1 /* pathsrch.h: environment-variable path searching for files, possibly
4 Copyright 1992 Karl Berry
5 Copyright 2007 TeX Users Group
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 /* Look for FILENAME in each of the directories given in the DIR_LIST
29 array. (Unless DIR_LIST is null, or FILENAME is absolute or
30 explicitly relative, in which case we just look at FILENAME.) Return
31 the complete pathname of the first readable file found, or NULL. */
32 extern string find_path_filename P2H(string filename, string *dir_list);
34 /* new version that does not allocate memory 1996/Jan/20 */
36 extern int xfind_path_filename P3H(string buffer, string filename, string *dir_list);
38 /* Return a NULL-terminated array of all the directory names in the
39 value of the environment variable ENV_NAME (or DEFAULT_PATH if it is
40 not set). Each directory in the list ends with the directory separator,
43 A leading or trailing path separator (e.g., `:') in the value of
44 ENV_NAME is replaced by DEFAULT_PATH.
46 If any element of the path ends with a double directory separator
47 (e.g., `foo//'), it is replaced by all its subdirectories. */
48 extern string *initialize_path_list P2H(string env_name, string default_path);
50 /* Replace a leading or trailing `:' in ENV_PATH with DEFAULT_PATH. If
51 neither is present, return ENV_PATH if that is non-null, else
53 extern string expand_default P2H(string env_path, string default_path);
55 /* Replace a leading ~ or ~name in FILENAME with getenv ("HOME") or
56 name's home directory. */
57 extern string expand_tilde P1H(string filename);
59 #endif /* not PATHSEARCH_H */