* zgrep.in: If the file name contains newline, &, \, or |, escape
[gzip.git] / tailor.h
blob2de59b7b6ea18ec8a16b66d85dab32ca4ee374e2
1 /* tailor.h -- target dependent definitions
3 Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
4 Copyright (C) 1992-1993 Jean-loup Gailly
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 /* The target dependent definitions should be defined here only.
21 * The target dependent functions should be defined in tailor.c.
24 /* $Id$ */
26 #if defined(__MSDOS__) && !defined(MSDOS)
27 # define MSDOS
28 #endif
30 #if defined(__OS2__) && !defined(OS2)
31 # define OS2
32 #endif
34 #if defined(OS2) && defined(MSDOS) /* MS C under OS/2 */
35 # undef MSDOS
36 #endif
38 #ifdef MSDOS
39 # ifdef __GNUC__
40 /* DJGPP version 1.09+ on MS-DOS.
41 * The DJGPP 1.09 stat() function must be upgraded before gzip will
42 * fully work.
43 * No need for HAVE_DIRENT_H, since <unistd.h> defines POSIX_SOURCE which
44 * implies HAVE_DIRENT_H.
46 # define near
47 # else
48 # define MAXSEG_64K
49 # ifdef __TURBOC__
50 # define off_t long
51 # ifdef __BORLANDC__
52 # define HAVE_DIRENT_H
53 # endif
54 # define HAVE_UTIME_H
55 # else /* MSC */
56 # define HAVE_SYS_UTIME_H
57 # endif
58 # endif
59 # define PATH_SEP2 '\\'
60 # define PATH_SEP3 ':'
61 # define MAX_PATH_LEN 128
62 # define NO_MULTIPLE_DOTS
63 # define MAX_EXT_CHARS 3
64 # define Z_SUFFIX "z"
65 # define PROTO
66 # define STDC_HEADERS
67 # define NO_SIZE_CHECK
68 # define UNLINK_READONLY_BUG
69 # define casemap(c) tolow(c) /* Force file names to lower case */
70 # include <io.h>
71 # define OS_CODE 0x00
72 # define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
73 # if !defined(NO_ASM) && !defined(ASMV)
74 # define ASMV
75 # endif
76 #else
77 # define near
78 #endif
80 #ifdef OS2
81 # define PATH_SEP2 '\\'
82 # define PATH_SEP3 ':'
83 # define MAX_PATH_LEN 260
84 # ifdef OS2FAT
85 # define NO_MULTIPLE_DOTS
86 # define MAX_EXT_CHARS 3
87 # define Z_SUFFIX "z"
88 # define casemap(c) tolow(c)
89 # endif
90 # define PROTO
91 # define STDC_HEADERS
92 # define UNLINK_READONLY_BUG
93 # include <io.h>
94 # define OS_CODE 0x06
95 # define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
96 # ifdef _MSC_VER
97 # define HAVE_SYS_UTIME_H
98 # define MAXSEG_64K
99 # undef near
100 # define near _near
101 # endif
102 # ifdef __EMX__
103 # define HAVE_SYS_UTIME_H
104 # define HAVE_DIRENT_H
105 # define EXPAND(argc,argv) \
106 {_response(&argc, &argv); _wildcard(&argc, &argv);}
107 # endif
108 # ifdef __BORLANDC__
109 # define HAVE_DIRENT_H
110 # define HAVE_UTIME_H
111 # endif
112 # ifdef __ZTC__
113 # define NO_DIR 1
114 # include <dos.h>
115 # define EXPAND(argc,argv) \
116 {response_expand(&argc, &argv);}
117 # endif
118 #endif
120 #ifdef WIN32 /* Windows NT */
121 # define HAVE_SYS_UTIME_H
122 # define PATH_SEP2 '\\'
123 # define PATH_SEP3 ':'
124 # define MAX_PATH_LEN 260
125 # define PROTO
126 # define STDC_HEADERS
127 # define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
128 # define UNLINK_READONLY_BUG
129 # include <io.h>
130 # include <malloc.h>
131 # ifdef NTFAT
132 # define NO_MULTIPLE_DOTS
133 # define MAX_EXT_CHARS 3
134 # define Z_SUFFIX "z"
135 # define casemap(c) tolow(c) /* Force file names to lower case */
136 # endif
137 # define OS_CODE 0x0b
138 #endif
140 #ifdef MSDOS
141 # ifdef __TURBOC__
142 # include <alloc.h>
143 # define DYN_ALLOC
144 /* Turbo C 2.0 does not accept static allocations of large arrays */
145 void * fcalloc (unsigned items, unsigned size);
146 void fcfree (void *ptr);
147 # else /* MSC */
148 # include <malloc.h>
149 # define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
150 # define fcfree(ptr) hfree(ptr)
151 # endif
152 #else
153 # ifdef MAXSEG_64K
154 # define fcalloc(items,size) calloc((items),(size))
155 # else
156 # define fcalloc(items,size) malloc((size_t)(items)*(size_t)(size))
157 # endif
158 # define fcfree(ptr) free(ptr)
159 #endif
161 #if defined(VAXC) || defined(VMS)
162 # define PATH_SEP ']'
163 # define PATH_SEP2 ':'
164 # define SUFFIX_SEP ';'
165 # define NO_MULTIPLE_DOTS
166 # define Z_SUFFIX "-gz"
167 # define RECORD_IO 1
168 # define casemap(c) tolow(c)
169 # define OS_CODE 0x02
170 # define OPTIONS_VAR "GZIP_OPT"
171 # define STDC_HEADERS
172 # define EXPAND(argc,argv) vms_expand_args(&argc,&argv);
173 # include <file.h>
174 # define unlink delete
175 # ifdef VAXC
176 # include <unixio.h>
177 # else
178 # define HAVE_FCNTL_H
179 # endif
180 #endif
182 #ifdef AMIGA
183 # define PATH_SEP2 ':'
184 # define STDC_HEADERS
185 # define OS_CODE 0x01
186 # define ASMV
187 # ifdef __GNUC__
188 # define HAVE_DIRENT_H
189 # define HAVE_FCNTL_H
190 # define HAVE_UNISTD_H
191 # define HAVE_CHOWN
192 # define HAVE_LSTAT
193 # else /* SASC */
194 # define NO_STDIN_FSTAT
195 # define HAVE_SYS_DIR_H
196 # include <fcntl.h> /* for read() and write() */
197 # define direct dirent
198 extern void _expand_args(int *argc, char ***argv);
199 # define EXPAND(argc,argv) _expand_args(&argc,&argv);
200 # undef O_BINARY /* disable useless --ascii option */
201 # endif
202 #endif
204 #if defined(ATARI) || defined(atarist)
205 # ifndef STDC_HEADERS
206 # define STDC_HEADERS
207 # define HAVE_UNISTD_H
208 # define HAVE_DIRENT_H
209 # endif
210 # define ASMV
211 # define OS_CODE 0x05
212 # ifdef TOSFS
213 # define PATH_SEP2 '\\'
214 # define PATH_SEP3 ':'
215 # define MAX_PATH_LEN 128
216 # define NO_MULTIPLE_DOTS
217 # define MAX_EXT_CHARS 3
218 # define Z_SUFFIX "z"
219 # define casemap(c) tolow(c) /* Force file names to lower case */
220 # endif
221 #endif
223 #ifdef MACOS
224 # define PATH_SEP ':'
225 # define DYN_ALLOC
226 # define PROTO
227 # define NO_STDIN_FSTAT
228 # define chmod(file, mode) (0)
229 # define OPEN(name, flags, mode) open(name, flags)
230 # define OS_CODE 0x07
231 # ifdef MPW
232 # define isatty(fd) ((fd) <= 2)
233 # endif
234 #endif
236 #ifdef __50SERIES /* Prime/PRIMOS */
237 # define PATH_SEP '>'
238 # define STDC_HEADERS
239 # define NO_STDIN_FSTAT
240 # define NO_SIZE_CHECK
241 # define RECORD_IO 1
242 # define casemap(c) tolow(c) /* Force file names to lower case */
243 # define put_char(c) put_byte((c) & 0x7F)
244 # define get_char(c) ascii2pascii(get_byte())
245 # define OS_CODE 0x0F /* temporary, subject to change */
246 # ifdef SIGTERM
247 # undef SIGTERM /* We don't want a signal handler for SIGTERM */
248 # endif
249 #endif
251 #if defined(pyr) && !defined(NOMEMCPY) /* Pyramid */
252 # define NOMEMCPY /* problem with overlapping copies */
253 #endif
255 #ifdef TOPS20
256 # define OS_CODE 0x0a
257 #endif
259 #ifndef unix
260 # define NO_ST_INO /* don't rely on inode numbers */
261 #endif
264 /* Common defaults */
266 #ifndef OS_CODE
267 # define OS_CODE 0x03 /* assume Unix */
268 #endif
270 #ifndef PATH_SEP
271 # define PATH_SEP '/'
272 #endif
274 #ifndef casemap
275 # define casemap(c) (c)
276 #endif
278 #ifndef OPTIONS_VAR
279 # define OPTIONS_VAR "GZIP"
280 #endif
282 #ifndef Z_SUFFIX
283 # define Z_SUFFIX ".gz"
284 #endif
286 #ifdef MAX_EXT_CHARS
287 # define MAX_SUFFIX MAX_EXT_CHARS
288 #else
289 # define MAX_SUFFIX 30
290 #endif
292 #ifndef MAKE_LEGAL_NAME
293 # ifdef NO_MULTIPLE_DOTS
294 # define MAKE_LEGAL_NAME(name) make_simple_name(name)
295 # else
296 # define MAKE_LEGAL_NAME(name)
297 # endif
298 #endif
300 #ifndef MIN_PART
301 # define MIN_PART 3
302 /* keep at least MIN_PART chars between dots in a file name. */
303 #endif
305 #ifndef EXPAND
306 # define EXPAND(argc,argv)
307 #endif
309 #ifndef RECORD_IO
310 # define RECORD_IO 0
311 #endif
313 #ifndef SET_BINARY_MODE
314 # define SET_BINARY_MODE(fd)
315 #endif
317 #ifndef OPEN
318 # define OPEN(name, flags, mode) open_safer (name, flags, mode)
319 #endif
321 #ifndef get_char
322 # define get_char() get_byte()
323 #endif
325 #ifndef put_char
326 # define put_char(c) put_byte(c)
327 #endif