1/* filesys.h -- external declarations for filesys.c.
2   $Id: filesys.h,v 1.3 2004/04/11 17:56:45 karl Exp $
3
4   Copyright (C) 1993, 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20   Written by Brian Fox (bfox@ai.mit.edu). */
21
22#ifndef INFO_FILESYS_H
23#define INFO_FILESYS_H
24
25/* The path on which we look for info files.  You can initialize this
26   from the environment variable INFOPATH if there is one, or you can
27   call info_add_path () to add paths to the beginning or end of it. */
28extern char *infopath;
29
30/* Make INFOPATH have absolutely nothing in it. */
31extern void zap_infopath (void);
32
33/* Add PATH to the list of paths found in INFOPATH.  2nd argument says
34   whether to put PATH at the front or end of INFOPATH. */
35extern void info_add_path (char *path, int where);
36
37/* Defines that are passed along with the pathname to info_add_path (). */
38#define INFOPATH_PREPEND 0
39#define INFOPATH_APPEND  1
40
41/* Expand the filename in PARTIAL to make a real name for this operating
42   system.  This looks in INFO_PATHS in order to find the correct file.
43   If it can't find the file, it returns NULL. */
44extern char *info_find_fullpath (char *partial);
45
46/* Given a chunk of text and its length, convert all CRLF pairs at the
47   EOLs into a single Newline character.  Return the length of produced
48   text.  */
49long convert_eols (char *text, long textlen);
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. */
55extern char *filesys_read_info_file (char *pathname, long int *filesize,
56    struct stat *finfo, int *is_compressed);
57
58extern char *filesys_read_compressed (char *pathname, long int *filesize);
59
60/* Return the command string that would be used to decompress FILENAME. */
61extern char *filesys_decompressor_for_file (char *filename);
62extern int compressed_filename_p (char *filename);
63
64/* A function which returns a pointer to a static buffer containing
65   an error message for FILENAME and ERROR_NUM. */
66extern char *filesys_error_string (char *filename, int error_num);
67
68/* The number of the most recent file system error. */
69extern int filesys_error_number;
70
71/* Given a string containing units of information separated by colons,
72   return the next one pointed to by IDX, or NULL if there are no more.
73   Advance IDX to the character after the colon. */
74extern char *extract_colon_unit (char *string, int *idx);
75
76/* Return true if FILENAME is `dir', with a possible compression suffix.  */
77extern int is_dir_name (char *filename);
78
79/* The default value of INFOPATH. */
80#if !defined (DEFAULT_INFOPATH)
81#  define DEFAULT_INFOPATH "/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:."
82#endif /* !DEFAULT_INFOPATH */
83
84#if !defined (S_ISREG) && defined (S_IFREG)
85#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
86#endif /* !S_ISREG && S_IFREG */
87
88#if !defined (S_ISDIR) && defined (S_IFDIR)
89#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
90#endif /* !S_ISDIR && S_IFDIR */
91
92#endif /* not INFO_FILESYS_H */
93