]>
Commit | Line | Data |
---|---|---|
1 | /*--------------------------------------------------------------------------- | |
2 | ||
3 | unzip.c | |
4 | ||
5 | UnZip - a zipfile extraction utility. See below for make instructions, or | |
6 | read the comments in Makefile and the various Contents files for more de- | |
7 | tailed explanations. To report a bug, send a *complete* description to | |
8 | Zip-Bugs@lists.wku.edu; include machine type, operating system and ver- | |
9 | sion, compiler and version, and reasonably detailed error messages or prob- | |
10 | lem report. To join Info-ZIP, see the instructions in README. | |
11 | ||
12 | UnZip 5.x is a greatly expanded and partially rewritten successor to 4.x, | |
13 | which in turn was almost a complete rewrite of version 3.x. For a detailed | |
14 | revision history, see UnzpHist.zip at quest.jpl.nasa.gov. For a list of | |
15 | the many (near infinite) contributors, see "CONTRIBS" in the UnZip source | |
16 | distribution. | |
17 | ||
18 | --------------------------------------------------------------------------- | |
19 | ||
20 | [from original zipinfo.c] | |
21 | ||
22 | This program reads great gobs of totally nifty information, including the | |
23 | central directory stuff, from ZIP archives ("zipfiles" for short). It | |
24 | started as just a testbed for fooling with zipfiles, but at this point it | |
25 | is actually a useful utility. It also became the basis for the rewrite of | |
26 | UnZip (3.16 -> 4.0), using the central directory for processing rather than | |
27 | the individual (local) file headers. | |
28 | ||
29 | As of ZipInfo v2.0 and UnZip v5.1, the two programs are combined into one. | |
30 | If the executable is named "unzip" (or "unzip.exe", depending), it behaves | |
31 | like UnZip by default; if it is named "zipinfo" or "ii", it behaves like | |
32 | ZipInfo. The ZipInfo behavior may also be triggered by use of unzip's -Z | |
33 | option; for example, "unzip -Z [zipinfo_options] archive.zip". | |
34 | ||
35 | Another dandy product from your buddies at Newtware! | |
36 | ||
37 | Author: Greg Roelofs, newt@pobox.com, http://pobox.com/~newt/ | |
38 | 23 August 1990 -> April 1997 | |
39 | ||
40 | --------------------------------------------------------------------------- | |
41 | ||
42 | Version: unzip5??.{tar.Z | tar.gz | zip} for Unix, VMS, OS/2, MS-DOS, Amiga, | |
43 | Atari, Windows 3.x/95/NT/CE, Macintosh, Human68K, Acorn RISC OS, | |
44 | BeOS, SMS/QDOS, VM/CMS, MVS, AOS/VS and TOPS-20. Decryption | |
45 | requires sources in zcrypt28.zip. See the accompanying "WHERE" | |
46 | file in the main source distribution for ftp, uucp, BBS and mail- | |
47 | server sites, or see http://www.cdrom.com/pub/infozip/UnZip.html . | |
48 | ||
49 | Copyrights: see accompanying file "COPYING" in UnZip source distribution. | |
50 | (This software is free but NOT IN THE PUBLIC DOMAIN. There | |
51 | are some restrictions on commercial use.) | |
52 | ||
53 | ---------------------------------------------------------------------------*/ | |
54 | ||
55 | ||
56 | ||
57 | #define UNZIP_C | |
58 | #define UNZIP_INTERNAL | |
59 | #include "unzip.h" /* includes, typedefs, macros, prototypes, etc. */ | |
60 | #include "crypt.h" | |
61 | #include "version.h" | |
62 | ||
63 | #ifndef WINDLL /* The WINDLL port uses windll/windll.c instead... */ | |
64 | ||
65 | /*******************/ | |
66 | /* Local Functions */ | |
67 | /*******************/ | |
68 | ||
69 | #ifndef SFX | |
70 | static void show_version_info OF((__GPRO)); | |
71 | #endif | |
72 | ||
73 | ||
74 | /*************/ | |
75 | /* Constants */ | |
76 | /*************/ | |
77 | ||
78 | #include "consts.h" /* all constant global variables are in here */ | |
79 | /* (non-constant globals were moved to globals.c) */ | |
80 | ||
81 | /* constant local variables: */ | |
82 | ||
83 | #ifndef SFX | |
84 | static ZCONST char Far EnvUnZip[] = ENV_UNZIP; | |
85 | static ZCONST char Far EnvUnZip2[] = ENV_UNZIP2; | |
86 | static ZCONST char Far EnvZipInfo[] = ENV_ZIPINFO; | |
87 | static ZCONST char Far EnvZipInfo2[] = ENV_ZIPINFO2; | |
88 | #ifdef RISCOS | |
89 | static ZCONST char Far EnvUnZipExts[] = ENV_UNZIPEXTS; | |
90 | #endif /* RISCOS */ | |
91 | #endif | |
92 | ||
93 | #if (!defined(SFX) || defined(SFX_EXDIR)) | |
94 | static ZCONST char Far NotExtracting[] = | |
95 | "caution: not extracting; -d ignored\n"; | |
96 | static ZCONST char Far MustGiveExdir[] = | |
97 | "error: must specify directory to which to extract with -d option\n"; | |
98 | static ZCONST char Far OnlyOneExdir[] = | |
99 | "error: -d option used more than once (only one exdir allowed)\n"; | |
100 | #endif | |
101 | ||
102 | #if CRYPT | |
103 | static ZCONST char Far MustGivePasswd[] = | |
104 | "error: must give decryption password with -P option\n"; | |
105 | #endif | |
106 | ||
107 | #ifndef SFX | |
108 | static ZCONST char Far Zfirst[] = | |
109 | "error: -Z must be first option for ZipInfo mode (check UNZIP variable?)\n"; | |
110 | #endif | |
111 | static ZCONST char Far InvalidOptionsMsg[] = "error:\ | |
112 | -fn or any combination of -c, -l, -p, -t, -u and -v options invalid\n"; | |
113 | static ZCONST char Far IgnoreOOptionMsg[] = | |
114 | "caution: both -n and -o specified; ignoring -o\n"; | |
115 | ||
116 | /* usage() strings */ | |
117 | #ifndef SFX | |
118 | #ifdef VMS | |
119 | static ZCONST char Far Example3[] = "vms.c"; | |
120 | static ZCONST char Far Example2[] = " unzip\ | |
121 | \"-V\" foo \"Bar\" => must quote uppercase options and filenames in VMS\n"; | |
122 | #else /* !VMS */ | |
123 | static ZCONST char Far Example3[] = "ReadMe"; | |
124 | #ifdef RISCOS | |
125 | static ZCONST char Far Example2[] = | |
126 | " unzip foo -d RAM:$ => extract all files from foo into RAMDisc\n"; | |
127 | #else /* !RISCOS */ | |
128 | #if (defined(OS2) || (defined(DOS_FLX_OS2_W32) && defined(MORE))) | |
129 | static ZCONST char Far Example2[] = | |
130 | ""; /* no room: too many local3[] items */ | |
131 | #else /* !OS2 */ | |
132 | #ifdef MACOS | |
133 | static ZCONST char Far Example2[] = ""; /* not needed */ | |
134 | #else /* !MACOS */ | |
135 | static ZCONST char Far Example2[] = " \ | |
136 | unzip -p foo | more => send contents of foo.zip via pipe into program more\n"; | |
137 | #endif /* ?MACOS */ | |
138 | #endif /* ?OS2 */ | |
139 | #endif /* ?RISCOS */ | |
140 | #endif /* ?VMS */ | |
141 | ||
142 | /* local1[]: command options */ | |
143 | #if (defined(DLL) && defined(API_DOC)) | |
144 | static ZCONST char Far local1[] = | |
145 | " -A print extended help for API functions"; | |
146 | #else /* !(DLL && API_DOC) */ | |
147 | static ZCONST char Far local1[] = ""; | |
148 | #endif /* ?(DLL && API_DOC) */ | |
149 | ||
150 | /* local2[] and local3[]: modifier options */ | |
151 | #ifdef DOS_FLX_OS2_W32 | |
152 | #ifdef FLEXOS | |
153 | static ZCONST char Far local2[] = ""; | |
154 | #else | |
155 | static ZCONST char Far local2[] = | |
156 | " -$ label removables (-$$ => fixed disks)"; | |
157 | #endif | |
158 | #ifdef OS2 | |
159 | #ifdef MORE | |
160 | static ZCONST char Far local3[] = "\ | |
161 | -X restore ACLs if supported -s spaces in filenames => '_'\n\ | |
162 | -M pipe through \"more\" pager\n"; | |
163 | #else | |
164 | static ZCONST char Far local3[] = " \ | |
165 | -X restore ACLs if supported -s spaces in filenames => '_'\n\n"; | |
166 | #endif /* ?MORE */ | |
167 | #else /* !OS2 */ | |
168 | #ifdef WIN32 | |
169 | #ifdef MORE | |
170 | static ZCONST char Far local3[] = "\ | |
171 | -X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'\n\ | |
172 | -M pipe through \"more\" pager\n"; | |
173 | #else | |
174 | static ZCONST char Far local3[] = " \ | |
175 | -X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'\n\n"; | |
176 | #endif /* ?MORE */ | |
177 | #else /* !WIN32 */ | |
178 | #ifdef MORE | |
179 | static ZCONST char Far local3[] = " -\ | |
180 | M pipe through \"more\" pager -s spaces in filenames => '_'\n\n"; | |
181 | #else | |
182 | static ZCONST char Far local3[] = "\ | |
183 | -s spaces in filenames => '_'\n"; | |
184 | #endif | |
185 | #endif /* ?WIN32 */ | |
186 | #endif /* ?OS2 || ?WIN32 */ | |
187 | #else /* !DOS_FLX_OS2_W32 */ | |
188 | #ifdef VMS | |
189 | static ZCONST char Far local2[] = "\"-X\" restore owner/protection info"; | |
190 | #ifdef MORE | |
191 | static ZCONST char Far local3[] = " \ | |
192 | \"-M\" pipe through \"more\" pager\n"; | |
193 | #else | |
194 | static ZCONST char Far local3[] = "\n"; | |
195 | #endif | |
196 | #else /* !VMS */ | |
197 | #if (defined(__BEOS__) || defined(TANDEM) || defined(UNIX)) | |
198 | static ZCONST char Far local2[] = " -X restore UID/GID info"; | |
199 | #ifdef MORE | |
200 | static ZCONST char Far local3[] = "\ | |
201 | -M pipe through \"more\" pager\n"; | |
202 | #else | |
203 | static ZCONST char Far local3[] = "\n"; | |
204 | #endif | |
205 | #else /* !(__BEOS__ || TANDEM || UNIX) */ | |
206 | #ifdef AMIGA | |
207 | static ZCONST char Far local2[] = " -N restore comments as filenotes"; | |
208 | #ifdef MORE | |
209 | static ZCONST char Far local3[] = "\ | |
210 | -M pipe through \"more\" pager\n"; | |
211 | #else | |
212 | static ZCONST char Far local3[] = "\n"; | |
213 | #endif | |
214 | #else /* !AMIGA */ | |
215 | #ifdef MACOS | |
216 | static ZCONST char Far local2[] = " -E show Mac info during extraction"; | |
217 | static ZCONST char Far local3[] = " \ | |
218 | -i ignore filenames in mac extra info -J junk (ignore) Mac extra info\n\n"; | |
219 | #else /* !MACOS */ | |
220 | #ifdef MORE | |
221 | static ZCONST char Far local2[] = " -M pipe through \"more\" pager"; | |
222 | static ZCONST char Far local3[] = "\n"; | |
223 | #else | |
224 | static ZCONST char Far local2[] = ""; /* Atari, Mac, CMS/MVS etc. */ | |
225 | static ZCONST char Far local3[] = ""; | |
226 | #endif | |
227 | #endif /* ?MACOS */ | |
228 | #endif /* ?AMIGA */ | |
229 | #endif /* ?(__BEOS__ || TANDEM || UNIX) */ | |
230 | #endif /* ?VMS */ | |
231 | #endif /* ?DOS_FLX_OS2_W32 */ | |
232 | #endif /* !SFX */ | |
233 | ||
234 | #ifndef NO_ZIPINFO | |
235 | #ifdef VMS | |
236 | static ZCONST char Far ZipInfoExample[] = "* or % (e.g., \"*font-%.zip\")"; | |
237 | #else | |
238 | static ZCONST char Far ZipInfoExample[] = "*, ?, [] (e.g., \"[a-j]*.zip\")"; | |
239 | #endif | |
240 | ||
241 | static ZCONST char Far ZipInfoUsageLine1[] = "\ | |
242 | ZipInfo %d.%d%d%s of %s, by Greg Roelofs and the Info-ZIP group.\n\ | |
243 | \n\ | |
244 | List name, date/time, attribute, size, compression method, etc., about files\n\ | |
245 | in list (excluding those in xlist) contained in the specified .zip archive(s).\ | |
246 | \n\"file[.zip]\" may be a wildcard name containing %s.\n\n\ | |
247 | usage: zipinfo [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]\n\ | |
248 | or: unzip %s-Z%s [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]\n"; | |
249 | ||
250 | static ZCONST char Far ZipInfoUsageLine2[] = "\nmain\ | |
251 | listing-format options: -s short Unix \"ls -l\" format (def.)\n\ | |
252 | -1 filenames ONLY, one per line -m medium Unix \"ls -l\" format\n\ | |
253 | -2 just filenames but allow -h/-t/-z -l long Unix \"ls -l\" format\n\ | |
254 | -v verbose, multi-page format\n"; | |
255 | ||
256 | static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\ | |
257 | -h print header line -t print totals for listed files or for all\n\ | |
258 | -z print zipfile comment %c-T%c print file times in sortable decimal format\ | |
259 | \n %c-C%c be case-insensitive %s\ | |
260 | -x exclude filenames that follow from listing\n"; | |
261 | #ifdef MORE | |
262 | #ifdef VMS | |
263 | static ZCONST char Far ZipInfoUsageLine4[] = | |
264 | " \"-M\" page output through built-in \"more\"\n"; | |
265 | #else | |
266 | static ZCONST char Far ZipInfoUsageLine4[] = | |
267 | " -M page output through built-in \"more\"\n"; | |
268 | #endif | |
269 | #else /* !MORE */ | |
270 | static ZCONST char Far ZipInfoUsageLine4[] = ""; | |
271 | #endif /* ?MORE */ | |
272 | #endif /* !NO_ZIPINFO */ | |
273 | ||
274 | #ifdef BETA | |
275 | # ifdef VMSCLI | |
276 | /* BetaVersion[] is also used in vms/cmdline.c: do not make it static */ | |
277 | ZCONST char Far BetaVersion[] = "%s\ | |
278 | THIS IS STILL A BETA VERSION OF UNZIP%s -- DO NOT DISTRIBUTE.\n\n"; | |
279 | # else | |
280 | static ZCONST char Far BetaVersion[] = "%s\ | |
281 | THIS IS STILL A BETA VERSION OF UNZIP%s -- DO NOT DISTRIBUTE.\n\n"; | |
282 | # endif | |
283 | #endif | |
284 | ||
285 | #ifdef SFX | |
286 | # ifdef VMSCLI | |
287 | /* UnzipSFXBanner[] is also used in vms/cmdline.c: do not make it static */ | |
288 | ZCONST char Far UnzipSFXBanner[] = | |
289 | # else | |
290 | static ZCONST char Far UnzipSFXBanner[] = | |
291 | # endif | |
292 | "UnZipSFX %d.%d%d%s of %s, by Info-ZIP (Zip-Bugs@lists.wku.edu).\n"; | |
293 | # ifdef SFX_EXDIR | |
294 | static ZCONST char Far UnzipSFXOpts[] = | |
295 | "Valid options are -tfupcz and -d <exdir>; modifiers are -abjnoqCL%sV%s.\n"; | |
296 | # else | |
297 | static ZCONST char Far UnzipSFXOpts[] = | |
298 | "Valid options are -tfupcz; modifiers are -abjnoqCL%sV%s.\n"; | |
299 | # endif | |
300 | #else /* !SFX */ | |
301 | static ZCONST char Far CompileOptions[] = | |
302 | "UnZip special compilation options:\n"; | |
303 | static ZCONST char Far CompileOptFormat[] = "\t%s\n"; | |
304 | static ZCONST char Far EnvOptions[] = | |
305 | "\nUnZip and ZipInfo environment options:\n"; | |
306 | static ZCONST char Far EnvOptFormat[] = "%16s: %s\n"; | |
307 | static ZCONST char Far None[] = "[none]"; | |
308 | # ifdef ACORN_FTYPE_NFS | |
309 | static ZCONST char Far AcornFtypeNFS[] = "ACORN_FTYPE_NFS"; | |
310 | # endif | |
311 | # ifdef ASM_CRC | |
312 | static ZCONST char Far AsmCRC[] = "ASM_CRC"; | |
313 | # endif | |
314 | # ifdef ASM_INFLATECODES | |
315 | static ZCONST char Far AsmInflateCodes[] = "ASM_INFLATECODES"; | |
316 | # endif | |
317 | # ifdef CHECK_VERSIONS | |
318 | static ZCONST char Far Check_Versions[] = "CHECK_VERSIONS"; | |
319 | # endif | |
320 | # ifdef COPYRIGHT_CLEAN | |
321 | static ZCONST char Far Copyright_Clean[] = | |
322 | "COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)"; | |
323 | # endif | |
324 | # ifdef DEBUG | |
325 | static ZCONST char Far UDebug[] = "DEBUG"; | |
326 | # endif | |
327 | # ifdef DEBUG_TIME | |
328 | static ZCONST char Far DebugTime[] = "DEBUG_TIME"; | |
329 | # endif | |
330 | # ifdef DLL | |
331 | static ZCONST char Far Dll[] = "DLL"; | |
332 | # endif | |
333 | # ifdef DOSWILD | |
334 | static ZCONST char Far DosWild[] = "DOSWILD"; | |
335 | # endif | |
336 | # ifdef LZW_CLEAN | |
337 | static ZCONST char Far LZW_Clean[] = | |
338 | "LZW_CLEAN (PKZIP/Zip 1.x unshrinking method not supported)"; | |
339 | # endif | |
340 | # ifndef MORE | |
341 | static ZCONST char Far No_More[] = "NO_MORE"; | |
342 | # endif | |
343 | # ifdef NO_ZIPINFO | |
344 | static ZCONST char Far No_ZipInfo[] = "NO_ZIPINFO"; | |
345 | # endif | |
346 | # ifdef NTSD_EAS | |
347 | static ZCONST char Far NTSDExtAttrib[] = "NTSD_EAS"; | |
348 | # endif | |
349 | # ifdef OS2_EAS | |
350 | static ZCONST char Far OS2ExtAttrib[] = "OS2_EAS"; | |
351 | # endif | |
352 | # ifdef QLZIP | |
353 | static ZCONST char Far SMSExFldOnUnix[] = "QLZIP"; | |
354 | # endif | |
355 | # ifdef REENTRANT | |
356 | static ZCONST char Far Reentrant[] = "REENTRANT"; | |
357 | # endif | |
358 | # ifdef REGARGS | |
359 | static ZCONST char Far RegArgs[] = "REGARGS"; | |
360 | # endif | |
361 | # ifdef RETURN_CODES | |
362 | static ZCONST char Far Return_Codes[] = "RETURN_CODES"; | |
363 | # endif | |
364 | # ifdef SET_DIR_ATTRIB | |
365 | static ZCONST char Far SetDirAttrib[] = "SET_DIR_ATTRIB"; | |
366 | # endif | |
367 | # ifdef TIMESTAMP | |
368 | static ZCONST char Far TimeStamp[] = "TIMESTAMP"; | |
369 | # endif | |
370 | # ifdef UNIXBACKUP | |
371 | static ZCONST char Far UnixBackup[] = "UNIXBACKUP"; | |
372 | # endif | |
373 | # ifdef USE_EF_UT_TIME | |
374 | static ZCONST char Far Use_EF_UT_time[] = "USE_EF_UT_TIME"; | |
375 | # endif | |
376 | # ifndef LZW_CLEAN | |
377 | static ZCONST char Far Use_Unshrink[] = | |
378 | "USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)"; | |
379 | # endif | |
380 | # ifndef COPYRIGHT_CLEAN | |
381 | static ZCONST char Far Use_Smith_Code[] = | |
382 | "USE_SMITH_CODE (PKZIP 0.9x unreducing method supported)"; | |
383 | # endif | |
384 | # ifdef USE_VFAT | |
385 | static ZCONST char Far Use_VFAT_support[] = "USE_VFAT"; | |
386 | # endif | |
387 | # ifdef USE_ZLIB | |
388 | static ZCONST char Far UseZlib[] = | |
389 | "USE_ZLIB (compiled with version %s; using version %s)"; | |
390 | # endif | |
391 | # ifdef VMS_TEXT_CONV | |
392 | static ZCONST char Far VmsTextConv[] = "VMS_TEXT_CONV"; | |
393 | # endif | |
394 | # ifdef VMSCLI | |
395 | static ZCONST char Far VmsCLI[] = "VMSCLI"; | |
396 | # endif | |
397 | # ifdef VMSWILD | |
398 | static ZCONST char Far VmsWild[] = "VMSWILD"; | |
399 | # endif | |
400 | # if CRYPT | |
401 | # ifdef PASSWD_FROM_STDIN | |
402 | static ZCONST char Far PasswdStdin[] = "PASSWD_FROM_STDIN"; | |
403 | # endif | |
404 | static ZCONST char Far Decryption[] = | |
405 | "\t[decryption, version %d.%d%s of %s]\n"; | |
406 | static ZCONST char Far CryptDate[] = CR_VERSION_DATE; | |
407 | # endif | |
408 | # ifndef __RSXNT__ | |
409 | # ifdef __EMX__ | |
410 | static ZCONST char Far EnvEMX[] = "EMX"; | |
411 | static ZCONST char Far EnvEMXOPT[] = "EMXOPT"; | |
412 | # endif | |
413 | # if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2))) | |
414 | static ZCONST char Far EnvGO32[] = "GO32"; | |
415 | static ZCONST char Far EnvGO32TMP[] = "GO32TMP"; | |
416 | # endif | |
417 | # endif /* !__RSXNT__ */ | |
418 | ||
419 | #ifdef VMS | |
420 | /* UnzipUsageLine1[] is also used in vms/cmdline.c: do not make it static */ | |
421 | ZCONST char Far UnzipUsageLine1[] = "\ | |
422 | UnZip %d.%d%d%s of %s, by Info-ZIP. For more details see: unzip -v.\n\n"; | |
423 | #ifdef COPYRIGHT_CLEAN | |
424 | static ZCONST char Far UnzipUsageLine1v[] = "\ | |
425 | UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\ | |
426 | bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.\ | |
427 | \n\n"; | |
428 | #else | |
429 | static ZCONST char Far UnzipUsageLine1v[] = "\ | |
430 | UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\ | |
431 | Send bug reports to authors at Zip-Bugs@lists.wku.edu; see README for details.\ | |
432 | \n\n"; | |
433 | #endif /* ?COPYRIGHT_CLEAN */ | |
434 | #else /* !VMS */ | |
435 | #ifdef COPYRIGHT_CLEAN | |
436 | static ZCONST char Far UnzipUsageLine1[] = "\ | |
437 | UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\ | |
438 | bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.\ | |
439 | \n\n"; | |
440 | #else | |
441 | static ZCONST char Far UnzipUsageLine1[] = "\ | |
442 | UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\ | |
443 | Send bug reports to authors at Zip-Bugs@lists.wku.edu; see README for details.\ | |
444 | \n\n"; | |
445 | #endif /* ?COPYRIGHT_CLEAN */ | |
446 | #define UnzipUsageLine1v UnzipUsageLine1 | |
447 | #endif /* ?VMS */ | |
448 | ||
449 | static ZCONST char Far UnzipUsageLine2v[] = "\ | |
450 | Latest sources and executables are at ftp://ftp.cdrom.com/pub/infozip/ , as of\ | |
451 | \nabove date; see http://www.cdrom.com/pub/infozip/UnZip.html for other sites.\ | |
452 | \n\n"; | |
453 | ||
454 | #ifdef MACOS | |
455 | static ZCONST char Far UnzipUsageLine2[] = "\ | |
456 | Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-d exdir]\n \ | |
457 | Default action is to extract files in list, to exdir;\n\ | |
458 | file[.zip] may be a wildcard. %s\n"; | |
459 | #else /* !MACOS */ | |
460 | #ifdef VM_CMS | |
461 | static ZCONST char Far UnzipUsageLine2[] = "\ | |
462 | Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d fm]\n \ | |
463 | Default action is to extract files in list, except those in xlist, to disk fm;\n\ | |
464 | file[.zip] may be a wildcard. %s\n"; | |
465 | #else /* !VM_CMS */ | |
466 | static ZCONST char Far UnzipUsageLine2[] = "\ | |
467 | Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]\n \ | |
468 | Default action is to extract files in list, except those in xlist, to exdir;\n\ | |
469 | file[.zip] may be a wildcard. %s\n"; | |
470 | #endif /* ?VM_CMS */ | |
471 | #endif /* ?MACOS */ | |
472 | ||
473 | #ifdef NO_ZIPINFO | |
474 | # define ZIPINFO_MODE_OPTION "" | |
475 | static ZCONST char Far ZipInfoMode[] = | |
476 | "(ZipInfo mode is disabled in this version.)"; | |
477 | #else | |
478 | # define ZIPINFO_MODE_OPTION "[-Z] " | |
479 | # ifdef VMS | |
480 | static ZCONST char Far ZipInfoMode[] = | |
481 | "\"-Z\" => ZipInfo mode (`unzip \"-Z\"' for usage)."; | |
482 | # else | |
483 | static ZCONST char Far ZipInfoMode[] = | |
484 | "-Z => ZipInfo mode (\"unzip -Z\" for usage)."; | |
485 | # endif | |
486 | #endif /* ?NO_ZIPINFO */ | |
487 | ||
488 | #ifdef VMS | |
489 | static ZCONST char Far VMSusageLine2b[] = "\ | |
490 | => define foreign command symbol in LOGIN.COM: $ unzip :== $dev:[dir]unzip.exe\ | |
491 | \n"; | |
492 | #endif | |
493 | ||
494 | #ifdef MACOS | |
495 | static ZCONST char Far UnzipUsageLine3[] = "\n\ | |
496 | -d extract files into exdir -l list files (short format)\n\ | |
497 | -f freshen existing files, create none -t test compressed archive data\n\ | |
498 | -u update files, create if necessary -z display archive comment\n\ | |
499 | %s\n"; | |
500 | #else /* !MACOS */ | |
501 | #ifdef VM_CMS | |
502 | static ZCONST char Far UnzipUsageLine3[] = "\n\ | |
503 | -p extract files to pipe, no messages -l list files (short format)\n\ | |
504 | -f freshen existing files, create none -t test compressed archive data\n\ | |
505 | -u update files, create if necessary -z display archive comment\n\ | |
506 | -x exclude files that follow (in xlist) -d extract files onto disk fm\n\ | |
507 | %s\n"; | |
508 | #else /* !VM_CMS */ | |
509 | static ZCONST char Far UnzipUsageLine3[] = "\n\ | |
510 | -p extract files to pipe, no messages -l list files (short format)\n\ | |
511 | -f freshen existing files, create none -t test compressed archive data\n\ | |
512 | -u update files, create if necessary -z display archive comment\n\ | |
513 | -x exclude files that follow (in xlist) -d extract files into exdir\n\ | |
514 | %s\n"; | |
515 | #endif /* ?VM_CMS */ | |
516 | #endif /* ?MACOS */ | |
517 | ||
518 | static ZCONST char Far UnzipUsageLine4[] = "\ | |
519 | modifiers: -q quiet mode (-qq => quieter)\n\ | |
520 | -n never overwrite existing files -a auto-convert any text files\n\ | |
521 | -o overwrite files WITHOUT prompting -aa treat ALL files as text\n \ | |
522 | -j junk paths (do not make directories) -v be verbose/print version info\n\ | |
523 | %c-C%c match filenames case-insensitively %c-L%c make (some) names \ | |
524 | lowercase\n %-42s %c-V%c retain VMS version numbers\n%s"; | |
525 | ||
526 | static ZCONST char Far UnzipUsageLine5[] = "\ | |
527 | Examples (see unzip.doc for more info):\n\ | |
528 | unzip data1 -x joe => extract all files except joe from zipfile data1.zip\n\ | |
529 | %s\ | |
530 | unzip -fo foo %-6s => quietly replace existing %s if archive file newer\n"; | |
531 | #endif /* ?SFX */ | |
532 | ||
533 | ||
534 | ||
535 | ||
536 | ||
537 | /*****************************/ | |
538 | /* main() / UzpMain() stub */ | |
539 | /*****************************/ | |
540 | ||
541 | int include_unpack(char *aname) /* return PK-type error code (except under VMS) */ | |
542 | { | |
543 | int r, argc = 3; | |
544 | char *argv[4]; | |
545 | ||
546 | argv[0] = "install.exe"; | |
547 | argv[1] = "-v"; | |
548 | argv[2] = aname; | |
549 | argv[3] = NULL; | |
550 | ||
551 | CONSTRUCTGLOBALS(); | |
552 | r = unzip(__G__ argc, argv); | |
553 | DESTROYGLOBALS() | |
554 | RETURN(r); | |
555 | } | |
556 | ||
557 | void resetglobals(void) { } | |
558 | ||
559 | int pipeit(char *format, ...) | |
560 | { | |
561 | return 0; | |
562 | } | |
563 | ||
564 | int confirm(char *format, ...) | |
565 | { | |
566 | return 1; | |
567 | } | |
568 | ||
569 | ||
570 | ||
571 | /*******************************/ | |
572 | /* Primary UnZip entry point */ | |
573 | /*******************************/ | |
574 | ||
575 | int unzip(__G__ argc, argv) | |
576 | __GDEF | |
577 | int argc; | |
578 | char *argv[]; | |
579 | { | |
580 | #ifndef NO_ZIPINFO | |
581 | char *p; | |
582 | #endif | |
583 | #ifdef DOS_FLX_H68_OS2_W32 | |
584 | int i; | |
585 | #endif | |
586 | int retcode, error=FALSE; | |
587 | ||
588 | #if (defined(__IBMC__) && defined(__DEBUG_ALLOC__)) | |
589 | extern void DebugMalloc(void); | |
590 | ||
591 | atexit(DebugMalloc); | |
592 | #endif | |
593 | ||
594 | #ifdef MALLOC_WORK | |
595 | G.area.Slide =(uch *)calloc(8193, sizeof(shrint)+sizeof(uch)+sizeof(uch)); | |
596 | G.area.shrink.Parent = (shrint *)G.area.Slide; | |
597 | G.area.shrink.value = G.area.Slide + (sizeof(shrint)*(HSIZE+1)); | |
598 | G.area.shrink.Stack = G.area.Slide + | |
599 | (sizeof(shrint) + sizeof(uch))*(HSIZE+1); | |
600 | #endif | |
601 | ||
602 | /*--------------------------------------------------------------------------- | |
603 | Macintosh initialization code. | |
604 | ---------------------------------------------------------------------------*/ | |
605 | ||
606 | #ifdef MACOS | |
607 | { | |
608 | int a; | |
609 | ||
610 | for (a = 0; a < 4; ++a) | |
611 | G.rghCursor[a] = GetCursor(a+128); | |
612 | G.giCursor = 0; | |
613 | } | |
614 | #endif | |
615 | ||
616 | /*--------------------------------------------------------------------------- | |
617 | Human68K initialization code. | |
618 | ---------------------------------------------------------------------------*/ | |
619 | ||
620 | #ifdef __human68k__ | |
621 | InitTwentyOne(); | |
622 | #endif | |
623 | ||
624 | /*--------------------------------------------------------------------------- | |
625 | Acorn RISC OS initialization code. | |
626 | ---------------------------------------------------------------------------*/ | |
627 | ||
628 | #ifdef RISCOS | |
629 | set_prefix(); | |
630 | #endif | |
631 | ||
632 | /*--------------------------------------------------------------------------- | |
633 | Set signal handler for restoring echo, warn of zipfile corruption, etc. | |
634 | ---------------------------------------------------------------------------*/ | |
635 | ||
636 | #ifdef SIGINT | |
637 | signal(SIGINT, handler); | |
638 | #endif | |
639 | #ifdef SIGTERM /* some systems really have no SIGTERM */ | |
640 | signal(SIGTERM, handler); | |
641 | #endif | |
642 | #ifdef SIGBUS | |
643 | signal(SIGBUS, handler); | |
644 | #endif | |
645 | #ifdef SIGSEGV | |
646 | signal(SIGSEGV, handler); | |
647 | #endif | |
648 | ||
649 | #if (defined(WIN32) && defined(__RSXNT__)) | |
650 | for (i = 0 ; i < argc; i++) { | |
651 | _ISO_INTERN(argv[i]); | |
652 | } | |
653 | #endif | |
654 | ||
655 | /*--------------------------------------------------------------------------- | |
656 | First figure out if we're running in UnZip mode or ZipInfo mode, and put | |
657 | the appropriate environment-variable options into the queue. Then rip | |
658 | through any command-line options lurking about... | |
659 | ---------------------------------------------------------------------------*/ | |
660 | ||
661 | #ifdef SFX | |
662 | G.argv0 = argv[0]; | |
663 | #if (defined(OS2) || defined(WIN32)) | |
664 | G.zipfn = GetLoadPath(__G);/* non-MSC NT puts path into G.filename[] */ | |
665 | #else | |
666 | G.zipfn = G.argv0; | |
667 | #endif | |
668 | ||
669 | #ifdef VMSCLI | |
670 | { | |
671 | ulg status = vms_unzip_cmdline(&argc, &argv); | |
672 | if (!(status & 1)) | |
673 | return status; | |
674 | } | |
675 | #endif /* VMSCLI */ | |
676 | ||
677 | uO.zipinfo_mode = FALSE; | |
678 | error = uz_opts(__G__ &argc, &argv); /* UnZipSFX call only */ | |
679 | ||
680 | #else /* !SFX */ | |
681 | ||
682 | #ifdef RISCOS | |
683 | /* get the extensions to swap from environment */ | |
684 | getRISCOSexts(ENV_UNZIPEXTS); | |
685 | #endif | |
686 | ||
687 | #ifdef MSDOS | |
688 | /* extract MKS extended argument list from environment (before envargs!) */ | |
689 | mksargs(&argc, &argv); | |
690 | #endif | |
691 | ||
692 | #ifdef VMSCLI | |
693 | { | |
694 | ulg status = vms_unzip_cmdline(&argc, &argv); | |
695 | if (!(status & 1)) | |
696 | return status; | |
697 | } | |
698 | #endif /* VMSCLI */ | |
699 | ||
700 | G.noargs = (argc == 1); /* no options, no zipfile, no anything */ | |
701 | ||
702 | #ifndef NO_ZIPINFO | |
703 | for (p = argv[0] + strlen(argv[0]); p >= argv[0]; --p) { | |
704 | if (*p == DIR_END | |
705 | #ifdef DIR_END2 | |
706 | || *p == DIR_END2 | |
707 | #endif | |
708 | ) | |
709 | break; | |
710 | } | |
711 | ++p; | |
712 | ||
713 | if (STRNICMP(p, LoadFarStringSmall(Zipnfo), 7) == 0 || | |
714 | STRNICMP(p, "ii", 2) == 0 || | |
715 | (argc > 1 && strncmp(argv[1], "-Z", 2) == 0)) | |
716 | { | |
717 | uO.zipinfo_mode = TRUE; | |
718 | envargs(__G__ &argc, &argv, LoadFarStringSmall(EnvZipInfo), | |
719 | LoadFarStringSmall2(EnvZipInfo2)); | |
720 | error = zi_opts(__G__ &argc, &argv); | |
721 | } else | |
722 | #endif /* NO_ZIPINFO */ | |
723 | { | |
724 | uO.zipinfo_mode = FALSE; | |
725 | envargs(__G__ &argc, &argv, LoadFarStringSmall(EnvUnZip), | |
726 | LoadFarStringSmall2(EnvUnZip2)); | |
727 | error = uz_opts(__G__ &argc, &argv); | |
728 | } | |
729 | ||
730 | #endif /* ?SFX */ | |
731 | ||
732 | if ((argc < 0) || error) | |
733 | return error; | |
734 | ||
735 | /*--------------------------------------------------------------------------- | |
736 | Now get the zipfile name from the command line and then process any re- | |
737 | maining options and file specifications. | |
738 | ---------------------------------------------------------------------------*/ | |
739 | ||
740 | #ifdef DOS_FLX_H68_OS2_W32 | |
741 | /* convert MSDOS-style directory separators to Unix-style ones for | |
742 | * user's convenience (include zipfile name itself) | |
743 | */ | |
744 | #ifdef SFX | |
745 | for (G.pfnames = argv, i = argc; i > 0; --i) { | |
746 | #else | |
747 | /* argc does not include the zipfile specification */ | |
748 | for (G.pfnames = argv, i = argc+1; i > 0; --i) { | |
749 | #endif | |
750 | char *q; | |
751 | ||
752 | for (q = *G.pfnames; *q; ++q) | |
753 | if (*q == '\\') | |
754 | *q = '/'; | |
755 | ++G.pfnames; | |
756 | } | |
757 | #endif /* DOS_FLX_H68_OS2_W32 */ | |
758 | ||
759 | #ifndef SFX | |
760 | G.wildzipfn = *argv++; | |
761 | #endif | |
762 | ||
763 | #if (defined(SFX) && !defined(SFX_EXDIR)) /* only check for -x */ | |
764 | ||
765 | G.filespecs = argc; | |
766 | G.xfilespecs = 0; | |
767 | ||
768 | if (argc > 0) { | |
769 | char **pp = argv-1; | |
770 | ||
771 | G.pfnames = argv; | |
772 | while (*++pp) | |
773 | if (strcmp(*pp, "-x") == 0) { | |
774 | if (pp > argv) { | |
775 | *pp = 0; /* terminate G.pfnames */ | |
776 | G.filespecs = pp - G.pfnames; | |
777 | } else { | |
778 | G.pfnames = (char **)fnames; /* defaults */ | |
779 | G.filespecs = 0; | |
780 | } | |
781 | G.pxnames = pp + 1; /* excluded-names ptr: _after_ -x */ | |
782 | G.xfilespecs = argc - G.filespecs - 1; | |
783 | break; /* skip rest of args */ | |
784 | } | |
785 | G.process_all_files = FALSE; | |
786 | } else | |
787 | G.process_all_files = TRUE; /* for speed */ | |
788 | ||
789 | #else /* !SFX || SFX_EXDIR */ /* check for -x or -d */ | |
790 | ||
791 | G.filespecs = argc; | |
792 | G.xfilespecs = 0; | |
793 | ||
794 | if (argc > 0) { | |
795 | int in_files=FALSE, in_xfiles=FALSE; | |
796 | char **pp = argv-1; | |
797 | ||
798 | G.process_all_files = FALSE; | |
799 | G.pfnames = argv; | |
800 | while (*++pp) { | |
801 | Trace((stderr, "pp - argv = %d\n", pp-argv)); | |
802 | #ifdef CMS_MVS | |
803 | if (!uO.exdir && STRNICMP(*pp, "-d", 2) == 0) { | |
804 | #else | |
805 | if (!uO.exdir && strncmp(*pp, "-d", 2) == 0) { | |
806 | #endif | |
807 | int firstarg = (pp == argv); | |
808 | ||
809 | uO.exdir = (*pp) + 2; | |
810 | if (in_files) { /* ... zipfile ... -d exdir ... */ | |
811 | *pp = (char *)NULL; /* terminate G.pfnames */ | |
812 | G.filespecs = pp - G.pfnames; | |
813 | in_files = FALSE; | |
814 | } else if (in_xfiles) { | |
815 | *pp = (char *)NULL; /* terminate G.pxnames */ | |
816 | G.xfilespecs = pp - G.pxnames; | |
817 | /* "... -x xlist -d exdir": nothing left */ | |
818 | } | |
819 | /* first check for "-dexdir", then for "-d exdir" */ | |
820 | if (*uO.exdir == '\0') { | |
821 | if (*++pp) | |
822 | uO.exdir = *pp; | |
823 | else { | |
824 | Info(slide, 0x401, ((char *)slide, | |
825 | LoadFarString(MustGiveExdir))); | |
826 | return(PK_PARAM); /* don't extract here by accident */ | |
827 | } | |
828 | } | |
829 | if (firstarg) { /* ... zipfile -d exdir ... */ | |
830 | if (pp[1]) { | |
831 | G.pfnames = pp + 1; /* argv+2 */ | |
832 | G.filespecs = argc - (G.pfnames-argv); /* for now... */ | |
833 | } else { | |
834 | G.process_all_files = TRUE; | |
835 | G.pfnames = (char **)fnames; /* GRR: necessary? */ | |
836 | G.filespecs = 0; /* GRR: necessary? */ | |
837 | break; | |
838 | } | |
839 | } | |
840 | } else if (!in_xfiles) { | |
841 | if (strcmp(*pp, "-x") == 0) { | |
842 | in_xfiles = TRUE; | |
843 | if (pp == G.pfnames) { | |
844 | G.pfnames = (char **)fnames; /* defaults */ | |
845 | G.filespecs = 0; | |
846 | } else if (in_files) { | |
847 | *pp = 0; /* terminate G.pfnames */ | |
848 | G.filespecs = pp - G.pfnames; /* adjust count */ | |
849 | in_files = FALSE; | |
850 | } | |
851 | G.pxnames = pp + 1; /* excluded-names ptr starts after -x */ | |
852 | G.xfilespecs = argc - (G.pxnames-argv); /* anything left */ | |
853 | } else | |
854 | in_files = TRUE; | |
855 | } | |
856 | } | |
857 | } else | |
858 | G.process_all_files = TRUE; /* for speed */ | |
859 | ||
860 | if (uO.exdir != (char *)NULL && !G.extract_flag) /* -d ignored */ | |
861 | Info(slide, 0x401, ((char *)slide, LoadFarString(NotExtracting))); | |
862 | #endif /* ?(SFX && !SFX_EXDIR) */ | |
863 | ||
864 | /*--------------------------------------------------------------------------- | |
865 | Okey dokey, we have everything we need to get started. Let's roll. | |
866 | ---------------------------------------------------------------------------*/ | |
867 | ||
868 | retcode = process_zipfiles(__G); | |
869 | return(retcode); | |
870 | ||
871 | } /* end main()/unzip() */ | |
872 | ||
873 | ||
874 | ||
875 | ||
876 | ||
877 | /**********************/ | |
878 | /* Function uz_opts() */ | |
879 | /**********************/ | |
880 | ||
881 | int uz_opts(__G__ pargc, pargv) | |
882 | __GDEF | |
883 | int *pargc; | |
884 | char ***pargv; | |
885 | { | |
886 | char **argv, *s; | |
887 | int argc, c, error=FALSE, negative=0; | |
888 | ||
889 | ||
890 | argc = *pargc; | |
891 | argv = *pargv; | |
892 | ||
893 | while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) { | |
894 | s = *argv + 1; | |
895 | while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */ | |
896 | #ifdef CMS_MVS | |
897 | switch (tolower(c)) | |
898 | #else | |
899 | switch (c) | |
900 | #endif | |
901 | { | |
902 | case ('-'): | |
903 | ++negative; | |
904 | break; | |
905 | case ('a'): | |
906 | if (negative) { | |
907 | uO.aflag = MAX(uO.aflag-negative,0); | |
908 | negative = 0; | |
909 | } else | |
910 | ++uO.aflag; | |
911 | break; | |
912 | #if (defined(DLL) && defined(API_DOC)) | |
913 | case ('A'): /* extended help for API */ | |
914 | APIhelp(__G__ argc, argv); | |
915 | *pargc = -1; /* signal to exit successfully */ | |
916 | return 0; | |
917 | #endif | |
918 | case ('b'): | |
919 | if (negative) { | |
920 | #ifdef VMS | |
921 | uO.bflag = MAX(uO.bflag-negative,0); | |
922 | #endif | |
923 | negative = 0; /* do nothing: "-b" is default */ | |
924 | } else { | |
925 | #ifdef VMS | |
926 | if (uO.aflag == 0) | |
927 | ++uO.bflag; | |
928 | #endif | |
929 | uO.aflag = 0; | |
930 | } | |
931 | break; | |
932 | #ifdef UNIXBACKUP | |
933 | case ('B'): /* -B: back up existing files */ | |
934 | if (negative) | |
935 | uO.B_flag = FALSE, negative = 0; | |
936 | else | |
937 | uO.B_flag = TRUE; | |
938 | break; | |
939 | #endif | |
940 | case ('c'): | |
941 | if (negative) { | |
942 | uO.cflag = FALSE, negative = 0; | |
943 | #ifdef NATIVE | |
944 | uO.aflag = 0; | |
945 | #endif | |
946 | } else { | |
947 | uO.cflag = TRUE; | |
948 | #ifdef NATIVE | |
949 | uO.aflag = 2; /* so you can read it on the screen */ | |
950 | #endif | |
951 | #ifdef DLL | |
952 | if (G.redirect_text) | |
953 | G.redirect_data = 2; | |
954 | #endif | |
955 | } | |
956 | break; | |
957 | #ifndef CMS_MVS | |
958 | case ('C'): /* -C: match filenames case-insensitively */ | |
959 | if (negative) | |
960 | uO.C_flag = FALSE, negative = 0; | |
961 | else | |
962 | uO.C_flag = TRUE; | |
963 | break; | |
964 | #endif /* !CMS_MVS */ | |
965 | #if (!defined(SFX) || defined(SFX_EXDIR)) | |
966 | case ('d'): | |
967 | if (negative) { /* negative not allowed with -d exdir */ | |
968 | Info(slide, 0x401, ((char *)slide, | |
969 | LoadFarString(MustGiveExdir))); | |
970 | return(PK_PARAM); /* don't extract here by accident */ | |
971 | } | |
972 | if (uO.exdir != (char *)NULL) { | |
973 | Info(slide, 0x401, ((char *)slide, | |
974 | LoadFarString(OnlyOneExdir))); | |
975 | return(PK_PARAM); /* GRR: stupid restriction? */ | |
976 | } else { | |
977 | /* first check for "-dexdir", then for "-d exdir" */ | |
978 | uO.exdir = s; | |
979 | if (*uO.exdir == '\0') { | |
980 | if (argc > 1) { | |
981 | --argc; | |
982 | uO.exdir = *++argv; | |
983 | if (*uO.exdir == '-') { | |
984 | Info(slide, 0x401, ((char *)slide, | |
985 | LoadFarString(MustGiveExdir))); | |
986 | return(PK_PARAM); | |
987 | } | |
988 | /* else uO.exdir points at extraction dir */ | |
989 | } else { | |
990 | Info(slide, 0x401, ((char *)slide, | |
991 | LoadFarString(MustGiveExdir))); | |
992 | return(PK_PARAM); | |
993 | } | |
994 | } | |
995 | /* uO.exdir now points at extraction dir (-dexdir or | |
996 | * -d exdir); point s at end of exdir to avoid mis- | |
997 | * interpretation of exdir characters as more options | |
998 | */ | |
999 | if (*s != 0) | |
1000 | while (*++s != 0) | |
1001 | ; | |
1002 | } | |
1003 | break; | |
1004 | #endif /* !SFX || SFX_EXDIR */ | |
1005 | case ('e'): /* just ignore -e, -x options (extract) */ | |
1006 | break; | |
1007 | #ifdef MACOS | |
1008 | case ('E'): /* -E [MacOS] display Mac e.f. when restoring */ | |
1009 | if( negative ) { | |
1010 | uO.E_flag = FALSE, negative = 0; | |
1011 | } else { | |
1012 | uO.E_flag = TRUE; | |
1013 | } | |
1014 | break; | |
1015 | #endif /* MACOS */ | |
1016 | case ('f'): /* "freshen" (extract only newer files) */ | |
1017 | if (negative) | |
1018 | uO.fflag = uO.uflag = FALSE, negative = 0; | |
1019 | else | |
1020 | uO.fflag = uO.uflag = TRUE; | |
1021 | break; | |
1022 | #if (defined(RISCOS) || defined(ACORN_FTYPE_NFS)) | |
1023 | case ('F'): /* Acorn filetype & NFS extension handling */ | |
1024 | if (negative) | |
1025 | uO.acorn_nfs_ext = FALSE, negative = 0; | |
1026 | else | |
1027 | uO.acorn_nfs_ext = TRUE; | |
1028 | break; | |
1029 | #endif /* RISCOS || ACORN_FTYPE_NFS */ | |
1030 | case ('h'): /* just print help message and quit */ | |
1031 | *pargc = -1; | |
1032 | return USAGE(PK_OK); | |
1033 | #ifdef MACOS | |
1034 | case ('i'): /* -i [MacOS] ignore filenames stored in Mac ef */ | |
1035 | if( negative ) { | |
1036 | uO.i_flag = FALSE, negative = 0; | |
1037 | } else { | |
1038 | uO.i_flag = TRUE; | |
1039 | } | |
1040 | break; | |
1041 | #endif /* MACOS */ | |
1042 | case ('j'): /* junk pathnames/directory structure */ | |
1043 | if (negative) | |
1044 | uO.jflag = FALSE, negative = 0; | |
1045 | else | |
1046 | uO.jflag = TRUE; | |
1047 | break; | |
1048 | #if (defined(__BEOS__) || defined(MACOS)) | |
1049 | case ('J'): /* Junk BeOS or MacOS file attributes */ | |
1050 | if( negative ) { | |
1051 | uO.J_flag = FALSE, negative = 0; | |
1052 | } else { | |
1053 | uO.J_flag = TRUE; | |
1054 | } | |
1055 | break; | |
1056 | #endif /* __BEOS__ || MACOS */ | |
1057 | #ifndef SFX | |
1058 | case ('l'): | |
1059 | if (negative) { | |
1060 | uO.vflag = MAX(uO.vflag-negative,0); | |
1061 | negative = 0; | |
1062 | } else | |
1063 | ++uO.vflag; | |
1064 | break; | |
1065 | #endif /* !SFX */ | |
1066 | #ifndef CMS_MVS | |
1067 | case ('L'): /* convert (some) filenames to lowercase */ | |
1068 | if (negative) | |
1069 | uO.L_flag = FALSE, negative = 0; | |
1070 | else | |
1071 | uO.L_flag = TRUE; | |
1072 | break; | |
1073 | #endif /* !CMS_MVS */ | |
1074 | #ifdef MORE | |
1075 | #ifdef CMS_MVS | |
1076 | case ('m'): | |
1077 | #endif | |
1078 | case ('M'): /* send all screen output through "more" fn. */ | |
1079 | /* GRR: eventually check for numerical argument => height */ | |
1080 | if (negative) | |
1081 | G.M_flag = FALSE, negative = 0; | |
1082 | else | |
1083 | G.M_flag = TRUE; | |
1084 | break; | |
1085 | #endif /* MORE */ | |
1086 | case ('n'): /* don't overwrite any files */ | |
1087 | if (negative) | |
1088 | uO.overwrite_none = FALSE, negative = 0; | |
1089 | else | |
1090 | uO.overwrite_none = TRUE; | |
1091 | break; | |
1092 | #ifdef AMIGA | |
1093 | case ('N'): /* restore comments as filenotes */ | |
1094 | if (negative) | |
1095 | uO.N_flag = FALSE, negative = 0; | |
1096 | else | |
1097 | uO.N_flag = TRUE; | |
1098 | break; | |
1099 | #endif /* AMIGA */ | |
1100 | case ('o'): /* OK to overwrite files without prompting */ | |
1101 | if (negative) { | |
1102 | uO.overwrite_all = MAX(uO.overwrite_all-negative,0); | |
1103 | negative = 0; | |
1104 | } else | |
1105 | ++uO.overwrite_all; | |
1106 | break; | |
1107 | case ('p'): /* pipes: extract to stdout, no messages */ | |
1108 | if (negative) { | |
1109 | uO.cflag = FALSE; | |
1110 | uO.qflag = MAX(uO.qflag-999,0); | |
1111 | negative = 0; | |
1112 | } else { | |
1113 | uO.cflag = TRUE; | |
1114 | uO.qflag += 999; | |
1115 | } | |
1116 | break; | |
1117 | #if CRYPT | |
1118 | /* GRR: yes, this is highly insecure, but dozens of people | |
1119 | * have pestered us for this, so here we go... */ | |
1120 | case ('P'): | |
1121 | if (negative) { /* negative not allowed with -P passwd */ | |
1122 | Info(slide, 0x401, ((char *)slide, | |
1123 | LoadFarString(MustGivePasswd))); | |
1124 | return(PK_PARAM); /* don't extract here by accident */ | |
1125 | } | |
1126 | if (uO.pwdarg != (char *)NULL) { | |
1127 | /* | |
1128 | GRR: eventually support multiple passwords? | |
1129 | Info(slide, 0x401, ((char *)slide, | |
1130 | LoadFarString(OnlyOnePasswd))); | |
1131 | return(PK_PARAM); | |
1132 | */ | |
1133 | } else { | |
1134 | /* first check for "-Ppasswd", then for "-P passwd" */ | |
1135 | uO.pwdarg = s; | |
1136 | if (*uO.pwdarg == '\0') { | |
1137 | if (argc > 1) { | |
1138 | --argc; | |
1139 | uO.pwdarg = *++argv; | |
1140 | if (*uO.pwdarg == '-') { | |
1141 | Info(slide, 0x401, ((char *)slide, | |
1142 | LoadFarString(MustGivePasswd))); | |
1143 | return(PK_PARAM); | |
1144 | } | |
1145 | /* else pwdarg points at decryption password */ | |
1146 | } else { | |
1147 | Info(slide, 0x401, ((char *)slide, | |
1148 | LoadFarString(MustGivePasswd))); | |
1149 | return(PK_PARAM); | |
1150 | } | |
1151 | } | |
1152 | /* pwdarg now points at decryption password (-Ppasswd or | |
1153 | * -P passwd); point s at end of passwd to avoid mis- | |
1154 | * interpretation of passwd characters as more options | |
1155 | */ | |
1156 | if (*s != 0) | |
1157 | while (*++s != 0) | |
1158 | ; | |
1159 | } | |
1160 | break; | |
1161 | #endif /* CRYPT */ | |
1162 | case ('q'): /* quiet: fewer comments/messages */ | |
1163 | if (negative) { | |
1164 | uO.qflag = MAX(uO.qflag-negative,0); | |
1165 | negative = 0; | |
1166 | } else | |
1167 | ++uO.qflag; | |
1168 | break; | |
1169 | #ifdef QDOS | |
1170 | case ('Q'): /* QDOS flags */ | |
1171 | qlflag ^= strtol(s, &s, 10); | |
1172 | break; /* we XOR this as we can config qlflags */ | |
1173 | #endif | |
1174 | #ifdef DOS_FLX_OS2_W32 | |
1175 | case ('s'): /* spaces in filenames: allow by default */ | |
1176 | if (negative) | |
1177 | uO.sflag = FALSE, negative = 0; | |
1178 | else | |
1179 | uO.sflag = TRUE; | |
1180 | break; | |
1181 | #endif /* DOS_FLX_OS2_W32 */ | |
1182 | case ('t'): | |
1183 | if (negative) | |
1184 | uO.tflag = FALSE, negative = 0; | |
1185 | else | |
1186 | uO.tflag = TRUE; | |
1187 | break; | |
1188 | #ifdef TIMESTAMP | |
1189 | case ('T'): | |
1190 | if (negative) | |
1191 | uO.T_flag = FALSE, negative = 0; | |
1192 | else | |
1193 | uO.T_flag = TRUE; | |
1194 | break; | |
1195 | #endif | |
1196 | case ('u'): /* update (extract only new and newer files) */ | |
1197 | if (negative) | |
1198 | uO.uflag = FALSE, negative = 0; | |
1199 | else | |
1200 | uO.uflag = TRUE; | |
1201 | break; | |
1202 | #ifndef CMS_MVS | |
1203 | case ('U'): /* obsolete; to be removed in version 6.0 */ | |
1204 | if (negative) | |
1205 | uO.L_flag = TRUE, negative = 0; | |
1206 | else | |
1207 | uO.L_flag = FALSE; | |
1208 | break; | |
1209 | #endif /* !CMS_MVS */ | |
1210 | #ifndef SFX | |
1211 | case ('v'): /* verbose */ | |
1212 | if (negative) { | |
1213 | uO.vflag = MAX(uO.vflag-negative,0); | |
1214 | negative = 0; | |
1215 | } else if (uO.vflag) | |
1216 | ++uO.vflag; | |
1217 | else | |
1218 | uO.vflag = 2; | |
1219 | break; | |
1220 | #endif /* !SFX */ | |
1221 | #ifndef CMS_MVS | |
1222 | case ('V'): /* Version (retain VMS/DEC-20 file versions) */ | |
1223 | if (negative) | |
1224 | uO.V_flag = FALSE, negative = 0; | |
1225 | else | |
1226 | uO.V_flag = TRUE; | |
1227 | break; | |
1228 | #endif /* !CMS_MVS */ | |
1229 | case ('x'): /* extract: default */ | |
1230 | #ifdef SFX | |
1231 | /* when 'x' is the only option in this argument, and the | |
1232 | * next arg is not an option, assume this initiates an | |
1233 | * exclusion list (-x xlist): terminate option-scanning | |
1234 | * and leave uz_opts with argv still pointing to "-x"; | |
1235 | * the xlist is processed later | |
1236 | */ | |
1237 | if (s - argv[0] == 2 && *s == '\0' && | |
1238 | argc > 1 && argv[1][0] != '-') { | |
1239 | /* break out of nested loops without "++argv;--argc" */ | |
1240 | goto opts_done; | |
1241 | } | |
1242 | #endif /* SFX */ | |
1243 | break; | |
1244 | #if (defined(RESTORE_UIDGID) || defined(OS2_W32)) | |
1245 | case ('X'): /* restore owner/protection info (need privs?) */ | |
1246 | if (negative) { | |
1247 | uO.X_flag = MAX(uO.X_flag-negative,0); | |
1248 | negative = 0; | |
1249 | } else | |
1250 | ++uO.X_flag; | |
1251 | break; | |
1252 | #endif /* RESTORE_UIDGID || OS2_W32 */ | |
1253 | case ('z'): /* display only the archive comment */ | |
1254 | if (negative) { | |
1255 | uO.zflag = MAX(uO.zflag-negative,0); | |
1256 | negative = 0; | |
1257 | } else | |
1258 | ++uO.zflag; | |
1259 | break; | |
1260 | #ifndef SFX | |
1261 | case ('Z'): /* should have been first option (ZipInfo) */ | |
1262 | Info(slide, 0x401, ((char *)slide, LoadFarString(Zfirst))); | |
1263 | error = TRUE; | |
1264 | break; | |
1265 | #endif /* !SFX */ | |
1266 | #ifdef DOS_OS2_W32 | |
1267 | case ('$'): | |
1268 | if (negative) { | |
1269 | uO.volflag = MAX(uO.volflag-negative,0); | |
1270 | negative = 0; | |
1271 | } else | |
1272 | ++uO.volflag; | |
1273 | break; | |
1274 | #endif /* DOS_OS2_W32 */ | |
1275 | default: | |
1276 | error = TRUE; | |
1277 | break; | |
1278 | ||
1279 | } /* end switch */ | |
1280 | } /* end while (not end of argument string) */ | |
1281 | } /* end while (not done with switches) */ | |
1282 | ||
1283 | /*--------------------------------------------------------------------------- | |
1284 | Check for nonsensical combinations of options. | |
1285 | ---------------------------------------------------------------------------*/ | |
1286 | ||
1287 | #ifdef SFX | |
1288 | opts_done: /* yes, very ugly...but only used by UnZipSFX with -x xlist */ | |
1289 | #endif | |
1290 | ||
1291 | if ((uO.cflag && uO.tflag) || (uO.cflag && uO.uflag) || | |
1292 | (uO.tflag && uO.uflag) || (uO.fflag && uO.overwrite_none)) | |
1293 | { | |
1294 | Info(slide, 0x401, ((char *)slide, LoadFarString(InvalidOptionsMsg))); | |
1295 | error = TRUE; | |
1296 | } | |
1297 | if (uO.aflag > 2) | |
1298 | uO.aflag = 2; | |
1299 | #ifdef VMS | |
1300 | if (uO.bflag > 2) | |
1301 | uO.bflag = 2; | |
1302 | #endif | |
1303 | if (uO.overwrite_all && uO.overwrite_none) { | |
1304 | Info(slide, 0x401, ((char *)slide, LoadFarString(IgnoreOOptionMsg))); | |
1305 | uO.overwrite_all = FALSE; | |
1306 | } | |
1307 | #ifdef MORE | |
1308 | if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func. useless */ | |
1309 | G.M_flag = 0; | |
1310 | #endif | |
1311 | ||
1312 | #ifdef SFX | |
1313 | if (error) | |
1314 | #else | |
1315 | if ((argc-- == 0) || error) | |
1316 | #endif | |
1317 | { | |
1318 | *pargc = argc; | |
1319 | *pargv = argv; | |
1320 | #ifndef SFX | |
1321 | if (uO.vflag >= 2 && argc == -1) { /* "unzip -v" */ | |
1322 | show_version_info(__G); | |
1323 | return PK_OK; | |
1324 | } | |
1325 | if (!G.noargs && !error) | |
1326 | error = PK_PARAM; /* had options (not -h or -v) but no zipfile */ | |
1327 | #endif /* !SFX */ | |
1328 | return USAGE(error); | |
1329 | } | |
1330 | ||
1331 | #ifdef SFX | |
1332 | /* print our banner unless we're being fairly quiet */ | |
1333 | if (uO.qflag < 2) | |
1334 | Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner), | |
1335 | UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, | |
1336 | LoadFarStringSmall(VersionDate))); | |
1337 | #ifdef BETA | |
1338 | /* always print the beta warning: no unauthorized distribution!! */ | |
1339 | Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n", | |
1340 | "SFX")); | |
1341 | #endif | |
1342 | #endif /* SFX */ | |
1343 | ||
1344 | if (uO.cflag || uO.tflag || uO.vflag || uO.zflag | |
1345 | #ifdef TIMESTAMP | |
1346 | || uO.T_flag | |
1347 | #endif | |
1348 | ) | |
1349 | G.extract_flag = FALSE; | |
1350 | else | |
1351 | G.extract_flag = TRUE; | |
1352 | ||
1353 | *pargc = argc; | |
1354 | *pargv = argv; | |
1355 | return PK_OK; | |
1356 | ||
1357 | } /* end function uz_opts() */ | |
1358 | ||
1359 | ||
1360 | ||
1361 | ||
1362 | /********************/ | |
1363 | /* Function usage() */ | |
1364 | /********************/ | |
1365 | ||
1366 | #ifdef SFX | |
1367 | # ifdef VMS | |
1368 | # define LOCAL "X. Quote uppercase options" | |
1369 | # endif | |
1370 | # ifdef UNIX | |
1371 | # define LOCAL "X" | |
1372 | # endif | |
1373 | # ifdef DOS_OS2_W32 | |
1374 | # define LOCAL "s$" | |
1375 | # endif | |
1376 | # ifdef FLEXOS | |
1377 | # define LOCAL "s" | |
1378 | # endif | |
1379 | # ifdef AMIGA | |
1380 | # define LOCAL "N" | |
1381 | # endif | |
1382 | /* Default for all other systems: */ | |
1383 | # ifndef LOCAL | |
1384 | # define LOCAL "" | |
1385 | # endif | |
1386 | ||
1387 | # ifdef MORE | |
1388 | # define SFXOPT1 "M" | |
1389 | # else | |
1390 | # define SFXOPT1 "" | |
1391 | # endif | |
1392 | ||
1393 | int usage(__G__ error) /* return PK-type error code */ | |
1394 | __GDEF | |
1395 | int error; | |
1396 | { | |
1397 | Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner), | |
1398 | UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, | |
1399 | LoadFarStringSmall(VersionDate))); | |
1400 | Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXOpts), | |
1401 | SFXOPT1, LOCAL)); | |
1402 | #ifdef BETA | |
1403 | Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n", | |
1404 | "SFX")); | |
1405 | #endif | |
1406 | ||
1407 | if (error) | |
1408 | return PK_PARAM; | |
1409 | else | |
1410 | return PK_COOL; /* just wanted usage screen: no error */ | |
1411 | ||
1412 | } /* end function usage() */ | |
1413 | ||
1414 | ||
1415 | ||
1416 | ||
1417 | ||
1418 | #else /* !SFX */ | |
1419 | # ifdef VMS | |
1420 | # define QUOT '\"' | |
1421 | # define QUOTS "\"" | |
1422 | # else | |
1423 | # define QUOT ' ' | |
1424 | # define QUOTS "" | |
1425 | # endif | |
1426 | ||
1427 | int usage(__G__ error) /* return PK-type error code */ | |
1428 | __GDEF | |
1429 | int error; | |
1430 | { | |
1431 | int flag = (error? 1 : 0); | |
1432 | ||
1433 | ||
1434 | /*--------------------------------------------------------------------------- | |
1435 | Print either ZipInfo usage or UnZip usage, depending on incantation. | |
1436 | (Strings must be no longer than 512 bytes for Turbo C, apparently.) | |
1437 | ---------------------------------------------------------------------------*/ | |
1438 | ||
1439 | if (uO.zipinfo_mode) { | |
1440 | ||
1441 | #ifndef NO_ZIPINFO | |
1442 | ||
1443 | Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine1), | |
1444 | ZI_MAJORVER, ZI_MINORVER, PATCHLEVEL, BETALEVEL, | |
1445 | LoadFarStringSmall(VersionDate), | |
1446 | LoadFarStringSmall2(ZipInfoExample), QUOTS,QUOTS)); | |
1447 | Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine2))); | |
1448 | Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine3), | |
1449 | QUOT,QUOT, QUOT,QUOT, LoadFarStringSmall(ZipInfoUsageLine4))); | |
1450 | #ifdef VMS | |
1451 | Info(slide, flag, ((char *)slide, "\nRemember that non-lowercase\ | |
1452 | filespecs must be quoted in VMS (e.g., \"Makefile\").\n")); | |
1453 | #endif | |
1454 | ||
1455 | #endif /* !NO_ZIPINFO */ | |
1456 | ||
1457 | } else { /* UnZip mode */ | |
1458 | ||
1459 | Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine1), | |
1460 | UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, | |
1461 | LoadFarStringSmall(VersionDate))); | |
1462 | #ifdef BETA | |
1463 | Info(slide, flag, ((char *)slide, LoadFarString(BetaVersion), "", "")); | |
1464 | #endif | |
1465 | ||
1466 | Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine2), | |
1467 | ZIPINFO_MODE_OPTION, LoadFarStringSmall(ZipInfoMode))); | |
1468 | #ifdef VMS | |
1469 | if (!error) /* maybe no command-line tail found; show extra help */ | |
1470 | Info(slide, flag, ((char *)slide, LoadFarString(VMSusageLine2b))); | |
1471 | #endif | |
1472 | ||
1473 | Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine3), | |
1474 | LoadFarStringSmall(local1))); | |
1475 | ||
1476 | Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine4), | |
1477 | QUOT,QUOT, QUOT,QUOT, LoadFarStringSmall(local2), QUOT,QUOT, | |
1478 | LoadFarStringSmall2(local3))); | |
1479 | ||
1480 | /* This is extra work for SMALL_MEM, but it will work since | |
1481 | * LoadFarStringSmall2 uses the same buffer. Remember, this | |
1482 | * is a hack. */ | |
1483 | Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine5), | |
1484 | LoadFarStringSmall(Example2), LoadFarStringSmall2(Example3), | |
1485 | LoadFarStringSmall2(Example3))); | |
1486 | ||
1487 | } /* end if (uO.zipinfo_mode) */ | |
1488 | ||
1489 | if (error) | |
1490 | return PK_PARAM; | |
1491 | else | |
1492 | return PK_COOL; /* just wanted usage screen: no error */ | |
1493 | ||
1494 | } /* end function usage() */ | |
1495 | ||
1496 | #endif /* ?SFX */ | |
1497 | ||
1498 | ||
1499 | ||
1500 | ||
1501 | #ifndef SFX | |
1502 | ||
1503 | /********************************/ | |
1504 | /* Function show_version_info() */ | |
1505 | /********************************/ | |
1506 | ||
1507 | static void show_version_info(__G) | |
1508 | __GDEF | |
1509 | { | |
1510 | if (uO.qflag > 3) /* "unzip -vqqqq" */ | |
1511 | Info(slide, 0, ((char *)slide, "%d\n", | |
1512 | (UZ_MAJORVER*100 + UZ_MINORVER*10 + PATCHLEVEL))); | |
1513 | else { | |
1514 | char *envptr, *getenv(); | |
1515 | int numopts = 0; | |
1516 | ||
1517 | Info(slide, 0, ((char *)slide, LoadFarString(UnzipUsageLine1v), | |
1518 | UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, | |
1519 | LoadFarStringSmall(VersionDate))); | |
1520 | Info(slide, 0, ((char *)slide, | |
1521 | LoadFarString(UnzipUsageLine2v))); | |
1522 | version(__G); | |
1523 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptions))); | |
1524 | #ifdef ACORN_FTYPE_NFS | |
1525 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1526 | LoadFarStringSmall(AcornFtypeNFS))); | |
1527 | ++numopts; | |
1528 | #endif | |
1529 | #ifdef ASM_CRC | |
1530 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1531 | LoadFarStringSmall(AsmCRC))); | |
1532 | ++numopts; | |
1533 | #endif | |
1534 | #ifdef ASM_INFLATECODES | |
1535 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1536 | LoadFarStringSmall(AsmInflateCodes))); | |
1537 | ++numopts; | |
1538 | #endif | |
1539 | #ifdef CHECK_VERSIONS | |
1540 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1541 | LoadFarStringSmall(Check_Versions))); | |
1542 | ++numopts; | |
1543 | #endif | |
1544 | #ifdef COPYRIGHT_CLEAN | |
1545 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1546 | LoadFarStringSmall(Copyright_Clean))); | |
1547 | ++numopts; | |
1548 | #endif | |
1549 | #ifdef DEBUG | |
1550 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1551 | LoadFarStringSmall(UDebug))); | |
1552 | ++numopts; | |
1553 | #endif | |
1554 | #ifdef DEBUG_TIME | |
1555 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1556 | LoadFarStringSmall(DebugTime))); | |
1557 | ++numopts; | |
1558 | #endif | |
1559 | #ifdef DLL | |
1560 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1561 | LoadFarStringSmall(Dll))); | |
1562 | ++numopts; | |
1563 | #endif | |
1564 | #ifdef DOSWILD | |
1565 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1566 | LoadFarStringSmall(DosWild))); | |
1567 | ++numopts; | |
1568 | #endif | |
1569 | #ifdef LZW_CLEAN | |
1570 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1571 | LoadFarStringSmall(LZW_Clean))); | |
1572 | ++numopts; | |
1573 | #endif | |
1574 | #ifndef MORE | |
1575 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1576 | LoadFarStringSmall(No_More))); | |
1577 | ++numopts; | |
1578 | #endif | |
1579 | #ifdef NO_ZIPINFO | |
1580 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1581 | LoadFarStringSmall(No_ZipInfo))); | |
1582 | ++numopts; | |
1583 | #endif | |
1584 | #ifdef NTSD_EAS | |
1585 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1586 | LoadFarStringSmall(NTSDExtAttrib))); | |
1587 | ++numopts; | |
1588 | #endif | |
1589 | #ifdef OS2_EAS | |
1590 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1591 | LoadFarStringSmall(OS2ExtAttrib))); | |
1592 | ++numopts; | |
1593 | #endif | |
1594 | #ifdef QLZIP | |
1595 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1596 | LoadFarStringSmall(SMSExFldOnUnix))); | |
1597 | ++numopts; | |
1598 | #endif | |
1599 | #ifdef REENTRANT | |
1600 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1601 | LoadFarStringSmall(Reentrant))); | |
1602 | ++numopts; | |
1603 | #endif | |
1604 | #ifdef REGARGS | |
1605 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1606 | LoadFarStringSmall(RegArgs))); | |
1607 | ++numopts; | |
1608 | #endif | |
1609 | #ifdef RETURN_CODES | |
1610 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1611 | LoadFarStringSmall(Return_Codes))); | |
1612 | ++numopts; | |
1613 | #endif | |
1614 | #ifdef SET_DIR_ATTRIB | |
1615 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1616 | LoadFarStringSmall(SetDirAttrib))); | |
1617 | ++numopts; | |
1618 | #endif | |
1619 | #ifdef TIMESTAMP | |
1620 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1621 | LoadFarStringSmall(TimeStamp))); | |
1622 | ++numopts; | |
1623 | #endif | |
1624 | #ifdef UNIXBACKUP | |
1625 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1626 | LoadFarStringSmall(UnixBackup))); | |
1627 | ++numopts; | |
1628 | #endif | |
1629 | #ifdef USE_EF_UT_TIME | |
1630 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1631 | LoadFarStringSmall(Use_EF_UT_time))); | |
1632 | ++numopts; | |
1633 | #endif | |
1634 | #ifndef COPYRIGHT_CLEAN | |
1635 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1636 | LoadFarStringSmall(Use_Smith_Code))); | |
1637 | ++numopts; | |
1638 | #endif | |
1639 | #ifndef LZW_CLEAN | |
1640 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1641 | LoadFarStringSmall(Use_Unshrink))); | |
1642 | ++numopts; | |
1643 | #endif | |
1644 | #ifdef USE_VFAT | |
1645 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1646 | LoadFarStringSmall(Use_VFAT_support))); | |
1647 | ++numopts; | |
1648 | #endif | |
1649 | #ifdef USE_ZLIB | |
1650 | sprintf((char *)(slide+256), LoadFarStringSmall(UseZlib), | |
1651 | ZLIB_VERSION, zlib_version); | |
1652 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1653 | (char *)(slide+256))); | |
1654 | ++numopts; | |
1655 | #endif | |
1656 | #ifdef VMS_TEXT_CONV | |
1657 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1658 | LoadFarStringSmall(VmsTextConv))); | |
1659 | ++numopts; | |
1660 | #endif | |
1661 | #ifdef VMSCLI | |
1662 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1663 | LoadFarStringSmall(VmsCLI))); | |
1664 | ++numopts; | |
1665 | #endif | |
1666 | #ifdef VMSWILD | |
1667 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1668 | LoadFarStringSmall(VmsWild))); | |
1669 | ++numopts; | |
1670 | #endif | |
1671 | #if CRYPT | |
1672 | # ifdef PASSWD_FROM_STDIN | |
1673 | Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), | |
1674 | LoadFarStringSmall(PasswdStdin))); | |
1675 | # endif | |
1676 | Info(slide, 0, ((char *)slide, LoadFarString(Decryption), | |
1677 | CR_MAJORVER, CR_MINORVER, CR_BETA_VER, | |
1678 | LoadFarStringSmall(CryptDate))); | |
1679 | ++numopts; | |
1680 | #endif /* CRYPT */ | |
1681 | if (numopts == 0) | |
1682 | Info(slide, 0, ((char *)slide, | |
1683 | LoadFarString(CompileOptFormat), | |
1684 | LoadFarStringSmall(None))); | |
1685 | ||
1686 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptions))); | |
1687 | envptr = getenv(LoadFarStringSmall(EnvUnZip)); | |
1688 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1689 | LoadFarStringSmall(EnvUnZip), | |
1690 | (envptr == (char *)NULL || *envptr == 0)? | |
1691 | LoadFarStringSmall2(None) : envptr)); | |
1692 | envptr = getenv(LoadFarStringSmall(EnvUnZip2)); | |
1693 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1694 | LoadFarStringSmall(EnvUnZip2), | |
1695 | (envptr == (char *)NULL || *envptr == 0)? | |
1696 | LoadFarStringSmall2(None) : envptr)); | |
1697 | envptr = getenv(LoadFarStringSmall(EnvZipInfo)); | |
1698 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1699 | LoadFarStringSmall(EnvZipInfo), | |
1700 | (envptr == (char *)NULL || *envptr == 0)? | |
1701 | LoadFarStringSmall2(None) : envptr)); | |
1702 | envptr = getenv(LoadFarStringSmall(EnvZipInfo2)); | |
1703 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1704 | LoadFarStringSmall(EnvZipInfo2), | |
1705 | (envptr == (char *)NULL || *envptr == 0)? | |
1706 | LoadFarStringSmall2(None) : envptr)); | |
1707 | #ifndef __RSXNT__ | |
1708 | #ifdef __EMX__ | |
1709 | envptr = getenv(LoadFarStringSmall(EnvEMX)); | |
1710 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1711 | LoadFarStringSmall(EnvEMX), | |
1712 | (envptr == (char *)NULL || *envptr == 0)? | |
1713 | LoadFarStringSmall2(None) : envptr)); | |
1714 | envptr = getenv(LoadFarStringSmall(EnvEMXOPT)); | |
1715 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1716 | LoadFarStringSmall(EnvEMXOPT), | |
1717 | (envptr == (char *)NULL || *envptr == 0)? | |
1718 | LoadFarStringSmall2(None) : envptr)); | |
1719 | #endif /* __EMX__ */ | |
1720 | #if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2))) | |
1721 | envptr = getenv(LoadFarStringSmall(EnvGO32)); | |
1722 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1723 | LoadFarStringSmall(EnvGO32), | |
1724 | (envptr == (char *)NULL || *envptr == 0)? | |
1725 | LoadFarStringSmall2(None) : envptr)); | |
1726 | envptr = getenv(LoadFarStringSmall(EnvGO32TMP)); | |
1727 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1728 | LoadFarStringSmall(EnvGO32TMP), | |
1729 | (envptr == (char *)NULL || *envptr == 0)? | |
1730 | LoadFarStringSmall2(None) : envptr)); | |
1731 | #endif /* __GO32__ && !(__DJGPP__ >= 2) */ | |
1732 | #endif /* !__RSXNT__ */ | |
1733 | #ifdef RISCOS | |
1734 | envptr = getenv(LoadFarStringSmall(EnvUnZipExts)); | |
1735 | Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), | |
1736 | LoadFarStringSmall(EnvUnZipExts), | |
1737 | (envptr == (char *)NULL || *envptr == 0)? | |
1738 | LoadFarStringSmall2(None) : envptr)); | |
1739 | #endif /* RISCOS */ | |
1740 | } | |
1741 | } /* end function show_version() */ | |
1742 | ||
1743 | #endif /* !SFX */ | |
1744 | #endif /* !WINDLL */ |