2
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
4
See the accompanying file LICENSE, version 1999-Oct-05 or later
5
(the contents of which are also included in zip.h) for terms of use.
6
If, for some reason, both of these files are missing, the Info-ZIP license
7
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
10
#include "amiga/osdep.h"
14
#include "aosvs/osdep.h"
18
#include "atari/osdep.h"
22
#include "beos/osdep.h"
26
#include "msdos/osdep.h"
30
#include "human68k/osdep.h"
33
#if ((defined(__MWERKS__) && defined(macintosh)) || defined(MACOS))
34
#include "macos/osdep.h"
38
#include "os2/osdep.h"
42
#include "acorn/osdep.h"
46
#include "qdos/osdep.h"
55
#include "unix/osdep.h"
58
#if defined(__COMPILER_KCC__) || defined(TOPS20)
59
#include "tops20/osdep.h"
62
#if defined(VMS) || defined(__VMS)
63
#include "vms/osdep.h"
66
#if defined(__VM__) || defined(VM_CMS) || defined(MVS)
71
#include "win32/osdep.h"
75
#include "theos/osdep.h"
78
#if (defined(USE_ZLIB) && defined(ASM_CRC))
82
#if (defined(USE_ZLIB) && defined(ASMV))
86
/* When "void" is an alias for "int", prototypes cannot be used. */
87
#if (defined(NO_VOID) && !defined(NO_PROTO))
91
/* Used to remove arguments in function prototypes for non-ANSI C */
96
#endif /* ?NO_PROTO */
98
/* If the compiler can't handle const define ZCONST in osdep.h */
99
/* Define const itself in case the system include files are bonkers */
105
# define ZCONST const
110
* case mapping functions. case_map is used to ignore case in comparisons,
111
* to_up is used to force upper case even on Unix (for dosify option).
114
# define case_map(c) upper[(c) & 0xff]
115
# define to_up(c) upper[(c) & 0xff]
117
# define case_map(c) (c)
118
# define to_up(c) ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
119
#endif /* USE_CASE_MAP */
121
/* Define void, zvoid, and extent (size_t) */
126
#endif /* !NO_STDDEF_H */
130
#endif /* !NO_STDLIB_H */
133
# include <unistd.h> /* usually defines _POSIX_VERSION */
134
#endif /* !NO_UNISTD_H */
138
#endif /* !NO_FNCTL_H */
143
# include <strings.h>
144
#endif /* NO_STRING_H */
150
# ifdef NO_TYPEDEF_VOID
153
#endif /* ?NO_VOID */
156
# define strrchr rindex
160
# define strchr index
164
* A couple of forward declarations that are needed on systems that do
165
* not supply C runtime library prototypes.
171
/* XXX use !defined(ZMEM) && !defined(__hpux__) ? */
172
#if !defined(ZMEM) && defined(NO_STRING_H)
175
#endif /* !ZMEM && NO_STRING_H */
177
/* XXX use !defined(__hpux__) ? */
183
#endif /* NO_STDLIB_H */
185
#endif /* NO_PROTO */
189
#endif /* !NO_MKTEMP */
192
* SEEK_* macros, should be defined in stdio.h
194
/* Define fseek() commands */
197
#endif /* !SEEK_SET */
201
#endif /* !SEEK_CUR */
212
typedef unsigned int extent;
214
typedef size_t extent;
221
/* DBCS support for Info-ZIP's zip (mainly for japanese (-: )
222
* by Yoshioka Tsuneo (QWF00133@nifty.ne.jp,tsuneo-y@is.aist-nara.ac.jp)
223
* This code is public domain! Date: 1998/12/20
228
/* Multi Byte Character Set */
229
extern char *___tmp_ptr;
230
unsigned char *zmbschr OF((ZCONST unsigned char *, unsigned int));
231
unsigned char *zmbsrchr OF((ZCONST unsigned char *, unsigned int));
232
# define CLEN(ptr) mblen(ptr, MB_CUR_MAX)
233
# define PREINCSTR(ptr) (ptr += CLEN(ptr))
234
# define POSTINCSTR(ptr) (___tmp_ptr=(char *)ptr,ptr += CLEN(ptr),___tmp_ptr)
235
int lastchar OF((ZCONST char *ptr));
236
# define MBSCHR(str,c) (char *)zmbschr((ZCONST unsigned char *)(str), c)
237
# define MBSRCHR(str,c) (char *)zmbsrchr((ZCONST unsigned char *)(str), (c))
238
# define SETLOCALE(category, locale) setlocale(category, locale)
241
# define PREINCSTR(ptr) (++(ptr))
242
# define POSTINCSTR(ptr) ((ptr)++)
243
# define lastchar(ptr) ((*(ptr)=='\0') ? '\0' : ptr[strlen(ptr)-1])
244
# define MBSCHR(str, c) strchr(str, c)
245
# define MBSRCHR(str, c) strrchr(str, c)
246
# define SETLOCALE(category, locale)
248
#define INCSTR(ptr) PREINCSTR(ptr)
251
/* System independent replacement for "struct utimbuf", which is missing
252
* in many older OS environments.
254
typedef struct ztimbuf {
255
time_t actime; /* new access time */
256
time_t modtime; /* new modification time */
259
/* This macro round a time_t value to the OS specific resolution */
261
# define ROUNDED_TIME(time) (time)
264
/* Some systems define S_IFLNK but do not support symbolic links */
265
#if defined (S_IFLNK) && defined(NO_SYMLINK)
269
#ifndef FOPR /* fallback default definitions for FOPR, FOPM, FOPW: */
273
#endif /* fallback definition */
275
#ifndef FOPW_TMP /* fallback default for opening writable temp files */
276
# define FOPW_TMP FOPW
279
/* Open the old zip file in exclusive mode if possible (to avoid adding
280
* zip file to itself).
283
# define FOPR_EX FOPM
285
# define FOPR_EX FOPR
289
/* MSDOS file or directory attributes */
290
#define MSDOS_HIDDEN_ATTR 0x02
291
#define MSDOS_DIR_ATTR 0x10
294
/* Define this symbol if your target allows access to unaligned data.
295
* This is not mandatory, just a speed optimization. The compressed
296
* output is strictly identical.
298
#if (defined(MSDOS) && !defined(WIN32)) || defined(i386)
299
# define UNALIGNED_OK
301
#if defined(mc68020) || defined(vax)
302
# define UNALIGNED_OK
305
#if (defined(SMALL_MEM) && !defined(CBSZ))
306
# define CBSZ 2048 /* buffer size for copying files */
307
# define ZBSZ 2048 /* buffer size for temporary zip file */
310
#if (defined(MEDIUM_MEM) && !defined(CBSZ))
321
# define SBSZ CBSZ /* copy buf size for STORED entries, see zipup() */
334
# if (!defined(__IBMC__) || !defined(OS2))
345
# define nearmalloc malloc
346
# define nearfree free
347
# define farmalloc malloc
348
# define farfree free
349
#endif /* !MEMORY16 */
355
#if (defined(BIG_MEM) || defined(MMAP)) && !defined(DYN_ALLOC)
364
# define LSSTAT(n, s) (linkput ? lstat((n), (s)) : SSTAT((n), (s)))
367
# define LSSTAT SSTAT
370
/* The following default definition of the second input for the crypthead()
371
* random seed computation can be used on most systems (all those that
372
* supply a UNIX compatible getpid() function).
374
#ifdef ZCRYPT_INTERNAL
376
# define ZCR_SEED2 (unsigned) getpid() /* use PID as seed pattern */
378
#endif /* ZCRYPT_INTERNAL */
380
/* The following OS codes are defined in pkzip appnote.txt */
382
# define OS_CODE 0x100
385
# define OS_CODE 0x200
389
# define OS_CODE 0x400
392
# define OS_CODE 0x500
395
# define OS_CODE 0x600
398
# define OS_CODE 0x700
403
# define OS_CODE 0xa00
406
# define OS_CODE 0xb00
409
# define OS_CODE 0xc00
412
# define OS_CODE 0xd00
415
# define OS_CODE 0xe00
418
# define OS_CODE 0xf00
421
# define OS_CODE 0x1000
424
# define OS_CODE 0x1100
427
# define OS_CODE 0x1200
431
/* Number of operating systems. Should be updated when new ports are made */
433
#if defined(DOS) && !defined(OS_CODE)
434
# define OS_CODE 0x000
438
# define OS_CODE 0x300 /* assume Unix */
441
/* can't use "return 0" from main() on VMS */
447
# define RETURN return
451
# define ZIPERR ziperr
454
#if (defined(USE_ZLIB) && defined(MY_ZCALLOC))
455
/* special zcalloc function is not needed when linked against zlib */
459
#if (!defined(USE_ZLIB) && !defined(MY_ZCALLOC))
460
/* Any system without a special calloc function */
461
# define zcalloc(items,size) \
462
(zvoid far *)calloc((unsigned)(items), (unsigned)(size))
464
#endif /* !USE_ZLIB && !MY_ZCALLOC */
466
/* end of tailor.h */