📄 unzpriv.h
字号:
#ifndef PATH_MAX# ifdef MAXPATHLEN# define PATH_MAX MAXPATHLEN /* in <sys/param.h> on some systems */# else# ifdef _MAX_PATH# define PATH_MAX _MAX_PATH# else# if FILENAME_MAX > 255# define PATH_MAX FILENAME_MAX /* used like PATH_MAX on some systems */# else# define PATH_MAX 1024# endif# endif /* ?_MAX_PATH */# endif /* ?MAXPATHLEN */#endif /* !PATH_MAX */#define FILNAMSIZ PATH_MAX/* DBCS support for Info-ZIP (mainly for japanese (-: ) * by Yoshioka Tsuneo (QWF00133@nifty.ne.jp,tsuneo-y@is.aist-nara.ac.jp) */#ifdef _MBCS# include <locale.h> /* Multi Byte Character Set */# define ___MBS_TMP_DEF char *___tmp_ptr;# define ___TMP_PTR ___tmp_ptr# define CLEN(ptr) mblen((ZCONST char *)(ptr), MB_CUR_MAX)# ifndef PREINCSTR# define PREINCSTR(ptr) (ptr += CLEN(ptr))# endif# define POSTINCSTR(ptr) (___TMP_PTR=(char *)(ptr), PREINCSTR(ptr),___TMP_PTR) char *plastchar OF((ZCONST char *ptr, extent len));# define lastchar(ptr, len) ((int)(unsigned)*plastchar(ptr, len))# ifndef MBSCHR# define NEED_UZMBSCHR# define MBSCHR(str,c) (char *)uzmbschr((ZCONST unsigned char *)(str), c)# endif# ifndef MBSRCHR# define NEED_UZMBSRCHR# define MBSRCHR(str,c) (char *)uzmbsrchr((ZCONST unsigned char *)(str), c)# endif# define SETLOCALE(category, locale) setlocale(category, locale)#else /* !_MBCS */# define ___MBS_TMP_DEF# define ___TMP_PTR# define CLEN(ptr) 1# define PREINCSTR(ptr) (++(ptr))# define POSTINCSTR(ptr) ((ptr)++)# define plastchar(ptr, len) (&ptr[(len)-1])# define lastchar(ptr, len) (ptr[(len)-1])# define MBSCHR(str, c) strchr(str, c)# define MBSRCHR(str, c) strrchr(str, c)# define SETLOCALE(category, locale)#endif /* ?_MBCS */#define INCSTR(ptr) PREINCSTR(ptr)#if (defined(MALLOC_WORK) && !defined(MY_ZCALLOC)) /* Any system without a special calloc function */# ifndef zcalloc# define zcalloc(items, size) \ (zvoid far *)calloc((unsigned)(items), (unsigned)(size))# endif# ifndef zcfree# define zcfree free# endif#endif /* MALLOC_WORK && !MY_ZCALLOC */#ifdef REGULUS /* returns the inode number on success(!)...argh argh argh */# define stat(p,s) zstat((p),(s))#endif#if (defined(CRAY) && defined(ZMEM))# undef ZMEM#endif#ifdef ZMEM# undef ZMEM# define memcmp(b1,b2,len) bcmp(b2,b1,len)# define memcpy(dest,src,len) bcopy(src,dest,len)# define memzero bzero#else# define memzero(dest,len) memset(dest,0,len)#endif#ifndef TRUE# define TRUE 1 /* sort of obvious */#endif#ifndef FALSE# define FALSE 0#endif#ifndef SEEK_SET# define SEEK_SET 0# define SEEK_CUR 1# define SEEK_END 2#endif#if (!defined(S_IEXEC) && defined(S_IXUSR))# define S_IEXEC S_IXUSR#endif#if (defined(UNIX) && defined(S_IFLNK) && !defined(MTS))# define SYMLINKS# ifndef S_ISLNK# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)# endif#endif /* UNIX && S_IFLNK && !MTS */#ifndef S_ISDIR# ifdef CMS_MVS# define S_ISDIR(m) (FALSE)# else# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)# endif#endif#ifndef IS_VOLID# define IS_VOLID(m) ((m) & 0x08)#endif#ifdef SHORT_SYMS /* Mark Williams C, ...? */# define extract_or_test_files xtr_or_tst_files# define extract_or_test_member xtr_or_tst_member#endif#ifdef REALLY_SHORT_SYMS /* TOPS-20 linker: first 6 chars */# define process_cdir_file_hdr XXpcdfh# define process_local_file_hdr XXplfh# define extract_or_test_files XXxotf /* necessary? */# define extract_or_test_member XXxotm /* necessary? */# define check_for_newer XXcfn# define overwrite_all XXoa# define process_all_files XXpaf# define extra_field XXef# define explode_lit8 XXel8# define explode_lit4 XXel4# define explode_nolit8 XXnl8# define explode_nolit4 XXnl4# define cpdist8 XXcpdist8# define inflate_codes XXic# define inflate_stored XXis# define inflate_fixed XXif# define inflate_dynamic XXid# define inflate_block XXib# define maxcodemax XXmax#endif#ifndef S_TIME_T_MAX /* max value of signed (>= 32-bit) time_t */# define S_TIME_T_MAX ((time_t)(ulg)0x7fffffffL)#endif#ifndef U_TIME_T_MAX /* max value of unsigned (>= 32-bit) time_t */# define U_TIME_T_MAX ((time_t)(ulg)0xffffffffL)#endif#ifdef DOSTIME_MINIMUM /* min DOSTIME value (1980-01-01) */# undef DOSTIME_MINIMUM#endif#define DOSTIME_MINIMUM ((ulg)0x00210000L)#ifdef DOSTIME_2038_01_18 /* approximate DOSTIME equivalent of */# undef DOSTIME_2038_01_18 /* the signed-32-bit time_t limit */#endif#define DOSTIME_2038_01_18 ((ulg)0x74320000L)#ifdef QDOS# define ZSUFX "_zip"# define ALT_ZSUFX ".zip"#else# ifdef RISCOS# define ZSUFX "/zip"# else# define ZSUFX ".zip"# endif# define ALT_ZSUFX ".ZIP" /* Unix-only so far (only case-sensitive fs) */#endif#define CENTRAL_HDR_SIG "\001\002" /* the infamous "PK" signature bytes, */#define LOCAL_HDR_SIG "\003\004" /* w/o "PK" (so unzip executable not */#define END_CENTRAL_SIG "\005\006" /* mistaken for zipfile itself) */#define EXTD_LOCAL_SIG "\007\010" /* [ASCII "\113" == EBCDIC "\080" ??] *//** internal-only return codes **/#define IZ_DIR 76 /* potential zipfile is a directory *//* special return codes for mapname() */#define MPN_OK 0 /* mapname successful */#define MPN_INF_TRUNC (1<<8) /* caution - filename truncated */#define MPN_INF_SKIP (2<<8) /* info - skipped because nothing to do */#define MPN_ERR_SKIP (3<<8) /* error - entry skipped */#define MPN_ERR_TOOLONG (4<<8) /* error - path too long */#define MPN_NOMEM (10<<8) /* error - out of memory, file skipped */#define MPN_CREATED_DIR (16<<8) /* directory created: set time & permission */#define MPN_VOL_LABEL (17<<8) /* volume label, but can't set on hard disk */#define MPN_INVALID (99<<8) /* internal logic error, should never reach *//* mask for internal mapname&checkdir return codes */#define MPN_MASK 0x7F00/* error code for extracting/testing extra field blocks */#define IZ_EF_TRUNC 79 /* local extra field truncated (PKZIP'd) *//* choice of activities for do_string() */#define SKIP 0 /* skip header block */#define DISPLAY 1 /* display archive comment (ASCII) */#define DISPL_8 5 /* display file comment (ext. ASCII) */#define DS_FN 2 /* read filename (ext. ASCII, chead) */#define DS_FN_C 2 /* read filename from central header */#define DS_FN_L 6 /* read filename from local header */#define EXTRA_FIELD 3 /* copy extra field into buffer */#define DS_EF 3#ifdef AMIGA# define FILENOTE 4 /* convert file comment to filenote */#endif#if (defined(SFX) && defined(CHEAP_SFX_AUTORUN))# define CHECK_AUTORUN 7 /* copy command, display remainder */# define CHECK_AUTORUN_Q 8 /* copy command, skip remainder */#endif#define DOES_NOT_EXIST -1 /* return values for check_for_newer() */#define EXISTS_AND_OLDER 0#define EXISTS_AND_NEWER 1#define OVERWRT_QUERY 0 /* status values for G.overwrite_mode */#define OVERWRT_ALWAYS 1#define OVERWRT_NEVER 2#define IS_OVERWRT_ALL (G.overwrite_mode == OVERWRT_ALWAYS)#define IS_OVERWRT_NONE (G.overwrite_mode == OVERWRT_NEVER)#define ROOT 0 /* checkdir() extract-to path: called once */#define INIT 1 /* allocate buildpath: called once per member */#define APPEND_DIR 2 /* append a dir comp.: many times per member */#define APPEND_NAME 3 /* append actual filename: once per member */#define GETPATH 4 /* retrieve the complete path and free it */#define END 5 /* free root path prior to exiting program *//* version_made_by codes (central dir): make sure these *//* are not defined on their respective systems!! */#define FS_FAT_ 0 /* filesystem used by MS-DOS, OS/2, Win32 */#define AMIGA_ 1#define VMS_ 2#define UNIX_ 3#define VM_CMS_ 4#define ATARI_ 5 /* what if it's a minix filesystem? [cjh] */#define FS_HPFS_ 6 /* filesystem used by OS/2 (and NT 3.x) */#define MAC_ 7 /* HFS filesystem used by MacOS */#define Z_SYSTEM_ 8#define CPM_ 9#define TOPS20_ 10#define FS_NTFS_ 11 /* filesystem used by Windows NT */#define QDOS_ 12#define ACORN_ 13 /* Archimedes Acorn RISC OS */#define FS_VFAT_ 14 /* filesystem used by Windows 95, NT */#define MVS_ 15#define BEOS_ 16 /* hybrid POSIX/database filesystem */#define TANDEM_ 17 /* Tandem NSK */#define THEOS_ 18 /* THEOS */#define MAC_OSX_ 19 /* Mac OS/X (Darwin) */#define ATHEOS_ 30 /* AtheOS */#define NUM_HOSTS 31 /* index of last system + 1 *//* don't forget to update zipinfo.c appropiately if NUM_HOSTS changes! */#define STORED 0 /* compression methods */#define SHRUNK 1#define REDUCED1 2#define REDUCED2 3#define REDUCED3 4#define REDUCED4 5#define IMPLODED 6#define TOKENIZED 7#define DEFLATED 8#define ENHDEFLATED 9#define DCLIMPLODED 10#define PKRESMOD11 11#define BZIP2ED 12#define NUM_METHODS 13 /* index of last method + 1 *//* don't forget to update list_files(), extract.c and zipinfo.c appropriately * if NUM_METHODS changes *//* (the PK-class error codes are public and have been moved into unzip.h) */#define DF_MDY 0 /* date format 10/26/91 (USA only) */#define DF_DMY 1 /* date format 26/10/91 (most of the world) */#define DF_YMD 2 /* date format 91/10/26 (a few countries) *//*--------------------------------------------------------------------------- Extra-field block ID values and offset info. ---------------------------------------------------------------------------*//* extra-field ID values, all little-endian: */#define EF_PKSZ64 0x0001 /* PKWARE's 64-bit filesize extensions */#define EF_AV 0x0007 /* PKWARE's authenticity verification */#define EF_OS2 0x0009 /* OS/2 extended attributes */#define EF_PKW32 0x000a /* PKWARE's Win95/98/WinNT filetimes */#define EF_PKVMS 0x000c /* PKWARE's VMS */#define EF_PKUNIX 0x000d /* PKWARE's Unix */#define EF_IZVMS 0x4d49 /* Info-ZIP's VMS ("IM") */#define EF_IZUNIX 0x5855 /* Info-ZIP's old Unix[1] ("UX") */#define EF_IZUNIX2 0x7855 /* Info-ZIP's new Unix[2] ("Ux") */#define EF_TIME 0x5455 /* universal timestamp ("UT") */#define EF_MAC3 0x334d /* Info-ZIP's new Macintosh (= "M3") */#define EF_JLMAC 0x07c8 /* Johnny Lee's old Macintosh (= 1992) */#define EF_ZIPIT 0x2605 /* Thomas Brown's Macintosh (ZipIt) */#define EF_ZIPIT2 0x2705 /* T. Brown's Mac (ZipIt) v 1.3.8 and newer ? */#define EF_SMARTZIP 0x4d63 /* Mac SmartZip by Marco Bambini */#define EF_VMCMS 0x4704 /* Info-ZIP's VM/CMS ("\004G") */#define EF_MVS 0x470f /* Info-ZIP's MVS ("\017G") */#define EF_ACL 0x4c41 /* (OS/2) access control list ("AL") */#define EF_NTSD 0x4453 /* NT security descriptor ("SD") */#define EF_ATHEOS 0x7441 /* AtheOS ("At") */#define EF_BEOS 0x6542 /* BeOS ("Be") */#define EF_QDOS 0xfb4a /* SMS/QDOS ("J\373") */#define EF_AOSVS 0x5356 /* AOS/VS ("VS") */#define EF_SPARK 0x4341 /* David Pilling's Acorn/SparkFS ("AC") */#define EF_TANDEM 0x4154 /* Tandem NSK ("TA") */#define EF_THEOS 0x6854 /* Jean-Michel Dubois' Theos "Th" */#define EF_THEOSO 0x4854 /* old Theos port */#define EF_MD5 0x4b46 /* Fred Kantor's MD5 ("FK") */#define EF_ASIUNIX 0x756e /* ASi's Unix ("nu") */#define EB_HEADSIZE 4 /* length of extra field block header */#define EB_ID 0 /* offset of block ID in header */#define EB_LEN 2 /* offset of data length field in header */#define EB_UCSIZE_P 0 /* offset of ucsize field in compr. data */#define EB_CMPRHEADLEN 6 /* lenght of compression header */#define EB_UX_MINLEN 8 /* minimal "UX" field contains atime, mtime */#define EB_UX_FULLSIZE 12 /* full "UX" field (atime, mtime, uid, gid) */#define EB_UX_ATIME 0 /* offset of atime in "UX" extra field data */#define EB_UX_MTIME 4 /* offset of mtime in "UX" extra field data */#define EB_UX_UID 8 /* byte offset of UID in "UX" field data */#define EB_UX_GID 10 /* byte offset of GID in "UX" field data */#define EB_UX2_MINLEN 4 /* minimal "Ux" field contains UID/GID */#define EB_UX2_UID 0 /* byte offset of UID in "Ux" field data */#define EB_UX2_GID 2 /* byte offset of GID in "Ux" field data */#define EB_UX2_VALID (1 << 8) /* UID/GID present */#define EB_UT_MINLEN 1 /* minimal UT field contains Flags byte */#define EB_UT_FLAGS 0 /* byte offset of Flags field */#define EB_UT_TIME1 1 /* byte offset of 1st time value */#define EB_UT_FL_MTIME (1 << 0) /* mtime present */#define EB_UT_FL_ATIME (1 << 1) /* atime present */#define EB_UT_FL_CTIME (1 << 2) /* ctime present */#define EB_FLGS_OFFS 4 /* offset of flags area in generic compressed extra field blocks (BEOS, MAC, and others) */#define EB_OS2_HLEN 4 /* size of OS2/ACL compressed data header */#define EB_BEOS_HLEN 5 /* length of BeOS&AtheOS e.f attribute header */#define EB_BE_FL_UNCMPR 0x01 /* "BeOS&AtheOS attribs uncompr." bit flag */#define EB_MAC3_HLEN 14 /* length of Mac3 attribute block header */#define EB_SMARTZIP_HLEN 64 /* fixed length of the SmartZip extra field */#define EB_M3_FL_DATFRK 0x01 /* "this entry is data fork" flag */#define EB_M3_FL_UNCMPR 0x04 /* "Mac3 attributes uncompressed" bit flag */#define EB_M3_FL_TIME64 0x08 /* "Mac3 time fields are 64 bit wide" flag */#define EB_M3_FL_NOUTC 0x10 /* "Mac3 timezone offset fields missing" flag */#define EB_NTSD_C_LEN 4 /* length of central NT security data */#define EB_NTSD_L_LEN 5 /* length of minimal local NT security data */#define EB_NTSD_VERSION 4 /* offset of NTSD version byte */#define EB_NTSD_MAX_VER (0) /* maximum version # we know how to handle */#define EB_ASI_CRC32 0 /* offset of ASI Unix field's crc32 checksum */#define EB_ASI_MODE 4 /* offset of ASI Unix permission mode field */#define EB_IZVMS_HLEN 12 /* length of IZVMS attribute block header */#define EB_IZVMS_FLGS 4 /* offset of compression type flag */#define EB_IZVMS_UCSIZ 6 /* offset of ucsize field in IZVMS header */#define EB_IZVMS_BCMASK 07 /* 3 bits for compression type */#define EB_IZVMS_BCSTOR 0 /* Stored */#define EB_IZVMS_BC00 1 /* 0byte -> 0bit compression */#define EB_IZVMS_BCDEFL 2 /* Deflated *//*--------------------------------------------------------------------------- True sizes of the various headers, as defined by PKWARE--so it is not likely that these will ever change. But if they do, make sure both these defines AND the typedefs below get updated accordingly. ---------------------------------------------------------------------------*/#define LREC_SIZE 26 /* lengths of local file headers, central */#define CREC_SIZE 42 /* directory headers, and the end-of- */#define ECREC_SIZE 18 /* central-dir record, respectively */#define MAX_BITS 13 /* used in unshrink() */#define HSIZE (1 << MAX_BITS) /* size of global work area */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -