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

  1. From: zip-bugs@wkuvx1.wku.edu (Info-ZIP group)
  2. Newsgroups: comp.sources.misc
  3. Subject: v44i079:  unzip - Info-ZIP portable UnZip, version 5.12, Part14/20
  4. Date: 18 Sep 1994 23:16:27 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <35j3ar$qq8@sparky.sterling.com>
  9. X-Md4-Signature: a2bca81071d659ef7dcaa2d245746e08
  10.  
  11. Submitted-by: zip-bugs@wkuvx1.wku.edu (Info-ZIP group)
  12. Posting-number: Volume 44, Issue 79
  13. Archive-name: unzip/part14
  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. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  unzip-5.12/INSTALL unzip-5.12/human68k/human68k.c
  22. #   unzip-5.12/mac/macstat.c unzip-5.12/unix/zipinfo.1
  23. # Wrapped by kent@sparky on Sat Sep 17 23:33:43 1994
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 14 (of 20)."'
  27. if test -f 'unzip-5.12/INSTALL' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'unzip-5.12/INSTALL'\"
  29. else
  30.   echo shar: Extracting \"'unzip-5.12/INSTALL'\" \(20087 characters\)
  31.   sed "s/^X//" >'unzip-5.12/INSTALL' <<'END_OF_FILE'
  32. X__________________________________________________________________________
  33. X
  34. X  This is the Info-ZIP file INSTALL (for UnZip), last updated 23 Aug 94.
  35. X__________________________________________________________________________
  36. X
  37. X  Yes, this is a rather long file, but don't be intimidated:  much of its
  38. X  length is due to coverage of multiple operating systems and of optional
  39. X  customization features, large portions of which may be skipped.  --GRR
  40. X__________________________________________________________________________
  41. X
  42. X
  43. X
  44. XTo compile UnZip, UnZipSFX and/or fUnZip:
  45. X=========================================
  46. X
  47. X(1) Unpack *.c and *.h (the actual source files), preserving the directory
  48. X    structure (e.g., ./unix/unix.c).  The sole exception is TOPS-20, where
  49. X    tops20/* should be unpacked into the current directory, but TOPS-20
  50. X    is no longer fully supported in this version.
  51. X
  52. X    If you wish to compile with decryption enabled, you must get the zcrypt
  53. X    package (see "Where").  Unpack crypt.c and crypt.h from the zcrypt ar-
  54. X    chive, overwriting the dummy versions supplied with UnZip.  If you don't
  55. X    have any sort of unzipper available, you'll have to compile the non-
  56. X    crypt version first and use that to unpack the full crypt sources, then
  57. X    recompile.  (The included zipcloak.c file is for use only with the Zip
  58. X    2.0.x sources, so don't bother unpacking it.)
  59. X
  60. X
  61. X(2) Choose the appropriate makefile based on the description in the Con-
  62. X    tents file for your OS (that is, there's only one for Unix or OS/2, but
  63. X    MS-DOS and several other OSes have several, depending on the compiler).
  64. X    Copy it into the current directory and rename if necessary or desired.
  65. X    (Some makefiles can be invoked in place; see (5) below.)
  66. X
  67. X    Special point of confusion:  some MS-DOS targets are in non-MSDOS
  68. X    makefiles.  In particular, for DOS emx+gcc use the gccdos target of
  69. X    the OS/2 makefile (os2/makefile.os2), and for djgpp use the gcc_dos
  70. X    target of the Unix makefile (unix/Makefile).  In addition, OS/2 users
  71. X    of MSC can cross-compile to MS-DOS with makefile.os2's mscdos target.
  72. X
  73. X
  74. X(3) If you want a non-standard version of UnZip, define one or more of the
  75. X    following optional macros, either by adding them to the LOCAL_UNZIP
  76. X    environment variable or by editing your makefile as appropriate.  The
  77. X    syntax differs from compiler to compiler, but macros are often defined
  78. X    via "-DMACRO_NAME" or similar (for one called MACRO_NAME).  Note that
  79. X    some of these may not be fully supported in future releases (or even
  80. X    in the current release).  Note also that very short command lines in
  81. X    MS-DOS (128 characters) may place severe limits on how many of these
  82. X    can be used; if need be, the definitions can be placed at the top of
  83. X    unzip.h instead (it is included in all source files).
  84. X
  85. X      CHECK_EOF   (recommended!)
  86. X        Corrupt zipfiles and zipfiles stored on damaged media (e.g., bad
  87. X        floppies) may cause UnZip to go into an infinite loop and either
  88. X        fill the disk(!) or, in some cases (notably under MS-DOS), hang the
  89. X        system.  (This only applies to testing or extraction of *damaged*
  90. X        archives, however.)  Defining CHECK_EOF enables special code which
  91. X        corrects the problem on most systems; DEC Ultrix may be one excep-
  92. X        tion.  The only reason this option is not defined by default is that
  93. X        it was introduced too late in the testing process.
  94. X
  95. X      DOSWILD   (MS-DOS only)
  96. X        Treat trailing "*.*" like Unix "*" (i.e., matches anything); treat
  97. X        trailing "*." as match for files without a dot (i.e., matches any-
  98. X        thing, as long as no dots in name).  Special treatment only occurs
  99. X        if patterns are at end of arguments; i.e., "a*.*" matches all files
  100. X        starting with "a", but "*.*c" matches all files ending in "c" *only*
  101. X        if they have a dot somewhere before the "c".  Thus "*.*.*" could be
  102. X        used (albeit awkwardly) to specify all filenames with at least one
  103. X        dot in them, and "*." matches all filenames with no dots in them.
  104. X        [The default method of specifying these would be "*.*" and "* -x *.*",
  105. X        respectively, where the second example makes use of UnZip's exclude-
  106. X        files option.]  All other regular expressions (including "?" and
  107. X        "[range_of_chars]") retain their Unix-like behavior.
  108. X
  109. X      VMSWILD   (VMS only)
  110. X        Use parentheses rather than brackets to delimit sets (ranges), and
  111. X        use '%' instead of '?' as the single-character wildcard for internal
  112. X        filename matching.  (External matching of zipfile names always uses
  113. X        the standard VMS wildcard facilities; character sets are disallowed.)
  114. X
  115. X      VMSCLI   (VMS only)
  116. X        Use VMS-style "slash options" (/FOOBAR) instead of the default Unix-
  117. X        style hyphenated options (-f).  This capability was added quite late
  118. X        in the beta cycle and isn't fully tested, so some features may not
  119. X        work as expected.  Also, it doesn't affect options stored in environ-
  120. X        ment variables (UNZIP_OPTS or ZIPINFO_OPTS); those use the Unix style
  121. X        regardless.
  122. X
  123. X      CHECK_VERSIONS   (VMS only)
  124. X        UnZip "extra fields" are used to store VMS (RMS) filesystem info,
  125. X    and the format of this information may differ in various versions
  126. X    of VMS.  Defining this option will enable UnZip warnings when the
  127. X    stored extra-field VMS version(s) do(es) not match the version of
  128. X    VMS currently being used.  This is a common occurrence in zipfiles 
  129. X    received from other sites, but since the format of the filesystem
  130. X    does not seem to have changed in years (including on Alpha and Open-
  131. X    VMS systems), the warnings are not enabled by default.
  132. X
  133. X      RETURN_SEVERITY   (VMS only)
  134. X        Return a VMS-style value in the range 0x7fff0001 to 0x7fff0332 for
  135. X        warnings or errors, or 1 for successful completion.  See unzip.doc
  136. X        for an explanation of the encoding of the normal UnZip return value.
  137. X        This option was added late in the beta cycle and hasn't been tested
  138. X        much yet, but it will likely become the default in future versions
  139. X        (assuming no collisions with official VMS error codes).
  140. X
  141. X      RETURN_CODES   (VMS only)
  142. X        VMS interprets return codes according to a rigid set of guidelines,
  143. X        which means it misinterprets normal UnZip return codes as all sorts
  144. X        of really nasty errors.  Therefore by default VMS UnZip always returns
  145. X        zero regardless of whether any warnings or errors occurred (but see
  146. X        RETURN_SEVERITY above).  Define RETURN_CODES for a human-readable ex-
  147. X        planation of UnZip's return codes.  Note that this is often annoying.
  148. X
  149. X      ASM_CRC   (Amiga/Aztec C only, for now)
  150. X        Use an assembler routine to calculate the CRC for each file (speed).
  151. X
  152. X      ASM_INFLATECODES   (Amiga/Aztec C only, for now)
  153. X        Use an assembler version of inflate_codes() for speed.
  154. X
  155. X      OLD_EXDIR   (not VMS or TOPS-20)
  156. X        Use old behavior regarding the directory to which to extract:  the
  157. X        argument immediately after the zipfile name is the extraction dir;
  158. X        if the directory doesn't exist, create it if it was specified as
  159. X        "dir/" (i.e., with trailing path separator), else treat it as a
  160. X        stored file; if -d is used, treat the argument as a stored file re-
  161. X        gardless of trailing '/'.  For example:
  162. X            unzip foo bar       if bar is a dir, extract everything into it;
  163. X                                  otherwise extract bar as stored file
  164. X            unzip foo bar/      extract everything into bar, creating if nec.
  165. X            unzip -d foo bar/   treat bar/ as a stored directory and extract it
  166. X
  167. X      SFX_EXDIR
  168. X        Enable the "-d <extract_dir>" option for UnZipSFX.  By default it is
  169. X        disabled so as to generate the smallest possible executable stub, but
  170. X        for use with automated installation scripts and the like it may be
  171. X        useful to enable -d.  Be sure to read unzipsfx.doc for restrictions
  172. X        on the use of this option and of -x; these restrictions should be 
  173. X        lifted in a later release.
  174. X
  175. X      NO_ZIPINFO
  176. X        Compile without zipinfo mode (-Z) enabled; makes a smaller executable
  177. X        because many text strings are left out.  Automatically enabled for
  178. X        some small-model compiles under MS-DOS and OS/2, so ordinarily there
  179. X        is no need to specify this explicitly.  (Note that even with this
  180. X        defined, the resulting executable may still be too big to extract
  181. X        some zipfiles correctly.)
  182. X
  183. X      DEBUG
  184. X        Used for debugging purposes; enables Trace() statements.  Generally
  185. X        it's best to compile only one or two modules this way.
  186. X
  187. X      DEBUG_TIME
  188. X        Used for debugging the timezone code in file_io.c; enables TTrace()
  189. X        statements.  This code is only used for the freshen/update options
  190. X        (-f and -u), and non-Unix compilers often get it wrong.
  191. X
  192. X
  193. X(4) If you regularly compile new versions of UnZip and always want the same
  194. X    non-standard option(s), you may wish to add it (them) to the LOCAL_UNZIP
  195. X    environment variable (assuming it's supported in your makefile).  Under
  196. X    MS-DOS, for example, add this to AUTOEXEC.BAT:
  197. X
  198. X        set LOCAL_UNZIP -DDOSWILD -DOLD_EXDIR
  199. X
  200. X    You can also use the variable to hold special compiler options (e.g.,
  201. X    -FPi87 for Microsoft C, if the x87 libraries are the only ones on your
  202. X    disk and they follow Microsoft's default naming conventions; MSC also
  203. X    supports the CL environment variable, however).
  204. X
  205. X
  206. X(5) Run the make utility on your chosen makefile:
  207. X
  208. X      Unix
  209. X        For most systems it's possible to invoke the makefile in place, at
  210. X        the possible cost of an ignorable warning; do "make -f unix/Makefile
  211. X        list" to get a list of possible system targets, and then "make -f
  212. X        unix/Makefile target" for your chosen target.  The "generic" target
  213. X        works for most systems, but if it fails with a message about ftime()
  214. X        unresolved or timezone redefined, do "make clean", "make help", and
  215. X        then either "make generic2" or "make generic3" as instructed.  If all
  216. X        else fails, read the makefile itself; it contains numerous comments.
  217. X
  218. X      VMS
  219. X        For a one-time build of the default UnZip, simply run the supplied
  220. X        command file MAKE.COM.  To use either DEC C on an Alpha or VAX C on
  221. X        a VAX, type "@make" (after copying make.com into the current direc-
  222. X        tory; otherwise do "@[.vms]make" to invoke it in place).  To use GNU
  223. X        C (gcc) on either platform, do "@make gcc".
  224. X
  225. X        For repeated makes or other hacker-like tinkering with the sources,
  226. X        or to create a custom version of UnZip (especially with VMSCLI), use
  227. X        the included "MMS" makefile, DESCRIP.MMS.  Copy it into the current
  228. X        directory, read the comments at the top of it and run MadGoat's free
  229. X        MMS clone "MMK" on it.  DEC's MMS is no longer supported due to the
  230. X        use of MMK-specific extensions in DESCRIP.MMS.
  231. X
  232. X      MS-DOS
  233. X        See the msdos\Contents file for notes regarding which makefile(s) to
  234. X        use with which compiler.  In summary:  pick one of msdos\makefile.*
  235. X        as appropriate, or (as noted above) use the OS/2 gccdos target for
  236. X        emx+gcc or the Unix gcc_dos target for djgpp.  There is also an
  237. X        mscdos cross-compilation target in os2\makefile.os2, an sco_dos
  238. X        cross-compilation target in unix\Makefile and bcc_dos and msc_dos
  239. X        targets in unix\Makefile as well.  The latter may disappear soon.
  240. X        For Watcom 16-bit or 32-bit versions, see the comments in the OS/2
  241. X        section below.
  242. X
  243. X        After choosing the appropriate makefile and editing as necessary or
  244. X        desired, invoke the corresponding make utility.  Microsoft's NMAKE
  245. X        and the free dmake and GNU make utilities are generally the most
  246. X        versatile.  Unfortunately, all current ports of GNU make 3.71 (djgpp,
  247. X        emx and gnuish flavors) have bugs which prevent their use with the
  248. X        Unix makefile; the older djgpp port of make 3.69 still works and for
  249. X        now is distributed with the MS-DOS executables on the primary Info-
  250. X        ZIP mirror site (see the Where file).  The makefiles in the msdos dir-
  251. X        ectory can be invoked in place (e.g., "nmake -f msdos\makefile.msc"),
  252. X        but the MS-DOS targets in the Unix makefile (gcc_dos, bcc_dos and
  253. X        msc_dos) cannot.
  254. X
  255. X      OS/2
  256. X        Either GNU make, nmake or dmake may be used with the OS/2 makefile;
  257. X        all are freely available on the net.  Do "nmake -f os2\makefile.os2",
  258. X        for example, to get a list of supported targets.  For Watcom C/386 it
  259. X        is necessary to edit makefile.os2 and change the os2$(OBJ) target so
  260. X        it uses backslashes (i.e., "os2/os2.c" -> "os2\os2.c").  For Watcom
  261. X        16-bit OS/2 versions or any Watcom DOS version (cross-compilation),
  262. X        or for Metaware High C++ (OS/2 32-bit), it is necessary to apply the
  263. X        patch in os2\wat_met.dif.  (This patch arrived too late to be fully
  264. X        tested.)
  265. X
  266. X        More generally, read the comments at the top of the makefile for an
  267. X        explanation of the differences between some of the same-compiler tar-
  268. X        gets.
  269. X
  270. X      NT (also applies to Chicago/Windows 4)
  271. X        You will need the Windows NT SDK or Visual C++ for NT, both from
  272. X        Microsoft; or DEC C/C++ for DECpc AXP and NT.  Use the command line
  273. X        to compile.  For the DEC compiler edit out the "cdebug" line in
  274. X        nt\makefile as noted in the comments at the top of the makefile.
  275. X        From the main source directory do "nmake -F nt\makefile".
  276. X
  277. X        If you are using VC++ you will get warnings about CL386 invoking CL,
  278. X        etc.  Don't worry, this is for compatibility with the SDK.  Microsoft
  279. X        should have changed the definition of $(cc) in ntwin32.mak for VC++.
  280. X
  281. X        If you have VC++ 1.5 (16-bit) installed together with VC++ 1.0 (32-
  282. X        bit), make sure that you don't run the 16-bit compiler when you run
  283. X        nmake.
  284. X
  285. X        At least with MSC 8.x (VC++ 1.x), it is possible to make a dual-mode
  286. X        self-extractor (DOS and NT/Chicago).  This is not built by default,
  287. X        but for those who don't care too much about the size, here's how:
  288. X
  289. X            From: Steve Salisbury <stevesa@microsoft.com>
  290. X            Date: Fri, 22 Jul 94 17:18:06 PDT
  291. X
  292. X            Did y'all know that you can build a dual mode (MS-DOS and Win32
  293. X            (NT + Chicago)) unzipsfx.exe by just making a 16-bit unzipsfx.exe
  294. X            and then specifying that as the 16-bit stub for the 32-bit unzip-
  295. X            sfx.exe?  You also have to specify the /Knoweas flag to the 16-bit
  296. X            linker.  I suspect that this won't work with C 6.0 and earlier,
  297. X            maybe not even with MS C/C++ 7.0.  Anyway, I use C 8.0 (a.k.a.
  298. X            Visual C 1.X), which has been shipping for 15+ months now.
  299. X
  300. X            Make a little change to MSDOS\MAKEFILE.MSC to add the /KNOWEAS
  301. X            flag:
  302. X
  303. X                LDFLAGS = /KNOWEAS /nologo/noi/e/st:0x0c00
  304. X
  305. X            rename the output file
  306. X
  307. X                ren UNZIPSFX.EXE UNZIPSFX.E16
  308. X
  309. X            and then make a little change to NT\MAKEFILE to add the -STUB
  310. X            directive:
  311. X
  312. X                .obj.exe:
  313. X                    $(link) $(ldebug) $(conflags) $(conflibs) $** \
  314. X                             -out:$@ -STUB:$*.e16
  315. X
  316. X            This is pretty useful.  It's nice to have dual-mode self-extracting
  317. X            files.
  318. X
  319. X            I do notice that they are pretty huge files (41K for 16-bit 
  320. X            unzipsfx.exe, 69k for the 32-bit version, 110k for the dual).  Oh
  321. X            well.
  322. X
  323. X      AmigaDOS
  324. X        SAS/Lattice C and Manx Aztec C are supported.  For SAS C 6.x do "lmk
  325. X        -f amiga/SMakeFile all"; for Aztec C do "make -f amiga/makefile.azt
  326. X        all".  The Aztec C version supports assembly-language versions of two
  327. X        routines; these are enabled by default.
  328. X
  329. X      Atari TOS
  330. X        Turbo C is no longer supported; use gcc (tested with 2.4.5 and 2.5.8)
  331. X        and the MiNT libraries, and do "make".  Note that all versions of gcc
  332. X        prior to 2.5.8 have a bug affecting 68000-based machines (optimizer
  333. X        adds 68020 instructions).  See atari\README for comments on using
  334. X        other compilers.
  335. X
  336. X      Macintosh
  337. X        Think C is the only currently supported compiler, although the Mac
  338. X        Programmer's Workbench (MPW) was supported at one time and still has
  339. X        hooks in unzip.h.  For Think C, un-BinHex the Think C project file
  340. X        and UnZip resource file (using BinHex 4.0 or later), then click on
  341. X        something or other... :-)  (I'm just making this up, since I haven't
  342. X        the faintest idea how Mac programming works.)
  343. X
  344. X      Human68K
  345. X        [This is a Japanese machine and OS.]  It appears that GNU make and
  346. X        gcc are required; presumably just do "gmake -f human68k/Makefile.gcc"
  347. X        to build everything.
  348. X
  349. X      TOPS-20
  350. X        [No longer fully supported due to new, unported features, although
  351. X        patches always accepted.]  Unpack all files into the current directory
  352. X        only (including those in the zipfile's tops20 directory), then use
  353. X        make.mic and "do make".
  354. X
  355. X    Running the appropriate make utility should produce three executables on
  356. X    most systems, one for UnZip/ZipInfo, one for UnZipSFX, and one for fUnZip.
  357. X    (VMS is one prominent exception:  fUnZip makes no sense on it.)  Read any
  358. X    OS-specific README files for notes on setting things up for normal use
  359. X    (especially for VMS) and for warnings about known quirks and bugs in var-
  360. X    ious compilers (especially for MS-DOS).
  361. X
  362. X    Also note that many OSes require a timezone variable to be set correctly
  363. X    (often "TZ"); Unix and VMS generally do so by default, but PC-based OSes
  364. X    generally do not.  See the discussion of the -f and -u options in the
  365. X    unzip man page (or unzip.doc).
  366. X
  367. X    Then test your new UnZip on a few archives and let us know if there are
  368. X    problems (but *please* first make certain that the archives aren't actu-
  369. X    ally corrupted and that you didn't make one of the silly mistakes dis-
  370. X    cussed in the documentation).  If possible, test with PKUNZIP or with a
  371. X    previous version of UnZip, if you have one.
  372. X
  373. X
  374. X
  375. XTo install:
  376. X===========
  377. X
  378. XUnix
  379. X  The default prefix for the installation location is /usr/local (things
  380. X  go into the bin and man/man1 subdirectories beneath the prefix), and
  381. X  the default man-page extension is "1" (corresponding to man/man1, above).
  382. X  To install as per the defaults, do "make install"; otherwise do "make
  383. X  prefix=/your/path manext=your_extension install".  For example, to install
  384. X  in your home directory with "l" as the man-page extension (for "local"),
  385. X  do "make prefix=$HOME manext=l install".  Permissions will be 755 for the
  386. X  executables and 644 for the man pages.  In general root must perform in-
  387. X  stallation into a public directory.  Do "rehash" if your shell requires
  388. X  it in order to find the new executables.
  389. X
  390. XVMS
  391. X  Install UnZip as foreign symbol by adding this to login.com:
  392. X
  393. X       $ unzip == "$disk:[dir]unzip.exe"
  394. X       $ zipinfo == "$disk:[dir]unzip.exe ""-Z"""
  395. X
  396. X  where "disk" and "dir" are the location of the UnZip executable; the "$"
  397. X  before the disk name is important, as are the double-double-quotes around
  398. X  the -Z.  Some people, including the author, prefer a short alias such as
  399. X  "ii" instead of "zipinfo"; edit to taste.  Optionally also install unzipsfx
  400. X  for use with the MAKESFX.COM command file.  See vms/README (or [.VMS]README.)
  401. X  for details on this and for notes/warnings about zipfiles and UnZip under
  402. X  VMS.
  403. X
  404. XOS/2, MS-DOS, NT, Atari, Amiga
  405. X  Move or copy unzip.exe (or unzip.ttp, or UnZip, or whatever) to a direc-
  406. X  tory in your path; also possibly copy the UnZip executable to zipinfo.exe
  407. X  (or ii.exe), or else create an alias or a batch or command file for zipinfo
  408. X  ("@unzip -Z %1 %2 %3 %4 %5 %6 %7 %8 %9" under MS-DOS).  The latter is only
  409. X  relevant if NO_ZIPINFO was not defined, obviously...
  410. X
  411. XMacintosh, Human68K, TOPS-20
  412. X  Dunno...
  413. END_OF_FILE
  414.   if test 20087 -ne `wc -c <'unzip-5.12/INSTALL'`; then
  415.     echo shar: \"'unzip-5.12/INSTALL'\" unpacked with wrong size!
  416.   fi
  417.   # end of 'unzip-5.12/INSTALL'
  418. fi
  419. if test -f 'unzip-5.12/human68k/human68k.c' -a "${1}" != "-c" ; then 
  420.   echo shar: Will not clobber existing file \"'unzip-5.12/human68k/human68k.c'\"
  421. else
  422.   echo shar: Extracting \"'unzip-5.12/human68k/human68k.c'\" \(20529 characters\)
  423.   sed "s/^X//" >'unzip-5.12/human68k/human68k.c' <<'END_OF_FILE'
  424. X/*---------------------------------------------------------------------------
  425. X
  426. X  human68k.c
  427. X
  428. X  Human68K-specific routines for use with Info-ZIP's UnZip 5.1 and later.
  429. X
  430. X  Contains:  do_wild()
  431. X             mapattr()
  432. X             mapname()
  433. X             checkdir()
  434. X             close_outfile()
  435. X             version()
  436. X             TwentyOne()
  437. X             normalize_name()
  438. X
  439. X  ---------------------------------------------------------------------------*/
  440. X
  441. X
  442. X#include <dirent.h>
  443. X#include <sys/dos.h>
  444. X#include <sys/xunistd.h>
  445. X#include <jstring.h>
  446. X#include "unzip.h"
  447. X
  448. X
  449. Xstatic void normalize_name(char *);
  450. X
  451. Xstatic int created_dir;        /* used in mapname(), checkdir() */
  452. Xstatic int renamed_fullpath;   /* ditto */
  453. X
  454. X/**********************/
  455. X/* Function do_wild() */
  456. X/**********************/
  457. X
  458. Xchar *do_wild(wildspec)
  459. X    char *wildspec;         /* only used first time on a given dir */
  460. X{
  461. X    static DIR *dir = NULL;
  462. X    static char *dirname, *wildname, matchname[FILNAMSIZ];
  463. X    static int firstcall=TRUE, have_dirname, dirnamelen;
  464. X    struct dirent *file;
  465. X
  466. X
  467. X    /* Even when we're just returning wildspec, we *always* do so in
  468. X     * matchname[]--calling routine is allowed to append four characters
  469. X     * to the returned string, and wildspec may be a pointer to argv[].
  470. X     */
  471. X    if (firstcall) {        /* first call:  must initialize everything */
  472. X        firstcall = FALSE;
  473. X
  474. X        /* break the wildspec into a directory part and a wildcard filename */
  475. X        if ((wildname = strrchr(wildspec, '/')) == NULL) {
  476. X            dirname = ".";
  477. X            dirnamelen = 1;
  478. X            have_dirname = FALSE;
  479. X            wildname = wildspec;
  480. X        } else {
  481. X            ++wildname;     /* point at character after '/' */
  482. X            dirnamelen = wildname - wildspec;
  483. X            if ((dirname = (char *)malloc(dirnamelen+1)) == NULL) {
  484. X                fprintf(stderr, "warning:  can't allocate wildcard buffers\n");
  485. X                strcpy(matchname, wildspec);
  486. X                return matchname;   /* but maybe filespec was not a wildcard */
  487. X            }
  488. X            strncpy(dirname, wildspec, dirnamelen);
  489. X            dirname[dirnamelen] = '\0';   /* terminate for strcpy below */
  490. X            have_dirname = TRUE;
  491. X        }
  492. X
  493. X        if ((dir = opendir(dirname)) != NULL) {
  494. X            while ((file = readdir(dir)) != NULL) {
  495. X                if (file->d_name[0] == '.' && wildname[0] != '.')
  496. X                    continue;  /* Unix:  '*' and '?' do not match leading dot */
  497. X                if (match(file->d_name, wildname, 0)) {  /* 0 == case sens. */
  498. X                    if (have_dirname) {
  499. X                        strcpy(matchname, dirname);
  500. X                        strcpy(matchname+dirnamelen, file->d_name);
  501. X                    } else
  502. X                        strcpy(matchname, file->d_name);
  503. X                    return matchname;
  504. X                }
  505. X            }
  506. X            /* if we get to here directory is exhausted, so close it */
  507. X            closedir(dir);
  508. X            dir = NULL;
  509. X        }
  510. X
  511. X        /* return the raw wildspec in case that works (e.g., directory not
  512. X         * searchable, but filespec was not wild and file is readable) */
  513. X        strcpy(matchname, wildspec);
  514. X        return matchname;
  515. X    }
  516. X
  517. X    /* last time through, might have failed opendir but returned raw wildspec */
  518. X    if (dir == NULL) {
  519. X        firstcall = TRUE;  /* nothing left to try--reset for new wildspec */
  520. X        if (have_dirname)
  521. X            free(dirname);
  522. X        return (char *)NULL;
  523. X    }
  524. X
  525. X    /* If we've gotten this far, we've read and matched at least one entry
  526. X     * successfully (in a previous call), so dirname has been copied into
  527. X     * matchname already.
  528. X     */
  529. X    while ((file = readdir(dir)) != NULL)
  530. X        if (match(file->d_name, wildname, 0)) {   /* 0 == don't ignore case */
  531. X            if (have_dirname) {
  532. X                /* strcpy(matchname, dirname); */
  533. X                strcpy(matchname+dirnamelen, file->d_name);
  534. X            } else
  535. X                strcpy(matchname, file->d_name);
  536. X            return matchname;
  537. X        }
  538. X
  539. X    closedir(dir);     /* have read at least one dir entry; nothing left */
  540. X    dir = NULL;
  541. X    firstcall = TRUE;  /* reset for new wildspec */
  542. X    if (have_dirname)
  543. X        free(dirname);
  544. X    return (char *)NULL;
  545. X
  546. X} /* end function do_wild() */
  547. X
  548. X
  549. X
  550. X
  551. X
  552. X/**********************/
  553. X/* Function mapattr() */
  554. X/**********************/
  555. X
  556. Xint mapattr()
  557. X{
  558. X    ulg  tmp = crec.external_file_attributes;
  559. X
  560. X    if (pInfo->hostnum == UNIX_ || pInfo->hostnum == VMS_)
  561. X    pInfo->file_attr = _mode2dos(tmp >> 16);
  562. X    else
  563. X    /* set archive bit (file is not backed up): */
  564. X    pInfo->file_attr = (unsigned)(crec.external_file_attributes|32) & 0xff;
  565. X    return 0;
  566. X
  567. X} /* end function mapattr() */
  568. X
  569. X
  570. X
  571. X
  572. X
  573. X/**********************/
  574. X/* Function mapname() */
  575. X/**********************/
  576. X
  577. Xint mapname(renamed)  /* return 0 if no error, 1 if caution (filename trunc), */
  578. X    int renamed;      /* 2 if warning (skip file because dir doesn't exist), */
  579. X{                     /* 3 if error (skip file), 10 if no memory (skip file) */
  580. X    char pathcomp[FILNAMSIZ];   /* path-component buffer */
  581. X    char *pp, *cp=NULL;         /* character pointers */
  582. X    char *lastsemi = NULL;      /* pointer to last semi-colon in pathcomp */
  583. X    int quote = FALSE;          /* flags */
  584. X    int error = 0;
  585. X    register unsigned workch;   /* hold the character being tested */
  586. X
  587. X
  588. X/*---------------------------------------------------------------------------
  589. X    Initialize various pointers and counters and stuff.
  590. X  ---------------------------------------------------------------------------*/
  591. X
  592. X    if (pInfo->vollabel)
  593. X        return IZ_VOL_LABEL;    /* can't set disk volume labels in Unix */
  594. X
  595. X    /* can create path as long as not just freshening, or if user told us */
  596. X    create_dirs = (!fflag || renamed);
  597. X
  598. X    created_dir = FALSE;        /* not yet */
  599. X
  600. X    /* user gave full pathname:  don't prepend rootpath */
  601. X    renamed_fullpath = (renamed && (*filename == '/'));
  602. X
  603. X    if (checkdir((char *)NULL, INIT) == 10)
  604. X        return 10;              /* initialize path buffer, unless no memory */
  605. X
  606. X    *pathcomp = '\0';           /* initialize translation buffer */
  607. X    pp = pathcomp;              /* point to translation buffer */
  608. X    if (jflag)                  /* junking directories */
  609. X        cp = (char *)strrchr(filename, '/');
  610. X    if (cp == NULL)             /* no '/' or not junking dirs */
  611. X        cp = filename;          /* point to internal zipfile-member pathname */
  612. X    else
  613. X        ++cp;                   /* point to start of last component of path */
  614. X
  615. X/*---------------------------------------------------------------------------
  616. X    Begin main loop through characters in filename.
  617. X  ---------------------------------------------------------------------------*/
  618. X
  619. X    while ((workch = (uch)*cp++) != 0) {
  620. X    if (iskanji(workch)) {
  621. X        *pp++ = (char)workch;
  622. X        quote = TRUE;
  623. X    } else if (quote) {                 /* if character quoted, */
  624. X            *pp++ = (char)workch;    /*  include it literally */
  625. X            quote = FALSE;
  626. X        } else
  627. X            switch (workch) {
  628. X            case '/':             /* can assume -j flag not given */
  629. X                *pp = '\0';
  630. X                if ((error = checkdir(pathcomp, APPEND_DIR)) > 1)
  631. X                    return error;
  632. X                pp = pathcomp;    /* reset conversion buffer for next piece */
  633. X                lastsemi = NULL;  /* leave directory semi-colons alone */
  634. X                break;
  635. X
  636. X            case ';':             /* VMS version (or DEC-20 attrib?) */
  637. X                lastsemi = pp;         /* keep for now; remove VMS ";##" */
  638. X                *pp++ = (char)workch;  /*  later, if requested */
  639. X                break;
  640. X
  641. X            case '\026':          /* control-V quote for special chars */
  642. X                quote = TRUE;     /* set flag for next character */
  643. X                break;
  644. X
  645. X            case ' ':             /* change spaces to underscore under */
  646. X                *pp++ = '_';      /*  MTS; leave as spaces under Unix */
  647. X                break;
  648. X
  649. X            default:
  650. X                /* allow European characters in filenames: */
  651. X                if (isprint(workch) || (128 <= workch && workch <= 254))
  652. X                    *pp++ = (char)workch;
  653. X            } /* end switch */
  654. X
  655. X    } /* end while loop */
  656. X
  657. X    *pp = '\0';                   /* done with pathcomp:  terminate it */
  658. X
  659. X    /* if not saving them, remove VMS version numbers (appended ";###") */
  660. X    if (!V_flag && lastsemi) {
  661. X        pp = lastsemi + 1;
  662. X        while (isdigit((uch)(*pp)))
  663. X            ++pp;
  664. X        if (*pp == '\0')          /* only digits between ';' and end:  nuke */
  665. X            *lastsemi = '\0';
  666. X    }
  667. X
  668. X/*---------------------------------------------------------------------------
  669. X    Report if directory was created (and no file to create:  filename ended
  670. X    in '/'), check name to be sure it exists, and combine path and name be-
  671. X    fore exiting.
  672. X  ---------------------------------------------------------------------------*/
  673. X
  674. X    if (filename[strlen(filename) - 1] == '/') {
  675. X        checkdir(filename, GETPATH);
  676. X        if (created_dir && QCOND2) {
  677. X            fprintf(stdout, "   creating: %s\n", filename);
  678. X            return IZ_CREATED_DIR;   /* set dir time (note trailing '/') */
  679. X        }
  680. X        return 2;   /* dir existed already; don't look for data to extract */
  681. X    }
  682. X
  683. X    if (*pathcomp == '\0') {
  684. X        fprintf(stderr, "mapname:  conversion of %s failed\n", filename);
  685. X        return 3;
  686. X    }
  687. X
  688. X    checkdir(pathcomp, APPEND_NAME);   /* returns 1 if truncated:  care? */
  689. X    checkdir(filename, GETPATH);
  690. X
  691. X    return error;
  692. X
  693. X} /* end function mapname() */
  694. X
  695. X
  696. X
  697. X
  698. X
  699. X/***********************/
  700. X/* Function checkdir() */
  701. X/***********************/
  702. X
  703. Xint checkdir(pathcomp, flag)
  704. X    char *pathcomp;
  705. X    int flag;
  706. X/*
  707. X * returns:  1 - (on APPEND_NAME) truncated filename
  708. X *           2 - path doesn't exist, not allowed to create
  709. X *           3 - path doesn't exist, tried to create and failed; or
  710. X *               path exists and is not a directory, but is supposed to be
  711. X *           4 - path is too long
  712. X *          10 - can't allocate memory for filename buffers
  713. X */
  714. X{
  715. X    static int rootlen = 0;   /* length of rootpath */
  716. X    static char *rootpath;    /* user's "extract-to" directory */
  717. X    static char *buildpath;   /* full path (so far) to extracted file */
  718. X    static char *end;         /* pointer to end of buildpath ('\0') */
  719. X
  720. X#   define FN_MASK   7
  721. X#   define FUNCTION  (flag & FN_MASK)
  722. X
  723. X
  724. X
  725. X/*---------------------------------------------------------------------------
  726. X    APPEND_DIR:  append the path component to the path being built and check
  727. X    for its existence.  If doesn't exist and we are creating directories, do
  728. X    so for this one; else signal success or error as appropriate.
  729. X  ---------------------------------------------------------------------------*/
  730. X
  731. X    if (FUNCTION == APPEND_DIR) {
  732. X        int too_long = FALSE;
  733. X        char *old_end = end;
  734. X
  735. X        Trace((stderr, "appending dir segment [%s]\n", pathcomp));
  736. X        while ((*end = *pathcomp++) != '\0')
  737. X            ++end;
  738. X    normalize_name(old_end);
  739. X
  740. X        /* GRR:  could do better check, see if overrunning buffer as we go:
  741. X         * check end-buildpath after each append, set warning variable if
  742. X         * within 20 of FILNAMSIZ; then if var set, do careful check when
  743. X         * appending.  Clear variable when begin new path. */
  744. X
  745. X        if ((end-buildpath) > FILNAMSIZ-3)  /* need '/', one-char name, '\0' */
  746. X            too_long = TRUE;                /* check if extracting directory? */
  747. X        if (stat(buildpath, &statbuf)) {    /* path doesn't exist */
  748. X            if (!create_dirs) {   /* told not to create (freshening) */
  749. X                free(buildpath);
  750. X                return 2;         /* path doesn't exist:  nothing to do */
  751. X            }
  752. X            if (too_long) {
  753. X                fprintf(stderr, "checkdir error:  path too long: %s\n",
  754. X                  buildpath);
  755. X                fflush(stderr);
  756. X                free(buildpath);
  757. X                return 4;         /* no room for filenames:  fatal */
  758. X            }
  759. X            if (mkdir(buildpath, 0666) == -1) {   /* create the directory */
  760. X                fprintf(stderr, "checkdir error:  can't create %s\n\
  761. X                 unable to process %s.\n", buildpath, filename);
  762. X                fflush(stderr);
  763. X                free(buildpath);
  764. X                return 3;      /* path didn't exist, tried to create, failed */
  765. X            }
  766. X            created_dir = TRUE;
  767. X        } else if (!S_ISDIR(statbuf.st_mode)) {
  768. X            fprintf(stderr, "checkdir error:  %s exists but is not directory\n\
  769. X                 unable to process %s.\n", buildpath, filename);
  770. X            fflush(stderr);
  771. X            free(buildpath);
  772. X            return 3;          /* path existed but wasn't dir */
  773. X        }
  774. X        if (too_long) {
  775. X            fprintf(stderr, "checkdir error:  path too long: %s\n", buildpath);
  776. X            fflush(stderr);
  777. X            free(buildpath);
  778. X            return 4;         /* no room for filenames:  fatal */
  779. X        }
  780. X        *end++ = '/';
  781. X        *end = '\0';
  782. X        Trace((stderr, "buildpath now = [%s]\n", buildpath));
  783. X        return 0;
  784. X
  785. X    } /* end if (FUNCTION == APPEND_DIR) */
  786. X
  787. X/*---------------------------------------------------------------------------
  788. X    GETPATH:  copy full path to the string pointed at by pathcomp, and free
  789. X    buildpath.
  790. X  ---------------------------------------------------------------------------*/
  791. X
  792. X    if (FUNCTION == GETPATH) {
  793. X        strcpy(pathcomp, buildpath);
  794. X        Trace((stderr, "getting and freeing path [%s]\n", pathcomp));
  795. X        free(buildpath);
  796. X        buildpath = end = NULL;
  797. X        return 0;
  798. X    }
  799. X
  800. X/*---------------------------------------------------------------------------
  801. X    APPEND_NAME:  assume the path component is the filename; append it and
  802. X    return without checking for existence.
  803. X  ---------------------------------------------------------------------------*/
  804. X
  805. X    if (FUNCTION == APPEND_NAME) {
  806. X        char *old_end = end;
  807. X
  808. X        Trace((stderr, "appending filename [%s]\n", pathcomp));
  809. X        while ((*end = *pathcomp++) != '\0') {
  810. X            ++end;
  811. X        normalize_name(old_end);
  812. X            if ((end-buildpath) >= FILNAMSIZ) {
  813. X                *--end = '\0';
  814. X                fprintf(stderr, "checkdir warning:  path too long; truncating\n\
  815. Xcheckdir warning:  path too long; truncating\n\
  816. X                   %s\n                -> %s\n", filename, buildpath);
  817. X                fflush(stderr);
  818. X                return 1;   /* filename truncated */
  819. X            }
  820. X        }
  821. X        Trace((stderr, "buildpath now = [%s]\n", buildpath));
  822. X        return 0;  /* could check for existence here, prompt for new name... */
  823. X    }
  824. X
  825. X/*---------------------------------------------------------------------------
  826. X    INIT:  allocate and initialize buffer space for the file currently being
  827. X    extracted.  If file was renamed with an absolute path, don't prepend the
  828. X    extract-to path.
  829. X  ---------------------------------------------------------------------------*/
  830. X
  831. X/* GRR:  for VMS and TOPS-20, add up to 13 to strlen */
  832. X
  833. X    if (FUNCTION == INIT) {
  834. X        Trace((stderr, "initializing buildpath to "));
  835. X        if ((buildpath = (char *)malloc(strlen(filename)+rootlen+1)) == NULL)
  836. X            return 10;
  837. X        if ((rootlen > 0) && !renamed_fullpath) {
  838. X            strcpy(buildpath, rootpath);
  839. X            end = buildpath + rootlen;
  840. X        } else {
  841. X            *buildpath = '\0';
  842. X            end = buildpath;
  843. X        }
  844. X        Trace((stderr, "[%s]\n", buildpath));
  845. X        return 0;
  846. X    }
  847. X
  848. X/*---------------------------------------------------------------------------
  849. X    ROOT:  if appropriate, store the path in rootpath and create it if neces-
  850. X    sary; else assume it's a zipfile member and return.  This path segment
  851. X    gets used in extracting all members from every zipfile specified on the
  852. X    command line.
  853. X  ---------------------------------------------------------------------------*/
  854. X
  855. X#if (!defined(SFX) || defined(SFX_EXDIR))
  856. X    if (FUNCTION == ROOT) {
  857. X        Trace((stderr, "initializing root path to [%s]\n", pathcomp));
  858. X        if (pathcomp == NULL) {
  859. X            rootlen = 0;
  860. X            return 0;
  861. X        }
  862. X        if ((rootlen = strlen(pathcomp)) > 0) {
  863. X            int had_trailing_pathsep=FALSE;
  864. X
  865. X            if (pathcomp[rootlen-1] == '/') {
  866. X                pathcomp[--rootlen] = '\0';
  867. X                had_trailing_pathsep = TRUE;
  868. X            }
  869. X            if (rootlen > 0 && (stat(pathcomp, &statbuf) ||
  870. X                !S_ISDIR(statbuf.st_mode)))          /* path does not exist */
  871. X            {
  872. X                if (!create_dirs                     /* || iswild(pathcomp) */
  873. X#ifdef OLD_EXDIR
  874. X                                 || !had_trailing_pathsep
  875. X#endif
  876. X                                                         ) {
  877. X                    rootlen = 0;
  878. X                    return 2;   /* skip (or treat as stored file) */
  879. X                }
  880. X                /* create the directory (could add loop here to scan pathcomp
  881. X                 * and create more than one level, but why really necessary?) */
  882. X                if (mkdir(pathcomp, 0777) == -1) {
  883. X                    fprintf(stderr,
  884. X                      "checkdir:  can't create extraction directory: %s\n",
  885. X                      pathcomp);
  886. X                    fflush(stderr);
  887. X                    rootlen = 0;   /* path didn't exist, tried to create, and */
  888. X                    return 3;  /* failed:  file exists, or 2+ levels required */
  889. X                }
  890. X            }
  891. X            if ((rootpath = (char *)malloc(rootlen+2)) == NULL) {
  892. X                rootlen = 0;
  893. X                return 10;
  894. X            }
  895. X            strcpy(rootpath, pathcomp);
  896. X            rootpath[rootlen++] = '/';
  897. X            rootpath[rootlen] = '\0';
  898. X        }
  899. X        Trace((stderr, "rootpath now = [%s]\n", rootpath));
  900. X        return 0;
  901. X    }
  902. X#endif /* !SFX || SFX_EXDIR */
  903. X
  904. X/*---------------------------------------------------------------------------
  905. X    END:  free rootpath, immediately prior to program exit.
  906. X  ---------------------------------------------------------------------------*/
  907. X
  908. X    if (FUNCTION == END) {
  909. X        Trace((stderr, "freeing rootpath\n"));
  910. X        if (rootlen > 0)
  911. X            free(rootpath);
  912. X        return 0;
  913. X    }
  914. X
  915. X    return 99;  /* should never reach */
  916. X
  917. X} /* end function checkdir() */
  918. X
  919. X
  920. X
  921. X
  922. X
  923. X/****************************/
  924. X/* Function close_outfile() */
  925. X/****************************/
  926. X
  927. Xvoid close_outfile()
  928. X{
  929. X    if (cflag) {
  930. X    fclose(outfile);
  931. X        return;
  932. X    }
  933. X
  934. X    _dos_filedate(fileno(outfile),
  935. X      (ulg)lrec.last_mod_file_date << 16 | lrec.last_mod_file_time);
  936. X    fclose(outfile);
  937. X    _dos_chmod(filename, pInfo->file_attr);
  938. X
  939. X} /* end function close_outfile() */
  940. X
  941. X
  942. X
  943. X
  944. X#ifndef SFX
  945. X
  946. X/************************/
  947. X/*  Function version()  */
  948. X/************************/
  949. X
  950. Xvoid version()
  951. X{
  952. X    extern char Far  CompiledWith[];
  953. X#if 0
  954. X    char buf[40];
  955. X#endif
  956. X
  957. X    printf(LoadFarString(CompiledWith),
  958. X
  959. X#ifdef __GNUC__
  960. X      "gcc ", __VERSION__,
  961. X#else
  962. X#  if 0
  963. X      "cc ", (sprintf(buf, " version %d", _RELEASE), buf),
  964. X#  else
  965. X      "unknown compiler", "",
  966. X#  endif
  967. X#endif
  968. X
  969. X      "Human68k", " (X68000)",
  970. X
  971. X#ifdef __DATE__
  972. X      " on ", __DATE__
  973. X#else
  974. X      "", ""
  975. X#endif
  976. X      );
  977. X
  978. X} /* end function version() */
  979. X
  980. X#endif /* !SFX */
  981. X
  982. X
  983. X
  984. X
  985. X
  986. X/* Human68K-specific routines */
  987. X
  988. X#define VALID_CHAR "&#()@_^{}!"
  989. X
  990. Xextern ulg TwentyOneOptions(void);
  991. X
  992. Xstatic int multi_period = 0;
  993. Xstatic int special_char = 0;
  994. X
  995. Xvoid
  996. XInitTwentyOne(void)
  997. X{
  998. X    ulg stat;
  999. X
  1000. X    stat = TwentyOneOptions();
  1001. X    if (stat == 0 || stat == (unsigned long) -1) {
  1002. X    special_char = 0;
  1003. X    multi_period = 0;
  1004. X    return;
  1005. X    }
  1006. X    if (stat & (1UL << 29))
  1007. X    special_char = 1;
  1008. X    if (stat & (1UL << 28))
  1009. X    multi_period = 1;
  1010. X}
  1011. X
  1012. Xstatic void
  1013. Xnormalize_name(char *name)
  1014. X{
  1015. X    char *dot;
  1016. X    char *p;
  1017. X
  1018. X    if (strlen(name) > 18) {    /* too long */
  1019. X    char base[18 + 1];
  1020. X    char ext[4 + 1];
  1021. X
  1022. X    if ((dot = jstrrchr(name, '.')) != NULL)
  1023. X        *dot = '\0';
  1024. X    strncpy(base, name, 18);
  1025. X    base[18] = '\0';
  1026. X    if (dot) {
  1027. X        *dot = '.';
  1028. X        strncpy(ext, dot, 4);
  1029. X        ext[4] = '\0';
  1030. X    } else
  1031. X        *ext = '\0';
  1032. X    strcpy(name, base);
  1033. X    strcat(name, ext);
  1034. X    }
  1035. X    dot = NULL;
  1036. X    for (p = name; *p; p++) {
  1037. X    if (iskanji((unsigned char)*p) && p[1] != '\0')
  1038. X        p++;
  1039. X    else if (*p == '.') {
  1040. X        if (!multi_period) {
  1041. X        dot = p;
  1042. X        *p = '_';
  1043. X        }
  1044. X    } else if (!special_char && !isalnum (*p)
  1045. X           && strchr(VALID_CHAR, *p) == NULL)
  1046. X        *p = '_';
  1047. X    }
  1048. X    if (dot != NULL) {
  1049. X    *dot = '.';
  1050. X    if (strlen(dot) > 4)
  1051. X        dot[4] = '\0';
  1052. X    }
  1053. X}
  1054. END_OF_FILE
  1055.   if test 20529 -ne `wc -c <'unzip-5.12/human68k/human68k.c'`; then
  1056.     echo shar: \"'unzip-5.12/human68k/human68k.c'\" unpacked with wrong size!
  1057.   fi
  1058.   # end of 'unzip-5.12/human68k/human68k.c'
  1059. fi
  1060. if test -f 'unzip-5.12/mac/macstat.c' -a "${1}" != "-c" ; then 
  1061.   echo shar: Will not clobber existing file \"'unzip-5.12/mac/macstat.c'\"
  1062. else
  1063.   echo shar: Extracting \"'unzip-5.12/mac/macstat.c'\" \(5803 characters\)
  1064.   sed "s/^X//" >'unzip-5.12/mac/macstat.c' <<'END_OF_FILE'
  1065. X#ifdef THINK_C
  1066. X#define MACOS
  1067. X#include    <pascal.h>
  1068. X#endif
  1069. X#ifdef MPW
  1070. X#define MACOS
  1071. X#include    <Files.h>
  1072. X#include    <Errors.h>
  1073. X#define FSFCBLen    (*(short *)0x3F6)
  1074. X#endif
  1075. X
  1076. X#ifdef MACOS
  1077. X#include    <string.h>
  1078. X#include    "macstat.h"
  1079. Xint macstat(char *path, struct stat *buf, short nVRefNum, long lDirID );
  1080. X
  1081. X#define unixTime(t) ((t) = ((t) < (time_t)0x7c25b080) ? 0 : (t) - (time_t)0x7c25b080)
  1082. X
  1083. X/* assume that the path will contain a Mac-type pathname, i.e. ':'s, etc. */
  1084. Xint macstat(char *path, struct stat *buf, short nVRefNum, long lDirID )
  1085. X{
  1086. X    char    temp[256];
  1087. X    short   nVRefNumT;
  1088. X    long    lDirIDT;
  1089. X    short   fIsHFS = false;
  1090. X    OSErr   err;
  1091. X    short   fUseDefault = ((nVRefNum == 0) && (lDirID == 0));
  1092. X
  1093. X    if (buf == (struct stat *)0L || path == (char *)0L) {
  1094. X        SysBeep(1);
  1095. X        return -1;
  1096. X    }
  1097. X
  1098. X    if (path[0] == '\0' || strlen(path)>255) {
  1099. X        return -1;
  1100. X    }
  1101. X
  1102. X    if ( fUseDefault )
  1103. X    {
  1104. X        if (GetVol((StringPtr)&temp[0], &nVRefNumT) != noErr) {
  1105. X            SysBeep(1);
  1106. X            return -1;
  1107. X        }
  1108. X    }
  1109. X
  1110. X    /* get info about the specified volume */
  1111. X    if (FSFCBLen > 0)   /* HFS Disk? */
  1112. X    {
  1113. X        HParamBlockRec    hpbr;
  1114. X
  1115. X        if ( fUseDefault )
  1116. X        {
  1117. X            WDPBRec wdpb;
  1118. X
  1119. X            wdpb.ioCompletion = 0;
  1120. X            wdpb.ioNamePtr = (StringPtr)temp;
  1121. X            err = PBHGetVol(&wdpb, 0);
  1122. X            nVRefNumT = wdpb.ioWDVRefNum;
  1123. X            lDirIDT = wdpb.ioWDDirID;
  1124. X        }
  1125. X        else
  1126. X        {
  1127. X            nVRefNumT = nVRefNum;
  1128. X            lDirIDT = lDirID;
  1129. X            err = noErr;
  1130. X        }
  1131. X        if (err == noErr)
  1132. X        {
  1133. X            hpbr.volumeParam.ioCompletion = 0;
  1134. X            hpbr.volumeParam.ioNamePtr = (StringPtr)temp;
  1135. X            hpbr.volumeParam.ioVRefNum = nVRefNumT;
  1136. X            hpbr.volumeParam.ioVolIndex = 0;
  1137. X            err = PBHGetVInfo(&hpbr, 0);
  1138. X
  1139. X            if (err == noErr && hpbr.volumeParam.ioVFSID == 0
  1140. X                && hpbr.volumeParam.ioVSigWord == 0x4244) {
  1141. X                    fIsHFS = true;
  1142. X            }
  1143. X        }
  1144. X    }
  1145. X
  1146. X
  1147. X    /* number of links, at least in System 6.0x, 0 */
  1148. X    buf->st_nlink = 0;
  1149. X    /* user id */
  1150. X    buf->st_uid = 0;
  1151. X    /* group id */
  1152. X    buf->st_gid = 0;
  1153. X
  1154. X    if (fIsHFS == true)   /* HFS? */
  1155. X    {
  1156. X        CInfoPBRec  cPB;
  1157. X        HParamBlockRec  hPB;
  1158. X
  1159. X        /* get information about file */
  1160. X        cPB.hFileInfo.ioCompletion = (ProcPtr)0L;
  1161. X        c2pstr(path);
  1162. X        strncpy(temp,path, path[0]+1);
  1163. X        p2cstr(path);
  1164. X        cPB.hFileInfo.ioNamePtr = (StringPtr)temp;
  1165. X        cPB.hFileInfo.ioVRefNum = nVRefNumT;
  1166. X        cPB.hFileInfo.ioDirID = lDirIDT;
  1167. X        cPB.hFileInfo.ioFDirIndex = 0;
  1168. X
  1169. X        err = PBGetCatInfo(&cPB, false);
  1170. X
  1171. X        if (err != noErr) {
  1172. X            if ((err != fnfErr) && (err != dirNFErr)) {
  1173. X                SysBeep(1);
  1174. X            }
  1175. X            return -1;
  1176. X        }
  1177. X
  1178. X        /* Type of file: directory or regular file + access */
  1179. X        buf->st_mode = (cPB.hFileInfo.ioFlAttrib & ioDirMask) ? S_IFDIR : S_IFREG |
  1180. X                       (cPB.hFileInfo.ioFlAttrib & 0x01) ? S_IREAD : (S_IREAD | S_IWRITE);
  1181. X
  1182. X        /* last access time, modification time and creation time(?) */
  1183. X        buf->st_atime = buf->st_mtime = cPB.hFileInfo.ioFlMdDat;
  1184. X        buf->st_ctime = cPB.hFileInfo.ioFlCrDat;
  1185. X        /* dev number */
  1186. X        buf->st_dev = (long)cPB.hFileInfo.ioVRefNum;
  1187. X        /* inode number */
  1188. X        buf->st_ino = cPB.hFileInfo.ioDirID;
  1189. X        /* size of file - use only the data fork */
  1190. X        buf->st_size = cPB.hFileInfo.ioFlLgLen;
  1191. X
  1192. X        /* size of disk block */
  1193. X        hPB.volumeParam.ioCompletion = (ProcPtr)0L;
  1194. X        hPB.volumeParam.ioNamePtr = (StringPtr)temp;
  1195. X        hPB.volumeParam.ioVRefNum = nVRefNumT;
  1196. X        hPB.volumeParam.ioVolIndex = 0;
  1197. X
  1198. X        err = PBHGetVInfo(&hPB, false);
  1199. X
  1200. X        if (err != noErr) {
  1201. X            SysBeep(1);
  1202. X            return -1;
  1203. X        }
  1204. X
  1205. X        buf->st_blksize = cPB.hFileInfo.ioFlPyLen / hPB.volumeParam.ioVAlBlkSiz;
  1206. X    }
  1207. X    else    /* MFS? */
  1208. X    {
  1209. X        ParamBlockRec   pPB;
  1210. X        ParamBlockRec   hPB;
  1211. X
  1212. X        c2pstr(path);
  1213. X        strncpy(temp, path, path[0]+1);
  1214. X        p2cstr(path);
  1215. X        pPB.fileParam.ioCompletion = (ProcPtr)0;
  1216. X        pPB.fileParam.ioNamePtr = (StringPtr)temp;
  1217. X        pPB.fileParam.ioVRefNum = nVRefNumT;
  1218. X        pPB.fileParam.ioFVersNum = 0;
  1219. X        pPB.fileParam.ioFDirIndex = 0;
  1220. X
  1221. X        err = PBGetFInfo(&pPB, false);
  1222. X
  1223. X        if (err != noErr) {
  1224. X            SysBeep(1);
  1225. X            return -1;
  1226. X        }
  1227. X
  1228. X        /* Type of file: either directory or regular file + access */
  1229. X        buf->st_mode = (pPB.fileParam.ioFlAttrib & ioDirMask) ? S_IFDIR : S_IFREG;
  1230. X                       (pPB.fileParam.ioFlAttrib & 0x01) ? S_IREAD : (S_IREAD | S_IWRITE);
  1231. X
  1232. X        /* last access time, modification time and creation time(?) */
  1233. X        buf->st_atime = buf->st_mtime = pPB.fileParam.ioFlMdDat;
  1234. X        buf->st_ctime = pPB.fileParam.ioFlCrDat;
  1235. X        /* dev number */
  1236. X        buf->st_dev = (long)pPB.fileParam.ioVRefNum;
  1237. X        /* inode number */
  1238. X        buf->st_ino = pPB.fileParam.ioFlNum;
  1239. X        /* size of file - use only the data fork */
  1240. X        buf->st_size = pPB.fileParam.ioFlLgLen;
  1241. X
  1242. X        /* size of disk block */
  1243. X        hPB.volumeParam.ioCompletion = (ProcPtr)0;
  1244. X        hPB.volumeParam.ioNamePtr = (StringPtr)temp;
  1245. X        hPB.volumeParam.ioVRefNum = nVRefNumT;
  1246. X        hPB.volumeParam.ioVolIndex = 0;
  1247. X
  1248. X        err = PBGetVInfo(&hPB, false);
  1249. X
  1250. X        if (err != noErr) {
  1251. X            SysBeep(1);
  1252. X            return -1;
  1253. X        }
  1254. X
  1255. X        buf->st_blksize = pPB.fileParam.ioFlPyLen / hPB.volumeParam.ioVAlBlkSiz;
  1256. X    }
  1257. X
  1258. X    /* Convert from Macintosh time format to Unix time format. */
  1259. X
  1260. X    unixTime(buf->st_atime);
  1261. X    unixTime(buf->st_mtime);
  1262. X    unixTime(buf->st_ctime);
  1263. X
  1264. X    return 0;
  1265. X}
  1266. X#else
  1267. X#error 1
  1268. X#endif
  1269. END_OF_FILE
  1270.   if test 5803 -ne `wc -c <'unzip-5.12/mac/macstat.c'`; then
  1271.     echo shar: \"'unzip-5.12/mac/macstat.c'\" unpacked with wrong size!
  1272.   fi
  1273.   # end of 'unzip-5.12/mac/macstat.c'
  1274. fi
  1275. if test -f 'unzip-5.12/unix/zipinfo.1' -a "${1}" != "-c" ; then 
  1276.   echo shar: Will not clobber existing file \"'unzip-5.12/unix/zipinfo.1'\"
  1277. else
  1278.   echo shar: Extracting \"'unzip-5.12/unix/zipinfo.1'\" \(20438 characters\)
  1279.   sed "s/^X//" >'unzip-5.12/unix/zipinfo.1' <<'END_OF_FILE'
  1280. X.\" Info-ZIP grants permission to any individual or institution to use, copy,
  1281. X.\" or redistribute this software, so long as:  (1) all of the original files
  1282. X.\" are included; (2) it is not sold for profit; and (3) this notice is re-
  1283. X.\" tained.
  1284. X.\"
  1285. X.\" zipinfo.1 by Greg Roelofs and others.
  1286. X.\"
  1287. X.\" =========================================================================
  1288. X.\" define .X macro (for long-line ZipInfo output examples; small Courier):
  1289. X.de X
  1290. X.ft CW
  1291. X.nf
  1292. X.ie n .ti -5
  1293. X.el \{ .ti +2m
  1294. X.ps -1 \}
  1295. X\&\\$1
  1296. X.ie n .ti +5
  1297. X.el \{ .ti -2m
  1298. X.ps +1 \}
  1299. X.ft
  1300. X.fi
  1301. X..
  1302. X.\" define .Y macro (for user-command examples; normal Courier font):
  1303. X.de Y
  1304. X.ft CW
  1305. X.in +4n
  1306. X.nf
  1307. X\&\\$1
  1308. X.ft
  1309. X.in
  1310. X.fi
  1311. X..
  1312. X.\" =========================================================================
  1313. X.TH ZIPINFO 1L "28 Aug 94 (v2.02)"
  1314. X.SH NAME
  1315. Xzipinfo \- list detailed information about a ZIP archive
  1316. X.PD
  1317. X.\" =========================================================================
  1318. X.SH SYNOPSIS
  1319. X\fBzipinfo\fP [\fB\-12smlvhtTz\fP] \fIfile\fP[\fI.zip\fP]
  1320. X[\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]
  1321. X.LP
  1322. X\fBunzip\fP \fB\-Z\fP [\fB\-12smlvhtTz\fP] \fIfile\fP[\fI.zip\fP]
  1323. X[\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]
  1324. X.PD
  1325. X.\" =========================================================================
  1326. X.SH DESCRIPTION
  1327. X\fIzipinfo\fP lists technical information about files in a ZIP archive, most
  1328. Xcommonly found on MS-DOS systems.  Such information includes file access
  1329. Xpermissions, encryption status, type of compression, version and operating
  1330. Xsystem or file system of compressing program, and the like.  The default
  1331. Xbehavior (with no options) is 
  1332. Xto list single-line entries for each file in the archive, with header and
  1333. Xtrailer lines providing summary information for the entire archive.  The
  1334. Xformat is a cross between Unix ``\fCls \-l\fR'' and ``\fCunzip \-v\fR''
  1335. Xoutput.  See
  1336. X.B DETAILED DESCRIPTION
  1337. Xbelow.  Note that \fIzipinfo\fP is the same program as \fIunzip\fP (under
  1338. XUnix, a link to it); on some systems, however, \fIzipinfo\fP support may 
  1339. Xhave been omitted when \fIunzip\fP was compiled.
  1340. X.PD
  1341. X.\" =========================================================================
  1342. X.SH ARGUMENTS
  1343. X.TP
  1344. X.IR file [ .zip ]
  1345. XPath of the ZIP archive(s).  If the file specification is a wildcard,
  1346. Xeach matching file is processed in an order determined by the operating
  1347. Xsystem (or file system).  Only the filename can be a wildcard; the path
  1348. Xitself cannot.  Wildcard expressions are similar to Unix \fIegrep\fP(1)
  1349. X(regular) expressions and may contain:
  1350. X.RS
  1351. X.IP *
  1352. Xmatches a sequence of 0 or more characters
  1353. X.IP ?
  1354. Xmatches exactly 1 character
  1355. X.IP [.\|.\|.]
  1356. Xmatches any single character found inside the brackets; ranges are specified
  1357. Xby a beginning character, a hyphen, and an ending character.  If an exclamation
  1358. Xpoint or a caret (`!' or `^') follows the left bracket, then the range of 
  1359. Xcharacters within the brackets is complemented (that is, anything \fIexcept\fP
  1360. Xthe characters inside the brackets is considered a match).
  1361. X.RE
  1362. X.IP
  1363. X(Be sure to quote any character which might otherwise be interpreted or
  1364. Xmodified by the operating system, particularly under Unix and VMS.)  If no
  1365. Xmatches are found, the specification is assumed to be a literal filename; 
  1366. Xand if that also fails, the suffix \fC.zip\fP is appended.  Note that 
  1367. Xself-extracting ZIP files are supported; just specify the \fC.exe\fP suffix
  1368. X(if any) explicitly.
  1369. X.IP [\fIfile(s)\fP]
  1370. XAn optional list of archive members to be processed.
  1371. XRegular expressions (wildcards) may be used to match multiple members; see
  1372. Xabove.  Again, be sure to quote expressions that would otherwise be expanded
  1373. Xor modified by the operating system.
  1374. X.IP [\fB\-x\fP\ \fIxfile(s)\fP]
  1375. XAn optional list of archive members to be excluded from processing.
  1376. X.\" =========================================================================
  1377. X.SH OPTIONS
  1378. X.TP
  1379. X.B \-1
  1380. Xlist filenames only, one per line.  This option excludes all others; headers,
  1381. Xtrailers and zipfile comments are never printed.  It is intended for use in
  1382. XUnix shell scripts.
  1383. X.TP
  1384. X.B \-2
  1385. Xlist filenames only, one per line, but allow headers (\fB\-h\fP), trailers
  1386. X(\fB\-t\fP) and zipfile comments (\fB\-z\fP), as well.  This option may be
  1387. Xuseful in cases where the stored filenames are particularly long.
  1388. X.TP
  1389. X.B \-s
  1390. Xlist zipfile info in short Unix ``\fCls \-l\fR'' format.  This is the default
  1391. Xbehavior; see below.
  1392. X.TP
  1393. X.B \-m
  1394. Xlist zipfile info in medium Unix ``\fCls \-l\fR'' format.  Identical to the
  1395. X\fB\-s\fP output, except that the compression factor, expressed as a
  1396. Xpercentage, is also listed.
  1397. X.TP
  1398. X.B \-l
  1399. Xlist zipfile info in long Unix ``\fCls \-l\fR'' format.  As with \fB\-m\fP 
  1400. Xexcept that the compressed size (in bytes) is printed instead of the 
  1401. Xcompression ratio.
  1402. X.TP
  1403. X.B \-v
  1404. Xlist zipfile information in verbose, multi-page format.
  1405. X.TP
  1406. X.B \-h
  1407. Xlist header line.  The archive name, actual size (in bytes) and total number
  1408. Xof files is printed.
  1409. X.TP
  1410. X.B \-t
  1411. Xlist totals for files listed or for all files.  The number of files listed,
  1412. Xtheir uncompressed and compressed total sizes, and their overall compression
  1413. Xfactor is printed; or, if only the totals line is being printed, the values
  1414. Xfor the entire archive are given.  Note that the total compressed (data)
  1415. Xsize will never match the actual zipfile size, since the latter includes all
  1416. Xof the internal zipfile headers in addition to the compressed data.
  1417. X.TP
  1418. X.B \-T
  1419. Xprint the file dates and times in a sortable decimal format (yymmdd.hhmmss).
  1420. XThe default date format is a more standard, human-readable version with
  1421. Xabbreviated month names (see examples below).
  1422. X.TP
  1423. X.B \-z
  1424. Xinclude the archive comment (if any) in the listing.
  1425. X.PD
  1426. X.\" =========================================================================
  1427. X.SH DETAILED DESCRIPTION
  1428. X.I zipinfo
  1429. Xhas a number of modes, and its behavior can be rather difficult to fathom
  1430. Xif one isn't familiar with Unix \fIls\fP(1) (or even if one is).  The default
  1431. Xbehavior is to list files in the following format:
  1432. X.LP
  1433. X.X "-rw-rws---  1.9 unx    2802 t- defX 11-Aug-91 13:48 perms.2660"
  1434. X.LP
  1435. XThe last three fields are the modification date and time of
  1436. Xthe file, and its name.  The case of the filename is respected; thus
  1437. Xfiles which come from MS-DOS PKZIP are always capitalized.  If the file
  1438. Xwas zipped with a stored directory name, that is also displayed as part
  1439. Xof the filename.
  1440. X.LP
  1441. XThe second and third fields indicate that the file was zipped under
  1442. XUnix with version 1.9 of \fIzip\fP.  Since it comes from Unix, the file
  1443. Xpermissions at the beginning of the line are printed in Unix format.
  1444. XThe uncompressed file-size (2802 in this example) is the fourth field.
  1445. X.LP
  1446. XThe fifth field consists of two characters, either of which may take
  1447. Xon several values.  The first character may be either `t' or `b', indicating
  1448. Xthat \fIzip\fP believes the file to be text or binary, respectively;
  1449. Xbut if the file is encrypted, \fIzipinfo\fP
  1450. Xnotes this fact by capitalizing the character (`T' or `B').  The second
  1451. Xcharacter may also take on four values, depending on whether there is
  1452. Xan extended local header and/or an ``extra field'' associated with the
  1453. Xfile (fully explained in PKWare's APPNOTE.TXT, but basically analogous to 
  1454. Xpragmas in ANSI C--i.e., they provide a standard way to include non-standard 
  1455. Xinformation in the archive).  If neither exists, the character
  1456. Xwill be a hyphen (`\-'); if there is an extended local header but no extra
  1457. Xfield, `l'; if the reverse, `x'; and if both exist, `X'.  Thus the
  1458. Xfile in this example is (probably) a text file, is not encrypted, and
  1459. Xhas neither an extra field nor an extended local header associated with it.
  1460. XThe example below, on the other hand, is an encrypted binary file with an 
  1461. Xextra field:
  1462. X.LP
  1463. X.X "RWD,R,R     0.9 vms     168 Bx shrk  9-Aug-91 19:15 perms.0644"
  1464. X.LP
  1465. XExtra fields are used for various purposes (see discussion of the \fB\-v\fP
  1466. Xoption below) including the storage of VMS file attributes, which is 
  1467. Xpresumably the case here.  Note that the file attributes are listed in
  1468. XVMS format.  Some other possibilities for the host operating system (which
  1469. Xis actually a misnomer--host file system is more correct) include
  1470. XOS/2 or NT with High Performance File System (HPFS), MS-DOS, OS/2 or NT
  1471. Xwith File Allocation Table (FAT) file system, and Macintosh.  These are
  1472. Xdenoted as follows:
  1473. X.LP
  1474. X.X "-rw-a--     1.0 hpf    5358 Tl i4:3  4-Dec-91 11:33 longfilename.hpfs"
  1475. X.X "-r--ahs     1.1 fat    4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF"
  1476. X.X "--w-------  1.0 mac   17357 bx i8:2  4-May-92 04:02 unzip.macr"
  1477. X.LP
  1478. XFile attributes in the first two cases are indicated in a Unix-like format,
  1479. Xwhere the seven subfields indicate whether the file:  (1) is a directory,
  1480. X(2) is readable (always true), (3) is writable, (4) is executable (guessed 
  1481. Xon the basis of the extension--\fI.exe\fP, \fI.com\fP, \fI.bat\fP, \fI.cmd\fP
  1482. Xand \fI.btm\fP files are assumed to be so), (5) has its archive bit set, 
  1483. X(6) is hidden, and (7) is a system file.  Interpretation of Macintosh file 
  1484. Xattributes is unreliable because some Macintosh archivers don't store any
  1485. Xattributes in the archive.
  1486. X.LP
  1487. XFinally, the sixth field indicates
  1488. Xthe compression method and possible sub-method used.  There are six methods
  1489. Xknown at present:  storing (no compression), reducing, shrinking, imploding,
  1490. Xtokenizing (never publicly released), and deflating.  In addition, there are 
  1491. Xfour levels of reducing (1 through 4); four types of imploding (4K or 8K 
  1492. Xsliding dictionary, and 2 or 3 Shannon-Fano trees); and four levels of 
  1493. Xdeflating (superfast, fast, normal, maximum compression).  \fIzipinfo\fP
  1494. Xrepresents these methods and their sub-methods as follows:  \fIstor\fP;
  1495. X\fIre:1\fP, \fIre:2\fP, etc.; \fIshrk\fP; \fIi4:2\fP, \fIi8:3\fP, etc.;
  1496. X\fItokn\fP; and \fIdefS\fP, \fIdefF\fP, \fIdefN\fP, and \fIdefX\fP.
  1497. X.LP
  1498. XThe medium and long listings are almost identical to the short format except 
  1499. Xthat they add information on the file's compression.  The medium format lists 
  1500. Xthe file's compression factor as a percentage indicating the amount of space
  1501. Xwhich has been ``removed'':
  1502. X.LP
  1503. X.X "-rw-rws---  1.5 unx    2802 t- 81% defX 11-Aug-91 13:48 perms.2660"
  1504. X.LP
  1505. XIn this example, the file has been compressed by more than a factor of
  1506. Xfive; the compressed data are only 19% of the original size.  The long
  1507. Xformat gives the compressed file's size in bytes, instead:
  1508. X.LP
  1509. X.X "-rw-rws---  1.5 unx    2802 t-     538 defX 11-Aug-91 13:48 perms.2660"
  1510. X.LP
  1511. XAdding the \fB\-T\fP option changes the file date and time to decimal
  1512. Xformat:
  1513. X.LP
  1514. X.X "-rw-rws---  1.5 unx    2802 t-     538 defX 910811.134804 perms.2660"
  1515. X.LP
  1516. XNote that because of limitations in the MS-DOS format used to store file
  1517. Xtimes, the seconds field is always rounded to the nearest even second.
  1518. XFor Unix files this is expected to change in the next major releases of 
  1519. X\fIzip\fP(1L) and \fIunzip\fP.
  1520. X.LP
  1521. XIn addition to individual file information, a default zipfile listing
  1522. Xalso includes header and trailer lines:
  1523. X.LP
  1524. X.X "Archive:  OS2.zip   5453 bytes   5 files"
  1525. X.X ",,rw,       1.0 hpf     730 b- i4:3 26-Jun-92 23:40 Contents"
  1526. X.X ",,rw,       1.0 hpf    3710 b- i4:3 26-Jun-92 23:33 makefile.os2"
  1527. X.X ",,rw,       1.0 hpf    8753 b- i8:3 26-Jun-92 15:29 os2unzip.c"
  1528. X.X ",,rw,       1.0 hpf      98 b- stor 21-Aug-91 15:34 unzip.def"
  1529. X.X ",,rw,       1.0 hpf      95 b- stor 21-Aug-91 17:51 zipinfo.def"
  1530. X.X "5 files, 13386 bytes uncompressed, 4951 bytes compressed:  63.0%"
  1531. X.LP
  1532. XThe header line gives the name of the archive, its total size, and the
  1533. Xtotal number of files; the trailer gives the number of files listed,
  1534. Xtheir total uncompressed size, and their total compressed size (not
  1535. Xincluding any of \fIzip\fP's internal overhead).  If, however, one or 
  1536. Xmore \fIfile(s)\fP are provided, the header and trailer lines are
  1537. Xnot listed.  This behavior is also similar to that of Unix's ``\fCls \-l\fR'';
  1538. Xit may be overridden by specifying the \fB\-h\fP and \fB\-t\fP options 
  1539. Xexplicitly.
  1540. XIn such a case the listing format must also be specified explicitly,
  1541. Xsince \fB\-h\fP or \fB\-t\fP (or both) in the absence of other options implies
  1542. Xthat ONLY the header or trailer line (or both) is listed.  See the
  1543. X\fBEXAMPLES\fP section below for a semi-intelligible translation of this
  1544. Xnonsense.
  1545. X.LP
  1546. XThe verbose listing is mostly self-explanatory.  It also lists file
  1547. Xcomments and the zipfile comment, if any, and the type and number of bytes 
  1548. Xin any stored extra fields.  Currently known types of extra fields include 
  1549. XPKWARE's authentication (``AV'') info; OS/2 extended attributes; VMS 
  1550. Xfilesystem info, both PKWARE and Info-ZIP versions; Macintosh resource
  1551. Xforks; Acorn/Archimedes SparkFS info; and so on.  (Note
  1552. Xthat in the case of OS/2 extended attributes--perhaps the most common
  1553. Xuse of zipfile extra fields--the size of the stored EAs as reported by
  1554. X\fIzipinfo\fP may not match the number given by OS/2's \fIdir\fP command:
  1555. XOS/2 always reports the number of bytes required in 16-bit format, whereas 
  1556. X\fIzipinfo\fP always reports the 32-bit storage.)
  1557. X.PD
  1558. X.\" =========================================================================
  1559. X.SH ENVIRONMENT OPTIONS
  1560. XModifying \fIzipinfo\fP's default behavior via options placed in
  1561. Xan environment variable can be a bit complicated to explain, due to
  1562. X\fIzipinfo\fP's attempts to handle various defaults in an intuitive,
  1563. Xyet Unix-like, manner.  (Try not to laugh.)  Nevertheless, there is some 
  1564. Xunderlying logic.  In brief, 
  1565. Xthere are three ``priority levels'' of options:  the default options;
  1566. Xenvironment options, which can override or add to the defaults; and 
  1567. Xexplicit options given by the user, which can override or add to 
  1568. Xeither of the above.
  1569. X.LP
  1570. XThe default listing format, as noted above, corresponds roughly
  1571. Xto the "\fCzipinfo \-hst\fP" command (except when individual zipfile members
  1572. Xare specified).
  1573. XA user who prefers the long-listing format (\fB\-l\fP) can make use of the
  1574. X\fIzipinfo\fP's environment variable to change this default:
  1575. X.LP
  1576. X.DT
  1577. X.ft CW
  1578. X.in +4n
  1579. X.ta \w'ZIPINFO=\-l; export ZIPINFO'u+4n
  1580. X.in
  1581. X.ft
  1582. X.PD 0
  1583. X.Y "ZIPINFO=\-l; export ZIPINFO\t\fRUnix Bourne shell"
  1584. X.Y "setenv ZIPINFO \-l\t\fRUnix C shell"
  1585. X.Y "set ZIPINFO=\-l\t\fROS/2 or MS-DOS"
  1586. X.Y "define ZIPINFO_OPTS ""\-l""\t\fRVMS (quotes for \fIlowercase\fP)"
  1587. X.PD
  1588. X.LP
  1589. XIf, in addition, the user dislikes the trailer line, \fIzipinfo\fP's
  1590. Xconcept of ``negative options'' may be used to override the default
  1591. Xinclusion of the line.  This is accomplished by preceding the undesired
  1592. Xoption with one or more minuses:  e.g., ``\fC\-l\-t\fR'' or ``\fC\-\-tl\fR'',
  1593. Xin this example.  The first hyphen is the regular switch character, but the 
  1594. Xone before the `t' is a minus sign.  The dual use of hyphens may seem a 
  1595. Xlittle awkward, but it's reasonably intuitive nonetheless:  simply ignore 
  1596. Xthe first hyphen and go from there.  It is also consistent with the behavior
  1597. Xof the Unix command \fInice\fP(1).
  1598. X.LP
  1599. XAs suggested above, the default variable names are ZIPINFO_OPTS for VMS
  1600. X(where the symbol used to install \fIzipinfo\fP as a foreign command
  1601. Xwould otherwise be confused with the environment variable), and ZIPINFO
  1602. Xfor all other operating systems.  For compatibility with \fIzip\fP(1L),
  1603. XZIPINFOOPT is also accepted (don't ask).  If both ZIPINFO and ZIPINFOOPT
  1604. Xare defined, however, ZIPINFO takes precedence.  \fIunzip\fP's diagnostic
  1605. Xoption (\fB\-v\fP with no zipfile name) can be used to check the values
  1606. Xof all four possible \fIunzip\fP and \fIzipinfo\fP environment variables.
  1607. X.PD
  1608. X.\" =========================================================================
  1609. X.SH EXAMPLES
  1610. XTo get a basic, short-format listing of the complete contents of a ZIP 
  1611. Xarchive \fIstorage.zip\fP, with both header and totals lines, use only
  1612. Xthe archive name as an argument to zipinfo:
  1613. X.LP
  1614. X.Y "zipinfo storage"
  1615. X.LP
  1616. XTo produce a basic, long-format listing (not verbose), including header and
  1617. Xtotals lines, use \fB\-l\fP:
  1618. X.LP
  1619. X.Y "zipinfo \-l storage"
  1620. X.LP
  1621. XTo list the complete contents of the archive without header and totals
  1622. Xlines, either negate the \fB\-h\fP and \fB\-t\fP options or else specify the 
  1623. Xcontents explicitly:
  1624. X.LP
  1625. X.PD 0
  1626. X.Y "zipinfo \-\-h\-t storage"
  1627. X.Y "zipinfo storage \e*"
  1628. X.PD
  1629. X.LP
  1630. X(where the backslash is required only if the shell would otherwise expand
  1631. Xthe `*' wildcard, as in Unix when globbing is turned on--double quotes around
  1632. Xthe asterisk would have worked as well).  To turn off the totals line by
  1633. Xdefault, use the environment variable (C shell is assumed here):
  1634. X.LP
  1635. X.PD 0
  1636. X.Y "setenv ZIPINFO \-\-t"
  1637. X.Y "zipinfo storage"
  1638. X.PD
  1639. X.LP
  1640. XTo get the full, short-format listing of the first example again, given
  1641. Xthat the environment variable is set as in the previous example, it is
  1642. Xnecessary to specify the \fB\-s\fP option explicitly, since the \fB\-t\fP
  1643. Xoption by itself implies that ONLY the footer line is to be printed:
  1644. X.LP
  1645. X.PD 0
  1646. X.Y "setenv ZIPINFO \-\-t"
  1647. X.Y "zipinfo \-t storage\t\fR[only totals line]"
  1648. X.Y "zipinfo \-st storage\t\fR[full listing]"
  1649. X.PD
  1650. X.LP
  1651. XThe \fB\-s\fP option, like \fB\-m\fP and \fB\-l\fP, includes headers and
  1652. Xfooters by default, unless otherwise specified.  Since the environment 
  1653. Xvariable specified no footers and that has a higher precedence than the 
  1654. Xdefault behavior of \fB\-s\fP, an explicit \fB\-t\fP option was necessary 
  1655. Xto produce the full listing.  Nothing was indicated about the header, 
  1656. Xhowever, so the \fB\-s\fP option was sufficient.  Note that both the 
  1657. X\fB\-h\fP and \fB\-t\fP options, when used by themselves or with
  1658. Xeach other, override any default listing of member files; only the header
  1659. Xand/or footer are printed.  This behavior is useful when \fIzipinfo\fP is
  1660. Xused with a wildcard zipfile specification; the contents of all zipfiles 
  1661. Xare then summarized with a single command.
  1662. X.LP
  1663. XTo list information on a single file within the archive, in medium format,
  1664. Xspecify the filename explicitly:
  1665. X.LP
  1666. X.Y "zipinfo \-m storage unshrink.c"
  1667. X.LP
  1668. XThe specification of any member file, as in this example, will override
  1669. Xthe default header and totals lines; only the single line of information
  1670. Xabout the requested file will be printed.  This is intuitively what one
  1671. Xwould expect when requesting information about a single file.  For multiple
  1672. Xfiles, it is often useful to know the total compressed and uncompressed
  1673. Xsize; in such cases \fB\-t\fP may be specified explicitly:
  1674. X.LP
  1675. X.Y "zipinfo \-mt storage ""*.[ch]"" Mak\e*"
  1676. X.LP
  1677. XTo get maximal information about the ZIP archive, use the verbose 
  1678. Xoption.  It is usually wise to pipe the output into a filter such as 
  1679. XUnix \fImore\fP(1) if the operating system allows it:
  1680. X.LP
  1681. X.Y "zipinfo \-v storage | more"
  1682. X.LP
  1683. XFinally, to see the most recently modified files in the archive, use
  1684. Xthe \fB\-T\fP option in conjunction with an external sorting utility
  1685. Xsuch as Unix \fIsort\fP(1) (and \fItail\fP(1) as well, in this example):
  1686. X.LP
  1687. X.Y "zipinfo \-T storage | sort -n +6 | tail -15"
  1688. X.LP
  1689. XThe \fB\-n\fP option to \fIsort\fP(1) tells it to sort numerically
  1690. Xrather than in ASCII order, and the \fB\+6\fP option tells it to sort
  1691. Xon the sixth field after the first one (i.e., the seventh field).  This
  1692. Xassumes the default short-listing format; if \fB\-m\fP or \fB\-l\fP is
  1693. Xused, the proper \fIsort\fP(1) option would be \fB\+7\fP.  The \fItail\fP(1) 
  1694. Xcommand filters out all but the last 15 lines of the listing.  Future
  1695. Xreleases of \fIzipinfo\fP may incorporate date/time and filename sorting
  1696. Xas built-in options.
  1697. X.PD
  1698. X.\" =========================================================================
  1699. X.SH TIPS
  1700. XThe author finds it convenient to define an alias \fIii\fP for \fIzipinfo\fP
  1701. Xon systems which allow aliases (or, on other systems, copy/rename the
  1702. Xexecutable, create a link or create a command file with the name \fIii\fP).
  1703. XThe \fIii\fP usage parallels the common \fIll\fP alias for long listings in 
  1704. XUnix, and the similarity between the outputs of the two commands was 
  1705. Xintentional.
  1706. X.PD
  1707. X.\" =========================================================================
  1708. X.SH BUGS
  1709. XNone known at this time, but we're always delighted to find a good one.
  1710. X.LP
  1711. X.\" =========================================================================
  1712. X.SH SEE ALSO
  1713. X\fIls\fP(1), \fIfunzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L),
  1714. X\fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
  1715. X.PD
  1716. X.\" =========================================================================
  1717. X.SH AUTHOR
  1718. XGreg Roelofs (a.k.a.\ Cave Newt).  ZipInfo contains pattern-matching code 
  1719. Xby Mark Adler and fixes/improvements by many others.  Please refer to the 
  1720. XCONTRIBS file in the UnZip source distribution for a more complete list.
  1721. END_OF_FILE
  1722.   if test 20438 -ne `wc -c <'unzip-5.12/unix/zipinfo.1'`; then
  1723.     echo shar: \"'unzip-5.12/unix/zipinfo.1'\" unpacked with wrong size!
  1724.   fi
  1725.   # end of 'unzip-5.12/unix/zipinfo.1'
  1726. fi
  1727. echo shar: End of archive 14 \(of 20\).
  1728. cp /dev/null ark14isdone
  1729. MISSING=""
  1730. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
  1731.     if test ! -f ark${I}isdone ; then
  1732.     MISSING="${MISSING} ${I}"
  1733.     fi
  1734. done
  1735. if test "${MISSING}" = "" ; then
  1736.     echo You have unpacked all 20 archives.
  1737.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1738. else
  1739.     echo You still must unpack the following archives:
  1740.     echo "        " ${MISSING}
  1741. fi
  1742. exit 0
  1743. exit 0 # Just in case...
  1744.