1 /* filesys.h -- external declarations for filesys.c.
2
3 Copyright 1993-2023 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 Originally written by Brian Fox. */
19
20 #ifndef INFO_FILESYS_H
21 #define INFO_FILESYS_H
22
23 /* Return a string describing the search path. */
24 extern char *infopath_string ();
25
26 /* Initialize INFOPATH */
27 void infopath_init (void);
28
29 /* Add PATH to the list of paths found in INFOPATH. */
30 void infopath_add (char *path);
31
32 /* Iterate over INFOPATH */
33 char *infopath_first (int *idx);
34 char *infopath_next (int *idx);
35
36 /* Expand the filename in PARTIAL to make a real name for this operating
37 system. This looks in INFO_PATHS in order to find the correct file.
38 If it can't find the file, it returns NULL. */
39 char *info_find_fullpath (char *partial, struct stat *finfo);
40
41 /* Scan the list of directories in PATH looking for FILENAME. If we find
42 one that is a regular file, return it as a new string. Otherwise, return
43 a NULL pointer. */
44 char *info_file_find_next_in_path (char *filename, int *diridx,
45 struct stat *finfo);
46
47 char *info_check_compressed (char *try_filename, struct stat *finfo);
48
49 char *info_add_extension (char *dirname, char *filename, struct stat *finfo);
50
51 /* Read the contents of PATHNAME, returning a buffer with the contents of
52 that file in it, and returning the size of that buffer in FILESIZE.
53 FINFO is a stat struct which has already been filled in by the caller.
54 If the file cannot be read, return a NULL pointer. */
55 char *filesys_read_info_file (char *pathname, size_t *filesize,
56 struct stat *finfo, int *is_compressed);
57
58 /* A function which returns a pointer to a static buffer containing
59 an error message for FILENAME and ERROR_NUM. */
60 char *filesys_error_string (char *filename, int error_num);
61
62 /* The number of the most recent file system error. */
63 extern int filesys_error_number;
64
65 /* Return true if FILENAME is `dir', with a possible compression suffix. */
66 int is_dir_name (char *filename);
67
68 /* The default value of INFOPATH. */
69 #if !defined (DEFAULT_INFOPATH)
70 # define DEFAULT_INFOPATH "PATH:/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info:."
71 #endif /* !DEFAULT_INFOPATH */
72
73 #if !defined (S_ISREG) && defined (S_IFREG)
74 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
75 #endif /* !S_ISREG && S_IFREG */
76
77 #if !defined (S_ISDIR) && defined (S_IFDIR)
78 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
79 #endif /* !S_ISDIR && S_IFDIR */
80
81 #endif /* not INFO_FILESYS_H */