1/* 2 tailor.h - Zip 3 3 4 Copyright (c) 1990-2008 Info-ZIP. All rights reserved. 5 6 See the accompanying file LICENSE, version 2007-Mar-4 or later 7 (the contents of which are also included in zip.h) for terms of use. 8 If, for some reason, all these files are missing, the Info-ZIP license 9 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 10*/ 11 12/* Some compiler distributions for Win32/i386 systems try to emulate 13 * a Unix (POSIX-compatible) environment. 14 */ 15#if (defined(WIN32) && defined(UNIX)) 16 /* Zip does not support merging both ports in a single executable. */ 17# if (defined(FORCE_WIN32_OVER_UNIX) && defined(FORCE_UNIX_OVER_WIN32)) 18 /* conflicting choice requests -> we prefer the Win32 environment */ 19# undef FORCE_UNIX_OVER_WIN32 20# endif 21# ifdef FORCE_WIN32_OVER_UNIX 22 /* native Win32 support was explicitely requested... */ 23# undef UNIX 24# else 25 /* use the POSIX (Unix) emulation features by default... */ 26# undef WIN32 27# endif 28#endif 29 30 31/* UNICODE */ 32#ifdef NO_UNICODE_SUPPORT 33# ifdef UNICODE_SUPPORT 34# undef UNICODE_SUPPORT 35# endif 36#endif 37 38 39#ifdef AMIGA 40#include "amiga/osdep.h" 41#endif 42 43#ifdef AOSVS 44#include "aosvs/osdep.h" 45#endif 46 47#ifdef ATARI 48#include "atari/osdep.h" 49#endif 50 51#ifdef __ATHEOS__ 52#include "atheos/osdep.h" 53#endif 54 55#ifdef __BEOS__ 56#include "beos/osdep.h" 57#endif 58 59#ifdef DOS 60#include "msdos/osdep.h" 61#endif 62 63#ifdef __human68k__ 64#include "human68k/osdep.h" 65#endif 66 67#if ((defined(__MWERKS__) && defined(macintosh)) || defined(MACOS)) 68#include "macos/osdep.h" 69#endif 70 71#ifdef NLM 72#include "novell/osdep.h" 73#endif 74 75#ifdef OS2 76#include "os2/osdep.h" 77#endif 78 79#ifdef __riscos 80#include "acorn/osdep.h" 81#endif 82 83#ifdef QDOS 84#include "qdos/osdep.h" 85#endif 86 87#ifdef __TANDEM 88#include "tandem.h" 89#include "tanzip.h" 90#endif 91 92#ifdef UNIX 93#include "unix/osdep.h" 94#endif 95 96#if defined(__COMPILER_KCC__) || defined(TOPS20) 97#include "tops20/osdep.h" 98#endif 99 100#if defined(VMS) || defined(__VMS) 101#include "vms/osdep.h" 102#endif 103 104#if defined(__VM__) || defined(VM_CMS) || defined(MVS) 105#include "cmsmvs.h" 106#endif 107 108#ifdef WIN32 109#include "win32/osdep.h" 110#endif 111 112#ifdef THEOS 113#include "theos/osdep.h" 114#endif 115 116 117/* generic LARGE_FILE_SUPPORT defines 118 These get used if not defined above. 119 7/21/2004 EG 120*/ 121/* If a port hasn't defined ZOFF_T_FORMAT_SIZE_PREFIX 122 then probably need to define all of these. */ 123#ifndef ZOFF_T_FORMAT_SIZE_PREFIX 124 125# ifdef LARGE_FILE_SUPPORT 126 /* Probably passed in from command line instead of in above 127 includes if get here. Assume large file support and hope. 8/14/04 EG */ 128 129 /* Set the Large File Summit (LFS) defines to turn on large file support 130 in case it helps. */ 131 132# define _LARGEFILE_SOURCE /* some OSes need this for fseeko */ 133# define _LARGEFILE64_SOURCE 134# define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */ 135# define _LARGE_FILES /* some OSes need this for 64-bit off_t */ 136 137 typedef off_t zoff_t; 138 typedef unsigned long long uzoff_t; /* unsigned zoff_t (12/29/04 EG) */ 139 140 /* go with common prefix */ 141# define ZOFF_T_FORMAT_SIZE_PREFIX "ll" 142 143# else 144 /* Default type for offsets and file sizes was ulg but reports 145 of using ulg to create files from 2 GB to 4 GB suggest 146 it doesn't work well. Now just switch to Zip64 or not 147 support over 2 GB. 7/24/04 EG */ 148 /* Now use uzoff_t for unsigned things. 12/29/04 EG */ 149 typedef long zoff_t; 150 typedef unsigned long uzoff_t; 151 152# define ZOFF_T_FORMAT_SIZE_PREFIX "l" 153 154# endif 155 156 typedef struct stat z_stat; 157 158 /* flag that we are defaulting */ 159# define USING_DEFAULT_LARGE_FILE_SUPPORT 160#endif 161 162 163#if (defined(USE_ZLIB) && defined(ASM_CRC)) 164# undef ASM_CRC 165#endif 166 167#if (defined(USE_ZLIB) && defined(ASMV)) 168# undef ASMV 169#endif 170 171/* When "void" is an alias for "int", prototypes cannot be used. */ 172#if (defined(NO_VOID) && !defined(NO_PROTO)) 173# define NO_PROTO 174#endif 175 176/* Used to remove arguments in function prototypes for non-ANSI C */ 177#ifndef NO_PROTO 178# define OF(a) a 179# define OFT(a) a 180#else /* NO_PROTO */ 181# define OF(a) () 182# define OFT(a) 183#endif /* ?NO_PROTO */ 184 185/* If the compiler can't handle const define ZCONST in osdep.h */ 186/* Define const itself in case the system include files are bonkers */ 187#ifndef ZCONST 188# ifdef NO_CONST 189# define ZCONST 190# define const 191# else 192# define ZCONST const 193# endif 194#endif 195 196/* 197 * Some compiler environments may require additional attributes attached 198 * to declarations of runtime libary functions (e.g. to prepare for 199 * linking against a "shared dll" version of the RTL). Here, we provide 200 * the "empty" default for these attributes. 201 */ 202#ifndef IZ_IMP 203# define IZ_IMP 204#endif 205 206/* 207 * case mapping functions. case_map is used to ignore case in comparisons, 208 * to_up is used to force upper case even on Unix (for dosify option). 209 */ 210#ifdef USE_CASE_MAP 211# define case_map(c) upper[(c) & 0xff] 212# define to_up(c) upper[(c) & 0xff] 213#else 214# define case_map(c) (c) 215# define to_up(c) ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c)) 216#endif /* USE_CASE_MAP */ 217 218/* Define void, zvoid, and extent (size_t) */ 219#include <stdio.h> 220 221#ifndef NO_STDDEF_H 222# include <stddef.h> 223#endif /* !NO_STDDEF_H */ 224 225#ifndef NO_STDLIB_H 226# include <stdlib.h> 227#endif /* !NO_STDLIB_H */ 228 229#ifndef NO_UNISTD_H 230# include <unistd.h> /* usually defines _POSIX_VERSION */ 231#endif /* !NO_UNISTD_H */ 232 233#ifndef NO_FCNTL_H 234# include <fcntl.h> 235#endif /* !NO_FNCTL_H */ 236 237#ifndef NO_STRING_H 238# include <string.h> 239#else 240# include <strings.h> 241#endif /* NO_STRING_H */ 242 243#ifdef NO_VOID 244# define void int 245 typedef char zvoid; 246#else /* !NO_VOID */ 247# ifdef NO_TYPEDEF_VOID 248# define zvoid void 249# else 250 typedef void zvoid; 251# endif 252#endif /* ?NO_VOID */ 253 254#ifdef NO_STRRCHR 255# define strrchr rindex 256#endif 257 258#ifdef NO_STRCHR 259# define strchr index 260#endif 261 262/* 263 * A couple of forward declarations that are needed on systems that do 264 * not supply C runtime library prototypes. 265 */ 266#ifdef NO_PROTO 267IZ_IMP char *strcpy(); 268IZ_IMP char *strcat(); 269IZ_IMP char *strrchr(); 270/* XXX use !defined(ZMEM) && !defined(__hpux__) ? */ 271#if !defined(ZMEM) && defined(NO_STRING_H) 272IZ_IMP char *memset(); 273IZ_IMP char *memcpy(); 274#endif /* !ZMEM && NO_STRING_H */ 275 276/* XXX use !defined(__hpux__) ? */ 277#ifdef NO_STDLIB_H 278IZ_IMP char *calloc(); 279IZ_IMP char *malloc(); 280IZ_IMP char *getenv(); 281IZ_IMP long atol(); 282#endif /* NO_STDLIB_H */ 283 284#ifndef NO_MKTEMP 285IZ_IMP char *mktemp(); 286#endif /* !NO_MKTEMP */ 287 288#endif /* NO_PROTO */ 289 290/* 291 * SEEK_* macros, should be defined in stdio.h 292 */ 293/* Define fseek() commands */ 294#ifndef SEEK_SET 295# define SEEK_SET 0 296#endif /* !SEEK_SET */ 297 298#ifndef SEEK_CUR 299# define SEEK_CUR 1 300#endif /* !SEEK_CUR */ 301 302#ifndef FALSE 303# define FALSE 0 304#endif 305 306#ifndef TRUE 307# define TRUE 1 308#endif 309 310#ifdef NO_SIZE_T 311 typedef unsigned int extent; 312 /* define size_t 3/17/05 EG */ 313 typedef unsigned int size_t; 314#else 315 typedef size_t extent; 316#endif 317 318#ifdef NO_TIME_T 319 typedef long time_t; 320#endif 321 322/* DBCS support for Info-ZIP's zip (mainly for japanese (-: ) 323 * by Yoshioka Tsuneo (QWF00133@nifty.ne.jp,tsuneo-y@is.aist-nara.ac.jp) 324 * This code is public domain! Date: 1998/12/20 325 */ 326 327/* 2007-07-29 SMS. 328 * Include <locale.h> here if it will be needed later for Unicode. 329 * Otherwise, SETLOCALE may be defined here, and then defined again 330 * (differently) when <locale.h> is read later. 331 */ 332#ifdef UNICODE_SUPPORT 333# if defined( UNIX) || defined( VMS) 334# include <locale.h> 335# endif /* defined( UNIX) || defined( VMS) */ 336# include <wchar.h> 337# include <wctype.h> 338#endif /* def UNICODE_SUPPORT */ 339 340#ifdef _MBCS 341# include <locale.h> 342 343 /* Multi Byte Character Set */ 344 extern char *___tmp_ptr; 345 unsigned char *zmbschr OF((ZCONST unsigned char *, unsigned int)); 346 unsigned char *zmbsrchr OF((ZCONST unsigned char *, unsigned int)); 347# define CLEN(ptr) mblen((ZCONST char *)ptr, MB_CUR_MAX) 348# define PREINCSTR(ptr) (ptr += CLEN(ptr)) 349# define POSTINCSTR(ptr) (___tmp_ptr=(char *)ptr,ptr += CLEN(ptr),___tmp_ptr) 350 int lastchar OF((ZCONST char *ptr)); 351# define MBSCHR(str,c) (char *)zmbschr((ZCONST unsigned char *)(str), c) 352# define MBSRCHR(str,c) (char *)zmbsrchr((ZCONST unsigned char *)(str), (c)) 353# ifndef SETLOCALE 354# define SETLOCALE(category, locale) setlocale(category, locale) 355# endif /* ndef SETLOCALE */ 356#else /* !_MBCS */ 357# define CLEN(ptr) 1 358# define PREINCSTR(ptr) (++(ptr)) 359# define POSTINCSTR(ptr) ((ptr)++) 360# define lastchar(ptr) ((*(ptr)=='\0') ? '\0' : ptr[strlen(ptr)-1]) 361# define MBSCHR(str, c) strchr(str, c) 362# define MBSRCHR(str, c) strrchr(str, c) 363# ifndef SETLOCALE 364# define SETLOCALE(category, locale) 365# endif /* ndef SETLOCALE */ 366#endif /* ?_MBCS */ 367#define INCSTR(ptr) PREINCSTR(ptr) 368 369 370/* System independent replacement for "struct utimbuf", which is missing 371 * in many older OS environments. 372 */ 373typedef struct ztimbuf { 374 time_t actime; /* new access time */ 375 time_t modtime; /* new modification time */ 376} ztimbuf; 377 378/* This macro round a time_t value to the OS specific resolution */ 379#ifndef ROUNDED_TIME 380# define ROUNDED_TIME(time) (time) 381#endif 382 383/* Some systems define S_IFLNK but do not support symbolic links */ 384#if defined (S_IFLNK) && defined(NO_SYMLINKS) 385# undef S_IFLNK 386#endif 387 388#ifndef Z_UINT4_DEFINED 389# if !defined(NO_LIMITS_H) 390# if (defined(UINT_MAX) && (UINT_MAX == 0xffffffffUL)) 391 typedef unsigned int z_uint4; 392# define Z_UINT4_DEFINED 393# else 394# if (defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL)) 395 typedef unsigned long z_uint4; 396# define Z_UINT4_DEFINED 397# else 398# if (defined(USHRT_MAX) && (USHRT_MAX == 0xffffffffUL)) 399 typedef unsigned short z_uint4; 400# define Z_UINT4_DEFINED 401# endif 402# endif 403# endif 404# endif /* !defined(NO_LIMITS_H) */ 405#endif /* ndef Z_UINT4_DEFINED */ 406#ifndef Z_UINT4_DEFINED 407 typedef ulg z_uint4; 408# define Z_UINT4_DEFINED 409#endif 410 411#ifndef FOPR /* fallback default definitions for FOPR, FOPM, FOPW: */ 412# define FOPR "r" 413# define FOPM "r+" 414# define FOPW "w" 415#endif /* fallback definition */ 416 417#ifndef FOPW_TMP /* fallback default for opening writable temp files */ 418# define FOPW_TMP FOPW 419#endif 420 421/* Open the old zip file in exclusive mode if possible (to avoid adding 422 * zip file to itself). 423 */ 424#ifdef OS2 425# define FOPR_EX FOPM 426#else 427# define FOPR_EX FOPR 428#endif 429 430 431/* MSDOS file or directory attributes */ 432#define MSDOS_HIDDEN_ATTR 0x02 433#define MSDOS_DIR_ATTR 0x10 434 435 436/* Define this symbol if your target allows access to unaligned data. 437 * This is not mandatory, just a speed optimization. The compressed 438 * output is strictly identical. 439 */ 440#if (defined(MSDOS) && !defined(WIN32)) || defined(i386) 441# define UNALIGNED_OK 442#endif 443#if defined(mc68020) || defined(vax) 444# define UNALIGNED_OK 445#endif 446 447#if (defined(SMALL_MEM) && !defined(CBSZ)) 448# define CBSZ 2048 /* buffer size for copying files */ 449# define ZBSZ 2048 /* buffer size for temporary zip file */ 450#endif 451 452#if (defined(MEDIUM_MEM) && !defined(CBSZ)) 453# define CBSZ 8192 454# define ZBSZ 8192 455#endif 456 457#ifndef CBSZ 458# define CBSZ 16384 459# define ZBSZ 16384 460#endif 461 462#ifndef SBSZ 463# define SBSZ CBSZ /* copy buf size for STORED entries, see zipup() */ 464#endif 465 466#ifndef MEMORY16 467# ifdef __WATCOMC__ 468# undef huge 469# undef far 470# undef near 471# endif 472# ifdef THEOS 473# undef far 474# undef near 475# endif 476# if (!defined(__IBMC__) || !defined(OS2)) 477# ifndef huge 478# define huge 479# endif 480# ifndef far 481# define far 482# endif 483# ifndef near 484# define near 485# endif 486# endif 487# define nearmalloc malloc 488# define nearfree free 489# define farmalloc malloc 490# define farfree free 491#endif /* !MEMORY16 */ 492 493#ifndef Far 494# define Far far 495#endif 496 497/* MMAP and BIG_MEM cannot be used together -> let MMAP take precedence */ 498#if (defined(MMAP) && defined(BIG_MEM)) 499# undef BIG_MEM 500#endif 501 502#if (defined(BIG_MEM) || defined(MMAP)) && !defined(DYN_ALLOC) 503# define DYN_ALLOC 504#endif 505 506 507/* LARGE_FILE_SUPPORT 508 * 509 * Types are in osdep.h for each port 510 * 511 * LARGE_FILE_SUPPORT and ZIP64_SUPPORT are automatically 512 * set in osdep.h (for some ports) based on the port and compiler. 513 * 514 * Function prototypes are below as OF is defined earlier in this file 515 * but after osdep.h is included. In the future ANSI prototype 516 * support may be required and the OF define may then go away allowing 517 * the function defines to be in the port osdep.h. 518 * 519 * E. Gordon 9/21/2003 520 * Updated 7/24/04 EG 521 */ 522#ifdef LARGE_FILE_SUPPORT 523 /* 64-bit Large File Support */ 524 525 /* Arguments for all functions are assumed to match the actual 526 arguments of the various port calls. As such only the 527 function names are mapped below. */ 528 529/* ---------------------------- */ 530# ifdef UNIX 531 532 /* Assume 64-bit file environment is defined. The below should all 533 be set to their 64-bit versions automatically. Neat. 7/20/2004 EG */ 534 535 /* 64-bit stat functions */ 536# define zstat stat 537# define zfstat fstat 538# define zlstat lstat 539 540# if defined(__alpha) && defined(__osf__) /* support for osf4.0f */ 541 /* 64-bit fseek */ 542# define zfseeko fseek 543 544 /* 64-bit ftell */ 545# define zftello ftell 546 547# else 548 /* 64-bit fseeko */ 549# define zfseeko fseeko 550 551 /* 64-bit ftello */ 552# define zftello ftello 553# endif /* __alpha && __osf__ */ 554 555 /* 64-bit fopen */ 556# define zfopen fopen 557# define zfdopen fdopen 558 559# endif /* UNIX */ 560 561/* ---------------------------- */ 562# ifdef VMS 563 564 /* 64-bit stat functions */ 565# define zstat stat 566# define zfstat fstat 567# define zlstat lstat 568 569 /* 64-bit fseeko */ 570# define zfseeko fseeko 571 572 /* 64-bit ftello */ 573# define zftello ftello 574 575 /* 64-bit fopen */ 576# define zfopen fopen 577# define zfdopen fdopen 578 579# endif /* def VMS */ 580 581/* ---------------------------- */ 582# ifdef WIN32 583 584# if defined(__MINGW32__) 585 /* GNU C, linked against "msvcrt.dll" */ 586 587 /* 64-bit stat functions */ 588# define zstat _stati64 589# ifdef UNICODE_SUPPORT 590# define zwfstat _fstati64 591# define zwstat _wstati64 592# define zw_stat struct _stati64 593# endif 594# define zfstat _fstati64 595# define zlstat lstat 596 597 /* 64-bit fseeko */ 598 /* function in win32.c */ 599 int zfseeko OF((FILE *, zoff_t, int)); 600 601 /* 64-bit ftello */ 602 /* function in win32.c */ 603 zoff_t zftello OF((FILE *)); 604 605 /* 64-bit fopen */ 606# define zfopen fopen 607# define zfdopen fdopen 608 609# endif 610 611# if defined(__CYGWIN__) 612 /* GNU C, CygWin with its own POSIX compatible runtime library */ 613 614 /* 64-bit stat functions */ 615# define zstat stat 616# define zfstat fstat 617# define zlstat lstat 618 619 /* 64-bit fseeko */ 620# define zfseeko fseeko 621 622 /* 64-bit ftello */ 623# define zftello ftello 624 625 /* 64-bit fopen */ 626# define zfopen fopen 627# define zfdopen fdopen 628 629# endif 630 631# ifdef __WATCOMC__ 632 /* WATCOM C */ 633 634 /* 64-bit stat functions */ 635# define zstat _stati64 636# ifdef UNICODE_SUPPORT 637# define zwfstat _fstati64 638# define zwstat _wstati64 639# define zw_stat struct _stati64 640# endif 641# define zfstat _fstati64 642# define zlstat lstat 643 644 /* 64-bit fseeko */ 645 /* function in win32.c */ 646 int zfseeko OF((FILE *, zoff_t, int)); 647 648 /* 64-bit ftello */ 649 /* function in win32.c */ 650 zoff_t zftello OF((FILE *)); 651 652 /* 64-bit fopen */ 653# define zfopen fopen 654# define zfdopen fdopen 655 656# endif 657 658# ifdef _MSC_VER 659 /* MS C and VC */ 660 661 /* 64-bit stat functions */ 662# define zstat _stati64 663# ifdef UNICODE_SUPPORT 664# define zwfstat _fstati64 665# define zwstat _wstati64 666# define zw_stat struct _stati64 667# endif 668# define zfstat _fstati64 669# define zlstat lstat 670 671 /* 64-bit fseeko */ 672 /* function in win32.c */ 673 int zfseeko OF((FILE *, zoff_t, int)); 674 675 /* 64-bit ftello */ 676 /* function in win32.c */ 677 zoff_t zftello OF((FILE *)); 678 679 /* 64-bit fopen */ 680# define zfopen fopen 681# define zfdopen fdopen 682 683# endif 684 685# ifdef __IBMC__ 686 /* IBM C */ 687 688 /* 64-bit stat functions */ 689 690 /* 64-bit fseeko */ 691 /* function in win32.c */ 692 int zfseeko OF((FILE *, zoff_t, int)); 693 694 /* 64-bit ftello */ 695 /* function in win32.c */ 696 zoff_t zftello OF((FILE *)); 697 698 /* 64-bit fopen */ 699 700# endif 701 702# endif /* WIN32 */ 703 704#else 705 /* No Large File Support or default for 64-bit environment */ 706 707# define zstat stat 708# define zfstat fstat 709# define zlstat lstat 710# define zfseeko fseek 711# define zftello ftell 712# define zfopen fopen 713# define zfdopen fdopen 714# ifdef UNICODE_SUPPORT 715# define zwfstat _fstat 716# define zwstat _wstat 717# define zw_stat struct _stat 718# endif 719 720#endif 721 722#ifdef LARGE_FILE_SUPPORT /* E. Gordon 9/12/2003 */ 723 724# ifndef SSTAT 725# define SSTAT zstat 726# ifdef UNICODE_SUPPORT 727# define SSTATW zwstat 728# endif 729# endif 730# ifdef S_IFLNK 731# define LSTAT zlstat 732# define LSSTAT(n, s) (linkput ? zlstat((n), (s)) : SSTAT((n), (s))) 733# else 734# define LSTAT SSTAT 735# define LSSTAT SSTAT 736# ifdef UNICODE_SUPPORT 737# define LSSTATW SSTATW 738# endif 739# endif 740 741#else /* no LARGE_FILE_SUPPORT */ 742 743# ifndef SSTAT 744# define SSTAT stat 745# endif 746# ifdef S_IFLNK 747# define LSTAT lstat 748# define LSSTAT(n, s) (linkput ? lstat((n), (s)) : SSTAT((n), (s))) 749# else 750# define LSTAT SSTAT 751# define LSSTAT SSTAT 752# ifdef UNICODE_SUPPORT 753# define LSSTATW SSTATW 754# endif 755# endif 756 757#endif 758 759 760/*---------------------------------------------------------------------*/ 761 762 763/* 2004-12-01 SMS. 764 * Added fancy zofft() macros, et c. 765 */ 766 767/* Default fzofft() format selection. 768 * Modified 2004-12-27 EG 769 */ 770 771#ifndef FZOFFT_FMT 772# define FZOFFT_FMT ZOFF_T_FORMAT_SIZE_PREFIX /* printf for zoff_t values */ 773 774# ifdef LARGE_FILE_SUPPORT 775# define FZOFFT_HEX_WID_VALUE "16" /* width of 64-bit hex values */ 776# else 777# define FZOFFT_HEX_WID_VALUE "8" /* digits in 32-bit hex values */ 778# endif 779 780#endif /* ndef FZOFFT_FMT */ 781 782#define FZOFFT_HEX_WID ((char *) -1) 783#define FZOFFT_HEX_DOT_WID ((char *) -2) 784 785 786 787 788/* The following default definition of the second input for the crypthead() 789 * random seed computation can be used on most systems (all those that 790 * supply a UNIX compatible getpid() function). 791 */ 792#ifdef ZCRYPT_INTERNAL 793# ifndef ZCR_SEED2 794# define ZCR_SEED2 (unsigned) getpid() /* use PID as seed pattern */ 795# endif 796#endif /* ZCRYPT_INTERNAL */ 797 798/* The following OS codes are defined in pkzip appnote.txt */ 799#ifdef AMIGA 800# define OS_CODE 0x100 801#endif 802#ifdef VMS 803# define OS_CODE 0x200 804#endif 805/* unix 3 */ 806#ifdef VM_CMS 807# define OS_CODE 0x400 808#endif 809#ifdef ATARI 810# define OS_CODE 0x500 811#endif 812#ifdef OS2 813# define OS_CODE 0x600 814#endif 815#ifdef MACOS 816# define OS_CODE 0x700 817#endif 818/* z system 8 */ 819/* cp/m 9 */ 820#ifdef TOPS20 821# define OS_CODE 0xa00 822#endif 823#ifdef WIN32 824# define OS_CODE 0xb00 825#endif 826#ifdef QDOS 827# define OS_CODE 0xc00 828#endif 829#ifdef RISCOS 830# define OS_CODE 0xd00 831#endif 832#ifdef VFAT 833# define OS_CODE 0xe00 834#endif 835#ifdef MVS 836# define OS_CODE 0xf00 837#endif 838#ifdef __BEOS__ 839# define OS_CODE 0x1000 840#endif 841#ifdef TANDEM 842# define OS_CODE 0x1100 843#endif 844#ifdef THEOS 845# define OS_CODE 0x1200 846#endif 847/* Yes, there is a gap here. */ 848#ifdef __ATHEOS__ 849# define OS_CODE 0x1E00 850#endif 851 852#define NUM_HOSTS 31 853/* Number of operating systems. Should be updated when new ports are made */ 854 855#if defined(DOS) && !defined(OS_CODE) 856# define OS_CODE 0x000 857#endif 858 859#ifndef OS_CODE 860# define OS_CODE 0x300 /* assume Unix */ 861#endif 862 863/* can't use "return 0" from main() on VMS */ 864#ifndef EXIT 865# define EXIT exit 866#endif 867#ifndef RETURN 868# define RETURN return 869#endif 870 871#ifndef ZIPERR 872# define ZIPERR ziperr 873#endif 874 875#if (defined(USE_ZLIB) && defined(MY_ZCALLOC)) 876 /* special zcalloc function is not needed when linked against zlib */ 877# undef MY_ZCALLOC 878#endif 879 880#if (!defined(USE_ZLIB) && !defined(MY_ZCALLOC)) 881 /* Any system without a special calloc function */ 882# define zcalloc(items,size) \ 883 (zvoid far *)calloc((unsigned)(items), (unsigned)(size)) 884# define zcfree free 885#endif /* !USE_ZLIB && !MY_ZCALLOC */ 886 887/* end of tailor.h */ 888