Blob


1 typedef struct ZipHead ZipHead;
3 enum
4 {
5 /*
6 * magic numbers
7 */
8 ZHeader = 0x04034b50,
9 ZCHeader = 0x02014b50,
10 ZECHeader = 0x06054b50,
12 /*
13 * "general purpose flag" bits
14 */
15 ZEncrypted = 1 << 0,
16 ZTrailInfo = 1 << 3, /* uncsize, csize, and crc are in trailer */
17 ZCompPatch = 1 << 5, /* compression patched data */
19 /* ZCrcPoly = 0xedb88320, */
20 #define ZCrcPoly 0xedb88320
22 /*
23 * compression method
24 */
25 ZDeflate = 8,
27 /*
28 * internal file attributes
29 */
30 ZIsText = 1 << 0,
32 /*
33 * file attribute interpretation, from high byte of version
34 */
35 ZDos = 0,
36 ZAmiga = 1,
37 ZVMS = 2,
38 ZUnix = 3,
39 ZVMCMS = 4,
40 ZAtariST = 5,
41 ZOS2HPFS = 6,
42 ZMac = 7,
43 ZZsys = 8,
44 ZCPM = 9,
45 ZNtfs = 10,
47 /*
48 * external attribute flags for ZDos
49 */
50 ZDROnly = 0x01,
51 ZDHidden = 0x02,
52 ZDSystem = 0x04,
53 ZDVLable = 0x08,
54 ZDDir = 0x10,
55 ZDArch = 0x20,
57 ZHeadSize = 4 + 2 + 2 + 2 + 2 + 2 + 4 + 4 + 4 + 2 + 2,
58 ZHeadCrc = 4 + 2 + 2 + 2 + 2 + 2,
59 ZTrailSize = 4 + 4 + 4,
60 ZCHeadSize = 4 + 2 + 2 + 2 + 2 + 2 + 2 + 4 + 4 + 4 + 2 + 2 + 2 + 2 + 2 + 4 + 4,
61 ZECHeadSize = 4 + 2 + 2 + 2 + 2 + 4 + 4 + 2
62 };
64 /*
65 * interesting info from a zip header
66 */
67 struct ZipHead
68 {
69 int madeos; /* version made by */
70 int madevers;
71 int extos; /* version needed to extract */
72 int extvers;
73 int flags; /* general purpose bit flag */
74 int meth;
75 int modtime;
76 int moddate;
77 ulong crc;
78 ulong csize;
79 ulong uncsize;
80 int iattr;
81 ulong eattr;
82 ulong off;
83 char *file;
84 };