home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip22.zip / tailor.h < prev    next >
C/C++ Source or Header  |  1997-10-31  |  7KB  |  381 lines

  1. /* tailor.h -- Not copyrighted 1993 Mark Adler */
  2.  
  3. #ifdef AMIGA
  4. #include "amiga/osdep.h"
  5. #endif
  6.  
  7. #ifdef AOSVS
  8. #include "aosvs/osdep.h"
  9. #endif
  10.  
  11. #ifdef ATARI
  12. #include "atari/osdep.h"
  13. #endif
  14.  
  15. #ifdef __BEOS__
  16. #include "beos/osdep.h"
  17. #endif
  18.  
  19. #ifdef DOS
  20. #include "msdos/osdep.h"
  21. #endif
  22.  
  23. #ifdef __human68k__
  24. #include "human68k/osdep.h"
  25. #endif
  26.  
  27. #ifdef OS2
  28. #include "os2/osdep.h"
  29. #endif
  30.  
  31. #ifdef __riscos
  32. #include "acorn/osdep.h"
  33. #endif
  34.  
  35. #ifdef QDOS
  36. #include "qdos/osdep.h"
  37. #endif
  38.  
  39. #ifdef __TANDEM
  40. #include "tandem.h"
  41. #endif
  42.  
  43. #ifdef UNIX
  44. #include "unix/osdep.h"
  45. #endif
  46.  
  47. #if defined(__COMPILER_KCC__) || defined(TOPS20)
  48. #include "tops20/osdep.h"
  49. #endif
  50.  
  51. #if defined(VMS) || defined(__VMS)
  52. #include "vms/osdep.h"
  53. #endif
  54.  
  55. #if defined(VM_CMS) || defined(MVS)
  56. #include "cmsmvs.h"
  57. #endif
  58.  
  59. #ifdef WIN32
  60. #include "win32/osdep.h"
  61. #endif
  62.  
  63. /* When "void" is an alias for "int", prototypes cannot be used. */
  64. #if (defined(NO_VOID) && !defined(NO_PROTO))
  65. #  define NO_PROTO
  66. #endif
  67.  
  68. /* Used to remove arguments in function prototypes for non-ANSI C */
  69. #ifndef NO_PROTO
  70. #  define OF(a) a
  71. #else /* NO_PROTO */
  72. #  define OF(a) ()
  73. #endif /* ?NO_PROTO */
  74.  
  75. /* Avoid using const if compiler does not support it */
  76. #if (!defined(ZCONST) && (!defined(NO_CONST) || defined(USE_CONST)))
  77. #  define ZCONST const
  78. #endif
  79.  
  80. #ifndef ZCONST
  81. #  define ZCONST
  82. #endif
  83.  
  84. /*
  85.  * case mapping functions. case_map is used to ignore case in comparisons,
  86.  * to_up is used to force upper case even on Unix (for dosify option).
  87.  */
  88. #ifdef USE_CASE_MAP
  89. #  define case_map(c) upper[(c) & 0xff]
  90. #  define to_up(c)    upper[(c) & 0xff]
  91. #else
  92. #  define case_map(c) (c)
  93. #  define to_up(c)    ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
  94. #endif /* USE_CASE_MAP */
  95.  
  96. /* Define void, zvoid, and extent (size_t) */
  97. #include <stdio.h>
  98.  
  99. #ifndef NO_STDDEF_H
  100. #  include <stddef.h>
  101. #endif /* !NO_STDDEF_H */
  102.  
  103. #ifndef NO_STDLIB_H
  104. #  include <stdlib.h>
  105. #endif /* !NO_STDLIB_H */
  106.  
  107. #ifndef NO_UNISTD_H
  108. #  include <unistd.h> /* usually defines _POSIX_VERSION */
  109. #endif /* !NO_UNISTD_H */
  110.  
  111. #ifndef NO_FCNTL_H
  112. #  include <fcntl.h>
  113. #endif /* !NO_FNCTL_H */
  114.  
  115. #ifndef NO_STRING_H
  116. #  include <string.h>
  117. #else
  118. #  include <strings.h>
  119. #endif /* NO_STRING_H */
  120.  
  121. #ifdef NO_VOID
  122. #  define void int
  123.    typedef char zvoid;
  124. #else /* !NO_VOID */
  125. # ifdef NO_TYPEDEF_VOID
  126. #  define zvoid void
  127. # else
  128.    typedef void zvoid;
  129. # endif
  130. #endif /* ?NO_VOID */
  131.  
  132. #ifdef NO_STRRCHR
  133. #  define strrchr rindex
  134. #endif
  135.  
  136. #ifdef NO_STRCHR
  137. #  define strchr index
  138. #endif
  139.  
  140. /*
  141.  * A couple of forward declarations that are needed on systems that do
  142.  * not supply C runtime library prototypes.
  143.  */
  144. #ifdef NO_PROTO
  145. char *strcpy();
  146. char *strcat();
  147. char *strrchr();
  148. /* XXX use !defined(ZMEM) && !defined(__hpux__) ? */
  149. #if !defined(ZMEM) && defined(NO_STRING_H)
  150. char *memset();
  151. char *memcpy();
  152. #endif /* !ZMEM && NO_STRING_H */
  153.  
  154. /* XXX use !defined(__hpux__) ? */
  155. #ifdef NO_STDLIB_H
  156. char *calloc();
  157. char *malloc();
  158. char *getenv();
  159. long atol();
  160. #endif /* NO_STDLIB_H */
  161.  
  162. #endif /* NO_PROTO */
  163.  
  164. #ifndef NO_MKTEMP
  165. char *mktemp();
  166. #endif /* !NO_MKTEMP */
  167.  
  168. /*
  169.  * SEEK_* macros, should be defined in stdio.h
  170.  */
  171. /* Define fseek() commands */
  172. #ifndef SEEK_SET
  173. #  define SEEK_SET 0
  174. #endif /* !SEEK_SET */
  175.  
  176. #ifndef SEEK_CUR
  177. #  define SEEK_CUR 1
  178. #endif /* !SEEK_CUR */
  179.  
  180. #ifndef FALSE
  181. #  define FALSE 0
  182. #endif
  183.  
  184. #ifndef TRUE
  185. #  define TRUE 1
  186. #endif
  187.  
  188. #ifdef NO_SIZE_T
  189.    typedef unsigned int extent;
  190. #else
  191.    typedef size_t extent;
  192. #endif
  193.  
  194. #ifdef NO_TIME_T
  195.    typedef long time_t;
  196. #endif
  197.  
  198. /* System independent replacement for "struct utimbuf", which is missing
  199.  * in many older OS environments.
  200.  */
  201. typedef struct ztimbuf {
  202.     time_t actime;              /* new access time */
  203.     time_t modtime;             /* new modification time */
  204. } ztimbuf;
  205.  
  206. /* This macro round a time_t value to the OS specific resolution */
  207. #ifndef ROUNDED_TIME
  208. #  define ROUNDED_TIME(time)   (time)
  209. #endif
  210.  
  211. /* Some systems define S_IFLNK but do not support symbolic links */
  212. #if defined (S_IFLNK) && defined(NO_SYMLINK)
  213. #  undef S_IFLNK
  214. #endif
  215.  
  216. #ifndef FOPR    /* fallback default definitions for FOPR, FOPM, FOPW: */
  217. #  define FOPR "r"
  218. #  define FOPM "r+"
  219. #  define FOPW "w"
  220. #endif /* fallback definition */
  221.  
  222. /* Open the old zip file in exclusive mode if possible (to avoid adding
  223.  * zip file to itself).
  224.  */
  225. #ifdef OS2
  226. #  define FOPR_EX FOPM
  227. #else
  228. #  define FOPR_EX FOPR
  229. #endif
  230.  
  231.  
  232. /* MDOS file attribute for directories */
  233. #define MSDOS_DIR_ATTR 0x10
  234.  
  235.  
  236. /* Define this symbol if your target allows access to unaligned data.
  237.  * This is not mandatory, just a speed optimization. The compressed
  238.  * output is strictly identical.
  239.  */
  240. #if (defined(MSDOS) && !defined(WIN32)) || defined(i386)
  241. #    define UNALIGNED_OK
  242. #endif
  243. #if defined(mc68020) || defined(vax)
  244. #    define UNALIGNED_OK
  245. #endif
  246.  
  247. #ifdef SMALL_MEM
  248. #   define CBSZ 2048 /* buffer size for copying files */
  249. #   define ZBSZ 2048 /* buffer size for temporary zip file */
  250. #endif
  251.  
  252. #ifdef MEDIUM_MEM
  253. #  define CBSZ 8192
  254. #  define ZBSZ 8192
  255. #endif
  256.  
  257. #ifndef CBSZ
  258. #  define CBSZ 16384
  259. #  define ZBSZ 16384
  260. #endif
  261.  
  262. #ifndef MEMORY16
  263. #  ifdef __WATCOMC__
  264. #    undef huge
  265. #    undef far
  266. #    undef near
  267. #  endif
  268. #  ifndef __IBMC__
  269. #    define huge
  270. #    define far
  271. #    define near
  272. #  endif
  273. #  define nearmalloc malloc
  274. #  define nearfree free
  275. #  define farmalloc malloc
  276. #  define farfree free
  277. #endif /* !MEMORY16 */
  278.  
  279. #if (defined(BIG_MEM) || defined(MMAP)) && !defined(DYN_ALLOC)
  280. #   define DYN_ALLOC
  281. #endif
  282.  
  283. #ifndef SSTAT
  284. #  define SSTAT      stat
  285. #endif
  286. #ifdef S_IFLNK
  287. #  define LSTAT      lstat
  288. #  define LSSTAT(n, s)  (linkput ? lstat((n), (s)) : SSTAT((n), (s)))
  289. #else
  290. #  define LSTAT      SSTAT
  291. #  define LSSTAT     SSTAT
  292. #endif
  293.  
  294. /* The following default definition of the second input for the crypthead()
  295.  * random seed computation can be used on most systems (all those that
  296.  * supply a UNIX compatible getpid() function).
  297.  */
  298. #ifdef ZCRYPT_INTERNAL
  299. #  ifndef ZCR_SEED2
  300. #    define ZCR_SEED2     (unsigned) getpid()   /* use PID as seed pattern */
  301. #  endif
  302. #endif /* ZCRYPT_INTERNAL */
  303.  
  304. /* The following OS codes are defined in pkzip appnote.txt */
  305. #ifdef AMIGA
  306. #  define OS_CODE  0x100
  307. #endif
  308. #ifdef VMS
  309. #  define OS_CODE  0x200
  310. #endif
  311. /* unix    3 */
  312. #ifdef VM_CMS
  313. #  define OS_CODE  0x400
  314. #endif
  315. #ifdef ATARI
  316. #  define OS_CODE  0x500
  317. #endif
  318. #ifdef OS2
  319. #  define OS_CODE  0x600
  320. #endif
  321. #ifdef MACOS
  322. #  define OS_CODE  0x700
  323. #endif
  324. /* z system 8 */
  325. /* cp/m     9 */
  326. #ifdef TOPS20
  327. #  define OS_CODE  0xa00
  328. #endif
  329. #ifdef WIN32
  330. #  define OS_CODE  0xb00
  331. #endif
  332. #ifdef QDOS
  333. #  define OS_CODE  0xc00
  334. #endif
  335. #ifdef RISCOS
  336. #  define OS_CODE  0xd00
  337. #endif
  338. #ifdef VFAT
  339. #  define OS_CODE  0xe00
  340. #endif
  341. #ifdef MVS
  342. #  define OS_CODE  0xf00
  343. #endif
  344. #ifdef __BEOS__
  345. #  define OS_CODE  0x1000
  346. #endif
  347. #ifdef TANDEM
  348. #  define OS_CODE  0x1100
  349. #endif
  350.  
  351. #define NUM_HOSTS 18
  352. /* Number of operating systems. Should be updated when new ports are made */
  353.  
  354. #if defined(DOS) && !defined(OS_CODE)
  355. #  define OS_CODE  0x000
  356. #endif
  357.  
  358. #ifndef OS_CODE
  359. #  define OS_CODE  0x300  /* assume Unix */
  360. #endif
  361.  
  362. /* can't use "return 0" from main() on VMS */
  363. #ifndef EXIT
  364. #  define EXIT  exit
  365. #endif
  366. #ifndef RETURN
  367. #  define RETURN return
  368. #endif
  369.  
  370. #ifndef ZIPERR
  371. #  define ZIPERR ziperr
  372. #endif
  373.  
  374. #ifndef MY_ZCALLOC /* Any system without a special calloc function */
  375. #  define zcalloc(items,size) \
  376.           (zvoid far *)calloc((unsigned)(items), (unsigned)(size))
  377. #  define zcfree    free
  378. #endif /* !MY_ZCALLOC */
  379.  
  380. /* end of tailor.h */
  381.