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