Imported Upstream version 1.3.14
[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 #  ifndef STDC_HEADERS
204 #    define STDC_HEADERS
205 #    define HAVE_UNISTD_H
206 #    define HAVE_DIRENT_H
207 #  endif
208 #  define ASMV
209 #  define OS_CODE  0x05
210 #  ifdef TOSFS
211 #    define PATH_SEP2 '\\'
212 #    define PATH_SEP3 ':'
213 #    define MAX_PATH_LEN  128
214 #    define NO_MULTIPLE_DOTS
215 #    define MAX_EXT_CHARS 3
216 #    define Z_SUFFIX "z"
217 #    define casemap(c) tolow(c) /* Force file names to lower case */
218 #  endif
219 #endif
220
221 #ifdef MACOS
222 #  define PATH_SEP ':'
223 #  define DYN_ALLOC
224 #  define PROTO
225 #  define NO_STDIN_FSTAT
226 #  define chmod(file, mode) (0)
227 #  define OPEN(name, flags, mode) open(name, flags)
228 #  define OS_CODE  0x07
229 #  ifdef MPW
230 #    define isatty(fd) ((fd) <= 2)
231 #  endif
232 #endif
233
234 #ifdef __50SERIES /* Prime/PRIMOS */
235 #  define PATH_SEP '>'
236 #  define STDC_HEADERS
237 #  define NO_STDIN_FSTAT
238 #  define NO_SIZE_CHECK
239 #  define RECORD_IO  1
240 #  define casemap(c)  tolow(c) /* Force file names to lower case */
241 #  define put_char(c) put_byte((c) & 0x7F)
242 #  define get_char(c) ascii2pascii(get_byte())
243 #  define OS_CODE  0x0F    /* temporary, subject to change */
244 #  ifdef SIGTERM
245 #    undef SIGTERM         /* We don't want a signal handler for SIGTERM */
246 #  endif
247 #endif
248
249 #if defined(pyr) && !defined(NOMEMCPY) /* Pyramid */
250 #  define NOMEMCPY /* problem with overlapping copies */
251 #endif
252
253 #ifdef TOPS20
254 #  define OS_CODE  0x0a
255 #endif
256
257
258         /* Common defaults */
259
260 #ifndef OS_CODE
261 #  define OS_CODE  0x03  /* assume Unix */
262 #endif
263
264 #ifndef PATH_SEP
265 #  define PATH_SEP '/'
266 #endif
267
268 #ifndef casemap
269 #  define casemap(c) (c)
270 #endif
271
272 #ifndef OPTIONS_VAR
273 #  define OPTIONS_VAR "GZIP"
274 #endif
275
276 #ifndef Z_SUFFIX
277 #  define Z_SUFFIX ".gz"
278 #endif
279
280 #ifdef MAX_EXT_CHARS
281 #  define MAX_SUFFIX  MAX_EXT_CHARS
282 #else
283 #  define MAX_SUFFIX  30
284 #endif
285
286 #ifndef MAKE_LEGAL_NAME
287 #  ifdef NO_MULTIPLE_DOTS
288 #    define MAKE_LEGAL_NAME(name)   make_simple_name(name)
289 #  else
290 #    define MAKE_LEGAL_NAME(name)
291 #  endif
292 #endif
293
294 #ifndef MIN_PART
295 #  define MIN_PART 3
296    /* keep at least MIN_PART chars between dots in a file name. */
297 #endif
298
299 #ifndef EXPAND
300 #  define EXPAND(argc,argv)
301 #endif
302
303 #ifndef RECORD_IO
304 #  define RECORD_IO 0
305 #endif
306
307 #ifndef SET_BINARY_MODE
308 #  define SET_BINARY_MODE(fd)
309 #endif
310
311 #ifndef OPEN
312 #  define OPEN(name, flags, mode) open_safer (name, flags, mode)
313 #endif
314
315 #ifndef get_char
316 #  define get_char() get_byte()
317 #endif
318
319 #ifndef put_char
320 #  define put_char(c) put_byte(c)
321 #endif