Imported Upstream version 610c20 97/182797/1 upstream/610c20
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 28 Jun 2018 05:25:05 +0000 (14:25 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 28 Jun 2018 05:25:07 +0000 (14:25 +0900)
Change-Id: I014f9636f31c3edb1fb843300b326505866945ac
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
56 files changed:
Contents
History.610
INSTALL
ToDo
USexport_aes_wg.msg [new file with mode: 0644]
USexport_zcrypt.msg [new file with mode: 0644]
acorn/acorn.c
aes_wg/README_AES_WG.txt [deleted file]
amiga/amiga.c
aosvs/aosvs.c
atari/atari.c
atheos/atheos.c
beos/beocfg.h
beos/beos.c
crypt.c
crypt.h
expand.c
extract.c
fileio.c
flexos/flexos.c
human68k/human68k.c
inflate.c
macos/source/macos.c
macos/source/sxunzip.c
man/man1/unzipsfx.1
man/man1/zipgrep.1
msdos/msdos.c
netware/netware.c
os2/os2.c
process.c
proginfo/extrafld.txt
qdos/qdos.c
tandem/tanunz.c
theos/theos.c
tops20/tops20.c
unix/README.zOS
unix/unix.c
unix/zipgrep
unzip.c
unzip610b.ann
unzip610c.ann
unzpriv.h
unzvers.h
vms/NOTES.TXT
vms/cmdline.c
vms/descrip_src.mms
vms/unzipsfx.hlp
vms/vms.c
win32/Contents
win32/win32.c
windll/windll.c
zip-comment.txt
zos/bbunzip.c
zos/vmmvs.c
zos/vmmvs.h
zvm/README.CMS

index 7363636..315c2bc 100644 (file)
--- a/Contents
+++ b/Contents
@@ -17,6 +17,8 @@ ToDo            List of new features/fixes under consideration
 unzip610a.ann   Notes on the UnZip 6.10a beta release
 unzip610b.ann   Notes on the UnZip 6.10b beta release
 unzip610c.ann   Notes on the UnZip 6.1c beta release
+USexport_aes_wg.msg  US Dept. of Commerce BIS TSU notification: AES_WG
+USexport_zcrypt.msg  US Dept. of Commerce BIS TSU notification: ZCRYPT
 zip-comment.txt Source kit archive comment
 proginfo/       Programming docs, additional technical info, contributor list
 
index 82151c0..bbc5944 100644 (file)
@@ -165,7 +165,7 @@ Features added (or removed):
 
 6.10c02 (28 May 2011):
  - Add ef_scan_for_aes() and ef_strip_aes() for processing AES extra
-   fields. (crypt.c) [SMS]
+   fields.  (crypt.c) [SMS]
  - Update zipcloak() and zipbare() to support AES encryption and
    decryption.  (Technically a Zip update, but to common code).
    (crypt.c) [SMS]
@@ -537,7 +537,7 @@ Features added (or removed):
    vms/unzip_cli.help, vms/unz_cli.cld) [SMS, JBCarpen]
  - A Bzip2 source kit (version 1.0.6, modified for better VMS support)
    is now included in the kit.  (Old bzip2/descrbz2.mms removed.
-   bzip2/README_bz2.txt, bzip2/)  [SMS]
+   bzip2/README_bz2.txt, bzip2/) [SMS]
  - Changed Unix and VMS builders:
     - Enable bzip2, LZMA, and PPMd compression support by default.
     - On VMS, enable large-file support by default on Alpha and IA64
@@ -605,7 +605,7 @@ Features added (or removed):
    extra field.  Define ARCHIVE_STDIN to enable support for streaming
    input archives.  Extensive refactoring of extract.c could have
    introduced new defects.  Some accommodation was attempted for
-   Windows, but not tested. (extract.c, fileio.c, globals.c, globals.h,
+   Windows, but not tested.  (extract.c, fileio.c, globals.c, globals.h,
    process.c, unix/unix.c, unix/unxcfg.h, unzip.c, unzpriv.h) [SMS]
  - Added tentative, experimental-grade support for segmented
    (multi-part) archives.  Patch contributed by Petr Stodulka.
@@ -622,6 +622,35 @@ Features added (or removed):
 6.10c18 (20 Mar 2015):
  - No news.
 
+6.1c19 (26 Jun 2015)
+ - Changed the displayed program version number to omit the PATCH_LEVEL
+   digit when it's zero, so, henceforth, UnZip version 6.1 will
+   generally be called version "6.1", not "6.10".  Added
+   -vq/--quick-version (/VERBOSE=BRIEF) option to provide a brief
+   (one-line) program version report.  (BUGS, Contents, INSTALL, README,
+   unzip.c, unzip.h, unzip610c.ann, unzpriv.h, unzvers.h, zipinfo.c,
+   docs/Contents, docs/unzip.txt, docs/unzipsfx.txt, docs/zipinfo.txt,
+   libiz/Contents, man/Contents, man/man1/Contents, man/man1/unzip.1,
+   man/man1/unzipsfx.1, man/man1/zipinfo.1, unix/Contents,
+   unix/README.zOS, vms/build_unzip.com, vms/cmdline.c, vms/Contents,
+   vms/descrip.mms, vms/descrip_mkdeps.mms, vms/descrip_src.mms,
+   vms/INSTALL_VMS.txt, vms/unzip_cli.help, vms/UNZIP_DEF.RNH,
+   vms/unz_cli.cld, win32/Contents, windll/Contents, wrap/Contents)
+   [SMS]
+
+6.1c20 (20 Sep 2015):
+ - Defining the C macro NO_BUILD_DATE now suppresses the display of the
+   build date in the "-v" (/VERBOSE) report (for example, "Compiled with
+   [compiler version] on Jul 26 2015.").  Compiling with this macro
+   defined makes the build reproducible.  Forum topic:
+   http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=490
+   (acorn/acorn.c, amiga/amiga.c, aosvs/aosvs.c, atari/atari.c,
+   atheos/atheos.c, beos/beos.c, flexos/flexos.c, human68k/human68k.c,
+   macos/source/macos.c, macos/source/sxunzip.c, msdos/msdos.c,
+   netware/netware.c, os2/os2.c, qdos/qdos.c, tandem/tanunz.c,
+   theos/theos.c, tops20/tops20.c, unix/unix.c, vms/vms.c,
+   win32/win32.c, zos/vmmvs.c) [sanvila, SMS]
+
 
 Bugs fixed:
 
@@ -651,7 +680,7 @@ Bugs fixed:
    qdos/qdos.c, tandem/tanunz.c, unix/unix.c, vms/vms.c, win32/win32.c) [SMS]
  - Changed argc+1 to argc to work with new parser.  Removed CMS_MVS 'U'
    option. Changed u0.L_flag-negative to u0.L_flag-1 as negative is now
-   always 0 or 1. (unzip.c) [EG]
+   always 0 or 1.  (unzip.c) [EG]
 
 6.10a04 (05 Aug 2010):
  - Set minimum value of u0.X_flag to -1 instead of 0, allowing flag to take on
@@ -704,7 +733,7 @@ Bugs fixed:
    bit. When this bit is set, a verification checksum is in the first 3
    bytes of the external attributes.  In this case, only use last byte of
    external attributes by clearing other bytes in
-   G.crec.external_file_attributes. (process.c) [EG]
+   G.crec.external_file_attributes.  (process.c) [EG]
  - Add check for NO_UNICODE_SUPPORT.  Automatically set WIN32_WIDE on Windows
    if UNICODE_SUPPORT set.  Remove UNICODE_SUPPORT and WIN32_WIDE macros
    from project.  (win32/w32cfg.h, win32/vc6/unzip.dsp) [EG]
@@ -867,7 +896,7 @@ Bugs fixed:
  - Update Contents.  Add lzma.  (Contents) [SMS]
  - Minor changes to Contents.  (Contents) [EG]
  - Update crypt to version 3.0.  (crypt.h) [SMS]
- - Update VCC6 project to look for AES WG files in aes_wg.
+ - Update VCC6 project to look for AES_WG files in aes_wg.
    (win32/vc6/unzip.dsp) [EG]
  - Allow Total Disks (ecloc64_total_disks) to be 0, as some archive creator
    out there sets this to 0 incorrectly instead of 1.  However, probably
@@ -985,7 +1014,7 @@ Bugs fixed:
    and AR_BZ for each port.  Add test for DJGPP, CYGWIN.  Set build
    configuration for various targets:  msdos, os2, qdos, zos,  zvm.  Add
    "fix me" note for assembler CRC code.  Change some output error
-   messages to use ^^ prefix as in Zip.  Add "No AES WG encryption", "No
+   messages to use ^^ prefix as in Zip.  Add "No AES_WG encryption", "No
    LZMA compression", "No BZIP2 compression", and "ZLIB not used" messages
    as in Zip.  Error message updates similar to Zip.  Add comment
    describing HAVE_HEADER_H, HAVE_DIR_HEADER_H, NO_HEADER_H,
@@ -1572,7 +1601,7 @@ Bugs fixed:
    (unix/configure) [AD]
  - Unix builder script was ignoring some early test results when running
    later tests, causing erroneous configuration related to wide
-   characters and Unicode.  (unix/configure)  [EG, SMS]
+   characters and Unicode.  (unix/configure) [EG, SMS]
 
 6.10c11 (03 Nov 2014):
  - Windows DLL interface/entry functions Wiz_SingleEntryUnzip() and
@@ -1582,7 +1611,7 @@ Bugs fixed:
  - Work around MS compiler quirk which caused bad behavior in the
    Windows DLL.  Forum topic:
    http://www.info-zip.org/phpBB3/viewtopic.php?f=4&t=447
-   (windll/windll.c)  [JBCarpen, SMS]
+   (windll/windll.c) [JBCarpen, SMS]
  - ZipInfo displayed wrong data for MD5 extra block (ID = 0x4b46).
    (zipinfo.c) [Wojtek Michalski]
  - A corrupt (or crafted) archive could cause memory access problems.
@@ -1619,7 +1648,7 @@ Bugs fixed:
    [SMS]
  - Limited to VMS a change intended to fix a message format problem on
    VMS.  It was enabled everywhere, but could cause spurious blank lines
-   on non-VMS systems.  (fileio.c)  [SMS]
+   on non-VMS systems.  (fileio.c) [SMS]
  _ Added more details to documentation on build customization.
    (INSTALL) [SMS]
  - Advanced copyright dates in messages to 2015.  (unzip.c) [SMS]
@@ -1679,12 +1708,13 @@ Bugs fixed:
    conflict resolution queries, as described above.  Some related code
    reorganization changed some variable names in non-Windows-specific
    modules.  (consts.h, extract.c, globals.h, unix/unix.c, unzip.c,
-   unzpriv.h, vms/vms.c) [SMS] 
+   unzpriv.h, vms/vms.c) [SMS]
 
 6.10c17 (18 Mar 2015)
  - Added a type cast to clear a compiler complaint.  (fileio.c) [SMS]
  - Changed an archive size variable type from z_uint4 to zoff_t for
-   better agreement with run-time seek/tell functions. (globals.h) [SMS]
+   better agreement with run-time seek/tell functions.  (globals.h)
+   [SMS]
 
 6.10c18 (18 Mar 2015)
  - Repaired damage to REENTRANT-sensitive code (such as the Windows DLL)
@@ -1695,26 +1725,40 @@ Bugs fixed:
    SMS]
 
 6.1c19 (26 Jun 2015)
- - Changed the displayed program version number to omit the PATCH_LEVEL
-   digit when it's zero, so, henceforth, UnZip version 6.1 will
-   generally be called version "6.1", not "6.10".  Added
-   -vq/--quick-version (/VERBOSE=BRIEF) option to provide a brief
-   (one-line) program version report.  (BUGS, Contents, INSTALL, README,
-   unzip.c, unzip.h, unzip610c.ann, unzpriv.h, unzvers.h, zipinfo.c,
-   docs/Contents, docs/unzip.txt, docs/unzipsfx.txt, docs/zipinfo.txt,
-   libiz/Contents, man/Contents, man/man1/Contents, man/man1/unzip.1,
-   man/man1/unzipsfx.1, man/man1/zipinfo.1, unix/Contents,
-   unix/README.zOS, vms/build_unzip.com, vms/cmdline.c, vms/Contents,
-   vms/descrip.mms, vms/descrip_mkdeps.mms, vms/descrip_src.mms,
-   vms/INSTALL_VMS.txt, vms/unzip_cli.help, vms/UNZIP_DEF.RNH,
-   vms/unz_cli.cld, win32/Contents, windll/Contents, wrap/Contents)
-   [SMS]
  - Repaired damage to AppleDouble extraction in the non-stream case,
-   beginning in 6.10c16.  (extract.c)  [SMS]
+   beginning in 6.10c16.  (extract.c) [SMS]
  - The "files tested" count in the error-summary trailer could be wrong
    for a streamed archive, when a list of archive members was specified.
-   (extract.c)  [SMS]
+   (extract.c) [SMS]
  - Removed the now-spurious warning, "zipfile claims to be last disk of
    a multi-part archive [...]".  Improved handling of segmented archives
    where the segment size varied.  (fileio.c, globals.h, process.c)
    [Petr Stodulka, SMS]
+
+6.1c20 (16 Mar 2016)
+ - One more bug in handling of segmented archives.  (fileio.c) [Petr
+   Stodulka, SMS]
+ - Incompatible declarations of function and prototype for
+   set_zipfn_sgmnt_name().  (fileio.c) [SMS]
+ - Since version 6.10b03, if the "external file attributes" for an
+   archive member was zero, typically when the archive was created from
+   a FAT file system (or similar, so, lacking UNIX-like permissions),
+   and then the archive member was extracted on a VMS system, the
+   resulting file and directory permissions could be defective.
+   (vms/vms.c) [SMS]
+ - The zipgrep shell script was erroneously adding backslash escapes to
+   pattern strings, making some legitimate egrep patterns behave like
+   simple grep patterns.  The zipgrep "usage" text now reminds the user
+   (and the developer) that it uses egrep.  (unix/zipgrep) [SMS]
+ - UnZip gave unhelpful error messages when trying to process archive
+   members with AES_WG encryption and an unsupported compression method
+   (for example, JPEG or WavPack).  Now, if AES_WG encryption is not
+   supported, then the "skipping" action message should complain about
+   "AES_WG_encr".  If AES_WG encryption _is_ supported, then the
+   "skipping" action message should complain about the actual
+   unsupported compression method.  (AES_WG encryption is denoted by a
+   fake "compression method" of 99, and the actual compression method is
+   stored in an AES_WG extra block.  In some cases, the AES_WG "99"
+   value was being used instead of the actual value from the extra
+   block.)  (extract.c)  [Elvis Angelaccio, SMS] 
+ - Revised some "UT"-related comments.  (process.c) [SMS]
diff --git a/INSTALL b/INSTALL
index 185fb47..4e6abaa 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
       INSTALL -- Info-ZIP UnZip Installation Instructions
       ===================================================
 
-   UnZip version 6.1.  Revised: 2015-06-10
+   UnZip version 6.1.  Revised: 2015-11-13
 
 ------------------------------------------------------------------------
 
