home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume44 / unzip / part01 next >
Internet Message Format  |  1994-09-19  |  79KB

  1. From: zip-bugs@wkuvx1.wku.edu (Info-ZIP group)
  2. Newsgroups: comp.sources.misc
  3. Subject: v44i066:  unzip - Info-ZIP portable UnZip, version 5.12, Part01/20
  4. Date: 18 Sep 1994 23:13:54 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <csm-v44i066=unzip.231310@sparky.sterling.com>
  9. X-Md4-Signature: f600743db4d0e93c2e2c1466fdb4f456
  10.  
  11. Submitted-by: zip-bugs@wkuvx1.wku.edu (Info-ZIP group)
  12. Posting-number: Volume 44, Issue 66
  13. Archive-name: unzip/part01
  14. Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, COHERENT, AMIGA?, ATARI TOS, SGI, DEC, Cray, Convex, Amdahl, Sun
  15. Supersedes: unzip50: Volume 31, Issue 104-117
  16.  
  17. UnZip is an extraction utility for archives compressed in .zip format (also
  18. called "zipfiles").  Although highly compatible both with PKWARE's PKZIP 
  19. and PKUNZIP utilities for MS-DOS and with Info-ZIP's own Zip program, our
  20. primary objectives have been portability and non-MSDOS functionality.
  21.  
  22. This version of UnZip has been ported to a wide array of hardware--from 
  23. micros to supercomputers--and operating systems:  Unix (many flavors),
  24. VMS, OS/2, MSDOS (+ Windows), NT, TOPS-20 (partly), AmigaDOS, Atari TOS,
  25. Macintosh and Human68k.  UnZip features not found in PKUNZIP include source
  26. code; default extraction of directory trees (with a switch to defeat this, 
  27. rather than the reverse); VMS, Macintosh and OS/2 extended file attributes; 
  28. and, of course, the ability to run under most of your favorite operating 
  29. systems.  Plus, it's free. :-)
  30.  
  31. For source distributions, see the main Contents file for a list of what's
  32. included, and read INSTALL for instructions on compiling (including OS-
  33. specific comments).  The individual operating systems' Contents files (for 
  34. example, vms/Contents) may list important compilation info in addition to 
  35. explaining what files are what, so be sure to read them.  Some of the ports 
  36. have their own, special README files, so be sure to look for those, too.
  37.  
  38. See unzip.1 or unzip.doc for usage (or the corresponding UnZipSFX, ZipInfo
  39. and fUnZip docs).  For VMS, unzip_def.rnh or unzip_cli.help may be compiled
  40. into unzip.hlp and installed as a normal VMS help entry; see vms/descrip.mms.
  41.  
  42.  CHANGES AND NEW FEATURES
  43.  ------------------------
  44. The 5.12 release mainly fixes some bugs in 5.11, including a silly pointer
  45. error in unzipsfx.  The only new features are fairly minor:
  46.  
  47.    - ZipInfo check for dead space inside archives (PKZIP/Netware bug)
  48.    - SFX_EXDIR compilation option to allow -d <exdir> with UnZipSFX
  49.    - "unzip -vqqqq" prints just the version number (e.g., "512")
  50.  
  51. Since neither 5.11 nor 5.1 was posted to Usenet, here's a summary of their
  52. new features.  In UnZip 5.11:
  53.  
  54.    - UnZipSFX, a self-extraction stub for prepending to (new-style) zipfiles
  55.       (tested under Unix, VMS, MS-DOS, OS/2, etc.; NOT portable *across* OSes)
  56.    - unshrink() rewritten to avoid copyright problems; 32-bit version only
  57.    - strings moved to far memory in MS-DOS:  can use small model again (MSC)
  58.    - numerous customization options (see INSTALL)
  59.    - diagnostic screen with -v option and no zipfile (i.e., "unzip -v")
  60.    - -C option for case-insensitive filename matching (esp. for MS-DOS, OS/2)
  61.    - more bad-zipfile "intelligence" (can sometimes even extract concatenated
  62.       multi-part archives)
  63.    - former -U behavior is now the default; new -L option to provide what was
  64.       the default behavior (auto-conversion of uppercase-OS filenames to lower
  65.       case)
  66.    - ZipInfo -T option to print times in decimal format (yymmdd.hhmmss) for
  67.       piping into sort(1)
  68.    - performance tweaks for listing archive contents
  69.    - improved/expanded documentation, esp. man pages (*.doc files) and INSTALL
  70.  
  71. In UnZip 5.1:
  72.  
  73.    - wildcard zipfiles (e.g., "unzip -tq \*.zip")
  74.    - extract to a directory other than the current one (-d <exdir> option)
  75.    - auto-conversion of text files
  76.    - ANSI sequences disabled in comments and filenames (avoid "ANSI bombs")
  77.    - ZipInfo incorporated into UnZip (-Z option)
  78.    - full Amiga, Atari, Mac, NT and Human68K support (partial TOPS-20)
  79.    - performance tuning for 35-70% faster extraction (depends on compression
  80.       method)
  81.  
  82. Note that, according to one tester, the 32-bit MS-DOS version is now *faster*
  83. than PKUNZIP on most archives!  Cool.
  84.  
  85.  DISTRIBUTION
  86.  ------------
  87. If you have a question regarding redistribution of Info-ZIP software,
  88. either as-is, as packaging for a commercial product, or as an integral
  89. part of a commercial product, read the Frequently Asked Questions (FAQ)
  90. section of the included COPYING file.
  91.  
  92. Insofar as C compilers are rare on some platforms and the authors only
  93. have direct access to Unix, VMS, OS/2, MS-DOS, Mac, Amiga and Atari 
  94. systems, others may wish to provide ready-to-run executables for new
  95. systems.  In general there is no problem with this; we require only that 
  96. such distributions include this README file, the Where file, the COPYING 
  97. file (contains copyright/redistribution information), and the appropriate 
  98. documentation files (unzip.doc and/or unzip.1 for UnZip, etc.).  If the 
  99. local system provides a way to make self-extracting archives in which both 
  100. the executables and text files may be stored together, that is best (in
  101. particular, use UnZipSFX if at all possible, even if it's a few kilobytes
  102. bigger than the alternatives); otherwise we suggest a bare UnZip executable
  103. and a separate zipfile containing the remaining text and binary files.  If
  104. another archiving method is in common use on the target system (for example,
  105. Zoo or LHa), that may also be used.
  106.  
  107.  BUGS AND NEW PORTS:  CONTACTING INFO-ZIP
  108.  ----------------------------------------
  109. All bug reports and patches (context diffs only, please!) should go to 
  110. zip-bugs@wkuvx1.wku.edu, which is the e-mail address for the Info-ZIP
  111. authors.  "Dumb questions" which aren't adequately answered in the docu-
  112. mentation should also be directed here rather than to a global forum such
  113. as Usenet.  (Kindly make certain that your questions *isn't* answered by
  114. the documentation, however--a great deal of effort has gone into making
  115. it clear and complete.)  Suggestions for new features can be sent to
  116. info-zip@wkuvx1.wku.edu, a mailing list for the Info-ZIP beta testers, 
  117. for discussion (the authors hang out here as well, of course), although 
  118. we don't promise to act on all suggestions.  If it is something which is 
  119. manifestly useful, sending the required patches to zip-bugs directly (as
  120. per the instructions in the ZipPorts file) is likely to produce a quicker 
  121. response than asking us to do it--the authors are always somewhat short 
  122. on time.  (Please do NOT send patches or encoded zipfiles to the info-zip 
  123. address.)
  124.  
  125. If you are considering a port, not only should you read the ZipPorts file,
  126. but also please check in with zip-bugs BEFORE getting started, since the 
  127. code is constantly being updated behind the scenes.  For example, an Acorn/
  128. Archimedes port is already almost complete, as is an OS/2 dynamic link lib-
  129. rary (DLL) version; VMOS, VM/CMS, Netware, QDOS and NT DLL ports are claimed
  130. to be under construction, although we have yet to see any up-to-date patches.
  131. We will arrange to send you the latest sources.  The alternative is the pos-
  132. sibility that your hard work will be tucked away in a sub-archive and mostly
  133. ignored, or completely ignored if someone else has already done the port
  134. (and you'd be surprised how often this has happened).  IBM mainframe ports
  135. (VM/CMS and/or MVS) would be particularly welcome.  (It can't be *that* hard,
  136. folks...the VMS filesystem is similar in many ways.)
  137.  
  138.  
  139.  BETA TESTING:  JOINING INFO-ZIP
  140.  -------------------------------
  141. If you'd like to keep up to date with our UnZip (and companion Zip utility)
  142. development, join the ranks of beta testers, add your own thoughts and con-
  143. tributions, etc., send a two-line mail message containing the commands HELP
  144. and LIST (on separate lines in the body of the message, not on the subject
  145. line) to mxserver@wkuvx1.wku.edu.  You'll receive two messages listing the 
  146. various Info-ZIP mailing-list formats which are available (and also various
  147. unrelated lists) and instructions on how to subscribe to one or more of them
  148. (courtesy of Hunter Goatley).  As of mid-1994, subscribing to the announce-
  149. ments list requires a command of the form
  150.  
  151.     SUBSCRIBE Info-ZIP-announce "Joe Isuzu"
  152.  
  153. The discussion list is called either Info-ZIP or Info-ZIP-digest, depending
  154. on one's preference for delivery.
  155.  
  156. -- Greg Roelofs (Cave Newt), UnZip maintainer/container/explainer and
  157.    developer guy, with inspiration from David Kirschbaum
  158. ----------
  159. #! /bin/sh
  160. # This is a shell archive.  Remove anything before this line, then feed it
  161. # into a shell via "sh file" or similar.  To overwrite existing files,
  162. # type "sh file -c".
  163. # Contents:  unzip-5.12 unzip-5.12/amiga unzip-5.12/atari
  164. #   unzip-5.12/human68k unzip-5.12/mac unzip-5.12/msdos
  165. #   unzip-5.12/msdos/README unzip-5.12/nt unzip-5.12/os2
  166. #   unzip-5.12/tops20 unzip-5.12/unix unzip-5.12/unzip.h
  167. #   unzip-5.12/vms
  168. # Wrapped by kent@sparky on Sat Sep 17 23:33:34 1994
  169. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  170. echo If this archive is complete, you will see the following message:
  171. echo '          "shar: End of archive 1 (of 20)."'
  172. if test ! -d 'unzip-5.12' ; then
  173.     echo shar: Creating directory \"'unzip-5.12'\"
  174.     mkdir 'unzip-5.12'
  175. fi
  176. if test ! -d 'unzip-5.12/amiga' ; then
  177.     echo shar: Creating directory \"'unzip-5.12/amiga'\"
  178.     mkdir 'unzip-5.12/amiga'
  179. fi
  180. if test ! -d 'unzip-5.12/atari' ; then
  181.     echo shar: Creating directory \"'unzip-5.12/atari'\"
  182.     mkdir 'unzip-5.12/atari'
  183. fi
  184. if test ! -d 'unzip-5.12/human68k' ; then
  185.     echo shar: Creating directory \"'unzip-5.12/human68k'\"
  186.     mkdir 'unzip-5.12/human68k'
  187. fi
  188. if test ! -d 'unzip-5.12/mac' ; then
  189.     echo shar: Creating directory \"'unzip-5.12/mac'\"
  190.     mkdir 'unzip-5.12/mac'
  191. fi
  192. if test ! -d 'unzip-5.12/msdos' ; then
  193.     echo shar: Creating directory \"'unzip-5.12/msdos'\"
  194.     mkdir 'unzip-5.12/msdos'
  195. fi
  196. if test -f 'unzip-5.12/msdos/README' -a "${1}" != "-c" ; then 
  197.   echo shar: Will not clobber existing file \"'unzip-5.12/msdos/README'\"
  198. else
  199.   echo shar: Extracting \"'unzip-5.12/msdos/README'\" \(4906 characters\)
  200.   sed "s/^X//" >'unzip-5.12/msdos/README' <<'END_OF_FILE'
  201. XNotes about MS-DOS executables and compilers:
  202. X
  203. X - Borland start-up code is reported to switch the screen mode auto-
  204. X   matically if it's not 80 columns (or possibly 40) and either 25, 43 
  205. X   or 50 lines.  In particular, extended modes such as 100x40 are not
  206. X   retained.
  207. X
  208. X - Borland start-up code also uses interrupt 1Ah, causing incorrect
  209. X   behavior (including lock-ups) on some Japanese MS-DOS machines such
  210. X   as the Fujitsu FMR series, which lack this interrupt.
  211. X
  212. X - Some(?) Borland compilers are apparently incapable of putting static
  213. X   data into far memory; this means all of UnZip's strings are in near
  214. X   memory, and there is not enough room to enable ZipInfo in the small
  215. X   memory model.  Even if strings are in far memory, the *code* segment
  216. X   produced by Borland compilers is now too big for one segment.  The
  217. X   large memory model is therefore the default for Borland compilers, but
  218. X   it may be possible to compile in the medium model as well (not tested).
  219. X
  220. X - Older Borland compilers do not understand source files with Unix
  221. X   line-endings (LF rather than CR/LF).  Use "flip" or a similar utility
  222. X   to convert the line endings before compiling, or take a look at the
  223. X   Borland.fix file in the UnZip source distribution.
  224. X
  225. X - Microsoft C 5.1 large-model code is more than an order of magnitude
  226. X   slower than the identical code compiled with MSC 6 or 7 (a factor of
  227. X   15 in our tests, actually).  This may be due to a lousy optimizer or
  228. X   lousy libraries; regardless, since UnZip is hovering at the doorstep
  229. X   of the large memory model, we recommend upgrading to a later version
  230. X   of the compiler.
  231. X
  232. XFor these reasons, Info-ZIP's distributed versions of the 16-bit MS-DOS 
  233. Xexecutables are compiled with MSC 6 or 7.
  234. X
  235. X - The default wildcard ("globbing") behavior of djgpp/go32 is disabled
  236. X   by default in UnZip, but this can be overridden if the GO32 environment
  237. X   variable is set to "glob".  This will cause UnZip to fail with various
  238. X   odd errors about "filename not matched" and the like; to avoid this, set
  239. X   the GO32 variable to "noglob" or unset it altogether.  (The documented
  240. X   method of avoiding this by quoting wildcards with single quotes was 
  241. X   buggy in djgpp 1.11 but is reported fixed in 1.12; not tested.)
  242. X
  243. X - djgpp's handling of timezones, necessary for the correct conversion of
  244. X   MS-DOS filetimes to those used in the Unix-like C library, is completely
  245. X   broken in djgpp 1.12 and probably earlier versions as well.  It is fixed
  246. X   (or very close to it) in the most recent 1.12m1 beta, so be sure to up-
  247. X   grade to 1.12m1 before compiling.  Otherwise UnZip's -f and -u (freshen/
  248. X   update) functions will not work correctly.
  249. X
  250. X - emx+gcc's DOS extender does not understand DPMI, and while there is an
  251. X   alternative extender called RSX available (found in dpmigcc4.zip as of
  252. X   August 1994), its setup is somewhat kludgy when the local memory manager
  253. X   supports both DPMI and VCPI (or something else).  It's also not yet as
  254. X   widely known or available as djgpp.
  255. X
  256. XFor these reasons Info-ZIP's distributed 32-bit MS-DOS executables are com-
  257. Xpiled with djgpp 1.12m1.  These are stand-alone programs; the "go32" DOS 
  258. Xextender is included inside the executables.  They generally run up to twice
  259. Xas fast as the 16-bit versions, but they only work on 386's and above.  In 
  260. Xsome cases they're actually slower.  If this is the case for you, first try 
  261. Xrunning under plain DOS, after removing any memory manager in your config.sys
  262. Xand rebooting, to check if the slowdown is due to your memory manager.  (Ac-
  263. Xcording to notes found in another package, there was a known conflict between 
  264. Xthe go32 extender and QEMM's DPMI; this was apparently just fixed in QEMM 
  265. X7.04/QDPMI 1.05, but if you still have an older version (1.03 or 1.01), add 
  266. X"set GO32=nodpmi" to your autoexec.bat to avoid the conflict.)  There may 
  267. Xalso be a problem with the time spent by the djgpp runtime creating and de-
  268. Xleting a swap file.  If you use SMARTDRV or another disk cache, make sure 
  269. Xthat writes are also cached.
  270. X
  271. XIf you already have djgpp 1.12m1 or later (or, more specifically, go32.exe
  272. X1.12m1 or later somewhere in your PATH), you can remove go32.exe from
  273. Xunzip386.exe to get a smaller executable:
  274. X
  275. X    exe2coff unzip386.exe
  276. X    coff2exe unzip386
  277. X    del unzip386
  278. X
  279. XAs noted above, go32/djgpp has its own wildcard-expansion routines which
  280. Xare disabled in UnZip by default because of incompatibilities with UnZip's
  281. Xown wildcards.  Stripping the go32 extender may cause go32's wildcards to
  282. Xbe re-enabled; in this case you must set GO32 as follows for UnZip to work
  283. Xcorrectly:
  284. X
  285. X    set GO32=noglob
  286. X
  287. XWith this setting unzip386.exe behaves just like unzip.exe.
  288. X
  289. XFor other problems related to DJGPP, read the documentation provided in
  290. Xoak.oakland.edu:/pub/msdos/djgpp/djdev112.zip.  If a problem occurs with 
  291. Xunzip386.exe, check first if it also occurs with unzip.exe before reporting 
  292. Xit.
  293. X
  294. X
  295. XGRR 940828
  296. END_OF_FILE
  297.   if test 4906 -ne `wc -c <'unzip-5.12/msdos/README'`; then
  298.     echo shar: \"'unzip-5.12/msdos/README'\" unpacked with wrong size!
  299.   fi
  300.   # end of 'unzip-5.12/msdos/README'
  301. fi
  302. if test ! -d 'unzip-5.12/nt' ; then
  303.     echo shar: Creating directory \"'unzip-5.12/nt'\"
  304.     mkdir 'unzip-5.12/nt'
  305. fi
  306. if test ! -d 'unzip-5.12/os2' ; then
  307.     echo shar: Creating directory \"'unzip-5.12/os2'\"
  308.     mkdir 'unzip-5.12/os2'
  309. fi
  310. if test ! -d 'unzip-5.12/tops20' ; then
  311.     echo shar: Creating directory \"'unzip-5.12/tops20'\"
  312.     mkdir 'unzip-5.12/tops20'
  313. fi
  314. if test ! -d 'unzip-5.12/unix' ; then
  315.     echo shar: Creating directory \"'unzip-5.12/unix'\"
  316.     mkdir 'unzip-5.12/unix'
  317. fi
  318. if test -f 'unzip-5.12/unzip.h' -a "${1}" != "-c" ; then 
  319.   echo shar: Will not clobber existing file \"'unzip-5.12/unzip.h'\"
  320. else
  321.   echo shar: Extracting \"'unzip-5.12/unzip.h'\" \(59872 characters\)
  322.   sed "s/^X//" >'unzip-5.12/unzip.h' <<'END_OF_FILE'
  323. X/*---------------------------------------------------------------------------
  324. X
  325. X  unzip.h
  326. X
  327. X  This header file is used by all of the UnZip source files.  Its contents
  328. X  are divided into seven more-or-less separate sections:  predefined macros,
  329. X  OS-dependent includes, (mostly) OS-independent defines, typedefs, function 
  330. X  prototypes (or "forward declarations," in the case of non-ANSI compilers),
  331. X  macros, and global-variable declarations.
  332. X
  333. X  ---------------------------------------------------------------------------*/
  334. X
  335. X
  336. X
  337. X#ifndef __unzip_h   /* prevent multiple inclusions */
  338. X#define __unzip_h
  339. X
  340. X/*****************************************/
  341. X/*  Predefined, Machine-specific Macros  */
  342. X/*****************************************/
  343. X
  344. X#if defined(__GO32__) && defined(unix)   /* MS-DOS extender:  NOT Unix */
  345. X#  undef unix
  346. X#endif
  347. X#if (defined(__convex__) && !defined(__convexc__))
  348. X#  define __convexc__
  349. X#endif
  350. X
  351. X#if defined(unix) || defined(M_XENIX) || defined(COHERENT) || defined(__hpux)
  352. X#  ifndef UNIX
  353. X#    define UNIX
  354. X#  endif
  355. X#endif /* unix || M_XENIX || COHERENT || __hpux */
  356. X#if defined(__convexc__) || defined(MINIX)
  357. X#  ifndef UNIX
  358. X#    define UNIX
  359. X#  endif
  360. X#endif /* __convexc__ || MINIX */
  361. X
  362. X#ifdef __COMPILER_KCC__
  363. X#  include <c-env.h>
  364. X#  ifdef SYS_T20
  365. X#    define TOPS20
  366. X#  endif
  367. X#endif /* __COMPILER_KCC__ */
  368. X
  369. X/* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */
  370. X#ifdef __POWERC
  371. X#  define __TURBOC__
  372. X#  define MSDOS
  373. X#endif /* __POWERC */
  374. X#if defined(__MSDOS__) && (!defined(MSDOS))   /* just to make sure */
  375. X#  define MSDOS
  376. X#endif
  377. X
  378. X#if defined(linux) && (!defined(LINUX))
  379. X#  define LINUX
  380. X#endif
  381. X
  382. X/* use prototypes and ANSI libraries if __STDC__, or Microsoft or Borland C, or
  383. X * Silicon Graphics, or Convex?, or IBM C Set/2, or GNU gcc/emx, or Watcom C,
  384. X * or Macintosh, or Windows NT, or Sequent, or Atari.
  385. X */
  386. X#if defined(__STDC__) || defined(MSDOS) || defined(sgi)
  387. X#  ifndef PROTO
  388. X#    define PROTO
  389. X#  endif
  390. X#  define MODERN
  391. X#endif
  392. X#if defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__)
  393. X#  ifndef PROTO
  394. X#    define PROTO
  395. X#  endif
  396. X#  define MODERN
  397. X#endif
  398. X#if defined(THINK_C) || defined(MPW) || defined(WIN32) || defined(_SEQUENT_)
  399. X#  ifndef PTX   /* Sequent running Dynix/ptx:  non-modern compiler */
  400. X#    ifndef PROTO
  401. X#      define PROTO
  402. X#    endif
  403. X#    define MODERN
  404. X#  endif
  405. X#endif
  406. X#if defined(ATARI_ST) || defined(__BORLANDC__)  /* || defined(__convexc__) */
  407. X#  ifndef PROTO
  408. X#    define PROTO
  409. X#  endif
  410. X#  define MODERN
  411. X#endif
  412. X
  413. X/* turn off prototypes if requested */
  414. X#if defined(NOPROTO) && defined(PROTO)
  415. X#  undef PROTO
  416. X#endif
  417. X
  418. X/* used to remove arguments in function prototypes for non-ANSI C */
  419. X#ifdef PROTO
  420. X#  define OF(a) a
  421. X#else
  422. X#  define OF(a) ()
  423. X#endif
  424. X
  425. X/* bad or (occasionally?) missing stddef.h: */
  426. X#if defined(M_XENIX) || defined(DNIX)
  427. X#  define NO_STDDEF_H
  428. X#endif
  429. X
  430. X#if defined(apollo)          /* defines __STDC__ */
  431. X#    define NO_STDLIB_H
  432. X#endif /* apollo */
  433. X
  434. X#ifdef DNIX
  435. X#  define SYSV
  436. X#  define SHORT_NAMES         /* 14-char limitation on path components */
  437. X/* #  define FILENAME_MAX  14 */
  438. X#  define FILENAME_MAX  NAME_MAX    /* GRR:  experiment */
  439. X#endif
  440. X
  441. X#if (defined(__SYSTEM_FIVE) || defined(M_SYSV) || defined(M_SYS5))
  442. X#  ifndef SYSV
  443. X#    define SYSV
  444. X#  endif
  445. X#endif /* __SYSTEM_FIVE || M_SYSV || M_SYS5 */
  446. X
  447. X#if (defined(ultrix) || defined(bsd4_2) || defined(sun) || defined(pyr))
  448. X#  if (!defined(BSD) && !defined(SYSV))
  449. X#    define BSD
  450. X#  endif
  451. X#endif /* ultrix || bsd4_2 || sun || pyr */
  452. X#if defined(__convexc__)
  453. X#  if (!defined(BSD) && !defined(SYSV))
  454. X#    define BSD
  455. X#  endif
  456. X#endif /* __convexc__ */
  457. X
  458. X#ifdef pyr  /* Pyramid */
  459. X#  ifdef BSD
  460. X#    define pyr_bsd
  461. X#    define USE_STRINGS_H    /* instead of more common string.h */
  462. X#  endif
  463. X#  define ZMEM            /* should ZMEM only be for BSD universe...? */
  464. X#  define DECLARE_ERRNO   /*  (AT&T memcpy was claimed to be very slow) */
  465. X#endif /* pyr */
  466. X
  467. X#if (defined(CRAY) && defined(ZMEM))
  468. X#  undef ZMEM
  469. X#endif
  470. X
  471. X/* stat() bug for Borland, Watcom, VAX C (also GNU?), and Atari ST MiNT on
  472. X * TOS filesystems:  returns 0 for wildcards!  (returns 0xffffffff on Minix
  473. X * filesystem or U: drive under Atari MiNT) */
  474. X#if (defined(__TURBOC__) || defined(__WATCOMC__) || defined(VMS))
  475. X#  define WILD_STAT_BUG
  476. X#endif
  477. X#if (defined(__MINT__))
  478. X#  define WILD_STAT_BUG
  479. X#endif
  480. X
  481. X#ifdef WILD_STAT_BUG
  482. X#  define SSTAT(path,pbuf) (iswild(path) || stat(path,pbuf))
  483. X#else
  484. X#  define SSTAT stat
  485. X#endif
  486. X
  487. X#ifdef REGULUS  /* returns the inode number on success(!)...argh argh argh */
  488. X#  define stat(p,s) zstat(p,s)
  489. X#endif
  490. X
  491. X#define STRNICMP zstrnicmp
  492. X
  493. X
  494. X
  495. X
  496. X
  497. X
  498. X/***************************/
  499. X/*  OS-Dependent Includes  */
  500. X/***************************/
  501. X
  502. X#ifndef MINIX            /* Minix needs it after all the other includes (?) */
  503. X#  include <stdio.h>
  504. X#endif
  505. X#include <ctype.h>       /* skip for VMS, to use tolower() function? */
  506. X#include <errno.h>       /* used in mapname() */
  507. X#ifdef USE_STRINGS_H
  508. X#  include <strings.h>   /* strcpy, strcmp, memcpy, index/rindex, etc. */
  509. X#else
  510. X#  include <string.h>    /* strcpy, strcmp, memcpy, strchr/strrchr, etc. */
  511. X#endif
  512. X#ifdef MODERN
  513. X#  include <limits.h>    /* GRR:  EXPERIMENTAL!  (can be deleted) */
  514. X#endif
  515. X
  516. X#ifdef EFT
  517. X#  define LONGINT off_t  /* Amdahl UTS nonsense ("extended file types") */
  518. X#else
  519. X#  define LONGINT long
  520. X#endif
  521. X
  522. X#ifdef MODERN
  523. X#  ifndef NO_STDDEF_H
  524. X#    include <stddef.h>
  525. X#  endif
  526. X#  ifndef NO_STDLIB_H
  527. X#    include <stdlib.h>    /* standard library prototypes, malloc(), etc. */
  528. X#  endif
  529. X   typedef size_t extent;
  530. X   typedef void voidp;
  531. X#else /* !MODERN */
  532. X   LONGINT lseek();
  533. X#  ifdef VAXC              /* not fully modern, but does have stdlib.h */
  534. X#    include <stdlib.h>
  535. X#  else
  536. X     char *malloc();
  537. X#  endif
  538. X   typedef unsigned int extent;
  539. X   typedef char voidp;
  540. X#  define void int
  541. X#endif /* ?MODERN */
  542. X
  543. X/* this include must be down here for SysV.4, for some reason... */
  544. X#include <signal.h>      /* used in unzip.c, file_io.c */
  545. X
  546. X/*---------------------------------------------------------------------------
  547. X    Amiga section:
  548. X  ---------------------------------------------------------------------------*/
  549. X
  550. X#ifdef AMIGA
  551. X#  include "amiga/amiga.h"
  552. X#  ifndef AZTEC_C
  553. X#    include <sys/types.h>      /* off_t, time_t, dev_t, ... */
  554. X#    include <sys/stat.h>
  555. X#  endif
  556. X#  include <fcntl.h>            /* O_BINARY for open() w/o CR/LF translation */
  557. X#  define DATE_FORMAT   DF_MDY
  558. X#  define lenEOL        1
  559. X#  define PutNativeEOL  *q++ = native(LF);
  560. X/* #  define USE_FWRITE   if write() returns 16-bit int */
  561. X#  define PIPE_ERROR (errno == 9999)    /* always false */
  562. X#endif
  563. X
  564. X/*---------------------------------------------------------------------------
  565. X    Atari ST section:
  566. X  ---------------------------------------------------------------------------*/
  567. X
  568. X#if (defined(ATARI_ST) || defined(__MINT__))    /* comments by [cjh] */
  569. X#  ifdef __TURBOC__
  570. X#    include <ext.h>   /* stat() */
  571. X#    include <tos.h>   /* OS-specific functions (Fdup) */
  572. X#  endif
  573. X#  include <time.h>
  574. X#  ifndef __MINT__
  575. X#    define dup     Fdup
  576. X#    define mkdir   Dcreate
  577. X#    define DIR_END '\\'
  578. X#  else
  579. X#    include <sys/types.h>     /* didn't we include this already? */
  580. X#    include <sys/stat.h>
  581. X#    include <fcntl.h>         /* O_BINARY */
  582. X#    include <unistd.h>        /* dup proto & unix system calls live here */
  583. X#    include <time.h>
  584. X#    include <stdio.h>         /* didn't we include this already? */
  585. X#    define dup dup
  586. X#    define mkdir mkdir
  587. X#    define DIR_END '/'        /* much sexier than DOS filenames... */
  588. X#    define timezone _timezone /* oops */
  589. X#    define DIRENT
  590. X#    define SYMLINKS
  591. X#    ifdef S_ISLNK             /* WARNING:  horrible kludge!!!! */
  592. X#      undef S_ISLNK           /* MiNTlibs & POSIX don't define S_ISLNK */
  593. X#      define S_ISLNK(a) (((a) & 0xa000) == 0xa000)
  594. X#    endif
  595. X#    ifdef SHORT_NAMES         /* library will truncate weird names on TOS fs */
  596. X#      undef SHORT_NAMES
  597. X#    endif
  598. X#    ifndef ZMEM
  599. X#      define ZMEM             /* we have bcopy, etc., ifndef __STRICT_ANSI__ */
  600. X#    endif
  601. X#  endif /* __MINT__ */
  602. X#  ifndef S_IFMT
  603. X#    define S_IFMT     (S_IFCHR | S_IFREG | S_IFDIR)
  604. X#  endif
  605. X#  define DATE_FORMAT  DF_MDY
  606. X#  ifndef lenEOL
  607. X#    define lenEOL 2           /* DOS convention; MiNT doesn't really care */
  608. X#  endif
  609. X#  ifndef PutNativeEOL
  610. X#    define PutNativeEOL  {*q++ = native(CR); *q++ = native(LF);}
  611. X#  endif
  612. X#  define EXE_EXTENSION  ".tos"  /* or .ttp instead?? */
  613. X#endif
  614. X
  615. X/*---------------------------------------------------------------------------
  616. X    Human68k/X68000 section:
  617. X  ---------------------------------------------------------------------------*/
  618. X
  619. X#ifdef __human68k__    /* DO NOT DEFINE DOS_OS2 HERE!  If Human68k is so much */
  620. X#  include <time.h>    /*  like MS-DOS and/or OS/2, create DOS_HUM_OS2 macro. */
  621. X#  include <fcntl.h>
  622. X#  include <io.h>
  623. X#  include <conio.h>
  624. X#  include <jctype.h>
  625. X#  include <sys/stat.h>
  626. X#  define DATE_FORMAT  DF_YMD    /* Japanese standard */
  627. X      /* GRR:  these EOL macros are guesses */
  628. X#  define lenEOL        2
  629. X#  define PutNativeEOL  {*q++ = native(CR); *q++ = native(LF);}
  630. X#  define EXE_EXTENSION ".exe"   /* just a guess... */
  631. X#endif
  632. X
  633. X/*---------------------------------------------------------------------------
  634. X    Mac section:
  635. X  ---------------------------------------------------------------------------*/
  636. X
  637. X#ifdef THINK_C
  638. X#  define MACOS
  639. X#  ifndef __STDC__            /* if Think C hasn't defined __STDC__ ... */
  640. X#    define __STDC__ 1        /*   make sure it's defined: it needs it */
  641. X#  else
  642. X#    if !__STDC__             /* sometimes __STDC__ is defined as 0; */
  643. X#      undef __STDC__         /*   it needs to be 1 or required header */
  644. X#      define __STDC__ 1      /*   files are not properly included. */
  645. X#    endif /* !__STDC__ */
  646. X#  endif
  647. X#  define CREATOR  'KAHL'
  648. X#  define MAIN     unzip
  649. X#endif /* THINK_C */
  650. X
  651. X#ifdef MPW
  652. X#  define MACOS
  653. X#  include <Errors.h>
  654. X#  include <Files.h>
  655. X#  include <Memory.h>
  656. X#  include <Quickdraw.h>
  657. X#  include <ToolUtils.h>
  658. X#  ifdef fileno
  659. X#    undef fileno
  660. X#  endif
  661. X#  ifdef MCH_MACINTOSH
  662. X#    define CREATOR     'Manx'
  663. X#  else
  664. X#    define CREATOR     'MPS '
  665. X#  endif
  666. X#endif /* MPW */
  667. X
  668. X#ifdef MACOS
  669. X#  include <fcntl.h>            /* O_BINARY for open() w/o CR/LF translation */
  670. X#  define fileno(x)     ((x) == stdout ? 1 : (short)(x))
  671. X#  define open(x,y)     macopen((x), (y), gnVRefNum, glDirID)
  672. X#  define fopen(x,y)    macfopen((x), (y), gnVRefNum, glDirID)
  673. X#  define close         macclose
  674. X#  define fclose(x)     macclose(fileno((x)))
  675. X#  define read          macread
  676. X#  define write         macwrite
  677. X#  define lseek         maclseek
  678. X#  define creat(x,y)    maccreat((x), gnVRefNum, glDirID, gostCreator, gostType)
  679. X#  define stat(x,y)     macstat((x), (y), gnVRefNum, glDirID)
  680. X#  define dup
  681. X#  ifndef MCH_MACINTOSH
  682. X#    define NO_STRNICMP
  683. X#  endif
  684. X#  define DIR_END ':'
  685. X#  define DATE_FORMAT   DF_MDY
  686. X#  define lenEOL        1
  687. X#  define PutNativeEOL  *q++ = native(CR);
  688. X#  define MALLOC_WORK
  689. X
  690. X#  ifdef THINK_C
  691. X#    define fgets       wfgets
  692. X#    define fflush(f)
  693. X#    define fprintf     wfprintf
  694. X#    define fputs(s,f)  wfprintf((f), "%s", (s))
  695. X#    define printf      wprintf
  696. X#    ifdef putc
  697. X#      undef putc
  698. X#    endif
  699. X#    define putc(c,f)   wfprintf((f), "%c", (c))
  700. X#    define getenv      macgetenv
  701. X#  endif
  702. X
  703. X#  ifndef isascii
  704. X#    define isascii(c)  ((unsigned char)(c) <= 0x3F)
  705. X#  endif
  706. X
  707. X#  include "macstat.h"
  708. X#  include "macdir.h"
  709. X
  710. X#  ifdef CR
  711. X#    undef  CR
  712. X#  endif
  713. X
  714. Xtypedef struct _ZipExtraHdr {
  715. X    unsigned short header;    /*    2 bytes */
  716. X    unsigned short data;      /*    2 bytes */
  717. X} ZIP_EXTRA_HEADER;
  718. X
  719. Xtypedef struct _MacInfoMin {
  720. X    unsigned short header;    /*    2 bytes */
  721. X    unsigned short data;      /*    2 bytes */
  722. X    unsigned long signature;  /*    4 bytes */
  723. X    FInfo finfo;              /*   16 bytes */
  724. X    unsigned long lCrDat;     /*    4 bytes */
  725. X    unsigned long lMdDat;     /*    4 bytes */
  726. X    unsigned long flags ;     /*    4 bytes */
  727. X    unsigned long lDirID;     /*    4 bytes */
  728. X                              /*------------*/
  729. X} MACINFOMIN;                 /* = 40 bytes for size of data */
  730. X
  731. Xtypedef struct _MacInfo {
  732. X    unsigned short header;    /*    2 bytes */
  733. X    unsigned short data;      /*    2 bytes */
  734. X    unsigned long signature;  /*    4 bytes */
  735. X    FInfo finfo;              /*   16 bytes */
  736. X    unsigned long lCrDat;     /*    4 bytes */
  737. X    unsigned long lMdDat;     /*    4 bytes */
  738. X    unsigned long flags ;     /*    4 bytes */
  739. X    unsigned long lDirID;     /*    4 bytes */
  740. X    char rguchVolName[28];    /*   28 bytes */
  741. X                              /*------------*/
  742. X} MACINFO;                    /* = 68 bytes for size of data */
  743. X#endif /* MACOS */
  744. X
  745. X/*---------------------------------------------------------------------------
  746. X    MS-DOS and OS/2 section:
  747. X  ---------------------------------------------------------------------------*/
  748. X
  749. X#ifdef MSDOS
  750. X#  include <dos.h>           /* for REGS macro (TC) or _dos_setftime (MSC) */
  751. X#  ifdef __TURBOC__          /* includes Power C */
  752. X#    include <sys/timeb.h>   /* for structure ftime */
  753. X#    ifndef __BORLANDC__     /* there appears to be a bug (?) in Borland's */
  754. X#      include <mem.h>       /*  MEM.H related to __STDC__ and far poin-   */
  755. X#    endif                   /*  ters. (dpk)  [mem.h included for memcpy]  */
  756. X#  endif
  757. X#endif /* MSDOS */
  758. X
  759. X#ifdef __IBMC__
  760. X#  define S_IFMT 0xF000
  761. X#  define timezone _timezone
  762. X#  define PIPE_ERROR (errno == EERRSET || errno == EOS2ERR)
  763. X#endif
  764. X
  765. X#ifdef __WATCOMC__
  766. X#  define __32BIT__
  767. X#  undef far
  768. X#  define far
  769. X#  undef near
  770. X#  define near
  771. X#  define PIPE_ERROR (errno == -1)
  772. X#endif
  773. X
  774. X#ifdef __EMX__
  775. X#  ifndef __32BIT__
  776. X#    define __32BIT__
  777. X#  endif
  778. X#  define far
  779. X#endif
  780. X
  781. X#ifdef __GO32__              /* note: MS-DOS compiler, not OS/2 */
  782. X#  ifndef __32BIT__
  783. X#    define __32BIT__
  784. X#  endif
  785. X#  include <sys/timeb.h>     /* for structure ftime */
  786. X   int setmode(int, int);    /* not in djgpp's include files */
  787. X#endif
  788. X
  789. X#if defined(_MSC_VER) && (!defined(MSC))
  790. X#  define MSC                /* for old versions, MSC must be set explicitly */
  791. X#endif
  792. X
  793. X#if 0  /* GRR 930907:  MSC 5.1 does declare errno but doesn't define _MSC_VER */
  794. X#ifdef MSC
  795. X#  ifndef _MSC_VER           /* new with 5.1 or 6.0 ... */
  796. X#    define DECLARE_ERRNO    /* not declared in errno.h in 5.0 or earlier? */
  797. X#  endif
  798. X#endif
  799. X#endif /* 0 */
  800. X
  801. X#if defined(MSDOS) || defined(OS2)
  802. X#  include <sys/types.h>      /* off_t, time_t, dev_t, ... */
  803. X#  include <sys/stat.h>
  804. X#  include <io.h>             /* lseek(), open(), setftime(), dup(), creat() */
  805. X#  include <time.h>           /* localtime() */
  806. X#  include <fcntl.h>          /* O_BINARY for open() w/o CR/LF translation */
  807. X#  ifdef __GO32__
  808. X#    define DIR_END '/'
  809. X#  else
  810. X#    define DIR_END '\\'
  811. X#  endif
  812. X#  if (defined(M_I86CM) || defined(M_I86LM))
  813. X#    define MED_MEM
  814. X#  endif
  815. X#  if (defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__))
  816. X#    define MED_MEM
  817. X#  endif
  818. X#  ifndef __32BIT__
  819. X#    ifndef MED_MEM
  820. X#      define SMALL_MEM
  821. X#    endif
  822. X/* #    define USE_FWRITE   write() *can* write up to 65534 bytes after all */
  823. X#  endif
  824. X#  define DATE_FORMAT   dateformat()
  825. X#  define lenEOL        2
  826. X#  define PutNativeEOL  {*q++ = native(CR); *q++ = native(LF);}
  827. X#endif
  828. X
  829. X#ifdef OS2                    /* defined for all OS/2 compilers */
  830. X#  ifdef MSDOS
  831. X#    undef MSDOS
  832. X#  endif
  833. X#  ifdef isupper
  834. X#    undef isupper
  835. X#  endif
  836. X#  ifdef tolower
  837. X#    undef tolower
  838. X#  endif
  839. X#  define isupper(x)   IsUpperNLS((unsigned char)(x))
  840. X#  define tolower(x)   ToLowerNLS((unsigned char)(x))
  841. X#endif
  842. X
  843. X#ifdef MSDOS
  844. X#  define EXE_EXTENSION ".exe"  /* OS/2 has GetLoadPath() function instead */
  845. X#endif
  846. X
  847. X#if defined(MSWIN) && defined(FILE_IO_C)
  848. X#  include "wizunzip.h"
  849. X#endif
  850. X
  851. X/*---------------------------------------------------------------------------
  852. X    MTS section (piggybacks UNIX, I think):
  853. X  ---------------------------------------------------------------------------*/
  854. X
  855. X#ifdef MTS
  856. X#  include <sys/types.h>    /* off_t, time_t, dev_t, ... */
  857. X#  include <sys/stat.h>
  858. X#  include <sys/file.h>     /* MTS uses this instead of fcntl.h */
  859. X#  include <timeb.h>
  860. X#  include <time.h>
  861. X#  include <unix.h>         /* some important non-ANSI routines */
  862. X#  define mkdir(s,n) (-1)   /* no "make directory" capability */
  863. X#  define EBCDIC            /* set EBCDIC conversion on */
  864. X#  define NO_STRNICMP       /* unzip's is as good the one in MTS */
  865. X#  define USE_FWRITE
  866. X#  define close_outfile()  fclose(outfile)   /* can't set time on files */
  867. X#  define umask(n)            /* Don't have umask() on MTS */
  868. X#  define FOPWT         "w"   /* Open file for writing in TEXT mode */
  869. X#  define DATE_FORMAT   DF_MDY
  870. X#  define lenEOL        1
  871. X#  define PutNativeEOL  *q++ = native(LF);
  872. X#endif
  873. X
  874. X/*---------------------------------------------------------------------------
  875. X    NT section:
  876. X  ---------------------------------------------------------------------------*/
  877. X
  878. X#ifdef WIN32  /* NT */
  879. X#  include <sys/types.h>        /* off_t, time_t, dev_t, ... */
  880. X#  include <sys/stat.h>
  881. X#  include <io.h>               /* read(), open(), etc. */
  882. X#  include <time.h>
  883. X#  include <memory.h>
  884. X#  include <direct.h>           /* mkdir() */
  885. X#  include <fcntl.h>
  886. X#  if defined(FILE_IO_C)
  887. X#    include <conio.h>
  888. X#    include <sys\types.h>
  889. X#    include <sys\utime.h>
  890. X#    include <windows.h>
  891. X#  endif
  892. X#  define DATE_FORMAT   DF_MDY
  893. X#  define lenEOL        2
  894. X#  define PutNativeEOL  {*q++ = native(CR); *q++ = native(LF);}
  895. X#  define NT
  896. X#  if (defined(_MSC_VER) && !defined(MSC))
  897. X#    define MSC
  898. X#  endif
  899. X#endif
  900. X
  901. X/*---------------------------------------------------------------------------
  902. X    TOPS-20 section:
  903. X  ---------------------------------------------------------------------------*/
  904. X
  905. X#ifdef TOPS20
  906. X#  include <sys/types.h>        /* off_t, time_t, dev_t, ... */
  907. X#  include <sys/stat.h>
  908. X#  include <sys/param.h>
  909. X#  include <sys/time.h>
  910. X#  include <sys/timeb.h>
  911. X/* #  include <utime.h>            GRR: not used, I suspect... */
  912. X#  include <sys/file.h>
  913. X#  include <timex.h>
  914. X#  include <monsym.h>           /* get amazing monsym() macro */
  915. X   extern int open(), close(), read();
  916. X   extern int stat(), unlink(), jsys(), fcntl();
  917. X   extern long lseek(), dup(), creat();
  918. X#  define strchr    index       /* GRR: necessary? */
  919. X#  define strrchr   rindex
  920. X#  define REALLY_SHORT_SYMS
  921. X#  define NO_MKDIR
  922. X#  define DIR_BEG  '<'
  923. X#  define DIR_END  '>'
  924. X#  define DIR_EXT  ".directory"
  925. X#  define DATE_FORMAT  DF_MDY
  926. X#  define EXE_EXTENSION ".exe"  /* just a guess... */
  927. X#endif /* TOPS20 */
  928. X
  929. X/*---------------------------------------------------------------------------
  930. X    Unix section:
  931. X  ---------------------------------------------------------------------------*/
  932. X
  933. X#ifdef UNIX
  934. X#  include <sys/types.h>       /* off_t, time_t, dev_t, ... */
  935. X#  include <sys/stat.h>
  936. X
  937. X#  ifndef COHERENT
  938. X#    include <fcntl.h>         /* O_BINARY for open() w/o CR/LF translation */
  939. X#  else /* COHERENT */
  940. X#    ifdef _I386
  941. X#      include <fcntl.h>       /* Coherent 4.0.x, Mark Williams C */
  942. X#    else
  943. X#      include <sys/fcntl.h>   /* Coherent 3.10, Mark Williams C */
  944. X#    endif
  945. X#    define SHORT_SYMS
  946. X#    ifndef __COHERENT__       /* Coherent 4.2 has tzset() */
  947. X#      define tzset  settz
  948. X#    endif
  949. X#  endif /* ?COHERENT */
  950. X
  951. X#  ifndef NO_PARAM_H
  952. X#    ifdef NGROUPS_MAX
  953. X#      undef NGROUPS_MAX       /* SCO bug:  defined again in <sys/param.h> */
  954. X#    endif
  955. X#    ifdef BSD
  956. X#      define TEMP_BSD         /* may be defined again in <sys/param.h> */
  957. X#      undef BSD
  958. X#    endif
  959. X#    include <sys/param.h>     /* conflict with <sys/types.h>, some systems? */
  960. X#    ifdef TEMP_BSD
  961. X#      undef TEMP_BSD
  962. X#      ifndef BSD
  963. X#        define BSD
  964. X#      endif
  965. X#    endif
  966. X#  endif /* !NO_PARAM_H */
  967. X
  968. X#  ifdef __osf__
  969. X#    define DIRENT
  970. X#    ifdef BSD
  971. X#      undef BSD
  972. X#    endif
  973. X#  endif /* __osf__ */
  974. X
  975. X#  ifdef BSD
  976. X#    include <sys/time.h>
  977. X#    include <sys/timeb.h>
  978. X#    ifdef _AIX
  979. X#      include <time.h>
  980. X#    endif
  981. X#  else
  982. X#    include <time.h>
  983. X     struct tm *gmtime(), *localtime();
  984. X#  endif
  985. X
  986. X#  if defined(BSD4_4) || defined(LINUX) || (defined(SYSV) && defined(MODERN))
  987. X#    include <unistd.h>        /* this includes utime.h, at least on SGIs */
  988. X#  endif
  989. X
  990. X#  if defined(BSD4_4) || defined(_POSIX_SOURCE) || defined(sgi) || defined(_AIX)
  991. X#    include <utime.h>   /* NeXT, at least, does NOT define utimbuf in here */
  992. X#  else
  993. X     struct utimbuf {
  994. X         time_t actime;        /* new access time */
  995. X         time_t modtime;       /* new modification time */
  996. X     };
  997. X#  endif /* ?(BSD4_4 || _POSIX_SOURCE || sgi || _AIX) */
  998. X
  999. X#  if (defined(V7) || defined(pyr_bsd))
  1000. X#    define strchr   index
  1001. X#    define strrchr  rindex
  1002. X#  endif
  1003. X#  ifdef V7
  1004. X#    define O_RDONLY 0
  1005. X#    define O_WRONLY 1
  1006. X#    define O_RDWR   2
  1007. X#  endif
  1008. X
  1009. X#  ifdef MINIX
  1010. X#    include <stdio.h>
  1011. X#  endif
  1012. X#  define DATE_FORMAT   DF_MDY
  1013. X#  define lenEOL        1
  1014. X#  define PutNativeEOL  *q++ = native(LF);
  1015. X#endif /* UNIX */
  1016. X
  1017. X/*---------------------------------------------------------------------------
  1018. X    VMS section:
  1019. X  ---------------------------------------------------------------------------*/
  1020. X
  1021. X#ifdef VMS
  1022. X#  include <types.h>              /* GRR:  experimenting... */
  1023. X#  include <stat.h>
  1024. X#  include <time.h>               /* the usual non-BSD time functions */
  1025. X#  include <file.h>               /* same things as fcntl.h has */
  1026. X#  include <unixio.h>
  1027. X#  include <rms.h>
  1028. X#  define _MAX_PATH NAM$C_MAXRSS  /* to define FILNAMSIZ below */
  1029. X#  define RETURN    return_VMS    /* VMS interprets return codes incorrectly */
  1030. X#  define DIR_BEG  '['
  1031. X#  define DIR_END  ']'
  1032. X#  define DIR_EXT  ".dir"
  1033. X#  define DATE_FORMAT  DF_MDY
  1034. X#  define lenEOL        1
  1035. X#  define PutNativeEOL  *q++ = native(LF);
  1036. X#endif /* VMS */
  1037. X
  1038. X
  1039. X
  1040. X
  1041. X
  1042. X/*************/
  1043. X/*  Defines  */
  1044. X/*************/
  1045. X
  1046. X#define UNZIP
  1047. X#define UNZIP_VERSION     20   /* compatible with PKUNZIP 2.0 */
  1048. X#define VMS_UNZIP_VERSION 42   /* if OS-needed-to-extract is VMS:  can do */
  1049. X
  1050. X#if defined(MSDOS) || defined(NT) || defined(OS2)
  1051. X#  define DOS_NT_OS2
  1052. X#endif
  1053. X
  1054. X#if defined(MSDOS) || defined(OS2)
  1055. X#  define DOS_OS2
  1056. X#endif
  1057. X
  1058. X#if defined(MSDOS) || defined(OS2) || defined(ATARI_ST)
  1059. X#  define DOS_OS2_TOS
  1060. X#endif
  1061. X
  1062. X#if defined(MSDOS) || defined(ATARI_ST)
  1063. X#  define DOS_TOS
  1064. X#endif
  1065. X
  1066. X#if defined(MSDOS) || defined(TOPS20) || defined(VMS)
  1067. X#  define DOS_T20_VMS
  1068. X#endif
  1069. X
  1070. X#if defined(TOPS20) || defined(VMS)
  1071. X#  define T20_VMS
  1072. X#endif
  1073. X
  1074. X/* clean up with a few defaults */
  1075. X#ifndef DIR_END
  1076. X#  define DIR_END '/'       /* last char before program name (or filename) */
  1077. X#endif
  1078. X#ifndef RETURN
  1079. X#  define RETURN  return    /* only used in main() */
  1080. X#endif
  1081. X#ifndef PRINTF
  1082. X#  define PRINTF  printf
  1083. X#endif
  1084. X#ifndef FPRINTF
  1085. X#  define FPRINTF fprintf
  1086. X#endif
  1087. X#ifndef PUTC
  1088. X#  define PUTC    putc      /* putchar() not used: use PUTC(c,stdout) instead */
  1089. X#endif
  1090. X
  1091. X#define DIR_BLKSIZ  64      /* number of directory entries per block
  1092. X                             *  (should fit in 4096 bytes, usually) */
  1093. X#ifndef WSIZE
  1094. X#  define WSIZE     0x8000  /* window size--must be a power of two, and */
  1095. X#endif                      /*  at least 32K for zip's deflate method */
  1096. X
  1097. X#ifndef INBUFSIZ
  1098. X#  if (defined(MED_MEM) || defined(SMALL_MEM))
  1099. X#    define INBUFSIZ  2048  /* works for MS-DOS small model */
  1100. X#  else
  1101. X#    define INBUFSIZ  8192  /* larger buffers for real OSes */
  1102. X#  endif
  1103. X#endif
  1104. X
  1105. X/* GRR:  NT defines MSDOS?? */
  1106. X#if (!defined(MSDOS) && !defined(__IBMC__)) || defined(NT)
  1107. X#  define near
  1108. X#  define far
  1109. X#endif
  1110. X#if defined(__GO32__) || defined(__EMX__)
  1111. X#  define near
  1112. X#  define far
  1113. X#endif
  1114. X
  1115. X/* Logic for case of small memory, length of EOL > 1:  if OUTBUFSIZ == 2048,
  1116. X * OUTBUFSIZ>>1 == 1024 and OUTBUFSIZ>>7 == 16; therefore rawbuf is 1008 bytes
  1117. X * and transbuf 1040 bytes.  Have room for 32 extra EOL chars; 1008/32 == 31.5
  1118. X * chars/line, smaller than estimated 35-70 characters per line for C source
  1119. X * and normal text.  Hence difference is sufficient for most "average" files.
  1120. X * (Argument scales for larger OUTBUFSIZ.)
  1121. X */
  1122. X#ifdef SMALL_MEM          /* i.e., 16-bit OS's:  MS-DOS, OS/2 1.x, etc. */
  1123. X#  ifndef Far
  1124. X#    define Far far  /* __far only works for MSC 6.00, not 6.0a or Borland */
  1125. X#  endif
  1126. X#  define OUTBUFSIZ INBUFSIZ
  1127. X#  if (lenEOL == 1)
  1128. X#    define RAWBUFSIZ (OUTBUFSIZ>>1)
  1129. X#  else
  1130. X#    define RAWBUFSIZ ((OUTBUFSIZ>>1) - (OUTBUFSIZ>>7))
  1131. X#  endif
  1132. X#  define TRANSBUFSIZ (OUTBUFSIZ-RAWBUFSIZ)
  1133. X#else
  1134. X#  define LoadFarString(x)       x
  1135. X#  define LoadFarStringSmall(x)  x
  1136. X#  define LoadFarStringSmall2(x) x
  1137. X#  ifdef MED_MEM
  1138. X#    define OUTBUFSIZ 0xFF80     /* can't malloc arrays of 0xFFE8 or more */
  1139. X#    define TRANSBUFSIZ 0xFF80
  1140. X#  else
  1141. X#    define OUTBUFSIZ (lenEOL*WSIZE)  /* more efficient text conversion */
  1142. X#    define TRANSBUFSIZ (lenEOL*OUTBUFSIZ)
  1143. X#    define NEW_UNSHRINK
  1144. X#  endif
  1145. X#  define RAWBUFSIZ OUTBUFSIZ
  1146. X#endif /* ?SMALL_MEM */
  1147. X
  1148. X#ifndef Far
  1149. X#  define Far   /* GRR:  should combine this with near/far above */
  1150. X#endif
  1151. X
  1152. X#ifndef MAIN
  1153. X#  define MAIN  main
  1154. X#endif
  1155. X
  1156. X#if (defined(SFX) && !defined(NO_ZIPINFO))
  1157. X#  define NO_ZIPINFO
  1158. X#endif
  1159. X
  1160. X#ifndef O_BINARY
  1161. X#  define O_BINARY  0
  1162. X#endif
  1163. X
  1164. X#ifndef PIPE_ERROR
  1165. X#  define PIPE_ERROR (errno == EPIPE)
  1166. X#endif
  1167. X
  1168. X/* File operations--use "b" for binary if allowed or fixed length 512 on VMS */
  1169. X#ifdef VMS
  1170. X#  define FOPR  "r","ctx=stm"
  1171. X#  define FOPM  "r+","ctx=stm","rfm=fix","mrs=512"
  1172. X#  define FOPW  "w","ctx=stm","rfm=fix","mrs=512"
  1173. X#else /* !VMS */
  1174. X#  if defined(MODERN) || defined(AMIGA)
  1175. X#    define FOPR "rb"
  1176. X#    define FOPM "r+b"
  1177. X#    ifdef TOPS20          /* TOPS-20 MODERN?  You kidding? */
  1178. X#      define FOPW "w8"
  1179. X#    else
  1180. X#      define FOPW "wb"
  1181. X#    endif
  1182. X#  else /* !MODERN */
  1183. X#    define FOPR "r"
  1184. X#    define FOPM "r+"
  1185. X#    define FOPW "w"
  1186. X#  endif /* ?MODERN */
  1187. X#endif /* VMS */
  1188. X
  1189. X/*
  1190. X * If <limits.h> exists on most systems, should include that, since it may
  1191. X * define some or all of the following:  NAME_MAX, PATH_MAX, _POSIX_NAME_MAX,
  1192. X * _POSIX_PATH_MAX.
  1193. X */
  1194. X#ifdef DOS_OS2_TOS
  1195. X#  include <limits.h>
  1196. X#endif
  1197. X
  1198. X#ifndef PATH_MAX
  1199. X#  ifdef MAXPATHLEN
  1200. X#    define PATH_MAX      MAXPATHLEN    /* in <sys/param.h> on some systems */
  1201. X#  else
  1202. X#    ifdef _MAX_PATH
  1203. X#      define PATH_MAX    _MAX_PATH
  1204. X#    else
  1205. X#      if FILENAME_MAX > 255
  1206. X#        define PATH_MAX  FILENAME_MAX  /* used like PATH_MAX on some systems */
  1207. X#      else
  1208. X#        define PATH_MAX  1024
  1209. X#      endif
  1210. X#    endif /* ?_MAX_PATH */
  1211. X#  endif /* ?MAXPATHLEN */
  1212. X#endif /* !PATH_MAX */
  1213. X
  1214. X#define FILNAMSIZ  (PATH_MAX+1)
  1215. X
  1216. X#ifdef SHORT_SYMS                   /* Mark Williams C, ...? */
  1217. X#  define extract_or_test_files     xtr_or_tst_files
  1218. X#  define extract_or_test_member    xtr_or_tst_member
  1219. X#endif
  1220. X
  1221. X#ifdef REALLY_SHORT_SYMS            /* TOPS-20 linker:  first 6 chars */
  1222. X#  define process_cdir_file_hdr     XXpcdfh
  1223. X#  define process_local_file_hdr    XXplfh
  1224. X#  define extract_or_test_files     XXxotf  /* necessary? */
  1225. X#  define extract_or_test_member    XXxotm  /* necessary? */
  1226. X#  define check_for_newer           XXcfn
  1227. X#  define overwrite_all             XXoa
  1228. X#  define process_all_files         XXpaf
  1229. X#  define extra_field               XXef
  1230. X#  define explode_lit8              XXel8
  1231. X#  define explode_lit4              XXel4
  1232. X#  define explode_nolit8            XXnl8
  1233. X#  define explode_nolit4            XXnl4
  1234. X#  define cpdist8                   XXcpdist8
  1235. X#  define inflate_codes             XXic
  1236. X#  define inflate_stored            XXis
  1237. X#  define inflate_fixed             XXif
  1238. X#  define inflate_dynamic           XXid
  1239. X#  define inflate_block             XXib
  1240. X#  define maxcodemax                XXmax
  1241. X#endif
  1242. X
  1243. X#define ZSUFX             ".zip"
  1244. X#define CENTRAL_HDR_SIG   "\113\001\002"   /* the infamous "PK" signature */
  1245. X#define LOCAL_HDR_SIG     "\113\003\004"   /*  bytes, sans "P" (so unzip */
  1246. X#define END_CENTRAL_SIG   "\113\005\006"   /*  executable not mistaken for */
  1247. X#define EXTD_LOCAL_SIG    "\113\007\010"   /*  zipfile itself) */
  1248. X
  1249. X#define SKIP              0    /* choice of activities for do_string() */
  1250. X#define DISPLAY           1
  1251. X#define FILENAME          2
  1252. X#define EXTRA_FIELD       3
  1253. X
  1254. X#define DOES_NOT_EXIST    -1   /* return values for check_for_newer() */
  1255. X#define EXISTS_AND_OLDER  0
  1256. X#define EXISTS_AND_NEWER  1
  1257. X
  1258. X#define ROOT              0    /* checkdir() extract-to path:  called once */
  1259. X#define INIT              1    /* allocate buildpath:  called once per member */
  1260. X#define APPEND_DIR        2    /* append a dir comp.:  many times per member */
  1261. X#define APPEND_NAME       3    /* append actual filename:  once per member */
  1262. X#define GETPATH           4    /* retrieve the complete path and free it */
  1263. X#define END               5    /* free root path prior to exiting program */
  1264. X
  1265. X/* version_made_by codes (central dir):  make sure these */
  1266. X/*  are not defined on their respective systems!! */
  1267. X#define FS_FAT_           0    /* filesystem used by MS-DOS, OS/2, NT */
  1268. X#define AMIGA_            1
  1269. X#define VMS_              2
  1270. X#define UNIX_             3
  1271. X#define VM_CMS_           4
  1272. X#define ATARI_            5    /* what if it's a minix filesystem? [cjh] */
  1273. X#define FS_HPFS_          6    /* filesystem used by OS/2, NT */
  1274. X#define MAC_              7
  1275. X#define Z_SYSTEM_         8
  1276. X#define CPM_              9
  1277. X#define TOPS20_           10
  1278. X#define FS_NTFS_          11   /* filesystem used by Windows NT */
  1279. X#define QDOS_MAYBE_       12   /* a bit premature, but somebody once started */
  1280. X#define ACORN_            13   /* Archimedes Acorn RISCOS */
  1281. X#define NUM_HOSTS         14   /* index of last system + 1 */
  1282. X
  1283. X#define STORED            0    /* compression methods */
  1284. X#define SHRUNK            1
  1285. X#define REDUCED1          2
  1286. X#define REDUCED2          3
  1287. X#define REDUCED3          4
  1288. X#define REDUCED4          5
  1289. X#define IMPLODED          6
  1290. X#define TOKENIZED         7
  1291. X#define DEFLATED          8
  1292. X#define NUM_METHODS       9    /* index of last method + 1 */
  1293. X/* don't forget to update list_files() appropriately if NUM_METHODS changes */
  1294. X
  1295. X#define PK_OK             0    /* no error */
  1296. X#define PK_COOL           0    /* no error */
  1297. X#define PK_GNARLY         0    /* no error */
  1298. X#define PK_WARN           1    /* warning error */
  1299. X#define PK_ERR            2    /* error in zipfile */
  1300. X#define PK_BADERR         3    /* severe error in zipfile */
  1301. X#define PK_MEM            4    /* insufficient memory */
  1302. X#define PK_MEM2           5    /* insufficient memory */
  1303. X#define PK_MEM3           6    /* insufficient memory */
  1304. X#define PK_MEM4           7    /* insufficient memory */
  1305. X#define PK_MEM5           8    /* insufficient memory */
  1306. X#define PK_NOZIP          9    /* zipfile not found */
  1307. X#define PK_PARAM          10   /* bad or illegal parameters specified */
  1308. X#define PK_FIND           11   /* no files found */
  1309. X#define PK_DISK           50   /* disk full */
  1310. X#define PK_EOF            51   /* unexpected EOF */
  1311. X
  1312. X#define IZ_DIR            76   /* potential zipfile is a directory */
  1313. X#define IZ_CREATED_DIR    77   /* directory created: set time and permissions */
  1314. X#define IZ_VOL_LABEL      78   /* volume label, but can't set on hard disk */
  1315. X
  1316. X#define DF_MDY            0    /* date format 10/26/91 (USA only) */
  1317. X#define DF_DMY            1    /* date format 26/10/91 (most of the world) */
  1318. X#define DF_YMD            2    /* date format 91/10/26 (a few countries) */
  1319. X
  1320. X/*---------------------------------------------------------------------------
  1321. X    True sizes of the various headers, as defined by PKWARE--so it is not
  1322. X    likely that these will ever change.  But if they do, make sure both these
  1323. X    defines AND the typedefs below get updated accordingly.
  1324. X  ---------------------------------------------------------------------------*/
  1325. X#define LREC_SIZE     26    /* lengths of local file headers, central */
  1326. X#define CREC_SIZE     42    /*  directory headers, and the end-of-    */
  1327. X#define ECREC_SIZE    18    /*  central-dir record, respectively      */
  1328. X
  1329. X#define MAX_BITS      13                 /* used in old unshrink() */
  1330. X#define HSIZE         (1 << MAX_BITS)    /* size of global work area */
  1331. X
  1332. X#define LF      10    /* '\n' on ASCII machines; must be 10 due to EBCDIC */
  1333. X#define CR      13    /* '\r' on ASCII machines; must be 13 due to EBCDIC */
  1334. X#define CTRLZ   26    /* DOS & OS/2 EOF marker (used in file_io.c, vms.c) */
  1335. X
  1336. X#ifdef EBCDIC
  1337. X#  define native(c)   ebcdic[(c)]
  1338. X#  define NATIVE      "EBCDIC"
  1339. X#endif
  1340. X
  1341. X#ifdef MPW
  1342. X#  define FFLUSH(f)   PUTC('\n',f)
  1343. X#else
  1344. X#  define FFLUSH      fflush
  1345. X#endif
  1346. X
  1347. X#ifdef ZMEM     /* GRR:  THIS IS AN EXPERIMENT... (seems to work) */
  1348. X#  undef ZMEM
  1349. X#  define memcpy(dest,src,len)   bcopy(src,dest,len)
  1350. X#  define memzero                bzero
  1351. X#else
  1352. X#  define memzero(dest,len)      memset(dest,0,len)
  1353. X#endif
  1354. X
  1355. X#ifdef VMS
  1356. X#  define ENV_UNZIP     "UNZIP_OPTS"      /* name of environment variable */
  1357. X#  define ENV_ZIPINFO   "ZIPINFO_OPTS"
  1358. X#else /* !VMS */
  1359. X#  define ENV_UNZIP     "UNZIP"
  1360. X#  define ENV_ZIPINFO   "ZIPINFO"
  1361. X#endif /* ?VMS */
  1362. X#define ENV_UNZIP2      "UNZIPOPT"        /* alternate name for zip compat. */
  1363. X#define ENV_ZIPINFO2    "ZIPINFOOPT"
  1364. X
  1365. X#if !defined(QQ) && !defined(NOQQ)
  1366. X#  define QQ
  1367. X#endif
  1368. X
  1369. X#ifdef QQ                         /* Newtware version:  no file */
  1370. X#  define QCOND     (!qflag)      /*  comments with -vq or -vqq */
  1371. X#else                             /* Bill Davidsen version:  no way to */
  1372. X#  define QCOND     (which_hdr)   /*  kill file comments when listing */
  1373. X#endif
  1374. X
  1375. X#ifdef OLD_QQ
  1376. X#  define QCOND2    (qflag < 2)
  1377. X#else
  1378. X#  define QCOND2    (!qflag)
  1379. X#endif
  1380. X
  1381. X#ifndef TRUE
  1382. X#  define TRUE      1   /* sort of obvious */
  1383. X#endif
  1384. X#ifndef FALSE
  1385. X#  define FALSE     0
  1386. X#endif
  1387. X
  1388. X#ifndef SEEK_SET
  1389. X#  define SEEK_SET  0
  1390. X#  define SEEK_CUR  1
  1391. X#  define SEEK_END  2
  1392. X#endif
  1393. X
  1394. X#if (defined(UNIX) && defined(S_IFLNK) && !defined(MTS))
  1395. X#  define SYMLINKS
  1396. X#  ifndef S_ISLNK
  1397. X#    define S_ISLNK(m)  (((m) & S_IFMT) == S_IFLNK)
  1398. X#  endif
  1399. X#endif /* UNIX && S_IFLNK && !MTS */
  1400. X
  1401. X#ifndef S_ISDIR
  1402. X#  define S_ISDIR(m)  (((m) & S_IFMT) == S_IFDIR)
  1403. X#endif
  1404. X
  1405. X#ifndef IS_VOLID
  1406. X#  define IS_VOLID(m)  ((m) & 0x08)
  1407. X#endif
  1408. X
  1409. X
  1410. X
  1411. X
  1412. X
  1413. X/**************/
  1414. X/*  Typedefs  */
  1415. X/**************/
  1416. X
  1417. Xtypedef char              boolean;
  1418. Xtypedef unsigned char     uch;  /* code assumes unsigned bytes; these type-  */
  1419. Xtypedef unsigned short    ush;  /*  defs replace byte/UWORD/ULONG (which are */
  1420. Xtypedef unsigned long     ulg;  /*  predefined on some systems) & match zip  */
  1421. X
  1422. Xtypedef struct min_info {
  1423. X    long offset;
  1424. X    ulg compr_size;          /* compressed size (needed if extended header) */
  1425. X    ulg crc;                 /* crc (needed if extended header) */
  1426. X    int hostnum;
  1427. X    unsigned file_attr;      /* local flavor, as used by creat(), chmod()... */
  1428. X    unsigned encrypted : 1;  /* file encrypted: decrypt before uncompressing */
  1429. X    unsigned ExtLocHdr : 1;  /* use time instead of CRC for decrypt check */
  1430. X    unsigned textfile : 1;   /* file is text (according to zip) */
  1431. X    unsigned textmode : 1;   /* file is to be extracted as text */
  1432. X    unsigned lcflag : 1;     /* convert filename to lowercase */
  1433. X    unsigned vollabel : 1;   /* "file" is an MS-DOS volume (disk) label */
  1434. X} min_info;
  1435. X
  1436. Xtypedef struct VMStimbuf {
  1437. X    char *revdate;           /* (both correspond to Unix modtime/st_mtime) */
  1438. X    char *credate;
  1439. X} VMStimbuf;
  1440. X
  1441. X/*---------------------------------------------------------------------------
  1442. X    Zipfile work area declarations.
  1443. X  ---------------------------------------------------------------------------*/
  1444. X
  1445. X#ifdef MALLOC_WORK
  1446. X
  1447. X   union work {
  1448. X     struct {
  1449. X       short *Prefix_of;            /* (8193 * sizeof(short)) */
  1450. X       uch *Suffix_of;
  1451. X       uch *Stack;
  1452. X     } shrink;                      /* unshrink() */
  1453. X     uch *Slide;                    /* explode(), inflate(), unreduce() */
  1454. X   };
  1455. X#  define prefix_of  area.shrink.Prefix_of
  1456. X#  define suffix_of  area.shrink.Suffix_of
  1457. X#  define stack      area.shrink.Stack
  1458. X
  1459. X#else /* !MALLOC_WORK */
  1460. X
  1461. X#  ifdef NEW_UNSHRINK   /* weird segmentation violations if union NODE array */
  1462. X     union work {
  1463. X       uch Stack[8192];             /* unshrink() */
  1464. X       uch Slide[WSIZE];            /* explode(), inflate(), unreduce() */
  1465. X     };
  1466. X#    define stack  area.Stack
  1467. X#  else
  1468. X     union work {
  1469. X       struct {
  1470. X         short Prefix_of[HSIZE];    /* (8192 * sizeof(short)) */
  1471. X         uch Suffix_of[HSIZE];
  1472. X         uch Stack[HSIZE];
  1473. X       } shrink;
  1474. X       uch Slide[WSIZE];            /* explode(), inflate(), unreduce() */
  1475. X     };
  1476. X#    define prefix_of  area.shrink.Prefix_of
  1477. X#    define suffix_of  area.shrink.Suffix_of
  1478. X#    define stack      area.shrink.Stack
  1479. X#  endif /* ?NEW_UNSHRINK */
  1480. X
  1481. X#endif /* ?MALLOC_WORK */
  1482. X
  1483. X#define slide  area.Slide
  1484. X
  1485. X/*---------------------------------------------------------------------------
  1486. X    Zipfile layout declarations.  If these headers ever change, make sure the
  1487. X    xxREC_SIZE defines (above) change with them!
  1488. X  ---------------------------------------------------------------------------*/
  1489. X
  1490. X   typedef uch   local_byte_hdr[ LREC_SIZE ];
  1491. X#      define L_VERSION_NEEDED_TO_EXTRACT_0     0
  1492. X#      define L_VERSION_NEEDED_TO_EXTRACT_1     1
  1493. X#      define L_GENERAL_PURPOSE_BIT_FLAG        2
  1494. X#      define L_COMPRESSION_METHOD              4
  1495. X#      define L_LAST_MOD_FILE_TIME              6
  1496. X#      define L_LAST_MOD_FILE_DATE              8
  1497. X#      define L_CRC32                           10
  1498. X#      define L_COMPRESSED_SIZE                 14
  1499. X#      define L_UNCOMPRESSED_SIZE               18
  1500. X#      define L_FILENAME_LENGTH                 22
  1501. X#      define L_EXTRA_FIELD_LENGTH              24
  1502. X
  1503. X   typedef uch   cdir_byte_hdr[ CREC_SIZE ];
  1504. X#      define C_VERSION_MADE_BY_0               0
  1505. X#      define C_VERSION_MADE_BY_1               1
  1506. X#      define C_VERSION_NEEDED_TO_EXTRACT_0     2
  1507. X#      define C_VERSION_NEEDED_TO_EXTRACT_1     3
  1508. X#      define C_GENERAL_PURPOSE_BIT_FLAG        4
  1509. X#      define C_COMPRESSION_METHOD              6
  1510. X#      define C_LAST_MOD_FILE_TIME              8
  1511. X#      define C_LAST_MOD_FILE_DATE              10
  1512. X#      define C_CRC32                           12
  1513. X#      define C_COMPRESSED_SIZE                 16
  1514. X#      define C_UNCOMPRESSED_SIZE               20
  1515. X#      define C_FILENAME_LENGTH                 24
  1516. X#      define C_EXTRA_FIELD_LENGTH              26
  1517. X#      define C_FILE_COMMENT_LENGTH             28
  1518. X#      define C_DISK_NUMBER_START               30
  1519. X#      define C_INTERNAL_FILE_ATTRIBUTES        32
  1520. X#      define C_EXTERNAL_FILE_ATTRIBUTES        34
  1521. X#      define C_RELATIVE_OFFSET_LOCAL_HEADER    38
  1522. X
  1523. X   typedef uch   ec_byte_rec[ ECREC_SIZE+4 ];
  1524. X/*     define SIGNATURE                         0   space-holder only */
  1525. X#      define NUMBER_THIS_DISK                  4
  1526. X#      define NUM_DISK_WITH_START_CENTRAL_DIR   6
  1527. X#      define NUM_ENTRIES_CENTRL_DIR_THS_DISK   8
  1528. X#      define TOTAL_ENTRIES_CENTRAL_DIR         10
  1529. X#      define SIZE_CENTRAL_DIRECTORY            12
  1530. X#      define OFFSET_START_CENTRAL_DIRECTORY    16
  1531. X#      define ZIPFILE_COMMENT_LENGTH            20
  1532. X
  1533. X
  1534. X   typedef struct local_file_header {                 /* LOCAL */
  1535. X       uch version_needed_to_extract[2];
  1536. X       ush general_purpose_bit_flag;
  1537. X       ush compression_method;
  1538. X       ush last_mod_file_time;
  1539. X       ush last_mod_file_date;
  1540. X       ulg crc32;
  1541. X       ulg csize;
  1542. X       ulg ucsize;
  1543. X       ush filename_length;
  1544. X       ush extra_field_length;
  1545. X   } local_file_hdr;
  1546. X
  1547. X   typedef struct central_directory_file_header {     /* CENTRAL */
  1548. X       uch version_made_by[2];
  1549. X       uch version_needed_to_extract[2];
  1550. X       ush general_purpose_bit_flag;
  1551. X       ush compression_method;
  1552. X       ush last_mod_file_time;
  1553. X       ush last_mod_file_date;
  1554. X       ulg crc32;
  1555. X       ulg csize;
  1556. X       ulg ucsize;
  1557. X       ush filename_length;
  1558. X       ush extra_field_length;
  1559. X       ush file_comment_length;
  1560. X       ush disk_number_start;
  1561. X       ush internal_file_attributes;
  1562. X       ulg external_file_attributes;
  1563. X       ulg relative_offset_local_header;
  1564. X   } cdir_file_hdr;
  1565. X
  1566. X   typedef struct end_central_dir_record {            /* END CENTRAL */
  1567. X       ush number_this_disk;
  1568. X       ush num_disk_with_start_central_dir;
  1569. X       ush num_entries_centrl_dir_ths_disk;
  1570. X       ush total_entries_central_dir;
  1571. X       ulg size_central_directory;
  1572. X       ulg offset_start_central_directory;
  1573. X       ush zipfile_comment_length;
  1574. X   } ecdir_rec;
  1575. X
  1576. X
  1577. X
  1578. X
  1579. X
  1580. X/*************************/
  1581. X/*  Function Prototypes  */
  1582. X/*************************/
  1583. X
  1584. X#ifndef __
  1585. X#  define __   OF
  1586. X#endif
  1587. X
  1588. X/*---------------------------------------------------------------------------
  1589. X    Functions in unzip.c (main initialization/driver routines):
  1590. X  ---------------------------------------------------------------------------*/
  1591. X
  1592. Xint    uz_opts                   __((int *pargc, char ***pargv));
  1593. Xint    usage                     __((int error));
  1594. Xint    process_zipfiles          __((void));
  1595. Xint    do_seekable               __((int lastchance));
  1596. Xint    uz_end_central            __((void));
  1597. Xint    process_cdir_file_hdr     __((void));
  1598. Xint    process_local_file_hdr    __((void));
  1599. X
  1600. X/*---------------------------------------------------------------------------
  1601. X    Functions in zipinfo.c (zipfile-listing routines):
  1602. X  ---------------------------------------------------------------------------*/
  1603. X
  1604. Xint    zi_opts                   __((int *pargc, char ***pargv));
  1605. Xint    zi_end_central            __((void));
  1606. Xint    zipinfo                   __((void));
  1607. X/* static int    zi_long         __((void)); */
  1608. X/* static int    zi_short        __((void)); */
  1609. X/* static char  *zi_time         __((ush *datez, ush *timez)); */
  1610. Xulg    SizeOfEAs                 __((void *extra_field));  /* also in os2.c? */
  1611. Xint    list_files                __((void));
  1612. X/* static int    ratio           __((ulg uc, ulg c)); */
  1613. X
  1614. X/*---------------------------------------------------------------------------
  1615. X    Functions in file_io.c:
  1616. X  ---------------------------------------------------------------------------*/
  1617. X
  1618. Xint      open_input_file    __((void));
  1619. Xint      open_outfile       __((void));                        /* also vms.c */
  1620. Xunsigned readbuf            __((char *buf, register unsigned len));
  1621. Xint      FillBitBuffer      __((void));
  1622. Xint      readbyte           __((void));
  1623. X#ifdef FUNZIP
  1624. X   int   flush              __((ulg size));
  1625. X#else
  1626. X   int   flush              __((uch *buf, ulg size, int unshrink));
  1627. X#endif
  1628. Xvoid     handler            __((int signal));
  1629. Xtime_t   dos_to_unix_time   __((unsigned ddate, unsigned dtime));
  1630. Xint      check_for_newer    __((char *filename));       /* also os2.c, vms.c */
  1631. Xint      find_ecrec         __((long searchlen));
  1632. Xint      get_cdir_ent       __((void));
  1633. Xint      do_string          __((unsigned int len, int option));
  1634. Xush      makeword           __((uch *b));
  1635. Xulg      makelong           __((uch *sig));
  1636. Xint      zstrnicmp __((register char *s1, register char *s2, register int n));
  1637. X
  1638. X#ifdef ZMEM   /* MUST be ifdef'd because of conflicts with the standard def. */
  1639. X   char *memset __((register char *, register char, register unsigned int));
  1640. X   char *memcpy __((register char *, register char *, register unsigned int));
  1641. X#endif
  1642. X
  1643. X#ifdef SMALL_MEM
  1644. X   char *LoadFarString         __((char Far *sz));
  1645. X   char *LoadFarStringSmall    __((char Far *sz));
  1646. X   char *LoadFarStringSmall2   __((char Far *sz));
  1647. X   char Far * Far zfstrcpy     __((char Far *s1, const char Far *s2));
  1648. X#endif
  1649. X
  1650. X
  1651. X/*---------------------------------------------------------------------------
  1652. X    Functions in extract.c:
  1653. X  ---------------------------------------------------------------------------*/
  1654. X
  1655. Xint    extract_or_test_files     __((void));
  1656. X/* static int   store_info               __((void)); */
  1657. X/* static int   extract_or_test_member   __((void)); */
  1658. Xint    memextract                __((uch *, ulg, uch *, ulg));
  1659. Xint    FlushMemory               __((void));
  1660. Xint    ReadMemoryByte            __((ush *x));
  1661. X
  1662. X/*---------------------------------------------------------------------------
  1663. X    Decompression functions:
  1664. X  ---------------------------------------------------------------------------*/
  1665. X
  1666. Xint    explode                   __((void));                    /* explode.c */
  1667. Xint    inflate                   __((void));                    /* inflate.c */
  1668. Xint    inflate_free              __((void));                    /* inflate.c */
  1669. Xvoid   unreduce                  __((void));                   /* unreduce.c */
  1670. X/* static void  LoadFollowers    __((void));                    * unreduce.c */
  1671. Xint    unshrink                  __((void));                   /* unshrink.c */
  1672. X/* static void  partial_clear    __((void));                    * unshrink.c */
  1673. X
  1674. X/*---------------------------------------------------------------------------
  1675. X    Human68K-only functions:
  1676. X  ---------------------------------------------------------------------------*/
  1677. X
  1678. X#ifdef __human68k__
  1679. X   void     InitTwentyOne        __((void));
  1680. X#endif
  1681. X
  1682. X/*---------------------------------------------------------------------------
  1683. X    Macintosh-only functions:
  1684. X  ---------------------------------------------------------------------------*/
  1685. X
  1686. X#ifdef MACOS
  1687. X   int      macmkdir             __((char *, short, long));
  1688. X   short    macopen              __((char *, short, short, long));
  1689. X   FILE    *macfopen             __((char *, char *, short, long));
  1690. X   short    maccreat             __((char *, short, long, OSType, OSType));
  1691. X   short    macread              __((short, char *, unsigned));
  1692. X   long     macwrite             __((short, char *, unsigned));
  1693. X   short    macclose             __((short));
  1694. X   long     maclseek             __((short, long, short));
  1695. X   char    *macgetenv            __((char *));
  1696. X   char    *wfgets               __((char *, int, FILE *));
  1697. X   void     wfprintf             __((FILE *, char *, ...));
  1698. X   void     wprintf              __((char *, ...));
  1699. X#endif
  1700. X
  1701. X/*---------------------------------------------------------------------------
  1702. X    MSDOS-only functions:
  1703. X  ---------------------------------------------------------------------------*/
  1704. X
  1705. X#if (defined(__GO32__) || (defined(MSDOS) && defined(__EMX__)))
  1706. X   unsigned _dos_getcountryinfo(void *);                          /* msdos.c */
  1707. X   void _dos_setftime(int, unsigned short, unsigned short);       /* msdos.c */
  1708. X   void _dos_setfileattr(char *, int);                            /* msdos.c */
  1709. X   unsigned _dos_creat(char *, unsigned, int *);                  /* msdos.c */
  1710. X   void _dos_getdrive(unsigned *);                                /* msdos.c */
  1711. X   unsigned _dos_close(int);                                      /* msdos.c */
  1712. X#endif
  1713. X
  1714. X/*---------------------------------------------------------------------------
  1715. X    OS/2-only functions:
  1716. X  ---------------------------------------------------------------------------*/
  1717. X
  1718. X#ifdef OS2  /* GetFileTime conflicts with something in NT header files */
  1719. X   int   GetCountryInfo   __((void));                               /* os2.c */
  1720. X   long  GetFileTime      __((char *name));                         /* os2.c */
  1721. X   void  SetPathInfo      __((char *path, ush moddate, ush modtime, int flags));
  1722. X   int   IsEA             __((void *extra_field));                  /* os2.c */
  1723. X   void  SetEAs           __((char *path, void *eablock));          /* os2.c */
  1724. X   ulg   SizeOfEAs        __((void *extra_field));                  /* os2.c */
  1725. X/* static int   IsFileNameValid __((char *name));                      os2.c */
  1726. X/* static void  map2fat         __((char *pathcomp, char **pEndFAT));  os2.c */
  1727. X/* static int   SetLongNameEA   __((char *name, char *longname));      os2.c */
  1728. X/* static void  InitNLS         __((void));                            os2.c */
  1729. X   int   IsUpperNLS       __((int nChr));                           /* os2.c */
  1730. X   int   ToLowerNLS       __((int nChr));                           /* os2.c */
  1731. X   void  DebugMalloc      __((void));                               /* os2.c */
  1732. X#endif
  1733. X
  1734. X/*---------------------------------------------------------------------------
  1735. X    TOPS20-only functions:
  1736. X  ---------------------------------------------------------------------------*/
  1737. X
  1738. X#ifdef TOPS20
  1739. X   int upper               __((char *s));                        /* tops20.c */
  1740. X   int enquote             __((char *s));                        /* tops20.c */
  1741. X   int dequote             __((char *s));                        /* tops20.c */
  1742. X   int fnlegal             __(());  /* error if prototyped(?) */ /* tops20.c */
  1743. X#endif
  1744. X
  1745. X/*---------------------------------------------------------------------------
  1746. X    VMS-only functions:
  1747. X  ---------------------------------------------------------------------------*/
  1748. X
  1749. X#ifdef VMS
  1750. X   int    check_format        __((void));                           /* vms.c */
  1751. X   int    find_vms_attrs      __((void));                           /* vms.c */
  1752. X   int    CloseOutputFile     __((void));                           /* vms.c */
  1753. X/* static uch *extract_block  __((struct extra_block *, int *, uch *, int)); */
  1754. X/* static int  _flush_blocks  __((int final_flag));                  * vms.c */
  1755. X/* static int  _flush_records __((int final_flag));                  * vms.c */
  1756. X/* static int  WriteBuffer    __((unsigned char *buf, int len));     * vms.c */
  1757. X/* static int  WriteRecord    __((unsigned char *rec, int len));     * vms.c */
  1758. X/* static void message        __((int string, char *status));        * vms.c */
  1759. X   void   return_VMS          __((int zip_error));                  /* vms.c */
  1760. X#ifdef VMSCLI
  1761. X   ulg    vms_unzip_cmdline   __((int *, char ***));            /* cmdline.c */
  1762. X#endif
  1763. X#endif
  1764. X
  1765. X/*---------------------------------------------------------------------------
  1766. X    Miscellaneous/shared functions:
  1767. X  ---------------------------------------------------------------------------*/
  1768. X
  1769. Xint      match           __((char *s, char *p, int ic));          /* match.c */
  1770. Xint      iswild          __((char *p));                           /* match.c */
  1771. X
  1772. Xvoid     envargs         __((int *, char ***, char *, char *)); /* envargs.c */
  1773. Xvoid     mksargs         __((int *, char ***));                 /* envargs.c */
  1774. X
  1775. Xint      dateformat      __((void));
  1776. Xvoid     version         __((void));                                /* local */
  1777. Xint      mapattr         __((void));                                /* local */
  1778. Xint      mapname         __((int renamed));                         /* local */
  1779. Xint      checkdir        __((char *pathcomp, int flag));            /* local */
  1780. Xchar    *do_wild         __((char *wildzipfn));                     /* local */
  1781. Xchar    *GetLoadPath     __((void));                                /* local */
  1782. X#ifndef MTS /* macro in MTS */
  1783. X   void  close_outfile   __((void));                                /* local */
  1784. X#endif
  1785. X
  1786. X
  1787. X
  1788. X
  1789. X
  1790. X/************/
  1791. X/*  Macros  */
  1792. X/************/
  1793. X
  1794. X#ifndef MAX
  1795. X#  define MAX(a,b)   ((a) > (b) ? (a) : (b))
  1796. X#endif
  1797. X#ifndef MIN
  1798. X#  define MIN(a,b)   ((a) < (b) ? (a) : (b))
  1799. X#endif
  1800. X
  1801. X#ifdef DEBUG
  1802. X#  define Trace(x)   FPRINTF x
  1803. X#else
  1804. X#  define Trace(x)
  1805. X#endif
  1806. X
  1807. X#if defined(UNIX) || defined(T20_VMS)   /* generally old systems */
  1808. X#  define ToLower(x)   ((char)(isupper((int)x)? tolower((int)x) : x))
  1809. X#else
  1810. X#  define ToLower      tolower          /* assumed "smart"; used in match() */
  1811. X#endif
  1812. X
  1813. X
  1814. X#define LSEEK(abs_offset) {LONGINT request=(abs_offset)+extra_bytes,\
  1815. X   inbuf_offset=request%INBUFSIZ, bufstart=request-inbuf_offset;\
  1816. X   if(request<0) {FPRINTF(stderr, LoadFarStringSmall(SeekMsg), LoadFarString(ReportMsg)); return(3);}\
  1817. X   else if(bufstart!=cur_zipfile_bufstart)\
  1818. X   {cur_zipfile_bufstart=lseek(zipfd,(LONGINT)bufstart,SEEK_SET);\
  1819. X   if((incnt=read(zipfd,(char *)inbuf,INBUFSIZ))<=0) return(51);\
  1820. X   inptr=inbuf+(int)inbuf_offset; incnt-=(int)inbuf_offset;} else\
  1821. X   {incnt+=(inptr-inbuf)-(int)inbuf_offset; inptr=inbuf+(int)inbuf_offset;}}
  1822. X
  1823. X/*
  1824. X *  Seek to the block boundary of the block which includes abs_offset,
  1825. X *  then read block into input buffer and set pointers appropriately.
  1826. X *  If block is already in the buffer, just set the pointers.  This macro
  1827. X *  is used by process_end_central_dir (unzip.c) and do_string (file_io.c).
  1828. X *  A slightly modified version is embedded within extract_or_test_files
  1829. X *  (unzip.c).  ReadByte and readbuf (file_io.c) are compatible.
  1830. X *
  1831. X *  macro LSEEK(abs_offset)
  1832. X *      ulg abs_offset;
  1833. X *  {
  1834. X *      LONGINT   request = abs_offset + extra_bytes;
  1835. X *      LONGINT   inbuf_offset = request % INBUFSIZ;
  1836. X *      LONGINT   bufstart = request - inbuf_offset;
  1837. X *
  1838. X *      if (request < 0) {
  1839. X *          FPRINTF(stderr, LoadFarStringSmall(SeekMsg),
  1840. X *            LoadFarString(ReportMsg));
  1841. X *          return(3);             /-* 3:  severe error in zipfile *-/
  1842. X *      } else if (bufstart != cur_zipfile_bufstart) {
  1843. X *          cur_zipfile_bufstart = lseek(zipfd, (LONGINT)bufstart, SEEK_SET);
  1844. X *          if ((incnt = read(zipfd,inbuf,INBUFSIZ)) <= 0)
  1845. X *              return(51);        /-* 51:  unexpected EOF *-/
  1846. X *          inptr = inbuf + (int)inbuf_offset;
  1847. X *          incnt -= (int)inbuf_offset;
  1848. X *      } else {
  1849. X *          incnt += (inptr-inbuf) - (int)inbuf_offset;
  1850. X *          inptr = inbuf + (int)inbuf_offset;
  1851. X *      }
  1852. X *  }
  1853. X *
  1854. X */
  1855. X
  1856. X
  1857. X#define SKIP_(length) if(length&&((error=do_string(length,SKIP))!=0))\
  1858. X  {error_in_archive=error; if(error>1) return error;}
  1859. X
  1860. X/*
  1861. X *  Skip a variable-length field, and report any errors.  Used in zipinfo.c
  1862. X *  and unzip.c in several functions.
  1863. X *
  1864. X *  macro SKIP_(length)
  1865. X *      ush length;
  1866. X *  {
  1867. X *      if (length && ((error = do_string(length, SKIP)) != 0)) {
  1868. X *          error_in_archive = error;   /-* might be warning *-/
  1869. X *          if (error > 1)              /-* fatal *-/
  1870. X *              return (error);
  1871. X *      }
  1872. X *  }
  1873. X *
  1874. X */
  1875. X
  1876. X
  1877. X#ifdef FUNZIP
  1878. X#  define FLUSH    flush
  1879. X#  define NEXTBYTE getc(in)   /* redefined in crypt.h if full version */
  1880. X#else
  1881. X#  define FLUSH(w) if (mem_mode) outcnt=(w); else flush(slide,(ulg)w,0)
  1882. X#  define NEXTBYTE \
  1883. X     (csize-- <= 0L ? EOF : (--incnt >= 0 ? (int)(*inptr++) : readbyte()))
  1884. X#endif
  1885. X
  1886. X
  1887. X#define READBITS(nbits,zdest) {if(nbits>bits_left) {int temp; zipeof=1;\
  1888. X  while (bits_left<=8*(sizeof(bitbuf)-1) && (temp=NEXTBYTE)!=EOF) {\
  1889. X  bitbuf|=(ulg)temp<<bits_left; bits_left+=8; zipeof=0;}}\
  1890. X  zdest=(int)((ush)bitbuf&mask_bits[nbits]);bitbuf>>=nbits;bits_left-=nbits;}
  1891. X
  1892. X/*
  1893. X * macro READBITS(nbits,zdest)    * only used by unreduce and unshrink *
  1894. X *  {
  1895. X *      if (nbits > bits_left) {  * fill bitbuf, which is 8*sizeof(ulg) bits *
  1896. X *          int temp;
  1897. X *
  1898. X *          zipeof = 1;
  1899. X *          while (bits_left <= 8*(sizeof(bitbuf)-1) &&
  1900. X *                 (temp = NEXTBYTE) != EOF) {
  1901. X *              bitbuf |= (ulg)temp << bits_left;
  1902. X *              bits_left += 8;
  1903. X *              zipeof = 0;
  1904. X *          }
  1905. X *      }
  1906. X *      zdest = (int)((ush)bitbuf & mask_bits[nbits]);
  1907. X *      bitbuf >>= nbits;
  1908. X *      bits_left -= nbits;
  1909. X *  }
  1910. X *
  1911. X */
  1912. X
  1913. X
  1914. X/* GRR:  should change name to STRLOWER and use StringLower if possible */
  1915. X
  1916. X/*
  1917. X *  Copy the zero-terminated string in str1 into str2, converting any
  1918. X *  uppercase letters to lowercase as we go.  str2 gets zero-terminated
  1919. X *  as well, of course.  str1 and str2 may be the same character array.
  1920. X */
  1921. X#ifdef __human68k__
  1922. X#  define TOLOWER(str1, str2) \
  1923. X   { \
  1924. X       char *p=(str1), *q=(str2); \
  1925. X       uch c; \
  1926. X       while ((c = *p++) != '\0') { \
  1927. X           if (iskanji(c)) { \
  1928. X               if (*p == '\0') \
  1929. X                   break; \
  1930. X               *q++ = c; \
  1931. X               *q++ = *p++; \
  1932. X           } else \
  1933. X               *q++ = isupper(c) ? tolower(c) : c; \
  1934. X       } \
  1935. X       *q = '\0'; \
  1936. X   }
  1937. X#else
  1938. X#  define TOLOWER(str1, str2) \
  1939. X   { \
  1940. X       char  *p, *q; \
  1941. X       p = (str1) - 1; \
  1942. X       q = (str2); \
  1943. X       while (*++p) \
  1944. X           *q++ = (char)(isupper((int)(*p))? tolower((int)(*p)) : *p); \
  1945. X       *q = '\0'; \
  1946. X   }
  1947. X#endif
  1948. X/*
  1949. X *  NOTES:  This macro makes no assumptions about the characteristics of
  1950. X *    the tolower() function or macro (beyond its existence), nor does it
  1951. X *    make assumptions about the structure of the character set (i.e., it
  1952. X *    should work on EBCDIC machines, too).  The fact that either or both
  1953. X *    of isupper() and tolower() may be macros has been taken into account;
  1954. X *    watch out for "side effects" (in the C sense) when modifying this
  1955. X *    macro.
  1956. X */
  1957. X
  1958. X
  1959. X#ifndef native
  1960. X#  define native(c)   (c)
  1961. X#  define A_TO_N(str1)
  1962. X#else
  1963. X#  ifndef NATIVE
  1964. X#    define NATIVE     "native chars"
  1965. X#  endif
  1966. X#  define A_TO_N(str1) {register unsigned char *p;\
  1967. X     for (p=str1; *p; p++) *p=native(*p);}
  1968. X#endif
  1969. X
  1970. X/*
  1971. X *  Translate the zero-terminated string in str1 from ASCII to the native
  1972. X *  character set. The translation is performed in-place and uses the
  1973. X *  "native" macro to translate each character.
  1974. X *
  1975. X *  macro A_TO_N( str1 )
  1976. X *  {
  1977. X *      register unsigned char *p;
  1978. X *
  1979. X *      for (p = str1;  *p;  ++p)
  1980. X *          *p = native(*p);
  1981. X *  }
  1982. X *
  1983. X *  NOTE:  Using the "native" macro means that is it the only part of unzip
  1984. X *    which knows which translation table (if any) is actually in use to
  1985. X *    produce the native character set.  This makes adding new character set
  1986. X *    translation tables easy, insofar as all that is needed is an appropriate
  1987. X *    "native" macro definition and the translation table itself.  Currently,
  1988. X *    the only non-ASCII native character set implemented is EBCDIC, but this
  1989. X *    may not always be so.
  1990. X */
  1991. X
  1992. X
  1993. X
  1994. X
  1995. X
  1996. X/*************/
  1997. X/*  Globals  */
  1998. X/*************/
  1999. X
  2000. X   extern int       zipinfo_mode;
  2001. X   extern int       aflag;
  2002. X   extern int       cflag;
  2003. X   extern int       C_flag;
  2004. X   extern int       fflag;
  2005. X   extern int       hflag;
  2006. X   extern int       jflag;
  2007. X   extern int       lflag;
  2008. X   extern int       L_flag;
  2009. X   extern int       overwrite_none;
  2010. X   extern int       overwrite_all;
  2011. X   extern int       force_flag;
  2012. X   extern int       qflag;
  2013. X#ifdef DOS_NT_OS2
  2014. X   extern int       sflag;
  2015. X   extern int       volflag;
  2016. X#endif
  2017. X   extern int       tflag;
  2018. X   extern int       T_flag;
  2019. X   extern int       uflag;
  2020. X   extern int       vflag;
  2021. X   extern int       V_flag;
  2022. X#ifdef VMS
  2023. X   extern int       secinf;
  2024. X#endif
  2025. X   extern int       zflag;
  2026. X#ifdef MACOS
  2027. X   extern int       HFSFlag;
  2028. X#endif
  2029. X   extern int       filespecs;
  2030. X   extern int       xfilespecs;
  2031. X   extern int       process_all_files;
  2032. X   extern int       create_dirs;
  2033. X#ifndef NO_ZIPINFO
  2034. X   extern int       newzip;
  2035. X#endif
  2036. X   extern LONGINT   real_ecrec_offset;
  2037. X   extern LONGINT   expect_ecrec_offset;
  2038. X   extern long      csize;
  2039. X   extern long      ucsize;
  2040. X   extern long      used_csize;
  2041. X   extern char      **pfnames;
  2042. X   extern char      **pxnames;
  2043. X   extern char near sig[];
  2044. X   extern char near answerbuf[];
  2045. X   extern min_info  *pInfo;
  2046. X
  2047. X   extern union work area;
  2048. X
  2049. X#ifdef FUNZIP
  2050. X   extern ulg near  crc_32_tab[];
  2051. X#else
  2052. X   extern ulg       *crc_32_tab;
  2053. X#endif
  2054. X   extern ulg       crc32val;
  2055. X   extern ush near  mask_bits[];
  2056. X
  2057. X   extern uch       *inbuf;
  2058. X   extern uch       *inptr;
  2059. X   extern int       incnt;
  2060. X   extern ulg       bitbuf;
  2061. X   extern int       bits_left;
  2062. X   extern boolean   zipeof;
  2063. X   extern char      *zipfn;
  2064. X   extern int       zipfd;
  2065. X   extern LONGINT   ziplen;
  2066. X   extern LONGINT   cur_zipfile_bufstart;
  2067. X   extern LONGINT   extra_bytes;
  2068. X   extern uch       *extra_field;
  2069. X   extern uch       *hold;
  2070. X   extern char near local_hdr_sig[];
  2071. X   extern char near central_hdr_sig[];
  2072. X   extern char near end_central_sig[];
  2073. X   extern local_file_hdr  lrec;
  2074. X   extern cdir_file_hdr   crec;
  2075. X   extern ecdir_rec       ecrec;
  2076. X   extern struct stat     statbuf;
  2077. X
  2078. X   extern int       mem_mode;
  2079. X   extern int       disk_full;
  2080. X   extern int       newfile;
  2081. X#ifdef SYMLINKS
  2082. X   extern int       symlnk;
  2083. X#endif
  2084. X#ifdef FUNZIP
  2085. X   extern FILE      *in;
  2086. X#endif
  2087. X   extern FILE      *outfile;
  2088. X   extern uch       *outbuf;
  2089. X   extern uch       *outbuf2;
  2090. X   extern uch       *outptr;
  2091. X   extern ulg       outcnt;
  2092. X#ifdef MSWIN
  2093. X   extern char      *filename;
  2094. X#else
  2095. X   extern char near filename[];
  2096. X#endif
  2097. X
  2098. X#ifdef DECLARE_ERRNO
  2099. X   extern int       errno;
  2100. X#endif
  2101. X
  2102. X#ifdef EBCDIC
  2103. X   extern uch       ebcdic[];
  2104. X#endif
  2105. X
  2106. X#ifdef MACOS
  2107. X   extern short     gnVRefNum;
  2108. X   extern long      glDirID;
  2109. X   extern OSType    gostCreator;
  2110. X   extern OSType    gostType;
  2111. X   extern boolean   fMacZipped;
  2112. X   extern boolean   macflag;
  2113. X   extern short     giCursor;
  2114. X   extern CursHandle rghCursor[];
  2115. X#endif
  2116. X
  2117. X   extern char Far  CentSigMsg[];
  2118. X   extern char Far  EndSigMsg[];
  2119. X   extern char Far  SeekMsg[];
  2120. X   extern char Far  ReportMsg[];
  2121. X   extern char Far  FilenameNotMatched[];
  2122. X   extern char Far  ExclFilenameNotMatched[];
  2123. X
  2124. X#endif /* !__unzip_h */
  2125. END_OF_FILE
  2126.   if test 59872 -ne `wc -c <'unzip-5.12/unzip.h'`; then
  2127.     echo shar: \"'unzip-5.12/unzip.h'\" unpacked with wrong size!
  2128.   fi
  2129.   # end of 'unzip-5.12/unzip.h'
  2130. fi
  2131. if test ! -d 'unzip-5.12/vms' ; then
  2132.     echo shar: Creating directory \"'unzip-5.12/vms'\"
  2133.     mkdir 'unzip-5.12/vms'
  2134. fi
  2135. echo shar: End of archive 1 \(of 20\).
  2136. cp /dev/null ark1isdone
  2137. MISSING=""
  2138. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
  2139.     if test ! -f ark${I}isdone ; then
  2140.     MISSING="${MISSING} ${I}"
  2141.     fi
  2142. done
  2143. if test "${MISSING}" = "" ; then
  2144.     echo You have unpacked all 20 archives.
  2145.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2146. else
  2147.     echo You still must unpack the following archives:
  2148.     echo "        " ${MISSING}
  2149. fi
  2150. exit 0
  2151. exit 0 # Just in case...
  2152.