Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6725 | siemargl | 1 | /*--------------------------------------------------------------------------- |
2 | |||
3 | unzip.h (new) |
||
4 | |||
5 | Copyright (c) 1990-2009 Info-ZIP. All rights reserved. |
||
6 | |||
7 | This header file contains the public macros and typedefs required by |
||
8 | both the UnZip sources and by any application using the UnZip API. If |
||
9 | UNZIP_INTERNAL is defined, it includes unzpriv.h (containing includes, |
||
10 | prototypes and extern variables used by the actual UnZip sources). |
||
11 | |||
12 | ---------------------------------------------------------------------------*/ |
||
13 | /*--------------------------------------------------------------------------- |
||
14 | This is version 2009-Jan-02 of the Info-ZIP license. |
||
15 | The definitive version of this document should be available at |
||
16 | ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and |
||
17 | a copy at http://www.info-zip.org/pub/infozip/license.html. |
||
18 | |||
19 | |||
20 | Copyright (c) 1990-2009 Info-ZIP. All rights reserved. |
||
21 | |||
22 | For the purposes of this copyright and license, "Info-ZIP" is defined as |
||
23 | the following set of individuals: |
||
24 | |||
25 | Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, |
||
26 | Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth, |
||
27 | Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, |
||
28 | David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko, |
||
29 | Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, |
||
30 | Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda, |
||
31 | Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren, |
||
32 | Rich Wales, Mike White. |
||
33 | |||
34 | This software is provided "as is," without warranty of any kind, express |
||
35 | or implied. In no event shall Info-ZIP or its contributors be held liable |
||
36 | for any direct, indirect, incidental, special or consequential damages |
||
37 | arising out of the use of or inability to use this software. |
||
38 | |||
39 | Permission is granted to anyone to use this software for any purpose, |
||
40 | including commercial applications, and to alter it and redistribute it |
||
41 | freely, subject to the above disclaimer and the following restrictions: |
||
42 | |||
43 | 1. Redistributions of source code (in whole or in part) must retain |
||
44 | the above copyright notice, definition, disclaimer, and this list |
||
45 | of conditions. |
||
46 | |||
47 | 2. Redistributions in binary form (compiled executables and libraries) |
||
48 | must reproduce the above copyright notice, definition, disclaimer, |
||
49 | and this list of conditions in documentation and/or other materials |
||
50 | provided with the distribution. Additional documentation is not needed |
||
51 | for executables where a command line license option provides these and |
||
52 | a note regarding this option is in the executable's startup banner. The |
||
53 | sole exception to this condition is redistribution of a standard |
||
54 | UnZipSFX binary (including SFXWiz) as part of a self-extracting archive; |
||
55 | that is permitted without inclusion of this license, as long as the |
||
56 | normal SFX banner has not been removed from the binary or disabled. |
||
57 | |||
58 | 3. Altered versions--including, but not limited to, ports to new operating |
||
59 | systems, existing ports with new graphical interfaces, versions with |
||
60 | modified or added functionality, and dynamic, shared, or static library |
||
61 | versions not from Info-ZIP--must be plainly marked as such and must not |
||
62 | be misrepresented as being the original source or, if binaries, |
||
63 | compiled from the original source. Such altered versions also must not |
||
64 | be misrepresented as being Info-ZIP releases--including, but not |
||
65 | limited to, labeling of the altered versions with the names "Info-ZIP" |
||
66 | (or any variation thereof, including, but not limited to, different |
||
67 | capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the |
||
68 | explicit permission of Info-ZIP. Such altered versions are further |
||
69 | prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP |
||
70 | e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP |
||
71 | will provide support for the altered versions. |
||
72 | |||
73 | 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," |
||
74 | "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its |
||
75 | own source and binary releases. |
||
76 | ---------------------------------------------------------------------------*/ |
||
77 | |||
78 | #ifndef __unzip_h /* prevent multiple inclusions */ |
||
79 | #define __unzip_h |
||
80 | |||
81 | /*--------------------------------------------------------------------------- |
||
82 | Predefined, machine-specific macros. |
||
83 | ---------------------------------------------------------------------------*/ |
||
84 | |||
85 | #ifdef __GO32__ /* MS-DOS extender: NOT Unix */ |
||
86 | # ifdef unix |
||
87 | # undef unix |
||
88 | # endif |
||
89 | # ifdef _unix |
||
90 | # undef _unix |
||
91 | # endif |
||
92 | # ifdef __unix |
||
93 | # undef __unix |
||
94 | # endif |
||
95 | # ifdef __unix__ |
||
96 | # undef __unix__ |
||
97 | # endif |
||
98 | #endif |
||
99 | |||
100 | #if ((defined(__convex__) || defined(__convexc__)) && !defined(CONVEX)) |
||
101 | # define CONVEX |
||
102 | #endif |
||
103 | |||
104 | #if (defined(unix) || defined(_unix) || defined(__unix) || defined(__unix__)) |
||
105 | # ifndef UNIX |
||
106 | # define UNIX |
||
107 | # endif |
||
108 | #endif /* unix || _unix || __unix || __unix__ */ |
||
109 | #if (defined(M_XENIX) || defined(COHERENT) || defined(__hpux)) |
||
110 | # ifndef UNIX |
||
111 | # define UNIX |
||
112 | # endif |
||
113 | #endif /* M_XENIX || COHERENT || __hpux */ |
||
114 | #if (defined(__NetBSD__) || defined(__FreeBSD__)) |
||
115 | # ifndef UNIX |
||
116 | # define UNIX |
||
117 | # endif |
||
118 | #endif /* __NetBSD__ || __FreeBSD__ */ |
||
119 | #if (defined(CONVEX) || defined(MINIX) || defined(_AIX) || defined(__QNX__)) |
||
120 | # ifndef UNIX |
||
121 | # define UNIX |
||
122 | # endif |
||
123 | #endif /* CONVEX || MINIX || _AIX || __QNX__ */ |
||
124 | |||
125 | #if (defined(VM_CMS) || defined(MVS)) |
||
126 | # define CMS_MVS |
||
127 | #endif |
||
128 | |||
129 | #if (defined(__OS2__) && !defined(OS2)) |
||
130 | # define OS2 |
||
131 | #endif |
||
132 | |||
133 | #if (defined(__TANDEM) && !defined(TANDEM)) |
||
134 | # define TANDEM |
||
135 | #endif |
||
136 | |||
137 | #if (defined(__VMS) && !defined(VMS)) |
||
138 | # define VMS |
||
139 | #endif |
||
140 | |||
141 | #if ((defined(__WIN32__) || defined(_WIN32)) && !defined(WIN32)) |
||
142 | # define WIN32 |
||
143 | #endif |
||
144 | #if ((defined(__WINNT__) || defined(__WINNT)) && !defined(WIN32)) |
||
145 | # define WIN32 |
||
146 | #endif |
||
147 | |||
148 | #if defined(_WIN32_WCE) |
||
149 | # ifndef WIN32 /* WinCE is treated as a variant of the Win32 API */ |
||
150 | # define WIN32 |
||
151 | # endif |
||
152 | # ifndef UNICODE /* WinCE requires UNICODE wide character support */ |
||
153 | # define UNICODE |
||
154 | # endif |
||
155 | #endif |
||
156 | |||
157 | #ifdef __COMPILER_KCC__ |
||
158 | # include |
||
159 | # ifdef SYS_T20 |
||
160 | # define TOPS20 |
||
161 | # endif |
||
162 | #endif /* __COMPILER_KCC__ */ |
||
163 | |||
164 | /* Borland C does not define __TURBOC__ if compiling for a 32-bit platform */ |
||
165 | #ifdef __BORLANDC__ |
||
166 | # ifndef __TURBOC__ |
||
167 | # define __TURBOC__ |
||
168 | # endif |
||
169 | # if (!defined(__MSDOS__) && !defined(OS2) && !defined(WIN32)) |
||
170 | # define __MSDOS__ |
||
171 | # endif |
||
172 | #endif |
||
173 | |||
174 | /* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */ |
||
175 | #ifdef __POWERC |
||
176 | # define __TURBOC__ |
||
177 | # define MSDOS |
||
178 | #endif /* __POWERC */ |
||
179 | |||
180 | #if (defined(__MSDOS__) && !defined(MSDOS)) /* just to make sure */ |
||
181 | # define MSDOS |
||
182 | #endif |
||
183 | |||
184 | /* RSXNTDJ (at least up to v1.3) compiles for WIN32 (RSXNT) using a derivate |
||
185 | of the EMX environment, but defines MSDOS and __GO32__. ARG !!! */ |
||
186 | #if (defined(MSDOS) && defined(WIN32)) |
||
187 | # undef MSDOS /* WIN32 is >>>not<<< MSDOS */ |
||
188 | #endif |
||
189 | #if (defined(__GO32__) && defined(__EMX__) && defined(__RSXNT__)) |
||
190 | # undef __GO32__ |
||
191 | #endif |
||
192 | |||
193 | #if (defined(linux) && !defined(LINUX)) |
||
194 | # define LINUX |
||
195 | #endif |
||
196 | |||
197 | #ifdef __riscos |
||
198 | # define RISCOS |
||
199 | #endif |
||
200 | |||
201 | #if (defined(THINK_C) || defined(MPW)) |
||
202 | # define MACOS |
||
203 | #endif |
||
204 | #if (defined(__MWERKS__) && defined(macintosh)) |
||
205 | # define MACOS |
||
206 | #endif |
||
207 | |||
208 | /* use prototypes and ANSI libraries if __STDC__, or MS-DOS, or OS/2, or Win32, |
||
209 | * or IBM C Set/2, or Borland C, or Watcom C, or GNU gcc (emx or Cygwin), |
||
210 | * or Macintosh, or Sequent, or Atari, or IBM RS/6000, or Silicon Graphics, |
||
211 | * or Convex?, or AtheOS, or BeOS. |
||
212 | */ |
||
213 | #if (defined(__STDC__) || defined(MSDOS) || defined(OS2) || defined(WIN32)) |
||
214 | # ifndef PROTO |
||
215 | # define PROTO |
||
216 | # endif |
||
217 | # ifndef MODERN |
||
218 | # define MODERN |
||
219 | # endif |
||
220 | #endif |
||
221 | #if (defined(__IBMC__) || defined(__BORLANDC__) || defined(__WATCOMC__)) |
||
222 | # ifndef PROTO |
||
223 | # define PROTO |
||
224 | # endif |
||
225 | # ifndef MODERN |
||
226 | # define MODERN |
||
227 | # endif |
||
228 | #endif |
||
229 | #if (defined(__EMX__) || defined(__CYGWIN__)) |
||
230 | # ifndef PROTO |
||
231 | # define PROTO |
||
232 | # endif |
||
233 | # ifndef MODERN |
||
234 | # define MODERN |
||
235 | # endif |
||
236 | #endif |
||
237 | #if (defined(MACOS) || defined(ATARI_ST) || defined(RISCOS) || defined(THEOS)) |
||
238 | # ifndef PROTO |
||
239 | # define PROTO |
||
240 | # endif |
||
241 | # ifndef MODERN |
||
242 | # define MODERN |
||
243 | # endif |
||
244 | #endif |
||
245 | /* Sequent running Dynix/ptx: non-modern compiler */ |
||
246 | #if (defined(_AIX) || defined(sgi) || (defined(_SEQUENT_) && !defined(PTX))) |
||
247 | # ifndef PROTO |
||
248 | # define PROTO |
||
249 | # endif |
||
250 | # ifndef MODERN |
||
251 | # define MODERN |
||
252 | # endif |
||
253 | #endif |
||
254 | #if (defined(CMS_MVS) || defined(__ATHEOS__) || defined(__BEOS__)) |
||
255 | /* || defined(CONVEX) ? */ |
||
256 | # ifndef PROTO |
||
257 | # define PROTO |
||
258 | # endif |
||
259 | # ifndef MODERN |
||
260 | # define MODERN |
||
261 | # endif |
||
262 | #endif |
||
263 | /* Bundled C compiler on HP-UX needs this. Others shouldn't care. */ |
||
264 | #if (defined(__hpux)) |
||
265 | # ifndef MODERN |
||
266 | # define MODERN |
||
267 | # endif |
||
268 | #endif |
||
269 | |||
270 | /* turn off prototypes if requested */ |
||
271 | #if (defined(NOPROTO) && defined(PROTO)) |
||
272 | # undef PROTO |
||
273 | #endif |
||
274 | |||
275 | /* used to remove arguments in function prototypes for non-ANSI C */ |
||
276 | #ifdef PROTO |
||
277 | # define OF(a) a |
||
278 | #else |
||
279 | # define OF(a) () |
||
280 | #endif |
||
281 | |||
282 | /* enable the "const" keyword only if MODERN and if not otherwise instructed */ |
||
283 | #ifdef MODERN |
||
284 | # if (!defined(ZCONST) && (defined(USE_CONST) || !defined(NO_CONST))) |
||
285 | # define ZCONST const |
||
286 | # endif |
||
287 | #endif |
||
288 | |||
289 | #ifndef ZCONST |
||
290 | # define ZCONST |
||
291 | #endif |
||
292 | |||
293 | /* Tell Microsoft Visual C++ 2005 (and newer) to leave us alone |
||
294 | * and let us use standard C functions the way we're supposed to. |
||
295 | * (These preprocessor symbols must appear before the first system |
||
296 | * header include. They are located here, because for WINDLL the |
||
297 | * first system header includes follow just below.) |
||
298 | */ |
||
299 | #if defined(_MSC_VER) && (_MSC_VER >= 1400) |
||
300 | # ifndef _CRT_SECURE_NO_WARNINGS |
||
301 | # define _CRT_SECURE_NO_WARNINGS |
||
302 | # endif |
||
303 | # ifndef _CRT_NONSTDC_NO_WARNINGS |
||
304 | # define _CRT_NONSTDC_NO_WARNINGS |
||
305 | # endif |
||
306 | # if defined(POCKET_UNZIP) && !defined(_CRT_NON_CONFORMING_SWPRINTFS) |
||
307 | # define _CRT_NON_CONFORMING_SWPRINTFS |
||
308 | # endif |
||
309 | #endif |
||
310 | |||
311 | /* NO_UNIXBACKUP overrides UNIXBACKUP */ |
||
312 | #if defined(NO_UNIXBACKUP) && defined(UNIXBACKUP) |
||
313 | # undef UNIXBACKUP |
||
314 | #endif |
||
315 | |||
316 | /*--------------------------------------------------------------------------- |
||
317 | Grab system-specific public include headers. |
||
318 | ---------------------------------------------------------------------------*/ |
||
319 | |||
320 | #ifdef POCKET_UNZIP /* WinCE port */ |
||
321 | # include "wince/punzip.h" /* must appear before windows.h */ |
||
322 | #endif |
||
323 | |||
324 | #ifdef WINDLL |
||
325 | /* for UnZip, the "basic" part of the win32 api is sufficient */ |
||
326 | # ifndef WIN32_LEAN_AND_MEAN |
||
327 | # define WIN32_LEAN_AND_MEAN |
||
328 | # define IZ_HASDEFINED_WIN32LEAN |
||
329 | # endif |
||
330 | # include |
||
331 | # include "windll/structs.h" |
||
332 | # ifdef IZ_HASDEFINED_WIN32LEAN |
||
333 | # undef WIN32_LEAN_AND_MEAN |
||
334 | # undef IZ_HASDEFINED_WIN32LEAN |
||
335 | # endif |
||
336 | #endif |
||
337 | |||
338 | /*--------------------------------------------------------------------------- |
||
339 | Grab system-dependent definition of EXPENTRY for prototypes below. |
||
340 | ---------------------------------------------------------------------------*/ |
||
341 | |||
342 | #if 0 |
||
343 | #if (defined(OS2) && !defined(FUNZIP)) |
||
344 | # ifdef UNZIP_INTERNAL |
||
345 | # define INCL_NOPM |
||
346 | # define INCL_DOSNLS |
||
347 | # define INCL_DOSPROCESS |
||
348 | # define INCL_DOSDEVICES |
||
349 | # define INCL_DOSDEVIOCTL |
||
350 | # define INCL_DOSERRORS |
||
351 | # define INCL_DOSMISC |
||
352 | # ifdef OS2DLL |
||
353 | # define INCL_REXXSAA |
||
354 | # include |
||
355 | # endif |
||
356 | # endif /* UNZIP_INTERNAL */ |
||
357 | # include |
||
358 | # define UZ_EXP EXPENTRY |
||
359 | #endif /* OS2 && !FUNZIP */ |
||
360 | #endif /* 0 */ |
||
361 | |||
362 | #if (defined(OS2) && !defined(FUNZIP)) |
||
363 | # if (defined(__IBMC__) || defined(__WATCOMC__)) |
||
364 | # define UZ_EXP _System /* compiler keyword */ |
||
365 | # else |
||
366 | # define UZ_EXP |
||
367 | # endif |
||
368 | #endif /* OS2 && !FUNZIP */ |
||
369 | |||
370 | #if (defined(WINDLL) || defined(USE_UNZIP_LIB)) |
||
371 | # ifndef EXPENTRY |
||
372 | # define UZ_EXP WINAPI |
||
373 | # else |
||
374 | # define UZ_EXP EXPENTRY |
||
375 | # endif |
||
376 | #endif |
||
377 | |||
378 | #ifndef UZ_EXP |
||
379 | # define UZ_EXP |
||
380 | #endif |
||
381 | |||
382 | #ifdef __cplusplus |
||
383 | extern "C" { |
||
384 | #endif |
||
385 | |||
386 | /*--------------------------------------------------------------------------- |
||
387 | Public typedefs. |
||
388 | ---------------------------------------------------------------------------*/ |
||
389 | |||
390 | #ifndef _IZ_TYPES_DEFINED |
||
391 | #ifdef MODERN |
||
392 | typedef void zvoid; |
||
393 | #else /* !MODERN */ |
||
394 | # ifndef AOS_VS /* mostly modern? */ |
||
395 | # ifndef VAXC /* not fully modern, but has knows 'void' */ |
||
396 | # define void int |
||
397 | # endif /* !VAXC */ |
||
398 | # endif /* !AOS_VS */ |
||
399 | typedef char zvoid; |
||
400 | #endif /* ?MODERN */ |
||
401 | typedef unsigned char uch; /* code assumes unsigned bytes; these type- */ |
||
402 | typedef unsigned short ush; /* defs replace byte/UWORD/ULONG (which are */ |
||
403 | typedef unsigned long ulg; /* predefined on some systems) & match zip */ |
||
404 | #define _IZ_TYPES_DEFINED |
||
405 | #endif /* !_IZ_TYPES_DEFINED */ |
||
406 | |||
407 | /* InputFn is not yet used and is likely to change: */ |
||
408 | #ifdef PROTO |
||
409 | typedef int (UZ_EXP MsgFn) (zvoid *pG, uch *buf, ulg size, int flag); |
||
410 | typedef int (UZ_EXP InputFn) (zvoid *pG, uch *buf, int *size, int flag); |
||
411 | typedef void (UZ_EXP PauseFn) (zvoid *pG, ZCONST char *prompt, int flag); |
||
412 | typedef int (UZ_EXP PasswdFn) (zvoid *pG, int *rcnt, char *pwbuf, |
||
413 | int size, ZCONST char *zfn, |
||
414 | ZCONST char *efn); |
||
415 | typedef int (UZ_EXP StatCBFn) (zvoid *pG, int fnflag, ZCONST char *zfn, |
||
416 | ZCONST char *efn, ZCONST zvoid *details); |
||
417 | typedef void (UZ_EXP UsrIniFn) (void); |
||
418 | #else /* !PROTO */ |
||
419 | typedef int (UZ_EXP MsgFn) (); |
||
420 | typedef int (UZ_EXP InputFn) (); |
||
421 | typedef void (UZ_EXP PauseFn) (); |
||
422 | typedef int (UZ_EXP PasswdFn) (); |
||
423 | typedef int (UZ_EXP StatCBFn) (); |
||
424 | typedef void (UZ_EXP UsrIniFn) (); |
||
425 | #endif /* ?PROTO */ |
||
426 | |||
427 | typedef struct _UzpBuffer { /* rxstr */ |
||
428 | ulg strlength; /* length of string */ |
||
429 | char *strptr; /* pointer to string */ |
||
430 | } UzpBuffer; |
||
431 | |||
432 | typedef struct _UzpInit { |
||
433 | ulg structlen; /* length of the struct being passed */ |
||
434 | |||
435 | /* GRR: can we assume that each of these is a 32-bit pointer? if not, |
||
436 | * does it matter? add "far" keyword to make sure? */ |
||
437 | MsgFn *msgfn; |
||
438 | InputFn *inputfn; |
||
439 | PauseFn *pausefn; |
||
440 | UsrIniFn *userfn; /* user init function to be called after */ |
||
441 | /* globals constructed and initialized */ |
||
442 | |||
443 | /* pointer to program's environment area or something? */ |
||
444 | /* hooks for performance testing? */ |
||
445 | /* hooks for extra unzip -v output? (detect CPU or other hardware?) */ |
||
446 | /* anything else? let me (Greg) know... */ |
||
447 | } UzpInit; |
||
448 | |||
449 | typedef struct _UzpCB { |
||
450 | ulg structlen; /* length of the struct being passed */ |
||
451 | /* GRR: can we assume that each of these is a 32-bit pointer? if not, |
||
452 | * does it matter? add "far" keyword to make sure? */ |
||
453 | MsgFn *msgfn; |
||
454 | InputFn *inputfn; |
||
455 | PauseFn *pausefn; |
||
456 | PasswdFn *passwdfn; |
||
457 | StatCBFn *statrepfn; |
||
458 | } UzpCB; |
||
459 | |||
460 | /* the collection of general UnZip option flags and option arguments */ |
||
461 | typedef struct _UzpOpts { |
||
462 | #ifndef FUNZIP |
||
463 | char *exdir; /* pointer to extraction root directory (-d option) */ |
||
464 | char *pwdarg; /* pointer to command-line password (-P option) */ |
||
465 | int zipinfo_mode; /* behave like ZipInfo or like normal UnZip? */ |
||
466 | int aflag; /* -a: do ASCII-EBCDIC and/or end-of-line translation */ |
||
467 | #ifdef VMS |
||
468 | int bflag; /* -b: force fixed record format for binary files */ |
||
469 | #endif |
||
470 | #ifdef TANDEM |
||
471 | int bflag; /* -b: create text files in 'C' format (180)*/ |
||
472 | #endif |
||
473 | #if defined(UNIX) || defined(OS2) || defined(WIN32) |
||
474 | int B_flag; /* -B: back up existing files by renaming to *~##### */ |
||
475 | #else |
||
476 | #ifdef UNIXBACKUP |
||
477 | int B_flag; /* -B: back up existing files by renaming to *~##### */ |
||
478 | #endif |
||
479 | #endif |
||
480 | int cflag; /* -c: output to stdout */ |
||
481 | int C_flag; /* -C: match filenames case-insensitively */ |
||
482 | int D_flag; /* -D: don't restore directory (-DD: any) timestamps */ |
||
483 | #ifdef MACOS |
||
484 | int E_flag; /* -E: [MacOS] show Mac extra field during restoring */ |
||
485 | #endif |
||
486 | int fflag; /* -f: "freshen" (extract only newer files) */ |
||
487 | #if (defined(RISCOS) || defined(ACORN_FTYPE_NFS)) |
||
488 | int acorn_nfs_ext; /* -F: RISC OS types & NFS filetype extensions */ |
||
489 | #endif |
||
490 | int hflag; /* -h: header line (zipinfo) */ |
||
491 | #ifdef MACOS |
||
492 | int i_flag; /* -i: [MacOS] ignore filenames stored in Mac e.f. */ |
||
493 | #endif |
||
494 | #ifdef RISCOS |
||
495 | int scanimage; /* -I: scan image files */ |
||
496 | #endif |
||
497 | int jflag; /* -j: junk pathnames (unzip) */ |
||
498 | #if (defined(__ATHEOS__) || defined(__BEOS__) || defined(MACOS)) |
||
499 | int J_flag; /* -J: ignore AtheOS/BeOS/MacOS e. f. info (unzip) */ |
||
500 | #endif |
||
501 | #if (defined(__ATHEOS__) || defined(__BEOS__) || defined(UNIX)) |
||
502 | int K_flag; /* -K: keep setuid/setgid/tacky permissions */ |
||
503 | #endif |
||
504 | int lflag; /* -12slmv: listing format (zipinfo) */ |
||
505 | int L_flag; /* -L: convert filenames from some OSes to lowercase */ |
||
506 | int overwrite_none; /* -n: never overwrite files (no prompting) */ |
||
507 | #ifdef AMIGA |
||
508 | int N_flag; /* -N: restore comments as AmigaDOS filenotes */ |
||
509 | #endif |
||
510 | int overwrite_all; /* -o: OK to overwrite files without prompting */ |
||
511 | #endif /* !FUNZIP */ |
||
512 | int qflag; /* -q: produce a lot less output */ |
||
513 | #ifdef TANDEM |
||
514 | int rflag; /* -r: remove file extensions */ |
||
515 | #endif |
||
516 | #ifndef FUNZIP |
||
517 | #if (defined(MSDOS) || defined(FLEXOS) || defined(OS2) || defined(WIN32)) |
||
518 | int sflag; /* -s: convert spaces in filenames to underscores */ |
||
519 | #endif |
||
520 | #if (defined(NLM)) |
||
521 | int sflag; /* -s: convert spaces in filenames to underscores */ |
||
522 | #endif |
||
523 | #ifdef VMS |
||
524 | int S_flag; /* -S: use Stream_LF for text files (-a[a]) */ |
||
525 | #endif |
||
526 | #if (defined(MSDOS) || defined(__human68k__) || defined(OS2) || defined(WIN32)) |
||
527 | int volflag; /* -$: extract volume labels */ |
||
528 | #endif |
||
529 | int tflag; /* -t: test (unzip) or totals line (zipinfo) */ |
||
530 | int T_flag; /* -T: timestamps (unzip) or dec. time fmt (zipinfo) */ |
||
531 | int uflag; /* -u: "update" (extract only newer/brand-new files) */ |
||
532 | #if defined(UNIX) || defined(VMS) || defined(WIN32) |
||
533 | int U_flag; /* -U: escape non-ASCII, -UU No Unicode paths */ |
||
534 | #endif |
||
535 | int vflag; /* -v: (verbosely) list directory */ |
||
536 | int V_flag; /* -V: don't strip VMS version numbers */ |
||
537 | int W_flag; /* -W: wildcard '*' won't match '/' dir separator */ |
||
538 | #if (defined (__ATHEOS__) || defined(__BEOS__) || defined(UNIX)) |
||
539 | int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */ |
||
540 | #else |
||
541 | #if (defined(TANDEM) || defined(THEOS)) |
||
542 | int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */ |
||
543 | #else |
||
544 | #if (defined(OS2) || defined(VMS) || defined(WIN32)) |
||
545 | int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */ |
||
546 | #endif |
||
547 | #endif |
||
548 | #endif |
||
549 | #ifdef VMS |
||
550 | int Y_flag; /* -Y: treat ".nnn" as ";nnn" version */ |
||
551 | #endif |
||
552 | int zflag; /* -z: display the zipfile comment (only, for unzip) */ |
||
553 | #ifdef VMS |
||
554 | int ods2_flag; /* -2: force names to conform to ODS2 */ |
||
555 | #endif |
||
556 | #if (!defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM)) |
||
557 | int ddotflag; /* -:: don't skip over "../" path elements */ |
||
558 | #endif |
||
559 | #ifdef UNIX |
||
560 | int cflxflag; /* -^: allow control chars in extracted filenames */ |
||
561 | #endif |
||
562 | #endif /* !FUNZIP */ |
||
563 | } UzpOpts; |
||
564 | |||
565 | /* intended to be a private struct: */ |
||
566 | typedef struct _ver { |
||
567 | uch major; /* e.g., integer 5 */ |
||
568 | uch minor; /* e.g., 2 */ |
||
569 | uch patchlevel; /* e.g., 0 */ |
||
570 | uch not_used; |
||
571 | } _version_type; |
||
572 | |||
573 | typedef struct _UzpVer { |
||
574 | ulg structlen; /* length of the struct being passed */ |
||
575 | ulg flag; /* bit 0: is_beta bit 1: uses_zlib */ |
||
576 | ZCONST char *betalevel; /* e.g. "g BETA" or "" */ |
||
577 | ZCONST char *date; /* e.g. "9 Oct 08" (beta) or "9 October 2008" */ |
||
578 | ZCONST char *zlib_version;/* e.g. "1.2.3" or NULL */ |
||
579 | _version_type unzip; /* current UnZip version */ |
||
580 | _version_type zipinfo; /* current ZipInfo version */ |
||
581 | _version_type os2dll; /* OS2DLL version (retained for compatibility */ |
||
582 | _version_type windll; /* WinDLL version (retained for compatibility */ |
||
583 | _version_type dllapimin; /* last incompatible change of library API */ |
||
584 | } UzpVer; |
||
585 | |||
586 | /* for Visual BASIC access to Windows DLLs: */ |
||
587 | typedef struct _UzpVer2 { |
||
588 | ulg structlen; /* length of the struct being passed */ |
||
589 | ulg flag; /* bit 0: is_beta bit 1: uses_zlib */ |
||
590 | char betalevel[10]; /* e.g. "g BETA" or "" */ |
||
591 | char date[20]; /* e.g. "9 Oct 08" (beta) or "9 October 2008" */ |
||
592 | char zlib_version[10]; /* e.g. "1.2.3" or NULL */ |
||
593 | _version_type unzip; /* current UnZip version */ |
||
594 | _version_type zipinfo; /* current ZipInfo version */ |
||
595 | _version_type os2dll; /* OS2DLL version (retained for compatibility */ |
||
596 | _version_type windll; /* WinDLL version (retained for compatibility */ |
||
597 | _version_type dllapimin; /* last incompatible change of library API */ |
||
598 | } UzpVer2; |
||
599 | |||
600 | |||
601 | typedef struct _Uzp_Siz64 { |
||
602 | unsigned long lo32; |
||
603 | unsigned long hi32; |
||
604 | } Uzp_Siz64; |
||
605 | |||
606 | typedef struct _Uzp_cdir_Rec { |
||
607 | uch version_made_by[2]; |
||
608 | uch version_needed_to_extract[2]; |
||
609 | ush general_purpose_bit_flag; |
||
610 | ush compression_method; |
||
611 | ulg last_mod_dos_datetime; |
||
612 | ulg crc32; |
||
613 | Uzp_Siz64 csize; |
||
614 | Uzp_Siz64 ucsize; |
||
615 | ush filename_length; |
||
616 | ush extra_field_length; |
||
617 | ush file_comment_length; |
||
618 | ush disk_number_start; |
||
619 | ush internal_file_attributes; |
||
620 | ulg external_file_attributes; |
||
621 | Uzp_Siz64 relative_offset_local_header; |
||
622 | } Uzp_cdir_Rec; |
||
623 | |||
624 | |||
625 | #define UZPINIT_LEN sizeof(UzpInit) |
||
626 | #define UZPVER_LEN sizeof(UzpVer) |
||
627 | #define cbList(func) int (* UZ_EXP func)(char *filename, Uzp_cdir_Rec *crec) |
||
628 | |||
629 | |||
630 | /*--------------------------------------------------------------------------- |
||
631 | Return (and exit) values of the public UnZip API functions. |
||
632 | ---------------------------------------------------------------------------*/ |
||
633 | |||
634 | /* external return codes */ |
||
635 | #define PK_OK 0 /* no error */ |
||
636 | #define PK_COOL 0 /* no error */ |
||
637 | #define PK_WARN 1 /* warning error */ |
||
638 | #define PK_ERR 2 /* error in zipfile */ |
||
639 | #define PK_BADERR 3 /* severe error in zipfile */ |
||
640 | #define PK_MEM 4 /* insufficient memory (during initialization) */ |
||
641 | #define PK_MEM2 5 /* insufficient memory (password failure) */ |
||
642 | #define PK_MEM3 6 /* insufficient memory (file decompression) */ |
||
643 | #define PK_MEM4 7 /* insufficient memory (memory decompression) */ |
||
644 | #define PK_MEM5 8 /* insufficient memory (not yet used) */ |
||
645 | #define PK_NOZIP 9 /* zipfile not found */ |
||
646 | #define PK_PARAM 10 /* bad or illegal parameters specified */ |
||
647 | #define PK_FIND 11 /* no files found */ |
||
648 | #define PK_DISK 50 /* disk full */ |
||
649 | #define PK_EOF 51 /* unexpected EOF */ |
||
650 | |||
651 | #define IZ_CTRLC 80 /* user hit ^C to terminate */ |
||
652 | #define IZ_UNSUP 81 /* no files found: all unsup. compr/encrypt. */ |
||
653 | #define IZ_BADPWD 82 /* no files found: all had bad password */ |
||
654 | #define IZ_ERRBF 83 /* big-file archive, small-file program */ |
||
655 | |||
656 | /* return codes of password fetches (negative = user abort; positive = error) */ |
||
657 | #define IZ_PW_ENTERED 0 /* got some password string; use/try it */ |
||
658 | #define IZ_PW_CANCEL -1 /* no password available (for this entry) */ |
||
659 | #define IZ_PW_CANCELALL -2 /* no password, skip any further pwd. request */ |
||
660 | #define IZ_PW_ERROR 5 /* = PK_MEM2 : failure (no mem, no tty, ...) */ |
||
661 | |||
662 | /* flag values for status callback function */ |
||
663 | #define UZ_ST_START_EXTRACT 1 /* no details */ |
||
664 | #define UZ_ST_IN_PROGRESS 2 /* no details */ |
||
665 | #define UZ_ST_FINISH_MEMBER 3 /* 'details': extracted size */ |
||
666 | |||
667 | /* return values of status callback function */ |
||
668 | #define UZ_ST_CONTINUE 0 |
||
669 | #define UZ_ST_BREAK 1 |
||
670 | |||
671 | |||
672 | /*--------------------------------------------------------------------------- |
||
673 | Prototypes for public UnZip API (DLL) functions. |
||
674 | ---------------------------------------------------------------------------*/ |
||
675 | |||
676 | #define UzpMatch match |
||
677 | |||
678 | int UZ_EXP UzpMain OF((int argc, char **argv)); |
||
679 | int UZ_EXP UzpAltMain OF((int argc, char **argv, UzpInit *init)); |
||
680 | ZCONST UzpVer * UZ_EXP UzpVersion OF((void)); |
||
681 | void UZ_EXP UzpFreeMemBuffer OF((UzpBuffer *retstr)); |
||
682 | #ifndef WINDLL |
||
683 | int UZ_EXP UzpUnzipToMemory OF((char *zip, char *file, UzpOpts *optflgs, |
||
684 | UzpCB *UsrFunc, UzpBuffer *retstr)); |
||
685 | int UZ_EXP UzpGrep OF((char *archive, char *file, |
||
686 | char *pattern, int cmd, int SkipBin, |
||
687 | UzpCB *UsrFunc)); |
||
688 | #endif |
||
689 | #ifdef OS2 |
||
690 | int UZ_EXP UzpFileTree OF((char *name, cbList(callBack), |
||
691 | char *cpInclude[], char *cpExclude[])); |
||
692 | #endif |
||
693 | |||
694 | unsigned UZ_EXP UzpVersion2 OF((UzpVer2 *version)); |
||
695 | int UZ_EXP UzpValidate OF((char *archive, int AllCodes)); |
||
696 | |||
697 | |||
698 | /* default I/O functions (can be swapped out via UzpAltMain() entry point): */ |
||
699 | |||
700 | int UZ_EXP UzpMessagePrnt OF((zvoid *pG, uch *buf, ulg size, int flag)); |
||
701 | int UZ_EXP UzpMessageNull OF((zvoid *pG, uch *buf, ulg size, int flag)); |
||
702 | int UZ_EXP UzpInput OF((zvoid *pG, uch *buf, int *size, int flag)); |
||
703 | void UZ_EXP UzpMorePause OF((zvoid *pG, ZCONST char *prompt, int flag)); |
||
704 | int UZ_EXP UzpPassword OF((zvoid *pG, int *rcnt, char *pwbuf, |
||
705 | int size, ZCONST char *zfn, |
||
706 | ZCONST char *efn)); |
||
707 | |||
708 | #ifdef __cplusplus |
||
709 | } |
||
710 | #endif |
||
711 | |||
712 | |||
713 | /*--------------------------------------------------------------------------- |
||
714 | Remaining private stuff for UnZip compilation. |
||
715 | ---------------------------------------------------------------------------*/ |
||
716 | |||
717 | #ifdef UNZIP_INTERNAL |
||
718 | # include "unzpriv.h" |
||
719 | #endif |
||
720 | |||
721 | |||
722 | #endif /* !__unzip_h */><><<> |