@@ -70,12 +70,12 @@ This should create an "unzip61" directory which contains the UnZip
 source kit, and that is where the rest of the work is done.
 
    Some unzip programs, such as the Extraction Wizard ("Extract
-Compressed (Zipped) Folders") in Windows, may want to add another add
-another "unzip61" directory above the top-level directory in the Zip
-archive.  This extra, top-level directory is not needed, and probably
-makes finding the archive's top-level directory harder.  (With the
-Windows Extraction Wizard, this extra directory can easily be deleted
-manually from the default destination path before letting the extraction
+Compressed (Zipped) Folders") in Windows, may want to add another
+"unzip61" directory above the top-level directory in the Zip archive.
+This extra, top-level directory is not needed, and probably makes
+finding the archive's top-level directory harder.  (With the Windows
+Extraction Wizard, this extra directory can easily be deleted manually
+from the default destination path before letting the extraction
 proceed.)  Many of the instructions below assume that you're in the
 archive's main (top-level) directory, that is, the directory which
 contains this INSTALL file (and many other UnZip files and directories).
@@ -181,7 +181,7 @@ compression methods bzip2, LZMA, and PPMd is enabled by default.  The
 code used to implement these compression methods and the code in the
 optional source kit for AES_WG encryption are generally written to newer
 C language standards than the base Info-ZIP code, so some very old
-compilers may be unable to build UnZip if these features are enabled. 
+compilers may be unable to build UnZip if these features are enabled.
 In other cases, some special build options must be specified to get a
 particular feature to work properly.  The build instructions below (and
 in other, system-specific, supplementary documents) show how to disable
@@ -1078,14 +1078,8 @@ UNSHRINK_SUPPORT   (now default, as of January 2005)
    was used by PKZIP 1.0 and 1.1, and Zip 1.0 and 1.1. All newer
    archives use only the deflation method.)
 
-MULT_VOLUME   (experimental for 5.5x, do NOT use in production versions!)
-NO_MULT_VOLUME   (default)
-   The macro MULT_VOLUME is used to flag code portions needed for
-   support of multi-volume archives.  For now, this flag MUST NOT be
-   used to build a production version of UnZip. This flag has been
-   introduced to allow integration of experimental code for multi-volume
-   support in the master source tree.  This feature will become a
-   default option in the future 6.1 release of UnZip (with any luck).
+NO_BUILD_DATE
+   Omit the build date from the "Compiled with" line in the "-v" report.
 
 NO_CRYPT
    Disable all encryption support in all programs.
@@ -1125,10 +1119,11 @@ NO_ZIPINFO
 NOTIMESTAMP
    Disable the -T option, which basically does exactly what Zip's -go
    options do.  That is, set the timestamp of the archive to that of the
