1
1
/* open-po - search for .po file along search path list and open for reading
2
Copyright (C) 1995-1996, 2000-2003, 2005-2007 Free Software Foundation, Inc.
2
Copyright (C) 1995-1996, 2000-2003, 2005-2009 Free Software Foundation, Inc.
3
3
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, April 1995.
5
5
This program is free software: you can redistribute it and/or modify
38
39
#define _(str) gettext (str)
40
/* This macro is used to determine the number of elements in an erray. */
41
/* This macro is used to determine the number of elements in an array. */
41
42
#define SIZEOF(a) (sizeof(a)/sizeof(a[0]))
61
62
if (IS_ABSOLUTE_PATH (input_name))
63
64
for (k = 0; k < SIZEOF (extension); ++k)
65
file_name = concatenated_filename ("", input_name, extension[k]);
67
ret_val = fopen (file_name, "r");
68
if (ret_val != NULL || errno != ENOENT)
70
/* We found the file. */
71
*real_file_name_p = file_name;
66
file_name = xconcatenated_filename ("", input_name, extension[k]);
68
ret_val = fopen (file_name, "r");
69
if (ret_val != NULL || errno != ENOENT)
71
/* We found the file. */
72
*real_file_name_p = file_name;
80
81
/* For relative file names, look through the directory search list,
81
trying the various extensions. If no directory search list is
82
specified, the current directory is used. */
82
trying the various extensions. If no directory search list is
83
specified, the current directory is used. */
83
84
for (j = 0; (dir = dir_list_nth (j)) != NULL; ++j)
84
for (k = 0; k < SIZEOF (extension); ++k)
86
file_name = concatenated_filename (dir, input_name, extension[k]);
88
ret_val = fopen (file_name, "r");
89
if (ret_val != NULL || errno != ENOENT)
91
*real_file_name_p = file_name;
85
for (k = 0; k < SIZEOF (extension); ++k)
87
file_name = xconcatenated_filename (dir, input_name, extension[k]);
89
ret_val = fopen (file_name, "r");
90
if (ret_val != NULL || errno != ENOENT)
92
*real_file_name_p = file_name;
99
100
/* File does not exist. */
118
119
const char *errno_description = strerror (errno);
119
120
po_xerror (PO_SEVERITY_FATAL_ERROR, NULL, NULL, 0, 0, false,
121
xasprintf (_("error while opening \"%s\" for reading"),
122
xasprintf (_("error while opening \"%s\" for reading"),