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