-   newest file in the archive without rewriting the archive. Unlike Zip,
-   however, UnZip supports wildcard specifications for the archive name.
-   For example, "unzip -T *.zip" will set the dates of all zipfiles in
-   the current directory.  (UnZip's option is also much faster.)
+   newest file in the archive without rewriting the archive.  UnZip
+   supports wildcard specifications for the archive name, which Zip may
+   not.  For example, "unzip -T *.zip" will set the dates of all
+   zipfiles in the current directory.  (UnZip's option is also much
+   faster.)
 
 OS2_EAS
    List the sizes of OS/2 EAs and ACLs for each file as two extra
@@ -1160,7 +1155,7 @@ USE_UNREDUCE_SMITH
    early PKZIP beta versions (0.9x).  By default, support for it is not
    included in UnZip.  If desired, Unreduce support can be provided
    using either the original, copyrighted code from Samuel H. Smith, or
-   some newer, public-domain code from Peter Backes. 
+   some newer, public-domain code from Peter Backes.
    USE_UNREDUCE_PUBLIC enables Unreduce support using the public-domain
    code.  USE_UNREDUCE_SMITH enables Unreduce support using the
    copyrighted code.  The public-domain Unreduce source module
@@ -1471,24 +1466,28 @@ re-link the programs.  On AIX, "-O2" seems to work.  On HP-UX, "-O1"
 seems to work.  For example:
 
     make -f unix/Makefile [options] CC=gcc generic          # Build.
-    make -f unix/Makefile test_ppmd                         # Test.
+    make -f unix/Makefile [options] test_ppmd               # Test.
     gcc -c -O1 szip/Ppmd8.c                                 # (Or "-O2"?)
     make -f unix/Makefile [options] CC=gcc generic          # Re-link.
-    make -f unix/Makefile test_ppmd                         # Re-test.
+    make -f unix/Makefile [options] test_ppmd               # Re-test.
 
-If "PROD=subdir" is used with "make", then add a suitable "-o" option to
-the compiler command.  For example:
+   Note that most "make" options are harmless but not required for the
+"test_ppmd" target (like "CC=gcc", above), but the "PROD=subdir" option,
+if it's used in the original "make" command, must also be specified for
+the "test_ppmd" target.  Also, if "PROD=subdir" is used with "make",
+then add a suitable "-o" option to the compiler command.  For example:
 
     make -f unix/Makefile [options] CC=gcc PROD=pd generic
-    make -f unix/Makefile PROD=pd test_ppmd
+    make -f unix/Makefile [options] PROD=pd test_ppmd
     gcc -c -O1 -o pd/Ppmd8.o szip/Ppmd8.c
     [...]
 
-Other compilers (AIX xlC?) may need some other optimization setting.  In
-any case, re-run the test after re-building UnZip, to verify that the
-program is behving properly.
+   Other compilers (AIX xlC?) may need some other optimization setting.
+In any case, re-run the test after re-building UnZip, to verify that the
+program is behaving properly.
 
    We would be grateful to receive reports describing environments where
-this problem occurs.
+this problem occurs, or GCC versions which work correctly in the
+environments where trouble was expected.
 
 ------------------------------------------------------------------------
diff --git a/ToDo b/ToDo
index c5c263b..427f56e 100644 (file)
--- a/ToDo
+++ b/ToDo
@@ -27,7 +27,7 @@ New stuff to be added to the main list (if not already there):
         Seems to be in 6.10b.
 - Look at extracting files with names larger than local OS limit (maybe
     by adding a truncation option.  (12 Jul 2010 EG, from forum thread
-    "Info-ZIP Bugs > UnZip Bugs > unzip archives with very long filenames")    
+    "Info-ZIP Bugs > UnZip Bugs > unzip archives with very long filenames")
 - Add compression method 98 (PPMd).  See the thread for references.  (12 Jul
     2010 EG, from forum thread "Info-ZIP Bugs > UnZip Bugs > unsupported
     compression method 98")
diff --git a/USexport_aes_wg.msg b/USexport_aes_wg.msg
new file mode 100644 (file)
index 0000000..53e7be9
--- /dev/null
@@ -0,0 +1,21 @@
+To: crypt (at) bis.doc.gov, enc (at) nsa.gov, web_site (at) bis.doc.gov
+Cc: Info-ZIP-Dev (at) goatley.com
+Subject: TSU NOTIFICATION - Encryption (Info-ZIP iz_aes_wg.zip)
+Date: Nov 5, 2015 2:38 AM
+
+   SUBMISSION TYPE:       TSU
+   SUBMITTED BY:          Edward Gordon
+   SUBMITTED FOR:         The Info-ZIP group (an informal, Internet-based
+                          collection of software developers with the contact
+                          address given in next item)
+   POINT OF CONTACT:      Info-ZIP-Dev (at) goatley.com
+   PHONE and/or FAX:      n/a
+   MANUFACTURER:          n/a
+   PRODUCT NAME/MODEL #:  iz_aes_wg
+   ECCN:                  5D002
+
+   NOTIFICATION:
+
+           ftp://ftp.info-zip.org/pub/infozip/crypt/iz_aes_wg.zip
+
+
diff --git a/USexport_zcrypt.msg b/USexport_zcrypt.msg
new file mode 100644 (file)
index 0000000..e76584d
--- /dev/null
@@ -0,0 +1,20 @@
+To: crypt (at) bis.doc.gov, enc (at) nsa.gov, web_site (at) bis.doc.gov
+Cc: Info-ZIP-Dev (at) goatley.com
+Subject: TSU NOTIFICATION - Encryption (Info-ZIP zcrypt.zip)
+Date: Nov 5, 2015 2:34 AM
+
+   SUBMISSION TYPE:       TSU
+   SUBMITTED BY:          Edward Gordon
+   SUBMITTED FOR:         The Info-ZIP group (an informal, Internet-based
+                          collection of software developers with the contact
+                          address given in next item)
+   POINT OF CONTACT:      Info-ZIP-Dev (at) goatley.com
+   PHONE and/or FAX:      n/a
+   MANUFACTURER:          n/a
+   PRODUCT NAME/MODEL #:  zcrypt
+   ECCN:                  5D002
+
+   NOTIFICATION:
+
+           ftp://ftp.info-zip.org/pub/infozip/crypt/zcrypt.zip
+
index 0c6bd8a..26f6d62 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1079,7 +1079,7 @@ void version(__G)
 
       " (Acorn Computers Ltd)",
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
diff --git a/aes_wg/README_AES_WG.txt b/aes_wg/README_AES_WG.txt
deleted file mode 100644 (file)
index 54cb50a..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-                        README_AES_WG.txt
-                        -----------------
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-      Description
-      -----------
-
-   The Info-ZIP programs UnZip (version 6.1 and later) and Zip (version
-3.1 and later) offer optional support for Advanced Encryption Standard
-(AES) encryption, a relatively strong encryption method.  Traditional
-zip encryption, in contrast, is now considered weak and relatively easy
-to crack.  Our IZ_AES_WG (Info-ZIP AES WinZip/Gladman) source kit adds
-support for WinZip-compatible AES encryption, using AES encryption code
-supplied by Brian Gladman.  The WinZip AES scheme is described in:
-
-      http://www.winzip.com/aes_info.htm
-
-Briefly, the WinZip AES scheme uses compression method 99 to flag the
-AES-encrypted entries.  (In contrast, PKZIP AES encryption uses an
-incompatible scheme with different archive data structures.  However,
-current versions of PKZIP may also be able to process WinZip AES
-encrypted archive entries.)
-
-   Our AES implementation supports 128-, 192-, and 256-bit keys.  See
-the various discussions of WinZip AES encryption on the Internet for
-more on the security of the WinZip AES encryption implementation.  We
-may add additional encryption methods in the future.
-
-   The IZ_AES_WG source kit is based on an AES source kit provided by
-Brian Gladman:
-
-      http://gladman.plushost.co.uk/oldsite/cryptography_technology/
-      fileencrypt/files.zip
-
-with one header file ("brg_endian.h") from a newer kit:
-
-      http://gladman.plushost.co.uk/oldsite/AES/aes-src-11-01-11.zip
-
-(Non-Windows users should use "unzip -a" when unpacking those kits.)
-
-   There are two main reasons we are providing essentially a repackaging
-of the Gladman AES code.  First, some minor changes were needed to
-improve its portability to different hardware and operating systems.
-Second, the version of Gladman code used, though recommended by WinZip,
-is relatively old and so not fully supported by Dr. Gladman.  We felt it
-necessary to capture this version of the Gladman AES code with our
-changes and make it available.  We are currently looking at newer
-versions of the Gladman AES code and may update our implementation in
-the future.
-
-   The portability-related changes to the original Gladman code include:
-
-      Use of <string.h> instead of <memory.h>.
-
-      Use of "brg_endian.h" for endian determination.
-
-      Changing "brg_endian.h" to work with GNU C on non-Linux systems,
-      and on SunOS 4.x systems.
-
-      #include <limits.h> instead of "limits.h" in aes.h.
-
-      Changing some "long" types to "int" or "sha1_32t" in hmac.c and
-      hmac.h to accommodate systems (like Mac OS X on Intel) where a
-      64-bit "long" type caused bad results.
-
-Comments in the code identify the changes.  (Look for "Info-ZIP".)  The
-original files are preserved in an "orig" subdirectory, for reference.
-
-   The name "IZ_AES_WG" (Info-ZIP AES WinZip/Gladman) is used by
-Info-ZIP to identify our implementation of WinZip AES encryption of Zip
-entries, using encryption code supplied by Dr. Gladman.  WinZip is a
-registered trademark of WinZip International LLC.  PKZIP is a registered
-trademark of PKWARE, Inc.
-
-   The source code files from Dr. Gladman are subject to the LICENSE
-TERMS at the top of each source file.  The entire IZ_AES_WG kit is
-provided under the Info-ZIP license, a copy of which is included in
-LICENSE.txt.  The latest version of the Info-ZIP license should be
-available at:
-
-      http://www.info-zip.org/license.html
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-      Building UnZip and Zip with AES_WG Encryption Support
-      -----------------------------------------------------
-
-   First, obtain the IZ_AES_WG source kit, which is packaged separately
-from the basic UnZip and Zip source kits.  For example, on the Info-ZIP
-FTP server, the IZ_AES_WG source kit should be found in:
-
-      ftp://ftp.info-zip.org/pub/infozip/crypt/
-
-The latest kit should be:
-
-      ftp://ftp.info-zip.org/pub/infozip/crypt/iz_aes_wg.zip
-
-however, different UnZip and Zip versions may need particular IZ_AES_WG
-kit versions, so, before downloading a particular IZ_AES_WG source kit,
-it would be best to consult the INSTALL files in the UnZip and Zip
-source kits, and the the Version History section of the current version
-of this document:
-
-      ftp://ftp.info-zip.org/pub/infozip/crypt/README_AES_WG.txt
-
-   The build instructions (INSTALL) in the UnZip and Zip source kits
-describe how to unpack the IZ_AES_WG source kit, and how to build UnZip
-and Zip with AES_WG encryption.
-
-   The UnZip and Zip README files have additional general information on
-AES encryption, and the UnZip and Zip manual pages provide the details
-on how to use AES encryption.
-
-   Be aware that some countries or jurisdictions may restrict who may
-download and use strong encryption source code and binaries.
-Prospective users are responsible for determining whether they are
-legally allowed to download and use this encryption software.
-
-   Note that many of the servers that distribute Info-ZIP software are
-situated in the United States.  See the latest version of file
-USexport_AES_WG.msg for information regarding export from the US.
-Downloads of Info-ZIP encryption software are subject to the limitations
-noted.
-
-      ftp://ftp.info-zip.org/pub/infozip/crypt/USexport_AES_WG.msg
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-      Acknowledgements
-      ----------------
-
-   We're grateful to Dr. Gladman for providing the AES encryption code.
-Any problems involving AES_WG encryption in Info-ZIP programs should be
-reported to the Info-ZIP team, not to Dr. Gladman.  However, any questions
-on AES encryption or decryption algorithms, or regarding Gladman's code
-(except as we modified and use it) should be addressed to Dr. Gladman.
-
-   We're grateful to WinZip for making the WinZip AES specification
-available, and providing the detailed information needed to implement
-it.
-
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-      IZ_AES_WG Version History
-      -------------------------
-
-      1.4  2015-03-23  Changed "long" types to "int" for counters, and
-                       to "sha1_32t" for apparent 32-bit byte groups,
-                       where a 64-bit "long" type caused bad results (on
-                       Mac OS X, Intel).  (hmac.c, hmac.h) [SMS]
-      1.3  2013-11-18  Renamed USexport.msg to USexport_AES_WG.msg to
-                       distinguish it from the Traditional encryption
-                       notice, USexport.msg.  [SMS]
-      1.2  2013-04-12  Avoid <sys/isa_defs.h> on __sun systems with
-                       __sparc defined (for SunOS 4.x).  (brg_endian.h)
-                       [SMS]
-      1.1  2012-12-31  #include <limits.h> instead of "limits.h" in
-                       aes.h (for VAX C).  [SMS]
-      1.0  2011-07-07  Minor documentation changes.  [SMS, EG]
-                       Compatible with UnZip 6.10 and Zip 3.1.
-                       US Department of Commerce BIS notified.
-      0.5  2011-07-07  Minor documentation changes.  [SMS, EG]
-                       Compatible with UnZip 6.10 and Zip 3.1.
-      0.4  2011-06-25  Minor documentation changes.  [SMS, EG]
-                       Compatible with UnZip 6.10 and Zip 3.1.
-      0.3  2011-06-22  Initial beta version.  [SMS, EG]
-      0.2  2011-06-20  Minor documentation updates.  [EG]
-      0.1  2011-06-17  Initial alpha version.  [SMS]
-
index a4ab3e5..9a9ef91 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2014 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1001,19 +1001,19 @@ void version(__G)
 # endif
 #endif
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
   sprintf(buf4," on %s",__DATE__);
 #else
-  strcpy(buf4," unknown date");
+  strcpy(buf4,"");
 #endif
 
-/******
-#ifdef __TIME__
+#if 0
+#if defined( __TIME__) && !defined( NO_BUILD_DATE)
   sprintf(buf5," at %s",__TIME__);
 #else
-  strcpy(buf5," unknown time");
+  strcpy(buf5,"");
 #endif
-******/
+#endif /* 0 */
 
 /* Print strings using "CompiledWith" mask defined in unzip.c (used by all).
  *  ("Compiled with %s%s for %s%s%s%s.")
index 9f427a6..77eb2d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2014 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1321,7 +1321,7 @@ void version(__G)
 #endif /* Sun */
 #endif /* SGI */
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index f6efdf9..d339982 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1003,7 +1003,7 @@ void version(__G)
 
       " (Atari ST/TT/Falcon030)",
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index be26f16..0f216e0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1227,7 +1227,7 @@ void version(__G)
       " (unknown platform)",
 #endif
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index b9ad805..b6b6cf9 100644 (file)
 
 #ifdef ICONV_MAPPING
 
-# define MAX_CP_NAME 25 
-   
+# define MAX_CP_NAME 25
+
 # ifdef SETLOCALE
 #  undef SETLOCALE
 # endif
 # define SETLOCALE(category, locale) setlocale(category, locale)
 # include <locale.h>
-   
+
 # ifdef _ISO_INTERN
 #  undef _ISO_INTERN
 # endif
index 0511949..b14b0bc 100644 (file)
@@ -1279,7 +1279,7 @@ void version(__G)
 # endif
 #endif
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
diff --git a/crypt.c b/crypt.c
index 6c31847..05dc8a8 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -121,20 +121,20 @@ local z_uint4 keys[3];          /* keys defining the pseudo-random sequence */
 #  endif
 # endif
 
-# ifdef IZ_CRYPT_TRAD
-
-#  include "crc32.h"
+# include "crc32.h"
 
-#  ifdef IZ_CRC_BE_OPTIMIZ
+# ifdef IZ_CRC_BE_OPTIMIZ
 local z_uint4 near crycrctab[256];
 local z_uint4 near *cry_crctb_p = NULL;
 local z_uint4 near *crytab_init OF((__GPRO));
-#   define CRY_CRC_TAB  cry_crctb_p
-#   undef CRC32
-#   define CRC32(c, b, crctab) (crctab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
-#  else
-#   define CRY_CRC_TAB  CRC_32_TAB
-#  endif /* ?IZ_CRC_BE_OPTIMIZ */
+#  define CRY_CRC_TAB  cry_crctb_p
+#  undef CRC32
+#  define CRC32(c, b, crctab) (crctab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
+# else /* def IZ_CRC_BE_OPTIMIZ */
+#  define CRY_CRC_TAB  CRC_32_TAB
+# endif /* def IZ_CRC_BE_OPTIMIZ [else] */
+
+# ifdef IZ_CRYPT_TRAD
 
 /***********************************************************************
  * Return the next byte in the pseudo-random sequence
@@ -150,6 +150,7 @@ int decrypt_byte(__G)
     return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
 }
 
+
 /***********************************************************************
  * Update the encryption keys with the next byte of plain text
  */
@@ -265,6 +266,8 @@ void crypthead(passwd, crc)
 
 
 /***********************************************************************
+ * zfwrite - write out buffer to file with encryption and byte counts
+ *
  * If requested, encrypt the data in buf, and in any case call bfwrite()
  * with the arguments to zfwrite().  Return what bfwrite() returns.
  * bfwrite() keeps byte counts, does splits, and calls fwrite() to
@@ -273,12 +276,14 @@ void crypthead(passwd, crc)
  * A bug has been found when encrypting large files that don't
  * compress.  See trees.c for the details and the fix.
  */
-unsigned zfwrite(buf, item_size, nb)
+unsigned int zfwrite(buf, item_size, nb)
     zvoid *buf;                 /* data buffer */
     extent item_size;           /* size of each item in bytes */
     extent nb;                  /* number of items */
 {
+#ifdef IZ_CRYPT_TRAD
     int t;                      /* temporary */
+#endif
 
     if (key != (char *)NULL)    /* key is the global password pointer */
     {
@@ -296,7 +301,7 @@ unsigned zfwrite(buf, item_size, nb)
         char *p = (char *)buf;  /* steps through buffer */
 
         /* Encrypt data in buffer */
-        for (size = item_size*(ulg)nb; size != 0; p++, size--)
+        for (size = (ulg)item_size*(ulg)nb; size != 0; p++, size--)
         {
             *p = (char)zencode(*p, t);
         }
@@ -309,7 +314,7 @@ unsigned zfwrite(buf, item_size, nb)
     }
 
     /* Write the buffer out */
-    return bfwrite(buf, item_size, nb, BFWRITE_DATA);
+    return (unsigned int)bfwrite(buf, item_size, nb, BFWRITE_DATA);
 }
 
 
@@ -585,6 +590,8 @@ int zipcloak(z, passwd)
     /* read the local header */
     res = readlocal(&localz, z);
 
+    /* readlocal() has already set localz->thresh_mthd = localz->how. */
+
     /* Update (assumed only one) disk.  Caller is responsible for offset. */
     z->dsk = 0;
 
@@ -733,12 +740,14 @@ int zipbare(z, passwd)
 #   ifdef ZIP10
     int c0                /* byte preceding the last input byte */
 #   endif
+#   ifdef IZ_CRYPT_TRAD
     int c1;               /* last input byte */
+    int b;                /* bytes in buffer */
+#   endif
     /* all file offset and size now zoff_t - 8/28/04 EG */
     zoff_t size;          /* size of input data */
     struct zlist far *localz; /* local header */
     uch buf[1024];        /* write buffer */
-    int b;                /* bytes in buffer */
     zoff_t z_siz;
     int passwd_ok;
     int r;                /* size of encryption header */
@@ -759,9 +768,27 @@ int zipbare(z, passwd)
 #    define HEAD_LEN RAND_HEAD_LEN      /* Constant trad. header length. */
 #   endif /* def IZ_CRYPT_AES_WG [else] */
 
+    ush vers = 0;               /* AES encryption version (1 or 2). */
+    ush vend = 0;               /* AES encryption vendor (should be "AE" (LE: x4541)). */
+    zoff_t pos_local = 0;       /* Local header position. */
+    zoff_t pos = 0;             /* End data position. */
+#   if defined(IZ_CRYPT_AES_WG) || defined(IZ_CRYPT_AES_WG_NEW)
+    ulg crc;                    /* To calculate CRC. */
+#   endif
+
     /* Read local header. */
     res = readlocal(&localz, z);
 
+    /* 2015-05-23  EG.
+     * Some work is needed to let crypt support Zip splits.  It also
+     * requires coordination with UnZip, which does not yet support
+     * splits, but that is also in the works.  As crypt is caught in the
+     * middle, some more work is needed to coordinate that multi-part
+     * implementation with what Zip does and somehow get crypt to
+     * support Zip, UnZip, and ZipCloak splits.  Both zipbare() and
+     * zipcloak() need modifications.
+     */
+
     /* Update (assumed only one) disk.  Caller is responsible for offset. */
     z->dsk = 0;
 
@@ -772,8 +799,8 @@ int zipbare(z, passwd)
     if (how_orig == AESENCRED)
     {
         /* Extract the AES encryption details from the local extra field. */
-        ef_scan_for_aes( (uch *)localz->extra, localz->ext,
-         NULL, NULL, &aes_mode, &aes_mthd);
+        ef_scan_for_aes((uch *)localz->extra, localz->ext,
+                        &vers, &vend, &aes_mode, &aes_mthd);
 
         if ((aes_mode > 0) && (aes_mode <= 3))
         {
@@ -783,6 +810,7 @@ int zipbare(z, passwd)
         else
         {
             /* Unexpected/invalid AES mode value. */
+            zipwarn("invalid AES mode", "");
             return ZE_CRYPT;
         }
 
@@ -870,11 +898,21 @@ int zipbare(z, passwd)
     localz->flg = z->flg &= ~9;         /* Clear the encryption and */
     z->lflg = localz->lflg &= ~9;       /* data-descriptor flags. */
 
+    /* Use correct CRC from central.  This is zero if AE-2, in which
+     * case we need to recalculate the CRC.
+     */
+    localz->crc = z->crc;
+
+    /* readlocal() has already set localz->thresh_mthd = localz->how.
+     * If AES, then code below revises these.
+     */
+
 #   ifdef IZ_CRYPT_AES_WG
     if (how_orig == AESENCRED)
     {
         localz->how = aes_mthd; /* Set the compression method value(s) */
         z->how = aes_mthd;      /* to the value from the AES extra block. */
+        z->thresh_mthd = aes_mthd;
 
         /* Subtract the MAC size from the compressed size(s). */
         localz->siz -= MAC_LENGTH( aes_mode);
@@ -905,6 +943,8 @@ int zipbare(z, passwd)
     }
 #   endif /* def IZ_CRYPT_AES_WG */
 
+    pos_local = zftello(y);
+
     /* Put out the (modified) local extra field. */
     if ((res = putlocal(localz, PUTLOCAL_WRITE)) != ZE_OK)
         return res;
@@ -918,15 +958,24 @@ int zipbare(z, passwd)
          * z->siz = new (decrypted) compressed size (bytes to write).
          */
         nout = 0;
+        if (vers == AES_WG_VEND_VERS_AE2) {
+            /* CRC is set to zero for AE-2, so we need to calculate it
+             * to update the decrypted entry.
+             */
+            crc = CRCVAL_INITIAL;
+        }
         for (size = z_siz; (size > 0) && (nout < z->siz);)
         {
-            nn = IZ_MIN( sizeof( buf), size);
+            nn = IZ_MIN( sizeof(buf), (size_t)size);
             n = fread( buf, 1, nn, in_file);
             if (n == nn)
             {
                 fcrypt_decrypt( buf, n, &zctx);
-                n = IZ_MIN( n, (z->siz - nout));
+                n = IZ_MIN( n, (size_t)(z->siz - nout));
                 bfwrite( buf, 1, n, BFWRITE_DATA);
+                if (vers == 2) {
+                    crc = crc32(crc, (uch *)buf, n);
+                }
                 nout += n;      /* Bytes written. */
             }
             else
@@ -935,6 +984,24 @@ int zipbare(z, passwd)
             }
             size -= nn;         /* Bytes left to read. */
         }
+        if (vers == AES_WG_VEND_VERS_AE2) {
+            /* We need to update the local header only if AE-2 to
+             * replace the missing CRC.
+             */
+            localz->crc = z->crc = crc;
+            /* Update local extra field. */
+            pos = zftello(y);
+            if (zfseeko(y, pos_local, SEEK_SET)) {
+                zipwarn("output seek back failed", "");
+                return ZE_WRITE;
+            }
+            if ((res = putlocal(localz, PUTLOCAL_REWRITE)) != ZE_OK)
+                return res;
+            if (zfseeko(y, pos, SEEK_SET)) {
+                zipwarn("output seek forward failed", "");
+                return ZE_WRITE;
+            }
+        }
     }
     else /* if (how_orig == AESENCRED) */
     {
diff --git a/crypt.h b/crypt.h
index d81bda2..7838d34 100644 (file)
--- a/crypt.h
+++ b/crypt.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2014 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-2 or later
   (the contents of which are also included in zip.h) for terms of use.
 #   include "aes_wg/fileenc.h"
 #  endif /* def IZ_CRYPT_AES_WG */
 
+/* Transpose the following blocks to select beta/non-beta release.
+ * (Last one wins.)
+ */
+#  ifdef CR_BETA
+#   undef CR_BETA       /* This is not a beta release. */
+#  endif
+
 #  ifndef CR_BETA
 #   define CR_BETA      /* This is a beta release. */
 #  endif
 
-#  ifdef CR_BETA
-#   undef CR_BETA       /* This is not a beta release. */
-#  endif
 
 #  define CR_MAJORVER        3
 #  define CR_MINORVER        0
 #  ifdef CR_BETA
-#   define CR_BETA_VER      "k BETA"
-#   define CR_VERSION_DATE  "01 Oct 2014"       /* Last real code change. */
+#   define CR_BETA_VER      "l BETA"
+#   define CR_VERSION_DATE  "24 Aug 2014"       /* Last real code change. */
 #  else
 #   define CR_BETA_VER      ""
-#   define CR_VERSION_DATE  "01 Oct 2014"       /* Last public release date. */
+#   define CR_VERSION_DATE  "24 Aug 2014"       /* Last public release date. */
 #   define CR_RELEASE
 #  endif
 
@@ -167,7 +171,8 @@ int zipcloak OF((struct zlist far *, ZCONST char *));
 int zipbare OF((struct zlist far *, ZCONST char *));
 #   else /* def UTIL */
 unsigned zfwrite OF((zvoid *, extent, extent));
-extern char *key;
+extern char *key;               /* Encryption key. */
+extern char *passwd;            /* Password before keyfile content added. */
 #   endif /* def UTIL [else] */
 #  endif /* def ZIP */
 
index 6897b9a..72a191a 100644 (file)
--- a/expand.c
+++ b/expand.c
@@ -1,20 +1,20 @@
 /* Info-ZIP version 1.0 */
 
-/* 
+/*
  * expand (unreduce)
  *
  * Written by Peter Backes, 2012
  * Public Domain
  *
- * This is a free replacement for "[t]he last chunk of code in UnZip 
+ * This is a free replacement for "[t]he last chunk of code in UnZip
  * that was blatantly derived from Sam Smith's unzip 2.0."  The reduce
  * algorithm was used only by PKZIP 0.90 and 0.92.  To enable unreducing
  * capability, define USE_UNREDUCE_PUBLIC (for example, by specifying
  * LOCAL_UNZIP=-DUSE_UNREDUCE_PUBLIC to the Makefile).
  *
- * reduce was rarely ever used, and, in fact, the PKZIP 0.90 and 0.92 
- * self-extracting distributions themselves (PKZ090.EXE and PKZ092.EXE) 
- * are the only easy to find files that actually make use of it.  So 
+ * reduce was rarely ever used, and, in fact, the PKZIP 0.90 and 0.92
+ * self-extracting distributions themselves (PKZ090.EXE and PKZ092.EXE)
+ * are the only easy to find files that actually make use of it.  So
  * this file might be handy only if you are into computer archeology and
  * old software archives.
  *
  *     NOTE: unreduce may or may not infinge or have been covered or
  *     be covered anytime in the future by patent restoration, by
  *     US patent 4,612,532, "Data compression apparatus and method,"
- *     inventor Bacon, assignee Telebyte Corportion, filed Jun. 19, 
+ *     inventor Bacon, assignee Telebyte Corportion, filed Jun. 19,
  *     1984, granted Sep. 16, 1986 (see compression-faq, section 7).
  *
- *     ALL LIABILITY FOR USE OF THIS CODE IN VIOLATION OF APPLICABLE 
+ *     ALL LIABILITY FOR USE OF THIS CODE IN VIOLATION OF APPLICABLE
  *     PATENT LAW IS HEREBY DISCLAIMED.
  *
  */
@@ -43,7 +43,7 @@
 #define UNZIP_INTERNAL
 #include "unzip.h"
 
-/* extend most significant bit to the right, at most one char, set 
+/* extend most significant bit to the right, at most one char, set
  * least significant extended bit to 1
  */
 #define M_EXTR1C(j) (((j) | (j) >> 1) | ((j) | (j) >> 1) >> 2 \
@@ -53,7 +53,7 @@
 #define M_L2C(n) ((unsigned int)(05637042010L >> ((((n) % 11) - 1) * 3)) & 7)
 
 #define LMASK 0x0f1f3f7f
-/* function L(X): masks out the lower (8-CF) bits of X, where 
+/* function L(X): masks out the lower (8-CF) bits of X, where
  * CF = compression factor
  */
 #define M_L(cf,x) (LMASK >> ((cf-1)<<3)  &  (x))
@@ -94,7 +94,7 @@ int unreduce(__G)
        /* get follower sets */
        for (i = 0; i < sizeof *f_n / sizeof **f_n; i++) {
                int m, j = 255 - i;
-               XREADBITS(M_L2C(sizeof **f_s / sizeof ***f_s) + 1, 
+               XREADBITS(M_L2C(sizeof **f_s / sizeof ***f_s) + 1,
                        (*f_n)[j],return PK_OK)
                Trace((stderr, "N(%d) = %d, S(%d) = {", j, (*f_n)[j], j));
                if ((*f_n)[j] > 32)
@@ -120,7 +120,7 @@ int unreduce(__G)
                                Trace((stderr, "1 => %d", lc));
                        } else {
                                XREADBITS(M_B((*f_n)[lc]), code, break)
-                               Trace((stderr, "0 %d %d ", 
+                               Trace((stderr, "0 %d %d ",
                                        M_B((*f_n)[lc]), code));
                                if (code >= (*f_n)[lc])
                                        break;
@@ -138,7 +138,7 @@ int unreduce(__G)
                                rest--;
                                Trace((stderr, "%d/%d", outpos, SWSIZE));
                                if (outpos == SWSIZE) {
-                                       if ((error = flush(__G__ slide, 
+                                       if ((error = flush(__G__ slide,
                                                        (ulg)SWSIZE, 0)))
                                                return error;
                                        outpos = 0;
@@ -158,7 +158,7 @@ int unreduce(__G)
                                slide[outpos++] = DLE;
                                rest--;
                                if (outpos == SWSIZE) {
-                                       if ((error = flush(__G__ slide, 
+                                       if ((error = flush(__G__ slide,
                                                        (ulg)SWSIZE, 0)))
                                                return error;
 
@@ -188,7 +188,7 @@ int unreduce(__G)
                                        while (outpos < SWSIZE)
                                                slide[outpos++]
                                                        = slide[backptr++];
-                                       if ((error = flush(__G__ slide, 
+                                       if ((error = flush(__G__ slide,
                                                        (ulg)SWSIZE, 0)))
                                                return error;
                                        outpos = 0;
@@ -203,12 +203,12 @@ int unreduce(__G)
                                while (outpos < SWSIZE)
                                        slide[outpos++]
                                                = slide[backptr++];
-                               if ((error = flush(__G__ slide, 
+                               if ((error = flush(__G__ slide,
                                                (ulg)SWSIZE, 0)))
                                        return error;
                                outpos = 0;
                        }
-                       while (len-- > 0) 
+                       while (len-- > 0)
                                slide[outpos++]
                                        = slide[backptr++];
 
index a6e4a02..4a5e8cd 100644 (file)
--- a/extract.c
+++ b/extract.c
@@ -144,12 +144,12 @@ static int UZppmd OF((__GPRO));
 /*******************************/
 
 static ZCONST char Far VersionMsg[] =
-  "   skipping: %-22s  need %s compat. v%u.%u (can do v%u.%u)\n";
+  "   skipping: %-22s   need %s compat. v%u.%u (can do v%u.%u)\n";
 static ZCONST char Far ComprMsgNum[] =
-  "   skipping: %-22s  unsupported compression method %u\n";
+  "   skipping: %-22s   unsupported compression method: %u\n";
 #ifndef SFX
    static ZCONST char Far ComprMsgName[] =
-     "   skipping: %-22s  `%s' method not supported\n";
+     "   skipping: %-22s   unsupported compression method: %s\n";
    static ZCONST char Far CmprNone[]       = "store";
    static ZCONST char Far CmprShrink[]     = "shrink";
    static ZCONST char Far CmprReduce[]     = "reduce";
@@ -157,15 +157,15 @@ static ZCONST char Far ComprMsgNum[] =
    static ZCONST char Far CmprTokenize[]   = "tokenize";
    static ZCONST char Far CmprDeflate[]    = "deflate";
    static ZCONST char Far CmprDeflat64[]   = "deflate64";
-   static ZCONST char Far CmprDCLImplode[] = "DCL implode";
+   static ZCONST char Far CmprDCLImplode[] = "DCL_implode";
    static ZCONST char Far CmprBzip[]       = "bzip2";
    static ZCONST char Far CmprLZMA[]       = "LZMA";
-   static ZCONST char Far CmprIBMTerse[]   = "IBM/Terse";
-   static ZCONST char Far CmprIBMLZ77[]    = "IBM LZ77";
+   static ZCONST char Far CmprIBMTerse[]   = "IBM_Terse";
+   static ZCONST char Far CmprIBMLZ77[]    = "IBM_LZ77";
    static ZCONST char Far CmprJPEG[]       = "JPEG";
    static ZCONST char Far CmprWavPack[]    = "WavPack";
    static ZCONST char Far CmprPPMd[]       = "PPMd";
-   static ZCONST char Far CmprAES[]        = "AES_WG encr";
+   static ZCONST char Far CmprAES[]        = "AES_WG(encr)";
    static ZCONST char Far *ComprNames[NUM_METHODS] = {
      CmprNone, CmprShrink, CmprReduce, CmprReduce, CmprReduce, CmprReduce,
      CmprImplode, CmprTokenize, CmprDeflate, CmprDeflat64, CmprDCLImplode,
@@ -354,8 +354,9 @@ static ZCONST char Far Inflate[] = "inflate";
      "warning:  %s is probably truncated\n";
 #endif
 
-static ZCONST char Far FileUnknownCompMethod[] =
-  "%s:  unknown compression method\n";
+static ZCONST char Far UnknownCmprMthdFile[] =
+  "%s:  unknown compression method: %d\n";
+
 static ZCONST char Far BadCRC[] = " bad CRC %08lx  (should be %08lx)\n";
 
 /* TruncEAs[] also used in os2/os2.c:[close_outfile(), mapname()]. */
@@ -381,7 +382,7 @@ ZCONST char Far TruncNTSD[] =
    static ZCONST char Far UnsuppNTSDVersEAs[] =
      " unsupported NTSD EAs version %d\n";
    static ZCONST char Far BadCRC_EAs[] = " bad CRC for extended attributes\n";
-   static ZCONST char Far UnknComprMethodEAs[] =
+   static ZCONST char Far UnknownCmprMthdEA[] =
      " unknown compression method for EAs (%u)\n";
    static ZCONST char Far NotEnoughMemEAs[] =
      " out of memory while inflating EAs\n";
@@ -950,7 +951,7 @@ static int TestExtraField(__G__ ef_buf, ef_len)
                                      LoadFarString(BadCRC_EAs)));
                                 else
                                     Info(slide, 1, ((char *)slide,
-                                     LoadFarString(UnknComprMethodEAs), m));
+                                     LoadFarString(UnknownCmprMthdEA), m));
                             }
                             break;
                     }
@@ -1008,7 +1009,7 @@ static int TestExtraField(__G__ ef_buf, ef_len)
                                      LoadFarString(BadCRC_EAs)));
                                 else
                                     Info(slide, 1, ((char *)slide,
-                                     LoadFarString(UnknComprMethodEAs), m));
+                                     LoadFarString(UnknownCmprMthdEA), m));
                             }
                             break;
                     }
@@ -1376,86 +1377,130 @@ static int extract_dest_dir( __G)       /* Return PK-type error code. */
  * Store (0) is always allowed.
  * Currently, Implode (6) is allowed for non-SFX.
  */
-#ifdef LZW_CLEAN                /* Shrink (1) not allowed. */
-# define UNKN_SHR (G.crec.compression_method == SHRUNK)
+#ifdef LZW_CLEAN                        /* Shrink (1) not allowed. */
+# define UNKN_SHR( mthd) (mthd == SHRUNK)
 #else
-# define UNKN_SHR  FALSE        /* Shrink (1) allowed. */
+# define UNKN_SHR( mthd) FALSE          /* Shrink (1) allowed. */
 #endif
 
 #if !defined( USE_UNREDUCE_PUBLIC) && !defined( USE_UNREDUCE_SMITH)
-                                /* Reduce (2-5) not allowed. */
-# define UNKN_RED (G.crec.compression_method >= REDUCED1 && \
-                      G.crec.compression_method <= REDUCED4)
+                                        /* Reduce (2-5) not allowed. */
+# define UNKN_RED( mthd) (mthd >= REDUCED1 && mthd <= REDUCED4)
 #else
-# define UNKN_RED  FALSE        /* Reduce (2-5) allowed. */
+# define UNKN_RED( mthd) FALSE          /* Reduce (2-5) allowed. */
 #endif
 
-#ifdef SFX                      /* Implode should have its own macro. */
-# define UNKN_IMPL (G.crec.compression_method == IMPLODED)
+#ifdef SFX                              /* Implode should have its own macro. */
+# define UNKN_IMPL( mthd) (mthd == IMPLODED)
 #else
-# define UNKN_IMPL FALSE        /* Implode (6) allowed. */
+# define UNKN_IMPL( mthd) FALSE         /* Implode (6) allowed. */
 #endif
 
-                                /* Tokenize (7) not allowed. */
-#define UNKN_TOKN (G.crec.compression_method == TOKENIZED)
+                                        /* Tokenize (7) not allowed. */
+#define UNKN_TOKN( mthd) (mthd == TOKENIZED)
 
 #ifdef DEFLATE_SUPPORT
-# define UNKN_DEFL FALSE        /* Deflate (8) allowed. */
+# define UNKN_DEFL( mthd) FALSE         /* Deflate (8) allowed. */
 #else
-# define UNKN_DEFL (G.crec.compression_method == DEFLATED)
+# define UNKN_DEFL( mthd) (mthd == DEFLATED)
 #endif
 
 #if defined( DEFLATE_SUPPORT) && defined( DEFLATE64_SUPPORT)
-# define UNKN_DEFL64 FALSE      /* Deflate64 (9) allowed. */
+# define UNKN_DEFL64( mthd) FALSE       /* Deflate64 (9) allowed. */
 #else
-# define UNKN_DEFL64 (G.crec.compression_method == ENHDEFLATED)
+# define UNKN_DEFL64( mthd) (mthd == ENHDEFLATED)
 #endif
 
 /* Assume that compression methods above Deflate64 (ENHDEFLATED = 9) are
  * not allowed, unless an UNKN_xxxx exception is false.
  */
 #ifdef IZ_CRYPT_AES_WG
-# define UNKN_AES_WG (G.crec.compression_method != AESENCRED)
+# define UNKN_AES_WG( mthd) (mthd != AESENCRED)
 #else
-# define UNKN_AES_WG TRUE       /* AES_WG (99) unknown. */
+# define UNKN_AES_WG( mthd) TRUE        /* AES_WG (99) unknown. */
 #endif
 
 #ifdef BZIP2_SUPPORT
-# define UNKN_BZ2 (G.crec.compression_method != BZIPPED)
+# define UNKN_BZ2( mthd) (mthd != BZIPPED)
+#else
+# define UNKN_BZ2( mthd) TRUE           /* Bzip2 (12) unknown. */
+#endif
+
+#ifdef JPEG_SUPPORT
+# define UNKN_JPEG( mthd) (mthd != JPEGED)
 #else
-# define UNKN_BZ2 TRUE          /* Bzip2 (12) unknown. */
+# define UNKN_JPEG( mthd) TRUE          /* JPEG (96) unknown */
 #endif
 
 #ifdef LZMA_SUPPORT
-# define UNKN_LZMA (G.crec.compression_method != LZMAED)
+# define UNKN_LZMA( mthd) (mthd != LZMAED)
 #else
-# define UNKN_LZMA TRUE         /* LZMA (14) unknown */
+# define UNKN_LZMA( mthd) TRUE          /* LZMA (14) unknown */
 #endif
 
 #ifdef PPMD_SUPPORT
-# define UNKN_PPMD (G.crec.compression_method != PPMDED)
+# define UNKN_PPMD( mthd) (mthd != PPMDED)
 #else
-# define UNKN_PPMD TRUE         /* PPMd (98) unknown */
+# define UNKN_PPMD( mthd) TRUE          /* PPMd (98) unknown */
 #endif
 
 #ifdef WAVP_SUPPORT
-# define UNKN_WAVP (G.crec.compression_method != WAVPACKED)
+# define UNKN_WAVP( mthd) (mthd != WAVPACKED)
 #else
-# define UNKN_WAVP TRUE         /* WavPack (97) unknown */
+# define UNKN_WAVP( mthd) TRUE          /* WavPack (97) unknown */
 #endif
 
-#define UNKN_COMPR \
- ((UNKN_DEFL || UNKN_DEFL64 || UNKN_IMPL || UNKN_RED || \
- UNKN_SHR || UNKN_TOKN) || \
- ((G.crec.compression_method > ENHDEFLATED) && \
- UNKN_AES_WG && UNKN_BZ2 && UNKN_LZMA && UNKN_PPMD && UNKN_WAVP))
+
+/******************************/
+/*  Function unkn_cmpr_mthd() */
+/******************************/
+
+static int unkn_cmpr_mthd( __G)
+  __GDEF
+{
+  /* Return 0: supported compression method
+   *        1: unsupported compression method
+   */
+  ush mthd;
+  int sts;
+
+  mthd = G.crec.compression_method;
+
+#ifdef IZ_CRYPT_AES_WG
+  if (mthd == AESENCRED)
+  {
+    /* Scan the (central) extra field for an AES block. */
+    sts = ef_scan_for_aes( G.extra_field,
+                           G.crec.extra_field_length,
+                           NULL,                        /* AES version. */
+                           NULL,                        /* AES vendor. */
+                           NULL,                        /* AES mode. */
+                           &G.pInfo->cmpr_mthd_aes);    /* AES method. */
+    if (sts == 1)
+    {
+      /* Found a valid AES_WG extra block.  Use its compression method. */
+      mthd = G.pInfo->cmpr_mthd_aes;
+    }
+  }
+#endif /* def IZ_CRYPT_AES_WG */
+
+  sts = ((UNKN_DEFL( mthd) || UNKN_DEFL64( mthd) || UNKN_IMPL( mthd) ||
+   UNKN_RED( mthd) || UNKN_SHR( mthd) || UNKN_TOKN( mthd)) ||
+   ((mthd > ENHDEFLATED) &&
+   (UNKN_AES_WG( mthd) && UNKN_BZ2( mthd) && UNKN_JPEG( mthd) &&
+    UNKN_LZMA( mthd) && UNKN_PPMD( mthd) && UNKN_WAVP( mthd))));
+
+  return sts;
+}
+
 
 /* UNZVERS_SUPPORT macro: Version Needed to Extract. */
+
 #if defined(BZIP2_SUPPORT) && (UNZIP_VERSION < UNZIP_BZIP2_VERS)
-    int unzvers_support = (UNKN_BZ2 ? UNZIP_VERSION : UNZIP_BZIP2_VERS);
-#   define UNZVERS_SUPPORT  unzvers_support
+#  define UNZVERS_SUPPORT( mthd) \
+     (UNKN_BZ2( mthd) ? UNZIP_VERSION : UNZIP_BZIP2_VERS)
 #else
-#   define UNZVERS_SUPPORT  UNZIP_VERSION
+#  define UNZVERS_SUPPORT( mthd) UNZIP_VERSION
 #endif
 
 
@@ -1489,27 +1534,40 @@ static int store_info(__G)      /* Return 0 if ok, non-zero if skipping. */
     }
 
     /* First, complain about an unsupported compression method. */
-    if (UNKN_COMPR) {
+    if (unkn_cmpr_mthd( __G))
+    {
+#ifdef IZ_CRYPT_AES_WG
+        ush mthd;
+
+        if (G.crec.compression_method == AESENCRED)
+          mthd = G.pInfo->cmpr_mthd_aes;
+        else
+          mthd = G.crec.compression_method;
+
+# define MTHD mthd
+#else /* def IZ_CRYPT_AES_WG */
+# define MTHD G.crec.compression_method
+#endif /* def IZ_CRYPT_AES_WG [else] */
+
         if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) {
 #ifndef SFX
             unsigned cmpridx;
 
-            if ((cmpridx = find_compr_idx(G.crec.compression_method))
-                < NUM_METHODS)
+            if ((cmpridx = find_compr_idx( MTHD)) < NUM_METHODS)
                 Info(slide, 0x401, ((char *)slide, LoadFarString(ComprMsgName),
                   FnFilter1(G.filename),
                   LoadFarStringSmall(ComprNames[cmpridx])));
             else
 #endif
                 Info(slide, 0x401, ((char *)slide, LoadFarString(ComprMsgNum),
-                  FnFilter1(G.filename),
-                  G.crec.compression_method));
+                  FnFilter1(G.filename), MTHD));
         }
         return 1;
     }
 
     /* Second, complain about an insufficient version number. */
-    if (G.crec.version_needed_to_extract[1] == VMS_) {
+    if (G.crec.version_needed_to_extract[1] == VMS_)
+    {
         if (G.crec.version_needed_to_extract[0] > VMS_UNZIP_VERSION) {
             if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)))
                 Info(slide, 0x401, ((char *)slide, LoadFarString(VersionMsg),
@@ -1529,13 +1587,15 @@ static int store_info(__G)      /* Return 0 if ok, non-zero if skipping. */
         }
 #endif /* ndef VMS */
     /* usual file type:  don't need VMS to extract */
-    } else if (G.crec.version_needed_to_extract[0] > UNZVERS_SUPPORT) {
+    }
+    else if (G.crec.version_needed_to_extract[0] > UNZVERS_SUPPORT( MTHD))
+    {
         if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)))
             Info(slide, 0x401, ((char *)slide, LoadFarString(VersionMsg),
               FnFilter1(G.filename), "PK",
               G.crec.version_needed_to_extract[0] / 10,
               G.crec.version_needed_to_extract[0] % 10,
-              UNZVERS_SUPPORT / 10, UNZVERS_SUPPORT % 10));
+              UNZVERS_SUPPORT( MTHD) / 10, UNZVERS_SUPPORT( MTHD) % 10));
         return 4;
     }
 
