156160Sru/* filesys.h -- external declarations for filesys.c.
2146515Sru   $Id: filesys.h,v 1.3 2004/04/11 17:56:45 karl Exp $
321495Sjmacd
4146515Sru   Copyright (C) 1993, 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
521495Sjmacd
621495Sjmacd   This program is free software; you can redistribute it and/or modify
721495Sjmacd   it under the terms of the GNU General Public License as published by
821495Sjmacd   the Free Software Foundation; either version 2, or (at your option)
921495Sjmacd   any later version.
1021495Sjmacd
1121495Sjmacd   This program is distributed in the hope that it will be useful,
1221495Sjmacd   but WITHOUT ANY WARRANTY; without even the implied warranty of
1321495Sjmacd   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1421495Sjmacd   GNU General Public License for more details.
1521495Sjmacd
1621495Sjmacd   You should have received a copy of the GNU General Public License
1721495Sjmacd   along with this program; if not, write to the Free Software
1821495Sjmacd   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1921495Sjmacd
2021495Sjmacd   Written by Brian Fox (bfox@ai.mit.edu). */
2121495Sjmacd
2242660Smarkm#ifndef INFO_FILESYS_H
2342660Smarkm#define INFO_FILESYS_H
2421495Sjmacd
2521495Sjmacd/* The path on which we look for info files.  You can initialize this
2621495Sjmacd   from the environment variable INFOPATH if there is one, or you can
2721495Sjmacd   call info_add_path () to add paths to the beginning or end of it. */
2821495Sjmacdextern char *infopath;
2921495Sjmacd
3021495Sjmacd/* Make INFOPATH have absolutely nothing in it. */
31146515Sruextern void zap_infopath (void);
3221495Sjmacd
3321495Sjmacd/* Add PATH to the list of paths found in INFOPATH.  2nd argument says
3421495Sjmacd   whether to put PATH at the front or end of INFOPATH. */
35146515Sruextern void info_add_path (char *path, int where);
3621495Sjmacd
3721495Sjmacd/* Defines that are passed along with the pathname to info_add_path (). */
3821495Sjmacd#define INFOPATH_PREPEND 0
3921495Sjmacd#define INFOPATH_APPEND  1
4021495Sjmacd
4121495Sjmacd/* Expand the filename in PARTIAL to make a real name for this operating
4221495Sjmacd   system.  This looks in INFO_PATHS in order to find the correct file.
4321495Sjmacd   If it can't find the file, it returns NULL. */
44146515Sruextern char *info_find_fullpath (char *partial);
4521495Sjmacd
4656160Sru/* Given a chunk of text and its length, convert all CRLF pairs at the
4756160Sru   EOLs into a single Newline character.  Return the length of produced
4856160Sru   text.  */
49146515Srulong convert_eols (char *text, long textlen);
5056160Sru
5121495Sjmacd/* Read the contents of PATHNAME, returning a buffer with the contents of
5221495Sjmacd   that file in it, and returning the size of that buffer in FILESIZE.
5321495Sjmacd   FINFO is a stat struct which has already been filled in by the caller.
5421495Sjmacd   If the file cannot be read, return a NULL pointer. */
55146515Sruextern char *filesys_read_info_file (char *pathname, long int *filesize,
56146515Sru    struct stat *finfo, int *is_compressed);
5721495Sjmacd
58146515Sruextern char *filesys_read_compressed (char *pathname, long int *filesize);
59146515Sru
6021495Sjmacd/* Return the command string that would be used to decompress FILENAME. */
61146515Sruextern char *filesys_decompressor_for_file (char *filename);
62146515Sruextern int compressed_filename_p (char *filename);
6321495Sjmacd
6421495Sjmacd/* A function which returns a pointer to a static buffer containing
6521495Sjmacd   an error message for FILENAME and ERROR_NUM. */
66146515Sruextern char *filesys_error_string (char *filename, int error_num);
6721495Sjmacd
6821495Sjmacd/* The number of the most recent file system error. */
6921495Sjmacdextern int filesys_error_number;
7021495Sjmacd
7121495Sjmacd/* Given a string containing units of information separated by colons,
7221495Sjmacd   return the next one pointed to by IDX, or NULL if there are no more.
7321495Sjmacd   Advance IDX to the character after the colon. */
74146515Sruextern char *extract_colon_unit (char *string, int *idx);
7521495Sjmacd
7656160Sru/* Return true if FILENAME is `dir', with a possible compression suffix.  */
77146515Sruextern int is_dir_name (char *filename);
7856160Sru
7921495Sjmacd/* The default value of INFOPATH. */
8021495Sjmacd#if !defined (DEFAULT_INFOPATH)
8142660Smarkm#  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:."
8221495Sjmacd#endif /* !DEFAULT_INFOPATH */
8321495Sjmacd
8421495Sjmacd#if !defined (S_ISREG) && defined (S_IFREG)
8521495Sjmacd#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
8621495Sjmacd#endif /* !S_ISREG && S_IFREG */
8721495Sjmacd
8821495Sjmacd#if !defined (S_ISDIR) && defined (S_IFDIR)
8921495Sjmacd#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
9021495Sjmacd#endif /* !S_ISDIR && S_IFDIR */
9121495Sjmacd
9242660Smarkm#endif /* not INFO_FILESYS_H */
93