New upstream version 1.8
[debian/gzip] / tailor.h
1 /* tailor.h -- target dependent definitions
2
3    Copyright (C) 1997-1999, 2002, 2006, 2009-2016 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 STDC_HEADERS
60 #  define NO_SIZE_CHECK
61 #  define UNLINK_READONLY_BUG
62 #  define casemap(c) tolow(c) /* Force file names to lower case */
63 #  include <io.h>
64 #  define OS_CODE  0x00
65 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
66 #  if !defined(NO_ASM) && !defined(ASMV)
67 #    define ASMV
68 #  endif
69 #else
70 #  define near
71 #endif
72
73 #ifdef OS2
74 #  define PATH_SEP2 '\\'
75 #  define PATH_SEP3 ':'
76 #  define MAX_PATH_LEN  260
77 #  ifdef OS2FAT
78 #    define NO_MULTIPLE_DOTS
79 #    define MAX_EXT_CHARS 3
80 #    define Z_SUFFIX "z"
81 #    define casemap(c) tolow(c)
82 #  endif
83 #  define STDC_HEADERS
84 #  define UNLINK_READONLY_BUG
85 #  include <io.h>
86 #  define OS_CODE  0x06
87 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
88 #  ifdef _MSC_VER
89 #    define HAVE_SYS_UTIME_H
90 #    define MAXSEG_64K
91 #    undef near
92 #    define near _near
93 #  endif
94 #  ifdef __EMX__
95 #    define HAVE_SYS_UTIME_H
96 #    define EXPAND(argc,argv) \
97        {_response(&argc, &argv); _wildcard(&argc, &argv);}
98 #  endif
99 #  ifdef __BORLANDC__
100 #    define HAVE_UTIME_H
101 #  endif
102 #  ifdef __ZTC__
103 #    define NO_DIR 1
104 #    include <dos.h>
105 #    define EXPAND(argc,argv) \
106        {response_expand(&argc, &argv);}
107 #  endif
108 #endif
109
110 #ifdef WIN32 /* Windows NT */
111 #  define HAVE_SYS_UTIME_H
112 #  define PATH_SEP2 '\\'
113 #  define PATH_SEP3 ':'
114 #  define MAX_PATH_LEN  260
115 #  define STDC_HEADERS
116 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
117 #  define UNLINK_READONLY_BUG
118 #  include <io.h>
119 #  include <malloc.h>
120 #  ifdef NTFAT
121 #    define NO_MULTIPLE_DOTS
122 #    define MAX_EXT_CHARS 3
123 #    define Z_SUFFIX "z"
124 #    define casemap(c) tolow(c) /* Force file names to lower case */
125 #  endif
126 #  define OS_CODE  0x0b
127 #endif
128
129 #ifdef MSDOS
130 #  ifdef __TURBOC__
131 #    include <alloc.h>
132 #    define DYN_ALLOC
133      /* Turbo C 2.0 does not accept static allocations of large arrays */
134      void * fcalloc (unsigned items, unsigned size);
135      void fcfree (void *ptr);
136 #  else /* MSC */
137 #    include <malloc.h>
138 #    define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
139 #    define fcfree(ptr) hfree(ptr)
140 #  endif
141 #else
142 #  ifdef MAXSEG_64K
143 #    define fcalloc(items,size) calloc((items),(size))
144 #  else
145 #    define fcalloc(items,size) malloc((size_t)(items)*(size_t)(size))
146 #  endif
147 #  define fcfree(ptr) free(ptr)
148 #endif
149
150 #if defined(VAXC) || defined(VMS)
151 #  define PATH_SEP ']'
152 #  define PATH_SEP2 ':'
153 #  define SUFFIX_SEP ';'
154 #  define NO_MULTIPLE_DOTS
155 #  define NO_SIZE_CHECK
156 #  define Z_SUFFIX "-gz"
157 #  define RECORD_IO 1
158 #  define casemap(c) tolow(c)
159 #  define OS_CODE  0x02
160 #  define OPTIONS_VAR "GZIP_OPT"
161 #  define STDC_HEADERS
162 #  define EXPAND(argc,argv) vms_expand_args(&argc,&argv);
163 #  include <file.h>
164 #  define unlink delete
165 #  ifdef VAXC
166 #    include <unixio.h>
167 #  endif
168 #endif
169
170 #ifdef AMIGA
171 #  define PATH_SEP2 ':'
172 #  define STDC_HEADERS
173 #  define OS_CODE  0x01
174 #  define ASMV
175 #  ifdef __GNUC__
176 #    define HAVE_CHOWN
177 #    define HAVE_LSTAT
178 #  else /* SASC */
179 #    define HAVE_SYS_DIR_H
180 #    include <fcntl.h> /* for read() and write() */
181 #    define direct dirent
182      extern void _expand_args(int *argc, char ***argv);
183 #    define EXPAND(argc,argv) _expand_args(&argc,&argv);
184 #  endif
185 #endif
186
187 #if defined(ATARI) || defined(atarist)
188 #  define ASMV
189 #  define OS_CODE  0x05
190 #  ifdef TOSFS
191 #    define PATH_SEP2 '\\'
192 #    define PATH_SEP3 ':'
193 #    define MAX_PATH_LEN  128
194 #    define NO_MULTIPLE_DOTS
195 #    define MAX_EXT_CHARS 3
196 #    define Z_SUFFIX "z"
197 #    define casemap(c) tolow(c) /* Force file names to lower case */
198 #  endif
199 #endif
200
201 #ifdef TOPS20
202 #  define OS_CODE  0x0a
203 #endif
204
205 #ifndef SIGPIPE
206 # define SIGPIPE 0
207 #endif
208
209
210         /* Common defaults */
211
212 #ifndef OS_CODE
213 #  define OS_CODE  0x03  /* assume Unix */
214 #endif
215
216 #ifndef PATH_SEP
217 #  define PATH_SEP '/'
218 #endif
219
220 #ifndef casemap
221 #  define casemap(c) (c)
222 #endif
223
224 #ifndef OPTIONS_VAR
225 #  define OPTIONS_VAR "GZIP"
226 #endif
227
228 #ifndef Z_SUFFIX
229 #  define Z_SUFFIX ".gz"
230 #endif
231
232 #ifdef MAX_EXT_CHARS
233 #  define MAX_SUFFIX  MAX_EXT_CHARS
234 #else
235 #  define MAX_SUFFIX  30
236 #endif
237
238 #ifndef MAKE_LEGAL_NAME
239 #  ifdef NO_MULTIPLE_DOTS
240 #    define MAKE_LEGAL_NAME(name)   make_simple_name(name)
241 #  else
242 #    define MAKE_LEGAL_NAME(name)
243 #  endif
244 #endif
245
246 #ifndef MIN_PART
247 #  define MIN_PART 3
248    /* keep at least MIN_PART chars between dots in a file name. */
249 #endif
250
251 #ifndef EXPAND
252 #  define EXPAND(argc,argv)
253 #endif
254
255 #ifndef RECORD_IO
256 #  define RECORD_IO 0
257 #endif
258
259 #ifndef SET_BINARY_MODE
260 #  define SET_BINARY_MODE(fd)
261 #endif