@@ -1826,7 +1886,7 @@ int aes_wg_prep( __G__ temp_cmpr_mthd_p, temp_sto_size_decr_p )
     /* Extract info from an AES extra block, if there is one. */
     /* Set mode negative.  (Valid values are positive.) */
     G.pInfo->cmpr_mode_aes = -1;
-    /* Scan the extra field for an AES block. */
+    /* Scan the (local) extra field for an AES block. */
     ef_scan_for_aes( G.extra_field,
                      G.lrec.extra_field_length,
                      &G.pInfo->cmpr_vers_aes,   /* AES version. */
@@ -1986,7 +2046,7 @@ static int detect_apl_dbl( __G)
           if (*G.pr_filename != '\0')
           {
             /* The previous normal file had its name replaced, so
-             * replace the name of this AppleDouble file name, too. 
+             * replace the name of this AppleDouble file name, too.
              * Without extra effort, the "renamed" flag will be
              * misleadingly FALSE for mapname() later, but the
              * preceding normal file should have paved the way by
@@ -2206,7 +2266,7 @@ void action_msg( __G__ action, flag)
 /* Note that the names "temp_compression_method" and
  * "temp_stored_size_decr" are used for local variables (and the related
  * macros REAL_COMPRESSION_METHOD and REAL_STORED_SIZE_DECR are used) in
- * multiple functions. 
+ * multiple functions.
  */
 #ifdef IZ_CRYPT_AES_WG
 #  define REAL_COMPRESSION_METHOD temp_compression_method
@@ -2681,9 +2741,10 @@ static int extract_or_test_member(__G)  /* return PK-type error code */
             break;
 #endif /* PPMD_SUPPORT */
 
-        default:   /* should never get to this point */
+        default:        /* Should never get here.  Bad unkn_cmpr_mthd()? */
             Info(slide, 0x401, ((char *)slide,
-              LoadFarString(FileUnknownCompMethod), FnFilter1(G.filename)));
+             LoadFarString(UnknownCmprMthdFile),
+             FnFilter1(G.filename), REAL_COMPRESSION_METHOD));
             /* close and delete file before return? */
             undefer_input(__G);
             return PK_WARN;
