⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unzip.h

📁 另一个解zip文件的程序
💻 H
📖 第 1 页 / 共 5 页
字号:




/**************/
/*  Typedefs  */
/**************/

typedef char              boolean;
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  */

typedef struct min_info {
    long offset;
    ulg compr_size;          /* compressed size (needed if extended header) */
    ulg crc;                 /* crc (needed if extended header) */
    int 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 */
} min_info;

typedef struct VMStimbuf {
    char *revdate;           /* (both correspond to Unix modtime/st_mtime) */
    char *credate;
} VMStimbuf;

/*---------------------------------------------------------------------------
    Zipfile work area declarations.
  ---------------------------------------------------------------------------*/

#ifdef MALLOC_WORK

   union work {
     struct {
       short *Prefix_of;            /* (8193 * sizeof(short)) */
       uch *Suffix_of;
       uch *Stack;
     } shrink;                      /* unshrink() */
     uch *Slide;                    /* explode(), inflate(), unreduce() */
   };
#  define prefix_of  area.shrink.Prefix_of
#  define suffix_of  area.shrink.Suffix_of
#  define stack      area.shrink.Stack

#else /* !MALLOC_WORK */

#  ifdef NEW_UNSHRINK   /* weird segmentation violations if union NODE array */
     union work {
       uch Stack[8192];             /* unshrink() */
       uch Slide[WSIZE];            /* explode(), inflate(), unreduce() */
     };
#    define stack  area.Stack
#  else
     union work {
       struct {
         short Prefix_of[HSIZE];    /* (8192 * sizeof(short)) */
         uch Suffix_of[HSIZE];
         uch Stack[HSIZE];
       } shrink;
       uch Slide[WSIZE];            /* explode(), inflate(), unreduce() */
     };
#    define prefix_of  area.shrink.Prefix_of
#    define suffix_of  area.shrink.Suffix_of
#    define stack      area.shrink.Stack
#  endif /* ?NEW_UNSHRINK */

#endif /* ?MALLOC_WORK */

#define slide  area.Slide

