filesys.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* filesys.h -- external declarations for filesys.c.
  2. $Id$
  3. Copyright 1993, 1997, 1998, 2002, 2004, 2005, 2007, 2009, 2012, 2013,
  4. 2014, 2016 Free Software Foundation, Inc.
  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. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. Originally written by Brian Fox. */
  16. #ifndef INFO_FILESYS_H
  17. #define INFO_FILESYS_H
  18. /* Return a string describing the search path. */
  19. extern char *infopath_string ();
  20. /* Initialize INFOPATH */
  21. void infopath_init (void);
  22. /* Add PATH to the list of paths found in INFOPATH. */
  23. void infopath_add (char *path);
  24. /* Iterate over INFOPATH */
  25. char *infopath_first (int *idx);
  26. char *infopath_next (int *idx);
  27. /* Expand the filename in PARTIAL to make a real name for this operating
  28. system. This looks in INFO_PATHS in order to find the correct file.
  29. If it can't find the file, it returns NULL. */
  30. char *info_find_fullpath (char *partial, struct stat *finfo);
  31. /* Scan the list of directories in PATH looking for FILENAME. If we find
  32. one that is a regular file, return it as a new string. Otherwise, return
  33. a NULL pointer. */
  34. char *info_file_find_next_in_path (char *filename, int *diridx,
  35. struct stat *finfo);
  36. char *info_add_extension (char *dirname, char *filename, struct stat *finfo);
  37. /* Read the contents of PATHNAME, returning a buffer with the contents of
  38. that file in it, and returning the size of that buffer in FILESIZE.
  39. FINFO is a stat struct which has already been filled in by the caller.
  40. If the file cannot be read, return a NULL pointer. */
  41. char *filesys_read_info_file (char *pathname, size_t *filesize,
  42. struct stat *finfo, int *is_compressed);
  43. /* A function which returns a pointer to a static buffer containing
  44. an error message for FILENAME and ERROR_NUM. */
  45. char *filesys_error_string (char *filename, int error_num);
  46. /* The number of the most recent file system error. */
  47. extern int filesys_error_number;
  48. /* Return true if FILENAME is `dir', with a possible compression suffix. */
  49. int is_dir_name (char *filename);
  50. /* The default value of INFOPATH. */
  51. #if !defined (DEFAULT_INFOPATH)
  52. # 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:."
  53. #endif /* !DEFAULT_INFOPATH */
  54. #if !defined (S_ISREG) && defined (S_IFREG)
  55. # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  56. #endif /* !S_ISREG && S_IFREG */
  57. #if !defined (S_ISDIR) && defined (S_IFDIR)
  58. # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  59. #endif /* !S_ISDIR && S_IFDIR */
  60. #endif /* not INFO_FILESYS_H */