@@ -4718,8 +4779,9 @@ static int extract_or_test_entrylist(__G__ mbr_ndx,
             error_in_archive = error;   /* only PK_EOF defined */
             continue;   /* can still try next one */
         }
-        if ((error = do_string(__G__ G.lrec.filename_length, DS_FN_L)) !=
-             PK_COOL)
+
+        if ((error =
+         do_string(__G__ G.lrec.filename_length, DS_FN_L)) != PK_COOL)
         {
             if (error > error_in_archive)
                 error_in_archive = error;
@@ -4731,7 +4793,7 @@ static int extract_or_test_entrylist(__G__ mbr_ndx,
         }
 
         if ((error =
-             do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != 0)
+         do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != PK_COOL)
         {
             if (error > error_in_archive)
                 error_in_archive = error;
@@ -4850,6 +4912,7 @@ static int extract_or_test_entrylist(__G__ mbr_ndx,
         {
             continue;   /* Go on to the next member. */
         }
+
 #endif /* def IZ_CRYPT_AES_WG */
 
         if (REAL_COMPRESSION_METHOD == STORED)
@@ -4934,7 +4997,7 @@ static int extract_or_test_entrylist(__G__ mbr_ndx,
         {
           /* Skip this member.  We created a directory, or there was
            * some other member-terminal condition.
-           */ 
+           */
 #if defined( UNIX) && defined( __APPLE__)
           /* If we are doing special AppleDouble file processing, then
            * record the fact that we're skipping this member.
@@ -5104,8 +5167,8 @@ static int extract_or_test_entrylistw(__G__ mbr_ndx,
                 error_in_archive = PK_WARN;
         }
 # endif /* # if !defined(SFX) && defined(UNICODE_SUPPORT) */
-        if ((error = do_string(__G__ G.lrec.filename_length, DS_FN_L)) !=
-             PK_COOL)
+        if ((error =
+         do_string(__G__ G.lrec.filename_length, DS_FN_L)) != PK_COOL)
         {
             if (error > error_in_archive)
                 error_in_archive = error;
@@ -5130,7 +5193,7 @@ static int extract_or_test_entrylistw(__G__ mbr_ndx,
 # endif /* def DYNAMIC_WIDE_NAME [else] */
 
         if ((error =
-             do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != 0)
+         do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != PK_COOL)
         {
             if (error > error_in_archive)
                 error_in_archive = error;
@@ -5301,7 +5364,7 @@ static int extract_or_test_entrylistw(__G__ mbr_ndx,
         {
           /* Skip this member.  We created a directory, or there was
            * some other member-terminal condition.
-           */ 
+           */
           continue;
         }
 
@@ -5519,8 +5582,8 @@ int extract_or_test_files(__G)    /* return PK-type error code */
                 reached_end = TRUE;     /* ...so no more left to do */
                 break;
             }
-            if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) !=
-                 PK_COOL)
+            if ((error =
+             do_string(__G__ G.crec.filename_length, DS_FN)) != PK_COOL)
             {
                 if (error > error_in_archive)
                     error_in_archive = error;
@@ -5532,8 +5595,9 @@ int extract_or_test_files(__G)    /* return PK-type error code */
                     break;
                 }
             }
-            if ((error = do_string(__G__ G.crec.extra_field_length,
-                EXTRA_FIELD)) != 0)
+            if ((error =
+             do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) !=
+             PK_COOL)
             {
                 if (error > error_in_archive)
                     error_in_archive = error;
@@ -5555,10 +5619,10 @@ int extract_or_test_files(__G)    /* return PK-type error code */
 #ifdef AMIGA
             G.filenote_slot = mbr_ndx;
             if ((error = do_string(__G__ G.crec.file_comment_length,
-                                   uO.N_flag ? FILENOTE : SKIP)) != PK_COOL)
+             uO.N_flag ? FILENOTE : SKIP)) != PK_COOL)
 #else
-            if ((error = do_string(__G__ G.crec.file_comment_length, SKIP))
-                != PK_COOL)
+            if ((error =
+             do_string(__G__ G.crec.file_comment_length, SKIP)) != PK_COOL)
 #endif
             {
                 if (error > error_in_archive)
index aa7bf00..bab6c3f 100644 (file)
--- a/fileio.c
+++ b/fileio.c
@@ -339,9 +339,13 @@ int close_infile( __G__ pfd)
 /***********************************/
 /* Function set_zipfn_sgmnt_name() */
 /***********************************/
+#ifdef PROTO
+int set_zipfn_sgmnt_name( __GPRO__ zuvl_t sgmnt_nr)
+#else /* def PROTO */
 int set_zipfn_sgmnt_name( __G__ sgmnt_nr)
   __GDEF
   zuvl_t sgmnt_nr;
+#endif /* def PROTO [else] */
 {
   char *suffix;
   int sufx_len;
@@ -1114,7 +1118,7 @@ int seek_zipf(__G__ abs_offset)
   zoff_t request;
   zoff_t inbuf_offset;
   zoff_t bufstart;
-  int sgmnt_movement = G.ecrec.number_this_disk - G.sgmnt_nr;
+  int sgmnt_movement = G.ecrec.number_this_disk - G.sgmnt_nr - 1;
   /* If request < 0, then we will move between segment files if
    * archive is segmented and in that case we need start always
    * from last file. So set right movement against actual segment.
@@ -1148,9 +1152,7 @@ int seek_zipf(__G__ abs_offset)
        G.zipfn, 12, LoadFarString(ReportMsg)));
       return PK_BADERR;
     }
-    /* Get the new segment size, and calculate the new offset.
-     * This is where G.sgmnt_size gets a real (non-zero) value.
-     */
+    /* Get the new segment size, and calculate the new offset. */
 #ifdef USE_STRM_INPUT
     zfseeko(G.zipfd, 0, SEEK_END);
     request += zftello(G.zipfd);
index 8df61c1..d93f896 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -913,7 +913,7 @@ void version(__G)
             "FlexOS",
             " (16-bit, big)",
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index b6bb18d..72f2cb8 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -947,7 +947,7 @@ void version(__G)
       " (X680x0)",
 #endif
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index bfed327..0c6bfb3 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -1117,7 +1117,7 @@ unsigned bl, bd;        /* number of bits decoded by tl[] and td[] */
 #  else /* def SLIDE_MEMCPY */
           {
 #  endif /* def SLIDE_MEMCPY [else] */
-            /* Advancing copy, probably slower than memcpy(). 
+            /* Advancing copy, probably slower than memcpy().
              * (Possibly faster than memmove() on VMS Alpha?)
              * When w > d, this copies blocks of size w-d repeatedly.
              */
index 4e4f2e5..24ec97a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2014 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -939,7 +939,9 @@ char CompVer[10];
 sprintf(CompVer, "%x", __MWERKS__);
 #endif
 
+#if defined( __DATE__) && defined( __TIME__) && !defined( NO_BUILD_DATE)
     sprintf(DateTime,"%s  %s",__DATE__, __TIME__);
+#endif
 
     sprintf((char *)slide, LoadFarString(CompiledWith),
 
@@ -956,8 +958,7 @@ sprintf(CompVer, "%x", __MWERKS__);
       " PowerPC Processor",
 #endif
 
-#ifdef __DATE__
-
+#if defined( __DATE__) && defined( __TIME__) && !defined( NO_BUILD_DATE)
       "\n compile time: ", DateTime, ""
 #else
       "", "", ""
index 6684e35..906e412 100644 (file)
@@ -123,7 +123,9 @@ static char UnZipVersionLocal[50];
 
 memset(UnZipVersionLocal,0,sizeof(UnZipVersionLocal));
 
+#ifndef NO_BUILD_DATE
 sprintf(UnZipVersionLocal, "[%s %s]", __DATE__, __TIME__);
+#endif
 
 return UnZipVersionLocal;
 }
index aaf8f24..f8bbdfb 100644 (file)
@@ -806,7 +806,7 @@ processing.  Because wildcard characters normally match "/" directory
 separators (for exceptions, see the option \fB\-W\fP), this option may
 be used to exclude any files that are in subdirectories.  For example,
 "\fCunzip\ foo\ *.[ch]\ \-x\ */*\fR" would extract all C source files
-(*.c, *.h) in the main directory, but none in any subdirectories. 
+(*.c, *.h) in the main directory, but none in any subdirectories.
 Without the \fB\-x\fP option, all C source files in all directories in
 the archive would be extracted.
 .IP
@@ -816,7 +816,7 @@ archive member name.  To avoid any confusion between member names and
 command options, it's simplest to specify \fB\-x\fP (\fB\-\-exclude
 member\fP) and its member list as the \fIlast\fP items on a command
 line.  Alternatively, the special name "@" can be used to terminate the
-member list (and cause the program to resume scanning for options). 
+member list (and cause the program to resume scanning for options).
 That is, for example, the following two commands are equivalent:
 .EX
       example_sfx -b -x file1 file2 file3
index 75ec3bd..cea384f 100644 (file)
@@ -50,7 +50,7 @@ matches a sequence of 0 or more characters
 matches exactly 1 character
 .IP [.\|.\|.]
 matches any single character found inside the brackets; ranges are
-specified by a beginning character, a hyphen, and an ending character. 
+specified by a beginning character, a hyphen, and an ending character.
 If an exclamation point or a caret (`!' or `^') follows the left
 bracket, then the range of characters within the brackets is
 complemented (that is, anything \fIexcept\fP the characters inside the
index 51bc88e..7d1f016 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1957,7 +1957,7 @@ void version(__G)
 #  endif
 #endif
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index 8962a27..1c69174 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -875,7 +875,7 @@ void version(__G)
       "NetWare",
       " (32-bit)",
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index 00a4eb5..fe16e92 100644 (file)
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in zip.h) for terms of use.
@@ -2241,7 +2241,7 @@ void version(__G)
       " (32-bit)",
 #endif
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index ce40cf4..07dfc65 100644 (file)
--- a/process.c
+++ b/process.c
@@ -3312,21 +3312,23 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime,
 # endif
 
 /*---------------------------------------------------------------------------
-    This function scans the extra field for EF_TIME, EF_IZUNIX2, EF_IZUNIX, or
-    EF_PKUNIX blocks containing Unix-style time_t (GMT) values for the entry's
-    access, creation, and modification time.
-    If a valid block is found, the time stamps are copied to the iztimes
-    structure (provided the z_utim pointer is not NULL).
-    If a IZUNIX2 block is found or the IZUNIX block contains UID/GID fields,
-    and the z_uidgid array pointer is valid (!= NULL), the owner info is
-    transfered as well.
-    The presence of an EF_TIME or EF_IZUNIX2 block results in ignoring all
-    data from probably present obsolete EF_IZUNIX blocks.
-    If multiple blocks of the same type are found, only the information from
-    the last block is used.
-    The return value is a combination of the EF_TIME Flags field with an
-    additional flag bit indicating the presence of valid UID/GID info,
-    or 0 in case of failure.
+ *    This function scans the extra field for EF_TIME ("UT"), EF_IZUNIX2
+ * ("Ux"), EF_IZUNIX ("UX"), or EF_PKUNIX (0x000d) blocks containing
+ * Unix-style time_t (GMT) values for the entry's access, creation, and
+ * modification time.
+ *    If a valid block is found (and the z_utim pointer is not NULL),
+ * then the time stamps are copied to the iztimes structure.
+ *    If an IZUNIX2 ("Ux") block is found or the IZUNIX ("UX") block
+ * contains UID/GID fields, and the z_uidgid array pointer is not NULL,
+ * then the owner info is transfered as well.
+ *    The presence of an EF_TIME ("UT") or EF_IZUNIX2 ("Ux") block
+ * results in ignoring all data from probably present, obsolete
+ * EF_IZUNIX ("UX") blocks.
+ *    If multiple blocks of the same type are found, then only the
+ * information from the last block is used.
+ *    The return value is a combination of the EF_TIME ("UT") Flags
+ * field with an additional flag bit indicating the presence of valid
+ * UID/GID info, or 0 in case of failure.
   ---------------------------------------------------------------------------*/
 
     if (ef_len == 0 || ef_buf == NULL || (z_utim == 0 && z_uidgid == NULL))
@@ -3348,7 +3350,7 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime,
         }
 
         switch (eb_id) {
-          case EF_TIME:
+          case EF_TIME:         /* "UT" */
             flags &= ~0x0ff;    /* ignore previous IZUNIX or EF_TIME fields */
             have_new_type_eb = 1;
             if ( eb_len >= EB_UT_MINLEN && z_utim != NULL) {
@@ -3491,7 +3493,7 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime,
             }
             break;
 
-          case EF_IZUNIX2:
+          case EF_IZUNIX2:      /* "Ux" */
             if (have_new_type_eb == 0) {
                 flags &= ~0x0ff;        /* ignore any previous IZUNIX field */
                 have_new_type_eb = 1;
@@ -3507,7 +3509,7 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime,
 # endif
             break;
 
-          case EF_IZUNIX3:
+          case EF_IZUNIX3:      /* "ux" */
             /* new 3rd generation Unix ef */
             have_new_type_eb = 2;
 
@@ -3563,8 +3565,8 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime,
 # endif /* def IZ_HAVE_UXUIDGID */
             break;
 
-          case EF_IZUNIX:
-          case EF_PKUNIX:       /* PKUNIX e.f. layout is identical to IZUNIX */
+          case EF_IZUNIX:       /* "UX" */
+          case EF_PKUNIX:       /* 0x000d (Same layout as IZUNIX) */
             if (eb_len >= EB_UX_MINLEN) {
                 TTrace((stderr, "ef_scan_for_izux: found %s extra field\n",
                  (eb_id == EF_IZUNIX ? "IZUNIX" : "PKUNIX")));
index df21585..2cfda97 100644 (file)
@@ -308,7 +308,7 @@ The following are detailed descriptions of the known extra-field block types:
           1. There will be one or more of attributes present, which will
              each be preceded by the above TagX & SizeX values.  These
              values are identical to the ATR$C_XXXX and ATR$S_XXXX
-             constants which are defined in atrdef.h under OpenVMS C. 
+             constants which are defined in atrdef.h under OpenVMS C.
              Neither of these values will ever be zero.
 
           2. No word alignment or padding is performed.
@@ -360,7 +360,7 @@ The following are detailed descriptions of the known extra-field block types:
           value.
 
           The variable-length compressed data contains only the data
-          corresponding to the indicated structure or string. 
+          corresponding to the indicated structure or string.
           Typically, multiple VMS2 extra blocks are present (each with a
           unique block ID).
 
@@ -663,7 +663,7 @@ The following are detailed descriptions of the known extra-field block types:
 
           The following is the layout of PKWARE's Unix extra block.  It
           was introduced with the release of PKZIP for Unix 2.50.  Note:
-          All fields are stored in Intel low-byte/high-byte order. 
+          All fields are stored in Intel low-byte/high-byte order.
           (Last Revision 19980901)
 
           This block has a minimum data size of 12 bytes and is only
@@ -684,8 +684,8 @@ The following are detailed descriptions of the known extra-field block types:
           "linked to" file names for hard or symbolic links, and the
           major and minor device node numbers for character and block
           device nodes.  Since device nodes cannot be either symbolic or
-          hard links, only one set of variable length data is stored. 
-          Link files will have the name of the original file stored. 
+          hard links, only one set of variable length data is stored.
+          Link files will have the name of the original file stored.
           This name is NOT NULL-terminated.  Its size can be determined
           by checking TSize - 12.  Device entries will have eight bytes
           stored as two 4 byte entries (in little-endian format).  The
@@ -981,7 +981,7 @@ The following are detailed descriptions of the known extra-field block types:
           UnicodeName   variable    UTF-8 version of the entry file name
 
           Currently, Version is set to the number 1.  If there is a need
-          to change this field, the version will be incremented. 
+          to change this field, the version will be incremented.
           Changes may not be backward compatible so this extra field
           should not be used if the version is not recognized.
 
@@ -1047,7 +1047,7 @@ The following are detailed descriptions of the known extra-field block types:
           UnicodeCom    Variable    UTF-8 version of the entry comment
 
           Currently Version is set to the number 1.  If there is a need
-          to change this field, the version will be incremented. 
+          to change this field, the version will be incremented.
           Changes may not be backward compatible so this extra field
           should not be used if the version is not recognized.
 
@@ -1130,7 +1130,7 @@ The following are detailed descriptions of the known extra-field block types:
                 bits 3-7        reserved for additional timestamps; not set
 
           Those times that are present will appear in the order
-          indicated, but any combination of times may be omitted. 
+          indicated, but any combination of times may be omitted.
           (Creation time may be present without access time, for
           example.)  TSize should equal (1 + 4*(number of set bits in
           Flags)), as the block is currently defined.  Other timestamps
@@ -1239,7 +1239,7 @@ The following are detailed descriptions of the known extra-field block types:
           ========================
 
           The following is the layout of the Info-ZIP New Unix extra
-          block.  It stores Unix UIDs/GIDs longer than 16 bits. 
+          block.  It stores Unix UIDs/GIDs longer than 16 bits.
           (Currently, 32 bits are used, but the format is not so
           limited.)  (Last Revision 20080509)
 
@@ -1254,7 +1254,7 @@ The following are detailed descriptions of the known extra-field block types:
           GID           Variable    GID for this entry
 
           Currently Version is set to the number 1.  If there is a need
-          to change this field, the version will be incremented. 
+          to change this field, the version will be incremented.
           Changes may not be backward compatible so this extra block
           should not be used if the version is not recognized.
 
@@ -1278,7 +1278,7 @@ The following are detailed descriptions of the known extra-field block types:
          -ASi UNIX:
           ========
 
-          The following is the layout of the ASi extra block for Unix. 
+          The following is the layout of the ASi extra block for Unix.
           The local-header and central-header versions are identical.
           (Last Revision 19960916)
 
@@ -1304,7 +1304,7 @@ The following are detailed descriptions of the known extra-field block types:
           numbers of the device).  SizDev is undefined in other cases.
 
           If Mode indicates that the file is a symbolic link, the final
-          field will be the name of the file to which the link points. 
+          field will be the name of the file to which the link points.
           The filename length can be inferred from TSize.
 
           [Note that TSize may incorrectly refer to the data size not
@@ -1584,7 +1584,7 @@ The following are detailed descriptions of the known extra-field block types:
           identifying files independent of filename, optionally adds and
           uses an extra field to support the rapid creation of an
           enhanced contents_signature.  There is no local-header
-          version; the following applies only to the central header. 
+          version; the following applies only to the central header.
           (Last Revision 19961207)
 
           Central-header version:
index fb98738..eb79dba 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2013 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1073,7 +1073,12 @@ void version(__G)
 
     sprintf((char *)slide, LoadFarString(CompiledWith),
            "c68", " v4.2x", "SMS/QDOS",
-            " on ", __DATE__, "","");
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
+           " on ", __DATE__,
+#else
+           "", "",
+#endif
+           "");
     (*G.message)((zvoid *)&G, slide, (ulg)strlen((char *)slide), 0);
 
 } /* end function version() */
index 557e46a..9f3bbeb 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2014 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1036,7 +1036,7 @@ void version(__G)
     "NonStop ",
     "(Tandem/NSK)",
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index 41fad9c..4a91812 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2014 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2000-Apr-09 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -1193,7 +1193,14 @@ void version(__G)
     extern char Far  CompiledWith[];
 
     sprintf(slide, CompiledWith,
-        "THEOS C ","5.28", "THEOS ", "4.x", " on ", __DATE__);
+        "THEOS C ","5.28", "THEOS ", "4.x",
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
+        " on ", __DATE__
+#else
+        "", ""
+#endif
+    );
+
     (*G.message)((zvoid *)&G, slide, (ulg)strlen((char *)slide), 0);
 
 } /* end function version() */
index 29ebe9a..c8ec9c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2007 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2000-Apr-09 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -219,7 +219,7 @@ void version(__G)
       "",
 #endif /* Foo BAR */
 
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #else
       "", ""
index 8c8ec39..f82e606 100644 (file)
@@ -31,7 +31,7 @@ Like the traditional z/OS MVS environment, the z/OS UNIX environment uses an
 EBCDIC-based character set by default.  The standard z/OS UNIX EBCDIC code page
 is IBM-1047, while the standard z/OS MVS EBCDIC code page is IBM-037.
 
-The z/OS UNIX port of InfoZIP UNZIP is a fairly straight-forward variation of 
+The z/OS UNIX port of InfoZIP UNZIP is a fairly straight-forward variation of
 the UNZIP generic unix port, using the EBCDIC character set.
 - The standard line termination character for EBCDIC POSIX text files is the
   Newline (NL, 0x15) character.
@@ -125,7 +125,7 @@ follows:
 * All object files and executables are built in the [UNZIP_ROOT] (unzip610)
   directory.  To remove these file in preparation for a new build, enter:
 
-    make -f unix/Makefile clean 
+    make -f unix/Makefile clean
 
   or
 
@@ -151,7 +151,7 @@ follows:
 
 * Optionally, InfoZIP UNZIP can be built with BZIP2 compression support, after
   one first obtains the bzip2 compression source code from www.bzip2.org, and
-  extract to the contained files to the ./bzip2 directory.    
+  extract to the contained files to the ./bzip2 directory.
 
     make -f unix/Makefile generic IZ_BZIP2=bzip2
 
@@ -175,7 +175,7 @@ The z/OS UNIX port is based on (and replaces) the original updated UNZIP 6.1
   that is supported by both make and gmake.
 
 - For each .o file for source files outside the zip tree root directory, an
-  explicit .c->.o build rule is provided.  
+  explicit .c->.o build rule is provided.
   - An initial iteration with file-pattern rules worked with z/OS make and
     gmake, but these were beyone what the AIX and Solaris make utilities were
     not able to handle.
index cc09e98..faf72d2 100644 (file)
@@ -2118,7 +2118,7 @@ void version(__G)
 #  endif /* Sun */
 # endif /* SGI */
 
-# ifdef __DATE__
+# if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 # else
       "", ""
index f45acbd..76f8e84 100755 (executable)
@@ -85,10 +85,12 @@ while test $# -ne 0; do
 done
 
 if test $# = 0; then
-  echo usage: `basename "$0"` "[egrep_options] pattern zipfile [members...]"
-  echo Uses unzip and egrep to search the zip members for a string or pattern.
+  echo 'usage: '`basename "$0"`' [egrep_options] pattern zipfile [members...]'
+  echo 'Uses unzip and egrep to search the zip members for a string or pattern.'
+  echo 'Note: egrep, not grep, so pattern characters like "|" are special.'
   exit 1
 fi
+
 zipfile="$1"; shift
 
 opts=`echo "$opts" | sed -e 's/ //g' -e 's/-//g'`
diff --git a/unzip.c b/unzip.c
index 27fb640..cfdccc2 100644 (file)
--- a/unzip.c
+++ b/unzip.c
@@ -409,7 +409,7 @@ ZCONST char Far BetaVersion[] = "%s\
 static                  /* Used in vms/cmdline.c, so not static in VMS CLI. */
 # endif /* ndef VMSCLI */
 ZCONST char Far UnzipBanner[] =
- "%s %s (%s)  (c)%4.4s Info-ZIP  http://info-zip.org\n";
+ "%s %s (%s)  (c) %4.4s Info-ZIP  http://info-zip.org\n";
 
 # ifdef SFX
 #  ifdef SFX_EXDIR
@@ -866,7 +866,7 @@ int MAIN(argc, argv)   /* return PK-type error code (except under VMS) */
  * Enable dump of memory leaks on program exit.
  */
 # if defined(_MSC_VER) && defined(_DEBUG) && !defined( NO_IZ_DEBUG_ALLOC)
-    _CrtSetDbgFlag( 
+    _CrtSetDbgFlag(
      _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF);
 # endif
 
index e308a44..e9b40dd 100644 (file)
@@ -13,7 +13,7 @@ Quick list of major changes in UnZip 6.10b:
 - Implement Windows full Unicode support.  This support should be
   automatic now on NT and later platforms.
 - Add -I and -O options for setting ISO and OEM character sets,
-  respectively, used by UnZip when doing character set translations. 
+  respectively, used by UnZip when doing character set translations.
   This support is based on the unzip60-alt-iconv-utf8 patch suggested in
   an Info-ZIP forum thread and uses the iconv library which must be
   available.  These options are enabled using the USE_ICONV_MAPPING
index 1789451..0e56262 100644 (file)
@@ -1,6 +1,6 @@
 UnZip 6.1c
 
-Announcement for UnZip Beta 6.1c, >>15 Apr 2015.  This is a beta
+Announcement for UnZip Beta 6.1c, >>16 Mar 2016.  This is a beta
 release.  Changes may be made before UnZip 6.1 is released.  See the
 file History.610 for details of changes in this beta release.
 
@@ -34,7 +34,7 @@ details):
   will now, by default, be extracted on a non-VMS system as "fred;123",
   not "fred".
 - New -da/--auto-extract-dir option specifies extraction into a
-  subdirectory whose name is derived from the base name of the archive. 
+  subdirectory whose name is derived from the base name of the archive.
   So, for example, "unzip -da fred.zip" would extract files into
   subdirectory "fred" ("[.fred]" on VMS).  This avoids cluttering the
   current directory with files if the archive structure lacks a
@@ -95,7 +95,7 @@ details):
   /[NO]AUTO_DIRECTORY[=REUSE] (-da/--auto-extract-dir) option controls
   automatic extraction destination subdirectory.
 - New builders for Microsoft Visual Studio (Visual C++) 2010 have more
-  options, fewer projects.  (Service Pack 1 may be needed for VS 2010. 
+  options, fewer projects.  (Service Pack 1 may be needed for VS 2010.
   VS 2012 (and newer?) should be compatible.)
 - Windows DLL now offers a command-line (argc, argv[]) interface which
   should be more stable than the old binary structure interface.  See
index 36db7b2..a5a9c7f 100644 (file)
--- a/unzpriv.h
+++ b/unzpriv.h
@@ -1928,7 +1928,7 @@ struct file_list {
 #define DOSTIME_2038_01_18 ((ulg)0x74320000L)
 
 /* Second-try (and third-try?) suffix(es) for non-wildcard archive names.
- * Mixed-case possibilities like ".Zip" are not covered.  
+ * Mixed-case possibilities like ".Zip" are not covered.
  * VMS handles this whole thing differently, using a default file spec.
  * FlexOS may be case-sensitive, but per-medium, which is too
  * complicated for our simple scheme.
index 0ad0072..88e6d1f 100644 (file)
--- a/unzvers.h
+++ b/unzvers.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2016 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2009-Jan-02 or later
   (the contents of which are also included in unzip.h) for terms of use.
 # endif
 
 # ifdef BETA
-#  define UZ_BETALEVEL      "c19-BETA"
-#  define UZ_VERSION_DATE   "2015-04-15"        /* Internal beta version. */
+#  define UZ_BETALEVEL      "c20-BETA"
+#  define UZ_VERSION_DATE   "2016-03-16"        /* Internal beta version. */
 # else
 #  define UZ_BETALEVEL      ""
-#  define UZ_VERSION_DATE   "2015-XX-XX"        /* Official release version. */
+#  define UZ_VERSION_DATE   "2016-XX-XX"        /* Official release version. */
 #  define RELEASE
 # endif
 
@@ -38,7 +38,7 @@
 
 # define UZ_PATCHLEVEL  0
 
-# define UZ_VER_STRING  "6.1c19"        /* Sync with Version numbers! */
+# define UZ_VER_STRING  "6.1c20"        /* Sync with Version numbers! */
 
 # ifndef IZ_COMPANY_NAME
 #  define IZ_COMPANY_NAME "Info-ZIP"
  * any of the DLL/Library APIs, the corresponding compatibility level should
  * be synchronized with the current UnZip version numbers.
  */
-/* generic DLL API minimum compatible version*/
+/* generic DLL API minimum compatible version */
 # define UZ_GENAPI_COMP_MAJOR   6
 # define UZ_GENAPI_COMP_MINOR   1
 # define UZ_GENAPI_COMP_REVIS   0
-/* os2dll API minimum compatible version*/
+/* os2dll API minimum compatible version */
 # define UZ_OS2API_COMP_MAJOR   6
 # define UZ_OS2API_COMP_MINOR   1
 # define UZ_OS2API_COMP_REVIS   0
-/* windll API minimum compatible version*/
+/* windll API minimum compatible version */
 # define UZ_WINAPI_COMP_MAJOR   6
 # define UZ_WINAPI_COMP_MINOR   1
 # define UZ_WINAPI_COMP_REVIS   0
index 44abb82..851a71e 100644 (file)
@@ -74,7 +74,7 @@ and maintaining control over this process is essentially impossible.
 
    VMS V8.3 offers support for symbolic links (symlinks) on ODS5
 volumes.  In previous Zip and UnZip versions, the generic code for
-symlinks was disabled, and there was no VMS-specific code for symlinks. 
+symlinks was disabled, and there was no VMS-specific code for symlinks.
 Now, by default, Zip and UnZip attempt to support symlinks wherever the
 C headers and C run-time library include the functions needed for
 symlink support.  This means non-VAX systems with __CRTL_VER >=
index ddceae6..e21a4a8 100644 (file)
@@ -770,7 +770,7 @@ vms_unzip_cmdline (int *argc_p, char ***argv_p)
          */
 #define OPT_DA  "-da"           /* "-da" Use auto destination dir. */
 #define OPT_DAN "-da-"          /* ""    Normal destination dir (default). */
-#define OPT_DAR "-da=reuse"     /* "-da=reuse" Allow existing auto dest dir. */ 
+#define OPT_DAR "-da=reuse"     /* "-da=reuse" Allow existing auto dest dir. */
 
         status = cli$present( &cli_auto_dir);
         if ((status & 1) || (status == CLI$_NEGATED))
index 6886a87..1ca65c5 100644 (file)
@@ -119,7 +119,7 @@ CHECK_AES_WG = 1
 # Alpha, the .FIRST rule will detect incompatibility (before VMS V7.2).
 
 # Targets which can bypass the AES_WG test and, on Alpha, the (slow)
-# large-file test. 
+# large-file test.
 # (Not "" or ALL.  Could add help- and message-related.)
 
 TRGT_CLEAN = 1
index 8071a23..ef8f167 100644 (file)
      To print only the zipfile comment:
 
          mcr sys$disk:[]letters -z
+
          mcr sys$disk:[]letters /comment
 
 2 Limitations
index f7e5752..bb9d414 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -536,7 +536,7 @@ int get_rms_fileprot( void)
     sts = sys$setdfprot( 0, &defprot);
     if ((sts & STS$M_SEVERITY) == STS$K_SUCCESS)
     {
-        /* V: Start bit.  S: Size (bits). */
+        /* V: Start bit.  S: Size (bits).  0 = access allowed. */
         sysdef = defprot& ((1<< XAB$S_SYS)- 1)<< XAB$V_SYS;
         owndef = defprot& ((1<< XAB$S_OWN)- 1)<< XAB$V_OWN;
         grpdef = defprot& ((1<< XAB$S_GRP)- 1)<< XAB$V_GRP;
@@ -2519,7 +2519,7 @@ static int _flush_stream(__G__ rawbuf, size, final_flag)
                 if ( eol_off >= size )
                 {
                     /* 2012-09-19 SMS.
-                     * No EOL found (at EOF?).  See note below. 
+                     * No EOL found (at EOF?).  See note below.
                      * Previously, the following memcpy() was not being
                      * done in this case, either, causing loss of data
                      * at the end of a last line with no line ending.
@@ -4125,8 +4125,8 @@ int mapattr(__G)
     __GDEF
 {
     ulg tmp = G.crec.external_file_attributes;
-    ulg theprot;
-    unsigned uxattr;
+    unsigned vmsprot;           /* VMS protections.  (0 = access ok.) */
+    unsigned uxattr;            /* UNIX permissions.  (1 = access ok.) */
 
     /* IM: The only field of XABPRO we need to set here is */
     /*     file protection, so we need not to change type */
@@ -4215,16 +4215,16 @@ int mapattr(__G)
                   G.pInfo->symlink = S_ISLNK(uxattr) &&
                                      SYMLINK_HOST(G.pInfo->hostnum);
 #endif /* def SYMLINKS */
-                  theprot  = (unix_to_vms[uxattr & 07] << XAB$V_WLD)
+                  vmsprot  = (unix_to_vms[uxattr & 07] << XAB$V_WLD)
                            | (unix_to_vms[(uxattr>>3) & 07] << XAB$V_GRP)
                            | (unix_to_vms[(uxattr>>6) & 07] << XAB$V_OWN);
                   if ( uxattr & 0x4000 )
                       /* Directory -- set D bits */
-                      theprot |= (XAB$M_NODEL << XAB$V_SYS)
+                      vmsprot |= (XAB$M_NODEL << XAB$V_SYS)
                               | (XAB$M_NODEL << XAB$V_OWN)
                               | (XAB$M_NODEL << XAB$V_GRP)
                               | (XAB$M_NODEL << XAB$V_WLD);
-                  G.pInfo->file_attr = theprot;
+                  G.pInfo->file_attr = vmsprot;
                   break;
               }
             }
@@ -4279,7 +4279,10 @@ int mapattr(__G)
                 if (fnlen > 0 && G.filename[fnlen-1] == '/')
                     tmp |= 0x10;
             }
-            tmp = !(tmp & 1) << 1  |  (tmp & 0x10) >> 4;
+
+            /* read-only bit --> write perms; subdir bit --> dir exec bit */
+            uxattr = !(tmp & 1) << 1  |  (tmp & 0x10) >> 4;
+
             if ((uxattr & 0700) == (unsigned)(0400 | tmp<<6)) {
                 /* keep previous G.pInfo->file_attr setting, when its "owner"
                  * part appears to be consistent with DOS attribute flags!
@@ -4292,14 +4295,14 @@ int mapattr(__G)
                                    (G.pInfo->hostnum == FS_FAT_);
 #endif /* def SYMLINKS */
             }
-            theprot = defprot;
+            vmsprot = defprot;
             if ( tmp & 1 )   /* Test read-only bit */
             {   /* Bit is set -- set bits in all fields */
                 tmp = XAB$M_NOWRITE | XAB$M_NODEL;
-                theprot |= (tmp << XAB$V_SYS) | (tmp << XAB$V_OWN) |
+                vmsprot |= (tmp << XAB$V_SYS) | (tmp << XAB$V_OWN) |
                            (tmp << XAB$V_GRP) | (tmp << XAB$V_WLD);
             }
-            G.pInfo->file_attr = theprot;
+            G.pInfo->file_attr = vmsprot;
             break;
     } /* end switch (host-OS-created-by) */
 
@@ -4375,7 +4378,7 @@ int dest_struct_level( char *path)
     struct dsc$descriptor_s dev_descr =
      { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 };
 
-    /* Get the device name from the path argument, if supplied. 
+    /* Get the device name from the path argument, if supplied.
      * Otherwise (NULL), use what's already in dest_dev.
      */
     if (path != NULL)
@@ -5693,7 +5696,7 @@ int vms_status( int err)
      *                                ^^
      *
      * UnZip versions before 6.00 (before an official Facility code was
-     * assigned) used 0x7FFF instead of the official Facility code. 
+     * assigned) used 0x7FFF instead of the official Facility code.
      * Define CTL_FAC_IZ_UZP as 0x7FFF (and/or MSG_FAC_SPEC) to get the
      * old behavior.  (See above.)
      */
@@ -6051,7 +6054,7 @@ void version(__G)
       "",
 # endif /* def VMS_VERSION [else] */
 
-# ifdef __DATE__
+# if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 # else
       "", ""
index 129398f..98f358f 100644 (file)
@@ -58,7 +58,7 @@ been reported to emit faster code from the plain C sources (crc32.c)
 than the assembler routines provide.  This has not been tested lately,
 however.
 
-   Many of the "make" files and other builders here are now obsolete. 
+   Many of the "make" files and other builders here are now obsolete.
 They may not have been updated for UnZip 6.1, and may not support its
 new optional features.  The Unix builders should support the Cygwin and
 MinGW environments.  The "vc10\" builders for Visual C++ 2010 should
index 7f0b63d..0ce4829 100644 (file)
@@ -4313,7 +4313,7 @@ void version(__G)
       "\nWindows 9x or NT family", " (32-bit)",
 #   endif
 
-#   ifdef __DATE__
+#   if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on ", __DATE__
 #   else
       "", ""
index cfb885e..801a8be 100644 (file)
@@ -377,7 +377,7 @@ LPDCL lpDCL;
      * What should these be with the new command-line parser (and no
      * fname[] array)?  process.c:free_G_buffers() would be willing to
      * use unzip.c:free_args() on these at clean-up time, but that's in
-     * the UnZip main program, not the DLL. 
+     * the UnZip main program, not the DLL.
      */
 #if 0
     G.pfnames = (char **)&fnames[0];    /* assign default file name vector */
index 5f1f595..029333a 100644 (file)
@@ -1,5 +1,5 @@
 
-Info-Zip UnZip -- Source kit.  Version 6.10c19 (pre-BETA)  2015-06-26.
+Info-Zip UnZip -- Source kit.  Version 6.10c20 (pre-BETA)  2016-03-16.
 
 See enclosed files INSTALL, LICENSE, and README.  For information on
 Info-Zip UnZip and Zip:
index 7f5b904..d47e69b 100644 (file)
 
   zos/bbunzip.c
 
-  This source file supports the compilation of the Infozip UNZIP utility.
-                                                              
+  This source file supports the compilation of the Info-ZIP UnZip utility.
+
   This enables the InfoZip source code to be used unmodified to build the
   utility.  A single compilation is performed, with each of the required C
-  header and source files #included.                          
+  header and source files #included.
 
   This greatly simplifies the compilation of the z/OS MVS UNZIP executable,
   and results in optimum performance by providing a cheap form of global
   program optimization.
 
   ---------------------------------------------------------------------------*/
-#pragma title ("BBUNZIP -- InfoZip UNZIP Utility") 
+#pragma title ("BBUNZIP -- Info-ZIP UnZip Utility")
 
 #pragma runopts(ENV(MVS),PLIST(MVS), TRAP(OFF), NOEXECOPS,             \
                 STACK(64K),                                            \
@@ -35,7 +35,7 @@
 #pragma csect(static, "IZ_WS")
 #pragma csect(test,   "IZ_TEST")
 
-#pragma comment( copyright , "1990-2014 Info-ZIP.  All rights reserved" ) 
+#pragma comment( copyright , "1990-2014 Info-ZIP.  All rights reserved" )
 
 #pragma subtitle( "Load module eye-catchers" )
 #pragma page()
index 56f0f0e..99bc53d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 1990-2005 Info-ZIP.  All rights reserved.
+  Copyright (c) 1990-2015 Info-ZIP.  All rights reserved.
 
   See the accompanying file LICENSE, version 2000-Apr-09 or later
   (the contents of which are also included in unzip.h) for terms of use.
@@ -679,11 +679,11 @@ void version(__G)
     platform,
 
     /* Add timestamp */
-#ifdef __DATE__
+#if defined( __DATE__) && !defined( NO_BUILD_DATE)
       " on " __DATE__
-#ifdef __TIME__
+# if defined( __TIME__) && !defined( NO_BUILD_DATE)
       " at " __TIME__
-#endif
+# endif
 #endif
       ".\n", "",
       liblvlmsg
index bf26ab2..6dc3908 100644 (file)
@@ -69,7 +69,7 @@
 
 #define USE_STRM_INPUT
 #define USE_FWRITE
-#define NO_USER_PROGRESS 
+#define NO_USER_PROGRESS
 
 #define PATH_MAX 128
 
index 226c23c..84f913c 100644 (file)
@@ -1,4 +1,4 @@
-Using ZIP and UNZIP on VM/CMS  (August 11, 2011)
+Using Zip and UnZip on VM/CMS  (August 11, 2011)
 =============================
 
 
@@ -28,17 +28,17 @@ their level, etc.
 To restore them to executable MODULEs on CMS, do the following:
    1. Upload them to CMS with a Fixed record length with LRECL 1024.
 
-      Example, using CMS FTP client 
+      Example, using CMS FTP client
         At a CMS command prompt, type this:
           BINARY FIXED 1024
           GET unzip.cmo unzip.module.a
 
-      Example, using other FTP client to CMS user 191 disk 
+      Example, using other FTP client to CMS user 191 disk
         Note: CMS ID must be logged off during transfer
         At the sending system command prompt, type this:
-          BINARY         
+          BINARY
           QUOTE SITE FIX 1024
-          PUT unzip.cmo unzip.module   
+          PUT unzip.cmo unzip.module
 
       Example, using PCOMM terminal emulator IND$FILE transfer
         Note: CMS ID must be logged on to PCOMM terminal emulator session
@@ -58,17 +58,17 @@ To restore them to executable MODULEs on CMS, do the following:
 
    5. Upload the EXECs to CMS as text files (with ASCII-to-EBCDIC
       translation).
-      Example, using CMS FTP client 
+
+      Example, using CMS FTP client
         At a CMS command prompt, type this:
           ASCII
           GET unzip.exec unzip.exec.a
 
-      Example, using other FTP client to CMS user 191 disk 
+      Example, using other FTP client to CMS user 191 disk
         Note: CMS ID must be logged off during transfer
         At the sending system command prompt, type this:
-          ASCII         
-          PUT unzip.exec unzip.exec   
+          ASCII
+          PUT unzip.exec unzip.exec
 
       Example, using PCOMM terminal emulator IND$FILE transfer
         Note: CMS ID must be logged on to PCOMM terminal emulator session
@@ -154,40 +154,40 @@ in a while.
     to CMS.  All the required files are plain text so they can
     be transferred with ASCII-to-EBCDIC translations.
 
- 2. Repeat step 1 with the zip file containing the UNZIP code.
-    Unzip the files to a different disk than the disk used for the ZIP
+ 2. Repeat step 1 with the zip file containing the UnZip code.
+    Unzip the files to a different disk than the disk used for the Zip
     code.
 
- 3. To compile the ZIP code, run the supplied CCZIP EXEC.
-    To compile the UNZIP code, run the supplied CCUNZIP EXEC.
+ 3. To compile the Zip code, run the supplied CCZIP EXEC.
+    To compile the UnZip code, run the supplied CCUNZIP EXEC.
 
 NOTE:
-Some of the ZIP and UNZIP source files have the same name.  It is
+Some of the Zip and UnZip source files have the same name.  It is
 recommended that you keep the source from each on separate disks and
 move the disk you are building from ahead of the other in the search
 order.
 
-For example, you may have a 192 disk with the ZIP source code and
-a 193 disk with the UNZIP source code.  To compile ZIP, access
+For example, you may have a 192 disk with the Zip source code and
+a 193 disk with the UnZip source code.  To compile Zip, access
 the 192 disk as B, then run CCZIP.  This will create the following
 modules:  ZIP, ZIPNOTE, ZIPSPLIT, ZIPCLOAK.
 
-To compile UNZIP, access 193 as B, then run CCUNZIP.  This will create
+To compile UnZip, access 193 as B, then run CCUNZIP.  This will create
 the following modules:  UNZIP, ZIPINFO (a copy of UNZIP).
 
 
 =========================================================================
 
 
-Using ZIP/UNZIP
+Using Zip/UnZip
 ---------------
 
-Documentation for the commands is in MANUAL NONAME (for ZIP) and in
+Documentation for the commands is in MANUAL NONAME (for Zip) and in
 UNZIP DOC UNZIP.  INFOZIP DOC describes the use of the -Z option of
-UNZIP.
+UnZip.
 
 The rest of this section explains special notes concerning the VM/CMS
-version of ZIP and UNZIP.
+version of Zip and UnZip.
 
 
 Filenames and directories
@@ -199,19 +199,19 @@ Filenames and directories
        (separate the three parts of the name with a period and use no
        spaces).  Example:  profile.exec.a
 
-       Unfortunately, this prevents you from using ZIP from
+       Unfortunately, this prevents you from using Zip from
        FILELIST.  To unzip a zip file, however, you can type something
        like this next to it in FILELIST:
           unzip /n -d c
 
        This will unzip the contents of the current file to a C-disk.
 
-    b. It is possible to use DD names with ZIP and UNZIP on CMS, though
+    b. It is possible to use DD names with Zip and UnZip on CMS, though
        it can be cumbersome.  Example:
           filedef out disk myzip zip a
           zip dd:out file1.txt file2.txt
 
-       While you can also use a DD name for the input files, ZIP
+       While you can also use a DD name for the input files, Zip
        currently does not correctly resolve the filename and will
        store something like "dd:in" inside the ZIP file.  A file stored
        in this manor cannot easily be unzipped, as "dd:in" is an invalid
@@ -223,7 +223,7 @@ Filenames and directories
        to unzip files onto a C-disk, you might type something like this:
           unzip myzip.zip -d c
 
-       Currently, ZIP uses the A-disk for work files.  When zipping
+       Currently, Zip uses the A-disk for work files.  When zipping
        large files, you may want to specify a larger disk for work files.
        This example will use a C-disk for work files.
           zip -b C myzip.zip.c test.dat.a
@@ -233,15 +233,15 @@ Filenames and directories
 
     a. Filemode letters are never stored into the zip file or take from
        a zip file.  Only the filename and filetype are used.
-       ZIP removes the filemode when storing the filename into the
-       zip file.  UNZIP assumes "A" for the filemode unless the -d
+       Zip removes the filemode when storing the filename into the
+       zip file.  UnZip assumes "A" for the filemode unless the -d
        option is used.
 
     b. When unzipping, any path names are removed from the fileid
        and the last two period-separated words are used as the
        filename and filetype.  These are truncated to a maximum of
        eight characters, if necessary.  If the filetype (extension)
-       is missing, then UNZIP uses "NONAME" for the filetype.
+       is missing, then UnzIp uses "NONAME" for the filetype.
        Any '(' or ')' characters are removed from the fileid.
 
     c. All files are created in upper-case.  Files in mixed-case
@@ -259,13 +259,13 @@ Filenames and directories
        necessary).  So, you can't do this:
           unzip -t *.zip
 
-    b. Wildcards CAN be used with UNZIP to select (or exclude) files
+    b. Wildcards CAN be used with UnZip to select (or exclude) files
        inside a zip file.  Examples:
           unzip myzip *.c          - Unzip all .c files.
           unzip myzip *.c -x z*.c  - Unzip all .c files but those
                                      starting with Z.
 
-    c. Wildcards cannot currently be used to select files with ZIP.
+    c. Wildcards cannot currently be used to select files with Zip.
        So, you can't do this:
           zip -a myzip *.exec
 
@@ -281,7 +281,7 @@ Filenames and directories
        being unzipped will always be the current system date/time.
 
     b. Existing files are assumed to be newer than files inside a zip
-       file when using the -f freshen option of UNZIP.  This will prevent
+       file when using the -f freshen option of UnZip.  This will prevent
        overwriting files that may be newer than the files inside the
        zip file, but also effectively prevents the -f option from working.
 
@@ -318,12 +318,12 @@ Filenames and directories
     the data can just be dumped into the zip file and the record
     format (RECFM) and logical record length (LRECL) can be stored
     in the extra data area of the zip file so they can be restored
-    when UNZIP is used.
+    when UnZip is used.
 
     Storing variable-length data is harder.  There is no place to put
     the record length data needed for each record of the file.  This
     data could be written to the zip file as the first two bytes of
-    each record and interpreted that way by UNZIP.  That would make
+    each record and interpreted that way by UnZip.  That would make
     the data unusable on systems other than CMS and MVS, though.
 
     Currently, there isn't a solution to this problem.  Each record is
@@ -345,7 +345,7 @@ Filenames and directories
     So, here's what we have...
 
     a. To store readable text data into a zip file that can be used
-       on other platforms, use the -a option with ZIP to convert the
+       on other platforms, use the -a option with Zip to convert the
        data to ASCII.  These files will unzip into variable-length
        files on CMS and should not contain binary data or corruption
        may occur.
@@ -353,49 +353,49 @@ Filenames and directories
     b. Files that were zipped on an ASCII-based system will be
        automatically translated to EBCDIC when unzipped.  To prevent
        this (to unzip binary data on CMS that was sent from an
-       ASCII-based system), use the -B option with UNZIP to force Binary
-       mode.  To zip binary files on CMS, use the -B option with ZIP to
+       ASCII-based system), use the -B option with UnZip to force Binary
+       mode.  To zip binary files on CMS, use the -B option with Zip to
        force Binary mode.  This will prevent any data conversions from
        taking place.
 
