📄 unzpriv.h
字号:
#endif#ifndef DATE_FORMAT# define DATE_FORMAT DF_MDY /* defaults to US convention */#endif#ifndef DATE_SEPCHAR# define DATE_SEPCHAR '-'#endif#ifndef CLOSE_INFILE# define CLOSE_INFILE() close(G.zipfd)#endif#ifndef RETURN# define RETURN return /* only used in main() */#endif#ifndef EXIT# define EXIT exit#endif#ifndef USAGE# define USAGE(ret) usage(__G__ (ret)) /* used in unzip.c, zipinfo.c */#endif#ifndef TIMET_TO_NATIVE /* everybody but MSC 7.0 and Macintosh */# define TIMET_TO_NATIVE(x)# define NATIVE_TO_TIMET(x)#endif#ifndef SSTAT# ifdef WILD_STAT_BUG# define SSTAT(path,pbuf) (iswild(path) || stat(path,pbuf))# else# define SSTAT stat# endif#endif#ifndef STRNICMP# ifdef NO_STRNICMP# define STRNICMP zstrnicmp# else# define STRNICMP strnicmp# endif#endif#if (defined(DOS_FLX_NLM_OS2_W32) || defined(ATH_BEO_UNX) || defined(RISCOS))# ifndef HAVE_UNLINK# define HAVE_UNLINK# endif#endif#if (defined(AOS_VS) || defined(ATARI)) /* GRR: others? */# ifndef HAVE_UNLINK# define HAVE_UNLINK# endif#endif/* OS-specific exceptions to the "ANSI <--> INT_SPRINTF" rule */#if (!defined(PCHAR_SPRINTF) && !defined(INT_SPRINTF))# if (defined(SYSV) || defined(CONVEX) || defined(NeXT) || defined(BSD4_4))# define INT_SPRINTF /* sprintf() returns int: SysVish/Posix */# endif# if (defined(DOS_FLX_NLM_OS2_W32) || defined(VMS) || defined(AMIGA))# define INT_SPRINTF /* sprintf() returns int: ANSI */# endif# if (defined(ultrix) || defined(__ultrix)) /* Ultrix 4.3 and newer */# if (defined(POSIX) || defined(__POSIX))# define INT_SPRINTF /* sprintf() returns int: ANSI/Posix */# endif# ifdef __GNUC__# define PCHAR_SPRINTF /* undetermined actual return value */# endif# endif# if (defined(__osf__) || defined(_AIX) || defined(CMS_MVS) || defined(THEOS))# define INT_SPRINTF /* sprintf() returns int: ANSI/Posix */# endif# if defined(sun)# define PCHAR_SPRINTF /* sprintf() returns char *: SunOS cc *and* gcc */# endif#endif/* defaults that we hope will take care of most machines in the future */#if (!defined(PCHAR_SPRINTF) && !defined(INT_SPRINTF))# ifdef __STDC__# define INT_SPRINTF /* sprintf() returns int: ANSI */# endif# ifndef INT_SPRINTF# define PCHAR_SPRINTF /* sprintf() returns char *: BSDish */# endif#endif#define MSG_STDERR(f) (f & 1) /* bit 0: 0 = stdout, 1 = stderr */#define MSG_INFO(f) ((f & 6) == 0) /* bits 1 and 2: 0 = info */#define MSG_WARN(f) ((f & 6) == 2) /* bits 1 and 2: 1 = warning */#define MSG_ERROR(f) ((f & 6) == 4) /* bits 1 and 2: 2 = error */#define MSG_FATAL(f) ((f & 6) == 6) /* bits 1 and 2: (3 = fatal error) */#define MSG_ZFN(f) (f & 0x0008) /* bit 3: 1 = print zipfile name */#define MSG_FN(f) (f & 0x0010) /* bit 4: 1 = print filename */#define MSG_LNEWLN(f) (f & 0x0020) /* bit 5: 1 = leading newline if !SOL */#define MSG_TNEWLN(f) (f & 0x0040) /* bit 6: 1 = trailing newline if !SOL */#define MSG_MNEWLN(f) (f & 0x0080) /* bit 7: 1 = trailing NL for prompts *//* the following are subject to change */#define MSG_NO_WGUI(f) (f & 0x0100) /* bit 8: 1 = skip if Windows GUI */#define MSG_NO_AGUI(f) (f & 0x0200) /* bit 9: 1 = skip if Acorn GUI */#define MSG_NO_DLL2(f) (f & 0x0400) /* bit 10: 1 = skip if OS/2 DLL */#define MSG_NO_NDLL(f) (f & 0x0800) /* bit 11: 1 = skip if WIN32 DLL */#define MSG_NO_WDLL(f) (f & 0x1000) /* bit 12: 1 = skip if Windows DLL */#if (defined(MORE) && !defined(SCREENLINES))# ifdef DOS_FLX_NLM_OS2_W32# define SCREENLINES 25 /* can be (should be) a function instead */# else# define SCREENLINES 24 /* VT-100s are assumed to be minimal hardware */# endif#endif#if (defined(MORE) && !defined(SCREENSIZE))# ifndef SCREENWIDTH# define SCREENSIZE(scrrows, scrcols) { \ if ((scrrows) != NULL) *(scrrows) = SCREENLINES; }# else# define SCREENSIZE(scrrows, scrcols) { \ if ((scrrows) != NULL) *(scrrows) = SCREENLINES; \ if ((scrcols) != NULL) *(scrcols) = SCREENWIDTH; }# endif#endif#define DIR_BLKSIZ 64 /* number of directory entries per block * (should fit in 4096 bytes, usually) */#ifndef WSIZE# ifdef USE_DEFLATE64# define WSIZE 65536L /* window size--must be a power of two, and */# else /* at least 64K for PKZip's deflate64 method */# define WSIZE 0x8000 /* window size--must be a power of two, and */# endif /* at least 32K for zip's deflate method */#endif#ifdef __16BIT__# ifndef INT_16BIT# define INT_16BIT /* on 16-bit systems int size is 16 bits */# endif#else# define nearmalloc malloc# define nearfree free# if (!defined(__IBMC__) || !defined(OS2))# ifndef near# define near# endif# ifndef far# define far# endif# endif#endif#if (defined(DYNALLOC_CRCTAB) && !defined(DYNAMIC_CRC_TABLE))# undef DYNALLOC_CRCTAB#endif#if (defined(DYNALLOC_CRCTAB) && defined(REENTRANT))# undef DYNALLOC_CRCTAB /* not safe with reentrant code */#endif#if (defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB))# ifdef DYNALLOC_CRCTAB# undef DYNALLOC_CRCTAB# endif#endif#if (defined(USE_ZLIB) && defined(ASM_CRC))# undef ASM_CRC#endif#ifndef INBUFSIZ# if (defined(MED_MEM) || defined(SMALL_MEM))# define INBUFSIZ 2048 /* works for MS-DOS small model */# else# define INBUFSIZ 8192 /* larger buffers for real OSes */# endif#endif#if (defined(INT_16BIT) && (defined(USE_DEFLATE64) || lenEOL > 1)) /* For environments using 16-bit integers OUTBUFSIZ must be limited to * less than 64k (do_string() uses "unsigned" in calculations involving * OUTBUFSIZ). This is achieved by defining MED_MEM when WSIZE = 64k (aka * Deflate64 support enabled) or EOL markers consist multiple characters. * (The rule gets applied AFTER the default rule for INBUFSIZ because it * is not neccessary to reduce INBUFSIZE in this case.) */# if (!defined(SMALL_MEM) && !defined(MED_MEM))# define MED_MEM# endif#endif/* Logic for case of small memory, length of EOL > 1: if OUTBUFSIZ == 2048, * OUTBUFSIZ>>1 == 1024 and OUTBUFSIZ>>7 == 16; therefore rawbuf is 1008 bytes * and transbuf 1040 bytes. Have room for 32 extra EOL chars; 1008/32 == 31.5 * chars/line, smaller than estimated 35-70 characters per line for C source * and normal text. Hence difference is sufficient for most "average" files. * (Argument scales for larger OUTBUFSIZ.) */#ifdef SMALL_MEM /* i.e., 16-bit OSes: MS-DOS, OS/2 1.x, etc. */# define LoadFarString(x) fLoadFarString(__G__ (x))# define LoadFarStringSmall(x) fLoadFarStringSmall(__G__ (x))# define LoadFarStringSmall2(x) fLoadFarStringSmall2(__G__ (x))# if (defined(_MSC_VER) && (_MSC_VER >= 600))# define zfstrcpy(dest, src) _fstrcpy((dest), (src))# define zfstrcmp(s1, s2) _fstrcmp((s1), (s2))# endif# if !(defined(SFX) || defined(FUNZIP))# if (defined(_MSC_VER))# define zfmalloc(sz) _fmalloc((sz))# define zffree(x) _ffree(x)# endif# if (defined(__TURBOC__))# include <alloc.h># define zfmalloc(sz) farmalloc((unsigned long)(sz))# define zffree(x) farfree(x)# endif# endif /* !(SFX || FUNZIP) */# ifndef Far# define Far far /* __far only works for MSC 6.00, not 6.0a or Borland */# endif# define OUTBUFSIZ INBUFSIZ# if (lenEOL == 1)# define RAWBUFSIZ (OUTBUFSIZ>>1)# else# define RAWBUFSIZ ((OUTBUFSIZ>>1) - (OUTBUFSIZ>>7))# endif# define TRANSBUFSIZ (OUTBUFSIZ-RAWBUFSIZ) typedef short shrint; /* short/int or "shrink int" (unshrink) */#else# define zfstrcpy(dest, src) strcpy((dest), (src))# define zfstrcmp(s1, s2) strcmp((s1), (s2))# define zfmalloc malloc# define zffree(x) free(x)# ifdef QDOS# define LoadFarString(x) Qstrfix(x) /* fix up _ for '.' */# define LoadFarStringSmall(x) Qstrfix(x)# define LoadFarStringSmall2(x) Qstrfix(x)# else# define LoadFarString(x) (char *)(x)# define LoadFarStringSmall(x) (char *)(x)# define LoadFarStringSmall2(x) (char *)(x)# endif# ifdef MED_MEM# define OUTBUFSIZ 0xFF80 /* can't malloc arrays of 0xFFE8 or more */# define TRANSBUFSIZ 0xFF80 typedef short shrint;# else# define OUTBUFSIZ (lenEOL*WSIZE) /* more efficient text conversion */# define TRANSBUFSIZ (lenEOL*OUTBUFSIZ)# ifdef AMIGA typedef short shrint;# else typedef int shrint; /* for efficiency/speed, we hope... */# endif# endif /* ?MED_MEM */# define RAWBUFSIZ OUTBUFSIZ#endif /* ?SMALL_MEM */#ifndef Far# define Far#endif#ifndef Cdecl# define Cdecl#endif#ifndef MAIN# define MAIN main#endif#ifdef SFX /* disable some unused features for SFX executables */# ifndef NO_ZIPINFO# define NO_ZIPINFO# endif# ifdef TIMESTAMP# undef TIMESTAMP# endif#endif#ifdef SFX# ifdef CHEAP_SFX_AUTORUN# ifndef NO_SFX_EXDIR# define NO_SFX_EXDIR# endif# endif# ifndef NO_SFX_EXDIR# ifndef SFX_EXDIR# define SFX_EXDIR# endif# else# ifdef SFX_EXDIR# undef SFX_EXDIR# endif# endif#endif/* user may have defined both by accident... NOTIMESTAMP takes precedence */#if (defined(TIMESTAMP) && defined(NOTIMESTAMP))# undef TIMESTAMP#endif#if (!defined(COPYRIGHT_CLEAN) && !defined(USE_SMITH_CODE))# define COPYRIGHT_CLEAN#endif/* The LZW patent is expired worldwide since 2004-Jul-07, so USE_UNSHRINK * is now enabled by default. See unshrink.c. */#if (!defined(LZW_CLEAN) && !defined(USE_UNSHRINK))# define USE_UNSHRINK#endif#ifndef O_BINARY# define O_BINARY 0#endif#ifndef PIPE_ERROR# define PIPE_ERROR (errno == EPIPE)#endif/* File operations--use "b" for binary if allowed or fixed length 512 on VMS */#ifdef VMS# define FOPR "r","ctx=stm"# define FOPM "r+","ctx=stm","rfm=fix","mrs=512"# define FOPW "w","ctx=stm","rfm=fix","mrs=512"#endif /* VMS */#ifdef CMS_MVS/* Binary files must be RECFM=F,LRECL=1 for ftell() to get correct pos *//* ...unless byteseek is used. Let's try that for a while. */# define FOPR "rb,byteseek"# define FOPM "r+b,byteseek"# ifdef MVS# define FOPW "wb,recfm=u,lrecl=32760,byteseek" /* New binary files */# define FOPWE "wb" /* Existing binary files */# define FOPWT "w,lrecl=133" /* New text files */# define FOPWTE "w" /* Existing text files */# else# define FOPW "wb,recfm=v,lrecl=32760"# define FOPWT "w"# endif#endif /* CMS_MVS */#ifdef TOPS20 /* TOPS-20 MODERN? You kidding? */# define FOPW "w8"#endif /* TOPS20 *//* Defaults when nothing special has been defined previously. */#ifdef MODERN# ifndef FOPR# define FOPR "rb"# endif# ifndef FOPM# define FOPM "r+b"# endif# ifndef FOPW# define FOPW "wb"# endif# ifndef FOPWT# define FOPWT "wt"# endif#else /* !MODERN */# ifndef FOPR# define FOPR "r"# endif# ifndef FOPM# define FOPM "r+"# endif# ifndef FOPW# define FOPW "w"# endif# ifndef FOPWT# define FOPWT "w"# endif#endif /* ?MODERN *//* * If <limits.h> exists on most systems, should include that, since it may * define some or all of the following: NAME_MAX, PATH_MAX, _POSIX_NAME_MAX, * _POSIX_PATH_MAX. */#ifdef DOS_FLX_NLM_OS2_W32# include <limits.h>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -