| 1 |
/* |
| 2 |
Copyright (c) 1990-2008 Info-ZIP. All rights reserved. |
| 3 |
|
| 4 |
See the accompanying file LICENSE, version 2007-Mar-4 or later |
| 5 |
(the contents of which are also included in zip.h) for terms of use. |
| 6 |
If, for some reason, all these files are missing, the Info-ZIP license |
| 7 |
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html |
| 8 |
*/ |
| 9 |
/* The symbol DOS is used throughout the Zip source to identify code portions |
| 10 |
* specific to the MSDOS port. |
| 11 |
* Just to make sure, we check that it is set. |
| 12 |
* (Currently, this should should not be neccessary, since currently it has |
| 13 |
* to be set on the compiler command line to get this file read in.) |
| 14 |
*/ |
| 15 |
#ifndef DOS |
| 16 |
# define DOS |
| 17 |
#endif |
| 18 |
|
| 19 |
/* The symbol MSDOS is consistently used in the generic source files |
| 20 |
* to identify code to support for MSDOS (and MSDOS related) stuff. |
| 21 |
* e.g: FAT or (FAT like) file systems, |
| 22 |
* '\\' as directory separator in paths, |
| 23 |
* "\r\n" as record (line) terminator in text files, ... |
| 24 |
* |
| 25 |
* IMPORTANT Note: |
| 26 |
* This symbol is not unique for the MSDOS port !!!!!! |
| 27 |
* It is also defined by ports to some other OS which are (to some extend) |
| 28 |
* considered DOS compatible. |
| 29 |
* Examples are: OS/2 (OS2), Windows NT and Windows 95 (WIN32). |
| 30 |
* |
| 31 |
*/ |
| 32 |
#ifndef MSDOS |
| 33 |
# define MSDOS |
| 34 |
#endif |
| 35 |
|
| 36 |
/* Power C is similar to Turbo C */ |
| 37 |
#ifdef __POWERC |
| 38 |
# define __TURBOC__ |
| 39 |
#endif /* __POWERC */ |
| 40 |
|
| 41 |
/* Automatic setting of the common Microsoft C idenfifier MSC. |
| 42 |
* NOTE: Watcom also defines M_I*86 ! |
| 43 |
*/ |
| 44 |
#if defined(_MSC_VER) || (defined(M_I86) && !defined(__WATCOMC__)) |
| 45 |
# ifndef MSC |
| 46 |
# define MSC /* This should work for older MSC, too! */ |
| 47 |
# endif |
| 48 |
#endif |
| 49 |
|
| 50 |
#if !defined(__GO32__) && !defined(__EMX__) |
| 51 |
# define NO_UNISTD_H |
| 52 |
#endif |
| 53 |
|
| 54 |
#if defined(__WATCOMC__) && defined(__386__) |
| 55 |
# define WATCOMC_386 |
| 56 |
#endif |
| 57 |
|
| 58 |
#ifdef WINDLL |
| 59 |
# define MSWIN |
| 60 |
# define MEMORY16 |
| 61 |
#endif |
| 62 |
|
| 63 |
|
| 64 |
#if !defined(__EMX__) && !defined(__GO32__) && !defined(WATCOMC_386) |
| 65 |
#if !defined(WINDLL) |
| 66 |
# define MSDOS16 /* 16 bit MSDOS only */ |
| 67 |
# define MEMORY16 |
| 68 |
#endif |
| 69 |
#endif |
| 70 |
|
| 71 |
#if !defined(NO_ASM) && !defined(ASMV) |
| 72 |
# define ASMV |
| 73 |
#endif |
| 74 |
|
| 75 |
/* enable creation of UTC time fields unless explicitely suppressed */ |
| 76 |
#if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME) |
| 77 |
# define USE_EF_UT_TIME |
| 78 |
#endif |
| 79 |
|
| 80 |
/* check that TZ environment variable is defined before using UTC times */ |
| 81 |
#if (!defined(NO_IZ_CHECK_TZ) && !defined(IZ_CHECK_TZ)) |
| 82 |
# define IZ_CHECK_TZ |
| 83 |
#endif |
| 84 |
|
| 85 |
#ifdef MEMORY16 |
| 86 |
# ifndef NO_ASM |
| 87 |
# define ASM_CRC 1 |
| 88 |
# endif /* ?NO_ASM */ |
| 89 |
# ifdef __TURBOC__ |
| 90 |
# include <alloc.h> |
| 91 |
# if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__) |
| 92 |
# if defined(DYNAMIC_CRC_TABLE) && defined(DYNALLOC_CRCTAB) |
| 93 |
error: No dynamic CRC table allocation with Borland C far data models. |
| 94 |
# endif /* DYNAMIC_CRC_TABLE */ |
| 95 |
# endif /* Turbo/Borland C far data memory models */ |
| 96 |
# define nearmalloc malloc |
| 97 |
# define nearfree free |
| 98 |
# define DYN_ALLOC |
| 99 |
# else /* !__TURBOC__ */ |
| 100 |
# include <malloc.h> |
| 101 |
# define nearmalloc _nmalloc |
| 102 |
# define nearfree _nfree |
| 103 |
# define farmalloc _fmalloc |
| 104 |
# define farfree _ffree |
| 105 |
# endif /* ?__TURBOC__ */ |
| 106 |
# define MY_ZCALLOC 1 |
| 107 |
# ifdef SMALL_MEM |
| 108 |
# define CBSZ 2048 |
| 109 |
# define ZBSZ 2048 |
| 110 |
# endif |
| 111 |
# ifdef MEDIUM_MEM |
| 112 |
# define CBSZ 4096 |
| 113 |
# define ZBSZ 4096 |
| 114 |
# endif |
| 115 |
# ifndef CBSZ |
| 116 |
# define CBSZ 8192 |
| 117 |
# define ZBSZ 8192 |
| 118 |
# endif |
| 119 |
#endif /* MEMORY16 */ |
| 120 |
|
| 121 |
|
| 122 |
/* Symbolic links are not supported, but some compilers may define S_IFLNK. */ |
| 123 |
#ifndef NO_SYMLINKS |
| 124 |
# define NO_SYMLINKS |
| 125 |
#endif |
| 126 |
|
| 127 |
#ifdef MATCH |
| 128 |
# undef MATCH |
| 129 |
#endif |
| 130 |
#define MATCH dosmatch /* use DOS style wildcard matching */ |
| 131 |
|
| 132 |
#define USE_CASE_MAP |
| 133 |
|
| 134 |
#define ROUNDED_TIME(time) (((time) + 1) & (~1)) |
| 135 |
#define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \ |
| 136 |
procname(n, 1)) |
| 137 |
|
| 138 |
#define FOPR "rb" |
| 139 |
#define FOPM "r+b" |
| 140 |
#define FOPW "wb" |
| 141 |
|
| 142 |
#include <sys/types.h> |
| 143 |
#include <sys/stat.h> |
| 144 |
#include <io.h> |
| 145 |
|
| 146 |
#ifdef ZCRYPT_INTERNAL |
| 147 |
# ifdef WINDLL |
| 148 |
# define ZCR_SEED2 (unsigned)3141592654L /* use PI as seed pattern */ |
| 149 |
# else |
| 150 |
# ifndef __GO32__ |
| 151 |
# include <process.h> /* getpid() declaration for srand seed */ |
| 152 |
# endif |
| 153 |
# endif |
| 154 |
#endif |
| 155 |
|
| 156 |
/* |
| 157 |
* djgpp 1.x did not declare these |
| 158 |
*/ |
| 159 |
#if defined(__GO32__) && !defined(__DJGPP__) |
| 160 |
char *strlwr(char *); |
| 161 |
int setmode(int, int); |
| 162 |
#endif |
| 163 |
|
| 164 |
#ifdef __WATCOMC__ |
| 165 |
# define NO_MKTEMP |
| 166 |
# define HAS_OPENDIR |
| 167 |
# define SSTAT stat_bandaid |
| 168 |
int stat_bandaid(const char *path, struct stat *buf); |
| 169 |
|
| 170 |
/* Get asm routines to link properly without using "__cdecl": */ |
| 171 |
# ifdef __386__ |
| 172 |
# ifdef ASMV |
| 173 |
# pragma aux match_init "_*" parm caller [] modify [] |
| 174 |
# pragma aux longest_match "_*" parm caller [] value [eax] \ |
| 175 |
modify [eax ecx edx] |
| 176 |
# endif |
| 177 |
# ifndef USE_ZLIB |
| 178 |
# pragma aux crc32 "_*" parm caller [] value [eax] modify [eax] |
| 179 |
# pragma aux get_crc_table "_*" parm caller [] value [eax] \ |
| 180 |
modify [eax ecx edx] |
| 181 |
# endif /* !USE_ZLIB */ |
| 182 |
# else /* !__386__ */ |
| 183 |
# ifdef ASMV |
| 184 |
# pragma aux match_init "_*" parm caller [] loadds modify [ax bx] |
| 185 |
# pragma aux longest_match "_*" parm caller [] loadds value [ax] \ |
| 186 |
modify [ax bx cx dx es] |
| 187 |
# endif /* ASMV */ |
| 188 |
# ifndef USE_ZLIB |
| 189 |
# pragma aux crc32 "_*" parm caller [] value [ax dx] \ |
| 190 |
modify [ax bx cx dx es] |
| 191 |
# pragma aux get_crc_table "_*" parm caller [] value [ax] \ |
| 192 |
modify [ax bx cx dx] |
| 193 |
# endif /* !USE_ZLIB */ |
| 194 |
# endif /* ?__386__ */ |
| 195 |
#endif /* __WATCOMC__ */ |
| 196 |
|
| 197 |
/* |
| 198 |
* Wrapper function to get around the MSC7 00:00:00 31 Dec 1899 time base, |
| 199 |
* see msdos.c for more info |
| 200 |
*/ |
| 201 |
|
| 202 |
#if defined(_MSC_VER) && _MSC_VER == 700 |
| 203 |
# define localtime(t) msc7_localtime(t) |
| 204 |
#endif |
| 205 |
|
| 206 |
#ifdef __TURBOC__ |
| 207 |
# ifdef __FILEIO_C |
| 208 |
# include <dir.h> /* supplies mktemp() prototype */ |
| 209 |
# endif |
| 210 |
#endif |
| 211 |
|
| 212 |
#if (defined(__TURBOC__) && !defined(__BORLANDC__) && __TURBOC__ <= 0x0201) |
| 213 |
# ifndef NO_MKTIME |
| 214 |
# define NO_MKTIME /* TC 2.01 and earlier do not supply mktime() */ |
| 215 |
# endif |
| 216 |
#endif |
| 217 |
|
| 218 |
void check_for_windows(char *app); |