-    c. When using the ZIP program without specifying the "-a" or "-B"
-       option, ZIP defaults to "native" (EBCDIC) mode and tries to
+    c. When using the Zip program without specifying the "-a" or "-B"
+       option, Zip defaults to "native" (EBCDIC) mode and tries to
        preserve the file information (RECFM, LRECL, and BLKSIZE).  So
-       when you unzip a file zipped with ZIP under CMS or MVS, UNZIP
+       when you unzip a file zipped with Zip under CMS or MVS, UnZip
        restores the file info.  The output will be fixed-length if the
        original was fixed and variable-length if the original was
        variable.
 
-    If UNZIP gives a "write error (disk full?)"  message, you may be
+    If UnZip gives a "write error (disk full?)"  message, you may be
     trying to unzip a binary file that was zipped as a text file
     (without using the -B option)
 
 
     Summary
     -------
-    Here's how to ZIP the different types of files.
+    Here's how to zip the different types of files.
 
     RECFM F text
-       Use the -a option with ZIP to convert to ASCII for use with other
+       Use the -a option with Zip to convert to ASCII for use with other
        platforms or no options for use on EBCDIC systems only.
 
     RECFM V text
-       Use the -a option with ZIP to convert to ASCII for use with other
+       Use the -a option with Zip to convert to ASCII for use with other
        platforms or no options for use on EBCDIC systems only.
 
 
     RECFM F binary
