home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-1.iso / Files / Unstuffers / Other Compression / MacGzip 0.21-src-c.sit / macgzip_021-src / unzip.c < prev    next >
MacBinary  |  1993-12-10  |  6.6 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: unzip.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Fri Dec 10 19:49:29 1993, modified Fri Dec 10 19:49:29 1993, creator Think C, type ASCII, 6097 bytes "unzip.c" , at 0x1851 412 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 07 75 6e 7a 69 70 2e | 63 00 00 00 00 00 00 00 |..unzip.|c.......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 00 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 17 d1 00 | 00 01 9c a9 2e c9 99 a9 |........|........|
|00000060| 2e c9 99 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 dc dd 00 00 |........|........|
|00000080| 2f 2a 20 75 6e 7a 69 70 | 2e 63 20 2d 2d 20 64 65 |/* unzip|.c -- de|
|00000090| 63 6f 6d 70 72 65 73 73 | 20 66 69 6c 65 73 20 69 |compress| files i|
|000000a0| 6e 20 67 7a 69 70 20 6f | 72 20 70 6b 7a 69 70 20 |n gzip o|r pkzip |
|000000b0| 66 6f 72 6d 61 74 2e 0d | 20 2a 20 43 6f 70 79 72 |format..| * Copyr|
|000000c0| 69 67 68 74 20 28 43 29 | 20 31 39 39 32 2d 31 39 |ight (C)| 1992-19|
|000000d0| 39 33 20 4a 65 61 6e 2d | 6c 6f 75 70 20 47 61 69 |93 Jean-|loup Gai|
|000000e0| 6c 6c 79 0d 20 2a 20 54 | 68 69 73 20 69 73 20 66 |lly. * T|his is f|
|000000f0| 72 65 65 20 73 6f 66 74 | 77 61 72 65 3b 20 79 6f |ree soft|ware; yo|
|00000100| 75 20 63 61 6e 20 72 65 | 64 69 73 74 72 69 62 75 |u can re|distribu|
|00000110| 74 65 20 69 74 20 61 6e | 64 2f 6f 72 20 6d 6f 64 |te it an|d/or mod|
|00000120| 69 66 79 20 69 74 20 75 | 6e 64 65 72 20 74 68 65 |ify it u|nder the|
|00000130| 0d 20 2a 20 74 65 72 6d | 73 20 6f 66 20 74 68 65 |. * term|s of the|
|00000140| 20 47 4e 55 20 47 65 6e | 65 72 61 6c 20 50 75 62 | GNU Gen|eral Pub|
|00000150| 6c 69 63 20 4c 69 63 65 | 6e 73 65 2c 20 73 65 65 |lic Lice|nse, see|
|00000160| 20 74 68 65 20 66 69 6c | 65 20 43 4f 50 59 49 4e | the fil|e COPYIN|
|00000170| 47 2e 0d 20 2a 0d 20 2a | 20 54 68 65 20 63 6f 64 |G.. *. *| The cod|
|00000180| 65 20 69 6e 20 74 68 69 | 73 20 66 69 6c 65 20 69 |e in thi|s file i|
|00000190| 73 20 64 65 72 69 76 65 | 64 20 66 72 6f 6d 20 74 |s derive|d from t|
|000001a0| 68 65 20 66 69 6c 65 20 | 66 75 6e 7a 69 70 2e 63 |he file |funzip.c|
|000001b0| 20 77 72 69 74 74 65 6e | 0d 20 2a 20 61 6e 64 20 | written|. * and |
|000001c0| 70 75 74 20 69 6e 20 74 | 68 65 20 70 75 62 6c 69 |put in t|he publi|
|000001d0| 63 20 64 6f 6d 61 69 6e | 20 62 79 20 4d 61 72 6b |c domain| by Mark|
|000001e0| 20 41 64 6c 65 72 2e 0d | 20 2a 2f 0d 0d 2f 2a 0d | Adler..| */../*.|
|000001f0| 20 2a 20 4d 6f 64 69 66 | 69 65 64 3a 31 39 39 33 | * Modif|ied:1993|
|00000200| 20 62 79 20 53 50 44 73 | 6f 66 74 20 66 6f 72 20 | by SPDs|oft for |
|00000210| 4d 61 63 47 7a 69 70 0d | 20 2a 0d 20 2a 2f 0d 0d |MacGzip.| *. */..|
|00000220| 0d 2f 2a 0d 20 20 20 54 | 68 69 73 20 76 65 72 73 |./*. T|his vers|
|00000230| 69 6f 6e 20 63 61 6e 20 | 65 78 74 72 61 63 74 20 |ion can |extract |
|00000240| 66 69 6c 65 73 20 69 6e | 20 67 7a 69 70 20 6f 72 |files in| gzip or|
|00000250| 20 70 6b 7a 69 70 20 66 | 6f 72 6d 61 74 2e 0d 20 | pkzip f|ormat.. |
|00000260| 20 20 46 6f 72 20 74 68 | 65 20 6c 61 74 74 65 72 | For th|e latter|
|00000270| 2c 20 6f 6e 6c 79 20 74 | 68 65 20 66 69 72 73 74 |, only t|he first|
|00000280| 20 65 6e 74 72 79 20 69 | 73 20 65 78 74 72 61 63 | entry i|s extrac|
|00000290| 74 65 64 2c 20 61 6e 64 | 20 69 74 20 68 61 73 20 |ted, and| it has |
|000002a0| 74 6f 20 62 65 0d 20 20 | 20 65 69 74 68 65 72 20 |to be. | either |
|000002b0| 64 65 66 6c 61 74 65 64 | 20 6f 72 20 73 74 6f 72 |deflated| or stor|
|000002c0| 65 64 2e 0d 20 2a 2f 0d | 0d 23 69 66 64 65 66 20 |ed.. */.|.#ifdef |
|000002d0| 52 43 53 49 44 0d 73 74 | 61 74 69 63 20 63 68 61 |RCSID.st|atic cha|
|000002e0| 72 20 72 63 73 69 64 5b | 5d 20 3d 20 22 24 49 64 |r rcsid[|] = "$Id|
|000002f0| 3a 20 75 6e 7a 69 70 2e | 63 2c 76 20 30 2e 31 33 |: unzip.|c,v 0.13|
|00000300| 20 31 39 39 33 2f 30 36 | 2f 31 30 20 31 33 3a 32 | 1993/06|/10 13:2|
|00000310| 39 3a 30 30 20 6a 6c 6f | 75 70 20 45 78 70 20 24 |9:00 jlo|up Exp $|
|00000320| 22 3b 0d 23 65 6e 64 69 | 66 0d 0d 23 69 6e 63 6c |";.#endi|f..#incl|
|00000330| 75 64 65 20 22 74 61 69 | 6c 6f 72 2e 68 22 0d 23 |ude "tai|lor.h".#|
|00000340| 69 6e 63 6c 75 64 65 20 | 22 67 7a 69 70 2e 68 22 |include |"gzip.h"|
|00000350| 0d 23 69 6e 63 6c 75 64 | 65 20 22 63 72 79 70 74 |.#includ|e "crypt|
|00000360| 2e 68 22 0d 0d 23 69 6e | 63 6c 75 64 65 20 22 4d |.h"..#in|clude "M|
|00000370| 61 63 45 72 72 6f 72 73 | 2e 68 22 0d 0d 2f 2a 20 |acErrors|.h"../* |
|00000380| 50 4b 5a 49 50 20 68 65 | 61 64 65 72 20 64 65 66 |PKZIP he|ader def|
|00000390| 69 6e 69 74 69 6f 6e 73 | 20 2a 2f 0d 23 64 65 66 |initions| */.#def|
|000003a0| 69 6e 65 20 4c 4f 43 53 | 49 47 20 30 78 30 34 30 |ine LOCS|IG 0x040|
|000003b0| 33 34 62 35 30 4c 20 20 | 20 20 20 20 2f 2a 20 66 |34b50L | /* f|
|000003c0| 6f 75 72 2d 62 79 74 65 | 20 6c 65 61 64 2d 69 6e |our-byte| lead-in|
|000003d0| 20 28 6c 73 62 20 66 69 | 72 73 74 29 20 2a 2f 0d | (lsb fi|rst) */.|
|000003e0| 23 64 65 66 69 6e 65 20 | 4c 4f 43 46 4c 47 20 36 |#define |LOCFLG 6|
|000003f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000400| 2f 2a 20 6f 66 66 73 65 | 74 20 6f 66 20 62 69 74 |/* offse|t of bit|
|00000410| 20 66 6c 61 67 20 2a 2f | 0d 23 64 65 66 69 6e 65 | flag */|.#define|
|00000420| 20 20 43 52 50 46 4c 47 | 20 31 20 20 20 20 20 20 | CRPFLG| 1 |
|00000430| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 20 62 69 74 | | /* bit|
|00000440| 20 66 6f 72 20 65 6e 63 | 72 79 70 74 65 64 20 65 | for enc|rypted e|
|00000450| 6e 74 72 79 20 2a 2f 0d | 23 64 65 66 69 6e 65 20 |ntry */.|#define |
|00000460| 20 45 58 54 46 4c 47 20 | 38 20 20 20 20 20 20 20 | EXTFLG |8 |
|00000470| 20 20 20 20 20 20 20 20 | 2f 2a 20 20 62 69 74 20 | |/* bit |
|00000480| 66 6f 72 20 65 78 74 65 | 6e 64 65 64 20 6c 6f 63 |for exte|nded loc|
|00000490| 61 6c 20 68 65 61 64 65 | 72 20 2a 2f 0d 23 64 65 |al heade|r */.#de|
|000004a0| 66 69 6e 65 20 4c 4f 43 | 48 4f 57 20 38 20 20 20 |fine LOC|HOW 8 |
|000004b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|000004c0| 6f 66 66 73 65 74 20 6f | 66 20 63 6f 6d 70 72 65 |offset o|f compre|
|000004d0| 73 73 69 6f 6e 20 6d 65 | 74 68 6f 64 20 2a 2f 0d |ssion me|thod */.|
|000004e0| 23 64 65 66 69 6e 65 20 | 4c 4f 43 54 49 4d 20 31 |#define |LOCTIM 1|
|000004f0| 30 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |0 | |
|00000500| 2f 2a 20 66 69 6c 65 20 | 6d 6f 64 20 74 69 6d 65 |/* file |mod time|
|00000510| 20 28 66 6f 72 20 64 65 | 63 72 79 70 74 69 6f 6e | (for de|cryption|
|00000520| 29 20 2a 2f 0d 23 64 65 | 66 69 6e 65 20 4c 4f 43 |) */.#de|fine LOC|
|00000530| 43 52 43 20 31 34 20 20 | 20 20 20 20 20 20 20 20 |CRC 14 | |
|00000540| 20 20 20 20 20 2f 2a 20 | 6f 66 66 73 65 74 20 6f | /* |offset o|
|00000550| 66 20 63 72 63 20 2a 2f | 0d 23 64 65 66 69 6e 65 |f crc */|.#define|
|00000560| 20 4c 4f 43 53 49 5a 20 | 31 38 20 20 20 20 20 20 | LOCSIZ |18 |
|00000570| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 6f 66 66 73 | | /* offs|
|00000580| 65 74 20 6f 66 20 63 6f | 6d 70 72 65 73 73 65 64 |et of co|mpressed|
|00000590| 20 73 69 7a 65 20 2a 2f | 0d 23 64 65 66 69 6e 65 | size */|.#define|
|000005a0| 20 4c 4f 43 4c 45 4e 20 | 32 32 20 20 20 20 20 20 | LOCLEN |22 |
|000005b0| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 6f 66 66 73 | | /* offs|
|000005c0| 65 74 20 6f 66 20 75 6e | 63 6f 6d 70 72 65 73 73 |et of un|compress|
|000005d0| 65 64 20 6c 65 6e 67 74 | 68 20 2a 2f 0d 23 64 65 |ed lengt|h */.#de|
|000005e0| 66 69 6e 65 20 4c 4f 43 | 46 49 4c 20 32 36 20 20 |fine LOC|FIL 26 |
|000005f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|00000600| 6f 66 66 73 65 74 20 6f | 66 20 66 69 6c 65 20 6e |offset o|f file n|
|00000610| 61 6d 65 20 66 69 65 6c | 64 20 6c 65 6e 67 74 68 |ame fiel|d length|
|00000620| 20 2a 2f 0d 23 64 65 66 | 69 6e 65 20 4c 4f 43 45 | */.#def|ine LOCE|
|00000630| 58 54 20 32 38 20 20 20 | 20 20 20 20 20 20 20 20 |XT 28 | |
|00000640| 20 20 20 20 2f 2a 20 6f | 66 66 73 65 74 20 6f 66 | /* o|ffset of|
|00000650| 20 65 78 74 72 61 20 66 | 69 65 6c 64 20 6c 65 6e | extra f|ield len|
|00000660| 67 74 68 20 2a 2f 0d 23 | 64 65 66 69 6e 65 20 4c |gth */.#|define L|
|00000670| 4f 43 48 44 52 20 33 30 | 20 20 20 20 20 20 20 20 |OCHDR 30| |
|00000680| 20 20 20 20 20 20 20 2f | 2a 20 73 69 7a 65 20 6f | /|* size o|
|00000690| 66 20 6c 6f 63 61 6c 20 | 68 65 61 64 65 72 2c 20 |f local |header, |
|000006a0| 69 6e 63 6c 75 64 69 6e | 67 20 73 69 67 20 2a 2f |includin|g sig */|
|000006b0| 0d 23 64 65 66 69 6e 65 | 20 45 58 54 48 44 52 20 |.#define| EXTHDR |
|000006c0| 31 36 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |16 | |
|000006d0| 20 2f 2a 20 73 69 7a 65 | 20 6f 66 20 65 78 74 65 | /* size| of exte|
|000006e0| 6e 64 65 64 20 6c 6f 63 | 61 6c 20 68 65 61 64 65 |nded loc|al heade|
|000006f0| 72 2c 20 69 6e 63 20 73 | 69 67 20 2a 2f 0d 0d 0d |r, inc s|ig */...|
|00000700| 2f 2a 20 47 6c 6f 62 61 | 6c 73 20 2a 2f 0d 0d 69 |/* Globa|ls */..i|
|00000710| 6e 74 20 64 65 63 72 79 | 70 74 3b 20 20 20 20 20 |nt decry|pt; |
|00000720| 20 20 20 2f 2a 20 66 6c | 61 67 20 74 6f 20 74 75 | /* fl|ag to tu|
|00000730| 72 6e 20 6f 6e 20 64 65 | 63 72 79 70 74 69 6f 6e |rn on de|cryption|
|00000740| 20 2a 2f 0d 63 68 61 72 | 20 2a 6b 65 79 3b 20 20 | */.char| *key; |
|00000750| 20 20 20 20 20 20 20 20 | 2f 2a 20 6e 6f 74 20 75 | |/* not u|
|00000760| 73 65 64 2d 2d 6e 65 65 | 64 65 64 20 74 6f 20 6c |sed--nee|ded to l|
|00000770| 69 6e 6b 20 63 72 79 70 | 74 2e 63 20 2a 2f 0d 69 |ink cryp|t.c */.i|
|00000780| 6e 74 20 70 6b 7a 69 70 | 20 3d 20 30 3b 20 20 20 |nt pkzip| = 0; |
|00000790| 20 20 20 2f 2a 20 73 65 | 74 20 66 6f 72 20 61 20 | /* se|t for a |
|000007a0| 70 6b 7a 69 70 20 66 69 | 6c 65 20 2a 2f 0d 69 6e |pkzip fi|le */.in|
|000007b0| 74 20 65 78 74 5f 68 65 | 61 64 65 72 20 3d 20 30 |t ext_he|ader = 0|
|000007c0| 3b 20 2f 2a 20 73 65 74 | 20 69 66 20 65 78 74 65 |; /* set| if exte|
|000007d0| 6e 64 65 64 20 6c 6f 63 | 61 6c 20 68 65 61 64 65 |nded loc|al heade|
|000007e0| 72 20 2a 2f 0d 0d 2f 2a | 20 3d 3d 3d 3d 3d 3d 3d |r */../*| =======|
|000007f0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000800| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000810| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000820| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000830| 3d 3d 3d 3d 0d 20 2a 20 | 43 68 65 63 6b 20 7a 69 |====. * |Check zi|
|00000840| 70 20 66 69 6c 65 20 61 | 6e 64 20 61 64 76 61 6e |p file a|nd advan|
|00000850| 63 65 20 69 6e 70 74 72 | 20 74 6f 20 74 68 65 20 |ce inptr| to the |
|00000860| 73 74 61 72 74 20 6f 66 | 20 74 68 65 20 63 6f 6d |start of| the com|
|00000870| 70 72 65 73 73 65 64 20 | 64 61 74 61 2e 0d 20 2a |pressed |data.. *|
|00000880| 20 47 65 74 20 6f 66 6e | 61 6d 65 20 66 72 6f 6d | Get ofn|ame from|
|00000890| 20 74 68 65 20 6c 6f 63 | 61 6c 20 68 65 61 64 65 | the loc|al heade|
|000008a0| 72 20 69 66 20 6e 65 63 | 65 73 73 61 72 79 2e 0d |r if nec|essary..|
|000008b0| 20 2a 2f 0d 69 6e 74 20 | 63 68 65 63 6b 5f 7a 69 | */.int |check_zi|
|000008c0| 70 66 69 6c 65 28 69 6e | 29 0d 20 20 20 20 69 6e |pfile(in|). in|
|000008d0| 74 20 69 6e 3b 20 20 20 | 2f 2a 20 69 6e 70 75 74 |t in; |/* input|
|000008e0| 20 66 69 6c 65 20 64 65 | 73 63 72 69 70 74 6f 72 | file de|scriptor|
|000008f0| 73 20 2a 2f 0d 7b 0d 20 | 20 20 20 75 63 68 20 2a |s */.{. | uch *|
|00000900| 68 20 3d 20 69 6e 62 75 | 66 20 2b 20 69 6e 70 74 |h = inbu|f + inpt|
|00000910| 72 3b 20 2f 2a 20 66 69 | 72 73 74 20 6c 6f 63 61 |r; /* fi|rst loca|
|00000920| 6c 20 68 65 61 64 65 72 | 20 2a 2f 0d 0d 20 20 20 |l header| */.. |
|00000930| 20 69 66 64 20 3d 20 69 | 6e 3b 0d 0d 20 20 20 20 | ifd = i|n;.. |
|00000940| 2f 2a 20 43 68 65 63 6b | 20 76 61 6c 69 64 69 74 |/* Check| validit|
|00000950| 79 20 6f 66 20 6c 6f 63 | 61 6c 20 68 65 61 64 65 |y of loc|al heade|
|00000960| 72 2c 20 61 6e 64 20 73 | 6b 69 70 20 6e 61 6d 65 |r, and s|kip name|
|00000970| 20 61 6e 64 20 65 78 74 | 72 61 20 66 69 65 6c 64 | and ext|ra field|
|00000980| 73 20 2a 2f 0d 20 20 20 | 20 69 6e 70 74 72 20 2b |s */. | inptr +|
|00000990| 3d 20 4c 4f 43 48 44 52 | 20 2b 20 53 48 28 68 20 |= LOCHDR| + SH(h |
|000009a0| 2b 20 4c 4f 43 46 49 4c | 29 20 2b 20 53 48 28 68 |+ LOCFIL|) + SH(h|
|000009b0| 20 2b 20 4c 4f 43 45 58 | 54 29 3b 0d 0d 20 20 20 | + LOCEX|T);.. |
|000009c0| 20 69 66 20 28 69 6e 70 | 74 72 20 3e 20 69 6e 73 | if (inp|tr > ins|
|000009d0| 69 7a 65 20 7c 7c 20 4c | 47 28 68 29 20 21 3d 20 |ize || L|G(h) != |
|000009e0| 4c 4f 43 53 49 47 29 20 | 7b 0d 09 73 70 72 69 6e |LOCSIG) |{..sprin|
|000009f0| 74 66 28 73 74 72 65 72 | 72 2c 20 22 25 73 3a 20 |tf(strer|r, "%s: |
|00000a00| 6e 6f 74 20 61 20 76 61 | 6c 69 64 20 7a 69 70 20 |not a va|lid zip |
|00000a10| 66 69 6c 65 22 2c 69 66 | 6e 61 6d 65 29 3b 0d 09 |file",if|name);..|
|00000a20| 43 61 6c 65 72 74 28 73 | 74 72 65 72 72 29 3b 0d |Calert(s|trerr);.|
|00000a30| 09 65 78 69 74 5f 63 6f | 64 65 20 3d 20 45 52 52 |.exit_co|de = ERR|
|00000a40| 4f 52 3b 0d 09 72 65 74 | 75 72 6e 20 45 52 52 4f |OR;..ret|urn ERRO|
|00000a50| 52 3b 0d 20 20 20 20 7d | 0d 20 20 20 20 6d 65 74 |R;. }|. met|
|00000a60| 68 6f 64 20 3d 20 68 5b | 4c 4f 43 48 4f 57 5d 3b |hod = h[|LOCHOW];|
|00000a70| 0d 20 20 20 20 69 66 20 | 28 6d 65 74 68 6f 64 20 |. if |(method |
|00000a80| 21 3d 20 53 54 4f 52 45 | 44 20 26 26 20 6d 65 74 |!= STORE|D && met|
|00000a90| 68 6f 64 20 21 3d 20 44 | 45 46 4c 41 54 45 44 29 |hod != D|EFLATED)|
|00000aa0| 20 7b 0d 09 73 70 72 69 | 6e 74 66 28 73 74 72 65 | {..spri|ntf(stre|
|00000ab0| 72 72 2c 0d 09 09 22 25 | 73 3a 20 66 69 72 73 74 |rr,..."%|s: first|
|00000ac0| 20 65 6e 74 72 79 20 6e | 6f 74 20 64 65 66 6c 61 | entry n|ot defla|
|00000ad0| 74 65 64 20 6f 72 20 73 | 74 6f 72 65 64 20 2d 2d |ted or s|tored --|
|00000ae0| 20 75 73 65 20 75 6e 7a | 69 70 22 2c 69 66 6e 61 | use unz|ip",ifna|
|00000af0| 6d 65 29 3b 0d 09 43 61 | 6c 65 72 74 28 73 74 72 |me);..Ca|lert(str|
|00000b00| 65 72 72 29 3b 0d 09 65 | 78 69 74 5f 63 6f 64 65 |err);..e|xit_code|
|00000b10| 20 3d 20 45 52 52 4f 52 | 3b 0d 09 72 65 74 75 72 | = ERROR|;..retur|
|00000b20| 6e 20 45 52 52 4f 52 3b | 0d 20 20 20 20 7d 0d 0d |n ERROR;|. }..|
|00000b30| 20 20 20 20 2f 2a 20 49 | 66 20 65 6e 74 72 79 20 | /* I|f entry |
|00000b40| 65 6e 63 72 79 70 74 65 | 64 2c 20 64 65 63 72 79 |encrypte|d, decry|
|00000b50| 70 74 20 61 6e 64 20 76 | 61 6c 69 64 61 74 65 20 |pt and v|alidate |
|00000b60| 65 6e 63 72 79 70 74 69 | 6f 6e 20 68 65 61 64 65 |encrypti|on heade|
|00000b70| 72 20 2a 2f 0d 20 20 20 | 20 69 66 20 28 28 64 65 |r */. | if ((de|
|00000b80| 63 72 79 70 74 20 3d 20 | 68 5b 4c 4f 43 46 4c 47 |crypt = |h[LOCFLG|
|00000b90| 5d 20 26 20 43 52 50 46 | 4c 47 29 20 21 3d 20 30 |] & CRPF|LG) != 0|
|00000ba0| 29 20 7b 0d 09 73 70 72 | 69 6e 74 66 28 73 74 72 |) {..spr|intf(str|
|00000bb0| 65 72 72 2c 20 22 25 73 | 3a 20 65 6e 63 72 79 70 |err, "%s|: encryp|
|00000bc0| 74 65 64 20 66 69 6c 65 | 20 2d 2d 20 75 73 65 20 |ted file| -- use |
|00000bd0| 75 6e 7a 69 70 22 2c 69 | 66 6e 61 6d 65 29 3b 0d |unzip",i|fname);.|
|00000be0| 09 43 61 6c 65 72 74 28 | 73 74 72 65 72 72 29 3b |.Calert(|strerr);|
|00000bf0| 0d 09 65 78 69 74 5f 63 | 6f 64 65 20 3d 20 45 52 |..exit_c|ode = ER|
|00000c00| 52 4f 52 3b 0d 09 72 65 | 74 75 72 6e 20 45 52 52 |ROR;..re|turn ERR|
|00000c10| 4f 52 3b 0d 20 20 20 20 | 7d 0d 0d 20 20 20 20 2f |OR;. |}.. /|
|00000c20| 2a 20 53 61 76 65 20 66 | 6c 61 67 73 20 66 6f 72 |* Save f|lags for|
|00000c30| 20 75 6e 7a 69 70 28 29 | 20 2a 2f 0d 20 20 20 20 | unzip()| */. |
|00000c40| 65 78 74 5f 68 65 61 64 | 65 72 20 3d 20 28 68 5b |ext_head|er = (h[|
|00000c50| 4c 4f 43 46 4c 47 5d 20 | 26 20 45 58 54 46 4c 47 |LOCFLG] |& EXTFLG|
|00000c60| 29 20 21 3d 20 30 3b 0d | 20 20 20 20 70 6b 7a 69 |) != 0;.| pkzi|
|00000c70| 70 20 3d 20 31 3b 0d 0d | 20 20 20 20 2f 2a 20 47 |p = 1;..| /* G|
|00000c80| 65 74 20 6f 66 6e 61 6d | 65 20 61 6e 64 20 74 69 |et ofnam|e and ti|
|00000c90| 6d 65 20 73 74 61 6d 70 | 20 66 72 6f 6d 20 6c 6f |me stamp| from lo|
|00000ca0| 63 61 6c 20 68 65 61 64 | 65 72 20 28 74 6f 20 62 |cal head|er (to b|
|00000cb0| 65 20 64 6f 6e 65 29 20 | 2a 2f 0d 20 20 20 20 72 |e done) |*/. r|
|00000cc0| 65 74 75 72 6e 20 4f 4b | 3b 0d 7d 0d 0d 2f 2a 20 |eturn OK|;.}../* |
|00000cd0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000ce0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000cf0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000d00| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000d10| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 0d 20 2a 20 55 |========|===. * U|
|00000d20| 6e 7a 69 70 20 69 6e 20 | 74 6f 20 6f 75 74 2e 20 |nzip in |to out. |
|00000d30| 20 54 68 69 73 20 72 6f | 75 74 69 6e 65 20 77 6f | This ro|utine wo|
|00000d40| 72 6b 73 20 6f 6e 20 62 | 6f 74 68 20 67 7a 69 70 |rks on b|oth gzip|
|00000d50| 20 61 6e 64 20 70 6b 7a | 69 70 20 66 69 6c 65 73 | and pkz|ip files|
|00000d60| 2e 0d 20 2a 0d 20 2a 20 | 49 4e 20 61 73 73 65 72 |.. *. * |IN asser|
|00000d70| 74 69 6f 6e 73 3a 20 74 | 68 65 20 62 75 66 66 65 |tions: t|he buffe|
|00000d80| 72 20 69 6e 62 75 66 20 | 63 6f 6e 74 61 69 6e 73 |r inbuf |contains|
|00000d90| 20 61 6c 72 65 61 64 79 | 20 74 68 65 20 62 65 67 | already| the beg|
|00000da0| 69 6e 6e 69 6e 67 20 6f | 66 0d 20 2a 20 20 20 74 |inning o|f. * t|
|00000db0| 68 65 20 63 6f 6d 70 72 | 65 73 73 65 64 20 64 61 |he compr|essed da|
|00000dc0| 74 61 2c 20 66 72 6f 6d | 20 6f 66 66 73 65 74 73 |ta, from| offsets|
|00000dd0| 20 69 6e 70 74 72 20 74 | 6f 20 69 6e 73 69 7a 65 | inptr t|o insize|
|00000de0| 2d 31 20 69 6e 63 6c 75 | 64 65 64 2e 0d 20 2a 20 |-1 inclu|ded.. * |
|00000df0| 20 20 54 68 65 20 6d 61 | 67 69 63 20 68 65 61 64 | The ma|gic head|
|00000e00| 65 72 20 68 61 73 20 61 | 6c 72 65 61 64 79 20 62 |er has a|lready b|
|00000e10| 65 65 6e 20 63 68 65 63 | 6b 65 64 2e 20 54 68 65 |een chec|ked. The|
|00000e20| 20 6f 75 74 70 75 74 20 | 62 75 66 66 65 72 20 69 | output |buffer i|
|00000e30| 73 20 63 6c 65 61 72 65 | 64 2e 0d 20 2a 2f 0d 69 |s cleare|d.. */.i|
|00000e40| 6e 74 20 75 6e 7a 69 70 | 28 69 6e 2c 20 6f 75 74 |nt unzip|(in, out|
|00000e50| 29 0d 20 20 20 20 69 6e | 74 20 69 6e 2c 20 6f 75 |). in|t in, ou|
|00000e60| 74 3b 20 20 20 2f 2a 20 | 69 6e 70 75 74 20 61 6e |t; /* |input an|
|00000e70| 64 20 6f 75 74 70 75 74 | 20 66 69 6c 65 20 64 65 |d output| file de|
|00000e80| 73 63 72 69 70 74 6f 72 | 73 20 2a 2f 0d 7b 0d 20 |scriptor|s */.{. |
|00000e90| 20 20 20 75 6c 67 20 6f | 72 69 67 5f 63 72 63 20 | ulg o|rig_crc |
|00000ea0| 3d 20 30 3b 20 20 20 20 | 20 20 20 2f 2a 20 6f 72 |= 0; | /* or|
|00000eb0| 69 67 69 6e 61 6c 20 63 | 72 63 20 2a 2f 0d 20 20 |iginal c|rc */. |
|00000ec0| 20 20 75 6c 67 20 6f 72 | 69 67 5f 6c 65 6e 20 3d | ulg or|ig_len =|
|00000ed0| 20 30 3b 20 20 20 20 20 | 20 20 2f 2a 20 6f 72 69 | 0; | /* ori|
|00000ee0| 67 69 6e 61 6c 20 75 6e | 63 6f 6d 70 72 65 73 73 |ginal un|compress|
|00000ef0| 65 64 20 6c 65 6e 67 74 | 68 20 2a 2f 0d 20 20 20 |ed lengt|h */. |
|00000f00| 20 69 6e 74 20 6e 3b 0d | 20 20 20 20 75 63 68 20 | int n;.| uch |
|00000f10| 62 75 66 5b 45 58 54 48 | 44 52 5d 3b 20 20 20 20 |buf[EXTH|DR]; |
|00000f20| 20 20 20 20 2f 2a 20 65 | 78 74 65 6e 64 65 64 20 | /* e|xtended |
|00000f30| 6c 6f 63 61 6c 20 68 65 | 61 64 65 72 20 2a 2f 0d |local he|ader */.|
|00000f40| 0d 20 20 20 20 69 66 64 | 20 3d 20 69 6e 3b 0d 20 |. ifd| = in;. |
|00000f50| 20 20 20 6f 66 64 20 3d | 20 6f 75 74 3b 0d 0d 20 | ofd =| out;.. |
|00000f60| 20 20 20 75 70 64 63 72 | 63 28 4e 55 4c 4c 2c 20 | updcr|c(NULL, |
|00000f70| 30 29 3b 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a |0); | /*|
|00000f80| 20 69 6e 69 74 69 61 6c | 69 7a 65 20 63 72 63 20 | initial|ize crc |
|00000f90| 2a 2f 0d 0d 20 20 20 20 | 69 66 20 28 70 6b 7a 69 |*/.. |if (pkzi|
|00000fa0| 70 20 26 26 20 21 65 78 | 74 5f 68 65 61 64 65 72 |p && !ex|t_header|
|00000fb0| 29 20 7b 20 20 2f 2a 20 | 63 72 63 20 61 6e 64 20 |) { /* |crc and |
|00000fc0| 6c 65 6e 67 74 68 20 61 | 74 20 74 68 65 20 65 6e |length a|t the en|
|00000fd0| 64 20 6f 74 68 65 72 77 | 69 73 65 20 2a 2f 0d 09 |d otherw|ise */..|
|00000fe0| 6f 72 69 67 5f 63 72 63 | 20 3d 20 4c 47 28 69 6e |orig_crc| = LG(in|
|00000ff0| 62 75 66 20 2b 20 4c 4f | 43 43 52 43 29 3b 0d 09 |buf + LO|CCRC);..|
|00001000| 6f 72 69 67 5f 6c 65 6e | 20 3d 20 4c 47 28 69 6e |orig_len| = LG(in|
|00001010| 62 75 66 20 2b 20 4c 4f | 43 4c 45 4e 29 3b 0d 20 |buf + LO|CLEN);. |
|00001020| 20 20 20 7d 0d 0d 20 20 | 20 20 2f 2a 20 44 65 63 | }.. | /* Dec|
|00001030| 6f 6d 70 72 65 73 73 20 | 2a 2f 0d 20 20 20 20 69 |ompress |*/. i|
|00001040| 66 20 28 6d 65 74 68 6f | 64 20 3d 3d 20 44 45 46 |f (metho|d == DEF|
|00001050| 4c 41 54 45 44 29 20 20 | 7b 0d 0d 09 69 6e 74 20 |LATED) |{...int |
|00001060| 72 65 73 20 3d 20 69 6e | 66 6c 61 74 65 28 29 3b |res = in|flate();|
|00001070| 0d 0d 09 69 66 20 28 72 | 65 73 20 3d 3d 20 33 29 |...if (r|es == 3)|
|00001080| 20 7b 0d 09 20 20 20 20 | 65 72 72 6f 72 28 22 6f | {.. |error("o|
|00001090| 75 74 20 6f 66 20 6d 65 | 6d 6f 72 79 22 29 3b 0d |ut of me|mory");.|
|000010a0| 09 7d 20 65 6c 73 65 20 | 69 66 20 28 72 65 73 20 |.} else |if (res |
|000010b0| 21 3d 20 30 29 20 7b 0d | 09 20 20 20 20 65 72 72 |!= 0) {.|. err|
|000010c0| 6f 72 28 22 69 6e 76 61 | 6c 69 64 20 63 6f 6d 70 |or("inva|lid comp|
|000010d0| 72 65 73 73 65 64 20 64 | 61 74 61 2d 2d 66 6f 72 |ressed d|ata--for|
|000010e0| 6d 61 74 20 76 69 6f 6c | 61 74 65 64 22 29 3b 0d |mat viol|ated");.|
|000010f0| 09 7d 0d 0d 20 20 20 20 | 7d 20 65 6c 73 65 20 69 |.}.. |} else i|
|00001100| 66 20 28 70 6b 7a 69 70 | 20 26 26 20 6d 65 74 68 |f (pkzip| && meth|
|00001110| 6f 64 20 3d 3d 20 53 54 | 4f 52 45 44 29 20 7b 0d |od == ST|ORED) {.|
|00001120| 0d 09 72 65 67 69 73 74 | 65 72 20 75 6c 67 20 6e |..regist|er ulg n|
|00001130| 20 3d 20 4c 47 28 69 6e | 62 75 66 20 2b 20 4c 4f | = LG(in|buf + LO|
|00001140| 43 4c 45 4e 29 3b 0d 0d | 09 69 66 20 28 6e 20 21 |CLEN);..|.if (n !|
|00001150| 3d 20 4c 47 28 69 6e 62 | 75 66 20 2b 20 4c 4f 43 |= LG(inb|uf + LOC|
|00001160| 53 49 5a 29 20 2d 20 28 | 64 65 63 72 79 70 74 20 |SIZ) - (|decrypt |
|00001170| 3f 20 52 41 4e 44 5f 48 | 45 41 44 5f 4c 45 4e 20 |? RAND_H|EAD_LEN |
|00001180| 3a 20 30 29 29 20 7b 0d | 0d 09 20 20 20 20 73 70 |: 0)) {.|.. sp|
|00001190| 72 69 6e 74 66 28 73 74 | 72 65 72 72 2c 20 22 6c |rintf(st|rerr, "l|
|000011a0| 65 6e 20 25 6c 64 2c 20 | 73 69 7a 20 25 6c 64 3a |en %ld, |siz %ld:|
|000011b0| 20 25 73 22 2c 20 6e 2c | 20 4c 47 28 69 6e 62 75 | %s", n,| LG(inbu|
|000011c0| 66 20 2b 20 4c 4f 43 53 | 49 5a 29 2c 0d 09 20 20 |f + LOCS|IZ),.. |
|000011d0| 20 20 22 69 6e 76 61 6c | 69 64 20 63 6f 6d 70 72 | "inval|id compr|
|000011e0| 65 73 73 65 64 20 64 61 | 74 61 2d 2d 6c 65 6e 67 |essed da|ta--leng|
|000011f0| 74 68 20 6d 69 73 6d 61 | 74 63 68 22 29 3b 0d 09 |th misma|tch");..|
|00001200| 20 20 20 20 65 72 72 6f | 72 28 73 74 72 65 72 72 | erro|r(strerr|
|00001210| 29 3b 0d 09 7d 0d 09 77 | 68 69 6c 65 20 28 6e 2d |);..}..w|hile (n-|
|00001220| 2d 29 20 7b 0d 09 20 20 | 20 20 75 63 68 20 63 20 |-) {.. | uch c |
|00001230| 3d 20 28 75 63 68 29 67 | 65 74 5f 62 79 74 65 28 |= (uch)g|et_byte(|
|00001240| 29 3b 0d 23 69 66 64 65 | 66 20 43 52 59 50 54 0d |);.#ifde|f CRYPT.|
|00001250| 09 20 20 20 20 69 66 20 | 28 64 65 63 72 79 70 74 |. if |(decrypt|
|00001260| 29 20 7a 64 65 63 6f 64 | 65 28 63 29 3b 0d 23 65 |) zdecod|e(c);.#e|
|00001270| 6e 64 69 66 0d 09 20 20 | 20 20 70 75 74 5f 75 62 |ndif.. | put_ub|
|00001280| 79 74 65 28 63 29 3b 0d | 09 7d 0d 09 66 6c 75 73 |yte(c);.|.}..flus|
|00001290| 68 5f 77 69 6e 64 6f 77 | 28 29 3b 0d 20 20 20 20 |h_window|();. |
|000012a0| 7d 20 65 6c 73 65 20 7b | 0d 09 65 72 72 6f 72 28 |} else {|..error(|
|000012b0| 22 69 6e 74 65 72 6e 61 | 6c 20 65 72 72 6f 72 2c |"interna|l error,|
|000012c0| 20 69 6e 76 61 6c 69 64 | 20 6d 65 74 68 6f 64 22 | invalid| method"|
|000012d0| 29 3b 0d 20 20 20 20 7d | 0d 0d 20 20 20 20 2f 2a |);. }|.. /*|
|000012e0| 20 47 65 74 20 74 68 65 | 20 63 72 63 20 61 6e 64 | Get the| crc and|
|000012f0| 20 6f 72 69 67 69 6e 61 | 6c 20 6c 65 6e 67 74 68 | origina|l length|
|00001300| 20 2a 2f 0d 20 20 20 20 | 69 66 20 28 21 70 6b 7a | */. |if (!pkz|
|00001310| 69 70 29 20 7b 0d 20 20 | 20 20 20 20 20 20 2f 2a |ip) {. | /*|
|00001320| 20 63 72 63 33 32 20 20 | 28 73 65 65 20 61 6c 67 | crc32 |(see alg|
|00001330| 6f 72 69 74 68 6d 2e 64 | 6f 63 29 0d 09 20 2a 20 |orithm.d|oc).. * |
|00001340| 75 6e 63 6f 6d 70 72 65 | 73 73 65 64 20 69 6e 70 |uncompre|ssed inp|
|00001350| 75 74 20 73 69 7a 65 20 | 6d 6f 64 75 6c 6f 20 32 |ut size |modulo 2|
|00001360| 5e 33 32 0d 20 20 20 20 | 20 20 20 20 20 2a 2f 0d |^32. | */.|
|00001370| 09 66 6f 72 20 28 6e 20 | 3d 20 30 3b 20 6e 20 3c |.for (n |= 0; n <|
|00001380| 20 38 3b 20 6e 2b 2b 29 | 20 7b 0d 09 20 20 20 20 | 8; n++)| {.. |
|00001390| 62 75 66 5b 6e 5d 20 3d | 20 28 75 63 68 29 67 65 |buf[n] =| (uch)ge|
|000013a0| 74 5f 62 79 74 65 28 29 | 3b 20 2f 2a 20 6d 61 79 |t_byte()|; /* may|
|000013b0| 20 63 61 75 73 65 20 61 | 6e 20 65 72 72 6f 72 20 | cause a|n error |
|000013c0| 69 66 20 45 4f 46 20 2a | 2f 0d 09 7d 0d 09 6f 72 |if EOF *|/..}..or|
|000013d0| 69 67 5f 63 72 63 20 3d | 20 4c 47 28 62 75 66 29 |ig_crc =| LG(buf)|
|000013e0| 3b 0d 09 6f 72 69 67 5f | 6c 65 6e 20 3d 20 4c 47 |;..orig_|len = LG|
|000013f0| 28 62 75 66 2b 34 29 3b | 0d 0d 20 20 20 20 7d 20 |(buf+4);|.. } |
|00001400| 65 6c 73 65 20 69 66 20 | 28 65 78 74 5f 68 65 61 |else if |(ext_hea|
|00001410| 64 65 72 29 20 7b 20 20 | 2f 2a 20 49 66 20 65 78 |der) { |/* If ex|
|00001420| 74 65 6e 64 65 64 20 68 | 65 61 64 65 72 2c 20 63 |tended h|eader, c|
|00001430| 68 65 63 6b 20 69 74 20 | 2a 2f 0d 09 2f 2a 20 73 |heck it |*/../* s|
|00001440| 69 67 6e 61 74 75 72 65 | 20 2d 20 34 62 79 74 65 |ignature| - 4byte|
|00001450| 73 3a 20 30 78 35 30 20 | 30 78 34 62 20 30 78 30 |s: 0x50 |0x4b 0x0|
|00001460| 37 20 30 78 30 38 0d 09 | 20 2a 20 43 52 43 2d 33 |7 0x08..| * CRC-3|
|00001470| 32 20 76 61 6c 75 65 0d | 20 20 20 20 20 20 20 20 |2 value.| |
|00001480| 20 2a 20 63 6f 6d 70 72 | 65 73 73 65 64 20 73 69 | * compr|essed si|
|00001490| 7a 65 20 34 2d 62 79 74 | 65 73 0d 20 20 20 20 20 |ze 4-byt|es. |
|000014a0| 20 20 20 20 2a 20 75 6e | 63 6f 6d 70 72 65 73 73 | * un|compress|
|000014b0| 65 64 20 73 69 7a 65 20 | 34 2d 62 79 74 65 73 0d |ed size |4-bytes.|
|000014c0| 09 20 2a 2f 0d 09 66 6f | 72 20 28 6e 20 3d 20 30 |. */..fo|r (n = 0|
|000014d0| 3b 20 6e 20 3c 20 45 58 | 54 48 44 52 3b 20 6e 2b |; n < EX|THDR; n+|
|000014e0| 2b 29 20 7b 0d 09 20 20 | 20 20 62 75 66 5b 6e 5d |+) {.. | buf[n]|
|000014f0| 20 3d 20 28 75 63 68 29 | 67 65 74 5f 62 79 74 65 | = (uch)|get_byte|
|00001500| 28 29 3b 20 2f 2a 20 6d | 61 79 20 63 61 75 73 65 |(); /* m|ay cause|
|00001510| 20 61 6e 20 65 72 72 6f | 72 20 69 66 20 45 4f 46 | an erro|r if EOF|
|00001520| 20 2a 2f 0d 09 7d 0d 09 | 6f 72 69 67 5f 63 72 63 | */..}..|orig_crc|
|00001530| 20 3d 20 4c 47 28 62 75 | 66 2b 34 29 3b 0d 09 6f | = LG(bu|f+4);..o|
|00001540| 72 69 67 5f 6c 65 6e 20 | 3d 20 4c 47 28 62 75 66 |rig_len |= LG(buf|
|00001550| 2b 31 32 29 3b 0d 20 20 | 20 20 7d 0d 0d 20 20 20 |+12);. | }.. |
|00001560| 20 2f 2a 20 56 61 6c 69 | 64 61 74 65 20 64 65 63 | /* Vali|date dec|
|00001570| 6f 6d 70 72 65 73 73 69 | 6f 6e 20 2a 2f 0d 20 20 |ompressi|on */. |
|00001580| 20 20 69 66 20 28 6f 72 | 69 67 5f 63 72 63 20 21 | if (or|ig_crc !|
|00001590| 3d 20 75 70 64 63 72 63 | 28 6f 75 74 62 75 66 2c |= updcrc|(outbuf,|
|000015a0| 20 30 29 29 20 7b 0d 09 | 65 72 72 6f 72 28 22 69 | 0)) {..|error("i|
|000015b0| 6e 76 61 6c 69 64 20 63 | 6f 6d 70 72 65 73 73 65 |nvalid c|ompresse|
|000015c0| 64 20 64 61 74 61 2d 2d | 63 72 63 20 65 72 72 6f |d data--|crc erro|
|000015d0| 72 22 29 3b 0d 20 20 20 | 20 7d 0d 20 20 20 20 69 |r");. | }. i|
|000015e0| 66 20 28 6f 72 69 67 5f | 6c 65 6e 20 21 3d 20 28 |f (orig_|len != (|
|000015f0| 75 6c 67 29 62 79 74 65 | 73 5f 6f 75 74 29 20 7b |ulg)byte|s_out) {|
|00001600| 0d 09 65 72 72 6f 72 28 | 22 69 6e 76 61 6c 69 64 |..error(|"invalid|
|00001610| 20 63 6f 6d 70 72 65 73 | 73 65 64 20 64 61 74 61 | compres|sed data|
|00001620| 2d 2d 6c 65 6e 67 74 68 | 20 65 72 72 6f 72 22 29 |--length| error")|
|00001630| 3b 0d 20 20 20 20 7d 0d | 0d 20 20 20 20 2f 2a 20 |;. }.|. /* |
|00001640| 43 68 65 63 6b 20 69 66 | 20 74 68 65 72 65 20 61 |Check if| there a|
|00001650| 72 65 20 6d 6f 72 65 20 | 65 6e 74 72 69 65 73 20 |re more |entries |
|00001660| 69 6e 20 61 20 70 6b 7a | 69 70 20 66 69 6c 65 20 |in a pkz|ip file |
|00001670| 2a 2f 0d 20 20 20 20 69 | 66 20 28 70 6b 7a 69 70 |*/. i|f (pkzip|
|00001680| 20 26 26 20 69 6e 70 74 | 72 20 2b 20 34 20 3c 20 | && inpt|r + 4 < |
|00001690| 69 6e 73 69 7a 65 20 26 | 26 20 4c 47 28 69 6e 62 |insize &|& LG(inb|
|000016a0| 75 66 2b 69 6e 70 74 72 | 29 20 3d 3d 20 4c 4f 43 |uf+inptr|) == LOC|
|000016b0| 53 49 47 29 20 7b 0d 09 | 69 66 20 28 74 6f 5f 73 |SIG) {..|if (to_s|
|000016c0| 74 64 6f 75 74 29 20 7b | 0d 09 20 20 20 20 57 41 |tdout) {|.. WA|
|000016d0| 52 4e 28 28 73 74 72 65 | 72 72 2c 0d 09 09 20 20 |RN((stre|rr,... |
|000016e0| 22 25 73 3a 20 25 73 20 | 68 61 73 20 6d 6f 72 65 |"%s: %s |has more|
|000016f0| 20 74 68 61 6e 20 6f 6e | 65 20 65 6e 74 72 79 2d | than on|e entry-|
|00001700| 2d 72 65 73 74 20 69 67 | 6e 6f 72 65 64 22 2c 0d |-rest ig|nored",.|
|00001710| 09 09 20 20 70 72 6f 67 | 6e 61 6d 65 2c 20 69 66 |.. prog|name, if|
|00001720| 6e 61 6d 65 29 29 3b 0d | 09 7d 20 65 6c 73 65 20 |name));.|.} else |
|00001730| 7b 0d 09 20 20 20 20 2f | 2a 20 44 6f 6e 27 74 20 |{.. /|* Don't |
|00001740| 64 65 73 74 72 6f 79 20 | 74 68 65 20 69 6e 70 75 |destroy |the inpu|
|00001750| 74 20 7a 69 70 20 66 69 | 6c 65 20 2a 2f 0d 09 20 |t zip fi|le */.. |
|00001760| 20 20 20 73 70 72 69 6e | 74 66 28 73 74 72 65 72 | sprin|tf(strer|
|00001770| 72 2c 0d 09 09 20 20 20 | 20 22 25 73 20 68 61 73 |r,... | "%s has|
|00001780| 20 6d 6f 72 65 20 74 68 | 61 6e 20 6f 6e 65 20 65 | more th|an one e|
|00001790| 6e 74 72 79 20 2d 2d 20 | 75 6e 63 68 61 6e 67 65 |ntry -- |unchange|
|000017a0| 64 22 2c 20 69 66 6e 61 | 6d 65 29 3b 0d 09 09 43 |d", ifna|me);...C|
|000017b0| 61 6c 65 72 74 28 73 74 | 72 65 72 72 29 3b 0d 09 |alert(st|rerr);..|
|000017c0| 20 20 20 20 65 78 69 74 | 5f 63 6f 64 65 20 3d 20 | exit|_code = |
|000017d0| 45 52 52 4f 52 3b 0d 09 | 20 20 20 20 65 78 74 5f |ERROR;..| ext_|
|000017e0| 68 65 61 64 65 72 20 3d | 20 70 6b 7a 69 70 20 3d |header =| pkzip =|
|000017f0| 20 30 3b 0d 09 20 20 20 | 20 72 65 74 75 72 6e 20 | 0;.. | return |
|00001800| 45 52 52 4f 52 3b 0d 09 | 7d 0d 20 20 20 20 7d 0d |ERROR;..|}. }.|
|00001810| 20 20 20 20 65 78 74 5f | 68 65 61 64 65 72 20 3d | ext_|header =|
|00001820| 20 70 6b 7a 69 70 20 3d | 20 30 3b 20 2f 2a 20 66 | pkzip =| 0; /* f|
|00001830| 6f 72 20 6e 65 78 74 20 | 66 69 6c 65 20 2a 2f 0d |or next |file */.|
|00001840| 20 20 20 20 72 65 74 75 | 72 6e 20 4f 4b 3b 0d 7d | retu|rn OK;.}|
|00001850| 0d 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001860| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001870| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001880| 00 00 01 00 00 00 01 56 | 00 00 00 56 00 00 00 46 |.......V|...V...F|
|00001890| 00 00 83 01 13 4d 61 63 | 50 6f 73 74 20 50 72 65 |.....Mac|Post Pre|
|000018a0| 66 65 72 65 6e 63 65 73 | 00 00 00 00 00 00 00 00 |ferences|........|
|000018b0| 07 75 6e 7a 69 70 2e 63 | 02 00 00 00 50 61 72 74 |.unzip.c|....Part|
|000018c0| 53 49 54 78 00 00 00 00 | 00 00 00 00 00 02 37 dd |SITx....|......7.|
|000018d0| 00 00 50 61 72 74 53 49 | 54 78 00 00 00 00 00 00 |..PartSI|Tx......|
|000018e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018f0| 00 00 a9 f7 c0 1b 00 00 | 00 00 00 00 01 9c 00 00 |........|........|
|00001900| 00 00 00 00 00 00 00 00 | 00 00 03 65 25 00 00 00 |........|...e%...|
|00001910| 87 ed 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001930| 00 00 00 00 03 62 25 00 | 00 00 87 ee 08 64 69 78 |.....b%.|.....dix|
|00001940| 6f 6e 2e 74 78 00 00 00 | 00 00 00 00 00 00 00 00 |on.tx...|........|
|00001950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 02 73 |........|.......s|
|00001960| 25 00 00 00 87 f0 09 44 | 44 69 78 6f 6e 2e 73 6c |%......D|Dixon.sl|
|00001970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001980| 00 00 00 1e 00 00 0e 0f | 00 6d 00 00 00 00 00 00 |........|.m......|
|00001990| 10 a1 00 89 00 00 00 00 | 00 00 14 a7 00 b1 00 00 |........|........|
|000019a0| 00 00 00 00 00 30 00 02 | 00 14 00 00 0e 0f 00 6d |.....0..|.......m|
|000019b0| 01 93 47 f0 00 00 05 70 | 6b 7a 69 70 00 1a 00 00 |..G....p|kzip....|
|000019c0| 0e 0f 00 6d 01 93 47 e0 | 00 00 0b 65 78 74 5f 68 |...m..G.|...ext_h|
|000019d0| 65 61 64 65 72 20 00 00 | 01 00 00 00 01 56 00 00 |eader ..|.....V..|
|000019e0| 00 56 00 00 00 46 01 b3 | de 80 25 18 00 00 00 1c |.V...F..|..%.....|
|000019f0| 00 46 00 01 42 4b 50 54 | 00 00 00 12 44 54 56 55 |.F..BKPT|....DTVU|
|00001a00| 00 00 00 1e 6e f4 ff ff | 00 00 00 00 00 00 00 00 |....n...|........|
|00001a10| 33 8b ff ff 00 00 00 22 | 00 00 00 00 00 00 00 00 |3......"|........|
|00001a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+