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