Merge tag 'upstream/1.6'
[debian/gzip] / tailor.h
1 /* tailor.h -- target dependent definitions
2
3    Copyright (C) 1997-1999, 2002, 2006, 2009-2013 Free Software Foundation,
4    Inc.
5    Copyright (C) 1992-1993 Jean-loup Gailly
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3, or (at your option)
10    any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software Foundation,
19    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
20
21 /* The target dependent definitions should be defined here only.
22  * The target dependent functions should be defined in tailor.c.
23  */
24
25 #if defined(__MSDOS__) && !defined(MSDOS)
26 #  define MSDOS
27 #endif
28
29 #if defined(__OS2__) && !defined(OS2)
30 #  define OS2
31 #endif
32
33 #if defined(OS2) && defined(MSDOS) /* MS C under OS/2 */
34 #  undef MSDOS
35 #endif
36
37 #ifdef MSDOS
38 #  ifdef __GNUC__
39      /* DJGPP version 1.09+ on MS-DOS.
40       * The DJGPP 1.09 stat() function must be upgraded before gzip will
41       * fully work.
42       */
43 #    define near
44 #  else
45 #    define MAXSEG_64K
46 #    ifdef __TURBOC__
47 #      define off_t long
48 #      define HAVE_UTIME_H
49 #    else /* MSC */
50 #      define HAVE_SYS_UTIME_H
51 #    endif
52 #  endif
53 #  define PATH_SEP2 '\\'
54 #  define PATH_SEP3 ':'
55 #  define MAX_PATH_LEN  128
56 #  define NO_MULTIPLE_DOTS
57 #  define MAX_EXT_CHARS 3
58 #  define Z_SUFFIX "z"
59 #  define PROTO
60 #  define STDC_HEADERS
61 #  define NO_SIZE_CHECK
62 #  define UNLINK_READONLY_BUG
63 #  define casemap(c) tolow(c) /* Force file names to lower case */
64 #  include <io.h>
65 #  define OS_CODE  0x00
66 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
67 #  if !defined(NO_ASM) && !defined(ASMV)
68 #    define ASMV
69 #  endif
70 #else
71 #  define near
72 #endif
73
74 #ifdef OS2
75 #  define PATH_SEP2 '\\'
76 #  define PATH_SEP3 ':'
77 #  define MAX_PATH_LEN  260
78 #  ifdef OS2FAT
79 #    define NO_MULTIPLE_DOTS
80 #    define MAX_EXT_CHARS 3
81 #    define Z_SUFFIX "z"
82 #    define casemap(c) tolow(c)
83 #  endif
84 #  define PROTO
85 #  define STDC_HEADERS
86 #  define UNLINK_READONLY_BUG
87 #  include <io.h>
88 #  define OS_CODE  0x06
89 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
90 #  ifdef _MSC_VER
91 #    define HAVE_SYS_UTIME_H
92 #    define MAXSEG_64K
93 #    undef near
94 #    define near _near
95 #  endif
96 #  ifdef __EMX__
97 #    define HAVE_SYS_UTIME_H
98 #    define EXPAND(argc,argv) \
99        {_response(&argc, &argv); _wildcard(&argc, &argv);}
100 #  endif
101 #  ifdef __BORLANDC__
102 #    define HAVE_UTIME_H
103 #  endif
104 #  ifdef __ZTC__
105 #    define NO_DIR 1
106 #    include <dos.h>
107 #    define EXPAND(argc,argv) \
108        {response_expand(&argc, &argv);}
109 #  endif
110 #endif
111
112 #ifdef WIN32 /* Windows NT */
113 #  define HAVE_SYS_UTIME_H
114 #  define PATH_SEP2 '\\'
115 #  define PATH_SEP3 ':'
116 #  define MAX_PATH_LEN  260
117 #  define PROTO
118 #  define STDC_HEADERS
119 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
120 #  define UNLINK_READONLY_BUG
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 NO_SIZE_CHECK
159 #  define Z_SUFFIX "-gz"
160 #  define RECORD_IO 1
161 #  define casemap(c) tolow(c)
162 #  define OS_CODE  0x02
163 #  define OPTIONS_VAR "GZIP_OPT"
164 #  define STDC_HEADERS
165 #  define EXPAND(argc,argv) vms_expand_args(&argc,&argv);
166 #  include <file.h>
167 #  define unlink delete
168 #  ifdef VAXC
169 #    include <unixio.h>
170 #  endif
171 #endif
172
173 #ifdef AMIGA
174 #  define PATH_SEP2 ':'
175 #  define STDC_HEADERS
176 #  define OS_CODE  0x01
177 #  define ASMV
178 #  ifdef __GNUC__
179 #    define HAVE_CHOWN
180 #    define HAVE_LSTAT
181 #  else /* SASC */
182 #    define NO_STDIN_FSTAT
183 #    define HAVE_SYS_DIR_H
184 #    include <fcntl.h> /* for read() and write() */
185 #    define direct dirent
186      extern void _expand_args(int *argc, char ***argv);
187 #    define EXPAND(argc,argv) _expand_args(&argc,&argv);
188 #  endif
189 #endif
190
191 #if defined(ATARI) || defined(atarist)
192 #  define ASMV
193 #  define OS_CODE  0x05
194 #  ifdef TOSFS
195 #    define PATH_SEP2 '\\'
196 #    define PATH_SEP3 ':'
197 #    define MAX_PATH_LEN  128
198 #    define NO_MULTIPLE_DOTS
199 #    define MAX_EXT_CHARS 3
200 #    define Z_SUFFIX "z"
201 #    define casemap(c) tolow(c) /* Force file names to lower case */
202 #  endif
203 #endif
204
205 #ifdef MACOS
206 #  define PATH_SEP ':'
207 #  define DYN_ALLOC
208 #  define PROTO
209 #  define NO_STDIN_FSTAT
210 #  define chmod(file, mode) (0)
211 #  define OPEN(name, flags, mode) open(name, flags)
212 #  define OS_CODE  0x07
213 #  ifdef MPW
214 #    define isatty(fd) ((fd) <= 2)
215 #  endif
216 #endif
217
218 #ifdef TOPS20
219 #  define OS_CODE  0x0a
220 #endif
221
222
223         /* Common defaults */
224
225 #ifndef OS_CODE
226 #  define OS_CODE  0x03  /* assume Unix */
227 #endif
228
229 #ifndef PATH_SEP
230 #  define PATH_SEP '/'
231 #endif
232
233 #ifndef casemap
234 #  define casemap(c) (c)
235 #endif
236
237 #ifndef OPTIONS_VAR
238 #  define OPTIONS_VAR "GZIP"
239 #endif
240
241 #ifndef Z_SUFFIX
242 #  define Z_SUFFIX ".gz"
243 #endif
244
245 #ifdef MAX_EXT_CHARS
246 #  define MAX_SUFFIX  MAX_EXT_CHARS
247 #else
248 #  define MAX_SUFFIX  30
249 #endif
250
251 #ifndef MAKE_LEGAL_NAME
252 #  ifdef NO_MULTIPLE_DOTS
253 #    define MAKE_LEGAL_NAME(name)   make_simple_name(name)
254 #  else
255 #    define MAKE_LEGAL_NAME(name)
256 #  endif
257 #endif
258
259 #ifndef MIN_PART
260 #  define MIN_PART 3
261    /* keep at least MIN_PART chars between dots in a file name. */
262 #endif
263
264 #ifndef EXPAND
265 #  define EXPAND(argc,argv)
266 #endif
267
268 #ifndef RECORD_IO
269 #  define RECORD_IO 0
270 #endif
271
272 #ifndef SET_BINARY_MODE
273 #  define SET_BINARY_MODE(fd)
274 #endif
275
276 #ifndef OPEN
277 #  define OPEN(name, flags, mode) open_safer (name, flags, mode)
278 #endif