📄 unzip2.h
字号:
#ifdef WILD_STAT_BUG
# define SSTAT(path,pbuf) (iswild(path) || stat(path,pbuf))
#else
# define SSTAT stat
#endif
#ifdef REGULUS /* returns the inode number on success(!)...argh argh argh */
# define stat(p,s) zstat(p,s)
#endif
#define STRNICMP zstrnicmp
/***************************/
/* OS-Dependent Includes */
/***************************/
#ifdef EFT
# define LONGINT off_t /* Amdahl UTS nonsense ("extended file types") */
#else
# define LONGINT long
#endif
#ifdef MODERN
# ifndef NO_STDDEF_H
# include <stddef.h>
# endif
# ifndef NO_STDLIB_H
# include <stdlib.h> /* standard library prototypes, malloc(), etc. */
# endif
typedef size_t extent;
typedef void zvoid;
#else /* !MODERN */
# ifndef AOS_VS /* mostly modern? */
# ifndef CMS_MVS
LONGINT lseek();
# endif
# ifdef VAXC /* not fully modern, but does have stdlib.h and void */
# include <stdlib.h>
# else
char *malloc();
# define void int
# endif /* ?VAXC */
# endif /* !AOS_VS */
typedef unsigned int extent;
typedef char zvoid;
#endif /* ?MODERN */
typedef unsigned char uch; /* code assumes unsigned bytes; these type- */
typedef unsigned short ush; /* defs replace byte/UWORD/ULONG (which are */
typedef unsigned long ulg; /* predefined on some systems) & match zip */
/* InputFn is not yet used and is likely to change: */
#ifdef PROTO
typedef int (MsgFn) (zvoid *pG, uch *buf, ulg size, int flag);
typedef int (InputFn) (zvoid *pG, uch *buf, int *size, int flag);
typedef void (PauseFn) (zvoid *pG, ZCONST char *prompt, int flag);
typedef int (PasswdFn) (zvoid *pG, int *rcnt, char *pwbuf, int size,
ZCONST char *zfn, ZCONST char *efn);
#ifdef WINDLL
typedef int (WINAPI ReplaceFn) (char *);
typedef void (WINAPI SoundFn) (void);
#endif
#else
typedef int (MsgFn) ();
typedef int (InputFn) ();
typedef void (PauseFn) ();
typedef int (PasswdFn) ();
#ifdef WINDLL
typedef int (WINAPI ReplaceFn) ();
typedef void (WINAPI SoundFn) ();
#endif
#endif
typedef struct _UzpBuffer { /* rxstr */
ulg strlength; /* length of string */
char *strptr; /* pointer to string */
} UzpBuffer;
typedef struct _UzpInit {
ulg structlen; /* length of the struct being passed */
/* GRR: can we assume that each of these is a 32-bit pointer? if not,
* does it matter? add "far" keyword to make sure? */
MsgFn *msgfn;
InputFn *inputfn;
PauseFn *pausefn;
void (*userfn)(); /* user init function to be called after globals */
/* constructed and initialized */
/* pointer to program's environment area or something? */
/* hooks for performance testing? */
/* hooks for extra unzip -v output? (detect CPU or other hardware?) */
/* anything else? let me (Greg) know... */
} UzpInit;
/* intended to be a private struct: */
typedef struct _ver {
uch major; /* e.g., integer 5 */
uch minor; /* e.g., 2 */
uch patchlevel; /* e.g., 0 */
uch not_used;
} _version_type;
typedef struct _UzpVer {
ulg structlen; /* length of the struct being passed */
ulg flag; /* bit 0: is_beta bit 1: uses_zlib */
char *betalevel; /* e.g., "g BETA" or "" */
char *date; /* e.g., "4 Sep 95" (beta) or "4 September 1995" */
char *zlib_version; /* e.g., "0.95" or NULL */
_version_type unzip;
_version_type zipinfo;
_version_type os2dll;
_version_type windll;
} UzpVer;
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;
ush last_mod_file_time;
ush last_mod_file_date;
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;
#define UZPINIT_LEN sizeof(UzpInit)
#define UZPVER_LEN sizeof(UzpVer)
#define cbList(func) int (*func)(char *filename, cdir_file_hdr *crec)
/*---------------------------------------------------------------------------
Grab system-dependent definition of EXPENTRY for prototypes below.
---------------------------------------------------------------------------*/
#if 0
#if (defined(OS2) && !defined(FUNZIP))
# ifdef UNZIP_INTERNAL
# define INCL_NOPM
# define INCL_DOSNLS
# define INCL_DOSPROCESS
# define INCL_DOSDEVICES
# define INCL_DOSDEVIOCTL
# define INCL_DOSERRORS
# define INCL_DOSMISC
# ifdef OS2DLL
# define INCL_REXXSAA
# include <rexxsaa.h>
# endif
# endif /* UNZIP_INTERNAL */
# include <os2.h>
# define UZ_EXP EXPENTRY
#endif /* OS2 && !FUNZIP */
#endif /* 0 */
#if (defined(OS2) && !defined(FUNZIP))
# if defined(__IBMC__) || defined(__WATCOMC__)
# define UZ_EXP _System /* compiler keyword */
# else
# define UZ_EXP
# endif
#endif /* OS2 && !FUNZIP */
#ifdef WINDLL
# ifndef EXPENTRY
# define UZ_EXP WINAPI
# else
# define UZ_EXP EXPENTRY
# endif
#endif
#ifndef UZ_EXP
# define UZ_EXP
#endif
/*---------------------------------------------------------------------------
Return (and exit) values of the public UnZip API functions.
---------------------------------------------------------------------------*/
/* external return codes */
#define PK_OK 0 /* no error */
#define PK_COOL 0 /* no error */
#define PK_GNARLY 0 /* no error */
#define PK_WARN 1 /* warning error */
#define PK_ERR 2 /* error in zipfile */
#define PK_BADERR 3 /* severe error in zipfile */
#define PK_MEM 4 /* insufficient memory (during initialization) */
#define PK_MEM2 5 /* insufficient memory (password failure) */
#define PK_MEM3 6 /* insufficient memory (file decompression) */
#define PK_MEM4 7 /* insufficient memory (memory decompression) */
#define PK_MEM5 8 /* insufficient memory (not yet used) */
#define PK_NOZIP 9 /* zipfile not found */
#define PK_PARAM 10 /* bad or illegal parameters specified */
#define PK_FIND 11 /* no files found */
#define PK_DISK 50 /* disk full */
#define PK_EOF 51 /* unexpected EOF */
#define IZ_CTRLC 80 /* user hit ^C to terminate */
#define IZ_UNSUP 81 /* no files found: all unsup. compr/encrypt. */
#define IZ_BADPWD 82 /* no files found: all had bad password */
/* internal and DLL-only return codes */
#define IZ_DIR 76 /* potential zipfile is a directory */
#define IZ_CREATED_DIR 77 /* directory created: set time and permissions */
#define IZ_VOL_LABEL 78 /* volume label, but can't set on hard disk */
#define IZ_EF_TRUNC 79 /* local extra field truncated (PKZIP'd) */
/* return codes of password fetches (negative = user abort; positive = error) */
#define IZ_PW_ENTERED 0 /* got some password string; use/try it */
#define IZ_PW_CANCEL -1 /* no password available (for this entry) */
#define IZ_PW_CANCELALL -2 /* no password, skip any further pwd. request */
#define IZ_PW_ERROR 5 /* = PK_MEM2 : failure (no mem, no tty, ...) */
/*---------------------------------------------------------------------------
Prototypes for public UnZip API (DLL) functions.
---------------------------------------------------------------------------*/
int UZ_EXP UzpMain OF((int argc, char **argv));
int UZ_EXP UzpAltMain OF((int argc, char **argv, UzpInit *init));
UzpVer * UZ_EXP UzpVersion OF((void));
int UZ_EXP UzpUnzipToMemory OF((char *zip, char *file,
UzpBuffer *retstr));
int UZ_EXP UzpFileTree OF((char *name, cbList(callBack),
char *cpInclude[], char *cpExclude[]));
/* default I/O functions (can be swapped out via UzpAltMain() entry point): */
int UzpMessagePrnt OF((zvoid *pG, uch *buf, ulg size, int flag));
int UzpMessageNull OF((zvoid *pG, uch *buf, ulg size, int flag));
int UzpInput OF((zvoid *pG, uch *buf, int *size, int flag));
void UzpMorePause OF((zvoid *pG, ZCONST char *prompt, int flag));
int UzpPassword OF((zvoid *pG, int *rcnt, char *pwbuf, int size,
ZCONST char *zfn, ZCONST char *efn));
/*---------------------------------------------------------------------------
Remaining private stuff for UnZip compilation.
---------------------------------------------------------------------------*/
#ifdef UNZIP_INTERNAL
# include "unzpriv.h"
#endif
#endif /* !__unzip_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -