filesys.h revision 146515
1139743Simp/* filesys.h -- external declarations for filesys.c. 243412Snewton $Id: filesys.h,v 1.3 2004/04/11 17:56:45 karl Exp $ 343412Snewton 443412Snewton Copyright (C) 1993, 1997, 1998, 2002, 2004 Free Software Foundation, Inc. 543412Snewton 643412Snewton This program is free software; you can redistribute it and/or modify 743412Snewton it under the terms of the GNU General Public License as published by 843412Snewton the Free Software Foundation; either version 2, or (at your option) 943412Snewton any later version. 1043412Snewton 1143412Snewton This program is distributed in the hope that it will be useful, 1243412Snewton but WITHOUT ANY WARRANTY; without even the implied warranty of 1343412Snewton MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1443412Snewton GNU General Public License for more details. 1543412Snewton 1643412Snewton You should have received a copy of the GNU General Public License 1743412Snewton along with this program; if not, write to the Free Software 1843412Snewton Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 1943412Snewton 2043412Snewton Written by Brian Fox (bfox@ai.mit.edu). */ 2143412Snewton 2243412Snewton#ifndef INFO_FILESYS_H 2343412Snewton#define INFO_FILESYS_H 2443412Snewton 2543412Snewton/* The path on which we look for info files. You can initialize this 2643412Snewton from the environment variable INFOPATH if there is one, or you can 2743412Snewton call info_add_path () to add paths to the beginning or end of it. */ 2843412Snewtonextern char *infopath; 29116174Sobrien 30116174Sobrien/* Make INFOPATH have absolutely nothing in it. */ 31116174Sobrienextern void zap_infopath (void); 3243412Snewton 3343412Snewton/* Add PATH to the list of paths found in INFOPATH. 2nd argument says 3443412Snewton whether to put PATH at the front or end of INFOPATH. */ 3543412Snewtonextern void info_add_path (char *path, int where); 3643412Snewton 3790002Salfred/* Defines that are passed along with the pathname to info_add_path (). */ 3843412Snewton#define INFOPATH_PREPEND 0 3943412Snewton#define INFOPATH_APPEND 1 4043412Snewton 4143412Snewton/* Expand the filename in PARTIAL to make a real name for this operating 4290002Salfred system. This looks in INFO_PATHS in order to find the correct file. 43121275Stjr If it can't find the file, it returns NULL. */ 44121275Stjrextern char *info_find_fullpath (char *partial); 4543412Snewton 4643412Snewton/* Given a chunk of text and its length, convert all CRLF pairs at the 4743412Snewton EOLs into a single Newline character. Return the length of produced 4865302Sobrien text. */ 4965302Sobrienlong convert_eols (char *text, long textlen); 5065302Sobrien 5165302Sobrien/* Read the contents of PATHNAME, returning a buffer with the contents of 5265302Sobrien that file in it, and returning the size of that buffer in FILESIZE. 5365302Sobrien FINFO is a stat struct which has already been filled in by the caller. 5465302Sobrien If the file cannot be read, return a NULL pointer. */ 5543412Snewtonextern char *filesys_read_info_file (char *pathname, long int *filesize, 5643412Snewton struct stat *finfo, int *is_compressed); 5743412Snewton 5843412Snewtonextern char *filesys_read_compressed (char *pathname, long int *filesize); 5983366Sjulian 6083366Sjulian/* Return the command string that would be used to decompress FILENAME. */ 6143412Snewtonextern char *filesys_decompressor_for_file (char *filename); 6243412Snewtonextern int compressed_filename_p (char *filename); 6343412Snewton 6443412Snewton/* A function which returns a pointer to a static buffer containing 6543412Snewton an error message for FILENAME and ERROR_NUM. */ 6643412Snewtonextern char *filesys_error_string (char *filename, int error_num); 6743412Snewton 6843412Snewton/* The number of the most recent file system error. */ 69125454Sjhbextern int filesys_error_number; 70125454Sjhb 71125454Sjhb/* Given a string containing units of information separated by colons, 72125454Sjhb return the next one pointed to by IDX, or NULL if there are no more. 73125454Sjhb Advance IDX to the character after the colon. */ 74125454Sjhbextern char *extract_colon_unit (char *string, int *idx); 75125454Sjhb 76121275Stjr/* Return true if FILENAME is `dir', with a possible compression suffix. */ 77107849Salfredextern int is_dir_name (char *filename); 78107849Salfred 79107849Salfred/* The default value of INFOPATH. */ 8043412Snewton#if !defined (DEFAULT_INFOPATH) 81107849Salfred# 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:." 82111119Simp#endif /* !DEFAULT_INFOPATH */ 8343412Snewton 8483366Sjulian#if !defined (S_ISREG) && defined (S_IFREG) 8543412Snewton# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 86107849Salfred#endif /* !S_ISREG && S_IFREG */ 8743412Snewton 8843412Snewton#if !defined (S_ISDIR) && defined (S_IFDIR) 8943412Snewton# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 9043412Snewton#endif /* !S_ISDIR && S_IFDIR */ 91107849Salfred 9243412Snewton#endif /* not INFO_FILESYS_H */ 9343412Snewton