-       Use the -B option with ZIP (upper-case "B").
+       Use the -B option with Zip (upper-case "B").
 
     RECFM V binary
-       Use the -B option with ZIP.  Can be zipped OK but the record
+       Use the -B option with Zip.  Can be zipped OK but the record
        structure is destroyed when unzipped.  This is OK for data files
        read as binary streams but not OK for files such as CMS MODULEs.
 
 
  6. Character Sets
 
-    If you are used to running UNZIP on systems like UNIX, DOS, OS/2 or
+    If you are used to running UnZip on systems like UNIX, DOS, OS/2 or
     Windows, you will may have some problems with differences in the
     character set.
 
@@ -407,7 +407,7 @@ Filenames and directories
     use a different EBCDIC code page, you may need to do some
     translation.
 
-    UNZIP translates ASCII text files to and from Open Systems EBCDIC
+    UnZip translates ASCII text files to and from Open Systems EBCDIC
     (IBM-1047), which may not be the EBCDIC that you are using.  For
     example, US EBCDIC (IBM-037) uses different character codes for
     square brackets.  In such cases, you can use the ICONV utility
@@ -415,29 +415,29 @@ Filenames and directories
     and IBM-1047.
 
     If your installation does not use IBM-1047 EBCDIC, messages from
-    UNZIP may look a little odd.  For example, in a US EBCDIC
+    UnZip may look a little odd.  For example, in a US EBCDIC
     installation, an opening square bracket will become an i-acute and a
     closing square bracket will become a u-grave.
 
-    The supplied ZIP and UNZIP EXECs attempt to correct this by setting
+    The supplied Zip and UnZip EXECs attempt to correct this by setting
     CMS INPUT and OUTPUT translations to adjust the display of left and
     right brackets.  You may need to change this if brackets don't
     display correctly on your system.
 
 
- 7. You can unzip using VM/CMS PIPELINES so unzip can be used as
+ 7. You can unzip using VM/CMS PIPELINES so UnZip can be used as
     a pipeline filter.  Example:
        'PIPE COMMAND UNZIP -p test.zip george.test | Count Lines | Cons'
 
 
 
 All bug reports or patches should go to zip-bugs via the web site contact
-form at http://www.info-zip.org/zip-bug.html; 
+form: http://www.info-zip.org/zip-bug.html
 
 If you'd like to keep up to date with our Zip and UnZip development, join
 the ranks of BETA testers, add your own thoughts and contributions, etc.,
-check out the new discussion forum available (courtesy of Hunter Goatley)
-at http://www.info-zip.org/phpBB3/index.php .
+check out the discussion forum available (courtesy of Hunter Goatley):
+http://www.info-zip.org/phpBB3/index.php
 
 -----------------------------------------------------------------------
 Revised (08/2011) by Al Dunsmuir