/*---------------------------------------------------------------------------
    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_FILE_TIME              6
#      define L_LAST_MOD_FILE_DATE              8
#      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_FILE_TIME              8
#      define C_LAST_MOD_FILE_DATE              10
#      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


   typedef struct local_file_header {                 /* LOCAL */
       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;
   } local_file_hdr;

   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;

   typedef struct end_central_dir_record {            /* END CENTRAL */
       ush number_this_disk;
       ush num_disk_with_start_central_dir;
       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;





/*************************/
/*  Function Prototypes  */
/*************************/

#ifndef __
#  define __   OF
#endif

/*---------------------------------------------------------------------------
    Functions in unzip.c (main initialization/driver routines):
  ---------------------------------------------------------------------------*/

int    uz_opts                   __((int *pargc, char ***pargv));
int    usage                     __((int error));
int    process_zipfiles          __((void));
int    do_seekable               __((int lastchance));
int    uz_end_central            __((void));
int    process_cdir_file_hdr     __((void));
int    process_local_file_hdr    __((void));

/*---------------------------------------------------------------------------
    Functions in zipinfo.c (zipfile-listing routines):
  ---------------------------------------------------------------------------*/

int    zi_opts                   __((int *pargc, char ***pargv));
int    zi_end_central            __((void));
int    zipinfo                   __((void));
/* static int    zi_long         __((void)); */
/* static int    zi_short        __((void)); */
/* static char  *zi_time         __((ush *datez, ush *timez)); */
ulg    SizeOfEAs                 __((void *extra_field));  /* also in os2.c? */
int    list_files                __((void));
/* static int    ratio           __((ulg uc, ulg c)); */

/*---------------------------------------------------------------------------
    Functions in file_io.c:
  ---------------------------------------------------------------------------*/

int      open_input_file    __((void));
int      open_outfile       __((void));                        /* also vms.c */
unsigned readbuf            __((char *buf, register unsigned len));
int      FillBitBuffer      __((void));
int      readbyte           __((void));
#ifdef FUNZIP
   int   flush              __((ulg size));
#else
   int   flush              __((uch *buf, ulg size, int unshrink));
#endif
void     handler            __((int signal));
time_t   dos_to_unix_time   __((unsigned ddate, unsigned dtime));
int      check_for_newer    __((char *filename));       /* also os2.c, vms.c */
int      find_ecrec         __((long searchlen));
int      get_cdir_ent       __((void));
int      do_string          __((unsigned int len, int option));
ush      makeword           __((uch *b));
ulg      makelong           __((uch *sig));
int      zstrnicmp __((register char *s1, register char *s2, register int n));

#ifdef ZMEM   /* MUST be ifdef'd because of conflicts with the standard def. */
   char *memset __((register char *, register char, register unsigned int));
   char *memcpy __((register char *, register char *, register unsigned int));
#endif

#ifdef SMALL_MEM
   char *LoadFarString         __((char Far *sz));
   char *LoadFarStringSmall    __((char Far *sz));
   char *LoadFarStringSmall2   __((char Far *sz));
   char Far * Far zfstrcpy     __((char Far *s1, const char Far *s2));
#endif


/*---------------------------------------------------------------------------
    Functions in extract.c:
  ---------------------------------------------------------------------------*/

int    extract_or_test_files     __((void));
/* static int   store_info               __((void)); */
/* static int   extract_or_test_member   __((void)); */
int    memextract                __((uch *, ulg, uch *, ulg));
int    FlushMemory               __((void));
int    ReadMemoryByte            __((ush *x));

/*---------------------------------------------------------------------------
    Decompression functions:
  ---------------------------------------------------------------------------*/

int    explode                   __((void));                    /* explode.c */
int    inflate                   __((void));                    /* inflate.c */
int    inflate_free              __((void));                    /* inflate.c */
void   unreduce                  __((void));                   /* unreduce.c */
/* static void  LoadFollowers    __((void));                    * unreduce.c */
int    unshrink                  __((void));                   /* unshrink.c */
/* static void  partial_clear    __((void));                    * unshrink.c */

/*---------------------------------------------------------------------------
    Human68K-only functions:
  ---------------------------------------------------------------------------*/

#ifdef __human68k__
   void     InitTwentyOne        __((void));
#endif

/*---------------------------------------------------------------------------
    Macintosh-only functions:
  ---------------------------------------------------------------------------*/

#ifdef MACOS
   int      macmkdir             __((char *, short, long));
   short    macopen              __((char *, short, short, long));
   FILE    *macfopen             __((char *, char *, short, long));
   short    maccreat             __((char *, short, long, OSType, OSType));
   short    macread              __((short, char *, unsigned));
   long     macwrite             __((short, char *, unsigned));
   short    macclose             __((short));
   long     maclseek             __((short, long, short));
   char    *macgetenv            __((char *));
   char    *wfgets               __((char *, int, FILE *));
   void     wfprintf             __((FILE *, char *, ...));
   void     wprintf              __((char *, ...));
#endif

/*---------------------------------------------------------------------------
    MSDOS-only functions:
  ---------------------------------------------------------------------------*/

#if (defined(__GO32__) || (defined(MSDOS) && defined(__EMX__)))
   unsigned _dos_getcountryinfo(void *);                          /* msdos.c */
   void _dos_setftime(int, unsigned short, unsigned short);       /* msdos.c */
   void _dos_setfileattr(char *, int);                            /* msdos.c */
   unsigned _dos_creat(char *, unsigned, int *);                  /* msdos.c */
   void _dos_getdrive(unsigned *);                                /* msdos.c */
   unsigned _dos_close(int);                                      /* msdos.c */
#endif

/*---------------------------------------------------------------------------
    OS/2-only functions:
  ---------------------------------------------------------------------------*/

#ifdef OS2  /* GetFileTime conflicts with something in NT header files */
   int   GetCountryInfo   __((void));                               /* os2.c */
   long  GetFileTime      __((char *name));                         /* os2.c */
   void  SetPathInfo      __((char *path, ush moddate, ush modtime, int flags));
   int   IsEA             __((void *extra_field));                  /* os2.c */
   void  SetEAs           __((char *path, void *eablock));          /* os2.c */
   ulg   SizeOfEAs        __((void *extra_field));                  /* os2.c */
/* static int   IsFileNameValid __((char *name));                      os2.c */
/* static void  map2fat         __((char *pathcomp, char **pEndFAT));  os2.c */
/* static int   SetLongNameEA   __((char *name, char *longname));      os2.c */
/* static void  InitNLS         __((void));                            os2.c */
   int   IsUpperNLS       __((int nChr));                           /* os2.c */
   int   ToLowerNLS       __((int nChr));                           /* os2.c */
   void  DebugMalloc      __((void));                               /* os2.c */
#endif

/*---------------------------------------------------------------------------
    TOPS20-only functions:
  ---------------------------------------------------------------------------*/

#ifdef TOPS20
   int upper               __((char *s));                        /* tops20.c */
   int enquote             __((char *s));                        /* tops20.c */
   int dequote             __((char *s));                        /* tops20.c */
   int fnlegal             __(());  /* error if prototyped(?) */ /* tops20.c */
#endif

/*---------------------------------------------------------------------------
    VMS-only functions:
  ---------------------------------------------------------------------------*/

#ifdef VMS
   int    check_format        __((void));                           /* vms.c */
   int    find_vms_attrs      __((void));                           /* vms.c */
   int    CloseOutputFile     __((void));                           /* vms.c */
/* static uch *extract_block  __((struct extra_block *, int *, uch *, int)); */
/* static int  _flush_blocks  __((int final_flag));                  * vms.c */
/* static int  _flush_records __((int final_flag));                  * vms.c */
/* static int  WriteBuffer    __((unsigned char *buf, int len));     * vms.c */
/* static int  WriteRecord    __((unsigned char *rec, int len));     * vms.c */
/* static void message        __((int string, char *status));        * vms.c */
   void   return_VMS          __((int zip_error));                  /* vms.c */
#ifdef VMSCLI
   ulg    vms_unzip_cmdline   __((int *, char ***));            /* cmdline.c */
#endif
#endif

/*---------------------------------------------------------------------------
    Miscellaneous/shared functions:
  ---------------------------------------------------------------------------*/

int      match           __((char *s, char *p, int ic));          /* match.c */
int      iswild          __((char *p));                           /* match.c */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -