1 /* system.h: system-dependent declarations; include this first.
2 $Id: system.h,v 1.14 1999/07/17 21:11:34 karl Exp $
4 Copyright (C) 1997, 98, 99 Free Software Foundation, Inc.
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)
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.
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 Foundation,
18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 #ifndef TEXINFO_SYSTEM_H
21 #define TEXINFO_SYSTEM_H
27 /* <unistd.h> should be included before any preprocessor test
31 #endif /* HAVE_UNISTD_H */
34 #include <sys/types.h>
40 #ifndef HAVE_SETLOCALE
41 #define setlocale(category,locale) /* empty */
44 /* For gettext (NLS). */
46 #define _(String) gettext (String)
47 #define N_(String) (String)
50 #define getopt system_getopt
54 extern char *getenv ();
57 /* Don't use bcopy! Use memmove if source and destination may overlap,
60 # if !STDC_HEADERS && HAVE_MEMORY_H
77 #ifndef HAVE_DECL_STRERROR
78 extern char *strerror ();
81 #ifndef HAVE_DECL_STRCASECMP
82 extern int strcasecmp ();
85 #ifndef HAVE_DECL_STRNCASECMP
86 extern int strncasecmp ();
89 #ifndef HAVE_DECL_STRCOLL
90 extern int strcoll ();
94 #if STAT_MACROS_BROKEN
97 #if !defined(S_ISDIR) && defined(S_IFDIR)
98 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
101 #ifdef HAVE_SYS_FILE_H
102 #include <sys/file.h>
103 #endif /* HAVE_SYS_FILE_H */
106 /* Since <fcntl.h> is POSIX, prefer that to <sys/fcntl.h>.
107 This also avoids some useless warnings on (at least) Linux. */
110 #else /* not HAVE_FCNTL_H */
111 #ifdef HAVE_SYS_FCNTL_H
112 #include <sys/fcntl.h>
113 #endif /* not HAVE_SYS_FCNTL_H */
114 #endif /* not HAVE_FCNTL_H */
115 #endif /* not O_RDONLY */
117 /* MS-DOS and similar non-Posix systems have some peculiarities:
118 - they distinguish between binary and text files;
119 - they use both `/' and `\\' as directory separator in file names;
120 - they can have a drive letter X: prepended to a file name;
121 - they have a separate root directory on each drive;
122 - their filesystems are case-insensitive;
123 - directories in environment variables (like INFOPATH) are separated
124 by `;' rather than `:';
125 - text files can have their lines ended either with \n or with \r\n pairs;
127 These are all parameterized here except the last, which is
128 handled by the source code as appropriate (mostly, in info/). */
131 # define O_BINARY _O_BINARY
135 #endif /* O_BINARY */
142 # define HAVE_LONG_FILENAMES(dir) (pathconf (dir, _PC_NAME_MAX) > 12)
143 # define NULL_DEVICE "/dev/null"
144 # else /* !__DJGPP__ */
145 # define HAVE_LONG_FILENAMES(dir) (0)
146 # define NULL_DEVICE "NUL"
147 # endif /* !__DJGPP__ */
148 # define SET_SCREEN_SIZE_HELPER terminal_prep_terminal()
149 # define DEFAULT_INFO_PRINT_COMMAND ">PRN"
150 # else /* !__MSDOS__ */
151 # define setmode(f,m) _setmode(f,m)
152 # define HAVE_LONG_FILENAMES(dir) (1)
153 # define NULL_DEVICE "NUL"
154 # endif /* !__MSDOS__ */
155 # define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0)
156 # define FOPEN_RBIN "rb"
157 # define FOPEN_WBIN "wb"
158 # define IS_SLASH(c) ((c) == '/' || (c) == '\\')
159 # define HAVE_DRIVE(n) ((n)[0] && (n)[1] == ':')
160 # define IS_ABSOLUTE(n) (IS_SLASH((n)[0]) || ((n)[0] && (n)[1] == ':'))
161 # define FILENAME_CMP strcasecmp
162 # define FILENAME_CMPN strncasecmp
163 # define PATH_SEP ";"
164 # define STRIP_DOT_EXE 1
165 # define DEFAULT_TMPDIR "c:/"
166 # define PIPE_USE_FORK 0
167 #else /* not O_BINARY */
168 # define SET_BINARY(f) (void)0
169 # define FOPEN_RBIN "r"
170 # define FOPEN_WBIN "w"
171 # define IS_SLASH(c) ((c) == '/')
172 # define HAVE_DRIVE(n) (0)
173 # define IS_ABSOLUTE(n) ((n)[0] == '/')
174 # define FILENAME_CMP strcmp
175 # define FILENAME_CMPN strncmp
176 # define HAVE_LONG_FILENAMES(dir) (1)
177 # define PATH_SEP ":"
178 # define STRIP_DOT_EXE 0
180 # define DEFAULT_TMPDIR "sys$scratch:"
182 # define DEFAULT_TMPDIR "/tmp/"
184 # define NULL_DEVICE "/dev/null"
185 # define PIPE_USE_FORK 1
186 #endif /* not O_BINARY */
191 /* Some systems don't declare this function in pwd.h. */
192 struct passwd *getpwnam ();
194 /* Our library routines not included in any system library. */
195 extern void *xmalloc (), *xrealloc ();
196 extern char *xstrdup ();
197 extern void xexit ();
198 extern char *substring ();
200 /* For convenience. */
201 #define STREQ(s1,s2) (strcmp (s1, s2) == 0)
203 #endif /* TEXINFO_SYSTEM_H */