📄 unzpriv.h
字号:
#define LF 10 /* '\n' on ASCII machines; must be 10 due to EBCDIC */#define CR 13 /* '\r' on ASCII machines; must be 13 due to EBCDIC */#define CTRLZ 26 /* DOS & OS/2 EOF marker (used in fileio.c, vms.c) */#ifdef EBCDIC# define foreign(c) ascii[(uch)(c)]# define native(c) ebcdic[(uch)(c)]# define NATIVE "EBCDIC"# define NOANSIFILT#endif#ifdef VMS# define ENV_UNZIP "UNZIP_OPTS" /* names of environment variables */# define ENV_ZIPINFO "ZIPINFO_OPTS"#endif /* VMS */#ifdef RISCOS# define ENV_UNZIP "Unzip$Options"# define ENV_ZIPINFO "Zipinfo$Options"# define ENV_UNZIPEXTS "Unzip$Exts"#endif /* RISCOS */#ifndef ENV_UNZIP# define ENV_UNZIP "UNZIP" /* the standard names */# define ENV_ZIPINFO "ZIPINFO"#endif#define ENV_UNZIP2 "UNZIPOPT" /* alternate names, for zip compat. */#define ENV_ZIPINFO2 "ZIPINFOOPT"#if (!defined(QQ) && !defined(NOQQ))# define QQ#endif#ifdef QQ /* Newtware version: no file */# define QCOND (!uO.qflag) /* comments with -vq or -vqq */#else /* Bill Davidsen version: no way to */# define QCOND (longhdr) /* kill file comments when listing */#endif#ifdef OLD_QQ# define QCOND2 (uO.qflag < 2)#else# define QCOND2 (!uO.qflag)#endif#ifdef WILD_STOP_AT_DIR# define __WDLPRO , int sepc# define __WDL , sepc# define __WDLDEF int sepc;# define WISEP , (uO.W_flag ? '/' : '\0')#else# define __WDLPRO# define __WDL# define __WDLDEF# define WISEP#endif/**************//* Typedefs *//**************/#ifdef NO_UID_GID# ifdef UID_USHORT typedef unsigned short uid_t; /* TI SysV.3 */ typedef unsigned short gid_t;# else typedef unsigned int uid_t; /* SCO Xenix */ typedef unsigned int gid_t;# endif#endif#if (defined(GOT_UTIMBUF) || defined(sgi) || defined(ATARI)) typedef struct utimbuf ztimbuf;#else typedef struct ztimbuf { time_t actime; /* new access time */ time_t modtime; /* new modification time */ } ztimbuf;#endiftypedef struct iztimes { time_t atime; /* new access time */ time_t mtime; /* new modification time */ time_t ctime; /* used for creation time; NOT same as st_ctime */} iztimes;#ifdef SET_DIR_ATTRIB typedef struct direntry { /* head of system-specific struct holding */ struct direntry *next; /* defered directory attributes info */ char *fn; /* filename of directory */ char buf[1]; /* start of system-specific internal data */ } direntry;#endif /* SET_DIR_ATTRIB */#ifdef SYMLINKS typedef struct slinkentry { /* info for deferred symlink creation */ struct slinkentry *next; /* pointer to next entry in chain */ extent targetlen; /* length of target filespec */ extent attriblen; /* length of system-specific attrib data */ char *target; /* pointer to target filespec */ char *fname; /* pointer to name of link */ char buf[2]; /* name of link, allocs space for 2 '\0's */ } slinkentry;#endif /* SYMLINKS */typedef struct min_info { Z_OFF_T offset; ulg compr_size; /* compressed size (needed if extended header) */ ulg uncompr_size; /* uncompressed size (needed if extended header) */ ulg crc; /* crc (needed if extended header) */ ush diskstart; /* no of volume where this entry starts */ uch hostver; uch hostnum; unsigned file_attr; /* local flavor, as used by creat(), chmod()... */ unsigned encrypted : 1; /* file encrypted: decrypt before uncompressing */ unsigned ExtLocHdr : 1; /* use time instead of CRC for decrypt check */ unsigned textfile : 1; /* file is text (according to zip) */ unsigned textmode : 1; /* file is to be extracted as text */ unsigned lcflag : 1; /* convert filename to lowercase */ unsigned vollabel : 1; /* "file" is an MS-DOS volume (disk) label */ unsigned HasUxAtt : 1; /* crec ext_file_attr has Unix style mode bits */#ifndef SFX char Far *cfilname; /* central header version of filename */#endif} min_info;typedef struct VMStimbuf { char *revdate; /* (both roughly correspond to Unix modtime/st_mtime) */ char *credate;} VMStimbuf;/*--------------------------------------------------------------------------- Zipfile work area declarations. ---------------------------------------------------------------------------*/#ifdef MALLOC_WORK union work { struct { /* unshrink(): */ shrint *Parent; /* pointer to (8192 * sizeof(shrint)) */ uch *value; /* pointer to 8KB char buffer */ uch *Stack; /* pointer to another 8KB char buffer */ } shrink; uch *Slide; /* explode(), inflate(), unreduce() */ };#else /* !MALLOC_WORK */ union work { struct { /* unshrink(): */ shrint Parent[HSIZE]; /* (8192 * sizeof(shrint)) == 16KB minimum */ uch value[HSIZE]; /* 8KB */ uch Stack[HSIZE]; /* 8KB */ } shrink; /* total = 32KB minimum; 80KB on Cray/Alpha */ uch Slide[WSIZE]; /* explode(), inflate(), unreduce() */ };#endif /* ?MALLOC_WORK */#define slide G.area.Slide#if (defined(DLL) && !defined(NO_SLIDE_REDIR))# define redirSlide G.redirect_sldptr#else# define redirSlide G.area.Slide#endif/*--------------------------------------------------------------------------- Zipfile layout declarations. If these headers ever change, make sure the xxREC_SIZE defines (above) change with them! ---------------------------------------------------------------------------*/ typedef uch local_byte_hdr[ LREC_SIZE ];# define L_VERSION_NEEDED_TO_EXTRACT_0 0# define L_VERSION_NEEDED_TO_EXTRACT_1 1# define L_GENERAL_PURPOSE_BIT_FLAG 2# define L_COMPRESSION_METHOD 4# define L_LAST_MOD_DOS_DATETIME 6# define L_CRC32 10# define L_COMPRESSED_SIZE 14# define L_UNCOMPRESSED_SIZE 18# define L_FILENAME_LENGTH 22# define L_EXTRA_FIELD_LENGTH 24 typedef uch cdir_byte_hdr[ CREC_SIZE ];# define C_VERSION_MADE_BY_0 0# define C_VERSION_MADE_BY_1 1# define C_VERSION_NEEDED_TO_EXTRACT_0 2# define C_VERSION_NEEDED_TO_EXTRACT_1 3# define C_GENERAL_PURPOSE_BIT_FLAG 4# define C_COMPRESSION_METHOD 6# define C_LAST_MOD_DOS_DATETIME 8# define C_CRC32 12# define C_COMPRESSED_SIZE 16# define C_UNCOMPRESSED_SIZE 20# define C_FILENAME_LENGTH 24# define C_EXTRA_FIELD_LENGTH 26# define C_FILE_COMMENT_LENGTH 28# define C_DISK_NUMBER_START 30# define C_INTERNAL_FILE_ATTRIBUTES 32# define C_EXTERNAL_FILE_ATTRIBUTES 34# define C_RELATIVE_OFFSET_LOCAL_HEADER 38 typedef uch ec_byte_rec[ ECREC_SIZE+4 ];/* define SIGNATURE 0 space-holder only */# define NUMBER_THIS_DISK 4# define NUM_DISK_WITH_START_CENTRAL_DIR 6# define NUM_ENTRIES_CENTRL_DIR_THS_DISK 8# define TOTAL_ENTRIES_CENTRAL_DIR 10# define SIZE_CENTRAL_DIRECTORY 12# define OFFSET_START_CENTRAL_DIRECTORY 16# define ZIPFILE_COMMENT_LENGTH 20/* The following structs are used to hold all header data of a zip entry. Traditionally, the structs' layouts followed the data layout of the corresponding zipfile header structures. However, the zipfile header layouts were designed in the old ages of 16-bit CPUs, they are subject to structure padding and/or alignment issues on newer systems with a "natural word width" of more than 2 bytes. Please note that the structure members are now reordered by size (top-down), to prevent internal padding and optimize memory usage! */ typedef struct local_file_header { /* LOCAL */ ulg csize; ulg ucsize; ulg last_mod_dos_datetime; ulg crc32; uch version_needed_to_extract[2]; ush general_purpose_bit_flag; ush compression_method; ush filename_length; ush extra_field_length; } local_file_hdr;#if 0 typedef struct central_directory_file_header { /* CENTRAL */ uch version_made_by[2]; uch version_needed_to_extract[2]; ush general_purpose_bit_flag; ush compression_method; ulg last_mod_dos_datetime; ulg crc32; ulg csize; ulg ucsize; ush filename_length; ush extra_field_length; ush file_comment_length; ush disk_number_start; ush internal_file_attributes; ulg external_file_attributes; ulg relative_offset_local_header; } cdir_file_hdr;#endif /* 0 */ typedef struct end_central_dir_record { /* END CENTRAL */ ush number_this_disk; ush num_disk_start_cdir; ush num_entries_centrl_dir_ths_disk; ush total_entries_central_dir; ulg size_central_directory; ulg offset_start_central_directory; ush zipfile_comment_length; } ecdir_rec;/* Huffman code lookup table entry--this entry is four bytes for machines that have 16-bit pointers (e.g. PC's in the small or medium model). Valid extra bits are 0..16. e == 31 is EOB (end of block), e == 32 means that v is a literal, 32 < e < 64 means that v is a pointer to the next table, which codes (e & 31) bits, and lastly e == 99 indicates an unused code. If a code with e == 99 is looked up, this implies an error in the data. */struct huft { uch e; /* number of extra bits or operation */ uch b; /* number of bits in this code or subcode */ union { ush n; /* literal, length base, or distance base */ struct huft *t; /* pointer to next level of table */ } v;};typedef struct _APIDocStruct { char *compare; char *function; char *syntax; char *purpose;} APIDocStruct;/*************//* Globals *//*************/#if (defined(OS2) && !defined(FUNZIP))# include "os2/os2data.h"#endif#include "globals.h"/*************************//* Function Prototypes *//*************************//*--------------------------------------------------------------------------- Functions in unzip.c (initialization routines): ---------------------------------------------------------------------------*/#ifndef WINDLL int MAIN OF((int argc, char **argv)); int unzip OF((__GPRO__ int argc, char **argv)); int uz_opts OF((__GPRO__ int *pargc, char ***pargv)); int usage OF((__GPRO__ int error));#endif /* !WINDLL *//*--------------------------------------------------------------------------- Functions in process.c (main driver routines): ---------------------------------------------------------------------------*/int process_zipfiles OF((__GPRO));void free_G_buffers OF((__GPRO));/* static int do_seekable OF((__GPRO__ int lastchance)); *//* static int find_ecrec OF((__GPRO__ long searchlen)); */int uz_end_central OF((__GPRO));int process_cdir_file_hdr OF((__GPRO));int get_cdir_ent OF((__GPRO));int process_local_file_hdr OF((__GPRO));unsigned ef_scan_for_izux OF((ZCONST uch *ef_buf, unsigned ef_len, int ef_is_c, ulg dos_mdatetime, iztimes *z_utim, ush *z_uidgid));#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS)) zvoid *getRISCOSexfield OF((ZCONST uch *ef_buf, unsigned ef_len));#endif#ifndef SFX/*--------------------------------------------------------------------------- Functions in zipinfo.c (`zipinfo-style' listing routines): ---------------------------------------------------------------------------*/#ifndef NO_ZIPINFO#ifndef WINDLL int zi_opts OF((__GPRO__ int *pargc, char ***pargv));#endifint zi_end_central OF((__GPRO));int zipinfo OF((__GPRO));/* static int zi_long OF((__GPRO__ ulg *pEndprev)); *//* static int zi_short OF((__GPRO)); *//* static char *zi_time OF((__GPRO__ ZCONST ulg *datetimez, ZCONST time_t *modtimez, char *d_t_str));*/#endif /* !NO_ZIPINFO *//*--------------------------------------------------------------------------- Functions in list.c (generic zipfile-listing routines): ---------------------------------------------------------------------------*/int list_files OF((__GPRO));#ifdef TIMESTAMP int get_time_stamp OF((__GPRO__ time_t *last_modtime, ulg *nmember));#endifint ratio OF((ulg uc, ulg c));void fnprint OF((__GPRO));#endif /* !SFX *//*--------------------------------------------------------------------------- Functions in fileio.c: ---------------------------------------------------------------------------*/int open_input_file OF((__GPRO));int open_outfile OF((__GPRO)); /* also vms.c */void undefer_input OF((__GPRO));void defer_leftover_input OF((__GPRO));unsigned readbuf OF((__GPRO__ char *buf, register unsigned len));int readbyte
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -