misc: update --version copyright
[debian/gzip] / tailor.h
1 /* tailor.h -- target dependent definitions
2
3    Copyright (C) 1997-1999, 2002, 2006, 2009-2017 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 MAX_PATH_LEN  128
54 #  define NO_MULTIPLE_DOTS
55 #  define MAX_EXT_CHARS 3
56 #  define Z_SUFFIX "z"
57 #  define NO_SIZE_CHECK
58 #  define UNLINK_READONLY_BUG
59 #  define casemap(c) tolow(c) /* Force file names to lower case */
60 #  include <io.h>
61 #  define OS_CODE  0x00
62 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
63 #  if !defined(NO_ASM) && !defined(ASMV)
64 #    define ASMV
65 #  endif
66 #else
67 #  define near
68 #endif
69
70 #ifdef OS2
71 #  define MAX_PATH_LEN  260
72 #  ifdef OS2FAT
73 #    define NO_MULTIPLE_DOTS
74 #    define MAX_EXT_CHARS 3
75 #    define Z_SUFFIX "z"
76 #    define casemap(c) tolow(c)
77 #  endif
78 #  define UNLINK_READONLY_BUG
79 #  include <io.h>
80 #  define OS_CODE  0x06
81 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
82 #  ifdef _MSC_VER
83 #    define HAVE_SYS_UTIME_H
84 #    define MAXSEG_64K
85 #    undef near
86 #    define near _near
87 #  endif
88 #  ifdef __EMX__
89 #    define HAVE_SYS_UTIME_H
90 #    define EXPAND(argc,argv) \
91        {_response(&argc, &argv); _wildcard(&argc, &argv);}
92 #  endif
93 #  ifdef __BORLANDC__
94 #    define HAVE_UTIME_H
95 #  endif
96 #  ifdef __ZTC__
97 #    define NO_DIR 1
98 #    include <dos.h>
99 #    define EXPAND(argc,argv) \
100        {response_expand(&argc, &argv);}
101 #  endif
102 #endif
103
104 #if defined WIN32 || defined _WIN32
105 #  define HAVE_SYS_UTIME_H
106 #  define MAX_PATH_LEN  260
107 #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
108 #  define UNLINK_READONLY_BUG
109 #  include <io.h>
110 #  include <malloc.h>
111 #  ifdef NTFAT
112 #    define NO_MULTIPLE_DOTS
113 #    define MAX_EXT_CHARS 3
114 #    define Z_SUFFIX "z"
115 #    define casemap(c) tolow(c) /* Force file names to lower case */
116 #  endif
117 #  define OS_CODE  0x0b
118 #endif
119
120 #ifdef MSDOS
121 #  ifdef __TURBOC__
122 #    include <alloc.h>
123 #    define DYN_ALLOC
124      /* Turbo C 2.0 does not accept static allocations of large arrays */
125      void * fcalloc (unsigned items, unsigned size);
126      void fcfree (void *ptr);
127 #  else /* MSC */
128 #    include <malloc.h>
129 #    define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
130 #    define fcfree(ptr) hfree(ptr)
131 #  endif
132 #else
133 #  ifdef MAXSEG_64K
134 #    define fcalloc(items,size) calloc((items),(size))
135 #  else
136 #    define fcalloc(items,size) malloc((size_t)(items)*(size_t)(size))
137 #  endif
138 #  define fcfree(ptr) free(ptr)
139 #endif
140
141 #if defined(ATARI) || defined(atarist)
142 #  define OS_CODE  0x05
143 #  ifdef TOSFS
144 #    define MAX_PATH_LEN  128
145 #    define NO_MULTIPLE_DOTS
146 #    define MAX_EXT_CHARS 3
147 #    define Z_SUFFIX "z"
148 #    define casemap(c) tolow(c) /* Force file names to lower case */
149 #  endif
150 #endif
151
152 #ifdef TOPS20
153 #  define OS_CODE  0x0a
154 #endif
155
156 #ifndef SIGPIPE
157 # define SIGPIPE 0
158 #endif
159
160
161         /* Common defaults */
162
163 #ifndef OS_CODE
164 #  define OS_CODE  0x03  /* assume Unix */
165 #endif
166
167 #ifndef casemap
168 #  define casemap(c) (c)
169 #endif
170
171 #ifndef OPTIONS_VAR
172 #  define OPTIONS_VAR "GZIP"
173 #endif
174
175 #ifndef Z_SUFFIX
176 #  define Z_SUFFIX ".gz"
177 #endif
178
179 #ifdef MAX_EXT_CHARS
180 #  define MAX_SUFFIX  MAX_EXT_CHARS
181 #else
182 #  define MAX_SUFFIX  30
183 #endif
184
185 #ifndef MAKE_LEGAL_NAME
186 #  ifdef NO_MULTIPLE_DOTS
187 #    define MAKE_LEGAL_NAME(name)   make_simple_name(name)
188 #  else
189 #    define MAKE_LEGAL_NAME(name)
190 #  endif
191 #endif
192
193 #ifndef MIN_PART
194 #  define MIN_PART 3
195    /* keep at least MIN_PART chars between dots in a file name. */
196 #endif
197
198 #ifndef EXPAND
199 #  define EXPAND(argc,argv)
200 #endif
201
202 #ifndef SET_BINARY_MODE
203 #  define SET_BINARY_MODE(fd)
204 #endif
205
206 #ifndef FALLTHROUGH
207 # if __GNUC__ < 7
208 #  define FALLTHROUGH ((void) 0)
209 # else
210 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
211 # endif
212 #endif