tion, "which -a unzip" will show *all* copies of "unzip" in your path.)
+Modern Bugs (UnZip 6.10):
+------------------------
+
+ - unix/zipgrep shell script has only limited support for long options
+ for egrep ("--color", for example, for GNU egrep), and none for short
+ options which have values (and especially multiples of those). Up to
+ four long options are currently handled by the script, with no good
+ error handling if more are specified. The argument quoting method
+ used by the shell seems to defeat attempts to pass multiple
+ options/arguments in one space-separated string. (Multiple short
+ options are combined into one, but that can't be done for long
+ options, and probably shouldn't be done for short options, either.)
+ A more clever scripting technique (or a re-write as a real program)
+ seems to be needed.
+ http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=384
+ Debian Bug#652838: unzip: zipgrep parses long egrep options as short
+ options
+
+ - On Windows with wide-character Unicode support, "-d dest_dir" or -da
+ works, but the extraction progress messages ("inflating: name") show
+ only the archive path, not the actual path used in the file system.
+ (The user-specified/requested destination directory is not shown.)
+
+
Bugs (real and/or imagined):
---------------------------
- [OS/2 DLL] when trying to use the REXX function UzUnZipToStem to extract a
- file with `&' in its name, the DLL crashes (but UzUnZipToVar still works)
+ file with "&" in its name, the DLL crashes (but UzUnZipToVar still works)
[Daniel H, 961215]
- UnZip has problems with archives bigger than 2GB; it may print "note: didn't
find end-of-central-dir signature at end of central dir" (harmless) or
__________________________________________________________________________
- This is the Info-ZIP file COPYING (for UnZip), last updated 17 Jul 2000.
+ This is the Info-ZIP file COPYING.OLD (for UnZip)
+ Last content update: 17 Jul 2000
+ Last edit: 28 Jan 2013
__________________________________________________________________________
FIRST NOTE:
contributions to the UnZip project.
Additionally, it summarises some exceptions to the general BSD-like
copyright found in LICENSE that covers our generic code and most of
- the system specific ports.
- Please read LICENSE first to find out what is allowed to do with
- Info-ZIP's UnZip code.
+ the system-specific ports.
+ Please read LICENSE first, to find out what is allowed to be done
+ with Info-ZIP's UnZip code.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are currently two explicit copyrights on portions of UnZip
code (at least, of which Info-ZIP is aware):
Jim Luther's Mac OS File Manager interface code; and Christopher Evans'
- MacBinaryIII coding code (for the MacOS port).. These copyrights
+ MacBinary III coding code (for the MacOS port). These copyrights
are discussed in more detail below.
All remaining code is now (starting with UnZip version 5.41) covered
- by the new Info-ZIP license. For details, please read the acompaning
- file LICENSE. The terms and conditions in this license supersede the
+ by the new Info-ZIP license. For details, please read the accompanying
+ file LICENSE. The terms and conditions in this license supersede the
copyright conditions of the contributions by Igor Mandrichenko
(vms/vms.c), Greg Roelofs (zipinfo.c, new version of unshrink.c),
Mike White (Windows DLL code in "windll/*"), Steve P. Miller (Pocket
UnZip GUI "wince/*"), and Mark Adler (inflate/explode decompresseion
- core routines, previously put into the public domain). All these
+ core routines, previously put into the public domain). All these
Info-ZIP contributors (or "primary" authors) have permitted us to
replace their copyright notes by the Info-ZIP License.
responsibility of the user to make his or her peace with Unisys and
its licensing requirements. (unshrink.c may be removed from future
releases altogether.)
+
__________________________________________________________________________
The original unzip source code has been extensively modified and
- almost entirely rewritten (changes include random zipfile access
+ almost entirely rewritten. Changes include random zipfile access
rather than sequential; replacement of unimplode() with explode();
replacement of old unshrink() with new (unrelated) unshrink(); re-
placement of output routines; addition of inflate(), wildcards,
- filename-mapping, text translation, ...; etc.). As far as we can
- tell, only the core code of the unreduce method remained substantially
+ filename-mapping, text translation, ...; etc. As far as we can
+ tell, only the core code of the Reduce method remained substantially
similar to Mr. Smith's original source. As of UnZip 5.42, the complete
core code is now covered by the Info-ZIP Licence. Therefore, support
- for the reduce method has been removed.
- The drop of the reduce method should only affect some test archives,
- reducing was never used in any publically distributed Zip program.
- For pathologic cases where support for reduced archive entries is
- needed, the unreduce code copyrighted by Samuel H. Smith is available
- as a separate distribution (the restricted copyright of this code is
- cited below in the "historical" section).
+ for the Reduce method has been removed.
+ The drop of the Reduce method should only affect some test archives.
+ Reduce was never used in any publicly distributed Zip program.
+ For pathologic cases where support for Reduced archive entries is
+ needed, the Reduce code copyrighted by Samuel H. Smith is available
+ as a separate distribution (unreduce.c). The restricted copyright of
+ this code is cited below in the "historical" section).
- The following copyright applies to the Mac OS File Manager interface code
- (macos/source/macstuff.[ch]), distributed with UnZip 5.4 and later:
+ The following copyright applies to the Mac OS File Manager interface
+ code (macos/source/macstuff.[ch]), distributed with UnZip 5.4 and later:
* MoreFiles
*
* changes."
The usage terms of this copyright note are compatible with the
- Info-ZIP license, they do not add further restrictions.
+ Info-ZIP license; they do not add further restrictions.
The following copyright applies to the Mac OS "macbin3" decoding code
--------------------------------------------------------------------------
- The remaining copyright notes have been superseeded by the new
+ The remaining copyright notes have been superseded by the new
Info-ZIP license, with explicit permission from the respective
original authors. They are cited here for historical reasons,
only:
Despite the fact that our "normal" code has been entirely rewritten
and by default no longer contains any of Mr. Smith's code, Info-ZIP
- remains indebted and grateful to him. We hope he finds our contribu-
- tions as useful as we have his.
+ remains indebted and grateful to him. We hope he finds our
+ contributions as useful as we have his.
- Note that the third and fourth stipulations still apply to any com-
- pany that wishes to incorporate the unreduce code into its products;
- if you wish to do so, you must contact Mr. Smith directly regarding
- licensing.
+ Note that the third and fourth stipulations still apply to any
+ company that wishes to incorporate the unreduce code into its
+ products. If you wish to do so, you must contact Mr. Smith directly
+ regarding licensing.
-----
-Contents of the UnZip 6.00 source archive. The OS-specific subdirectories
-at the end contain their own Contents listings:
+ Contents of the UnZip 6.10 Source Archive
+ -----------------------------------------
- Contents this file
- README what UnZip is; general information
- LICENSE Info-ZIP license; terms for using and distributing UnZip
- COPYING.OLD historic copyrights and distribution policy (obsolete)
- INSTALL how to compile and install UnZip and related utilities
- WHERE where Zip/UnZip and encryption/decryption support can be found
- History.600 new features and fixes of the last major release
- ToDo rough priority list of new features to be added in next release
- BUGS known bugs, problems, and (possible) other features to be added
- unzip.txt UnZip manual page, human-readable format
- unzipsfx.txt UnZipSFX manual page, human-readable format
- zipinfo.txt ZipInfo manual page, human-readable format
- zipgrep.txt ZipGrep manual page, human-readable format
- funzip.txt fUnZip manual page, human-readable format
- file_id.diz BBS-oriented file describing this archive
- testmake.zip test archive for checking whether newly compiled UnZip works
- api.c generic DLL entry points, support functions (required for DLLs)
- apihelp.c API help text for DLL versions (currently OS/2 only)
- consts.h global, initialized variables that never change (required)
- crc32.c code for calculation 32bit CRC of a string buffer (required*)
- crc32.h declarations for the crc-32 code (required*)
- crc_i386.S fast assembler replacement for crc32() (Intel 386 and newer)
- crypt.c de-/encryption routines (required*)
- crypt.h de-/encryption header file (required*)
- ebcdic.h static lookup table for ASCII <-> EBCDIC translation (required)
- envargs.c code to read options from environment variables (required)
- explode.c code for exploding (required)
- extract.c high-level extraction and decryption code (required)
- fileio.c file manipulation and password code (required)
- funzip.c filter unzip: extracts in a pipe from stdin to stdout
- gbloffs.c helper program to retrieve offsets of globals struct members
- globals.c code to support global variables with reentrancy (required)
- globals.h definition of global structure G (required)
- inflate.c code for inflating (required*)
- inflate.h header file for inflating (required*)
- list.c UnZip listing routines, non-ZipInfo mode (required)
- match.c pattern-matching code for filename wildcards (required)
- process.c zipfile headers code (required)
- timezone.c timezone and timestamp functions (required)
- timezone.h header file for interface to "internal" tz functions (required)
- ttyio.c code for handling nonecho tty input: password, pager (required)
- ttyio.h header file for nonecho tty input: password, pager (required)
- ubz2err.c callback handler for fatal bzip2 errors (bzip2 support only)
- unreduce.c code for unreducing (required)
- unshrink.c code for unshrinking (required)
- unzip.c UnZip main(), usage and options code (required)
- unzip.h public half of main UnZip header file (required*)
- unzipstb.c minimal UnZip "stub" file demonstrating use of DLL versions
- unzpriv.h private (internal) half of main UnZip header file (required*)
- unzvers.h header with UnZip/UnZipSFX and ZipInfo version info (required)
- zip.h dummy header for use with crypt.c (required*)
- zipinfo.c UnZip listing routines, ZipInfo mode (required)
- acorn/ support files for compiling under Acorn RISC OS
- amiga/ support files for compiling under AmigaDOS
- aosvs/ support files for compiling under Data General AOS/VS
- atari/ support files for compiling under Atari TOS
- atheos/ support files for compiling under AtheOS/Syllable
- beos/ support files for compiling under BeOS
- cmsmvs/ support files for compiling under VM/CMS and MVS
- flexos/ support files for compiling under FlexOS
- human68k/ support files for compiling under X68000/Human68K
- macos/ support files for compiling under Macintosh OS
- msdos/ support files for compiling under MS-DOS
- netware/ support files for compiling for Novell Netware NLM
- os2/ support files for compiling under OS/2 (includes DLL stuff)
- qdos/ support files for compiling under SMS/QDOS
- tandem/ support files for compiling under Tandem NSK
- theos/ support files for compiling under Theos
- tops20/ support files for compiling under TOPS-20
- unix/ support files for compiling under Unix
- vms/ support files for compiling under VMS
- win32/ support files for compiling under Windows 9x and Windows NT
- wince/ support files for compiling under Windows CE (GUI version)
- windll/ support files for compiling Windows 3.x/9x/NT DLLs
- bzip2/ subfolder for source of externally supplied bzip2 extension
- man/ nroff man-page sources for the main user documentation
- proginfo/ programming docs, additional technical info, contributor list
+(Subdirectories may contain their own Contents listings.)
-Files marked "required*" are also needed to compile fUnZip. The normal
-UnZip makefile targets now make both UnZipSFX and fUnZip, except in a few
-cases; ZipInfo is now incorporated into UnZip (see zipinfo.txt for usage).
+ General Documentation
+BUGS Known bugs, problems, and (possible) future features
+Contents This file
+COPYING.OLD Historic copyrights and distribution policy (obsolete)
+History.5xx New features and fixes before version 6.00
+History.600 New features and fixes in version 6.00
+History.610 New features and fixes in the current version
+INSTALL How to build and install UnZip and related utilities
+LICENSE Info-ZIP license; terms for using and distributing UnZip
+README General information about UnZip
+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.10c beta release
+proginfo/ Programming docs, additional technical info, contributor list
+
+ User Program Documentation ("man"/help formatted output)
+docs/
+ funzip.txt fUnZip manual page, formatted output
+ unzip.txt UnZip manual page, formatted output
+ unzipsfx.txt UnZipSFX manual page, formatted output
+ zipgrep.txt ZipGrep manual page, formatted output
+ zipinfo.txt ZipInfo manual page, formatted output
+ UNZIP.HTX UnZip VMS Help output (Unix-style command-line)
+ UNZIP_CLI.HTX UnZip VMS Help output (VMS-style command-line)
+
+ User Program Documentation ("man") Source Directory
+man/man1/ nroff "man" sources for the main user documentation
+ funzip.1 fUnZip manual page, source
+ unzip.1 UnZip manual page, source
+ unzipsfx.1 UnZipSFX manual page, source
+ zipgrep.1 ZipGrep manual page, source
+ zipinfo.1 ZipInfo manual page, source
+
+ Miscellaneous
+file_id.diz BBS-oriented file describing this archive [?]
+testmake.zip Test archive for checking whether newly built UnZip works
+testmake_ppmd.zip Test archive with PPMd compression
+
+ Source Code
+api.c DLL, object library entry points, support functions
+api.h Header file for api.c
+apihelp.c API help text for DLL versions (currently OS/2 only)
+consts.h Global, initialized variables that never change
+crc32.c Calculate 32-bit CRC of a string buffer
+crc32.h Header file for the CRC-32 code
+crc_i386.S Assembly replacement for crc32() (Intel 386 and newer)
+crypt.c Traditional zip encryption
+crypt.h Header file for crypt.c
+ebcdic.h Static lookup table for ASCII <-> EBCDIC translation
+envargs.c Read options from environment variables
+explode.c Implode compression (method 6)
+extract.c High-level extraction and decryption code
+fileio.c File I/O, password, various utilities
+funzip.c Filter UnZip main(): Extract in a pipe from stdin to stdout
+gbloffs.c Helper program to retrieve offsets of globals struct members
+globals.c Global structure/variable support with reentrancy
+globals.h Header file for globals.c; global structure G
+inflate.c Deflate compression (method 8)
+inflate.h Header file for inflate.c
+list.c UnZip (not ZipInfo) listing
+match.c Pattern-matching for filename wildcards
+process.c Multiple archives, memory management, extra field
+timezone.c Timezone and timestamp supplement
+timezone.h Header file for timezone.c
+ttyio.c Terminal I/O: echo, size; password, pager
+ttyio.h Header file for ttyio.c
+ubz2err.c Callback handler for fatal bzip2 errors (bzip2 support)
+unreduce.c Reduce compression (methods 2-5), stub only
+unshrink.c Shrink compression (method 1)
+unzip.c UnZip main(), usage and options code
+unzip.h Public part of main UnZip header file
+unzpriv.h Private (internal) part of main UnZip header file
+unzvers.h Header with UnZip/UnZipSFX and ZipInfo version info
+zip.h Redirecting header (to unzip.h) for crypt.c
+zipinfo.c ZipInfo pseudo-main()
+
+ OS-Specific Directories (with their own Contents files)
+acorn/ Acorn RISC OS
+amiga/ AmigaDOS
+aosvs/ Data General AOS/VS
+atari/ Atari TOS
+atheos/ AtheOS/Syllable
+beos/ BeOS
+flexos/ FlexOS
+human68k/ X68000/Human68K
+macos/ Macintosh OS (pre-OS-X)
+msdos/ MS-DOS
+netware/ Novell Netware NLM
+os2/ OS/2 (includes DLL stuff)
+qdos/ SMS/QDOS
+tandem/ Tandem NSK
+theos/ Theos
+tops20/ TOPS-20
+unix/ Unix
+vms/ VMS/OpenVMS
+win32/ Windows 9x and Windows NT
+wince/ Windows CE (GUI version)
+windll/ Windows 3.x/9x/NT DLLs
+zos/ z/OS
+zvm/ VM/CMS and MVS
+
+ Optional/Foreign Source Code Directories (which may contain their own
+ Contents files)
+aes_wg/ AES_WG encryption
+bzip2/ bzip2 compression
+libiz/ Information (example program) for the UnZip object library
+szip/ LZMA and PPMd compression
+wrap/ Wrappers for optional source modules
--- /dev/null
+ UnZip Changes and New Features Before Version 6.00
+ --------------------------------------------------
+
+The 5.52 maintenance release fixes a few minor problems found in the 5.51
+release, closes some more security holes, adds a new AtheOS port, and
+contains a Win32 extra-field code cleanup that was not finished earlier.
+The most important changes are:
+
+ - (re)enabled unshrinking support by default, the LZW patents have expired
+ - fixed an extraction size bug for encrypted stored entries (12 excess bytes
+ were written with 5.51)
+ - fixed false "uncompressed size mismatch" messages when extracting
+ encrypted archive entries
+ - do not restore SUID/SGID/Tacky attribute bits on Unix (BeOS, AtheOS)
+ unless explicitly requested by new "-K" command line qualifier
+ - optional support for "-W" qualifier to modify the pattern matching syntax
+ (with -W: "*" stops at directory delimiter, "**" matches unlimited)
+ - prevent buffer overflow caused by bogus extra-long Zipfile specification
+ - performance enhancements for VMS port
+ - fixed windll interface handling of its extraction mode qualifiers
+ nfflag, ExtractOnlyNewer, noflag, PromptToOverwrite; added detailed
+ explanation of their meanings and interactions to the windll documentation
+
+The 5.51 maintenance release adds a command-line CE port, intended for
+batch processing. With the integration of this port, the pUnZip port
+has been revised and "revitalized".
+The most important changes for the general public are a number of
+bug fixes, mostly related to security issues:
+
+ - repair a serious bug in the textmode output conversion code for the 16-bit
+ ports (16-bit MSDOS, OS/2 1.x, some variants of AMIGA, possibly others)
+ which was introduced by the Deflate64 support of release 5.5
+ - fix a long standing bug in the the inflate decompression method that
+ prevented correct extraction in some rare cases
+ - fixed holes in parent dir traversal security code (e.g.: ".^C." slipped
+ through the previous version of the check code)
+ - fixed security hole: check naming consistency in local and central header
+ - fixed security hole: prevent extracted symlinks from redirecting file
+ extraction paths
+
+The main addition in the 5.5 release is support for PKWARE's new Deflate64(tm)
+algorithm, which appeared first in PKZIP 4.0 (published November 2000).
+As usual, some other bugfixes and clean-ups have been integrated:
+
+ - support for Deflate64 (Zip compression method #9)
+ - support for extracting VMS variable length record text files on
+ any system
+ - optional "cheap autorun" feature for the SFX stub
+ - security fixes:
+ * strip leading slash from stored pathspecs,
+ * remove "../" parent dir path components from extracted file names
+ - new option "-:" to allow verbatim extraction of file names containing
+ "../" parent dir path specs
+ - fixed file handle leak for the DLL code
+ - repaired OS2 & WinNT ACL extraction which was broken in 5.42
+
+The 5.42 maintenance release fixes more bugs and cleans up the redistribution
+conditions:
+
+ - removal of unreduce.c and amiga/timelib.c code to get rid of the last
+ distribution restrictions beyond the BSD-like Info-ZIP LICENSE
+ - new generic timelib replacement (currently used by AMIGA port)
+ - more reasonable mapping rules of UNIX "leading-dot" filenames to the
+ DOS 8.3 name convention
+ - repaired screensize detection in MORE paging code
+ (was broken for DOS/OS2/WIN32 in 5.41)
+
+The 5.41 maintenance release adds another new port and fixes some bugs.
+
+ - new BSD-like LICENSE
+ - new Novell Netware NLM port
+ - supports extraction of archives with more than 64k entries
+ - attribute handling of VMS port was broken in UnZip 5.4
+ - decryption support integrated in the main source distribution
+
+The 5.4 release adds new ports, again. Other important items are changes
+to the listing format, new supplemental features and several bug fixes
+(especially concerning time-stamp handling...):
+
+ - new IBM OS/390 port, a UNIX derivative (POSIX with EBCDIC charset)
+ - complete revision of the MacOS port
+ - changed listing formats to enlarge the file size fields for more digits
+ - added capability to restore directory attributes on MSDOS, OS/2, WIN32
+ - enabled support of symbolic links on BeOS
+ - Unix: optional Acorn filetype support, useful for volumes exported via NFS
+ - several changes/additions to the DLL API
+ - GUI SFX stub for Win16 (Windows 3.1) and Win32 (Windows 9x, Windows NT)
+ - new free GCC compiler environments supported on WIN32
+ - many time-zone handling bug fixes for WIN32, AMIGA, ...
+
+The 5.32 release adds two new ports and a fix for at least one relatively
+serious bug:
+
+ - new FlexOS port
+ - new Tandem NSK port
+ - new Visual BASIC support (compatibility with the Windows DLLs)
+ - new -T option (set zipfile timestamp) for virtually all ports
+ - fix for timestamps beyond 2038 (e.g., 2097; crashed under DOS/Win95/NT)
+ - fix for undetected "dangling" symbolic links (i.e., no pointee)
+ - fix for VMS indexed-file extraction problem (stored with Zip 2.0 or 2.1)
+ - further performance optimizations
+
+The 5.31 release included nothing but small bug-fixes and typo corrections,
+with the exception of some minor performance tweaks.
+
+The 5.3 release added still more ports and more cross-platform portability
+features:
+
+ - new BeOS port
+ - new SMS/QDOS port
+ - new Windows CE graphical port
+ - VM/CMS port fully updated and tested
+ - MVS port fully updated and tested
+ - updated Windows DLL port, with WiZ GUI spun off to a separate package
+ - full Universal Time (UTC or GMT) support for trans-timezone consistency
+ - cross-platform support for 8-bit characters (ISO Latin-1, OEM code pages)
+ - support for NT security descriptors (ACLs)
+ - support for overwriting OS/2 directory EAs if -o option given
+ - updated Solaris/SVR4 package facility
+
- UNIX: added new "-^" command line option that switches off the control
character filter for extracted filenames. [Chr. Spieler]
- UNIX: added support for restoring attributes and UID/GID for symbolic
- links when appropiate OS support is provided. [Chr. Spieler]
+ links when appropriate OS support is provided. [Chr. Spieler]
6.00d07 (26 Dec 07):
- New "-D" option which allows skipping of timestamp restoration for extracted
determining the VMS fileorg setting. [Steven M. Schweda]
- extract.c - extract_or_test_files(): the "back at endsig" checking code
is not used for the SFX stub. [Steven M. Schweda]
- - win32: changed all Win32-API calls with string parameters to explicitely use
+ - win32: changed all Win32-API calls with string parameters to explicitly use
the ANSI variant; this removes the dependency on the UNICODE and _UNICODE
compile flags being undefined. [NN, Chr. Spieler]
- zipinfo.c: on WIN32, archive filename display must be fed through codepage
user-supplied BZIP2 (and ZLIB) libraries (user-supplied library is expected
to work with any supported compiler on VAX, so no dependency on the
specific compiler used). [Steven M. Schweda]
- - unzip.c: replaced tab characters in output messages by appropiate number of
+ - unzip.c: replaced tab characters in output messages by appropriate number of
spaces (assuming standard tab spacing of 8 chars), to prevent mis-formatted
output on terminals with non-standard tabstop settings. [S. M. Schweda]
- unix/unix.c
- vms/build_unzip.com, vms/descrip.mms, vms/descrip_src.mms: resolved a
/NAME=AS_IS case issue by changing the linking command for bzip2-enabled
builds to read the unzip code library twice (before and after the bzip2
- object library) to resolve the bzip2 error callback, instead of explicitely
+ object library) to resolve the bzip2 error callback, instead of explicitly
loading the callback function. [Steven M. Schweda]
- vms/NOTES.TXT: cleaned up wording of the Symbolic Links section. [SMS]
- extract.c, fileio.c, process.c, unzpriv.h: fixed recognition of "native
- unix/configure: added working check for lchmod. [SMS]
- unzip.c: added compile option display for MBCS support. [Chr. Spieler]
- unzpriv.h, unix/unxcfg.h, win32/w32cfg.h: the new preprocessor symbol
- NO_MBCS allows to explicitely disable MBCS support. [Chr. Spieler]
+ NO_MBCS allows to explicitly disable MBCS support. [Chr. Spieler]
- INSTALL: documented _MBCS and NO_MBCS preprocessor symbols. [Chr. Spieler]
- unix/configure: added checks for MBCS support. [Chr. Spieler]
--- /dev/null
+UnZip, version 6.10c, ?? ??? 2014
+
+These changes occurred in beta versions 6.10a through 6.10c.
+
+Features added (or removed):
+
+6.10a00 (05 Jul 2010):
+ - Copy over UnZip 6.00 and rename as UnZip 6.10a00. [EG]
+
+6.10a01 (05 Jul 2010):
+ - No feature changes.
+
+6.10a02 (10 Jul 2010):
+ - Add new command parser code from new-cmdparser/unz6-newcmdparser-diffs.txt,
+ which is a modified version of the new Zip parser. Some modifications to
+ account for changes in UnZip since code was written. UnZip now supports
+ use of get_option() to parse the command line, adding support for a
+ command table and long options. Command parsing now mostly similar to
+ that used in Zip, but most of UnZip syntax preserved. One big difference
+ is inverting an option (making negative) is now done by a trailing "-"
+ instead of a leading one. See the long help and the manual for the
+ current syntax of these and all commands. (unzip.c, unzpriv.h, zipinfo.c,
+ vms/cmdline.c) [EG]
+ - Changed zipgrep to cope with the new command parser. Added environment
+ variable ZIPGREP_UNZIP to let the user specify a particular UnZip program
+ to use. (unix/zipgrep) [SMS]
+ - Add new option --license to show the license and note added to short help
+ displayed when no command arguments that this new option exists. Allows
+ distribution of UnZip under the current Info-ZIP license without additional
+ documentation. Calls show_license(). (unzip.c) [EG]
+ - Add preliminary support for AppleDouble storage of resource information on
+ Mac platforms. (extract.c, fileio.c, globals.h, unzip.c, unzip.h,
+ unzpriv.h, unix/unix.c) [SMS]
+ - Add VMS symlink works check. (extract.c) [SMS]
+ - Add new option --options to show all available options. (unzip.c) [EG]
+ - Add strerror() if port does not have one. Add check for mbstr.h.
+ (unzpriv.h, unix/configure, unix/unix.c) [SMS]
+ - Add uname calls to get system identification. (unix/configure,
+ unix/unix.c) [SMS]
+ - Add control of UID/GID and SGID using X_flag and K_flag. (unix/unix.c,
+ vms/vms.c) [SMS]
+ - Add verbose report. (vms/cmdline.c, vms/unz_cli.cld) [SMS]
+ - Update VMS notes. (vms/notes.txt) [SMS]
+ - VMS return code updates and allow restoring old status codes. (vms/vms.c)
+ [SMS]
+
+6.10a03 (30 Jul 2010):
+ - fnfilter() now converts to a wide character string and does the isprint()
+ check on that, avoiding the issue of doing the check on multi-byte
+ characters. (extract.c, win32/win32.c, unzpriv.h, process.c) [EG]
+ - Update TODO list. (ToDo) [EG]
+
+6.10a04 (05 Aug 2010):
+ - Updated INSTALL with latest information. [SMS]
+ - Remove 8-bit ASCII characters from ToDo. Add items. [SMS]
+ - Add ZipInfo "C" option to command table. (unzip.c) [SMS]
+ - Add new option --commandline to show the processed command line and exit.
+ Add new function show_commandline(). Update extended help. (unzip.c,
+ fileio.c, unzip.h, zipinfo.c) [EG]
+
+6.10a05 (08 Aug 2010):
+ - No feature changes.
+
+6.10a06 (09 Aug 2010):
+ - Update version information in description file. (file_id.diz) [EG]
+
+6.10a07 (10 Aug 2010):
+ - Add announcement file. (unzip610a.ann) [EG]
+ - Replace /[NO]CASE_INSENSITIVE with /CASE_MATCH. (vms/unzip_cli.help,
+ vms/unz_cli.cld) [SMS]
+
+6.10a (23 Aug 2010):
+ - Add note to README. Update announcement. (README, unzip610a.ann) [EG]
+
+6.10b01 (12 Sep 2010):
+ - Restore full Windows Unicode support based on diff in win32-experimental
+ directory. Mainly involved adding wide character OS calls to Windows
+ port code. WIN32_WIDE must be defined for the new code to be used, but
+ this should be the default on Windows platforms from NT on. Currently
+ Windows 9x Unicode is partially supported, but this support may be pulled
+ to clean up the code. Some of the new functions include check_for_newerw()
+ has_win32_wide(), wchar_to_wide_string(), wchar_to_local_string(),
+ iswildw(), zstat_win32w(), getNTfiletimeW(), defer_dir_attribsw(),
+ set_direc_attribsw(), FStampIsLocTimeW(), mapnamew(), checkdirw(),
+ NTQueryVolInfoW(), maskDOSdevicew(), extract_or_test_entrylistw(), and
+ map2fatw(). (extract.c, fileio.c, process.c, match.c, globals.h, unzip.c,
+ unzpriv.h, win32/nt.c, win32/nt.h, win32/w32cfg.h, win32/win32.c,
+ win32/vc6/funzip.dsp, win32/vc6/unzip.dsp, win32/vc6/unzipbz2.dsp,
+ win32/vc6/unzipsfx.dsp, windll/vc6/dll/unz32dll.dsp) [EG]
+
+6.10b02 (16 Sep 2010):
+ - Implement -I (--iso-char-set) and -O (--oem-char-set) options to allow user
+ to set a specific ISO or OEM character set that UnZip should translate
+ from to create the internal file name strings. Based on the
+ unzip60-alt-iconv-utf8.patch suggested in a forum thread. This patch is
+ rather simple, just providing the new options to manually set the input
+ character set (generally OEM if archive from Windows and ISO otherwise).
+ These options are currently only available on Unix. This is separate from
+ the Unicode implementation that allows direct conversion between character
+ sets and bypasses these new options if an entry has Unicode. These options
+ are only for converting names from older archives without stored UTF-8 to
+ names that are readable on a Unix platform. This implementation includes
+ a short table to automatically guess the code page for a few common
+ locales. More locales can be added later, and a more complete solution
+ might be implemented later based on something like the libnatspec or
+ librcc libraries. However, the goal is for everyone to move to zippers
+ that support UTF-8 so these options are no longer needed. Enabled by
+ setting the USE_ICONV_MAPPING macro. Uses the iconv library which must be
+ available. (unzip.c, zipinfo.c, unix/unix.c, unix/unxcfg.h) [EG]
+
+6.10b03 (06 Nov 2010):
+ - No feature changes.
+
+6.10b04 (25 Nov 2010):
+ - Resurrected Acorn port by rewriting/updating the makefiles, replacing
+ srcrename utility with 32bit compatible BASIC equivalent, replacing APCS-R
+ swiven.s file with more portable C version, and updating contents & readme
+ files with compilation instructions for the latest compilers. Fixed a few
+ compiler warnings/errors and swapped the os_error struct for the standard
+ _kernel_os_error. (acorn/makefile, acorn/GMakefile, acorn/srcrename,
+ acorn/acorn.c, acorn/riscos.c, acorn/riscos.h, acorn/swiven.c,
+ acorn/swiven.h, acorn/Contents, acorn/ReadMe, acorn/RunMe1st updated.
+ acorn/swiven.s deleted.) [Jeffrey Lee]
+ - Acorn port: Increased max file name/path length to 1024. (acorn/riscos.h)
+ [Jeffrey Lee]
+ - Acorn port: Increased max file name/path length to 1024. (acorn/riscos.h)
+ [Jeffrey Lee]
+ - Acorn port: Added SET_DIR_ATTRIB support, so that directories are created
+ with the right timestamps/attributes. (acorn/riscos.h, acorn/acorn.c)
+ [Jeffrey Lee]
+ - Minor edits to Contents. (acorn/Contents) [EG]
+ - Update VB6 example project to add more comments, change some form object
+ sizes, and update GUI handling of listing and extracting. Update readme.
+ (windll/vb/vbreadme.txt, windll/vb/vbunzip.bas, windll/vb/vbunzip.frm,
+ windll/vb/vbunzip.vbp) [EG]
+ - Add announcement file for UnZip 6.10b. (unzip610b.ann) [EG]
+
+6.10b05 (29 Nov 2010):
+ - No feature changes.
+
+6.10b06 (03 Dec 2010):
+ - Updated INSTALL and README. (INSTALL, README) [EG]
+
+6.10b07 (05 Dec 2010):
+ - No feature changes.
+
+6.10b (10 Dec 2010):
+ - No feature changes.
+
+6.10c01 (15 May 2011):
+ - Clarify VMS usage line. (unzip.c) [SMS]
+ - Add compiler test. (unix/configure) [SMS]
+ - Make -s (spaces to underscores) option generic (unzip.c) [Stan
+ Sieler]
+ - Add optional support for AES encryption compatible with WinZip
+ version (compression method 99). Use Gladman AES implementation.
+ Note that when the optional AES_WG support is not enabled, this still
+ changes the old message:
+ skipping: <name> unsupported compression method 99
+ to:
+ skipping: <name> AES_WG encr method not supported
+ when trying to extract an AES_WG-encrypted file.
+ (crypt.c, crypt.h, extract.c, fileio.c, globals.h, list.c, process.c,
+ unzip.c, unzpriv.h, zipinfo.c) [SMS]
+
+6.10c02 (28 May 2011):
+ - Add ef_scan_for_aes() and ef_strip_aes() for processing AES extra
+ 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]
+ - Add WIN32 entropy_fun(). Add VCC 6 project for compiling in AES
+ encryption. (crypt.c) [EG]
+ - Add AES support to ZipInfo. Add recognition of flag bit 0x0040. (Not
+ sure if this is correct.) (zipinfo.c) [SMS]
+ - Add support for named parameters to configure. Add support for AES
+ encryption. (unix/configure, unix/makefile) [SMS]
+ - Add AES encryption. (vms/build_unzip.com, vms/descrip.mms,
+ vms/descrip_deps.mms, vms/descrip_mkdeps.mms, vms/descrip_src.mms) [SMS]
+ - Add initial VCC6 project for compiling AES on Win32.
+ (win32/vc6/unzip.dsp) [EG]
+ - Update UnZip to more current Zip version of crypt.c, making
+ modifications as needed. (crypt.c) [SMS]
+ - Update testp() and testkey() to support AES. (crypt.c) [SMS]
+
+6.10c03 (24 Jul 2011):
+ - Add AES_WG version to CRYPT_AES_WG line in -v. (unzip.c, unzpriv.h) [SMS]
+ - Add P6 (search vector) and P7 (macro vector) parameters.
+ (vms/collect_deps.com) [SMS]
+
+6.10c04 (05 Aug 2011):
+ - First attempt at support for LZMA compression (method 14). (extract.c,
+ fileio.c, unzip.c, unzpriv.h, lzma/* (from LZMA SDK), unix/configure,
+ unix/Makefile, vms/descrip.mms, vms/descrip_deps.mms,
+ vms/descrip_src.mms) [SMS]
+ - Create start of zos port. (zos/zcc, zos/zld) [AD]
+ - Modify handling of non-ASCI file names (-I/-O options) to automatically
+ guess OEM code page when not already set. Only some common mappings
+ have been added currently. Only used if USE_ICONV_MAPPING is defined.
+ (unix/unix.c) [EG, based on patch by Dmitry Butskoy on Red Hat Bugzilla -
+ Bug 225576]
+
+6.10c05 (13 Aug 2011):
+ - Add LZMA files needed by UnZip from LZMA SDK version 9.20.
+ (lzma/7zfile.c, lzma/7zfile.h, lzma/7zversion.h, lzma/alloc.c,
+ lzma/alloc.h, lzma/lzfind.c, lzma/lzhash.h, lzma/lzmadec.c,
+ lzma/lzmadec.h, lzma/README_LZMA.txt, lzma/types.h, lzma/orig/lzfind.h)
+ [SMS]
+ - Split cmsmvs port into two ports zos and zvm. (cmsmvs/* (removed),
+ zos/ccunzip.exec, zos/mvs.mki, zos/readme.mvs, zos/unzmvsc.job,
+ zos/vmmvs.c, zos/vmmvs.h, zvm/install.cms, zvm/mc.exec, zvm/readme.cms,
+ zvm/unzip.exec, zvm/unzip.makefile, zvm/unzvmc.exec, zvm/vmstat.h,
+ zvm/whatsnew.cms, zvm/zipinfo.exec) [AD]
+ - Drop VMS CASE_INSENSITIVE option as conflicts with CASE_MATCH. Add NAMES
+ option that includes NAMES.LOWERCASE, NAMES.ODS2 (convert names to ODS2),
+ and NAMES.SPACES (convert spaces to underscores). Add CASE_MATCH = BLIND
+ (ignore case) or SENSITIVE (don't ignore differences in case).
+ (vms/cmdline.c, vms/unz_cli.cld, vms/unzip_cli.help) [SMS]
+ - Add note about self-extracting archives. (vms/install.vms) [SMS]
+ - Update VMS help for self-extracting archives. (vms/unzipsfx.hlp) [SMS]
+
+6.10c06 (24 Aug 2011):
+ - Create new Win32 projects for AES_WG and LZMA. Additional cleanup of
+ the Win32 projects is expected before release. (win32/vc6/unzip.dsp,
+ win32/vc6/unzip.dsw, win32/vc6/unzipaes.dsp) [EG]
+
+6.10c07 (12 Sep 2011):
+ - Rename vms/INSTALL.VMS to vms/INSTALL_VMS.txt. Move much of the VMS
+ material from INSTALL to vms/INSTALL_VMS.txt. Minor update to Mac OS X
+ to note adding of AppleDouble Finder info and resource fork storage.
+ (vms/INSTALL_VMS.txt, INSTALL) [SMS]
+ - Change default to -D everywhere, not only on VMS. Update extended
+ help. Update man page. (globals.c, unzip.c, man/unzip.1) [SMS]
+ - Restructure unix build: Restructure, document, reorganize; recognize
+ IBM compilers (z/OS, z/VM, AIX, Linux. iSeries); recognize z/OS system
+ (uname -I variant); add $PROD/flags_bz; support build with system zlib,
+ zlib in tree; support man and doc generation. (unix/configure,
+ unix/Makefile) [AD]
+ - Correct z/OS build script options parsing. (zos/zcc, zos/zld) [AD]
+ - Add z/OS wrapper script for C preprocessor tests. (zos/zccp) [AD]
+ - For unzip -v, emit IBM compiler OS-specific version. (unix/unix.c) [AD]
+ - Customize unix build for z/OS UNIX (HAVE_SYS_TIME_H, sys/time.h,
+ sys/timeb.h, utime.h, et al). (unix/unxcfg.h) [AD]
+ - Add PORT unix/configure macro, allows reuse by z/OS MVS build (under
+ z/OS UNIX) (unix/configure) [AD]
+ - Following changes made to unix/configure, mainly to support z/OS port.
+ (unix/configure) [AD]
+ 1. A new file $PROD/flags_bz is generated containing just the bzip2
+ compilation-related flags.
+ 2. UNAME-related flags now in more legible order.
+ 3. For z/OS, use "uname -I" to generate current z/OS information.
+ 4. Now generates installation flags (BINDIR, BINPERMS).
+ 5. Now generates man page flags (MANEXT, MANDIR, MANPERMS);
+ unix/Makefile supports generic_man and generic_doc.
+ 6. Now generates man page nroff option, currently "-Tascii" or "".
+ 7. Flags renamed for consistency between zip and unzip:
+ - CFLAGS -> CF
+ - CFLAGS_BZ -> CF_BZ
+ - LFLAGS1 -> LF1
+ - LFLAGS2 -> LF2
+ 8. Flags generated are a superset of zip and unzip and include
+ additional header checks.
+ 9. OSDEP_xxxx flags contain OS-dependent values:
+ - OSDEP_C C source files
+ - OSDEP_H C header files
+ - OSDEP_S Assembler source files
+ - OSDEP_OC Object files (C)
+ - OSDEP_OS Object files (assembler)
+ These allows multiple OS-dependent C or assembler source files.
+ 10. Use consistent configuration, naming and recipes for assembler
+ files.
+ 11. Add $PROD/flags values for program extensions:
+ - PMGEXT Executables
+ - DLLEXT DLLs (Shared objects)
+ 12. Add $PROD/flags values for RANLIB, RM and LN.
+ 13. Add $PROD/flags values for AR, required by IBM XLC for AIX 64-bit
+ compiles.
+ 14. Object archive dependencies. Non-blank if library is required:
+ LIB_AES_WG, LIB_LZMA, LIB_BZ, LIB_Z.
+ 15. ZLIB and BZIP2 support now consistent:
+ - Supports build within tree via bzip2/Makefile or zlib/Makefile
+ (if present)
+ - Supports build with OS-owned libbz2.a (IZ_BZIP2=bzip2, ./bzip2 is
+ empty)
+ - Supports build with OS-owned libz.a (IZ_ZLIB=zlib, ./zlib is empty)
+ - Returns MK_BZ to allow configure to return system-specific BZIP2
+ makefile name
+ 16. Now supports AF for assembler flags.
+ 17. Support compiler listing options (+ CC on z/OS) for LIST=1.
+ 18. Cleanup targets now same on zip and unzip (clean, clean_bzip2,
+ clean_exe)
+ 19. All make targets are now explicit for portability; SysV make pattern
+ matching is not as powerful as gmane or z/OS make (MKS).
+ 20. .SUFFIX reset to prevent builds from using default .c -> .o rules.
+ 21. On z/OS, use CC=c89 (xlc ends with sigkill for failing compiles).
+ 22. On AIX (with IBM XL C) use CC=c89.
+ 23. Use unzip nl_langinfo() test instead of following zip test (which
+ fails because codeset is not an int).
+ 24. Add test for sys/param.h (for -DNO_PARAM_H).
+ 25. Add test for sys/time.h (separate from entry timing).
+ 26. Add tests for sys/timeb.h and utime.h.
+ 27. Set z/OS linker flag.s
+ 28. Add PORT unix/configure parm, allows reuse by z/OS MVS build (under
+ z/OS UNIX) [AD]
+ - Minor updates to -D option help and option descriptions. Add warning
+ regarding change in option negation (trailing "-" instead of leading).
+ Add note that split support should be coming by release of UnZip 6.10.
+ Add mention of automatic code page selection in some cases, but can be
+ overridden by use of -I and -O. (unzip.c) [EG]
+ - Additional updates to UnZip man page. (man/unzip.1) [EG]
+
+6.10c08 (22 Nov 2011):
+ - Add initial implementation of a user-triggered progress message.
+ Enabled by default, disabled by defining the C macro NO_USER_PROGRESS.
+ Adds a SIGUSR1 signal handler (non-VMS) or a control-T AST (VMS),
+ user_progress(). On non-VMS systems, add option -si to display the
+ UnZip process ID, for convenience in forming a "kill -USR1 <pid>"
+ command. (unzip.c, unzpriv.h, vms/vms.c) [SMS]
+
+6.10c09 (7 March 2014):
+ - Added optional support for PPMd compression (method 98). (extract.c,
+ lzma/Ppmd.h, lzma/Ppmd8.c, lzma/Ppmd8.h, lzma/Ppmd8Dec.c,
+ lzma/README_LZMA.txt, unix/configure, unix/Makefile,
+ vms/build_unzip.com, vms/descrip.mms, vms/descrip_deps.mms,
+ vms/descrip_mkdeps.mms, vms/descrip_src.mms) [SMS]
+ - Added a PPMd test archive to the kit, "testmake_ppmd.zip", and a new
+ "make" target, "test_ppmd" to use it. (testmake_ppmd.zip,
+ unix/Makefile, unix/test_unzip.sh, vms/descrip.mms,
+ vms/test_unzip.com) [SMS]
+ - Added recognition (only) of JPEG compression (method 96). (list.c,
+ unzpriv.h, zipinfo.c) [SMS]
+ - Added archive name to user-triggered progress message. (unzip.c) [SMS]
+ - Added data-dependent supplementary info to verbose test (-tv) report
+ for LZMA- and PPMd-compressed data. (extract.c, man/unzip.1) [SMS]
+ - Initial attempt to provide a callable-UnZip interface on UNIX and VMS
+ systems. Specify LIBUNZIP at build time to create libizunzip.a
+ (Unix) or LIBIZUNZIP.OLB and LIBIZUNZIP.OPT (VMS), which may be
+ linked with a user-supplied program. Comments in an example main
+ program source module, libiz/izunzip_example.c, explain some usage
+ details. (libiz/izunzip_example.c, unix/configure, unix/Makefile,
+ vms/build_unzip.com, vms/descrip.mms, vms/descrip_deps.mms,
+ vms/descrip_mkdeps.mms, vms/descrip_src.mms) [SMS]
+ - Initial attempt to support Windows MinGW environment with UNIX
+ builders ("generic" target). No DLL. (unix/configure, unix/Makefile)
+ [SMS]
+ - Added support for BAE Systems STOP OS, which lacks chown(). The
+ "configure" script now checks for chmod() and chown(), and unix.c now
+ honors the resulting NO_CHMOD and NO_CHOWN macros. (unix/configure,
+ unix/unix.c) [SMS]
+ - Extended the -j/--junk-dirs option to accept an optional value, the
+ number of directory levels to discard. Moved code to handle
+ directory junking out of the system-specific mapname[w]() functions
+ into the common extract.c:extract_or_test_entrylist[w](). Not
+ implemented on Tandem. Windows DLL sets uO.jflag from lpDCL->ndflag
+ as well as it can, but needs more than one bit to use the extended
+ capability. (extract.c, globals.h, unzip.c, unzpriv.h, 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, msdos/msdos.c, netware/netware.c, os2/os2.c,
+ qdos/qdos.c, theos/theos.c, unix/unix.c, vms/cmdline.c,
+ vms/unz_cli.cld, vms/vms.c, win32/win32.c, windll/windll.c) [SMS]
+ - Added C macro DIAG_SFX for developers to enable the "-v" diagnostic
+ report in UnZipSFX. Discouraged for normal use. (unzip.c) [SMS]
+ - On VMS, added HELP_TEXT as a builder option/target. Specifying
+ HELP_TEXT creates the text files UNZIP.HTX and UNZIP_CLI.HTX, which
+ are the output from "help unzip..." commands using the corresponding
+ .HLP help library source files. (vms/build_unzip.com,
+ vms/descrip.mms) [SMS]
+ - VMS CLI changes: Restore but deprecate /[NO]CASE_INSENSITIVE, replace
+ /CASE_MATCH (6.10a07) with more general /MATCH = CASE (-C). When C
+ macro WILD_STOP_AT_DIR is defined, add /MATCH = [NO]WILD_MATCH_SLASH
+ (-W). (vms/cmdline.c, vms/unzip_cli.help, vms/unz_cli.cld) [SMS]
+ - Changed C macro USE_ICONV_MAPPING to ICONV_MAPPING, and added "make"
+ macro ICONV to the Unix builder options to enable the feature. Added
+ ICONV_MAPPING to the "special compilation options" section of the
+ "-v" report. (unzip.c, zipinfo.c, beos/beocfg.h, beos/beos.c,
+ unix/configure, unix/unix.c, unix/unxcfg.h) [SMS]
+ - Format changes to ZipInfo header and totals report sections. The
+ totals section now includes separate member counts for directories
+ and files, and, where SYMLINKS is defined, links. A new option, -mc
+ (--member_counts, /[NO]MEMBER_COUNTS) allows the user to suppress the
+ new directories/files/links counts. Test archives have new-format
+ ZipInfo reports (without the new member counts, to accommodate
+ systems without symlinks). (testmake.zip, testmake_ppmd.zip,
+ unix/Makefile, unix/test_unzip.sh, unzip.c, unzip.h,
+ vms/test_unzip.com, zipinfo.c) [SMS]
+ - Volume labels can now be set on VMS (options: -$, --volume-label,
+ /VOLUME_LABEL). The destination device must be allocated, not
+ shared. (unzip.c, unzip.h, vms/vms.c) [SMS]
+ - Added option -k/--keep-permissions on AtheOS, BeOS, Unix, and VMS, to
+ control how archived permissions or protections are determined on
+ extracted files and directories. The default behavior has changed
+ from previous UnZip versions. Now, by default, on AtheOS, BeOS, and
+ Unix, the current umask value is applied (to the normal
+ user/group/other permissions). On VMS, the current default
+ protection is applied to the UIC-based (SOGW) protections. With -k,
+ the archived permissions are restored without regard to the Unix umask
+ or VMS default protection. (This was the default behavior in previous
+ UnZip versions.) With -k-, the archived permissions are ignored, so
+ only the Unix umask or VMS default protection is effective. (As
+ before, on VMS, directories are always created without any Delete
+ access.) Added new VMS CLI options /RESTORE = PROTECTION =
+ [LIMITED|ORIGINAL] for -k. Define the C macro NO_KFLAG to disable
+ the -k option, and restore the old behavior (or something like it).
+ Forum topic: http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=100
+ (atheos/athcfg.h, atheos/atheos.c, beos/beocfg.h, beos/beos.c,
+ man/unzip.1, unix/unix.c, unix/unxcfg.h, unzip.c, unzip.h, unzpriv.h,
+ vms/cmdline.c, vms/unz_cli.cld, vms/unzip_cli.help, vms/UNZIP_DEF.RNH,
+ vms/vms.c, vms/vms.h) [SMS]
+ - Added options -ka/--keep-acl (/RESTORE = ACL) on VMS, to control
+ restoration of ACL. Added VMS CLI option /RESTORE = OWNER (-X) to
+ control restoration of owner/UIC. With -k/--keep-permission
+ (/RESTORE = PROTECTION), these options allow independent control over
+ the restoration of ACL, protection, and owner/UIC. (man/unzip.1,
+ unzip.c, unzip.h, vms/cmdline.c, vms/unz_cli.cld, vms/unzip_cli.help,
+ vms/vms.c) [SMS]
+ - Added options on Mac OS X to provide better control over which
+ Mac-specific file attributes are _not_ restored on extracted files:
+ All extended attributes, -Je/--junk-extattr; Finder info,
+ -Jf/--junk-finder; Quarantine ("com.apple.quarantine"),
+ -Jq/--junk-qtn; Resource fork, -Jr/--junk-rsrc. (By default, all
+ are restored.) Note that the Quarantine attribute is one of the
+ extended attributes, so specifying -Je inhibits restoring the
+ Quarantine attribute, along with all other extended attributes. The
+ extended attribute features are available on Mac OS X 10.4 and later.
+ (The "xattr" command can be used to remove selected attributes after
+ extraction.) (fileio.c, unzip.c, unzip.h, unzpriv.h) [SMS]
+ - Experimental new builders for Microsoft Visual Studio (Visual C++)
+ 2010. Optional feature selection for each program (project) is done
+ entirely using <project> Properties > Configuration Properties >
+ C/C++ > Preprocessor > Preprocessor Definitions > <Edit...>. Some
+ popular options (macros) are included, but are disabled by an easy to
+ remove "x_" prefix. The "unzip" project is used whether or not bzip2
+ compression support is desired. There is now no separate "unzipbz2"
+ project for UnZip with bzip2 support. The "unzip" and "unzipsfx"
+ projects have been marked as dependent on the "libbz2" project. If a
+ bzip2 source kit has not been installed in the "bzip2/" subdirectory,
+ then the "libbz2" project build will fail, but the "unzip" project
+ build should still succeed, so long as the C macro BZIP2_SUPPORT is
+ not defined. In the "Debug" configuration, DIAG_SFX is defined,
+ which enables the "-v" report in the UnZipSFX executable.
+ (ubz2err.c, win32/vc10/unzip.sln, win32/vc10/funzip/funzip.vcxproj,
+ win32/vc10/funzip/funzip.vcxproj.filters,
+ win32/vc10/libbz2/libbz2.vcxproj,
+ win32/vc10/libbz2/libbz2.vcxproj.filters,
+ win32/vc10/unzip/unzip.vcxproj,
+ win32/vc10/unzip/unzip.vcxproj.filters,
+ win32/vc10/unzipsfx/unzipsfx.vcxproj,
+ win32/vc10/unzipsfx/unzipsfx.vcxproj.filters, wrap/aescrypt.c,
+ wrap/aeskey.c, wrap/aestab.c, wrap/crc_i386.c, wrap/fileenc.c,
+ wrap/hmac.c, wrap/LzFind.c, wrap/LzmaDec.c, wrap/Ppmd8.c,
+ wrap/Ppmd8Dec.c, wrap/prng.c, wrap/pwd2key.c, wrap/sha1.c) [SMS]
+ - Command-line syntax errors should now trigger a Usage explanation,
+ like the brief help (-h, /HELP) report. When triggered by an error,
+ this report now includes a listing of any options environment
+ variables (UNZIP, UNZIPOPT, UNZIP_OPTS, ...) which are defined (and
+ might be causing trouble in non-obvious ways). The -v (/VERBOSE)
+ report still shows all the options environment variables, whether or
+ not they're defined. If enough users object to the (bulky?) Usage
+ report, we may be persuaded to provide a way to disable it.
+ (unzip.c, unzpriv.h, vms/cmdline.c) [SMS]
+ - VMS CLI changes. Added /[NO]JAR (--jar), /WILD_MATCH (-W).
+ Deprecated /[NO]TIMES in favor of new /[NO]DECIMAL_TIME.
+ (vms/cmdline.c, vms/unz_cli.cld, vms/unzip_cli.help) [SMS]
+ - The Unix and VMS builders now support "PROD=subdir", allowing the
+ user to specify a destination subdirectory for product files (object
+ files, object libraries, executables, and so on), instead of getting
+ everything in the main, top-level directory on Unix, or the
+ automatically chosen subdirectory on VMS. This feature is intended
+ to make it easier to use one source tree for multiple build
+ configurations (different compilers, options, hardware architectures,
+ and so on). For details, see INSTALL and [.vms]INSTALL_VMS.txt (and
+ the builder files themselves). (INSTALL, unix/configure,
+ unix/Makefile, unix/mlz.sh, vms/build_unzip.com, vms/descrip.mms,
+ vms/INSTALL_VMS.txt) [SMS]
+ - Experimental implementation of symbolic links on Windows (Vista or
+ later?). To activate, define C macro SYMLINKS. Slightly improved
+ symlink error handling/messages on all symlink-capable system types.
+ On Windows XP, the build may work with SYMLINKS defined, but the
+ resulting UnZip executable may fail immediately with exit status
+ (Command Prompt: %ERRORLEVEL%, PowerShell: $LASTEXITCODE) -1073741511
+ (0xC0000139), "Entry Point Not Found", possibly with a pop-up message
+ which mentions CreateSymbolicLinkA (and KERNEL32.dll).
+ (extract.c, fileio.c, unzpriv.h, win32/w32cfg.h, win32/win32.c) [SMS]
+ - Added initial support in ZipInfo for a proposed extra field type
+ (0x414c = "LA") containing attributes which are missing from the
+ local directory header. (unzpriv.h, zipinfo.c) [SMS]
+ - Added --version as a synonym for -v/--verbose. When used as the only
+ option, the program version, build options, and relevant environment
+ variables are displayed. (unzip.c, unzip.txt, unzpriv.h,
+ man/unzip.1) [SMS]
+ - Added library interface function UzpFeatures() to provide an
+ optional-feature string (a program-friendly edition of the "special
+ compilation options" section of the "-v/--verbose" report. (api.c,
+ unzip.h, libiz/izunzip_example.c, windll/vc10/windll32.def) [SMS]
+ - Added new -da/--auto-extract-dir (/[NO]AUTO_DIRECTORY) option to
+ specify a destination directory for extracted files which is derived
+ from the base name of the archive. For example, with -da, extraction
+ of "fred.zip" is done into subdirectory "fred" instead of into the
+ current directory. (On VMS, subdirectory "[.fred]".) Added new exit
+ status value, IZ_BADDEST (84), for failure to create automatic
+ destination directory. (fileio.c, process.c, unzip.c, unzip.h,
+ man/unzip.1, vms/cmdline.c, vms/unzip_cli.help, vms/UNZIP_CLI.RNH,
+ vms/unz_cli.cld, vms/vms.c) [SMS]
+ - Added new command-line (argc, argv[]) interface to the Windows DLL,
+ which should be more stable than the old binary structure interface.
+ A revised example program, unzipstb.c (now in the windll/ directory),
+ illustrates usage. (api.c, unzip.c, unzip.h, unzpriv.h, zipinfo.c,
+ win32/win32.c, windll/unzipstb.c, windll/windll.c,
+ windll/windll32.def, windll/vc10/unzip32_dll.sln,
+ windll/vc10/unzip32_dll/unzip32_dll.vcxproj,
+ windll/vc10/unzip32_dll/unzip32_dll.vcxproj.filters,
+ windll/vc10/unzipstb/unzipstb.vcxproj,
+ windll/vc10/unzipstb/unzipstb.vcxproj.filters) [SMS]
+
+6.10c10 (? ??? 2014):
+ - Added initial support for Windows directory symlinks (using a symlink
+ name with a trailing slash) on Unix, VMS, and Windows. (extract.c,
+ process.c, unzpriv.h, zipinfo.c, unix/unix.c, vms/vms.c,
+ win32/w32cfg.h, win32/win32.c) [EG, SMS]
+
+
+Bugs fixed:
+
+6.10a00 (05 Jul 2010):
+ - No bug fixes.
+
+6.10a01 (05 Jul 2010):
+ - No bug fixes.
+
+6.10a02 (10 Jul 2010):
+ - No bug fixes.
+
+6.10a03 (30 Jul 2010):
+ - Fixed compile problems involving funzip and use of zlib. (inflate.c) [SMS]
+ - Changed SFX to allow --license, but not --options. Removed some redundant
+ "BETA" messages, and an unreachable "return". (unzip.c) [SMS]
+ - Fixed various builder problems involving the use of zlib, or when defining
+ BZIP2_SFX to get bzip2 compression support in UnZipSFX. (unix/configure,
+ unix/Makefile) [SMS]
+ - Changed some UNIX system ID info to agree with the more precise names used
+ by Zip. For example, "(HP-UX)" -> "(HP-UX B.11.31 ia64)". (unix/unix.c)
+ [SMS]
+ - Changed VMS version (";nnn") deletion code to leave ";" (no digits)
+ unchanged. (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, msdos/msdos.c, netware/netware.c, os2/os2.c,
+ 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]
+
+6.10a04 (05 Aug 2010):
+ - Set minimum value of u0.X_flag to -1 instead of 0, allowing flag to take on
+ values -1, 0, and 1. Update -S flag comment. (unzip.c) [SMS]
+ - Change vms_unzip_cmdline() from ulg to unsigned. (unzpriv.h) [SMS]
+ - Add newlines to command parser error messages. (unzip.c) [EG]
+
+6.10a05 (08 Aug 2010):
+ - Change fnfilter() from using code used for Unicode for wide character
+ conversions to using standard ANSI wide calls, avoiding dependencies
+ on zwstring and so the need to restructure that code so it works in
+ all contexts. (extract.c) [EG]
+
+6.10a06 (09 Aug 2010):
+ - Add (char *) casts in fnfilter(). Add (ulg) cast in utf8_to_ucs4_string().
+ (extract.c, process.c) [SMS]
+
+6.10a07 (10 Aug 2010):
+ - Add more -q- to cancel possible previous -q. (vms/cmdline.c) [SMS]
+
+6.10a (23 Aug 2010):
+ - Worked around a limitation in VAX C V3.1-051 involving
+ "\"-continuation of "#if" directives. Restored lost "-J" to option
+ table on Mac OS X. Created J_FLAG macro to enable -J option. (unzip.c,
+ unzip.h) [SMS]
+
+6.10b01 (12 Sep 2010):
+ - Some fixes to Unicode processing in association with Win32 implementation.
+ (See above file list). [EG]
+
+6.10b02 (16 Sep 2010):
+ - Avoid ISO/OEM translation if main path has UTF-8 bit set. Changed ==
+ to >= in version check. (unzip.h, fileio.c) [from forum "Info-ZIP Bugs
+ > UnZip Bugs > unzip UTF8 on linux" thread. [(dennislkj), EG]
+
+6.10b03 (06 Nov 2010):
+ - Add __G__ to multiple places to fix compile problems if REENTRANT is
+ defined. (process.c, unzip.c, unzip.h, unzpriv.h, zipinfo.c, vms/vms.c)
+ - Move local variable uxattr definition higher up. Set DOS subdir bit if
+ entry path ends in "/". Get process RMS_DEFAULT values only if not
+ REENTRANT. (vms/vms.c) [SMS]
+ - Change dw->fn to wide version dw->fnw in Trace statement. Free
+ structure values G.unipath_filename and G.unipath_widefilename to help
+ debugging. Set G.unipath_widefilename to either translated
+ G.unipath_filename if set or translation of standard G.filename, to fix
+ bug where this was not set when using Unicode in Win32 and no Unicode
+ for this entry. (extract.c) [EG]
+ - Change (1 << 11) to UTF8_BIT macro. (extract.c, process.c) [EG]
+ - Bit 2 of internal attributes for an entry is the PKWare verification
+ 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]
+ - 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]
+ - Some #if #endif formatting. Long option help updates. Minor updates for
+ -I and -O options. (unzip.c) [EG]
+ - Added missing __G__ to WinDLL function call. Added missing buffer size
+ parameter to DLL *G.lpUserFunctions->replace() callback function. DLL
+ compiles, but needs testing. (extract.c) [EG]
+
+6.10b04 (25 Nov 2010):
+ - See features above for some related bug fixes.
+
+6.10b05 (29 Nov 2010):
+ - Fix bug from previous fix where uxattr was not being set reliably.
+ (vms/vms.c) [SMS]
+
+6.10b06 (03 Dec 2010):
+ - No bug fixes.
+
+6.10b07 (05 Dec 2010):
+ - Fix bug by adding missing line end. (vms/hlp_lib_next.com) [SMS]
+
+6.10b (10 Dec 2010):
+ - No bug fixes.
+
+6.10c01 (15 May 2011):
+ - VMS-specific problem could cause "unzip -a" to truncate the last line
+ in a text file which had a one-character line ending (like LF) which
+ fell at the end of an internal buffer. (vms/vms.c) [SMS]
+
+6.10c02 (28 May 2011):
+ - Changed the exit handler to use echorig() to restore the original
+ terminal echo setting, instead of echon() to enable echo
+ unconditionally. (Actually implemented only on VMS.) (fileio.c,
+ ttyio.c, ttyio.h) [SMS]
+ - Changed the carriage-control scheme used when an unfinished output line
+ to stdout is interrupted by an error message to stderr. On VMS, the old
+ method produced spurious blank lines, and error messages could be
+ overwritten by succeeding output lines. Please report any new problems
+ with error message format/placement. (extract.c, fileio.c, globals.h,
+ process.c) [SMS]
+ - Updates to decrypt() to fix some minor AES header length issues.
+ (crypt.c) [SMS]
+ - Update testkey() for AES. (crypt.c) [SMS]
+ - Minor bug fixes for AES and for making crypt similar in Zip and UnZip.
+ (crypt.h) [SMS]
+ - Add extra field processing for AES. Account for extra AES data in file
+ data. Replace fprintf() use with Info(). (extract.c, unzpriv.h) [SMS]
+ - Additional AES fixes. (fileio.c, globals.h) [SMS]
+ - Spelling fixes. (history.600, readme, unzip.h, unzpriv.h,
+ cmsmvs/vmmvs.h, macos/history.txt, windll/contents) [SMS]
+ - Minor wording updates. Add descriptions for CRYPT_AES_WG and
+ AES_WG_SFX. Describe support for new CC=gcc format for parameters.
+ (INSTALL) [SMS]
+ - Update method list to include AESencr. (list.c) [SMS]
+ - Update VMS example in help message. Add -v line for CRYPT_AES_WG.
+ Change compiler option error from PK_BADERR to PK_COMPERR. Add
+ byte endian runtime check. Remove CryptDate from Crypt -v line.
+ (unzip.c, unzip.h) [SMS]
+ - Add AES support to SFX. Define AESENCRED as 99. Define EF_AES_WG
+ as 0x9901. (unzpriv.h) [SMS]
+ - Update comments to match latest makefile changes. Remove support for
+ gcc target as the CC=gcc parameter covers that now. (unix/configure)
+ [SMS]
+ - Message wording changes. (vms/collect_deps.com) [SMS]
+ - Add new COMPERR error. (vms/unzip_msg.msg) [SMS]
+ - Change NAM to NAMX. Add some SYS defines. (vms/vms.c, vms/vms.h,
+ vms/vmscfg.h) [SMS]
+ - Reset file pointer even on failure to fix problem. (win32/win32.c) [????]
+ - Add (int) cast to n assignment in testkey() for type mismatch. (May
+ limit the range of test cases.) (crypt.c) [EG]
+ - Miscellaneous code tidying (white space, mostly). (crypt.c, extract.c,
+ fileio.c, match.c, unzip.c, acorn/acorn.c, unix/unix.c, unix/unxcfg.h,
+ vms/cmdline.c, win32/win32.c) [SMS]
+
+6.10c03 (02 Aug 2011):
+ - Replace crypt.c with version from Zip 3.1d14. In brief, changes for
+ AES_WG, updates in AES_WG and ZCRYPT documentation, fix eb_eas == NULL
+ issue, zipcloak() updates, change STANDARD_ENCRYPTION to
+ TRADITIONAL_ENCRYPTION, fix AES_WG password and MAC issue, remove
+ Win32 entropy_fun(), and add some type casts. (crypt.c) [SMS]
+ - Change AES to AES_WG. (crypt.h, extract.c, globals.h, unzip.c,
+ zipinfo.c) [SMS]
+ - Add BadEasMacMsg message. Change #if defined(CRYPT) to #if CRYPT.
+ Pass in cmpr_vers_aes to ef_scan_for_aes(). Change bytes_put_out from
+ zoff_t to zusz_t. Add aes_wg_mac storage. Clear aes_mac_mismatch
+ if entry not AES encrypted. Update bytes_put_out loop. Add
+ aes_mac_mismatch error message. Fix MAC issue. (extract.c) [SMS]
+ - Add size check before calling fcrypt_decrypt(). (fileio.c) [SMS]
+ - Add ucsize_aes global for AES uncompressed bytes left do decrypt.
+ (globals.h) [SMS]
+ - Change AESencr to AES_WG as compression method name. (list.c) [SMS]
+ - Formatting updates. Remove tabs. (match.c, acorn/acorn.c,
+ unix/unix.c, unix/unxcfg.h, vms/cmdline.c) [SMS]
+ - Include aes_wg/iz_aes_wg.h. Change elif to else if. (unzip.c) [SMS]
+ - Remove unused constant UNZIP_AESVERS as there is no specific PKZIP
+ version associated with WinZip AES encryption. (unzpriv.h) [SMS]
+ - Add IZ_MIN() for doing min of two values. (unzpriv.h) [SMS]
+ - Change AES-ed to AES_WG-ed. Update AES extra field output.
+ Interpret AES extra field. (zipinfo.c) [SMS]
+ - Update aes_wg directory to use latest IZ_AES_WG files. Remove
+ original files, just keep current files. (aes_wg/aes.h,
+ aes_wg/aescrypt.c, aes_wg/aeskey.c, aes_wg/aesopt.h, aes_wg/aestab.c,
+ aes_wg/brg_endian.h, aes_wg/fileenc.c, aes_wg/fileenc.h,
+ aes_wg/hmac.c, aes_wg/hmac.h, aes_wg/iz_aes_wg.h, aes_wg/license.txt,
+ aes_wg/main.c, aes_wg/prng.c, aes_wg/prng.h, aes_wg/pwd2key.c,
+ aes_wg/pwd2key.h, aes_wg/sha1.c, aes_wg/sha1.h) [EG]
+ - Change AES to AES_WG. Other minor updates for AES_WG encryption.
+ (unix/configure) [SMS]
+ - Change aes to aes_wg. Update command line help. Move instructions
+ for manuals to end of help. Change LIB_AES to LIB_AES_WG. Change
+ some single quotes to double quotes. Add -DNO_LCHMOD to unzips
+ rule for rs6000 (IBM RS/6000 under AIX 3.2). (unix/makefile) [SMS]
+ - Change AES to AES_WG. Change ZIP.OLB to UNZIP.OLB. Add UNZIPSFX
+ library replace. (vms/build_unzip.com) [SMS]
+ - Documentation updates. (vms/descrip.mms) [SMS]
+ - Changes to convert from AES to AES_WG. (vms/descrip_deps.mms,
+ vms/descrip_mkdeps.mms) [SMS]
+ - Remove VAXC, GNUC dependencies. Change AES to AES_WG. Add SFX
+ object library. (vms/descrip_src.mms) [SMS]
+ - Update multi-line string formatting. (win32/win32.c) [SMS]
+ - Update options list for UnZip for -C, changing ZIO to UZO in
+ UZO (UnZip) list so option is available to UnZip. Option had
+ been put twice in ZipInfo (ZIO) list. (unzip.c) [EG]
+ - Add comment about disk number == 1. (process.c) [EG]
+
+6.10c04 (05 Aug 2011):
+ - Replace some Mac-specific AppleDouble-related code which got omitted
+ between 6.10a and 6.10b(?) (extract.c) [SMS]
+ - Replace lost code for enhanced "apparent file type" message in
+ ZipInfo. A hex value is now included, to show useful info for
+ unexpected values (not "binary", "ebcdic", or "text"). zipinfo.c [SMS]
+ - Replace lost change enabling "-s" everywhere. Replace lost change to
+ VMS usage text. (unzip.c, unzip.h) [SMS]
+ - Remove an unused variable (aes_strngth). (zipinfo.c) [EG, SMS]
+ - Reform a defective ZCRYPT version test, now handling version 3.0 case.
+ (ttyio.c) [SMS]
+ - Replace obsolete test Zip archive, to give "make test" a chance to
+ succeed. (testmake.zip) [SMS]
+ - Add "testmake_zip" target to UNIX "make" file, to help in creating
+ testmake.zip. (Formerly not done on UNIX.) (unix/Makefile) [SMS]
+ - New command-line processing in ZipInfo miscounted non-option
+ arguments, causing loss of the heading and total sections in default
+ reports. (zipinfo.c) [SMS]
+ - New command-line processing in UnZipSFX lost the first non-option
+ argument (member to extract, not archive name). (unzip.c) [SMS]
+ - Various VMS CLI bad behavior involving /HELP and /VERBOSE.
+ (vms/cmdline.c) [SMS]
+ - Remove _orig files. (crypt.c_orig, crypt.h_orig, extract.c_orig,
+ fileio.c_orig, globals.h_orig, INSTALL._orig, list.c_orig,
+ process.c_orig, README._orig, ttyio.c_orig, ttyio.h_orig,
+ unshrink.c_orig, unzip.c_orig, unzip.h_orig, unzpriv.h_orig,
+ zipinfo.c_orig, unix/configure._orig, unix/Makefile._orig,
+ unix/unix.c_orig, vms/build_unzip.com_orig, vms/collect_deps.com_orig,
+ vms/descrip.mms_orig, vms/descrip_deps.mms_orig,
+ vms/descrip_mkdeps.mms_orig, vms/descrip_src.mms_orig, vms/vms.c_orig,
+ vms/vms.h_orig, vmscfg.h_orig) [EG]
+ - Rename bzip2 readme from 00README.IZ to README_bz2.txt.
+ (README_bz2.txt) [EG]
+ - 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.
+ (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
+ no reason we can't just go with it. This only is relevant for Zip64
+ archives. (process.c) [EG]
+ - Change i and b to unsigned in AES_WG endian test. (unzip.c) [SMS]
+ - Add possible fix for MINIX needing <unistd.h>. (unzpriv.h) [SMS, adapted
+ from user suggestion]
+ - New UNIX(-like) shell script for basic UnZip testing. Builder
+ changed to use it, instead of in-line actions. (unix/Makefile,
+ unix/test_unzip.sh) [SMS]
+ - VMS builders now generate module-ID options files. vms/unzip.opt and
+ vms/unzipsfx.opt have been removed from the kit. Add new NOCOMPILE, NOEXE,
+ LZMA, and TEST commands. Command-line options for the VMS DCL builder
+ should now agree better with those for Zip. (vms/build_unzip.com,
+ vms/descrip.mms, vms/unzip.opt (removed), vms/unzipsfx.opt (removed),
+ vms/optgen.com (new)) [SMS]
+ - Added VMS CLI option, /LICENSE, equivalent to --license. Change
+ VERBOSE to VERBOSE.COMMAND for verbose_command. Update to use -h and
+ -hh help options supported by new command line parser. (vms/cmdline.c,
+ vms/unz_cli.cld, vms/unzip_cli.help) [SMS]
+ - Significant updates to VMS Contents. (vms/contents) [SMS]
+ - New VMS DCL procedure for basic UnZip testing. New MMS/MMK builder
+ target, TEST, to run it, and CLEAN_TEST to clean up after it.
+ (vms/descrip.mms, vms/test_unzip.com (new), vms/install.vms) [SMS]
+ - Add definition of C macro _SZ_NO_INT_64 for LZMA on VAX.
+ (vms/descrip_mkdeps.mms, vms/descrip_src.mms) [SMS]
+ - Initial update to README. (README) [SMS]
+
+6.10c05 (13 Aug 2011):
+ - Bug fix for array overflow and slight enhancement of "Available
+ options" listing. (unzip.c) [EG]
+ - Fix for improper argument count for -Z bug. (zipinfo.c) [EG, SMS]
+
+6.10c06 (24 Aug 2011):
+ - Change UNZIP_BZ2VERS to UNZIP_BZIP2_VERS to be consistent with other
+ version macros. Set UnZip (compatible with) version based on inclusion
+ of BZIP2 or LZMA support. (extract.c, unzpriv.h) [SMS]
+ - Change %ld in a Trace() to %lld. (This would be incompatible with
+ Win32, which uses %I64d, but not a problem unless Trace() is used.)
+ Remove G.incnt < LZMA_PROPS_SIZE + 4 check from LZMA properties
+ length check. (extract.c) [SMS]
+ - Add (unsigned int) cast to ucsize assignment to fix 64-bit to 32-bit
+ assignment. (extract.c) [EG]
+ - Add (long) cast to G.ucsize_aes in IZ_MIN() to fix 64-bit to 32-bit
+ assignment. (fileio.c) [EG]
+ - Rename 7z* files to Sz*. (unzip.c, SzVersion.h, lzma/7zFile.c (remove),
+ lzma/7zFile.h (remove), lzma/7zVersion.h (remove), lzma/SzFile.c,
+ lzma/SzFile.h, lzma/SzVersion.h) [SMS, EG]
+ - Add encryption notices. (unzip.c) [SMS]
+ - Update LZMA Readme. (README_LZMA.txt) [SMS]
+ - Change 7z* to Sz*. Explicitly use sh to run test_unzip.sh.
+ (unix/makefile) [SMS]
+ - For VMS, update comments for SFX regarding AES_WG and LZMA. Note that
+ SFX does not include AES_WG by default. Change 7z* to Sz*.
+ (vms/build_unzip.mms, vms/descrip.mms, vms/descrip_deps.mms,
+ vms/descrip_src.mms) [SMS]
+ - Update VMS Install documentation. (vms/install.vms) [SMS]
+ - Minor updates to VMS test script. (vms/test_unzip.com) [SMS]
+ - Repackage Win32 VC 6 projects, creating new project unzipaes for AES_WG
+ and moving configurations dependent on AES files in the aes_wg
+ directory to that project. Remove AES_WG dependencies from unzip
+ project. Add LZMA configurations to the unzip and unzipaes projects.
+ Currently the VC 6 configurations depend on the LZMA files being present
+ (they are part of the source distribution so they should be). The user
+ ignores those files when they select a configuration that does not use
+ them. Added missing Release configurations. The ASM (assembly)
+ configurations are not updated yet to support AES_WG or LZMA.
+ (win32/vc6/unzip.dsp, win32/vc6/unzip.dsw, win32/vc6/unzipaes.dsp) [EG]
+
+6.10c07 (12 Sep 2011):
+ - Change type of ucsize_lzma to SizeT. (extract.c) [SMS]
+ - CF_BZ now has "-DBZ_NO_STDIO" to build correct bzip2 variation.
+ (unix/configure, unix/Makefile) [AD]
+ - CF_BZ now contains "-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" if large
+ files supported. (unix/configure) [AD]
+ - Customize unzip unix/unxcfg.h for time.h et al. (unix/configure) [AD]
+ - Add fix for symlink bug. (See
+ http://comments.gmane.org/gmane.comp.version-control.git/181165).
+ From Andreas Schwab: "This only happens if you have more then 16K
+ entries and when one of the 16K entry infos is reused it happend to be
+ previously used for a symlink entry." Patch provided. (process.c) [AS]
+
+6.10c08 (22 Nov 2011):
+ - Add (wchar_t *) casts to wstring malloc(). (extract.c) [SMS]
+ - Remove wchar.h include. Add parentheses around wide_string[]
+ assignment in for loop to quiet complaint by a particular compiler.
+ [SMS, AD]
+ - Add note regarding possible morphing of unzpriv.h to something more
+ like tailor.h. (Could happen.) Copy over UNICODE_SUPPORT comment
+ from Zip detailing the current plan for unifying Unicode code to just
+ three possibiities: UNICODE_WIDE, UNICODE_ICONV, and UNICODE_NATIVE.
+ Change "#define BSD" to "#define BSD 1". Copy over DBCS Japanese
+ support comment. Always include stdlib.h if UNICODE_SUPPORT defined.
+ Copy over wchar and langinfo support headers from Zip. Add MBCS
+ comment noting possible use of replacement functions when available.
+ Copy over in comments some Zip MBCS code. (unzpriv.h, unix/unxcfg.h)
+ [AD]
+ - Include unistd.h where available, mainly for SunOS. (lzma/szfile.h)
+ [SMS]
+ - Comment updates in top section. Attempts at making the Zip and UnZip
+ configure scripts similar. Formatting updates. Add message:
+ "Generating system-dependent flags...". Split up parameter list in
+ valid_vars. Remove -DUNIX from CFLAGS. Define AR_BZ for bzip2.
+ Change manuals output dir to manout. Default PORT to empty instead
+ of "unix." Default AES_WG, LZMA, IZ_BZIP2, and IZ_ZLIB to empty if not
+ already defined. Define PORT_SPEC for port specification method.
+ Remove OSDEP_C and OSDEP_S. Remove MANTAB. Minor changes to output
+ build messages. Assign default PORT setting. Set PORT_SPEC to I
+ (implicit) if PORT is unix, else E (explicit). Output UNAME_S as OS
+ name. Add quotes around some variables. Add tests for MinGW 64, MinGW
+ 32, LLVM, LLVM Clang, LLVM GCC. Add Darwin check for obsolate -s
+ option. Add tests for Portable C (PCC), EKOPath, Intel, GNU C, CNU C
+ for Mac OS X, AIX. Update defines for CC_TST, CFLAGS_OPT, CFLAGS_TST,
+ 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
+ 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,
+ NO_DIR_HEADER_H, FUNCTION=function, and NO_FUNCTION. Remove HPUX ANSI
+ test. Add off_t and UID/GID messages from Zip. (The UID/GID code, in
+ particular, may not be appropriate for UnZip, but this should be
+ corrected in a later beta.) Update sys/time.h messages. (Not sure if
+ these are appropriate to UnZip. It's possible that UnZip would work,
+ but that checking for unneeded features could prevent it from building.)
+ Add wchar.h checks. Update wide character support checks to match those
+ in Zip. Update check for missing functions. Add "FIX ME" note for
+ langinfo.h. Change ${CFLAGS} to ${CFLAGS_TST} in assignment. Update
+ MBCS functions check. Output end blank line. (unix/configure) [SMS, AD]
+ - Update Makefile instructions at top to be similar to Zip. Update
+ list of targets. Add additional instructions and guidance from Zip.
+ Update AR to change -cq to cq. Add note about OSDEP_H, OS_DEPOC, and
+ OSDEP_OS. Update note on Assembler to mention msdos/crc_i86.S. Remove
+ PGM_ZINFO from UNZIP_PGMS. User manout for output directory of manuals.
+ Put plain text versions of manuals in root directory as have
+ traditionally done. Use PGM_* variables to set BIN_* variables. Add
+ note about C files when cross compiling and PORT parm. Change note on
+ api.o rule from "object files" to "C Compile rule" for unzip DLL. Add
+ comment separator lines around AES code and LZMA code. Update BZIP2
+ test to use "@if [ flags_bz ];" instead of "@if test -f flags_bz;".
+ Change "-> zips' to "-> unzips". Change manl rule to manout. Update
+ text output rules for manuals based on Zip updates including using man
+ instead of nroff. Add "Running: unix/configure" message. Add PROD
+ parameter to unix/configure. Add note on BZIP2 flags. Add PGM_ZINFO to
+ clean rule. Add clean_docs rule for cleaning the plain text docs as
+ was done in Zip. Update install rule. Remove duplicate "Originally
+ tested under Sun" comment. Add generic build warning message. Rephrase
+ some comments for generic rules. Update rules list for specific ports.
+ Remove OSDEP_C and OSDEP_S from linux_dos rule. Remove some space from
+ comments and messages. (unix/Makefile) [SMS, AD]
+ - Add compiler identification for NeXT DevKit, MinGW 64, MinGW 32, LLVM
+ Clang, LLVM Apple GCC, LLVM GCC, Portable C, EKOPath C, Intel C, GCC, and
+ SunPro C. Ignore case of "CRAY" define. Reformat IBM version. Reformat
+ sprintf() lines for specific compiler versions. Change (bad) Mac OS X
+ message string '" (Mac OS X")' to '" (Mac OS X)"'. (unix/unix.c) [AD]
+
+6.10c09 (8 May 2014):
+ - Minor code tidying: UZbunzip2() and UZlzma() are now static.
+ (extract.c, unzpriv.h) [SMS]
+ - A bare "#if" directive embedded in a multi-line comment block
+ confused old C preprocessors (SunOS 4.1.4 bundled C, VAX C V3.1-051).
+ (unzpriv.h) [SMS]
+ - Less lame handling of LZMA and PPMd data structures. More things are
+ allocated and/or initialized once per job, rather than once per
+ archive member. (extract.c, globals.h, process.c) [SMS]
+ - Removed definition of unused LZMA- and PPMd-related C macro _7ZIP_ST
+ from builders. (unix/configure, vms/build_unzip.com,
+ vms/descrip_src.mms) [SMS]
+ - Miscellaneous code tidying for user-triggered progress message on
+ VMS: Portability to old VAX versions, coping with batch mode, better
+ comments and messages. (vms/vms.c, vms/vmscfg.h) [SMS]
+ - Removed lzma/Alloc.c and lzma/Alloc.h (MyAlloc() and MyFree()
+ functions). (extract.c, unix/Makefile, vms/descrip_src.mms) [SMS]
+ - Remove (unused) lzma/SzFile.c and lzma/SzFile.h. (unix/Makefile,
+ vms/descrip_src.mms) [SMS]
+ - Bad hard-coded string length in message function could put a spurious
+ NUL character into messages. (Typically invisible on screen, but
+ ugly in redirected output.) (fileio.c) [SMS]
+ - On Unix, "make clean" missed some spots. (unix/Makefile) [SMS]
+ - A user-specified CFLAGS value for UNIX(-like) builds no longer needs
+ to include "-I.". (unix/configure) [SMS]
+ - Some Clang and GCC versions would emit many "warning: format string
+ is not a string literal" or similar diagnostics. The Unix builders
+ now add compiler options, "-Wno-format-security" and/or
+ "-Wno-format-nonliteral", to suppress these, where appropriate.
+ (unix/configure) [SMS]
+ _ Changed C macros USE_BZIP2, USE_DEFLATE64, USE_LZMA, USE_PPMD, and
+ USE_UNSHRINK to BZIP2_SUPPORT, DEFLATE64_SUPPORT, LZMA_SUPPORT,
+ PPMD_SUPPORT, and UNSHRINK_SUPPORT, respectively, for clarity and
+ consistency with Zip. (INSTALL, explode.c, extract.c. fileio.c.
+ funzip.c. gbloffs.c. globals.h. inflate.c, process.c, ubz2err.c,
+ unzip.c, unzpriv.h, amiga/flate.a, human68k/flate.s, msdos/doscfg.h,
+ msdos/makefile.dj2, msdos/makefile.wat, os2/os2cfg.h, unix/configure,
+ vms/build_unzip.com, vms/descrip_src.mms, win32/Makefile,
+ win32/Makefile.gcc, win32/Makefile.wat, wince/punzip.h) [SMS]
+ - Changed the "special compilation options" section of the "-v" report
+ to agree better with that of Zip. Added explanations for some more
+ options. (unzip.c) [SMS]
+ - Changed to use the new C macro, NO_TRADITIONAL_CRYPT, as in Zip, to
+ control (disable) compilation of code specific to traditional
+ encryption, allowing AES_WG encryption without traditional
+ encryption. (crypt.c, crypt.h, fileio.c, unzip.c, unzpriv.h) [SMS]
+ - Adopted a suggestion from Ireneusz Hallmann to use an alternate
+ buffer in more situations in the DLL, to solve a problem with data
+ corruption when inflating to memory. Adapted another suggestion for
+ a better window size calculation. The old method gave poor results
+ for buffer sizes which were not powers of two. (inflate,c) [IH, SMS]
+ - Fixed many problems when building with REENTRANT defined, mostly in
+ the new command-line option code, but also in ppmd_read_byte() and
+ the user-triggered progress message. Reformed globals access in
+ VMS-specific stamp_file(). (extract.c, unzip.c, unzpriv.h,
+ zipinfo.c, vms/vms.c) [SMS]
+ - Added "aesw" to the table of compression method names used in a
+ ZipInfo report. ("u###" was appearing for method 99 in reports.)
+ (zipinfo.c) [SMS]
+ - Repaired lame punctuation in SFX "Must quote upper-case options"
+ message on VMS. (unzip.c) [SMS]
+ - Renamed C macro APL_DBL_SFX to APL_DBL_SUFX to reduce confusion with
+ self-extracting "SFX". (extract.c, fileio.c, unix/macosx.h) [SMS]
+ - Added some minimal/lame support in the unix/zipgrep script for (up to
+ four) GNU long-form options for egrep, and fixed some lame error
+ handling (when the "unzip -Z1" command failed, for example). Added
+ "\" escapes for globbing characters ("*", "?", and "[") in archive
+ member names. Many limitations and problems remain. (unix/zipgrep)
+ [SMS]
+ - Renamed "lzma" directory to "szip". (Contents, INSTALL, extract.c,
+ globals.h, unzip.c, unix/configure, unix/Makefile, vms/build_unzip.com,
+ vms/descrip_deps.mms, vms/descrip_mkdeps.mms, vms/descrip_src.mms) [SMS]
+ - Changed Mac OS X system-specific code to use "/..namedfork/rsrc" as
+ the suffix for resource fork access on Intel, staying with "/rsrc" on
+ PowerPC. Define the C Macro APPLE_NFRSRC as 0 (on Intel) or 1 (on
+ PowerPC) at build time to override the automatic decision. (We believe
+ that all PowerPC-compatible OS versions accept "/rsrc", and all
+ Intel-compatible OS versions accept "/..namedfork/rsrc".) Using "/rsrc"
+ on Mac OS X 10.7 (Lion, Intel-only) caused spurious "Not a directory"
+ messages, and resource forks were not properly restored. (unzip.c,
+ unix/macosx.h) [SMS]
+ - UnZip failed to extract an archive member with a null name (silently
+ on VMS, with a mesage, "mapname: conversion of failed", on Unix).
+ Spurious error messages like ": mismatching "local" filename (fred)"
+ (where "fred" was some previously processed member name) were also
+ possible. (Info-ZIP Zip uses "-" as the name for an archive member
+ created from standard input, but the .ZIP standard allows a null name
+ for this case.) Now, UnZip extracts a null-name archive member as
+ "-" (C macro: NULL_NAME_REPL). On VMS, an error message was added,
+ similar to the one on UNIX, and on UNIX, the message was clarified.
+ (fileio.c, unzpriv.h, unix/unix.c, vms/vms.c) [SMS]
+ - "unzip -t" silently detected an unexpected end-of-file condition when
+ reading an archive, leading to an unexplained "At least one error was
+ detected" message. An "Unexpected end-of-file" message has been
+ added to reduce the mystery in this case. (extract.c) [SMS]
+ - Java "jar" archives with over-simplified header info were interpreted
+ as coming from MS-DOS, causing UTF-8-encoded file names to be damaged.
+ A Java "CAFE" extra block is now detected, and inhibits this
+ inappropriate name conversion. A new "--jar" option lets the user
+ force this behavior when an archive lacks a "CAFE" extra block.
+ http://sourceforge.net/p/infozip/support-requests/10/ (extract.c,
+ fileio.c, unzip.c, unzip.h) [SMS]
+ - Added Java "CAFE" extra field type to ZipInfo reports. (zipinfo.c)
+ [SMS]
+ - Changed some declarations to accommodate a type change in zlib
+ version 1.2.7. (globals.h) [SMS]
+ - UnZipSFX could fail (SEGV) on systems with backslash ("\") file path
+ separators (MSDOS, Windows, ...), if a list of member names to be
+ extracted was specified on the command line. (unzip.c) [SMS]
+ - Added a #ifndef condition to avoid redefining the C macro
+ HAVE_TERMIOS_H on Cygwin. (unix/unxcfg.h) [SMS]
+ - Fixed assembler testing in configure script. Defining NO_ASM or
+ NO_ASM_CRC in LOCAL_UNZIP disables use of assembly code for CRC.
+ (unix/configure) [SMS]
+ - Added Linux Exec Shield .section directive to assembly code, as in
+ Zip. (crc_i386.S) [SMS]
+ - Added a check in DLL unzip() for proper NULL termination of argv[].
+ (unzip.c) [SMS]
+ - Revised VMS builders to make it easier to generate the help files
+ (only). (vms/build_unzip.com, vms/descrip.mms) [SMS]
+ - Changed to avoid conflict between a user definition of the C macro
+ NO_EXCEPT_SIGNALS and an automatic one. (unzip.c) [SMS]
+ - Disambiguated some option-related error messages. (unzip.c) [SMS]
+ - Changed, on VMS, the way a "-d" (/DIRECTORY) destination directory is
+ tested for validity. Previously, some VMS-invalid directory
+ specifications (such as "." or "..") would generate no error, and
+ then be (silently) ignored.
+ - Reformed the multi-value C macro CRYPT into simpler (binary)
+ IZ_CRYPT_ANY and IZ_CRYPT_TRAD. The actual encryption code should
+ now use only IZ_CRYPT_AES_WG and IZ_CRYPT_TRAD (plus IZ_CRYPT_ANY,
+ derived from them). At build time, users specify more controlled
+ options: CRYPT_AES_WG, CRYPT_AES_WG_SFX, CRYPT_TRAD_SFX, NO_CRYPT,
+ NO_CRYPT_TRAD. (crypt.c, crypt.h, ebcdic.h, extract.c, fileio.c,
+ funzip.c, gbloffs.c, globals.h, INSTALL, ttyio.c, ttyio.h, unzip.c,
+ unzpriv.h, amiga/filedate.c, qdos/qdos.c, windll/windll.c) [SMS]
+ - Changed C macro USE_UNZIP_LIB$INITIALIZE to USE_UNZIP_LIB_INITIALIZE
+ for consistency with Zip, where Sun C objected to the "$" in the
+ corresponding code. (vms/vms.c) [SMS]
+ - Changed some assembler-related details, including the test for an
+ "_" prefix on global names. (unix/configure, unix/Makefile) [SMS]
+ - Supposedly, the "-s" (--space_to_uscore) option became OS-generic in
+ 6.10c01, but its implementation relies on OS-specific mapname()
+ processing, and there was none on Unix or VMS. It may still be
+ missing on other, more obscure systems. (unix/unix.c, vms/vms.c) [SMS]
+ - Changed the archive file default file spec on VMS from "[]*.ZIP" to
+ ".ZIP", to avoid undesired behavior in some unusual cases.
+ (vms/vms.c) [SMS]
+ - VMS-specific problem could cause "unzip -a" to truncate the last line
+ in a text file if it lacked a normal line ending (like LF). (This
+ problem was close to, but different from, the similar one which was
+ fixed in version 6.10c01.) (vms/vms.c) [SMS]
+ - The Unix builders detected a UID and/or GID bigger than 16 bits, but
+ then defined the wrong C macro, disabling support for the new "ux"
+ extra block. This could prevent UnZip (-X) from restoring UID and
+ GID on files extracted from archives created by Zip 3.0 or later,
+ where the new "ux" extra block was used. Never defining the right C
+ macro also hid some defective code, which would cause a build failure
+ if the right C macro was defined. Also, the "-v" report did not
+ mention this option (IZ_HAVE_UXUIDGID). Forum topic:
+ http://www.info-zip.org/phpBB3/viewtopic.php?f=3&t=402
+ (process.c, unzip.c, unix/configure) [SMS]
+ - VMS CLI UnZip executables (UNZIP_CLI.EXE) were being built with a
+ ZipInfo module (zipinfo.c) which was compiled for the Unix-style
+ interface, not the VMS CLI interface. An obvious symptom was a
+ Unix-style usage guide instead of a VMS CLI-style usage guide.
+ (vms/build_unzip.com, vms/descrip.mms, vms/descrip_mkdeps.mms,
+ vms/descrip_src.mms) [SMS]
+ - With -c (--to-stdout, /SCREEN) or -p (--pipe-to-stdout, /PIPE),
+ various progress messages ("Archive: xxx", "inflating: yyy", and so
+ on) were sent to stdout along with the extracted data, and only
+ -q (--quiet, /QUIET) could stop them. Now, with -c or -p, these
+ messages should be sent to stderr, making them visible to the user
+ without corrupting the extracted data stream. (fileio.c, unzpriv.h,
+ vms/vms.c) [SMS]
+ - Attempt to support Zip64 in fUnZip. Changed to skip directory
+ members at the beginning of an archive, instead of doing nothing when
+ the first archive member was a directory. Changed some messages and
+ exit status codes. Still crude in many places. (funzip.c) [SMS]
+ - With UNICODE_SUPPORT, UnZip could fail (SIGBUS, SIGSEGV,
+ %SYSTEM-F-ACCVIO, ...) when processing a non-Unicode name which
+ contained character codes above 127. More thought/work may be needed
+ here. http://sourceforge.net/p/infozip/bugs/40/ (extract.c) [SMS]
+ - Changed the DLL and object-library forms of the UnZip main entry
+ point function not to look for "zipinfo" in argv[0]. To get ZipInfo
+ mode, specify "-Z" in argv[1]. (unzip.c) [SMS]
+ - Changed iconv code to use memset() instead of bzero(), for
+ consistency and portability. Added a missing free(). Added
+ ICONV_ARG2 macro to facilitate user addition of a "const" type
+ qualifier to satisfy Sun C. Moved loose global storage into the
+ general globals structure. Copied newer Unix code into BeOS.
+ (beos/beocfg.h, beos/beos.c, globals.h, unix/unix.c, unix/unxcfg.h,
+ unzip.c, unzpriv.h, zipinfo.c) [SMS]
+ - -M (/MORE) used bad carriage control on VMS, adding spurious blank
+ lines to the output. Changed the prompt function on VMS to use the
+ same output file as the message function (stderr or stdout) to avoid
+ this. (fileio.c, globals.h) [SMS]
+ - Revised VMS DCL builder to recreate object libraries when not
+ compiling (NOCOMPILE). (vms/build_unzip.com) [SMS]
+ - Fixed some bad behavior (program aborts or loops, or faulty memory
+ access) caused by (intentionally) defective/corrupt archives.
+ Reported by OUSPG ("https://www.ee.oulu.fi/research/ouspg/").
+ Removed some harmless but redundant free() instances from extract.c.
+ (crypt.c, crypt.h, extract.c, fileio.c, funzip.c, os2/os2.c,
+ process.c, unzpriv.h, win32/win32.c, zipinfo.c) [Aki Helin, SMS]
+ - memcpy() was being used in some cases on overlapping buffers, which
+ could cause bad extracted data (and "bad CRC" errors) on some
+ systems. Forum topic:
+ http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=406
+ New code uses memcpy() only on disjoint buffers. New C macros
+ replace old NOMEMCPY: Define C macro NO_SLIDE_MEMCPY to disable use
+ of memcpy(). Define SLIDE_MEMMOVE to enable use of memmove() for a
+ case where it works. Limited testing suggests that using memcpy() is
+ faster, but using memmove() is not, so that's the default scheme, but
+ we're open to evidence reports. (explode.c, inflate.c) [SMS]
+ - Changed LLVM Clang compiler version identification to cope with v1.x,
+ where __clang_major__ and friends were not defined. (unix/unix.c)
+ [SMS]
+ - Made the configuration test for lchmod() stricter, to detect a "not
+ implemented" compiler warning message (Clang and GCC on GNU/Linux).
+ (unix/configure) [SMS]
+ - Changed the definitions of macros _ISO_INTERN and _OEM_INTERN on Unix
+ to use function charset_to_intern() (now not static) directly, instead
+ of using inline functions, iso_intern() and oem_intern() (now gone).
+ HP-UX bundled C compiler (at least) does not support the keyword
+ "inline". (beos/beocfg.h, beos/beos.c, unix/unix.c, unix/unxcfg.h,
+ unzip.c) [SMS]
+ - Added macro "Tracing", defined when macro "Trace" is non-empty, for use
+ where Trace() was the only thing in the body of an "if" statement,
+ and Clang complained, "if statement has empty body". (extract.c,
+ unzpriv.h) [SMS]
+ - Stopped some memory leaks, mostly related to the new command-line
+ parser. Removed declarations and use of obsolete global name array,
+ fnames[]. Removed the unused global pointer argument from
+ free_args(). Removed redundant call to free_G_buffers() from
+ process_zipfiles(). Track and free transient-use command-line option
+ value storage. In free_G_buffers(), added calls to free() for the
+ archive name and for retained command-line option values: extraction
+ directory (-d) and password (-P). Changed API functions to use
+ dynamic storage for the archive name (which may now be free()'d).
+ (api.c, globals.c, process.c, unzip.c, unzpriv.h, zipinfo.c) [SMS]
+ - In Unix builders, accept user-specified CFLAGS_OPT macro to override
+ automatic compiler optimization options setting. For debugging, for
+ example, one might specify "CFLAGS_OPT='-g -O0' LFLAGS2=-L.". (A
+ non-null value is required for each. "-L." should be harmless for
+ LFLAGS2.) Stopped putting redundant "-L." linker options into
+ "flags". (unix/configure) [SMS]
+ - Added some conditionality for SGI IRIX. (Knowing nothing, we assume
+ that large-file support is still missing on SGI IRIX.)
+ http://sourceforge.net/p/infozip/bugs/41/ (unzpriv.h) [SMS]
+ - Disambiguated some Windows-specific error messages. (win32/win32.c)
+ [SMS]
+ - Minor code tidying (#directive rearangement, type casts) to pacify
+ Microsoft Visual C++ 2010. (explode.c, extract.c, funzip.c,
+ inflate.c, process.c, zipinfo.c) [SMS]
+ - Added definition of HAVE_LOCALE_H to Windows-specific configuration
+ file. (win32/w32cfg.h) [SMS]
+ - Changed VMS builders to use explicit (CC) /NOLIST and (LINK) /NOMAP
+ qualifiers by default, to reduce unexpected clutter in batch mode.
+ (vms/build_unzip.com, vms/descrip_src.mms) [SMS]
+ - Changed APIhelp() interface to deal with the new command-line parser.
+ Converted tabs to spaces in text. Removed a BEL code from an error
+ message. Added text for UzpMainI(). Added NULL termination to
+ example argv[] arrays. Added apihelp.c to the Unix and VMS builders,
+ primarily for testing. (It's normally disabled, unless API_DOC is
+ defined.) (apihelp.c, unzip.c, unzpriv.h, unix/Makefile,
+ vms/descrip.mms, vms/descrip_deps.mms, vms/descrip_mkdeps.mms,
+ vms/descrip_src.mms) [SMS]
+ - Fixed a problem where callable UnZip (or any build with the C macro
+ REENTRANT defined) could try to free() the main-program argv[],
+ instead of our local copy. (unzip.c, zipinfo.c) [SMS]
+ - Removed a Unicode memory leak, and improved some sub-optimal code
+ based on suggestions from Dmitry ??????. (fileio.c, process.c,
+ win32/win32.c) [Dmitry, SMS]
+ - On non-VMS systems, an I/O error while extracting a file (disk full,
+ or similar) caused an interactive query ("write error (disk full?).
+ Continue? (y/n/^C)"), even if there was no interactive user, causing
+ the program to hang. Now, by default, such an I/O error is fatal.
+ To restore the query, define the C macro I_O_ERROR_QUERY at build
+ time, but the query code now checks stdin using isatty(), and skips
+ the query if stdin is not a terminal. (fileio.c, unzpriv.h)
+ [Dmitry, SMS]
+ - On Windows, some defective bit-mask tests could cause failure to set
+ directory attributes. (win32/win32.c) [Dmitry, SMS]
+ - Memory leaks in Unicode name handling. (extract.c, fileio.c,
+ process.c, unzip.c) [Dmitry, SMS]
+ - On Windows, Unicode-capable code to set a volume label could fail.
+ (win32/win32.c) [Dmitry, SMS]
+ - In "-vl" (/LIST /FULL) reports, an unexpectedly large compression
+ method value (>999) caused a (mostly harmless) buffer overflow, and
+ spoiled the report format. Now, values less than 1000 are displayed
+ as before, using a three-digit decimal format, "Unk:ddd", but larger
+ values are displayed using a four-digit hexadecimal format,
+ "UnkXXXX". http://sourceforge.net/p/infozip/bugs/27/ (list.c) [SMS]
+ - In ZipInfo reports, an unexpectedly large "version made by" value
+ (>99) caused a (mostly harmless) buffer overflow, and could spoil the
+ report format. Now, for system types where space always allows,
+ large values should always be displayed properly. For VMS, a more
+ careful calculation is done to determine space requirements, and
+ large values should be displayed properly when space allows. Forum
+ topics: http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=267
+ http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=437
+ (zipinfo.c) [quanww, sanvila, SMS]
+ - Added some crude, optional, dynamic memory tracing diagnostic
+ capability for use by developers. (api.c, crypt.c, envargs.c,
+ extract.c, fileio.c, funzip.c, globals.c, inflate.c, match.c,
+ memdiag.c, process.c, timezone.c, unshrink.c, unzip.c, unzpriv.h,
+ unix/unix.c, win32/win32.c) [SMS]
+ - On Windows, with Unicode support, a buffer overrun in pathname
+ storage could cause a variety of problems, including spurious error
+ messages and program failure. That problem should be solved. Some
+ buffers were allocated with a few bytes more than necessary. Some
+ code which was needed only for developer diagnostic tracing was being
+ compiled and executed always. A reform making the global array
+ unipath_widefilename fixed instead of dynamic can be reversed by
+ defining the C macro DYNAMIC_WIDE_NAME. (extract.c, fileio.c,
+ globals.h, memdiag.c, process.c, unzip.c, win32/w32cfg.h,
+ win32/win32.c) [SMS]
+ - Changed behavior involving files which appear to have VMS version
+ numbers (names ending with ";ddd", where "ddd" is a decimal number),
+ and option "-V" (--keep-versions, /[NO]VERSION). Previously, UnZip
+ would, by default, strip these apparent VMS version numbers when
+ extracting files, and the "-V" option was required to prevent this,
+ even when the file was not archived on a VMS system. Thus, a Unix
+ file named "fred;123" would normally be extracted as "fred", unless
+ "-V" was specified to prevent this damage. Now, on non-VMS systems,
+ UnZip should strip apparent VMS version numbers only from files which
+ were archived on a VMS system. Specify "-V" explicitly to keep
+ version numbers even on VMS-archived files. Specify "-V-" explicitly
+ to strip apparent VMS version numbers from all files regadless of
+ where they were archived (the old default behavior). Behavior on VMS
+ systems is unchanged. (acorn/acorn.c, amiga/amiga.c, aosvs/aosvs.c,
+ atari/atari.c, atheos/atheos.c, beos/beos.c, extract.c,
+ flexos/flexos.c, human68k/human68k.c, macos/source/macos.c,
+ man/unzip.1, msdos/msdos.c, netware/netware.c, os2/os2.c, qdos/qdos.c,
+ tandem/tanunz.c, unix/unix.c, unzip.c, vms/unzip_cli.help,
+ vms/UNZIP_DEF.RNH, vms/vms.c, win32/win32.c) [SMS]
+ - Bad white space in Unix builder caused problems in UID/GID size
+ determination tests with old (K&R) compilers (SunOS 4.1.4 bundled,
+ for example). (unix/configure) [SMS]
+ - Bad white space caused build problems with old (K&R) compilers (SunOS
+ 4.1.4 bundled, for example). (inflate.c) [SMS]
+ - SunOS 4.1.4 bundled C compiler needed help with labs(). (fileio.c,
+ funzip.c, unix/configure, unzpriv.h) [SMS]
+ - Changed AES_WG endian-determination code not to look for
+ <sys/isa_defs.h> on __sun systems with __sparc defined, because it's
+ missing on SunOS 4.1.4. (aes_wg/brg_endian.h) [SMS]
+ - Changed the VMS DCL test script to give SFX tests some chance of
+ working on VMS versions before V6.0, where SET FILE /ATTRIBUTES is
+ not available. Added an explanation to the VMS-specific installation
+ instructions. (vms/INSTALL_VMS.txt, vms/test_unzip.com) [SMS]
+ - Some conditional code conditions were misplaced, causing compiler
+ warnings and/or bad behavior when some combinations of optional
+ compression and/or encryption options were enabled in UnZip SFX.
+ (extract.c) [SMS]
+ - Added a Windows cmd test script, but the builders don't (yet?) run it
+ automatically. Added code to set appropriate exit status values in
+ the Unix and VMS test scripts. (unix/test_unzip.sh,
+ vms/test_unzip.com, win32/test_unzip.cmd) [SMS]
+ - Changed VMS exit status code to SS$_NORMAL for success instead of a
+ facility-specific code (%x17A28001). This agrees with most VMS
+ utilities, and with UnZip versions before 6.10a02. Define C macro
+ OK_USE_FAC to use the facility code in all cases. (vms/vms.c) [SMS]
+ - Removed Windows DLL global archive name storage (hwildZipFN) to fix a
+ reentrancy problem reported by Alexandr Miloslavskiy. (This change
+ is not well tested. Additional DLL wisdom is welcome.)
+ (windll/windll.c) [SMS]
+ - On Windows, conflicts with anti-virus programs could cause avoidable
+ errors, "CreateFile() error 32 when trying set file time". ("32" is
+ ERROR_SHARING_VIOLATION.) A similar problem when setting NT Security
+ Descriptor data (-X) has not been reported, but seems similarly
+ likely. Now, when CreateFile[AW]() fails for this reason, it is
+ retried according to C macros IZ_CREATEFILE_xxx, defined in
+ win32/w32cfg.h. Currently, a fixed time limit is used, which may be
+ inadequate for large files. Users who still experience the problem
+ are encouraged to report the circumstances.
+ http://sourceforge.net/p/infozip/bugs/44/ (win32/nt.c,
+ win32/w32cfg.h, win32/win32.c) [awaterson, Dmitry, SMS]
+ - On Mac OS X, extended attributes (such as "com.apple.quarantine")
+ were erroneously treated as more resource-fork data, so the
+ extracted file did not get the proper attributes, and its resource
+ fork was corrupted. These attributes should now be set correctly.
+ Define the C macro NO_APPLE_XATTR at build time to disable the code
+ to set extended attributes. (fileio.c, globals.h, process.c,
+ unix/configure, unix/macosx.h) [SMS]
+ - Moved definitions of multi-character option ID codes from individual
+ main program modules to a common header file. (unzip.c, unzpriv.h,
+ zipinfo.c) [SMS]
+ - On Mac OS X, with "-d exdir", AppleDouble "._" file names were
+ mishandled, causing Finder info and resource fork data to be lost.
+ Some Mac-specific name handling code has been moved from the general
+ extract.c:extract_or_test_entrylist() to a new OS-specific function,
+ unix/unix.c:revert_apl_dbl_path(). (extract.c, fileio.c, globals.h,
+ unzpriv.h, unix/unix.c) [SMS]
+ - On Mac OS X, when archive member patterns were specified explicitly,
+ including with a -x/--exclude option, AppleDouble "._" file names
+ were mishandled, causing Finder info and resource fork data to be
+ lost, or otherwise mishandled. This happened because a normal name
+ and the corresponding "._" name might not match the same patterns, so
+ one of the two parts might be processed while the other was not.
+ Now, when Mac attributes are being restored (no -J/--junk-attrs
+ option, and the destination volume supports attributes), an
+ AppleDouble "._" archive member should be processed if the
+ corresponding normal archive member is. (extract.c) [SMS]
+ - On Mac OS X, setting non-data-fork attributes/data on a file could
+ give it a new modification time, even if the user requested that its
+ archived modification time be restored. (unix/unix.c) [SMS]
+ - On Mac OS X, with an Intel CPU, UnZip tried to access a resource fork
+ using the old "/rsrc" suffix instead of the newer "/..namedfork/rsrc"
+ suffix, and this failed. After some recent code restructuring,
+ unzip.c was not including unix/macosx.h as needed, so the C macro
+ APPLE_NFRSRC was not being defined properly. An undefined
+ APPLE_NFRSRC should have been detected, but was not. (api.c,
+ unzip.c) [SMS]
+ - Windows DLL builders failed to deal with (optional) bzip2
+ compression. Now, a scheme like that used for UnZip proper is used
+ for the DLL. (windll/vc10/unzip32_dll.sln,
+ windll/vc10/libbz2/libbz2.vcxproj,
+ windll/vc10/libbz2/libbz2.vcxproj.filters) [SMS]
+ - Added or updated copyright and license information in various files.
+ (unix/configure, unix/configure_old, unix/Makefile,
+ unix/Makefile_old, unix/mlz.sh, unix/test_unzip.sh, unix/zipgrep,
+ vms/build_unzip.com, vms/collect_deps.com, vms/cppcld.com,
+ vms/cvthelp.tpu, vms/descrip.mms, vms/descrip_mkdeps.mms,
+ vms/descrip_src.mms, vms/find_bzip2_lib.com, vms/hlp_lib_next.com,
+ vms/makesfx.com, vms/mod_dep.com, vms/optgen.com, vms/test_unzip.com,
+ vms/unzip_cli.help, vms/UNZIP_DEF.RNH, vms/UNZIP_MSG.MSG,
+ vms/unz_cli.cld, win32/test_unzip.cmd) [SMS]
+ - "unzip --zipinfo-mode[...]" should have been equivalent to "unzip -Z
+ [...]", but the long option was not handled properly, causing a
+ spurious fatal error (message: "error: -Z must be first option for
+ ZipInfo mode (check UNZIP variable?)", followed by two (!) Usage
+ guides). (unzip.c) [SMS]
+ - Cleared a compiler complaint (unused variable: p) when building the
+ Windows DLL, or an object library without ZipInfo mode. (unzip.c)
+ [SMS]
+ - Cleared a Microsoft (VC12) compiler complaint (type mismatch).
+ (zipinfo.c) [SMS]
+ - Removed a redundant declaration (Zipnfo). (process.c) [SMS]
+ - Updated copyright messages, and corrected a typo ("Built-n").
+ (unzip.c) [SMS]
+ - Code tidying (comments, #directive indentation, #include path
+ simplification). (windll/structs.h, windll/uzexampl.c,
+ windll/windll.c, windll/vc10/unzip32_dll/unzip32_dll.vcxproj,
+ windll/vc10/uzexampl/uzexampl.vcxproj) [SMS]
+ - Simplified handling of C macros UNIXBACKUP and NO_UNIXBACKUP.
+ (unzip.h, unzpriv.h) [SMS]
+ - On Unix, "-d exdir" was limited to creating a maximum of one
+ directory. So, for example, "-d fred1/fred2" would fail if the
+ directory fred1 did not already exist. (unix/unix.c) [SMS]
+ - On VMS, a long archive path (resulting in a directory specification
+ longer than 255 characters) could be truncated, even on an ODS5
+ destination file system, where such a path was valid. (vms/vms.c)
+ [SMS]
+ - Tidied code based on Cppcheck analysis, GCC _FORTIFY_SOURCE=2, LLVM
+ Clang, and some inspection (buffer overflow, syntax error in disused
+ code, unused variable/value, memory management, bad error handling,
+ bad I/O formats, and so on). (apihelp.c, crypt.c, extract.c,
+ fileio.c, funzip.c, process.c, timezone.c, ttyio.c, unzip.c,
+ zipinfo.c, amiga/amiga.c, aosvs/aosvs.c, beos/beos.c,
+ macos/source/macbin3.c, macos/source/macdir.c, macos/source/macos.c,
+ macos/source/pathname.c, qdos/callstub.c, qdos/makesfx.c,
+ tandem/tandem.c, tandem/tanunz.c, theos/_setargv.c, theos/theos.c,
+ unix/unix.c, vms/cmdline.c, vms/vms.c, windll/unzipstb.c) [Dmitry,
+ SMS].
+ - Unrealistic size data in an archive could cause a buffer overflow
+ when reporting the resulting unrealistic compression ratio in a
+ long listing (-lv) report. Forum topic:
+ http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=432
+ (list.c) [SMS]
+ - A user response longer than eight characters to an interactive query
+ (like, say, "replace XXX? [y]es, [n]o, [A]ll, [N]one, [r]ename: ")
+ could be only partially consumed, leaving excess characters to be
+ read by a later interactive query, without any additional user
+ response. Now, a whole line should be read, even if only the first
+ character is significant. (extract.c, fileio.c, process.c,
+ unzpriv.h, vms/vms.c) [SMS]
+ - Changes to accommodate old K&R-style C compilers: Changed some API
+ function declarations/prototypes to remove prototypes where they are
+ not supported. Changed the object-library example program to work
+ when prototypes are not supported. Renamed some members of the
+ _version_type structure to avoid conflicts with macros "major" and
+ "minor" on SunOS 4.1.4. Added some type casts to clear some compiler
+ complaints. Indented a "#error" directive. Added a missing ranlib
+ command to the "make" rule for libizunzip.a on Unix. (api.c,
+ apihelp.c, funzip.c, unzip.c, unzip.h, libiz/izunzip_example.c,
+ unix/Makefile, windll/unzipstb.c, windll/uzexampl.c) [SMS]
+ - Added the method descriptor ("creating", "extracting", "inflating",
+ "testing", and so on) to the user progress message. (extract.c,
+ globals.h, unzip.c, unzpriv.h, unix/unix.c, vms/vms.c) [SMS]
+ - Restructured "man" documentation directories. Now, "man" source
+ files (*.1) are supplied in a "man/man1/" directory, allowing direct
+ use of a "man -M ./man" command in the kit directory. Formatted
+ "man" output files (*.txt) are now supplied in a "docs/" directory.
+ (INSTALL, README, unix/configure, unix/Makefile) [SMS]
+ - On Unix systems, a temporary object library used during a build for
+ some optional feature (for example, liblzma.a) could easily collide
+ with an existing system-wide object library or shared object, and
+ cause a link failure (undefined symbol, or similar). Now, these
+ temporary object library names include a distinctive prefix,
+ "iz_prvt_" which should be enough to avoid the problem.
+ (unix/configure, unix/Makefile) [SMS]
+ - The Unix builders now support use of the "make" macro PREFIX to
+ specify a destination directory tree with the "install" target, and
+ MANSUFX replaces MANEXT for modifying the names of the installed
+ "man" files. The "install" target was trying build programs as well
+ as just copying them, which was more than it knew how to do. Some
+ obsolete, disfunctional, or experimental targets ("generic_XXX",
+ "*shlib*") have been removed. The rules used to create the formatted
+ manual (".txt") files now use "man -M", allowing them to work with
+ non-GNU "man" programs.
+ - Changed the name of the function zipinfo.c:zipinfo() to zipinform(),
+ to clear a compiler complaint on z/OS (CCN3571, "The external name
+ zipinfo must not conflict with the name in pragma csect or the csect
+ name generated by the compiler."). (process.c, unzpriv.h, zipinfo.c)
+ [SMS]
+ - Removed some decisions involving "man" file names and "bin" and "man"
+ installation directories from the unix/configure script, allowing
+ unix/Makefile to follow explicit user instructions. ("If you don't
+ think too good, don't think too much.") (unix/configure) [SMS]
+ - Added a new variable/macro, COL, to the unix builders to accommodate
+ SunOS 4.x, where /bin/col does not support "-x", but /usr/5bin/col
+ does. (unix/configure, unix/Makefile) [SMS]
+
+6.10c09 (13 May 2014):
+ - Changed LIBUNZIP macro in the Unix builders to a more versatile
+ BINS=[L][M][U] scheme. (unix/configure, unix/Makefile) [SMS]
+ - If memory allocation failed in the unmatched-name detection code for
+ file list and -x/--exclude (/EXCLUDE) list names, no notice was
+ given, and unmatched names were not reported. Now, less memory is
+ used (char, instead of int arrays), and such (unlikely) failures are
+ fatal. (extract.c) [SMS]
+
+6.10c10 (18 Aug 2014):
+ - Reconciled common encryption code with Zip. (crypt.c, crypt.h) [SMS]
+ - Added a dummy/comment C macro, x_SYMLINKS, to the Windows vc10
+ builder for UnZipSFX (like the existing one in the UnZip builder).
+ (win32/vc10/unzipsfx/unzipsfx.vcxproj) [SMS]
+ - Support single-source z/OS MVS builds. (zos/bbunzip.c,
+ zos/build.jcl) [AD]
+ - Add z/OS MVS executable and source ship builds. (zos/xmit.jcl,
+ zos/zipsrc.jcl) [AD]
+ - Correct ar -X option placement. (unix/configure) [AD]
+ - IBM XL C builds with ICONV=1 to support utf-8 via iconv().
+ (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]
-__________________________________________________________________________
-
- This is the Info-ZIP file INSTALL (for UnZip), last updated 16 Apr 2009.
-__________________________________________________________________________
-
- Yes, this is a rather long file, but don't be intimidated: much of its
- length is due to coverage of multiple operating systems and of optional
- customization features, large portions of which may be skipped.
-__________________________________________________________________________
-
-
-
-To compile UnZip, UnZipSFX and/or fUnZip (quick-start instructions):
-========================================
-
-(1) Unpack everything into a work directory somewhere, and make sure you're
- in the main UnZip directory (the one with this file in it).
- * (See note below concerning line termination format used in the source
- distribution)
-
-(2) Copy the appropriate makefile into the current directory, except under
- OS/2.
-
-(3) Run your "make" utility on the makefile (e.g., "nmake -f makefile.msc").
-
-(4) Try out your new UnZip the way you would any new utility: read the
- docs first.
-
- Ah ha ha ha!! Oh, that kills me. But seriously... For VMS, see the
- Install section below or [.vms]README. for details.
-
- For DOS and other OSes without explicit timezone support (i.e., everybody
- but Unix, Windows 95 and NT), make sure the "TZ" environment variable is
- set to a valid and reasonable value; see your compiler docs for details.
-
-(*) The unzip sources as well as other Info-ZIP source archives are packaged
- in Unix format. All text files use single LF (Ascii 0x0a) characters as
- line terminators. On systems that use different conventions for plain text
- files (e.g.:DOS,Win9x,WinNT,OS/2 -> combined CR+LF; MacOS -> single CR),
- some utilities (editors, compilers, etc.) may not accept source files
- with LF line terminators.
- For these systems, we recommend to use Info-ZIP's UnZip utility for
- extraction of our distribution archives, applying the command option
- "-a" (= translate text files to native format) in the extraction command.
- In case this procedure is not applicable, an appropiate third-party
- conversion utility may be used to achieve the desired line termination
- style (examples: "flip", available for Unix, DOS, OS/2; or "tr" on Unix).
-
-
-To compile UnZip, UnZipSFX and/or fUnZip (detailed instructions):
-========================================
-
-(1) Unpack *.c and *.h (the actual source files), preserving the directory
- structure (e.g., ./unix/unix.c). The sole exception is TOPS-20, where
- tops20/* should be unpacked into the current directory, but TOPS-20
- is no longer fully supported anyway.
-
- As of UnZip 5.41, full decryption support has been integrated in the
- UnZip source distribution. If you wish to compile binaries without
- decryption support, you must define the preprocessor flag NO_CRYPT.
- For many environments, you may add this flag to the custom compilation
- flags supplied by the environment variable LOCAL_UNZIP. For more
- details, see the make procedures and accompanied documentation for your
- particular target OS.
-
- As of UnZip 5.53, support for the bzip2 compression algorithm has been
- added to UnZip. However, this support requires the original sources of
- the bzip2 compression library which have to be aquired separately;
- see "http://www.bzip.org/" for further reference.
-
-
-(2) Choose the appropriate makefile based on the description in the Con-
- tents file for your OS (that is, there's only one for Unix or OS/2, but
- MS-DOS and several other OSes have several, depending on the compiler).
- Copy it into the current directory and rename if necessary or desired.
- (Some makefiles can be invoked in place; see (5) below.)
-
- Don't be afraid to read the makefile! Many options will be explained only
- in the comments contained therein. The defaults may not quite suit your
- system. When making changes, remember that some "make" utilities expect
- tabs as part of the makefile syntax. Failure with cryptic error messages
- will result if your editor quietly replaces those tabs with spaces.
-
- Special point of confusion: some non-MSDOS makefiles contain MS-DOS
- targets (useful for cross-compilations). An example is the OS/2 makefile
- os2/makefile.os2 that contains the gccdos target for DOS emx+gcc and
- some more DOS related targets for Watcom C and MSC. But since version 5.3,
- the msdos subdirectory contains makefiles for all supported DOS compilers.
- [The old djgpp, djgpp1 and gcc_dos targets in unix/Makefile have been
- removed in 5.3; use msdos/makefile.dj* instead.]
-
- Extra-special point of confusion: makefile.os2 expects to remain in
- the os2 subdirectory. Invoke it via "nmake -f os2/makefile.os2 gcc",
- for example.
-
-
-(3) If you want a non-standard version of UnZip, define one or more of the
- following optional macros, either by adding them to the LOCAL_UNZIP
- environment variable or by editing your makefile as appropriate. The
- syntax differs from compiler to compiler, but macros are often defined
- via "-DMACRO_NAME" or similar (for one called MACRO_NAME). Note that
- some of these may not be fully supported in future releases (or even
- in the current release). Note also that very short command lines in
- MS-DOS (128 characters) may place severe limits on how many of these
- can be used; if need be, the definitions can be placed at the top of
- unzip.h instead (it is included in all source files)--for example,
- "#define MACRO_NAME", one macro per line.
-
- DOSWILD (MS-DOS only)
- Treat trailing "*.*" like Unix "*" (i.e., matches anything); treat
- trailing "*." as match for files without a dot (i.e., matches any-
- thing, as long as no dots in name). Special treatment only occurs
- if patterns are at end of arguments; i.e., "a*.*" matches all files
- starting with "a", but "*.*c" matches all files ending in "c" *only*
- if they have a dot somewhere before the "c". [The default method of
- specifying files without a dot would be "* -x *.*", making use of
- UnZip's exclude-files option.] The matching is actually the same as
- Unix, if you assume that undotted filenames really have an invisible
- dot at the end, which is how DOS and related systems treat filenames
- in general. All other regular expressions (including "?" and
- "[range_of_chars]") retain their Unix-like behavior.
-
- WILD_STOP_AT_DIR (incompatible with WINDLL!)
- Enables an additional option "-W". When this qualifier is specified,
- the pattern matching routine is modified so that both '?' (single-char
- wildcard) and '*' (multi-char wildcard) do not match the directory
- separator character '/'. Examples:
- "*.c" matches "foo.c" but not "mydir/foo.c"
- "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
- "??*/*" matches "ab/foo" and "abc/foo" but not "a/foo" or "a/b/foo"
- To enable matching across directory separator chars, two consecutive
- multi-char wildcards "**" should be specified.
- This modified behaviour is equivalent to the pattern matching style
- used by the shells of some of UnZip's supported target OSs (one
- example is Acorn RISC OS).
-
- VMSWILD (VMS only)
- Use parentheses rather than brackets to delimit sets (ranges), and
- use '%' instead of '?' as the single-character wildcard for internal
- filename matching. (External matching of zipfile names always uses
- the standard VMS wildcard facilities; character sets are disallowed.)
-
- VMSCLI (VMS only)
- Use VMS-style "slash options" (/FOOBAR) instead of the default Unix-
- style hyphenated options (-f). This capability does not affect options
- stored in environment variables (UNZIP_OPTS or ZIPINFO_OPTS); those use
- the Unix style regardless. Beginning with UnZip 5.32, the supplied
- VMS build methods generate both VMS-style and default "UNIX-style"
- executables; you should NOT add VMSCLI to the custom options.
-
- CHECK_VERSIONS (VMS only)
- UnZip "extra fields" are used to store VMS (RMS) filesystem info,
- and the format of this information may differ in various versions
- of VMS. Defining this option will enable UnZip warnings when the
- stored extra-field VMS version(s) do(es) not match the version of
- VMS currently being used. This is a common occurrence in zipfiles
- received from other sites, but since the format of the filesystem
- does not seem to have changed in years (including on Alpha and
- IA64 systems), the warnings are not enabled by default.
-
- RETURN_CODES (VMS only)
- VMS interprets return codes according to a rigid set of guidelines,
- which means it misinterprets normal UnZip return codes as all sorts
- of really nasty errors. Therefore VMS UnZip returns an alternate set
- of return codes; since these may be difficult to interpret, define
- RETURN_CODES for human-readable explanations.
-
- VMS_TEXT_CONV (everybody except VMS)
- VMS Stream_LF-format text files archived with the "-V" option
- (/VMS), but NOT with -VV (/VMS=ALL), should be fine when extracted
- on other systems. Stream_LF-files archived with -VV should be
- readable as well, but they may get some junk appended.
- Text files with other formats (like the default VFC, with its
- embedded byte counts) may be only semi-readable at best when
- extracted on other systems. Defining this option enables UnZip's
- -aa option to detect and convert VMS VFC-record text files into
- native text format. Non-VMS UnZips now use a rudimentary VMS extra
- field analyser to relyably determine such text files. (Earlier
- versions of UnZip applied some heuristics instead.)
- Therefore this option is now enabled by default for the main program
- (but not the SFX stub), because it can be extremely useful on those
- rare occasions when a VMS text file must be extracted as normal text.
-
- USE_DJGPP_ENV (MS-DOS DJGPP 2.0x only)
- Regular DJGPP v2.0x compiled programs which use ENVIRONMENT are
- able to read from the file "djgpp.env" as well as those set in the
- environment. This adds about 1KB to the size of the executable.
- This option is disabled by default in Info-ZIP source. If you are
- able to use "djgpp.env" and don't like to clutter the environment
- with many special purpose variables, you may want to compile with
- this option set.
-
- USE_DJGPP_GLOB (MS-DOS DJGPP 2.0x only)
- If you like to get UnZip binaries that handle command line arguments
- similar to Unix tools which are run in an Unix shell, you might want
- to set this compilation option. This option enables the support for
- globbing command line arguments containing wildcards that is built
- into the DJGPP startup code. When using a binary compiled with this
- option, you may have to enclose wildcard arguments in double quotes
- to get them passed to the program unmodified. Enabling this option
- is not recommended, because it results in Info-Zip binaries that do
- not behave as expected for MS-DOS programs.
-
- USE_VFAT (MS-DOS only, for using same executable under DOS and Win95/NT)
- djgpp 2.x and emx/gcc+RSX 5.1 can detect when they are running under a
- Win32 DOS box and will accordingly enable long-filename support. For
- now only djgpp 2.x and emx/gcc with RSX 5.1 or later have this feature
- (and it is defined by default in msdos/makefile.dj2 and makefile.emx),
- but if/when other compilers build in similar support, define this
- macro to enable its use. See also msdos/doscfg.h. [Note that djgpp
- 2.0's LFN support is flaky; users should upgrade to 2.01 or later.]
-
- NO_W32TIMES_IZFIX (Win32 including WinDLL, and WinCE)
- By specifying this option, you can disable Info-ZIP's special timestamp
- adjustment to get stable time stamps on NTFS disks that do not change
- depending on the current time being normal vs. daylight saving time.
- When this option is set, UnZip behaves exactly like other programs;
- file timestamps on NTFS partitions are created so that their >current<
- local time representation displayed by directory listings (cmd.exe
- "dir" command or Windows Explorer listings) is the same as shown by
- UnZip's listing. But the actual UTC timestamp values stored in the
- NTFS file attributes vary depending on whether extraction is done
- at summer or winter time.
- This option is not recommended because it sacrifies the timestamp
- comparison checks when extracting or modifying archives in "update
- only newer" mode.
- However, for environments where consistency of >displayed< dates
- of files extracted to NTFS vs. FAT disks is considered more important
- than correctly working update/freshen tasks of Zip&UnZip, this
- option may be used.
- >> DO NOT DISTRIBUTE OR PUBLISH executables that were compiled with
- this option! <<
-
- NOTIMESTAMP
- This option disables the -T option, which basically does exactly what
- Zip's -go options do (i.e., set the timestamp of the zipfile 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.)
-
- DATE_FORMAT=DF_DMY or DF_MDY or DF_YMD
- This option controls the order in which date components are printed
- in non-ZipInfo-mode listings: day-month-year or month-day-year or
- year-month-day.
- For DOS, FlexOS, OS2, Theos and Win32, the format is automatically
- obtained from the operating system; most others default to DF_MDY.
-
- DATE_SEPCHAR='-' or '.' or '/' etc.
- This option controls the character that separates the date components
- shown in (non-ZipInfo-mode) listings. The Win32 port obtains the
- separator automatically from the operating system's locale settings;
- all others default to '-'.
-
- ACORN_FTYPE_NFS (needs support for long filenames with embedded commas)
- This option enables a -F option that instructs UnZip to interpret the
- filetype information extracted from Acorn RiscOS extra field blocks.
- The filetype IDs are translated into "NFS filetype extensions" and
- appended to the names of the extracted files. This feature facilitates
- maintenance of Unix-based NFS volumes that are exported to Acorn RiscOS
- systems.
-
- QLZIP (Unix only)
- Add some support for QDOS extra fields. This option enables Unix
- UnZip to append "datalen info" to QDOS exec type files in the same
- format as used by QDOS cross-compilers on Unix or the qltools v2.2(+).
-
- UNIXBACKUP (default on OS/2, Unix, Win32)
- This option enables a -B option that instructs UnZip to rename files
- that would normally be overwritten. The renamed files are given a
- tilde suffix and a unique sequence number (`~#####'). Note that
- previously renamed files may be overwritten without notice, even
- if the -n option is given.
- On target ports where UNIXBACKUP is enabled by default, the negated
- option NO_UNIXBACKUP may be used to disable this feature.
-
- OS2_EAS
- List the sizes of OS/2 EAs and ACLs for each file as two extra columns
- in "unzip -l" output. This is primarily useful for OS/2 systems, but
- because zipfiles are portable, OS2_EAS can be defined for any system.
- (May be extended someday to show sizes of Mac resource forks, RISCOS
- and VMS file info, etc.)
-
- DELETE_IF_FULL (anybody with unlink() function)
- If a write error is encountered (most likely due to a full disk),
- enabling this option will cause the incomplete file to be deleted
- instead of closed normally. This is particularly useful for the
- Windows CE port, which must generally contend with extremely limited
- resources.
-
- ASM_CRC (Amiga/Aztec C; many x86 systems: DOS, OS/2, Win32, Unix)
- Use an assembler routine to calculate the CRC for each file (speed).
-
- ASM_INFLATECODES (Amiga/Aztec C only, for now)
- Use an assembler version of inflate_codes() for speed.
-
- OLD_EXDIR
- No longer supported.
-
- SFX_EXDIR
- Enable the "-d <extract_dir>" option for UnZipSFX. This is now
- enabled by default (since UnZip 5.5) to facilitate use with
- automated installation scripts and the like. For disabling
- this feature, see the NO_SFX_EXDIR option.
-
- NO_SFX_EXDIR
- Disables the "-d <extract_dir>" option for UnZipSFX to generate the
- smallest possible executable stub. (Prior to the UnZip 5.5 release,
- this was the default.)
-
- CHEAP_SFX_AUTORUN
- Enable a simple "run command after extraction" feature for
- the (command line) UnZipSFX stub. This feature is currently
- incompatible with the "-d <extract_dir>" command line option,
- therefore CHEAP_SFX_AUTORUN implicitely sets the NO_SFX_EXDIR
- option.
-
- NO_ZIPINFO
- Compile without ZipInfo mode (-Z) enabled; makes a smaller executable
- because many text strings are left out. Automatically enabled for
- some small-model compiles under MS-DOS and OS/2, so ordinarily there
- is no need to specify this explicitly. (Note that even with this
- defined, the resulting executable may still be too big to extract
- some zipfiles correctly, if compiled with the small memory model.)
-
- USE_DEFLATE64 (default for UnZip and fUnZip)
- NO_DEFLATE64 (default for UnZipSFX stub)
- The "deflate64" algorithm from PKZIP 4.0 (or newer) is an enhanced
- variant of the deflate algorithm that achieves slightly better
- compression ratios on highly redundant data. Normally, UnZip should
- be compiled with support for this compression algorithm enabled.
- However, this results in significantly larger memory requirements
- to run the program. For 16-bit executables (DOS and OS/2), the
- special memory management to support the 64k history buffer results
- in a slight performance (= speed) penalty. And for the SFX stub,
- "deflate64" support might be unnessessary as long as the Info-ZIP
- Zip utility does not support it (quite likely, this will never
- get implemented). So, the NO_DEFLATE64 option is provided to allow
- exclusion of the deflate64 support.
-
- USE_BZIP2 (requires additional external code distribution)
- UnZip can optionally support the "bzip2" compression algorithm for
- most ports on 32-bit (or higher) platforms. Currently, this support
- is integrated in the Make procedures of MSDOS 32-bit (DJGPP), VMS,
- Win32, and many Unix systems.
- Prerequisites:
- You have to obtain the bzip2 source distribution (version 1.03 or
- higher) and extract it into the "bzip2" subdirectory.
- Compilation:
- - MSDOS, Win32: You have to supply the symbol definition
- "USEBZ2=1" on the command line when you invoke the make program.
- - Unix: The target "generic" automatically activates bzip2 support
- when its configure script detects the presence of the bzip2 sources.
- For other targets, there are two options:
- a) Use the command
- "make -f unix/Makefile D_USE_BZ2=-DUSE_BZIP2 L_BZ2=-lbz2 \
- LIBBZ2=bzip2/libbz2.a YourTarget"
- (Do not use the continuation line and replace YourTarget with
- the appropiate target name.)
- b) Edit the Makefile and remove the comment signs from the lines
- that define the macros D_USE_BZ2, L_BZ2, and LIBBZ2 (at about
- line 84 ff.).
- - VMS: The MMS/MMK build program should automatically activate the
- bzip2 support when it detects the presence of the bzip2 sources.
-
- MULT_VOLUME (experimental for 5.5x, do NOT use in production versions!)
- NO_MULT_VOLUME (default)
- The symbol MULT_VOLUME is used to flag code portions needed for
- support of multi-volume archives. For now, this flag MUST NOT be
- used to compile a production versions 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.
-
- LZW_CLEAN
- USE_UNSHRINK (now default, as of January 2005)
- The "shrinking" algorithm from PKZIP 1.0 is an LZW variant. Unisys
- patented the Lempel-Ziv-Welch algorithm in 1985 and has publicly
- claimed that decompression is covered by it. (IBM also patented the
- same thing in a filing 3 weeks prior to Unisys's.) In 2004, the
- Unisys and IBM patents expired worldwide, so unshrinking is now
- enabled again by default. If you do not wish to include the LZW
- method, you may still disable it by defining LZW_CLEAN.
- (Unshrinking was used by PKZIP 1.0 and 1.1, and Zip 1.0 and 1.1.
- All newer archives use only the deflation method.)
-
- COPYRIGHT_CLEAN (now default)
- USE_SMITH_CODE
- The last chunk of code in UnZip that was blatantly derived from Sam
- Smith's unzip 2.0 (as in, "substantially similar") is in unreduce.c.
- Since reducing was only used by very early PKZIP beta versions (0.9x),
- support for it is now omitted by default (COPYRIGHT_CLEAN). To in-
- clude unreducing capability, define USE_SMITH_CODE and replace the
- stub unreduce.c source file by the separatly distributed full source
- code module. Note that this subjects UnZip to any and all restrictions
- in Smith's copyright; see the UnZip COPYING.OLD file for details.
-
- USE_CRYPT
- Enable decryption support for all binaries. The default setting
- is to disable decryption support for the SFX stub to keep its size
- as small as possible. For other binaries of the UnZip distribution,
- decryption support is enabled by default.
-
- NO_CRYPT
- Disable decryption support for all binaries.
-
- PASSWD_FROM_STDIN (with full crypt sources only; Unix, VMS only)
- Used to allow the password on encrypted files to be read from stdin
- rather than the default stderr. This was useful for those who wished
- to automate the testing or decoding of encrypted archives (say, in a
- shell script via ``echo "password" | unzip -tq archive''), but as of
- version 5.3, UnZip has a -P option for passing a password directly to
- the program. PASSWD_FROM_STDIN will therefore probably be phased out
- in future versions. Note that the same security warnings given in the
- description of the -P option apply here as well.
-
- UNICODE_SUPPORT
- Enable restoring from UTF-8 encoded paths. These paths are stored
- in extra fields in a backward-compatible way so that archives with
- UTF-8 paths still work on zips and unzips that don't support Unicode.
- This support follows the recent additions to the PKWare AppNote for
- Unicode support, except that Unicode comments on systems where UTF-8
- is not the current character set is not implemented in this release.
-
- Internally, Unicode support can be achieved by three methods:
- a) The charset encoding used by the system is already UTF-8, so
- the program just has to select the UTF-8 versions of the stored
- filenames for file name handling.
- This method is enabled by setting the symbol UTF8_MAYBE_NATIVE;
- this activates code to check for native UTF-8 encoding in the
- locale settings.
- b) The operating system and the compilation environment support
- "wide character" data in Unicode encoding (UCS-2/UTF-16 or UCS-4),
- which are used to translate between UTF-8 and the native
- extended-ASCII character encoding.
- The code for this method is activated by setting the preprocessor
- symbol UNICODE_WCHAR.
- It may be activated together with UTF8_MAYBE_NATIVE to provide
- more versatile Unicode support and additional "debugging" options
- for checking the correct recognition of non-ASCII Unicode
- characters.
- c) The operating system and the compilation environment allow to use
- unicode-encoded "wide character" data for native text strings
- support.
- Complete support for this method requires a throughout revision
- of the UnZip code. All internal string handling and text output
- needs to be ported to use wchar_t character storage.
- This porting is still in an experimental stage and not ready
- for general distribution.
-
- On some ports UNICODE_SUPPORT is set automatically:
- - WIN32 (and WinCE) use method b) by defining UNICODE_SUPPORT and
- UNICODE_WCHAR.
- - On Unix, the automatic configuration script enables UNICODE_WCHAR
- if ISO-10646 compatible wide characters are supported and
- UTF8_MAYBE_NATIVE if the locale detection call is available.
- For these ports, setting NO_UNICODE_SUPPORT forces deactivation of
- the Unicode support.
-
- NO_SETLOCALE (for Unix)
- On Unix, it is now assumed that <locale.h> and the setlocale function
- are available, to setup locale-aware filtering of displayed filenames.
- The option NO_SETLOCALE allows to disable the dependency on <locale.h>
- and setlocale() on systems where this assumption is invalid (and the
- auto-configuring make target "generic" cannot be used for capabilities
- detection).
-
- _MBCS
- NO_MBCS
- Enable multi-byte character set support. This is the default for the
- Human68k system (originated from Japan) and for Win32 (here only DBCS
- "double-byte character set" support). The MBCS support should also be
- enabled on systems which are capable of using UTF-8 as native charset.
- For MBCS support, the C runtime library must supply implementations
- for the mblen() function and the MB_CUR_MAX runtime macro/function.
- The NO_MBCS symbol allows to explicitely disable MBCS support for
- testing purpose, or when MBCS support does not work as expected.
-
- HAVE_WORKING_ISPRINT
- NO_WORKING_ISPRINT
- The symbol HAVE_WORKING_ISPRINT enables enhanced non-printable chars
- filtering for filenames in the fnfilter() function. On some systems
- (Unix, VMS, some Win32 compilers), this setting is enabled by default.
- In cases where isprint() flags printable extended characters as
- unprintable, defining NO_WORKING_ISPRINT allows to disable the enhanced
- filtering capability in fnfilter(). (The ASCII control codes 0x01 to
- 0x1f are always escaped on ASCII systems.)
-
- DEBUG
- Used for debugging purposes; enables Trace() statements. Generally
- it's best to compile only one or two modules this way.
-
- DEBUG_TIME
- Used for debugging the timezone code in fileio.c; enables TTrace()
- statements. This code is only used for the freshen/update options
- (-f and -u), and non-Unix compilers often get it wrong.
-
-
-(4) If you regularly compile new versions of UnZip and always want the same
- non-standard option(s), you may wish to add it (them) to the LOCAL_UNZIP
- environment variable (assuming it's supported in your makefile). Under
- MS-DOS, for example, add this to AUTOEXEC.BAT:
-
- set LOCAL_UNZIP=-DDOSWILD -DDATE_FORMAT=DF_DMY
-
- You can also use the variable to hold special compiler options (e.g.,
- -FPi87 for Microsoft C, if the x87 libraries are the only ones on your
- disk and they follow Microsoft's default naming conventions; MSC also
- supports the CL environment variable, however).
-
-
-(5) Run the make utility on your chosen makefile:
-
- Unix
- For most systems it's possible to invoke the makefile in place, at
- the possible cost of an ignorable warning; do "make -f unix/Makefile
- list" to get a list of possible system targets, and then "make -f
- unix/Makefile target" for your chosen target. The "generic" target
- works for most systems, but if it fails with a message about ftime()
- unresolved or timezone redefined, do "make clean", "make help", and
- then either "make generic2" or "make generic3" as instructed. If all
- else fails, read the makefile itself; it contains numerous comments.
- (One of these days we'll make a configure script that automates this
- procedure better.)
-
- VMS (OpenVMS):
- On VMS, two build methods are provided: a command procedure, and
- description files for MMS or MMK. Both methods must be run from
- the main directory, not the [.VMS] subdirectory.
-
- A simple build using the command procedure looks like this:
- @ [.VMS]BUILD_UNZIP.COM
-
- A simple build using MMS or MMK looks like this:
- MMS /DESCRIP = [.VMS]DESCRIP.MMS ! Or, with MMK, ...
- MMK /DESCRIP = [.VMS]DESCRIP.MMS
-
- Various options for each build method are explained in comments in
- the main builder file, either BUILD_UNZIP.COM or DESCRIP.MMS.
-
- Here are some more complex build examples:
-
- o Build with the large-file option enabled (non-VAX only):
-
- @ [.VMS]BUILD_UNZIP LARGE
- or:
- MMS /DESC = [.VMS] /MACRO = LARGE=1
-
- o Re-link the executables (small-file and large-file):
-
- @ [.VMS]BUILD_UNZIP LINK
- @ [.VMS]BUILD_UNZIP LARGE LINK
- or
- MMK /DESC = [.VMS] CLEAN_EXE ! Deletes existing executables.
- MMK /DESC = [.VMS] ! Builds new executables.
- MMK /DESC = [.VMS] /MACRO = LARGE=1 CLEAN_EXE
- MMK /DESC = [.VMS] /MACRO = LARGE=1
-
- o Build a large-file product from scratch, for debug, getting
- compiler listings and link maps:
-
- mms /desc = [.vms] clean
- mms /desc = [.vms] /macro = (DBG=1, LARGE=1. LIST=1)
-
- On VAX, the builders attempt to cope with the various available C
- compilers: DEC/Compaq/HP C, VAX C, or GNU C. If DEC/Compaq/HP C is
- not available or not desired, comments in the relevant builder file
- explain the command-line options used to select a different
- compiler.
-
- System-architecture-specific files (like objects and executables)
- are placed in separate directories, such as [.ALPHA], [.IA64], or
- [.VAX]. Large-file products get their own directories, [.ALPHAL]
- or [.IA64L]. On VAX, VAX C products are placed in [.VAXV], GNU C
- products in [.VAXG]. Each product builder announces what the
- destination directory will be when it is run.
-
- Common files, such as the help libraries (UNZIP.HLP for the
- default UNIX-like command-line interface, UNZIP_CLI.HLP for the
- VMS-like command-line interface), are placed in the main
- directory. With a mixed-architecture VMS cluster, the same main
- directory on a shared disk may may be used by all system types.
- (Using the NOHELP option with BUILD_UNZIP.COM can keep it from
- making the same help files repeatedly.)
-
- Some further information may be found in the files
- [.VMS]README. and [.VMS]00BINARY.VMS, though much of what's
- there is now obsolete.
-
- MS-DOS
- See the msdos\Contents file for notes regarding which makefile(s) to
- use with which compiler. In summary: pick one of msdos\makefile.*
- as appropriate, or (as noted above) use the OS/2 gccdos target for
- emx+gcc. There is also an mscdos cross-compilation target in
- os2\makefile.os2 and a sco_dos cross-compilation target in the Unix
- makefile. For Watcom 16-bit or 32-bit versions, see the comments in
- the OS/2 section below.
-
- After choosing the appropriate makefile and editing as necessary or
- desired, invoke the corresponding make utility. Microsoft's NMAKE
- and the free dmake and GNU make utilities are generally the most
- versatile. The makefiles in the msdos directory can be invoked in
- place ("nmake -f msdos\makefile.msc", for example).
-
- OS/2
- Either GNU make, nmake or dmake may be used with the OS/2 makefile;
- all are freely available on the net. Do "nmake -f os2\makefile.os2",
- for example, to get a list of supported targets. More generally,
- read the comments at the top of the makefile for an explanation of
- the differences between some of the same-compiler targets.
-
- Win32 (WinNT or Win9x)
- For creating Win32 executables, the Microsoft Visual C++ compiler
- platforms from version 2.x up to 8.0 (Visual Studio .Net C++ 2005)
- are supported. Recent build test have been run on VC++ 6.0, 7.1
- and 8.0. The linker of newer Microsoft Visual C++ versions (beginning
- with Visual C++ 2008 - [VC++ 9.0]) create executables that are marked
- to run on Windows 2000 and newer, only. Although these Visual C++
- environments may succeed in building Win32 Info-ZIP executables,
- they cannot (and must not) be used to create binaries for public
- distribution.
- Alternative compilers for the Intel platforms are OpenWatcom C++,
- GNU C (preferably the mingw32 port, CygWin and emx/rsxnt may also
- work), Borland C++, or lcc-win32.
- DEC C/C++ for NT/Alpha may or may not still work.
- For the Watcom compiler, use WMAKE and win32\makefile.wat; for the
- Microsoft compilers, use NMAKE and win32\Makefile; for mingw32 and
- CygWin, GNU Make and win32\Makefile.gcc should do the job.
- With emx+gcc, a good choice is GNUMake 3.75 (or higher) from the
- djgpp V2 distribution used on win32\Makefile.emx.
-
- The unzip32.dll WinDLL executables can be built using the appropiate
- Makefile in the win32\ subdirectory, or by using the Microsoft Visual
- C++ project files supplied below the windll subdirectory. Besides the
- MSC compilers, gcc-mingw32, Watcom C and Borland C allow to build the
- Windows UnZip DLL. By default, the Makefiles for compilers that use
- the Microsoft C runtime are configured to link against the shared
- multithreading C runtime DLL. Depending on the intended usage for
- unzip32.dll, a statically linked dll might be more suitable. The
- make scripts for MSC support build variants with static linking; you
- should look up the configuration switch DLLSTANDALONE in the MSC
- Makefile or the "Static..." build configurations in the Visual Studio
- project files.
-
- WinCE (WinCE or WinNT)
- Only Microsoft Visual C++ 5.0, 6.0 or Visual C++ embedded 3.0 or later
- are supported. Use the appropiate version of the included project
- files and check wince\README for details.
-
- AmigaDOS
- SAS/Lattice C and Manx Aztec C are supported. For SAS C 6.x do "smake
- -f amiga/smakefile all"; for Aztec C do "make -f amiga/makefile.azt
- all". The Aztec C version supports assembly-language versions of two
- routines; these are enabled by default.
-
- Atari TOS
- Turbo C is no longer supported; use gcc and the MiNT libraries, and
- do "make". Note that all versions of gcc prior to 2.5.8 have a bug
- affecting 68000-based machines (optimizer adds 68020 instructions).
- See atari\README for comments on using other compilers.
-
- Macintosh
- Metrowerks CodeWarrior Pro 4 with Universal Interfaces 3.1 is the only
- currently supported compiler, although the Mac Programmer's Workbench
- (MPW) and Think C were supported at one time and still have some hooks.
- Other Compilers may work too, no compiler specific instructions
- (pragma, header, macros, ...) were used in the code.
- For CodeWarrior Pro 4, un-BinHex the CodeWarrior project file and
- UnZip resource file (using Stuffit Expander or BinHex 4.0 or later),
- then open the project and click on the compile button.
- See ":macos:Contents" for the possible project targets.
- Link order of the standard libraries is very important: Link all
- sources first and all standard libraries last.
-
- Acorn (RISC OS)
- Extract the files from the archive and place in standard 'Acorn' C
- form (i.e., *.c, *.h and *.s become c.*, h.* and s.*, respectively),
- either using the UNZIP$EXTS environment variable and a pre-built UnZip
- binary, or using Spark[FS] and doing it manually. Then copy the
- Acorn.Makefile to the main UnZip directory and either type 'amu' or
- use the desktop make utility.
-
- VM/CMS
- Unpack all the files and transfer them with ASCII -> EBCDIC conver-
- sion to an appropriate directory/minidisk/whatever, then execute
- UNZVMC to compile and link all the sources. This may require C/370
- version 2.1 or later and certain `nucleus extensions,' although
- UnZip 5.3 has been reported to compile fine with the `ADCYCLE C/370
- v1.2 compiler.' Note that it will abend without access to the C/370
- runtime library. See the README.CMS file for more details.
-
- MVS
- Unpack all the files and transfer them to an appropriate PDS with
- ASCII -> EBCDIC conversion enabled, then edit UNZMVSC.JOB as required,
- and execute it to compile and link all the sources. C/370 2.1 or
- later is required. See README.MVS for further details. [This is a
- new port and may need a little more work even to compile.]
-
- Human68K
- [This is a Japanese machine and OS.] It appears that GNU make and
- gcc are required; presumably just do "gmake -f human68k/Makefile.gcc"
- to build everything. This port has not been tested since the 5.12
- release.
-
- TOPS-20
- [No longer fully supported due to new, unported features, although
- patches are always accepted.] Unpack all files into the current
- directory only (including those in the zipfile's tops20 directory),
- then use make.mic and "do make".
-
- BeOS
- You can run the BeOS makefile in place by typing "make -f
- beos/Makefile". In fact, this is how the author tests it.
-
- Running the appropriate make utility should produce three executables on
- most systems, one for UnZip/ZipInfo, one for UnZipSFX, and one for fUnZip.
- (VMS is one prominent exception: fUnZip makes no sense on it. The Amiga
- produces a fourth executable called MakeSFX, which is necessary because
- Amiga self-extracting archives cannot be created by simple concatenation.
- If necessary the source amiga/makesfx.c can be compiled on other systems.)
- Read any OS-specific README files for notes on setting things up for
- normal use (especially for VMS) and for warnings about known quirks and
- bugs in various compilers (especially for MS-DOS).
-
- Also note that many OSes require a timezone variable to be set correctly
- (often "TZ"); Unix and VMS generally do so by default, Win95/NT do if set
- up properly, but other OSes generally do not. See the discussion of the
- -f and -u options in the UnZip man page (or unzip.txt). BeOS doesn't
- currently support timezone information at all, but this will probably be
- added soon.
-
- Then test your new UnZip on a few archives and let us know if there are
- problems (but *please* first make certain that the archives aren't actu-
- ally corrupted and that you didn't make one of the silly mistakes dis-
- cussed in the documentation). If possible, double-check any problems
- with PKUNZIP or with a previous version of UnZip prior to reporting a
- "bug." The zipfile itself may be damaged.
-
-
-
-To install:
-===========
-
-Unix
- The default prefix for the installation location is /usr/local (things
- go into the bin and man/man1 subdirectories beneath the prefix), and
- the default man-page extension is "1" (corresponding to man/man1, above).
- To install as per the defaults, do "make install"; otherwise do "make
- prefix=/your/path manext=your_extension install". (For Intel Unix flavors
- where the assembler CRC routines were used [ASM_CRC], use the install_asm
- target instead of the regular install target.) For example, to install
- in your home directory with "l" as the man-page extension (for "local"),
- do "make prefix=$HOME manext=l install". Permissions will be 755 for the
- executables and 644 for the man pages. In general root must perform in-
- stallation into a public directory. Do "rehash" if your shell requires
- it in order to find the new executables.
+ INSTALL -- Info-ZIP UnZip Installation Instructions
+ ===================================================
-VMS
- To complete the installation, the executables may be left in place,
- or moved (or copied) to a convenient place. While other methods
- (like DCL$PATH) exist, most users define symbols to make the UnZip
- executables available as foreign commands. These symbol definitions
- may be placed in a user's SYS$LOGIN:LOGIN.COM, or in a more central
- location, like SYS$MANAGER:SYLOGIN.COM. Typical symbol definitions
- might look like these:
+ UnZip version 6.10. Revised: 2014-05-14
+
+------------------------------------------------------------------------
+
+ On most system types, the general procedure to build and install
+UnZip follows these steps:
+
+ 1. Unpack the UnZip source kit. (Some optional features, such as
+ optional compression or encryption methods, may require additional
+ source kits. Obtain and unpack any additional source kits, if
+ needed.)
+
+ 2. Build. That is, compile and link the programs. A C compiler
+ and a "make" program are usually required. Other standard utility
+ programs for the build environment may also be needed. (For
+ example, on a Unix(-like) system, "cat", "chmod", "cp", "ln",
+ "mkdir", "rm", "sed", and so on.)
+
+ 3. Test. The Unix and VMS builders include a very basic test
+ procedure. A Windows command script is also available. Careful
+ users should test any programs like these using their own data and
+ procedures before relying on them.
+
+ 4, Install. That is, move the executables and associated files to
+ their destination directories.
+
+ The details of these steps depend on the system type and on
+user-selected options.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ For Macintosh Mac OS X, follow the Unix procedures.
+
+ For VMS instructions, see [.vms]INSTALL_VMS.txt.
+
+ For Windows, using Cygwin or MinGW, follow the Unix procedures. (For
+ Windows using native tools, see the Windows section below.)
+
+ +-------------------------------------------------------------------+
+ | Many system types have a system-specific directory ("unix/", |
+ | "[.vms]", "win32\", and so on). For any system type, look in its |
+ | system-specific directory for a system-specific INSTALL*.* and/or |
+ | README*.* file, which should explain any system-specific details. |
+ +-------------------------------------------------------------------+
+
+------------------------------------------------------------------------
+
+ Unpack the Source Kit(s)
+ ------------------------
+
+ UnZip is normally distributed as a Zip archive (which requires some
+kind of unzip program to unpack), or as a gzip-compressed "tar" archive
+(which requires programs like "gzip" and "tar" to unpack).
+
+ To unpack a Zip-archive kit, use a command like the following:
+
+ unzip unzip61.zip
+
+(But see "Source File Format", below, for details on some relevant UnZip
+options.)
+
+ To unpack a tar+gzip kit, use a command like the following:
+
+ gzip -dc unzip61.tgz | tar xf -
+
+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 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.) 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).
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Source File Format
+ ------------------
+
+ Text files in Info-ZIP source kits generally have Unix-compatible
+line endings (line-feed, LF, ASCII 0x0a). On systems like MS-DOS or
+Windows, the norm is different (Carriage Return + Line Feed, CR+LF,
+ASCII 0x0d+0x0a). On those systems, some programs (text editors,
+compilers, and so on) may have problems with LF line endings. In such
+situations, one solution is to use Info-ZIP UnZip with its "-a" option
+to unpack the source kit. With "-a", UnZip converts line endings in
+text files to the local standard as those files are extracted. For
+example:
+
+ unzip -a unzip61.zip
+
+Alternatively, programs like "flip" or "unix2dos" (or Unix utilities
+like "sed" or "tr") can also be used to convert text file line endings.
+
+ Some system-specific text files in an UnZip source kit, such as
+Microsoft Windows Visual Studio files, may be archived with CR+LF line
+endings, and these files should work on the appropriate systems whether
+or not "unzip -a" is used to extract them. (Unix users could use "unzip
+-a" to make it easier to examine these files on their systems.)
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Optional Source Kits
+ --------------------
+
+ Advanced Encryption Standard (AES) Encryption
+ ---------------------------------------------
+
+ To enable support for AES encryption, a separate IZ_AES_WG source kit
+is needed. 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
+
+but other, older kits may also be available there. Version
+compatibility information should be included in the IZ_AES_WG
+documentation. The latest version of that should be:
+
+ ftp://ftp.info-zip.org/pub/infozip/crypt/README_AES_WG.txt
+
+It might be wise to read that before downloading any particular
+IZ_AES_WG kit.
+
+ The IZ_AES_WG kit should be unpacked in the main UnZip directory,
+where it should populate the "aes_wg" subdirectory. For example, if the
+proper IZ_AES_WG kit is "iz_aes_wg13.zip", then use commands like the
+following:
+
+ cd unzip61 # (If not already there.)
+ unzip ../iz_aes_wg13.zip
+
+ See the "Build" section, below, for details on how to build UnZip
+with AES encryption support.
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ Bzip2 Compression
+ -----------------
+
+ To enable support for the bzip2 compression method, the UnZip
+programs must be linked with a bzip2 object library, such as "libbz2.a".
+For proper error handling, the bzip2 object library should be built with
+the C macro BZ_NO_STDIO defined (which is not the bzip2 default). For
+general information on bzip2 compression, or to download a bzip2 source
+kit:
+
+ http://www.bzip.org/
+
+Any bzip2 version from 1.0.3 up should be compatible. Bzip2 version
+1.0.6 was current when this UnZip version was developed.
+
+ The UnZip builders for Unix systems can use a pre-built (BZ_NO_STDIO)
+object library, or they can build a proper bzip2 object library, if they
+find bzip2 source files in the "bzip2" subdirectory of the main UnZip
+directory. To have the UnZip builders do the work, let's assume that
+you have downloaded a bzip2 kit, like, say, "bzip2-1.0.6.tar.gz", and
+put it in the same directory as the UnZip source kit. To unpack that
+kit, and put its contents where the UnZip builders expect them, use
+commands like the following:
+
+ cd unzip61 # (If not already there.)
+ gzip -dc ../bzip2-1.0.6.tar.gz | tar xf -
+ mv bzip2-1.0.6/* bzip2
+
+ The UnZip builders will attempt to build a bzip2 object library from
+sources only in the "bzip2" subdirectory of the main UnZip directory.
+Existing bzip2 kits in other directory trees should be safe from damage
+by UnZip builders.
+
+ See the "Build" section, below, for details on how to build UnZip
+with bzip2 compression support.
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ LZMA and PPMd Compression
+ -------------------------
+
+ All the source files needed to enable support for the LZMA and PPMd
+compression methods are included in the UnZip source kit.
+
+------------------------------------------------------------------------
+
+ Build
+ -----
+
+ What Gets Built
+ ---------------
+
+ On most systems, UnZip provides three programs: fUnZip,
+UnZip/ZipInfo, and UnZipSFX. (Actual executable names depend on the
+operating system, so, for example, an UnZip executable might be named
+"unzip", "unzip.exe", UNZIP.EXE, and so on, on different systems.)
+fUnZip is not provided on VMS, where pipeline capabilities are too
+limited. On Amiga, an additional executable, MakeSFX, is provided,
+because a self-extracting archive on Amiga cannot be created by simple
+concatenation ("cat", COPY), as it can on other systems.
+
+ Various documentation files (Unix "man" files, VMS HELP files, and so
+on) may also be created, if they were not already included in the kit.
+
+ Additional shell scripts, utility programs, and so on may also reside
+in system-dependent subdirectories.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ How to Build
+ ------------
+
+ Before starting the build, move into the unpacked archive's top-level
+directory, using a command like the following:
+
+ cd unzip61 # (If not already there.)
+
+ In many Unix or Unix-like environments, the basic build command looks
+like the following:
- UNZIP :== $ dev:[dir]UNZIP.EXE ! UNIX-like command line.
- or:
- UNZIP :== $ dev:[dir]UNZIP_CLI.EXE ! VMS-like command line.
+ make -f unix/Makefile generic
- For convenience, a ZIPINFO symbol could also be defined, so:
+but many options may be specified in the "make" command. These are
+described below.
- ZIPINFO :== $ dev:[dir]UNZIP.EXE """-Z"""
+ In some environments, where "make -f DIR/Makefile" does not work,
+copy the appropriate "make" file (in the example above, "DIR/Makefile"),
+into the main directory, and then use a "make" command without the "-f
+DIR/Makefile" option (or without the "DIR/" part of the path to the
+"make" file).
- On a non-VAX system, different symbols could be defined for the
- small-file and large-file programs. For example:
+ In most Unix(-like) environments, the "generic" target (as shown
+above) works best. It uses a shell script, "unix/configure", to adjust
+the build procedure to the local environment. (It's also tested better
+than the other, older "make" targets.) If "generic" does not work, then
+the "help" target should list the other possible targets (and some of
+the popular "make" options):
- UNZIPS :== $ dev:[dir.ALPHA]UNZIP.EXE ! UNZIPS = small-file UnZip.
- UNZIP*L :== $ dev:[dir.ALPHAL]UNZIP.EXE ! UNZIP[L] = large-file UnZip.
+ make -f unix/Makefile help
- The builders create help text files, UNZIP.HLP and UNZIP_CLI.HLP.
- These may be incorporated into an existing help library, or a separate
- UnZip help library may be created using commands like these, using
- either UNZIP.HLP (as shown) or UNZIP_CLI.HLP:
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- $ LIBRARY /HELP dev:[dir]existing_library.HLB UNZIP.HLP
+ Build Options for the "generic" Target
+ --------------------------------------
- $ LIBRARY /CREATE /HELP UNZIP.HLB UNZIP.HLP
+ When using "make generic", add the "make" macros listed below to
+control the corresponding optional features:
- UnZip help may then be accessed from a separate UnZip help library
- using a command like:
+ NO_AES_WG=1 Disable support for WinZip-compatible AES
+ (strong) encryption (if the optional source kit
+ is present). Support requires a separate
+ IZ_AES_WG source kit, as described above
+ ("Optional Source Kits"), but is enabled by
+ default if that source kit is present.
- $ HELP /LIBRARY = device:[directory]UNZIP.HLB
+ BINS=[L][M][U] Binaries build list:
+ L: object library (libizunzip.a)
+ M: main program (UnZip)
+ U: utility programs (fUnZip, UnZipSFX)
+ Default: MU.
+ Specify "BINS=LMU" to build the UnZip object
+ library along with the usual executables.
- For greater ease, the user (or system manager) may define a
- HLP$LIBRARY logical name to allow the HELP utility to find the UnZip
- help library automatically. See HELP HELP /USERLIBRARY for more
- details. The command procedure HLP_LIB_NEXT.COM may be used to
- determine the next available HLP$LIBRARY logical name, and could be
- adapted to define a HLP$LIBRARY logical name for an UnZip help library.
+ CC=gcc Compile and link using "gcc" instead of "cc".
+ (This method replaces the separate "generic_gcc"
+ target, which was used with UnZip 6.0, and has
+ been removed.)
- The kit includes MAKESFX.COM, a command procedure intended to simplify
- creating a self-extracting archive. It may be helpful to install this
- procedure near the UnZip executables. MAKESFX.COM expects another
- symbol definition, like one of these:
+ NO_ICONV=1 Disable ISO/OEM (iconv) character conversion
+ (options: -I, -O), if it's normallty supported
+ on this system type.
- UNZIPSFX :== $ dev:[dir]UNZIPSFX.EXE ! UNIX-like command line.
- or:
- UNZIPSFX :== $ dev:[dir]UNZIPSFX_CLI.EXE ! VMS-like command line.
+ NO_IZ_BZIP2=1 Disable support for the bzip2 compression
+ method. See also IZ_BZIP2.
- Again here, on a non-VAX system, either a small-file or a large-file
- UNZIPSFX program may be used. (MAKESFX.COM could be modified to allow
- a run-time choice to be made.)
+ IZ_BZIP2=bz2dir Use bzip2 compression code from the "bz2dir"
+ directory. By default, the code in the
+ "./bzip2" subdirectory will be used (unless
+ NO_IZ_BZIP2=1 is specified). Specify
+ "IZ_BZIP2=bzip2" without a bzip2 source kit
+ there to attempt to get a bzip2 library from the
+ operating system.
-OS/2, MS-DOS, NT, Atari, Amiga
- Move or copy unzip.exe (or unzip.ttp, or UnZip, or whatever) to a direc-
- tory in your path; also possibly copy the UnZip executable to zipinfo.exe
- (or ii.exe), or else create an alias or a batch/command file for ZipInfo
- ("@unzip -Z %1 %2 %3 %4 %5 %6 %7 %8 %9" under MS-DOS). The latter is only
- relevant if NO_ZIPINFO was *not* defined, obviously... Under djgpp 2.x,
- zipinfo.exe is a 2K stub symbolically linked to unzip.exe.
+ IZ_ZLIB=zdir Use zlib for the Deflate compression method,
+ instead of UnZip's internal Deflate code.
+ "zdir" specifies the directory where the zlib
+ code resides.
+
+ LOCAL_UNZIP=<opts> Build using "<opts>" (C compiler options,
+ typically defining C macros).
+
+ NO_LZMA=1 Disable support for the LZMA compression method.
+
+ NO_PPMD=1 Disable support for the PPMd compression method.
+
+ PROD=subdir Use "subdir" as the destination directory for
+ product files (object files, object libraries,
+ executables, and so on). By default, product
+ files are placed in the main directory (".").
+ With PROD=subdir, they are placed in the
+ specified subdirectory. This allows different
+ product configurations (different compilers,
+ options, hardware architectures, and so on) to
+ be built in a single source tree.
+ Note: PROD has no effect on any automatically
+ built bzip2 object library, so it's generally
+ safer to use a pre-built bzip2 object library in
+ an external directory when using PROD,
+ especially when using one source tree for
+ different hardware architectures.
+
+
+ For example, a build command using "gcc" as the C compiler, with all
+the optional compression and encryption methods enabled, might look like
+the following:
+
+ make -f unix/Makefile CC=gcc generic
+
+ The following commands would build UnZip in the "cc" subdirectory
+using "cc" as the compiler, and again, in the "gcc" subdirectory using
+"gcc" as the compiler. In both cases, bzip2 files in "../iz_bzip2"
+are used. See "Building with Bzip2 Compression", below. ("CC=cc" is
+the default, so specifying it explicitly is normally not needed, but
+doing so is harmless and clear.)
+
+ make -f unix/Makefile CC=cc PROD=cc generic
+
+ make -f unix/Makefile CC=gcc PROD=gcc generic
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ LOCAL_UNZIP
+ -----------
+
+ Environment Variables v. "make" Macros
+ --------------------------------------
+
+ On many systems, defining an environment variable (or, on VMS, a DCL
+symbol) can substitute for specifying a "make" macro on the "make"
+command line. For example, if you regularly build new versions of
+UnZip, and always want the same non-standard compiler options, then you
+may wish to specify those options in a LOCAL_UNZIP environment variable
+(assuming that it's supported in your "make" file). Under MS-DOS, for
+example, you could add something like the following to AUTOEXEC.BAT:
+
+ set LOCAL_UNZIP=-DDOSWILD -DDATE_FORMAT=DF_DMY
+
+For a Bourne-like shell on a Unix(-like) system, you could add something
+like the following to a shell start-up file (like "~/.profile"):
+
+ LOCAL_UNZIP='-DBZIP2_SFX' ; export LOCAL_UNZIP
+
+You could also use the variable to hold special compiler options. For
+example, -FPi87 for Microsoft C, if the x87 libraries are the only ones
+on your disk and they follow Microsoft's default naming conventions.
+(MSC also supports the CL environment variable, however.)
+
+ Hiding UnZip build options this way can also cause confusion, because
+it may not be obvious why some particular build option was active if
+it's not specified explicitly on the "make" command line. Creating a
+shell script with the desired special options may be safer than setting
+a LOCAL_UNZIP environment variable. Also, beware of changes to these
+"make" macros from one product version to another.
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ Building with Bzip2 Compression
+ -------------------------------
+
+ The Unix and VMS builders for UnZip can use a bzip2 source kit which
+has been placed in the "bzip2" subdirectory of the main UnZip directory,
+as described above ("Optional Source Kits"). Users who regularly work
+with multiple UnZip versions can avoid duplicating the bzip2 code by
+manually building a bzip2 object library ("libbz2.a" on Unix) with
+BZ_NO_STDIO defined, in some common location. Then, when building
+UnZip, specify that bzip2 directory as the value of the "make" macro
+IZ_BZIP2. For example:
+
+ make -f unix/Makefile IZ_BZIP2=../../bzip2/bzip-1.0.6 generic
+
+ Frequent UnZip builders may find it convenient to create a nearby
+bzip2 directory, or a nearby link to some particular bzip2 kit
+directory. For example:
+
+ make -f unix/Makefile IZ_BZIP2=../iz_bzip2 generic
+
+where "../iz_bzip2" is a real bzip2 directory or a link to one.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ UnZipSFX Considerations
+ -----------------------
+
+ Building an optimal UnZipSFX executable is more complicated when
+optional compression or encryption methods will be used (or when the
+standard method, Deflate, will not be used). Ideally, UnZipSFX should
+be built with only the required compression and encryption methods
+enabled, but the list of required compression and encryption methods is
+determined when an archive is created, while the list of available
+methods is determined when UnZipSFX is built. As always, when creating
+a self-extracting archive, the resulting program+archive bundle should
+be tested (on the target system). Options like "-q -t" should be
+helpful for this.
+
+ Normally, to minimize its size, UnZipSFX, the self-extracting archive
+program, is built with support for only the Deflate compression method,
+and the Traditional (weak) encryption method. To get an UnZipSFX with
+more capability, use the "make" macro LOCAL_UNZIP to specify the
+appropriate C macros (described below) when building UnZip. For
+example, to build the same full-featured UnZip as in the earlier
+example build command, but also enable support in UnZipSFX for AES
+encryption, and for LZMA and PPMd compression, use a command like the
+following:
+
+ make -f unix/Makefile CC=gcc \
+ LOCAL_UNZIP='-DCRYPT_AES_WG_SFX -DLZMA_SFX -DPPMD_SFX' \
+ generic
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Helping "make generic"
+ ----------------------
+
+ In some situations, the "unix/configure" script may not set all the
+build options as desired. One way to work around problems with "make
+generic" is to use a two-step procedure. First, instead of doing "make
+generic", do "make config_flags". For example:
+
+ make -f unix/Makefile [other-options ...] config_flags
+
+This should run the "unix/configure" script, which generates a "flags"
+(text) file in the main destination directory ("$(PROD)", default: ".").
+The file "flags" contains all the "make" macros which will be used in
+the second step. This file can be edited to make final adjustments to
+compile options, link options, and so on.
+
+ When "flags" has been changed as desired, the second step is to build
+using the "generic" target. For example:
+
+ make -f unix/Makefile [other-options ...] generic
+
+This should do the build using the changed "flags" file.
+
+ Of course, it's also possible to edit "unix/configure" and/or
+"unix/Makefile", but normally that's not required.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Non-"generic" Builds
+ --------------------
+
+ For systems where the "generic" target does not work, and a
+system-specific "make" file exists, use a "make" command which specifies
+the appropriate "make" program and "make" file. For example:
+
+ nmake -f os2\makefile.os2 gcc
+
+Or, if necessary, copy that system-specific "make" file into the main
+UnZip directory (renaming it, if necessary), and use a "make" command
+without the "-f DIR/Makefile" option (or without the "DIR/" part of the
+path to the "make" file). For example:
+
+ copy msdos\makefile.msc .
+ nmake -f makefile.msc
+
+ As with a "generic" build, it's also possible to edit a
+system-specific "make" file.
+
+ In some environments which have very limited command line lengths
+(like 128 characters for MS-DOS?), it may be necessary to add "#define"
+directives directly into the "unzip.h" header file (near the top),
+instead of specifying many options using the LOCAL_UNZIP "make" macro.
+
+ The Info-ZIP developers do not have access to all the system types
+for which support has been included (or suggested) in the various "make"
+files. so non-"generic" targets are less well tested, and may need
+considerable help from the user to get optimal results (or any success
+at all). Feedback from users of these system types would be gratefully
+received. To get a list of all possible system targets, use a command
+like:
+
+ make -f unix/Makefile list
+
+Then "make -f unix/Makefile <target>" for your chosen "<target>".
+
+ The "generic" target works for most systems, but if it fails with a
+message about "_ftime unresolved" or "timezone redefined", then try
+commands like the following:
+
+ make -f unix/Makefile clean
+ make -f unix/Makefile help
+and then:
+ make -f unix/Makefile generic2
+or:
+ make -f unix/Makefile generic3
+as instructed. The comments in unix/Makefile may offer some useful
+information for building on various target systems.
+
+ Use of "make" targets other than "generic" requires some care,
+because other targets typically do not use the unix/configure script (or
+its intermediate "flags" file), and this may cause programs to be built
+without some expected features enabled.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Build Suggestions for Various Non-"generic" Targets
+ ---------------------------------------------------
+
+Macintosh (Mac OS X)
+ On Mac OS X, use the Unix build procedure, described above. When
+using Xcode, the optional command-line tools must be installed. For
+pre-Mac-OS-X Macintosh, see below for old infomation.
+
+MS-DOS
+ See the msdos\Contents file for notes regarding which makefile(s) to
+ use with which compiler. In summary, pick one of msdos\makefile.*
+ as appropriate, or use the OS/2 gccdos target for emx+gcc. There is
+ also an mscdos cross-compilation target in os2\makefile.os2. There
+ may have been an sco_dos cross-compilation target in the Unix
+ makefile, but it seems to be gone now. For Watcom 16-bit or 32-bit
+ versions, see the comments in the OS/2 section below.
+
+ After choosing the appropriate makefile and editing as necessary or
+ desired, invoke the corresponding make utility. Microsoft's NMAKE
+ and the free dmake and GNU make utilities are generally the most
+ versatile. The makefiles in the msdos directory can be invoked in
+ place ("nmake -f msdos\makefile.msc", for example).
+
+MVS, z/OS
+ Unpack all the files and transfer them to an appropriate PDS with
+ ASCII -> EBCDIC conversion enabled, then edit UNZMVSC.JOB as required,
+ and execute it to compile and link all the sources. C/370 2.1 or
+ later is required. See README.MVS for further details. (This is a
+ new port and may need a little more work even to compile.) There has
+ been considerable work on the MVS and z/OS ports lately (indeed, z/OS
+ may be split off as its own port soon), so there should be updates to
+ these procedures shortly.
+
+VM/CMS
+ Unpack all the files and transfer them with ASCII -> EBCDIC
+ conversion to an appropriate directory/minidisk/whatever, then
+ execute UNZVMC to compile and link all the sources. This may require
+ C/370 version 2.1 or later and certain "nucleus extensions", although
+ UnZip 5.3 has been reported to compile fine with the "ADCYCLE C/370
+ v1.2 compiler". (See how current this information is?) Note that it
+ will abend without access to the C/370 runtime library. See the
+ README.CMS file for more details.
+
+Windows (XP, Vista, 7, and so on)
+ UnZip solution and project files for Microsoft Visual Studio 2010 are
+ supplied in the win32\vc10\ subdirectory. Optional features, such as
+ optional compression and encryption methods, are controlled by
+ Preprocessor Definitions (C macros). Some popular macros are
+ included but disabled by "x_" prefixes, which are easy to remove.
+ The solution file, unzip.sln, includes the "libbz2" project, which is
+ marked as a prerequisite for the "unzip" and "unzipsfx" projects. If
+ there is no bzip2 source kit in the bzip2\ directory, then the
+ "libbz2" project build will fail, but the "unzip" and "unzipsfx"
+ project builds should still work (so long as the BZIP2_SUPPORT macro
+ is not defined).
+
+ Symbolic link support (C macro SYMLINKS) requires Windows Vista or
+ newer.
+
+ Note that currently in the "unzipsfx" project, when enabling optional
+ compression or encryption methods, both the base feature macro and
+ the corresponding SFX-specific macro must be defined. For example,
+ to enable bzip2 compression in UnZipSFX, define both BZIP2_SUPPORT
+ and BZIP2_SFX. To enable AES_WG encryption, define both CRYPT_AES_WG
+ and CRYPT_AES_WG_SFX, and so on.
+
+ Similarly, UnZip DLL solution and project files for Microsoft Visual
+ Studio 2010 are supplied in the windll\vc10\ subdirectory. As with
+ UnZip itself, optional features are controlled by Preprocessor
+ Definitions (C macros). Also similarly, the solution file,
+ unzip32_dll.sln, includes the "libbz2" project as as a prerequisite
+ for the "unz32dll" and "uzexampl" projects, and if there is no bzip2
+ source kit in the bzip2\ directory, then the "libbz2" project build
+ will fail, but the other project builds should still work (so long as
+ the BZIP2_SUPPORT macro is not defined).
+
+ Currently, Microsoft Visual Studio 2010 (Visual C++ v10.0), VS 2012
+ (VC++ v11.0), and VS 2013 (VC++ 12.0) are the only tested versions.
+ Newer Visual Studio versions may work, but have not been tested.
+ Builder files for older Visual Studio versions have not been removed
+ from the kit, and may work in limited ways, but they have not been
+ updated to handle the latest optional features (optional compression
+ and encryption methods, and so on). The Unix-like Windows
+ environments, Cygwin and MinGW, use the Unix builders, not the Visual
+ Studio builders. Other, non-Microsoft compilers (like Borland or
+ Watcom) have not been tested. Obsolete information for older Visual
+ Studio versions and other compilers follows:
+
+ For creating Windows executables, the Microsoft Visual C++ compiler
+ platforms from version 2.x up to 8.0 (Visual Studio .Net C++ 2005)
+ should work. Recent build tests have been run on VC++ 6.0, 7.1 and
+ 8.0. The linker of newer Microsoft Visual C++ versions (beginning
+ with Visual C++ 2008 - [VC++ 9.0]) create executables that are marked
+ to run on Windows 2000 and newer, only. Although these Visual C++
+ environments may succeed in building Windows Info-ZIP executables,
+ they cannot (and must not) be used to create binaries for public
+ distribution, if support for older systems is intended.
+
+ Alternative compilers for the Intel platforms are OpenWatcom C++,
+ GNU C (Cygwin and MinGW32 have been tested, others, such as emx/rsxnt
+ may also work), Borland C++, or lcc-win32. DEC C/C++ for NT/Alpha
+ may or may not still work.
+
+ For the Watcom compiler, use WMAKE and win32\makefile.wat.
+
+ For the Microsoft compilers, use NMAKE and win32\Makefile.
+
+ For Cygwin or MinGW, use unix/Makefile and the "generic" target.
+ (An old win32\Makefile.gcc may still be included in the kit, but it
+ lacks support for many features, and may be of little value.)
+
+ With emx+gcc, a good choice is GNUMake 3.75 (or higher) from the
+ djgpp V2 distribution used on win32\Makefile.emx.
+
+ The unzip32.dll WinDLL executables can be built using the appropriate
+ Makefile in the win32\ subdirectory, or by using the Microsoft Visual
+ C++ project files supplied below the windll\ subdirectory. Besides
+ the MSC compilers, gcc-mingw32, Watcom C and Borland C allow to build
+ the Windows UnZip DLL. By default, the Makefiles for compilers that
+ use the Microsoft C runtime are configured to link against the shared
+ multithreading C runtime DLL. Depending on the intended usage for
+ unzip32.dll, a statically linked dll might be more suitable. The
+ "make" scripts for MSC support build variants with static linking; you
+ should look up the configuration switch DLLSTANDALONE in the MSC
+ Makefile or the "Static..." build configurations in the Visual Studio
+ project files.
+
+Windows CE
+ Only Microsoft Visual C++ 5.0, 6.0 or Visual C++ embedded 3.0 or later
+ are supported. Use the appropriate version of the included project
+ files and check wince\README for details.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Build Suggestions for Various Old/Obsolete Non-"generic" Targets
+ ----------------------------------------------------------------
+
+ Note: Much of the following information is old, obsolete, and
+probably useless, and is included for completeness only. These system
+types have not been tested with recent versions of Info-ZIP programs.
+Antique OS enthusiasts are always welcome to contribute changes to
+builders, code, or documentation for systems which the Info-ZIP team
+lacks.
+
+Acorn (RISC OS)
+ Extract the files from the archive and place in standard Acorn C
+ form (i.e., *.c, *.h and *.s become c.*, h.* and s.*, respectively),
+ either using the UNZIP$EXTS environment variable and a pre-built UnZip
+ binary, or using Spark[FS] and doing it manually. Then copy the
+ Acorn.Makefile to the main UnZip directory and either type "amu" or
+ use the desktop "make" utility.
+
+AmigaDOS
+ SAS/Lattice C and Manx Aztec C are supported. For SAS C 6.x do "smake
+ -f amiga/smakefile all"; for Aztec C do "make -f amiga/makefile.azt
+ all". The Aztec C version supports assembly-language versions of two
+ routines; these are enabled by default.
+
+Atari TOS
+ Turbo C is no longer supported; use gcc and the MiNT libraries, and
+ do "make". Note that all versions of gcc prior to 2.5.8 have a bug
+ affecting 68000-based machines (optimizer adds 68020 instructions).
+ See atari\README for comments on using other compilers.
+
+BeOS
+ make -f beos/Makefile
+
+Human68K
+ (This is a Japanese machine and OS.) It appears that GNU "make" and
+ gcc are required. Presumably, to build everything, just do:
+ gmake -f human68k/Makefile.gcc
+ This port has not been tested since the 5.12 release.
+
+Macintosh (Pre-Mac-OS-X)
+ On Mac OS X, use the Unix build procedure. The following information
+ for pre-Mac-OS-X Macintosh is old, obsolete, and probably useless,
+ and is included for completeness only.
+
+ Metrowerks CodeWarrior Pro 4 with Universal Interfaces 3.1 is the only
+ currently supported compiler, although the Mac Programmer's Workbench
+ (MPW) and Think C were supported at one time and still have some hooks.
+ Other Compilers may work too, no compiler specific instructions
+ (pragma, header, macros, ...) were used in the code.
+
+ For CodeWarrior Pro 4, un-BinHex the CodeWarrior project file and
+ UnZip resource file (using Stuffit Expander or BinHex 4.0 or later),
+ then open the project and click on the compile button. See
+ ":macos:Contents" for the possible project targets. Link order of
+ the standard libraries is very important: Link all sources first and
+ all standard libraries last.
+
+OS/2
+ GNU "make", "nmake", or "dmake" may be used with the OS/2 makefile.
+ All are freely available on the net. To get a list of supported
+ targets, use a command like the following:
+ nmake -f os2\makefile.os2
+ Comments at the top of the makefile explain the differences between
+ some of the same-compiler targets.
+
+TOPS-20
+ No longer fully supported due to new, unported features, although
+ patches are always welcome. Unpack all files into the current
+ directory only (including those in the kit's tops20 directory), then
+ use make.mic and "do make".
+
+------------------------------------------------------------------------
+
+ Test
+ ----
+
+ On Unix(-like) systems, after a successful build, an "unzip -v"
+report can be generated using the "make" target "dashv". For example:
+
+ make -f unix/Makefile dashv
+
+ A very basic set of tests can be run using the "make" target "test".
+For example:
+
+ make -f unix/Makefile test
+
+ If PPMd compression was enabled, some basic PPMd tests can be run
+using the "make" target "test_ppmd". For example:
+
+ make -f unix/Makefile test_ppmd
+
+See "Known PPMd Compression Problems", below, for an explanation of why
+running the PPMd test is important.
+
+ On VMS, see [.vms]INSTALL_VMS.txt.
+
+ On Windows, when the Unix builders are not used (Visual Studio
+builds, for example), a Windows command script is provided,
+"win32\test_unzip.cmd". Typical usage:
+
+ win32\test_unzip.cmd testmake.zip win32\vc10\Debug
+ win32\test_unzip.cmd testmake_ppmd.zip win32\vc10\Debug NOFUNSFX
+
+Note that some tests may fail if this script is not run from the
+top-level UnZip kit directory (where the paths shown above make sense).
+
+ These test sets are simple, not exhaustive. Before relying on UnZip,
+more realistic tests should be run in the user's own environment,
+ideally, working with the user's own data. This is especially true when
+using new features, such as new compression and encryption methods.
+
+------------------------------------------------------------------------
+
+ Install
+ -------
+
+ Installation details depend on the operating system, and some user
+preferences.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Installation Suggestions for Unix Systems
+ -----------------------------------------
+
+ On Unix(-like) systems, after a successful build (and, ideally,
+testing), a command like the following should install the programs and
+the "man" files into their default locations, "/usr/local/bin" and
+"/usr/local/man/man1", respectively:
+
+ make -f unix/Makefile install
+
+ The "make" macro PREFIX can be used to specify a destination
+directory tree different from the default, "/usr/local". For example,
+the following command should install the programs into "/usr/bin" and
+the "man" files into "/usr/man/man1":
+
+ make -f unix/Makefile PREFIX=/usr install
+
+ The "make" macro MANSUFX can be defined to add a "section" suffix to
+the installed "man" files. For example, the following command also
+installs into the "/usr" tree, but the "man" files will be installed as
+"XXX.1l" instead of the default "XXX.1":
+
+ make -f unix/Makefile PREFIX=/usr MANSUFX=l install
+
+ The "make" macros BINDIR and MANDIR can be used instead of PREFIX to
+direct the programs and "man" files to (non-standard) separate
+destinations. For example, the following command should install the
+programs into "/usr/exe" and the "man" files into "/usr/tools/man/man1":
+
+ make -f unix/Makefile BINDIR=/usr/exe MANDIR=/usr/tools/man \
+ install
+
+ The "make" targets "install_bin" and "install_man" can be used
+instead of "install" to install only the programs or only the "man"
+files, respectively.
+
+ The "make" target "install_gz" does what "install" does, and then
+uses gzip to compress the installed "man" files. Similarly,
+"install_man_gz" does what "install_man" does, and then uses gzip to
+compress the installed "man" files. These targets should be used only
+on systems where the "man" program supports gzip-compressed files.
+
+ The user who does the installation needs write permission in all the
+destination directories. Permissions should be set to 755 for the
+executables, and 644 for the "man" files. The "make" macros BINPERMS
+and MANPERMS can be used to specify other values.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Installation Suggestions for Non-Unix Systems
+ ---------------------------------------------
+
+Amiga, Atari, MS-DOS, OS/2, Windows
+ Move or copy unzip.exe (or unzip.ttp, or UnZip, or whatever) to the
+ desired destination directory. Add that directory to your path, if
+ necessary. Also possibly copy or link the UnZip executable to
+ zipinfo.exe (or ii.exe), or else create an alias or a batch/command
+ file for ZipInfo. For example, for MS-DOS:
+ @unzip -Z %1 %2 %3 %4 %5 %6 %7 %8 %9
+ Under djgpp 2.x, zipinfo.exe is a 2K stub symbolically linked to
+ unzip.exe.
Acorn RISC OS
- Copy the executables unzip, funzip and zipinfo to somewhere in your
- Run$Path. See your Welcome manual if you don't know about Run$Path.
+ Copy the executables (unzip, funzip, and zipinfo) to the desired
+ destination directory. Add that directory to your Run$Path, if
+ necessary. See your Welcome manual if you don't know about Run$Path.
BeOS
- The default prefix for the installation location is /boot/usr/local
- (things go into the bin and man/man1 subdirectories beneath the prefix),
- and the default man-page extension is "1" (corresponding to the man/man1,
- above). Of course, these Unix man-pages aren't useful until someone ports
- something that can format them... plain text versions are also installed
- with an extension of ".txt". To install, do a "make install", or to
- change the prefix, do "make prefix=/your/path install". For example, to
- install in /boot/bin, do "make prefix=/boot/bin install".
-
-Macintosh
- (This port is for Macintosh OS before Mac OS X. See Unix Apple below for
- Mac OS X and later.)
- MacZip requires at least System 7 and a Macintosh with a minimum of a
- Motorola 68020 or PowerPC 601 processor. Other configurations may work
- but it is not tested at all.
- The application (MacZip) is distributed as a combination of zip and unzip
- in one program. The offical release is a fat binary with both regular 68K
- and native PowerPC versions included.
- Move the executable(s) somewhere--for example, drag it (or them) to your
- Applications folder. For easy access, make an alias in the Launcher Control
- Panel or directly on your desktop.
- This port supports also Apple-event.So you can install it in your
- WWW-Browser as a helper-app.
- Look into "macos/README.TXT" (or ":macos:README.TXT" on Mac) for further
- info.
-
-Macintosh OS X (Unix Apple)
- Mac OS X and later are based on BSD Unix and are supported by the Unix
- port. See the Unix port for details. Though support is currently
- minimal, we plan to support additional Mac OS X features, such as resource
- forks, in future releases.
-
-Human68K, TOPS-20, AOS/VS, MVS, VM/CMS, etc.
- Dunno, sorry...
+ The default installation location is "/boot/usr/local". (Executables
+ and "man" files go into the "bin" and "man/man1" subdirectories
+ there, respectively. The corresponding plain-text (".txt") files in
+ the "docs/" directory may be more useful, however.
+
+Macintosh (Pre-Mac-OS-X)
+ MacZip requires at least System 7 and a Macintosh with a minimum of a
+ Motorola 68020 or PowerPC 601 processor. Other configurations may
+ work but have not tested at all.
+ The application (MacZip) is distributed as a combination of zip and
+ unzip in one program. The official release is a fat binary with both
+ regular 68K and native PowerPC versions included.
+ Move the executable(s) somewhere. For example, drag it (or them) to
+ your Applications folder. For easy access, make an alias in the
+ Launcher Control Panel or directly on your desktop.
+ This port supports also Apple-event, so you can install it in your
+ Web browser as a helper-app.
+ See "macos/README.TXT" (or ":macos:README.TXT" on Mac) for further
+ info.
+
+MVS, VM/CMS, z/OS
+ More information may be coming soon.
+
+VMS
+ See [.vms]INSTALL_VMS.txt.
+
+Human68K, TOPS-20, AOS/VS, etc.
+ More information is unlikely to be coming soon.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Post-Installation
+ -----------------
+
+ Many operating systems require a timezone variable to be set
+correctly (often "TZ"). Unix and VMS generally do so by default.
+Windows does, if set up properly. Other operating systems may not. See
+the discussion of the -f and -u options in the UnZip man page (or
+docs/unzip.txt).
+
+------------------------------------------------------------------------
+
+ C Macros to Control UnZip Behavior
+ ----------------------------------
+
+ Contents:
+
+ General C macros
+ System-Specific C macros
+ Unicode-related C macros
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ General C Macros
+ ----------------
+
+ACORN_FTYPE_NFS (needs support for long filenames with embedded commas)
+ Enable a -F option that instructs UnZip to interpret the filetype
+ information extracted from Acorn RiscOS extra field blocks. The
+ filetype IDs are translated into "NFS filetype extensions" and
+ appended to the names of the extracted files. This feature
+ facilitates maintenance of Unix-based NFS volumes that are exported
+ to Acorn RiscOS systems.
+
+BZIP2_SFX
+ Enable bzip2 compression support in UnZipSFX (if it's enabled in
+ UnZip). By default, to reduce the size of the UnZipSFX executable,
+ bzip2 compression support is disabled in UnZipSFX even when it's
+ enabled in UnZip itself.
+
+BZIP2_SUPPORT (requires additional external code distribution)
+ Enable support for bzip2 compression. UnZip can optionally support
+ the "bzip2" compression algorithm on most ports on 32-bit (or higher)
+ platforms. Currently, this support is integrated in the builders for
+ MSDOS 32-bit (DJGPP), Unix, VMS, and Windows.
+
+ Prerequisites:
+ You have to obtain the bzip2 source kit (version 1.03 or higher).
+ To have the UnZip builder build the bzip2 object library, extract
+ the source files into the "bzip2" subdirectory.
+
+ Compilation:
+ - MSDOS, Windows: You have to supply the macro definition
+ "USEBZ2=1" on the command line when you invoke the "make"
+ program.
+ - Unix: The target "generic" automatically enables bzip2 support
+ when its unix/configure script detects bzip2 sources in the
+ "bzip2" subdirectory. See the Unix section below for details on
+ how to specify the use of an existing bzip2 kit somewhere other
+ than in the local UnZip "bzip2" subdirectory. For non-"generic"
+ targets, there are two options:
+ a) Use a command like:
+ make -f unix/Makefile CFLAGS=-DBZIP2_SUPPORT \
+ LIB_BZ=BZIP2_DIR/libbz2.a YourTarget
+ (Replace YourTarget with the appropriate target name.)
+ b) Edit the Makefile to get the C macro BZIP2_SUPPORT defined
+ in the compiler commands ("-DBZIP2_SUPPORT"), and the "make"
+ macro LIB_BZ defined to locate the bzip2 object library
+ ("LIB_BZ=BZIP2_DIR/libbz2.a").
+ - VMS: The builders should automatically enable bzip2 support when
+ they detect the bzip2 files in the [.bzip2] subdirectory. The
+ user can also specify a different directory where the bzip2
+ source and object library can be found using the IZ_BZIP2
+ parameter/macro. See [.vms]INSTALL_VMS.txt for details.
+
+CHEAP_SFX_AUTORUN
+ Enable a simple "run command after extraction" feature in
+ (command-line) UnZipSFX. This feature is currently incompatible
+ with the "-d <extract_dir>" command line option, therefore
+ CHEAP_SFX_AUTORUN implicitly sets the NO_SFX_EXDIR option (below).
+
+COPYRIGHT_CLEAN (now default)
+USE_SMITH_CODE
+ The last chunk of code in UnZip that was blatantly derived from Sam
+ Smith's unzip 2.0 (as in, "substantially similar") is in unreduce.c.
+ Because the Reduce compression method was only used by very early
+ PKZIP beta versions (0.9x), support for it is now omitted by default
+ (COPYRIGHT_CLEAN). To include support for Reduce compression, define
+ the C macro USE_SMITH_CODE, and replace the stub unreduce.c source
+ module with the separately distributed full source code module. Note
+ that this subjects your UnZip to any and all restrictions in Smith's
+ copyright. See the UnZip COPYING.OLD file for details. The source
+ code module unreduce.c is supplied in:
+ ftp://ftp.info-zip.org/pub/infozip/src/unreduce_full.zip
+
+IZ_CRYPT_AES_WG (requires additional external code distribution)
+ Enable WinZip/Gladman AES (strong) encryption support. Currently,
+ this support is integrated in the Make procedures of MSDOS 32-bit
+ (DJGPP), VMS, Windows, and many Unix systems. A separately
+ distributed IZ_AES_WG source code kit is required.
+
+IZ_CRYPT_AES_WG_SFX
+ Enable WinZip/Gladman AES (strong) encryption support in UnZipSFX (if
+ it's enabled in UnZip). By default, to reduce the size of the
+ UnZipSFX executable, AES_WG support is disabled in UnZipSFX even when
+ it's enabled in UnZip itself.
+
+IZ_CRYPT_TRAD_SFX
+ Enable Traditional (weak) encryption support in UnZipSFX. The
+ default setting is to disable Traditional encryption in UnZipSFX, to
+ reduce its size. In UnZip, encryption support is enabled by default.
+ See also NO_CRYPT, below.
+
+DATE_FORMAT=DF_DMY or DF_MDY or DF_YMD
+ Specify the order in which date components are printed in
+ non-ZipInfo-mode listings: day-month-year, month-day-year, or
+ year-month-day. On DOS, FlexOS, OS2, Theos and Windows, the format
+ is automatically obtained from the operating system; most others
+ default to DF_MDY.
+
+DATE_SEPCHAR='-' or '.' or '/' etc.
+ Specify the character that separates the date components shown in
+ (non-ZipInfo-mode) listings. The Windows port obtains the separator
+ automatically from the operating system's locale settings. All
+ others default to '-'.
+
+DEBUG
+ Used for debugging purposes; enables Trace() statements. It's
+ generally best to compile only one or two modules this way.
+
+DEBUG_TIME
+ Used for debugging the timezone code in fileio.c; enables TTrace()
+ statements. This code is only used for the freshen/update options
+ (-f and -u), and non-Unix compilers often get it wrong.
+
+DEFLATE64_SUPPORT (default in UnZip and fUnZip)
+NO_DEFLATE64 (default in UnZipSFX)
+ The "Deflate64" compression algorithm from PKZIP 4.0 (or newer) is an
+ enhanced variant of the Deflate algorithm that achieves slightly
+ better compression ratios on highly redundant data. For better
+ compatibility with archives which use this method, UnZip should be
+ built with support for Deflate64 enabled. However, this results in
+ significantly larger memory requirements to run the program. For
+ 16-bit executables (DOS and OS/2), the special memory management to
+ support the 64K history buffer results in a slight speed penalty.
+ For UnZipSFX, "Deflate64" support should be unnecessary so long as
+ the Info-ZIP Zip utility does not support it. The NO_DEFLATE64
+ option disables Deflate64 support.
+
+DELETE_IF_FULL (any system with unlink() function)
+ If a write error is encountered (most likely due to a full disk),
+ enabling this option will cause the incomplete file to be deleted
+ instead of closed normally. This is particularly useful on Windows
+ CE, which must generally contend with extremely limited resources.
+
+LZMA_SFX
+ Enable LZMA compression support in UnZipSFX (if it's enabled in
+ UnZip). By default, to reduce the size of the UnZipSFX executable,
+ LZMA compression support is disabled in UnZipSFX even when it's
+ enabled in UnZip itself.
+
+LZMA_SUPPORT
+ Enable LZMA compression support in UnZip.
+
+LZW_CLEAN
+UNSHRINK_SUPPORT (now default, as of January 2005)
+ The "shrinking" algorithm from PKZIP 1.0 is an LZW variant. Unisys
+ patented the Lempel-Ziv-Welch algorithm in 1985 and has publicly
+ claimed that decompression is covered by it. (IBM also patented the
+ same thing in a filing 3 weeks prior to Unisys's.) In 2004, the
+ Unisys and IBM patents expired worldwide, so unshrinking is now
+ enabled again by default. If you do not wish to include the LZW
+ method, you may still disable it by defining LZW_CLEAN. (Unshrinking
+ 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_CRYPT
+ Disable all encryption support in all programs.
+
+NO_CRYPT_TRAD
+ Disable Traditional (weak) encryption support in all programs.
+
+NO_DEFLATE_SFX
+ Disable Deflate compression support in UnZipSFX. By default,
+ UnZipSFX supports the usual Deflate compression method, but Deflate
+ support can be disabled to reduce the size of the UnZipSFX
+ executable. (Currently, Deflate support is always enabled in UnZip
+ itself.)
+
+NO_SFX_EXDIR
+ Disable the "-d <extract_dir>" option in UnZipSFX. Since UnZip 5.5,
+ "-d" has been enabled by default, to facilitate use with automated
+ installation scripts and the like.
+
+NO_ZIPINFO
+ Disable ZipInfo mode (-Z). This makes a smaller UnZip executable,
+ because many text strings are left out. Automatically enabled in
+ some small-model builds under MS-DOS and OS/2, so ordinarily there is
+ no need to specify this explicitly. (Note that even with this
+ defined, the resulting executable may still be too big to extract
+ some zipfiles correctly, if built with the small memory model.)
+
+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.)
+
+OS2_EAS
+ List the sizes of OS/2 EAs and ACLs for each file as two extra
+ columns in "unzip -l" output. This is primarily useful on OS/2
+ systems, but, because zipfiles are portable, OS2_EAS can be defined
+ for any system. (May be extended someday to show sizes of Mac
+ resource forks, RISCOS and VMS file info, etc.)
+
+PPMD_SFX
+ Enable PPMd compression support in UnZipSFX (if it's enabled in
+ UnZip). By default, to reduce the size of the UnZipSFX executable,
+ PPMd compression support is disabled in UnZipSFX even when it's
+ enabled in UnZip itself.
+
+PPMD_SUPPORT
+ Enable PPMd compression support in UnZip.
+
+UNIXBACKUP (default on OS/2, Unix, Windows)
+ Enable a -B option that instructs UnZip to rename files that would
+ normally be overwritten. The renamed files are given a tilde suffix
+ and a unique sequence number ("~#####"). Note that previously renamed
+ files may be overwritten without notice, even if the -n option is given.
+ On target ports where UNIXBACKUP is enabled by default, the negated
+ option, NO_UNIXBACKUP, may be used to disable this feature.
+
+VMS_TEXT_CONV (default everywhere except VMS)
+NO_VMS_TEXT_CONV
+ VMS_TEXT_CONV enables conversion of some VMS-specific text file
+ formats, and is defined by default in UnZip (but not in UnZipSFX).
+ Defining NO_VMS_TEXT_CONV disables this capability.
+ VMS Stream_LF-format text files archived with the "-V" option (/VMS),
+ but NOT with -VV (/VMS=ALL), should be fine when extracted on other
+ systems. Stream_LF-files archived with -VV should be readable as well,
+ but they may get some junk appended. Text files with other record
+ formats (like the common variable-length format, with its embedded
+ byte counts) may be only semi-readable at best when extracted on other
+ systems. Defining VMS_TEXT_CONV enables UnZip's -aa option to detect
+ and convert VMS variable-length record format text files into the
+ native text format. UnZip on non-VMS systems uses a simple VMS extra
+ field analyzer to identify such text files. (Very old versions of
+ UnZip applied some heuristics instead.)
+
+WILD_STOP_AT_DIR (incompatible with WINDLL!)
+ Enables an additional option "-W". When "-W" is specified, the
+ pattern-matching routine is modified so that both "?" (single-char
+ wildcard) and "*" (multi-char wildcard) do not match the directory
+ separator character "/". Examples:
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo" but not "a/foo" or "a/b/foo"
+ To enable matching across directory separator chars, specify two
+ consecutive multi-char wildcards ("**"). This modified behavior is
+ like the pattern matching style used by the shells of some of UnZip's
+ supported target OSs (for example, Acorn RISC OS).
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ System-Specific C Macros
+ ------------------------
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ Multi-System
+ ------------
+
+ASM_CRC
+NO_ASM
+NO_ASM_CRC (Amiga/Aztec C; many x86 systems: DOS, OS/2, Windows, Unix)
+ Used by unix/configure ("make generic") and other builders to
+ control the use of assembly code for CRC calculations. We have not
+ recently done extensive testing to compare the speed of the x86
+ assembly code with the speed of the corresponding C code on modern
+ hardware using modern compilers. At least one test (VS 2010, Windows
+ XP(32), Xeon 5160) was about 5% faster with ASM_CRC. Reports are
+ welcome on this and any other performance-related tuning of build
+ procedures, and so on.
+
+ASM_INFLATECODES (Amiga/Aztec C only, for now)
+ Use an assembler version of inflate_codes() for speed.
+
+PASSWD_FROM_STDIN (Unix, VMS only)
+ Used to allow the password on encrypted files to be read from stdin
+ rather than the default stderr. This was useful for those who wished
+ to automate the testing or decoding of encrypted archives in a shell
+ script, for example, using a command like:
+ echo "password" | unzip -tq archive
+ As of version 5.3, UnZip has a -P option for passing a password
+ directly to the program, making PASSWD_FROM_STDIN unnecessary.
+ PASSWD_FROM_STDIN will therefore probably be removed in some future
+ version. Note that the same security warnings given in the
+ description of the -P option apply here as well.
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ MS-DOS
+ ------
+
+DOSWILD (MS-DOS only)
+ Treat trailing "*.*" like Unix "*" (i.e., matches anything); treat
+ trailing "*." as match for files without a dot (i.e., matches
+ anything, as long as no dots in name). Special treatment only occurs
+ if patterns are at end of arguments. That is, "a*.*" matches all
+ files starting with "a", but "*.*c" matches all files ending in "c"
+ only if they have a dot somewhere before the "c". (The default method
+ of specifying files without a dot would be "* -x *.*", making use of
+ UnZip's exclude-files option.) The matching is similar to that in
+ Unix, if you pretend that undotted filenames really have an invisible
+ dot at the end, which is how DOS and related systems treat filenames
+ in general. All other regular expressions (including "?" and
+ "[range_of_chars]") retain their Unix-like behavior.
+
+USE_DJGPP_ENV (MS-DOS DJGPP 2.0x only)
+ Regular DJGPP v2.0x built programs which use ENVIRONMENT are able to
+ read from the file "djgpp.env" as well as those set in the
+ environment. This adds about 1KB to the size of the executable.
+ This option is disabled by default in Info-ZIP source. If you are
+ able to use "djgpp.env" and don't like to clutter the environment
+ with many special purpose variables, you may want to build with this
+ option set.
+
+USE_DJGPP_GLOB (MS-DOS DJGPP 2.0x only)
+ Enable Unix-shell-like expansion of command-line wildcards (built-in
+ "globbing"). This option enables the globbing built into the DJGPP
+ startup code. When using an executable built with this option, you
+ normally need to quote wildcard arguments ("*"), to get them passed
+ to the program unmodified. Enabling this option is not recommended,
+ because it results in Info-Zip binaries that do not behave as users
+ might expect for an MS-DOS program.
+
+USE_VFAT (MS-DOS only, for using same executable under DOS and Windows)
+ djgpp 2.x and emx/gcc+RSX 5.1 can detect when they are running under
+ a Windows DOS box and will accordingly enable long-filename support.
+ For now, only djgpp 2.x and emx/gcc with RSX 5.1 or later have this
+ feature (and it is defined by default in msdos/makefile.dj2 and
+ makefile.emx), but if/when other compilers build in similar support,
+ define this macro to enable its use. See also msdos/doscfg.h. (Note
+ that djgpp 2.0's LFN support is flaky; users should upgrade to 2.01
+ or later.)
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ QDOS
+ ----
+
+QLZIP (Unix only)
+ Add some support for QDOS extra fields. This option enables Unix
+ UnZip to append "datalen info" to QDOS exec type files in the same
+ format as used by QDOS cross-compilers on Unix or the qltools v2.2(+).
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ VMS
+ ---
+
+CHECK_VERSIONS (VMS only)
+ Obsolete. Enable a warning when the VMS version of the system where
+ UnZip is being used differs from the VMS version where an archive was
+ created. Long ago, some Info-ZIP developers were concerned that the
+ format of the VMS (RMS) file-attribute data (stored in Zip "extra
+ fields") might differ between different versions of VMS. This has
+ not been a problem, so this warning has long been disabled by
+ default.
+
+RETURN_CODES (VMS only)
+ Obsolete. Enable a final status (success/error) message which is
+ sent to the user's terminal when UnZip exits. UnZip's internal
+ Unix-style exit status codes are normally converted to VMS-style
+ status codes in a DCL environment, so enabling this exit message
+ would probably be more confusing than helpful.
+
+VMSCLI (VMS only)
+ For internal use only. Use VMS-style "slash options" (/FOOBAR)
+ instead of the default Unix-style hyphen options (-f, --foobar).
+ Automatic options stored in DCL symbols or logical names (UNZIP_OPTS
+ or ZIPINFO_OPTS) must always be in the Unix style. Beginning with
+ UnZip 5.32, the VMS builders generate both VMS-style (*_CLI.EXE) and
+ Unix-style executables, so a user normally does NOT need to specify
+ VMSCLI.
+
+VMSWILD (VMS only)
+ Use parentheses rather than brackets to delimit sets (ranges), and
+ use "%" instead of "?" as the single-character wildcard for internal
+ filename matching. (External matching of zipfile names always uses
+ the standard VMS wildcard facilities; character sets are disallowed.)
+
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+ Windows
+ -------
+
+NO_W32TIMES_IZFIX (Windows, including WinDLL, and Windows CE)
+ Disable Info-ZIP's special timestamp adjustment to get stable time
+ stamps on NTFS disks that do not change depending on the current time
+ being normal vs. daylight saving time. When this option is set,
+ UnZip behaves like other programs; file timestamps on NTFS partitions
+ are created so that their current local time representation displayed
+ by directory listings (cmd.exe "dir" command or Windows Explorer
+ listings) is the same as shown by UnZip's listing. But the actual UTC
+ timestamp values stored in the NTFS file attributes vary depending on
+ whether extraction is done at summer or winter time.
+ This option is not recommended because it sacrifices the timestamp
+ comparison checks when extracting or modifying archives in "update
+ only newer" mode. However, for environments where consistency of
+ displayed dates of files extracted to NTFS vs. FAT disks is
+ considered more important than correctly working update/freshen tasks
+ of Zip and UnZip, this option may be used. PLEASE DO NOT PUBLISH
+ executables that were built with this option!
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Unicode-Related C Macros
+ ------------------------
+
+UNICODE_SUPPORT
+ Enable restoring from UTF-8 encoded paths. These paths are stored
+ either in extra fields or directly in the path fields if a new UTF-8
+ bit is set in the flag word. If the extra field is used, the UTF-8
+ is stored in a backward-compatible way so that archives with UTF-8
+ paths still work on zips and unzips that don't support Unicode. If
+ the UTF-8 bit is used the UTF-8 is directly stored in the main path
+ field, so an unzip with Unicode support (such as UnZip 6.0 or later)
+ is needed to correctly interpret the UTF-8. This support follows the
+ recent additions to the PKWARE APPNOTE for Unicode support, except
+ that Unicode comments on systems where UTF-8 is not the current
+ character set is not implemented in this release.
+
+ Internally, Unicode support can be achieved by three methods:
+ a) The charset encoding used by the system is already UTF-8, so
+ the program just has to select the UTF-8 versions of the stored
+ filenames for file name handling. (Such as most current Unix.)
+ This method is enabled by defining the C macro UTF8_MAYBE_NATIVE;
+ this activates code to check for native UTF-8 encoding in the
+ locale settings.
+ b) The operating system and the compilation environment support
+ "wide character" data in Unicode encoding (UCS-2/UTF-16 or UCS-4),
+ which are used to translate between UTF-8 and the native
+ extended-ASCII character encoding. The code for this method is
+ activated by setting the C macro UNICODE_WCHAR. It may be enabled
+ together with UTF8_MAYBE_NATIVE to provide more versatile Unicode
+ support and additional "debugging" options for checking the
+ correct recognition of non-ASCII Unicode characters.
+ c) The operating system and the compilation environment allow use of
+ Unicode-encoded "wide character" data for native text strings
+ support. Complete support for this method requires a thorough
+ revision of the UnZip code to convert the MBCS 8-bit string calls
+ used now to the equivalent wide character calls. All internal
+ string handling and text output needs to be ported to use wchar_t
+ character storage, which for the most part requires just proper
+ type updating. This capability could be included in UnZip 6.10.
+
+ Beginning with version 6.10b (beta), UnZip includes full wide
+ character support of UTF-8 paths on Windows NT and later. On these
+ systems, the UTF-8 is converted to wide character paths and those
+ paths used to recreate the Unicode paths on the file system. Still
+ not implemented on Windows are language-dependent messages,
+ wide-character console input and output, and wide character list
+ support. These may be implemented in UnZip 6.10.
+
+ On current GNU/Linux and similar systems, UnZip now supports UTF-8
+ names and patterns on the command line as well as display of UTF-8
+ listings on the console.
+
+ On some ports UNICODE_SUPPORT is set automatically:
+ - Windows (and WinCE) use method b) by defining UNICODE_SUPPORT and
+ UNICODE_WCHAR. On Windows NT and later, paths are now created
+ using wide character strings as in method c), but console input and
+ output still use method b). These are now the defaults.
+ - On Unix, the automatic configuration script enables UNICODE_WCHAR
+ if ISO-10646 compatible wide characters are supported and
+ UTF8_MAYBE_NATIVE if the locale detection call is available. For
+ these ports, setting NO_UNICODE_SUPPORT forces deactivation of the
+ Unicode support.
+
+HAVE_WORKING_ISPRINT
+NO_WORKING_ISPRINT
+ HAVE_WORKING_ISPRINT enables enhanced filtering of non-printable
+ characters in filenames by the fnfilter() function. On some systems
+ (Unix, VMS, some Windows compilers), this setting is enabled by
+ default. In cases where isprint() flags printable extended characters
+ as unprintable, defining NO_WORKING_ISPRINT disables the enhanced
+ filtering capability in fnfilter(). (The ASCII control codes 0x01 to
+ 0x1f are always escaped on ASCII systems.) If UNICODE_SUPPORT is
+ enabled, the isprint() check is now done using wide characters for
+ MBCS compatibility.
+
+NO_SETLOCALE (for Unix)
+ On Unix, it is now assumed that <locale.h> and the setlocale function
+ are available, to set up locale-aware filtering of displayed
+ filenames. The option NO_SETLOCALE disables the dependency on
+ <locale.h> and setlocale() on systems where this assumption is
+ invalid (and the auto-configuring "make" target "generic" cannot be
+ used for automatic capability detection).
+
+_MBCS
+NO_MBCS
+ Enable multi-byte character set support. This is the default for the
+ Human68k system (originated from Japan) and for Windows (here only
+ DBCS "double-byte character set" support). MBCS support should also
+ be enabled on systems which are capable of using UTF-8 as the native
+ charset. For MBCS support, the C runtime library must supply
+ implementations for the mblen() function and the MB_CUR_MAX runtime
+ macro/function. NO_MBCS explicitly disables MBCS support for testing
+ purposes, or when MBCS support does not work as expected.
+
+------------------------------------------------------------------------
+
+ Known PPMd Compression Problems
+ ===============================
+
+ Run-time problems have been observed with PPMd compression in UnZip
+and Zip programs built using GCC on AIX/PowerPC and HP-UX/PA-RISC
+systems (but not on HP-UX/IA64 systems). On AIX systems, the programs
+may hang/loop. In HP-UX systems, the programs may fail/abort. Zip may
+produce corrupt archives. The "make test_ppmd" procedure described
+above should reveal the problem, if it exists in UnZip. The Zip
+builders lack a similar PPMd test capability, but it's very likely that
+Zip will have PPMd problems in any environment where UnZip has PPMd
+problems.
+
+ One work-around for this problem is to re-compile the sensitive PPMd
+module using a lower level of optimization than the usual, and then
+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.
+ 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.
+
+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
+ 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.
+
+ We would be grateful to receive reports describing environments where
+this problem occurs.
+
+------------------------------------------------------------------------
-This is the README file for the 20 April 2009 public release of the
-Info-ZIP group's portable UnZip zipfile-extraction program (and related
-utilities).
-
-unzip60.zip portable UnZip, version 6.0, source code distribution
-unzip60.tar.Z same as above, but compress'd tar format
-unzip60.tar.gz same as above, but gzip'd tar format
-
-__________________________________________________________________________
-
-BEFORE YOU ASK: UnZip, its companion utility Zip, and related utilities
-and support files can be found in many places; read the file "WHERE" for
-further details. To contact the authors with suggestions, bug reports,
-or fixes, continue reading this file (README) and, if this is part of a
-source distribution, the file "ZipPorts" in the proginfo directory. Also
-in source distributions: read "BUGS" for a list of known bugs, non-bugs
-and possible future bugs; INSTALL for instructions on how to build UnZip;
-and "Contents" for a commented listing of all the distributed files.
-__________________________________________________________________________
-
-
-GENERAL INFO
-------------
-UnZip is an extraction utility for archives compressed in .zip format (also
-called "zipfiles"). Although highly compatible both with PKWARE's PKZIP
-and PKUNZIP utilities for MS-DOS and with Info-ZIP's own Zip program, our
-primary objectives have been portability and non-MSDOS functionality.
-
-This version of UnZip has been ported to a stupendous array of hardware--
-from micros to supercomputers--and operating systems: Unix (many flavors),
-VMS, OS/2 (including DLL version), Windows NT and Windows 95 (including DLL
-version), Windows CE (GUI version), Windows 3.x (including DLL version),
-MS-DOS, AmigaDOS, Atari TOS, Acorn RISC OS, BeOS, Macintosh (GUI version),
-SMS/QDOS, MVS, VM/CMS, FlexOS, Tandem NSK, Human68k (mostly), AOS/VS (partly)
-and TOPS-20 (partly). UnZip features not found in PKUNZIP include source
-code; default extraction of directory trees (with a switch to defeat this,
-rather than the reverse); system-specific extended file attributes; and, of
-course, the ability to run under most of your favorite operating systems.
-Plus, it's free. :-)
-
-For source distributions, see the main Contents file for a list of what's
-included, and read INSTALL for instructions on compiling (including OS-
-specific comments). The individual operating systems' Contents files (for
-example, vms/Contents) may list important compilation info in addition to
-explaining what files are what, so be sure to read them. Some of the ports
-have their own, special README files, so be sure to look for those, too.
-
-See unzip.1 or unzip.txt for usage (or the corresponding UnZipSFX, ZipInfo,
-fUnZip and ZipGrep docs). For VMS, unzip_def.rnh or unzip_cli.help may be
-compiled into unzip.hlp and installed as a normal VMS help entry; see
-vms/descrip.mms.
-
-
-CHANGES AND NEW FEATURES
-------------------------
-UnZip 6.0 finally supports nowadays "large" files of sizes > 2 GiB!
-This is the first release containing support for the PKWARE Zip64
-enhancements.
-Major changes are:
- - Support PKWARE ZIP64 extensions, allowing Zip archives and Zip archive
- entries larger than 4 GiBytes and more than 65536 entries within a single
- Zip archive. This support is currently only available for Unix,
- OpenVMS and Win32/Win64.
- - Support for bzip2 compression method.
- - Support for UTF-8 encoded entry names, both through PKWARE's "General
- Purpose Flags Bit 11" indicator and Info-ZIP's new "up" unicode path
- extra field. (Currently, on Windows the UTF-8 handling is limited to
- the character subset contained in the configured non-unicode "system
- code page".)
- - Added "wrong implementation used" warning to error messages of the MSDOS
- port when used under Win32, in an attempt to reduce false bug reports.
- - Fixed "Time of Creation/Time of Use" vulnerability when setting attributes
- of extracted files, for Unix and Unix-like ports.
- - Fixed memory leak when processing invalid deflated data.
- - Fixed long-standing bug in unshrink (partial_clear), added boundary checks
- against invalid compressed data.
- - On Unix, keep inherited SGID attribute bit for extracted directories
- unless restoration of owner/group id or SUID/SGID/Tacky attributes was
- requested.
- - On Unix, allow extracted filenames to contain embedded control characters
- when explicitly requested by specifying the new command line option "-^".
- - On Unix, support restoration of symbolic link attributes.
- - On Unix, support restoration of 32-bit UID/GID data using the new "ux"
- IZUNIX3 extra field introduced with Zip 3.0.
- - Support for ODS5 extended filename syntax on new OpenVMS systems.
- - Support symbolic links zipped up on VMS.
- - On VMS (only 8.x or better), support symbolic link creation.
- - On VMS, support option to create converted text files in Stream_LF format.
- - New -D option to suppress restoration of timestamps for extracted
- directory entries (on those ports that support setting of directory
- timestamps). By specifying "-DD", this new option also allows to suppress
- timestamp restoration for ALL extracted files on all UnZip ports which
- support restoration of timestamps.
- On VMS, the default behaviour is now to skip restoration of directory
- timestamps; here, "--D" restores ALL timestamps, "-D" restores none.
- - On OS/2, Win32, and Unix, the (previously optional) feature UNIXBACKUP
- to allow saving backup copies of overwritten files on extraction is now
- enabled by default.
-
-For the UnZip 6.0 release, we want to give special credit to Myles Bennet,
-who started the job of supporting ZIP64 extensions and Large-File (> 2GiB)
-and provided a first (alpha-state) port.
-
-The 5.52 maintenance release fixes a few minor problems found in the 5.51
-release, closes some more security holes, adds a new AtheOS port, and
-contains a Win32 extra-field code cleanup that was not finished earlier.
-The most important changes are:
-
- - (re)enabled unshrinking support by default, the LZW patents have expired
- - fixed an extraction size bug for encrypted stored entries (12 excess bytes
- were written with 5.51)
- - fixed false "uncompressed size mismatch" messages when extracting
- encrypted archive entries
- - do not restore SUID/SGID/Tacky attribute bits on Unix (BeOS, AtheOS)
- unless explicitely requested by new "-K" command line qualifier
- - optional support for "-W" qualifier to modify the pattern matching syntax
- (with -W: "*" stops at directory delimiter, "**" matches unlimited)
- - prevent buffer overflow caused by bogus extra-long Zipfile specification
- - performance enhancements for VMS port
- - fixed windll interface handling of its extraction mode qualifiers
- nfflag, ExtractOnlyNewer, noflag, PromptToOverwrite; added detailed
- explanation of their meanings and interactions to the windll documentation
-
-The 5.51 maintenance release adds a command-line CE port, intended for
-batch processing. With the integration of this port, the pUnZip port
-has been revised and "revitalized".
-The most important changes for the general public are a number of
-bug fixes, mostly related to security issues:
-
- - repair a serious bug in the textmode output conversion code for the 16-bit
- ports (16-bit MSDOS, OS/2 1.x, some variants of AMIGA, possibly others)
- which was introduced by the Deflate64 support of release 5.5
- - fix a long standing bug in the the inflate decompression method that
- prevented correct extraction in some rare cases
- - fixed holes in parent dir traversal security code (e.g.: ".^C." slipped
- through the previous version of the check code)
- - fixed security hole: check naming consistency in local and central header
- - fixed security hole: prevent extracted symlinks from redirecting file
- extraction paths
-
-The main addition in the 5.5 release is support for PKWARE's new Deflate64(tm)
-algorithm, which appeared first in PKZIP 4.0 (published November 2000).
-As usual, some other bugfixes and clean-ups have been integrated:
-
- - support for Deflate64 (Zip compression method #9)
- - support for extracting VMS variable length record text files on
- any system
- - optional "cheap autorun" feature for the SFX stub
- - security fixes:
- * strip leading slash from stored pathspecs,
- * remove "../" parent dir path components from extracted file names
- - new option "-:" to allow verbatim extraction of file names containing
- "../" parent dir path specs
- - fixed file handle leak for the DLL code
- - repaired OS2 & WinNT ACL extraction which was broken in 5.42
-
-The 5.42 maintenance release fixes more bugs and cleans up the redistribution
-conditions:
-
- - removal of unreduce.c and amiga/timelib.c code to get rid of the last
- distribution restrictions beyond the BSD-like Info-ZIP LICENSE
- - new generic timelib replacement (currently used by AMIGA port)
- - more reasonable mapping rules of UNIX "leading-dot" filenames to the
- DOS 8.3 name convention
- - repaired screensize detection in MORE paging code
- (was broken for DOS/OS2/WIN32 in 5.41)
-
-The 5.41 maintenance release adds another new port and fixes some bugs.
-
- - new BSD-like LICENSE
- - new Novell Netware NLM port
- - supports extraction of archives with more than 64k entries
- - attribute handling of VMS port was broken in UnZip 5.4
- - decryption support integrated in the main source distribution
-
-The 5.4 release adds new ports, again. Other important items are changes
-to the listing format, new supplemental features and several bug fixes
-(especially concerning time-stamp handling...):
-
- - new IBM OS/390 port, a UNIX derivate (POSIX with EBCDIC charset)
- - complete revision of the MacOS port
- - changed listing formats to enlarge the file size fields for more digits
- - added capability to restore directory attributes on MSDOS, OS/2, WIN32
- - enabled support of symbolic links on BeOS
- - Unix: optional Acorn filetype support, useful for volumes exported via NFS
- - several changes/additions to the DLL API
- - GUI SFX stub for Win16 (Windows 3.1) and Win32 (Windows 9x, Windows NT)
- - new free GCC compiler environments supported on WIN32
- - many time-zone handling bug fixes for WIN32, AMIGA, ...
-
-The 5.32 release adds two new ports and a fix for at least one relatively
-serious bug:
-
- - new FlexOS port
- - new Tandem NSK port
- - new Visual BASIC support (compatibility with the Windows DLLs)
- - new -T option (set zipfile timestamp) for virtually all ports
- - fix for timestamps beyond 2038 (e.g., 2097; crashed under DOS/Win95/NT)
- - fix for undetected "dangling" symbolic links (i.e., no pointee)
- - fix for VMS indexed-file extraction problem (stored with Zip 2.0 or 2.1)
- - further performance optimizations
-
-The 5.31 release included nothing but small bug-fixes and typo corrections,
-with the exception of some minor performance tweaks.
-
-The 5.3 release added still more ports and more cross-platform portability
-features:
-
- - new BeOS port
- - new SMS/QDOS port
- - new Windows CE graphical port
- - VM/CMS port fully updated and tested
- - MVS port fully updated and tested
- - updated Windows DLL port, with WiZ GUI spun off to a separate package
- - full Universal Time (UTC or GMT) support for trans-timezone consistency
- - cross-platform support for 8-bit characters (ISO Latin-1, OEM code pages)
- - support for NT security descriptors (ACLs)
- - support for overwriting OS/2 directory EAs if -o option given
- - updated Solaris/SVR4 package facility
-
-What is (still!) not added is multi-part archive support (a.k.a. "diskette
-spanning", though we really mean archive splitting and not the old diskette
-spanning) and a unified and more powerful DLL interface. These are the two
-highest priorities for the 6.x releases. Work on the former is almost
-certain to have commenced by the time you read this. This time we mean it!
-You betcha. :-)
-
-Although the DLLs are still basically a mess, the Windows DLLs (16- and 32-
-bit) now have some documentation and a small example application. Note that
-they should now be compatible with C/C++, Visual BASIC and Delphi. Weirder
-languages (FoxBase, etc.) are probably Right Out.
-
-
-INTERNET RESOURCES
-------------------
-
-Info-ZIP's web site is at http://www.info-zip.org/pub/infozip/
-and contains the most up-to-date information about coming releases,
-links to binaries, and common problems.
-(See http://www.info-zip.org/pub/infozip/FAQ.html for the latter.)
-Files may also be retrieved via ftp://ftp.info-zip.org/pub/infozip/ .
-Thanks to LEO (Munich, Germany) for previously hosting our primary site.
-
-
-DISTRIBUTION
-------------
-If you have a question regarding redistribution of Info-ZIP software, either
-as is, as packaging for a commercial product, or as an integral part of a
-commercial product, please read the Frequently Asked Questions (FAQ) section
-of the included COPYING file. All Info-ZIP releases are now covered by
-the Info-ZIP license. See the file LICENSE. The most current license
-should be available at http://www.info-zip.org/license.html and
-ftp://ftp.info-zip.org/pub/infozip/license.html.
-
-Insofar as C compilers are rare on some platforms and the authors only have
-direct access to a subset of the supported systems, others may wish to pro-
-vide ready-to-run executables for new systems. In general there is no prob-
-lem with this; we require only that such distributions include this README
-file, the WHERE file, the LICENSE file (contains copyright/redistribution
-information), and the appropriate documentation files (unzip.txt and/or
-unzip.1 for UnZip, etc.). If the local system provides a way to make self-
-extracting archives in which both the executables and text files can be
-stored together, that's best (in particular, use UnZipSFX if at all possible,
-even if it's a few kilobytes bigger than the alternatives); otherwise we
-suggest a bare UnZip executable and a separate zipfile containing the re-
-maining text and binary files. If another archiving method is in common
-use on the target system (for example, Zoo or LHa), that may also be used.
-
-
-BUGS AND NEW PORTS: CONTACTING INFO-ZIP
-----------------------------------------
-All bug reports and patches (context diffs only, please!) should be
-submitted either through the new Info-ZIP Discussion Forum at
-http://www.info-zip.org/board/board.pl or through the Info-ZIP SourceForge
-site at http://sourceforge.net/projects/infozip/. The forum allows file
-attachments while SourceForge provides a place to post patches. The old
-Zip-Bugs@lists.wku.edu e-mail address for the Info-ZIP authors was
-discontinued after heavy continuous spam, as was the QuickTopic discussion
-forum. The above methods are public, but we also can be reached directly
-using the web reply page at http://www.info-zip.org/zip-bug.html. If you
-need to send us files privately, contact us first for instructions.
-
-"Dumb questions" that aren't adequately answered in the documentation
-should also be directed to Zip-Bugs rather than to a global forum such
-as Usenet. (Kindly make certain that your question *isn't* answered by
-the documentation, however--a great deal of effort has gone into making
-it clear and complete.)
-
-Suggestions for new features can be discussed on the new Discussion Forum.
-A new mailing list for Info-ZIP beta testers and interested parties may
-be created someday, but for now any issues found in the betas should use
-the forum. We make no promises to act on all suggestions or even all
-patches, but if it is something that is manifestly useful, sending the
-required patches to Zip-Bugs directly (as per the instructions in the
-ZipPorts file) is likely to produce a quicker response than asking us to
-do it--the authors are always ridiculously short on time. (Please do
-NOT send patches or encoded zipfiles to the Info-ZIP list. Please DO
-read the ZipPorts file before sending any large patch. It would be
-difficult to over-emphasize this point...)
-
-If you are considering a port, not only should you read the ZipPorts file,
-but also please check in with Zip-Bugs BEFORE getting started, since the
-code is constantly being updated behind the scenes. (For example, VxWorks,
-VMOS and Netware ports were once claimed to be under construction, although
-we have yet to see any up-to-date patches.) We will arrange to send you the
-latest sources. The alternative is the possibility that your hard work will
-be tucked away in a subdirectory and mostly ignored, or completely ignored
-if someone else has already done the port (and you'd be surprised how often
-this has happened).
-
-
-BETA TESTING: JOINING INFO-ZIP
--------------------------------
-If you'd like to keep up to date with our UnZip (and companion Zip utility)
-development, join the ranks of beta testers, add your own thoughts and
-contributions, or simply lurk, you may join one of our mailing lists.
-There is an announcements-only list (Info-ZIP-announce) and a general
-discussion/testing list (Info-ZIP). You must be a subscriber to post, and
-you can subscribe via the links on our Frequently Asked Questions page:
-
- http://www.info-zip.org/pub/infozip/FAQ.html#lists
-
-(Please note that as of late May 2004, the lists are unavailable pending
-a move to a new site; we hope to have them restored shortly. In the
-interim ...) Feel free to use our bug-reporting web page for bug reports
-and to ask questions not answered on the FAQ page above:
-
- http://www.info-zip.org/zip-bug.html
-
-For now the best option is to monitor and contribute to the various threads
-on the new discussion forum site at:
-
- http://www.info-zip.org/board/board.pl
-
-The second best way to contribute is through the various features at
-SourceForge, such as the bug posting areas.
-
-There is also a closed mailing list for internal discussions of our core
-development team. This list is now kept secret to prevent us from being
-flooded with spam messages.
-
-
--- Greg Roelofs (sometimes known as Cave Newt), principal UnZip developer
- guy, with inspiration from David Kirschbaum, was Author of this text.
-
--- Christian Spieler (shorthand: SPC), current UnZip maintenance coordinator,
- applied the most recent changes, with Ed Gordon providing a few additions.
+ README -- Info-ZIP UnZip
+ ------------------------
+
+ Program version: 6.10c (BETA)
+ Document date: 2014-02-29
+
+------------------------------------------------------------------------
+
+ Introduction
+ ------------
+
+ Info-ZIP UnZip and Zip are free, portable, compressor-archiver
+utility programs, which are intended to be compatible with PKZIP by
+PKWARE, Inc. PKWARE and PKZIP are registered trademarks of PKWARE, Inc.
+The .ZIP archive format is widely used, by these and other programs.
+
+ This document describes UnZip, the extraction program. (Zip is
+described in its own README file.)
+
+ The UnZip kit includes the following programs:
+
+UnZip The normal UnZip program.
+
+UnZipSFX The UnZip self-extraction (SFX) program. (On most
+ systems, append a ZIP archive to it to make a
+ self-extracting archive bundle.)
+
+ZipInfo A mode of UnZip operation ("unzip -Z"), rather than a
+ separate program, but it may be installed as an alias or
+ link to the real UnZip program.
+
+ Particular operating systems may have additional programs or variants
+of these basic programs. For example:
+
+fUnZip [Unix] Filter UnZip, a limited-capability extraction program,
+ intended for use in a pipeline.
+
+ZipGrep [Unix] A Bourne shell script which uses UnZip and egrep to
+ search for patterns in Zip archive members.
+
+VMS includes VMS-style CLI variants of UnZip, UnZipSFX, and ZipInfo.
+
+------------------------------------------------------------------------
+
+ Information Sources
+ -------------------
+
+Main Info-ZIP Web site: http://info-zip.org/
+ UnZip page: http://info-zip.org/UnZip.html
+ Info-ZIP forums: http://info-zip.org/phpBB3/index.php
+FTP access: ftp://ftp.info-zip.org/pub/infozip/
+
+Info-ZIP at SourceForge: https://sourceforge.net/projects/infozip/
+Info-ZIP forums at SourceForge:
+ https://sourceforge.net/tracker/?group_id=118012
+
+ Info-ZIP programs are widely used and distributed (and often modified
+and redistributed). The sources listed above provide the original
+source code, and pre-built binaries for some system types. For the
+software license (and disclaimers) see:
+
+ http://info-zip.org/license.html [HTML]
+ http://info-zip.org/license.txt [plain text]
+ ftp://ftp.info-zip.org/pub/infozip/license.html [HTML]
+ ftp://ftp.info-zip.org/pub/infozip/doc/license [plain text]
+
+ Source kits include this README file, and various other files,
+including BUGS, COPYING, INSTALL, LICENSE, and ToDo. Changes are noted
+in "History.610". (For changes in older versions, see other "History.*"
+files.) Many OS-specific subdirectories include "INSTALL*" and/or
+"README*" supplements. A "proginfo" subdirectory contains some
+additional (mostly old) documentation of particular interest to
+developers.
+
+ For program usage information, source kits include a "docs"
+subdirectory wich contains ".txt" files with formatted Unix "man"
+output, and may also include ".htx" files with VMS help output.
+
+------------------------------------------------------------------------
+
+ Description
+ -----------
+
+ UnZip is an extraction utility for archives in .ZIP format, in which
+member files usually are compressed, and may be encrypted. Although
+highly compatible both with PKWARE's PKZIP program and with Info-ZIP's
+own Zip program, the primary objectives for UnZip have been portability
+and non-MS-DOS functionality.
+
+ Info-ZIP programs are developed primarily on Unix (and Unix-like,
+including GNU/Linux and Mac OS X), VMS, and Windows systems. Support
+for other, older or less popular operating environments depends on help
+from contributors outside the main Info-ZIP group, who have access to
+these systems. Similarly, we don't have every available compiler on
+every system type. We describe our programs as "portable", and welcome
+complaints and suggestions involving their use on almost anything.
+UnZip has been ported to operating systems like AmigaDOS, AOS/VS, Atari
+TOS, Acorn RISC OS, BeOS, FlexOS, Human68k, IBM mainframes (MVS, VM/CMS,
+z/OS), Macintosh (pre-OS-X), MS-DOS, OS/2, SMS/QDOS, Tandem NSK, and
+TOPS-20. A DLL is available for OS/2 and Windows.
+
+------------------------------------------------------------------------
+
+ Significant New Features and Behavior Changes Since UnZip 6.00
+ --------------------------------------------------------------
+
+- Optional support for WinZip-compatible AES encryption (compression
+ method 99). For better export control, the source kit for AES
+ encryption is distributed separately from the main UnZip source kit.
+ See aes_wg/README_AES_WG.txt for more information.
+
+- Optional support for compression methods LZMA (14) and PPMd (98).
+ See szip/README_SZIP.txt for more information.
+
+- Full Unicode support for Windows
+
+- New -I and -O options for ISO and OEM character set conversion,
+ respectively, using iconv. See INSTALL (or unix/Makefile) for details
+ on enabling iconv support.
+
+- New command-line parser (like the one used by Zip). Functional
+ changes include:
+ - Addition of long options, like "--license".
+ - Addition of two-character short options, for example, "-so". Note
+ that this can make some combined one-character options ambiguous.
+ When in doubt, separate one-character short options like "-s -o",
+ instead of combining them into "-so".
+ - Option negation now uses a trailing "-" instead of a leading "-".
+ For example, "-q-" instead of "--q". Multiple levels of negation,
+ like "----q", are no longer supported. Use multiple negative
+ options, like "-q- -q- -q-", instead.
+ - New option "-so"/"--options" lists all available options.
+ - New option "-sc"/"--commandline" shows the input command line and
+ exits.
+ - New "--license" option lists the license. This allows distribution
+ without additional documentation.
+
+- Behavior change: Now, by default, date-time information is restored on
+ extracted files only, not on created directories. Use "-D" to restore
+ no date-time information. Use "-D-" to restore date-time information
+ on directories as well as files. (On VMS, this is not a change,
+ except for the new trailing-hyphen syntax for option negation.)
+
+- Behavior change: Now, by default, permission/protection information is
+ restored on Unix(-like) and VMS systems, but limited by the user's
+ Unix umask or VMS default protection. Use -k/--keep-permissions
+ (/RESTORE = PROTECTION = ORIGINAL) to ignore the umask or default
+ protection, and get the old default behavior. Use -k- (/RESTORE =
+ NOPROTECTION) to ignore the archived permissions, leaving only the
+ umask or default protection.
+
+- Behavior change: Now, on Unix(-like) and VMS systems,
+ -X/--restore-owner (/RESTORE = OWNER) controls only restoration of
+ Unix UID/GID or VMS UIC. On VMS, -ka/--keep-acl (/RESTORE = ACL)
+ controls restoration of ACLs.
+
+- Behavior change: ZipInfo report format changes:
+ - Headers and totals summary formats have been changed. New option:
+ -mc/--member_counts.
+ - "-v" report includes some raw hexadecimal values along with the old
+ descriptions/interpretations.
+
+- New -da/--auto-auto-extract-dir option to specify a destination
+ directory for extracted files which is derived from the base name of
+ the archive. For example, with -da, extraction of "fred.zip" is done
+ into subdirectory "fred" instead of into the current directory. (On
+ VMS, subdirectory "[.fred]".)
+
+- -j/--junk-dirs option now accepts an optional value, the number of
+ directory levels to discard. As before, plain "-j" discards all
+ directory names. "-j=N" discards only the top "N" directory levels.
+
+- Initial support for AppleDouble storage of Finder info and resource
+ fork data on Macintosh (Mac OS X) systems. Intended to be compatible
+ with Apple "ditto".
+
+- Initial support for an UnZip object library on Unix and VMS, providing
+ a callable UnZip interface. Comments in an example main program
+ source module, libiz/izunzip_example.c, explain some usage details.
+ Currently, only a simple .a or .OLB object library is offered, not a
+ .so shared object or .EXE shareable image.
+
+- Acorn port updated.
+
+- The Unix builders (unix/configure, unix/Makefile) have been changed
+ substantially. See INSTALL and unix/Makefile for details.
+ Highlights:
+ - More consistent with Zip.
+ - Use "CC=gcc" to specify GCC. "make" targets "*_gcc" are gone.
+ - Use "PROD=subdir" to put product files (objects, executables, ...)
+ into a subdirectory, rather than ".". In case of PROD-related
+ build problems, older, pre-PROD builders are available as
+ unix/configure_old and unix/Makefile_old.
+ - Windows MinGW support.
+ - Minor changes to accommodate BAE Systems STOP OS.
+ - Output from unix/configure script (used by "make generic") is more
+ informative.
+
+- VMS CLI changes:
+ - /[NO]CASE_INSENSITIVE (for -C) is now deprecated, replaced by new
+ /MATCH = CASE = {BLIND|SENSITIVE}.
+ - /[NO]TIMES (for -T) is now deprecated, replaced by new
+ /[NO]DECIMAL_TIME.
+ - /JUNK_DIRS (-j) now has an optional (integer) value.
+ - New qualifiers/values: /[NO]AUTO_DIRECTORY (-da), /JAR (--jar),
+ /LICENSE (--license), /RESTORE = ACL (-ka),
+ /RESTORE = [NO]PROTECTION = [LIMITED|ORIGINAL] (-k),
+ /RESTORE = OWNER (-X), /VERBOSE = COMMAND (-sc). Optional:
+ /MATCH = [NO]WILD_MATCH_SLASH (-W).
+
+- New Windows builders for Microsoft Visual Studio (Visual C++) 2010
+ have more options, fewer projects. (Service Pack 1 may be needed for
+ VS 2010. VS 2012 (and newer?) should be compatible.) Look for
+ "vc10/" directory under "win32/" and "windll/".
+
+------------------------------------------------------------------------
+
+ Distribution
+ ------------
+
+ If you have a question regarding redistribution of Info-ZIP software,
+whether as-is, as packaging for a commercial product, or as an integral
+part of a commercial product, please read the Frequently Asked Questions
+(FAQ) section of the included COPYING file. All Info-ZIP releases are
+now covered by the Info-ZIP license. See the file LICENSE. The most
+current license should be available at:
+
+ http://info-zip.org/license.html
+ ftp://ftp.info-zip.org/pub/infozip/license.html
+
+ The Info-ZIP group lacks access to many supported system types
+(and/or C compilers), so others may wish to provide pre-built
+executables for various environments. In general, there is no problem
+with this. We require only that such distributions include this README
+file, the LICENSE file (which includes copyright and redistribution
+information, and any appropriate documentation files (unzip.txt and/or
+unzip.1 for UnZip, and so on).
+
+ Any commonly used kit scheme for the target system may be used, such
+as a tar+gzip kit for Unix, a BACKUP save set for VMS, a disk image, and
+so on. Plain Zip archives work if some kind of compatible unzipping
+program is easily available on the target system. If the target system
+provides a way to make self-extracting archives, in which both the
+executables and text files can be stored together, then that's often a
+good way. (Info-ZIP UnZipSFX is normally suitable, for example.) If a
+bare UnZip executable is supplied, then a separate Zip archive
+containing the remaining text and binary files should also be supplied.
+
+------------------------------------------------------------------------
+
+ Talk to Info-ZIP -- Bug Reports, Feature Requests, ...
+ ------------------------------------------------------
+
+ Info-ZIP offers two discussion forums for UnZip and related programs,
+our own forums:
+ http://info-zip.org/phpBB3/index.php
+and SourceForge forums:
+ https://sourceforge.net/tracker/?group_id=118012
+
+ Reports of bugs and documentation problems, and other complaints, are
+welcome, as are feature requests and other suggestions, and even general
+usage questions (ideally on topics which are not already well explained
+in the existing documentation).
+
+ The developers also use an internal e-mail discussion forum, with a
+Web-form submission gateway ("Info-ZIP Bug Report") at:
+ http://info-zip.org/zip-bug.html
+
+ We may never see discussions on other, OS- or application-specific
+forums, unless someone directs us to them.
+
+ As with most such forums, these are subject to abuse. We try to
+reduce this on our own forums by requiring users to register, and by
+moderating postings. (The resulting delays may be annoying, but the
+noise was more annoying.) The bug-report Web form also blocks any
+message which contains a URI/URL, so some useful information may need to
+be omitted there, at least until the discussion gets going. Similarly,
+if a test case involves private data, a discussion which begins on a
+forum can move to private e-mail when appropriate.
+
+ In all cases, a program problem report should include some basic
+information, like:
+
+ Computer type and operating system (and version).
+
+ Program version. (Ideally, a whole "unzip -v" or "zip -v"
+ report, although you might need to edit out any URLs to get it
+ through the bug-report Web form.)
+
+ What you did, and what happened when you did it. Showing actual
+ commands with their actual output is usually more helpful than a
+ vague description or interpretation.
+
+ Actual patches ("diff -u") to the code are welcome, but it's usually
+wise to discuss suggested changes before doing the extra work. It's
+often helpful to base patches on a recent internal-development source
+kit, rather than on a recent full release (or even the latest public
+beta kit, if it's getting old). Similarly, anyone trying to port these
+programs to a new system type will probably benefit by starting with a
+recent internal-development source kit. (Ask, and you are likely to
+receive.) Any such work should begin with a reading of the (old, but
+still useful) proginfo/ZipPorts file.
+
+------------------------------------------------------------------------
+
+ Contributions
+ -------------
+
+ Info-ZIP programs are the result of much work by many people, as
+suggested by the list in the proginfo/CONTRIBS file, but the number of
+active developers is rather small (as the pace of recent releases might
+suggest). A to-do list is kept in the file ToDo, which is a reasonable
+place to start for anyone wishing to contribute. There are many
+projects, small and large (some, _very_ large), listed there. New
+contributors are welcome.
+
+------------------------------------------------------------------------
+ Chronic deficiencies:
+
+- Automated testing system. Should accommodate multiple operating
+ systems (at least Unix, VMS and Windows?), so Perl-based?
+
+- Testing.
+
+- Performance analysis and improvement.
+
+- Localized messages.
+
+
+New stuff to be added to the main list (if not already there):
+- Check if -X is implemented on platforms other than Unix and VMS
+ (8 Jul 2010 SMS)
+- Check if UnZip ?? are appropriately displayed in file names. (12 Jul 2010 EG,
+ from forum thread "Info-ZIP Software Discussions and Feature Requests >
+ Info-ZIP UnZip > How to deal with a list of filenames with '??'")
+ (Also thread "Info-ZIP Bugs > UnZip Bugs > file listing in UTF-8 shows
+ question marks")
+- Explain path matching in extended help, such as *a.txt matches a/b/a.txt.
+ (12 Jul 2010 EG, from forum thread "Info-ZIP Software Discussions and
+ Feature Requests > Info-ZIP UnZip > How to extract a single file among
+ using unzip?")
+- Add -O option to set the code page. (12 Jul 2010 EG, from forum thread
+ "Info-ZIP Bugs > UnZip Bugs > Unzip 6.0 is missing option -O")
+ 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")
+- 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")
+ Done in 6.10c09.
+- Fix for funzip. (12 Jul 2010 EG, from forum thread "Info-ZIP Bugs > UnZip
+ Bugs > compilation error: Uz_Globs has no disk_full")
+ Fixed in 6.10c09.
+- Add more specifics about editing flags. Is check needed that all data
+ from extra field was read? (12 Jul 2010 EG, from forum thread "Info-ZIP
+ Bugs > UnZip Bugs > Valgrind reports uninitialized reads in unzip")
+- Handle archives that truncate large files at 32 bits. (12 Jul 2010 EG,
+ from forum thread "Info-ZIP Bugs > UnZip Bugs > Unable to extract
+ large ZIP files")
+- Probably should update the non-generic targets of UNIX Makefile. (12
+ Jul 2010 EG, from forum thread "Info-ZIP Software Discussions and
+ Feature Requests > Info-ZIP UnZip > How to include large file support
+ in unzip 6.00")
+- Recover ftp damaged file. (12 Jul 2010 EG, from forum thread "Info-ZIP
+ Software Discussions and Feature Requests > Info-ZIP UnZip > Recover
+ ascii ftp damaged zip file - I've done it!")
+- Support for more Mac-specific file attributes in AppleDouble scheme.
+ (3 Aug 2010 SMS)
+- Testing Mac-specific attribute code on (different-endian) Intel Mac
+ (including crossing between Power PC and Intel). (3 Aug 2010 SMS)
+- Look at controlling attribute extraction more finely, maybe using a
+ new --restore-attributes=(protection,owner,acl) option. (3 Aug
+ 2010 SMS, EG)
+
+- Shared object (Unix) or shareable image (VMS) for the object library.
+
================================
For UnZip 6.1/who knows:
================================
PKZIP, WinZIP, 7-Zip versions
- LZMA, compression type 14 (most important, because of its efficiency)
- PPMd, compression type 98 (maybe, less important)
- - WavPacked, compression type 97 (maybe, less important)
+ - WavPack, compression type 97 (maybe, less important)
LZMA is first-level priority for 6.1, other formats may be taken
into consideration
+ LZMA and PPMd done in 6.10c09.
+
o add support for reading AES encrypted archives
- WinZIP format (priority 1)
- PKZip format (priority 2)
- extend the built-in translation tables to support other language
regions besides "Western_Latin1" (e.g. Russian-kyrillic, Japanese,
Chinese)
+ There has been talk on the forum to link to the libiconv library
+ to do translations.
- streamline the multilingual codepage and UTF-8 support for the UNIX
port (standard codepage translation facility?, like WideChar<->AnsiCP
translation functions under MS Windows)
should happen for 6.1
(there is internal alpha-state code for better "wide" support on
Windows available at the time of the 6.0 release)
+ Planned for UnZip 6.10b.
o revise the "extended charcodes" handling in decryption password to
support UTF-8 encoding on Unicode-aware systems where the "native"
- add a (long) option to switch off UnZip's internal pattern matching
on filename arguments.
- probably in 6.1,
- (first prototype of the revised command parser was available at the
- time of the 6.0 release)
+ Initial implementation done in 6.1
o add command line options for miscellaneous features requested by users
and/or development team members:
- - display the Info-ZIP software license
+ - display the Info-ZIP software license (done as --license in 6.1)
- more fine-tuning for file attributes set/restored at extraction, like:
set/clear archive attribute on DOS/OS2/WIN32;
apply/skip standard or user-defined umask filter on UNIX (& Unix-alike)
of this feature wish-list has to be delayed until the "long option"
support of the revised command line parser becomes available.
+
+------------------------------
+
+New stuff:
+
+ - option to extract a file using a new name
+ (2009-6-9, Kamers on forum
+ (http://www.info-zip.org/board/board.pl?m-1244582716/))
+
+ - support Windows extra long paths
+ (2009-7-8, fritz.mueller on forum
+ (http://www.info-zip.org/board/board.pl?m-1246994079/))
+
+
+------------------------------
+
some option may get implemented in 6.1
o support for
o check NEXTBYTE for EOF in crypt.c, funzip.c and explode.c, too
whenever
+ Done in crypt.c and funzip.c in 6.10c09.
o add option to force completely non-interactive operation (no queries
for overwrite/rename, password, etc.); also allow some sort of non-
who knows (zip -F, -FF already exist)
-Some maintenance or OS specific topics for 6.0 release:
+Some maintenance or OS specific topics for 6.x release:
* add "unix-style-path -> partitioned-dataset filename" conversion
to MVS port
* should we add support for (null) entry names (empty entry name field), to
conform to the PKWARE specification?
-
+ Done in 6.10c09.
=======================================
+++ /dev/null
-__________________________________________________________________________
-
- This is the Info-ZIP file ``WHERE,'' last updated on 29 March 2008.
-__________________________________________________________________________
-
- The latest version of this file can be found online at:
-
- ftp://ftp.info-zip.org/pub/infozip/doc/WHERE
-
- Note that some ftp sites may not yet have the latest versions of Zip
- and UnZip when you read this. The latest versions always appear in
- ftp://ftp.info-zip.org/pub/infozip/ (and subdirectories thereof) first,
- except for encryption binaries, which always appear in
- ftp://ftp.icce.rug.nl/infozip/ (and subdirectories) first.
-
- IF YOU FIND AN ERROR: please let us know! We don't have time to
- check each and every site personally (or even collectively), so any
- number of the sites listed below may have moved or disappeared en-
- tirely. E-mail to Zip-Bugs@lists.wku.edu and we'll update this file.
-__________________________________________________________________________
-
-
-Info-ZIP's home WWW site is listed on Yahoo and is at:
-
- ftp://ftp.info-zip.org/pub/infozip/Info-ZIP.html (master version)
- http://ftp.info-zip.org/pub/infozip/ (master version)
- http://www.info-zip.org/
-
-Note that the old sites at http://www.cdrom.com/pub/infozip/ and
-http://www.freesoftware.com/pub/infozip are PERMANENTLY BROKEN. They
-cannot be updated or removed, apparently.
-
-The Zip and UnZip pages have links to most known mirror sites carrying our
-source and/or binary distributions, and they generally are more up-to-date
-and have better information than what you are reading:
-
- ftp://ftp.info-zip.org/pub/infozip/Zip.html
- ftp://ftp.info-zip.org/pub/infozip/UnZip.html
-
-The related zlib package by Info-ZIP's Jean-loup Gailly and Mark Adler is at:
-
- http://www.zlib.net/
-
-Source-code archives for Info-ZIP's portable Zip, UnZip, and related
-utilities:
-
- zip30.zip Zip 3.0 (deflation, bzip2, ZIP64 large archives, multi-
- volume splits; includes zipnote/zipsplit/zipcloak)
- zip30.tar.Z ditto, compress'd tar format
-
- zip232.zip Zip 2.32 (deflation; includes zipnote/zipsplit/zipcloak)
- zip232.tar.Z ditto, compress'd tar format
-
- zip11.zip Zip 1.1 (shrinking, implosion; compatible w. PKUNZIP 1.1)
- zip11.tar.Z ditto, compress'd tar format
-
- unzip60.zip UnZip 6.0 (all methods[*]; unzip/funzip/unzipsfx/zipgrep)
- unzip60.tar.gz ditto, gzip'd tar format
- unzip60.tar.Z ditto, compress'd tar format
-
- unred60.zip UnZip 6.0 add-on, contains copyrighted unreduce support
-
- zcrypt29.zip encryption support for Zip 2.3[**]
- zcrypt10.zip encryption support for Zip 1.1
-
- MacZip106src.zip contains all the GUI stuff and the project files to build
- the MacZip main-app. To build MacZip successfully, both
- the Zip 3.0 and UnZip 6.0 sources are required, too.
-
- wiz601.zip WiZ 6.01, Windows 9x/NT GUI front-end for Info-ZIP's DLLs,
- as well as the source code and project files for the DLLs,
- and static libraries.
-
-[*] Unreducing is disabled by default, but is available as add-on.
- As of July 2004, Unisys's LZW patent was expired worldwide, and
- unshrinking is turned on by default since the release of UnZip 5.52.
- See UnZip's INSTALL file for details.
-
-[**] As of January 2000, US export regulations were amended to allow export
- of free encryption source code from the US. As of June 2002, these
- regulations were further relaxed to allow export of encryption binaries
- associated with free encryption source code. The Zip 2.31, UnZip 5.52
- and Wiz 5.02 archives now include full crypto source code. As of the
- Zip 2.31 release, all official binaries include encryption support; the
- former "zcr" archives ceased to exist.
- (Note that restrictions may still exist in other countries, of course.)
-
-Executables archives (and related files) for Info-ZIP's software; not all
-of these will be immediately available due to lack of access to appropriate
-systems on the part of Info-ZIP members.
-
- zip###x.zip MSDOS executables and docs
- zip###x1.zip OS/2 1.x (16-bit) executables and docs
- zip###x2.zip OS/2 2/3/4.x (32-bit) executables and docs
- zip###xA.zip Amiga executables and docs
- zip###xB.zip BeOS executables and docs
- zip###xC.zip VM/CMS executable and docs
- zip###xK.zip Tandem NSK executables and docs
- zip###xM.xmit MVS classic executable
- zip###xM-docs.zip MVS classic port, docs only
- zip###dN.zip WinNT/Win9x (Intel) DLL, header files, docs
- zip###xN.zip WinNT/Win9x (Intel) executables and docs
- zip###xN-axp.zip WinNT (Alpha AXP) executables and docs
- zip###xN-mip.zip WinNT (MIPS R4000) executables and docs
- zip###xN-ppc.zip WinNT (PowerPC) executables and docs
- zip###xO.zip IBM OS/390 Open Edition binaries and docs
- zip###xQ.zip SMS/QDOS executables and docs
- zip###xR.zip Acorn RISC OS executables and docs
- zip###xT.zip Atari TOS executables and docs
- zip###-vms-axp-obj.zip
- VMS (Alpha AXP) object libs, link procedure and docs
- zip###-vms-axp-exe.zip
- VMS (Alpha AXP) executables for VMS 6.1 or later and docs
- zip###-vms-vax-decc-obj.zip
- VMS (VAX) object libs (new DEC C), link procedure and docs
- zip###-vms-vax-decc-exe.zip
- VMS (VAX) executables (DEC C) for VMS 6.1 or later; docs
- zip###-vms-vax-vaxc-obj.zip
- VMS (VAX) object libs (old VAX C), link procedure and docs
- zip###x.hqx Macintosh BinHex'd executables and docs
-
- unz###x.exe MSDOS self-extracting executable (16-bit unzip, ..., docs)
- unz###x3.exe MSDOS self-extracting executable (16-, 32-bit unzip, docs)
- unz###x1.exe OS/2 1.x (16-bit) self-extracting executables and docs
- unz###x2.exe OS/2 2/3/4.x (32-bit) self-extracting executables and docs
- unz###d2.zip OS/2 2/3/4.x (32-bit) DLL, header file, demo exe and docs
- unz###xA.ami Amiga self-extracting executables and docs
- unz###xA.lha Amiga executables and docs, LHa archive
- unz###xB.sfx BeOS self-extracting executables and docs
- unz###xB.tar.gz BeOS executables and docs, gzip'd tar archive
- unz###xC.mod VM/CMS executable module in "packed" format
- unz###xC-docs.zip VM/CMS docs, only
- unz###xF.zip FlexOS executable and docs
- unz###xK.zip Tandem NSK executable and docs
- unz###xM.xmit MVS classic executable
- unz###xM-docs.zip MVS classic port, docs only
- unz###dN.zip NT4/W2K/XP/2K3/W9x (32-bit Intel) DLL, header files, docs
- unz###xN.exe NT/2K/XP/2K3/W9x self-extracting i386 executables and docs
- unz###xN-axp.exe WinNT (Alpha AXP) self-extracting executables and docs
- unz###xN-mip.exe WinNT (MIPS R4000) self-extracting executables and docs
- unz###xN-ppc.exe WinNT (PowerPC) self-extracting executables and docs
- unz###xQ.sfx SMS/QDOS self-extracting executables and docs
- unz###xO.tar.Z IBM OS/390 Open edition (Unix-like), exes and docs
- unz###xR.exe Acorn RISC OS self-extracting executables and docs
- unz###xR.spk Acorn RISC OS Spark'd executables and docs
- unz###xT.tos Atari TOS self-extracting executables and docs
- unz###x-vms-axp-obj.bck VMS backup saveset,
- contains UnZip (Alpha) obj libs, link procedure, docs
- unz###x-vms-axp-obj.exe VMS (Alpha AXP) SFX archive (statically linked),
- contains UnZip (Alpha) obj libs, link procedure, docs
- unz###x-vms-axp-exe.exe VMS (Alpha AXP) SFX archive (dynamically linked),
- contains UnZip (Alpha AXP, DEC C) executables and docs,
- smaller than object archive, but requires VMS 6.1
- unz###x-vms-vax-decc-obj.bck VMS backup saveset,
- contains UnZip (new DEC C) obj libs, link procedure, docs
- unz###x-vms-vax-decc-obj.exe VMS (VAX) SFX archive (statically linked),
- contains UnZip (new DEC C) obj libs, link procedure, docs
- unz###x-vms-vax-decc-exe.exe VMS (VAX) SFX archive (dynamically linked),
- contains UnZip (new DEC C) executables and docs,
- smaller than object archive, but requires VMS 6.1
- unz###x-vms-vax-vaxc-obj.bck VMS backup saveset,
- contains UnZip (old VAX C) obj libs, link procedure, docs
- unz###x-vms-vax-vaxc-obj.exe VMS (VAX) SFX archive (statically linked),
- contains UnZip (old VAX C) obj libs, link procedure, docs
- unz###x.hqx Macintosh BinHex'd executables and docs for unzip
- (unz###x.tar.{Z,gz} Unix exes/docs for Solaris 2.x, SCO Unix, Linux, etc.,
- depending on directory/location; generally only provided
- in cases where the OS does *not* ship with a bundled C
- compiler)
-
- MacZip106nc.hqx Macintosh combined Zip&UnZip application with GUI,
- executables and docs (no encryption)
- MacZip106c.hqx Macintosh combined Zip&UnZip application with GUI,
- executables and docs (with encryption)
-
- wiz###xN.exe WiZ #.## 32-bit (Win9x/NT/2K/XP/2K3) app+docs (self-extr.)
-
- UnzpHist.zip complete changes-history of UnZip and its precursors
- ZipHist.zip complete changes-history of Zip
-
-ftp/web sites for the US-exportable sources and executables:
-
- NOTE: Look for the Info-ZIP file names given above (not PKWARE or third-
- party stuff) in the following locations. Some sites like to use slightly
- different names, such as zip-#.##.tar.gz instead of zip###.tar.Z.
-
- http://sourceforge.net/project/showfiles.php?group_id=118012
- [THE INFO-ZIP SOURCES HOME SITE]
-
- ftp://ftp.info-zip.org/pub/infozip/ [THE INFO-ZIP HOME SITE]
- ftp://sunsite.doc.ic.ac.uk/packages/zip/ [MIRRORS THE INFO-ZIP HOME SITE]
- ftp://unix.hensa.ac.uk/mirrors/uunet/pub/archiving/zip/
-
- ftp://ftp.cmdl.noaa.gov/aerosol/doc/archiver/{all,dos,os2,mac,vax_alpha}/
- ftp://garbo.uwasa.fi/pc/arcers/ [AND OTHER GARBO MIRRORS]
- ftp://garbo.uwasa.fi/unix/arcers/ [AND OTHER GARBO MIRRORS]
- ftp://ftp.elf.stuba.sk/pub/pc/pack/ [AND OTHER STUBA MIRRORS]
- ftp://ftp-os2.cdrom.com/pub/os2/archiver/
- ftp://ftp-os2.nmsu.edu/os2/archiver/
- ftp://ftp.informatik.tu-muenchen.de/pub/comp/os/os2/archiver/
- ftp://sumex-aim.stanford.edu/info-mac/cmp/
- ftp://ftp.wustl.edu/pub/aminet/util/arc/ [AND OTHER AMINET MIRRORS]
- ftp://atari.archive.umich.edu/pub/Archivers/ [AND OTHER UMICH MIRRORS]
- http://www.umich.edu/~archive/atari/Archivers/
- ftp://jake.educom.com.au/pub/infozip/acorn/ [Acorn RISC OS]
- http://www.sitec.net/maczip/ [MacZip port]
-
-ftp/web sites for the encryption and decryption sources and/or executables:
-
- Outside the US:
- ftp://ftp.info-zip.org/pub/infozip/ [THE INFO-ZIP HOME SITE]
- ftp://ftp.icce.rug.nl/infozip/ [THE INFO-ZIP ENCRYPTION HOME SITE]
- ftp://ftp.elf.stuba.sk/pub/pc/pack/
- ftp://garbo.uwasa.fi/pc/arcers/
- ftp://ftp.inria.fr/system/arch-compr/
- ftp://ftp.leo.org/pub/comp/os/os2/leo/archiver/
- (mail server at ftp-mailer@ftp.leo.org)
-
- ftp://ftp.win.tue.nl/pub/compression/zip/
- ftp://ftp.uni-erlangen.de/pub/pc/msdos/arc-utils/zip/
-
-
-The primary distribution site for the MacZip port can be found at:
-
- http://www.sitec.net/maczip/
-
-ftp sites for VMS-format Zip and UnZip packages (sources, object files and
-executables, no encryption/decryption--see also "Mail servers" section below):
-
- ftp.spc.edu [192.107.46.27] and ftp.wku.edu:
-
- [.MACRO32]AAAREADME.TXT
- [.MACRO32.SAVESETS]UNZIP.BCK or UNZIP.ZIP (if already have older version)
- [.MACRO32.SAVESETS]ZIP.ZIP
-
-To find other ftp/web sites:
-
- The "archie" ftp database utility can be used to find an ftp site near
- you (although the command-line versions always seem to find old ver-
- sions...the `FTPsearch' server at http://ftpsearch.ntnu.no/ftpsearch
- --formerly `Archie 95'--is quite up-to-date, however). Or check a stan-
- dard WWW search engine like AltaVista (http://www.altavista.digital.com/)
- or Yahoo (http://www.yahoo.com/). If you don't know how to use these,
- DON'T ASK US--read the web sites' help pages or check the Usenet groups
- news.announce.newusers or news.answers or some such, or ask your system
- administrator.
-
-Mail servers:
-
- To get the encryption sources by e-mail, send the following commands
- to ftp-mailer@informatik.tu-muenchen.de:
-
- get /pub/comp/os/os2/archiver/zcrypt29.zip
- quit
-
- To get the VMS Zip/UnZip package by e-mail, send the following
- commands in the body of a mail message to fileserv@wku.edu (the
- "HELP" command is also accepted):
-
- SEND FILESERV_TOOLS
- SEND UNZIP
- SEND ZIP
-
- To get Atari executables by e-mail, send a message to
- atari@atari.archive.umich.edu for information about the mail server.
-__________________________________________________________________________
-Contents of the "acorn" subdirectory for UnZip 5.4 and later:
+Contents of the "acorn" subdirectory for UnZip 6.0 and later:
acorn.c.acorn Acorn-specific resources
- acorn.c.riscos mainly file-handling routines for FileCore-based filesystems
- acorn.Contents this file
- acorn.GMakeFile Makefile for gcc
+ acorn.c.riscos Mainly file-handling routines for FileCore-based filesystems
+ acorn.c.swiven SWI veneers
+ acorn.Contents This file
+ acorn.GMakeFile Makefile for GCC
acorn.h.riscos
acorn.h.swiven
acorn.makefile Makefile script for default Acorn C compiler
- acorn.README notes about Acorn-specific features
+ acorn.README Notes about Acorn-specific features
acorn.RunMe1st Obey file to move files into suitable place for compilation
on RISC OS machines
- acorn.s.swiven SWI veneers
- acorn.srcrename small executable that converts files from Unix style to
+ acorn.srcrename Small BASIC program that converts files from Unix style to
RISC OS style, used by RunMe1st
Notes:
- Use the "RunMe1st" file (it is an Obey file) to convert all the files from
- "filename/[chs]" to "[chs].filename" (so that UnZip could be easily compiled
- under RISC OS). It will also set the correct makefile.
+Compilation under GCC
+---------------------
- To compile just set the CSD to the main UnZip directory and run 'amu'.
+It is recommended that you use GCC 4 or higher and the corresponding 'make'
+utility. Both are available from <URL:http://www.riscos.info/index.php/GCCSDK>.
- Currently only the Acorn C V5 compiler has been tested but probably also
- Acorn C V4 and the Acorn Assembler V2 will be able to compile UnZip.
+Use the "RunMe1st" file (it is an Obey file) to convert all the files from
+"filename/[chs]" to "[chs].filename" (so that unzip could be easily compiled
+under RISC OS). It will also set the correct makefile.
+
+To compile just set the CSD to the main unzip directory and run 'make'.
+
+Compilation under Acorn C/C++
+-----------------------------
+
+Currently only the Acorn C V5 compiler has been tested but probably also
+Acorn C V4 and the Acorn Assembler V2 will be able to compile unzip.
+
+First check RunMe1st for a few lines that need uncommenting, in order to install
+the Acorn C/C++ makefile as opposed to the GCC one. Then run RunMe1st as normal
+(i.e. set type to 'Obey' and then double-click). The source tree should then be
+renamed and the makefile installed in the right place.
+
+To compile just set the CSD to the main unzip directory and run 'amu'.
+
+Cross-compilation under GCCSDK
+------------------------------
+
+Use of RunMe1st is not required when using GCCSDK 4
+(<URL:http://www.riscos.info/index.php/GCCSDK>). Instead copy the GCC makefile
+to the right place (e.g. 'cp acorn/GMakefile makefile') and then start the cross
+compiler:
+
+ $ /home/riscos/env/ro-make E=,ff8 CC=arm-unknown-riscos-gcc
-# Makefile for UnZip, UnZipSFX, ZipInfo and fUnZip (5.53 or later)
-# using gcc 2.95.4 (or later).
-# You may look at <URL:http://hard-mofo.dsvr.net/gcc/> for an up-to-date
-# gcc port.
+# Makefile for UnZip, UnZipSFX, ZipInfo and fUnZip (6.0 or later)
+# using GCC 4 (or later).
+# You may look at <URL:http://www.riscos.info/index.php/GCCSDK> for an
+# up-to-date GCC port.
-CC = gcc -mlibscl
+CC = gcc
BIND = $(CC)
AS = $(CC) -c
-ASM = as
SQUEEZE = squeeze -v
-E =
+E ?=
# flags
# CFLAGS flags for C compile
# LFLAGS1 flags after output file spec, before obj file list
# LFLAGS2 flags after obj file list (libraries, etc)
#
-LIB =
-CFLAGS = -O2 -mthrowback -DNO_STRNICMP
-ASMFLAGS = -throwback -objasm -upper
-LFLAGS1 =
-LFLAGS2 = $(LIB)
+CFLAGS = -mlibscl -O2 -mthrowback -DNO_STRNICMP -Wall -I.
+LFLAGS1 = -mlibscl
+LFLAGS2 =
# object file lists
-OBJS1 = o.unzip o.crc32 o.crypt o.envargs o.explode
-OBJS2 = o.extract o.fileio o.globals o.inflate o.list o.match
-OBJS3 = o.process o.ttyio o.unreduce o.unshrink o.zipinfo
-OBJS = $(OBJS1) $(OBJS2) $(OBJS3) o.riscos o.swiven o.acorn
-OBJF = o.funzip o.crc32 o.cryptf o.globalsf o.inflatef o.ttyiof \
- o.riscos o.swiven
-OBJX = o.unzipsfx o.crc32 o.crypt_ o.extract_ o.fileio_ o.globals_ \
- o.inflate_ o.match_ o.process_ o.ttyio_ o.acorn_ o.swiven o.riscos_
-
-UNZIP_H = h.unzip h.unzpriv h.globals acorn.h.riscos acorn.h.swiven
+OBJS1 = unzip.o crc32.o $(CRCA_O) crypt.o envargs.o explode.o
+OBJS2 = extract.o fileio.o globals.o inflate.o list.o match.o
+OBJS3 = process.o ttyio.o ubz2err.o unreduce.o unshrink.o zipinfo.o
+OBJS = $(OBJS1) $(OBJS2) $(OBJS3) riscos.o swiven.o acorn.o
+LOBJS = $(OBJS)
+OBJSDLL = $(OBJS:.o=.pic.o) api.pic.o
+OBJX = unzipsfx.o crc32_.o $(CRCA_O) crypt_.o extract_.o fileio_.o \
+ globals_.o inflate_.o match_.o process_.o ttyio_.o ubz2err_.o \
+ riscos_.o swiven.o acorn_.o
+LOBJX = $(OBJX)
+OBJF = funzip.o crc32.o $(CRCA_O) cryptf.o globalsf.o inflatef.o ttyiof.o \
+ swiven.o
+UNZIP_H = unzip.h unzpriv.h globals.h acorn/riscos.h
all: unzip funzip unzipsfx
-
install: unzip funzip unzipsfx
$(SQUEEZE) unzip %.unzip
$(SQUEEZE) funzip %.funzip
$(SQUEEZE) unzipsfx unzipsfx
copy %.unzip %.zipinfo ~CVF
-# rules for unzip and funzip
-o.crc32: c.crc32 $(UNZIP_H) h.zip h.crc32
- $(CC) $(CFLAGS) -c c.crc32 -o o.crc32
-o.crypt: c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
- $(CC) $(CFLAGS) -c c.crypt -o o.crypt
-o.envargs: c.envargs $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.envargs -o o.envargs
-o.explode: c.explode $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.explode -o o.explode
-o.extract: c.extract $(UNZIP_H) h.crc32 h.crypt
- $(CC) $(CFLAGS) -c c.extract -o o.extract
-o.fileio: c.fileio $(UNZIP_H) h.crc32 h.crypt h.ttyio h.ebcdic
- $(CC) $(CFLAGS) -c c.fileio -o o.fileio
-o.funzip: c.funzip $(UNZIP_H) h.crc32 h.crypt h.ttyio
- $(CC) $(CFLAGS) -c c.funzip -o o.funzip
-o.globals: c.globals $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.globals -o o.globals
-o.inflate: c.inflate h.inflate $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.inflate -o o.inflate
-o.list: c.list $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.list -o o.list
-o.match: c.match $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.match -o o.match
-o.process: c.process $(UNZIP_H) h.crc32
- $(CC) $(CFLAGS) -c c.process -o o.process
-o.ttyio: c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
- $(CC) $(CFLAGS) -c c.ttyio -o o.ttyio
-o.unreduce: c.unreduce $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.unreduce -o o.unreduce
-o.unshrink: c.unshrink $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.unshrink -o o.unshrink
-o.unzip: c.unzip $(UNZIP_H) h.crypt h.unzvers h.consts
- $(CC) $(CFLAGS) -c c.unzip -o o.unzip
-o.zipinfo: c.zipinfo $(UNZIP_H)
- $(CC) $(CFLAGS) -c c.zipinfo -o o.zipinfo
-
-o.crypt_: c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
- $(CC) $(CFLAGS) -DSFX -c c.crypt -o o.crypt_
-o.extract_: c.extract $(UNZIP_H) h.crc32 h.crypt
- $(CC) $(CFLAGS) -DSFX -c c.extract -o o.extract_
-o.fileio_: c.fileio $(UNZIP_H) h.crc32 h.crypt h.ttyio h.ebcdic
- $(CC) $(CFLAGS) -DSFX -c c.fileio -o o.fileio_
-o.globals_: c.globals $(UNZIP_H)
- $(CC) $(CFLAGS) -DSFX -c c.globals -o o.globals_
-o.inflate_: c.inflate h.inflate $(UNZIP_H) h.crypt
- $(CC) $(CFLAGS) -DSFX -c c.inflate -o o.inflate_
-o.match_: c.match $(UNZIP_H)
- $(CC) $(CFLAGS) -DSFX -c c.match -o o.match_
-o.process_: c.process $(UNZIP_H) h.crc32
- $(CC) $(CFLAGS) -DSFX -c c.process -o o.process_
-o.ttyio_: c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
- $(CC) $(CFLAGS) -DSFX -c c.ttyio -o o.ttyio_
-
-o.unzipsfx: c.unzip $(UNZIP_H) h.crypt h.unzvers h.consts
- $(CC) $(CFLAGS) -DSFX -c c.unzip -o o.unzipsfx
-
-o.cryptf: c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
- $(CC) $(CFLAGS) -DFUNZIP -c c.crypt -o o.cryptf
-o.globalsf: c.globals $(UNZIP_H)
- $(CC) $(CFLAGS) -DFUNZIP -c c.globals -o o.globalsf
-o.inflatef: c.inflate h.inflate $(UNZIP_H) h.crypt
- $(CC) $(CFLAGS) -DFUNZIP -c c.inflate -o o.inflatef
-o.ttyiof: c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
- $(CC) $(CFLAGS) -DFUNZIP -c c.ttyio -o o.ttyiof
-
-o.acorn: acorn.c.acorn $(UNZIP_H)
- $(CC) $(CFLAGS) -I@ -c acorn.c.acorn
-o.acorn_: acorn.c.acorn $(UNZIP_H)
- $(CC) $(CFLAGS) -I@ -c -DSFX -DSFX_EXDIR -o o.acorn_ acorn.c.acorn
-
-o.riscos: acorn.c.riscos $(UNZIP_H)
- $(CC) $(CFLAGS) -I@ -c acorn.c.riscos
-o.riscos_: acorn.c.riscos $(UNZIP_H)
- $(CC) $(CFLAGS) -I@ -c -DSFX -DSFX_EXDIR -o o.riscos_ acorn.c.riscos
-
-o.swiven: acorn.s.swiven
- $(ASM) $(ASMFLAGS) acorn.s.swiven -o o.swiven
+# suffix rules
+.SUFFIXES:
+.SUFFIXES: _.o .o .c
+.c_.o:
+ $(CC) -c $(CFLAGS) -DUTIL -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $<
+
+# rules for common stuff
+crc32.o: crc32.c $(UNZIP_H) zip.h crc32.h
+crypt.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
+envargs.o: envargs.c $(UNZIP_H)
+explode.o: explode.c $(UNZIP_H)
+extract.o: extract.c $(UNZIP_H) crc32.h crypt.h
+fileio.o: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
+funzip.o: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
+globals.o: globals.c $(UNZIP_H)
+inflate.o: inflate.c inflate.h $(UNZIP_H)
+list.o: list.c $(UNZIP_H)
+match.o: match.c $(UNZIP_H)
+process.o: process.c $(UNZIP_H) crc32.h
+ttyio.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
+ubz2err.o: ubz2err.c $(UNZIP_H)
+unreduce.o: unreduce.c $(UNZIP_H)
+unshrink.o: unshrink.c $(UNZIP_H)
+unzip.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
+zipinfo.o: zipinfo.c $(UNZIP_H)
+
+# unzipsfx compilation section
+unzipsfx.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ unzip.c
+
+crc32_.o: crc32.c $(UNZIP_H) zip.h crc32.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ crc32.c
+
+crypt_.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ crypt.c
+
+extract_.o: extract.c $(UNZIP_H) crc32.h crypt.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ extract.c
+
+fileio_.o: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ fileio.c
+
+globals_.o: globals.c $(UNZIP_H)
+ $(CC) -c $(CFLAGS) -DSFX -o $@ globals.c
+
+inflate_.o: inflate.c inflate.h $(UNZIP_H) crypt.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ inflate.c
+
+match_.o: match.c $(UNZIP_H)
+ $(CC) -c $(CFLAGS) -DSFX -o $@ match.c
+
+process_.o: process.c $(UNZIP_H) crc32.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ process.c
+
+ttyio_.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ ttyio.c
+
+ubz2err_.o: ubz2err.c $(UNZIP_H)
+ $(CC) -c $(CFLAGS) -DSFX -o $@ ubz2err.c
+
+
+# funzip compilation section
+cryptf.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
+ $(CC) -c $(CFLAGS) -DFUNZIP -o $@ crypt.c
+
+globalsf.o: globals.c $(UNZIP_H)
+ $(CC) -c $(CFLAGS) -DFUNZIP -o $@ globals.c
+
+inflatef.o: inflate.c inflate.h $(UNZIP_H) crypt.h
+ $(CC) -c $(CFLAGS) -DFUNZIP -o $@ inflate.c
+
+ttyiof.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
+ $(CC) -c $(CFLAGS) -DFUNZIP -o $@ ttyio.c
+
+
+acorn.o: acorn/acorn.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c acorn/acorn.c
+acorn_.o: acorn/acorn.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c -DSFX -DSFX_EXDIR -o acorn_.o acorn/acorn.c
+acornf.o: acorn/acorn.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c -DFUNZIP -o acornf.o acorn/acorn.c
+
+riscos.o: acorn/riscos.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c acorn/riscos.c
+riscos_.o: acorn/riscos.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c -DSFX -DSFX_EXDIR -o riscos_.o acorn/riscos.c
+riscosf.o: acorn/riscos.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c -DFUNZIP -o riscosf.o acorn/riscos.c
+
+swiven.o: acorn/swiven.c
+ $(CC) $(CFLAGS) -c acorn/swiven.c
unzip: $(OBJS)
$(BIND) -o unzip$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2)
-| This Obey file prepares the UnZip port for a Desktop C re-compile.
+| This Obey file prepares the UnZip port for a GCC/Desktop C re-compile.
| Run it and it will copy all the needed files into the correct
| place.
-| Set the correct type of 'srcrename' so that the only requirement
-| for the user is to set 'RunMe1st' to Obey
-SetType <Obey$Dir>.srcrename FF8
-
| Run 'srcrename' on the main UnZip directory with recursion enabled
-/<Obey$Dir>.srcrename -r -e c:h:s:o <Obey$Dir>.^
-
-| Create the 'o' directory
-CDir <Obey$Dir>.^.o
+BASIC -quit "<Obey$Dir>.srcrename" -r -e c:h:s:o <Obey$Dir>.^
| Put the Makefile in its correct place and set the correct filetype
-SetType <Obey$Dir>.makefile FE1
-Copy <Obey$Dir>.makefile <Obey$Dir>.^.makefile ~C ~V F
+Copy <Obey$Dir>.GMakefile <Obey$Dir>.^.makefile ~C~VF
+
+| Uncomment the following lines if you're using Acorn C/C++
+|| Put the Makefile in its correct place and set the correct filetype
+|Copy <Obey$Dir>.makefile <Obey$Dir>.^.makefile ~C ~V F
+|| Create the 'o' directory
+|CDir <Obey$Dir>.^.o
+
+SetType <Obey$Dir>.^.makefile FE1
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
acorn.c
- RISCOS-specific routines for use with Info-ZIP's UnZip 5.2 and later.
+ RISCOS-specific routines for use with Info-ZIP's UnZip 6.0 and later.
Contains: do_wild() <-- generic enough to put in fileio.c?
mapattr()
setRISCOSexfield()
printRISCOSexfield()
close_outfile()
+ defer_dir_attribs()
+ set_direc_attribs()
stamp_file()
version()
#define UNZIP_INTERNAL
-#include "^.unzip.h"
+#include "../unzip.h"
#include "riscos.h"
#define FTYPE_FFF (1<<17) /* set filetype to &FFF when extracting */
static int uxtime2acornftime(unsigned *pexadr, unsigned *pldadr, time_t ut);
static int mimemap(const char *name);
+#ifdef SET_DIR_ATTRIB
+typedef struct uxdirattr { /* struct for holding unix style directory */
+ struct uxdirattr *next; /* info until can be sorted and set at end */
+ char *fn; /* filename of directory */
+ unsigned int loadaddr,execaddr; /* RISC OS encoded timestamp */
+ unsigned attr; /* RISC OS file attribs */
+ char fnbuf[1]; /* buffer stub for directory name */
+} uxdirattr;
+#define UxAtt(d) ((uxdirattr *)d) /* typecast shortcut */
+#endif /* SET_DIR_ATTRIB */
+
#ifndef SFX
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
if (*pathcomp == '\0') {
int attr;
int mode=G.pInfo->file_attr&0xffff; /* chmod equivalent mode */
- time_t m_time;
-#ifdef USE_EF_UT_TIME
- iztimes z_utime;
-#endif
+ /* get current time-stamp and attributes */
+ SWI_OS_File_5(G.filename, NULL, &loadaddr, &execaddr, NULL, &attr);
/* skip restoring time stamps on user's request */
if (uO.D_flag <= 1) {
+ time_t m_time;
+#ifdef USE_EF_UT_TIME
+ iztimes z_utime;
+#endif
+
#ifdef USE_EF_UT_TIME
if (G.extra_field &&
#ifdef IZ_CHECK_TZ
} else
#endif /* USE_EF_UT_TIME */
m_time = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
- }
- /* set the file's time-stamp and attributes */
- SWI_OS_File_5(G.filename, NULL, &loadaddr, NULL, NULL, &attr);
-
- if (uO.D_flag <= 1)
- /* set the file's modification time */
uxtime2acornftime(&execaddr, &loadaddr, m_time);
+ }
+ /* Write out new attributes */
loadaddr = (loadaddr & 0xfff000ffU) |
((G.pInfo->file_attr&0xfff00000) >> 12);
} /* end function close_outfile() */
+#ifdef SET_DIR_ATTRIB
+int defer_dir_attribs(__G__ pd)
+ __GDEF
+ direntry **pd;
+{
+ uxdirattr *d_entry;
+ extra_block *spark_ef;
+
+ d_entry = (uxdirattr *)malloc(sizeof(uxdirattr) + strlen(G.filename));
+ *pd = (direntry *)d_entry;
+ if (d_entry == (uxdirattr *)NULL) {
+ return PK_MEM;
+ }
+ d_entry->fn = d_entry->fnbuf;
+ strcpy(d_entry->fn, G.filename);
+ /* Directory name typically contains a trailing dot; get rid of it */
+ char *c = &d_entry->fn[strlen(d_entry->fn)-1];
+ if(*c == '.')
+ *c = 0;
+
+ if ((spark_ef = (extra_block *) getRISCOSexfield(G.extra_field, G.lrec.extra_field_length))
+ != NULL) {
+ d_entry->loadaddr = spark_ef->loadaddr;
+ d_entry->execaddr = spark_ef->execaddr;
+ d_entry->attr = spark_ef->attr;
+ } else {
+ unsigned int loadaddr, execaddr;
+ int attr;
+ int mode=G.pInfo->file_attr&0xffff; /* chmod equivalent mode */
+
+ /* get current time-stamp and attributes */
+ SWI_OS_File_5(G.filename, NULL, &loadaddr, &execaddr, NULL, &attr);
+
+ /* skip restoring directory time stamps on user's request */
+ if (uO.D_flag <= 0) {
+ time_t m_time;
+#ifdef USE_EF_UT_TIME
+ iztimes z_utime;
+#endif
+
+#ifdef USE_EF_UT_TIME
+ if (G.extra_field &&
+#ifdef IZ_CHECK_TZ
+ G.tz_is_valid &&
+#endif
+ (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
+ G.lrec.last_mod_dos_datetime, &z_utime, NULL)
+ & EB_UT_FL_MTIME))
+ {
+ TTrace((stderr, "defer_dir_attribs: Unix e.f. modif. time = %ld\n",
+ z_utime.mtime));
+ m_time = z_utime.mtime;
+ } else
+#endif /* USE_EF_UT_TIME */
+ m_time = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
+
+ uxtime2acornftime(&execaddr, &loadaddr, m_time);
+ }
+
+ /* Write out new attributes */
+ loadaddr = (loadaddr & 0xfff000ffU) |
+ ((G.pInfo->file_attr&0xfff00000) >> 12);
+
+ attr=(attr&0xffffff00) | ((mode&0400) >> 8) | ((mode&0200) >> 6) |
+ ((mode&0004) << 2) | ((mode&0002) << 4);
+
+ d_entry->loadaddr = loadaddr;
+ d_entry->execaddr = execaddr;
+ d_entry->attr = attr;
+ }
+
+ return PK_OK;
+} /* end function defer_dir_attribs() */
+
+
+int set_direc_attribs(__G__ d)
+ __GDEF
+ direntry *d;
+{
+ int errval = PK_OK;
+
+ SWI_OS_File_1(UxAtt(d)->fn,UxAtt(d)->loadaddr,UxAtt(d)->execaddr,UxAtt(d)->attr);
+
+ return errval;
+} /* end function set_direc_attribs() */
+
+#endif /* SET_DIR_ATTRIB */
+
+
#ifdef TIMESTAMP
-# Makefile for UnZip, UnZipSFX, ZipInfo and fUnZip (5.53 or later)
-# last modified: 25 Dec 2006
+# Makefile for UnZip, UnZipSFX, ZipInfo and fUnZip (6.0 or later)
+# last modified: 18 Nov 2010
# add -g to CC to debug
# add -d to BIND to debug
CC = cc
BIND = link
AS = $(CC) -c
-ASM = objasm
SQUEEZE = squeeze -v
E =
# LFLAGS1 flags after output file spec, before obj file list
# LFLAGS2 flags after obj file list (libraries, etc)
#
-LIB =
-CBASE = -throwback -wn -DNO_STRNICMP
-CFLAGS = $(CBASE) -IC:,@.
-ASMFLAGS = -Throwback -Stamp -NoCache -CloseExec -quit
+LIB =
+CBASE = -throwback -wn -DNO_STRNICMP -memaccess -L22-S22-L41
+CFLAGS = $(CBASE) -IC:,@.
LFLAGS1 =
LFLAGS2 = $(LIB) C:o.Stubs
# object file lists
-OBJS1 = unzip.o crc32.o crypt.o envargs.o explode.o
+OBJS1 = unzip.o crc32.o $(CRCA_O) crypt.o envargs.o explode.o
OBJS2 = extract.o fileio.o globals.o inflate.o list.o match.o
OBJS3 = process.o ttyio.o ubz2err.o unreduce.o unshrink.o zipinfo.o
-OBJS = $(OBJS1) $(OBJS2) $(OBJS3) riscos.o swiven.o acorn.o
-OBJF = funzip.o crc32.o cryptf.o globalsf.o inflatef.o ttyiof.o \
- riscos.o swiven.o
-OBJX = unzipsfx.o crc32.o crypt_.o extract_.o fileio_.o globals.o \
- inflate.o match.o process_.o ttyio.o ubz2err_.o \
- acorn_.o swiven.o riscos_.o
+OBJS = $(OBJS1) $(OBJS2) $(OBJS3) riscos.o swiven.o acorn.o
+LOBJS = $(OBJS)
+OBJSDLL = $(OBJS:.o=.pic.o) api.pic.o
+OBJX = unzipsfx.o crc32_.o $(CRCA_O) crypt_.o extract_.o fileio_.o \
+ globals_.o inflate_.o match_.o process_.o ttyio_.o ubz2err_.o \
+ riscos_.o swiven.o acorn_.o
+LOBJX = $(OBJX)
+OBJF = funzip.o crc32.o $(CRCA_O) cryptf.o globalsf.o inflatef.o ttyiof.o \
+ swiven.o
+UNZIP_H = unzip.h unzpriv.h globals.h acorn/riscos.h
-UNZIP_H = unzip.h unzpriv.h globals.h acorn/riscos.h acorn/swiven.h
-
-all: unzip funzip unzipsfx
+all: unzip funzip unzipsfx
install: unzip funzip unzipsfx
- $(SQUEEZE) unzip %.unzip
- $(SQUEEZE) funzip %.funzip
- $(SQUEEZE) unzipsfx unzipsfx
- copy %.unzip %.zipinfo ~CVF
+ $(SQUEEZE) unzip %.unzip
+ $(SQUEEZE) funzip %.funzip
+ $(SQUEEZE) unzipsfx unzipsfx
+ copy %.unzip %.zipinfo ~CVF
# suffix rules
-.SUFFIXES: .o .c
+.SUFFIXES: _.o .o .c
+.c_.o:
+ $(CC) $(CFLAGS) -DUTIL -o $@ -c $<
.c.o:
- $(CC) $(CFLAGS) -c $<
-.s.o:
- $(ASM) $(ASMFLAGS) -from @*.s -to @*.o
-
-# rules for unzip and funzip
-crc32.o: crc32.c $(UNZIP_H) zip.h crc32.h
-crypt.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
-envargs.o: envargs.c $(UNZIP_H)
-explode.o: explode.c $(UNZIP_H)
-extract.o: extract.c $(UNZIP_H) crc32.h crypt.h
-fileio.o: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
-funzip.o: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
-globals.o: globals.c $(UNZIP_H)
-inflate.o: inflate.c inflate.h $(UNZIP_H)
-list.o: list.c $(UNZIP_H)
-match.o: match.c $(UNZIP_H)
-process.o: process.c $(UNZIP_H) crc32.h
-ttyio.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
-ubz2err.o: ubz2err.c $(UNZIP_H)
-unreduce.o: unreduce.c $(UNZIP_H)
-unshrink.o: unshrink.c $(UNZIP_H)
-unzip.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
-zipinfo.o: zipinfo.c $(UNZIP_H)
-
-crypt_.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
- $(CC) $(CFLAGS) -DSFX -c c.crypt -o o.crypt_
-extract_.o: extract.c $(UNZIP_H) crc32.h crypt.h
- $(CC) $(CFLAGS) -DSFX -c c.extract -o o.extract_
-fileio_.o: fileio.c $(UNZIP_H) crc32.h crypt.h
- $(CC) $(CFLAGS) -DSFX -c c.fileio -o o.fileio_
-globals_.o: globals.c $(UNZIP_H)
- $(CC) $(CFLAGS) -DFUNZIP -c c.globals -o o.globals_
-inflate_.o: inflate.c inflate.h $(UNZIP_H) crypt.h
- $(CC) $(CFLAGS) -DFUNZIP -c c.inflate -o o.inflate_
-process_.o: process.c $(UNZIP_H) crc32.h
- $(CC) $(CFLAGS) -DSFX -c c.process -o o.process_
-ttyio_.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
- $(CC) $(CFLAGS) -DFUNZIP -c c.ttyio -o o.ttyio_
-ubz2err_.o: ubz2err.c $(UNZIP_H)
- $(CC) $(CFLAGS) -DSFX -c c.ubz2err -o o.ubz2err_
-
-unzipsfx.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
- $(CC) $(CFLAGS) -DSFX -c c.unzip -o o.unzipsfx
-
-o.cryptf: c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
- $(CC) $(CFLAGS) -DFUNZIP -c c.crypt -o o.cryptf
-o.globalsf: c.globals $(UNZIP_H)
- $(CC) $(CFLAGS) -DFUNZIP -c c.globals -o o.globalsf
-o.inflatef: c.inflate h.inflate $(UNZIP_H) h.crypt
- $(CC) $(CFLAGS) -DFUNZIP -c c.inflate -o o.inflatef
-o.ttyiof: c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
- $(CC) $(CFLAGS) -DFUNZIP -c c.ttyio -o o.ttyiof
+ $(CC) $(CFLAGS) -c $<
-acorn.o: acorn/acorn.c $(UNZIP_H)
- $(CC) $(CFLAGS) -c acorn/acorn.c
-acorn_.o: acorn/acorn.c $(UNZIP_H)
- $(CC) $(CFLAGS) -c -DSFX -DSFX_EXDIR -o acorn_.o acorn/acorn.c
+# rules for common stuff
+crc32.o: crc32.c $(UNZIP_H) zip.h crc32.h
+crypt.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
+envargs.o: envargs.c $(UNZIP_H)
+explode.o: explode.c $(UNZIP_H)
+extract.o: extract.c $(UNZIP_H) crc32.h crypt.h
+fileio.o: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
+funzip.o: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
+globals.o: globals.c $(UNZIP_H)
+inflate.o: inflate.c inflate.h $(UNZIP_H)
+list.o: list.c $(UNZIP_H)
+match.o: match.c $(UNZIP_H)
+process.o: process.c $(UNZIP_H) crc32.h
+ttyio.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
+ubz2err.o: ubz2err.c $(UNZIP_H)
+unreduce.o: unreduce.c $(UNZIP_H)
+unshrink.o: unshrink.c $(UNZIP_H)
+unzip.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
+zipinfo.o: zipinfo.c $(UNZIP_H)
+
+# unzipsfx compilation section
+unzipsfx.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ unzip.c
+
+crc32_.o: crc32.c $(UNZIP_H) zip.h crc32.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ crc32.c
+
+crypt_.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ crypt.c
+
+extract_.o: extract.c $(UNZIP_H) crc32.h crypt.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ extract.c
+
+fileio_.o: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ fileio.c
+
+globals_.o: globals.c $(UNZIP_H)
+ $(CC) -c $(CFLAGS) -DSFX -o $@ globals.c
+
+inflate_.o: inflate.c inflate.h $(UNZIP_H) crypt.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ inflate.c
+
+match_.o: match.c $(UNZIP_H)
+ $(CC) -c $(CFLAGS) -DSFX -o $@ match.c
-riscos.o: acorn/riscos.c $(UNZIP_H)
- $(CC) $(CFLAGS) -c acorn/riscos.c
-riscos_.o: acorn/riscos.c $(UNZIP_H)
- $(CC) $(CFLAGS) -c -DSFX -DSFX_EXDIR -o riscos_.o acorn/riscos.c
+process_.o: process.c $(UNZIP_H) crc32.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ process.c
-swiven.o: acorn/swiven.s
- $(ASM) $(ASMFLAGS) -from acorn.s.swiven -to o.swiven
+ttyio_.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
+ $(CC) -c $(CFLAGS) -DSFX -o $@ ttyio.c
-unzip: $(OBJS)
- $(BIND) -o unzip$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2)
+ubz2err_.o: ubz2err.c $(UNZIP_H)
+ $(CC) -c $(CFLAGS) -DSFX -o $@ ubz2err.c
+
+
+# funzip compilation section
+cryptf.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
+ $(CC) -c $(CFLAGS) -DFUNZIP -o $@ crypt.c
+
+globalsf.o: globals.c $(UNZIP_H)
+ $(CC) -c $(CFLAGS) -DFUNZIP -o $@ globals.c
+
+inflatef.o: inflate.c inflate.h $(UNZIP_H) crypt.h
+ $(CC) -c $(CFLAGS) -DFUNZIP -o $@ inflate.c
+
+ttyiof.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
+ $(CC) -c $(CFLAGS) -DFUNZIP -o $@ ttyio.c
+
+
+acorn.o: acorn/acorn.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c acorn/acorn.c
+acorn_.o: acorn/acorn.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c -DSFX -DSFX_EXDIR -o acorn_.o acorn/acorn.c
+acornf.o: acorn/acorn.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c -DFUNZIP -o acornf.o acorn/acorn.c
+
+riscos.o: acorn/riscos.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c acorn/riscos.c
+riscos_.o: acorn/riscos.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c -DSFX -DSFX_EXDIR -o riscos_.o acorn/riscos.c
+riscosf.o: acorn/riscos.c $(UNZIP_H)
+ $(CC) $(CFLAGS) -c -DFUNZIP -o riscosf.o acorn/riscos.c
+
+swiven.o: acorn/swiven.c
+ $(CC) $(CFLAGS) -c acorn/swiven.c
+
+unzip: $(OBJS)
+ $(BIND) -o unzip$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2)
funzip: $(OBJF)
- $(BIND) -o funzip$(E) $(LFLAGS1) $(OBJF) $(LFLAGS2)
+ $(BIND) -o funzip$(E) $(LFLAGS1) $(OBJF) $(LFLAGS2)
unzipsfx: $(OBJX)
- $(BIND) -o unzipsfx$(E) $(LFLAGS1) $(OBJX) $(LFLAGS2)
-
-clean: ;remove unzip; remove funzip;
- remove zipinfo; remove unzipsfx;
- create o.!fake! 0
- wipe o.* ~cf
+ $(BIND) -o unzipsfx$(E) $(LFLAGS1) $(OBJX) $(LFLAGS2)
+
+clean:
+ remove unzip
+ remove funzip
+ remove zipinfo
+ remove unzipsfx
+ create o.!fake! 0
+ wipe o.* ~cf
# end of Makefile
/*
- Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2010 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.
DIR *thisdir;
int type;
int attr;
- os_error *er;
thisdir=(DIR *)malloc(sizeof(DIR));
if (thisdir==NULL)
if (thisdir->dirname[strlen(thisdir->dirname)-1]=='.')
thisdir->dirname[strlen(thisdir->dirname)-1]=0;
- if (er=SWI_OS_File_5(thisdir->dirname,&type,NULL,NULL,NULL,&attr),er!=NULL ||
+ if (SWI_OS_File_5(thisdir->dirname,&type,NULL,NULL,NULL,&attr)!=NULL ||
type<=1 || (type==3 && !uO.scanimage))
{
free(thisdir->dirname);
free(d);
}
-int unlink(f)
-char *f; /* file to delete */
+int unlink(char *f)
/* Delete the file *f, returning non-zero on failure. */
{
- os_error *er;
+ _kernel_oserror *er;
char canon[256];
int size=255;
void set_prefix(void)
{
- char *pref;
- int size=0;
+ char pref[MAXFILENAMELEN];
+ int size=MAXFILENAMELEN-1;
if (SWI_OS_FSControl_37("@",pref,&size)!=NULL)
return;
- size=1-size;
-
- if (pref=malloc(size),pref!=NULL) {
- if (SWI_OS_FSControl_37("@",pref,&size)!=NULL) {
- free(pref);
- return;
- }
-
if (SWI_DDEUtils_Prefix(pref)==NULL) {
atexit(remove_prefix);
}
-
- free(pref);
- }
}
#ifdef localtime
/*
- Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2010 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.
#include <time.h>
-typedef struct {
- int errnum;
- char errmess[252];
-} os_error;
-
#ifndef __swiven_h
# include "swiven.h"
#endif
-#define MAXPATHLEN 256
-#define MAXFILENAMELEN 64 /* should be 11 for ADFS, 13 for DOS, 64 seems a sensible value... */
-#define DIR_BUFSIZE 1024 /* this should be enough to read a whole E-Format directory */
+#define MAXPATHLEN 1024
+#define MAXFILENAMELEN MAXPATHLEN /* RISC OS 4 has 1024 limit. 1024 is also the same as FNMAX in zip.h */
+#define DIR_BUFSIZE MAXPATHLEN /* Ensure we can read at least one full-length RISC OS 4 filename */
struct stat {
unsigned int st_dev;
};
typedef struct {
- unsigned int load_addr;
- unsigned int exec_addr;
- int lenght;
- int attrib;
- int objtype;
- char name[13];
-} riscos_direntry;
-
-typedef struct {
short ID;
short size;
int ID_2;
# define localtime riscos_localtime
# define gmtime riscos_gmtime
#endif /* !NO_UNZIPH_STUFF */
+#define SET_DIR_ATTRIB
+
+#define NO_EXCEPT_SIGNALS
#define _raw_getc() SWI_OS_ReadC()
--- /dev/null
+/*
+ Copyright (c) 1990-2010 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 1999-Oct-05 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, both of these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
+*/
+#include "kernel.h"
+#include "swis.h"
+
+#include "riscos.h"
+
+/* This is not defined in Acorn C swis.h header: */
+#ifndef DDEUtils_Prefix
+#define DDEUtils_Prefix 0x042580
+#endif
+#ifndef MimeMap_Translate
+#define MimeMap_Translate 0x50B00
+#endif
+
+_kernel_oserror *SWI_OS_FSControl_26(char *source, char *dest, int actionmask)
+{ /* copy */
+ return _swix(OS_FSControl,_INR(0,3),26,source,dest,actionmask);
+}
+
+_kernel_oserror *SWI_OS_FSControl_27(char *filename, int actionmask)
+{ /* wipe */
+ return _swix(OS_FSControl,_INR(0,3),27,filename,0,actionmask);
+}
+
+_kernel_oserror *SWI_OS_GBPB_9(char *dirname, void *buf, int *number,
+ int *offset, int size, char *match)
+{ /* read dir */
+ int _number,_offset;
+ _kernel_oserror *err = _swix(OS_GBPB,_INR(0,6)|_OUTR(3,4),9,dirname,buf,*number,*offset,size,match,&_number,&_offset);
+ if(err)
+ return err;
+ *number = _number;
+ *offset = _offset;
+ return 0;
+}
+
+_kernel_oserror *SWI_OS_File_1(char *filename, unsigned int loadaddr,
+ unsigned int execaddr, int attrib)
+{ /* write file attributes */
+ return _swix(OS_File,_INR(0,5),1,filename,loadaddr,execaddr,0,attrib);
+}
+
+_kernel_oserror *SWI_OS_File_5(char *filename, int *objtype,
+ unsigned int *loadaddr, unsigned int *execaddr,
+ int *length, int *attrib)
+{ /* read file info */
+ int _objtype,_length,_attrib;
+ unsigned int _loadaddr,_execaddr;
+ _kernel_oserror *err = _swix(OS_File,_INR(0,1)|_OUT(0)|_OUTR(2,5),5,filename,&_objtype,&_loadaddr,&_execaddr,&_length,&_attrib);
+ if(err)
+ return err;
+ if(objtype)
+ *objtype = _objtype;
+ if(loadaddr)
+ *loadaddr = _loadaddr;
+ if(execaddr)
+ *execaddr = _execaddr;
+ if(length)
+ *length = _length;
+ if(attrib)
+ *attrib = _attrib;
+ return 0;
+}
+
+_kernel_oserror *SWI_OS_File_6(char *filename)
+{ /* delete */
+ return _swix(OS_File,_INR(0,1),6,filename);
+}
+
+_kernel_oserror *SWI_OS_File_7(char *filename, int loadaddr, int execaddr,
+ int size)
+{ /* create an empty file */
+ return _swix(OS_File,_INR(0,5),7,filename,loadaddr,execaddr,0,size);
+}
+
+_kernel_oserror *SWI_OS_File_8(char *dirname)
+{ /* create directory */
+ return _swix(OS_File,_INR(0,1)|_IN(4),8,dirname,0);
+}
+
+_kernel_oserror *SWI_OS_CLI(char *cmd)
+{ /* execute a command */
+ return _swix(OS_CLI,_IN(0),cmd);
+}
+
+int SWI_OS_ReadC(void)
+{ /* get a key from the keyboard buffer */
+ int key;
+ _swix(OS_ReadC,_OUT(0),&key);
+ return key;
+}
+
+_kernel_oserror *SWI_OS_ReadVarVal(char *var, char *buf, int len,
+ int *bytesused)
+{ /* reads an OS variable */
+ int _bytesused;
+ _kernel_oserror *err = _swix(OS_ReadVarVal,_INR(0,4)|_OUT(2),var,buf,len,0,0,&_bytesused);
+ if(err)
+ return err;
+ if(bytesused)
+ *bytesused = _bytesused;
+ return 0;
+}
+
+_kernel_oserror *SWI_OS_FSControl_54(char *buffer, int dir, char *fsname,
+ int *size)
+{ /* reads the path of a specified directory */
+ int _size;
+ _kernel_oserror *err = _swix(OS_FSControl,_INR(0,5)|_OUT(5),54,buffer,dir,fsname,0,*size,&_size);
+ if(err)
+ return err;
+ *size = _size;
+ return 0;
+}
+
+_kernel_oserror *SWI_OS_FSControl_37(char *pathname, char *buffer, int *size)
+{ /* canonicalise path */
+ int _size;
+ _kernel_oserror *err = _swix(OS_FSControl,_INR(0,5)|_OUT(5),37,pathname,buffer,0,0,*size,&_size);
+ if(err)
+ return err;
+ *size = _size;
+ return 0;
+}
+
+
+_kernel_oserror *SWI_DDEUtils_Prefix(char *dir)
+{ /* sets the 'prefix' directory */
+ return _swix(DDEUtils_Prefix,_IN(0),dir);
+}
+
+int SWI_Read_Timezone(void)
+{ /* returns the timezone offset (centiseconds) */
+ int ofs;
+ _kernel_oserror *err = _swix(Territory_ReadCurrentTimeZone,_OUT(0),&ofs);
+ if(err)
+ return 0;
+ return ofs;
+}
+
+int SWI_MimeMap_Translate(const char *ext)
+{
+ int result;
+ _kernel_oserror *err = _swix(MimeMap_Translate,_INR(0,2)|_OUT(3),3,ext,0,&result);
+ if(err)
+ return -1;
+ return result;
+}
/*
- Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2010 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.
#ifndef __swiven_h
#define __swiven_h
-os_error *SWI_OS_FSControl_26(char *source, char *dest, int actionmask);
+#include "kernel.h"
+
+_kernel_oserror *SWI_OS_FSControl_26(char *source, char *dest, int actionmask);
/* copy */
-os_error *SWI_OS_FSControl_27(char *filename, int actionmask);
+_kernel_oserror *SWI_OS_FSControl_27(char *filename, int actionmask);
/* wipe */
-os_error *SWI_OS_GBPB_9(char *dirname, void *buf, int *number,
+_kernel_oserror *SWI_OS_GBPB_9(char *dirname, void *buf, int *number,
int *offset, int size, char *match);
/* read dir */
-os_error *SWI_OS_File_1(char *filename, unsigned int loadaddr,
+_kernel_oserror *SWI_OS_File_1(char *filename, unsigned int loadaddr,
unsigned int execaddr, int attrib);
/* write file attributes */
-os_error *SWI_OS_File_5(char *filename, int *objtype, unsigned int *loadaddr,
+_kernel_oserror *SWI_OS_File_5(char *filename, int *objtype, unsigned int *loadaddr,
unsigned int *execaddr, int *length, int *attrib);
/* read file info */
-os_error *SWI_OS_File_6(char *filename);
+_kernel_oserror *SWI_OS_File_6(char *filename);
/* delete */
-os_error *SWI_OS_File_7(char *filename, int loadaddr, int execaddr, int size);
+_kernel_oserror *SWI_OS_File_7(char *filename, int loadaddr, int execaddr, int size);
/* create an empty file */
-os_error *SWI_OS_File_8(char *dirname);
+_kernel_oserror *SWI_OS_File_8(char *dirname);
/* create a directory */
-os_error *SWI_OS_File_18(char *filename, int filetype);
+_kernel_oserror *SWI_OS_File_18(char *filename, int filetype);
/* set a file's type */
-os_error *SWI_OS_CLI(char *cmd);
+_kernel_oserror *SWI_OS_CLI(char *cmd);
/* execute a command */
int SWI_OS_ReadC(void);
/* get a key from the keyboard buffer */
-os_error *SWI_OS_ReadVarVal(char *var, char *buf, int len, int *bytesused);
+_kernel_oserror *SWI_OS_ReadVarVal(char *var, char *buf, int len, int *bytesused);
/* reads an OS varibale */
-os_error *SWI_OS_FSControl_54(char *buffer, int dir, char *fsname, int *size);
+_kernel_oserror *SWI_OS_FSControl_54(char *buffer, int dir, char *fsname, int *size);
/* reads the path of a specified directory */
-os_error *SWI_OS_FSControl_37(char *pathname, char *buffer, int *size);
+_kernel_oserror *SWI_OS_FSControl_37(char *pathname, char *buffer, int *size);
/* canonicalise path */
-os_error *SWI_DDEUtils_Prefix(char *dir);
+_kernel_oserror *SWI_DDEUtils_Prefix(char *dir);
/* sets the 'prefix' directory */
int SWI_Read_Timezone(void);
+++ /dev/null
-;===========================================================================
-; Copyright (c) 1990-2000 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.
-; If, for some reason, all these files are missing, the Info-ZIP license
-; also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
-;===========================================================================
-; SWI veneers used by Zip/Unzip
-;
-
-r0 RN 0
-r1 RN 1
-r2 RN 2
-r3 RN 3
-r4 RN 4
-r5 RN 5
-r6 RN 6
-r7 RN 7
-r8 RN 8
-r9 RN 9
-r10 RN 10
-r11 RN 11
-r12 RN 12
-sp RN 13
-lr RN 14
-pc RN 15
-
-sl RN 10
-fp RN 11
-ip RN 12
-
-
-XOS_Bit EQU &020000
-
-OS_GBPB EQU &00000C
-OS_File EQU &000008
-OS_FSControl EQU &000029
-OS_CLI EQU &000005
-OS_ReadC EQU &000004
-OS_ReadVarVal EQU &000023
-DDEUtils_Prefix EQU &042580
-Territory_ReadCurrentTimeZone EQU &043048
-MimeMap_Translate EQU &050B00
-
- MACRO
- STARTCODE $name
- EXPORT $name
-$name
- MEND
-
-
- AREA |C$$code|, CODE, READONLY
-
-; os_error *SWI_OS_FSControl_26(char *source, char *dest, int actionmask);
-
- STARTCODE SWI_OS_FSControl_26
-
- MOV ip, lr
-
- MOV r3, r2
- MOV r2, r1
- MOV r1, r0
- MOV r0, #26
-
- SWI OS_FSControl + XOS_Bit
-
- MOVVC r0, #0
-
- MOVS pc, ip
-
-
-; os_error *SWI_OS_FSControl_27(char *filename, int actionmask);
-
- STARTCODE SWI_OS_FSControl_27
-
- MOV ip, lr
-
- MOV r3, r1
- MOV r1, r0
- MOV r0, #27
-
- SWI OS_FSControl + XOS_Bit
-
- MOVVC r0, #0
-
- MOVS pc, ip
-
-
-; os_error *SWI_OS_GBPB_9(char *dirname, void *buf, int *number,
-; int *offset, int size, char *match);
-
- STARTCODE SWI_OS_GBPB_9
-
- MOV ip, sp
- STMFD sp!, {r2-r6,lr}
- LDMIA ip, {r5,r6}
- LDR r4, [r3]
- LDR r3, [r2]
- MOV r2, r1
- MOV r1, r0
- MOV r0, #9
- SWI OS_GBPB + XOS_Bit
- LDMVSFD sp!, {r2-r6,pc}^
- MOV r0, #0
- LDMFD sp, {r5,r6}
- STR r3, [r5]
- STR r4, [r6]
- LDMFD sp!, {r2-r6,pc}^
-
-
-; os_error *SWI_OS_File_1(char *filename, int loadaddr, int execaddr, int attrib);
-
- STARTCODE SWI_OS_File_1
-
- STMFD sp!, {r5,lr}
- MOV r5, r3
- MOV r3, r2
- MOV r2, r1
- MOV r1, r0
- MOV r0, #1
- SWI OS_File + XOS_Bit
- MOVVC r0, #0
- LDMFD sp!, {r5,pc}^
-
-
-
-; os_error *SWI_OS_File_5(char *filename, int *objtype, int *loadaddr,
-; int *execaddr, int *length, int *attrib);
-
- STARTCODE SWI_OS_File_5
-
- STMFD sp!, {r1-r5,lr}
- MOV r1, r0
- MOV r0, #5
- SWI OS_File + XOS_Bit
- LDMVSFD sp!, {r1-r5,pc}^
- LDR lr, [sp]
- TEQ lr, #0
- STRNE r0, [lr]
- LDR lr, [sp, #4]
- TEQ lr ,#0
- STRNE r2, [lr]
- LDR lr, [sp, #8]
- TEQ lr, #0
- STRNE r3, [lr]
- LDR lr, [sp ,#24]
- TEQ lr, #0
- STRNE r4, [lr]
- LDR lr, [sp ,#28]
- TEQ lr, #0
- STRNE r5, [lr]
- MOV r0, #0
- LDMFD sp!, {r1-r5,pc}^
-
-
-; os_error *SWI_OS_File_6(char *filename);
-
- STARTCODE SWI_OS_File_6
-
- STMFD sp!, {r4-r5,lr}
- MOV r1, r0
- MOV r0, #6
- SWI OS_File + XOS_Bit
- MOVVC r0, #0
- LDMFD sp!, {r4-r5,pc}^
-
-
-; os_error *SWI_OS_File_7(char *filename, int loadaddr, int execaddr, int size);
-
- STARTCODE SWI_OS_File_7
-
- STMFD sp!, {r4-r5,lr}
- MOV r5, r3
- MOV r4, #0
- MOV r3, r2
- MOV r2, r1
- MOV r1, r0
- MOV r0, #7
- SWI OS_File + XOS_Bit
- MOVVC r0, #0
- LDMFD sp!, {r4-r5,pc}^
-
-
-; os_error *SWI_OS_File_8(char *dirname);
-
- STARTCODE SWI_OS_File_8
-
- STMFD sp!, {r4,lr}
- MOV r1, r0
- MOV r4, #0
- MOV r0, #8
- SWI OS_File + XOS_Bit
- MOVVC r0, #0
- LDMFD sp!, {r4,pc}^
-
-
-; os_error *SWI_OS_File_18(char *filename, int filetype);
-
- STARTCODE SWI_OS_File_18
-
- STMFD sp!, {r4-r5,lr}
- MOV r2, r1
- MOV r1, r0
- MOV r0, #18
- SWI OS_File + XOS_Bit
- MOVVC r0, #0
- LDMFD sp!, {r4-r5,pc}^
-
-
-; os_error *SWI_OS_CLI(char *cmd);
-
- STARTCODE SWI_OS_CLI
-
- MOV ip, lr
- SWI OS_CLI + XOS_Bit
- MOVVC r0, #0
- MOVS pc, ip
-
-
-; int SWI_OS_ReadC(void);
-
- STARTCODE SWI_OS_ReadC
-
- MOV ip, lr
- SWI OS_ReadC + XOS_Bit
- MOVS pc, ip
-
-
-; os_error *SWI_OS_ReadVarVal(char *var, char *buf, int len, int *bytesused);
-
- STARTCODE SWI_OS_ReadVarVal
-
- STMFD sp!, {r4,lr}
- MOV ip, r3
- MOV r3, #0
- MOV r4, #0
- SWI OS_ReadVarVal + XOS_Bit
- LDMVSFD sp!, {r4,pc}^
- TEQ ip, #0
- STRNE r2, [ip]
- MOV r0, #0
- LDMFD sp!, {r4,pc}^
-
-
-; os_error *SWI_OS_FSControl_54(char *buffer, int dir, char *fsname, int *size);
-
- STARTCODE SWI_OS_FSControl_54
-
- STMFD sp!, {r3-r6,lr}
- LDR r5, [r3]
- MOV r3, r2
- MOV r2, r1
- MOV r1, r0
- MOV r0, #54
- SWI OS_FSControl + XOS_Bit
- LDMVSFD sp!, {r3-r6,pc}^
- MOV r0, #0
- LDMFD sp!, {r3}
- STR r5, [r3]
- LDMFD sp!, {r4-r6,pc}^
-
-
-; os_error *SWI_OS_FSControl_37(char *pathname, char *buffer, int *size);
-
- STARTCODE SWI_OS_FSControl_37
-
- STMFD sp!, {r2,r3-r5,lr}
- LDR r5, [r2]
- MOV r3, #0
- MOV r4, #0
- MOV r2, r1
- MOV r1, r0
- MOV r0, #37
- SWI OS_FSControl + XOS_Bit
- LDMVSFD sp!, {r2,r3-r5,pc}^
- MOV r0, #0
- LDMFD sp!, {r2}
- STR r5, [r2]
- LDMFD sp!, {r3-r5,pc}^
-
-
-; os_error *SWI_DDEUtils_Prefix(char *dir);
-
- STARTCODE SWI_DDEUtils_Prefix
-
- MOV ip, lr
- SWI DDEUtils_Prefix + XOS_Bit
- MOVVC r0, #0
- MOVS pc, ip
-
-; int SWI_Read_Timezone(void);
-
- STARTCODE SWI_Read_Timezone
-
- MOV ip, lr
- SWI Territory_ReadCurrentTimeZone + XOS_Bit
- MOVVC r0, r1
- MOVVS r0, #0
- MOVS pc, ip
-
-
-; int SWI_MimeMap_Translate(char *ext);
-
- STARTCODE SWI_MimeMap_Translate
- MOV ip,lr
- MOV r1, r0
- MOV r0, #3
- MOV r2, #0
- SWI MimeMap_Translate + XOS_Bit
- MOVVC r0, r3
- MVNVS r0, #0 ; return -1 on error
- MOVS pc, ip
-
-
- END
--- /dev/null
+ 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.
+
+Comments in the code identify the changes. (Look for "Info-ZIP".) The
+original files are preserved in an "original_files" 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.3 2013-11-18 Renamed USexport.msg to USexport_AES_WG.msg to
+ distinguish it from the Traditional encryption
+ notice, USexport.msg.
+ 1.2 2013-04-12 Avoid <sys/isa_defs.h> on __sun systems with
+ __sparc defined (for SunOS 4.x).
+ 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)
+
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
#else
/* supress G.rootpath even when user gave a relative pathname */
# if 1
- G.renamed_fullpath = (renamed && strpbrk(G.filename, ":/");
+ G.renamed_fullpath = (renamed && strpbrk(G.filename, ":/"));
# else
G.renamed_fullpath = (renamed &&
(strchr(G.filename, ':') || strchr(G.filename, '/')));
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
if (*pathcomp == '\0') {
# ifdef AZTEC_C
strcpy(buf1,"Manx Aztec C ");
# else
- strcpy(buf1,"UNKNOWN ");
+ strcpy(buf1,"Unknown C ");
# endif
# endif
# endif
/* "under" */
sprintf(buf3,"AmigaDOS v%d",WBversion);
#else
- strcpy(buf1,"Unknown compiler ");
+ strcpy(buf1,"Unknown C ");
strcpy(buf3,"Unknown OS");
#endif
/*
- Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2012 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2000-Apr-09 or later
(the contents of which are also included in zip.h) for terms of use.
#endif /* !FUNZIP && !UTIL */
-#if CRYPT || !defined(FUNZIP)
+#if defined( IZ_CRYPT_ANY) || !defined(FUNZIP)
/* sendpkt.c
* by A. Finkel, P. Lindsay, C. Sheppner
} /* sendpkt() */
-#endif /* CRYPT || !FUNZIP */
+#endif /* defined( IZ_CRYPT_ANY) || !defined(FUNZIP) */
-#if CRYPT || (defined(UNZIP) && !defined(FUNZIP))
+#if defined( IZ_CRYPT_ANY) || (defined(UNZIP) && !defined(FUNZIP))
/* Agetch() reads one raw keystroke -- uses sendpkt() */
return c;
}
-#endif /* CRYPT || (UNZIP && !FUNZIP) */
+#endif /* defined( IZ_CRYPT_ANY) || (defined(UNZIP) && !defined(FUNZIP)) */
#endif /* __amiga_filedate_c*/
;===========================================================================
-; Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+; Copyright (c) 1990-2012 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.
;
; Define INT16 if ints are short, otherwise it assumes ints are long.
;
-; Define USE_DEFLATE64 if we're supporting Deflate64 decompression.
+; Define DEFLATE64_SUPPORT if we're supporting Deflate64 decompression.
;
-; Do NOT define WSIZE; it is always 32K or 64K depending on USE_DEFLATE64.
+; Do NOT define WSIZE; it is always 32K or 64K depending on DEFLATE64_SUPPORT.
; You also do not need to define FUNZIP or SFX, if you create t:G_offs.a
; correctly (see below).
;
; Lastly, this include will define CRYPT as 1 if appropriate and supply flag
; definitions for major compile options that may affect the layout of the
; globals structure and the functionality of the core decompression routines
-; (currently FUNZIP, SFX, REENTRANT, DLL, NO_SLIDE_REDIR, USE_DEFLATE64).
+; (currently FUNZIP, SFX, REENTRANT, DLL, NO_SLIDE_REDIR, DEFLATE64_SUPPORT).
INCLUDE "t:G_offs.a"
; Couple other items we need:
savregs reg d2-d7/a2/a3/a6
- IFD USE_DEFLATE64
+ IFD DEFLATE64_SUPPORT
WSIZE equ $10000 ; 64K... be careful not to treat as short!
ELSE
WSIZE equ $08000 ; 32K... be careful not to treat as negative!
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
/* On UNIX (and compatible systems), "." and ".." are reserved for
long int dgdate(short mm, short dd, short yy)
{
long int temp;
- short ytmp;
if (mm<1 || mm>12 || dd<1 || dd>31 || yy<1968 || yy>2099)
return 0L;
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
This module supplies an UnZip engine for use directly from C/C++
programs. The functions are:
+ char *UzpFeatures( void)
ZCONST UzpVer *UzpVersion(void);
unsigned UzpVersion2(UzpVer2 *version)
int UzpMain(int argc, char *argv[]);
+ int UzpMainI( int argc, char *argv[], UzpCB *init)
int UzpAltMain(int argc, char *argv[], UzpInit *init);
int UzpValidate(char *archive, int AllCodes);
void UzpFreeMemBuffer(UzpBuffer *retstr);
int UzpFileTree(char *name, cbList(callBack), char *cpInclude[],
char *cpExclude[]);
- You must define `DLL' in order to include the API extensions.
+ You must define DLL in order to include the API extensions.
---------------------------------------------------------------------------*/
-#ifdef OS2
+#ifdef DLL /* This source file supplies library interface code. */
+
+# ifdef OS2
# define INCL_DOSMEMMGR
# include <os2.h>
-#endif
+# endif /* def OS2 */
-#define UNZIP_INTERNAL
-#include "unzip.h"
-#ifdef WINDLL
-# ifdef POCKET_UNZIP
-# include "wince/intrface.h"
-# else
-# include "windll/windll.h"
-# endif
-#endif
-#include "unzvers.h"
-#include <setjmp.h>
+# if defined( UNIX) && defined( __APPLE__)
+# include <unix/macosx.h>
+# endif /* defined( UNIX) && defined( __APPLE__) */
-#ifdef DLL /* This source file supplies DLL-only interface code. */
-
-#ifndef POCKET_UNZIP /* WinCE pUnZip defines this elsewhere. */
+# define UNZIP_INTERNAL
+# include "unzip.h"
+# ifdef WINDLL
+# ifdef POCKET_UNZIP
+# include "wince/intrface.h"
+# else /* def POCKET_UNZIP */
+# include "windll/windll.h"
+# endif /* def POCKET_UNZIP [else] */
+# else /* def WINDLL */
+# include "api.h"
+# endif /* def WINDLL [else] */
+# include "unzvers.h"
+# include "crypt.h"
+
+# include <setjmp.h>
+
+# ifndef POCKET_UNZIP /* WinCE pUnZip defines this elsewhere. */
jmp_buf dll_error_return;
-#endif
+# endif /* def POCKET_UNZIP */
/*---------------------------------------------------------------------------
Documented API entry points
---------------------------------------------------------------------------*/
-ZCONST UzpVer * UZ_EXP UzpVersion() /* returns pointer to const struct */
+ZCONST UzpVer * UZ_EXP UzpVersion()
{
- static ZCONST UzpVer version = { /* doesn't change between calls */
+ static ZCONST UzpVer version = { /* Doesn't change between calls. */
/* structure size */
UZPVER_LEN,
/* version flags */
-#ifdef BETA
-# ifdef ZLIB_VERSION
+# ifdef BETA
+# ifdef ZLIB_VERSION
3,
-# else
+# else /* def ZLIB_VERSION */
1,
-# endif
-#else
-# ifdef ZLIB_VERSION
+# endif /* def ZLIB_VERSION [else] */
+# else /* def BETA */
+# ifdef ZLIB_VERSION
2,
-# else
+# else /* def ZLIB_VERSION */
0,
-# endif
-#endif
+# endif /* def ZLIB_VERSION [else] */
+# endif /* def BETA [else] */
/* betalevel and date strings */
UZ_BETALEVEL, UZ_VERSION_DATE,
/* zlib_version string */
-#ifdef ZLIB_VERSION
+# ifdef ZLIB_VERSION
ZLIB_VERSION,
-#else
+# else /* def ZLIB_VERSION */
NULL,
-#endif
+# endif /* def ZLIB_VERSION [else] */
/*== someday each of these may have a separate patchlevel: ==*/
/* unzip version */
{UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, 0},
{UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, 0},
/* windll version (retained for backward compatibility)*/
{UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, 0},
-#ifdef OS2DLL
+# ifdef OS2DLL
/* os2dll API minimum compatible version*/
{UZ_OS2API_COMP_MAJOR, UZ_OS2API_COMP_MINOR, UZ_OS2API_COMP_REVIS, 0}
-#else /* !OS2DLL */
-#ifdef WINDLL
+# else /* def OS2DLL */
+# ifdef WINDLL
/* windll API minimum compatible version*/
{UZ_WINAPI_COMP_MAJOR, UZ_WINAPI_COMP_MINOR, UZ_WINAPI_COMP_REVIS, 0}
-#else /* !WINDLL */
+# else /* def WINDLL */
/* generic DLL API minimum compatible version*/
{UZ_GENAPI_COMP_MAJOR, UZ_GENAPI_COMP_MINOR, UZ_GENAPI_COMP_REVIS, 0}
-#endif /* ?WINDLL */
-#endif /* ?OS2DLL */
+# endif /* def WINDLL [else] */
+# endif /* def OS2DLL [else] */
};
return &version;
}
-unsigned UZ_EXP UzpVersion2(UzpVer2 *version)
+unsigned UZ_EXP UzpVersion2( OFT( UzpVer2 *)version)
+# ifdef NO_PROTO
+ UzpVer2 *version;
+# endif /* def NO_PROTO */
{
if (version->structlen != sizeof(UzpVer2))
return sizeof(UzpVer2);
-#ifdef BETA
+# ifdef BETA
version->flag = 1;
-#else
+# else /* def BETA */
version->flag = 0;
-#endif
+# endif /* def BETA [else] */
strcpy(version->betalevel, UZ_BETALEVEL);
strcpy(version->date, UZ_VERSION_DATE);
-#ifdef ZLIB_VERSION
+# ifdef ZLIB_VERSION
/* Although ZLIB_VERSION is a compile-time constant, we implement an
"overrun-safe" copy because its actual value is not under our control.
*/
sizeof(version->zlib_version) - 1);
version->zlib_version[sizeof(version->zlib_version) - 1] = '\0';
version->flag |= 2;
-#else
+# else /* def ZLIB_VERSION */
version->zlib_version[0] = '\0';
-#endif
+# endif /* def ZLIB_VERSION [else] */
/* someday each of these may have a separate patchlevel: */
- version->unzip.major = UZ_MAJORVER;
- version->unzip.minor = UZ_MINORVER;
+ version->unzip.vmajor = UZ_MAJORVER;
+ version->unzip.vminor = UZ_MINORVER;
version->unzip.patchlevel = UZ_PATCHLEVEL;
- version->zipinfo.major = ZI_MAJORVER;
- version->zipinfo.minor = ZI_MINORVER;
+ version->zipinfo.vmajor = ZI_MAJORVER;
+ version->zipinfo.vminor = ZI_MINORVER;
version->zipinfo.patchlevel = UZ_PATCHLEVEL;
/* these are retained for backward compatibility only: */
- version->os2dll.major = UZ_MAJORVER;
- version->os2dll.minor = UZ_MINORVER;
+ version->os2dll.vmajor = UZ_MAJORVER;
+ version->os2dll.vminor = UZ_MINORVER;
version->os2dll.patchlevel = UZ_PATCHLEVEL;
- version->windll.major = UZ_MAJORVER;
- version->windll.minor = UZ_MINORVER;
+ version->windll.vmajor = UZ_MAJORVER;
+ version->windll.vminor = UZ_MINORVER;
version->windll.patchlevel = UZ_PATCHLEVEL;
-#ifdef OS2DLL
+# ifdef OS2DLL
/* os2dll API minimum compatible version*/
- version->dllapimin.major = UZ_OS2API_COMP_MAJOR;
- version->dllapimin.minor = UZ_OS2API_COMP_MINOR;
+ version->dllapimin.vmajor = UZ_OS2API_COMP_MAJOR;
+ version->dllapimin.vminor = UZ_OS2API_COMP_MINOR;
version->dllapimin.patchlevel = UZ_OS2API_COMP_REVIS;
-#else /* !OS2DLL */
-#ifdef WINDLL
+# else /* def OS2DLL */
+# ifdef WINDLL
/* windll API minimum compatible version*/
- version->dllapimin.major = UZ_WINAPI_COMP_MAJOR;
- version->dllapimin.minor = UZ_WINAPI_COMP_MINOR;
+ version->dllapimin.vmajor = UZ_WINAPI_COMP_MAJOR;
+ version->dllapimin.vminor = UZ_WINAPI_COMP_MINOR;
version->dllapimin.patchlevel = UZ_WINAPI_COMP_REVIS;
-#else /* !WINDLL */
+# else /* def WINDLL */
/* generic DLL API minimum compatible version*/
- version->dllapimin.major = UZ_GENAPI_COMP_MAJOR;
- version->dllapimin.minor = UZ_GENAPI_COMP_MINOR;
+ version->dllapimin.vmajor = UZ_GENAPI_COMP_MAJOR;
+ version->dllapimin.vminor = UZ_GENAPI_COMP_MINOR;
version->dllapimin.patchlevel = UZ_GENAPI_COMP_REVIS;
-#endif /* ?WINDLL */
-#endif /* ?OS2DLL */
+# endif /* def WINDLL [else] */
+# endif /* def OS2DLL [else] */
return 0;
}
+char *UzpFeatures()
+{
+ char *feats;
+ char tempstring[ 100]; /* Temporary string storage. */
+ char featurelist[ 1000]; /* Feature string storage. */
+
+ /* All features start and end with a semi-colon for easy parsing. */
+ strcpy( featurelist, ";");
+ tempstring[ 0] = '\0'; /* Avoid "unused" warning. */
+
+# ifdef ACORN_FTYPE_NFS
+ strcat( featurelist, "apple_nfrsrc;");
+# endif
+
+# if defined( UNIX) && defined( __APPLE__)
+
+# ifndef APPLE_NFRSRC
+ Bad code: error APPLE_NFRSRC not defined.
+# endif
+# if defined( __ppc__) || defined( __ppc64__)
+# if APPLE_NFRSRC
+ strcat( featurelist, "apple_nfrsrc;");
+# endif /* APPLE_NFRSRC */
+# else /* defined( __ppc__) || defined( __ppc64__) */
+# if ! APPLE_NFRSRC
+ strcat( featurelist, "apple_rsrc;");
+# endif /* ! APPLE_NFRSRC */
+# endif /* defined( __ppc__) || defined( __ppc64__) [else] */
+
+# ifdef APPLE_XATTR
+ strcat( featurelist, "apple_xattr;");
+# endif /* def APPLE_XATTR */
+
+# endif /* defined( UNIX) && defined( __APPLE__) */
+
+# ifdef ASM_CRC
+ strcat( featurelist, "asm_crc;");
+# endif
+
+# ifdef ASM_INFLATECODES
+ strcat( featurelist, "asm_inflatecodes;");
+# endif
+
+# ifdef CHECK_VERSIONS
+ strcat( featurelist, "check_versions;");
+# endif
+
+ strcat( featurelist, "compmethods:store");
+# ifdef BZIP2_SUPPORT
+ strcat( featurelist, ",bzip2");
+# endif
+# ifdef DEFLATE_SUPPORT
+ strcat( featurelist, ",deflate");
+# endif
+# ifdef DEFLATE64_SUPPORT
+ strcat( featurelist, ",deflate64");
+# endif
+# ifdef LZMA_SUPPORT
+ strcat( featurelist, ",lzma");
+# endif
+# ifdef PPMD_SUPPORT
+ strcat( featurelist, ",ppmd");
+# endif
+ strcat( featurelist, ";");
+
+# ifdef COPYRIGHT_CLEAN
+ strcat( featurelist, "copyright_clean;");
+# endif
+
+# ifdef IZ_CRYPT_ANY
+
+# ifdef IZ_CRYPT_TRAD
+ strcat( featurelist, "crypt;");
+# endif
+
+# ifdef IZ_CRYPT_AES_WG
+ strcat( featurelist, "crypt_aes_wg;");
+# endif
+
+# ifdef PASSWD_FROM_STDIN
+ strcat( featurelist, "passwd_from_stdin;");
+# endif
+
+# endif /* def IZ_CRYPT_ANY */
+
+# ifdef DEBUG
+ strcat( featurelist, "debug;");
+# endif
+
+# ifdef DEBUG_TIME
+ strcat( featurelist, "debug_time;");
+# endif
+
+# ifdef DLL
+ strcat( featurelist, "dll;");
+# endif
+
+# ifdef DOSWILD
+ strcat( featurelist, "doswild;");
+# endif
+
+# ifdef ICONV_MAPPING
+ strcat( featurelist, "iconv_mapping;");
+# endif
+
+# ifdef IZ_HAVE_UXUIDGID
+ strcat( featurelist, "iz_have_uxuidgid;");
+# endif
+
+# ifdef LARGE_FILE_SUPPORT
+ strcat( featurelist, "large_file_support;");
+# endif
+
+# ifdef LZW_CLEAN
+ strcat( featurelist, "lzw_clean;");
+# endif
+# ifndef MORE
+ strcat( featurelist, "no_more;");
+# endif
-#ifndef SFX
-#ifndef WINDLL
+# ifdef MULT_VOLUME
+ strcat( featurelist, "mult_volume;");
+# endif
+
+# ifdef NTSD_EAS
+ strcat( featurelist, "ntsd_eas;");
+# endif
-int UZ_EXP UzpAltMain(int argc, char *argv[], UzpInit *init)
+# if defined( WIN32) && defined( NO_W32TIMES_IZFIX)
+ strcat( featurelist, "no_w32times_izfix;");
+# endif
+
+# ifdef OLD_THEOS_EXTRA
+ strcat( featurelist, "old_theos_extra;");
+# endif
+
+# ifdef OS2_EAS
+ strcat( featurelist, "os2_eas;");
+# endif
+
+# ifdef QLZIP
+ strcat( featurelist, "qlzip;");
+# endif
+
+# ifdef REENTRANT
+ strcat( featurelist, "reentrant;");
+# endif
+
+# ifdef REGARGS
+ strcat( featurelist, "regargs;");
+# endif
+
+# ifdef RETURN_CODES
+ strcat( featurelist, "return_codes;");
+# endif
+
+# ifdef SET_DIR_ATTRIB
+ strcat( featurelist, "set_dir_attrib;");
+# endif
+
+# ifdef SYMLINKS
+ strcat( featurelist, "symlinks;");
+# endif
+
+# ifdef TIMESTAMP
+ strcat( featurelist, "timestamp;");
+# endif
+
+# ifdef UNIXBACKUP
+ strcat( featurelist, "unixbackup;");
+# endif
+
+# ifdef UNICODE_SUPPORT
+ strcat( featurelist, "unicode;");
+# endif
+
+# if defined(__DJGPP__) && (__DJGPP__ >= 2)
+
+# ifdef USE_DJGPP_ENV
+ strcat( featurelist, "use_djgpp_env;");
+# endif
+
+# ifdef USE_DJGPP_GLOB
+ strcat( featurelist, "use_djgpp_glob;");
+# endif
+
+# endif /* defined(__DJGPP__) && (__DJGPP__ >= 2) */
+
+# ifdef USE_EF_UT_TIME
+ strcat( featurelist, "use_ef_ut_time;");
+# endif
+
+# ifdef USE_VFAT
+ strcat( featurelist, "use_vfat;");
+# endif
+
+# ifdef USE_ZLIB
+ strcat( featurelist, "zlib;");
+ sprintf( tempstring, "zlib_version:%s,%s;", ZLIB_VERSION, zlibVersion());
+ strcat( featurelist, tempstring);
+# endif
+
+# ifdef VMSCLI
+ strcat( featurelist, "vmscli;");
+# endif
+
+# ifdef VMSWILD
+ strcat( featurelist, "vmswild;");
+# endif
+
+# ifdef WILD_STOP_AT_DIR
+ strcat( featurelist, "wild_stop_at_dir;");
+# endif
+
+# ifdef WIN32_WIDE
+ strcat( featurelist, "win32_wide;");
+# endif
+
+# ifdef ZIP64_SUPPORT
+ strcat( featurelist, "zip64;");
+# endif
+
+# ifdef NO_ZIPINFO
+ strcat( featurelist, "no_zipinfo;");
+# endif
+
+ feats = malloc( strlen( featurelist) + 1);
+ if (feats != NULL)
+ {
+ strcpy( feats, featurelist);
+ }
+
+ return feats;
+}
+
+
+
+# ifndef SFX
+# ifndef WINDLL
+
+int UZ_EXP UzpAltMain( OFT( int)argc,
+ OFT( char **)argv,
+ OFT( UzpInit *)init)
+# ifdef NO_PROTO
+ int argc;
+ char **argv;
+ UzpInit *init;
+# endif /* def NO_PROTO */
{
int r, (*dummyfn)();
RETURN(r);
}
-#endif /* !WINDLL */
+# endif /* ndef WINDLL */
+int UZ_EXP UzpMainI( OFT( int)argc,
+ OFT( char **)argv,
+ OFT( UzpCB *)init)
+# ifdef NO_PROTO
+ int argc;
+ char **argv;
+ UzpCB *init;
+# endif /* def NO_PROTO */
+{
+ int r, (*dummyfn)();
+ CONSTRUCTGLOBALS();
+
+ if (init->structlen >= (sizeof(ulg) + sizeof(dummyfn)) && init->msgfn)
+ G.message = init->msgfn;
+
+ if (init->structlen >= (sizeof(ulg) + 2*sizeof(dummyfn)) && init->inputfn)
+ G.input = init->inputfn;
+
+ if (init->structlen >= (sizeof(ulg) + 3*sizeof(dummyfn)) && init->pausefn)
+ G.mpause = init->pausefn;
-#ifndef __16BIT__
+ if (init->structlen >= (sizeof(ulg) + 4*sizeof(dummyfn)) && init->passwdfn)
+ G.decr_passwd = init->passwdfn;
-void UZ_EXP UzpFreeMemBuffer(UzpBuffer *retstr)
+ r = unzip(__G__ argc, argv);
+ DESTROYGLOBALS();
+ RETURN(r);
+}
+
+
+
+# ifndef __16BIT__
+
+void UZ_EXP UzpFreeMemBuffer( OFT( UzpBuffer *)retstr)
+# ifdef NO_PROTO
+ UzpBuffer *retstr;
+# endif /* def NO_PROTO */
{
if (retstr != NULL && retstr->strptr != NULL) {
- free(retstr->strptr);
+ izu_free(retstr->strptr);
retstr->strptr = NULL;
retstr->strlength = 0;
}
}
+# ifndef WINDLL
-
-#ifndef WINDLL
-
-static int UzpDLL_Init OF((zvoid *pG, UzpCB *UsrFuncts));
-
-static int UzpDLL_Init(pG, UsrFuncts)
-zvoid *pG;
-UzpCB *UsrFuncts;
+static int UzpDLL_Init( OFT( zvoid *)pG,
+ OFT( UzpCB *)UsrFuncts)
+# ifdef NO_PROTO
+ zvoid *pG;
+ UzpCB *UsrFuncts;
+# endif /* def NO_PROTO */
{
int (*dummyfn)();
}
-int UZ_EXP UzpUnzipToMemory(char *zip, char *file, UzpOpts *optflgs,
- UzpCB *UsrFuncts, UzpBuffer *retstr)
+int UZ_EXP UzpUnzipToMemory( OFT( char *)zip,
+ OFT( char *)file,
+ OFT( UzpOpts *)optflgs,
+ OFT( UzpCB *)UsrFuncts,
+ OFT( UzpBuffer *)retstr)
+# ifdef NO_PROTO
+ char *zip;
+ char *file;
+ UzpOpts *optflgs;
+ UzpCB *UsrFuncts;
+ UzpBuffer *retstr;
+# endif /* def NO_PROTO */
{
int r;
-#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO))
+# if defined(WINDLL) && !defined(CRTL_CP_IS_ISO)
char *intern_zip, *intern_file;
-#endif
+# endif /* defined(WINDLL) && !defined(CRTL_CP_IS_ISO) */
CONSTRUCTGLOBALS();
-#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO))
- intern_zip = (char *)malloc(strlen(zip)+1);
+# if defined(WINDLL) && !defined(CRTL_CP_IS_ISO)
+ intern_zip = (char *)izu_malloc(strlen(zip)+1);
if (intern_zip == NULL) {
DESTROYGLOBALS();
return PK_MEM;
}
- intern_file = (char *)malloc(strlen(file)+1);
+ intern_file = (char *)izu_malloc(strlen(file)+1);
if (intern_file == NULL) {
DESTROYGLOBALS();
- free(intern_zip);
+ izu_free(intern_zip);
return PK_MEM;
}
ISO_TO_INTERN(zip, intern_zip);
ISO_TO_INTERN(file, intern_file);
-# define zip intern_zip
-# define file intern_file
-#endif
+# define zip intern_zip
+# define file intern_file
+# endif /* defined(WINDLL) && !defined(CRTL_CP_IS_ISO) */
/* Copy those options that are meaningful for UzpUnzipToMemory, instead of
* a simple "memcpy(G.UzO, optflgs, sizeof(UzpOpts));"
*/
r = (unzipToMemory(__G__ zip, file, retstr) <= PK_WARN);
DESTROYGLOBALS();
-#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO))
-# undef file
-# undef zip
- free(intern_file);
- free(intern_zip);
-#endif
+# if defined(WINDLL) && !defined(CRTL_CP_IS_ISO)
+# undef file
+# undef zip
+ izu_free(intern_file);
+ izu_free(intern_zip);
+# endif /* defined(WINDLL) && !defined(CRTL_CP_IS_ISO) */
if (!r && retstr->strlength) {
- free(retstr->strptr);
+ izu_free(retstr->strptr);
retstr->strptr = NULL;
}
return r;
}
-#endif /* !WINDLL */
-#endif /* !__16BIT__ */
-
+# endif /* ndef WINDLL */
+# endif /* ndef __16BIT__ */
+# ifdef OS2DLL
-#ifdef OS2DLL
-
-int UZ_EXP UzpFileTree(char *name, cbList(callBack), char *cpInclude[],
- char *cpExclude[])
+int UZ_EXP UzpFileTree( OFT( char *)name,
+ OFT( cbList( callBack)), /* Defective? */
+ OFT( char **)cpInclude,
+ OFT( char **)cpExclude)
+# ifdef NO_PROTO
+ char *name;
+ cbList(callBack);
+ char **cpInclude;
+ char **cpExclude;
+# endif /* def NO_PROTO */
{
int r;
uO.qflag = 2;
uO.vflag = 1;
uO.C_flag = 1;
- G.wildzipfn = name;
+ G.wildzipfn = (char *)izu_malloc( strlen( name)+ 1);
+ strcpy( G.wildzipfn, name);
G.process_all_files = TRUE;
if (cpInclude) {
char **ptr = cpInclude;
return r;
}
-#endif /* OS2DLL */
-#endif /* !SFX */
-
+# endif /* def OS2DLL */
+# endif /* ndef SFX */
}
-#ifndef SFX
+# ifndef SFX
-int unzipToMemory(__GPRO__ char *zip, char *file, UzpBuffer *retstr)
+int unzipToMemory( __G__ zip, file, retstr)
+ __GDEF
+ char *zip;
+ char *file;
+ UzpBuffer *retstr;
{
int r;
char *incname[2];
G.process_all_files = FALSE;
G.extract_flag = TRUE;
uO.qflag = 2;
- G.wildzipfn = zip;
+ G.wildzipfn = (char *)izu_malloc( strlen( zip)+ 1);
+ strcpy( G.wildzipfn, zip);
G.pfnames = incname;
incname[0] = file;
retstr->strptr = (char *)G.redirect_buffer;
retstr->strlength = G.redirect_size;
}
- return r; /* returns `PK_???' error values */
+ return r; /* returns PK_??? error values */
}
-#endif /* !SFX */
+# endif /* ndef SFX */
/*
With the advent of 64 bit support, for now I am assuming that
will simply not be enough memory to handle it, and am returning
FALSE.
*/
-int redirect_outfile(__G)
+int redirect_outfile( __G)
__GDEF
{
-#ifdef ZIP64_SUPPORT
- __int64 check_conversion;
-#endif
+# ifdef ZIP64_SUPPORT
+ z_uint8 check_conversion;
+# endif
if (G.redirect_size != 0 || G.redirect_buffer != NULL)
return FALSE;
-#ifndef NO_SLIDE_REDIR
+# ifndef NO_SLIDE_REDIR
G.redirect_slide = !G.pInfo->textmode;
-#endif
-#if (lenEOL != 1)
+# endif
+# if lenEOL != 1
if (G.pInfo->textmode) {
G.redirect_size = (ulg)(G.lrec.ucsize * lenEOL);
if (G.redirect_size < G.lrec.ucsize)
G.redirect_size = (ulg)((G.lrec.ucsize > (ulg)-2L) ?
G.lrec.ucsize : -2L);
-#ifdef ZIP64_SUPPORT
+# ifdef ZIP64_SUPPORT
check_conversion = G.lrec.ucsize * lenEOL;
-#endif
+# endif /* def ZIP64_SUPPORT */
} else
-#endif
+# endif /* lenEOL != 1 */
{
G.redirect_size = (ulg)G.lrec.ucsize;
-#ifdef ZIP64_SUPPORT
- check_conversion = (__int64)G.lrec.ucsize;
-#endif
+# ifdef ZIP64_SUPPORT
+ check_conversion = (z_uint8)G.lrec.ucsize;
+# endif /* def ZIP64_SUPPORT */
}
-#ifdef ZIP64_SUPPORT
- if ((__int64)G.redirect_size != check_conversion)
+# ifdef ZIP64_SUPPORT
+ if ((z_uint8)G.redirect_size != check_conversion)
return FALSE;
-#endif
+# endif /* def ZIP64_SUPPORT */
-#ifdef __16BIT__
+# ifdef __16BIT__
if ((ulg)((extent)G.redirect_size) != G.redirect_size)
return FALSE;
-#endif
-#ifdef OS2
+# endif /* def __16BIT__ */
+# ifdef OS2
DosAllocMem((void **)&G.redirect_buffer, G.redirect_size+1,
PAG_READ|PAG_WRITE|PAG_COMMIT);
G.redirect_pointer = G.redirect_buffer;
-#else
+# else /* def OS2 */
G.redirect_pointer =
- G.redirect_buffer = malloc((extent)(G.redirect_size+1));
-#endif
+ G.redirect_buffer = (uch *)izu_malloc((extent)(G.redirect_size+1));
+# endif /* def OS2 [else] */
if (!G.redirect_buffer)
return FALSE;
G.redirect_pointer[G.redirect_size] = '\0';
-int writeToMemory(__GPRO__ ZCONST uch *rawbuf, extent size)
+# ifdef NO_PROTO
+int writeToMemory( __G__ rawbuf, size)
+ __GDEF
+ ZCONST uch *rawbuf;
+ extent size;
+# else /* def NO_PROTO */
+int writeToMemory( __GPRO__ ZCONST uch *rawbuf, extent size)
+# endif /* def NO_PROTO [else] */
{
int errflg = FALSE;
-
-int close_redirect(__G)
+int close_redirect( __G)
__GDEF
{
if (G.pInfo->textmode) {
*G.redirect_pointer = '\0';
G.redirect_size = (ulg)(G.redirect_pointer - G.redirect_buffer);
if ((G.redirect_buffer =
- realloc(G.redirect_buffer, G.redirect_size + 1)) == NULL) {
+ (uch *)izu_realloc(G.redirect_buffer, G.redirect_size + 1)) == NULL) {
G.redirect_size = 0;
return EOF;
}
-
-#ifndef SFX
-#ifndef __16BIT__
-#ifndef WINDLL
+# ifndef SFX
+# ifndef __16BIT__
+# ifndef WINDLL
/* Purpose: Determine if file in archive contains the string szSearch
matching occurrence of the pattern.
*/
-int UZ_EXP UzpGrep(char *archive, char *file, char *pattern, int cmd,
- int SkipBin, UzpCB *UsrFuncts)
+int UZ_EXP UzpGrep( OFT( char *)archive,
+ OFT( char *)file,
+ OFT( char *)pattern,
+ OFT( int) cmd,
+ OFT( int) SkipBin,
+ OFT( UzpCB *)UsrFuncts)
+# ifdef NO_PROTO
+ char *archive;
+ char *file;
+ char *pattern;
+ int cmd;
+ int SkipBin;
+ UzpCB *UsrFuncts;
+# endif /* def NO_PROTO */
{
int retcode = FALSE, compare;
ulg i, j, patternLen, buflen;
(retstr.strptr[i] != 0x09))
{
/* OK, we now think we have a binary file of some sort */
- free(retstr.strptr);
+ izu_free(retstr.strptr);
return FALSE;
}
}
patternLen = strlen(pattern);
if (retstr.strlength < patternLen) {
- free(retstr.strptr);
+ izu_free(retstr.strptr);
return FALSE;
}
- sz = malloc(patternLen + 3); /* add two in case doing whole words only */
+ sz = izu_malloc(patternLen + 3); /* +2 in case doing whole words only */
if (cmd > 1) {
strcpy(sz, " ");
strcat(sz, pattern);
}
}
- free(sz);
- free(retstr.strptr);
+ izu_free(sz);
+ izu_free(retstr.strptr);
return retcode;
}
-#endif /* !WINDLL */
-#endif /* !__16BIT__ */
+# endif /* ndef WINDLL */
+# endif /* ndef __16BIT__ */
-int UZ_EXP UzpValidate(char *archive, int AllCodes)
+int UZ_EXP UzpValidate( OFT( char *)archive,
+ OFT( int) AllCodes)
+# ifdef NO_PROTO
+ char *archive;
+ int AllCodes;
+# endif /* def NO_PROTO */
{
int retcode;
CONSTRUCTGLOBALS();
uO.overwrite_none = 0;
G.extract_flag = (!uO.zipinfo_mode &&
!uO.cflag && !uO.tflag && !uO.vflag && !uO.zflag
-#ifdef TIMESTAMP
+# ifdef TIMESTAMP
&& !uO.T_flag
-#endif
+# endif
);
uO.qflag = 2; /* turn off all messages */
G.fValidate = TRUE;
- G.pfnames = (char **)&fnames[0]; /* assign default filename vector */
if (archive == NULL) { /* something is screwed up: no filename */
DESTROYGLOBALS();
goto exit_retcode;
}
- G.wildzipfn = (char *)malloc(FILNAMSIZ);
- strcpy(G.wildzipfn, archive);
-#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO))
+ G.wildzipfn = (char *)izu_malloc( FILNAMSIZ);
+ strcpy( G.wildzipfn, archive);
+# if defined(WINDLL) && !defined(CRTL_CP_IS_ISO)
_ISO_INTERN(G.wildzipfn);
-#endif
+# endif
-#ifdef WINDLL
+# ifdef WINDLL
Wiz_NoPrinting(TRUE);
-#endif
+# endif
G.process_all_files = TRUE; /* for speed */
if (setjmp(dll_error_return) != 0) {
-#ifdef WINDLL
+# ifdef WINDLL
Wiz_NoPrinting(FALSE);
-#endif
- free(G.wildzipfn);
+# endif
+ izu_free(G.wildzipfn);
DESTROYGLOBALS();
retcode = PK_BADERR;
goto exit_retcode;
retcode = process_zipfiles(__G);
- free(G.wildzipfn);
-#ifdef WINDLL
+ izu_free(G.wildzipfn);
+# ifdef WINDLL
Wiz_NoPrinting(FALSE);
-#endif
+# endif
DESTROYGLOBALS();
/* PK_WARN == 1 and PK_FIND == 11. When we are just looking at an
return FALSE;
}
-#endif /* !SFX */
-#endif /* DLL */
+# endif /* ndef SFX */
+
+#else /* def DLL */
+
+/* Dummy declaration to quiet compilers. */
+int dummy_api;
+
+#endif /* def DLL [else] */
--- /dev/null
+/*
+ Copyright (c) 1990-2014 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+/*---------------------------------------------------------------------------
+
+ api.h
+
+ ---------------------------------------------------------------------------*/
+
+#ifndef __API_H
+# define __API_H
+
+# ifdef DLL /* This source file supplies DLL-only interface code. */
+
+# if !defined( POCKET_UNZIP) && !defined( WINDLL)
+
+# include <setjmp.h>
+
+extern jmp_buf dll_error_return;
+# endif /* ndef WINDLL */
+
+# endif /* def DLL */
+
+#endif /* ndef __API_H */
/*
- Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
#include "unzvers.h"
+/* 2013-01-16 SMS.
+ * Changed APIhelp() from using argc and argv[1] to using a plain char*
+ * argument, for compatibility with the new command-line parser.
+ * Converted tab characters to spaces in message text.
+ * Removed the BEL code from the end of the "not a documented command"
+ * message.
+ * Added text for UzpMainI().
+ * Added NULL termination to example argv[] arrays.
+ */
+
+
APIDocStruct APIDoc[] = {
{
- "UZPVERSION" , "UzpVersion" ,
- "UzpVer *UzpVersion(void);",
- "Get version numbers of the API and the underlying UnZip code.\n\n"
- "\t\tThis is used for comparing the version numbers of the run-time\n"
- "\t\tDLL code with those expected from the unzip.h at compile time.\n"
- "\t\tIf the version numbers do not match, there may be compatibility\n"
- "\t\tproblems with further use of the DLL.\n\n"
- " Example:\t/* Check the major version number of the DLL code. */\n"
- "\t\tUzpVer *pVersion;\n"
- "\t\tpVersion = UzpVersion();\n"
- "\t\tif (pVersion->unzip.major != UZ_MAJORVER)\n"
- "\t\t fprintf(stderr, \"error: using wrong version of DLL\\n\");\n\n"
- "\t\tSee unzip.h for details and unzipstb.c for an example.\n"
+"UZPVERSION" , "UzpVersion" ,
+"UzpVer *UzpVersion(void);",
+"Get version numbers of the API and the underlying UnZip code.\n\n"
+" This is used for comparing the version numbers of the run-time\n"
+" DLL code with those expected from the unzip.h at compile time.\n"
+" If the version numbers do not match, there may be compatibility\n"
+" problems with further use of the DLL.\n\n"
+" Example: /* Check the major version number of the DLL code. */\n"
+" UzpVer *pVersion;\n"
+" pVersion = UzpVersion();\n"
+" if (pVersion->unzip.vmajor != UZ_MAJORVER)\n"
+" fprintf(stderr, \"error: using wrong version of DLL\\n\");\n\n"
+" See unzip.h for details and unzipstb.c for an example.\n"
+ },
+
+ {
+"UZPMAIN" , "UzpMain" ,
+"int UzpMain(int argc, char *argv[]);",
+"Provide a direct entry point to the command line interface.\n\n"
+" This is used by the UnZip stub but you can use it in your\n"
+" own program as well. Output is sent to stdout.\n"
+" 0 on return indicates success.\n\n"
+" Example: /* Extract 'test.zip' silently, junking paths. */\n"
+" char *argv[] = { \"-q\", \"-j\", \"test.zip\", NULL };\n"
+" int argc = 3;\n"
+" if (UzpMain(argc, argv))\n"
+" printf(\"error: unzip failed\\n\");\n\n"
+" See unzip.h for details.\n"
},
{
- "UZPMAIN" , "UzpMain" ,
- "int UzpMain(int argc, char *argv[]);",
- "Provide a direct entry point to the command line interface.\n\n"
- "\t\tThis is used by the UnZip stub but you can use it in your\n"
- "\t\town program as well. Output is sent to stdout.\n"
- "\t\t0 on return indicates success.\n\n"
- " Example:\t/* Extract 'test.zip' silently, junking paths. */\n"
- "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n"
- "\t\tint argc = 3;\n"
- "\t\tif (UzpMain(argc,argv))\n"
- "\t\t printf(\"error: unzip failed\\n\");\n\n"
- "\t\tSee unzip.h for details.\n"
+"UZPMAINI" , "UzpMainI" ,
+"int UzpMainI(int argc, char *argv[], UzpCB *init);",
+"Provide a direct entry point to the command line interface,\n"
+" optionally installing replacement I/O handler functions,\n"
+" including a password call-back function.\n\n"
+" As with UzpMain(), output is sent to stdout by default.\n"
+" 'InputFn *inputfn' is not yet implemented. 0 on return\n"
+" indicates success.\n\n"
+" 0 on return indicates success.\n\n"
+" Example: /* Extract 'test.zip' silently, junking paths. */\n"
+" char *argv[] = { \"-q\", \"-j\", \"test.zip\", NULL };\n"
+" int argc = 3;\n"
+" UzpCB user_funs =\n"
+" { (sizeof user_funs), NULL, NULL, NULL, MyUzpPassword, NULL };\n"
+" if (UzpMainI( argc, argv, &user_funs))\n"
+" printf(\"error: unzip failed\\n\");\n\n"
+" See unzip.h and libiz/izunzip_example.c for details.\n"
},
{
- "UZPALTMAIN" , "UzpAltMain" ,
- "int UzpAltMain(int argc, char *argv[], UzpInit *init);",
- "Provide a direct entry point to the command line interface,\n"
- "optionally installing replacement I/O handler functions.\n\n"
- "\t\tAs with UzpMain(), output is sent to stdout by default.\n"
- "\t\t`InputFn *inputfn' is not yet implemented. 0 on return\n"
- "\t\tindicates success.\n\n"
- " Example:\t/* Replace normal output and `more' functions. */\n"
- "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n"
- "\t\tint argc = 3;\n"
- "\t\tUzpInit init = { 16, MyMessageFn, NULL, MyPauseFn };\n"
- "\t\tif (UzpAltMain(argc,argv,&init))\n"
- "\t\t printf(\"error: unzip failed\\n\");\n\n"
- "\t\tSee unzip.h for details.\n"
+"UZPALTMAIN" , "UzpAltMain" ,
+"int UzpAltMain(int argc, char *argv[], UzpInit *init);",
+"Provide a direct entry point to the command line interface,\n"
+" optionally installing replacement I/O handler functions.\n\n"
+" As with UzpMain(), output is sent to stdout by default.\n"
+" 'InputFn *inputfn' is not yet implemented. 0 on return\n"
+" indicates success.\n\n"
+" Example: /* Replace normal output and 'more' functions. */\n"
+" char *argv[] = { \"-q\", \"-j\", \"test.zip\", NULL };\n"
+" int argc = 3;\n"
+" UzpInit init = { 16, MyMessageFn, NULL, MyPauseFn };\n"
+" if (UzpAltMain(argc, argv, &init))\n"
+" printf(\"error: unzip failed\\n\");\n\n"
+" See unzip.h for details.\n"
},
{
- "UZPUNZIPTOMEMORY", "UzpUnzipToMemory",
- "int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);",
- "Pass the name of the zip file and the name of the file\n"
- "\t\tyou wish to extract. UzpUnzipToMemory will create a\n"
- "\t\tbuffer and return it in *retstr; 0 on return indicates\n"
- "\t\tfailure.\n\n"
- "\t\tSee unzip.h for details.\n"
+"UZPUNZIPTOMEMORY", "UzpUnzipToMemory",
+"int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);",
+"Pass the name of the zip file and the name of the file\n"
+" you wish to extract. UzpUnzipToMemory will create a\n"
+" buffer and return it in *retstr; 0 on return indicates\n"
+" failure.\n\n"
+" See unzip.h for details.\n"
},
{
- "UZPFILETREE", "UzpFileTree",
- "int UzpFileTree(char *name, cbList(callBack),\n"
- "\t\t\tchar *cpInclude[], char *cpExclude[]);",
- "Pass the name of the zip file, a callback function, an\n"
- "\t\tinclude and exclude file list. UzpFileTree calls the\n"
- "\t\tcallback for each valid file found in the zip file.\n"
- "\t\t0 on return indicates failure.\n\n"
- "\t\tSee unzip.h for details.\n"
+"UZPFILETREE", "UzpFileTree",
+"int UzpFileTree(char *name, cbList(callBack),\n"
+" char *cpInclude[], char *cpExclude[]);",
+"Pass the name of the zip file, a callback function, an\n"
+" include and exclude file list. UzpFileTree calls the\n"
+" callback for each valid file found in the zip file.\n"
+" 0 on return indicates failure.\n\n"
+" See unzip.h for details.\n"
},
{ 0 }
APIDocStruct *doc;
char *fname;
{
- strcpy(slide, fname);
+ strcpy( (char *)slide, fname);
/* strupr(slide); non-standard */
- while (doc->compare && STRNICMP(doc->compare,slide,strlen(fname)))
+ while (doc->compare &&
+ STRNICMP( doc->compare, (char *)slide, strlen( fname)))
doc++;
if (!doc->compare)
return 0;
else
Info(slide, 0, ((char *)slide,
- " Function:\t%s\n\n Syntax:\t%s\n\n Purpose:\t%s",
+ " Function: %s\n\n Syntax: %s\n\n Purpose: %s",
doc->function, doc->syntax, doc->purpose));
return 1;
-void APIhelp(__G__ argc, argv)
+void APIhelp(__G__ fname)
__GDEF
- int argc;
- char **argv;
+ char *fname;
{
- if (argc > 1) {
- struct APIDocStruct *doc;
-
- if (function_help(__G__ APIDoc, argv[1]))
+ if (fname != NULL)
+ {
+ if (function_help(__G__ APIDoc, fname))
return;
#ifdef SYSTEM_API_DETAILS
- if (function_help(__G__ SYSTEM_API_DETAILS, argv[1]))
+ if (function_help(__G__ SYSTEM_API_DETAILS, fname))
return;
#endif
Info(slide, 0, ((char *)slide,
- "%s is not a documented command.\n\n\a", argv[1]));
+ "%s is not a documented command.\n\n", fname));
}
Info(slide, 0, ((char *)slide, "\
C functions: -- See unzip.h for details\n\
UzpVer *UzpVersion(void);\n\
int UzpMain(int argc, char *argv[]);\n\
+ int UzpMainI(int argc, char *argv[], UzpCB *init);\n\
int UzpAltMain(int argc, char *argv[], UzpInit *init);\n\
int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);\n\
int UzpFileTree(char *name, cbList(callBack),\n\
"\nFor more information, type 'unzip -A <function-name>'\n"));
}
-#endif /* API_DOC */
+#else /* def API_DOC */
+
+/* Dummy declaration to quiet compilers. */
+int dummy_apihelp;
+
+#endif /* def API_DOC [else] */
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
/* On UNIX (and compatible systems), "." and ".." are reserved for
/*
- Copyright (c) 1990-2004 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 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.
#endif
#define RESTORE_UIDGID
-/* Static variables that we have to add to Uz_Globs: */
+/* Static variables that we have to add to Uz_Globs. */
+
+#ifdef KFLAG
+# define UMASK_VAL mode_t umask_val;
+#else /* def KFLAG */
+# define UMASK_VAL
+#endif /* def KFLAG [else] */
+
#define SYSTEM_SPECIFIC_GLOBALS \
int created_dir, renamed_fullpath;\
char *rootpath, *buildpath, *end;\
ZCONST char *wildname;\
char *dirname, matchname[FILNAMSIZ];\
int rootlen, have_dirname, dirnamelen, notfirstcall;\
- zvoid *wild_dir;
+ zvoid *wild_dir;\
+ UMASK_VAL
/* created_dir, and renamed_fullpath are used by both mapname() and */
/* checkdir(). */
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
(based on beos/beos.c and unix/unix.c)
Contains: do_wild() <-- generic enough to put in fileio.c?
+ filtattr()
mapattr()
mapname()
checkdir()
#include <dirent.h>
#include <atheos/fs_attribs.h>
-static unsigned filtattr OF((__GPRO__ unsigned perms));
static uch *scanAtheOSexfield OF((const uch *ef_ptr, unsigned ef_len));
static int set_file_attrs( const char *, const unsigned char *, const off_t );
static void setAtheOSexfield OF((const char *path, uch *extra_field));
-
#ifndef S_ISUID
# define S_ISUID 0004000 /* set user id on execution */
#endif
/************************/
/* Function filtattr() */
/************************/
-/* This is used to clear or keep the SUID and GID bits on file permissions.
- * It's possible that a file in an archive could have one of these bits set
- * and, unknown to the person unzipping, could allow others to execute the
- * file as the user or group. The new option -K bypasses this check.
+/* For safety/security, clear SUID and SGID permission bits, unless -K
+ * was specified to allow their preservation.
+ * For safety/security (and consistency with the default behavior of
+ * "tar"), apply umask to archive permissions, unless -k was specified
+ * to preserve the archive permissions (always subject to -K, above).
*/
static unsigned filtattr(__G__ perms)
__GDEF
unsigned perms;
{
- /* keep setuid/setgid/tacky perms? */
+ /* Keep setuid/setgid/tacky perms? */
if (!uO.K_flag)
perms &= ~(S_ISUID | S_ISGID | S_ISVTX);
+#ifdef KFLAG
+ /* Apply umask to archive permissions? */
+ if (uO.kflag == 0)
+ perms &= ~G.umask_val;
+#endif /* def KFLAG */
+
+ /* Mask off any non-permission bits, and return the result. */
return (0xffff & perms);
} /* end function filtattr() */
-
-
/**********************/
/* Function mapattr() */
/**********************/
break;
} /* end switch (host-OS-created-by) */
- /* for originating systems with no concept of "group," "other," "system": */
- umask( (int)(tmp=umask(0)) ); /* apply mask to expanded r/w(/x) perms */
- G.pInfo->file_attr &= ~tmp;
+ /* For originating systems with no concept of "group", "other",
+ * "system", apply mask to expanded r/w(/x) permissions.
+ */
+ G.pInfo->file_attr &= ~G.umask_val;
return 0;
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
}
#ifndef NO_CHMOD
- /* set approx. dir perms (make sure can still read/write in dir) */
- if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr) | 0700))
- perror("chmod (directory attributes) error");
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ /* set approx. dir perms (make sure can still read/write in dir) */
+ if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr) | 0700))
+ perror("chmod (directory attributes) error");
+ }
#endif
/* set dir time (note trailing '/') */
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
/* On UNIX (and compatible systems), "." and ".." are reserved for
---------------------------------------------------------------------------*/
#ifndef NO_CHMOD
- if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
- perror("chmod (file attributes) error");
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
+ perror("chmod (file attributes) error");
+ }
#endif
} /* end function close_outfile() */
}
}
#ifndef NO_CHMOD
- if (chmod(d->fn, filtattr(__G__ UxAtt(d)->perms))) {
- Info(slide, 0x201, ((char *)slide,
- LoadFarString(DirlistChmodFailed), FnFilter1(d->fn)));
- /* perror("chmod (file attributes) error"); */
- if (!errval)
- errval = PK_WARN;
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ if (chmod(d->fn, filtattr(__G__ UxAtt(d)->perms))) {
+ Info(slide, 0x201, ((char *)slide,
+ LoadFarString(DirlistChmodFailed), FnFilter1(d->fn)));
+ /* perror("chmod (file attributes) error"); */
+ if (!errval)
+ errval = PK_WARN;
+ }
}
#endif /* !NO_CHMOD */
return errval;
SHELL = /bin/sh
# Punish those of you not running on SMP hardware...
-MAKE = make -j 4 -f beos/Makefile
+MAKE = make -f beos/Makefile
LOC=$(LOCAL_UNZIP) -DPASSWD_FROM_STDIN
AF=$(LOC)
LOBJS = $(OBJS)
OBJSDLL = $(OBJS) api$O
OBJX = unzipsfx$O crc32_$O crypt_$O extract_$O fileio_$O globals_$O \
- inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O $(BEOS_MAIN)
+ inflate_$O process_$O ttyio_$O ubz2err$O $M_$O match$O $(BEOS_MAIN)
LOBJX = $(OBJX)
OBJF = funzip$O crc32f$O cryptf$O globalsf$O inflatef$O ttyiof$O
UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
ifeq "$(WHAT)" "x86-gcc"
CC=gcc
LD=gcc
-CF=-O3 -mpentiumpro \
+CF=-O3 -march=pentiumpro -DUNIX \
-Wall -Wno-multichar -Wno-trigraphs \
- -ansi -I. -I/boot/develop/headers/be/support \
+ -I. -I/boot/develop/headers/be/support \
-I/boot/develop/headers/be/storage $(LOC)
LF=-o unzip
-LF2=-L/boot/develop/lib/x86 -lbe -lroot
+LF2=-L/boot/develop/lib/x86 -lbe -lroot -liconv
BEOS_MAIN=beosmain$O
TARGET=$(UNZIPS)
endif
ubz2err$O: ubz2err.c $(UNZIP_H)
$(CP) ubz2err.c ubz2err_.c
- $(CC) -c $(CF) -DSFX ubz2err_.c
+ $(CC) -c $(CF) -DSFX ubz2err_.c -o ubz2err$O
$(RM) ubz2err_.c
# funzip compilation section
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2012 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.
#define SYMLINKS
#define MAIN main_stub /* now that we're using a wrapper... */
-/* Static variables that we have to add to Uz_Globs: */
+/* Static variables that we have to add to Uz_Globs. */
+
+#ifdef KFLAG
+# define UMASK_VAL mode_t umask_val;
+#else /* def KFLAG */
+# define UMASK_VAL
+#endif /* def KFLAG [else] */
+
#define SYSTEM_SPECIFIC_GLOBALS \
int created_dir, renamed_fullpath;\
char *rootpath, *buildpath, *end;\
ZCONST char *wildname;\
char *dirname, matchname[FILNAMSIZ];\
int rootlen, have_dirname, dirnamelen, notfirstcall;\
- zvoid *wild_dir;
+ zvoid *wild_dir; \
+ UMASK_VAL
/* created_dir, and renamed_fullpath are used by both mapname() and */
/* checkdir(). */
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
/* and notfirstcall are used by do_wild(). */
+/* ISO/OEM (iconv) character conversion. */
+
+#define ICONV_MAPPING /* part of vanilla Haiku distribution */
+
+#ifdef ICONV_MAPPING
+
+# 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
+# define _ISO_INTERN( string) charset_to_intern( string, G.iso_cp)
+
+# ifdef _OEM_INTERN
+# undef _OEM_INTERN
+# endif
+# ifndef IZ_OEM2ISO_ARRAY
+# define IZ_OEM2ISO_ARRAY
+# endif
+# define _OEM_INTERN( string) charset_to_intern( string, G.oem_cp)
+
+/* Possible "const" type qualifier for arg 2 of iconv(). */
+# ifndef ICONV_ARG2
+# define ICONV_ARG2
+# endif /* ndef ICONV_ARG2 */
+
+#endif /* def ICONV_MAPPING */
+
#endif /* !__beocfg_h */
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
(based on unix/unix.c)
Contains: do_wild() <-- generic enough to put in fileio.c?
+ filtattr()
mapattr()
mapname()
checkdir()
#define UNZIP_INTERNAL
#include "unzip.h"
+#ifdef ICONV_MAPPING
+#include <iconv.h>
+#include <langinfo.h>
+#endif /* ICONV_MAPPING */
+
#include "beos.h"
#include <errno.h> /* Just make sure we've got a few things... */
#include <sys/types.h>
/* For the new post-DR8 file attributes */
#include <kernel/fs_attr.h>
-#include <support/byteorder.h>
+#include <support/ByteOrder.h>
#include <storage/Mime.h>
-static unsigned filtattr OF((__GPRO__ unsigned perms));
static uch *scanBeOSexfield OF((const uch *ef_ptr, unsigned ef_len));
static int set_file_attrs( const char *, const unsigned char *, const off_t );
static void setBeOSexfield OF((const char *path, uch *extra_field));
-
#ifndef S_ISUID
# define S_ISUID 0004000 /* set user id on execution */
#endif
/************************/
/* Function filtattr() */
/************************/
-/* This is used to clear or keep the SUID and SGID bits on file permissions.
- * It's possible that a file in an archive could have one of these bits set
- * and, unknown to the person unzipping, could allow others to execute the
- * file as the user or group. The new option -K bypasses this check.
+/* For safety/security, clear SUID and SGID permission bits, unless -K
+ * was specified to allow their preservation.
+ * For safety/security (and consistency with the default behavior of
+ * "tar"), apply umask to archive permissions, unless -k was specified
+ * to preserve the archive permissions (always subject to -K, above).
*/
static unsigned filtattr(__G__ perms)
__GDEF
unsigned perms;
{
- /* keep setuid/setgid/tacky perms? */
+ /* Keep setuid/setgid/tacky perms? */
if (!uO.K_flag)
perms &= ~(S_ISUID | S_ISGID | S_ISVTX);
+#ifdef KFLAG
+ /* Apply umask to archive permissions? */
+ if (uO.kflag == 0)
+ perms &= ~G.umask_val;
+#endif /* def KFLAG */
+
+ /* Mask off any non-permission bits, and return the result. */
return (0xffff & perms);
} /* end function filtattr() */
-
-
/**********************/
/* Function mapattr() */
/**********************/
break;
} /* end switch (host-OS-created-by) */
- /* for originating systems with no concept of "group," "other," "system": */
- umask( (int)(tmp=umask(0)) ); /* apply mask to expanded r/w(/x) perms */
- G.pInfo->file_attr &= ~tmp;
+ /* For originating systems with no concept of "group", "other",
+ * "system", apply mask to expanded r/w(/x) permissions.
+ */
+ G.pInfo->file_attr &= ~G.umask_val;
return 0;
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
}
#ifndef NO_CHMOD
- /* set approx. dir perms (make sure can still read/write in dir) */
- if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr) | 0700))
- perror("chmod (directory attributes) error");
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ /* set approx. dir perms (make sure can still read/write in dir) */
+ if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr) | 0700))
+ perror("chmod (directory attributes) error");
+ }
#endif
/* set dir time (note trailing '/') */
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
/* On UNIX (and compatible systems), "." and ".." are reserved for
---------------------------------------------------------------------------*/
#ifndef NO_CHMOD
- if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
- perror("chmod (file attributes) error");
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
+ perror("chmod (file attributes) error");
+ }
#endif
/* if -X option was specified and we have UID/GID info, restore it */
}
}
#ifndef NO_CHMOD
- if (chmod(d->fn, filtattr(__G__ UxAtt(d)->perms))) {
- Info(slide, 0x201, ((char *)slide, DirlistChmodFailed,
- FnFilter1(d->fn), strerror(errno)));
- if (!errval)
- errval = PK_WARN;
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ if (chmod(d->fn, filtattr(__G__ UxAtt(d)->perms))) {
+ Info(slide, 0x201, ((char *)slide, DirlistChmodFailed,
+ FnFilter1(d->fn), strerror(errno)));
+ if (!errval)
+ errval = PK_WARN;
+ }
}
#endif /* !NO_CHMOD */
return errval;
{
char *fullname;
char buff[PATH_MAX], cwd_buff[PATH_MAX];
- int retval;
+/* int retval; 2014-03-13 SMS. This function is "void". */
if( file[0] == '/' ) {
fullname = (char *)file;
fullname = buff;
}
- retval = update_mime_info( fullname, FALSE, TRUE, TRUE );
+ /* retval = */ update_mime_info( fullname, FALSE, TRUE, TRUE );
}
#endif
+
+
+/* ISO/OEM (iconv) character conversion. */
+
+#ifdef ICONV_MAPPING
+
+typedef struct {
+/* char *local_charset; */
+ char *local_lang;
+ char *archive_charset;
+} CHARSET_MAP;
+
+/* Was: A mapping of local <-> archive charsets used by default to convert
+ * filenames of DOS/Windows Zip archives. Currently very basic.
+ */
+/* Now: A mapping of environment language <-> archive charsets used by default
+ * to convert filenames of DOS/Windows Zip archives. Currently incomplete.
+ */
+
+/*
+ * static CHARSET_MAP dos_charset_map[] = {
+ * { "ANSI_X3.4-1968", "CP850" },
+ * { "ISO-8859-1", "CP850" },
+ * { "CP1252", "CP850" },
+ * { "UTF-8", "CP866" },
+ * { "KOI8-R", "CP866" },
+ * { "KOI8-U", "CP866" },
+ * { "ISO-8859-5", "CP866" }
+ * };
+ */
+
+static CHARSET_MAP dos_charset_map[] = {
+ { "C", "CP850" },
+ { "en", "CP850" },
+ /* a lot of latin1 not included, by default it will be "CP850" */
+ { "bs", "CP852" },
+ { "cs", "CP852" },
+ { "hr", "CP852" },
+ { "hsb", "CP852" },
+ { "hu", "CP852" },
+ { "pl", "CP852" },
+ { "ro", "CP852" },
+ { "sk", "CP852" },
+ { "sl", "CP852" },
+ { "ru", "CP866" },
+ { "be", "CP866" },
+ { "bg", "CP866" },
+ { "mk", "CP866" },
+ { "uk", "CP866" },
+ { "ar", "CP864" },
+ { "el", "CP869" },
+ { "he", "CP862" },
+ { "iw", "CP862" },
+ { "ku", "CP857" },
+ { "tr", "CP857" },
+ { "zh", "CP950" }, /* CP936 */
+ { "ja", "CP932" },
+ { "ko", "CP949" },
+ { "th", "CP874" },
+ { "da", "CP865" },
+ { "nb", "CP865" },
+ { "nn", "CP865" },
+ { "no", "CP865" },
+ { "is", "CP861" },
+ { "lt", "CP775" },
+ { "lv", "CP775" },
+};
+
+
+/* Try to guess the default value of G.oem_cp based on the current locale.
+ * G.iso_cp is left alone for now.
+ */
+void init_conversion_charsets( __G)
+ __GDEF
+{
+/*
+ * const char *local_charset;
+ * int i;
+ */
+ char *locale;
+ char *loc = NULL;
+
+ /* Make a guess only if G.oem_cp not already set. */
+/*
+ * if(*OEM_CP == '\0') {
+ * local_charset = nl_langinfo(CODESET);
+ * for (i = 0; i < sizeof(dos_charset_map)/sizeof(CHARSET_MAP); i++)
+ * if (!strcasecmp(local_charset, dos_charset_map[i].local_charset)) {
+ * strncpy(OEM_CP, dos_charset_map[i].archive_charset,
+ * sizeof(OEM_CP));
+ * break;
+ * }
+ * }
+ */
+
+ if (*G.oem_cp != '\0')
+ return;
+
+ locale = getenv("LC_ALL");
+ if (!locale)
+ locale = getenv("LANG");
+
+ if (locale && (loc = malloc(strlen(locale) + 1)) != NULL)
+ {
+ char *p;
+ int i;
+
+ strcpy(loc, locale);
+
+ /* Extract language part */
+ p = strchr(loc, '.');
+ if (p)
+ *p = '\0';
+
+ /* Extract main language part */
+ p = strchr(loc, '_');
+ if (p)
+ *p = '\0';
+
+ for (i = 0; i < sizeof(dos_charset_map)/sizeof(CHARSET_MAP); i++)
+ {
+ if (!strcmp(loc, dos_charset_map[i].local_lang))
+ {
+ strncpy( G.oem_cp, dos_charset_map[i].archive_charset,
+ sizeof( G.oem_cp));
+ break;
+ }
+ }
+ /* 2012-11-27 SMS. */
+ free( loc);
+ }
+
+ if (*G.oem_cp == '\0') /* Set Default one. */
+ strncpy( G.oem_cp, "CP850", sizeof( G.oem_cp));
+}
+
+/* Convert a string from one encoding to the current locale using iconv().
+ * Be as non-intrusive as possible. If error is encountered during
+ * convertion just leave the string intact.
+ */
+void charset_to_intern(char *string, char *from_charset)
+{
+ iconv_t cd;
+ char *buf;
+ char *d;
+ const char *local_charset;
+ ICONV_ARG2 char *s;
+ size_t buflen;
+ size_t dlen;
+ size_t slen;
+
+ if (*from_charset == '\0')
+ return;
+
+ buf = NULL;
+ local_charset = nl_langinfo(CODESET);
+
+ if ((cd = iconv_open(local_charset, from_charset)) == (iconv_t)-1)
+ return;
+
+ slen = strlen(string);
+ s = string;
+ dlen = buflen = 2 * slen;
+ d = buf = malloc(buflen + 1);
+ if (d)
+ {
+ memset( buf, 0, buflen);
+ if(iconv(cd, &s, &slen, &d, &dlen) != (size_t)-1)
+ strncpy(string, buf, buflen);
+ free(buf);
+ }
+ iconv_close(cd);
+}
+
+#endif /* def ICONV_MAPPING */
ZCONST char Far ExclFilenameNotMatched[] =
"caution: excluded filename not matched: %s\n";
+ZCONST char Far ExtractMsg[] =
+ "%8sing: %-22s %s%s";
+
#ifdef VMS
ZCONST char Far ReportMsg[] = "\
(please check that you have transferred or created the zipfile in the\n\
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
/* Preprocess with -DNO_UNDERLINE if your C compiler does not prefix
* external symbols with an underline character '_'.
*/
-#if defined(NO_UNDERLINE) || defined(__ELF__)
+# if defined(NO_UNDERLINE) || defined(__ELF__)
# define _crc32 crc32
# define _get_crc_table get_crc_table
-#endif
+# endif
/* Use 16-byte alignment if your assembler supports it. Warning: gas
* uses a log(x) parameter (.align 4 means 16-byte alignment). On SVR4
* the parameter is a number of bytes.
*/
-#ifndef ALIGNMENT
+# ifndef ALIGNMENT
# define ALIGNMENT .align 4,0x90
-#endif
+# endif
-#if defined(i386) || defined(_i386) || defined(_I386) || defined(__i386)
+# if defined(i386) || defined(_i386) || defined(_I386) || defined(__i386)
/* This version is for 386 Unix, OS/2, MSDOS in 32 bit mode (gcc & gas).
* Warning: it uses the AT&T syntax: mov source,dest
.file "crc_i386.S"
-#if !defined(PRE_686) && !defined(__686)
- /* Optimize for Pentium Pro and compatible CPUs by default. */
-# define __686
-#endif
+# if !defined(PRE_686) && !defined(__686)
+ /* Optimize for Pentium Pro and compatible CPUs by default. */
+# define __686
+# endif
-#if defined(NO_STD_STACKFRAME) && defined(USE_STD_STACKFRAME)
-# undef USE_STACKFRAME
-#else
- /* The default is to use standard stack frame entry, because it
- * results in smaller code!
- */
-# ifndef USE_STD_STACKFRAME
+# if defined(NO_STD_STACKFRAME) && defined(USE_STD_STACKFRAME)
+# undef USE_STACKFRAME
+# else
+ /* The default is to use standard stack frame entry, because it
+ * results in smaller code!
+ */
+# ifndef USE_STD_STACKFRAME
# define USE_STD_STACKFRAME
+# endif
# endif
-#endif
-#ifdef USE_STD_STACKFRAME
-# define _STD_ENTRY pushl %ebp ; movl %esp,%ebp
-# define arg1 8(%ebp)
-# define arg2 12(%ebp)
-# define arg3 16(%ebp)
-# define _STD_LEAVE popl %ebp
-#else /* !USE_STD_STACKFRAME */
-# define _STD_ENTRY
-# define arg1 24(%esp)
-# define arg2 28(%esp)
-# define arg3 32(%esp)
-# define _STD_LEAVE
-#endif /* ?USE_STD_STACKFRAME */
+# ifdef USE_STD_STACKFRAME
+# define _STD_ENTRY pushl %ebp ; movl %esp,%ebp
+# define arg1 8(%ebp)
+# define arg2 12(%ebp)
+# define arg3 16(%ebp)
+# define _STD_LEAVE popl %ebp
+# else /* !USE_STD_STACKFRAME */
+# define _STD_ENTRY
+# define arg1 24(%esp)
+# define arg2 28(%esp)
+# define arg3 32(%esp)
+# define _STD_LEAVE
+# endif /* ?USE_STD_STACKFRAME */
/*
* These two (three) macros make up the loop body of the CRC32 cruncher.
* ebx : index into crc_table array
* (requires upper three bytes = 0 when __686 is undefined)
*/
-#ifndef __686 /* optimize for 386, 486, Pentium */
-#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\
+# ifndef __686 /* optimize for 386, 486, Pentium */
+# define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\
movb %al, %bl ;/* tmp = c & 0xFF */\
shrl $8, %eax ;/* c = (c >> 8) */\
xorl (%edi, %ebx, 4), %eax ;/* c ^= table[tmp] */
-#else /* __686 : optimize for Pentium Pro and compatible CPUs */
-#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\
+# else /* __686 : optimize for Pentium Pro and compatible CPUs */
+# define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\
movzbl %al, %ebx ;/* tmp = c & 0xFF */\
shrl $8, %eax ;/* c = (c >> 8) */\
xorl (%edi, %ebx, 4), %eax ;/* c ^=table[tmp] */
-#endif /* ?__686 */
+# endif /* ?__686 */
-#define Do_CRC_byte /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\
+# define Do_CRC_byte /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\
xorb (%esi), %al ;/* c ^= *buf */\
incl %esi ;/* buf++ */\
Do_CRC
-#define Do_CRC_byteof(ofs) /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\
+# define Do_CRC_byteof(ofs) /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\
xorb ofs(%esi), %al ;/* c ^= *buf */\
incl %esi ;/* buf++ */\
Do_CRC
-#ifndef NO_32_BIT_LOADS
-# ifdef IZ_CRCOPTIM_UNFOLDTBL
- /* the edx register is needed in crc calculation */
-# define SavLen arg3
-# define UpdCRC_lword \
+# ifndef NO_32_BIT_LOADS
+# ifdef IZ_CRCOPTIM_UNFOLDTBL
+ /* the edx register is needed in crc calculation */
+# define SavLen arg3
+# define UpdCRC_lword \
movzbl %al, %ebx ; \
movl 3072(%edi,%ebx,4), %edx ; \
movzbl %ah, %ebx ; \
xorl 1024(%edi,%ebx,4), %edx ; \
movl (%edi,%eax,4), %eax ; \
xorl %edx,%eax ;
-# define UpdCRC_lword_sh(dwPtrIncr) \
+# define UpdCRC_lword_sh(dwPtrIncr) \
movzbl %al, %ebx ; \
movl 3072(%edi,%ebx,4), %edx ; \
movzbl %ah, %ebx ; \
xorl 1024(%edi,%ebx,4), %edx ; \
movl (%edi,%eax,4),%eax ; \
xorl %edx,%eax ;
-# else /* !IZ_CRCOPTIM_UNFOLDTBL */
- /* the edx register is not needed anywhere else */
-# define SavLen %edx
-# define UpdCRC_lword \
+# else /* !IZ_CRCOPTIM_UNFOLDTBL */
+ /* the edx register is not needed anywhere else */
+# define SavLen %edx
+# define UpdCRC_lword \
Do_CRC \
Do_CRC \
Do_CRC \
Do_CRC
-# define UpdCRC_lword_sh(dwPtrIncr) \
+# define UpdCRC_lword_sh(dwPtrIncr) \
Do_CRC \
Do_CRC \
addl $4*(dwPtrIncr), %esi ;/* ((ulg *)buf)++ */\
Do_CRC \
Do_CRC
-# endif /* ?IZ_CRCOPTIM_UNFOLDTBL */
-#define Do_CRC_lword \
+# endif /* ?IZ_CRCOPTIM_UNFOLDTBL */
+# define Do_CRC_lword \
xorl (%esi), %eax ;/* c ^= *(ulg *)buf */\
UpdCRC_lword_sh(1) /* ... ((ulg *)buf)++ */
-#define Do_CRC_4lword \
+# define Do_CRC_4lword \
xorl (%esi), %eax ;/* c ^= *(ulg *)buf */\
UpdCRC_lword \
xorl 4(%esi), %eax ;/* c ^= *((ulg *)buf+1) */\
UpdCRC_lword \
xorl 12(%esi), %eax ;/* c ^= *((ulg *)buf]+3 */\
UpdCRC_lword_sh(4) /* ... ((ulg *)buf)+=4 */
-#endif /* !NO_32_BIT_LOADS */
+# endif /* !NO_32_BIT_LOADS */
.text
call _get_crc_table
movl %eax, %edi
movl arg1, %eax /* 1st arg: ulg crc */
-#ifndef __686
+# ifndef __686
subl %ebx, %ebx /* ebx=0; bl usable as dword */
-#endif
+# endif
movl arg3, %ecx /* 3rd arg: extent len */
notl %eax /* > c = ~crc; */
testl %ecx, %ecx
-#ifndef NO_UNROLLED_LOOPS
+# ifndef NO_UNROLLED_LOOPS
jz .L_bail
-# ifndef NO_32_BIT_LOADS
+# ifndef NO_32_BIT_LOADS
/* Assert now have positive length */
.L_align_loop:
testl $3, %esi /* Align buf on lword boundary */
decl %ecx
jnz .L_align_loop
.L_aligned_now:
-# endif /* !NO_32_BIT_LOADS */
+# endif /* !NO_32_BIT_LOADS */
movl %ecx, SavLen /* save current value of len */
shrl $4, %ecx /* ecx = len / 16 */
jz .L_No_Sixteens
/* align loop head at start of 486 internal cache line !! */
ALIGNMENT
.L_Next_Sixteen:
-# ifndef NO_32_BIT_LOADS
+# ifndef NO_32_BIT_LOADS
Do_CRC_4lword
-# else /* NO_32_BIT_LOADS */
+# else /* NO_32_BIT_LOADS */
Do_CRC_byteof(0)
Do_CRC_byteof(1)
Do_CRC_byteof(2)
Do_CRC_byteof(14)
Do_CRC_byteof(15)
addl $16,%esi ;/* buf += 16 */
-# endif /* ?NO_32_BIT_LOADS */
+# endif /* ?NO_32_BIT_LOADS */
decl %ecx
jnz .L_Next_Sixteen
.L_No_Sixteens:
movl SavLen, %ecx
andl $15, %ecx /* ecx = len % 16 */
-# ifndef NO_32_BIT_LOADS
+# ifndef NO_32_BIT_LOADS
shrl $2,%ecx /* ecx = len / 4 */
jz .L_No_Fours
.L_Next_Four:
.L_No_Fours:
movl SavLen,%ecx
andl $3,%ecx /* ecx = len % 4 */
-# endif /* !NO_32_BIT_LOADS */
-#endif /* !NO_UNROLLED_LOOPS */
+# endif /* !NO_32_BIT_LOADS */
+# endif /* !NO_UNROLLED_LOOPS */
jz .L_bail /* > if (len) */
/* align loop head at start of 486 internal cache line !! */
ALIGNMENT
_STD_LEAVE
ret
-#else
+# else
error: this asm version is for 386 only
-#endif /* i386 || _i386 || _I386 || __i386 */
+# endif /* i386 || _i386 || _I386 || __i386 */
#endif /* !USE_ZLIB && !CRC_TABLE_ONLY */
+
+
+/* Exec Shield. */
+#if defined( __ELF__) && defined( __linux__)
+.section .note.GNU-stack, "", @progbits
+.previous
+#endif /* defined( __ELF__) && defined( __linux__) */
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2005-Feb-10 or later
- (the contents of which are also included in (un)zip.h) for terms of use.
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
version without encryption capabilities).
*/
-#define ZCRYPT_INTERNAL
+/*
+ crypt.c now includes part of the AES_WG encryption implementation (in
+ IZ_CRYPT_AES_WG blocks). This code is provided under the Info-ZIP
+ license. If this code enabled, it uses the Gladman AES code (or
+ equivalent), which is distributed separately.
+ */
+
+#define ZCRYPT_INTERNAL /* Ensure <windows.h>, where applicable. */
+
#include "zip.h"
-#include "crypt.h"
-#include "ttyio.h"
+#include "crypt.h" /* Get CRYPT defined as desired. */
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
-#ifndef FALSE
+# include "ttyio.h"
+
+# ifndef FALSE
# define FALSE 0
-#endif
-
-#ifdef ZIP
- /* For the encoding task used in Zip (and ZipCloak), we want to initialize
- the crypt algorithm with some reasonably unpredictable bytes, see
- the crypthead() function. The standard rand() library function is
- used to supply these `random' bytes, which in turn is initialized by
- a srand() call. The srand() function takes an "unsigned" (at least 16bit)
- seed value as argument to determine the starting point of the rand()
- pseudo-random number generator.
- This seed number is constructed as "Seed = Seed1 .XOR. Seed2" with
- Seed1 supplied by the current time (= "(unsigned)time()") and Seed2
- as some (hopefully) nondeterministic bitmask. On many (most) systems,
- we use some "process specific" number, as the PID or something similar,
- but when nothing unpredictable is available, a fixed number may be
- sufficient.
- NOTE:
- 1.) This implementation requires the availability of the following
- standard UNIX C runtime library functions: time(), rand(), srand().
- On systems where some of them are missing, the environment that
- incorporates the crypt routines must supply suitable replacement
- functions.
- 2.) It is a very bad idea to use a second call to time() to set the
- "Seed2" number! In this case, both "Seed1" and "Seed2" would be
- (almost) identical, resulting in a (mostly) "zero" constant seed
- number passed to srand().
-
- The implementation environment defined in the "zip.h" header should
- supply a reasonable definition for ZCR_SEED2 (an unsigned number; for
- most implementations of rand() and srand(), only the lower 16 bits are
- significant!). An example that works on many systems would be
- "#define ZCR_SEED2 (unsigned)getpid()".
- The default definition for ZCR_SEED2 supplied below should be regarded
- as a fallback to allow successful compilation in "beta state"
- environments.
- */
+# endif
+
+# ifdef ZIP
+/* Implementation notes on traditional zip (weak) encryption.
+ *
+ * For the encoding task used in Zip (and ZipCloak), we want to initialize
+ * the crypt algorithm with some reasonably unpredictable bytes; see
+ * the crypthead() function. The standard rand() library function is
+ * used to supply these `random' bytes, which in turn is initialized by
+ * a srand() call. The srand() function takes an "unsigned" (at least 16bit)
+ * seed value as argument to determine the starting point of the rand()
+ * pseudo-random number generator.
+ *
+ * This seed number is constructed as "Seed = Seed1 .XOR. Seed2" with
+ * Seed1 supplied by the current time (= "(unsigned)time()") and Seed2
+ * as some (hopefully) nondeterministic bitmask. On many (most) systems,
+ * we use some process-specific number, as the PID or something similar,
+ * but when nothing unpredictable is available, a fixed number may be
+ * sufficient.
+ *
+ * NOTE:
+ * 1.) This implementation requires the availability of the following
+ * standard UNIX C runtime library functions: time(), rand(), srand().
+ * On systems where some of them are missing, the environment that
+ * incorporates the crypt routines must supply suitable replacement
+ * functions.
+ * 2.) It is a very bad idea to use a second call to time() to set the
+ * "Seed2" number! In this case, both "Seed1" and "Seed2" would be
+ * (almost) identical, resulting in a (mostly) "zero" constant seed
+ * number passed to srand().
+ *
+ * The implementation environment defined in the "zip.h" header should
+ * supply a reasonable definition for ZCR_SEED2 (an unsigned number; for
+ * most implementations of rand() and srand(), only the lower 16 bits are
+ * significant!). An example that works on many systems would be
+ * "#define ZCR_SEED2 (unsigned)getpid()".
+ * The default definition for ZCR_SEED2 supplied below should be regarded
+ * as a fallback to allow successful compilation in "beta state"
+ * environments.
+ */
+
# include <time.h> /* time() function supplies first part of crypt seed */
/* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2
-# define ZCR_SEED2 (unsigned)3141592654L /* use PI as default pattern */
+# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif
# ifdef GLOBAL /* used in Amiga system headers, maybe others too */
-# undef GLOBAL
+# undef GLOBAL
# endif
-# define GLOBAL(g) g
-#else /* !ZIP */
-# define GLOBAL(g) G.g
-#endif /* ?ZIP */
+# define GLOBAL(g) g /* Zip global reference. */
+# else /* def ZIP */
+# define GLOBAL(g) G.g /* UnZip global reference. */
+# endif /* def ZIP [else] */
-#ifdef UNZIP
+# ifdef UNZIP
/* char *key = (char *)NULL; moved to globals.h */
# ifndef FUNZIP
- local int testp OF((__GPRO__ ZCONST uch *h));
- local int testkey OF((__GPRO__ ZCONST uch *h, ZCONST char *key));
-# endif
-#endif /* UNZIP */
-
-#ifndef UNZIP /* moved to globals.h for UnZip */
-# ifndef Z_UINT4_DEFINED
-# if !defined(NO_LIMITS_H)
-# if (defined(UINT_MAX) && (UINT_MAX == 0xffffffffUL))
- typedef unsigned int z_uint4;
-# define Z_UINT4_DEFINED
-# else
-# if (defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL))
- typedef unsigned long z_uint4;
-# define Z_UINT4_DEFINED
-# else
-# if (defined(USHRT_MAX) && (USHRT_MAX == 0xffffffffUL))
- typedef unsigned short z_uint4;
-# define Z_UINT4_DEFINED
-# endif
-# endif
-# endif
-# endif /* !NO_LIMITS_H */
-# endif /* !Z_UINT4_DEFINED */
-# ifndef Z_UINT4_DEFINED
- typedef ulg z_uint4;
-# define Z_UINT4_DEFINED
-# endif
- local z_uint4 keys[3]; /* keys defining the pseudo-random sequence */
-#endif /* !UNZIP */
-
-#ifndef Trace
-# ifdef CRYPT_DEBUG
-# define Trace(x) fprintf x
+local int testp OF((__GPRO__ int hd_len, ZCONST uch *h));
+local int testkey OF((__GPRO__ int hd_len, ZCONST uch *h,
+ ZCONST char *key));
+# endif /* ndef FUNZIP */
+# else /* def UNZIP */ /* moved to globals.h for UnZip */
+local z_uint4 keys[3]; /* keys defining the pseudo-random sequence */
+# endif /* def UNZIP [else] */
+
+# ifndef Trace
+# ifdef IZ_CRYPT_DEBUG
+# define Trace(x) fprintf x
# else
-# define Trace(x)
+# define Trace(x)
# endif
-#endif
+# endif
-#include "crc32.h"
+# ifdef IZ_CRYPT_TRAD
-#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 */
+# include "crc32.h"
+
+# 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 */
/***********************************************************************
* Return the next byte in the pseudo-random sequence
__GDEF
ZCONST char *passwd; /* password string with which to modify keys */
{
-#ifdef IZ_CRC_BE_OPTIMIZ
+# ifdef IZ_CRC_BE_OPTIMIZ
if (cry_crctb_p == NULL) {
cry_crctb_p = crytab_init(__G);
}
-#endif
- GLOBAL(keys[0]) = 305419896L;
- GLOBAL(keys[1]) = 591751049L;
- GLOBAL(keys[2]) = 878082192L;
+# endif
+ GLOBAL(keys[0]) = 305419896L; /* 0x12345678. */
+ GLOBAL(keys[1]) = 591751049L; /* 0x23456789. */
+ GLOBAL(keys[2]) = 878082192L; /* 0x34567890. */
while (*passwd != '\0') {
update_keys(__G__ (int)*passwd);
passwd++;
* requires inverting the byte-order of the values in the
* crypt-crc32-table.
*/
-#ifdef IZ_CRC_BE_OPTIMIZ
+# ifdef IZ_CRC_BE_OPTIMIZ
local z_uint4 near *crytab_init(__G)
__GDEF
{
}
return crycrctab;
}
-#endif
+# endif /* def IZ_CRC_BE_OPTIMIZ */
+
+# endif /* def IZ_CRYPT_TRAD */
+
+# ifdef ZIP
-#ifdef ZIP
+# ifdef IZ_CRYPT_TRAD
/***********************************************************************
- * Write encryption header to file zfile using the password passwd
- * and the cyclic redundancy check crc.
+ * Write (Traditional) encryption header to file zfile using the password
+ * passwd and the cyclic redundancy check crc.
*/
-void crypthead(passwd, crc, zfile)
+void crypthead(passwd, crc)
ZCONST char *passwd; /* password string */
ulg crc; /* crc of file being encrypted */
- FILE *zfile; /* where to write header */
{
int n; /* index in random header */
int t; /* temporary */
uch header[RAND_HEAD_LEN]; /* random header */
static unsigned calls = 0; /* ensure different random header each time */
- /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
- * output of rand() to get less predictability, since rand() is
+ /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
+ * output of rand() to get less predictability, because rand() is
* often poorly implemented.
*/
- if (++calls == 1) {
+ if (calls == 0)
+ {
+#ifndef IZ_CRYPT_SKIP_SRAND
srand((unsigned)time(NULL) ^ ZCR_SEED2);
+#endif /* ndef IZ_CRYPT_SKIP_SRAND */
+ calls = 1;
}
init_keys(passwd);
for (n = 0; n < RAND_HEAD_LEN-2; n++) {
}
header[RAND_HEAD_LEN-2] = (uch)zencode((int)(crc >> 16) & 0xff, t);
header[RAND_HEAD_LEN-1] = (uch)zencode((int)(crc >> 24) & 0xff, t);
- fwrite(header, 1, RAND_HEAD_LEN, f);
+ bfwrite(header, 1, RAND_HEAD_LEN, BFWRITE_DATA);
+}
+
+# endif /* def IZ_CRYPT_TRAD */
+
+
+/***********************************************************************
+ * 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
+ * write out the data.
+ *
+ * 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)
+ zvoid *buf; /* data buffer */
+ extent item_size; /* size of each item in bytes */
+ extent nb; /* number of items */
+{
+ int t; /* temporary */
+
+ if (key != (char *)NULL) /* key is the global password pointer */
+ {
+# ifdef IZ_CRYPT_AES_WG
+ if (encryption_method >= AES_MIN_ENCRYPTION)
+ {
+ /* assume all items are bytes */
+ fcrypt_encrypt(buf, item_size * nb, &zctx);
+ }
+ else
+ {
+# endif /* def IZ_CRYPT_AES_WG */
+# ifdef IZ_CRYPT_TRAD
+ ulg size; /* buffer size */
+ char *p = (char *)buf; /* steps through buffer */
+
+ /* Encrypt data in buffer */
+ for (size = item_size*(ulg)nb; size != 0; p++, size--)
+ {
+ *p = (char)zencode(*p, t);
+ }
+# else /* def IZ_CRYPT_TRAD */
+ /* Do something in case the impossible happens here? */
+# endif /* def IZ_CRYPT_TRAD [else] */
+# ifdef IZ_CRYPT_AES_WG
+ }
+# endif /* def IZ_CRYPT_AES_WG */
+ }
+
+ /* Write the buffer out */
+ return bfwrite(buf, item_size, nb, BFWRITE_DATA);
}
-#ifdef UTIL
+# ifdef IZ_CRYPT_AES_WG
/***********************************************************************
- * Encrypt the zip entry described by z from file source to file dest
+ * Write AES_WG encryption header to file zfile.
+ *
+ * Size (bytes) Content
+ * Variable Salt value
+ * 2 Password verification value
+ * Variable Encrypted file data
+ * 10 Authentication code
+ *
+ * Here, writing salt and password verification.
+ */
+void aes_crypthead( OFT( ZCONST uch *)salt,
+ OFT( uch) salt_len,
+ OFT( ZCONST uch *)pwd_verifier)
+# ifdef NO_PROTO
+ ZCONST uch *salt;
+ uch salt_len;
+ ZCONST uch *pwd_verifier;
+# endif /* def NO_PROTO */
+{
+ bfwrite(salt, 1, salt_len, BFWRITE_DATA);
+ bfwrite(pwd_verifier, 1, PWD_VER_LENGTH, BFWRITE_DATA);
+}
+
+# endif /* def IZ_CRYPT_AES_WG */
+
+# endif /* def ZIP */
+
+
+/* ef_scan_for_aes() is used by UnZip and Zip utilities (ZipCloak). */
+
+# if defined( UNZIP) || defined( UTIL)
+
+# ifdef IZ_CRYPT_AES_WG
+
+/* SH() macro lifted from zipfile.c. */
+
+# ifdef THEOS
+ /* Macros cause stack overflow in compiler */
+ush SH(uch* p) { return ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8)); }
+# else /* !THEOS */
+ /* Macros for converting integers in little-endian to machine format */
+# define SH(a) ((ush)(((ush)(uch)(a)[0]) | (((ush)(uch)(a)[1]) << 8)))
+# endif /* ?THEOS */
+
+# define makeword( a) SH( a)
+
+
+/******************************/
+/* Function ef_scan_for_aes() */
+/******************************/
+
+/* 2012-11-25 SMS. (OUSPG report.)
+ * Changed eb_len and ef_len from unsigned to signed, to catch underflow
+ * of ef_len caused by corrupt/malicious data. (32-bit is adequate.
+ * Used "long" to accommodate any systems with 16-bit "int".)
+ */
+
+int ef_scan_for_aes( ef_buf, ef_len, vers, vend, mode, mthd)
+ ZCONST uch *ef_buf; /* Buffer containing extra field */
+ long ef_len; /* Total length of extra field */
+ ush *vers; /* Return storage: AES encryption version. */
+ ush *vend; /* Return storage: AES encryption vendor. */
+ char *mode; /* Return storage: AES encryption mode. */
+ ush *mthd; /* Return storage: Real compression method. */
+{
+ int ret = 0;
+ unsigned eb_id;
+ long eb_len;
+
+/*---------------------------------------------------------------------------
+ This function scans the extra field for an EF_AES_WG block
+ containing the AES encryption mode (which determines key length and
+ salt length) and the actual compression method used.
+ The return value is 0 if EF_AES_WG was not found, 1 if a good
+ EF_AES_WG was found, and negative if an error occurred.
+ ---------------------------------------------------------------------------*/
+
+ /* Exit early, if there are no extra field data. */
+ if ((ef_len == 0) || (ef_buf == NULL))
+ return 0;
+
+ Trace(( stderr,
+ "\nef_scan_for_aes: scanning extra field of length %ld\n",
+ ef_len));
+
+ /* Scan the extra field blocks. */
+ while (ef_len >= EB_HEADSIZE)
+ {
+ eb_id = makeword( ef_buf+ EB_ID); /* Extra block ID. */
+ eb_len = makeword( ef_buf+ EB_LEN); /* Extra block length. */
+ if (eb_len > (ef_len - EB_HEADSIZE))
+ {
+ /* Discovered some extra field inconsistency! */
+ Trace(( stderr,
+ "ef_scan_for_aes: block length %ld > rest ef_size %ld\n",
+ eb_len, (ef_len- EB_HEADSIZE)));
+ ret = -1;
+ break;
+ }
+
+ if (eb_id == EF_AES_WG)
+ {
+ /* Found an EF_AES_WG block. Check for a valid length. */
+ if (eb_len < EB_AES_HLEN)
+ {
+ /* Not enough data. Return an error code. */
+ ret = -2;
+ break;
+ }
+
+ /* Store extra block data in the user-supplied places. */
+ if (vers != NULL)
+ {
+ *vers = makeword( ef_buf+ EB_HEADSIZE+ EB_AES_VERS);
+ }
+ if (vend != NULL)
+ {
+ *vend = makeword( ef_buf+ EB_HEADSIZE+ EB_AES_VEND);
+ }
+ if (mode != NULL)
+ {
+ *mode = *(ef_buf+ EB_HEADSIZE+ EB_AES_MODE);
+ }
+ if (mthd != NULL)
+ {
+ *mthd = makeword( ef_buf+ EB_HEADSIZE+ EB_AES_MTHD);
+ }
+ ret = 1;
+ break;
+ }
+
+ /* Advance to the next extra field block. */
+ ef_buf += (eb_len+ EB_HEADSIZE);
+ ef_len -= (eb_len+ EB_HEADSIZE);
+ }
+
+ return ret;
+}
+
+# endif /* def IZ_CRYPT_AES_WG */
+
+# endif /* defined( UNZIP) || defined( UTIL) */
+
+# ifdef ZIP
+# ifdef UTIL
+
+# ifdef IZ_CRYPT_AES_WG
+
+/***************************/
+/* Function ef_strip_aes() */
+/***************************/
+
+/* 2012-11-25 SMS. (OUSPG report.)
+ * Changed eb_len, ef_len, and ef_len_d from unsigned to signed, to
+ * catch underflow of ef_len caused by corrupt/malicious data. (32-bit
+ * is adequate. Used "long" to accommodate any systems with 16-bit
+ * "int".) Made function static.
+ */
+
+local int ef_strip_aes( ef_buf, ef_len)
+ ZCONST uch *ef_buf; /* Buffer containing extra field */
+ long ef_len; /* Total length of extra field */
+{
+ int ret = -1; /* Return value. */
+ unsigned eb_id; /* Extra block ID. */
+ long eb_len; /* Extra block length. */
+ uch *eb_aes; /* Start of AES block. */
+ uch *ef_buf_d; /* Sliding extra field pointer. */
+ long ef_len_d; /* Remaining extra field length. */
+
+/*---------------------------------------------------------------------------
+ This function strips an EF_AES_WG block from an extra field.
+ The return value is -1 if EF_AES_WG was not found, and the new
+ (smaller) extra field length, if an EF_AES_WG was found.
+ ---------------------------------------------------------------------------*/
+
+ /* Exit early, if there are no extra field data. */
+ if ((ef_len == 0) || (ef_buf == NULL))
+ return -1;
+
+ Trace(( stderr,
+ "\nef_strip_aes: scanning extra field of length %ld\n",
+ ef_len));
+
+ eb_aes = NULL; /* Start of AES block. */
+ ef_buf_d = (uch *)ef_buf; /* Sliding extra field pointer. */
+ ef_len_d = ef_len; /* Remaining extra field length. */
+
+ /* Scan the extra field blocks. */
+ while (ef_len_d >= EB_HEADSIZE)
+ {
+ eb_id = makeword( ef_buf_d+ EB_ID); /* Extra block ID. */
+ eb_len = makeword( ef_buf_d+ EB_LEN); /* Extra block length. */
+
+ if (eb_len > (ef_len_d - EB_HEADSIZE))
+ {
+ /* Discovered some extra field inconsistency! */
+ Trace(( stderr,
+ "ef_strip_aes: block length %ld > rest ef_size %ld\n",
+ eb_len, (ef_len_d- EB_HEADSIZE)));
+ ret = -1;
+ break;
+ }
+
+ if (eb_id == EF_AES_WG)
+ {
+ /* Found an EF_AES_WG block. Save its location, and escape. */
+ eb_aes = ef_buf_d;
+ break;
+ }
+
+ /* Advance to the next extra field block. */
+ ef_buf_d += (eb_len+ EB_HEADSIZE);
+ ef_len_d -= (eb_len+ EB_HEADSIZE);
+ }
+
+ if (eb_aes != NULL)
+ {
+ /* Move post-AES block data up onto AES block data (if not at end).
+ * Prepare to return the original EF size less the AES block size.
+ * Note: memmove() is supposed to be overlap-safe.
+ */
+ eb_len += EB_HEADSIZE; /* Total block size (header+data). */
+ ret = ef_len- eb_len; /* New (reduced) extra field size. */
+ ef_len_d = ef_buf+ ef_len- eb_aes- eb_len; /* Move size. */
+
+ if (ef_len_d > 0)
+ {
+ /* Move the data which need to be moved. */
+ memmove( eb_aes, (eb_aes+ eb_len), ef_len_d);
+ }
+ }
+
+ return ret;
+}
+
+# endif /* def IZ_CRYPT_AES_WG */
+
+
+/***********************************************************************
+ * Encrypt the zip entry described by z from file in_file to file y
* using the password passwd. Return an error code in the ZE_ class.
+ *
+ * bfwrite() should take care of any byte counting.
*/
-int zipcloak(z, source, dest, passwd)
- struct zlist far *z; /* zip entry to encrypt */
- FILE *source, *dest; /* source and destination files */
- ZCONST char *passwd; /* password string */
+int zipcloak(z, passwd)
+ struct zlist far *z; /* zip entry to encrypt */
+ ZCONST char *passwd; /* password string */
{
- int c; /* input byte */
- int res; /* result code */
- ulg n; /* holds offset and counts size */
- ush flag; /* previous flags */
- int t; /* temporary */
- int ztemp; /* temporary storage for zencode value */
+ int res; /* result code */
+ struct zlist far *localz; /* local header */
+ uch buf[1024]; /* write buffer */
+ zoff_t size; /* size of input data */
+# ifdef IZ_CRYPT_AES_WG
+# define HEAD_LEN head_len /* Variable header length. */
+ int head_len; /* Variable encryption header length. */
+ uch salt_len = 0; /* AES salt length. (Init'd to hush cmplr.) */
+# else /* def IZ_CRYPT_AES_WG */
+# define HEAD_LEN RAND_HEAD_LEN /* Constant trad. header length. */
+# endif /* def IZ_CRYPT_AES_WG [else] */
/* Set encrypted bit, clear extended local header bit and write local
header to output file */
- if ((n = (ulg)ftell(dest)) == (ulg)-1L) return ZE_TEMP;
- z->off = n;
- flag = z->flg;
+
+ /* assume this archive is one disk and the file is open */
+
+ /* read the local header */
+ res = readlocal(&localz, z);
+
+ /* Update (assumed only one) disk. Caller is responsible for offset. */
+ z->dsk = 0;
+
+ /* Set the encryption flags, and unset any extended local header flags. */
z->flg |= 1, z->flg &= ~8;
- z->lflg |= 1, z->lflg &= ~8;
- z->siz += RAND_HEAD_LEN;
- if ((res = putlocal(z, dest)) != ZE_OK) return res;
+ localz->lflg |= 1, localz->lflg &= ~8;
+
+ /* Set the new encryption method. */
+ localz->encrypt_method = encryption_method;
+ z->encrypt_method = encryption_method;
+
+# ifdef IZ_CRYPT_AES_WG
+ if (encryption_method == TRADITIONAL_ENCRYPTION)
+ {
+ HEAD_LEN = RAND_HEAD_LEN;
+ }
+ else
+ {
+ /* Determine AES encryption salt length, and header+trailer length.
+ * Header has salty stuff. Trialer has Message Authentication
+ * Code (MAC).
+ */
+ /* Note: v-- No parentheses in SALT_LENGTH def'n. --v */
+ salt_len = SALT_LENGTH( (encryption_method - (AES_MIN_ENCRYPTION - 1)) );
+ HEAD_LEN = salt_len + PWD_VER_LENGTH + /* Header. */
+ MAC_LENGTH( encryption_method - (AES_MIN_ENCRYPTION - 1) ); /* Trailer. */
+
+ /* get the salt */
+ prng_rand( zsalt, salt_len, &aes_rnp);
+
+ /* initialize encryption context for this file */
+ res = fcrypt_init(
+ (encryption_method- (AES_MIN_ENCRYPTION- 1)), /* AES mode. */
+ (unsigned char*) passwd, /* Password. */
+ strlen( passwd), /* Password length. */
+ zsalt, /* Salt. */
+ zpwd_verifier, /* Password vfy buf. */
+ &zctx); /* AES context. */
+
+ if (res == PASSWORD_TOO_LONG) {
+ ZIPERR(ZE_CRYPT, "Password too long");
+ } else if (res == BAD_MODE) {
+ ZIPERR(ZE_CRYPT, "Bad mode");
+ }
+ }
+# endif /* def IZ_CRYPT_AES_WG */
+
+ /* Add size of encryption header (AES_WG: header+trailer). */
+ localz->siz += HEAD_LEN;
+ z->siz = localz->siz;
- /* Initialize keys with password and write random header */
- crypthead(passwd, z->crc, dest);
+ /* Put out the local header. */
+ if ((res = putlocal(localz, PUTLOCAL_WRITE)) != ZE_OK) return res;
- /* Skip local header in input file */
- if (fseek(source, (long)((4 + LOCHEAD) + (ulg)z->nam + (ulg)z->ext),
- SEEK_CUR)) {
- return ferror(source) ? ZE_READ : ZE_EOF;
+ /* Write out an encryption header before the file data. */
+ if (z->encrypt_method != NO_ENCRYPTION)
+ {
+# ifdef IZ_CRYPT_AES_WG
+ if ((z->encrypt_method >= AES_MIN_ENCRYPTION) &&
+ (z->encrypt_method <= AES_MAX_ENCRYPTION))
+ {
+ aes_crypthead( zsalt, salt_len, zpwd_verifier );
+ tempzn += HEAD_LEN; /* Count header+trailer. */
+ }
+ else
+ {
+# endif /* def IZ_CRYPT_AES_WG */
+# ifdef IZ_CRYPT_TRAD
+ /* Initialize keys with password and write random header */
+ crypthead( passwd, localz->crc);
+ tempzn += HEAD_LEN; /* Count header. */
+# endif /* IZ_CRYPT_TRAD */
+# ifdef IZ_CRYPT_AES_WG
+ }
+# endif /* def IZ_CRYPT_AES_WG */
}
- /* Encrypt data */
- for (n = z->siz - RAND_HEAD_LEN; n; n--) {
- if ((c = getc(source)) == EOF) {
- return ferror(source) ? ZE_READ : ZE_EOF;
+ /* Read, encrypt, and write out member data. */
+ for (size = z->siz- HEAD_LEN; size > 0; )
+ {
+ size_t bytes_to_read;
+ size_t bytes_read;
+
+ bytes_to_read = (size_t)IZ_MIN( sizeof( buf), size);
+ bytes_read = fread( buf, 1, bytes_to_read, in_file);
+
+ if (bytes_to_read == bytes_read)
+ {
+ zfwrite( buf, 1, bytes_read);
+ }
+ else
+ {
+ return ferror(in_file) ? ZE_READ : ZE_EOF;
}
- ztemp = zencode(c, t);
- putc(ztemp, dest);
+ size -= bytes_to_read;
+ }
+
+# ifdef IZ_CRYPT_AES_WG
+ /* For AES_WG, write out an AES_WG MAC trailer. */
+ if ((z->encrypt_method >= AES_MIN_ENCRYPTION) &&
+ (z->encrypt_method <= AES_MAX_ENCRYPTION))
+ {
+ int ret;
+
+ ret = fcrypt_end( auth_code, /* Returned msg auth code (MAC). */
+ &zctx); /* AES context. */
+
+ bfwrite(auth_code, 1, ret, BFWRITE_DATA);
+ /* tempzn already got this trailer size when it got the header size. */
}
- /* Skip extended local header in input file if there is one */
- if ((flag & 8) != 0 && fseek(source, 16L, SEEK_CUR)) {
- return ferror(source) ? ZE_READ : ZE_EOF;
+# endif /* def IZ_CRYPT_AES_WG */
+
+ /* Since we seek to the start of each local header can skip
+ reading any extended local header */
+#if 0
+ if ((flag & 8) != 0 && zfseeko(in_file, 16L, SEEK_CUR)) {
+ return ferror(in_file) ? ZE_READ : ZE_EOF;
}
- if (fflush(dest) == EOF) return ZE_TEMP;
+ if (fflush(y) == EOF) return ZE_TEMP;
+#endif /* 0 */
/* Update number of bytes written to output file */
- tempzn += (4 + LOCHEAD) + z->nam + z->ext + z->siz;
+ tempzn += (4 + LOCHEAD) + localz->nam + localz->ext + localz->siz;
+
+ /* Free local header */
+ if (localz->ext) izc_free(localz->extra);
+ if (localz->nam) izc_free(localz->iname);
+ if (localz->nam) izc_free(localz->name);
+# ifdef UNICODE_SUPPORT
+ if (localz->uname) izc_free(localz->uname);
+# endif
+ izc_free(localz);
return ZE_OK;
}
+
/***********************************************************************
- * Decrypt the zip entry described by z from file source to file dest
+ * Decrypt the zip entry described by z from file in_file to file y
* using the password passwd. Return an error code in the ZE_ class.
*/
-int zipbare(z, source, dest, passwd)
+int zipbare(z, passwd)
struct zlist far *z; /* zip entry to encrypt */
- FILE *source, *dest; /* source and destination files */
ZCONST char *passwd; /* password string */
{
-#ifdef ZIP10
+# ifdef ZIP10
int c0 /* byte preceding the last input byte */
-#endif
+# endif
int c1; /* last input byte */
- ulg offset; /* used for file offsets */
- ulg size; /* size of input data */
+ /* 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 */
int res; /* return code */
- ush flag; /* previous flags */
- /* Save position and skip local header in input file */
- if ((offset = (ulg)ftell(source)) == (ulg)-1L ||
- fseek(source, (long)((4 + LOCHEAD) + (ulg)z->nam + (ulg)z->ext),
- SEEK_CUR)) {
- return ferror(source) ? ZE_READ : ZE_EOF;
- }
- /* Initialize keys with password */
- init_keys(passwd);
+# ifdef IZ_CRYPT_AES_WG
+# define HEAD_LEN head_len /* Variable header length. */
+ int head_len; /* Variable encryption header length. */
+ uch h[ ENCR_HEAD_LEN]; /* Encryption header. */
+ uch hh[ ENCR_PW_CHK_LEN]; /* Password check buffer. */
+ char aes_mode = 0; /* AES encryption mode. (Init'd to hush cmplr.) */
+ ush aes_mthd = 0; /* Actual compress method. (Init'd to hush cmplr.) */
+ ush how_orig; /* Original encryption method. */
+ zoff_t n; /* Bytes actually read. */
+ zoff_t nn; /* Bytes requested. */
+ zoff_t nout; /* Total bytes put out. */
+# else /* def IZ_CRYPT_AES_WG */
+# define HEAD_LEN RAND_HEAD_LEN /* Constant trad. header length. */
+# endif /* def IZ_CRYPT_AES_WG [else] */
+
+ /* Read local header. */
+ res = readlocal(&localz, z);
+
+ /* Update (assumed only one) disk. Caller is responsible for offset. */
+ z->dsk = 0;
+
+ passwd_ok = 1; /* Assume a good password. */
+
+# ifdef IZ_CRYPT_AES_WG
+ how_orig = localz->how; /* Save the original encryption method. */
+ 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);
+
+ if ((aes_mode > 0) && (aes_mode <= 3))
+ {
+ /* AES header size depends on (variable) salt length. */
+ HEAD_LEN = SALT_LENGTH( aes_mode)+ PWD_VER_LENGTH;
+ }
+ else
+ {
+ /* Unexpected/invalid AES mode value. */
+ return ZE_CRYPT;
+ }
+
+ /* Read the AES header from the input file. */
+ size = fread( h, 1, HEAD_LEN, in_file);
+ if (size < HEAD_LEN)
+ {
+ return ferror(in_file) ? ZE_READ : ZE_EOF;
+ }
- /* Decrypt encryption header, save last two bytes */
- c1 = 0;
- for (r = RAND_HEAD_LEN; r; r--) {
-#ifdef ZIP10
- c0 = c1;
-#endif
- if ((c1 = getc(source)) == EOF) {
- return ferror(source) ? ZE_READ : ZE_EOF;
+ /* Initialize the AES decryption machine for the password check. */
+ fcrypt_init( aes_mode, /* AES mode. */
+ (unsigned char*) passwd, /* Password. */
+ strlen( passwd), /* Password length. */
+ h, /* Salt. */
+ hh, /* PASSWORD_VERIFIER. */
+ &zctx); /* AES context. */
+
+ /* Check the password verifier. */
+ if (memcmp( (h+ HEAD_LEN- PWD_VER_LENGTH), hh, PWD_VER_LENGTH))
+ {
+ passwd_ok = 0; /* Bad AES password. */
}
- Trace((stdout, " (%02x)", c1));
- zdecode(c1);
- Trace((stdout, " %02x", c1));
}
- Trace((stdout, "\n"));
+ else /* if (how_orig == AESENCRED) */
+ {
+ /* Traditional Zip decryption. */
+ HEAD_LEN = RAND_HEAD_LEN;
+# else /* def IZ_CRYPT_AES_WG */
+ {
+# endif /* def IZ_CRYPT_AES_WG [else] */
+# ifdef IZ_CRYPT_TRAD
+ /* Traditional Zip decryption. */
+ /* Update disk. Caller is responsible for offset (z->off). */
+ z->dsk = 0;
+
+ /* Initialize keys with password */
+ init_keys(passwd);
+
+ /* Decrypt encryption header, save last two bytes */
+ c1 = 0;
+ for (r = RAND_HEAD_LEN; r; r--) {
+# ifdef ZIP10
+ c0 = c1;
+# endif
+ if ((c1 = getc(in_file)) == EOF) {
+ return ferror(in_file) ? ZE_READ : ZE_EOF;
+ }
+ Trace((stdout, " (%02x)", c1));
+ zdecode(c1);
+ Trace((stdout, " %02x", c1));
+ }
+ Trace((stdout, "\n"));
/* If last two bytes of header don't match crc (or file time in the
* case of an extended local header), back up and just copy. For
* pkzip 2.0, the check has been reduced to one byte only.
*/
-#ifdef ZIP10
- if ((ush)(c0 | (c1<<8)) !=
- (z->flg & 8 ? (ush) z->tim & 0xffff : (ush)(z->crc >> 16))) {
-#else
- if ((ush)c1 != (z->flg & 8 ? (ush) z->tim >> 8 : (ush)(z->crc >> 24))) {
-#endif
- if (fseek(source, offset, SEEK_SET)) {
- return ferror(source) ? ZE_READ : ZE_EOF;
+# ifdef ZIP10
+ if ((ush)(c0 | (c1<<8)) !=
+ (z->flg & 8 ? (ush) z->tim & 0xffff : (ush)(z->crc >> 16)))
+# else
+ if ((ush)c1 != (z->flg & 8 ? (ush) z->tim >> 8 : (ush)(z->crc >> 24)))
+# endif
+ {
+ passwd_ok = 0; /* Bad traditional password. */
}
- if ((res = zipcopy(z, source, dest)) != ZE_OK) return res;
- return ZE_MISS;
+# endif /* def IZ_CRYPT_TRAD */
}
- /* Clear encrypted bit and local header bit, and write local header to
- output file */
- if ((offset = (ulg)ftell(dest)) == (ulg)-1L) return ZE_TEMP;
- z->off = offset;
- flag = z->flg;
- z->flg &= ~9;
- z->lflg &= ~9;
- z->siz -= RAND_HEAD_LEN;
- if ((res = putlocal(z, dest)) != ZE_OK) return res;
-
- /* Decrypt data */
- for (size = z->siz; size; size--) {
- if ((c1 = getc(source)) == EOF) {
- return ferror(source) ? ZE_READ : ZE_EOF;
+ if (!passwd_ok)
+ {
+ /* Bad password. Copy the entry as is. */
+ if ((res = zipcopy(z)) != ZE_OK) {
+ ziperr(res, "was copying an entry");
}
- zdecode(c1);
- putc(c1, dest);
- }
- /* Skip extended local header in input file if there is one */
- if ((flag & 8) != 0 && fseek(source, 16L, SEEK_CUR)) {
- return ferror(source) ? ZE_READ : ZE_EOF;
+ return ZE_MISS;
}
- if (fflush(dest) == EOF) return ZE_TEMP;
- /* Update number of bytes written to output file */
- tempzn += (4 + LOCHEAD) + z->nam + z->ext + z->siz;
-
- return ZE_OK;
-}
+ /* Good password. Proceed to decrypt the entry. */
+ z->siz -= HEAD_LEN; /* Subtract the encryption header length. */
+ localz->siz = z->siz; /* Local, too. */
+ z_siz = z->siz; /* Save z->siz as Use z_siz for I/O later. */
+ localz->flg = z->flg &= ~9; /* Clear the encryption and */
+ z->lflg = localz->lflg &= ~9; /* data-descriptor flags. */
-#else /* !UTIL */
-
-/***********************************************************************
- * If requested, encrypt the data in buf, and in any case call fwrite()
- * with the arguments to zfwrite(). Return what fwrite() returns.
- *
- * A bug has been found when encrypting large files. See trees.c
- * for details and the fix.
- */
-unsigned zfwrite(buf, item_size, nb, f)
- zvoid *buf; /* data buffer */
- extent item_size; /* size of each item in bytes */
- extent nb; /* number of items */
- FILE *f; /* file to write to */
-{
- int t; /* temporary */
+# 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. */
+
+ /* Subtract the MAC size from the compressed size(s). */
+ localz->siz -= MAC_LENGTH( aes_mode);
+ z->siz = localz->siz;
+
+ /* Strip the AES extra block out of the local extra field. */
+ if (localz->extra != NULL)
+ {
+ r = ef_strip_aes( (uch *)localz->extra, localz->ext);
+ if (r >= 0)
+ {
+ localz->ext = r;
+ if (r == 0)
+ {
+ /* Whole extra field is now gone. free() below will
+ * see localz->ext == 0, and skip it, so do it here.
+ */
+ izc_free( localz->extra);
+ }
+ }
+ }
+ /* Strip the AES extra block out of the central extra field. */
+ r = ef_strip_aes( (uch *)z->cextra, z->cext);
+ if (r >= 0)
+ {
+ z->cext = r;
+ }
+ }
+# endif /* def IZ_CRYPT_AES_WG */
- if (key != (char *)NULL) { /* key is the global password pointer */
- ulg size; /* buffer size */
- char *p = (char*)buf; /* steps through buffer */
+ /* Put out the (modified) local extra field. */
+ if ((res = putlocal(localz, PUTLOCAL_WRITE)) != ZE_OK)
+ return res;
- /* Encrypt data in buffer */
- for (size = item_size*(ulg)nb; size != 0; p++, size--) {
- *p = (char)zencode(*p, t);
+# ifdef IZ_CRYPT_AES_WG
+ if (how_orig == AESENCRED)
+ {
+ /* Read, AES-decrypt, and write the member data, until
+ * exhausted (no more input, or no more desired output).
+ * z_siz = original (encrypted) compressed size (bytes to read).
+ * z->siz = new (decrypted) compressed size (bytes to write).
+ */
+ nout = 0;
+ for (size = z_siz; (size > 0) && (nout < z->siz);)
+ {
+ nn = IZ_MIN( sizeof( buf), size);
+ n = fread( buf, 1, nn, in_file);
+ if (n == nn)
+ {
+ fcrypt_decrypt( buf, n, &zctx);
+ n = IZ_MIN( n, (z->siz- nout));
+ bfwrite( buf, 1, n, BFWRITE_DATA);
+ nout += n; /* Bytes written. */
+ }
+ else
+ {
+ return ferror(in_file) ? ZE_READ : ZE_EOF;
+ }
+ size -= nn; /* Bytes left to read. */
}
}
- /* Write the buffer out */
- return fwrite(buf, item_size, nb, f);
+ else /* if (how_orig == AESENCRED) */
+ {
+# endif /* def IZ_CRYPT_AES_WG */
+# ifdef IZ_CRYPT_TRAD
+ /* Read, traditional-decrypt, and write the member data, until done. */
+ b = 0;
+ for (size = z->siz; size; size--) {
+ if ((c1 = getc(in_file)) == EOF) {
+ return ferror(in_file) ? ZE_READ : ZE_EOF;
+ }
+ zdecode(c1);
+ buf[b] = c1;
+ b++;
+ if (b >= 1024) {
+ /* write the buffer */
+ bfwrite(buf, 1, b, BFWRITE_DATA);
+ b = 0;
+ }
+ }
+ if (b) {
+ /* write the buffer */
+ bfwrite(buf, 1, b, BFWRITE_DATA);
+ b = 0;
+ }
+# endif /* def IZ_CRYPT_TRAD */
+# ifdef IZ_CRYPT_AES_WG
+ }
+# endif /* def IZ_CRYPT_AES_WG */
+
+ /* Since we seek to the start of each local header can skip
+ reading any extended local header */
+
+ /* Update number of bytes written to output file */
+ tempzn += (4 + LOCHEAD) + localz->nam + localz->ext + localz->siz;
+
+ /* Free local header */
+ if (localz->ext) izc_free(localz->extra);
+ if (localz->nam) izc_free(localz->iname);
+ if (localz->nam) izc_free(localz->name);
+# ifdef UNICODE_SUPPORT
+ if (localz->uname) izc_free(localz->uname);
+# endif
+ izc_free(localz);
+
+ return ZE_OK;
}
-#endif /* ?UTIL */
-#endif /* ZIP */
+# endif /* def UTIL */
+# endif /* def ZIP */
-#if (defined(UNZIP) && !defined(FUNZIP))
+# if (defined(UNZIP) && !defined(FUNZIP))
/***********************************************************************
* Get the password and set up keys for current zipfile member.
ZCONST char *passwrd;
{
ush b;
- int n, r;
- uch h[RAND_HEAD_LEN];
+ int n;
+ int r;
+ uch h[ ENCR_HEAD_LEN];
+# ifdef IZ_CRYPT_AES_WG
+# define HEAD_LEN head_len /* Variable header length. */
+ int head_len; /* Variable encryption header length. */
+# else /* def IZ_CRYPT_AES_WG */
+# define HEAD_LEN RAND_HEAD_LEN /* Constant trad. header length. */
+# endif /* def IZ_CRYPT_AES_WG [else] */
Trace((stdout, "\n[incnt = %d]: ", GLOBAL(incnt)));
+# ifdef IZ_CRYPT_AES_WG
+ if (GLOBAL( lrec.compression_method) == AESENCRED)
+ {
+ if ((GLOBAL( pInfo->cmpr_mode_aes) > 0) &&
+ (GLOBAL( pInfo->cmpr_mode_aes) <= 3))
+ {
+ /* AES header size depends on (variable) salt length. */
+ HEAD_LEN = SALT_LENGTH( GLOBAL( pInfo->cmpr_mode_aes))+
+ PWD_VER_LENGTH;
+ }
+ else
+ {
+ /* Unexpected/invalid AES mode value. */
+ return PK_ERR;
+ }
+ }
+ else
+ {
+ HEAD_LEN = RAND_HEAD_LEN;
+ }
+# endif /* def IZ_CRYPT_AES_WG */
+
/* get header once (turn off "encrypted" flag temporarily so we don't
* try to decrypt the same data twice) */
GLOBAL(pInfo->encrypted) = FALSE;
defer_leftover_input(__G);
- for (n = 0; n < RAND_HEAD_LEN; n++) {
- b = NEXTBYTE;
+ for (n = 0; n < HEAD_LEN; n++)
+ {
+ /* 2012-11-23 SMS. (OUSPG report.)
+ * Quit early if compressed size < HEAD_LEN. The resulting
+ * error message ("unable to get password") could be improved,
+ * but it's better than trying to read nonexistent data, and
+ * then continuing with a negative G.csize. (See
+ * fileio.c:readbyte()).
+ */
+ if ((b = NEXTBYTE) == (ush)EOF)
+ {
+ return PK_ERR;
+ }
h[n] = (uch)b;
Trace((stdout, " (%02x)", h[n]));
}
GLOBAL(newzip) = FALSE;
if (passwrd != (char *)NULL) { /* user gave password on command line */
if (!GLOBAL(key)) {
- if ((GLOBAL(key) = (char *)malloc(strlen(passwrd)+1)) ==
+ if ((GLOBAL(key) = (char *)izc_malloc(strlen(passwrd)+1)) ==
(char *)NULL)
return PK_MEM2;
strcpy(GLOBAL(key), passwrd);
GLOBAL(nopwd) = TRUE; /* inhibit password prompting! */
}
} else if (GLOBAL(key)) { /* get rid of previous zipfile's key */
- free(GLOBAL(key));
+ izc_free(GLOBAL(key));
GLOBAL(key) = (char *)NULL;
}
}
/* if have key already, test it; else allocate memory for it */
if (GLOBAL(key)) {
- if (!testp(__G__ h))
+ if (!testp(__G__ HEAD_LEN, h))
return PK_COOL; /* existing password OK (else prompt for new) */
else if (GLOBAL(nopwd))
return PK_WARN; /* user indicated no more prompting */
- } else if ((GLOBAL(key) = (char *)malloc(IZ_PWLEN+1)) == (char *)NULL)
+ } else if ((GLOBAL(key) = (char *)izc_malloc(IZ_PWLEN+1)) == (char *)NULL)
return PK_MEM2;
/* try a few keys */
n = 0;
do {
- r = (*G.decr_passwd)((zvoid *)&G, &n, GLOBAL(key), IZ_PWLEN+1,
+ r = (*G.decr_passwd)((zvoid *)&G, &n, GLOBAL(key), IZ_PWLEN,
GLOBAL(zipfn), GLOBAL(filename));
if (r == IZ_PW_ERROR) { /* internal error in fetch of PW */
free (GLOBAL(key));
*GLOBAL(key) = '\0'; /* We try the NIL password, ... */
n = 0; /* and cancel fetch for this item. */
}
- if (!testp(__G__ h))
+ if (!testp(__G__ HEAD_LEN, h))
return PK_COOL;
if (r == IZ_PW_CANCELALL) /* User replied "Skip all" */
GLOBAL(nopwd) = TRUE; /* inhibit any further PW prompt! */
/***********************************************************************
* Test the password. Return -1 if bad, 0 if OK.
*/
-local int testp(__G__ h)
+local int testp(__G__ hd_len, h)
__GDEF
+ int hd_len;
ZCONST uch *h;
{
int r;
* the first test translates the password to the "main standard"
* character coding. */
-#ifdef STR_TO_CP1
+# ifdef STR_TO_CP1
/* allocate buffer for translated password */
- if ((key_translated = malloc(strlen(GLOBAL(key)) + 1)) == (char *)NULL)
+ if ((key_translated = izc_malloc(strlen(GLOBAL(key)) + 1)) == (char *)NULL)
return -1;
/* first try, test password translated "standard" charset */
- r = testkey(__G__ h, STR_TO_CP1(key_translated, GLOBAL(key)));
-#else /* !STR_TO_CP1 */
+ r = testkey(__G__ hd_len, h, STR_TO_CP1(key_translated, GLOBAL(key)));
+# else /* !STR_TO_CP1 */
/* first try, test password as supplied on the extractor's host */
- r = testkey(__G__ h, GLOBAL(key));
-#endif /* ?STR_TO_CP1 */
+ r = testkey(__G__ hd_len, h, GLOBAL(key));
+# endif /* ?STR_TO_CP1 */
-#ifdef STR_TO_CP2
+# ifdef STR_TO_CP2
if (r != 0) {
-#ifndef STR_TO_CP1
+# ifndef STR_TO_CP1
/* now prepare for second (and maybe third) test with translated pwd */
- if ((key_translated = malloc(strlen(GLOBAL(key)) + 1)) == (char *)NULL)
+ if ((key_translated = izc_malloc(strlen(GLOBAL(key)) + 1)) ==
+ (char *)NULL)
return -1;
-#endif
+# endif
/* second try, password translated to alternate ("standard") charset */
- r = testkey(__G__ h, STR_TO_CP2(key_translated, GLOBAL(key)));
-#ifdef STR_TO_CP3
+ r = testkey(__G__ hd_len, h, STR_TO_CP2(key_translated, GLOBAL(key)));
+# ifdef STR_TO_CP3
if (r != 0)
/* third try, password translated to another "standard" charset */
- r = testkey(__G__ h, STR_TO_CP3(key_translated, GLOBAL(key)));
-#endif
-#ifndef STR_TO_CP1
- free(key_translated);
-#endif
+ r = testkey(__G__ hd_len, h, STR_TO_CP3(key_translated, GLOBAL(key)));
+# endif
+# ifndef STR_TO_CP1
+ izc_free(key_translated);
+# endif
}
-#endif /* STR_TO_CP2 */
+# endif /* STR_TO_CP2 */
-#ifdef STR_TO_CP1
- free(key_translated);
+# ifdef STR_TO_CP1
+ izc_free(key_translated);
if (r != 0) {
/* last resort, test password as supplied on the extractor's host */
- r = testkey(__G__ h, GLOBAL(key));
+ r = testkey(__G__ hd_len, h, GLOBAL(key));
}
-#endif /* STR_TO_CP1 */
+# endif /* STR_TO_CP1 */
return r;
} /* end function testp() */
-local int testkey(__G__ h, key)
+local int testkey(__G__ hd_len, h, key)
__GDEF
- ZCONST uch *h; /* decrypted header */
- ZCONST char *key; /* decryption password to test */
+ int hd_len; /* Encryption header length. */
+ ZCONST uch *h; /* Decrypted header. */
+ ZCONST char *key; /* Decryption password to test. */
{
ush b;
-#ifdef ZIP10
+# ifdef ZIP10
ush c;
-#endif
+# endif
int n;
uch *p;
- uch hh[RAND_HEAD_LEN]; /* decrypted header */
+ uch hh[ ENCR_PW_CHK_LEN]; /* Password check buffer. */
+
+# ifdef IZ_CRYPT_AES_WG
+ if (GLOBAL( lrec.compression_method) == AESENCRED)
+ {
+ fcrypt_init( GLOBAL( pInfo->cmpr_mode_aes), /* AES mode. */
+ (unsigned char*) key, /* Password. */
+ strlen( key), /* Password length. */
+ h, /* Salt. */
+ hh, /* PASSWORD_VERIFIER. */
+ GLOBAL( zcx)); /* AES context. */
+
+ /* Check password verifier. */
+ if (memcmp( (h+ hd_len- PWD_VER_LENGTH), hh, PWD_VER_LENGTH))
+ {
+ return -1; /* Bad AES password. */
+ }
+ /* Password verified, so probably (but not certainly) OK.
+ * Save the count of bytes to decrypt, up to, but not including,
+ * the Message Authorization Code (MAC) block.
+ * Decrypt the current buffer contents (pre-MAC) before leaving.
+ */
+ GLOBAL( ucsize_aes) =
+ GLOBAL( csize)- MAC_LENGTH( GLOBAL( pInfo->cmpr_mode_aes));
+ n = (int)(IZ_MIN( GLOBAL( incnt), GLOBAL( ucsize_aes)));
+ fcrypt_decrypt( GLOBAL( inptr), n, GLOBAL( zcx));
+ GLOBAL( ucsize_aes) -= n; /* Decrement bytes-to-decrypt. */
+ return 0; /* OK */
+ }
+ else
+ {
+# endif /* def IZ_CRYPT_AES_WG */
+
+# ifdef IZ_CRYPT_TRAD
+ /* Traditional encryption. */
/* set keys and save the encrypted header */
init_keys(__G__ key);
- memcpy(hh, h, RAND_HEAD_LEN);
+ memcpy(hh, h, hd_len);
/* check password */
- for (n = 0; n < RAND_HEAD_LEN; n++) {
+ for (n = 0; n < hd_len; n++) {
zdecode(hh[n]);
Trace((stdout, " %02x", hh[n]));
}
"\n lrec.crc= %08lx crec.crc= %08lx pInfo->ExtLocHdr= %s\n",
GLOBAL(lrec.crc32), GLOBAL(pInfo->crc),
GLOBAL(pInfo->ExtLocHdr) ? "true":"false"));
- Trace((stdout, " incnt = %d unzip offset into zipfile = %ld\n",
+ Trace((stdout, " incnt = %d unzip offset into zipfile = %lld\n",
GLOBAL(incnt),
GLOBAL(cur_zipfile_bufstart)+(GLOBAL(inptr)-GLOBAL(inbuf))));
/* same test as in zipbare(): */
-#ifdef ZIP10 /* check two bytes */
+# ifdef ZIP10 /* check two bytes */
c = hh[RAND_HEAD_LEN-2], b = hh[RAND_HEAD_LEN-1];
Trace((stdout,
" (c | (b<<8)) = %04x (crc >> 16) = %04x lrec.time = %04x\n",
((ush)GLOBAL(lrec.last_mod_dos_datetime) & 0xffff) :
(ush)(GLOBAL(lrec.crc32) >> 16)))
return -1; /* bad */
-#else
+# else
b = hh[RAND_HEAD_LEN-1];
Trace((stdout, " b = %02x (crc >> 24) = %02x (lrec.time >> 8) = %02x\n",
b, (ush)(GLOBAL(lrec.crc32) >> 24),
((ush)GLOBAL(lrec.last_mod_dos_datetime) >> 8) & 0xff :
(ush)(GLOBAL(lrec.crc32) >> 24)))
return -1; /* bad */
-#endif
+# endif
/* password OK: decrypt current buffer contents before leaving */
for (n = (long)GLOBAL(incnt) > GLOBAL(csize) ?
(int)GLOBAL(csize) : GLOBAL(incnt),
p = GLOBAL(inptr); n--; p++)
zdecode(*p);
return 0; /* OK */
+# endif /* def IZ_CRYPT_TRAD */
+
+# ifdef IZ_CRYPT_AES_WG
+ } /* (GLOBAL( lrec.compression_method) == AESENCRED) [else] */
+# endif /* def IZ_CRYPT_AES_WG */
} /* end function testkey() */
-#endif /* UNZIP && !FUNZIP */
+# endif /* (defined(UNZIP) && !defined(FUNZIP)) */
-#else /* !CRYPT */
+#else /* def IZ_CRYPT_ANY */
/* something "externally visible" to shut up compiler/linker warnings */
int zcr_dummy;
-#endif /* ?CRYPT */
+#endif /* def IZ_CRYPT_ANY [else] */
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2005-Feb-10 or later
- (the contents of which are also included in (un)zip.h) for terms of use.
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*
crypt.h (full version) by Info-ZIP. Last revised: [see CR_VERSION_DATE]
- The main encryption/decryption source code for Info-Zip software was
- originally written in Europe. To the best of our knowledge, it can
- be freely distributed in both source and object forms from any country,
- including the USA under License Exception TSU of the U.S. Export
+ The main (Traditional) encryption/decryption source code for Info-Zip
+ software was originally written in Europe. To the best of our knowledge,
+ it can be freely distributed in both source and object forms from any
+ country, including the USA under License Exception TSU of the U.S. Export
Administration Regulations (section 740.13(e)) of 6 June 2002.
NOTE on copyright history:
- Previous versions of this source package (up to version 2.8) were
+ Some previous versions of this source package (up to version 2.8) were
not copyrighted and put in the public domain. If you cannot comply
with the Info-Zip LICENSE, you may want to look for one of those
public domain versions.
*/
-#ifndef __crypt_h /* don't include more than once */
+#ifndef __crypt_h /* Don't include more than once. */
#define __crypt_h
-#ifdef CRYPT
-# undef CRYPT
-#endif
-/*
- Logic of selecting "full crypt" code:
- a) default behaviour:
- - dummy crypt code when compiling UnZipSFX stub, to minimize size
- - full crypt code when used to compile Zip, UnZip and fUnZip
- b) USE_CRYPT defined:
- - always full crypt code
- c) NO_CRYPT defined:
- - never full crypt code
- NO_CRYPT takes precedence over USE_CRYPT
+/* To enable encryption (using crypt.c and crypt.h), the builder sets
+ * one or both of:
+ *
+ * IZ_CRYPT_AES_WG Include AES (WinZip/Gladman) (strong) encryption.
+ * IZ_CRYPT_TRAD Include Zip Traditional (weak) encryption.
+ *
+ * Other necessary macros are derived from these.
+ *
+ * AES_WG encryption uses files in the aes_wg directory in addition to
+ * the basic crypt.c and crypt.h. This implementation is intended to be
+ * compatible with the WinZip AES implementation, and uses AES
+ * encryption code supplied by Brian Gladman. For more information, see
+ * aes_wg/README_AES_WG.txt in Info-ZIP product kits or on the Info-ZIP
+ * server.
+ *
+ * Source kits for both AES_WG and Traditional encryption are available
+ * separately on the Info-ZIP server. Contact us if an encryption-free
+ * version of either the Zip or UnZip source kit is needed.
*/
-#if defined(NO_CRYPT)
-# define CRYPT 0 /* dummy version */
-#else
-#if defined(USE_CRYPT)
-# define CRYPT 1 /* full version */
-#else
-#if !defined(SFX)
-# define CRYPT 1 /* full version for zip and main unzip */
-#else
-# define CRYPT 0 /* dummy version for unzip sfx */
-#endif
-#endif /* ?USE_CRYPT */
-#endif /* ?NO_CRYPT */
-
-#if CRYPT
-/* full version */
-
-#ifdef CR_BETA
-# undef CR_BETA /* this is not a beta release */
-#endif
-
-#define CR_MAJORVER 2
-#define CR_MINORVER 11
-#ifdef CR_BETA
-# define CR_BETA_VER "c BETA"
-# define CR_VERSION_DATE "05 Jan 2007" /* last real code change */
-#else
-# define CR_BETA_VER ""
-# define CR_VERSION_DATE "05 Jan 2007" /* last public release date */
-# define CR_RELEASE
-#endif
-
-#ifndef __G /* UnZip only, for now (DLL stuff) */
-# define __G
-# define __G__
-# define __GDEF
-# define __GPRO void
-# define __GPRO__
-#endif
-
-#if defined(MSDOS) || defined(OS2) || defined(WIN32)
-# ifndef DOS_OS2_W32
+
+# undef IZ_CRYPT_ANY
+# if defined( IZ_CRYPT_AES_WG) || defined( IZ_CRYPT_TRAD)
+# define IZ_CRYPT_ANY
+# endif /* defined( IZ_CRYPT_AES_WG) || defined( IZ_CRYPT_TRAD) */
+
+# ifdef IZ_CRYPT_ANY
+
+# ifdef IZ_CRYPT_AES_WG
+# include "aes_wg/fileenc.h"
+# endif /* def IZ_CRYPT_AES_WG */
+
+# 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
+
+# define CR_MAJORVER 3
+# define CR_MINORVER 0
+# ifdef CR_BETA
+# define CR_BETA_VER "j BETA"
+# define CR_VERSION_DATE "21 Mar 2013" /* Last real code change. */
+# else
+# define CR_BETA_VER ""
+# define CR_VERSION_DATE "01 Apr 2013" /* Last public release date. */
+# define CR_RELEASE
+# endif
+
+# ifndef __G /* UnZip only, for now (DLL stuff). */
+# define __G
+# define __G__
+# define __GDEF
+# define __GPRO void
+# define __GPRO__
+# endif
+
+# if defined(MSDOS) || defined(OS2) || defined(WIN32)
+# ifndef DOS_OS2_W32
# define DOS_OS2_W32
+# endif
# endif
-#endif
-#if defined(DOS_OS2_W32) || defined(__human68k__)
-# ifndef DOS_H68_OS2_W32
+# if defined(DOS_OS2_W32) || defined(__human68k__)
+# ifndef DOS_H68_OS2_W32
# define DOS_H68_OS2_W32
+# endif
# endif
-#endif
-#if defined(VM_CMS) || defined(MVS)
-# ifndef CMS_MVS
+# if defined(VM_CMS) || defined(MVS)
+# ifndef CMS_MVS
# define CMS_MVS
+# endif
# endif
-#endif
/* To allow combining of Zip and UnZip static libraries in a single binary,
- * the Zip and UnZip versions of the crypt core functions have to be named
- * differently.
+ * the Zip and UnZip versions of the crypt core functions must have
+ * different names.
*/
-#ifdef ZIP
-# ifdef REALLY_SHORT_SYMS
+# ifdef ZIP
+# ifdef REALLY_SHORT_SYMS
# define decrypt_byte zdcrby
-# else
+# else
# define decrypt_byte zp_decrypt_byte
-# endif
-# define update_keys zp_update_keys
-# define init_keys zp_init_keys
-#else /* !ZIP */
-# ifdef REALLY_SHORT_SYMS
+# endif
+# define update_keys zp_update_keys
+# define init_keys zp_init_keys
+# else /* def ZIP */
+# ifdef REALLY_SHORT_SYMS
# define decrypt_byte dcrbyt
+# endif
+# endif /* def ZIP [else] */
+
+# define IZ_PWLEN 256 /* Input buffer size for reading encryption key. */
+# ifndef PWLEN /* for compatibility with older zcrypt release. */
+# define PWLEN IZ_PWLEN
# endif
-#endif /* ?ZIP */
+# define RAND_HEAD_LEN 12 /* Length of Trad. encryption random header. */
-#define IZ_PWLEN 80 /* input buffer size for reading encryption key */
-#ifndef PWLEN /* for compatibility with previous zcrypt release... */
-# define PWLEN IZ_PWLEN
-#endif
-#define RAND_HEAD_LEN 12 /* length of encryption random header */
+/* Encrypted data header and password check buffer sizes.
+ * (One buffer accommodates both types.)
+ */
+# ifdef IZ_CRYPT_AES_WG
+ /* All data from extra field block. */
+# if (MAX_SALT_LENGTH + 2 > RAND_HEAD_LEN)
+# define ENCR_HEAD_LEN (MAX_SALT_LENGTH + 2)
+# endif
+ /* Data required for password check. */
+# if (PWD_VER_LENGTH > RAND_HEAD_LEN)
+# define ENCR_PW_CHK_LEN PWD_VER_LENGTH
+# endif
+# endif /* def IZ_CRYPT_AES_WG */
+
+# ifndef ENCR_HEAD_LEN
+# define ENCR_HEAD_LEN RAND_HEAD_LEN
+# endif
+# ifndef ENCR_PW_CHK_LEN
+# define ENCR_PW_CHK_LEN RAND_HEAD_LEN
+# endif
-/* the crc_32_tab array has to be provided externally for the crypt calculus */
+/* The crc_32_tab array must be provided externally for the crypt calculus. */
-/* encode byte c, using temp t. Warning: c must not have side effects. */
-#define zencode(c,t) (t=decrypt_byte(__G), update_keys(c), t^(c))
+/* Encode byte c, using temp t. Warning: c must not have side effects. */
+# define zencode(c,t) (t=decrypt_byte(__G), update_keys(c), t^(c))
-/* decode byte c in place */
-#define zdecode(c) update_keys(__G__ c ^= decrypt_byte(__G))
+/* Decode byte c in place. */
+# define zdecode(c) update_keys(__G__ c ^= decrypt_byte(__G))
int decrypt_byte OF((__GPRO));
int update_keys OF((__GPRO__ int c));
void init_keys OF((__GPRO__ ZCONST char *passwd));
-#ifdef ZIP
- void crypthead OF((ZCONST char *, ulg, FILE *));
-# ifdef UTIL
- int zipcloak OF((struct zlist far *, FILE *, FILE *, ZCONST char *));
- int zipbare OF((struct zlist far *, FILE *, FILE *, ZCONST char *));
-# else
- unsigned zfwrite OF((zvoid *, extent, extent, FILE *));
- extern char *key;
+# ifdef ZIP
+void crypthead OF((ZCONST char *, ulg));
+# ifdef UTIL
+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;
+# endif /* def UTIL [else] */
+# endif /* def ZIP */
+
+# if (defined(UNZIP) && !defined(FUNZIP))
+int decrypt OF((__GPRO__ ZCONST char *passwrd));
# endif
-#endif /* ZIP */
-#if (defined(UNZIP) && !defined(FUNZIP))
- int decrypt OF((__GPRO__ ZCONST char *passwrd));
-#endif
-
-#ifdef FUNZIP
- extern int encrypted;
-# ifdef NEXTBYTE
+# ifdef FUNZIP
+extern int encrypted;
+# ifdef NEXTBYTE
# undef NEXTBYTE
-# endif
-# define NEXTBYTE \
- (encrypted? update_keys(__G__ getc(G.in)^decrypt_byte(__G)) : getc(G.in))
-#endif /* FUNZIP */
+# endif
+# define NEXTBYTE \
+ (encrypted? update_keys(__G__ getc(G.in)^decrypt_byte(__G)) : getc(G.in))
+# endif /* def FUNZIP */
+
+# else /* def IZ_CRYPT_ANY */
-#else /* !CRYPT */
-/* dummy version */
+/* Dummy version. */
-#define zencode
-#define zdecode
+# define zencode
+# define zdecode
-#define zfwrite fwrite
+# define zfwrite(b,s,c) bfwrite(b,s,c,BFWRITE_DATA)
-#endif /* ?CRYPT */
-#endif /* !__crypt_h */
+# endif /* def IZ_CRYPT_ANY [else] */
+#endif /* ndef __crypt_h */
--- /dev/null
+ Contents of the UnZip 6.10 Source Archive "docs" Directory
+ ----------------------------------------------------------
+
+funzip.txt fUnZip manual page, formatted output
+unzip.txt UnZip manual page, formatted output
+unzipsfx.txt UnZipSFX manual page, formatted output
+zipgrep.txt ZipGrep manual page, formatted output
+zipinfo.txt ZipInfo manual page, formatted output
--- /dev/null
+FUNZIP(1L) FUNZIP(1L)
+
+NAME
+ funzip - filter for extracting from a ZIP archive in a pipe
+
+SYNOPSIS
+ funzip [-password] [archive[.zip|.gz]]
+
+ARGUMENTS
+ [-password]
+ Optional password to be used if ZIP archive is encrypted.
+ Encryption support can be disabled at build time. See DESCRIP-
+ TION for more details.
+
+ [archive[.zip|.gz]]
+ Optional input archive file specification. See DESCRIPTION for
+ details.
+
+DESCRIPTION
+ fUnZip without a file argument acts as a filter; that is, it assumes
+ that a ZIP archive (or a gzip'd(1) file) is being piped into standard
+ input, and it extracts the first (non-directory) member from the ar-
+ chive to standard output (stdout). When standard input (stdin) is a
+ terminal (tty) device, fUnZip assumes that this cannot be a stream of
+ (binary) compressed data and shows a short usage guide, instead. If
+ there is a file argument, then input is read from the specified file
+ instead of from stdin.
+
+ A password for encrypted zip files can be specified on the command line
+ (preceding the file name, if any) by prefixing the password with a
+ hyphen. Note that this constitutes a security risk on many systems;
+ running processes are often visible via simple commands (e.g., ps(1)
+ under Unix), and command-line histories can be read. If the first
+ entry of the zip file is encrypted and no password is specified on the
+ command line, then the user is prompted for a password and the password
+ is not echoed on the console.
+
+ Given the limitation on single-member extraction, fUnZip is most useful
+ in conjunction with a secondary archiver program such as tar(1). The
+ following section includes an example illustrating this usage in the
+ case of disk backups to tape.
+
+EXAMPLES
+ Use fUnZip to extract the first (non-directory) member of the archive
+ "test.zip", and to pipe it into more(1):
+
+ funzip test.zip | more
+
+ Use fUnZip to test the first (non-directory) member of "test.zip" (with
+ any error messages sent to standard error (stderr)):
+
+ funzip test.zip > /dev/null
+
+ Use Zip and fUnZip in place of compress(1) and zcat(1) (or gzip(1L) and
+ gzcat(1L)) for tape backups:
+
+ tar cf - . | zip -7 | dd of=/dev/nrst0 obs=8k
+ dd if=/dev/nrst0 ibs=8k | funzip | tar xf -
+
+ (where, for example, nrst0 is a SCSI tape drive).
+
+BUGS
+ When piping an encrypted file into more and allowing fUnZip to prompt
+ for password, the terminal may sometimes be reset to a non-echo mode.
+ This is apparently due to a race condition between the two programs;
+ fUnZip changes the terminal mode to non-echo before more reads its
+ state, and more then "restores" the terminal to this mode before exit-
+ ing. To recover, run fUnZip on the same file but redirect to /dev/null
+ rather than piping into more. After prompting again for the password,
+ fUnZip should reset the terminal properly.
+
+ There is no way to extract any member except the first (non-directory)
+ from a ZIP archive, but fUnZip will skip archive members which are
+ directories, and extract the first member which is not a directory.
+
+ Only Deflate compression and Traditional ZIP encryption are supported.
+
+ The functionality of fUnZip should be incorporated into UnZip itself
+ (in some future release).
+
+SEE ALSO
+ gzip(1L), unzip(1L), unzipsfx(1L), zip(1L), zipcloak(1L), zipinfo(1L),
+ zipnote(1L), zipsplit(1L)
+
+URL
+ The Info-ZIP main Web page is:
+ http://www.info-zip.org/
+
+ FTP access is available, too:
+ ftp://ftp.info-zip.org/pub/infozip/
+
+AUTHOR
+ Mark Adler (Info-ZIP)
+
+Info-ZIP 06 Nov 2013 (v4.10) FUNZIP(1L)
--- /dev/null
+UNZIP(1L) UNZIP(1L)
+
+NAME
+ unzip - extract, list, or test compressed files in a ZIP archive.
+
+SYNOPSIS
+ unzip [ unzip_options ] [ file[.zip] ] [ member ... ]
+ unzip -Z [ zipinfo_options ] [ file[.zip] ] [ member ... ]
+
+DESCRIPTION
+ UnZip extracts, lists, or tests files in a ZIP archive (an archive for-
+ mat commonly used on many different systems). The default behavior
+ (with no options) is to extract into the current directory (and subdi-
+ rectories below it) all files from the specified ZIP archive. A com-
+ panion program, Zip, creates ZIP archives.
+
+ Info-ZIP UnZip and Zip were intended to be compatible with archives
+ created by PKWARE's PKZIP and PKUNZIP programs (originally for MS-DOS),
+ but in many cases the program options or default behaviors differ.
+ Nowadays, many other programs are available which work with ZIP ar-
+ chives.
+
+ Note: Beginning with UnZip version 6.10, the old command-line parser
+ has been replaced by one like the one used in Zip (version 3.0 and
+ later). One significant change is that option negation now uses a
+ TRAILING hyphen ("-"), so, for example, -B- negates the -B option.
+ This change was made because a double hyphen ("--") now introduces a
+ long option.
+
+ To display the basic built-in help, use the command:
+ unzip -h
+ To display the extended built-in help, use the command:
+ unzip -hh
+ The built-in help may be more current than this manual page, especially
+ between full product releases.
+
+ To list all available options for a particular UnZip program, use the
+ command:
+ unzip --show-options
+ This report will not include any options which are available only on
+ other system types, or options which must be enabled at build-time but
+ were not enabled in the particular UnZip program being used.
+
+ [VMS] On VMS, alternate program editions with VMS-style command-line
+ interfaces are also available. For details, see the VMS-specific docu-
+ mentation.
+
+ARGUMENTS
+ file[.zip]
+ File path/name of a ZIP archive. A wildcard name may be used to
+ specify multiple ZIP archives to be processed in one command.
+ On VMS systems, any of the standard wildcards for a direc-
+ tory/file specification may be used: "...", "*", or "%" (or,
+ since VMS V7.2, "?"). On non-VMS systems, a wildcard name may
+ be used only in the filename part of the file specification, not
+ in the directory part, and, on Unix, characters which are spe-
+ cial to the shell must be escaped or quoted to protect them from
+ processing by the shell. If a wildcard is used, then each
+ matching archive file is processed in an order determined by the
+ operating system or shell (or file system). Non-VMS wildcard
+ expressions are similar to those supported (for "globbing") in
+ commonly used Unix shells (csh, ksh, sh, and so on) and may con-
+ tain:
+
+ * Matches a sequence of 0 or more characters.
+
+ ? Matches exactly 1 character.
+
+ [...] Matches any single character found inside the brackets.
+ Ranges are specified by a beginning character, a hyphen,
+ and an ending character. If an exclamation point ("!")
+ or a caret ("^") follows the left bracket, then the range
+ of characters within the brackets is complemented. That
+ is, anything except the characters inside the brackets is
+ considered a match. To specify a literal left bracket,
+ use the three-character sequence "[[]".
+
+ If no wildcard matches are found, then the specification is
+ assumed to be a literal filename. If that also fails, then the
+ suffix ".zip" and/or ".ZIP" is appended, and that is tried.
+ (For this reason, if a non-existent file is specified, then the
+ resulting error message may mention these other names with their
+ ".zip" or ".ZIP" suffixes.)
+
+ Note that a ".zip" or ".ZIP" name ending on an archive is merely
+ a convention, not a requirement. For example, a self-extracting
+ ZIP archive named "fred" or "fred.exe" could be processed as if
+ it were an ordinary archive; just specify the actual file name
+ with its actual name ending (if any), whatever that may be.
+
+ Strictly speaking, an archive name is optional, but, except in a
+ special case like "unzip -v", it's difficult to do much useful
+ work without specifying an archive.
+
+ member ...
+ An optional list of archive members to be processed, separated
+ by spaces. If no member list is specified, then all archive
+ members are processed. Wildcard patterns (like those used for
+ an archive file name on Unix, described above) may be used to
+ match multiple members. Again, be sure to quote expressions
+ that would otherwise be expanded or modified by the operating
+ system or shell.
+
+ On Mac OS X systems, file attributes, a resource fork, and simi-
+ lar data may be stored in a separate AppleDouble archive member
+ which has a "._" name prefix. When restoring files with such
+ attributes (no -J/--junk-attrs option, and the destination file
+ system supports such attributes), if the user specifies only the
+ main archive member, then UnZip should automatically handle the
+ corresponding AppleDouble archive member. If -J/--junk-attrs is
+ specified, or the destination file system does not support such
+ file attributes (so that an AppleDouble archive member will be
+ stored as a separate file), then AppleDouble archive members are
+ not handled automatically, and the user must specify patterns
+ which explicitly include any desired AppleDouble archive mem-
+ bers.
+
+ On VMS systems, the wildcard rules used for archive members are
+ the same as on Unix systems. VMS wildcard rules are used only
+ for archive file specifications, not for archive member pat-
+ terns.
+
+OPTIONS
+ UnZip's usage summary ("unzip -h") is kept short to try to accommodate
+ small terminal/emulator screens, so it's normally incomplete. The
+ option list below should be complete.
+
+OPTIONS (ZipInfo Mode)
+ -Z
+ --zipinfo-mode
+ ZipInfo mode. If the first option on the command line is -Z,
+ then the program runs in ZipInfo mode. Remaining options are
+ interpreted as ZipInfo options. See the zipinfo manual page for
+ a description of those options.
+
+OPTIONS (Primary Mode)
+ Options in this group (-c -f -h -l -p -T -t -u -v -z) specify the pri-
+ mary mode of operation of UnZip. Only one of these primary mode
+ options may be specified.
+
+ -c
+ --to-stdout
+ Primary Mode. Extract files to stdout/screen. This option is
+ similar to the -p option except that the name of each file is
+ displayed as it is extracted, and the -a option is allowed,
+ which can provide automatic ASCII-EBCDIC conversion, where
+ appropriate.
+
+ -f
+ --freshen
+ Primary Mode. Freshen existing files. That is, extract only
+ those files that already exist on disk and that are newer than
+ the disk copies. By default UnZip queries before overwriting,
+ but the -o option may be used to suppress the queries. Note
+ that on many operating systems, the TZ (timezone) environment
+ variable must be set correctly in order for -f/--freshen and
+ -u/--update to work properly. (On Unix the variable is usually
+ set automatically.) The reasons for this are somewhat subtle
+ but have to do with the differences between DOS-format file
+ times (always local time) and Unix-format times (always UTC) and
+ the necessity to compare the two. A typical TZ value is
+ "PST8PDT" (US Pacific time with automatic adjustment for Day-
+ light Saving Time).
+
+ -h
+ --help
+ Primary Mode. Display brief (roughly 24 lines) usage instruc-
+ tions. See also -hh.
+
+ -hh
+ --long-help
+ Primary Mode. Display extended help (more complete usage
+ instructions). See also -h.
+
+ -l
+ --list
+ Primary Mode. List archive members. By default, a brief format
+ is used, which includes the following items: member name, uncom-
+ pressed file size ("Length"), and modification date-time of the
+ member. A summary is included at the end of the report, showing
+ total size and count for all the members in the report. Speci-
+ fying a member list limits the report to those members.
+
+ Adding -v (--verbose) to an "unzip -l" command line adds the
+ following items to the report: compression method, compressed
+ size ("Size"), compression ratio, and 32-bit CRC.
+
+ In contrast to some other programs, UnZip does not include the
+ 12-byte encryption header in the compressed size values for a
+ Traditionally encrypted member. Therefore, compressed size and
+ compression ratio figures are independent of the member's
+ encryption status and show the correct compression performance.
+ (The complete size of the encrypted compressed data stream for
+ archive members is reported by the more verbose ZipInfo reports.
+ See the separate zipinfo manual page.)
+
+ If UnZip was built with OS2_EAS enabled, then the -l report also
+ includes the sizes of stored OS/2 extended attributes (EAs) and
+ OS/2 access control lists (ACLs). In addition, the archive com-
+ ment and individual member comments (if any) are displayed.
+
+ If a file was archived from a single-case file system (for exam-
+ ple, the old MS-DOS FAT file system) and the -L option was
+ given, the filename is converted to lowercase and is shown pre-
+ fixed with a caret (^).
+
+ Note: If only -v (--verbose) is specified with an archive name,
+ then UnZip acts as if "-l -v" were specified, and a detailed
+ listing is generated.
+
+ --license
+ Primary Mode. Display the Info-ZIP license.
+
+ -p
+ --pipe-to-stdout
+ Primary Mode. Extract files to stdout (pipe). Only the actual
+ file data for the members are sent to stdout (no file names, or
+ other information, as would be displayed with -c), and the files
+ are always extracted in binary format, just as they are stored
+ (no line-ending or ASCII-EBCDIC conversions).
+
+ -T
+ --timestamp-new
+ Primary Mode. Set the timestamp on the archive(s) to that of
+ the newest file in each one. This corresponds to Zip's -go
+ option, except that it can be used on wildcard archives (for
+ example, "unzip -T '*.zip'") and is much faster.
+
+ -t
+ --test
+ Primary Mode. Test archive members. Testing means that each
+ archive member is extracted in memory (expanding and decrypting,
+ as needed), but not written to a file. The resulting CRC
+ (cyclic redundancy check, an enhanced checksum) of the extracted
+ data is then compared with the original file's stored CRC value,
+ and an error message is emitted if a CRC mismatch is detected.
+
+ Adding -v to -t adds some diagnostic information to the report
+ for archive members with LZMA or PPMd compression.
+
+ -u
+ --update
+ Primary mode. Update existing files and create new ones if
+ needed. This mode performs the same function as the Freshen
+ (-f) mode, extracting (with query) files that are newer than
+ those with the same name on disk, but it also extracts those
+ files that do not already exist on disk. See -f, above, for
+ information on setting the timezone properly.
+
+ -v
+ --verbose
+ Primary mode (when alone) or option. When used as a primary
+ mode (alone), and no archive is specified, an "unzip -v" command
+ generates a report showing the program version, build options,
+ and relevant environment variables.
+
+ When used with some other primary mode option, -v can make out-
+ put more verbose.
+
+ If no other primary mode is specified, and an archive is speci-
+ fied, then UnZip acts as if "-l -v" were specified, and a
+ detailed listing is generated. See -l.
+
+ --version
+ Primary Mode. Display the program version, build options, and relevant
+ environment variables.
+
+ Currently, --version is implemented as a synonym for -v/--ver-
+ bose, so, for proper operation, it must be specified with no
+ other options.
+
+ -z
+ --zipfile-comment
+ Primary mode. Display only the archive comment.
+
+OPTIONS (Ordinary)
+ -2
+ --force-ods2
+ [VMS] Convert extracted file names to ODS2-compatible names,
+ even on an ODS5 file system. By default, if the destination
+ file system is ODS5, case is preserved, and extended file name
+ characters are caret-escaped as needed, while if the destination
+ file system is ODS2, ODS2-invalid characters are replaced by
+ underscores.
+
+ -A
+ --api-help
+ [OS/2, Unix DLL] Print extended help for the DLL's application
+ programming interface (API).
+
+ -a
+ --ascii
+ Convert text files. Ordinarily, all files are extracted exactly
+ as they are stored, byte-for-byte. With -a, line endings in a
+ text file are adjusted to the local standard as the file is
+ extracted. When appropriate, ASCII<-->EBCDIC conversion is also
+ done.
+
+ Zip (or a similar archiving program) identifies files as
+ "binary" or "text" when they are archived. (A short-format Zip-
+ Info report denotes a binary file with a "b", and a text file
+ with a "t".) Zip's identification of text files may not be per-
+ fect, so UnZip prints "[binary]" or "[text]" as a visual check
+ for each file it extracts with -a. The -aa option forces all
+ files to be extracted (and converted) as text, regardless of the
+ supposed file type.
+
+ [VMS] On VMS, for archives with VMS attribute information (made
+ with "zip -V" or "ZIP /VMS"), files are always created with
+ their original record formats. For archives without VMS
+ attribute information (not made with "zip -V" or "ZIP /VMS"),
+ all files are normally created with Stream_LF record format.
+ With -a, text files are normally created with variable-length
+ record format, but adding -S gives them Stream_LF record format.
+ With -aa, all files are treated as text files. See also -b and
+ -S.
+
+ -B
+ --backup
+ [when built with UNIXBACKUP enabled] Save a backup copy of each
+ overwritten file. The backup file gets the name of the target
+ file with a tilde and optionally a unique sequence number (up to
+ 5 digits) appended. The sequence number is appended whenever
+ another file with the original name plus tilde already exists.
+ When used together with the "overwrite all" option, -o, numbered
+ backup files are never created. In this case, all backup files
+ are named as the original file with an appended tilde, and
+ existing backup files are deleted without notice. This feature
+ works similarly to the default behavior of emacs(1) in many
+ locations.
+
+ Example: the old copy of "foo" is renamed to "foo~".
+
+ Warning: Users should be aware that the -B option does not pre-
+ vent loss of existing data under all circumstances. For exam-
+ ple, when UnZip is run in overwrite-all mode, an existing "foo~"
+ file is deleted before UnZip attempts to rename "foo" to "foo~".
+ When this rename attempt fails (because of a file lock, insuffi-
+ cient privileges, or any other reason), the extraction of "foo~"
+ gets cancelled, but the old backup file is already lost. A sim-
+ ilar scenario takes place when the sequence number range for
+ numbered backup files gets exhausted (99999, or 65535 for 16-bit
+ systems). In this case, the backup file with the maximum
+ sequence number is deleted and replaced by the new backup ver-
+ sion without notice.
+
+ -b
+ --binary
+ [Tandem, VMS] Selects the file record format used when extract-
+ ing binary files. -b may conflict or interact with -a in dif-
+ ferent ways on different system types. -b is ignored on systems
+ other than Tandem and VMS.
+
+ Zip (or a similar archiving program) identifies files as
+ "binary" or "text" when they are archived. (A short-format Zip-
+ Info report denotes a binary file with a "b", and a text file
+ with a "t".)
+
+ [Tandem] Force the creation files with filecode type 180 ('C')
+ when extracting archive members marked as "text". (On Tandem, -a
+ is enabled by default, see above).
+
+ [VMS] On VMS, for archives with VMS attribute information (made
+ with "zip -V" or "ZIP /VMS"), files are always created with
+ their original record formats. For archives without VMS
+ attribute information (not made with "zip -V" or "ZIP /VMS"),
+ files are normally created with Stream_LF record format. With
+ -b, binary files are created with fixed-length, 512-byte record
+ format. With -bb, all files are treated as binary files. When
+ extracting to standard output (-c or -p option in effect), the
+ default conversion of text record delimiters is disabled for
+ binary files (with -b), or for all files (with -bb).
+
+ -C
+ --ignore-case ([CMS, MVS] --CMS-MVS-lower)
+ Use case-insensitive name matching for names in the member list
+ and the -x excluded-member list on the command line. By
+ default, case-sensitive matching is done. For example, specify-
+ ing "makefile" on the command line will match only "makefile" in
+ the archive, not "Makefile" or "MAKEFILE". On many systems, the
+ local file system is case-insensitive, so case-insensitive name
+ matching would be more natural. With -C, "makefile" would match
+ "makefile", "Makefile", or "MAKEFILE".
+
+ -C does not affect the search for the ZIP archive file(s), nor
+ the matching of archive members to existing files on the extrac-
+ tion path. So, on a case-sensitive file system, UnZip will
+ never try to overwrite a file "FOO" when extracting a member
+ named "foo"!
+
+ -c
+ --to-stdout
+ Primary Mode. Extract files to stdout/screen. For details, see
+ Primary Mode options.
+
+ -D
+ --dir-timestamps
+ Control timestamps on extracted files and directories. By
+ default, UnZip restores timestamps for extracted files, but not
+ for directories it creates. Specifying -D tells UnZip not to
+ restore any timestamps. Specifying -D- tells UnZip to restore
+ timestamps for directories as well as other items. -D- works
+ only on systems that support setting timestamps for directories
+ (currently ATheOS, BeOS, MacOS, OS/2, Unix, VMS, Win32). On
+ other systems, -D- has no effect.
+
+ [Non-VMS] Timestamp restoration behavior changed between UnZip
+ versions 6.00 and 6.10. The following table shows the effects
+ of various -D options for both versions.
+
+ UnZip version |
+ 6.00 | 6.10 | Restore timestamps on:
+ -----------+-----------+------------------------
+ -DD | -D | Nothing.
+ -D | (default) | Files, not directories.
+ (default) | -D- | Files and directories.
+
+ [VMS] The old behavior on VMS was the same as the new behavior
+ on all systems. (The old negated --D option is now -D-, because
+ of changes to the command-line parser.)
+
+ -d dest_dir
+ --extract-dir dest_dir
+ Specifies a destination directory for extracted files. By
+ default, files are extracted (and subdirectories created) in the
+ current (default, working) directory. With -d dest_dir, extrac-
+ tion is done into the specified directory, instead. See also
+ -da.
+
+ The option and directory may be concatenated without any white
+ space between them, but this may cause normal shell behavior to
+ be suppressed. For example, "-d ~" (tilde) is expanded by Unix
+ shells into the name of the user's home directory, but "-d~" is
+ treated as a literal "~" subdirectory of the current directory.
+
+ [VMS] On VMS, only a VMS-style device:[directory] specification
+ is permitted.
+
+ -da[=reuse]
+ --auto-extract-dir[=reuse]
+ Specifies a destination directory for extracted files which is
+ derived from the base name of the archive. By default, files
+ are extracted (and subdirectories created) in the current
+ (default, working) directory. With -da, UnZip automatically
+ derives a subdirectory name from the archive name, creates that
+ subdirectory, and extracts files into that subdirectory.
+
+ For example, with -da, extraction of "fred.zip" is done into
+ subdirectory "fred" instead of into the current directory. (On
+ VMS, subdirectory "[.fred]".)
+
+ Using this option can help to avoid cluttering the current
+ directory with files extracted from an archive whose structure
+ does not include a top-level directory.
+
+ For greater safety, by default, UnZip will refuse to extract
+ into an automatic extraction directory which already exists.
+ Specifying the optional keyword "reuse" will allow an existing
+ directory to be used.
+
+ If -da is specified as a default option in an environment vari-
+ able, it can be overridden by either a negated -da- option or an
+ explicit -d dest_dir option. See also -d.
+
+ -E
+ --mac-efs
+ [MacOS (pre-OS-X)] Display contents of MacOS extra field during
+ restore operation.
+
+ -F
+ --keep-nfs
+ [Acorn] Suppress removal of NFS filetype extension from stored
+ filenames.
+
+ [non-Acorn systems supporting long filenames with embedded com-
+ mas, and only if compiled with ACORN_FTYPE_NFS defined] Trans-
+ late filetype information from ACORN RISC OS extra field blocks
+ into a NFS filetype extension and append it to the names of the
+ extracted files. (When the stored filename appears already to
+ have an appended NFS filetype extension, it is replaced by the
+ info from the extra field.)
+
+ -f
+ --freshen
+ Primary Mode. Freshen existing files. For details, see Primary
+ Mode options.
+
+ -h
+ --help
+ Primary Mode. Display brief (roughly 24 lines) usage instruc-
+ tions. For details, see Primary Mode options.
+
+ -hh
+ --long-help
+ Primary Mode. Display complete usage instructions. For
+ details, see Primary Mode options.
+
+ -I char_set
+ --iso-char-set char_set
+ [Unix] Select ISO character set char_set.
+
+ -i
+ --no-mac-ef-names
+ [MacOS (pre-OS-X)] Ignore filenames stored in MacOS extra
+ fields. Instead, the most compatible filename stored in the
+ generic part of the member's header is used.
+
+ -J
+ --junk-attrs
+ [BeOS] Junk file attributes. The file's BeOS file attributes
+ are not restored, only the file's data.
+
+ [MacOS (pre-OS-X)] Ignore Mac OS extra fields.
+
+ [Mac OS X] Do no special Mac-specific processing of AppleDouble
+ archive members. An AppleDouble archive member is restored as a
+ separate "._name" file, as it would be on a non-Mac file system.
+
+ Note that "-J" is not equivalent to
+ "-Je -Jf -Jr". With "-J", an AppleDouble archive
+ member is restored as a separate "._name" file, as it would be on a
+ non-Mac file system. With "-Je -Jf -Jr", all the data in an
+ AppleDouble archive member are ignored, so the data fork file is
+ restored with no extended attributes (-Je), no Finder info
+ (-Jf), and no resource fork (-Jr); no "._name" file is
+ created.
+
+ Note that -j acts on the path of an archive member, and is
+ independent of the destination directory specified using -d or
+ -da. For example, with "-d zz -j=1", an archive
+ member like "a/b/c/d/ee.txt" would be extracted as "zz/b/c/d/ee.txt",
+ with -j=1 stripping the "a/" off the archive path, and
+ -d zz adding the "zz/" to the path in the destination file
+ system.
+
+ -Je
+ --junk-extattr
+ [Mac OS X] Ignore all Mac OS extended attributes. Extended
+ attribute processing is available on Mac OS X 10.4 and later.
+ See also -J, -Jf, -Jq, and -Jr.
+
+ -Jf
+ --junk-finder
+ [Mac OS X] Ignore Mac OS Finder info. See also -J, -Je, -Jq,
+ and -Jr.
+
+ -Jq
+ --junk-qtn
+ [Mac OS X] Ignore Mac OS X Quarantine ("com.apple.quarantine")
+ extended attribute. Use "-Je", to ignore this and all other
+ extended attributes. Extended attribute processing is available
+ on Mac OS X 10.4 and later. See also -J, -Je, -Jf, and -Jr.
+
+ -Jr
+ --junk-rsrc
+ [Mac OS X] Ignore Mac OS Resource fork. See also -J, -Je, -Jf,
+ and -Jq.
+
+ -j[=depth]
+ --junk-dirs[=depth]
+ Junk directories on extracted files. With -j, all directory
+ information is stripped from an archive member name, so all
+ files are extracted into the destination directory. (See also
+ -d and -da.)
+
+ If a depth (=depth, where depth is a positive integer) is speci-
+ fied, then that number of directory levels will be stripped from
+ an archive member name. For example, an archive member like
+ "a/b/c/d/ee.txt" would normally be extracted as
+ "a/b/c/d/ee.txt". With -j, it would be extracted as "ee.txt".
+ With -j=2, the first two directory levels would be stripped, so
+ it would be extracted as "c/d/ee.txt".
+
+ --jar
+ Treat archive(s) as Java JAR. Over-simplification in Java JAR archives
+ can cause UnZip to transform UTF-8 file names according to inappropri-
+ ate (MS-DOS) rules, yielding corrupt names on extracted files (typi-
+ cally those with character codes 128-255). Archives containing a Java
+ "CAFE" extra field should be detected automatically, and handled cor-
+ rectly, but not all JAR archives include that extra field. Specifying
+ --jar tells UnZip to expect UTF-8 file names, regardless of whether the
+ archive contains a "CAFE" extra field.
+ -K
+ --keep-s-attrs
+ [AtheOS, BeOS, Unix] Retain SUID/SGID/Tacky permission bits. By
+ default, these permission bits are cleared, for security rea-
+ sons.
+
+ -k
+ --keep-permissions
+ [AtheOS, BeOS, Unix, VMS] Control how archived permissions or
+ protections are restored on extracted files and directories.
+
+ By default, archived permissions are restored with some limita-
+ tions. On AtheOS, BeOS, and Unix, the current umask value is
+ applied (to the normal user/group/other permissions). On VMS,
+ the current default protection is applied to the UIC-based
+ (SOGW) protections.
+
+ With -k, the archived permissions are restored without regard to
+ the Unix umask or VMS default protection. (This was the default
+ behavior in UnZip versions before 6.10.)
+
+ With -k-, the archived permissions are ignored, so only the Unix
+ umask or VMS default protection is effective. (On VMS, directo-
+ ries are always created without any Delete access.)
+
+ On AtheOS, BeOS, and Unix, the SUID/SGID/Tacky permission bits
+ are controlled by the -K/--keep-s-attrs option, regardless of
+ the -k/--keep-permissions setting.
+
+ -ka
+ --keep-acl
+ [VMS] Restore ACLs on extracted files and directories.
+
+ -L
+ --lowercase-names
+ Convert to lowercase any filename originating on an uppercase-
+ only operating system or file system. (This was UnZip's default
+ behavior in versions before 5.11. The current default behavior
+ is the same as the old behavior with the -U option. -U is now
+ used for another purpose.)
+
+ Depending on the archiver, files archived from single-case file
+ systems (old MS-DOS FAT, VMS ODS2, and so on) may be stored as
+ all-uppercase names; this can be ugly or inconvenient when
+ extracting to a case-preserving file system such as OS/2 HPFS or
+ a case-sensitive one such as on Unix. By default UnZip lists
+ and extracts such filenames exactly as they're stored (excepting
+ truncation, conversion of unsupported characters, an so on).
+ With -L, the names of all files from certain systems will be
+ converted to lowercase. With -LL, all file names will be down-
+ cased, regardless of the originating file system.
+
+ -l
+ --list
+ Primary Mode. List archive members. For details, see Primary
+ Mode options.
+
+ -M ([CMS,MVS] Or: -m)
+ --more
+ Pipe all output through an internal pager similar to the Unix
+ more(1) command. At the end of a screenful of output, UnZip
+ pauses with a "--More--" prompt; the next screenful may be
+ viewed by pressing the Enter/Return key or the space bar. UnZip
+ can be terminated by pressing the "Q" key and, on some systems,
+ the Enter/Return key. Unlike Unix more(1), there is no forward-
+ searching or editing capability. Also, UnZip doesn't notice if
+ long lines wrap at the edge of the screen, effectively resulting
+ in the printing of two or more lines and the likelihood that
+ some text will scroll off the top of the screen before being
+ viewed. If the actual number of lines on the screen can not be
+ determined, 24 lines will be assumed.
+
+ -N
+ --comment-to-note
+ [Amiga] Extract member comments as Amiga filenotes. Member com-
+ ments are created with the -c option of Zip, or with the -N
+ option of the Amiga port of Zip, which stores filenotes as com-
+ ments.
+
+ -n
+ --never-overwrite
+ When extracting, never overwrite existing files. If a file
+ already exists, then skip the extraction of that file without
+ asking. See also -o (--overwrite).
+
+ By default, UnZip queries the user before extracting any file
+ that already exists. The user may choose to overwrite only the
+ current file, overwrite all files, skip extraction of the cur-
+ rent file, skip extraction of all existing files, or rename the
+ current file (choose a new name for the extracted file).
+
+ [VMS] On VMS, the usual query choices are to create a new ver-
+ sion of an existing file, to skip extraction, or to rename the
+ current file. In the case where an archive member name includes
+ a version number, and -V ("retain VMS file version numbers") is
+ in effect, then an additional query choice is offered: to over-
+ write the existing file.
+
+ -O char_set
+ --oem-char-set char_set
+ [Unix] Select OEM character set char_set.
+
+ -o
+ --overwrite
+ When extracting, always overwrite existing files without prompt-
+ ing. This is a dangerous option, so use it with care. (It is
+ often used with -f, however, and is the only way to overwrite
+ directory EAs on OS/2.) See also -n (--never-overwrite).
+
+ By default, UnZip queries the user before extracting any file
+ that already exists.
+
+ [Non-VMS] On non-VMS systems, the user may choose to overwrite
+ only the current file, overwrite all files, skip extraction of
+ the current file, skip extraction of all existing files, or
+ rename the current file (choose a new name for the extracted
+ file).
+
+ [VMS] On VMS, the usual query choices are to create a new ver-
+ sion of an existing file, to skip extraction, or to rename the
+ current file. In the case where an archive member name includes
+ a version number, and -V ("retain VMS file version numbers") is
+ in effect, then an additional query choice is offered: to over-
+ write the existing file. In this case, -o selects the "new ver-
+ sion" choice, and -oo (or "-o -o") selects the "overwrite"
+ choice.
+
+ -P password
+ --password password
+ Use password to decrypt encrypted archive members (if any).
+ THIS IS INSECURE! Many multi-user operating systems provide
+ ways for any user to see the current command line of any other
+ user. Even on stand-alone systems, there is always the threat
+ of over-the-shoulder peeking. Storing the plaintext password as
+ part of a command line in an automated script can be even less
+ secure, Whenever possible, use the non-echoing, interactive
+ prompt to enter passwords. Where security is truly important,
+ use a strong encryption method, such as AES, instead of the rel-
+ atively weak encryption provided by Traditional ZIP encryption.
+ Or, use an external encryption program, such as GnuPG, before
+ archiving the file. (Note that Zip will probably not be able to
+ do significant compression on a file which has already been
+ encrypted.)
+
+ -p
+ --pipe-to-stdout
+ Primary Mode. Extract files to stdout (pipe). For details, see
+ Primary Mode options.
+
+ -q
+ --quiet
+ Perform operations quietly. (-qq: even more quietly). By
+ default, UnZip prints the names of the files it's extracting or
+ testing, the extraction methods, any member or archive comments
+ that may be stored in the archive, and possibly a summary when
+ finished with each archive. The -q[q] options suppress the
+ printing of some or all of these messages.
+
+ -r
+ --remove-exts
+ [Tandem] Remove file extensions.
+
+ -S
+ --streamlf
+ [VMS] Use Stream_LF record format when converting extracted text
+ files (-a, -aa), instead of the text-file default, variable-
+ length record format.
+
+ [VMS] On VMS, for archives with VMS attribute information (made
+ with "zip -V" or "ZIP /VMS"), files are always created with
+ their original record formats. For archives without VMS
+ attribute information (not made with "zip -V" or "ZIP /VMS"),
+ all files are normally created with Stream_LF record format.
+ With -a, text files are normally created with variable-length
+ record format, but adding -S gives them Stream_LF record format.
+ With -aa, all files are treated as text files. See also -a and
+ -b.
+
+ -s
+ --space-to-uscore
+ Convert spaces in filenames to underscores. Normally, on a sys-
+ tem which allows spaces in filenames, UnZip extracts filenames
+ with spaces intact (for example, "EA DATA. SF"). Working with
+ such file names can be awkward, however, so -s can be used to
+ replace spaces with underscores.
+
+ -sc
+ --show-command
+ Show processed command line (options, arguments), and then exit.
+
+ Strictly speaking this is a primary-mode option, but it's
+ intended for use in program development, not for normal use.
+
+ -si
+ --show-pid
+ [Non-VMS] Show the UnZip program's process ID (pid) before per-
+ forming any other work. This value can then be used in a "kill
+ -USR1 pid" command to trigger a user-triggered progress report.
+
+ -so
+ --show-options
+ Display all valid program options, then exit.
+
+ Strictly speaking this is a primary-mode option, but it's
+ intended for use in program development, not for normal use.
+
+ -T
+ --timestamp-new
+ Primary Mode. Set the timestamp on the archive(s) to that of
+ the newest file in each one. For details, see Primary Mode
+ options.
+
+ -t
+ --test
+ Primary Mode. Test archive members. For details, see Primary
+ Mode options.
+
+ -U
+ --unicode
+ [UNICODE_SUPPORT] Control UTF-8 handling. When UNICODE_SUPPORT
+ is available, -U forces UnZip to escape all non-ASCII characters
+ from UTF-8 coded filenames as "#Uxxxx' (for UCS-2 characters, or
+ "#Lxxxxxx" for Unicode codepoints needing 3 octets). This
+ option is provided mainly for debugging, when the fairly new
+ UTF-8 support is suspected of mangling extracted filenames.
+
+ -UU disables the recognition of UTF-8 encoded filenames. The
+ handling of filename codings within UnZip falls back to the
+ behavior of pre-Unicode versions.
+
+ [old, obsolete usage] Leave filenames uppercase if created on
+ MS-DOS, VMS, and so on. See -L.
+
+ -u
+ --update
+ Primary mode. Update existing files and create new ones if
+ needed. For details, see Primary Mode options.
+
+ -V
+ --keep-versions
+ [Non-CMS-MVS] Retain VMS file version numbers. VMS files can be
+ stored with a version number, in the format "file.type;##",
+ where "##" is a positive decimal number. By default VMS ";##"
+ version numbers are stripped, but this option allows them to be
+ retained. (On file systems that limit filenames to particularly
+ short lengths, the version numbers may be truncated or stripped
+ regardless of this option.)
+
+ [Non-VMS] Note that before UnZip version 6.10, on a non-VMS sys-
+ tem, a file with a name like "fred;123" would, by default, be
+ extracted as "fred", even if the file did not originate on a VMS
+ system (so that ";123" was probably not really a VMS version
+ number). Beginning with UnZip version 6.10, the default behav-
+ ior is to strip VMS version numbers only from files which were
+ archived on a VMS system. To restore the old behavior, and
+ always strip apparent VMS version numbers, explicitly negate the
+ option: -V-.
+
+ [VMS] Note that on VMS, -V affects only version numbers, and is
+ not needed to restore VMS file attributes. Zip's -V (/VMS)
+ option is required to store VMS attributes in an archive. If
+ that was done when an archive was created, then UnZip will
+ always restore those attributes when a file is extracted.
+
+ -v
+ --verbose
+ When used with some primary mode option, -v can make output more
+ verbose. See also Primary Mode options, and -l in particular.
+
+ Note: If only -v (--verbose) is specified with an archive name,
+ then UnZip acts as if "-l -v" were specified, and a detailed
+ listing is generated.
+
+ --version
+ Primary Mode. Display the program version, build options, and relevant
+ environment variables. For details, see Primary Mode options.
+
+ -W
+ --wild-no-span
+ [WILD_STOP_AT_DIR] (Valid when the program was built with the C
+ macro WILD_STOP_AT_DIR defined.) By default, the wildcard char-
+ acters "?" (single-character wildcard) and "*" (multi-character
+ wildcard) match any character in a member path/name. "-W" modi-
+ fies the pattern-matching behavior for archive members so that
+ both "?" (single-character wildcard) and "*" (multi-character
+ wildcard) do not match the directory separator character "/".
+ (The two-character sequence "**" acts as a multi-character wild-
+ card that includes the directory separator in its matched char-
+ acters.) For example, with "-W":
+
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "**.c" matches both "foo.c" and "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+
+ This modified behavior is equivalent to the pattern matching
+ style used by the shells of some of UnZip's supported target OSs
+ (one example is Acorn RISC OS). This option may not be avail-
+ able on systems where the Zip archive's internal directory sepa-
+ rator character "/" is allowed as regular character in native
+ operating system filenames.
+
+ [non-VMS] Currently, UnZip uses the same pattern matching rules
+ for both wildcard archive file name specifications and archive
+ member selection patterns on most system types. For systems
+ allowing "/" as regular filename character, the -W option would
+ not work as expected on a wildcard file name specification.
+
+ -X
+ --restore-owner
+ [NT, OS/2, Unix, VMS, Tandem] Restore owner info (user and group
+ info (UID/GID) on Unix, UIC on VMS, or access control lists
+ (ACLs) on certain network-enabled versions of OS/2 (Warp Server
+ with IBM LAN Server/Requester 3.0 to 5.0; Warp Connect with IBM
+ Peer 1.0), or security ACLs on Windows NT.) In most cases this
+ will require special system privileges, and doubling the option
+ (-XX) on NT instructs UnZip to use privileges for extraction;
+ but on Unix, for example, a user who belongs to several groups
+ can restore files owned by any of those groups, so long as the
+ user IDs match the user's own. Note that ordinary file
+ attributes are always restored. This option applies only to
+ optional, extra ownership info available on some operating sys-
+ tems. (NT's access control lists do not appear to be especially
+ compatible with OS/2's, so no attempt is made at cross-platform
+ portability of access privileges. It is not clear under which
+ conditions this would ever be useful anyway.)
+
+ -x member ...
+ --exclude member ...
+ An optional list of archive members to be excluded from process-
+ ing. Because wildcard characters normally match "/" directory
+ separators (for exceptions, see the option -W), this option may
+ be used to exclude any files that are in subdirectories. For
+ example, "unzip foo *.[ch] -x */*" would extract all C source
+ files (*.c, *.h) in the main directory, but none in any subdi-
+ rectories. Without the -x option, all C source files in all
+ directories within the archive would be extracted.
+
+ When the program sees -x (--exclude) on a command line, it stops
+ scanning for options, and treats every succeeding item as an ar-
+ chive member name. To avoid confusion between member names and
+ command options, it's simplest to specify -x (--exclude) and its
+ member list as the last 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). That
+ is, the following two commands are equivalent:
+ unzip fred.zip -b -x file1 file2 file3
+ unzip fred.zip -x file1 file2 file3 @ -b
+
+ -Y
+ --dot-version
+ [VMS] Treat archive member name endings of ".nnn" (where "nnn"
+ is a decimal number) as if they were VMS version numbers
+ (";nnn"). (The default is to treat them as file types.) For
+ example:
+ "a.b.3" -> "a.b;3"
+
+ -Z
+ --zipinfo-mode
+ ZipInfo mode. If the first option on the command line is -Z,
+ then the program runs in ZipInfo mode. Remaining options are
+ interpreted as ZipInfo options. See the zipinfo manual page for
+ a description of those options.
+
+ -z
+ --zipfile-comment
+ Primary mode. Display only the archive comment. For details,
+ see Primary Mode options.
+
+ -$
+ --volume-labels
+ [MS-DOS, NT, OS/2, VMS] Restore the volume label if the extrac-
+ tion medium is removable (for example, a diskette). Doubling
+ the option (-$$) allows fixed media (hard disks) to be labeled
+ as well. By default, volume labels are ignored.
+ [VMS] On VMS, a volume must be allocated, not shared, for a vol-
+ ume label to be set.
+
+ -/
+ --extensions
+ [Acorn] Overrides the extension list supplied by the Unzip$Ext
+ environment variable. During extraction, filename extensions
+ that match one of the items in this extension list are swapped
+ in front of the base name of the extracted file.
+
+ -:
+ --do-double-dots
+ [all but Acorn, VM/CMS, MVS, Tandem] Allows UnZip to extract ar-
+ chive members into locations outside of the current extraction
+ destination directory (and its subdirectories).
+
+ For security reasons, UnZip normally removes "parent directory"
+ path components ("../") from the path names of archive members
+ as they are extracted. This safety feature (new for version
+ 5.50) prevents UnZip from accidentally writing files to directo-
+ ries outside the current destination directory tree. The -:
+ option sets UnZip back to its previous, more liberal behavior,
+ allowing exact extraction of archives that use "../" path compo-
+ nents to create multiple directory trees at or above the level
+ of the destination directory.
+
+ This option does not enable writing explicitly to the root
+ directory ("/"). To achieve this, it is necessary to set the
+ extraction target folder to "/" (by using an option like
+ "-d /"). However, when the -: option is specified, it is still
+ possible implicitly to write to the root directory if member
+ paths specifying enough "../" path components.
+
+ Use this option with extreme caution.
+
+ -^
+ --control-in-name
+ [Unix] Allow control characters in file names of extracted ZIP
+ archive members. On Unix, a file name may contain any (8-bit)
+ character code with the two exceptions of "/" (the directory
+ delimiter) and NUL (0x00, the C string-termination character),
+ unless the specific file system has more restrictive conven-
+ tions. Generally, this allows embedding ASCII control charac-
+ ters or escape sequences in file names. However, this feature
+ allows the use of malicious file names which can cause various
+ kinds of bad trouble when displayed on a user's terminal/emula-
+ tor. (Even a file name with unprintable but otherwise harmless
+ characters can cause problems for users.)
+
+ For these reasons, by default, UnZip applies a filter that
+ removes potentially dangerous control characters from the
+ extracted file names. The -^ option overrides this filter in
+ the rare case that embedded filename dangerous control charac-
+ ters are to be intentionally restored.
+
+ENVIRONMENT OPTIONS
+ UnZip's default behavior may be modified by placing command-line
+ options in an environment variable. This can be done with any option,
+ but it is probably most useful options like -a (auto-convert text
+ files), -L (downcase file names from systems with all uppercase file
+ names), -C (use case-insensitive name matching), -q (quiet), -o (always
+ overwrite), or -n (never overwrite).
+
+ For UnZip, the environment variable name is UNZIP, except on
+ VMS, where it's UNZIP_OPTS (to avoid conflict with a foreign-
+ command DCL symbol, UNZIP). For similarity with Zip, if UNZIP
+ (UNZIP_OPTS on VMS) is not defined, then UnZip will use UNZIPOPT
+ the same way.
+
+ For ZipInfo ("unzip -Z"), the environment variable name is ZIP-
+ INFO, except on VMS, where it's ZIPINFO_OPTS. For similarity
+ with Zip, if ZIPINFO (ZIPINFO_OPTS on VMS) is not defined, then
+ ZipInfo will use ZIPINFOOPT the same way.
+
+ For example, to make UnZip act as quietly as possible, only
+ reporting errors, one could use commands like the following:
+
+ Unix Bourne (or similar) shell:
+ UNZIP='-q -q'; export UNZIP
+
+ Unix C shell:
+ setenv UNZIP '-q -q'
+
+ OS/2 or MS-DOS:
+ set UNZIP="-q -q"
+
+ VMS (with quotation to preserve lower case in DCL):
+ define UNZIP_OPTS "-q -q" ! Logical name, or
+ UNZIP_OPTS = "-q -q" ! DCL symbol. (Either works.)
+
+ Environment options are treated the same as any other command-
+ line options, except that they are effectively the first options
+ on the command line. To override an environment option, one may
+ use an explicit option to cancel or override it. For example,
+ to override one of the "quiet" flags in the example above, use a
+ command like:
+ unzip -q- [other options] archive.zip
+
+ The leading hyphen is the normal option character, and the
+ trailing one negates the option, canceling one level of quiet-
+ ness. To cancel multiple "quiet" flags, use multiple -q-
+ options:
+
+ unzip -t -q- -q- archive
+ unzip -q- -q- -t archive
+
+ Note that multiple one-character options like "-q" and "-q" can
+ be combined into a single "-qq", but it's generally clearer to
+ keep each instance of each option separate. Similarly, negated
+ one-character options can be combined, as with "-q-q-", but
+ "-q- -q-" is generally clearer.
+
+ The examples show short (one-character) options, but long ("--")
+ options are also allowed.
+
+ The timezone variable (TZ) should be set according to the local time-
+ zone in order for the Freshen (-f) and Update (-u) modes to operate
+ correctly. For details, see -f. This variable may also be necessary
+ to get timestamps of extracted files to be set correctly.
+
+ On Windows systems, UnZip gets the timezone configuration from
+ the registry, assuming it is correctly set in the Control Panel.
+ The TZ variable is ignored on these systems.
+
+ENCRYPTION/DECRYPTION
+ Zip and UnZip have long supported a relatively weak encryption method,
+ which we call Traditional ZIP encryption. The source code for Tradi-
+ tional encryption is included in the source kits, and support for Tra-
+ ditional encryption is enabled by default. (Build-time C macros:
+ IZ_CRYPT_TRAD, NO_CRYPT.)
+
+ Beginning with UnZip version 6.10 and Zip version 3.1, these programs
+ also offer a stronger, Advanced Encryption Standard (AES) encryption
+ method, which we call AES WinZip/Gladman (AES_WG) encryption. (The
+ encryption code was supplied by Brian Gladman, and the archive format
+ is intended to be compatible with that used by the WinZip program.
+ WinZip is a registered trademark of WinZip International LLC.) The
+ source code for AES_WG encryption is distributed in a separate kit (for
+ export control reasons), and support for AES_WG encryption must be
+ enabled explicitly at build time. (Build-time C macro:
+ IZ_CRYPT_AES_WG.) See the INSTALL file in the source kit for details
+ on how to enable AES_WG encryption (or how to disable Traditional
+ encryption).
+
+ For details on the WinZip AES scheme, see:
+ http://www.winzip.com/aes_info.htm
+
+ For information on the separate AES_WG source kit, see:
+ ftp://ftp.info-zip.org/pub/infozip/crypt/
+ ftp://ftp.info-zip.org/pub/infozip/crypt/README_AES_WG.txt
+
+ Normally, encryption passwords are supplied by the user interactively
+ when requested by the program. See the -P option for a (less secure)
+ method of specifying a password on the command line.
+
+ With Traditional encryption, when decrypting, a password will be
+ checked against header data, and used if it appears to be correct. The
+ correct password will always check out against the header data, but
+ there is a 1-in-256 chance that an incorrect password will as well.
+ (This is a security feature of the PKWARE archive format; it helps pre-
+ vent brute-force attacks that might otherwise gain a large speed advan-
+ tage by testing only the header.) In the case that an incorrect pass-
+ word is given but it passes the header test anyway, either an incorrect
+ CRC will be generated for the extracted data or else UnZip will fail
+ during the extraction because the "decrypted" bytes do not constitute a
+ valid compressed data stream.
+
+ If the first password fails the header check on some file, UnZip will
+ prompt for another password, and so on until all files are extracted.
+ If a password is not known, entering a null password (that is, just a
+ carriage return or "Enter") is taken as a signal to skip all further
+ prompting. Only unencrypted files in the archive(s) will thereafter be
+ extracted. (The situation is actually a little more complicated. Some
+ old versions of Zip and ZipCloak allowed null passwords, so UnZip
+ checks each encrypted file to see if the null password works. This may
+ result in "false positives" and extraction errors, as noted above.)
+
+ Archives encrypted with 8-bit-character passwords (for example, pass-
+ words with accented European characters) may not be portable across
+ systems or to other archivers. This problem stems from the use of mul-
+ tiple encoding methods for such characters, including Latin-1 (ISO
+ 8859-1) and OEM code page 850. DOS PKZIP 2.04g uses the OEM code page;
+ Windows PKZIP 2.50 uses Latin-1 (and is therefore incompatible with DOS
+ PKZIP); Info-ZIP uses the OEM code page on DOS, OS/2 and Win3.x ports
+ but ISO coding (Latin-1 etc.) everywhere else; and Nico Mak's WinZip
+ 6.x does not allow 8-bit-character passwords at all. UnZip 5.3 (or
+ newer) attempts to use the default character set first (e.g., Latin-1),
+ followed by the alternate one (e.g., OEM code page) to test passwords.
+ On EBCDIC systems, if both of these fail, EBCDIC encoding will be
+ tested as a last resort. (EBCDIC is not tested on non-EBCDIC systems,
+ because there are no known archivers that encrypt using EBCDIC encod-
+ ing.) ISO character encodings other than Latin-1 are not supported.
+ The new addition of (partial) Unicode (UTF-8) support in UnZip 6.0 has
+ not yet been adapted to the encryption password handling in UnZip. On
+ systems that use UTF-8 as native character encoding, UnZip simply tries
+ decryption with the native UTF-8 encoded password; the built-in
+ attempts to check the password in translated encoding have not yet been
+ adapted for UTF-8 support and will consequently fail.
+
+EXAMPLES
+ To use UnZip to extract all members of the archive letters.zip into the
+ current directory and subdirectories below it, creating any subdirecto-
+ ries as necessary:
+
+ unzip letters
+
+ To extract all members of letters.zip into the current directory only:
+
+ unzip -j letters
+
+ To test letters.zip, printing only a summary message indicating whether
+ the archive is OK or not:
+
+ unzip -t -q letters
+
+ To test all ".zip" archives in the current directory, printing only the
+ summaries:
+
+ unzip -t -q "*.zip"
+
+ Here, the wildcard archive name was quoted to keep a Unix shell from
+ expanding ("globbing") it. (This would not be necessary on VMS.)
+
+ The following command extracts to standard output all members of let-
+ ters.zip whose names end in .tex, auto-converting to the local end-of-
+ line convention, and piping the output into more(1) (again, quoting the
+ wildcard member name pattern):
+
+ unzip -c -a letters '*.tex' | more
+
+ To extract the binary file paper1.dvi to standard output and pipe it to
+ a printing program:
+
+ unzip -p articles paper1.dvi | dvips
+
+ To extract from source.zip all Fortran and C source files (*.f, *.c,
+ *.h) and Makefile into the /tmp directory (again, quoting the wild-
+ card):
+
+ unzip source.zip "*.[fch]" Makefile -d /tmp
+
+ To extract all FORTRAN and C source files, regardless of case (for
+ example, both *.c and *.C, and any makefile, Makefile, MAKEFILE or sim-
+ ilar):
+
+ unzip -C source.zip "*.[fch]" makefile -d /tmp
+
+ To extract any such files but convert any uppercase MS-DOS or VMS names
+ to lowercase and convert the line-endings of all of the files to the
+ local standard (without respect to any files that might be marked
+ "binary"):
+
+ unzip -aa -C -L source.zip "*.[fch]" makefile -d /tmp
+
+ The following command extracts only newer versions of the files already
+ in the current directory, without querying. (Note: Be careful of
+ extracting in one timezone an archive created in another. ZIP archives
+ created by Zip versions before 2.1 contain no timezone information, and
+ a "newer" file from an eastern timezone may, in fact, be older):
+
+ unzip -f -o sources
+
+ To extract newer versions of the files already in the current directory
+ and to create any files not already there (same caveat as previous
+ example):
+
+ unzip -u -o sources
+
+ To display a configuration report showing the program version, the OS
+ and compiler used to build it, a list of optional features enabled at
+ build time, and the values of all the relevant environment variables:
+
+ unzip -v
+
+ In the last five examples, assume that UNZIP or UNZIP_OPTS is set to
+ -q. To do a (singly) quiet listing:
+
+ unzip -l file.zip
+
+ To do a doubly quiet listing:
+
+ unzip -l -q file.zip
+
+ (Note that the ".zip" is generally not necessary.) To do a standard
+ listing:
+
+ unzip -l -q- file.zip
+ or:
+ unzip -lq- file.zip
+ or:
+ unzip -q-l file.zip
+
+EXIT STATUS
+ The exit status (or error level) approximates the exit codes defined by
+ PKWARE and takes on the following values (except on VMS):
+
+ 0 Normal. No errors or warnings detected.
+
+ 1 One or more warnings were encountered, but processing
+ completed successfully. This includes archives where one
+ or more (but not all) files were skipped because of an
+ unsupported compression or encryption method, or a bad
+ encryption password.
+
+ 2 Error in the archive format. Processing may or may not
+ have completed successfully.
+
+ 3 Severe error in the archive format. Processing probably
+ failed immediately.
+
+ 4 Memory allocation failed in program initialization.
+
+ 5 Memory allocation or terminal I/O failed in encryption
+ password processing.
+
+ 6 Memory allocation failed while decompressing to disk.
+
+ 7 Memory allocation failed while decompressing in memory.
+
+ 8 Memory allocation failed. (Currently not used.)
+
+ 9 Specified archive files were not found.
+
+ 10 Invalid command-line options or parameters.
+
+ 11 No matching files were found.
+
+ 50 Disk (file system) filled during extraction.
+
+ 51 Unexpected end-of-file while reading the archive.
+
+ 80 User interrupt (Ctrl/C or similar).
+
+ 81 No files were processed, because of unsupported compres-
+ sion or encryption methods.
+
+ 82 No files were processed, because of bad encryption pass-
+ word(s).
+
+ 83 Large-file archive could not be processed by this small-
+ file program.
+
+ 84 Failed to create automatic extraction directory.
+ (Already exists?)
+
+ [VMS] On VMS, the standard Unix exit status values are translated into
+ valid VMS status codes. For details, see the file [.vms]NOTES.TXT in
+ the source kit.
+
+BUGS
+ Multi-part archives are not yet supported, except in conjunction with
+ Zip. (All parts must be concatenated together in order, and then
+ "zip -F" (for Zip 2.x) or "zip -FF" (for Zip 3.x) must be performed on
+ the concatenated archive in order to "fix" it. Also, zip version 3.0
+ and later can combine multi-part (split) archives into a combined sin-
+ gle-file archive using "zip -s- inarchive -O outarchive". See the zip
+ manual page for more information.) This may be corrected in the next
+ major release.
+
+ Archives read from standard input are not yet supported, except with
+ fUnZip (and then only the first member of the archive can be
+ extracted).
+
+ Archives encrypted with 8-bit-character passwords (such as passwords
+ with accented European characters) may not be portable across systems
+ and/or other archivers. See also ENCRYPTION/DECRYPTION.
+
+ UnZip's -M ("--more") option tries to take into account automatic wrap-
+ ping of long lines. However, the code may fail to detect the correct
+ wrapping locations. First, TAB characters (and similar control
+ sequences) are not taken into account, they are handled as ordinary
+ printable characters. Second, depending on the actual system type,
+ UnZip may not detect the true terminal/emulator geometry, but instead
+ may rely on "commonly used" default dimensions. The correct handling
+ of tabs would require the implementation of a query for the actual tab
+ setup on the output terminal/emulator.
+
+ [Unix] Unix special files such as FIFO buffers (named pipes), block
+ devices and character devices are not restored even if they are somehow
+ represented in the archive, nor are hard-linked files relinked. Basi-
+ cally, the only file types restored by UnZip are regular files, direc-
+ tories, and symbolic (soft) links.
+
+ [OS/2] Extended attributes for existing directories are only updated if
+ the -o ("overwrite all") option is given. This is a limitation of the
+ operating system; because directories only have a creation time associ-
+ ated with them, UnZip has no way to determine whether the stored
+ attributes are newer or older than those on disk. In practice this may
+ mean a two-pass approach is required: first unpack the archive nor-
+ mally (with or without freshening/updating existing files), then over-
+ write just the directory entries (for example, "unzip -o foo */").
+
+SEE ALSO
+ funzip(1L), unzipsfx(1L), zip(1L), zipcloak(1L),
+ zipgrep(1L), zipinfo(1L), zipnote(1L), zipsplit(1L)
+
+URL
+ The Info-ZIP main Web page is:
+ http://www.info-zip.org/
+
+ FTP access is available, too:
+ ftp://ftp.info-zip.org/pub/infozip/
+
+AUTHORS
+ The primary Info-ZIP authors (current semi-active members of the Zip-
+ Bugs workgroup) are: Ed Gordon (Zip, general maintenance, shared code,
+ Zip64, Win32, Unix, Unicode); Christian Spieler (UnZip maintenance
+ coordination, VMS, MS-DOS, Win32, shared code, general Zip and UnZip
+ integration and optimization); Onno van der Linden (Zip); Mike White
+ (Win32, Windows GUI, Windows DLLs); Kai Uwe Rommel (OS/2, Win32);
+ Steven M. Schweda (VMS, Unix, support of new features); Paul Kienitz
+ (Amiga, Win32, Unicode); Chris Herborth (BeOS, QNX, Atari); Jonathan
+ Hudson (SMS/QDOS); Sergio Monesi (Acorn RISC OS); Harald Denker (Atari,
+ MVS); John Bush (Solaris, Amiga); Hunter Goatley (VMS, Info-ZIP Site
+ maintenance); Steve Salisbury (Win32); Steve Miller (Windows CE GUI),
+ Johnny Lee (MS-DOS, Win32, Zip64); and Dave Smith (Tandem NSK).
+
+ The following people are former members of the Info-ZIP development
+ group, and provided major contributions to key parts of the current
+ code: Greg "Cave Newt" Roelofs (UnZip, unshrink decompression); Jean-
+ loup Gailly (deflate compression); Mark Adler (inflate decompression,
+ fUnZip).
+
+ The author of the original unzip code upon which Info-ZIP's was based
+ is Samuel H. Smith; Carl Mascott did the first Unix port; and David P.
+ Kirschbaum organized and led Info-ZIP in its early days with Keith
+ Petersen hosting the original mailing list at WSMR-SimTel20. The full
+ list of contributors to UnZip has grown quite large; please refer to
+ the proginfo/CONTRIBS file in the UnZip source distribution for a rela-
+ tively complete version.
+
+Info-ZIP 09 May 2014 (v6.10) UNZIP(1L)
--- /dev/null
+UNZIPSFX(1L) UNZIPSFX(1L)
+
+NAME
+ unzipsfx - self-extraction (SFX) program. Append a ZIP archive to it
+ to make a self-extracting archive bundle.
+
+SYNOPSIS
+ name_of_unzipsfx+archive_bundle [ unzip_options ] [ member ... ]
+
+DESCRIPTION
+ UnZipSFX is a special edition of UnZip which is designed to be attached
+ to the beginning of an existing, ordinary ZIP archive to form a self-
+ extracting (SFX) archive. Unlike the normal UnZip program, which works
+ on an archive specified on its command line, UnZipSFX works on an ar-
+ chive which has been appended to itself.
+
+ Minimizing the size of a self-extracting archive, means minimizing the
+ size of the UnZipSFX program itself. Thus UnZipSFX is normally built
+ without some of the less important features found in the normal UnZip
+ program. Among these are the help/usage displays (-h, -hh), the list-
+ ing and diagnostic functions (-l, -v), the ability to process some
+ older compression methods ("Implode", "Reduce", "Shrink"), and, by
+ default, some newer compression methods (bzip2, LZMA, PPMd) and any
+ encryption methods.
+
+ Starting with UnZipSFX version 5.50, the ability to extract to a direc-
+ tory other than the current one (-d dest_dir) has been enabled by
+ default. Some or all of the optional compression and/or encryption
+ methods can be enabled at build time, at the cost of increasing the
+ size of the resulting UnZipSFX program.
+
+ Starting with UnZip version 5.50, another build-time option adds a sim-
+ ple "run command after extraction" feature. This feature is currently
+ incompatible with the "extract to different directory" (-d dest_dir)
+ feature, and remains disabled by default.
+
+ All the build-time options controlling UnZipSFX features should be
+ explained in the UnZip installation instructions (INSTALL). Note that
+ the features (such as optional encryption or compression methods) which
+ are available in an UnZipSFX executable are determined when the
+ UnZipSFX executable is built. However, the features which are needed
+ are determined when the ZIP archive is created. The user must decide
+ which optional features to include in or exclude from the UnZipSFX exe-
+ cutable, and then use only the available UnZipSFX features when creat-
+ ing an archive for use as a self-extracting archive. Enabling optional
+ features in UnZipSFX makes the executable bigger (and hence SFX ar-
+ chives made with it). Of course, the greater efficiency of some
+ optional compression method might save enough space to compensate for
+ the bigger UnZipSFX executable which would be needed to deal with it.
+ And, if encryption is desired, then the UnZipSFX executable must be
+ able to deal with that.
+
+ Users with complex requirements may find it useful to build multiiple
+ UnZipSFX executables with different feature sets for different pur-
+ poses. The user is responsible for managing multiple UnZipSFX executa-
+ bles. The UnZip builders offer no tools to help, and, without a "-v"
+ report, determining the capabilities of an UnZipSFX executable is not
+ very easy. The user is also responsible for testing a self-extracting
+ archive on the target system, to ensure that the UnZipSFX executable
+ used has all the features it needs to process the attached archive.
+
+ Note that the UnZipSFX executable in a self-extracting archive
+ is a real executable program, and so is not generally portable
+ from one operating system or hardware architecture to another.
+ The ZIP archive within a self-extracting archive can be pro-
+ cessed anywhere using a normal UnZip program. (At worst, UnZip
+ will emit a warning like "nnnn extra bytes at beginning or
+ within zipfile", but using "zip -A" on an SFX bundle will pre-
+ vent even that annoyance.)
+
+ARGUMENTS
+ member ...
+ An optional list of archive members to be processed, separated
+ by spaces. If no member list is specified, then all archive
+ members are processed. Wildcard patterns may be used to match
+ multiple members. These wildcard expressions are similar to
+ those supported (for "globbing") in commonly used Unix shells
+ (csh, ksh, sh, and so on) and may contain:
+
+ * matches a sequence of 0 or more characters.
+
+ ? matches exactly 1 character.
+
+ [...] matches any single character found inside the brackets.
+ Ranges are specified by a beginning character, a hyphen,
+ and an ending character. If an exclamation point ("!")
+ or a caret ("^") follows the left bracket, then the range
+ of characters within the brackets is complemented. That
+ is, anything except the characters inside the brackets is
+ considered a match. To specify a literal left bracket,
+ use the three-character sequence "[[]".
+
+ Be sure to escape or quote any character(s) that might otherwise
+ be interpreted or modified by the operating system, particularly
+ Unix shells.
+
+OPTIONS (Primary Mode)
+ Options in this group (-c -f -p -t -u -z) specify the primary mode of
+ operation of UnZipSFX. Only one of these primary mode options may be
+ specified.
+
+ -c
+ --to-stdout
+ Primary Mode. Extract files to stdout/screen. This option is
+ similar to the -p option except that the name of each file is
+ displayed as it is extracted, and the -a option is allowed,
+ which can provide automatic ASCII-EBCDIC conversion, where
+ appropriate.
+
+ -f
+ --freshen
+ Primary Mode. Freshen existing files. That is, extract only
+ those files that already exist on disk and that are newer than
+ the disk copies. By default, UnZipSFX queries before overwrit-
+ ing, but the -o option may be used to suppress the queries.
+ Note that on many operating systems, the TZ (timezone) environ-
+ ment variable must be set correctly in order for -f and -u to
+ work properly. (On Unix the variable is usually set automati-
+ cally.) The reasons for this are somewhat subtle but have to do
+ with the differences between DOS-format file times (always local
+ time) and Unix-format times (always UTC) and the necessity to
+ compare the two. A typical TZ value is "PST8PDT" (US Pacific
+ time with automatic adjustment for Daylight Saving Time).
+
+ -p
+ --pipe-to-stdout
+ Primary Mode. Extract files to stdout (pipe). Only the actual
+ file data for the members are sent to stdout (no file names, or
+ other information, as would be displayed with -c), and the files
+ are always extracted in binary format, just as they are stored
+ (no line-ending or ASCII-EBCDIC conversions).
+
+ -t
+ --test
+ Primary Mode. Test archive members. Testing means that each
+ archive member is extracted in memory (expanding and decrypting,
+ as needed), but not written to a file. The resulting CRC
+ (cyclic redundancy check, an enhanced checksum) of the extracted
+ data is then compared with the original file's stored CRC value,
+ and an error message is emitted if a CRC mismatch is detected.
+
+ -u
+ --update
+ Primary mode. Update existing files and create new ones if
+ needed. This mode performs the same function as the Freshen
+ (-f) mode, extracting (with query) files that are newer than
+ those with the same name on disk, but it also extracts those
+ files that do not already exist on disk. See -f, above, for
+ information on setting the timezone properly.
+
+ -z
+ --zipfile-comment
+ Primary mode. Display only the archive comment.
+
+OPTIONS (Ordinary)
+ -2
+ --force-ods2
+ [VMS] Convert extracted file names to ODS2-compatible names,
+ even on an ODS5 file system. By default, if the destination
+ file system is ODS5, case is preserved, and extended file name
+ characters are caret-escaped as needed, while if the destination
+ file system is ODS2, ODS2-invalid characters are replaced by
+ underscores.
+
+ -a
+ --ascii
+ Convert text files. Ordinarily, all files are extracted exactly
+ as they are stored, byte-for-byte. With -a, line endings in a
+ text file are adjusted to the local standard as the file is
+ extracted. When appropriate, ASCII<-->EBCDIC conversion is also
+ done.
+
+ Zip (or a similar archiving program) identifies files as
+ "binary" or "text" when they are archived. (A short-format Zip-
+ Info report denotes a binary file with a "b", and a text file
+ with a "t".) Zip's identification of text files may not be per-
+ fect, so UnZipSFX prints "[text]" or "[binary]" as a visual
+ check for each file it extracts with -a. The -aa option forces
+ all files to be extracted (and converted) as text, regardless of
+ the supposed file type.
+
+ [VMS] On VMS, for archives with VMS attribute information (made
+ with "zip -V" or "ZIP /VMS"), files are always created with
+ their original record formats. For archives without VMS
+ attribute information (not made with "zip -V" or "ZIP /VMS"),
+ all files are normally created with Stream_LF record format.
+ With -a, text files are normally created with variable-length
+ record format, but adding -S gives them Stream_LF record format.
+ With -aa, all files are treated as text files. See also -b and
+ -S.
+
+ Support for line-ending conversion for text files may be removed
+ in some future UnZipSFX version, because the creator of a self-
+ ectracting archive should easily be able to ensure that text
+ files have the appropriate characteristics for the SFX target
+ system (and expecting the SFX user to specify the appropriate
+ option is unreliable). ASCII-EBCDIC conversion must continue to
+ be supported, because the ZIP archive format implies ASCII stor-
+ age of text files.
+
+ -b
+ --binary
+ [Tandem, VMS] Selects the file record format used when extract-
+ ing binary files. -b may conflict or interact with -a in dif-
+ ferent ways on different system types. -b is ignored on systems
+ other than Tandem and VMS.
+
+ Zip (or a similar archiving program) identifies files as
+ "binary" or "text" when they are archived. (A short-format Zip-
+ Info report denotes a binary file with a "b", and a text file
+ with a "t".)
+
+ [Tandem] Force the creation files with filecode type 180 ('C')
+ when extracting archive members marked as "text". (On Tandem, -a
+ is enabled by default, see above).
+
+ [VMS] On VMS, for archives with VMS attribute information (made
+ with "zip -V" or "ZIP /VMS"), files are always created with
+ their original record formats. For archives without VMS
+ attribute information (not made with "zip -V" or "ZIP /VMS"),
+ files are normally created with Stream_LF record format. With
+ -b, binary files are created with fixed-length, 512-byte record
+ format. With -bb, all files are treated as binary files. When
+ extracting to standard output (-c or -p option in effect), the
+ default conversion of text record delimiters is disabled for
+ binary files (with -b), or for all files (with -bb).
+
+ -C
+ --ignore-case ([CMS, MVS] --CMS-MVS-lower)
+ Use case-insensitive name matching for file names in the file
+ list and the -x excluded-file list on the command line. By
+ default, case-sensitive matching is done. For example, specify-
+ ing "makefile" on the command line will match only "makefile" in
+ the archive, not "Makefile" or "MAKEFILE". On many systems, the
+ local file system is case-insensitive, so case-insensitive name
+ matching would be more natural. With -C, "makefile" would match
+ "makefile", "Makefile", or "MAKEFILE".
+
+ -C does not affect the matching of archive members to existing
+ files on the extraction path. So, on a case-sensitive file sys-
+ tem, UnZipSFX will never try to overwrite a file "FOO" when
+ extracting a member named "foo"!
+
+ -c
+ --to-stdout
+ Primary Mode. Extract files to stdout/screen. For details, see
+ Primary Mode options.
+
+ -D
+ --dir-timestamps
+ Control timestamps on extracted files and directories. By
+ default, UnZipSFX restores timestamps for extracted files, but
+ not for directories it creates. Specifying -D tells UnZipSFX
+ not to restore any timestamps. Specifying -D- tells UnZipSFX to
+ restore timestamps for directories as well as other items. -D-
+ works only on systems that support setting timestamps for direc-
+ tories (currently ATheOS, BeOS, MacOS, OS/2, Unix, VMS, Win32).
+ On other systems, -D- has no effect.
+
+ [Non-VMS] Timestamp restoration behavior changed between UnZip
+ versions 6.00 and 6.10. The following table shows the effects
+ of various -D options for both versions.
+
+ UnZip version |
+ 6.00 | 6.10 | Restore timestamps on:
+ -----------+-----------+------------------------
+ -DD | -D | Nothing.
+ -D | (default) | Files, not directories.
+ (default) | -D- | Files and directories.
+
+ [VMS] The old behavior on VMS was the same as the new behavior
+ on all systems. (The old negated --D option is now -D-, because
+ of changes to the command-line parser.)
+
+ -d dest_dir
+ --extract-dir dest_dir
+ Specifies a destination directory for extracted files. By
+ default, files are extracted (and subdirectories created) in the
+ current directory. With -d dest_dir, extraction is done into
+ the specified directory, instead.
+
+ The option and directory may be concatenated without any white
+ space between them, but this may cause normal shell behavior to
+ be suppressed. For example, "-d ~" (tilde) is expanded by Unix
+ shells into the name of the user's home directory, but "-d~" is
+ treated as a literal "~" subdirectory of the current directory.
+
+ [VMS] On VMS, only a VMS-style device:[directory] specification
+ is permitted.
+
+ This option may be disabled at build time in UnZipSFX.
+
+ -F
+ --keep-nfs
+ [Acorn] Suppress removal of NFS filetype extension from stored
+ filenames.
+
+ [non-Acorn systems supporting long filenames with embedded com-
+ mas, and only if compiled with ACORN_FTYPE_NFS defined] Trans-
+ late filetype information from ACORN RISC OS extra field blocks
+ into a NFS filetype extension and append it to the names of the
+ extracted files. (When the stored filename appears already to
+ have an appended NFS filetype extension, it is replaced by the
+ info from the extra field.)
+
+ -f
+ --freshen
+ Primary Mode. Freshen existing files. For details, see Primary
+ Mode options.
+
+ -I char_set
+ --iso-char-set char_set
+ [Unix] Select ISO character set char_set.
+
+ -J
+ --junk-attrs
+ [BeOS] Junk file attributes. The file's BeOS file attributes
+ are not restored, only the file's data.
+
+ [MacOS] Ignore MacOS extra fields. All Macintosh-specific info
+ is skipped. AppleDouble files are restored as separate files.
+
+ -j[=depth]
+ --junk-dirs[=depth]
+ Junk directories. With -j, all directory information is
+ stripped from an archive member name, so all files are extracted
+ into the destination directory. (See also -d.)
+
+ If a depth (=depth, where depth is a positive integer) is speci-
+ fied, then that number of directory levels will be stripped from
+ an archive member name. For example, an archive member like
+ "a/b/c/d/ee.txt" would normally be extracted as
+ "a/b/c/d/ee.txt". With -j, it would be extracted as "ee.txt".
+ With -j=2, the first two directory levels would be stripped, so
+ it would be extracted as "c/d/ee.txt".
+
+ --jar
+ Treat archive(s) as Java JAR. Over-simplification in Java JAR archives
+ can cause UnZipSFX to transform UTF-8 file names according to inappro-
+ priate (MS-DOS) rules, yielding corrupt names on extracted files (typi-
+ cally those with character codes 128-255). Archives containing a Java
+ "CAFE" extra field should be detected automatically, and handled cor-
+ rectly, but not all JAR archives include that extra field. Specifying
+ --jar tells UnZipSFX to expect UTF-8 file names, regardless of whether
+ the archive contains a "CAFE" extra field.
+ -k
+ --keep-permissions
+ [AtheOS, BeOS, Unix, VMS] Control how archived permissions or
+ protections are restored on extracted files and directories.
+
+ By default, archived permissions are restored with some limita-
+ tions. On AtheOS, BeOS, and Unix, the current umask value is
+ applied (to the normal user/group/other permissions). On VMS,
+ the current default protection is applied to the UIC-based
+ (SOGW) protections.
+
+ With -k, the archived permissions are restored without regard to
+ the Unix umask or VMS default protection. (This was the default
+ behavior in UnZip versions before 6.10.)
+
+ With -k-, the archived permissions are ignored, so only the Unix
+ umask or VMS default protection is effective. (On VMS, directo-
+ ries are always created without any Delete access.)
+
+ On AtheOS, BeOS, and Unix, the SUID/SGID/Tacky permission bits
+ are controlled by the -K/--keep-s-attrs option, regardless of
+ the -k/--keep-permissions setting.
+
+ -ka
+ --keep-acl
+ [VMS] Restore ACLs on extracted files and directories.
+
+ -L
+ --lowercase-names
+ Convert to lowercase any filename originating on an uppercase-
+ only operating system or file system. (This was UnZipSFX's
+ default behavior in versions before 5.11. The current default
+ behavior is the same as the old behavior with the -U option. -U
+ is now used for another purpose.)
+
+ Depending on the archiver, files archived from single-case file
+ systems (old MS-DOS FAT, VMS ODS2, and so on) may be stored as
+ all-uppercase names; this can be ugly or inconvenient when
+ extracting to a case-preserving file system such as OS/2 HPFS or
+ a case-sensitive one such as on Unix. By default, UnZipSFX
+ lists and extracts such filenames exactly as they're stored
+ (excepting truncation, conversion of unsupported characters, an
+ so on). With -L, the names of all files from certain systems
+ will be converted to lowercase. With -LL, all file names will
+ be down-cased, regardless of the originating file system.
+
+ -M [CMS,MVS] Or: -m)
+ --more
+ Pipe all output through an internal pager similar to the Unix
+ more(1) command. At the end of a screenful of output, UnZipSFX
+ pauses with a "--More--" prompt; the next screenful may be
+ viewed by pressing the Enter/Return key or the space bar.
+ UnZipSFX can be terminated by pressing the "Q" key and, on some
+ systems, the Enter/Return key. Unlike Unix more(1), there is no
+ forward-searching or editing capability. Also, UnZipSFX doesn't
+ notice if long lines wrap at the edge of the screen, effectively
+ resulting in the printing of two or more lines and the likeli-
+ hood that some text will scroll off the top of the screen before
+ being viewed. If the actual number of lines on the screen can
+ not be determined, 24 lines will be assumed.
+
+ -n
+ --never-overwrite
+ When extracting, never overwrite existing files. If a file
+ already exists, then skip the extraction of that file without
+ asking. See also -o (--overwrite).
+
+ By default, UnZipSFX queries the user before extracting any file
+ that already exists. The user may choose to overwrite only the
+ current file, overwrite all files, skip extraction of the cur-
+ rent file, skip extraction of all existing files, or rename the
+ current file (choose a new name for the extracted file).
+
+ [VMS] On VMS, the usual query choices are to create a new ver-
+ sion of an existing file, to skip extraction, or to rename the
+ current file. In the case where an archive member name includes
+ a version number, and -V ("retain VMS file version numbers") is
+ in effect, then an additional query choice is offered: to over-
+ write the existing file.
+
+ -O char_set
+ --oem-char-set char_set
+ [Unix] Select OEM character set char_set.
+
+ -o
+ --overwrite
+ When extracting, always overwrite existing files without prompt-
+ ing. This is a dangerous option, so use it with care. (It is
+ often used with -f, however, and is the only way to overwrite
+ directory EAs on OS/2.) See also -n (--never-overwrite).
+
+ By default, UnZipSFX queries the user before extracting any file
+ that already exists.
+
+ [Non-VMS] On non-VMS systems, the user may choose to overwrite
+ only the current file, overwrite all files, skip extraction of
+ the current file, skip extraction of all existing files, or
+ rename the current file (choose a new name for the extracted
+ file).
+
+ [VMS] On VMS, the usual query choices are to create a new ver-
+ sion of an existing file, to skip extraction, or to rename the
+ current file. In the case where an archive member name includes
+ a version number, and -V ("retain VMS file version numbers") is
+ in effect, then an additional query choice is offered: to over-
+ write the existing file. In this case, -o selects the "new ver-
+ sion" choice, and -oo (or: -o -o) selects the "overwrite"
+ choice.
+
+ -P password
+ --password password
+ [CRYPT_AES_WG, CRYPT_TRAD] -P ("--password") is valid only if
+ encryption support was enabled at build-time for the UnZipSFX
+ program.
+
+ Use password to decrypt encrypted archive members (if any).
+ THIS IS INSECURE! Many multi-user operating systems provide
+ ways for any user to see the current command line of any other
+ user. Even on stand-alone systems, there is always the threat
+ of over-the-shoulder peeking. Storing the plaintext password as
+ part of a command line in an automated script can be even less
+ secure, Whenever possible, use the non-echoing, interactive
+ prompt to enter passwords. Where security is truly important,
+ use a strong encryption method, such as AES, instead of the rel-
+ atively weak encryption provided by Traditional ZIP encryption.
+ Or, use an external encryption program, such as GnuPG, before
+ archiving the file. (Note that Zip will probably not be able to
+ do significant compression on a file which has already been
+ encrypted.)
+
+ -p
+ --pipe-to-stdout
+ Primary Mode. Extract files to stdout (pipe). For details, see
+ Primary Mode options.
+
+ -q
+ --quiet
+ Perform operations quietly. (-qq: even more quietly). By
+ default, UnZipSFX prints the names of the files it's extracting
+ or testing, the extraction methods, any member or archive com-
+ ments that may be stored in the archive, and possibly a summary
+ when finished with each archive. The -q[q] options suppress the
+ printing of some or all of these messages.
+
+ -r
+ --remove-exts
+ [Tandem] Remove file extensions.
+
+ -S
+ --stream_lf
+ [VMS] Use Stream_LF record format when converting extracted text
+ files (-a, -aa), instead of the text-file default, variable-
+ length record format.
+
+ [VMS] On VMS, for archives with VMS attribute information (made
+ with "zip -V"), files are always created with their original
+ record formats. For archives without VMS attribute information
+ (not made with "zip -V"), all files are normally created with
+ Stream_LF record format. With -a, text files are normally cre-
+ ated with variable-length record format, but adding -S gives
+ them Stream_LF record format. With -aa, all files are treated
+ as text files. See also -a and -b.
+
+ -s
+ --space_to_uscore
+ Convert spaces in filenames to underscores. Normally, on a sys-
+ tem which allows spaces in filenames, UnZipSFX extracts file-
+ names with spaces intact (for example, "EA DATA. SF"). Working
+ with such file names can be awkward, however, so -s can be used
+ to replace spaces with underscores.
+
+ -t
+ --test
+ Primary Mode. Test archive members. For details, see Primary
+ Mode options.
+
+ -U
+ --unicode
+ [UNICODE_SUPPORT] Control UTF-8 handling. When UNICODE_SUPPORT
+ is available, -U forces UnZipSFX to escape all non-ASCII charac-
+ ters from UTF-8 coded filenames as "#Uxxxx' (for UCS-2 charac-
+ ters, or "#Lxxxxxx" for Unicode codepoints needing 3 octets).
+ This option is provided mainly for debugging, when the fairly
+ new UTF-8 support is suspected of mangling extracted filenames.
+
+ -UU disables the recognition of UTF-8 encoded filenames. The
+ handling of filename codings within UnZipSFX falls back to the
+ behavior of pre-Unicode versions.
+
+ [old, obsolete usage] Leave filenames uppercase if created on
+ MS-DOS, VMS, and so on. See -L.
+
+ -u
+ --update
+ Primary mode. Update existing files and create new ones if
+ needed. For details, see Primary Mode options.
+
+ -V
+ --keep-versions
+ [Non-CMS-MVS] Retain VMS file version numbers. VMS files can
+ be stored with a version number, in the format file.type;##,
+ where "##" is a positive decimal number. By default, the ";##"
+ version numbers are stripped, but this option allows them to be
+ retained. (On file systems that limit filenames to particularly
+ short lengths, the version numbers may be truncated or stripped
+ regardless of this option.)
+
+ [Non-VMS] Note that before UnZip version 6.10, on a non-VMS sys-
+ tem, a file with a name like "fred;123" would, by default, be
+ extracted as "fred", even if the file did not originate on a VMS
+ system (so that ";123" was probably not really a VMS version
+ number). Beginning with UnZip version 6.10, the default behav-
+ ior is to strip VMS version numbers only from files which were
+ archived on a VMS system. To restore the old behavior, and
+ always strip apparent VMS version numbers, explicitly negate the
+ option: -V-.
+
+ [VMS] Note that on VMS, -V affects only version numbers, and is
+ not needed to restore VMS file attributes. Zip's -V (/VMS)
+ option is required to store VMS attributes in an archive. If
+ that was done when an archive was created, then UnZipSFX will
+ always restore those attributes when a file is extracted.
+
+ -W
+ --wild-no-span
+ [WILD_STOP_AT_DIR] (Valid when the program was built with the C
+ macro WILD_STOP_AT_DIR defined.) By default, the wildcard char-
+ acters "?" (single-character wildcard) and "*" (multi-character
+ wildcard) match any character in a member path/name. "-W" modi-
+ fies the pattern-matching behavior for archive members so that
+ both "?" (single-character wildcard) and "*" (multi-character
+ wildcard) do not match the directory separator character "/".
+ (The two-character sequence "**" acts as a multi-character wild-
+ card that includes the directory separator in its matched char-
+ acters.) For example, with "-W":
+
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "**.c" matches both "foo.c" and "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+
+ This modified behavior is equivalent to the pattern matching
+ style used by the shells of some of UnZipSFX's supported target
+ OSs (one example is Acorn RISC OS). This option may not be
+ available on systems where the Zip archive's internal directory
+ separator character "/" is allowed as regular character in
+ native operating system filenames.
+
+ [non-VMS] Currently, UnZipSFX uses the same pattern matching
+ rules for both wildcard archive file name specifications and ar-
+ chive member selection patterns on most system types. For sys-
+ tems allowing "/" as regular filename character, the -W option
+ would not work as expected on a wildcard file name specifica-
+ tion.
+
+ -X
+ --restore-info
+ [VMS, Unix, OS/2, NT, Tandem] Restore owner info (UIC on VMS, or
+ user and group info (UID/GID) on Unix, or access control lists
+ (ACLs) on certain network-enabled versions of OS/2 (Warp Server
+ with IBM LAN Server/Requester 3.0 to 5.0; Warp Connect with IBM
+ Peer 1.0), or security ACLs on Windows NT.) In most cases this
+ will require special system privileges, and doubling the option
+ (-XX) on NT instructs UnZipSFX to use privileges for extraction;
+ but on Unix, for example, a user who belongs to several groups
+ can restore files owned by any of those groups, so long as the
+ user IDs match the user's own. Note that ordinary file
+ attributes are always restored. This option applies only to
+ optional, extra ownership info available on some operating sys-
+ tems. (NT's access control lists do not appear to be especially
+ compatible with OS/2's, so no attempt is made at cross-platform
+ portability of access privileges. It is not clear under which
+ conditions this would ever be useful anyway.)
+
+ -x member ...
+ --exclude member ...
+ An optional list of archive members to be excluded from process-
+ ing. Because wildcard characters normally match "/" directory
+ separators (for exceptions, see the option -W), this option may
+ be used to exclude any files that are in subdirectories. For
+ example, "unzip foo *.[ch] -x */*" would extract all C source
+ files (*.c, *.h) in the main directory, but none in any subdi-
+ rectories. Without the -x option, all C source files in all
+ directories in the archive would be extracted.
+
+ When the program sees -x (--exclude) on a command line, it stops
+ scanning for options, and treats every succeeding item as an ar-
+ chive member name. To avoid any confusion between member names
+ and command options, it's simplest to specify -x (--exclude mem-
+ ber) and its member list as the last 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). That is, for example, the following two commands are
+ equivalent:
+ example_sfx -b -x file1 file2 file3
+ example_sfx -x file1 file2 file3 @ -b
+
+ -Y
+ --dot-version
+ [VMS] Treat archive member name endings of ".nnn" (where "nnn"
+ is a decimal number) as if they were VMS version numbers
+ (";nnn"). (The default is to treat them as file types.) For
+ example:
+ "a.b.3" -> "a.b;3"
+
+ -z
+ --zipfile-comment
+ Primary mode. Display only the archive comment. For details,
+ see Primary Mode options.
+
+ -$
+ --volume-labels
+ [MS-DOS, NT, OS/2, VMS] Restore the volume label if the extrac-
+ tion medium is removable (for example, a diskette). Doubling
+ the option (-$$) allows fixed media (hard disks) to be labeled
+ as well. By default, volume labels are ignored.
+ [VMS] On VMS, a volume must be allocated, not shared, for a vol-
+ ume label to be set.
+
+ -/
+ --extensions
+ [Acorn] Overrides the extension list supplied by the Unzip$Ext
+ environment variable. During extraction, filename extensions
+ that match one of the items in this extension list are swapped
+ in front of the base name of the extracted file.
+
+ -:
+ --do-double-dots
+ [all but Acorn, VM/CMS, MVS, Tandem] Allows UnZipSFX to extract
+ archive members into locations outside of the current extraction
+ destination directory (and its subdirectories).
+
+ For security reasons, UnZipSFX normally removes "parent direc-
+ tory" path components ("../") from the path names of archive
+ members as they are extracted. This safety feature (new for
+ version 5.50) prevents UnZipSFX from accidentally writing files
+ to directories outside the current destination directory tree.
+ The -: option sets UnZipSFX back to its previous, more liberal
+ behavior, allowing exact extraction of archives that use "../"
+ path components to create multiple directory trees at or above
+ the level of the destination directory.
+
+ This option does not enable writing explicitly to the root
+ directory ("/"). To achieve this, it is necessary to set the
+ extraction target folder to "/" (by using an option like
+ "-d /"). However, when the -: option is specified, it is still
+ possible implicitly to write to the root directory if member
+ paths specifying enough "../" path components.
+
+ Use this option with extreme caution.
+
+ -^
+ --control-in-name
+ [Unix] Allow control characters in file names of extracted ZIP
+ archive members. On Unix, a file name may contain any (8-bit)
+ character code with the two exceptions of "/" (the directory
+ delimiter) and NUL (0x00, the C string-termination character),
+ unless the specific file system has more restrictive conven-
+ tions. Generally, this allows embedding ASCII control charac-
+ ters or escape sequences in file names. However, this feature
+ allows the use of malicious file names which can cause various
+ kinds of bad trouble when displayed on a user's terminal/emula-
+ tor. (Even a file name with unprintable but otherwise harmless
+ characters can cause problems for users.)
+
+ For these reasons, by default, UnZipSFX applies a filter that
+ removes potentially dangerous control characters from the
+ extracted file names. The -^ option overrides this filter in
+ the rare case that embedded filename dangerous control charac-
+ ters are to be intentionally restored.
+
+ENVIRONMENT OPTIONS
+ UnZipSFX uses the same environment variables as UnZip does, although
+ this is more likely to affect the person creating and testing a self-
+ extracting archive than it is the SFX user. For details, see the unzip
+ manual page.
+
+ENCRYPTION/DECRYPTION
+ UnZipSFX supports the same encryption methods as UnZip, but encryption
+ support in UnZipSFX must be explicitly enabled at build time. For
+ details, see the UnZip installation instructions (INSTALL).
+
+AUTORUN COMMAND
+ When UnZipSFX is built with CHEAP_SFX_AUTORUN defined, a simple "com-
+ mand autorun" feature is enabled. The command to be run is placed at
+ the beginning of the Zip archive comment, using the following format:
+
+ $AUTORUN$>command-to-be-run
+
+ When UnZipSFX recognizes the token "$AUTORUN$>" at the beginning of the
+ ZIP archive comment, the remainder of the first line of the comment
+ (until the first newline character) is passed as a shell command to the
+ operating system using the C RTL system() function. Before executing
+ the command, UnZipSFX displays the command on the console and prompts
+ the user for confirmation. For safety, when the user has switched off
+ prompting by specifying the -q option, an autorun command is not exe-
+ cuted.
+
+ If the archive comment contains additional lines of text, then those
+ additional comment lines are displayed normally, unless quiet operation
+ was requested using a -q option.
+
+EXAMPLES
+ On Unix, the following commands create a self-extracting archive (exam-
+ ple_sfx) from an ordinary archive (example.zip), adjust the offsets in
+ the resulting SFX archive, and change the permissions on the new SFX
+ archive's to allow execution by everyone:
+
+ cat /usr/local/bin/unzipsfx example.zip > example_sfx
+ zip -A example_sfx
+ chmod 755 example_sfx
+
+ We assume that the desired UnZipSFX executable is found at
+ "/usr/local/bin/unzipsfx", but any path to the desired UnZipSFX exe-
+ cutable is ok.
+
+ On MS-DOS, OS/2, or Windows, the following commands create a similar
+ SFX archive. (Note the use of the /b (binary) option in the COPY com-
+ mand.):
+
+ copy /b unzipsfx.exe+example.zip example_sfx.exe
+ zip -A example_sfx.exe
+
+ If the desired UnZipSFX executable is not in the current directory,
+ then an appropriate path should be specified for it.
+
+ On VMS the basic commands look like these:
+
+ copy unzipsfx.exe, example.zip example_sfx.exe
+ zip -A example_sfx.exe
+
+ If the desired UnZipSFX executable is not in the current default direc-
+ tory, then an appropriate path should be specified for it. (The VMS
+ APPEND command could be used instead of COPY.)
+
+ A slightly more elaborate DCL script to do this job is included in the
+ UnZip source kit: [.vms]makesfx.com. It uses a DCL symbol to find the
+ UnZipSFX executable. Comments in the script explain its usage.
+
+ @ makesfx.com example.zip example_sfx.exe
+
+ As usual on VMS, if a program like an UnZipSFX bundle is to be executed
+ without options or arguments, then the RUN command may be used. For
+ example:
+ run example_sfx.exe
+
+ More work is needed when options or arguments are desired. For exam-
+ ple:
+ mcr sys$disk:[]example_sfx.exe -t -x fred.txt
+ Or, define a foreign-command DCL symbol, and use that:
+ example_sfx = "$ ''f$environment( "default")'example_sfx.exe"
+ example_sfx -t -x fred.txt
+
+ On AmigaDOS:
+
+ MakeSFX example example.zip UnZipSFX
+
+ (MakeSFX is included with the UnZip source distribution and with Amiga
+ binary distributions. "zip -A" doesn't work on Amiga self-extracting
+ archives.)
+
+ To test (or list) the newly created self-extracting archive, use -t:
+
+ example_sfx -t
+
+ To test "example_sfx" quietly, printing only a summary message indicat-
+ ing whether the archive is OK or not, use -tqq:
+
+ example_sfx -tqq
+
+ To extract the complete contents into the current directory, recreating
+ all files and subdirectories as necessary:
+
+ example_sfx
+
+ To extract all *.txt files:
+
+ example_sfx *.txt
+
+ On Unix, quote the "*":
+
+ example_sfx '*.txt'
+
+ To extract everything except the *.txt files:
+
+ example_sfx -x *.txt
+ or:
+ example_sfx -x '*.txt'
+
+ To extract only the README file to standard output (the screen):
+
+ example_sfx -c README
+
+ To print only the archive comment:
+
+ example_sfx -z
+
+LIMITATIONS
+ The principal and fundamental limitation of UnZipSFX is that it is not
+ generally portable from one operating system or hardware architecture
+ to another. Therefore, neither are the resulting SFX archives, as
+ self-extracting archives. The ZIP archive within a self-extracting ar-
+ chive bundle can always be processed anywhere using a normal UnZip pro-
+ gram, even where the UnZipSFX program in the bundle can't do the job.
+ At worst, UnZip will emit a warning like "nnnn extra bytes at beginning
+ or within zipfile", but using "zip -A" on an SFX bundle will prevent
+ even that annoyance. (UnZipSFX itself does not emit the "extra bytes"
+ warning, even if the "zip -A" adjustment is not done.)
+
+ Strictly speaking, until "zip -A" is used to adjust the offsets within
+ the UnZipSFX+archive bundle, that bundle is not a valid ZIP archive,
+ because the offsets in it are wrong. Info-ZIP UnZip can still work
+ with it (emitting that "extra bytes" warning mentioned above), but some
+ other unzipping program might have more trouble with it. After the
+ "zip -A" offset adjustment has been done, any unzipping program should
+ be able to work with the resulting SFX bundle.
+
+ To do its work, the UnZipSFx program in a self-extracting archive must
+ open and read the self-extracting archive file itself. (It's not
+ enough that the shell can find it. It must be able to find itself.)
+ UnZipSFX has no knowledge of the user's PATH, so, in general, a self-
+ extracting archive must either be in the current directory when it is
+ invoked (and "." must be on the user's PATH), or else some explicit
+ (absolute or relative) path must be specified. For example:
+
+ # example_sfx -t # Fails if "." is not on PATH.
+ bash: example_sfx: command not found
+ # ./example_sfx -t # Works.
+ or:
+ mkdir sandbox
+ cd sandbox
+ ../example_sfx
+
+ If a user runs a self-extracting archive which is found in a directory
+ on the PATH other than the current one ("."), then UnZipSFX may fail
+ with a fatal error: "cannot find myself!". This is always true on
+ Unix, and may be true in some cases under MS-DOS, depending on the com-
+ piler used. (Microsoft C may fully qualify the program name, but other
+ compilers may not.) Under OS/2 and NT there are operating-system func-
+ tions available that provide the full path name, so the archive may be
+ invoked from anywhere in the user's path. On VMS, this problem never
+ arises, because the program always sees an absolute path to itself,
+ even when DCL$PATH is used. (The situation is unknown for more obscure
+ operating systems: AmigaDOS, Atari TOS, and so on. Reports are wel-
+ come.)
+
+ As explained above, some normal UnZip features are omitted from
+ UnZipSFX to make it smaller. The diagnostic (-v) and listing (-l) fea-
+ tures are always omitted. Optional compression methods (bzip2, LZMA,
+ PPMd) and any encryption methods (Traditional, AES_WG) are omitted by
+ default, but may be enabled when UnZipSFX is built. For details, see
+ the installation instructions (INSTALL).
+
+ UnZipSFX on the Amiga requires the use of a special program, MakeSFX,
+ to create working self-extracting archives; simple concatenation does
+ not work. (For technically oriented users, the attached archive is
+ defined as a "debug hunk".) There may be compatibility problems
+ between the ROM levels of older Amigas and newer ones.
+
+EXIT STATUS
+ The possible exit status values from UnZipSFX are the same as those for
+ UnZipSFX. See the unzip manual page for details.
+
+SEE ALSO
+ funzip(1L), unzip(1L), zip(1L), zipcloak(1L),
+ zipgrep(1L), zipinfo(1L), zipnote(1L), zipsplit(1L)
+
+URL
+ The Info-ZIP main Web page is:
+ http://www.info-zip.org/
+
+ FTP access is available, too:
+ ftp://ftp.info-zip.org/pub/infozip/
+
+AUTHORS
+ Greg Roelofs was responsible for the basic modifications to UnZip nec-
+ essary to create UnZipSFX. See unzip(1L) for the current list of Info-
+ ZIP authors.
+
+Info-ZIP 06 Nov 2013 (v6.10) UNZIPSFX(1L)
DESCRIPTION
zipgrep will search files within a ZIP archive for lines matching the
given string or pattern. zipgrep is a shell script and requires
- egrep(1) and unzip(1L) to function. Its output is identical to that of
- egrep(1).
+ egrep(1) and unzip(1L) (and basename(1), grep(1), od(1), and sed(1)) to
+ function. Its output is generally similar to that of egrep(1).
ARGUMENTS
pattern
string or regular expression accepted by egrep(1) may be
used. file[.zip] Path of the ZIP archive. (Wildcard
expressions for the ZIP archive name are not supported.)
- If the literal filename is not found, the suffix .zip is
- appended. Note that self-extracting ZIP files are sup-
- ported, as with any other ZIP archive; just specify the
- .exe suffix (if any) explicitly.
+ If the specified filename is not found, then UnZip (not
+ the zipgrep script itself) appends the suffix .zip to the
+ name, and tries again. Note that self-extracting ZIP
+ files are supported, as with any other ZIP archive; just
+ specify the .exe (or any other) suffix explicitly.
[file(s)]
An optional list of archive members to be processed, sep-
- arated by spaces. If no member files are specified, all
- members of the ZIP archive are searched. Regular expres-
- sions (wildcards) may be used to match multiple members:
+ arated by spaces. If no member files are specified, then
+ all members of the ZIP archive are searched. Regular
+ expressions (wildcards) may be used to match multiple
+ members:
* matches a sequence of 0 or more characters
anything except the characters inside the brackets
is considered a match).
- (Be sure to quote any character that might otherwise be
- interpreted or modified by the operating system.)
+ Be sure to quote any character(s) that might otherwise be
+ interpreted or modified by the operating system or shell.
[-x xfile(s)]
An optional list of archive members to be excluded from
- processing. Since wildcard characters match directory
- separators (`/'), this option may be used to exclude any
- files that are in subdirectories. For example, ``zipgrep
- grumpy foo *.[ch] -x */*'' would search for the string
- ``grumpy'' in all C source files in the main directory of
- the ``foo'' archive, but none in any subdirectories.
- Without the -x option, all C source files in all directo-
- ries within the zipfile would be searched.
+ processing. Because wildcard characters match directory
+ separators ("/"), this option may be used to exclude any
+ files that are in subdirectories. For example, "zipgrep
+ grumpy foo *.[ch] -x */*" would search for the string
+ "grumpy" in all C source files in the main directory of
+ the "foo[.zip]" archive, but none in any subdirectories.
+ Without the -x option, all C source files (in all direc-
+ tories) within the archive would be searched.
OPTIONS
All options prior to the ZIP archive filename are passed to
info(1L), zipnote(1L), zipsplit(1L)
URL
- The Info-ZIP home page is currently at http://www.info-
- zip.org/pub/infozip/ or ftp://ftp.info-zip.org/pub/infozip/ .
+ The Info-ZIP main Web page is:
+ http://www.info-zip.org/
+
+ FTP access is available, too:
+ ftp://ftp.info-zip.org/pub/infozip/
AUTHORS
- zipgrep was written by Jean-loup Gailly.
+ zipgrep was written by Jean-loup Gailly and others in the Info-
+ ZIP group.
-Info-ZIP 20 April 2009 ZIPGREP(1L)
+Info-ZIP 25 January 2013 ZIPGREP(1L)
--- /dev/null
+ZIPINFO(1L) ZIPINFO(1L)
+
+NAME
+ zipinfo - show detailed information about a ZIP archive
+
+SYNOPSIS
+ zipinfo [-12smlvhMtTz] file[.zip] [member ...] [-x member ...]
+
+ unzip -Z [-12smlvhMtTz] file[.zip] [member ...] [-x member ...]
+
+DESCRIPTION
+ ZipInfo reports detailed information about a ZIP archive and its mem-
+ bers. This information may include file access permissions, compres-
+ sion method, encryption method, version and operating system (or file
+ system) of the archive-creating program, and so on. The default behav-
+ ior (with no options) is to show a single-line entry for each member in
+ the archive, with a header and a trailer providing summary information
+ for the entire archive. The format is a cross between Unix "ls -l" and
+ "unzip -lv" output. See DETAILED DESCRIPTION below. ZipInfo is the
+ same program as UnZip. (On Unix, "zipinfo" may be a link to "unzip".)
+ However, ZipInfo support may have been disabled when UnZip was built.
+
+ARGUMENTS
+ file[.zip]
+ File path/name of a ZIP archive. A wildcard name may be speci-
+ fied (only in the filename part of the file specification, not
+ in the directory part). If a wildcard is used, then each match-
+ ing archive file is processed in an order determined by the
+ operating system (or file system). Wildcard expressions are
+ similar to those supported (for "globbing") in commonly used
+ Unix shells (csh, ksh, sh, and so on) and may contain:
+
+ * Matches a sequence of 0 or more characters.
+
+ ? Matches exactly 1 character.
+
+ [...] Matches any single character found inside the brackets.
+ Ranges are specified by a beginning character, a hyphen,
+ and an ending character. If an exclamation point ("!")
+ or a caret ("^") follows the left bracket, then the range
+ of characters within the brackets is complemented. That
+ is, anything except the characters inside the brackets is
+ considered a match. To specify a literal left bracket,
+ use the three-character sequence "[[]".
+
+ Be sure to escape or quote any character(s) that might otherwise
+ be interpreted or modified by the operating system, particularly
+ Unix shells. If no wildcard matches are found, then the speci-
+ fication is assumed to be a literal filename. If that also
+ fails, then the suffix ".zip" and/or ".ZIP" is appended, and
+ that is tried. (For this reason, if a non-existent file is
+ specified, then the resulting error message may mention these
+ other names with their ".zip" or ".ZIP" suffixes.)
+
+ Note that a ".zip" or ".ZIP" name ending on an archive is merely
+ a convention, not a requirement. For example, a self-extracting
+ ZIP archive named "fred" or "fred.exe" could be processed as if
+ it were an ordinary archive; just specify the actual file name
+ with its actual name ending (if any), whatever that may be.
+
+ member ...
+ An optional list of archive members to be processed, separated
+ by spaces. If no member list is specified, then all archive
+ members are processed. Wildcard patterns (like those used for
+ an archive file name on Unix, described above) may be used to
+ match multiple members. Again, be sure to quote expressions
+ that would otherwise be expanded or modified by the operating
+ system or shell.
+
+ On Mac OS X systems, file attributes, a resource fork, and simi-
+ lar data may be stored in a separate AppleDouble archive member
+ which has a "._" name prefix. In some cases, UnZip automati-
+ cally handles these AppleDouble archive members when a normal
+ member pattern is specified, but with ZipInfo, the user must
+ specify patterns which explicitly include any desired AppleDou-
+ ble archive members.
+
+ On VMS systems, the wildcard rules used for archive members are
+ the same as on Unix systems. VMS wildcard rules are used only
+ for archive file specifications, not for archive member pat-
+ terns.
+
+OPTIONS (Primary Format)
+ -1
+ --names-only
+ Primary Format. Show member names only, one per line. This
+ option excludes all others, and the report does not include
+ headers, trailers, or archive comments. This format may be use-
+ ful with Unix shell (or other) scripts.
+
+ -2
+ --names-mostly
+ Primary Format. Show member names only, one per line (as with
+ "-1"), but allow headers (-h), trailers (-t), and archive com-
+ ments (-z), if requested explicitly.
+
+ -s
+ --short-list
+ Primary Format. Show member info in short Unix "ls -l" format.
+ This is the default behavior, unless -h or -t is specified.
+
+ -m
+ --medium-list
+ Primary Format. Show member info in medium-length Unix "ls -l"
+ format. Like the -s format, except that the compression factor,
+ expressed as a percentage, is also included.
+
+ -l
+ --long-list
+ Primary Format. Show member info in long Unix "ls -l" format.
+ Like the -m format, except that the compressed size (in bytes)
+ is printed instead of the compression ratio.
+
+ -v
+ --verbose
+ Primary Format. Show very detailed member info in a multi-line
+ format.
+
+ The verbose report is mostly self-explanatory, but it does
+ assume some familiarity with the ZIP archive format. It also
+ includes the archive comment, if any. Extra fields in the cen-
+ tral directory are broken dowm into subfields, with brief
+ descriptions of recognized subfields (or abbreviated dumps of
+ unrecognized subfields).
+
+OPTIONS (Ordinary)
+ -C
+ --ignore-case ([CMS, MVS] --CMS-MVS-lower)
+ Use case-insensitive name matching for names in the member list
+ and the -x excluded-member list on the command line. By
+ default, case-sensitive matching is done. For example, specify-
+ ing "makefile" on the command line will match only "makefile" in
+ the archive, not "Makefile" or "MAKEFILE". On many systems, the
+ local file system is case-insensitive, so case-insensitive name
+ matching would be more natural. With -C, "makefile" would match
+ "makefile", "Makefile", or "MAKEFILE".
+
+ -h
+ --header
+ Include a header in the report, showing the archive name, the
+ archive size (in bytes), and the number of members in the ar-
+ chive.
+
+ For the Unix-format reports (options -l, -m, -s), the header is
+ included by default, if no archive members are specified. If -h
+ is specified alone, that is, without one of the Unix-format
+ options, and without a member list, then only the header lines
+ will be put out.
+
+ -M ([CMS,MVS] Or: -m)
+ --more
+ Pipe all output through an internal pager similar to the Unix
+ more(1) command. At the end of a screenful of output, Zipinfo
+ pauses with a "--More--" prompt; the next screenful may be
+ viewed by pressing the Enter (Return) key or the space bar.
+ ZipInfo can be terminated by pressing the "q" key, or, on some
+ systems, the Enter/Return key. Unlike Unix more(1), there is no
+ forward-searching or editing capability. Also, ZipInfo doesn't
+ notice if long lines wrap at the edge of the screen, effectively
+ resulting in the printing of two or more lines and the likeli-
+ hood that some text will scroll off the top of the screen before
+ being viewed. If the actual number of lines on the screen can
+ not be determined, 24 lines will be assumed.
+
+ -mc
+ --member-counts
+ Control inclusion of separate member counts for directories,
+ files, and (if symlinks are supported) links, after the totals
+ summary at the end of the report. By default, they are
+ included. Use -mc- or --member-counts- to suppress them. See
+ also /TOTALS.
+
+ -T
+ --decimal-time
+ Show the file date-times in a sortable, all-numeric, "YYYYM-
+ MDD.hhmmss" format. The default date format is an alpha-numeric
+ "YY-Mmm-DD hh:mm". For example ("-s", "-s -T"):
+
+ -rw-a-- 3.1 fat 211916 tx defX 10-Jun-18 00:27 zip31c/zip.c
+ -rw-a-- 3.1 fat 211916 tx defX 20100618.002703 zip31c/zip.c
+
+ -t
+ --totals
+ Include a totals summary at the end of the report, showing the
+ number of members in the report, the sum of their uncompressed
+ sizes, the sum of their compressed sizes, and the compression
+ factor as a percentage.
+
+ For the Unix-format reports (options -l, -m, -s), the totals
+ summary is included by default, if no archive members are speci-
+ fied. If -t is specified alone, that is, without one of the
+ Unix-format options, and without a member list, then only the
+ totals summary trailer lines will be put out.
+
+ The total "bytes compressed" reported includes only the actual
+ data, not the ZIP archive meta-data, so the size of the archive
+ will always be greater than this value.
+
+ See also -mc.
+
+ -U
+ --unicode
+ [UNICODE_SUPPORT] Control UTF-8 handling. When UNICODE_SUPPORT
+ is available, -U forces ZipInfo to escape all non-ASCII charac-
+ ters from UTF-8 coded filenames as "#Uxxxx" (for UCS-2 charac-
+ ters, or "#Lxxxxxx" for Unicode codepoints needing 3 octets).
+ This option is mainly provided for debugging purpose when the
+ fairly new UTF-8 support is suspected of damaging extracted
+ filenames.
+
+ -UU disables the recognition of UTF-8 encoded filenames. The
+ handling of filename codings within ZipInfo falls back to the
+ behavior of pre-Unicode versions.
+
+ -W
+ --wild-no-span
+ [WILD_STOP_AT_DIR] (Valid when the program was built with
+ WILD_STOP_AT_DIR enabled.) Modify the pattern-matching behavior
+ so that both "?" (single-character wildcard) and "*" (multi-
+ character wildcard) do not match the directory separator charac-
+ ter "/". (The two-character sequence "**" acts as a multi-char-
+ acter wildcard that includes the directory separator in its
+ matched characters.) For example, with "-W":
+
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "**.c" matches both "foo.c" and "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+
+ This modified behavior is equivalent to the pattern matching
+ style used by the shells of some of UnZip's supported target OSs
+ (one example is Acorn RISC OS). This option may not be avail-
+ able on systems where the Zip archive's internal directory sepa-
+ rator character "/" is allowed as regular character in native
+ operating system filenames. (Currently, UnZip uses the same pat-
+ tern matching rules for both wildcard archive file name specifi-
+ cations and archive member selection patterns on most system
+ types. For systems allowing "/" as regular filename character,
+ the -W option would not work as expected on a wildcard file name
+ specification.)
+
+ -x member ...
+ --exclude member ...
+ An optional list of archive members to be excluded from process-
+ ing. Because wildcard characters normally match "/" directory
+ separators (for exceptions see the option -W), this option may
+ be used to exclude any files that are in subdirectories. For
+ example, "zipinfo foo *.[ch] -x */*" would report on all C
+ source files (*,c, *.h) in the main directory, but none in any
+ subdirectories. Without the -x option, all C source files in
+ all directories within the archive would be included in the
+ report.
+
+ When the program sees -x (--exclude) on a command line, it stops
+ scanning for options, and treats every succeeding item as an ar-
+ chive member name. To avoid confusion between member names and
+ command options, it's simplest to specify -x (--exclude) and its
+ member list as the last 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). That
+ is, the following two commands are equivalent:
+ zipinfo fred.zip -2 -t -x file1 file2 file3
+ zipinfo fred.zip -x file1 file2 file3 @ -2 -t
+
+ -z
+ --zipfile-comment
+ Include the archive comments (if any) in the report.
+
+DETAILED DESCRIPTION
+ ZipInfo has three basic report formats, providing different degrees of
+ detail in the information about the members of an archive: a simple
+ list of names (-1, -2), a Unix ls-style listing (-l, -m, -s), and a
+ very detailed analysis (-v). Some of the information, such as file
+ sizes, is easy to interpret. Some of the information involves fairly
+ obscure details of ZIP archive structure. ZIP archive structure is
+ documented in the PKWARE Inc. APPNOTE.TXT: http://www.pkware.com/docu-
+ ments/casestudies/APPNOTE.TXT
+
+ The table below shows some typical -l report entries:
+
+ Perm/Prot Zver Ofs UncoSize At CompSize Cmth ModDate Mtime Name
+ ----------+----+---+--------+--+--------+----+---------------+--------------
+ -rw-a-- 3.1 fat 211916 tx 53467 defX 10-Jun-18 00:27 zip31c/zip.c
+ -rwxr-x--- 3.1 unx 709 Tx 311 aesw 11-Aug-21 22:20 endian.c
+ RWED,RE, 3.1 vms 6656 bx 2295 defN 07-Aug-15 14:12 itrc/TST.EXE;8
+
+ Field 1 (Perm/Prot) shows the file permission/protection attributes,
+ formatted according to the original operating system or file system
+ where the archive was created.
+
+ Field 2 (Zver) shows the (approximate) version of the Zip program which
+ created the archive.
+
+ Field 3 (Ofs) shows the original operating system where the archive was
+ created, or the file system on which the member file was stored.
+
+ Field 4 (UncoSize) shows the original, uncompressed file size.
+
+ Field 5 (At) shows some archive member attributes, as detailed in the
+ tables below. The first character indicates whether a file was binary
+ or text, and whether it was encrypted. The second character indicates
+ the presence of a data descriptor (sometimes called an "extended
+ header") and/or an extra field in the member data.
+
+ | File Type Extra Field |
+ First char | binary text yes no | Second char
+ --------------+-------+----- ------+-----+--------------------
+ Encrypted no | b t x - | no Data Descriptor
+ yes | B T X l | yes
+
+ A Data Descriptor holds CRC and size data at an alternate place
+ in the archive (after processed member data instead of before),
+ and is normally used when the archiving program can't seek in
+ the output archive data/file. An Extra Field can hold a wide
+ variety of data, including 64-bit file sizes, many kinds of OS-
+ specific attribute data, UTC times, and so on.
+
+ Field 6 (CompSize) shows the compressed file size. With -m, this field
+ shows the compression fraction as a percentage. With -s (the default),
+ this field is omitted. This compressed size value (unlike the one in
+ an "unzip -l" report) includes all the overhead resulting from Tradi-
+ tional encryption.
+
+ Field 7 (Cmth) shows the compression method used. Note that AES_WG
+ encryption is treated as a compression method here. Not all of the
+ methods shown in the table below are supported. (Some are obsolete.)
+
+ Num Abbr Name, description
+ ----+----+------------------------------------------------------------
+ 0 stor Store (no compression)
+ 1 shrk Shrink
+ 2 re:1 Reduce (factor 1)
+ 3 re:2 Reduce (factor 2)
+ 4 re:3 Reduce (factor 3)
+ 5 re:4 Reduce (factor 4)
+ 6 i#:# Implode (dictonary_size:Shannon-Fano_trees)
+ 7 tokn Tokenize
+ 8 def# Deflate (N: normal, X: maximum, F: fast, S: super-fast)
+ 9 d64# Deflate64 (N: normal, X: maximum, F: fast, S: super-fast)
+ 10 dcli PKWARE Data Compression Library Imploding - IBM TERSE (old)
+ 12 bzp2 bzip2
+ 14 lzma LZMA
+ 18 ters IBM TERSE (new)
+ 19 lz77 IBM LZ77 z Architecture (PFS)
+ 96 jpeg JPEG
+ 97 wavp WavPack
+ 98 ppmd PPMd version I, Rev 1
+ 99 aesw AES_WG encryption
+
+ Fields 8 and 9 (ModDate, Mtime) show the file modification date-time
+ (MS-DOS format, local time).
+
+ Field 10 (Name) shows the file path/name.
+
+ENVIRONMENT OPTIONS
+ ZipInfo's default behavior may be modified by placing command-line
+ options in an environment variable. This can be done with any option,
+ but it is probably most useful options like -T (decimal time format) or
+ one of the non-default Unix format optiond (-l, -m).
+
+ For ZipInfo ("unzip -Z"), the environment variable name is ZIP-
+ INFO, except on VMS, where it's ZIPINFO_OPTS. For similarity
+ with Zip, if ZIPINFO (ZIPINFO_OPTS on VMS) is not defined, then
+ ZipInfo will use ZIPINFOOPT the same way.
+
+ For example, to make the default format the long Unix format
+ instead of the short Unix format, one could use commands like
+ the following:
+
+ Unix Bourne (or similar) shell:
+ ZIPINFO='-l'; export ZIPINFO
+
+ Unix C shell:
+ setenv ZIPINFO '-l'
+
+ OS/2 or MS-DOS:
+ set ZIPINFO="-l"
+
+ VMS (with quotation to preserve lower case in DCL):
+ define ZIPINFO_OPTS "-l" ! Logical name, or
+ ZIPINFO_OPTS = "-l" ! DCL symbol. (Either works.)
+
+ Environment options are treated the same as any other command-
+ line options, except that they are effectively the first options
+ on the command line. To override an environment option, one may
+ use an explicit option to cancel or override it. For example,
+ to disable the totals trailer line by default, one could use
+ commands like the following:
+
+ Unix Bourne (or similar) shell:
+ ZIPINFO='-t-'; export ZIPINFO
+
+ Unix C shell:
+ setenv ZIPINFO '-t-'
+
+ OS/2 or MS-DOS:
+ set ZIPINFO="-t-"
+
+ VMS (with quotation to preserve lower case in DCL):
+ define ZIPINFO_OPTS "-t-" ! Logical name, or
+ ZIPINFO_OPTS = "-t-" ! DCL symbol. (Either works.)
+
+ The examples show short (one-character) options, but long ("--")
+ options are also allowed.
+
+ The timezone variable (TZ) should be set according to the local time-
+ zone in order for the Freshen (-f) and Update (-u) modes to operate
+ correctly. For details, see -f. This variable may also be necessary
+ to get timestamps of extracted files to be set correctly.
+
+ On Windows systems, UnZip gets the timezone configuration from
+ the registry, assuming it is correctly set in the Control Panel.
+ The TZ variable is ignored on these systems.
+
+EXAMPLES
+ To get a basic, short-format listing of the complete contents of a ZIP
+ archive zip31c.zip, with both header and totals lines, use only the ar-
+ chive name as an argument to zipinfo:
+
+ zipinfo zip31c.zip
+ zipinfo zip31c
+
+ To produce a basic, long-format listing (not verbose), including header
+ and totals lines, use -l:
+
+ zipinfo -l zip31c.zip
+
+ To list the complete contents of the archive without header and totals
+ lines, either negate the -h and -t options or else specify the contents
+ explicitly:
+
+ zipinfo -h- -t- zip31c.zip
+ zipinfo zip31c.zip "*"
+
+ (Here, the wildcard "*" is quoted to prevent a Unix shell from expand-
+ ing (globbing) it.)
+
+ To list information on a single archive member, in medium format, spec-
+ ify the member name explicitly:
+
+ zipinfo -m unzip60.zip "*/unshrink.c"
+
+ When any member name is specified, the header and totals trailer are,
+ by default, not included in the report, but explicitly specifying -h
+ and/or -t will restore them. For example:
+
+ zipinfo -m -t unzip610b.zip "*.[ch]" "*/Make*"
+
+ On a Unix system, one could use the -T option along with an external
+ sorting program (and another filter like head or tail) to get a listing
+ of the least or most recently modified files in the archive:
+
+ zipinfo -l -T -h- -t- zip31c.zip | sort -k 8 | head -12
+ zipinfo -l -T -h- -t- zip31c.zip | sort -r -k 8 | head -12
+
+ The sort option -k 8 tells it to sort on field 8, which is the date-
+ time field in a long- or medium-format (-l, -m) ZipInfo report. (Use
+ -k 7 for the short (-s) format.) The -r option reverses the default
+ smallest-to-largest sort order.
+
+BUGS
+ As with UnZip, ZipInfo's -M ("more") option is overly simplistic in its
+ handling of screen output. As noted above, it fails to detect the
+ wrapping of long lines and may thereby cause lines at the top of the
+ screen to be scrolled off before being read. ZipInfo should detect and
+ treat each occurrence of line-wrap as one additional line printed.
+ This requires knowledge of the screen's width as well as its height.
+ In addition, ZipInfo should detect the true screen geometry on all sys-
+ tems.
+
+ The interactions among the various listing format, header, and trailer
+ options (-h, -l, -m, -s, -t) are unnecessarily complex and should be
+ simplified, despite the potential disruption to current users.
+
+SEE ALSO
+ funzip(1L), unzip(1L), unzipsfx(1L), zip(1L), zipcloak(1L), zip-
+ note(1L), zipsplit(1L)
+
+URL
+ The Info-ZIP main Web page is:
+ http://www.info-zip.org/
+
+ FTP access is available, too:
+ ftp://ftp.info-zip.org/pub/infozip/
+
+Info-ZIP 06 Nov 2013 (v3.1) ZIPINFO(1L)
0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF /* F8 - FF */
};
-#if (defined(ZIP) || CRYPT)
+#if defined(ZIP) || defined( IZ_CRYPT_ANY)
ZCONST uch ascii[] = {
0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, /* 00 - 07 */
0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* F0 - F7 */
0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F /* F8 - FF */
};
-#endif /* ZIP || CRYPT */
+#endif /* defined(ZIP) || defined( IZ_CRYPT_ANY) */
#else /* MTS */
0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF /* F8 - FF */
};
-#if (defined(ZIP) || CRYPT)
+#if defined(ZIP) || defined( IZ_CRYPT_ANY)
ZCONST uch ascii[] = {
0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, /* 00 - 07 */
0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* F0 - F7 */
0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F /* F8 - FF */
};
-#endif /* ZIP || CRYPT */
+#endif /* defined(ZIP) || defined( IZ_CRYPT_ANY) */
#endif /* ?MTS */
#endif /* EBCDIC */
/*
- Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 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.
if (envptr == (char *)NULL || *envptr == '\0')
return PK_OK;
- bufptr = malloc(1 + strlen(envptr));
+ bufptr = izu_malloc(1 + strlen(envptr));
if (bufptr == (char *)NULL)
return PK_MEM;
#if ((defined(WIN32) || defined(WINDLL)) && !defined(_WIN32_WCE))
/* count the args so we can allocate room for them */
argc = count_args(bufptr);
/* allocate a vector large enough for all args */
- argv = (char **)malloc((argc + *Pargc + 1) * sizeof(char *));
+ argv = (char **)izu_malloc((argc + *Pargc + 1) * sizeof(char *));
if (argv == (char **)NULL) {
- free(bufptr);
+ izu_free(bufptr);
return PK_MEM;
}
argvect = argv;
return; /* no environment arguments */
/* set up new argument list */
- newargv = (char **) malloc(sizeof(char **) * (newargc+1));
+ newargv = (char **) izu_malloc(sizeof(char **) * (newargc+1));
if (newargv == NULL)
return; /* malloc failed */
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2012 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2007-Mar-04 or later
(the contents of which are also included in unzip.h) for terms of use.
#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
# define wszimpl (unsigned)(G._wsize)
#else
-# if defined(USE_DEFLATE64) && defined(INT_16BIT)
+# if defined(DEFLATE64_SUPPORT) && defined(INT_16BIT)
# define wszimpl (unsigned)(WSIZE>>1)
-# else /* !(USE_DEFLATE64 && INT_16BIT) */
+# else /* !(DEFLATE64_SUPPORT && INT_16BIT) */
# define wszimpl WSIZE
-# endif /* !(USE_DEFLATE64 && INT_16BIT) */
+# endif /* !(DEFLATE64_SUPPORT && INT_16BIT) */
#endif
/* routines here */
}
+/* 2012-12-04 SMS. Memory copy method selection. */
+# ifndef NO_SLIDE_MEMCPY
+# define SLIDE_MEMCPY
+# endif
+# ifndef NO_SLIDE_MEMMOVE
+# define SLIDE_MEMMOVE_disabled /* Some testing suggests unhelpful. */
+# endif
static int explode_lit(__G__ tb, tl, td, bb, bl, bd, bdl)
__GDEF
d += e;
}
else
-#ifndef NOMEMCPY
+ {
+#ifdef SLIDE_MEMCPY
+# ifdef BAD_SLIDE_MEMCPY
+ /* 2012-12-04 SMS.
+ * http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=406
+ * This test can be erroneous if w < d. Unsigned overflow
+ * is always greater than "e", so memcpy() could be used on
+ * overlapping regions when d - w < e. See below.
+ */
if (w - d >= e) /* (this test assumes unsigned comparison) */
{
+# else /* def BAD_SLIDE_MEMCPY */
+ /* Use memcpy(), if no overlap. */
+ if (labs( (long)w - (long)d) >= (long)e)
+ {
+# endif /* def BAD_SLIDE_MEMCPY [else] */
memcpy(redirSlide + w, redirSlide + d, e);
w += e;
d += e;
}
- else /* do it slow to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
+# ifdef SLIDE_MEMMOVE
+ /* 2012-12-04 SMS. Use memmove() where it does what we want. */
+ else if ((long)w < (long)d)
+ {
+ /* memmove() does the right thing, so use it. */
+ memmove( redirSlide + (unsigned)w, redirSlide + d, e);
+ w += e;
+ d += e;
+ }
+# endif /* def SLIDE_MEMMOVE */
+ else
+ {
+#else /* def SLIDE_MEMCPY */
+ {
+#endif /* def SLIDE_MEMCPY [else] */
+ /* Advancing copy, probably slower than memcpy().
+ * (Possibly faster than memmove() on VMS Alpha?)
+ * When w > d, this copies blocks of size w-d repeatedly.
+ */
do {
redirSlide[w++] = redirSlide[d++];
} while (--e);
+ }
+ }
if (w == wszimpl)
{
if ((retval = flush(__G__ redirSlide, (ulg)w, 0)) != 0)
d += e;
}
else
-#ifndef NOMEMCPY
+ {
+#ifdef SLIDE_MEMCPY
+# ifdef BAD_SLIDE_MEMCPY
+ /* 2012-12-04 SMS.
+ * http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=406
+ * This test can be erroneous if w < d. Unsigned overflow
+ * is always greater than "e", so memcpy() could be used on
+ * overlapping regions when d - w < e. See below.
+ */
if (w - d >= e) /* (this test assumes unsigned comparison) */
{
+# else /* def BAD_SLIDE_MEMCPY */
+ /* Use memcpy(), if no overlap. */
+ if (labs( (long)w - (long)d) >= (long)e)
+ {
+# endif /* def BAD_SLIDE_MEMCPY [else] */
memcpy(redirSlide + w, redirSlide + d, e);
w += e;
d += e;
}
- else /* do it slow to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
+# ifdef SLIDE_MEMMOVE
+ /* 2012-12-04 SMS. Use memmove() where it does what we want. */
+ else if ((long)w < (long)d)
+ {
+ /* memmove() does the right thing, so use it. */
+ memmove( redirSlide + (unsigned)w, redirSlide + d, e);
+ w += e;
+ d += e;
+ }
+# endif /* def SLIDE_MEMMOVE */
+ else
+ {
+#else /* def SLIDE_MEMCPY */
+ {
+#endif /* def SLIDE_MEMCPY [else] */
+ /* Advancing copy, probably slower than memcpy().
+ * (Possibly faster than memmove() on VMS Alpha?)
+ * When w > d, this copies blocks of size w-d repeatedly.
+ */
do {
redirSlide[w++] = redirSlide[d++];
} while (--e);
+ }
+ }
if (w == wszimpl)
{
if ((retval = flush(__G__ redirSlide, (ulg)w, 0)) != 0)
*/
G._wsize = G.redirect_size, redirSlide = G.redirect_buffer;
else
-#if defined(USE_DEFLATE64) && defined(INT_16BIT)
+#if defined(DEFLATE64_SUPPORT) && defined(INT_16BIT)
/* For systems using 16-bit ints, reduce the used buffer size below
* the limit of "unsigned int" numbers range.
*/
G._wsize = WSIZE>>1, redirSlide = slide;
-#else /* !(USE_DEFLATE64 && INT_16BIT) */
+#else /* !(DEFLATE64_SUPPORT && INT_16BIT) */
G._wsize = WSIZE, redirSlide = slide;
-#endif /* !(USE_DEFLATE64 && INT_16BIT) */
+#endif /* !(DEFLATE64_SUPPORT && INT_16BIT) */
#endif /* DLL && !NO_SLIDE_REDIR */
/* Tune base table sizes. Note: I thought that to truly optimize speed,
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
store_info()
find_compr_idx()
extract_or_test_entrylist()
+ extract_or_test_entrylistw() (Wide Char Windows)
extract_or_test_member()
TestExtraField()
test_compr_eb()
memextract()
memflush()
- extract_izvms_block() (VMS or VMS_TEXT_CONV)
- set_deferred_symlink() (SYMLINKS only)
+ extract_izvms_block() (VMS or VMS_TEXT_CONV)
+ set_deferred_symlink() (SYMLINKS only)
fnfilter()
- dircomp() (SET_DIR_ATTRIB only)
- UZbunzip2() (USE_BZIP2 only)
+ dircomp() (SET_DIR_ATTRIB only)
+ UZbunzip2() (BZIP2_SUPPORT only)
+ UZlzma() (LZMA_SUPPORT only)
+ UZppmd() (PPMD_SUPPORT only)
---------------------------------------------------------------------------*/
#define __EXTRACT_C /* identifies this source module */
#define UNZIP_INTERNAL
#include "unzip.h"
+#if defined( UNIX) && defined( __APPLE__)
+# include "unix/macosx.h"
+#endif /* defined( UNIX) && defined( __APPLE__) */
#ifdef WINDLL
-# ifdef POCKET_UNZIP
-# include "wince/intrface.h"
-# else
-# include "windll/windll.h"
-# endif
+# ifdef POCKET_UNZIP
+# include "wince/intrface.h"
+# else
+# include "windll/windll.h"
+# endif
#endif
#include "crc32.h"
#include "crypt.h"
+#ifdef BZIP2_SUPPORT
+static int UZbunzip2 OF((__GPRO));
+#endif
+
+#ifdef LZMA_SUPPORT
+static int UZlzma OF((__GPRO));
+#endif
+
+#ifdef PPMD_SUPPORT
+static int UZppmd OF((__GPRO));
+#endif
+
#define GRRDUMP(buf,len) { \
int i, j; \
\
static int store_info OF((__GPRO));
#ifdef SET_DIR_ATTRIB
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static int extract_or_test_entrylistw OF((__GPRO__ unsigned numchunk,
+ ulg *pfilnum, ulg *pnum_bad_pwd, zoff_t *pold_extra_bytes,
+ unsigned *pnum_dirs,
+ direntryw **pdirlistw,
+ int error_in_archive));
+# endif
static int extract_or_test_entrylist OF((__GPRO__ unsigned numchunk,
ulg *pfilnum, ulg *pnum_bad_pwd, zoff_t *pold_extra_bytes,
unsigned *pnum_dirs, direntry **pdirlist,
#endif
static int extract_or_test_member OF((__GPRO));
#ifndef SFX
- static int TestExtraField OF((__GPRO__ uch *ef, unsigned ef_len));
- static int test_compr_eb OF((__GPRO__ uch *eb, unsigned eb_size,
+ static int TestExtraField OF((__GPRO__ uch *ef, long ef_len));
+ static int test_compr_eb OF((__GPRO__ uch *eb, long eb_size,
unsigned compr_offset,
- int (*test_uc_ebdata)(__GPRO__ uch *eb, unsigned eb_size,
+ int (*test_uc_ebdata)(__GPRO__ uch *eb, long eb_size,
uch *eb_ucptr, ulg eb_ucsize)));
#endif
-#if (defined(VMS) || defined(VMS_TEXT_CONV))
+#if defined(VMS) || defined(VMS_TEXT_CONV)
static void decompress_bits OF((uch *outptr, unsigned needlen,
ZCONST uch *bitptr));
#endif
static void set_deferred_symlink OF((__GPRO__ slinkentry *slnk_entry));
#endif
#ifdef SET_DIR_ATTRIB
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ static int Cdecl dircompw OF((ZCONST zvoid *a, ZCONST zvoid *b));
+# endif
static int Cdecl dircomp OF((ZCONST zvoid *a, ZCONST zvoid *b));
#endif
-
/*******************************/
/* Strings used in extract.c */
/*******************************/
static ZCONST char Far CmprLZMA[] = "LZMA";
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 *ComprNames[NUM_METHODS] = {
CmprNone, CmprShrink, CmprReduce, CmprReduce, CmprReduce, CmprReduce,
CmprImplode, CmprTokenize, CmprDeflate, CmprDeflat64, CmprDCLImplode,
- CmprBzip, CmprLZMA, CmprIBMTerse, CmprIBMLZ77, CmprWavPack, CmprPPMd
+ CmprBzip, CmprLZMA, CmprIBMTerse, CmprIBMLZ77, CmprJPEG, CmprWavPack,
+ CmprPPMd, CmprAES
};
static ZCONST unsigned ComprIDs[NUM_METHODS] = {
STORED, SHRUNK, REDUCED1, REDUCED2, REDUCED3, REDUCED4,
IMPLODED, TOKENIZED, DEFLATED, ENHDEFLATED, DCLIMPLODED,
- BZIPPED, LZMAED, IBMTERSED, IBMLZ77ED, WAVPACKED, PPMDED
+ BZIPPED, LZMAED, IBMTERSED, IBMLZ77ED, JPEGED, WAVPACKED,
+ PPMDED, AESENCRED
};
#endif /* !SFX */
static ZCONST char Far FilNamMsg[] =
"%s: mismatching \"local\" filename (%s),\n\
continuing with \"central\" filename version\n";
#endif /* !SFX */
-#if (!defined(SFX) && defined(UNICODE_SUPPORT))
+#if !defined(SFX) && defined(UNICODE_SUPPORT)
static ZCONST char Far GP11FlagsDiffer[] =
"file #%lu (%s):\n\
mismatch between local and central GPF bit 11 (\"UTF-8\"),\n\
"%s: bad extra field length (%s)\n";
static ZCONST char Far OffsetMsg[] =
"file #%lu: bad zipfile offset (%s): %ld\n";
-static ZCONST char Far ExtractMsg[] =
- "%8sing: %-22s %s%s";
#ifndef SFX
static ZCONST char Far LengthMsg[] =
"%s %s: %s bytes required to uncompress to %s bytes;\n %s\
supposed to require %s bytes%s%s%s\n";
#endif
+#ifdef IZ_CRYPT_AES_WG
+static ZCONST char Far BadAesExtFieldMsg[] =
+ "%s: bad AES_WG extra field (mode = %d)\n";
+static ZCONST char Far BadAesMacMsg[] = " bad AES_WG MAC\n";
+#endif /* def IZ_CRYPT_AES_WG */
+
static ZCONST char Far BadFileCommLength[] = "%s: bad file comment length\n";
static ZCONST char Far LocalHdrSig[] = "local header sig";
static ZCONST char Far BadLocalHdr[] = "file #%lu: bad local header\n";
"warning: stripped absolute path spec from %s\n";
static ZCONST char Far SkipVolumeLabel[] =
" skipping: %-22s %svolume label\n";
+static ZCONST char Far JunkTooMany[] =
+ "warning: not enough directories (%d) to junk %d:";
+static ZCONST char Far JunkTooManyDir[] =
+ "warning: not enough Directories (%d) to junk %d: %s\n";
+
+
+#if defined( UNIX) && defined( __APPLE__)
+static ZCONST char Far AplDblNameTooLong[] =
+ "ERROR: file name too long with AppleDouble suffix: %s\n";
+#endif /* defined( UNIX) && defined( __APPLE__) */
#ifdef SET_DIR_ATTRIB /* messages of code for setting directory attributes */
static ZCONST char Far DirlistEntryNoMem[] =
"finishing deferred symbolic links:\n";
static ZCONST char Far SymLnkFinish[] =
" %-22s -> %s\n";
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ static ZCONST char Far SymLnkFinishW[] =
+ " %-22S -> %s\n";
+# endif
+ static ZCONST char Far SymLnkErrUnlink[] = "%sunlink error: %s";
+ static ZCONST char Far SymLnkErrSymlink[] = "symlink%s error: %s";
+# ifdef VMS
+ static ZCONST char Far SymLnkError[] =
+ " %s\n";
+# endif /* def VMS */
+# ifdef WIN32
+ static ZCONST char Far SymLnkErrSymlinkPriv[] =
+ "Insufficient privilege to create symlink (may need Administrative)";
+# endif /* def WIN32 */
#endif
#ifndef WINDLL
"error: invalid response [%s]\n";
#endif /* !WINDLL */
+static ZCONST char Far ErrorUnexpectedEOF[] =
+ "error: Unexpected end-of-file reading %s.\n";
static ZCONST char Far ErrorInArchive[] =
- "At least one %serror was detected in %s.\n";
+ "At least one %serror %swas detected in %s.\n";
static ZCONST char Far ZeroFilesTested[] =
"Caution: zero files tested in %s.\n";
"\n%s: stored in VMS format. Extract anyway? (y/n) ";
#endif
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
static ZCONST char Far SkipCannotGetPasswd[] =
" skipping: %-22s unable to get password\n";
static ZCONST char Far SkipIncorrectPasswd[] =
"%lu file%s skipped because of incorrect password.\n";
static ZCONST char Far MaybeBadPasswd[] =
" (may instead be incorrect password)\n";
-#else
+#else /* def IZ_CRYPT_ANY */
static ZCONST char Far SkipEncrypted[] =
" skipping: %-22s encrypted (not supported)\n";
-#endif
+#endif /* def IZ_CRYPT_ANY [else] */
static ZCONST char Far NoErrInCompData[] =
"No errors detected in compressed data of %s.\n";
static ZCONST char Far NoErrInTestedFiles[] =
"No errors detected in %s for the %lu file%s tested.\n";
static ZCONST char Far FilesSkipped[] =
- "%lu file%s skipped because of unsupported compression or encoding.\n";
+ "%lu file%s skipped because of unsupported compression or encryption.\n";
-static ZCONST char Far ErrUnzipFile[] = " error: %s%s %s\n";
-static ZCONST char Far ErrUnzipNoFile[] = "\n error: %s%s\n";
+static ZCONST char Far ErrUnzipFile[] = "ERROR: %s%s %s\n";
+static ZCONST char Far ErrUnzipNoFile[] = "ERROR: %s%s\n";
static ZCONST char Far NotEnoughMem[] = "not enough memory to ";
static ZCONST char Far InvalidComprData[] = "invalid compressed data to ";
+#ifdef DEFLATE_SUPPORT
static ZCONST char Far Inflate[] = "inflate";
-#ifdef USE_BZIP2
+#endif
+#ifdef BZIP2_SUPPORT
static ZCONST char Far BUnzip[] = "bunzip";
#endif
-
+#ifdef LZMA_SUPPORT
+ static ZCONST char Far UnLZMA[] = "unLZMA";
+#endif
+#ifdef PPMD_SUPPORT
+ static ZCONST char Far UnPPMd[] = "unPPMd";
+#endif
#ifndef SFX
static ZCONST char Far Explode[] = "explode";
+#endif
#ifndef LZW_CLEAN
static ZCONST char Far Unshrink[] = "unshrink";
#endif
-#endif
-#if (!defined(DELETE_IF_FULL) || !defined(HAVE_UNLINK))
+#if !defined(DELETE_IF_FULL) || !defined(HAVE_UNLINK)
static ZCONST char Far FileTruncated[] =
"warning: %s is probably truncated\n";
#endif
"%s: unknown compression method\n";
static ZCONST char Far BadCRC[] = " bad CRC %08lx (should be %08lx)\n";
- /* TruncEAs[] also used in OS/2 mapname(), close_outfile() */
-char ZCONST Far TruncEAs[] = " compressed EA data missing (%d bytes)%s";
-char ZCONST Far TruncNTSD[] =
- " compressed WinNT security data missing (%d bytes)%s";
+/* TruncEAs[] also used in os2/os2.c:[close_outfile(), mapname()]. */
+ZCONST char Far TruncEAs[] = " compressed EA data missing (%ld bytes)%s";
+
+/* TruncNTSD also used in win32/win32.c:[close_outfile(),
+ * set_direc_attribs(), set_direc_attribsw()].
+ */
+ZCONST char Far TruncNTSD[] =
+ " compressed WinNT security data missing (%ld bytes)%s";
#ifndef SFX
static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \
- EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n";
+ EF block length (%ld bytes) exceeds remaining EF data (%ld bytes)\n";
static ZCONST char Far InvalidComprDataEAs[] =
" invalid compressed data for EAs\n";
-# if (defined(WIN32) && defined(NTSD_EAS))
+# if defined(WIN32) && defined(NTSD_EAS)
static ZCONST char Far InvalidSecurityEAs[] =
" EAs fail security check\n";
-# endif
+# endif
static ZCONST char Far UnsuppNTSDVersEAs[] =
" unsupported NTSD EAs version %d\n";
static ZCONST char Far BadCRC_EAs[] = " bad CRC for extended attributes\n";
#endif /* !SFX */
static ZCONST char Far UnsupportedExtraField[] =
- "\nerror: unsupported extra-field compression type (%u)--skipping\n";
+ "ERROR: unsupported extra-field compression type (%u)--skipping\n";
static ZCONST char Far BadExtraFieldCRC[] =
- "error [%s]: bad extra-field CRC %08lx (should be %08lx)\n";
+ "ERROR [%s]: bad extra-field CRC %08lx (should be %08lx)\n";
+/* Data-dependent info for verbose test (-tv) report. */
+static ZCONST char Far InfoMsgLZMA[] =
+ "\n LZMA: dicSize = %u, lc = %u, lp = %u, pb = %u. ";
+static ZCONST char Far InfoMsgPPMd[] =
+ "\n PPMd: flags = 0x%04x. Order = %d, Mem = %dMB, Restore = %d. ";
+
+/* Inconsistent Java "CAFE" extra fields (local v. central dir.). */
+static ZCONST char Far InfoInconsistentJavaCAFE[] =
+ "Inconsistent cantral-local Java CAFE. Expect name warnings/problems.\n";
int extract_or_test_files(__G) /* return PK-type error code */
__GDEF
{
- unsigned i, j;
+ unsigned i;
+ unsigned j;
zoff_t cd_bufstart;
uch *cd_inptr;
int cd_incnt;
- ulg filnum=0L, blknum=0L;
+ ulg filnum = 0L;
+ ulg blknum = 0L;
int reached_end;
+ int sts;
#ifndef SFX
int no_endsig_found;
#endif
- int error, error_in_archive=PK_COOL;
- int *fn_matched=NULL, *xn_matched=NULL;
+ int error;
+ int error_in_archive = PK_COOL;
+ char *fn_matched = NULL;
+ char *xn_matched = NULL;
zucn_t members_processed;
- ulg num_skipped=0L, num_bad_pwd=0L;
+ ulg num_skipped = 0L;
+ ulg num_bad_pwd = 0L;
zoff_t old_extra_bytes = 0L;
#ifdef SET_DIR_ATTRIB
- unsigned num_dirs=0;
- direntry *dirlist=(direntry *)NULL, **sorted_dirlist=(direntry **)NULL;
+ unsigned num_dirs = 0;
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ direntryw *dirlistw = (direntryw *)NULL;
+ direntryw **sorted_dirlistw = (direntryw **)NULL;
+# endif
+ direntry *dirlist = (direntry *)NULL;
+ direntry **sorted_dirlist = (direntry **)NULL;
#endif
/*
}
}
-#if (!defined(SFX) || defined(SFX_EXDIR))
+#if !defined(SFX) || defined(SFX_EXDIR)
/* b) check out if specified extraction root directory exists */
if (uO.exdir != (char *)NULL && G.extract_flag) {
G.create_dirs = !uO.fflag;
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if (G.has_win32_wide) {
+ wchar_t *exdirw = local_to_wchar_string(uO.exdir);
+ if ((error = checkdirw(__G__ exdirw, ROOT)) > MPN_INF_SKIP) {
+ /* out of memory, or file in way */
+ izu_free(exdirw);
+ return (error == MPN_NOMEM ? PK_MEM : PK_ERR);
+ }
+ izu_free(exdirw);
+ } else {
+ if ((error = checkdir(__G__ uO.exdir, ROOT)) > MPN_INF_SKIP) {
+ /* out of memory, or file in way */
+ return (error == MPN_NOMEM ? PK_MEM : PK_ERR);
+ }
+ }
+# else /* ! (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
if ((error = checkdir(__G__ uO.exdir, ROOT)) > MPN_INF_SKIP) {
/* out of memory, or file in way */
return (error == MPN_NOMEM ? PK_MEM : PK_ERR);
}
+# endif /* ! (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
}
#endif /* !SFX || SFX_EXDIR */
G.pInfo = G.info;
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
G.newzip = TRUE;
#endif
#ifndef SFX
G.reported_backslash = FALSE;
#endif
- /* malloc space for check on unmatched filespecs (OK if one or both NULL) */
- if (G.filespecs > 0 &&
- (fn_matched=(int *)malloc(G.filespecs*sizeof(int))) != (int *)NULL)
- for (i = 0; i < G.filespecs; ++i)
- fn_matched[i] = FALSE;
- if (G.xfilespecs > 0 &&
- (xn_matched=(int *)malloc(G.xfilespecs*sizeof(int))) != (int *)NULL)
- for (i = 0; i < G.xfilespecs; ++i)
- xn_matched[i] = FALSE;
+ /* Allocate space for checking unmatched list/-x list file specs. */
+ if (G.filespecs > 0)
+ { /* Member list. */
+ fn_matched = (char *)izu_malloc( G.filespecs* sizeof( char));
+ if (fn_matched == (char *)NULL)
+ {
+ Info( slide, 0x401, ((char *)slide,
+ "Not enough memory for (include) file list"));
+ return PK_MEM;
+ }
+ else
+ {
+ memset( fn_matched, FALSE, G.filespecs);
+ }
+ }
+ if (G.xfilespecs > 0)
+ { /* -x. */
+ xn_matched = (char *)izu_malloc( G.xfilespecs* sizeof( char));
+ if (xn_matched == (char *)NULL)
+ {
+ Info( slide, 0x401, ((char *)slide,
+ "Not enough memory for exclude file list"));
+ return PK_MEM;
+ }
+ else
+ {
+ memset( xn_matched, FALSE, G.xfilespecs);
+ }
+ }
/*---------------------------------------------------------------------------
Begin main loop over blocks of member files. We know the entire central
no_endsig_found = FALSE;
#endif
reached_end = FALSE;
- while (!reached_end) {
+ while (!reached_end)
+ {
+#if defined( UNIX) && defined( __APPLE__)
+ int apl_dbl;
+ int do_this_file_prev = 0;
+ int seeking_apl_dbl = 0;
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
j = 0;
+
#ifdef AMIGA
memzero(G.filenotes, DIR_BLKSIZ * sizeof(char *));
#endif
-
/*
* Loop through files in central directory, storing offsets, file
* attributes, case-conversion and text-conversion flags until block
* size is reached.
*/
+ while ((j < DIR_BLKSIZ))
+ {
+ int do_this_file;
- while ((j < DIR_BLKSIZ)) {
G.pInfo = &G.info[j];
if (readbuf(__G__ G.sig, 4) == 0) {
+ Info(slide, 0x221, ((char *)slide,
+ LoadFarString( ErrorUnexpectedEOF), G.zipfn));
error_in_archive = PK_EOF;
reached_end = TRUE; /* ...so no more left to do */
break;
break;
}
}
+ else if (uO.java_cafe == 0)
+ {
+ /* 2012-05-20 SMS.
+ * Accommodation for Java "jar" archives whose
+ * (over-)simplified central header info ("version made
+ * by") lacks any accurate host-system info. (Internal
+ * and external file atributes are zero, high byte of
+ * "version made by" is zero, so we see "MS-DOS", and
+ * try to adjust names accordingly, which damages Java's
+ * UTF-8-encoded names. See fileio.c:do_string().)
+ *
+ * Look for, and remember finding, a Java "CAFE" extra
+ * field (once). This affects name processing, so
+ * waiting for TestExtraField() to detect it in a
+ * local-header extra field would cause complaints about
+ * inconsistent file names. Small-sample evidence
+ * suggests that if a Java "CAFE" extra field is
+ * present, then it'll be in the first header, and
+ * alone, so most of the robustness here is probably
+ * wasted. Also, if uO.java_cafe is not set once before
+ * the first file name is processed, then we'll be
+ * handling names inconsistently, so this had better be
+ * adequate.
+ */
+ /* 2012-11-25 SMS. (OUSPG report.)
+ * Changed eb_len and ef_len from unsigned to signed, to
+ * catch underflow of ef_len caused by corrupt/malicious
+ * data. (32-bit is adequate. Used "long" to
+ * accommodate any systems with 16-bit "int".)
+ */
+ ush eb_id;
+ long eb_len;
+ long ef_len = (long)G.crec.extra_field_length;
+ uch *ef = G.extra_field;
+
+ while (ef_len >= EB_HEADSIZE)
+ {
+ eb_id = makeword( ef);
+ if (eb_id == EF_JAVA)
+ {
+ /* Found one. */
+ uO.java_cafe = 1;
+ }
+
+ eb_len = (unsigned)makeword( ef+ EB_LEN);
+ ef_len -= (eb_len + EB_HEADSIZE);
+ ef += (eb_len + EB_HEADSIZE);
+ }
+ if (uO.java_cafe == 0)
+ {
+ /* None found in the first extra field. Quit looking. */
+ uO.java_cafe = -1;
+ }
+ }
+
#ifdef AMIGA
G.filenote_slot = j;
if ((error = do_string(__G__ G.crec.file_comment_length,
break;
}
}
- if (G.process_all_files) {
- if (store_info(__G))
- ++j; /* file is OK; info[] stored; continue with next */
- else
- ++num_skipped;
- } else {
- int do_this_file;
+ /* Decide whether to process this archive member. */
+ do_this_file = -1; /* Undetermined. */
+#if defined( UNIX) && defined( __APPLE__)
+ apl_dbl = 0; /* Not (yet) AppleDouble. */
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
+ if (G.process_all_files)
+ {
+ do_this_file = 1;
+ }
+#if defined( UNIX) && defined( __APPLE__)
+ /* Do AppleDouble file, if its antecedent was done. */
+ else if (seeking_apl_dbl)
+ {
+ apl_dbl = revert_apl_dbl_path( G.filename, NULL);
+ if (apl_dbl)
+ {
+ do_this_file = do_this_file_prev;
+ }
+ }
+ if (do_this_file < 0) /* Continue, if still undetermined. */
+#else /* defined( UNIX) && defined( __APPLE__) */
+ else
+#endif /* defined( UNIX) && defined( __APPLE__) [else] */
+ {
+ /* Determine if this entry matches an "include" pattern. */
if (G.filespecs == 0)
- do_this_file = TRUE;
- else { /* check if this entry matches an `include' argument */
- do_this_file = FALSE;
+ {
+ /* No "include" patterns. */
+ do_this_file = 1;
+ }
+ else
+ {
for (i = 0; i < G.filespecs; i++)
- if (match(G.filename, G.pfnames[i], uO.C_flag WISEP)) {
- do_this_file = TRUE; /* ^-- ignore case or not? */
- if (fn_matched)
- fn_matched[i] = TRUE;
+ {
+ if (match(G.filename, G.pfnames[i], uO.C_flag WISEP))
+ {
+ do_this_file = 1; /* ^-- ignore case or not? */
+ fn_matched[i] = TRUE;
break; /* found match, so stop looping */
}
+ }
}
- if (do_this_file) { /* check if this is an excluded file */
+ if (do_this_file > 0)
+ {
+ /* Determine if this entry matches an "exclude" pattern. */
for (i = 0; i < G.xfilespecs; i++)
- if (match(G.filename, G.pxnames[i], uO.C_flag WISEP)) {
- do_this_file = FALSE; /* ^-- ignore case or not? */
- if (xn_matched)
- xn_matched[i] = TRUE;
+ {
+ if (match(G.filename, G.pxnames[i], uO.C_flag WISEP))
+ {
+ do_this_file = 0; /* ^-- ignore case or not? */
+ xn_matched[i] = TRUE;
break;
}
+ }
}
- if (do_this_file) {
- if (store_info(__G))
- ++j; /* file is OK */
- else
- ++num_skipped; /* unsupp. compression or encryption */
- }
- } /* end if (process_all_files) */
+ } /* end if (G.process_all_files) */
members_processed++;
+ if (do_this_file > 0)
+ {
+ if (store_info(__G))
+ ++j; /* file is OK */
+ else
+ ++num_skipped; /* unsupp. compression or encryption */
+ }
+
+#if defined( UNIX) && defined( __APPLE__)
+ /* Save do_this_file, for possible use with the next (AD?) file. */
+ do_this_file_prev = do_this_file;
+ if ((!uO.J_flag) && G.exdir_attr_ok)
+ /* Integrated AppleDouble processing. Look for an
+ * AppleDouble next, iff this one was normal.
+ */
+ seeking_apl_dbl = !apl_dbl;
+ else
+ /* No special AppleDouble processing. */
+ seeking_apl_dbl = 0;
+#endif /* defined( UNIX) && defined( __APPLE__) */
} /* end while-loop (adding files to current block) */
each one.
-----------------------------------------------------------------------*/
- error = extract_or_test_entrylist(__G__ j,
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if (G.has_win32_wide)
+ {
+ error = extract_or_test_entrylistw(__G__ j,
+ &filnum, &num_bad_pwd, &old_extra_bytes,
+# ifdef SET_DIR_ATTRIB
+ &num_dirs, &dirlistw,
+# endif
+ error_in_archive);
+ }
+ else
+#endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
+ {
+ error = extract_or_test_entrylist(__G__ j,
&filnum, &num_bad_pwd, &old_extra_bytes,
#ifdef SET_DIR_ATTRIB
&num_dirs, &dirlist,
#endif
error_in_archive);
+ }
if (error != PK_COOL) {
if (error > error_in_archive)
error_in_archive = error;
* the next batch of files.
*/
+ /* 2014-03-14 SMS.
+ * Added some basic I/O status checking. Untested, but possibly
+ * better than the previous complete lack of checking. (Quiets
+ * some fussy compiler/run-time checks, too.)
+ */
#ifdef USE_STRM_INPUT
- zfseeko(G.zipfd, cd_bufstart, SEEK_SET);
- G.cur_zipfile_bufstart = zftello(G.zipfd);
-#else /* !USE_STRM_INPUT */
+ sts = zfseeko( G.zipfd, cd_bufstart, SEEK_SET);
+ if (sts >= 0)
+ {
+ G.cur_zipfile_bufstart = zftello( G.zipfd);
+ }
+ else
+ {
+ G.cur_zipfile_bufstart = -1;
+ }
+#else /* def USE_STRM_INPUT */
G.cur_zipfile_bufstart =
- zlseek(G.zipfd, cd_bufstart, SEEK_SET);
-#endif /* ?USE_STRM_INPUT */
- read(G.zipfd, (char *)G.inbuf, INBUFSIZ); /* been here before... */
- G.inptr = cd_inptr;
- G.incnt = cd_incnt;
- ++blknum;
+ zlseek( G.zipfd, cd_bufstart, SEEK_SET);
+#endif /* def USE_STRM_INPUT [else] */
+ if (G.cur_zipfile_bufstart >= 0)
+ {
+ sts = read( G.zipfd, (char *)G.inbuf, INBUFSIZ);
+ }
+#ifndef USE_STRM_INPUT
+ else
+ {
+ sts = -1;
+ }
+#endif /* ndef USE_STRM_INPUT */
+ if (sts >= 0)
+ {
+ G.inptr = cd_inptr;
+ G.incnt = cd_incnt;
+ ++blknum;
+ }
+ else
+ {
+ Info(slide, 0x221, ((char *)slide,
+ LoadFarString( ErrorUnexpectedEOF), G.zipfn));
+ error_in_archive = PK_EOF;
+ reached_end = TRUE; /* ...so no more left to do */
+ break;
+ }
#ifdef TEST
printf("\ncd_bufstart = %ld (%.8lXh)\n", cd_bufstart, cd_bufstart);
/* remove the processed entry from the chain and free its memory */
G.slink_last = G.slink_head;
G.slink_head = G.slink_last->next;
- free(G.slink_last);
+ izu_free(G.slink_last);
}
G.slink_last = NULL;
}
#ifdef SET_DIR_ATTRIB
if (num_dirs > 0) {
- sorted_dirlist = (direntry **)malloc(num_dirs*sizeof(direntry *));
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if (G.has_win32_wide) {
+ sorted_dirlistw = (direntryw **)izu_malloc(num_dirs*sizeof(direntryw *));
+ if (sorted_dirlistw == (direntryw **)NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(DirlistSortNoMem)));
+ while (dirlistw != (direntryw *)NULL) {
+ direntryw *dw = dirlistw;
+
+ dirlistw = dirlistw->next;
+ izu_free(dw);
+ }
+ } else {
+ ulg ndirs_fail = 0;
+
+ if (num_dirs == 1)
+ sorted_dirlistw[0] = dirlistw;
+ else {
+ for (i = 0; i < num_dirs; ++i) {
+ sorted_dirlistw[i] = dirlistw;
+ dirlistw = dirlistw->next;
+ }
+ qsort((char *)sorted_dirlistw, num_dirs, sizeof(direntryw *),
+ dircompw);
+ }
+
+ Trace((stderr, "setting directory times/perms/attributes\n"));
+ for (i = 0; i < num_dirs; ++i) {
+ direntryw *dw = sorted_dirlistw[i];
+
+ Trace((stderr, "dir = %s\n", dw->fnw));
+ if ((error = set_direc_attribsw(__G__ dw)) != PK_OK) {
+ ndirs_fail++;
+ Info(slide, 0x201, ((char *)slide,
+ LoadFarString(DirlistSetAttrFailed), dw->fnw));
+ if (!error_in_archive)
+ error_in_archive = error;
+ }
+ izu_free(dw);
+ }
+ izu_free(sorted_dirlistw);
+ if (!uO.tflag && QCOND2) {
+ if (ndirs_fail > 0)
+ Info(slide, 0, ((char *)slide,
+ LoadFarString(DirlistFailAttrSum), ndirs_fail));
+ }
+ }
+ }
+ else
+# endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
+ {
+ sorted_dirlist = (direntry **)izu_malloc(num_dirs*sizeof(direntry *));
if (sorted_dirlist == (direntry **)NULL) {
Info(slide, 0x401, ((char *)slide,
LoadFarString(DirlistSortNoMem)));
direntry *d = dirlist;
dirlist = dirlist->next;
- free(d);
+ izu_free(d);
}
} else {
ulg ndirs_fail = 0;
if (!error_in_archive)
error_in_archive = error;
}
- free(d);
+ izu_free(d);
}
- free(sorted_dirlist);
+ izu_free(sorted_dirlist);
if (!uO.tflag && QCOND2) {
if (ndirs_fail > 0)
Info(slide, 0, ((char *)slide,
LoadFarString(DirlistFailAttrSum), ndirs_fail));
}
}
+ }
}
#endif /* SET_DIR_ATTRIB */
if (error_in_archive <= PK_WARN)
error_in_archive = PK_FIND; /* some files not found */
}
- free((zvoid *)fn_matched);
+ izu_free((zvoid *)fn_matched);
}
if (xn_matched) {
if (reached_end) for (i = 0; i < G.xfilespecs; ++i)
if (!xn_matched[i])
Info(slide, 0x401, ((char *)slide,
LoadFarString(ExclFilenameNotMatched), G.pxnames[i]));
- free((zvoid *)xn_matched);
+ izu_free((zvoid *)xn_matched);
}
/*---------------------------------------------------------------------------
if (uO.qflag < 2) { /* GRR 930710: was (uO.qflag == 1) */
if (error_in_archive)
+ {
+ char errnrstr[ 16];
+
+ if (uO.vflag)
+ sprintf( errnrstr, "(%d) ", error_in_archive);
+ else
+ *errnrstr = '\0';
+
Info(slide, 0, ((char *)slide, LoadFarString(ErrorInArchive),
- (error_in_archive == PK_WARN)? "warning-" : "", G.zipfn));
+ (error_in_archive == PK_WARN)? "warning-" : "",
+ errnrstr, G.zipfn));
+ }
else if (num == 0L)
Info(slide, 0, ((char *)slide, LoadFarString(ZeroFilesTested),
G.zipfn));
if (num_skipped > 0L)
Info(slide, 0, ((char *)slide, LoadFarString(FilesSkipped),
num_skipped, (num_skipped==1L)? "":"s"));
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
if (num_bad_pwd > 0L)
Info(slide, 0, ((char *)slide, LoadFarString(FilesSkipBadPasswd)
, num_bad_pwd, (num_bad_pwd==1L)? "":"s"));
-#endif /* CRYPT */
+#endif /* def IZ_CRYPT_ANY */
}
}
else
error_in_archive = PK_FIND; /* no files found at all */
}
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
else if ((filnum == num_bad_pwd) && error_in_archive <= PK_WARN)
error_in_archive = IZ_BADPWD; /* bad passwd => all files skipped */
-#endif
+#endif /* def IZ_CRYPT_ANY */
else if ((num_skipped > 0L) && error_in_archive <= PK_WARN)
error_in_archive = IZ_UNSUP; /* was PK_WARN; Jean-loup complained */
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
else if ((num_bad_pwd > 0L) && !error_in_archive)
error_in_archive = PK_WARN;
-#endif
+#endif /* def IZ_CRYPT_ANY */
return error_in_archive;
+/* UNKN_COMPR macro: Unsupported compression method tests.
+ *
+ * Assume that compression methods from Store (STORED = 0) through
+ * Deflate64 (ENHDEFLATED = 9) are allowed, unless an UNKN_xxxx
+ * exception is true.
+ * 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)
+#else
+# define UNKN_SHR FALSE /* Shrink (1) allowed. */
+#endif
-/***************************/
-/* Function store_info() */
-/***************************/
+#ifdef COPYRIGHT_CLEAN /* Reduce (2-5) not allowed. */
+# define UNKN_RED (G.crec.compression_method >= REDUCED1 && \
+ G.crec.compression_method <= REDUCED4)
+#else
+# define UNKN_RED FALSE /* Reduce (2-5) allowed. */
+#endif
-static int store_info(__G) /* return 0 if skipping, 1 if OK */
- __GDEF
-{
-#ifdef USE_BZIP2
-# define UNKN_BZ2 (G.crec.compression_method!=BZIPPED)
+#ifdef SFX /* Implode should have its own macro. */
+# define UNKN_IMPL (G.crec.compression_method == IMPLODED)
#else
-# define UNKN_BZ2 TRUE /* bzip2 unknown */
+# define UNKN_IMPL FALSE /* Implode (6) allowed. */
#endif
-#ifdef USE_LZMA
-# define UNKN_LZMA (G.crec.compression_method!=LZMAED)
+ /* Tokenize (7) not allowed. */
+#define UNKN_TOKN (G.crec.compression_method == TOKENIZED)
+
+#ifdef DEFLATE_SUPPORT
+# define UNKN_DEFL FALSE /* Deflate (8) allowed. */
#else
-# define UNKN_LZMA TRUE /* LZMA unknown */
+# define UNKN_DEFL (G.crec.compression_method == DEFLATED)
#endif
-#ifdef USE_WAVP
-# define UNKN_WAVP (G.crec.compression_method!=WAVPACKED)
+#if defined( DEFLATE_SUPPORT) && defined( DEFLATE64_SUPPORT)
+# define UNKN_DEFL64 FALSE /* Deflate64 (9) allowed. */
#else
-# define UNKN_WAVP TRUE /* WavPack unknown */
+# define UNKN_DEFL64 (G.crec.compression_method == ENHDEFLATED)
#endif
-#ifdef USE_PPMD
-# define UNKN_PPMD (G.crec.compression_method!=PPMDED)
+/* 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)
#else
-# define UNKN_PPMD TRUE /* PPMd unknown */
+# define UNKN_AES_WG TRUE /* AES_WG (99) unknown. */
#endif
-#ifdef SFX
-# ifdef USE_DEFLATE64
-# define UNKN_COMPR \
- (G.crec.compression_method!=STORED && G.crec.compression_method<DEFLATED \
- && G.crec.compression_method>ENHDEFLATED \
- && UNKN_BZ2 && UNKN_LZMA && UNKN_WAVP && UNKN_PPMD)
-# else
-# define UNKN_COMPR \
- (G.crec.compression_method!=STORED && G.crec.compression_method!=DEFLATED\
- && UNKN_BZ2 && UNKN_LZMA && UNKN_WAVP && UNKN_PPMD)
-# endif
+#ifdef BZIP2_SUPPORT
+# define UNKN_BZ2 (G.crec.compression_method != BZIPPED)
#else
-# ifdef COPYRIGHT_CLEAN /* no reduced files */
-# define UNKN_RED (G.crec.compression_method >= REDUCED1 && \
- G.crec.compression_method <= REDUCED4)
-# else
-# define UNKN_RED FALSE /* reducing not unknown */
-# endif
-# ifdef LZW_CLEAN /* no shrunk files */
-# define UNKN_SHR (G.crec.compression_method == SHRUNK)
-# else
-# define UNKN_SHR FALSE /* unshrinking not unknown */
-# endif
-# ifdef USE_DEFLATE64
-# define UNKN_COMPR (UNKN_RED || UNKN_SHR || \
- G.crec.compression_method==TOKENIZED || \
- (G.crec.compression_method>ENHDEFLATED && UNKN_BZ2 && UNKN_LZMA \
- && UNKN_WAVP && UNKN_PPMD))
-# else
-# define UNKN_COMPR (UNKN_RED || UNKN_SHR || \
- G.crec.compression_method==TOKENIZED || \
- (G.crec.compression_method>DEFLATED && UNKN_BZ2 && UNKN_LZMA \
- && UNKN_WAVP && UNKN_PPMD))
-# endif
+# define UNKN_BZ2 TRUE /* Bzip2 (12) unknown. */
+#endif
+
+#ifdef LZMA_SUPPORT
+# define UNKN_LZMA (G.crec.compression_method != LZMAED)
+#else
+# define UNKN_LZMA TRUE /* LZMA (14) unknown */
+#endif
+
+#ifdef PPMD_SUPPORT
+# define UNKN_PPMD (G.crec.compression_method != PPMDED)
+#else
+# define UNKN_PPMD TRUE /* PPMd (98) unknown */
+#endif
+
+#ifdef USE_WAVP
+# define UNKN_WAVP (G.crec.compression_method != WAVPACKED)
+#else
+# define UNKN_WAVP TRUE /* WavPack (97) unknown */
#endif
-#if (defined(USE_BZIP2) && (UNZIP_VERSION < UNZIP_BZ2VERS))
- int unzvers_support = (UNKN_BZ2 ? UNZIP_VERSION : UNZIP_BZ2VERS);
+#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))
+
+
+/* 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
#else
# define UNZVERS_SUPPORT UNZIP_VERSION
#endif
+
+
+
+/***************************/
+/* Function store_info() */
+/***************************/
+
+static int store_info(__G) /* return 0 if skipping, 1 if OK */
+ __GDEF
+{
/*---------------------------------------------------------------------------
Check central directory info for version/compatibility requirements.
---------------------------------------------------------------------------*/
break;
}
+ /* First, complain about an unsupported compression method. */
+ if (UNKN_COMPR) {
+ if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) {
+#ifndef SFX
+ unsigned cmpridx;
+
+ if ((cmpridx = find_compr_idx(G.crec.compression_method))
+ < 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));
+ }
+ return 0;
+ }
+
+ /* Second, complain about an insufficient version number. */
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)))
return 0;
}
#ifndef VMS /* won't be able to use extra field, but still have data */
- else if (!uO.tflag && !IS_OVERWRT_ALL) { /* if -o, extract anyway */
+ else if (!uO.tflag && !IS_OVERWRT_ALL) /* If -o, extract anyway. */
+ {
Info(slide, 0x481, ((char *)slide, LoadFarString(VMSFormatQuery),
FnFilter1(G.filename)));
- fgets(G.answerbuf, sizeof(G.answerbuf), stdin);
- if ((*G.answerbuf != 'y') && (*G.answerbuf != 'Y'))
+ if ((fgets_ans( __G) < 0) || (toupper( *G.answerbuf != 'Y')))
return 0;
}
#endif /* !VMS */
return 0;
}
- if (UNKN_COMPR) {
- if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) {
-#ifndef SFX
- unsigned cmpridx;
-
- if ((cmpridx = find_compr_idx(G.crec.compression_method))
- < 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));
- }
- return 0;
- }
-#if (!CRYPT)
+#ifndef IZ_CRYPT_ANY
+ /* Third, complain about missing encryption support. */
if (G.pInfo->encrypted) {
if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)))
Info(slide, 0x401, ((char *)slide, LoadFarString(SkipEncrypted),
FnFilter1(G.filename)));
return 0;
}
-#endif /* !CRYPT */
+#endif /* ndef IZ_CRYPT_ANY */
#ifndef SFX
/* store a copy of the central header filename for later comparison */
unsigned find_compr_idx(compr_methodnum)
unsigned compr_methodnum;
{
- unsigned i;
+ unsigned i;
- for (i = 0; i < NUM_METHODS; i++) {
- if (ComprIDs[i] == compr_methodnum) break;
- }
- return i;
+ for (i = 0; i < NUM_METHODS; i++) {
+ if (ComprIDs[i] == compr_methodnum) break;
+ }
+ return i;
}
#endif /* !SFX */
int skip_entry;
zoff_t bufstart, inbuf_offset, request;
int error, errcode;
+ char *slp; /* Slash pointer for pre-mapname() processing. */
+
+#if defined( UNIX) && defined( __APPLE__)
+ int cfn;
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
+#ifdef IZ_CRYPT_AES_WG
+ ush temp_compression_method;
+ int temp_stored_size_decr;
+# define REAL_COMPRESSION_METHOD temp_compression_method
+# define REAL_STORED_SIZE_DECR temp_stored_size_decr
+#else /* def IZ_CRYPT_AES_WG */
+ /* RAND_HEAD_LEN normally comes from crypt.h, but may be disabled,
+ * if CRYPT is not defined.
+ */
+# ifndef RAND_HEAD_LEN
+# define RAND_HEAD_LEN 12
+# endif /* ndef RAND_HEAD_LEN */
+# define REAL_COMPRESSION_METHOD G.lrec.compression_method
+# define REAL_STORED_SIZE_DECR RAND_HEAD_LEN
+#endif /* def IZ_CRYPT_AES_WG) [else] */
/* possible values for local skip_entry flag: */
#define SKIP_NO 0 /* do not skip this entry */
#ifdef NOVELL_BUG_FAILSAFE
G.dne = FALSE; /* assume file exists until stat() says otherwise */
#endif
-
/* if the target position is not within the current input buffer
* (either haven't yet read far enough, or (maybe) skipping back-
* ward), skip to the target position and reset readbuf(). */
error_in_archive = PK_BADERR;
continue; /* but can still try next one */
}
- if (memcmp(G.sig, local_hdr_sig, 4)) {
+ if (strncmp(G.sig, local_hdr_sig, 4)) {
Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg),
*pfilnum, LoadFarStringSmall(LocalHdrSig), (long)request));
/*
error_in_archive = PK_BADERR;
continue; /* but can still try next one */
}
- if (memcmp(G.sig, local_hdr_sig, 4)) {
+ if (strncmp(G.sig, local_hdr_sig, 4)) {
Info(slide, 0x401, ((char *)slide,
LoadFarString(OffsetMsg), *pfilnum,
LoadFarStringSmall(LocalHdrSig), (long)request));
error_in_archive = error; /* only PK_EOF defined */
continue; /* can still try next one */
}
-#if (!defined(SFX) && defined(UNICODE_SUPPORT))
- if (((G.lrec.general_purpose_bit_flag & (1 << 11)) == (1 << 11))
- != (G.pInfo->GPFIsUTF8 != 0)) {
- if (QCOND2) {
-# ifdef SMALL_MEM
- char *temp_cfilnam = slide + (7 * (WSIZE>>3));
-
- zfstrcpy((char Far *)temp_cfilnam, G.pInfo->cfilname);
-# define cFile_PrintBuf temp_cfilnam
-# else
-# define cFile_PrintBuf G.pInfo->cfilname
-# endif
- Info(slide, 0x421, ((char *)slide,
- LoadFarStringSmall2(GP11FlagsDiffer),
- *pfilnum, FnFilter1(cFile_PrintBuf), G.pInfo->GPFIsUTF8));
-# undef cFile_PrintBuf
- }
- if (error_in_archive < PK_WARN)
- error_in_archive = PK_WARN;
- }
-#endif /* !SFX && UNICODE_SUPPORT */
if ((error = do_string(__G__ G.lrec.filename_length, DS_FN_L)) !=
PK_COOL)
{
continue; /* go on to next one */
}
}
- if (G.extra_field != (uch *)NULL) {
- free(G.extra_field);
- G.extra_field = (uch *)NULL;
- }
+
if ((error =
do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != 0)
{
*/
if (G.pInfo->cfilname != (char Far *)NULL) {
if (zfstrcmp(G.pInfo->cfilname, G.filename) != 0) {
-# ifdef SMALL_MEM
+# ifdef SMALL_MEM
char *temp_cfilnam = slide + (7 * (WSIZE>>3));
zfstrcpy((char Far *)temp_cfilnam, G.pInfo->cfilname);
-# define cFile_PrintBuf temp_cfilnam
-# else
-# define cFile_PrintBuf G.pInfo->cfilname
-# endif
+# define cFile_PrintBuf temp_cfilnam
+# else
+# define cFile_PrintBuf G.pInfo->cfilname
+# endif
Info(slide, 0x401, ((char *)slide,
LoadFarStringSmall2(LvsCFNamMsg),
FnFilter2(cFile_PrintBuf), FnFilter1(G.filename)));
-# undef cFile_PrintBuf
+# undef cFile_PrintBuf
zfstrcpy(G.filename, G.pInfo->cfilname);
if (error_in_archive < PK_WARN)
error_in_archive = PK_WARN;
G.pInfo->cfilname = (char Far *)NULL;
}
#endif /* !SFX */
+
+#ifdef IZ_CRYPT_AES_WG
+ /* Analyze any AES encryption extra block before calculating
+ * the true uncompressed file size.
+ */
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ /* 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. */
+ ef_scan_for_aes( G.extra_field,
+ G.lrec.extra_field_length,
+ &G.pInfo->cmpr_vers_aes, /* AES version, */
+ NULL, /* AES vendor, */
+ &G.pInfo->cmpr_mode_aes, /* AES mode. */
+ &G.pInfo->cmpr_mthd_aes); /* AES method. */
+
+ if ((G.pInfo->cmpr_mode_aes <= 0) || (G.pInfo->cmpr_mode_aes > 3))
+ {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(BadAesExtFieldMsg),
+ FnFilter1(G.filename), G.pInfo->cmpr_mode_aes));
+ continue; /* this one hosed; try next? */
+ }
+ temp_compression_method = G.pInfo->cmpr_mthd_aes;
+ temp_stored_size_decr = MAC_LENGTH( G.pInfo->cmpr_mode_aes)+
+ SALT_LENGTH( G.pInfo->cmpr_mode_aes)+ PWD_VER_LENGTH;
+ }
+ else
+ {
+ /* Use non-AES values. */
+ temp_compression_method = G.lrec.compression_method;
+ temp_stored_size_decr = RAND_HEAD_LEN;
+ }
+#endif /* def IZ_CRYPT_AES_WG */
+
/* Size consistency checks must come after reading in the local extra
* field, so that any Zip64 extension local e.f. block has already
* been processed.
*/
- if (G.lrec.compression_method == STORED) {
+ if (REAL_COMPRESSION_METHOD == STORED)
+ {
zusz_t csiz_decrypted = G.lrec.csize;
if (G.pInfo->encrypted)
- csiz_decrypted -= 12;
+ {
+ csiz_decrypted -= REAL_STORED_SIZE_DECR;
+ }
if (G.lrec.ucsize != csiz_decrypted) {
Info(slide, 0x401, ((char *)slide,
LoadFarStringSmall2(WrnStorUCSizCSizDiff),
}
}
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
if (G.pInfo->encrypted &&
(error = decrypt(__G__ uO.pwdarg)) != PK_COOL) {
if (error == PK_WARN) {
}
continue; /* go on to next file */
}
-#endif /* CRYPT */
+#endif /* def IZ_CRYPT_ANY */
+
+#if defined( UNIX) && defined( __APPLE__)
+ /* Unless the user objects, or the destination volume does not
+ * support setattrlist(), detect an AppleDouble file (by name),
+ * and set flags and adjusted file name accordingly.
+ */
+ G.apple_double = 0;
+ if ((!uO.J_flag) && G.exdir_attr_ok)
+ {
+ int sts;
+
+ /* Excise the "._" name prefix from the AppleDouble file name. */
+ sts = revert_apl_dbl_path( G.filename, G.ad_filename);
+
+ if (sts < 0) /* Skip a sequestration directory. */
+ continue;
+
+ G.apple_double = sts; /* Set the AppleDouble flag. */
+
+ if (G.apple_double)
+ {
+ /* 2013-08-16 SMS.
+ * This test might make more sense after mapname()
+ * changes everything.
+ */
+ /* Check that the file name will not be too long when the
+ * "/rsrc" (APL_DBL_SUFX) string is appended (fileio.c:
+ * open_outfile()). (strlen() ignores its NUL, sizeof()
+ * includes its NUL. FILNAMSIZ includes a NUL.)
+ */
+ if (strlen( G.ad_filename)+ sizeof( APL_DBL_SUFX) > FILNAMSIZ)
+ {
+ Info(slide, 0x401, ((char *)slide, AplDblNameTooLong,
+ G.ad_filename));
+ error_in_archive = PK_ERR;
+ /* Skip this (doomed) AppleDouble file. */
+ continue;
+ }
+ /* If current file is the AppleDouble file for the previous
+ * file (their names match), then arrange to handle this
+ * AppleDouble file the way the previous file was handled.
+ */
+ else if (strcmp( G.ad_filename, G.pq_filename) == 0)
+ {
+ if (renamed)
+ {
+ /* Replace this AppleDouble file name, too.
+ * Without extra effort, the "renamed" flag will
+ * be misleadingly FALSE for mapname() below, but
+ * the preceding normal file should have paved
+ * the way by getting all the directories created
+ * as needed.
+ */
+ strcpy( G.ad_filename, G.pr_filename);
+ }
+ else if (skip_entry != SKIP_NO)
+ {
+ /* Skip this AppleDouble file, too. */
+ continue;
+ }
+ *G.pq_filename = '\0'; /* Pointless? */
+ *G.pr_filename = '\0'; /* Pointless? */
+ }
+ }
+ else
+ {
+ /* Save a normal file name for comparison with the next
+ * AppleDouble file name.
+ */
+ if (!G.apple_double)
+ strcpy( G.pq_filename, G.filename);
+ }
+ }
+
+#endif /* defined( UNIX) && defined( __APPLE__) */
/*
* just about to extract file: if extracting to disk, check if
#endif /* !SFX */
if (!renamed) {
- /* remove absolute path specs */
- if (G.filename[0] == '/') {
- Info(slide, 0x401, ((char *)slide,
+ /* remove absolute path specs */
+ if (G.filename[0] == '/') {
+ Info(slide, 0x401, ((char *)slide,
LoadFarString(AbsolutePathWarning),
FnFilter1(G.filename)));
- if (!error_in_archive)
- error_in_archive = PK_WARN;
- do {
- char *p = G.filename + 1;
- do {
- *(p-1) = *p;
- } while (*p++ != '\0');
- } while (G.filename[0] == '/');
- }
+ if (!error_in_archive)
+ error_in_archive = PK_WARN;
+ do {
+ char *p = G.filename + 1;
+ do {
+ *(p-1) = *p;
+ } while (*p++ != '\0');
+ } while (G.filename[0] == '/');
+ }
+ }
+
+ /* 2012-07-13 SMS.
+ * Moved -j/--junkdirs (.jflag) processing up to here from
+ * OS-specific mapname() functions.
+ * G.jdir_filename is a pointer (within G.filename) to the
+ * path being kept (not junked).
+ */
+ G.jdir_filename = G.filename; /* (Right, if "-j-", .jflag == 0.) */
+ if (uO.jflag < 0)
+ {
+ /* "-j": Junking all directories. Find last slash (if any). */
+ slp = strrchr( G.filename, '/');
+ if (slp != NULL)
+ {
+ /* Found a last slash. Name begins after it. */
+ G.jdir_filename = slp+ 1;
+ }
}
+ else if (uO.jflag > 0)
+ {
+ /* "-j=N": Junking N directories. Loop through slashes. */
+ int i;
+
+ for (i = 0; i < uO.jflag; i++)
+ {
+ slp = strchr( G.jdir_filename, '/');
+ if (slp == NULL)
+ {
+ if (G.filename[ strlen( G.filename)- 1] == '/')
+ {
+ /* Directory. (Won't be created, so show name.) */
+ Info( slide, 0x401, ((char *)slide,
+ LoadFarString( JunkTooManyDir),
+ i, uO.jflag, FnFilter1( G.filename)));
+ }
+ else
+ {
+ /* File. (Will be extracted, so name follows.) */
+ Info( slide, 0x401, ((char *)slide,
+ LoadFarString( JunkTooMany),
+ i, uO.jflag));
+ }
+ break;
+ }
+ else
+ {
+ /* Advance the retained-name pointer. */
+ G.jdir_filename = ++slp;
+ }
+ }
+ }
/* mapname can create dirs if not freshening or if renamed */
error = mapname(__G__ renamed);
+
+
+#if defined( UNIX) && defined( __APPLE__)
+ /* If the destination volume attributes are still a mystery,
+ * and mapname() admits that it made any destination directories,
+ * then try again to determine the volume attributes.
+ * We're hoping that a normal file precedes any AppleDouble
+ * files, so that the flag gets set before it's too late.
+ * We're also ignoring the possibility that a user rename
+ * has sent us onto a volume with different attributes.
+ * Otherwise, we'd need to do more complex, rename-aware
+ * volume attribute determination.
+ */
+ if ((G.exdir_attr_ok < 0) && (error& MPN_CREATED_DIR))
+ {
+ G.exdir_attr_ok = vol_attr_ok( uO.exdir);
+ }
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
if ((errcode = error & ~MPN_MASK) != PK_OK &&
error_in_archive < errcode)
error_in_archive = errcode;
#ifdef QDOS
QFilename(__G__ G.filename);
#endif
- switch (check_for_newer(__G__ G.filename)) {
+
+#if defined( UNIX) && defined( __APPLE__)
+ /* If we are doing special AppleDouble file processing,
+ * and this is an AppleDouble file,
+ * then we should ignore a file-exists test, which may be
+ * expected to succeed.
+ */
+
+ if (G.apple_double && (!uO.J_flag))
+ {
+ /* Fake a does-not-exist value for this AppleDouble file. */
+ cfn = DOES_NOT_EXIST;
+ }
+ else
+ {
+ /* Do the real test. */
+ cfn = check_for_newer(__G__ G.filename);
+ }
+
+ /* Use "cfn" on Mac, plain check_for_newer() elsewhere. */
+ switch (cfn)
+#else /* defined( UNIX) && defined( __APPLE__) */
+ switch (check_for_newer(__G__ G.filename))
+#endif /* defined( UNIX) && defined( __APPLE__) */
+ {
case DOES_NOT_EXIST:
#ifdef NOVELL_BUG_FAILSAFE
G.dne = TRUE; /* stat() says file DOES NOT EXIST */
query = TRUE;
}
break;
- }
+ }
#ifdef VMS
/* 2008-07-24 SMS.
* On VMS, if the file name includes a version number,
* conflicts with an existing file, making this query
* redundant. (Implicit "y" response here.)
*/
- if (query && uO.V_flag) {
+ if (query && (uO.V_flag > 0)) {
/* Not discarding file versions. Look for one. */
int cndx = strlen(G.filename) - 1;
Info(slide, 0x81, ((char *)slide,
LoadFarString(ReplaceQuery),
FnFilter1(G.filename)));
- if (fgets(G.answerbuf, sizeof(G.answerbuf), stdin)
- == (char *)NULL) {
+ if (fgets_ans( __G) < 0)
+ {
Info(slide, 1, ((char *)slide,
LoadFarString(AssumeNone)));
*G.answerbuf = 'N';
switch (*G.answerbuf) {
case 'r':
case 'R':
- do {
+ do
+ {
Info(slide, 0x81, ((char *)slide,
LoadFarString(NewNameQuery)));
- fgets(G.filename, FILNAMSIZ, stdin);
- /* usually get \n here: better check for it */
- fnlen = strlen(G.filename);
- if (lastchar(G.filename, fnlen) == '\n')
- G.filename[--fnlen] = '\0';
+ if (fgets( G.filename, FILNAMSIZ, stdin) == NULL)
+ { /* read() error. Try again. */
+ goto reprompt;
+ }
+ else
+ {
+ /* Usually get \n here. Check for it. */
+ fnlen = strlen(G.filename);
+ if (lastchar(G.filename, fnlen) == '\n')
+ G.filename[--fnlen] = '\0';
+ }
} while (fnlen == 0);
-#ifdef WIN32 /* WIN32 fgets( ... , stdin) returns OEM coded strings */
+# ifdef WIN32 /* WIN32 fgets( ... , stdin) returns OEM coded strings */
_OEM_INTERN(G.filename);
-#endif
+# endif
renamed = TRUE;
goto startover; /* sorry for a goto */
case 'A': /* dangerous option: force caps */
/* report skipping of an existing entry */
Info(slide, 0, ((char *)slide,
((IS_OVERWRT_NONE || !uO.uflag || renamed) ?
- "Target file exists. Skipping %s\n" :
- "Target file newer. Skipping %s\n"),
+ "Target file exists.\nSkipping %s\n" :
+ "Target file newer.\nSkipping %s\n"),
FnFilter1(G.filename)));
}
#endif /* WINDLL */
}
} /* end if (extracting to disk) */
+#if defined( UNIX) && defined( __APPLE__)
+ /* If we are doing special AppleDouble file processing,
+ * and this was a normal file, and the user renamed it,
+ * then save the new name for use on its AppleDouble file
+ * (which should be coming along next).
+ */
+ if (renamed && (!G.apple_double) && (!uO.J_flag))
+ {
+ strcpy( G.pr_filename, G.filename);
+ }
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
#ifdef DLL
if ((G.statreportcb != NULL) &&
(*G.statreportcb)(__G__ UZ_ST_START_EXTRACT, G.zipfn,
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static int extract_or_test_entrylistw(__G__ numchunk,
+ pfilnum, pnum_bad_pwd, pold_extra_bytes,
+# ifdef SET_DIR_ATTRIB
+ pnum_dirs, pdirlistw,
+# endif
+ error_in_archive) /* return PK-type error code */
+ __GDEF
+ unsigned numchunk;
+ ulg *pfilnum;
+ ulg *pnum_bad_pwd;
+ zoff_t *pold_extra_bytes;
+# ifdef SET_DIR_ATTRIB
+ unsigned *pnum_dirs;
+ direntryw **pdirlistw;
+# endif
+ int error_in_archive;
+{
+ unsigned i;
+ int renamed, query;
+ int skip_entry;
+ zoff_t bufstart, inbuf_offset, request;
+ int error, errcode;
+ wchar_t *wslp; /* Wide slash pointer for pre-mapnamew() processing. */
-/* wsize is used in extract_or_test_member() and UZbunzip2() */
-#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
-# define wsize G._wsize /* wsize is a variable */
-#else
-# define wsize WSIZE /* wsize is a constant */
-#endif
+# ifdef IZ_CRYPT_AES_WG
+ ush temp_compression_method;
+ int temp_stored_size_decr;
+# endif /* def IZ_CRYPT_AES_WG */
-/***************************************/
-/* Function extract_or_test_member() */
-/***************************************/
+/* possible values for local skip_entry flag: */
+# define SKIP_NO 0 /* do not skip this entry */
+# define SKIP_Y_EXISTING 1 /* skip this entry, do not overwrite file */
+# define SKIP_Y_NONEXIST 2 /* skip this entry, do not create new file */
-static int extract_or_test_member(__G) /* return PK-type error code */
- __GDEF
-{
- char *nul="[empty] ", *txt="[text] ", *bin="[binary]";
-#ifdef CMS_MVS
- char *ebc="[ebcdic]";
-#endif
- register int b;
- int r, error=PK_COOL;
+ /*-----------------------------------------------------------------------
+ Second loop: process files in current block, extracting or testing
+ each one.
+ -----------------------------------------------------------------------*/
+ for (i = 0; i < numchunk; ++i) {
+ (*pfilnum)++; /* *pfilnum = i + blknum*DIR_BLKSIZ + 1; */
+ G.pInfo = &G.info[i];
+# ifdef NOVELL_BUG_FAILSAFE
+ G.dne = FALSE; /* assume file exists until stat() says otherwise */
+# endif
+ /* if the target position is not within the current input buffer
+ * (either haven't yet read far enough, or (maybe) skipping back-
+ * ward), skip to the target position and reset readbuf(). */
-/*---------------------------------------------------------------------------
- Initialize variables, buffers, etc.
- ---------------------------------------------------------------------------*/
+ /* seek_zipf(__G__ pInfo->offset); */
+ request = G.pInfo->offset + G.extra_bytes;
+ inbuf_offset = request % INBUFSIZ;
+ bufstart = request - inbuf_offset;
- G.bits_left = 0;
- G.bitbuf = 0L; /* unreduce and unshrink only */
- G.zipeof = 0;
- G.newfile = TRUE;
- G.crc32val = CRCVAL_INITIAL;
+ Trace((stderr, "\ndebug: request = %ld, inbuf_offset = %ld\n",
+ (long)request, (long)inbuf_offset));
+ Trace((stderr,
+ "debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n",
+ (long)bufstart, (long)G.cur_zipfile_bufstart));
+ if (request < 0) {
+ Info(slide, 0x401, ((char *)slide, LoadFarStringSmall(SeekMsg),
+ G.zipfn, LoadFarString(ReportMsg)));
+ error_in_archive = PK_ERR;
+ if (*pfilnum == 1 && G.extra_bytes != 0L) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(AttemptRecompensate)));
+ *pold_extra_bytes = G.extra_bytes;
+ G.extra_bytes = 0L;
+ request = G.pInfo->offset; /* could also check if != 0 */
+ inbuf_offset = request % INBUFSIZ;
+ bufstart = request - inbuf_offset;
+ Trace((stderr, "debug: request = %ld, inbuf_offset = %ld\n",
+ (long)request, (long)inbuf_offset));
+ Trace((stderr,
+ "debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n",
+ (long)bufstart, (long)G.cur_zipfile_bufstart));
+ /* try again */
+ if (request < 0) {
+ Trace((stderr,
+ "debug: recompensated request still < 0\n"));
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarStringSmall(SeekMsg),
+ G.zipfn, LoadFarString(ReportMsg)));
+ error_in_archive = PK_BADERR;
+ continue;
+ }
+ } else {
+ error_in_archive = PK_BADERR;
+ continue; /* this one hosed; try next */
+ }
+ }
-#ifdef SYMLINKS
- /* If file is a (POSIX-compatible) symbolic link and we are extracting
- * to disk, prepare to restore the link. */
- G.symlnk = (G.pInfo->symlink &&
- !uO.tflag && !uO.cflag && (G.lrec.ucsize > 0));
-#endif /* SYMLINKS */
+ if (bufstart != G.cur_zipfile_bufstart) {
+ Trace((stderr, "debug: bufstart != cur_zipfile_bufstart\n"));
+# ifdef USE_STRM_INPUT
+ zfseeko(G.zipfd, bufstart, SEEK_SET);
+ G.cur_zipfile_bufstart = zftello(G.zipfd);
+# else /* !USE_STRM_INPUT */
+ G.cur_zipfile_bufstart =
+ zlseek(G.zipfd, bufstart, SEEK_SET);
+# endif /* ?USE_STRM_INPUT */
+ if ((G.incnt = read(G.zipfd, (char *)G.inbuf, INBUFSIZ)) <= 0)
+ {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg),
+ *pfilnum, "lseek", (long)bufstart));
+ error_in_archive = PK_BADERR;
+ continue; /* can still do next file */
+ }
+ G.inptr = G.inbuf + (int)inbuf_offset;
+ G.incnt -= (int)inbuf_offset;
+ } else {
+ G.incnt += (int)(G.inptr-G.inbuf) - (int)inbuf_offset;
+ G.inptr = G.inbuf + (int)inbuf_offset;
+ }
- if (uO.tflag) {
- if (!uO.qflag)
- Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), "test",
- FnFilter1(G.filename), "", ""));
- } else {
-#ifdef DLL
- if (uO.cflag && !G.redirect_data)
-#else
- if (uO.cflag)
-#endif
- {
-#if (defined(OS2) && defined(__IBMC__) && (__IBMC__ >= 200))
- G.outfile = freopen("", "wb", stdout); /* VAC++ ignores setmode */
-#else
- G.outfile = stdout;
-#endif
-#ifdef DOS_FLX_NLM_OS2_W32
-#if (defined(__HIGHC__) && !defined(FLEXOS))
+ /* should be in proper position now, so check for sig */
+ if (readbuf(__G__ G.sig, 4) == 0) { /* bad offset */
+ Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg),
+ *pfilnum, "EOF", (long)request));
+ error_in_archive = PK_BADERR;
+ continue; /* but can still try next one */
+ }
+ if (memcmp(G.sig, local_hdr_sig, 4)) {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg),
+ *pfilnum, LoadFarStringSmall(LocalHdrSig), (long)request));
+ /*
+ GRRDUMP(G.sig, 4)
+ GRRDUMP(local_hdr_sig, 4)
+ */
+ error_in_archive = PK_ERR;
+ if ((*pfilnum == 1 && G.extra_bytes != 0L) ||
+ (G.extra_bytes == 0L && *pold_extra_bytes != 0L)) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(AttemptRecompensate)));
+ if (G.extra_bytes) {
+ *pold_extra_bytes = G.extra_bytes;
+ G.extra_bytes = 0L;
+ } else
+ G.extra_bytes = *pold_extra_bytes; /* third attempt */
+ if (((error = seek_zipf(__G__ G.pInfo->offset)) != PK_OK) ||
+ (readbuf(__G__ G.sig, 4) == 0)) { /* bad offset */
+ if (error != PK_BADERR)
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(OffsetMsg), *pfilnum, "EOF",
+ (long)request));
+ error_in_archive = PK_BADERR;
+ continue; /* but can still try next one */
+ }
+ if (memcmp(G.sig, local_hdr_sig, 4)) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(OffsetMsg), *pfilnum,
+ LoadFarStringSmall(LocalHdrSig), (long)request));
+ error_in_archive = PK_BADERR;
+ continue;
+ }
+ } else
+ continue; /* this one hosed; try next */
+ }
+ if ((error = process_local_file_hdr(__G)) != PK_COOL) {
+ Info(slide, 0x421, ((char *)slide, LoadFarString(BadLocalHdr),
+ *pfilnum));
+ error_in_archive = error; /* only PK_EOF defined */
+ continue; /* can still try next one */
+ }
+# if !defined(SFX) && defined(UNICODE_SUPPORT)
+ if (((G.lrec.general_purpose_bit_flag & UTF8_BIT) != 0)
+ != (G.pInfo->GPFIsUTF8 != 0)) {
+ if (QCOND2) {
+# ifdef SMALL_MEM
+ char *temp_cfilnam = slide + (7 * (WSIZE>>3));
+
+ zfstrcpy((char Far *)temp_cfilnam, G.pInfo->cfilname);
+# define cFile_PrintBuf temp_cfilnam
+# else
+# define cFile_PrintBuf G.pInfo->cfilname
+# endif
+ Info(slide, 0x421, ((char *)slide,
+ LoadFarStringSmall2(GP11FlagsDiffer),
+ *pfilnum, FnFilter1(cFile_PrintBuf), G.pInfo->GPFIsUTF8));
+# undef cFile_PrintBuf
+ }
+ if (error_in_archive < PK_WARN)
+ error_in_archive = PK_WARN;
+ }
+# endif /* !SFX && UNICODE_SUPPORT */
+ if ((error = do_string(__G__ G.lrec.filename_length, DS_FN_L)) !=
+ PK_COOL)
+ {
+ if (error > error_in_archive)
+ error_in_archive = error;
+ if (error > PK_WARN) {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(FilNamMsg),
+ FnFilter1(G.filename), "local"));
+ continue; /* go on to next one */
+ }
+ }
+
+# ifdef WIN32_WIDE
+# ifdef DYNAMIC_WIDE_NAME
+ /* 2013-02-10 SMS.
+ * fileio.c:do_string() will free() and NULL G.unipath_filename,
+ * as needed. G.unipath_widefilename is handled here.
+ */
+ if (G.unipath_widefilename) {
+ izu_free(G.unipath_widefilename);
+ G.unipath_widefilename = NULL;
+ }
+# else /* def DYNAMIC_WIDE_NAME */
+ *G.unipath_widefilename = L'\0';
+# endif /* def DYNAMIC_WIDE_NAME [else] */
+# endif
+ if ((error =
+ do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != 0)
+ {
+ if (error > error_in_archive)
+ error_in_archive = error;
+ if (error > PK_WARN) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(ExtFieldMsg),
+ FnFilter1(G.filename), "local"));
+ continue; /* go on */
+ }
+ }
+# ifdef WIN32_WIDE
+# ifdef DYNAMIC_WIDE_NAME
+ if (G.unipath_widefilename == NULL) {
+ if (G.unipath_filename) {
+ /* Get wide path from UTF-8 */
+ G.unipath_widefilename = utf8_to_wchar_string(G.unipath_filename);
+ }
+ else {
+ G.unipath_widefilename = utf8_to_wchar_string(G.filename);
+ }
+ if (G.pInfo->lcflag) { /* replace with lowercase filename */
+ wcslwr(G.unipath_widefilename);
+ }
+ }
+# else /* def DYNAMIC_WIDE_NAME */
+ if (*G.unipath_widefilename == L'\0') {
+ if (G.unipath_filename) {
+ /* Get wide path from UTF-8 */
+ utf8_to_wchar_string( G.unipath_widefilename,
+ G.unipath_filename);
+ }
+ else {
+ utf8_to_wchar_string( G.unipath_widefilename, G.filename);
+ }
+ if (G.pInfo->lcflag) { /* replace with lowercase filename */
+ wcslwr(G.unipath_widefilename);
+ }
+# endif /* def DYNAMIC_WIDE_NAME [else] */
+# if 0
+ if (G.pInfo->vollabel && length > 8 && G.unipath_widefilename[8] == '.') {
+ wchar_t *p = G.unipath_widefilename+8;
+ while (*p++)
+ p[-1] = *p; /* disk label, and 8th char is dot: remove dot */
+ }
+# endif
+ }
+# endif /* WIN32_WIDE */
+
+# ifndef SFX
+ if (G.pInfo->cfilname != (char Far *)NULL) {
+ if (zfstrcmp(G.pInfo->cfilname, G.filename) != 0) {
+# ifdef SMALL_MEM
+ char *temp_cfilnam = slide + (7 * (WSIZE>>3));
+
+ zfstrcpy((char Far *)temp_cfilnam, G.pInfo->cfilname);
+# define cFile_PrintBuf temp_cfilnam
+# else
+# define cFile_PrintBuf G.pInfo->cfilname
+# endif
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarStringSmall2(LvsCFNamMsg),
+ FnFilter2(cFile_PrintBuf), FnFilter1(G.filename)));
+# undef cFile_PrintBuf
+ zfstrcpy(G.filename, G.pInfo->cfilname);
+ if (error_in_archive < PK_WARN)
+ error_in_archive = PK_WARN;
+ }
+ zffree(G.pInfo->cfilname);
+ G.pInfo->cfilname = (char Far *)NULL;
+ }
+# endif /* !SFX */
+
+# ifdef IZ_CRYPT_AES_WG
+ /* Analyze any AES encryption extra block before calculating
+ * the true uncompressed file size.
+ */
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ /* 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. */
+ ef_scan_for_aes( G.extra_field,
+ G.lrec.extra_field_length,
+ NULL, /* AES version, */
+ NULL, /* AES vendor, */
+ &G.pInfo->cmpr_mode_aes, /* AES mode. */
+ &G.pInfo->cmpr_mthd_aes); /* AES method. */
+
+ if ((G.pInfo->cmpr_mode_aes <= 0) || (G.pInfo->cmpr_mode_aes > 3))
+ {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(BadAesExtFieldMsg),
+ FnFilter1(G.filename), G.pInfo->cmpr_mode_aes));
+ continue; /* this one hosed; try next? */
+ }
+ temp_compression_method = G.pInfo->cmpr_mthd_aes;
+ temp_stored_size_decr = MAC_LENGTH( G.pInfo->cmpr_mode_aes)+
+ SALT_LENGTH( G.pInfo->cmpr_mode_aes)+ PWD_VER_LENGTH;
+ }
+ else
+ {
+ /* Use non-AES values. */
+ temp_compression_method = G.lrec.compression_method;
+ temp_stored_size_decr = RAND_HEAD_LEN;
+ }
+# endif /* def IZ_CRYPT_AES_WG */
+
+ /* Size consistency checks must come after reading in the local extra
+ * field, so that any Zip64 extension local e.f. block has already
+ * been processed.
+ */
+ if (REAL_COMPRESSION_METHOD == STORED)
+ {
+ zusz_t csiz_decrypted = G.lrec.csize;
+
+ if (G.pInfo->encrypted)
+ {
+ csiz_decrypted -= REAL_STORED_SIZE_DECR;
+ }
+ if (G.lrec.ucsize != csiz_decrypted) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarStringSmall2(WrnStorUCSizCSizDiff),
+ FnFilter1(G.filename),
+ FmZofft(G.lrec.ucsize, NULL, "u"),
+ FmZofft(csiz_decrypted, NULL, "u")));
+ G.lrec.ucsize = csiz_decrypted;
+ if (error_in_archive < PK_WARN)
+ error_in_archive = PK_WARN;
+ }
+ }
+
+# ifdef IZ_CRYPT_ANY
+ if (G.pInfo->encrypted &&
+ (error = decrypt(__G__ uO.pwdarg)) != PK_COOL) {
+ if (error == PK_WARN) {
+ if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)))
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(SkipIncorrectPasswd),
+ FnFilter1(G.filename)));
+ ++(*pnum_bad_pwd);
+ } else { /* (error > PK_WARN) */
+ if (error > error_in_archive)
+ error_in_archive = error;
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(SkipCannotGetPasswd),
+ FnFilter1(G.filename)));
+ }
+ continue; /* go on to next file */
+ }
+# endif /* def IZ_CRYPT_ANY */
+
+ /*
+ * just about to extract file: if extracting to disk, check if
+ * already exists, and if so, take appropriate action according to
+ * fflag/uflag/overwrite_all/etc. (we couldn't do this in upper
+ * loop because we don't store the possibly renamed filename[] in
+ * info[])
+ */
+# ifdef DLL
+ if (!uO.tflag && !uO.cflag && !G.redirect_data)
+# else
+ if (!uO.tflag && !uO.cflag)
+# endif
+ {
+ renamed = FALSE; /* user hasn't renamed output file yet */
+
+startover:
+ query = FALSE;
+ skip_entry = SKIP_NO;
+ /* for files from DOS FAT, check for use of backslash instead
+ * of slash as directory separator (bug in some zipper(s); so
+ * far, not a problem in HPFS, NTFS or VFAT systems)
+ */
+# ifndef SFX
+ if (G.pInfo->hostnum == FS_FAT_ && !MBSCHR(G.filename, '/')) {
+ char *p=G.filename;
+
+ if (*p) do {
+ if (*p == '\\') {
+ if (!G.reported_backslash) {
+ Info(slide, 0x21, ((char *)slide,
+ LoadFarString(BackslashPathSep), G.zipfn));
+ G.reported_backslash = TRUE;
+ if (!error_in_archive)
+ error_in_archive = PK_WARN;
+ }
+ *p = '/';
+ }
+ } while (*PREINCSTR(p));
+ }
+# endif /* !SFX */
+
+ if (!renamed) {
+ /* remove absolute path specs */
+ if (G.filename[0] == '/') {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(AbsolutePathWarning),
+ FnFilter1(G.filename)));
+ if (!error_in_archive)
+ error_in_archive = PK_WARN;
+ do {
+ char *p = G.filename + 1;
+ do {
+ *(p-1) = *p;
+ } while (*p++ != '\0');
+ } while (G.filename[0] == '/');
+ }
+ }
+
+ /* 2012-07-14 SMS.
+ * Moved -j/--junkdirs (.jflag) processing up to here from
+ * OS-specific mapnamew() function.
+ * G.unipath_jdir_widefilename is a pointer (within the
+ * G.unipath_widefilename string) to the path being kept
+ * (not junked).
+ */
+ G.unipath_jdir_widefilename = G.unipath_widefilename;
+ /* (Right, if "-j-", .jflag == 0.) */
+ if (uO.jflag < 0)
+ {
+ /* "-j": Junking all directories. Find last slash (if any). */
+ wslp = wcschr( G.unipath_widefilename, '/');
+ if (wslp != NULL)
+ {
+ /* Found a last slash. Name begins after it. */
+ G.unipath_jdir_widefilename = wslp+ 1;
+ }
+ }
+ else if (uO.jflag > 0)
+ {
+ /* "-j=N": Junking N directories. Loop through slashes. */
+ int i;
+
+ for (i = 0; i < uO.jflag; i++)
+ {
+ wslp = wcschr( G.unipath_jdir_widefilename, '/');
+ if (wslp == NULL)
+ {
+ if (G.filename[ strlen( G.filename)- 1] == '/')
+ {
+ /* Directory. (Won't be created, so show name.) */
+ Info( slide, 0x401, ((char *)slide,
+ LoadFarString( JunkTooManyDir),
+ i, uO.jflag, FnFilter1( G.filename)));
+ }
+ else
+ {
+ /* File. (Will be extracted, so name follows.) */
+ Info( slide, 0x401, ((char *)slide,
+ LoadFarString( JunkTooMany),
+ i, uO.jflag));
+ }
+ break;
+ }
+ else
+ {
+ /* Advance the retained-name pointer. */
+ G.unipath_jdir_widefilename = ++wslp;
+ }
+ }
+ }
+
+ /* mapname can create dirs if not freshening or if renamed */
+ error = mapnamew(__G__ renamed);
+
+ if ((errcode = error & ~MPN_MASK) != PK_OK &&
+ error_in_archive < errcode)
+ error_in_archive = errcode;
+ if ((errcode = error & MPN_MASK) > MPN_INF_TRUNC) {
+ if (errcode == MPN_CREATED_DIR) {
+# ifdef SET_DIR_ATTRIB
+ direntryw *d_entryw;
+
+ error = defer_dir_attribsw(__G__ &d_entryw);
+ if (d_entryw == (direntryw *)NULL) {
+ /* There may be no dir_attribs info available, or
+ * we have encountered a mem allocation error.
+ * In case of an error, report it and set program
+ * error state to warning level.
+ */
+ if (error) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(DirlistEntryNoMem)));
+ if (!error_in_archive)
+ error_in_archive = PK_WARN;
+ }
+ } else {
+ d_entryw->next = (*pdirlistw);
+ (*pdirlistw) = d_entryw;
+ ++(*pnum_dirs);
+ }
+# endif /* SET_DIR_ATTRIB */
+ } else if (errcode == MPN_VOL_LABEL) {
+# ifdef DOS_OS2_W32
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(SkipVolumeLabel),
+ FnFilter1(G.filename),
+ uO.volflag? "hard disk " : ""));
+# else
+ Info(slide, 1, ((char *)slide,
+ LoadFarString(SkipVolumeLabel),
+ FnFilter1(G.filename), ""));
+# endif
+ } else if (errcode > MPN_INF_SKIP &&
+ error_in_archive < PK_ERR)
+ error_in_archive = PK_ERR;
+ Trace((stderr, "mapname(%s) returns error code = %d\n",
+ FnFilter1(G.filename), error));
+ continue; /* go on to next file */
+ }
+
+ switch (check_for_newerw(__G__ G.unipath_widefilename)) {
+ case DOES_NOT_EXIST:
+# ifdef NOVELL_BUG_FAILSAFE
+ G.dne = TRUE; /* stat() says file DOES NOT EXIST */
+# endif
+ /* freshen (no new files): skip unless just renamed */
+ if (uO.fflag && !renamed)
+ skip_entry = SKIP_Y_NONEXIST;
+ break;
+ case EXISTS_AND_OLDER:
+# ifdef UNIXBACKUP
+ if (!uO.B_flag)
+# endif
+ {
+ if (IS_OVERWRT_NONE)
+ /* never overwrite: skip file */
+ skip_entry = SKIP_Y_EXISTING;
+ else if (!IS_OVERWRT_ALL)
+ query = TRUE;
+ }
+ break;
+ case EXISTS_AND_NEWER: /* (or equal) */
+# ifdef UNIXBACKUP
+ if ((!uO.B_flag && IS_OVERWRT_NONE) ||
+# else
+ if (IS_OVERWRT_NONE ||
+# endif
+ (uO.uflag && !renamed)) {
+ /* skip if update/freshen & orig name */
+ skip_entry = SKIP_Y_EXISTING;
+ } else {
+# ifdef UNIXBACKUP
+ if (!IS_OVERWRT_ALL && !uO.B_flag)
+# else
+ if (!IS_OVERWRT_ALL)
+# endif
+ query = TRUE;
+ }
+ break;
+ }
+ if (query) {
+# ifdef WINDLL
+ switch (G.lpUserFunctions->replace != NULL ?
+ (*G.lpUserFunctions->replace)(G.filename, FILNAMSIZ) :
+ IDM_REPLACE_NONE) {
+ case IDM_REPLACE_RENAME:
+ _ISO_INTERN(G.filename);
+ renamed = TRUE;
+ goto startover;
+ case IDM_REPLACE_ALL:
+ G.overwrite_mode = OVERWRT_ALWAYS;
+ /* FALL THROUGH, extract */
+ case IDM_REPLACE_YES:
+ break;
+ case IDM_REPLACE_NONE:
+ G.overwrite_mode = OVERWRT_NEVER;
+ /* FALL THROUGH, skip */
+ case IDM_REPLACE_NO:
+ skip_entry = SKIP_Y_EXISTING;
+ break;
+ }
+# else /* !WINDLL */
+ extent fnlen;
+reprompt:
+ Info(slide, 0x81, ((char *)slide,
+ LoadFarString(ReplaceQuery),
+ FnFilter1(G.filename)));
+ if (fgets_ans( __G) < 0)
+ {
+ Info(slide, 1, ((char *)slide,
+ LoadFarString(AssumeNone)));
+ *G.answerbuf = 'N';
+ if (!error_in_archive)
+ error_in_archive = 1; /* not extracted: warning */
+ }
+ switch (*G.answerbuf) {
+ case 'r':
+ case 'R':
+ do {
+ Info(slide, 0x81, ((char *)slide,
+ LoadFarString(NewNameQuery)));
+ fgets(G.filename, FILNAMSIZ, stdin);
+ /* usually get \n here: better check for it */
+ fnlen = strlen(G.filename);
+ if (lastchar(G.filename, fnlen) == '\n')
+ G.filename[--fnlen] = '\0';
+ } while (fnlen == 0);
+# ifdef WIN32 /* WIN32 fgets( ... , stdin) returns OEM coded strings */
+ _OEM_INTERN(G.filename);
+# endif
+ renamed = TRUE;
+ goto startover; /* sorry for a goto */
+ case 'A': /* dangerous option: force caps */
+ G.overwrite_mode = OVERWRT_ALWAYS;
+ /* FALL THROUGH, extract */
+ case 'y':
+ case 'Y':
+ break;
+ case 'N':
+ G.overwrite_mode = OVERWRT_NEVER;
+ /* FALL THROUGH, skip */
+ case 'n':
+ /* skip file */
+ skip_entry = SKIP_Y_EXISTING;
+ break;
+ case '\n':
+ case '\r':
+ /* Improve echo of '\n' and/or '\r'
+ * (sizeof(G.answerbuf) == 10 (see globals.h), so
+ * there is enough space for the provided text...)
+ */
+ strcpy( G.answerbuf, "{ENTER}");
+ /* fall through ... */
+ default:
+ /* usually get \n here: remove it for nice display
+ (fnlen can be re-used here, we are outside the
+ "enter new filename" loop) */
+ fnlen = strlen(G.answerbuf);
+ if (lastchar(G.answerbuf, fnlen) == '\n')
+ G.answerbuf[--fnlen] = '\0';
+ Info(slide, 1, ((char *)slide,
+ LoadFarString(InvalidResponse), G.answerbuf));
+ goto reprompt; /* yet another goto? */
+ } /* end switch (*answerbuf) */
+# endif /* ?WINDLL */
+ } /* end if (query) */
+ if (skip_entry != SKIP_NO) {
+# ifdef WINDLL
+ if (skip_entry == SKIP_Y_EXISTING) {
+ /* report skipping of an existing entry */
+ Info(slide, 0, ((char *)slide,
+ ((IS_OVERWRT_NONE || !uO.uflag || renamed) ?
+ "Target file exists. Skipping %s\n" :
+ "Target file newer. Skipping %s\n"),
+ FnFilter1(G.filename)));
+ }
+# endif /* WINDLL */
+ continue;
+ }
+ } /* end if (extracting to disk) */
+
+# ifdef DLL
+ if ((G.statreportcb != NULL) &&
+ (*G.statreportcb)(__G__ UZ_ST_START_EXTRACT, G.zipfn,
+ G.filename, NULL)) {
+ return IZ_CTRLC; /* cancel operation by user request */
+ }
+# endif
+ G.disk_full = 0;
+ if ((error = extract_or_test_member(__G)) != PK_COOL) {
+ if (error > error_in_archive)
+ error_in_archive = error; /* ...and keep going */
+# ifdef DLL
+ if (G.disk_full > 1 || error_in_archive == IZ_CTRLC) {
+# else
+ if (G.disk_full > 1) {
+# endif
+ return error_in_archive; /* (unless disk full) */
+ }
+ }
+# ifdef DLL
+ if ((G.statreportcb != NULL) &&
+ (*G.statreportcb)(__G__ UZ_ST_FINISH_MEMBER, G.zipfn,
+ G.filename, (zvoid *)&G.lrec.ucsize)) {
+ return IZ_CTRLC; /* cancel operation by user request */
+ }
+# endif
+ } /* end for-loop (i: files in current block) */
+
+ return error_in_archive;
+
+} /* end function extract_or_test_entrylistw() */
+
+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+
+
+
+/* wsize is used in extract_or_test_member() and various method-specific
+ * UZ functions: UZbunzip2(), UZlzma(), UZppmd().
+ */
+#if defined(DLL) && !defined(NO_SLIDE_REDIR)
+# define wsize G._wsize /* wsize is a variable */
+#else
+# define wsize WSIZE /* wsize is a constant */
+#endif
+
+/***************************************/
+/* Function extract_or_test_member() */
+/***************************************/
+
+static int extract_or_test_member(__G) /* return PK-type error code */
+ __GDEF
+{
+ char *nul="[empty] ", *txt="[text] ", *bin="[binary]";
+#ifdef CMS_MVS
+ char *ebc="[ebcdic]";
+#endif
+ register int b;
+ int r, error=PK_COOL;
+
+ /* AES-encrypted data include a trailer which must not be put out.
+ * For STORED data, the output bytes are counted in bytes_put_out,
+ * and limited (below) to the known uncompressed data size.
+ */
+ zusz_t bytes_put_out;
+
+#ifdef IZ_CRYPT_AES_WG
+ zoff_t g_csize_adj = 0; /* Temporary adjustment to G.csize. */
+ int aes_mac_mismatch;
+ ush temp_compression_method;
+ /* AES Message Authentication Code storage. Note that we're in
+ * trouble, if the size ever changes to exceed 10.
+ */
+ uch aes_wg_mac_file[ 10]; /* AES MAC from file. */
+ uch aes_wg_mac_calc[ 10]; /* AES MAC calculated. */
+#endif /* def IZ_CRYPT_AES_WG */
+
+/*---------------------------------------------------------------------------
+ Initialize variables, buffers, etc.
+ ---------------------------------------------------------------------------*/
+
+ G.bits_left = 0;
+ G.bitbuf = 0L; /* unreduce and unshrink only */
+ G.zipeof = 0;
+ G.newfile = TRUE;
+ G.crc32val = CRCVAL_INITIAL;
+
+#ifdef SYMLINKS
+ /* If file is a (POSIX-compatible) symbolic link and we are extracting
+ * to disk, prepare to restore the link. */
+ G.symlnk = (G.pInfo->symlink &&
+ !uO.tflag && !uO.cflag && (G.lrec.ucsize > 0));
+#endif /* SYMLINKS */
+
+ if (uO.tflag) {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "test";
+#endif /* def ENABLE_USER_PROGRESS */
+ if (!uO.qflag)
+ {
+ Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), "test",
+ FnFilter1(G.filename), "", ""));
+ }
+ } else {
+#ifdef DLL
+ if (uO.cflag && !G.redirect_data)
+#else
+ if (uO.cflag)
+#endif
+ {
+#if defined(OS2) && defined(__IBMC__) && (__IBMC__ >= 200)
+ G.outfile = freopen("", "wb", stdout); /* VAC++ ignores setmode */
+#else
+ G.outfile = stdout;
+#endif
+#ifdef DOS_FLX_NLM_OS2_W32
+# if defined(__HIGHC__) && !defined(FLEXOS)
setmode(G.outfile, _BINARY);
-#else /* !(defined(__HIGHC__) && !defined(FLEXOS)) */
+# else /* !(defined(__HIGHC__) && !defined(FLEXOS)) */
setmode(fileno(G.outfile), O_BINARY);
-#endif /* ?(defined(__HIGHC__) && !defined(FLEXOS)) */
-# define NEWLINE "\r\n"
+# endif /* ?(defined(__HIGHC__) && !defined(FLEXOS)) */
+# define NEWLINE "\r\n"
#else /* !DOS_FLX_NLM_OS2_W32 */
-# define NEWLINE "\n"
+# define NEWLINE "\n"
#endif /* ?DOS_FLX_NLM_OS2_W32 */
#ifdef VMS
/* VMS: required even for stdout! */
---------------------------------------------------------------------------*/
defer_leftover_input(__G); /* so NEXTBYTE bounds check will work */
- switch (G.lrec.compression_method) {
+
+#ifdef IZ_CRYPT_AES_WG
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ /* The "compression_method" is AES, so use the real method. */
+ temp_compression_method = G.pInfo->cmpr_mthd_aes;
+ }
+ else
+ {
+ /* Not AES encrypted, so use the apparent compression_method,
+ * and clear the AES MAC-mismatch indicator.
+ */
+ temp_compression_method = G.lrec.compression_method;
+ aes_mac_mismatch = 0;
+ }
+#endif /* def IZ_CRYPT_AES_WG */
+
+ switch (REAL_COMPRESSION_METHOD) {
case STORED:
- if (!uO.tflag && QCOND2) {
+ if (!uO.tflag)
+ {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "link";
+#endif /* def ENABLE_USER_PROGRESS */
+ if (QCOND2) {
#ifdef SYMLINKS
if (G.symlnk) /* can also be deflated, but rarer... */
+ {
Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
"link", FnFilter1(G.filename), "", ""));
+
+ }
else
#endif /* SYMLINKS */
- Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
- "extract", FnFilter1(G.filename),
- (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)?
- "" : (G.lrec.ucsize == 0L? nul : (G.pInfo->textfile? txt :
- bin)), uO.cflag? NEWLINE : ""));
+ {
+ Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
+ "extract", FnFilter1(G.filename),
+ ((uO.aflag != 1)
+ /* && G.pInfo->textfile==G.pInfo->textmode */ ) ?
+ "" : (G.lrec.ucsize == 0L? nul : (G.pInfo->textfile? txt :
+ bin)), uO.cflag? NEWLINE : ""));
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "extract";
+#endif /* def ENABLE_USER_PROGRESS */
+ }
+ }
}
-#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
+#if defined(DLL) && !defined(NO_SLIDE_REDIR)
if (G.redirect_slide) {
wsize = G.redirect_size; redirSlide = G.redirect_buffer;
} else {
#endif
G.outptr = redirSlide;
G.outcnt = 0L;
- while ((b = NEXTBYTE) != EOF) {
+ bytes_put_out = 0;
+
+ while (bytes_put_out < G.pInfo->uncompr_size)
+ {
+ if ((b = NEXTBYTE) == EOF)
+ break;
*G.outptr++ = (uch)b;
+ bytes_put_out++;
+
if (++G.outcnt == wsize) {
error = flush(__G__ redirSlide, G.outcnt, 0);
G.outptr = redirSlide;
if (G.outcnt) { /* flush final (partial) buffer */
r = flush(__G__ redirSlide, G.outcnt, 0);
if (error < r) error = r;
+
+ bytes_put_out += G.outcnt;
}
break;
-#ifndef SFX
#ifndef LZW_CLEAN
case SHRUNK:
- if (!uO.tflag && QCOND2) {
+ if (!uO.tflag)
+ {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = Unshrink;
+#endif /* def ENABLE_USER_PROGRESS */
+ if (QCOND2)
+ {
Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
LoadFarStringSmall(Unshrink), FnFilter1(G.filename),
- (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)?
+ ((uO.aflag != 1)
+ /* && G.pInfo->textfile==G.pInfo->textmode */ ) ?
"" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : ""));
+ }
}
if ((r = unshrink(__G)) != PK_COOL) {
if (r < PK_DISK) {
case REDUCED2:
case REDUCED3:
case REDUCED4:
- if (!uO.tflag && QCOND2) {
+ if (!uO.tflag)
+ {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "unreduc";
+#endif /* def ENABLE_USER_PROGRESS */
+ if (QCOND2)
+ {
Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
"unreduc", FnFilter1(G.filename),
- (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)?
+ ((uO.aflag != 1)
+ /* && G.pInfo->textfile==G.pInfo->textmode */ ) ?
"" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : ""));
+ }
}
if ((r = unreduce(__G)) != PK_COOL) {
/* unreduce() returns only PK_COOL, PK_DISK, or IZ_CTRLC */
break;
#endif /* !COPYRIGHT_CLEAN */
+#ifndef SFX /* Implode should have its own macro. */
case IMPLODED:
- if (!uO.tflag && QCOND2) {
+ if (!uO.tflag)
+ {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "explod";
+#endif /* def ENABLE_USER_PROGRESS */
+ if (QCOND2)
+ {
Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
"explod", FnFilter1(G.filename),
- (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)?
+ ((uO.aflag != 1)
+ /* && G.pInfo->textfile==G.pInfo->textmode */ ) ?
"" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : ""));
+ }
}
if ((r = explode(__G)) != 0) {
if (r == 5) { /* treat 5 specially */
} else if (r < PK_DISK) {
if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))
Info(slide, 0x401, ((char *)slide,
- LoadFarStringSmall(ErrUnzipFile), r == 3?
+ LoadFarStringSmall(ErrUnzipFile), r == PK_MEM3 ?
LoadFarString(NotEnoughMem) :
LoadFarString(InvalidComprData),
LoadFarStringSmall2(Explode),
FnFilter1(G.filename)));
else
Info(slide, 0x401, ((char *)slide,
- LoadFarStringSmall(ErrUnzipNoFile), r == 3?
+ LoadFarStringSmall(ErrUnzipNoFile), r == PK_MEM3 ?
LoadFarString(NotEnoughMem) :
LoadFarString(InvalidComprData),
LoadFarStringSmall2(Explode)));
}
}
break;
-#endif /* !SFX */
+#endif /* ndef SFX */
+#ifdef DEFLATE_SUPPORT
case DEFLATED:
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
case ENHDEFLATED:
-#endif
- if (!uO.tflag && QCOND2) {
+# endif
+ if (!uO.tflag)
+ {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "inflat";
+#endif /* def ENABLE_USER_PROGRESS */
+ if (QCOND2)
+ {
Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
"inflat", FnFilter1(G.filename),
- (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)?
+ ((uO.aflag != 1)
+ /* && G.pInfo->textfile==G.pInfo->textmode */ ) ?
"" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : ""));
+ }
}
-#ifndef USE_ZLIB /* zlib's function is called inflate(), too */
-# define UZinflate inflate
-#endif
+# ifndef USE_ZLIB /* zlib's function is called inflate(), too */
+# define UZinflate inflate
+# endif
if ((r = UZinflate(__G__
(G.lrec.compression_method == ENHDEFLATED)))
!= 0) {
if (r < PK_DISK) {
if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))
Info(slide, 0x401, ((char *)slide,
- LoadFarStringSmall(ErrUnzipFile), r == 3?
+ LoadFarStringSmall(ErrUnzipFile), r == PK_MEM3 ?
LoadFarString(NotEnoughMem) :
LoadFarString(InvalidComprData),
LoadFarStringSmall2(Inflate),
FnFilter1(G.filename)));
else
Info(slide, 0x401, ((char *)slide,
- LoadFarStringSmall(ErrUnzipNoFile), r == 3?
+ LoadFarStringSmall(ErrUnzipNoFile), r == PK_MEM3 ?
LoadFarString(NotEnoughMem) :
LoadFarString(InvalidComprData),
LoadFarStringSmall2(Inflate)));
}
}
break;
+#endif
-#ifdef USE_BZIP2
+#ifdef BZIP2_SUPPORT
case BZIPPED:
- if (!uO.tflag && QCOND2) {
+ if (!uO.tflag)
+ {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "bunzipp";
+#endif /* def ENABLE_USER_PROGRESS */
+ if (QCOND2)
+ {
Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
"bunzipp", FnFilter1(G.filename),
- (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)?
+ ((uO.aflag != 1)
+ /* && G.pInfo->textfile==G.pInfo->textmode */ ) ?
"" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : ""));
+ }
+ }
+
+# ifdef IZ_CRYPT_AES_WG
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ /* Subtract the MAC data size from G.csize, to keep
+ * the MAC data away from UZbunzip2(). Remember doing
+ * this, so that G.csize can be restored later, before
+ * trying to read the MAC data.
+ */
+ g_csize_adj = MAC_LENGTH( G.pInfo->cmpr_mode_aes);
+ G.csize -= g_csize_adj;
}
+# endif /* def IZ_CRYPT_AES_WG */
+
if ((r = UZbunzip2(__G)) != 0) {
if (r < PK_DISK) {
if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))
Info(slide, 0x401, ((char *)slide,
- LoadFarStringSmall(ErrUnzipFile), r == 3?
+ LoadFarStringSmall(ErrUnzipFile), r == PK_MEM3 ?
LoadFarString(NotEnoughMem) :
LoadFarString(InvalidComprData),
LoadFarStringSmall2(BUnzip),
FnFilter1(G.filename)));
else
Info(slide, 0x401, ((char *)slide,
- LoadFarStringSmall(ErrUnzipNoFile), r == 3?
+ LoadFarStringSmall(ErrUnzipNoFile), r == PK_MEM3 ?
LoadFarString(NotEnoughMem) :
LoadFarString(InvalidComprData),
LoadFarStringSmall2(BUnzip)));
}
}
break;
-#endif /* USE_BZIP2 */
+#endif /* BZIP2_SUPPORT */
+
+#ifdef LZMA_SUPPORT
+ case LZMAED:
+ if (!uO.tflag)
+ {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "unLZMA";
+#endif /* def ENABLE_USER_PROGRESS */
+ if (QCOND2)
+ {
+ Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
+ "unLZMA", FnFilter1(G.filename),
+ ((uO.aflag != 1)
+ /* && G.pInfo->textfile==G.pInfo->textmode */ ) ?
+ "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : ""));
+ }
+ }
+
+# ifdef IZ_CRYPT_AES_WG
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ /* Subtract the MAC data size from G.csize, to keep
+ * the MAC data away from UZlzma(). Remember doing
+ * this, so that G.csize can be restored later, before
+ * trying to read the MAC data.
+ */
+ g_csize_adj = MAC_LENGTH( G.pInfo->cmpr_mode_aes);
+ G.csize -= g_csize_adj;
+ }
+# endif /* def IZ_CRYPT_AES_WG */
+
+ if ((r = UZlzma(__G)) != 0) {
+ if (r < PK_DISK) {
+ if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarStringSmall(ErrUnzipFile), r == PK_MEM3 ?
+ LoadFarString(NotEnoughMem) :
+ LoadFarString(InvalidComprData),
+ LoadFarStringSmall2(UnLZMA),
+ FnFilter1(G.filename)));
+ else
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarStringSmall(ErrUnzipNoFile), r == PK_MEM3 ?
+ LoadFarString(NotEnoughMem) :
+ LoadFarString(InvalidComprData),
+ LoadFarStringSmall2(UnLZMA)));
+ error = ((r == 3) ? PK_MEM3 : PK_ERR);
+ } else {
+ error = r;
+ }
+ }
+ break;
+#endif /* LZMA_SUPPORT */
+
+#ifdef PPMD_SUPPORT
+ case PPMDED:
+ if (!uO.tflag)
+ {
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "unPPMd";
+#endif /* def ENABLE_USER_PROGRESS */
+ if (QCOND2)
+ {
+ Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg),
+ "unPPMd", FnFilter1(G.filename),
+ ((uO.aflag != 1)
+ /* && G.pInfo->textfile==G.pInfo->textmode */ ) ?
+ "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : ""));
+ }
+ }
+
+# ifdef IZ_CRYPT_AES_WG
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ /* Subtract the MAC data size from G.csize, to keep
+ * the MAC data away from UZppmd(). Remember doing
+ * this, so that G.csize can be restored later, before
+ * trying to read the MAC data.
+ */
+ g_csize_adj = MAC_LENGTH( G.pInfo->cmpr_mode_aes);
+ G.csize -= g_csize_adj;
+ }
+# endif /* def IZ_CRYPT_AES_WG */
+
+ if ((r = UZppmd(__G)) != 0) {
+ if (r < PK_DISK) {
+ if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarStringSmall(ErrUnzipFile), r == PK_MEM3 ?
+ LoadFarString(NotEnoughMem) :
+ LoadFarString(InvalidComprData),
+ LoadFarStringSmall2(UnPPMd),
+ FnFilter1(G.filename)));
+ else
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarStringSmall(ErrUnzipNoFile), r == PK_MEM3 ?
+ LoadFarString(NotEnoughMem) :
+ LoadFarString(InvalidComprData),
+ LoadFarStringSmall2(UnPPMd)));
+ error = ((r == 3) ? PK_MEM3 : PK_ERR);
+ } else {
+ error = r;
+ }
+ }
+ break;
+#endif /* PPMD_SUPPORT */
default: /* should never get to this point */
Info(slide, 0x401, ((char *)slide,
} /* end switch (compression method) */
+#ifdef IZ_CRYPT_AES_WG
+ if (g_csize_adj != 0)
+ {
+ /* Bump G.csize back up, so that NEXTBYTE doesn't quit
+ * prematurely while collecting the file MAC data.
+ */
+ G.csize += g_csize_adj;
+ }
+
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ int i;
+
+ /* Save the Message Authorization Code from the file data. */
+ for (i = 0; i < MAC_LENGTH( G.pInfo->cmpr_mode_aes); i++)
+ {
+ unsigned int uichar;
+
+ if ((uichar = NEXTBYTE) == (unsigned int)EOF)
+ break;
+ aes_wg_mac_file[ i] = uichar;
+ }
+ /* Get the calculated MAC from the encryption package. */
+ i = fcrypt_end( aes_wg_mac_calc, G.zcx);
+ /* Verify MAC match. Record result. */
+ aes_mac_mismatch = (i != MAC_LENGTH( G.pInfo->cmpr_mode_aes)) ||
+ (memcmp( aes_wg_mac_file, aes_wg_mac_calc, i));
+ }
+#endif /* def IZ_CRYPT_AES_WG */
+
/*---------------------------------------------------------------------------
Close the file and set its date and time (not necessarily in that order),
and make sure the CRC checked out OK. Logical-AND the CRC for 64-bit
if (!uO.tflag) /* don't close NULL file */
close_outfile(__G);
#else
-#ifdef DLL
+# ifdef DLL
if (!uO.tflag && (!uO.cflag || G.redirect_data)) {
if (G.redirect_data)
FINISH_REDIRECT();
else
close_outfile(__G);
}
-#else
+# else
if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */
close_outfile(__G);
-#endif
+# endif
#endif /* VMS */
/* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */
if (G.disk_full) { /* set by flush() */
if (G.disk_full > 1) {
-#if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK))
+#if defined(DELETE_IF_FULL) && defined(HAVE_UNLINK)
/* delete the incomplete file if we can */
if (unlink(G.filename) != 0)
Trace((stderr, "extract.c: could not delete %s\n",
undefer_input(__G);
return error;
}
- if (G.crc32val != G.lrec.crc32) {
+
+ /* Complain about a bad CRC or an AES MAC mis-match.
+ * Ignore a bad CRC for AES version 2.
+ */
+ if (((G.crc32val != G.lrec.crc32)
+#ifdef IZ_CRYPT_AES_WG
+ && (G.pInfo->cmpr_vers_aes != 2)) || aes_mac_mismatch
+#else /* def IZ_CRYPT_AES_WG */
+ )
+#endif /* def IZ_CRYPT_AES_WG [else] */
+ )
+ {
/* if quiet enough, we haven't output the filename yet: do it */
if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))
Info(slide, 0x401, ((char *)slide, "%-22s ",
FnFilter1(G.filename)));
- Info(slide, 0x401, ((char *)slide, LoadFarString(BadCRC), G.crc32val,
- G.lrec.crc32));
-#if CRYPT
+
+#ifdef IZ_CRYPT_AES_WG
+ if (aes_mac_mismatch)
+ {
+ /* Bad AES Message Authentication Code.
+ * It's ten bytes of bad data or a bad length. Will anyone
+ * want to see all the details?
+ */
+ Info(slide, 0x401, ((char *)slide, LoadFarString(BadAesMacMsg)));
+ }
+ else
+#endif /* def IZ_CRYPT_AES_WG */
+ {
+ /* Bad CRC checksum. */
+ Info(slide, 0x401, ((char *)slide, LoadFarString(BadCRC),
+ G.crc32val, G.lrec.crc32));
+ }
+#ifdef IZ_CRYPT_ANY
if (G.pInfo->encrypted)
Info(slide, 0x401, ((char *)slide, LoadFarString(MaybeBadPasswd)));
-#endif
+#endif /* def IZ_CRYPT_ANY */
error = PK_ERR;
} else if (uO.tflag) {
#ifndef SFX
}
undefer_input(__G);
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = NULL; /* Clear the progress mthd str. */
+#endif /* def ENABLE_USER_PROGRESS */
return error;
} /* end function extract_or_test_member() */
/* Function TestExtraField() */
/*******************************/
+/* 2012-11-25 SMS. (OUSPG report.)
+ * Changed eb_len and ef_len from unsigned to signed, to
+ * catch underflow of ef_len caused by corrupt/malicious
+ * data. (32-bit is adequate. Used "long" to
+ * accommodate any systems with 16-bit "int".)
+ */
+
static int TestExtraField(__G__ ef, ef_len)
__GDEF
uch *ef;
- unsigned ef_len;
+ long ef_len;
{
- ush ebID;
- unsigned ebLen;
+ ush eb_id;
+ long eb_len;
unsigned eb_cmpr_offs = 0;
int r;
* wouldn't be here ==> print filename if any extra-field errors found
*/
while (ef_len >= EB_HEADSIZE) {
- ebID = makeword(ef);
- ebLen = (unsigned)makeword(ef+EB_LEN);
+ eb_id = makeword(ef);
+ eb_len = (unsigned)makeword(ef+EB_LEN);
- if (ebLen > (ef_len - EB_HEADSIZE)) {
+ if (eb_len > (ef_len - EB_HEADSIZE)) {
/* Discovered some extra field inconsistency! */
if (uO.qflag)
Info(slide, 1, ((char *)slide, "%-22s ",
FnFilter1(G.filename)));
Info(slide, 1, ((char *)slide, LoadFarString(InconsistEFlength),
- ebLen, (ef_len - EB_HEADSIZE)));
+ eb_len, (ef_len - EB_HEADSIZE)));
return PK_ERR;
}
- switch (ebID) {
+ switch (eb_id) {
case EF_OS2:
case EF_ACL:
case EF_MAC3:
case EF_BEOS:
case EF_ATHEOS:
- switch (ebID) {
+ switch (eb_id) {
case EF_OS2:
case EF_ACL:
eb_cmpr_offs = EB_OS2_HLEN;
break;
case EF_MAC3:
- if (ebLen >= EB_MAC3_HLEN &&
+ if (eb_len >= EB_MAC3_HLEN &&
(makeword(ef+(EB_HEADSIZE+EB_FLGS_OFFS))
& EB_M3_FL_UNCMPR) &&
- (makelong(ef+EB_HEADSIZE) == ebLen - EB_MAC3_HLEN))
+ (makelong(ef+EB_HEADSIZE) == eb_len - EB_MAC3_HLEN))
eb_cmpr_offs = 0;
else
eb_cmpr_offs = EB_MAC3_HLEN;
break;
case EF_BEOS:
case EF_ATHEOS:
- if (ebLen >= EB_BEOS_HLEN &&
+ if (eb_len >= EB_BEOS_HLEN &&
(*(ef+(EB_HEADSIZE+EB_FLGS_OFFS)) & EB_BE_FL_UNCMPR) &&
- (makelong(ef+EB_HEADSIZE) == ebLen - EB_BEOS_HLEN))
+ (makelong(ef+EB_HEADSIZE) == eb_len - EB_BEOS_HLEN))
eb_cmpr_offs = 0;
else
eb_cmpr_offs = EB_BEOS_HLEN;
break;
}
- if ((r = test_compr_eb(__G__ ef, ebLen, eb_cmpr_offs, NULL))
+ if ((r = test_compr_eb(__G__ ef, eb_len, eb_cmpr_offs, NULL))
!= PK_OK) {
if (uO.qflag)
Info(slide, 1, ((char *)slide, "%-22s ",
case IZ_EF_TRUNC:
Info(slide, 1, ((char *)slide,
LoadFarString(TruncEAs),
- ebLen-(eb_cmpr_offs+EB_CMPRHEADLEN), "\n"));
+ eb_len-(eb_cmpr_offs+EB_CMPRHEADLEN), "\n"));
break;
case PK_ERR:
Info(slide, 1, ((char *)slide,
break;
case EF_NTSD:
- Trace((stderr, "ebID: %i / ebLen: %u\n", ebID, ebLen));
- r = ebLen < EB_NTSD_L_LEN ? IZ_EF_TRUNC :
+ Trace((stderr, "eb_id: %i / eb_len: %ld\n", eb_id, eb_len));
+ r = eb_len < EB_NTSD_L_LEN ? IZ_EF_TRUNC :
((ef[EB_HEADSIZE+EB_NTSD_VERSION] > EB_NTSD_MAX_VER) ?
(PK_WARN | 0x4000) :
- test_compr_eb(__G__ ef, ebLen, EB_NTSD_L_LEN, TEST_NTSD));
+ test_compr_eb(__G__ ef, eb_len, EB_NTSD_L_LEN, TEST_NTSD));
if (r != PK_OK) {
if (uO.qflag)
Info(slide, 1, ((char *)slide, "%-22s ",
case IZ_EF_TRUNC:
Info(slide, 1, ((char *)slide,
LoadFarString(TruncNTSD),
- ebLen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), "\n"));
+ eb_len-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), "\n"));
break;
-#if (defined(WIN32) && defined(NTSD_EAS))
+#if defined(WIN32) && defined(NTSD_EAS)
case PK_WARN:
Info(slide, 1, ((char *)slide,
LoadFarString(InvalidSecurityEAs)));
case EF_PKVMS:
if (makelong(ef+EB_HEADSIZE) !=
crc32(CRCVAL_INITIAL, ef+(EB_HEADSIZE+4),
- (extent)(ebLen-4)))
+ (extent)(eb_len-4)))
Info(slide, 1, ((char *)slide,
LoadFarString(BadCRC_EAs)));
break;
+ case EF_JAVA:
+ /* 2012-05-20 SMS.
+ * Setting java_cafe here may be too late to be useful.
+ * If it wasn't done when the central directory was
+ * processed, then now may be too late. Perhaps it
+ * would make some sense not to set the flag here, if
+ * we're just now seeing a "CAFE" extra block here, than
+ * to set the flag now, and risk inconsistency with
+ * previous name processing.
+ */
+ if (uO.java_cafe <= 0)
+ {
+ Info( slide, 1, ((char *)slide,
+ LoadFarString( InfoInconsistentJavaCAFE)));
+ }
+ uO.java_cafe = 1;
+ break;
case EF_PKW32:
case EF_PKUNIX:
case EF_ASIUNIX:
default:
break;
}
- ef_len -= (ebLen + EB_HEADSIZE);
- ef += (ebLen + EB_HEADSIZE);
+ ef_len -= (eb_len + EB_HEADSIZE);
+ ef += (eb_len + EB_HEADSIZE);
}
if (!uO.qflag)
static int test_compr_eb(
__GPRO__
uch *eb,
- unsigned eb_size,
+ long eb_size,
unsigned compr_offset,
- int (*test_uc_ebdata)(__GPRO__ uch *eb, unsigned eb_size,
+ int (*test_uc_ebdata)(__GPRO__ uch *eb, long eb_size,
uch *eb_ucptr, ulg eb_ucsize))
#else /* !PROTO */
static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata)
__GDEF
uch *eb;
- unsigned eb_size;
+ long eb_size;
unsigned compr_offset;
int (*test_uc_ebdata)();
#endif /* ?PROTO */
if ((eb_size < (EB_UCSIZE_P + 4)) ||
((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L &&
- eb_size <= (compr_offset + EB_CMPRHEADLEN)))
+ eb_size <= (long)(compr_offset + EB_CMPRHEADLEN)))
return IZ_EF_TRUNC; /* no compressed data! */
if (
#ifdef INT_16BIT
(((ulg)(extent)eb_ucsize) != eb_ucsize) ||
#endif
- (eb_ucptr = (uch *)malloc((extent)eb_ucsize)) == (uch *)NULL)
+ (eb_ucptr = (uch *)izu_malloc((extent)eb_ucsize)) == (uch *)NULL)
return PK_MEM4;
r = memextract(__G__ eb_ucptr, eb_ucsize,
if (r == PK_OK && test_uc_ebdata != NULL)
r = (*test_uc_ebdata)(__G__ eb, eb_size, eb_ucptr, eb_ucsize);
- free(eb_ucptr);
+ izu_free(eb_ucptr);
return r;
} /* end function test_compr_eb() */
memcpy((char *)tgt, (char *)G.inptr, (extent)G.incnt);
G.outcnt = (ulg)G.csize; /* for CRC calculation */
break;
+
+#ifdef DEFLATE_SUPPORT
case DEFLATED:
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
case ENHDEFLATED:
-#endif
+# endif
G.outcnt = 0L;
if ((r = UZinflate(__G__ (method == ENHDEFLATED))) != 0) {
if (!uO.tflag)
if (G.outcnt == 0L) /* inflate's final FLUSH sets outcnt */
break;
break;
+#endif
default:
if (uO.tflag)
error = PK_ERR | ((int)method << 8);
-#if (defined(VMS) || defined(VMS_TEXT_CONV))
+#if defined(VMS) || defined(VMS_TEXT_CONV)
/************************************/
/* Function extract_izvms_block() */
if (retlen)
*retlen = usiz;
- if ((ucdata = (uch *)malloc(MAX(needlen, usiz))) == NULL)
+ if ((ucdata = (uch *)izu_malloc(IZ_MAX(needlen, usiz))) == NULL)
return NULL;
if (init && (usiz < needlen))
ebdata+EB_IZVMS_HLEN, (ulg)csiz);
break;
default:
- free(ucdata);
+ izu_free(ucdata);
ucdata = NULL;
}
return ucdata;
__GDEF
slinkentry *slnk_entry;
{
+ int errno1 = 0;
+ int sts1;
+ int sts2;
extent ucsize = slnk_entry->targetlen;
char *linkfname = slnk_entry->fname;
- char *linktarget = (char *)malloc(ucsize+1);
+ char *linktarget = (char *)izu_malloc(ucsize+1);
+#ifdef WIN32
+ char err_msg[ 32];
+#endif /* def WIN32 */
+
+#ifdef VMS
+ static int vms_symlink_works = -1;
+
+ if (vms_symlink_works < 0)
+ {
+ /* Test symlink() with an invalid file name. If errno comes
+ * back ENOSYS ("Function not implemented"), then don't try to
+ * use it below on the symlink placeholder text files.
+ */
+ vms_symlink_works = symlink( "", "?");
+ if (errno == ENOSYS)
+ vms_symlink_works = 0;
+ else
+ vms_symlink_works = 1;
+ }
+#endif /* def VMS */
if (!linktarget) {
Info(slide, 0x201, ((char *)slide,
return;
}
linktarget[ucsize] = '\0';
- G.outfile = zfopen(linkfname, FOPR); /* open link placeholder for reading */
+ /* Open link placeholder for reading. */
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if (slnk_entry->wide)
+ {
+ G.outfile = zfopenw( (wchar_t *)linkfname, FOPR_W);
+ }
+ else
+ {
+#else /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+ {
+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) [else] */
+ G.outfile = zfopen( linkfname, FOPR);
+ }
/* Check that the following conditions are all fulfilled:
* a) the placeholder file exists,
* b) the placeholder file contains exactly "ucsize" bytes
* stored in the symlink control structure.
*/
if (!G.outfile ||
- fread(linktarget, 1, ucsize+1, G.outfile) != ucsize ||
- strcmp(slnk_entry->target, linktarget))
+ fread( linktarget, 1, (ucsize+ 1), G.outfile) != ucsize ||
+ strcmp( slnk_entry->target, linktarget))
{
Info(slide, 0x201, ((char *)slide,
LoadFarString(SymLnkWarnInvalid), FnFilter1(linkfname)));
- free(linktarget);
+ izu_free(linktarget);
if (G.outfile)
fclose(G.outfile);
return;
}
- fclose(G.outfile); /* close "data" file for good... */
- unlink(linkfname); /* ...and delete it */
- if (QCOND2)
+ fclose(G.outfile); /* Close "data" file for good... */
+
+#ifdef VMS
+ if (vms_symlink_works == 0)
+ {
Info(slide, 0, ((char *)slide, LoadFarString(SymLnkFinish),
FnFilter1(linkfname), FnFilter2(linktarget)));
- if (symlink(linktarget, linkfname)) /* create the real link */
- perror("symlink error");
- free(linktarget);
+ Info(slide, 0x401, ((char *)slide, LoadFarString(SymLnkError),
+ strerror( ENOSYS)));
+ izu_free(linktarget);
+ return;
+ }
+#endif /* def VMS */
+
+ /* Delete the old placeholder, and create the real symlink. */
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ sts1 = _wunlink( (wchar_t *)linkfname);
+ errno1 = errno;
+ sts2 = symlinkw( linktarget, (wchar_t *)linkfname, slnk_entry->is_dir);
+#else /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+ sts1 = unlink( linkfname);
+ errno1 = errno;
+ sts2 = symlink( linktarget, linkfname);
+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) [else] */
+
+ if (QCOND2 || (sts1 != 0) || (sts2 != 0))
+ {
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if (slnk_entry->wide)
+ {
+ Info(slide, 0, ((char *)slide, LoadFarString( SymLnkFinishW),
+ FnFilterW1( (ZCONST wchar_t *)linkfname),
+ FnFilter2( linktarget)));
+ }
+ else
+ {
+#else /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+ {
+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) [else] */
+
+ Info(slide, 0, ((char *)slide, LoadFarString(SymLnkFinish),
+ FnFilter1(linkfname), FnFilter2(linktarget)));
+ }
+ }
+
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+# define WIDE_STR (slnk_entry->wide ? "w" : "")
+#else
+# define WIDE_STR ""
+#endif
+ if (sts1 != 0)
+ {
+ Info( slide, 0x61, ((char *)slide, LoadFarString( SymLnkErrUnlink),
+ WIDE_STR, strerror( errno1)));
+ }
+ if (sts2 != 0)
+ {
+#ifdef WIN32
+ if (sts2 == 1314)
+ {
+ /* Insufficient privilege error. */
+ Info( slide, 0x61, ((char *)slide,
+ LoadFarString( SymLnkErrSymlinkPriv)));
+ }
+ else
+ {
+ /* Use "decimal (0xhexadecimal)" msg for GetLast Error() result. */
+ sprintf( err_msg, "%d (0x%x)", sts2, sts2);
+ Info( slide, 0x61, ((char *)slide,
+ LoadFarString( SymLnkErrSymlink), WIDE_STR, err_msg));
+ }
+#else /* def WIN32 */
+ /* Use normal C RTL message for errno. */
+ Info( slide, 0x61, ((char *)slide,
+ LoadFarString( SymLnkErrSymlink), WIDE_STR, strerror( errno)));
+#endif /* def WIN32 [else] */
+ }
+
+ izu_free(linktarget);
#ifdef SET_SYMLINK_ATTRIBS
set_symlnk_attribs(__G__ slnk_entry);
#endif
-/*************************/
-/* Function fnfilter() */ /* here instead of in list.c for SFX */
-/*************************/
+/****************************/
+/* Function fnfilter[w]() */ /* here instead of in list.c for SFX */
+/****************************/
+
+/*
+ * If Unicode is supported, assume we have what we need to do this
+ * check using wide characters, avoiding MBCS issues.
+ */
+
+#ifndef UZ_FNFILTER_REPLACECHAR
+ /* A convenient choice for the replacement of unprintable char codes is
+ * the "single char wildcard", as this character is quite unlikely to
+ * appear in filenames by itself. The following default definition
+ * sets the replacement char to a question mark as the most common
+ * "single char wildcard"; this setting should be overridden in the
+ * appropiate system-specific configuration header when needed.
+ */
+# define UZ_FNFILTER_REPLACECHAR '?'
+#endif
+
+#if defined( UNICODE_SUPPORT) && defined( _MBCS)
+
+/* fnfilterw() - Convert wide-character name to safely printable form. */
+
+wchar_t *fnfilterw( src, dst, siz)
+ ZCONST wchar_t *src; /* Pointer to source char (string). */
+ wchar_t *dst; /* Pointer to destination char (string). */
+ extent siz; /* Not used (!). */
+{
+ wchar_t *dsx = dst;
+
+ /* Filter the wide chars. */
+ while (*src)
+ {
+ if (iswprint( *src))
+ {
+ /* Printable code. Copy it. */
+ *dst++ = *src;
+ }
+ else
+ {
+ /* Unprintable code. Substitute something printable for it. */
+ if (*src < 32)
+ {
+ /* Replace ASCII control code with "^{letter}". */
+ *dst++ = (wchar_t)'^';
+ *dst++ = (wchar_t)(64 + *src);
+ }
+ else
+ {
+ /* Replace other unprintable code with the placeholder. */
+ *dst++ = (wchar_t)UZ_FNFILTER_REPLACECHAR;
+ }
+ }
+ src++;
+ }
+ *dst = (wchar_t)0; /* NUL-terminate the destination string. */
+ return dsx;
+}
-char *fnfilter(raw, space, size) /* convert name to safely printable form */
+#endif /* defined( UNICODE_SUPPORT) && defined( _MBCS) */
+
+
+
+/* fnfilter() - Convert name to safely printable form. */
+
+char *fnfilter(raw, space, size)
ZCONST char *raw;
uch *space;
extent size;
{
-#ifndef NATIVE /* ASCII: filter ANSI escape codes, etc. */
- ZCONST uch *r=(ZCONST uch *)raw;
- uch *s=space;
- uch *slim=NULL;
- uch *se=NULL;
+
+#ifndef NATIVE /* ASCII: filter ANSI escape codes, etc. */
+
+ ZCONST uch *r;
+ uch *s = space;
+ uch *slim = NULL;
+ uch *se = NULL;
int have_overflow = FALSE;
- if (size > 0) {
- slim = space + size
-#ifdef _MBCS
- - (MB_CUR_MAX - 1)
-#endif
- - 4;
+# if defined( UNICODE_SUPPORT) && defined( _MBCS)
+/* If Unicode support is enabled, and we have multi-byte characters,
+ * then do the isprint() checks by first converting to wide characters
+ * and checking those. This avoids our having to parse multi-byte
+ * characters for ourselves. After the wide-char replacements have been
+ * made, the wide string is converted back to the local character set.
+ */
+ wchar_t *wstring; /* wchar_t version of raw */
+ size_t wslen; /* length of wstring */
+ wchar_t *wostring; /* wchar_t version of output string */
+ size_t woslen; /* length of wostring */
+ char *newraw; /* new raw */
+
+ /* 2012-11-06 SMS.
+ * Changed to check the value returned by mbstowcs(), and bypass the
+ * Unicode processing if it fails. This seems to fix a problem
+ * reported in the SourceForge forum, but it's not clear that we
+ * should be doing any Unicode processing without some evidence that
+ * the name actually is Unicode. (Check bit 11 in the flags before
+ * coming here?)
+ * http://sourceforge.net/p/infozip/bugs/40/
+ */
+
+ if (MB_CUR_MAX <= 1)
+ {
+ /* There's no point to converting multi-byte chars if there are
+ * no multi-byte chars.
+ */
+ wslen = (size_t)-1;
}
- while (*r) {
- if (size > 0 && s >= slim && se == NULL) {
- se = s;
+ else
+ {
+ /* Get Unicode wide character count (for storage allocation). */
+ wslen = mbstowcs( NULL, raw, 0);
+ }
+
+ if (wslen != (size_t)-1)
+ {
+ /* Apparently valid Unicode. Allocate wide-char storage. */
+ wstring = (wchar_t *)izu_malloc((wslen + 1) * sizeof(wchar_t));
+ if (wstring == NULL) {
+ strcpy( (char *)space, raw);
+ return (char *)space;
}
-#ifdef QDOS
- if (qlflag & 2) {
- if (*r == '/' || *r == '.') {
+ wostring = (wchar_t *)izu_malloc(2 * (wslen + 1) * sizeof(wchar_t));
+ if (wostring == NULL) {
+ izu_free(wstring);
+ strcpy( (char *)space, raw);
+ return (char *)space;
+ }
+
+ /* Convert the multi-byte Unicode to wide chars. */
+ wslen = mbstowcs(wstring, raw, wslen + 1);
+
+ /* Filter the wide-character string. */
+ fnfilterw( wstring, wostring, (2 * (wslen + 1) * sizeof(wchar_t)));
+
+ /* Convert filtered wide chars back to multi-byte. */
+ woslen = wcstombs( NULL, wostring, 0);
+ if ((newraw = izu_malloc(woslen + 1)) == NULL) {
+ izu_free(wstring);
+ izu_free(wostring);
+ strcpy( (char *)space, raw);
+ return (char *)space;
+ }
+ woslen = wcstombs( newraw, wostring, (woslen * MB_CUR_MAX) + 1);
+
+ if (size > 0) {
+ slim = space + size - 4;
+ }
+ r = (ZCONST uch *)newraw;
+ while (*r) {
+ if (size > 0 && s >= slim && se == NULL) {
+ se = s;
+ }
+# ifdef QDOS
+ if (qlflag & 2) {
+ if (*r == '/' || *r == '.') {
+ if (se != NULL && (s > (space + (size-3)))) {
+ have_overflow = TRUE;
+ break;
+ }
+ ++r;
+ *s++ = '_';
+ continue;
+ }
+ } else
+# endif
+ {
if (se != NULL && (s > (space + (size-3)))) {
have_overflow = TRUE;
break;
}
- ++r;
- *s++ = '_';
- continue;
+ *s++ = *r++;
}
- } else
-#endif
-#ifdef HAVE_WORKING_ISPRINT
-# ifndef UZ_FNFILTER_REPLACECHAR
- /* A convenient choice for the replacement of unprintable char codes is
- * the "single char wildcard", as this character is quite unlikely to
- * appear in filenames by itself. The following default definition
- * sets the replacement char to a question mark as the most common
- * "single char wildcard"; this setting should be overridden in the
- * appropiate system-specific configuration header when needed.
- */
-# define UZ_FNFILTER_REPLACECHAR '?'
+ }
+ if (have_overflow) {
+ strcpy((char *)se, "...");
+ } else {
+ *s = '\0';
+ }
+
+ izu_free(wstring);
+ izu_free(wostring);
+ izu_free(newraw);
+ }
+ else
+# endif /* defined( UNICODE_SUPPORT) && defined( _MBCS) */
+ {
+ /* No Unicode support, or apparently invalid Unicode. */
+ r = (ZCONST uch *)raw;
+
+ if (size > 0) {
+ slim = space + size
+# ifdef _MBCS
+ - (MB_CUR_MAX - 1)
+# endif
+ - 4;
+ }
+ while (*r) {
+ if (size > 0 && s >= slim && se == NULL) {
+ se = s;
+ }
+# ifdef QDOS
+ if (qlflag & 2) {
+ if (*r == '/' || *r == '.') {
+ if (se != NULL && (s > (space + (size-3)))) {
+ have_overflow = TRUE;
+ break;
+ }
+ ++r;
+ *s++ = '_';
+ continue;
+ }
+ } else
# endif
- if (!isprint(*r)) {
+# ifdef HAVE_WORKING_ISPRINT
+ if (!isprint(*r)) {
+ if (*r < 32) {
+ /* ASCII control codes are escaped as "^{letter}". */
+ if (se != NULL && (s > (space + (size-4)))) {
+ have_overflow = TRUE;
+ break;
+ }
+ *s++ = '^', *s++ = (uch)(64 + *r++);
+ } else {
+ /* Other unprintable codes are replaced by the
+ * placeholder character. */
+ if (se != NULL && (s > (space + (size-3)))) {
+ have_overflow = TRUE;
+ break;
+ }
+ *s++ = UZ_FNFILTER_REPLACECHAR;
+ INCSTR(r);
+ }
+# else /* !HAVE_WORKING_ISPRINT */
if (*r < 32) {
/* ASCII control codes are escaped as "^{letter}". */
if (se != NULL && (s > (space + (size-4)))) {
break;
}
*s++ = '^', *s++ = (uch)(64 + *r++);
+# endif /* ?HAVE_WORKING_ISPRINT */
} else {
- /* Other unprintable codes are replaced by the
- * placeholder character. */
+# ifdef _MBCS
+ unsigned i = CLEN(r);
+ if (se != NULL && (s > (space + (size-i-2)))) {
+ have_overflow = TRUE;
+ break;
+ }
+ for (; i > 0; i--)
+ *s++ = *r++;
+# else /* def _MBCS */
if (se != NULL && (s > (space + (size-3)))) {
have_overflow = TRUE;
break;
}
- *s++ = UZ_FNFILTER_REPLACECHAR;
- INCSTR(r);
- }
-#else /* !HAVE_WORKING_ISPRINT */
- if (*r < 32) {
- /* ASCII control codes are escaped as "^{letter}". */
- if (se != NULL && (s > (space + (size-4)))) {
- have_overflow = TRUE;
- break;
- }
- *s++ = '^', *s++ = (uch)(64 + *r++);
-#endif /* ?HAVE_WORKING_ISPRINT */
- } else {
-#ifdef _MBCS
- unsigned i = CLEN(r);
- if (se != NULL && (s > (space + (size-i-2)))) {
- have_overflow = TRUE;
- break;
- }
- for (; i > 0; i--)
*s++ = *r++;
-#else
- if (se != NULL && (s > (space + (size-3)))) {
- have_overflow = TRUE;
- break;
- }
- *s++ = *r++;
-#endif
- }
- }
- if (have_overflow) {
- strcpy((char *)se, "...");
- } else {
- *s = '\0';
+# endif /* def _MBCS [else] */
+ }
+ }
+ if (have_overflow) {
+ strcpy((char *)se, "...");
+ } else {
+ *s = '\0';
+ }
}
-#ifdef WINDLL
+# ifdef WINDLL
INTERN_TO_ISO((char *)space, (char *)space); /* translate to ANSI */
-#else
-#if (defined(WIN32) && !defined(_WIN32_WCE))
+# else
+# if defined(WIN32) && !defined(_WIN32_WCE)
/* Win9x console always uses OEM character coding, and
WinNT console is set to OEM charset by default, too */
INTERN_TO_OEM((char *)space, (char *)space);
-#endif /* (WIN32 && !_WIN32_WCE) */
-#endif /* ?WINDLL */
+# endif /* (WIN32 && !_WIN32_WCE) */
+# endif /* ?WINDLL */
return (char *)space;
-#else /* NATIVE: EBCDIC or whatever */
+#else /* def NATIVE */ /* EBCDIC or whatever. */
return (char *)raw;
-#endif
+#endif /* def NATIVE [else] */
} /* end function fnfilter() */
/* return namecmp((*(direntry **)b)->fn, (*(direntry **)a)->fn); */
}
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static int Cdecl dircompw(a, b) /* used by qsort(); swiped from Zip */
+ ZCONST zvoid *a, *b;
+{
+ /* order is significant: this sorts in reverse order (deepest first) */
+ return wcscmp((*(direntryw **)b)->fnw, (*(direntryw **)a)->fnw);
+ /* return namecmp((*(direntry **)b)->fn, (*(direntry **)a)->fn); */
+}
+# endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
+
#endif /* SET_DIR_ATTRIB */
-#ifdef USE_BZIP2
+#ifdef BZIP2_SUPPORT
/**************************/
/* Function UZbunzip2() */
/**************************/
-int UZbunzip2(__G)
+static int UZbunzip2(__G)
__GDEF
/* decompress a bzipped entry using the libbz2 routines */
{
int repeated_buf_err;
bz_stream bstrm;
-#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
+#if defined(DLL) && !defined(NO_SLIDE_REDIR)
if (G.redirect_slide)
wsize = G.redirect_size, redirSlide = G.redirect_buffer;
else
if (err == BZ_MEM_ERROR)
return 3;
+#ifdef Tracing /* 2012-12-03 SMS. Avoid complaints about empty if(). */
else if (err != BZ_OK)
Trace((stderr, "oops! (BZ2_bzDecompressInit() err = %d)\n", err));
+#endif /* def Tracing */
}
#ifdef FUNZIP
while (err != BZ_STREAM_END) {
#else /* !FUNZIP */
while (G.csize > 0) {
- Trace((stderr, "first loop: G.csize = %ld\n", G.csize));
+ Trace((stderr, "first loop: G.csize = %s\n",
+ FmZofft( G.csize, NULL, "u")));
#endif /* ?FUNZIP */
while (bstrm.avail_out > 0) {
err = BZ2_bzDecompress(&bstrm);
retval = 2; goto uzbunzip_cleanup_exit;
} else if (err == BZ_MEM_ERROR) {
retval = 3; goto uzbunzip_cleanup_exit;
- } else if (err != BZ_OK && err != BZ_STREAM_END)
+ }
+#ifdef Tracing /* 2012-12-03 SMS. Avoid complaints about empty if(). */
+ else if (err != BZ_OK && err != BZ_STREAM_END)
Trace((stderr, "oops! (bzip(first loop) err = %d)\n", err));
+#endif /* def Tracing */
#ifdef FUNZIP
if (err == BZ_STREAM_END) /* "END-of-entry-condition" ? */
uzbunzip_cleanup_exit:
err = BZ2_bzDecompressEnd(&bstrm);
+#ifdef Tracing /* 2012-12-03 SMS. Avoid complaints about empty if(). */
if (err != BZ_OK)
Trace((stderr, "oops! (BZ2_bzDecompressEnd() err = %d)\n", err));
+#endif /* def Tracing */
return retval;
} /* end function UZbunzip2() */
-#endif /* USE_BZIP2 */
+#endif /* BZIP2_SUPPORT */
+
+
+#if defined( LZMA_SUPPORT) || defined( PPMD_SUPPORT)
+
+#include "szip/Types.h"
+
+/* 2011-12-24 SMS.
+ * 7-ZIP offers memory allocation functions with diagnostics conditional
+ * on _SZ_ALLOC_DEBUG: szip/Alloc.c: MyAlloc(), MyFree(). Using these
+ * functions complicates linking with separately conditional LZMA and
+ * PPMd support, so it's easier to use plain malloc() and free() here,
+ * or else add the diagnostic messages to these Sz* functions, rather
+ * than drag szip/Alloc.c into the picture. To use the szip/Alloc.c
+ * functions, add
+ * #include "szip/Alloc.h"
+ * above, change malloc() and free() below to MyAlloc() and MyFree(),
+ * and add szip/Alloc.* back to the builders. (And then solve the other
+ * problems.)
+ */
+void *SzAlloc(void *p, size_t size) { p = p; return izu_malloc(size); }
+void SzFree(void *p, void *address) { p = p; izu_free(address); }
+#endif /* defined( LZMA_SUPPORT) || defined( PPMD_SUPPORT) */
+
+
+#ifdef LZMA_SUPPORT
+
+#include "szip/LzmaDec.h"
+
+/***********************/
+/* Function UZlzma() */
+/***********************/
+
+/* Notes:
+ * Capitalized types (like "SRes") or "SZ_*" macros (like SZ_OK) are
+ * probably defined in a 7-ZIP header file.
+ */
+
+static int UZlzma(__G)
+__GDEF
+/* Decompress an LZMA-compressed entry using the LZMA routines. */
+{
+ SRes sts;
+ ELzmaStatus sts2;
+ ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
+
+ SizeT avail_in;
+ SizeT avail_out;
+ unsigned char *next_in;
+ unsigned char *next_out;
+
+ /* Bidirectional arguments for LzmaDec_DecodeToBuf(). */
+ SizeT in_buf_size_len; /* Buffer size (in), buffer used (out). */
+ SizeT out_buf_size_len; /* Buffer size (in), buffer filled (out). */
+
+ /* LZMA Header. */
+ unsigned char lzma_version_major; /* LZMA version (major). */
+ unsigned char lzma_version_minor; /* LZMA version (minor). */
+ unsigned short lzma_props_len; /* Properties length. */
+ unsigned char lzma_props[ LZMA_PROPS_SIZE]; /* LMZA properties. */
+ int b;
+
+ zusz_t ucsize_lzma; /* LZMA uncompressed bytes left to put out. */
+
+ /* Initialize 7-Zip (LZMA, PPMd) memory allocation function pointer
+ * structure (once).
+ */
+ if ((G.g_Alloc.Alloc == NULL) || (G.g_Alloc.Free == NULL))
+ {
+ G.g_Alloc.Alloc = SzAlloc;
+ G.g_Alloc.Free = SzFree;
+ }
+
+ /* Uncompressed bytes to put out. */
+ ucsize_lzma = G.lrec.ucsize;
+
+ /* Extract LZMA version (curiosity) and properties length (crucial). */
+ if ((b = NEXTBYTE) == EOF)
+ return PK_ERR;
+ lzma_version_major = b;
+ if ((b = NEXTBYTE) == EOF)
+ return PK_ERR;
+ lzma_version_minor = b;
+ if ((b = NEXTBYTE) == EOF)
+ return PK_ERR;
+ lzma_props[ 0] = b;
+ if ((b = NEXTBYTE) == EOF)
+ return PK_ERR;
+ lzma_props[ 1] = b;
+ lzma_props_len = makeword( lzma_props);
+
+ /* LZMA properties length must match, or we're in big trouble. */
+ if (lzma_props_len != LZMA_PROPS_SIZE)
+ return PK_ERR;
+
+ /* Save the actual LZMA properties. */
+ for (lzma_props_len = 0; lzma_props_len < LZMA_PROPS_SIZE; lzma_props_len++)
+ {
+ if ((b = NEXTBYTE) == EOF)
+ break;
+ lzma_props[ lzma_props_len] = b;
+ }
+ if (lzma_props_len != LZMA_PROPS_SIZE)
+ return PK_ERR;
+
+ sts = LzmaProps_Decode( &G.clzma_props, lzma_props, LZMA_PROPS_SIZE);
+
+ Trace(( stderr,
+ "LzmaProps_Decode() = %d, dicSize = %u, lc = %u, lp = %u, pb = %u.\n",
+ sts, G.clzma_props.dicSize, G.clzma_props.lc,
+ G.clzma_props.lp, G.clzma_props.pb));
+
+ /* Verbose test (-tv) information. */
+ if (uO.tflag && uO.vflag)
+ {
+ Info( slide, 0, ((char *)slide, LoadFarString( InfoMsgLZMA),
+ G.clzma_props.dicSize, G.clzma_props.lc,
+ G.clzma_props.lp, G.clzma_props.pb));
+ }
+
+ /* Require valid LZMA properties. */
+ if (sts != SZ_OK)
+ return PK_ERR;
+
+ /* Set up LZMA decode. */
+ LzmaDec_Construct( &G.state_lzma);
+ sts = LzmaDec_Allocate( &G.state_lzma, lzma_props,
+ LZMA_PROPS_SIZE, &G.g_Alloc);
+
+ if (sts != SZ_OK)
+ {
+ return PK_MEM3;
+ }
+
+ LzmaDec_Init( &G.state_lzma);
+
+#if defined(DLL) && !defined(NO_SLIDE_REDIR)
+ if (G.redirect_slide)
+ wsize = G.redirect_size, redirSlide = G.redirect_buffer;
+ else
+ wsize = WSIZE, redirSlide = slide;
+#endif
+
+ next_out = redirSlide;
+ avail_out = wsize;
+ next_in = G.inptr;
+ avail_in = G.incnt;
+ sts2 = -1;
+
+ while ((sts == SZ_OK) &&
+ (sts2 != LZMA_STATUS_FINISHED_WITH_MARK) &&
+ (sts2 != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK))
+ {
+ in_buf_size_len = avail_in;
+ out_buf_size_len = avail_out;
+ if (ucsize_lzma <= out_buf_size_len)
+ {
+ /* Expecting this to be the last decode operation. */
+ finishMode = LZMA_FINISH_END;
+ out_buf_size_len = (SizeT)ucsize_lzma;
+ }
+
+ sts = LzmaDec_DecodeToBuf( &G.state_lzma, next_out, &out_buf_size_len,
+ next_in, &in_buf_size_len, finishMode, &sts2);
+ avail_in -= in_buf_size_len; /* Input unused. */
+ avail_out -= out_buf_size_len; /* Output unused. */
+
+ /* Flush the output (slide[]). */
+ if ((sts = FLUSH( wsize- avail_out)) != 0)
+ goto uzlzma_cleanup_exit;
+ Trace((stderr, "inside loop: flushing %ld bytes (ptr diff = %ld)\n",
+ (unsigned long)(wsize- avail_out),
+ (unsigned long)(next_out- redirSlide)));
+
+ /* Decrement bytes-left-to-put-out count. */
+ ucsize_lzma -= (wsize- avail_out);
+
+ next_out = redirSlide;
+ avail_out = wsize;
+
+ if ((sts2 != LZMA_STATUS_FINISHED_WITH_MARK) &&
+ (sts2 != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK))
+ {
+ if (avail_in == 0)
+ {
+ if (fillinbuf(__G) == 0)
+ {
+ /* No "END-condition" yet, but no more data. */
+ sts = PK_ERR; goto uzlzma_cleanup_exit;
+ }
+
+ next_in = G.inptr;
+ avail_in = G.incnt;
+ }
+ else
+ {
+ next_in += in_buf_size_len;
+ }
+ Trace((stderr, " avail_in = %lu\n", (unsigned long)avail_in));
+ }
+ } /* while ((G.csize > 0) || (G.incnt > 0)) */
+
+uzlzma_cleanup_exit:
+
+ LzmaDec_Free( &G.state_lzma, &G.g_Alloc);
+
+ return sts;
+}
+#endif /* def LZMA_SUPPORT */
+
+
+#ifdef PPMD_SUPPORT
+
+#include "szip/Ppmd8.h"
+
+/* 7-Zip-compatible I/O Read function. */
+static Byte ppmd_read_byte( void *pp)
+{
+ int b;
+
+ /* 2012-03-17 SMS.
+ * Note that if REENTRANT and USETHREADID are defined (globals.h),
+ * then GETGLOBALS() is actually a function call, to
+ * getGlobalPointer(). It might be smarter to add a "G" pointer to
+ * the CByteInToLook structure (done), set it once (done), and then
+ * use it here (not done), instead of calling getGlobalPointer() for
+ * every byte fetched. (Add a "G" parameter to NEXTBYTE?)
+ */
+ CByteInToLook *p = (CByteInToLook *)pp;
+ GETGLOBALS();
+
+ b = NEXTBYTE;
+ if (b == EOF)
+ {
+ p->extra = True;
+ p->res = SZ_ERROR_INPUT_EOF;
+ b = 0;
+ }
+ return b;
+}
+
+
+/***********************/
+/* Function UZppmd() */
+/***********************/
+
+static int UZppmd(__G)
+__GDEF
+/* Decompress a PPMd-compressed entry using the PPMd routines. */
+{
+ int sts;
+ int sts2;
+
+ unsigned avail_out; /* Output buffer size. */
+ unsigned char *next_out; /* Output buffer pointer. */
+
+ /* PPMd Header. */
+ unsigned char ppmd_props[ 2]; /* PPMd properties. */
+ unsigned short ppmd_prop_word;
+ int b;
+
+ /* PPMd parameters. */
+ unsigned order;
+ unsigned memSize;
+ unsigned restor;
+
+ /* Initialize 7-Zip (LZMA, PPMd) memory allocation function pointer
+ * structure (once).
+ */
+
+ if ((G.g_Alloc.Alloc == NULL) || (G.g_Alloc.Free == NULL))
+ {
+ G.g_Alloc.Alloc = SzAlloc;
+ G.g_Alloc.Free = SzFree;
+ }
+
+ /* Initialize PPMd8 structure (once). */
+ if (G.ppmd_constructed == 0)
+ {
+ Ppmd8_Construct( &G.ppmd8);
+ G.ppmd_constructed = 1;
+ }
+
+ /* Initialize simulated 7-Zip I/O structure. */
+ G.szios.p.Read = ppmd_read_byte;
+ G.szios.extra = False;
+ G.szios.res = SZ_OK;
+ G.szios.pG = &G;
+
+ sts = 0;
+ /* Extract PPMd properties. */
+ if ((b = NEXTBYTE) == EOF)
+ return PK_ERR;
+ ppmd_props[ 0] = b;
+ if ((b = NEXTBYTE) == EOF)
+ return PK_ERR;
+ ppmd_props[ 1] = b;
+ ppmd_prop_word = makeword( ppmd_props);
+
+/* wPPMd = (Model order - 1) +
+ * ((Sub-allocator size - 1) << 4) +
+ * (Model restoration method << 12)
+ *
+ * 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
+ * Mdl_Res_Mth ___Sub-allocator_size-1 Mdl_Order-1
+ */
+ order = (ppmd_prop_word& 0xf)+ 1;
+ memSize = ((ppmd_prop_word>> 4)& 0xff)+ 1;
+ restor = (ppmd_prop_word>> 12);
+
+ /* Verbose test (-tv) information. */
+ if (uO.tflag && uO.vflag)
+ {
+ Info( slide, 0, ((char *)slide, LoadFarString( InfoMsgPPMd),
+ ppmd_prop_word, order, memSize, restor));
+ }
+
+ /* Convert archive MB value into raw byte value. */
+ memSize <<= 20;
+
+ if ((order < PPMD8_MIN_ORDER) || (order > PPMD8_MAX_ORDER))
+ return PK_ERR;
+
+ if (!Ppmd8_Alloc( &G.ppmd8, memSize, &G.g_Alloc))
+ return PK_MEM3;
+
+ G.ppmd8.Stream.In = &G.szios.p;
+
+ sts = Ppmd8_RangeDec_Init( &G.ppmd8);
+ if (!sts)
+ return PK_ERR;
+ else if (G.szios.extra)
+ sts = ((G.szios.res != SZ_OK) ? G.szios.res : SZ_ERROR_DATA);
+ else
+ {
+ int sym;
+
+ Ppmd8_Init( &G.ppmd8, order, restor);
+
+#if defined(DLL) && !defined(NO_SLIDE_REDIR)
+ if (G.redirect_slide) {
+ wsize = G.redirect_size; redirSlide = G.redirect_buffer;
+ } else {
+ wsize = WSIZE; redirSlide = slide;
+ }
+#endif
+
+ sym = 0;
+ while ((sym >= 0) && (G.szios.extra == 0))
+ {
+ /* Reset output buffer pointer. */
+ next_out = redirSlide;
+
+ /* Decode input to fill the output buffer. */
+ for (avail_out = wsize; avail_out > 0; avail_out--)
+ {
+ sym = Ppmd8_DecodeSymbol( &G.ppmd8);
+ if (G.szios.extra || sym < 0)
+ break;
+ *(next_out++) = sym;
+ }
+
+ /* Flush the output (slide[]). */
+ if ((sts = FLUSH( wsize- avail_out)) != 0)
+ goto uzppmd_cleanup_exit;
+ Trace((stderr,
+ "inside loop: flushing %ld bytes (ptr diff = %ld)\n",
+ (unsigned long)(wsize- avail_out),
+ (unsigned long)(next_out- redirSlide)));
+ }
+
+ if (G.szios.extra)
+ {
+ /* Insufficient input data. */
+ sts = PK_ERR;
+ }
+ else if ((sym < 0) && (sym != -1))
+ {
+ /* Invalid end of input data? */
+ sts = PK_ERR;
+ }
+ else
+ {
+ sts2 = Ppmd8_RangeDec_IsFinishedOK( &G.ppmd8);
+ if (sts2 == 0)
+ {
+ sts = PK_ERR;
+ }
+ }
+ }
+
+uzppmd_cleanup_exit:
+
+ Ppmd8_Free( &G.ppmd8, &G.g_Alloc);
+
+ return sts;
+}
+#endif /* def PPMD_SUPPORT */
-Info-ZIP's UnZip 6.0: generic C sources
- Complete C source code for Info-ZIP's
- PKUNZIP-compatible .zip extractor, for
- all supported compilers and platforms
- (Unix, OS/2, MS-DOS, NT, VMS, Amiga,
- Atari, Mac, Acorn, VM/CMS, etc.), plus
- lots of pretty decent documentation.
+Info-ZIP UnZip 6.1 - Source and doc kit.
+ UnZip is a .zip archive extractor,
+ generally PKUNZIP-compatible, and widely
+ portable (tested most on Unix (including
+ Mac OS X), VMS, and Windows, but with
+ OS-specific code for many others). Written
+ in C (with some asm on some system types).
This is FREE (but copyrighted) software.
See LICENSE for details on distribution
and reuse.
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
readbyte()
fillinbuf()
seek_zipf()
+ fgets_ans()
flush() (non-VMS)
is_vms_varlen_txt() (non-VMS, VMS_TEXT_CONV only)
disk_error() (non-VMS)
dos_to_unix_time() (non-VMS, non-VM/CMS, non-MVS)
check_for_newer() (non-VMS, non-OS/2, non-VM/CMS, non-MVS)
do_string()
+ name_only() (non-VMS, ...?)
makeword()
makelong()
makeint64()
#define __FILEIO_C /* identifies this source module */
#define UNZIP_INTERNAL
#include "unzip.h"
+#ifdef DLL
+# include "api.h"
+#endif /* def DLL */
#ifdef WINDLL
-# ifdef POCKET_UNZIP
-# include "wince/intrface.h"
-# else
-# include "windll/windll.h"
-# endif
-# include <setjmp.h>
+# ifdef POCKET_UNZIP
+# include "wince/intrface.h"
+# else
+# include "windll/windll.h"
+# endif
+# include <setjmp.h>
#endif
#include "crc32.h"
#include "crypt.h"
#include "ttyio.h"
+#if defined( UNIX) && defined( __APPLE__)
+# include "unix/macosx.h"
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
/* setup of codepage conversion for decryption passwords */
-#if CRYPT
-# if (defined(CRYP_USES_ISO2OEM) && !defined(IZ_ISO2OEM_ARRAY))
-# define IZ_ISO2OEM_ARRAY /* pull in iso2oem[] table */
-# endif
-# if (defined(CRYP_USES_OEM2ISO) && !defined(IZ_OEM2ISO_ARRAY))
-# define IZ_OEM2ISO_ARRAY /* pull in oem2iso[] table */
-# endif
-#endif
+#ifdef IZ_CRYPT_ANY
+# if (defined(CRYP_USES_ISO2OEM) && !defined(IZ_ISO2OEM_ARRAY))
+# define IZ_ISO2OEM_ARRAY /* pull in iso2oem[] table */
+# endif
+# if (defined(CRYP_USES_OEM2ISO) && !defined(IZ_OEM2ISO_ARRAY))
+# define IZ_OEM2ISO_ARRAY /* pull in oem2iso[] table */
+# endif
+#endif /* def IZ_CRYPT_ANY */
#include "ebcdic.h" /* definition/initialization of ebcdic[] */
buffers are that big).
*/
#ifdef WINDLL
-# define WriteError(buf,len,strm) \
+# define WriteError(buf,len,strm) \
(win_fprintf(pG, strm, (extent)len, (char far *)buf) != (int)(len))
#else /* !WINDLL */
-# ifdef USE_FWRITE
-# define WriteError(buf,len,strm) \
- ((extent)fwrite((char *)(buf),1,(extent)(len),strm) != (extent)(len))
-# else
-# define WriteError(buf,len,strm) \
- ((extent)write(fileno(strm),(char *)(buf),(extent)(len)) != (extent)(len))
-# endif
+# ifdef USE_FWRITE
+# define WriteError(buf,len,strm) \
+ ((extent)fwrite((char *)(buf),1,(extent)(len),strm) != (extent)(len))
+# else
+# define WriteError(buf,len,strm) \
+ ((extent)write(fileno(strm),(char *)(buf),(extent)(len)) != (extent)(len))
+# endif
#endif /* ?WINDLL */
/*
out a record (only) when it sees a newline.
*/
#ifdef VMS
-# define WriteTxtErr(buf,len,strm) \
+# define WriteTxtErr(buf,len,strm) \
((extent)fprintf(strm, "%.*s", len, buf) != (extent)(len))
#else
-# define WriteTxtErr(buf,len,strm) WriteError(buf,len,strm)
+# define WriteTxtErr(buf,len,strm) WriteError(buf,len,strm)
#endif
-#if (defined(USE_DEFLATE64) && defined(__16BIT__))
+#if (defined(DEFLATE64_SUPPORT) && defined(__16BIT__))
static int partflush OF((__GPRO__ uch *rawbuf, ulg size, int unshrink));
#endif
#ifdef VMS_TEXT_CONV
-static int is_vms_varlen_txt OF((__GPRO__ uch *ef_buf, unsigned ef_len));
+static int is_vms_varlen_txt OF((__GPRO__ uch *ef_buf, long ef_len));
#endif
static int disk_error OF((__GPRO));
static ZCONST char Far CannotOpenZipfile[] =
"error: cannot open zipfile [ %s ]\n %s\n";
-#if (!defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS))
-#if (!defined(TANDEM))
-#if (defined(ATH_BEO_THS_UNX) || defined(DOS_FLX_NLM_OS2_W32))
- static ZCONST char Far CannotDeleteOldFile[] =
- "error: cannot delete old %s\n %s\n";
-#ifdef UNIXBACKUP
- static ZCONST char Far CannotRenameOldFile[] =
- "error: cannot rename old %s\n %s\n";
- static ZCONST char Far BackupSuffix[] = "~";
-#endif
-#endif /* ATH_BEO_THS_UNX || DOS_FLX_NLM_OS2_W32 */
-#ifdef NOVELL_BUG_FAILSAFE
- static ZCONST char Far NovellBug[] =
- "error: %s: stat() says does not exist, but fopen() found anyway\n";
-#endif
- static ZCONST char Far CannotCreateFile[] =
- "error: cannot create %s\n %s\n";
-#endif /* !TANDEM */
-#endif /* !VMS && !AOS_VS && !CMS_MVS && !MACOS */
+#if !defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS)
+# ifndef TANDEM
+# if defined(ATH_BEO_THS_UNX) || defined(DOS_FLX_NLM_OS2_W32)
+static ZCONST char Far CannotDeleteOldFile[] =
+ "error: cannot delete old %s\n %s\n";
+# ifdef UNIXBACKUP
+static ZCONST char Far CannotRenameOldFile[] =
+ "error: cannot rename old %s\n %s\n";
+static ZCONST char Far BackupSuffix[] = "~";
+# endif /* def UNIXBACKUP */
+# endif /* defined(ATH_BEO_THS_UNX) || defined(DOS_FLX_NLM_OS2_W32) */
+# ifdef NOVELL_BUG_FAILSAFE
+static ZCONST char Far NovellBug[] =
+ "error: %s: stat() says does not exist, but fopen() found anyway\n";
+# endif /* def NOVELL_BUG_FAILSAFE */
+static ZCONST char Far CannotCreateFile[] =
+ "error: cannot create %s\n %s\n";
+# endif /* ndef TANDEM */
+#endif /* !defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS) */
static ZCONST char Far ReadError[] = "error: zipfile read error\n";
static ZCONST char Far FilenameTooLongTrunc[] =
"warning: filename too long--truncating.\n";
+
#ifdef UNICODE_SUPPORT
- static ZCONST char Far UFilenameTooLongTrunc[] =
- "warning: Converted unicode filename too long--truncating.\n";
-#endif
+static ZCONST char Far UFilenameTooLongTrunc[] =
+ "warning: Converted unicode filename too long--truncating.\n";
+#endif /* def UNICODE_SUPPORT */
+
static ZCONST char Far ExtraFieldTooLong[] =
- "warning: extra field too long (%d). Ignoring...\n";
+ "warning: extra field too long (%d). Ignoring...\n";
+static ZCONST char Far DiskFullMsg[] =
+ "%s: write error (disk full?).\n";
-#ifdef WINDLL
- static ZCONST char Far DiskFullQuery[] =
- "%s: write error (disk full?).\n";
-#else
- static ZCONST char Far DiskFullQuery[] =
- "%s: write error (disk full?). Continue? (y/n/^C) ";
- static ZCONST char Far ZipfileCorrupt[] =
- "error: zipfile probably corrupt (%s)\n";
-# ifdef SYMLINKS
- static ZCONST char Far FileIsSymLink[] =
- "%s exists and is a symbolic link%s.\n";
-# endif
-# ifdef MORE
- static ZCONST char Far MorePrompt[] = "--More--(%lu)";
-# endif
- static ZCONST char Far QuitPrompt[] =
- "--- Press `Q' to quit, or any other key to continue ---";
- static ZCONST char Far HidePrompt[] = /* "\r \r"; */
- "\r \r";
-# if CRYPT
-# ifdef MACOS
+#ifdef SYMLINKS
+static ZCONST char Far FileIsSymLink[] =
+ "%s exists and is a symbolic link%s.\n";
+#endif /* def SYMLINKS */
+
+#if !defined( WINDLL) && defined( I_O_ERROR_QUERY) && defined( STDIN_ISATTY)
+# define USE_I_O_ERROR_QUERY
+#endif
+
+#ifdef USE_I_O_ERROR_QUERY
+static ZCONST char Far DiskFullQuery[] =
+ "%s: write error (disk full?). Continue? (y/n/^C) ";
+#endif /* def USE_I_O_ERROR_QUERY */
+
+#ifndef WINDLL
+static ZCONST char Far ZipfileCorrupt[] =
+ "error: zipfile probably corrupt (%s)\n";
+# ifdef MORE
+static ZCONST char Far MorePrompt[] = "--More--(%lu)";
+# endif /* def MORE */
+static ZCONST char Far QuitPrompt[] =
+ "--- Press `Q' to quit, or any other key to continue ---";
+static ZCONST char Far HidePrompt[] = /* (Match max prompt length.) */
+ "\r \r";
+# ifdef IZ_CRYPT_ANY
+# ifdef MACOS
/* SPC: are names on MacOS REALLY so much longer than elsewhere ??? */
- static ZCONST char Far PasswPrompt[] = "[%s]\n %s password: ";
-# else
- static ZCONST char Far PasswPrompt[] = "[%s] %s password: ";
-# endif
- static ZCONST char Far PasswPrompt2[] = "Enter password: ";
- static ZCONST char Far PasswRetry[] = "password incorrect--reenter: ";
-# endif /* CRYPT */
-#endif /* !WINDLL */
+static ZCONST char Far PasswPrompt[] = "[%s]\n %s password: ";
+# else /* def MACOS */
+static ZCONST char Far PasswPrompt[] = "[%s] %s password: ";
+# endif /* def MACOS [else] */
+static ZCONST char Far PasswPrompt2[] = "Enter password: ";
+static ZCONST char Far PasswRetry[] = "password incorrect--reenter: ";
+# endif /* def IZ_CRYPT_ANY */
+#endif /* ndef WINDLL */
+#if defined( UNIX) && defined( __APPLE__)
+static ZCONST char MemAllocFailed[] =
+ "error: cannot allocate AplDbl attrib memory (loc: %d, bytes: %d).\n";
+static ZCONST char SetattrlistFailed[] =
+ "\nsetattrlist(fndr) failure (errno = %d): %s";
+# ifdef APPLE_XATTR
+static ZCONST char SetxattrFailed[] =
+ "\nsetxattr() failure (errno = %d): %s";
+# endif /* def APPLE_XATTR */
+#endif /* defined( UNIX) && defined( __APPLE__) */
#ifdef VMS
G.zipfd = open(G.zipfn, O_RDONLY, 0, OPNZIP_RMS_ARGS);
-#else /* !VMS */
-#ifdef MACOS
+#else /* def VMS */
+# ifdef MACOS
G.zipfd = open(G.zipfn, 0);
-#else /* !MACOS */
-#ifdef CMS_MVS
+# else /* def MACOS */
+# ifdef CMS_MVS
G.zipfd = vmmvs_open_infile(__G);
-#else /* !CMS_MVS */
-#ifdef USE_STRM_INPUT
+# else /* def CMS_MVS */
+# ifdef USE_STRM_INPUT
G.zipfd = fopen(G.zipfn, FOPR);
-#else /* !USE_STRM_INPUT */
+# else /* def USE_STRM_INPUT */
G.zipfd = open(G.zipfn, O_RDONLY | O_BINARY);
-#endif /* ?USE_STRM_INPUT */
-#endif /* ?CMS_MVS */
-#endif /* ?MACOS */
-#endif /* ?VMS */
+# endif /* def USE_STRM_INPUT */
+# endif /* def CMS_MVS [else] */
+# endif /* def MACOS [else] */
+#endif /* def VMS [else] */
#ifdef USE_STRM_INPUT
if (G.zipfd == NULL)
-#else
+#else /* def USE_STRM_INPUT */
/* if (G.zipfd < 0) */ /* no good for Windows CE port */
if (G.zipfd == -1)
-#endif
+#endif /* def USE_STRM_INPUT [else] */
{
Info(slide, 0x401, ((char *)slide, LoadFarString(CannotOpenZipfile),
G.zipfn, strerror(errno)));
-#if (!defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS))
-#if (!defined(TANDEM))
+#if !defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS)
+# if !defined(TANDEM)
/***************************/
/* Function open_outfile() */
int open_outfile(__G) /* return 1 if fail */
__GDEF
{
-#ifdef DLL
+ int r;
+
+# ifdef DLL
if (G.redirect_data)
return (redirect_outfile(__G) == FALSE);
-#endif
-#ifdef QDOS
+# endif
+# ifdef QDOS
QFilename(__G__ G.filename);
-#endif
-#if (defined(DOS_FLX_NLM_OS2_W32) || defined(ATH_BEO_THS_UNX))
-#ifdef BORLAND_STAT_BUG
+# endif
+
+# if defined( UNIX) && defined( __APPLE__)
+ if (G.apple_double)
+ {
+ /* Allocate AppleDouble header buffer, if needed. */
+ if (G.apl_dbl_hdr_alloc < APL_DBL_SIZE_HDR)
+ {
+ G.apl_dbl_hdr = izu_realloc( G.apl_dbl_hdr, APL_DBL_SIZE_HDR);
+ if (G.apl_dbl_hdr == NULL)
+ {
+ Info(slide, 1, ((char *)slide, MemAllocFailed,
+ 1, APL_DBL_SIZE_HDR));
+ return 1;
+ }
+ G.apl_dbl_hdr_alloc = APL_DBL_SIZE_HDR;
+ }
+
+ /* Set flags and byte counts for the AppleDouble header. */
+ G.apl_dbl_hdr_len = 0; /* Bytes in header. */
+ G.apl_dbl_hdr_bytes = APL_DBL_SIZE_HDR; /* Header bytes sought. */
+
+ /* 2013-08-05 SMS.
+ * It might be more efficient not to append a "/rsrc" suffix
+ * here, and then use fsetxattr( fileno( G.outfile), ...)
+ * instead of setxattr( G.filename, ...) to set the extended
+ * attributes below. (And then do something different for the
+ * resource fork.) Or append the "/rsrc" suffix later, after
+ * setting the attributes. Note that XATTR_NOFOLLOW is not used
+ * with fsetxattr().
+ */
+ /* Excise the "._" name prefix from the post-mapname()
+ * AppleDouble file name.
+ */
+ revert_apl_dbl_path( G.filename, G.filename);
+ /* Append "/rsrc" suffix to the AppleDouble file name. */
+ strcat( G.filename, APL_DBL_SUFX);
+ }
+ else
+ {
+ /* Set byte count to bypass AppleDouble processing. */
+ G.apl_dbl_hdr_bytes = 0;
+ }
+# endif /* defined( UNIX) && defined( __APPLE__) */
+
+# if defined(DOS_FLX_NLM_OS2_W32) || defined(ATH_BEO_THS_UNX)
+# ifdef BORLAND_STAT_BUG
/* Borland 5.0's stat() barfs if the filename has no extension and the
* file doesn't exist. */
if (access(G.filename, 0) == -1) {
fputc('0', tmp); /* just to have something in the file */
fclose(tmp);
}
-#endif /* BORLAND_STAT_BUG */
-#ifdef SYMLINKS
- if (SSTAT(G.filename, &G.statbuf) == 0 ||
- lstat(G.filename, &G.statbuf) == 0)
-#else
- if (SSTAT(G.filename, &G.statbuf) == 0)
-#endif /* ?SYMLINKS */
+# endif /* def BORLAND_STAT_BUG */
+
+/* AppleDouble resource fork is expected to exist, so evade the test. */
+# if defined( UNIX) && defined( __APPLE__)
+# define TEST_EXIST (G.apple_double == 0)
+# else /* defined( UNIX) && defined( __APPLE__) */
+# define TEST_EXIST 1
+# endif /* defined( UNIX) && defined( __APPLE__) [else] */
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ r = ((G.has_win32_wide
+ ? SSTATW(G.unipath_widefilename, &G.statbuf)
+ : SSTAT(G.filename, &G.statbuf)
+ ) == 0);
+# else /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+ r = (SSTAT(G.filename, &G.statbuf) == 0);
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) [else] */
+
+# if defined( SYMLINKS) && !defined( WIN32)
+ if (TEST_EXIST && (r || lstat(G.filename, &G.statbuf) == 0))
+# else /* defined( SYMLINKS) && !defined( WIN32) */
+ if (TEST_EXIST && r)
+# endif /* defined( SYMLINKS) && !defined( WIN32) [else] */
{
Trace((stderr, "open_outfile: stat(%s) returns 0: file exists\n",
FnFilter1(G.filename)));
-#ifdef UNIXBACKUP
+# ifdef UNIXBACKUP
if (uO.B_flag) { /* do backup */
char *tname;
z_stat tmpstat;
flen = strlen(G.filename);
tlen = flen + blen + 6; /* includes space for 5 digits */
if (tlen >= FILNAMSIZ) { /* in case name is too long, truncate */
- tname = (char *)malloc(FILNAMSIZ);
+ tname = (char *)izu_malloc(FILNAMSIZ);
if (tname == NULL)
return 1; /* in case we run out of space */
tlen = FILNAMSIZ - 1 - blen;
Info(slide, 0x401, ((char *)slide,
LoadFarString(CannotRenameOldFile),
FnFilter1(G.filename), strerror(errno)));
- free(tname);
+ izu_free(tname);
return 1;
}
Trace((stderr, "open_outfile: %s now renamed into %s\n",
FnFilter1(G.filename), FnFilter2(tname)));
- free(tname);
+ izu_free(tname);
} else
-#endif /* UNIXBACKUP */
+# endif /* def UNIXBACKUP */
{
-#ifdef DOS_FLX_OS2_W32
+# ifdef DOS_FLX_OS2_W32
if (!(G.statbuf.st_mode & S_IWRITE)) {
Trace((stderr,
"open_outfile: existing file %s is read-only\n",
Trace((stderr, "open_outfile: %s now writable\n",
FnFilter1(G.filename)));
}
-#endif /* DOS_FLX_OS2_W32 */
-#ifdef NLM
+# endif /* def DOS_FLX_OS2_W32 */
+# ifdef NLM
/* Give the file read/write permission (non-POSIX shortcut) */
chmod(G.filename, 0);
-#endif /* NLM */
- if (unlink(G.filename) != 0) {
+# endif /* def NLM */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if ((G.has_win32_wide
+ ? _wunlink(G.unipath_widefilename)
+ : unlink(G.filename)
+ ) != 0)
+# else /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+ if (unlink(G.filename) != 0)
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) [else] */
+ {
Info(slide, 0x401, ((char *)slide,
LoadFarString(CannotDeleteOldFile),
FnFilter1(G.filename), strerror(errno)));
FnFilter1(G.filename)));
}
}
-#endif /* DOS_FLX_NLM_OS2_W32 || ATH_BEO_THS_UNX */
-#ifdef RISCOS
+# endif /* defined(DOS_FLX_NLM_OS2_W32) || defined(ATH_BEO_THS_UNX) */
+# ifdef RISCOS
if (SWI_OS_File_7(G.filename,0xDEADDEAD,0xDEADDEAD,G.lrec.ucsize)!=NULL) {
Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile),
FnFilter1(G.filename), strerror(errno)));
return 1;
}
-#endif /* RISCOS */
-#ifdef TOPS20
+# endif /* def RISCOS */
+# ifdef TOPS20
char *tfilnam;
if ((tfilnam = (char *)malloc(2*strlen(G.filename)+1)) == (char *)NULL)
if ((G.outfile = fopen(tfilnam, FOPW)) == (FILE *)NULL) {
Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile),
tfilnam, strerror(errno)));
- free(tfilnam);
+ izu_free(tfilnam);
return 1;
}
- free(tfilnam);
-#else /* !TOPS20 */
-#ifdef MTS
+ izu_free(tfilnam);
+# else /* def TOPS20 */
+# ifdef MTS
if (uO.aflag)
G.outfile = zfopen(G.filename, FOPWT);
else
FnFilter1(G.filename), strerror(errno)));
return 1;
}
-#else /* !MTS */
-#ifdef DEBUG
+# else /* def MTS */
+# ifdef DEBUG
Info(slide, 1, ((char *)slide,
"open_outfile: doing fopen(%s) for reading\n", FnFilter1(G.filename)));
if ((G.outfile = zfopen(G.filename, FOPR)) == (FILE *)NULL)
FnFilter1(G.filename)));
fclose(G.outfile);
}
-#endif /* DEBUG */
-#ifdef NOVELL_BUG_FAILSAFE
+# endif /* def DEBUG */
+# ifdef NOVELL_BUG_FAILSAFE
if (G.dne && ((G.outfile = zfopen(G.filename, FOPR)) != (FILE *)NULL)) {
Info(slide, 0x401, ((char *)slide, LoadFarString(NovellBug),
FnFilter1(G.filename)));
fclose(G.outfile);
return 1; /* with "./" fix in checkdir(), should never reach here */
}
-#endif /* NOVELL_BUG_FAILSAFE */
+# endif /* def NOVELL_BUG_FAILSAFE */
Trace((stderr, "open_outfile: doing fopen(%s) for writing\n",
FnFilter1(G.filename)));
{
-#if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
+# if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
mode_t umask_sav = umask(0077);
-#endif
-#if defined(SYMLINKS) || defined(QLZIP)
+# endif
+
+# if defined(SYMLINKS) && defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ G.outfile = (G.has_win32_wide
+ ? zfopenw(G.unipath_widefilename, FOPWR_W)
+ : zfopen(G.filename, FOPWR)
+ );
+# else /* defined(SYMLINKS) && defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ G.outfile = (G.has_win32_wide
+ ? zfopenw(G.unipath_widefilename, FOPW_W)
+ : zfopen(G.filename, FOPW)
+ );
+# else /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+# if defined(SYMLINKS) || defined(QLZIP)
/* These features require the ability to re-read extracted data from
the output files. Output files are created with Read&Write access.
*/
G.outfile = zfopen(G.filename, FOPWR);
-#else
+# else
G.outfile = zfopen(G.filename, FOPW);
-#endif
-#if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
+# endif
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) [else] */
+# endif /* defined(SYMLINKS) && defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) [else] */
+
+# if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
umask(umask_sav);
-#endif
+# endif
}
if (G.outfile == (FILE *)NULL) {
Info(slide, 0x401, ((char *)slide, LoadFarString(CannotCreateFile),
}
Trace((stderr, "open_outfile: fopen(%s) for writing succeeded\n",
FnFilter1(G.filename)));
-#endif /* !MTS */
-#endif /* !TOPS20 */
+# endif /* def MTS */
+# endif /* def TOPS20 [else] */
-#ifdef USE_FWRITE
-#ifdef DOS_NLM_OS2_W32
+# ifdef USE_FWRITE
+# ifdef DOS_NLM_OS2_W32
/* 16-bit MSC: buffer size must be strictly LESS than 32K (WSIZE): bogus */
setbuf(G.outfile, (char *)NULL); /* make output unbuffered */
-#else /* !DOS_NLM_OS2_W32 */
-#ifndef RISCOS
-#ifdef _IOFBF /* make output fully buffered (works just about like write()) */
+# else /* def DOS_NLM_OS2_W32 */
+# ifndef RISCOS
+# ifdef _IOFBF /* make output fully buffered (works just about like write()) */
setvbuf(G.outfile, (char *)slide, _IOFBF, WSIZE);
-#else
+# else /* def _IOFBF */
setbuf(G.outfile, (char *)slide);
-#endif
-#endif /* !RISCOS */
-#endif /* ?DOS_NLM_OS2_W32 */
-#endif /* USE_FWRITE */
-#ifdef OS2_W32
+# endif /* def _IOFBF [else] */
+# endif /* ndef RISCOS */
+# endif /* def DOS_NLM_OS2_W32 [else] */
+# endif /* def USE_FWRITE */
+# ifdef OS2_W32
/* preallocate the final file size to prevent file fragmentation */
SetFileSize(G.outfile, G.lrec.ucsize);
-#endif
+# endif /* def OS2_W32 */
return 0;
} /* end function open_outfile() */
-#endif /* !TANDEM */
-#endif /* !VMS && !AOS_VS && !CMS_MVS && !MACOS */
-
+# endif /* !defined(TANDEM) */
+#endif /* !defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS) */
-
/***********************************/
/* function defer_leftover_input() */
/***********************************/
-
/**********************/
/* Function readbuf() */
/**********************/
G.cur_zipfile_bufstart += INBUFSIZ;
G.inptr = G.inbuf;
}
- count = MIN(size, (unsigned)G.incnt);
+ count = IZ_MIN(size, (unsigned)G.incnt);
memcpy(buf, G.inptr, count);
buf += count;
G.inptr += count;
-
/***********************/
/* Function readbyte() */
/***********************/
(uch *)LoadFarString(ReadError),
(ulg)strlen(LoadFarString(ReadError)), 0x401);
echon();
-#ifdef WINDLL
+#if defined( WINDLL) || defined( DLL)
longjmp(dll_error_return, 1);
#else
DESTROYGLOBALS();
defer_leftover_input(__G); /* decrements G.csize */
}
-#if CRYPT
- if (G.pInfo->encrypted) {
- uch *p;
- int n;
+#ifdef IZ_CRYPT_ANY
+ if (G.pInfo->encrypted)
+ {
+# ifdef IZ_CRYPT_AES_WG
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ int n;
+
+ n = (int)(IZ_MIN( G.incnt, G.ucsize_aes));
+ fcrypt_decrypt( G.inptr, n, G.zcx);
+ G.ucsize_aes -= n;
+ }
+ else
+# endif /* def IZ_CRYPT_AES_WG */
+ {
+# ifdef IZ_CRYPT_TRAD
+ uch *p;
+ int n;
/* This was previously set to decrypt one byte beyond G.csize, when
* incnt reached that far. GRR said, "but it's required: why?" This
* was a bug in fillinbuf() -- was it also a bug here?
*/
- for (n = G.incnt, p = G.inptr; n--; p++)
- zdecode(*p);
+ for (n = G.incnt, p = G.inptr; n--; p++)
+ zdecode(*p);
+# endif /* def IZ_CRYPT_TRAD */
+ }
}
-#endif /* CRYPT */
+#endif /* def IZ_CRYPT_ANY */
--G.incnt;
return *G.inptr++;
-
-#if defined(USE_ZLIB) || defined(USE_BZIP2)
+#if defined(USE_ZLIB) || defined(BZIP2_SUPPORT) || defined(LZMA_SUPPORT)
/************************/
/* Function fillinbuf() */
G.inptr = G.inbuf;
defer_leftover_input(__G); /* decrements G.csize */
-#if CRYPT
- if (G.pInfo->encrypted) {
- uch *p;
- int n;
+# ifdef IZ_CRYPT_ANY
+ if (G.pInfo->encrypted)
+ {
+# ifdef IZ_CRYPT_AES_WG
+ if (G.lrec.compression_method == AESENCRED)
+ {
+ int n;
+
+ n = IZ_MIN( G.incnt, (long)G.ucsize_aes);
+ fcrypt_decrypt( G.inptr, n, G.zcx);
+ G.ucsize_aes -= n;
+ }
+ else
+# endif /* def IZ_CRYPT_AES_WG */
+ {
+# ifdef IZ_CRYPT_TRAD
+ uch *p;
+ int n;
- for (n = G.incnt, p = G.inptr; n--; p++)
- zdecode(*p);
+ for (n = G.incnt, p = G.inptr; n--; p++)
+ zdecode(*p);
+# endif /* def IZ_CRYPT_TRAD */
+ }
}
-#endif /* CRYPT */
+# endif /* def IZ_CRYPT_ANY */
return G.incnt;
} /* end function fillinbuf() */
-#endif /* USE_ZLIB || USE_BZIP2 */
-
+#endif /* defined(USE_ZLIB) || defined(BZIP2_SUPPORT) || defined(LZMA_SUPPORT) */
#ifdef USE_STRM_INPUT
zfseeko(G.zipfd, bufstart, SEEK_SET);
G.cur_zipfile_bufstart = zftello(G.zipfd);
-#else /* !USE_STRM_INPUT */
+#else /* def USE_STRM_INPUT */
G.cur_zipfile_bufstart = zlseek(G.zipfd, bufstart, SEEK_SET);
-#endif /* ?USE_STRM_INPUT */
+#endif /* def USE_STRM_INPUT [else] */
Trace((stderr,
" request = %s, (abs+extra) = %s, inbuf_offset = %s\n",
FmZofft(request, NULL, NULL),
+/************************/
+/* Function fgets_ans() */
+/************************/
+
+int fgets_ans( __G)
+ __GDEF
+{
+ char *ans;
+ int ret;
+ char waste[ 8];
+
+ ans = fgets( G.answerbuf, sizeof( G.answerbuf), stdin);
+ if (ans == NULL)
+ { /* Error or end-of-file. */
+ ret = -1; /* Failure code. */
+ *G.answerbuf = '\0'; /* Null the answer buffer. */
+ }
+ else
+ {
+ ret = 0; /* Success code. */
+ /* Read any remaining chars on line, leaving G.answerbuf intact. */
+ while ((ans != NULL) && (ans[ strlen( ans)- 1] != '\n'))
+ {
+ ans = fgets( waste, sizeof( waste), stdin);
+ }
+ }
+ return ret;
+}
+
+
+
-#ifndef VMS /* for VMS use code in vms.c */
+#ifndef VMS /* For VMS, use code in vms.c. */
/********************/
/* Function flush() */ /* returns PK error codes: */
uch *rawbuf;
ulg size;
int unshrink;
-#if (defined(USE_DEFLATE64) && defined(__16BIT__))
+# if defined(DEFLATE64_SUPPORT) && defined(__16BIT__)
{
int ret;
} /* end function flush() */
+
+
/************************/
/* Function partflush() */ /* returns PK error codes: */
/************************/ /* if tflag => always 0; PK_DISK if write error */
uch *rawbuf; /* cannot be ZCONST, gets passed to (*G.message)() */
ulg size;
int unshrink;
-#endif /* USE_DEFLATE64 && __16BIT__ */
+# endif /* defined(DEFLATE64_SUPPORT) && defined(__16BIT__) */
{
register uch *p;
register uch *q;
uch *transbuf;
-#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV))
+# if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV))
ulg transbufsiz;
-#endif
+# endif
/* static int didCRlast = FALSE; moved to globals.h */
G.crc32val = crc32(G.crc32val, rawbuf, (extent)size);
-#ifdef DLL
+# ifdef DLL
if ((G.statreportcb != NULL) &&
(*G.statreportcb)(__G__ UZ_ST_IN_PROGRESS, G.zipfn, G.filename, NULL))
return IZ_CTRLC; /* cancel operation by user request */
-#endif
+# endif
if (uO.tflag || size == 0L) /* testing or nothing to write: all done */
return PK_OK;
necessarily checked for overflow.
---------------------------------------------------------------------------*/
- if (!G.pInfo->textmode) { /* write raw binary data */
+ if (!G.pInfo->textmode)
+ { /* write raw binary data */
/* GRR: note that for standard MS-DOS compilers, size argument to
* fwrite() can never be more than 65534, so WriteError macro will
* have to be rewritten if size can ever be that large. For now,
* at least MSC 5.1 has a lousy implementation of fwrite() (as does
* DEC Ultrix cc), write() is used anyway.
*/
-#ifdef DLL
+# ifdef DLL
if (G.redirect_data) {
-#ifdef NO_SLIDE_REDIR
+# ifdef NO_SLIDE_REDIR
if (writeToMemory(__G__ rawbuf, (extent)size)) return PK_ERR;
-#else
+# else
writeToMemory(__G__ rawbuf, (extent)size);
-#endif
+# endif
} else
-#endif
+# endif
+
+# if defined( UNIX) && defined( __APPLE__)
+ /* If expecting AppleDouble header bytes, process them.
+ * Note that any extended attributes are analyzed, whether or
+ * not setxattr() is available to apply them, so that we can
+ * correctly locate the resource fork data which follow them.
+ */
+ if (G.apl_dbl_hdr_bytes > 0)
+ {
+ if (size < G.apl_dbl_hdr_bytes)
+ {
+ /* Fewer bytes than needed to complete the AppleDouble
+ * header. Move available data to the AppleDouble
+ * header buffer, adjust the byte counts, and resume
+ * extraction.
+ */
+ memcpy( &G.apl_dbl_hdr[ G.apl_dbl_hdr_len], rawbuf, size);
+ G.apl_dbl_hdr_len += size; /* Bytes in header. */
+ G.apl_dbl_hdr_bytes -= size; /* Hdr bytes still sought. */
+ size = 0; /* Bytes left in rawbuf. */
+ }
+ else
+ {
+ /* Enough bytes to complete the AppleDouble header
+ * (short and/or extended). Move expected data to the
+ * AppleDouble header buffer, and adjust the byte counts
+ * and pointer. If (only) the first part (through
+ * Finder info) is complete, then get the offset for the
+ * resource fork, and adjust the expected header length
+ * accordingly, to include the attributes.
+ */
+ int res_frk_offs;
+
+ memcpy( &G.apl_dbl_hdr[ G.apl_dbl_hdr_len], rawbuf,
+ G.apl_dbl_hdr_bytes);
+ G.apl_dbl_hdr_len += G.apl_dbl_hdr_bytes; /* Bytes in hdr. */
+ size -= G.apl_dbl_hdr_bytes; /* Bytes left in rawbuf. */
+ rawbuf += G.apl_dbl_hdr_bytes; /* Pointer to remaining data. */
+ G.apl_dbl_hdr_bytes = 0; /* Hdr bytes still sought. */
+
+ if (G.apl_dbl_hdr_len == APL_DBL_SIZE_HDR)
+ {
+ /* Have complete basic header. Get resource fork offset. */
+ res_frk_offs = BIGC_TO_HOST32(
+ &G.apl_dbl_hdr[ APL_DBL_OFS_ENT_DSCR_OFS1]);
+
+ if (res_frk_offs > APL_DBL_SIZE_HDR)
+ {
+ /* Have attributes. Revise remaining header
+ * size accordingly.
+ */
+ G.apl_dbl_hdr_bytes =
+ res_frk_offs- APL_DBL_SIZE_HDR;
+
+ /* Allocate more AplDbl header storage, if needed. */
+ if (G.apl_dbl_hdr_alloc < res_frk_offs)
+ {
+ G.apl_dbl_hdr = izu_realloc( G.apl_dbl_hdr,
+ res_frk_offs);
+ if (G.apl_dbl_hdr == NULL)
+ {
+ Info(slide, 1, ((char *)slide, MemAllocFailed,
+ 2, res_frk_offs));
+ return 1;
+ }
+ G.apl_dbl_hdr_alloc = res_frk_offs;
+ }
+
+ if (size < G.apl_dbl_hdr_bytes)
+ {
+ /* Fewer bytes than needed to complete the
+ * AppleDouble header. Move available data
+ * to the AppleDouble header buffer, adjust
+ * the byte counts, and resume extraction.
+ */
+ memcpy( &G.apl_dbl_hdr[ G.apl_dbl_hdr_len],
+ rawbuf, size);
+ G.apl_dbl_hdr_len += size; /* Bytes in header. */
+ G.apl_dbl_hdr_bytes -= size;/* Hdr byts stl sght. */
+ size = 0; /* Bs left in rawbuf. */
+ }
+ else
+ {
+ /* Enough bytes to complete the AppleDouble
+ * header (extended). Move remaining data
+ * to the AppleDouble header buffer, and
+ * adjust the byte counts and pointer.
+ */
+ memcpy( &G.apl_dbl_hdr[ G.apl_dbl_hdr_len],
+ rawbuf, G.apl_dbl_hdr_bytes);
+ G.apl_dbl_hdr_len = res_frk_offs; /* Byts in hdr. */
+ size -= G.apl_dbl_hdr_bytes;/* Bs left in rawbuf. */
+ rawbuf += G.apl_dbl_hdr_bytes; /* Ptr to r data. */
+ G.apl_dbl_hdr_bytes = 0; /* Hdr byts stl sght. */
+ }
+ }
+ }
+
+ if (G.apl_dbl_hdr_bytes == 0)
+ {
+ /* Set the Finder info and other attributes (for the
+ * plain-name) file.
+ */
+ char btrbslash; /* Saved character had better be a slash. */
+ int sts;
+ struct attrlist attr_list_fndr;
+
+ /* Truncate name at "/rsrc" for setattrlist(). */
+ btrbslash =
+ G.filename[ strlen( G.filename)- strlen( APL_DBL_SUFX)];
+ G.filename[ strlen( G.filename)- strlen( APL_DBL_SUFX)] =
+ '\0';
+
+ /* Clear attribute list structure. */
+ memset( &attr_list_fndr, 0, sizeof( attr_list_fndr));
+ /* Set attribute list bits for Finder info. */
+ attr_list_fndr.bitmapcount = ATTR_BIT_MAP_COUNT;
+ attr_list_fndr.commonattr = ATTR_CMN_FNDRINFO;
+
+ if (!uO.Jf_flag)
+ {
+ /* Set Finder info for main file. */
+ sts = setattrlist(
+ G.filename, /* Path. */
+ &attr_list_fndr, /* Attrib list. */
+ &G.apl_dbl_hdr[ APL_DBL_OFS_FNDR_INFO], /* Src bufr. */
+ APL_DBL_SIZE_FNDR_INFO, /* Src buffer size. */
+ 0); /* Options. */
+
+ if (sts != 0)
+ {
+ Info(slide, 0x12, ((char *)slide,
+ SetattrlistFailed, errno, G.filename));
+ }
+ }
+
+# ifdef APPLE_XATTR
+ if ((!uO.Je_flag) &&
+ (G.apl_dbl_hdr_len > APL_DBL_OFS_ATTR))
+ {
+ /* int attr_offs; (Unused.) */
+ int attr_count;
+ int attr_ndx;
+ char *attr_ptr;
+ int attr_size;
+ int ndx;
+ /* unsigned short flags; (Unused.) */
+ int val_offs;
+ int val_size;
+
+/* AppleDouble extended attribute data layout:
+ *
+ * A+ Size Description
+ * 0 4 Attribute magic ("ATTR").
+ * 4 4 FileID (for debug).
+ * 8 4 Total size (pre-resource-fork).
+ * 12 4 Attribute value first offset.
+ * 16 4 Attribute value total size.
+ * 20 12 Reserved.
+ * 32 2 Flags.
+ * 34 2 Attribute count.
+ * 36 4 Value offset [0]. (Align:4.) -+
+ * 40 4 Value size [0]. |
+ * 44 2 Flags. |
+ * 46 1 Attribute name size [0]. |
+ * 47 var Attribute name [0] var = size + pad to align:4. |
+ * Next offset = (name_offset+ size+ 3)& 0xfffffffc. -+
+ * O1 4 Value offset [1].
+ * O1+4 4 Value size [1].
+ * O1+8 2 Flags.
+ * O1+10 1 Attribute name size [1].
+ * O1+11 1 Attribute name [1].
+ * [...]
+ */
+ ndx = APL_DBL_OFS_ATTR+ 12;
+ /* attr_offs = BIGC_TO_HOST32( &G.apl_dbl_hdr[ ndx]); */
+ ndx += 22;
+ attr_count = BIGC_TO_HOST16( &G.apl_dbl_hdr[ ndx]);
+ ndx += 2;
+
+ /* Loop through and set the extended attributes. */
+ for (attr_ndx = 0; attr_ndx < attr_count; attr_ndx++)
+ {
+ val_offs = BIGC_TO_HOST32( &G.apl_dbl_hdr[ ndx]);
+ ndx += 4;
+ val_size = BIGC_TO_HOST32( &G.apl_dbl_hdr[ ndx]);
+ ndx += 4;
+ /* flags = BIGC_TO_HOST16( &G.apl_dbl_hdr[ ndx]); */
+ ndx += 2;
+ attr_size = G.apl_dbl_hdr[ ndx];
+ ndx += 1;
+ attr_ptr = (char *)(&(G.apl_dbl_hdr[ ndx]));
+
+ /* 2013-07-05 SMS.
+ * Add more code here to inhibit setting
+ * selected extended attributes.
+ */
+# define XATTR_QTR "com.apple.quarantine"
+
+ if ((!uO.Jq_flag) ||
+ (strcmp( attr_ptr, XATTR_QTR) != 0))
+ {
+ sts = setxattr(
+ G.filename, /* Real file name. */
+ attr_ptr, /* Attr name. */
+ &(G.apl_dbl_hdr[ val_offs]), /* Attr val. */
+ val_size, /* Attr value size. */
+ 0, /* Position. */
+ XATTR_NOFOLLOW); /* Options. */
+
+ if (sts != 0)
+ {
+ Info(slide, 0x12, ((char *)slide,
+ SetxattrFailed, errno, G.filename));
+ }
+ }
+
+ /* Advance index to the next align:4 value. */
+ ndx = (ndx+ attr_size+ 3)& 0xfffffffc;
+ }
+ }
+# endif /* def APPLE_XATTR */
+
+ /* Restore name suffix ("/rsrc"). */
+ G.filename[ strlen( G.filename)] = btrbslash;
+ }
+ }
+
+ /* Quit now if there are no resource fork data, or if the
+ * user inhibited the resource fork.
+ */
+ if ((size == 0L) || uO.Jr_flag)
+ return PK_OK;
+ }
+# endif /* defined( UNIX) && defined( __APPLE__) */
+
if (!uO.cflag && WriteError(rawbuf, size, G.outfile))
return disk_error(__G);
- else if (uO.cflag && (*G.message)((zvoid *)&G, rawbuf, size, 0))
+ else if (uO.cflag && (*G.message)((zvoid *)&G, rawbuf, size, 0x2000))
return PK_OK;
} else { /* textmode: aflag is true */
if (unshrink) {
/* rawbuf = outbuf */
transbuf = G.outbuf2;
-#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV))
+# if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV))
transbufsiz = TRANSBUFSIZ;
-#endif
+# endif
} else {
/* rawbuf = slide */
transbuf = G.outbuf;
-#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV))
+# if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV))
transbufsiz = OUTBUFSIZ;
Trace((stderr, "\ntransbufsiz = OUTBUFSIZ = %u\n",
(unsigned)OUTBUFSIZ));
-#endif
+# endif
}
if (G.newfile) {
-#ifdef VMS_TEXT_CONV
+# ifdef VMS_TEXT_CONV
if (G.pInfo->hostnum == VMS_ && G.extra_field &&
is_vms_varlen_txt(__G__ G.extra_field,
G.lrec.extra_field_length))
G.VMS_line_state = 0; /* 0: ready to read line length */
else
G.VMS_line_state = -1; /* -1: don't treat as VMS text */
-#endif
+# endif
G.didCRlast = FALSE; /* no previous buffers written */
G.newfile = FALSE;
}
-#ifdef VMS_TEXT_CONV
+# ifdef VMS_TEXT_CONV
if (G.VMS_line_state >= 0)
{
p = rawbuf;
remaining -= outroom;
for (;outroom > 0; p++, outroom--)
*q++ = native(*p);
-#ifdef DLL
+# ifdef DLL
if (G.redirect_data) {
if (writeToMemory(__G__ transbuf,
(extent)(q-transbuf))) return PK_ERR;
} else
-#endif
+# endif
if (!uO.cflag && WriteError(transbuf,
(extent)(q-transbuf), G.outfile))
return disk_error(__G);
else if (uO.cflag && (*G.message)((zvoid *)&G,
- transbuf, (ulg)(q-transbuf), 0))
+ transbuf, (ulg)(q-transbuf), 0x2000))
return PK_OK;
q = transbuf;
/* fall through to normal case */
/* 3: ready to PutNativeEOL */
case 3:
if (q > transbuf+(extent)transbufsiz-lenEOL) {
-#ifdef DLL
+# ifdef DLL
if (G.redirect_data) {
if (writeToMemory(__G__ transbuf,
(extent)(q-transbuf))) return PK_ERR;
} else
-#endif
+# endif
if (!uO.cflag &&
WriteError(transbuf, (extent)(q-transbuf),
G.outfile))
return disk_error(__G);
else if (uO.cflag && (*G.message)((zvoid *)&G,
- transbuf, (ulg)(q-transbuf), 0))
+ transbuf, (ulg)(q-transbuf), 0x2000))
return PK_OK;
q = transbuf;
}
} /* end while */
} else
-#endif /* VMS_TEXT_CONV */
+# endif /* def VMS_TEXT_CONV */
/*-----------------------------------------------------------------------
Algorithm: CR/LF => native; lone CR => native; lone LF => native.
} else if (*p == LF) /* lone LF */
PutNativeEOL
else
-#ifndef DOS_FLX_OS2_W32
+# ifndef DOS_FLX_OS2_W32
if (*p != CTRLZ) /* lose all ^Z's */
-#endif
+# endif
*q++ = native(*p);
-#if (defined(SMALL_MEM) || defined(MED_MEM))
-# if (lenEOL == 1) /* don't check unshrink: both buffers small but equal */
+# if defined(SMALL_MEM) || defined(MED_MEM)
+# if (lenEOL == 1) /* don't check unshrink: both buffers small but equal */
if (!unshrink)
-# endif
+# endif
/* check for danger of buffer overflow and flush */
if (q > transbuf+(extent)transbufsiz-lenEOL) {
Trace((stderr,
(extent)(q-transbuf), G.outfile))
return disk_error(__G);
else if (uO.cflag && (*G.message)((zvoid *)&G,
- transbuf, (ulg)(q-transbuf), 0))
+ transbuf, (ulg)(q-transbuf), 0x2000))
return PK_OK;
q = transbuf;
continue;
}
-#endif /* SMALL_MEM || MED_MEM */
+# endif /* defined(SMALL_MEM) || defined(MED_MEM) */
}
}
Trace((stderr, "p - rawbuf = %u q-transbuf = %u size = %lu\n",
(unsigned)(p-rawbuf), (unsigned)(q-transbuf), size));
if (q > transbuf) {
-#ifdef DLL
+# ifdef DLL
if (G.redirect_data) {
if (writeToMemory(__G__ transbuf, (extent)(q-transbuf)))
return PK_ERR;
} else
-#endif
+# endif
if (!uO.cflag && WriteError(transbuf, (extent)(q-transbuf),
G.outfile))
return disk_error(__G);
else if (uO.cflag && (*G.message)((zvoid *)&G, transbuf,
- (ulg)(q-transbuf), 0))
+ (ulg)(q-transbuf), 0x2000))
return PK_OK;
}
}
-
-#ifdef VMS_TEXT_CONV
+# ifdef VMS_TEXT_CONV
/********************************/
/* Function is_vms_varlen_txt() */
/********************************/
+/* 2012-11-25 SMS. (OUSPG report.)
+ * Changed eb_len and ef_len from unsigned to signed, to catch underflow
+ * of ef_len caused by corrupt/malicious data. (32-bit is adequate.
+ * Used "long" to accommodate any systems with 16-bit "int".)
+ */
+
static int is_vms_varlen_txt(__G__ ef_buf, ef_len)
__GDEF
uch *ef_buf; /* buffer containing extra field */
- unsigned ef_len; /* total length of extra field */
+ long ef_len; /* total length of extra field */
{
unsigned eb_id;
- unsigned eb_len;
+ long eb_len;
uch *eb_data;
unsigned eb_datlen;
-#define VMSREC_C_UNDEF 0
-#define VMSREC_C_VAR 2
+# define VMSREC_C_UNDEF 0
+# define VMSREC_C_VAR 2
uch vms_rectype = VMSREC_C_UNDEF;
/* uch vms_fileorg = 0; */ /* currently, fileorg is not used... */
-#define VMSPK_ITEMID 0
-#define VMSPK_ITEMLEN 2
-#define VMSPK_ITEMHEADSZ 4
+# define VMSPK_ITEMID 0
+# define VMSPK_ITEMLEN 2
+# define VMSPK_ITEMHEADSZ 4
-#define VMSATR_C_RECATTR 4
-#define VMS_FABSIG 0x42414656 /* "VFAB" */
+# define VMSATR_C_RECATTR 4
+# define VMS_FABSIG 0x42414656 /* "VFAB" */
/* offsets of interesting fields in VMS fabdef structure */
-#define VMSFAB_B_RFM 31 /* record format byte */
-#define VMSFAB_B_ORG 29 /* file organization byte */
+# define VMSFAB_B_RFM 31 /* record format byte */
+# define VMSFAB_B_ORG 29 /* file organization byte */
if (ef_len == 0 || ef_buf == NULL)
return FALSE;
if (eb_len > (ef_len - EB_HEADSIZE)) {
/* discovered some extra field inconsistency! */
Trace((stderr,
- "is_vms_varlen_txt: block length %u > rest ef_size %u\n", eb_len,
- ef_len - EB_HEADSIZE));
+ "is_vms_varlen_txt: block length %ld > rest ef_size %ld\n",
+ eb_len, ef_len - EB_HEADSIZE));
break;
}
vms_rectype = eb_data[VMSFAB_B_RFM] & 15;
/* vms_fileorg = eb_data[VMSFAB_B_ORG] >> 4; */
}
- free(eb_data);
+ izu_free(eb_data);
}
}
break;
} /* end function is_vms_varlen_txtfile() */
-#endif /* VMS_TEXT_CONV */
+# endif /* def VMS_TEXT_CONV */
__GDEF
{
/* OK to use slide[] here because this file is finished regardless */
- Info(slide, 0x4a1, ((char *)slide, LoadFarString(DiskFullQuery),
- FnFilter1(G.filename)));
-
-#ifndef WINDLL
- fgets(G.answerbuf, sizeof(G.answerbuf), stdin);
- if (*G.answerbuf == 'y') /* stop writing to this file */
- G.disk_full = 1; /* (outfile bad?), but new OK */
+ /* 2013-02-04 SMS.
+ * By default (I_O_ERROR_QUERY not defined), don't query the user.
+ * If I_O_ERROR_QUERY is defined, then query the user only if stdin
+ * is a terminal. STDIN_ISATTY is defined in unzpriv.h (unless some
+ * OS-specific sub-header file does it first).
+ */
+ G.disk_full = 2; /* Default: No. Exit program. */
+# ifdef USE_I_O_ERROR_QUERY
+ if (STDIN_ISATTY)
+ {
+ Info(slide, 0x4a1, ((char *)slide, LoadFarString(DiskFullQuery),
+ FnFilter1(G.filename)));
+ fgets_ans( __G);
+ if (toupper( *G.answerbuf) == 'Y') /* Error = "no". */
+ /* Stop writing to this file. */
+ G.disk_full = 1; /* (outfile bad?), but new OK. */
+ }
else
-#endif
- G.disk_full = 2; /* no: exit program */
+ {
+ /* stdin is not a terminal, so don't ask. */
+ Info(slide, 0x4a1, ((char *)slide, LoadFarString(DiskFullMsg),
+ FnFilter1(G.filename)));
+ }
+# else /* def USE_I_O_ERROR_QUERY */
+ /* Default behavior: Never ask. */
+ Info(slide, 0x4a1, ((char *)slide, LoadFarString(DiskFullMsg),
+ FnFilter1(G.filename)));
+# endif /* def USE_I_O_ERROR_QUERY [else] */
return PK_DISK;
} /* end function disk_error() */
-#endif /* !VMS */
-
+#endif /* ndef VMS */
uch *q=buf, *endbuf=buf+(unsigned)size;
#ifdef MORE
uch *p=buf;
-#if (defined(SCREENWIDTH) && defined(SCREENLWRAP))
+# if (defined(SCREENWIDTH) && defined(SCREENLWRAP))
int islinefeed = FALSE;
-#endif
-#endif
+# endif
+#endif /* def MORE */
FILE *outfp;
#ifdef WINDLL
if (MSG_NO_WDLL(flag))
return 0;
-#endif
-#ifdef WINDLL
if (MSG_NO_WGUI(flag))
return 0;
-#endif
+#endif /* def WINDLL */
/*
#ifdef ACORN_GUI
if (MSG_NO_AGUI(flag))
if (((Uz_Globs *)pG)->redirect_data &&
!((Uz_Globs *)pG)->redirect_text)
return 0;
-#endif
+#endif /* def DLL */
- if (MSG_STDERR(flag) && !((Uz_Globs *)pG)->UzO.tflag)
+ /* 2012-10-09 SMS
+ * Changed to use stderr for messages, if extracting to stdout
+ * (-c, -p).
+ */
+ if ((MSG_STDERR(flag) && !((Uz_Globs *)pG)->UzO.tflag) ||
+ (!MSG_STDOUT(flag) && ((Uz_Globs *)pG)->UzO.cflag))
outfp = (FILE *)stderr;
else
outfp = (FILE *)stdout;
+#ifdef VMS
+ /* Save the output file for the prompt function. */
+ ((Uz_Globs *)pG)->msgfp = outfp;
+#endif /* def VMS */
+
+ /* 2011-05-07 SMS.
+ * VMS needs to handle toggling between stdout and stderr in its own
+ * way. We were putting out a message like "inflating <file_name>"
+ * to stdout (with no terminating "\n"), and then putting out an
+ * error message with a leading "\n" to stderr, to get the error
+ * message onto its own line. This may look ok on UNIX, but it
+ * makes a mess on VMS with spurious blank lines, and the error
+ * message getting overwritten by the next message to stdout. Now,
+ * we save the outfp value, and, when it changes, and we're not at
+ * start-of-line, we put out an explicit "\n" to the previous outfp.
+ * This closes the old stdout line properly, allowing the new error
+ * message to appear on its own line, with no spurious blank lines
+ * added. This method seems to work on UNIX, too.
+ */
+
+ /* When outfp changes, "\n"-terminate any pending line. */
+ if (outfp != ((Uz_Globs *)pG)->outfp_prev)
+ {
+ if (!((Uz_Globs *)pG)->sol)
+ {
+ (void)WriteTxtErr( "\n", 1, ((Uz_Globs *)pG)->outfp_prev);
+ ((Uz_Globs *)pG)->sol = TRUE;
+ }
+ ((Uz_Globs *)pG)->outfp_prev = outfp;
+ }
+
#ifdef QUERY_TRNEWLN
/* some systems require termination of query prompts with '\n' to force
* immediate display */
*endbuf++ = '\n'; /* with room for one more char at end of buf */
++size; /* (safe assumption: only used for four */
} /* short queries in extract.c and fileio.c) */
-#endif
+#endif /* def QUERY_TRNEWLN */
if (MSG_TNEWLN(flag)) { /* again assumes writable buffer: fragile... */
if ((!size && !((Uz_Globs *)pG)->sol) ||
SCREENSIZE(&((Uz_Globs *)pG)->height, (int *)NULL);
# endif
((Uz_Globs *)pG)->height -= 2;
-# else
+# else /* def SCREENSIZE */
/* room for --More-- and one line of overlap: */
((Uz_Globs *)pG)->height = SCREENLINES - 2;
# if (defined(SCREENWIDTH) && defined(SCREENLWRAP))
((Uz_Globs *)pG)->width = SCREENWIDTH;
# endif
-# endif
-#endif /* MORE */
+# endif /* def SCREENSIZE [else] */
+#endif /* def MORE */
if (MSG_LNEWLN(flag) && !((Uz_Globs *)pG)->sol) {
/* not at start of line: want newline */
#ifdef MORE
if (((Uz_Globs *)pG)->M_flag)
{
-#if (defined(SCREENWIDTH) && defined(SCREENLWRAP))
+# if (defined(SCREENWIDTH) && defined(SCREENLWRAP))
((Uz_Globs *)pG)->chars = 0;
-#endif
+# endif
++((Uz_Globs *)pG)->numlines;
++((Uz_Globs *)pG)->lines;
if (((Uz_Globs *)pG)->lines >= ((Uz_Globs *)pG)->height)
(*((Uz_Globs *)pG)->mpause)((zvoid *)pG,
LoadFarString(MorePrompt), 1);
}
-#endif /* MORE */
+#endif /* def MORE */
if (MSG_STDERR(flag) && ((Uz_Globs *)pG)->UzO.tflag &&
!isatty(1) && isatty(2))
{
#ifdef MORE
if (((Uz_Globs *)pG)->M_flag
-#ifdef OS2DLL
+# ifdef OS2DLL
&& !((Uz_Globs *)pG)->redirect_text
-#endif
+# endif
)
{
while (p < endbuf) {
if (*p == '\n') {
-#if (defined(SCREENWIDTH) && defined(SCREENLWRAP))
+# if defined(SCREENWIDTH) && defined(SCREENLWRAP)
islinefeed = TRUE;
} else if (SCREENLWRAP) {
if (*p == '\r') {
((Uz_Globs *)pG)->chars +=
(TABSIZE - (((Uz_Globs *)pG)->chars % TABSIZE));
else
-# endif
+# endif /* def TABSIZE */
++((Uz_Globs *)pG)->chars;
if (((Uz_Globs *)pG)->chars >= ((Uz_Globs *)pG)->width)
if (islinefeed) {
islinefeed = FALSE;
((Uz_Globs *)pG)->chars = 0;
-#endif /* (SCREENWIDTH && SCREEN_LWRAP) */
+# endif /* defined(SCREENWIDTH) && defined(SCREENLWRAP) */
++((Uz_Globs *)pG)->numlines;
++((Uz_Globs *)pG)->lines;
if (((Uz_Globs *)pG)->lines >= ((Uz_Globs *)pG)->height)
} /* end while */
size = (ulg)(p - q); /* remaining text */
}
-#endif /* MORE */
+#endif /* def MORE */
if (size) {
#ifdef OS2DLL
if ((error = REDIRECTPRINT(q, size)) != 0)
return error;
}
-#endif /* OS2DLL */
+#endif /* def OS2DLL */
((Uz_Globs *)pG)->sol = (endbuf[-1] == '\n');
}
return 0;
-
#ifdef DLL
/*****************************/
} /* end function UzpMessageNull() */
-#endif /* DLL */
-
+#endif /* def DLL */
-
-#if (!defined(WINDLL) && !defined(MACOS))
+#if !defined(WINDLL) && !defined(MACOS) && !defined( DLL)
/***************************/
/* Function UzpMorePause() */
int flag; /* 0 = any char OK; 1 = accept only '\n', ' ', q */
{
uch c;
+ FILE *outfp;
+
+/* 2012-11-17 SMS.
+ * On VMS, match the message output file because, as usual, carriage
+ * control differs on VMS, and mixing stderr and stdout causes spurious
+ * blank lines and similar problems. If anyone else cares, then this
+ * scheme could be used elsewhere, too. Note that VMS does not need to
+ * use fflush() for terminal output.
+ */
+# ifdef VMS
+ outfp = ((Uz_Globs *)pG)->msgfp;
+ if (outfp == NULL)
+ outfp = stderr; /* (For emergency use only.) */
+# else /* def VMS */
+ outfp = stderr;
+# endif /* def VMS [else] */
/*---------------------------------------------------------------------------
Print a prompt and wait for the user to press a key, then erase prompt
---------------------------------------------------------------------------*/
if (!((Uz_Globs *)pG)->sol)
- fprintf(stderr, "\n");
+ fprintf( outfp, "\n");
/* numlines may or may not be used: */
- fprintf(stderr, prompt, ((Uz_Globs *)pG)->numlines);
- fflush(stderr);
+ fprintf( outfp, prompt, ((Uz_Globs *)pG)->numlines);
+# ifndef VMS
+ fflush( outfp);
+# endif /* ndef VMS */
if (flag & 1) {
do {
c = (uch)FGETCH(0);
} while (
-#ifdef THEOS
+# ifdef THEOS
c != 17 && /* standard QUIT key */
-#endif
+# endif
c != '\r' && c != '\n' && c != ' ' && c != 'q' && c != 'Q');
} else
c = (uch)FGETCH(0);
/* newline was not echoed, so cover up prompt line */
- fprintf(stderr, LoadFarString(HidePrompt));
- fflush(stderr);
+ fprintf( outfp, LoadFarString(HidePrompt));
+# ifndef VMS
+ fflush( outfp);
+# endif /* ndef VMS */
if (
-#ifdef THEOS
+# ifdef THEOS
(c == 17) || /* standard QUIT key */
-#endif
+# endif
(ToLower(c) == 'q')) {
DESTROYGLOBALS();
EXIT(PK_COOL);
((Uz_Globs *)pG)->sol = TRUE;
-#ifdef MORE
+# ifdef MORE
/* space for another screen, enter for another line. */
if ((flag & 1) && c == ' ')
((Uz_Globs *)pG)->lines = 0;
-#endif /* MORE */
+# endif /* def MORE */
} /* end function UzpMorePause() */
-#endif /* !WINDLL && !MACOS */
+#endif /* !defined(WINDLL) && !defined(MACOS) && !defined( DLL) */
zvoid *pG; /* pointer to UnZip's internal global vars */
int *rcnt; /* retry counter */
char *pwbuf; /* buffer for password */
- int size; /* size of password buffer */
+ int size; /* Usable size of password buffer */
ZCONST char *zfn; /* name of zip archive */
ZCONST char *efn; /* name of archive entry being processed */
{
-#if CRYPT
+# ifdef IZ_CRYPT_ANY
int r = IZ_PW_ENTERED;
char *m;
char *prompt;
-#ifndef REENTRANT
+# ifndef REENTRANT
/* tell picky compilers to shut up about "unused variable" warnings */
pG = pG;
-#endif
+# endif
if (*rcnt == 0) { /* First call for current entry */
*rcnt = 2;
m = getp(__G__ m, pwbuf, size);
if (prompt != (char *)NULL) {
- free(prompt);
+ izu_free(prompt);
}
if (m == (char *)NULL) {
r = IZ_PW_ERROR;
}
return r;
-#else /* !CRYPT */
+# else /* def IZ_CRYPT_ANY */
/* tell picky compilers to shut up about "unused variable" warnings */
pG = pG; rcnt = rcnt; pwbuf = pwbuf; size = size; zfn = zfn; efn = efn;
return IZ_PW_ERROR; /* internal error; function should never get called */
-#endif /* ?CRYPT */
+# endif /* def IZ_CRYPT_ANY [else] */
} /* end function UzpPassword() */
+#endif /* ndef WINDLL */
+
+#if !defined( WINDLL) && !defined( DLL)
/**********************/
/* Function handler() */
{
GETGLOBALS();
-#if !(defined(SIGBUS) || defined(SIGSEGV)) /* add a newline if not at */
+# if !(defined(SIGBUS) || defined(SIGSEGV)) /* add a newline if not at */
(*G.message)((zvoid *)&G, slide, 0L, 0x41); /* start of line (to stderr; */
-#endif /* slide[] should be safe) */
+# endif /* slide[] should be safe) */
- echon();
+ /* Restore the original terminal echo setting. */
+ echorig();
-#ifdef SIGBUS
+# ifdef SIGBUS
if (signal == SIGBUS) {
Info(slide, 0x421, ((char *)slide, LoadFarString(ZipfileCorrupt),
"bus error"));
DESTROYGLOBALS();
EXIT(PK_BADERR);
}
-#endif /* SIGBUS */
+# endif /* SIGBUS */
-#ifdef SIGILL
+# ifdef SIGILL
if (signal == SIGILL) {
Info(slide, 0x421, ((char *)slide, LoadFarString(ZipfileCorrupt),
"illegal instruction"));
DESTROYGLOBALS();
EXIT(PK_BADERR);
}
-#endif /* SIGILL */
+# endif /* SIGILL */
-#ifdef SIGSEGV
+# ifdef SIGSEGV
if (signal == SIGSEGV) {
Info(slide, 0x421, ((char *)slide, LoadFarString(ZipfileCorrupt),
"segmentation violation"));
DESTROYGLOBALS();
EXIT(PK_BADERR);
}
-#endif /* SIGSEGV */
+# endif /* SIGSEGV */
/* probably ctrl-C */
DESTROYGLOBALS();
-#if defined(AMIGA) && defined(__SASC)
+# if defined(AMIGA) && defined(__SASC)
_abort();
-#endif
+# endif
EXIT(IZ_CTRLC); /* was EXIT(0), then EXIT(PK_ERR) */
}
-#endif /* !WINDLL */
+#endif /* !defined( WINDLL) && !defined( DLL) */
-#if (!defined(VMS) && !defined(CMS_MVS))
-#if (!defined(OS2) || defined(TIMESTAMP))
+#if !defined(VMS) && !defined(CMS_MVS)
+# if !defined(OS2) || defined(TIMESTAMP)
-#if (!defined(HAVE_MKTIME) || defined(WIN32))
+# if !defined(HAVE_MKTIME) || defined(WIN32)
/* also used in amiga/filedate.c and win32/win32.c */
ZCONST ush ydays[] =
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
-#endif
+# endif
+
+
+
/*******************************/
/* Function dos_to_unix_time() */ /* used for freshening/updating/timestamps */
{
time_t m_time;
-#ifdef HAVE_MKTIME
+# ifdef HAVE_MKTIME
ZCONST time_t now = time(NULL);
struct tm *tm;
tm = localtime(&now);
tm->tm_isdst = -1; /* let mktime determine if DST is in effect */
+ /* MS-DOS date-time format:
+ * Bits: 31:25 24:21 20:16 15:11 10:05 04:00
+ * Value: year-1980 month day hour min sec/2
+ * (1-12) (1-31)
+ */
+
/* dissect date */
tm->tm_year = ((int)(dosdatetime >> 25) & 0x7f) + (1980 - YRBASE);
tm->tm_mon = ((int)(dosdatetime >> 21) & 0x0f) - 1;
NATIVE_TO_TIMET(m_time) /* NOP unless MSC 7.0 or Macintosh */
TTrace((stderr, " final m_time = %lu\n", (ulg)m_time));
-#else /* !HAVE_MKTIME */
+# else /* def HAVE_MKTIME */
int yr, mo, dy, hh, mm, ss;
-#ifdef TOPS20
-# define YRBASE 1900
+# ifdef TOPS20
+# define YRBASE 1900
struct tmx *tmx;
char temp[20];
-#else /* !TOPS20 */
-# define YRBASE 1970
+# else /* def TOPS20 */
+# define YRBASE 1970
int leap;
unsigned days;
struct tm *tm;
-#if (!defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM))
-#ifdef WIN32
+# if !defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM)
+# ifdef WIN32
TIME_ZONE_INFORMATION tzinfo;
DWORD res;
-#else /* ! WIN32 */
-#ifndef BSD4_4 /* GRR: change to !defined(MODERN) ? */
-#if (defined(BSD) || defined(MTS) || defined(__GO32__))
+# else /* def WIN32 */
+# ifndef BSD4_4 /* GRR: change to !defined(MODERN) ? */
+# if defined(BSD) || defined(MTS) || defined(__GO32__)
struct timeb tbp;
-#else /* !(BSD || MTS || __GO32__) */
-#ifdef DECLARE_TIMEZONE
+# else /* defined(BSD) || defined(MTS) || defined(__GO32__) */
+# ifdef DECLARE_TIMEZONE
extern time_t timezone;
-#endif
-#endif /* ?(BSD || MTS || __GO32__) */
-#endif /* !BSD4_4 */
-#endif /* ?WIN32 */
-#endif /* !MACOS && !RISCOS && !QDOS && !TANDEM */
-#endif /* ?TOPS20 */
-
+# endif /* def DECLARE_TIMEZONE */
+# endif /* defined(BSD) || defined(MTS) || defined(__GO32__) [else] */
+# endif /* ndef BSD4_4 */
+# endif /* def WIN32 [else] */
+# endif /* !defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM) */
+# endif /* def TOPS20 [else] */
+
+ /* MS-DOS date-time format:
+ * Bits: 31:25 24:21 20:16 15:11 10:05 04:00
+ * Value: year-1980 month day hour min sec/2
+ * (1-12) (1-31)
+ */
/* dissect date */
yr = ((int)(dosdatetime >> 25) & 0x7f) + (1980 - YRBASE);
mm = (int)((unsigned)dosdatetime >> 5) & 0x3f;
ss = (int)((unsigned)dosdatetime & 0x1f) * 2;
-#ifdef TOPS20
+ /* 2012-11-26 SMS. (OUSPG report.)
+ * Return the mktime() error status for obviously invalid values.
+ * (This avoids the use of "ydays[mo]" for an invalid "mo". Other
+ * invalid values should cause less trouble.)
+ */
+ if ((mo < 0) || (mo > 11) || (dy < 0) || (ss > 59))
+ return (time_t)-1;
+
+# ifdef TOPS20
tmx = (struct tmx *)malloc(sizeof(struct tmx));
sprintf (temp, "%02d/%02d/%02d %02d:%02d:%02d", mo+1, dy+1, yr, hh, mm, ss);
time_parse(temp, tmx, (char *)0);
m_time = time_make(tmx);
- free(tmx);
+ izu_free(tmx);
-#else /* !TOPS20 */
+# else /* def TOPS20 */
/*---------------------------------------------------------------------------
Calculate the number of seconds since the epoch, usually 1 January 1970.
Adjust for local standard timezone offset.
---------------------------------------------------------------------------*/
-#if (!defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM))
-#ifdef WIN32
+# if !defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM)
+# ifdef WIN32
/* account for timezone differences */
res = GetTimeZoneInformation(&tzinfo);
if (res != TIME_ZONE_ID_INVALID)
{
m_time += 60*(tzinfo.Bias);
-#else /* !WIN32 */
-#if (defined(BSD) || defined(MTS) || defined(__GO32__))
-#ifdef BSD4_4
+# else /* def WIN32 */
+# if defined(BSD) || defined(MTS) || defined(__GO32__)
+# ifdef BSD4_4
if ( (dosdatetime >= DOSTIME_2038_01_18) &&
(m_time < (time_t)0x70000000L) )
m_time = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */
m_time = S_TIME_T_MAX; /* -> saturate at max signed time_t value */
if ((tm = localtime(&m_time)) != (struct tm *)NULL)
m_time -= tm->tm_gmtoff; /* sec. EAST of GMT: subtr. */
-#else /* !(BSD4_4 */
+# else /* def BSD4_4 */
ftime(&tbp); /* get `timezone' */
m_time += tbp.timezone * 60L; /* seconds WEST of GMT: add */
-#endif /* ?(BSD4_4 || __EMX__) */
-#else /* !(BSD || MTS || __GO32__) */
+# endif /* def BSD4_4 */
+# else /* defined(BSD) || defined(MTS) || defined(__GO32__) */
/* tzset was already called at start of process_zipfiles() */
/* tzset(); */ /* set `timezone' variable */
-#ifndef __BEOS__ /* BeOS DR8 has no timezones... */
+# ifndef __BEOS__ /* BeOS DR8 has no timezones... */
m_time += timezone; /* seconds WEST of GMT: add */
-#endif
-#endif /* ?(BSD || MTS || __GO32__) */
-#endif /* ?WIN32 */
+# endif /* ndef __BEOS__ */
+# endif /* defined(BSD) || defined(MTS) || defined(__GO32__) [else] */
+# endif /* def WIN32 [else] */
TTrace((stderr, " m_time after timezone = %lu\n", (ulg)m_time));
/*---------------------------------------------------------------------------
Adjust for local daylight savings (summer) time.
---------------------------------------------------------------------------*/
-#ifndef BSD4_4 /* (DST already added to tm_gmtoff, so skip tm_isdst) */
+# ifndef BSD4_4 /* (DST already added to tm_gmtoff, so skip tm_isdst) */
if ( (dosdatetime >= DOSTIME_2038_01_18) &&
(m_time < (time_t)0x70000000L) )
m_time = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */
m_time = S_TIME_T_MAX; /* -> saturate at max signed time_t value */
TIMET_TO_NATIVE(m_time) /* NOP unless MSC 7.0 or Macintosh */
if (((tm = localtime((time_t *)&m_time)) != NULL) && tm->tm_isdst)
-#ifdef WIN32
+# ifdef WIN32
m_time += 60L * tzinfo.DaylightBias; /* adjust with DST bias */
else
m_time += 60L * tzinfo.StandardBias; /* add StdBias (normally 0) */
-#else
+# else /* def WIN32 */
m_time -= 60L * 60L; /* adjust for daylight savings time */
-#endif
+# endif /* def WIN32 [else] */
NATIVE_TO_TIMET(m_time) /* NOP unless MSC 7.0 or Macintosh */
TTrace((stderr, " m_time after DST = %lu\n", (ulg)m_time));
-#endif /* !BSD4_4 */
-#ifdef WIN32
+# endif /* ndef BSD4_4 */
+# ifdef WIN32
}
-#endif
-#endif /* !MACOS && !RISCOS && !QDOS && !TANDEM */
-#endif /* ?TOPS20 */
+# endif /* def WIN32 */
+# endif /* !defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM) */
+# endif /* def TOPS20 [else] */
-#endif /* ?HAVE_MKTIME */
+# endif /* def HAVE_MKTIME [else] */
if ( (dosdatetime >= DOSTIME_2038_01_18) &&
(m_time < (time_t)0x70000000L) )
} /* end function dos_to_unix_time() */
-#endif /* !OS2 || TIMESTAMP */
-#endif /* !VMS && !CMS_MVS */
+# endif /* !defined(OS2) || defined(TIMESTAMP) */
+#endif /* !defined(VMS) && !defined(CMS_MVS) */
-#if (!defined(VMS) && !defined(OS2) && !defined(CMS_MVS))
+
+#if !defined(VMS) && !defined(OS2) && !defined(CMS_MVS)
/******************************/
/* Function check_for_newer() */ /* used for overwriting/freshening/updating */
char *filename; /* exist yet */
{
time_t existing, archive;
-#ifdef USE_EF_UT_TIME
+# ifdef USE_EF_UT_TIME
iztimes z_utime;
-#endif
-#ifdef AOS_VS
+# endif
+# ifdef AOS_VS
long dyy, dmm, ddd, dhh, dmin, dss;
if (!zvs_create(filename, (((ulg)dgdate(dmm, ddd, dyy)) << 16) |
(dhh*1800L + dmin*30L + dss/2L), -1L, -1L, (char *) -1, -1, -1, -1))
return DOES_NOT_EXIST;
-#endif /* AOS_VS */
+# endif /* AOS_VS */
Trace((stderr, "check_for_newer: doing stat(%s)\n", FnFilter1(filename)));
if (SSTAT(filename, &G.statbuf)) {
Trace((stderr,
"check_for_newer: stat(%s) returns %d: file does not exist\n",
FnFilter1(filename), SSTAT(filename, &G.statbuf)));
-#ifdef SYMLINKS
+# ifdef SYMLINKS
Trace((stderr, "check_for_newer: doing lstat(%s)\n",
FnFilter1(filename)));
/* GRR OPTION: could instead do this test ONLY if G.symlnk is true */
FnFilter1(filename), " with no real file"));
return EXISTS_AND_OLDER; /* symlink dates are meaningless */
}
-#endif /* SYMLINKS */
+# endif /* def SYMLINKS */
return DOES_NOT_EXIST;
}
Trace((stderr, "check_for_newer: stat(%s) returns 0: file exists\n",
FnFilter1(filename)));
-#ifdef SYMLINKS
+# ifdef SYMLINKS
/* GRR OPTION: could instead do this test ONLY if G.symlnk is true */
if (lstat(filename, &G.statbuf) == 0 && S_ISLNK(G.statbuf.st_mode)) {
Trace((stderr, "check_for_newer: %s is a symbolic link\n",
FnFilter1(filename), ""));
return EXISTS_AND_OLDER; /* symlink dates are meaningless */
}
-#endif /* SYMLINKS */
+# endif /* def SYMLINKS */
NATIVE_TO_TIMET(G.statbuf.st_mtime) /* NOP unless MSC 7.0 or Macintosh */
-#ifdef USE_EF_UT_TIME
+# ifdef USE_EF_UT_TIME
/* The `Unix extra field mtime' should be used for comparison with the
* time stamp of the existing file >>>ONLY<<< when the EF info is also
* used to set the modification time of the extracted file.
*/
if (G.extra_field &&
-#ifdef IZ_CHECK_TZ
+# ifdef IZ_CHECK_TZ
G.tz_is_valid &&
-#endif
+# endif
(ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
G.lrec.last_mod_dos_datetime, &z_utime, NULL)
& EB_UT_FL_MTIME))
G.statbuf.st_mtime + 1 : G.statbuf.st_mtime;
archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
}
-#else /* !USE_EF_UT_TIME */
+# else /* def USE_EF_UT_TIME */
/* round up existing filetime to nearest 2 seconds for comparison,
* but saturate in case of arithmetic overflow
*/
(G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ?
G.statbuf.st_mtime + 1 : G.statbuf.st_mtime;
archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
-#endif /* ?USE_EF_UT_TIME */
+# endif /* def USE_EF_UT_TIME [else] */
TTrace((stderr, "check_for_newer: existing %lu, archive %lu, e-a %ld\n",
(ulg)existing, (ulg)archive, (long)(existing-archive)));
} /* end function check_for_newer() */
-#endif /* !VMS && !OS2 && !CMS_MVS */
+#endif /* !defined(VMS) && !defined(OS2) && !defined(CMS_MVS) */
+
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+int check_for_newerw(__G__ filenamew) /* return 1 if existing file is newer */
+ __GDEF /* or equal; 0 if older; -1 if doesn't */
+ wchar_t *filenamew; /* exist yet */
+{
+ time_t existing, archive;
+# ifdef USE_EF_UT_TIME
+ iztimes z_utime;
+# endif
+
+ Trace((stderr, "check_for_newer: doing stat(%s)\n", FnFilter1(filename)));
+ if (SSTATW(filenamew, &G.statbuf)) {
+ Trace((stderr,
+ "check_for_newer: stat(%s) returns %d: file does not exist\n",
+ FnFilter1(filename), SSTAT(filename, &G.statbuf)));
+# ifdef SYMLINKS
+ Trace((stderr, "check_for_newer: doing lstat(%s)\n",
+ FnFilter1(filename)));
+ /* GRR OPTION: could instead do this test ONLY if G.symlnk is true */
+ if (lstatw(filenamew, &G.statbuf) == 0) {
+ Trace((stderr,
+ "check_for_newer: lstat(%s) returns 0: symlink does exist\n",
+ FnFilter1(filename)));
+ if (QCOND2 && !IS_OVERWRT_ALL)
+ Info(slide, 0, ((char *)slide, LoadFarString(FileIsSymLink),
+ FnFilterW1(filenamew), " with no real file"));
+ return EXISTS_AND_OLDER; /* symlink dates are meaningless */
+ }
+# endif /* def SYMLINKS */
+ return DOES_NOT_EXIST;
+ }
+ Trace((stderr, "check_for_newer: stat(%s) returns 0: file exists\n",
+ FnFilter1(filename)));
+
+# ifdef SYMLINKS
+ /* GRR OPTION: could instead do this test ONLY if G.symlnk is true */
+ if (lstatw(filenamew, &G.statbuf) == 0 && S_ISLNK(G.statbuf.st_mode)) {
+ Trace((stderr, "check_for_newer: %s is a symbolic link\n",
+ FnFilter1(filename)));
+ if (QCOND2 && !IS_OVERWRT_ALL)
+ Info(slide, 0, ((char *)slide, LoadFarString(FileIsSymLink),
+ FnFilterW1(filenamew), ""));
+ return EXISTS_AND_OLDER; /* symlink dates are meaningless */
+ }
+# endif /* def SYMLINKS */
+
+ NATIVE_TO_TIMET(G.statbuf.st_mtime) /* NOP unless MSC 7.0 or Macintosh */
+
+# ifdef USE_EF_UT_TIME
+ /* The `Unix extra field mtime' should be used for comparison with the
+ * time stamp of the existing file >>>ONLY<<< when the EF info is also
+ * used to set the modification time of the extracted file.
+ */
+ if (G.extra_field &&
+# ifdef IZ_CHECK_TZ
+ G.tz_is_valid &&
+# endif
+ (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
+ G.lrec.last_mod_dos_datetime, &z_utime, NULL)
+ & EB_UT_FL_MTIME))
+ {
+ TTrace((stderr, "check_for_newer: using Unix extra field mtime\n"));
+ existing = G.statbuf.st_mtime;
+ archive = z_utime.mtime;
+ } else {
+ /* round up existing filetime to nearest 2 seconds for comparison,
+ * but saturate in case of arithmetic overflow
+ */
+ existing = ((G.statbuf.st_mtime & 1) &&
+ (G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ?
+ G.statbuf.st_mtime + 1 : G.statbuf.st_mtime;
+ archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
+ }
+# else /* def USE_EF_UT_TIME */
+ /* round up existing filetime to nearest 2 seconds for comparison,
+ * but saturate in case of arithmetic overflow
+ */
+ existing = ((G.statbuf.st_mtime & 1) &&
+ (G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ?
+ G.statbuf.st_mtime + 1 : G.statbuf.st_mtime;
+ archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
+# endif /* def USE_EF_UT_TIME [else] */
+
+ TTrace((stderr, "check_for_newer: existing %lu, archive %lu, e-a %ld\n",
+ (ulg)existing, (ulg)archive, (long)(existing-archive)));
+
+ return (existing >= archive);
+} /* end function check_for_newerw() */
+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
#ifdef AMIGA
char tmp_fnote[2 * AMIGA_FILENOTELEN]; /* extra room for squozen chars */
#endif
+ ush flag;
/*---------------------------------------------------------------------------
length of the string: if zero, we're already done.
---------------------------------------------------------------------------*/
- if (!length)
- return PK_COOL;
+ /* 2012-05-01 SMS.
+ *
+ * if (!length)
+ * return PK_COOL;
+ *
+ * Well, no, if "length" is zero, then we're _not_ "already done".
+ * Exiting immediately would leave the destination buffer
+ * unmodified, so it would retain its previous value, instead of
+ * what should be a null string. (The APPNOTE says, "If input came
+ * from standard input, the file name length is set to zero." So,
+ * we need to handle that case accordingly.) Cases DS_FN and DS_FNL
+ * now substitute NULL_NAME_REPL (unzpriv.h) for a null archive
+ * member name. Other cases must handle a null name appropriately.
+ */
switch (option) {
-#if (defined(SFX) && defined(CHEAP_SFX_AUTORUN))
+#if defined(SFX) && defined(CHEAP_SFX_AUTORUN)
/*
* Special case: See if the comment begins with an autorun command line.
* Save that and display (or skip) the remainder.
char *eol;
length -= 10;
block_len = readbuf(__G__ G.autorun_command,
- MIN(length, sizeof(G.autorun_command)-1));
+ IZ_MIN(length, sizeof(G.autorun_command)-1));
if (block_len == 0)
return PK_EOF;
comment_bytes_left -= block_len;
length -= eol + 1 - G.autorun_command;
while (eol >= G.autorun_command && isspace(*eol))
*eol-- = '\0';
-#if (defined(WIN32) && !defined(_WIN32_WCE))
+# if defined(WIN32) && !defined(_WIN32_WCE)
/* Win9x console always uses OEM character coding, and
WinNT console is set to OEM charset by default, too */
INTERN_TO_OEM(G.autorun_command, G.autorun_command);
-#endif /* (WIN32 && !_WIN32_WCE) */
+# endif /* defined(WIN32) && !defined(_WIN32_WCE) */
}
}
if (option == CHECK_AUTORUN_Q) /* don't display the remainder */
if (!length)
break;
/* FALL THROUGH... */
-#endif /* SFX && CHEAP_SFX_AUTORUN */
+#endif /* defined(SFX) && defined(CHEAP_SFX_AUTORUN) */
/*
* First normal case: print string on standard output. First set loop
register uch *q = G.outbuf;
if ((block_len = readbuf(__G__ (char *)G.outbuf,
- MIN((unsigned)OUTBUFSIZ, comment_bytes_left))) == 0)
+ IZ_MIN((unsigned)OUTBUFSIZ, comment_bytes_left))) == 0)
return PK_EOF;
comment_bytes_left -= block_len;
#ifdef WINDLL
/* translate to ANSI (RTL internal codepage may be OEM) */
INTERN_TO_ISO((char *)G.outbuf, (char *)G.outbuf);
-#else /* !WINDLL */
-#if (defined(WIN32) && !defined(_WIN32_WCE))
+#else /* def WINDLL */
+# if defined(WIN32) && !defined(_WIN32_WCE)
/* Win9x console always uses OEM character coding, and
WinNT console is set to OEM charset by default, too */
INTERN_TO_OEM((char *)G.outbuf, (char *)G.outbuf);
-#endif /* (WIN32 && !_WIN32_WCE) */
-#endif /* ?WINDLL */
+# endif /* defined(WIN32) && !defined(_WIN32_WCE) */
+#endif /* def WINDLL [else] */
} else {
A_TO_N(G.outbuf); /* translate string to native */
}
win_fprintf((zvoid *)&G, stdout, (extent)(q-G.outbuf),
(char *)G.outbuf);
win_fprintf((zvoid *)&G, stdout, 2, (char *)"\n\n");
-#else /* !WINDLL */
-#ifdef NOANSIFILT /* GRR: can ANSI be used with EBCDIC? */
+#else /* def WINDLL */
+# ifdef NOANSIFILT /* GRR: can ANSI be used with EBCDIC? */
(*G.message)((zvoid *)&G, G.outbuf, (ulg)(q-G.outbuf), 0);
-#else /* ASCII, filter out ANSI escape sequences and handle ^S (pause) */
+# else /* def NOANSIFILT */
+ /* ASCII, filter out ANSI escape sequences and handle ^S (pause) */
p = G.outbuf - 1;
q = slide;
while (*++p) {
}
}
(*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0);
-#endif /* ?NOANSIFILT */
-#endif /* ?WINDLL */
+# endif /* def NOANSIFILT [else] */
+#endif /* def WINDLL [else] */
}
/* add '\n' if not at start of line */
(*G.message)((zvoid *)&G, slide, 0L, 0x40);
case DS_FN:
case DS_FN_L:
#ifdef UNICODE_SUPPORT
+ if (length == 0)
+ {
+ /* Replace a null name. */
+ extent fnbufsiz = sizeof( NULL_NAME_REPL);
+
+ if (G.fnfull_bufsize < fnbufsiz)
+ {
+ if (G.filename_full)
+ izu_free(G.filename_full);
+ G.filename_full = malloc( fnbufsiz);
+ if (G.filename_full == NULL)
+ return PK_MEM;
+ G.fnfull_bufsize = fnbufsiz;
+ }
+ strcpy( G.filename_full, NULL_NAME_REPL);
+ return PK_COOL;
+ }
/* get the whole filename as need it for Unicode checksum */
if (G.fnfull_bufsize <= length) {
extent fnbufsiz = FILNAMSIZ;
if (fnbufsiz <= length)
fnbufsiz = length + 1;
if (G.filename_full)
- free(G.filename_full);
+ izu_free(G.filename_full);
G.filename_full = malloc(fnbufsiz);
if (G.filename_full == NULL)
return PK_MEM;
block_len = 0;
strncpy(G.filename, G.filename_full, length);
G.filename[length] = '\0'; /* terminate w/zero: ASCIIZ */
-#else /* !UNICODE_SUPPORT */
+#else /* def UNICODE_SUPPORT */
+ if (length == 0)
+ {
+ strcpy( G.filename, NULL_NAME_REPL);
+ return PK_COOL;
+ }
if (length >= FILNAMSIZ) {
Info(slide, 0x401, ((char *)slide,
LoadFarString(FilenameTooLongTrunc)));
if (readbuf(__G__ G.filename, length) == 0)
return PK_EOF;
G.filename[length] = '\0'; /* terminate w/zero: ASCIIZ */
-#endif /* ?UNICODE_SUPPORT */
-
- /* translate the Zip entry filename coded in host-dependent "extended
- ASCII" into the compiler's (system's) internal text code page */
- Ext_ASCII_TO_Native(G.filename, G.pInfo->hostnum, G.pInfo->hostver,
- G.pInfo->HasUxAtt, (option == DS_FN_L));
+#endif /* def UNICODE_SUPPORT [else] */
+
+ flag = (option==DS_FN_L) ? G.lrec.general_purpose_bit_flag :
+ G.crec.general_purpose_bit_flag;
+ /* skip ISO/OEM translation if stored name is UTF-8 */
+ /* 2012-05-20 SMS.
+ * Added check for Java "CAFE" extra block, to avoid mistaking
+ * Java's mostly-zero header info for an MS-DOS origin. A more
+ * rigorous hostnum test might be easier, but might break other
+ * stuff.
+ */
+ if (((flag & UTF8_BIT) == 0) && (uO.java_cafe <= 0))
+ {
+ /* translate the Zip entry filename coded in host-dependent "extended
+ ASCII" into the compiler's (system's) internal text code page */
+ Ext_ASCII_TO_Native(G.filename, G.pInfo->hostnum, G.pInfo->hostver,
+ G.pInfo->HasUxAtt, (option == DS_FN_L));
+ }
if (G.pInfo->lcflag) /* replace with lowercase filename */
STRLOWER(G.filename, G.filename);
*/
case SKIP:
+ if (length == 0)
+ {
+ return PK_COOL;
+ }
+
/* cur_zipfile_bufstart already takes account of extra_bytes, so don't
* correct for it twice: */
seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes +
*/
case EXTRA_FIELD:
+ /* 2012-12-05 SMS. Changed to free old storage always, and to
+ * null G.extra_field if the length is zero.
+ */
+ /* Free any previous extra field storage. */
if (G.extra_field != (uch *)NULL)
- free(G.extra_field);
+ izu_free(G.extra_field);
+
+ /* Return early, if no data are expected. */
+ if (length == 0)
+ {
+ G.extra_field = (uch *)NULL;
+ return PK_COOL;
+ }
+ /* Allocate new extra field storage, and fill it. */
if ((G.extra_field = (uch *)malloc(length)) == (uch *)NULL) {
Info(slide, 0x401, ((char *)slide, LoadFarString(ExtraFieldTooLong),
length));
/* Looks like here is where extra fields are read */
getZip64Data(__G__ G.extra_field, length);
#ifdef UNICODE_SUPPORT
+ /* 2013-02-11 SMS.
+ * Free old G.unipath_filename storage, if not already
+ * done (G.unipath_filename == G.filename_full).
+ */
+ if ((G.unipath_filename != NULL) &&
+ (G.unipath_filename != G.filename_full))
+ {
+ izu_free( G.unipath_filename);
+ }
G.unipath_filename = NULL;
if (G.UzO.U_flag < 2) {
/* check if GPB11 (General Purpuse Bit 11) is set indicating
the standard path and comment are UTF-8 */
if (G.pInfo->GPFIsUTF8) {
/* if GPB11 set then filename_full is untruncated UTF-8 */
- G.unipath_filename = G.filename_full;
+ if (!(G.unipath_filename = malloc(strlen(G.filename_full)+1)))
+ return PK_MEM;
+ strcpy(G.unipath_filename, G.filename_full);
} else {
/* Get the Unicode fields if exist */
getUnicodeData(__G__ G.extra_field, length);
- if (G.unipath_filename && strlen(G.unipath_filename) == 0) {
+ if (G.unipath_filename && (*G.unipath_filename == '\0')) {
/* the standard filename field is UTF-8 */
- free(G.unipath_filename);
+ izu_free(G.unipath_filename);
G.unipath_filename = G.filename_full;
}
}
if (G.native_is_utf8
# ifdef UNICODE_WCHAR
&& (!G.unicode_escape_all)
-# endif
+# endif /* def UNICODE_WCHAR */
) {
strncpy(G.filename, G.unipath_filename, FILNAMSIZ - 1);
/* make sure filename is short enough */
}
# ifdef UNICODE_WCHAR
else
-# endif
-# endif /* UTF8_MAYBE_NATIVE */
+# endif /* def UNICODE_WCHAR */
+# endif /* def UTF8_MAYBE_NATIVE */
# ifdef UNICODE_WCHAR
{
char *fn;
}
/* replace filename with converted UTF-8 */
strcpy(G.filename, fn);
- free(fn);
+ izu_free(fn);
}
-# endif /* UNICODE_WCHAR */
+# endif /* def UNICODE_WCHAR */
+
+# if 0
+ /* 2013-02-10 SMS.
+ * This disabled code section does not catch all the
+ * cases. The new pre-use free() code, above, should.
+ */
if (G.unipath_filename != G.filename_full)
- free(G.unipath_filename);
- G.unipath_filename = NULL;
+ izu_free(G.unipath_full);
+ G.unipath_full = NULL;
+# endif /* 0 */
+
+ }
+# ifdef WIN32_WIDE
+# ifdef DYNAMIC_WIDE_NAME
+ /* 2013-02-12 SMS.
+ * Free old G.unipath_widefilename storage.
+ */
+ if (G.unipath_widefilename != NULL)
+ {
+ izu_free( G.unipath_widefilename);
+ G.unipath_widefilename = NULL;
+ }
+# else /* def DYNAMIC_WIDE_NAME */
+ *G.unipath_widefilename = L'\0';
+# endif /* def DYNAMIC_WIDE_NAME [else] */
+ if (G.has_win32_wide) {
+ if (G.unipath_filename)
+# ifdef DYNAMIC_WIDE_NAME
+ /* Get wide path from UTF-8 */
+ G.unipath_widefilename = utf8_to_wchar_string(G.unipath_filename);
+ else
+ G.unipath_widefilename = utf8_to_wchar_string(G.filename);
+# else /* def DYNAMIC_WIDE_NAME */
+ /* Get wide path from UTF-8 */
+ utf8_to_wchar_string( G.unipath_widefilename,
+ G.unipath_filename);
+ else
+ utf8_to_wchar_string( G.unipath_widefilename, G.filename);
+# endif /* def DYNAMIC_WIDE_NAME [else] */
+
+ if (G.pInfo->lcflag) /* replace with lowercase filename */
+ wcslwr(G.unipath_widefilename);
+
+ if (G.pInfo->vollabel && length > 8 && G.unipath_widefilename[8] == '.') {
+ wchar_t *p = G.unipath_widefilename+8;
+ while (*p++)
+ p[-1] = *p; /* disk label, and 8th char is dot: remove dot */
+ }
}
+# endif /* def WIN32_WIDE */
}
-#endif /* UNICODE_SUPPORT */
+#endif /* def UNICODE_SUPPORT */
}
break;
case FILENOTE:
if ((block_len = readbuf(__G__ tmp_fnote, (unsigned)
- MIN(length, 2 * AMIGA_FILENOTELEN - 1))) == 0)
+ IZ_MIN(length, 2 * AMIGA_FILENOTELEN - 1))) == 0)
return PK_EOF;
if ((length -= block_len) > 0) /* treat remainder as in case SKIP: */
seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes
tmp_fnote[block_len] = ' ';
tmp_fnote[AMIGA_FILENOTELEN - 1] = '\0';
if (G.filenotes[G.filenote_slot])
- free(G.filenotes[G.filenote_slot]); /* should not happen */
+ izu_free(G.filenotes[G.filenote_slot]); /* should not happen */
G.filenotes[G.filenote_slot] = NULL;
if (tmp_fnote[0]) {
if (!(G.filenotes[G.filenote_slot] = malloc(strlen(tmp_fnote)+1)))
strcpy(G.filenotes[G.filenote_slot], tmp_fnote);
}
break;
-#endif /* AMIGA */
+#endif /* def AMIGA */
} /* end switch (option) */
+#ifndef VMS
+
+/************************/
+/* Function name_only() */
+/************************/
+
+char *name_only( path)
+ char *path;
+{
+ /* Extract the name component from a path specification.
+ * Returns pointer to allocated storage; NULL, if error.
+ */
+
+ char *result = NULL;
+ char *dot;
+ char *name;
+ int len;
+
+ name = strrchr( path, '/');
+ if (name == NULL)
+ {
+ name = path; /* No slash found. */
+ }
+ else
+ {
+ name++; /* Name begins after slash. */
+ }
+
+# ifdef WIN32
+ {
+ /* On Windows, look for "\", too. */
+ char *nameb;
+
+ nameb = strrchr( name, '\\');
+ if (nameb != NULL)
+ {
+ name = nameb+ 1; /* Name begins after backslash. */
+ }
+ }
+# endif /* def WIN32 */
+
+ dot = strchr( name, '.');
+ if (dot == NULL)
+ {
+ len = strlen( name); /* No dot found. */
+ }
+ else
+ {
+ len = dot- name; /* Name ends before dot. */
+ }
+
+ if (len > 0)
+ {
+ result = izu_malloc( len+ 1);
+ if (result != NULL)
+ {
+ strncpy( result, name, len);
+ result[ len] = '\0';
+ }
+ }
+ return result;
+}
+
+#endif /* ndef VMS */
+
+
+
/***********************/
/* Function makeword() */
-
/***********************/
/* Function makelong() */
/***********************/
-
/************************/
/* Function makeint64() */
/************************/
+ (((unsigned)sig[1]) << 8)
+ (sig[0]));
-#else /* !LARGE_FILE_SUPPORT */
+#else /* def LARGE_FILE_SUPPORT */
if ((sig[7] | sig[6] | sig[5] | sig[4]) != 0)
return (zusz_t)0xffffffffL;
+ (((unsigned)sig[1]) << 8)
+ (sig[0]));
-#endif /* ?LARGE_FILE_SUPPORT */
+#endif /* def LARGE_FILE_SUPPORT [else] */
}
-
/*********************/
/* Function fzofft() */
/*********************/
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
-#ifdef NEED_STR2ISO
+# ifdef NEED_STR2ISO
/**********************/
/* Function str2iso() */
/**********************/
char *dst; /* destination buffer */
register ZCONST char *src; /* source string */
{
-#ifdef INTERN_TO_ISO
+# ifdef INTERN_TO_ISO
INTERN_TO_ISO(src, dst);
-#else
+# else /* def INTERN_TO_ISO */
register uch c;
register char *dstp = dst;
c = (uch)foreign(*src++);
*dstp++ = (char)ASCII2ISO(c);
} while (c != '\0');
-#endif
+# endif /* def INTERN_TO_ISO [else] */
return dst;
}
-#endif /* NEED_STR2ISO */
+# endif /* def NEED_STR2ISO */
+
-#ifdef NEED_STR2OEM
+
+# ifdef NEED_STR2OEM
/**********************/
/* Function str2oem() */
/**********************/
char *dst; /* destination buffer */
register ZCONST char *src; /* source string */
{
-#ifdef INTERN_TO_OEM
+# ifdef INTERN_TO_OEM
INTERN_TO_OEM(src, dst);
-#else
+# else /* def INTERN_TO_OEM */
register uch c;
register char *dstp = dst;
c = (uch)foreign(*src++);
*dstp++ = (char)ASCII2OEM(c);
} while (c != '\0');
-#endif
+# endif /* def INTERN_TO_OEM [else] */
return dst;
}
-#endif /* NEED_STR2OEM */
+# endif /* def NEED_STR2OEM */
+
+#endif /* def IZ_CRYPT_ANY */
+
-#endif /* CRYPT */
#ifdef ZMEM /* memset/memcmp/memcpy for systems without either them or */
+
/*********************/
/* Function memcmp() */
/*********************/
+
/*********************/
/* Function memcpy() */
/*********************/
return start;
}
-#endif /* ZMEM */
+#endif /* def ZMEM */
+
+
+
+
+#ifdef NEED_LABS
+
+/*******************/
+/* Function labs() */
+/*******************/
+
+long int labs( l)
+ long l;
+{
+ if (l >= 0)
+ return l;
+ else
+ return -l;
+}
+
+#endif /* def NEED_LABS */
return 0;
}
-#endif /* NO_STRNICMP */
+#endif /* def NO_STRNICMP */
return (stat((char *)p,s) >= 0? 0 : (-1));
}
-#endif /* REGULUS */
+#endif /* def REGULUS */
}
-#ifdef NEED_UZMBCLEN
+
+
+# ifdef NEED_UZMBCLEN
/***********************/
/* Function uzmbclen() */
/***********************/
*/
return (extent)(mbl > 0 ? mbl : 1);
}
-#endif /* NEED_UZMBCLEN */
+# endif /* def NEED_UZMBCLEN */
+
+
-#ifdef NEED_UZMBSCHR
+# ifdef NEED_UZMBSCHR
/***********************/
/* Function uzmbschr() */
/***********************/
}
return NULL;
}
-#endif /* NEED_UZMBSCHR */
+# endif /* def NEED_UZMBSCHR */
-#ifdef NEED_UZMBSRCHR
+
+
+# ifdef NEED_UZMBSRCHR
/************************/
/* Function uzmbsrchr() */
/************************/
}
return match;
}
-#endif /* NEED_UZMBSRCHR */
-#endif /* _MBCS */
-
+# endif /* def NEED_UZMBSRCHR */
+#endif /* def _MBCS */
-#if (!defined(_MSC_VER) || (_MSC_VER < 600))
+# if !defined(_MSC_VER) || (_MSC_VER < 600)
/*************************/
/* Function zfstrcpy() */ /* portable clone of _fstrcpy() */
/*************************/
return p;
}
-#if (!(defined(SFX) || defined(FUNZIP)))
+
+
+
+# if !(defined(SFX) || defined(FUNZIP))
/*************************/
/* Function zfstrcmp() */ /* portable clone of _fstrcmp() */
/*************************/
}
return ret;
}
-#endif /* !(SFX || FUNZIP) */
-#endif /* !_MSC_VER || (_MSC_VER < 600) */
+# endif /* !(defined(SFX) || defined(FUNZIP)) */
+# endif /* !defined(_MSC_VER) || (_MSC_VER < 600) */
-#endif /* SMALL_MEM */
+#endif /* def SMALL_MEM */
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
if (!renamed) { /* cp already set if renamed */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
}
/*---------------------------------------------------------------------------
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi; /* semi-colon was omitted: expect all #'s */
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
map2fat(pathcomp, last_dot); /* 8.3 truncation (in place) */
if (plu == (char *)NULL) { /* no dots, no underscores: truncate at */
if (pEnd > pathcomp+8) /* 8 chars (could insert '.' and keep 11) */
*(pEnd = pathcomp+8) = '\0';
- } else if (MIN(plu - pathcomp, 8) + MIN(pEnd - plu - 1, 3) > 8) {
+ } else if (IZ_MIN(plu - pathcomp, 8) + IZ_MIN(pEnd - plu - 1, 3) > 8) {
last_dot = plu; /* be lazy: drop through to next if-block */
} else if ((pEnd - pathcomp) > 8) /* more fits into just basename */
pathcomp[8] = '\0'; /* than if convert last underscore to dot */
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
*/
/* funzip.c -- by Mark Adler */
-#define VERSION "3.95 of 20 January 2009"
+#define VERSION "4.10 of 12 April 2013"
/* Copyright history:
- 14 Jan 01 - public release with UnZip 5.42
3.94 20 Feb 01 C. Spieler added support for Deflate64(tm)
23 Mar 02 C. Spieler changed mask_bits[] type to "unsigned"
+ 4.10 26 Jan 13 S. Schweda Zip64 support. Skip directory
+ members at the beginning of the
+ archive. Use symbolic exit status
+ codes. Check for EOF from
+ NEXTBYTE.
+ 12 Apr 13 Added labs().
*/
*/
#ifndef FUNZIP
-# define FUNZIP
+# define FUNZIP
#endif
#define UNZIP_INTERNAL
#include "unzip.h"
#include "ttyio.h"
#ifdef EBCDIC
-# undef EBCDIC /* don't need ebcdic[] */
+# undef EBCDIC /* don't need ebcdic[] */
#endif
#ifndef USE_ZLIB /* zlib's function is called inflate(), too */
-# define UZinflate inflate
+# define UZinflate inflate
#endif
/* PKZIP header definitions */
/* Macros cause stack overflow in compiler */
ush SH(uch* p) { return ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8)); }
ulg LG(uch* p) { return ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16)); }
-#else /* !THEOS */
+# ifdef ZIP64_SUPPORT
+zusz_t LL(uch *p) { return ((zusz_t)(LG(p)) | ((zusz_t)(LG((p)+4)) << 32)); }
+# endif /* def ZIP64_SUPPORT */
+#else /* def THEOS */
/* Macros for getting two-byte and four-byte header values */
-#define SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8))
-#define LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16))
-#endif /* ?THEOS */
+# define SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8))
+# define LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16))
+# ifdef ZIP64_SUPPORT
+# define LL(p) ((zusz_t)(LG(p)) | ((zusz_t)(LG((p)+4)) << 32))
+# endif /* def ZIP64_SUPPORT */
+#endif /* def THEOS [else] */
/* Function prototypes */
static void err OF((int, char *));
-#if (defined(USE_DEFLATE64) && defined(__16BIT__))
+#if (defined(DEFLATE64_SUPPORT) && defined(__16BIT__))
static int partflush OF((uch *rawbuf, unsigned w));
#endif
int main OF((int, char **));
/* Globals */
FILE *out; /* output file (*in moved to G struct) */
-ulg outsiz; /* total bytes written to out */
+zusz_t outsiz; /* total bytes written to out */
int encrypted; /* flag to turn on decryption */
/* Masks for inflate.c */
return 0;
G.inptr = G.inbuf;
-#if CRYPT
+# ifdef IZ_CRYPT_ANY
if (encrypted) {
uch *p;
int n;
for (n = G.incnt, p = G.inptr; n--; p++)
zdecode(*p);
}
-#endif /* CRYPT */
+# endif /* def IZ_CRYPT_ANY */
return G.incnt;
}
-#if (defined(USE_DEFLATE64) && defined(__16BIT__))
+#if defined(DEFLATE64_SUPPORT) && defined(__16BIT__)
static int partflush(rawbuf, w)
uch *rawbuf; /* start of buffer area to flush */
{
G.crc32val = crc32(G.crc32val, rawbuf, (extent)w);
if (fwrite((char *)rawbuf,1,(extent)w,out) != (extent)w && !PIPE_ERROR)
- err(9, "out of space on stdout");
+ err(PK_DISK, "out of space on stdout");
outsiz += w;
return 0;
}
return partflush(rawbuf, (extent)w);
} /* end function flush() */
-#else /* !(USE_DEFLATE64 && __16BIT__) */
+#else /* defined(DEFLATE64_SUPPORT) && defined(__16BIT__) */
int flush(w) /* used by inflate.c (FLUSH macro) */
ulg w; /* number of bytes to flush */
{
G.crc32val = crc32(G.crc32val, slide, (extent)w);
if (fwrite((char *)slide,1,(extent)w,out) != (extent)w && !PIPE_ERROR)
- err(9, "out of space on stdout");
+ err(PK_DISK, "out of space on stdout");
outsiz += w;
return 0;
}
-#endif /* ?(USE_DEFLATE64 && __16BIT__) */
+#endif /* defined(DEFLATE64_SUPPORT) && defined(__16BIT__) [else] */
+/* 2012-11-25 SMS. (OUSPG report.)
+ * Changed eb_len and ef_len from unsigned to signed, to catch underflow
+ * of ef_len caused by corrupt/malicious data. (32-bit is adequate.
+ * Used "long" to accommodate any systems with 16-bit "int".)
+ */
int main(argc, argv)
int argc;
char **argv;
/* Given a zipfile on stdin, decompress the first entry to stdout. */
{
+ unsigned eb_id;
+ long eb_len;
+ uch *ef_buf;
+ uch *ef_bufx;
+ long ef_len;
+ zusz_t csize;
+ zusz_t ucsiz;
+ zusz_t ucsize;
+ int good_member;
+
ush n;
uch h[LOCHDR]; /* first local header (GZPHDR < LOCHDR) */
int g = 0; /* true if gzip format */
unsigned method = 0; /* initialized here to shut up gcc warning */
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
char *s = " [-password]";
char *p; /* password */
-#else /* !CRYPT */
+#else /* def IZ_CRYPT_ANY */
char *s = "";
-#endif /* ?CRYPT */
+#endif /* def IZ_CRYPT_ANY [else] */
CONSTRUCTGLOBALS();
/* skip executable name */
argc--;
argv++;
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
/* get the command line password, if any */
p = (char *)NULL;
if (argc && **argv == '-')
argc--;
p = 1 + *argv++;
}
-#endif /* CRYPT */
+#endif /* def IZ_CRYPT_ANY */
#ifdef MALLOC_WORK
- /* The following expression is a cooked-down simplyfication of the
+ /* The following expression is a cooked-down simplification of the
calculation for the work area size of UnZip (see unzip.c). For
fUnZip, the work area does not need to match the granularity
- of the complex unshrink structures, because it only supports
- inflation. But, like in UnZip, the zcalloc() wrapper function
+ of the complex unshrink structures, because it supports only
+ inflation. But, as in UnZip, the zcalloc() wrapper function
is needed for the allocation, to support the 64kByte buffer on
16-bit systems.
*/
if (argc)
{
if ((G.in = fopen(*argv, FOPR)) == (FILE *)NULL)
- err(2, "cannot find input file");
+ err(PK_NOZIP, "cannot find input file");
}
else
{
#ifdef DOS_FLX_NLM_OS2_W32
-#if (defined(__HIGHC__) && !defined(FLEXOS))
+# if (defined(__HIGHC__) && !defined(FLEXOS))
setmode(stdin, _BINARY);
-#else
- setmode(0, O_BINARY); /* some buggy C libraries require BOTH setmode() */
-#endif /* call AND the fdopen() in binary mode :-( */
+# else
+ setmode(0, O_BINARY); /* some buggy C libraries require BOTH setmode() */
+# endif /* call AND the fdopen() in binary mode :-( */
#endif /* DOS_FLX_NLM_OS2_W32 */
#ifdef RISCOS
G.in = stdin;
#else
if ((G.in = fdopen(0, FOPR)) == (FILE *)NULL)
- err(2, "cannot find stdin");
+ err(PK_NOZIP, "cannot find stdin");
#endif
}
#ifdef DOS_FLX_H68_NLM_OS2_W32
-#if (defined(__HIGHC__) && !defined(FLEXOS))
+# if (defined(__HIGHC__) && !defined(FLEXOS))
setmode(stdout, _BINARY);
-#else
+# else
setmode(1, O_BINARY);
-#endif
+# endif
#endif /* DOS_FLX_H68_NLM_OS2_W32 */
#ifdef RISCOS
out = stdout;
#else
if ((out = fdopen(1, FOPW)) == (FILE *)NULL)
- err(2, "cannot write to stdout");
+ err(PK_DISK, "cannot write to stdout");
#endif
/* read local header, check validity, and skip name and extra fields */
+ /* Read first two bytes. Look for Zip or gzip signature. */
n = getc(G.in); n |= getc(G.in) << 8;
if (n == ZIPMAG)
{
- if (fread((char *)h, 1, LOCHDR, G.in) != LOCHDR || SH(h) != LOCREM)
- err(3, "invalid zipfile");
- switch (method = SH(h + LOCHOW)) {
+ /* Zip signature. Read local headers until a non-directory member
+ * name is found.
+ */
+ good_member = 0;
+ while (good_member == 0)
+ {
+ if (fread((char *)h, 1, LOCHDR, G.in) != LOCHDR || SH(h) != LOCREM)
+ err(PK_BADERR, "invalid zipfile");
+
+ /* Get compressed and uncompressed sizes from the local header. */
+ csize = LG( h + LOCSIZ);
+ ucsize = LG( h + LOCLEN);
+
+ /* Waste the file name (but keep the last character). */
+ for (n = SH(h + LOCFIL); n--; ) g = getc(G.in);
+
+ /* Process the extra field, if any. */
+ ef_len = SH( h + LOCEXT);
+ if (ef_len > 0)
+ {
+ /* Allocate storage for the extra field, and read it. */
+ ef_buf = (uch *)izu_malloc( ef_len);
+ if (ef_buf == (uch *)NULL)
+ err(PK_MEM, "out of memory");
+
+ /* Read the extra field data. */
+ if (fread( ef_buf, 1, ef_len, G.in) != ef_len)
+ err( PK_BADERR, "invalid zipfile");
+
+ /* Scan the extra field for a 0x0001 (Zip64) extra block. */
+ ef_bufx = ef_buf;
+ while (ef_len >= EB_HEADSIZE)
+ {
+ eb_id = SH( EB_ID+ ef_bufx);
+ eb_len = SH( EB_LEN+ ef_bufx);
+ if (eb_id == 0x0001)
+ {
+#ifdef ZIP64_SUPPORT
+ /* Extract Zip64 (large) size data from the Zip64 extra block. */
+ uch *eb_bufp;
+
+ eb_bufp = ef_bufx+ EB_HEADSIZE;
+ if (ucsize == 0xffffffff)
+ {
+ /* Uncompressed size. */
+ ucsize = LL( eb_bufp);
+ eb_bufp += 8;
+ }
+ if (csize == 0xffffffff)
+ {
+ /* Compressed size. */
+ csize = LL( eb_bufp);
+ eb_bufp += 8;
+ }
+
+#else /* def ZIP64_SUPPORT */
+ err( PK_COMPERR, "Zip64 extra field found, but no Zip64 support");
+#endif /* def ZIP64_SUPPORT [else] */
+ }
+
+ /* Advance to the next extra field block */
+ ef_bufx += (eb_len + EB_HEADSIZE);
+ ef_len -= (eb_len + EB_HEADSIZE);
+ }
+ /* Free the extra field storage. */
+ izu_free( ef_buf);
+ }
+
+ /* If this member is a directory, then skip to the next one. */
+ if (g == '/')
+ {
+ /* Waste the data to reach the next local header. */
+ for (ucsize = csize; ucsize--; ) g = getc(G.in);
+ /* Look for the local header signature. */
+ n = getc(G.in); n |= getc(G.in) << 8;
+ if (n == ZIPMAG)
+ continue;
+ err(PK_BADERR, "invalid zipfile (lhl)");
+ }
+ /* Not a directory. Escape loop to look for other problems. */
+ good_member = 1;
+ }
+
+ switch (method = SH(h + LOCHOW))
+ {
case STORED:
case DEFLATED:
-#ifdef USE_DEFLATE64
+#ifdef DEFLATE64_SUPPORT
case ENHDEFLATED:
#endif
break;
default:
- err(3, "first entry not deflated or stored--cannot unpack");
+ err(PK_BADERR, "first entry not deflated or stored--cannot unpack");
break;
}
- for (n = SH(h + LOCFIL); n--; ) g = getc(G.in);
- for (n = SH(h + LOCEXT); n--; ) g = getc(G.in);
g = 0;
encrypted = h[LOCFLG] & CRPFLG;
}
else if (n == GZPMAG)
{
+ /* Gzip. */
if (fread((char *)h, 1, GZPHDR, G.in) != GZPHDR)
- err(3, "invalid gzip file");
+ err(PK_BADERR, "invalid gzip file");
if ((method = h[GZPHOW]) != DEFLATED && method != ENHDEFLATED)
- err(3, "gzip file not deflated");
+ err(PK_BADERR, "gzip file not deflated");
if (h[GZPFLG] & GZPMUL)
- err(3, "cannot handle multi-part gzip files");
+ err(PK_BADERR, "cannot handle multi-part gzip files");
if (h[GZPFLG] & GZPISX)
{
n = getc(G.in); n |= getc(G.in) << 8;
encrypted = h[GZPFLG] & GZPISE;
}
else
- err(3, "input not a zip or gzip file");
+ err(PK_BADERR, "input not a zip or gzip file");
/* if entry encrypted, decrypt and validate encryption header */
if (encrypted)
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
{
ush i, e;
if (p == (char *)NULL) {
- if ((p = (char *)malloc(IZ_PWLEN+1)) == (char *)NULL)
- err(1, "out of memory");
+ if ((p = (char *)izu_malloc(IZ_PWLEN+1)) == (char *)NULL)
+ err(PK_MEM3, "out of memory");
else if ((p = getp("Enter password: ", p, IZ_PWLEN+1)) == (char *)NULL)
- err(1, "no tty to prompt for password");
+ err(IZ_PW_ERROR, "no tty to prompt for password");
}
/* initialize crc_32_tab pointer for decryption */
CRC_32_TAB = get_crc_table();
/* prepare the decryption keys for extraction and check the password */
init_keys(p);
for (i = 0; i < RAND_HEAD_LEN; i++)
- e = NEXTBYTE;
+ {
+ /* 2013-01-23 SMS. Quit reading when data exhausted. */
+ if ((e = NEXTBYTE) == (ush)EOF)
+ break;
+ }
if (e != (ush)(h[LOCFLG] & EXTFLG ? h[LOCTIM + 1] : h[LOCCRC + 3]))
- err(3, "incorrect password for first entry");
+ err(PK_PARAM, "incorrect password for first entry");
}
-#else /* !CRYPT */
- err(3, "cannot decrypt entry (need to recompile with full crypt.c)");
-#endif /* ?CRYPT */
+#else /* def IZ_CRYPT_ANY */
+ err(PK_COMPERR, "encrypted member, but no CRYPT support");
+#endif /* def IZ_CRYPT_ANY [else] */
/* prepare output buffer and crc */
G.outptr = slide;
- G.outcnt = 0L;
- outsiz = 0L;
+ G.outcnt = 0;
+ outsiz = 0;
G.crc32val = CRCVAL_INITIAL;
/* decompress */
#ifdef USE_ZLIB
/* need to allocate and prepare input buffer */
- if ((G.inbuf = (uch *)malloc(INBUFSIZ)) == (uch *)NULL)
- err(1, "out of memory");
+ if ((G.inbuf = (uch *)izu_malloc(INBUFSIZ)) == (uch *)NULL)
+ err(PK_MEM3, "out of memory");
#endif /* USE_ZLIB */
if ((r = UZinflate(__G__ (method == ENHDEFLATED))) != 0) {
if (r == 3)
- err(1, "out of memory");
+ err(PK_MEM3, "out of memory");
else
- err(4, "invalid compressed data--format violated");
+ err(PK_BADERR, "invalid compressed data--format violated");
}
inflate_free(__G);
}
else
{ /* stored entry */
- register ulg n;
-
- n = LG(h + LOCLEN);
-#if CRYPT
- if (n != LG(h + LOCSIZ) - (encrypted ? RAND_HEAD_LEN : 0)) {
-#else
- if (n != LG(h + LOCSIZ)) {
-#endif
- Info(slide, 1, ((char *)slide, "len %ld, siz %ld\n", n, LG(h + LOCSIZ)));
- err(4, "invalid compressed data--length mismatch");
+#ifdef IZ_CRYPT_ANY
+ if (ucsize != csize - (encrypted ? RAND_HEAD_LEN : 0)) {
+#else /* def IZ_CRYPT_ANY */
+ if (ucsize != csize) {
+#endif /* def IZ_CRYPT_ANY [else] */
+#ifdef ZIP64_SUPPORT
+ Info(slide, 1, ((char *)slide, "len %llu, siz %llu\n",
+ ucsize, csize));
+#else /* def ZIP64_SUPPORT */
+ Info(slide, 1, ((char *)slide, "len %lu, siz %lu\n",
+ ucsize, csize));
+#endif /* def ZIP64_SUPPORT [else] */
+ err(PK_BADERR, "invalid compressed data--length mismatch");
}
- while (n--) {
+
+ ucsiz = ucsize;
+ while (ucsiz--) {
ush c = getc(G.in);
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
if (encrypted)
zdecode(c);
-#endif
+#endif /* def IZ_CRYPT_ANY */
*G.outptr++ = (uch)c;
-#if (defined(USE_DEFLATE64) && defined(__16BIT__))
+#if (defined(DEFLATE64_SUPPORT) && defined(__16BIT__))
if (++G.outcnt == (WSIZE>>1)) /* do FlushOutput() */
#else
if (++G.outcnt == WSIZE) /* do FlushOutput() */
G.crc32val = crc32(G.crc32val, slide, (extent)G.outcnt);
if (fwrite((char *)slide, 1,(extent)G.outcnt,out) != (extent)G.outcnt
&& !PIPE_ERROR)
- err(9, "out of space on stdout");
+ err(PK_DISK, "out of space on stdout");
outsiz += G.outcnt;
G.outptr = slide;
- G.outcnt = 0L;
+ G.outcnt = 0;
}
}
}
G.crc32val = crc32(G.crc32val, slide, (extent)G.outcnt);
if (fwrite((char *)slide, 1,(extent)G.outcnt,out) != (extent)G.outcnt
&& !PIPE_ERROR)
- err(9, "out of space on stdout");
+ err(PK_DISK, "out of space on stdout");
outsiz += G.outcnt;
}
fflush(out);
- /* if extended header, get it */
+ /* If Gzip, then read the trailer, and extract the uncompressed size.
+ * If Zip extended header (data descriptor) is expected, then read it,
+ * placing the CRC where it would have been in the header buffer.
+ */
if (g)
{
+ /* Gzip. */
if (fread((char *)h + LOCCRC, 1, 8, G.in) != 8)
- err(3, "gzip file ended prematurely");
+ err(PK_BADERR, "gzip file ended prematurely");
+
+ /* Get uncompressed size from Gzip trailer.
+ * (Wrong macro name, right datum.)
+ * What about 64-bit sizes???
+ */
+ ucsize = LG( h + LOCSIZ);
}
else
+ {
+ /* Zip extended header (data descriptor). */
if ((h[LOCFLG] & EXTFLG) &&
- fread((char *)h + LOCCRC - 4, 1, EXTHDR, G.in) != EXTHDR)
- err(3, "zipfile ended prematurely");
+ fread((char *)h + LOCCRC - 4, 1, EXTHDR, G.in) != EXTHDR)
+ err(PK_BADERR, "zipfile ended prematurely");
+ }
- /* validate decompression */
+ /* Validate CRC. */
if (LG(h + LOCCRC) != G.crc32val)
- err(4, "invalid compressed data--crc error");
- if (LG((g ? (h + LOCSIZ) : (h + LOCLEN))) != outsiz)
- err(4, "invalid compressed data--length error");
+ err(PK_ERR, "invalid compressed data--crc error");
- /* check if there are more entries */
+ /* Validate uncompressed size. */
+ if (ucsize != outsiz)
+ err(PK_ERR, "invalid compressed data--length error");
+
+ /* Complain about additional (ignored) Zip archive members. */
if (!g && fread((char *)h, 1, 4, G.in) == 4 && LG(h) == LOCSIG)
Info(slide, 1, ((char *)slide,
- "funzip warning: zipfile has more than one entry--rest ignored\n"));
+ "funzip warning: zipfile has more than one entry--rest ignored\n"));
DESTROYGLOBALS();
RETURN (0);
}
+
+
+#ifdef NEED_LABS
+
+/*******************/
+/* Function labs() */
+/*******************/
+
+long int labs( l)
+ long l;
+{
+ if (l >= 0)
+ return l;
+ else
+ return -l;
+}
+
+#endif /* def NEED_LABS */
+
+++ /dev/null
-FUNZIP(1L) FUNZIP(1L)
-
-NAME
- funzip - filter for extracting from a ZIP archive in a pipe
-
-SYNOPSIS
- funzip [-password] [input[.zip|.gz]]
-
-ARGUMENTS
- [-password]
- Optional password to be used if ZIP archive is encrypted.
- Decryption may not be supported at some sites. See DESCRIPTION
- for more details.
-
- [input[.zip|.gz]]
- Optional input archive file specification. See DESCRIPTION for
- details.
-
-DESCRIPTION
- funzip without a file argument acts as a filter; that is, it assumes
- that a ZIP archive (or a gzip'd(1) file) is being piped into standard
- input, and it extracts the first member from the archive to stdout.
- When stdin comes from a tty device, funzip assumes that this cannot be
- a stream of (binary) compressed data and shows a short help text,
- instead. If there is a file argument, then input is read from the
- specified file instead of from stdin.
-
- A password for encrypted zip files can be specified on the command line
- (preceding the file name, if any) by prefixing the password with a
- dash. Note that this constitutes a security risk on many systems; cur-
- rently running processes are often visible via simple commands (e.g.,
- ps(1) under Unix), and command-line histories can be read. If the
- first entry of the zip file is encrypted and no password is specified
- on the command line, then the user is prompted for a password and the
- password is not echoed on the console.
-
- Given the limitation on single-member extraction, funzip is most useful
- in conjunction with a secondary archiver program such as tar(1). The
- following section includes an example illustrating this usage in the
- case of disk backups to tape.
-
-EXAMPLES
- To use funzip to extract the first member file of the archive test.zip
- and to pipe it into more(1):
-
- funzip test.zip | more
-
- To use funzip to test the first member file of test.zip (any errors
- will be reported on standard error):
-
- funzip test.zip > /dev/null
-
- To use zip and funzip in place of compress(1) and zcat(1) (or gzip(1L)
- and gzcat(1L)) for tape backups:
-
- tar cf - . | zip -7 | dd of=/dev/nrst0 obs=8k
- dd if=/dev/nrst0 ibs=8k | funzip | tar xf -
-
- (where, for example, nrst0 is a SCSI tape drive).
-
-BUGS
- When piping an encrypted file into more and allowing funzip to prompt
- for password, the terminal may sometimes be reset to a non-echo mode.
- This is apparently due to a race condition between the two programs;
- funzip changes the terminal mode to non-echo before more reads its
- state, and more then ``restores'' the terminal to this mode before
- exiting. To recover, run funzip on the same file but redirect to
- /dev/null rather than piping into more; after prompting again for the
- password, funzip will reset the terminal properly.
-
- There is presently no way to extract any member but the first from a
- ZIP archive. This would be useful in the case where a ZIP archive is
- included within another archive. In the case where the first member is
- a directory, funzip simply creates the directory and exits.
-
- The functionality of funzip should be incorporated into unzip itself
- (future release).
-
-SEE ALSO
- gzip(1L), unzip(1L), unzipsfx(1L), zip(1L), zipcloak(1L), zipinfo(1L),
- zipnote(1L), zipsplit(1L)
-
-URL
- The Info-ZIP home page is currently at
- http://www.info-zip.org/pub/infozip/
- or
- ftp://ftp.info-zip.org/pub/infozip/ .
-
-AUTHOR
- Mark Adler (Info-ZIP)
-
-Info-ZIP 20 April 2009 (v3.95) FUNZIP(1L)
/*
- Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2012 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.
#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
printf(out_format, "_wsize", (ulg)&G._wsize - (ulg)&G);
#endif /* DLL && !NO_SLIDE_REDIR */
- printf(out_format, "CRYPT", (ulg)CRYPT);
+#ifdef IZ_CRYPT_AES_WG
+ (*set_flag)("IZ_CRYPT_AES_WG");
+#endif
+#ifdef IZ_CRYPT_ANY
+ (*set_flag)("IZ_CRYPT_ANY");
+#endif
+#ifdef IZ_CRYPT_TRAD
+ (*set_flag)("IZ_CRYPT_TRAD");
+#endif
#ifdef FUNZIP
(*set_flag)("FUNZIP");
#endif
(*set_flag)("NO_SLIDE_REDIR");
# endif
#endif
-#ifdef USE_DEFLATE64
- (*set_flag)("USE_DEFLATE64");
+#ifdef DEFLATE64_SUPPORT
+ (*set_flag)("DEFLATE64_SUPPORT");
#endif
return 0;
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2003-May-08 or later
(the contents of which are also included in unzip.h) for terms of use.
char end_central64_sig[4] = {0, 0, 0x06, 0x06};
char end_centloc64_sig[4] = {0, 0, 0x06, 0x07};
/* extern char extd_local_sig[4] = {0, 0, 0x07, 0x08}; NOT USED YET */
-
-ZCONST char *fnames[2] = {"*", NULL}; /* default filenames vector */
-#endif
+#endif /* ndef FUNZIP */
#ifndef REENTRANT
if (scan == THREADID_ENTRIES) {
ZCONST char *tooMany = LoadFarString(TooManyThreads);
Info(slide, 0x421, ((char *)slide, tooMany, THREADID_ENTRIES));
- free(pG);
+ izu_free(pG);
EXIT(PK_MEM); /* essentially memory error before we've started */
}
threadIdTable [scan] = 0;
lastScan = scan;
- free(threadPtrTable[scan]);
+ izu_free(threadPtrTable[scan]);
}
Uz_Globs *globalsCtor()
{
#ifdef REENTRANT
- Uz_Globs *pG = (Uz_Globs *)malloc(sizeof(Uz_Globs));
+ Uz_Globs *pG = (Uz_Globs *)izu_malloc(sizeof(Uz_Globs));
if (!pG)
return (Uz_Globs *)NULL;
#ifdef TANDEM
uO.aflag=1; /* default to '-a' auto create Text Files as type 101 */
#endif
-#ifdef VMS
-# if (!defined(NO_TIMESTAMPS))
- uO.D_flag=1; /* default to '-D', no restoration of dir timestamps */
-# endif
+#if (!defined(NO_TIMESTAMPS))
+ uO.D_flag = 1; /* Default to '-D', no restoration of dir timestamps. */
#endif
uO.lflag=(-1);
G.wildzipfn = "";
- G.pfnames = (char **)fnames;
- G.pxnames = (char **)&fnames[1];
G.pInfo = G.info;
G.sol = TRUE; /* at start of line */
G.message = UzpMessagePrnt;
G.input = UzpInput; /* not used by anyone at the moment... */
-#if defined(WINDLL) || defined(MACOS)
+#if defined(WINDLL) || defined(MACOS) || defined( DLL)
G.mpause = NULL; /* has scrollbars: no need for pausing */
#else
G.mpause = UzpMorePause;
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
If you make the inclusion of any variables conditional, be sure to only
check macros that are GUARANTEED to be included in every module.
- For instance, newzip and pwdarg are needed only if CRYPT is TRUE,
- but this is defined after unzip.h has been read. If you are not careful,
- some modules will expect your variable to be part of this struct while
- others won't. This will cause BIG problems. (Inexplicable crashes at
- strange times, car fires, etc.) When in doubt, always include it!
+ For instance, newzip and pwdarg are needed only if IZ_CRYPT_ANY is
+ defined, but this is defined after unzip.h has been read. If you are
+ not careful, some modules will expect your variable to be part of this
+ struct while others won't. This will cause BIG problems. (Inexplicable
+ crashes at strange times, car fires, etc.) When in doubt, always
+ include it!
Note also that UnZipSFX needs a few variables that UnZip doesn't. However,
it also includes some object files from UnZip. If we were to conditionally
---------------------------------------------------------------------------*/
#ifndef __globals_h
-#define __globals_h
+# define __globals_h
-#ifdef USE_ZLIB
+# ifdef USE_ZLIB
+ /* zlib.h may define OF(), conflicting with our definition.
+ * First, protect zlib.h from our definition.
+ */
+# undef OF
# include "zlib.h"
# ifdef zlib_version /* This name is used internally in unzip */
-# undef zlib_version /* and must not be defined as a macro. */
+# undef zlib_version /* and must not be defined as a macro. */
# endif
-#endif
+ /* Finally, restore our definition. */
+# undef OF
+# ifdef PROTO
+# define OF(a) a
+# else
+# define OF(a) ()
+# endif
+# endif
+
+# ifdef IZ_CRYPT_AES_WG
+# include "aes_wg/fileenc.h"
+# endif
-#ifdef USE_BZIP2
+# ifdef BZIP2_SUPPORT
# include "bzlib.h"
-#endif
+# endif /* def BZIP2_SUPPORT */
+
+# if defined( LZMA_SUPPORT) || defined( PPMD_SUPPORT)
+# include "szip/Types.h"
+# endif /* defined( LZMA_SUPPORT) || defined( PPMD_SUPPORT) */
+
+# ifdef LZMA_SUPPORT
+# include "szip/LzmaDec.h"
+# endif /* def LZMA_SUPPORT */
+
+# ifdef PPMD_SUPPORT
+# include "szip/Ppmd8.h"
+
+struct Globals; /* Early (vacant) declaration. */
+
+/* 7-Zip I/O structure (reduced). */
+typedef struct
+{
+ IByteIn p;
+ Bool extra;
+ SRes res;
+ struct Globals *pG;
+} CByteInToLook;
+# endif /* def PPMD_SUPPORT */
/*************/
/*************/
typedef struct Globals {
-#ifdef DLL
+# ifdef DLL
zvoid *callerglobs; /* pointer to structure of pass-through global vars */
-#endif
+# endif
/* command options of general use */
UzpOpts UzO; /* command options of general use */
-#ifndef FUNZIP
+# ifndef FUNZIP
/* command options specific to the high level command line interface */
-#ifdef MORE
+# ifdef MORE
int M_flag; /* -M: built-in "more" function */
-#endif
+# endif
/* internal flags and general globals */
-#ifdef MORE
+# ifdef MORE
int height; /* check for SIGWINCH, etc., eventually... */
int lines; /* count of lines displayed on current screen */
-# if (defined(SCREENWIDTH) && defined(SCREENLWRAP))
+# if (defined(SCREENWIDTH) && defined(SCREENLWRAP))
int width;
int chars; /* count of screen characters in current line */
-# endif
-#endif /* MORE */
-#if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME))
+# endif
+# endif /* MORE */
+ FILE *outfp_prev; /* Previous outfp for fileio.c:UzpMessagePrnt(). */
+# if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME))
int tz_is_valid; /* indicates that timezone info can be used */
-#endif
+# endif
int noargs; /* did true command line have *any* arguments? */
unsigned filespecs; /* number of real file specifications to be matched */
unsigned xfilespecs; /* number of excluded filespecs to be matched */
zoff_t csize; /* used by decompr. (NEXTBYTE): must be signed */
zoff_t used_csize; /* used by extract_or_test_member(), explode() */
-#ifdef DLL
+# if defined( UNIX) && defined( __APPLE__)
+ int apple_double; /* True for an AppleDouble file ("._name"). */
+ int apl_dbl_hdr_alloc; /* Allocated size of apl_dbl_hdr. */
+ int apl_dbl_hdr_bytes; /* Bytes left to read for apl_dbl_hdr. */
+ int apl_dbl_hdr_len; /* Bytes in apl_dbl_hdr. */
+ int exdir_attr_ok; /* True if dest supports setattrlist(). */
+ unsigned char *apl_dbl_hdr; /* AppleDouble header buffer. */
+ char ad_filename[ FILNAMSIZ]; /* AppleDouble "/rsrc" file name. */
+ char pq_filename[ FILNAMSIZ]; /* Previous query file name. */
+ char pr_filename[ FILNAMSIZ]; /* Previous rename file name. */
+# endif /* defined( UNIX) && defined( __APPLE__) */
+
+# ifdef DLL
int fValidate; /* true if only validating an archive */
int filenotfound;
int redirect_data; /* redirect data to memory buffer */
int redirect_text; /* redirect text output to buffer */
-# ifndef NO_SLIDE_REDIR
+# ifndef NO_SLIDE_REDIR
int redirect_slide; /* redirect decompression area to mem buffer */
-# if (defined(USE_DEFLATE64) && defined(INT_16BIT))
+# if (defined(DEFLATE64_SUPPORT) && defined(INT_16BIT))
ulg _wsize; /* size of sliding window exceeds "unsigned" range */
-# else
+# else
unsigned _wsize; /* sliding window size can be hold in unsigned */
-# endif
-# endif
+# endif
+# endif
ulg redirect_size; /* size of redirected output buffer */
uch *redirect_buffer; /* pointer to head of allocated buffer */
uch *redirect_pointer; /* pointer past end of written data */
-# ifndef NO_SLIDE_REDIR
+# ifndef NO_SLIDE_REDIR
uch *redirect_sldptr; /* head of decompression slide buffer */
-# endif
-# ifdef OS2DLL
+# endif
+# ifdef OS2DLL
cbList(processExternally); /* call-back list */
-# endif
-#endif /* DLL */
+# endif
+# endif /* DLL */
char **pfnames;
char **pxnames;
char answerbuf[10];
min_info info[DIR_BLKSIZ];
min_info *pInfo;
-#endif /* !FUNZIP */
+# endif /* !FUNZIP */
union work area; /* see unzpriv.h for definition of work */
-#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB))
+# if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB))
ZCONST ulg near *crc_32_tab;
-#else
- ZCONST ulg Far *crc_32_tab;
-#endif
+# else
+/* 2012-05-31 SMS.
+ * Zlib 1.2.7 changed the type of *get_crc_table() from uLongf to
+ * z_crc_t (to get a 32-bit type on systems with a 64-bit long). To
+ * avoid complaints about mismatched (int-long) pointers (such as
+ * %CC-W-PTRMISMATCH on VMS, for example), we need to match the type
+ * zlib uses. At zlib version 1.2.7, the only indicator available to
+ * CPP seems to be the Z_U4 macro.
+ */
+# ifdef Z_U4
+ ZCONST z_crc_t Far *crc_32_tab;
+# else /* def Z_U4 */
+ ZCONST uLongf Far *crc_32_tab;
+# endif /* def Z_U4 [else] */
+# endif
ulg crc32val; /* CRC shift reg. (was static in funzip) */
-#ifdef FUNZIP
+# ifdef FUNZIP
FILE *in; /* file descriptor of compressed stream */
-#endif
+# endif
uch *inbuf; /* input buffer (any size is OK) */
uch *inptr; /* pointer into input buffer */
int incnt;
-#ifndef FUNZIP
+# ifndef FUNZIP
ulg bitbuf;
int bits_left; /* unreduce and unshrink only */
int zipeof;
char *argv0; /* used for NT and EXE_EXTENSION */
char *wildzipfn;
char *zipfn; /* GRR: WINDLL: must nuke any malloc'd zipfn... */
-#ifdef USE_STRM_INPUT
+# ifdef USE_STRM_INPUT
FILE *zipfd; /* zipfile file descriptor */
-#else
+# else
int zipfd; /* zipfile file handle */
-#endif
+# endif
zoff_t ziplen;
zoff_t cur_zipfile_bufstart; /* extract_or_test, readbuf, ReadByte */
zoff_t extra_bytes; /* used in unzip.c, misc.c */
ulg numlines; /* fileio static: number of lines printed */
int sol; /* fileio static: at start of line */
int no_ecrec; /* process static */
-#ifdef SYMLINKS
+# ifdef SYMLINKS
int symlnk;
slinkentry *slink_head; /* pointer to head of symlinks list */
slinkentry *slink_last; /* pointer to last entry in symlinks list */
-#endif
-#ifdef NOVELL_BUG_FAILSAFE
+# endif
+# ifdef NOVELL_BUG_FAILSAFE
int dne; /* true if stat() says file doesn't exist */
-#endif
+# endif
FILE *outfile;
uch *outbuf;
uch *realbuf;
-#ifndef VMS /* if SMALL_MEM, outbuf2 is initialized in */
+# ifndef VMS /* if SMALL_MEM, outbuf2 is initialized in */
uch *outbuf2; /* process_zipfiles() (never changes); */
-#endif /* else malloc'd ONLY if unshrink and -a */
-#endif /* !FUNZIP */
+# endif /* else malloc'd ONLY if unshrink and -a */
+# endif /* !FUNZIP */
uch *outptr;
ulg outcnt; /* number of chars stored in outbuf */
-#ifndef FUNZIP
+# ifndef FUNZIP
char filename[FILNAMSIZ]; /* also used by NT for temporary SFX path */
-#ifdef UNICODE_SUPPORT
+ char *jdir_filename; /* Ptr (in filename[]) to non-junk path. */
+# ifdef UNICODE_SUPPORT
char *filename_full; /* the full path so Unicode checks work */
extent fnfull_bufsize; /* size of allocated filename buffer */
int unicode_escape_all;
int unicode_mismatch;
-#ifdef UTF8_MAYBE_NATIVE
+# ifdef UTF8_MAYBE_NATIVE
int native_is_utf8; /* bool, TRUE => native charset == UTF-8 */
-#endif
+# endif /* def UTF8_MAYBE_NATIVE */
int unipath_version; /* version of Unicode field */
ulg unipath_checksum; /* Unicode field checksum */
char *unipath_filename; /* UTF-8 path */
-#endif /* UNICODE_SUPPORT */
-
-#ifdef CMS_MVS
+# ifdef WIN32_WIDE
+# ifdef DYNAMIC_WIDE_NAME
+ wchar_t *unipath_widefilename; /* wide character filename */
+# else /* def DYNAMIC_WIDE_NAME */
+ wchar_t unipath_widefilename[FILNAMSIZ]; /* wide character filename */
+# endif /* def DYNAMIC_WIDE_NAME [else] */
+ wchar_t *unipath_jdir_widefilename; /* Ptr to non-junk path. */
+ int has_win32_wide; /* true if Win32 W calls work */
+# endif /* def WIN32_WIDE */
+# if defined( ICONV_MAPPING) && defined( MAX_CP_NAME)
+ /* ISO/OEM (iconv) character conversion. */
+ char iso_cp[ MAX_CP_NAME]; /* Character set names. */
+ char oem_cp[ MAX_CP_NAME];
+# endif /* defined( ICONV_MAPPING) && defined( MAX_CP_NAME) */
+# endif /* def UNICODE_SUPPORT */
+
+# ifdef CMS_MVS
char *tempfn; /* temp file used; erase on close */
-#endif
+# endif
char *key; /* crypt static: decryption password or NULL */
int nopwd; /* crypt static */
-#endif /* !FUNZIP */
+# endif /* !FUNZIP */
z_uint4 keys[3]; /* crypt static: keys defining pseudo-random sequence */
-#if (!defined(DOS_FLX_H68_NLM_OS2_W32) && !defined(AMIGA) && !defined(RISCOS))
-#if (!defined(MACOS) && !defined(ATARI) && !defined(VMS))
+# if (!defined(DOS_FLX_H68_NLM_OS2_W32) && !defined(AMIGA) && !defined(RISCOS))
+# if (!defined(MACOS) && !defined(ATARI) && !defined(VMS))
int echofd; /* ttyio static: file descriptor whose echo is off */
-#endif /* !(MACOS || ATARI || VMS) */
-#endif /* !(DOS_FLX_H68_NLM_OS2_W32 || AMIGA || RISCOS) */
+# endif /* !(MACOS || ATARI || VMS) */
+# endif /* !(DOS_FLX_H68_NLM_OS2_W32 || AMIGA || RISCOS) */
unsigned hufts; /* track memory usage */
-#ifdef USE_ZLIB
+# ifdef USE_ZLIB
int inflInit; /* inflate static: zlib inflate() initialized */
z_stream dstrm; /* inflate global: decompression stream */
-#else
+# else
struct huft *fixed_tl; /* inflate static */
struct huft *fixed_td; /* inflate static */
unsigned fixed_bl, fixed_bd; /* inflate static */
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
struct huft *fixed_tl64; /* inflate static */
struct huft *fixed_td64; /* inflate static */
unsigned fixed_bl64, fixed_bd64; /* inflate static */
ZCONST ush *cplens; /* inflate static */
ZCONST uch *cplext; /* inflate static */
ZCONST uch *cpdext; /* inflate static */
-#endif
+# endif /* def DEFLATE64_SUPPORT */
unsigned wp; /* inflate static: current position in slide */
ulg bb; /* inflate static: bit buffer */
unsigned bk; /* inflate static: bits count in bit buffer */
-#endif /* ?USE_ZLIB */
+# endif /* ?USE_ZLIB */
-#ifndef FUNZIP
+# ifndef FUNZIP
/* cylindric buffer space for formatting zoff_t values (fileio static) */
char fzofft_buf[FZOFFT_NUM][FZOFFT_LEN];
int fzofft_index;
-#ifdef SMALL_MEM
+# ifdef SMALL_MEM
char rgchBigBuffer[512];
char rgchSmallBuffer[96];
char rgchSmallBuffer2[160]; /* boosted to 160 for local3[] in unzip.c */
-#endif
+# endif
MsgFn *message;
InputFn *input;
PauseFn *mpause;
PasswdFn *decr_passwd;
StatCBFn *statreportcb;
-#ifdef WINDLL
+# if defined( WINDLL)
LPUSERFUNCTIONS lpUserFunctions;
-#endif
+# endif
+
+# ifdef VMS
+ FILE *msgfp; /* Message/prompt output file. */
+# endif /* def VMS */
int incnt_leftover; /* so improved NEXTBYTE does not waste input */
uch *inptr_leftover;
-#ifdef VMS_TEXT_CONV
+# ifdef VMS_TEXT_CONV
unsigned VMS_line_length; /* so native VMS variable-length text files */
int VMS_line_state; /* are readable on other platforms */
int VMS_line_pad;
-#endif
+# endif
-#if (defined(SFX) && defined(CHEAP_SFX_AUTORUN))
+# if (defined(SFX) && defined(CHEAP_SFX_AUTORUN))
char autorun_command[FILNAMSIZ];
-#endif
-#endif /* !FUNZIP */
+# endif
-#ifdef SYSTEM_SPECIFIC_GLOBALS
+# ifdef IZ_CRYPT_AES_WG
+ /* 2011-05-24 SMS.
+ * AES_WG encryption parameters.
+ */
+ zoff_t ucsize_aes; /* AES uncompressed bytes left to decrypt. */
+ fcrypt_ctx zcx[ 1]; /* AES context. */
+# endif /* def IZ_CRYPT_AES_WG */
+
+/* 7-Zip (LZMA, PPMd) memory allocation function structure. */
+# if defined( LZMA_SUPPORT) || defined( PPMD_SUPPORT)
+ ISzAlloc g_Alloc;
+# endif /* defined( LZMA_SUPPORT) || defined( PPMD_SUPPORT) */
+
+/* 7-Zip LZMA compression parameters. */
+# ifdef LZMA_SUPPORT
+ CLzmaProps clzma_props; /* LZMA properties. */
+ CLzmaDec state_lzma; /* LZMA context. */
+# endif /* def LZMA_SUPPORT */
+
+/* 7-Zip PPMd compression parameters. */
+# ifdef PPMD_SUPPORT
+ CPpmd8 ppmd8; /* PPMd structure. */
+ int ppmd_constructed; /* PPMd initialization flag. */
+ CByteInToLook szios; /* 7-Zip-like I/O structure. */
+# endif /* def PPMD_SUPPORT */
+
+# ifdef ENABLE_USER_PROGRESS
+ ZCONST char *extract_msg_str; /* Mthd str used with ExtractMsg[]. */
+# endif /* def ENABLE_USER_PROGRESS */
+
+# endif /* ndef FUNZIP */
+
+# ifdef SYSTEM_SPECIFIC_GLOBALS
SYSTEM_SPECIFIC_GLOBALS
-#endif
+# endif
} Uz_Globs; /* end of struct Globals */
/***************************************************************************/
-#define CRC_32_TAB G.crc_32_tab
+# define CRC_32_TAB G.crc_32_tab
Uz_Globs *globalsCtor OF((void));
extern char end_centloc64_sig[4];
/* extern char extd_local_sig[4]; NOT USED YET */
-#ifdef REENTRANT
+# ifdef REENTRANT
# define G (*(Uz_Globs *)pG)
# define __G pG
# define __G__ pG,
# define __GPRO__ Uz_Globs *pG,
# define __GDEF Uz_Globs *pG;
# ifdef USETHREADID
- extern int lastScan;
- void deregisterGlobalPointer OF((__GPRO));
- Uz_Globs *getGlobalPointer OF((void));
-# define GETGLOBALS() Uz_Globs *pG = getGlobalPointer()
-# define DESTROYGLOBALS() do {free_G_buffers(pG); \
+ extern int lastScan;
+ void deregisterGlobalPointer OF((__GPRO));
+ Uz_Globs *getGlobalPointer OF((void));
+# define GETGLOBALS() Uz_Globs *pG = getGlobalPointer()
+# define DESTROYGLOBALS() do {free_G_buffers(pG); \
deregisterGlobalPointer(pG);} while (0)
# else
- extern Uz_Globs *GG;
-# define GETGLOBALS() Uz_Globs *pG = GG
-# define DESTROYGLOBALS() do {free_G_buffers(pG); free(pG);} while (0)
+ extern Uz_Globs *GG;
+# define GETGLOBALS() Uz_Globs *pG = GG
+# define DESTROYGLOBALS() do {free_G_buffers(pG); free(pG);} while (0)
# endif /* ?USETHREADID */
# define CONSTRUCTGLOBALS() Uz_Globs *pG = globalsCtor()
-#else /* !REENTRANT */
+# else /* !REENTRANT */
extern Uz_Globs G;
# define __G
# define __G__
# define GETGLOBALS()
# define CONSTRUCTGLOBALS() globalsCtor()
# define DESTROYGLOBALS()
-#endif /* ?REENTRANT */
+# endif /* ?REENTRANT */
-#define uO G.UzO
+# define uO G.UzO
#endif /* __globals_h */
;===========================================================================
-; Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
+; Copyright (c) 1990-2012 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.
; If, for some reason, all these files are missing, the Info-ZIP license
; also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
;===========================================================================
-; flate.a created by Paul Kienitz, 20 June 94. Last modified 23 Mar 2002.
+; flate.a created by Paul Kienitz, 20 June 94. Last modified 16 Jan 2012.
;
; 68000 assembly language version of inflate_codes(), for Amiga. Prototype:
;
;
; Define INT16 if ints are short, otherwise it assumes ints are long.
;
-; Define USE_DEFLATE64 if we're supporting Deflate64 decompression.
+; Define DEFLATE64_SUPPORT if we're supporting Deflate64 decompression.
;
-; Do NOT define WSIZE; it is always 32K or 64K depending on USE_DEFLATE64.
+; Do NOT define WSIZE; it is always 32K or 64K depending on DEFLATE64_SUPPORT.
;
; 1999/09/23: for Human68k: Modified by Shimazaki Ryo.
; Couple other items we need:
savregs reg d2-d7/a2/a3/a6
- IFDEF USE_DEFLATE64
+ IFDEF DEFLATE64_SUPPORT
WSIZE equ $10000 ; 64K... be careful not to treat as short!
ELSE
WSIZE equ $08000 ; 32K... be careful not to treat as negative!
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
map2fat(pathcomp, last_dot); /* 18.3 truncation (in place) */
int fd;
if (QCOND2)
- Info(slide, 0, ((char *)slide, " labelling: %s\n",
+ Info(slide, 0, ((char *)slide, " labeling: %s\n",
FnFilter1(G.filename)));
if ((fd = _dos_newfile(G.filename, G.pInfo->file_attr)) < 0) {
Info(slide, 1, ((char *)slide,
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2007-Mar-04 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
when processing invalid compressed data and
hitting premature EOF, do not reuse td as
temp work ptr during tables decoding
+ c17f 13 Jul 10 S. Schweda Added FUNZIP conditionality to uses of
+ G.disk_full.
*/
#define INFMOD /* tell inflate.h to include code to be compiled */
#include "inflate.h"
+#ifdef DEFLATE_SUPPORT
/* marker for "unused" huft code, and corresponding check macro */
#define INVALID_CODE 99
#define IS_INVALID_CODE(c) ((c) == INVALID_CODE)
#ifndef WSIZE /* default is 32K resp. 64K */
-# ifdef USE_DEFLATE64
-# define WSIZE 65536L /* window size--must be a power of two, and */
-# else /* at least 64K for PKZip's deflate64 method */
-# define WSIZE 0x8000 /* window size--must be a power of two, and */
-# endif /* at least 32K for zip's deflate method */
+# ifdef DEFLATE64_SUPPORT
+# define WSIZE 65536L /* window size--must be a power of two, and */
+# else /* at least 64K for PKZip's deflate64 method */
+# define WSIZE 0x8000 /* window size--must be a power of two, and */
+# endif /* at least 32K for zip's deflate method */
#endif
-/* some buffer counters must be capable of holding 64k for Deflate64 */
-#if (defined(USE_DEFLATE64) && defined(INT_16BIT))
-# define UINT_D64 ulg
+/* some buffer counters must be capable of holding 64K for Deflate64 */
+#if (defined(DEFLATE64_SUPPORT) && defined(INT_16BIT))
+# define UINT_D64 ulg
#else
-# define UINT_D64 unsigned
+# define UINT_D64 unsigned
#endif
#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
-# define wsize G._wsize /* wsize is a variable */
+# define wsize G._wsize /* wsize is a variable */
#else
-# define wsize WSIZE /* wsize is a constant */
+# define wsize WSIZE /* wsize is a constant */
+#endif
+
+/* Type cast for wsize. Should not overflow at 64K. */
+#ifdef INT_16BIT
+# define WSCAST unsigned long
+#else
+# define WSCAST unsigned
#endif
#ifndef NEXTBYTE /* default is to simply get a byte from stdin */
-# define NEXTBYTE getchar()
+# define NEXTBYTE getchar()
#endif
#ifndef MESSAGE /* only used twice, for fixed strings--NOT general-purpose */
-# define MESSAGE(str,len,flag) fprintf(stderr,(char *)(str))
+# define MESSAGE(str,len,flag) fprintf(stderr,(char *)(str))
#endif
#ifndef FLUSH /* default is to simply write the buffer to stdout */
-# define FLUSH(n) \
- (((extent)fwrite(redirSlide, 1, (extent)(n), stdout) == (extent)(n)) ? \
- 0 : PKDISK)
+# define FLUSH(n) \
+ (((extent)fwrite(redirSlide, 1, (extent)(n), stdout) == (extent)(n)) ? \
+ 0 : PKDISK)
#endif
/* Warning: the fwrite above might not work on 16-bit compilers, since
0x8000 might be interpreted as -32,768 by the library function. When
simple fwrite statement is definitely broken for 16-bit compilers. */
#ifndef Trace
-# ifdef DEBUG
-# define Trace(x) fprintf x
-# else
-# define Trace(x)
-# endif
+# ifdef DEBUG
+# define Trace(x) fprintf x
+# else
+# define Trace(x)
+# endif
#endif
The preprocessor flag NO_ZLIBCALLBCK can be set to force usage of the
old zlib 1.1.x interface, for testing purpose.
*/
-#ifdef USE_ZLIB_INFLATCB
+# ifdef USE_ZLIB_INFLATCB
# undef USE_ZLIB_INFLATCB
-#endif
-#if (defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1200 && !defined(NO_ZLIBCALLBCK))
+# endif
+# if (defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1200 && !defined(NO_ZLIBCALLBCK))
# define USE_ZLIB_INFLATCB 1
-#else
+# else
# define USE_ZLIB_INFLATCB 0
-#endif
+# endif
/* Check for incompatible combinations of zlib and Deflate64 support. */
-#if defined(USE_DEFLATE64)
-# if !USE_ZLIB_INFLATCB
- #error Deflate64 is incompatible with traditional (pre-1.2.x) zlib interface!
-# else
+# if defined(DEFLATE64_SUPPORT)
+# if !USE_ZLIB_INFLATCB
+ /* This line is indented to hide the #error directive from pure traditional
+ * K&R C preprocessors. These do not recognize the #error directive, but
+ * they also recognize only lines that start with a '#' in column 1 as
+ * preprocessor directives.
+ */
+ # error Deflate64 is incompatible with traditional (pre-1.2.x) zlib interface!
+# else
/* The Deflate64 callback function in the framework of zlib 1.2.x requires
the inclusion of the unsupported infback9 header file:
*/
-# include "infback9.h"
-# endif
-#endif /* USE_DEFLATE64 */
+# include "infback9.h"
+# endif
+# endif /* DEFLATE64_SUPPORT */
-#if USE_ZLIB_INFLATCB
+# if USE_ZLIB_INFLATCB
static unsigned zlib_inCB OF((void FAR *pG, unsigned char FAR * FAR * pInbuf));
static int zlib_outCB OF((void FAR *pG, unsigned char FAR *outbuf,
unsigned char FAR *outbuf;
unsigned outcnt;
{
-#ifdef FUNZIP
+# ifdef FUNZIP
return flush(__G__ (ulg)(outcnt));
-#else
+# else
return ((G.mem_mode) ? memflush(__G__ outbuf, (ulg)(outcnt))
: flush(__G__ outbuf, (ulg)(outcnt), 0));
-#endif
+# endif
}
-#endif /* USE_ZLIB_INFLATCB */
+# endif /* USE_ZLIB_INFLATCB */
/*
{
int retval = 0; /* return code: 0 = "no error" */
int err=Z_OK;
-#if USE_ZLIB_INFLATCB
-
-#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
- if (G.redirect_slide)
+# if USE_ZLIB_INFLATCB
+
+# if (defined(DLL) && !defined(NO_SLIDE_REDIR))
+ /* 2012-03-15 SMS.
+ * Problem reported by Ireneusz Hallmann.
+ * inflateBack() reuses the beginning of the output buffer
+ * if amount of output data is larger than window size.
+ * Therefore separate redirect buffer must be used for larger files.
+ * Formerly, the condition below was simply:
+ * if (G.redirect_slide)
+ */
+ if (G.redirect_slide && (G.redirect_size <= WSIZE)
+# ifdef USE_DEFLATE64
+ && (is_defl64 || (G.redirect_size <= (WSIZE >> 1)))
+# endif
+ )
wsize = G.redirect_size, redirSlide = G.redirect_buffer;
else
wsize = WSIZE, redirSlide = slide;
-#endif
+# endif /* (defined(DLL) && !defined(NO_SLIDE_REDIR)) */
if (!G.inflInit) {
/* local buffer for efficiency */
G.inflInit = 1;
}
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
if (is_defl64)
{
Trace((stderr, "initializing inflate9()\n"));
retval = 2;
} else {
/* output write failure */
+# ifdef FUNZIP
+ retval = PK_DISK;
+# else /* def FUNZIP */
retval = (G.disk_full != 0 ? PK_DISK : IZ_CTRLC);
+# endif /* def FUNZIP [else] */
}
} else {
Trace((stderr, "oops! (inflateBack9() err = %d)\n", err));
}
}
else
-#endif /* USE_DEFLATE64 */
+# endif /* DEFLATE64_SUPPORT */
{
/* For the callback interface, inflate initialization has to
be called before each decompression call.
{
unsigned i;
int windowBits;
- /* windowBits = log2(wsize) */
- for (i = (unsigned)wsize, windowBits = 0;
- !(i & 1); i >>= 1, ++windowBits);
- if ((unsigned)windowBits > (unsigned)15)
+ /* windowBits = log2(wsize), min = 8, max = 15. */
+ /* 2012-03-15 SMS.
+ * Problem reported by Ireneusz Hallmann. Calculation of
+ * windowBits was defective for non-power-of-two values of
+ * wsize.
+ * Simplified method. Should give the same results for
+ * power-of-two values of wsize (and less goofy results for
+ * non-power-of-two values). Using "wsize-1+wsize"
+ * effectively rounds up to the next higher power of two.
+ * (256 -> 8, 257 -> 9, 512 -> 9, 513 -> 10, ...) Was:
+ *
+ * for (i = (unsigned)wsize, windowBits = 0;
+ * !(i & 1); i >>= 1, ++windowBits);
+ */ /* ^^^^^^^^--- Eewww. */ /*
+ * if ((unsigned)windowBits > (unsigned)15)
+ * windowBits = 15;
+ * else if (windowBits < 8)
+ * windowBits = 8;
+ */
+ for (i = ((WSCAST)wsize- 1+ (WSCAST)wsize) >> 9, windowBits = 8;
+ i != 0; i >>= 1, ++windowBits);
+ if (windowBits > 15)
windowBits = 15;
- else if (windowBits < 8)
- windowBits = 8;
Trace((stderr, "initializing inflate()\n"));
err = inflateBackInit(&G.dstrm, windowBits, redirSlide);
retval = 2;
} else {
/* output write failure */
+# ifdef FUNZIP
+ retval = PK_DISK;
+# else /* def FUNZIP */
retval = (G.disk_full != 0 ? PK_DISK : IZ_CTRLC);
+# endif /* def FUNZIP [else] */
}
} else {
Trace((stderr, "oops! (inflateBack() err = %d)\n", err));
}
}
-#else /* !USE_ZLIB_INFLATCB */
+# else /* !USE_ZLIB_INFLATCB */
int repeated_buf_err;
-#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
- if (G.redirect_slide)
+# if (defined(DLL) && !defined(NO_SLIDE_REDIR))
+ /* 2012-03-15 SMS.
+ * See comments above (in the USE_ZLIB_INFLATCB section).
+ */
+ if (G.redirect_slide && (G.redirect_size <= WSIZE)
+# ifdef USE_DEFLATE64
+ && (is_defl64 || (G.redirect_size <= (WSIZE >> 1)))
+# endif
+ )
wsize = G.redirect_size, redirSlide = G.redirect_buffer;
else
wsize = WSIZE, redirSlide = slide;
-#endif
+# endif /* (defined(DLL) && !defined(NO_SLIDE_REDIR)) */
G.dstrm.next_out = redirSlide;
G.dstrm.avail_out = wsize;
"warning: different zlib version (expected %s, using %s)\n",
ZLIB_VERSION, zlib_RtVersion));
- /* windowBits = log2(wsize) */
- for (i = (unsigned)wsize, windowBits = 0;
- !(i & 1); i >>= 1, ++windowBits);
- if ((unsigned)windowBits > (unsigned)15)
+ /* windowBits = log2(wsize), min = 8, max = 15. */
+ /* 2012-03-15 SMS.
+ * See comments above (on the similar windowBits calculation).
+ */
+ for (i = ((WSCAST)wsize- 1+ (WSCAST)wsize) >> 9, windowBits = 8;
+ i != 0; i >>= 1, ++windowBits);
+ if (windowBits > 15)
windowBits = 15;
- else if (windowBits < 8)
- windowBits = 8;
G.dstrm.zalloc = (alloc_func)Z_NULL;
G.dstrm.zfree = (free_func)Z_NULL;
G.inflInit = 1;
}
-#ifdef FUNZIP
+# ifdef FUNZIP
while (err != Z_STREAM_END) {
-#else /* !FUNZIP */
+# else /* !FUNZIP */
while (G.csize > 0) {
Trace((stderr, "first loop: G.csize = %ld\n", G.csize));
-#endif /* ?FUNZIP */
+# endif /* ?FUNZIP */
while (G.dstrm.avail_out > 0) {
err = inflate(&G.dstrm, Z_PARTIAL_FLUSH);
} else if (err != Z_OK && err != Z_STREAM_END)
Trace((stderr, "oops! (inflate(first loop) err = %d)\n", err));
-#ifdef FUNZIP
+# ifdef FUNZIP
if (err == Z_STREAM_END) /* "END-of-entry-condition" ? */
-#else /* !FUNZIP */
+# else /* !FUNZIP */
if (G.csize <= 0L) /* "END-of-entry-condition" ? */
-#endif /* ?FUNZIP */
+# endif /* ?FUNZIP */
break;
if (G.dstrm.avail_in == 0) {
} else if (err == Z_MEM_ERROR) {
retval = 3; goto uzinflate_cleanup_exit;
} else if (err == Z_BUF_ERROR) { /* DEBUG */
-#ifdef FUNZIP
+# ifdef FUNZIP
Trace((stderr,
"zlib inflate() did not detect stream end\n"));
-#else
+# else
Trace((stderr,
"zlib inflate() did not detect stream end (%s, %s)\n",
G.zipfn, G.filename));
-#endif
+# endif
if ((!repeated_buf_err) && (G.dstrm.avail_in == 0)) {
/* when detecting this problem for the first time,
try to provide one fake byte beyond "EOF"... */
if (err != Z_OK)
Trace((stderr, "oops! (inflateReset() err = %d)\n", err));
-#endif /* ?USE_ZLIB_INFLATCB */
+# endif /* ?USE_ZLIB_INFLATCB */
return retval;
}
/* Function prototypes */
-#ifndef OF
+# ifndef OF
# ifdef __STDC__
-# define OF(a) a
+# define OF(a) a
# else
-# define OF(a) ()
+# define OF(a) ()
# endif
-#endif /* !OF */
+# endif /* !OF */
int inflate_codes OF((__GPRO__ struct huft *tl, struct huft *td,
unsigned bl, unsigned bd));
static int inflate_stored OF((__GPRO));
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
/* - Copy lengths for literal codes 257..285 */
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
static ZCONST ush cplens64[] = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 3, 0, 0};
/* For Deflate64, the code 285 is defined differently. */
-#else
+# else
# define cplens32 cplens
-#endif
+# endif
static ZCONST ush cplens32[] = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
/* note: see note #13 above about the 258 in this list. */
/* - Extra bits for literal codes 257..285 */
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
static ZCONST uch cplext64[] = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 16, INVALID_CODE, INVALID_CODE};
-#else
+# else
# define cplext32 cplext
-#endif
+# endif
static ZCONST uch cplext32[] = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, INVALID_CODE, INVALID_CODE};
static ZCONST ush cpdist[] = {
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
-#if (defined(USE_DEFLATE64) || defined(PKZIP_BUG_WORKAROUND))
+# if (defined(DEFLATE64_SUPPORT) || defined(PKZIP_BUG_WORKAROUND))
8193, 12289, 16385, 24577, 32769, 49153};
-#else
+# else
8193, 12289, 16385, 24577};
-#endif
+# endif
/* - Extra bits for distance codes 0..29 (0..31 for Deflate64) */
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
static ZCONST uch cpdext64[] = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
12, 12, 13, 13, 14, 14};
-#else
+# else
# define cpdext32 cpdext
-#endif
+# endif
static ZCONST uch cpdext32[] = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
-#ifdef PKZIP_BUG_WORKAROUND
+# ifdef PKZIP_BUG_WORKAROUND
12, 12, 13, 13, INVALID_CODE, INVALID_CODE};
-#else
+# else
12, 12, 13, 13};
-#endif
+# endif
-#ifdef PKZIP_BUG_WORKAROUND
+# ifdef PKZIP_BUG_WORKAROUND
# define MAXLITLENS 288
-#else
+# else
# define MAXLITLENS 286
-#endif
-#if (defined(USE_DEFLATE64) || defined(PKZIP_BUG_WORKAROUND))
+# endif
+# if (defined(DEFLATE64_SUPPORT) || defined(PKZIP_BUG_WORKAROUND))
# define MAXDISTS 32
-#else
+# else
# define MAXDISTS 30
-#endif
+# endif
/* moved to consts.h (included in unzip.c), resp. funzip.c */
unsigned bk; /* bits in bit buffer */
#endif
-#ifndef CHECK_EOF
+# ifndef CHECK_EOF
# define CHECK_EOF /* default as of 5.13/5.2 */
-#endif
+# endif
-#ifndef CHECK_EOF
+# ifndef CHECK_EOF
# define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE)<<k;k+=8;}}
-#else
-# ifdef FIX_PAST_EOB_BY_TABLEADJUST
-# define NEEDBITS(n) {while(k<(n)){int c=NEXTBYTE;\
- if(c==EOF){retval=1;goto cleanup_and_exit;}\
- b|=((ulg)c)<<k;k+=8;}}
# else
-# define NEEDBITS(n) {while((int)k<(int)(n)){int c=NEXTBYTE;\
- if(c==EOF){if((int)k>=0)break;retval=1;goto cleanup_and_exit;}\
- b|=((ulg)c)<<k;k+=8;}}
+# ifdef FIX_PAST_EOB_BY_TABLEADJUST
+# define NEEDBITS(n) {while(k<(n)){int c=NEXTBYTE;\
+ if(c==EOF){retval=1;goto cleanup_and_exit;}\
+ b|=((ulg)c)<<k;k+=8;}}
+# else
+# define NEEDBITS(n) {while((int)k<(int)(n)){int c=NEXTBYTE;\
+ if(c==EOF){if((int)k>=0)break;retval=1;goto cleanup_and_exit;}\
+ b|=((ulg)c)<<k;k+=8;}}
+# endif
# endif
-#endif
-#define DUMPBITS(n) {b>>=(n);k-=(n);}
+# define DUMPBITS(n) {b>>=(n);k-=(n);}
/*
static ZCONST unsigned dbits = 6;
-#ifndef ASM_INFLATECODES
+# ifndef ASM_INFLATECODES
+
+/* 2012-12-04 SMS. Memory copy method selection. */
+# ifndef NO_SLIDE_MEMCPY
+# define SLIDE_MEMCPY
+# endif
+# ifndef NO_SLIDE_MEMMOVE
+# define SLIDE_MEMMOVE_disabled /* Some testing suggests unhelpful. */
+# endif
int inflate_codes(__G__ tl, td, bl, bd)
__GDEF
/* do the copy */
do {
-#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
+# if (defined(DLL) && !defined(NO_SLIDE_REDIR))
if (G.redirect_slide) {
/* &= w/ wsize unnecessary & wrong if redirect */
if ((UINT_D64)d >= wsize)
e = (unsigned)(wsize - (d > (unsigned)w ? (UINT_D64)d : w));
}
else
-#endif
+# endif
e = (unsigned)(wsize -
((d &= (unsigned)(wsize-1)) > (unsigned)w ?
(UINT_D64)d : w));
if ((UINT_D64)e > n) e = (unsigned)n;
n -= e;
-#ifndef NOMEMCPY
+
+# ifdef SLIDE_MEMCPY
+# ifdef BAD_SLIDE_MEMCPY
+ /* 2012-12-04 SMS.
+ * http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=406
+ * This test can be erroneous if w < d. Unsigned overflow
+ * is always greater than "e", so memcpy() could be used on
+ * overlapping regions when d - w < e. See below.
+ */
if ((unsigned)w - d >= e)
/* (this test assumes unsigned comparison) */
{
+# else /* def BAD_SLIDE_MEMCPY */
+ /* Use memcpy(), if no overlap. */
+ if (labs( (long)w - (long)d) >= (long)e)
+ {
+# endif /* def BAD_SLIDE_MEMCPY [else] */
memcpy(redirSlide + (unsigned)w, redirSlide + d, e);
w += e;
d += e;
}
- else /* do it slowly to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
+# ifdef SLIDE_MEMMOVE
+ /* 2012-12-04 SMS. Use memmove() where it does what we want. */
+ else if ((long)w < (long)d)
+ {
+ /* memmove() does the right thing, so use it. */
+ memmove( redirSlide + (unsigned)w, redirSlide + d, e);
+ w += e;
+ d += e;
+ }
+# endif /* def SLIDE_MEMMOVE */
+ else
+ {
+# else /* def SLIDE_MEMCPY */
+ {
+# endif /* def SLIDE_MEMCPY [else] */
+ /* Advancing copy, probably slower than memcpy().
+ * (Possibly faster than memmove() on VMS Alpha?)
+ * When w > d, this copies blocks of size w-d repeatedly.
+ */
do {
redirSlide[w++] = redirSlide[d++];
} while (--e);
+ }
if (w == wsize)
{
if ((retval = FLUSH(w)) != 0) goto cleanup_and_exit;
return retval;
}
-#endif /* ASM_INFLATECODES */
+# endif /* ASM_INFLATECODES */
for (; i < 288; i++) /* make a complete, but wrong code set */
l[i] = 8;
G.fixed_bl = 7;
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
if ((i = huft_build(__G__ l, 288, 257, G.cplens, G.cplext,
&G.fixed_tl, &G.fixed_bl)) != 0)
-#else
+# else
if ((i = huft_build(__G__ l, 288, 257, cplens, cplext,
&G.fixed_tl, &G.fixed_bl)) != 0)
-#endif
+# endif
{
G.fixed_tl = (struct huft *)NULL;
return i;
for (i = 0; i < MAXDISTS; i++) /* make an incomplete code set */
l[i] = 5;
G.fixed_bd = 5;
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
if ((i = huft_build(__G__ l, MAXDISTS, 0, cpdist, G.cpdext,
&G.fixed_td, &G.fixed_bd)) > 1)
-#else
+# else
if ((i = huft_build(__G__ l, MAXDISTS, 0, cpdist, cpdext,
&G.fixed_td, &G.fixed_bd)) > 1)
-#endif
+# endif
{
huft_free(G.fixed_tl);
G.fixed_td = G.fixed_tl = (struct huft *)NULL;
/* build the decoding tables for literal/length and distance codes */
bl = lbits;
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
retval = huft_build(__G__ ll, nl, 257, G.cplens, G.cplext, &tl, &bl);
-#else
+# else
retval = huft_build(__G__ ll, nl, 257, cplens, cplext, &tl, &bl);
-#endif
+# endif
if (bl == 0) /* no literals or lengths */
retval = 1;
if (retval)
}
return retval; /* incomplete code set */
}
-#ifdef FIX_PAST_EOB_BY_TABLEADJUST
+# ifdef FIX_PAST_EOB_BY_TABLEADJUST
/* Adjust the requested distance base table size so that a distance code
fetch never tries to get bits behind an immediatly following end-of-block
code. */
bd = (dbits <= bl+1 ? dbits : bl+1);
-#else
+# else
bd = dbits;
-#endif
-#ifdef USE_DEFLATE64
+# endif
+# ifdef DEFLATE64_SUPPORT
retval = huft_build(__G__ ll + nl, nd, 0, cpdist, G.cpdext, &td, &bd);
-#else
+# else
retval = huft_build(__G__ ll + nl, nd, 0, cpdist, cpdext, &td, &bd);
-#endif
-#ifdef PKZIP_BUG_WORKAROUND
+# endif
+# ifdef PKZIP_BUG_WORKAROUND
if (retval == 1)
retval = 0;
-#endif
+# endif
if (bd == 0 && nl > 257) /* lengths but no distances */
retval = 1;
if (retval)
{
int e; /* last block flag */
int r; /* result code */
-#ifdef DEBUG
+# ifdef DEBUG
unsigned h = 0; /* maximum struct huft's malloc'ed */
-#endif
+# endif
-#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
+# if (defined(DLL) && !defined(NO_SLIDE_REDIR))
if (G.redirect_slide)
wsize = G.redirect_size, redirSlide = G.redirect_buffer;
else
wsize = WSIZE, redirSlide = slide; /* how they're #defined if !DLL */
-#endif
+# endif
/* initialize window, bit buffer */
G.wp = 0;
G.bk = 0;
G.bb = 0;
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
if (is_defl64) {
G.cplens = cplens64;
G.cplext = cplext64;
G.fixed_td = G.fixed_td32;
G.fixed_bd = G.fixed_bd32;
}
-#else /* !USE_DEFLATE64 */
+# else /* !DEFLATE64_SUPPORT */
if (is_defl64) {
/* This should not happen unless UnZip is built from object files
* compiled with inconsistent option setting. Handle this by
Trace((stderr, "\nThis inflate() cannot handle Deflate64!\n"));
return 2;
}
-#endif /* ?USE_DEFLATE64 */
+# endif /* ?DEFLATE64_SUPPORT */
/* decompress until the last block */
do {
-#ifdef DEBUG
+# ifdef DEBUG
G.hufts = 0;
-#endif
+# endif
if ((r = inflate_block(__G__ &e)) != 0)
return r;
-#ifdef DEBUG
+# ifdef DEBUG
if (G.hufts > h)
h = G.hufts;
-#endif
+# endif
} while (!e);
Trace((stderr, "\n%u bytes in Huffman tables (%u/entry)\n",
h * (unsigned)sizeof(struct huft), (unsigned)sizeof(struct huft)));
-#ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
if (is_defl64) {
G.fixed_tl64 = G.fixed_tl;
G.fixed_bl64 = G.fixed_bl;
G.fixed_td32 = G.fixed_td;
G.fixed_bd32 = G.fixed_bd;
}
-#endif
+# endif
/* flush out redirSlide and return (success, unless final FLUSH failed) */
return (FLUSH(G.wp));
l[h] = j; /* set table size in stack */
/* allocate and link in new table */
- if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) ==
+ if ((q = (struct huft *)izu_malloc((z + 1)*sizeof(struct huft))) ==
(struct huft *)NULL)
{
if (h)
while (p != (struct huft *)NULL)
{
q = (--p)->v.t;
- free((zvoid *)p);
+ izu_free((zvoid *)p);
p = q;
}
return 0;
}
+
+#endif /* def DEFLATE_SUPPORT */
--- /dev/null
+ Contents of the UnZip 6.10 Source Archive "libiz" directory
+ -----------------------------------------------------------
+
+ General Documentation
+Contents This file
+
+ Source Code
+izunzip_example.c Example main program for callable UnZip (Unix, VMS)
--- /dev/null
+/*
+ Copyright (c) 1990-2014 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+/*---------------------------------------------------------------------------
+
+ izunzip_example.c
+
+ Example main program illustrating how to use the libizunzip object
+ library (Unix: libizunzip.a, VMS: LIBIZUNZIP.OLB).
+
+ Basic build procedure, Unix:
+
+ cc izunzip_example.c -IUnZip_Source_Dir -o izunzip_example \
+ -LUnzip_Object_Dir -lizunzip
+
+ (On Unix, the default Unzip_Object_Dir is the same as the
+ Unzip_Source_Dir.)
+
+ Basic build procedure, VMS:
+
+ cc izunzip_example.c /include = Unzip_Source_Dir
+ link izunzip_example.obj, Unzip_Object_Dir:libizunzip.olb /library
+
+ If the UnZip library was built with bzip2 support, then the bzip2
+ object library must be added to the link command.
+
+ On Unix, add the appropriate -L (if needed) and -l options (plus any
+ other system-specific options which may be needed). For example:
+
+ cc izunzip_example.c -IUnZip_Source_Dir -o izunzip_example \
+ -LUnzip_Object_Dir -LBzip2_Object_Dir -lizunzip -lbz2 -lizunzip
+
+ Additional -L and/or -l options may be needed to supply other external
+ libraries, such as iconv or zlib, if these are used.
+
+ On VMS, a link options file, LIB_IZUNZIP.OPT, is generated along with
+ the object library (in the same directory), and it can be used to
+ simplify the LINK command. (LIB_IZUNZIP.OPT contains comments showing
+ how to define the logical names which it uses.)
+
+ define LIB_IZUNZIP Dir ! See comments in LIB_IZUNZIP.OPT.
+ define LIB_other Dir ! See comments in LIB_IZUNZIP.OPT.
+ link izunzip_example.obj, Unzip_Object_Dir:lib_izunzip.opt /options
+
+ ---------------------------------------------------------------------------*/
+
+#include "unzip.h" /* UnZip specifics. */
+
+#include <stdio.h>
+#include <string.h>
+
+
+#ifdef MY_PW
+# define UZP_PW MyUzpPassword
+/*
+ * MyUzpPassword(): Encryption password call-back function.
+ */
+
+int UZ_EXP MyUzpPassword( zvoid *pG, /* Ignore (globals pointer). */
+ int *rcnt, /* Retry count. */
+ char *pwbuf, /* Password buffer. */
+ int size, /* Password buffer size. */
+ ZCONST char *zfn, /* Archive name. */
+ ZCONST char *efn) /* Archive member name. */
+{
+ fprintf( stderr, "MyUP. size = %d, zfn: >%s<\n", size, zfn);
+ fprintf( stderr, "MyUP. efn: >%s<\n", efn);
+ fprintf( stderr, "MyUP. *rcnt = %d\n", *rcnt);
+ strncpy( pwbuf, "password", size);
+ return IZ_PW_ENTERED;
+}
+#else /* def MY_PW */
+# define UZP_PW NULL
+#endif /* def MY_PW [else] */
+
+
+/*
+ * main(): Example main program.
+ */
+
+int main( OFT( int) argc, OFT( char **)argv)
+#ifdef NO_PROTO
+ int argc;
+ char **argv;
+#endif /* def NO_PROTO */
+{
+ char *features;
+ int sts;
+#ifdef __VMS
+ int vsts;
+#endif
+ ZCONST UzpVer *unzip_ver_p; /* Storage for program version string. */
+ UzpCB user_functions; /* User-supplied call-back functions. */
+
+ /* Populate the user-supplied call-back function structure.
+ *
+ * See unzip.h for details of the UzpCB structure, and for
+ * prototypes of the various call-back functions. The only
+ * call-back function supplied here is the one which returns an
+ * encryption password, and it's used only if MY_PW is defined.
+ */
+ user_functions.structlen = sizeof( user_functions);
+ user_functions.msgfn = NULL;
+ user_functions.inputfn = NULL;
+ user_functions.pausefn = NULL;
+ user_functions.passwdfn = UZP_PW;
+ user_functions.statrepfn = NULL;
+
+ /* Call the UnZip entry point function, UzpMainI(), passing it an
+ * UnZip command expressed as an argument vector.
+ *
+ * This example emulates the normal UnZip program, so we pass the
+ * existing argument vector to the UnZip entry point. A real
+ * application program would probably form an argument vector with
+ * some application-generated command.
+ */
+ sts = UzpMainI( argc, argv, &user_functions);
+
+ /* Display the returned status value.
+ * On VMS, also get and display the VMS-format status code.
+ */
+ fprintf( stderr, " Raw sts = %d.\n", sts);
+#ifdef __VMS
+ vsts = vms_status( sts);
+ fprintf( stderr, " VMS sts = %d (%%x%08x).\n", vsts, vsts);
+#endif
+
+ /* Get and display the library version. */
+ unzip_ver_p = UzpVersion();
+ fprintf( stderr, " UnZip version %d.%d%d%s\n",
+ unzip_ver_p->unzip.vmajor, unzip_ver_p->unzip.vminor,
+ unzip_ver_p->unzip.patchlevel, unzip_ver_p->betalevel);
+
+ /* Get and display the library feature list. */
+ features = UzpFeatures();
+ if (features != NULL)
+ fprintf( stderr, " UnZip features: %s\n", features);
+}
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
{
int do_this_file=FALSE, cfactor, error, error_in_archive=PK_COOL;
#ifndef WINDLL
- char sgn, cfactorstr[10];
+ char sgn, cfactorstr[11];
int longhdr=(uO.vflag>1);
#endif
int date_format;
static ZCONST char Far method[NUM_METHODS+1][8] =
{"Stored", "Shrunk", "Reduce1", "Reduce2", "Reduce3", "Reduce4",
"Implode", "Token", "Defl:#", "Def64#", "ImplDCL", "BZip2",
- "LZMA", "Terse", "IBMLZ77", "WavPack", "PPMd", "Unk:###"};
+ "LZMA", "Terse", "IBMLZ77", "JPEG", "WavPack", "PPMd",
+ "AES_WG", "Unk:###"};
return error;
}
if (G.extra_field != (uch *)NULL) {
- free(G.extra_field);
+ izu_free(G.extra_field);
G.extra_field = (uch *)NULL;
}
if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD))
G.crec.compression_method == ENHDEFLATED) {
methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3];
} else if (methnum >= NUM_METHODS) {
- sprintf(&methbuf[4], "%03u", G.crec.compression_method);
+ /* 2013-02-26 SMS.
+ * http://sourceforge.net/tracker/?func=detail
+ * &aid=2861648&group_id=118012&atid=679786
+ * Unexpectedly large compression methods overflow
+ * &methbuf[]. Use the old, three-digit decimal format
+ * for values which fit. Otherwise, sacrifice the
+ * colon, and use four-digit hexadecimal.
+ */
+ if (G.crec.compression_method <= 999) {
+ sprintf( &methbuf[ 4], "%03u", G.crec.compression_method);
+ } else {
+ sprintf( &methbuf[ 3], "%04X", G.crec.compression_method);
+ }
}
#if 0 /* GRR/Euro: add this? */
return error;
}
if (G.extra_field != (uch *)NULL) {
- free(G.extra_field);
+ izu_free(G.extra_field);
G.extra_field = (uch *)NULL;
}
if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD))
12) ADD: {Unzip} following switches were added:
-J [MacOS only] ignore mac extra info. All macintosh
info are not restored. Datafork and resource-fork
- are restored separatly.
+ are restored separately.
-i [MacOS only] ignore filenames stored in mac extra
field. Use the most compatible filename stored in
{
Boolean isIt = false;
unsigned long resourceForkLength, dataForkLength, df_rf_length;
+#ifdef TRACE_MACBINARY /* 2014-03-13 SMS. Used only for trace. */
short commentLength;
+#endif /* def TRACE_MACBINARY */
Byte mbVersion;
#ifdef TRACE_MACBINARY
resourceForkLength = LONG_AT_OFFSET(header, kResourceForkLengthOffset);
dataForkLength = LONG_AT_OFFSET(header, kDataForkLengthOffset);
+#ifdef TRACE_MACBINARY
commentLength = WORD_AT_OFFSET(header, kGetInfoCommentLengthOffset);
+#endif /* def TRACE_MACBINARY */
df_rf_length = dataForkLength + resourceForkLength;
#ifdef TRACE_MACBINARY
DIR *opendir(char *dirName)
{
int fullPath;
- unsigned pathLen;
+/* unsigned pathLen; 2014-03-13 SMS. Unused. */
char *s;
HParamBlockRec hPB;
CInfoPBRec cPB;
printerr("GetCompletePath", err, err, __LINE__, __FILE__, dirName);
if (dirName == NULL || *dirName == '\0' ||
- (pathLen = strlen(dirName)) >= 256) {
+ (/* pathLen = */ strlen(dirName)) >= 256) {
errno = EINVAL;
return NULL;
}
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
-
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) { /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- if (renamed_fullpath)
- ++cp; /* skip over leading '/' */
- } else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
if (*pathcomp == '\0') {
#if (!defined(SFX) || defined(SFX_EXDIR))
if (FUNCTION == ROOT) {
Trace((stderr, "initializing root path to [%s]\n",
- FnFilter1pathcomp)));
+ FnFilter1( pathcomp)));
if (pathcomp == (char *)NULL) {
rootlen = 0;
return MPN_OK;
{
OSErr err;
char scriptTag = newExtraField.fpb.hFileInfo.ioFlXFndrInfo.fdScript;
- static char Num = 0;
+/* static char Num = 0; 2014-03-13 SMS. Unused. */
sz = sz;
/*
- Copyright (c) 1990-2003 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2000-Apr-09 or later
(the contents of which are also included in zip.h) for terms of use.
Boolean isDirectory;
unsigned short namelen, pathlen = strlen(ExtractPath);
unsigned long ext_length = 0;
-unsigned long num_to_cut = 0;
-long firstpart_length = pathlen;
+/* unsigned long num_to_cut = 0; 2014-03-13 SMS. Unused. */
+/* long firstpart_length = pathlen; 2014-03-13 SMS. Unused. */
AssertStr(ExtractPath,"FindNewExtractFolder ExtractPath == NULL")
{
char buffer[255];
FSSpec volumes[50]; /* 50 Volumes should be enough */
-short actVolCount, volIndex = 1, VolCount = 0;
+short actVolCount, volIndex = 1 /* , VolCount = 0 2014-03-13 SMS. Unused. */;
OSErr err;
short i, foundVRefNum;
FSSpec spec;
-Contents of the "man" subdirectory for UnZip 5.41 and later:
+ Contents of the UnZip 6.10 Source Archive "man/man1" Directory
+ --------------------------------------------------------------
- Contents this file
- funzip.1 fUnZip manual page, nroff format
- unzip.1 UnZip manual page, nroff format
- unzipsfx.1 UnZipSFX manual page, nroff format
- zipgrep.1 ZipGrep manual page, nroff format
- zipinfo.1 ZipInfo manual page, nroff format
-
-This subdirectory contains the master source files for the UnZip user
-documentation. Although these documents are Unix man-page sources, they
-are of general interest and therefore stored separately.
-Some non-Unix systems may supply a man-page reader where they could be
-used; and they are the sources for the generic ASCII text document files.
+man1/ nroff "man" sources for the main user documentation
+ funzip.1 fUnZip manual page, source
+ unzip.1 UnZip manual page, source
+ unzipsfx.1 UnZipSFX manual page, source
+ zipgrep.1 ZipGrep manual page, source
+ zipinfo.1 ZipInfo manual page, source
+++ /dev/null
-.\" Copyright (c) 1990-2009 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.
-.\" If, for some reason, all these files are missing, the Info-ZIP license
-.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
-.\"
-.\" funzip.1 by Greg Roelofs and others.
-.\"
-.\" =========================================================================
-.\" define .EX/.EE (for multiline user-command examples; normal Courier font)
-.de EX
-.in +4n
-.nf
-.ft CW
-..
-.de EE
-.ft R
-.fi
-.in -4n
-..
-.\" =========================================================================
-.TH FUNZIP 1L "20 April 2009 (v3.95)" "Info-ZIP"
-.SH NAME
-funzip \- filter for extracting from a ZIP archive in a pipe
-.PD
-.SH SYNOPSIS
-\fBfunzip\fP [\fB\-password\fP] [\fIinput[.zip|.gz]\fP]
-.\" =========================================================================
-.SH ARGUMENTS
-.IP [\fI\-password\fP]
-Optional password to be used if ZIP archive is encrypted. Decryption
-may not be supported at some sites. See DESCRIPTION for more details.
-.IP [\fIinput[.zip|.gz]\fP]
-Optional input archive file specification. See DESCRIPTION for details.
-.PD
-.\" =========================================================================
-.SH DESCRIPTION
-.I funzip
-without a file argument acts as a filter; that is, it assumes that a
-ZIP archive (or a \fIgzip\fP'd(1) file) is being piped into
-standard input, and it extracts the first member from the archive to stdout.
-When stdin comes from a tty device,
-.I funzip
-assumes that this cannot be a stream of (binary) compressed data and
-shows a short help text, instead.
-If there is a file argument, then input is read from the specified file
-instead of from stdin.
-.PP
-A password for encrypted zip files can be specified
-on the command line (preceding the file name, if any) by prefixing the
-password with a dash. Note that this constitutes a security risk on many
-systems; currently running processes are often visible via simple commands
-(e.g., \fIps\fP(1) under Unix), and command-line histories can be read.
-If the first entry of the zip file is encrypted and
-no password is specified on the command line, then the user is prompted for
-a password and the password is not echoed on the console.
-.PP
-Given the limitation on single-member extraction, \fIfunzip\fP is most
-useful in conjunction with a secondary archiver program such as \fItar\fP(1).
-The following section includes an example illustrating this usage in the
-case of disk backups to tape.
-.PD
-.\" =========================================================================
-.SH EXAMPLES
-To use \fIfunzip\fP to extract the first member file of the archive test.zip
-and to pipe it into \fImore\fP(1):
-.PP
-.EX
-funzip test.zip | more
-.EE
-.PP
-To use \fIfunzip\fP to test the first member file of test.zip (any errors
-will be reported on standard error):
-.PP
-.EX
-funzip test.zip > /dev/null
-.EE
-.PP
-To use \fIzip\fP and \fIfunzip\fP in place of \fIcompress\fP(1) and
-\fIzcat\fP(1) (or \fIgzip\fP(1L) and \fIgzcat\fP(1L)) for tape backups:
-.PP
-.EX
-tar cf \- . | zip \-7 | dd of=/dev/nrst0 obs=8k
-dd if=/dev/nrst0 ibs=8k | funzip | tar xf \-
-.EE
-.PP
-(where, for example, nrst0 is a SCSI tape drive).
-.PD
-.\" =========================================================================
-.SH BUGS
-When piping an encrypted file into \fImore\fP and allowing \fIfunzip\fP
-to prompt for password, the terminal may sometimes be reset to a non-echo
-mode. This is apparently due to a race condition between the two programs;
-\fIfunzip\fP changes the terminal mode to non-echo before \fImore\fP reads
-its state, and \fImore\fP then ``restores'' the terminal to this mode before
-exiting. To recover, run \fIfunzip\fP on the same file but redirect to
-/dev/null rather than piping into more; after prompting again for the
-password, \fIfunzip\fP will reset the terminal properly.
-.PP
-There is presently no way to extract any member but the first from a ZIP
-archive. This would be useful in the case where a ZIP archive is included
-within another archive. In the case where the first member is a directory,
-\fIfunzip\fP simply creates the directory and exits.
-.PP
-The functionality of \fIfunzip\fP should be incorporated into \fIunzip\fP
-itself (future release).
-.PD
-.\" =========================================================================
-.SH "SEE ALSO"
-\fIgzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L), \fIzip\fP(1L),
-\fIzipcloak\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
-.PD
-.\" =========================================================================
-.SH URL
-The Info-ZIP home page is currently at
-.EX
-\fChttp://www.info-zip.org/pub/infozip/\fR
-.EE
-or
-.EX
-\fCftp://ftp.info-zip.org/pub/infozip/\fR .
-.EE
-.PD
-.\" =========================================================================
-.SH AUTHOR
-Mark Adler (Info-ZIP)
--- /dev/null
+ Contents of the UnZip 6.10 Source Archive "man/man1" Directory
+ --------------------------------------------------------------
+
+funzip.1 fUnZip manual page, source
+unzip.1 UnZip manual page, source
+unzipsfx.1 UnZipSFX manual page, source
+zipgrep.1 ZipGrep manual page, source
+zipinfo.1 ZipInfo manual page, source
--- /dev/null
+.\" Copyright (c) 1990-2013 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.
+.\" If, for some reason, all these files are missing, the Info-ZIP license
+.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+.\"
+.\" funzip.1 by Greg Roelofs and others.
+.\"
+.\" =========================================================================
+.TH FUNZIP 1L "06 Nov 2013 (v4.10)" "Info-ZIP"
+.\" =========================================================================
+.\"
+.\" Define .EX/.EE (for multiline user-command examples; normal Courier font).
+.\" Must follow ".TH"; otherwise macros get redefined.
+.de EX
+.in +4n
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.fi
+.in -4n
+..
+.\" =========================================================================
+.SH NAME
+funzip \- filter for extracting from a ZIP archive in a pipe
+.PD
+.SH SYNOPSIS
+\fBfunzip\fP [\fB\-\fP\fIpassword\fP] [\fIarchive[.zip|.gz]\fP]
+.\" =========================================================================
+.SH ARGUMENTS
+.IP [\fB\-\fP\fIpassword\fP]
+Optional password to be used if ZIP archive is encrypted. Encryption
+support can be disabled at build time. See DESCRIPTION for more
+details.
+.IP [\fIarchive[.zip|.gz]\fP]
+Optional input archive file specification. See DESCRIPTION for details.
+.PD
+.\" =========================================================================
+.SH DESCRIPTION
+\fIfUnZip\fP without a file argument acts as a filter; that is, it
+assumes that a ZIP archive (or a \fIgzip\fP'd(1) file) is being piped
+into standard input, and it extracts the first (non-directory) member
+from the archive to standard output (stdout). When standard input
+(stdin) is a terminal (tty) device, \fIfUnZip\fP assumes that this
+cannot be a stream of (binary) compressed data and shows a short usage
+guide, instead. If there is a file argument, then input is read from
+the specified file instead of from stdin.
+.PP
+A password for encrypted zip files can be specified on the command line
+(preceding the file name, if any) by prefixing the password with a
+hyphen. Note that this constitutes a security risk on many systems;
+running processes are often visible via simple commands (e.g.,
+\fIps\fP(1) under Unix), and command-line histories can be read. If the
+first entry of the zip file is encrypted and no password is specified on
+the command line, then the user is prompted for a password and the
+password is not echoed on the console.
+.PP
+Given the limitation on single-member extraction, \fIfUnZip\fP is most
+useful in conjunction with a secondary archiver program such as
+\fItar\fP(1). The following section includes an example illustrating
+this usage in the case of disk backups to tape.
+.PD
+.\" =========================================================================
+.SH EXAMPLES
+Use \fIfUnZip\fP to extract the first (non-directory) member of the
+archive "test.zip", and to pipe it into \fImore\fP(1):
+.PP
+.EX
+funzip test.zip | more
+.EE
+.PP
+Use \fIfUnZip\fP to test the first (non-directory) member of "test.zip"
+(with any error messages sent to standard error (stderr)):
+.PP
+.EX
+funzip test.zip > /dev/null
+.EE
+.PP
+Use \fIZip\fP and \fIfUnZip\fP in place of \fIcompress\fP(1) and
+\fIzcat\fP(1) (or \fIgzip\fP(1L) and \fIgzcat\fP(1L)) for tape backups:
+.PP
+.EX
+tar cf \- . | zip \-7 | dd of=/dev/nrst0 obs=8k
+dd if=/dev/nrst0 ibs=8k | funzip | tar xf \-
+.EE
+.PP
+(where, for example, nrst0 is a SCSI tape drive).
+.PD
+.\" =========================================================================
+.SH BUGS
+When piping an encrypted file into \fImore\fP and allowing \fIfUnZip\fP
+to prompt for password, the terminal may sometimes be reset to a
+non-echo mode. This is apparently due to a race condition between the
+two programs; \fIfUnZip\fP changes the terminal mode to non-echo before
+\fImore\fP reads its state, and \fImore\fP then "restores" the
+terminal to this mode before exiting. To recover, run \fIfUnZip\fP on
+the same file but redirect to /dev/null rather than piping into
+\fImore\fP. After prompting again for the password, \fIfUnZip\fP should
+reset the terminal properly.
+.PP
+There is no way to extract any member except the first (non-directory)
+from a ZIP archive, but \fIfUnZip\fP will skip archive members which are
+directories, and extract the first member which is not a directory.
+.PP
+Only Deflate compression and Traditional ZIP encryption are supported.
+.PP
+The functionality of \fIfUnZip\fP should be incorporated into
+\fIUnZip\fP itself (in some future release).
+.PD
+.\" =========================================================================
+.SH "SEE ALSO"
+\fIgzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L), \fIzip\fP(1L),
+\fIzipcloak\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
+.PD
+.\" =========================================================================
+.SH URL
+.TP
+The Info-ZIP main Web page is:
+.EX
+\fChttp://www.info-zip.org/\fR
+.EE
+.TP
+FTP access is available, too:
+.EX
+\fCftp://ftp.info-zip.org/pub/infozip/\fR
+.EE
+.PP
+.\" =========================================================================
+.SH AUTHOR
+Mark Adler (Info-ZIP)
--- /dev/null
+.\" Copyright (c) 1990-2014 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.
+.\" If, for some reason, all these files are missing, the Info-ZIP license
+.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+.\"
+.\" unzip.1 by Greg Roelofs, Fulvio Marino, Jim van Zandt and others.
+.\"
+.\" =========================================================================
+.TH UNZIP 1L "09 May 2014 (v6.10)" "Info-ZIP"
+.\" =========================================================================
+.\"
+.\" Define .EX/.EE (for multiline user-command examples; normal Courier font).
+.\" Must follow ".TH"; otherwise macros get redefined.
+.de EX
+.in +4n
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.fi
+.in -4n
+..
+.\" =========================================================================
+.SH NAME
+unzip \- extract, list, or test compressed files in a ZIP archive.
+.PP
+.SH SYNOPSIS
+.B unzip
+.RB "[ " unzip_options " ]"
+.RI "[ " file[.zip] " ]"
+.RI "[ " member " ... ]"
+.br
+.B "unzip \-Z"
+.RB "[ " zipinfo_options " ]"
+.RI "[ " file[.zip] " ]"
+.RI "[ " member " ... ]"
+.PP
+.\" =========================================================================
+.SH DESCRIPTION
+\fIUnZip\fP extracts, lists, or tests files in a ZIP archive (an archive
+format commonly used on many different systems). The default behavior
+(with no options) is to extract into the current directory (and
+subdirectories below it) all files from the specified ZIP archive. A
+companion program, \fIZip\fP, creates ZIP archives.
+.PP
+Info-ZIP \fIUnZip\fP and \fIZip\fP were intended to be compatible with
+archives created by PKWARE's \fIPKZIP\fP and \fIPKUNZIP\fP programs
+(originally for MS-DOS), but in many cases the program options or
+default behaviors differ. Nowadays, many other programs are available
+which work with ZIP archives.
+.PP
+Note: Beginning with \fIUnZip\fP version 6.10, the old command-line
+parser has been replaced by one like the one used in \fIZip\fP (version
+3.0 and later). One significant change is that \fIoption negation now
+uses a TRAILING hyphen ("\-")\fP, so, for example, \fB\-B\-\fP negates
+the \fB\-B\fP option. This change was made because a double hyphen
+("\-\-") now introduces a long option.
+.PP
+To display the basic built-in help, use the command:
+.EX
+unzip \-h
+.EE
+To display the extended built-in help, use the command:
+.EX
+unzip \-hh
+.EE
+The built-in help may be more current than this manual page, especially
+between full product releases.
+.PP
+To list all available options for a particular \fIUnZip\fP program, use
+the command:
+.EX
+unzip \-\-show\-options
+.EE
+This report will not include any options which are available only on
+other system types, or options which must be enabled at build-time but
+were not enabled in the particular \fIUnZip\fP program being used.
+.PP
+[VMS] On VMS, alternate program editions with VMS-style command-line
+interfaces are also available. For details, see the VMS-specific
+documentation.
+.\" =========================================================================
+.SH ARGUMENTS
+.TP
+.I file[.zip]
+File path/name of a ZIP archive. A wildcard name may be used to specify
+multiple ZIP archives to be processed in one command. On VMS systems,
+any of the standard wildcards for a directory/file specification may be
+used: "...", "*", or "%" (or, since VMS V7.2, "?"). On non-VMS systems,
+a wildcard name may be used only in the filename part of the file
+specification, not in the directory part, and, on Unix, characters which
+are special to the shell must be escaped or quoted to protect them from
+processing by the shell. If a wildcard is used, then each matching
+archive file is processed in an order determined by the operating
+system or shell (or file system). Non-VMS wildcard expressions are
+similar to those supported (for "globbing") in commonly used Unix shells
+(\fIcsh\fP, \fIksh\fP, \fIsh\fP, and so on) and may contain:
+.RS
+.IP *
+Matches a sequence of 0 or more characters.
+.IP ?
+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. If an exclamation point ("!") or a caret ("^") follows the
+left bracket, then the range of characters within the brackets is
+complemented. That is, anything \fIexcept\fP the characters inside the
+brackets is considered a match. To specify a literal left bracket, use
+the three-character sequence "[[]".
+.RE
+.IP
+If no wildcard matches are found, then the specification is assumed to
+be a literal filename. If that also fails, then the
+suffix "\fC\.zip\fR" and/or "\fC\.ZIP\fR" is appended, and that is
+tried. (For this reason, if a non-existent file is specified, then the
+resulting error message may mention these other names with
+their "\fC\.zip\fR" or "\fC\.ZIP\fR" suffixes.)
+.IP
+Note that a "\fC\.zip\fR" or "\fC\.ZIP\fR" name ending on an archive is
+merely a convention, not a requirement. For example, a self-extracting
+ZIP archive named "\fCfred\fR" or "\fCfred.exe\fR" could be processed as
+if it were an ordinary archive; just specify the actual file name with
+its actual name ending (if any), whatever that may be.
+.IP
+Strictly speaking, an archive name is optional, but, except in a special
+case like "\fCunzip\ \-v\fR", it's difficult to do much useful work
+without specifying an archive.
+.TP
+.IR member " ..."
+An optional list of archive members to be processed, separated by
+spaces. If no member list is specified, then all archive members are
+processed. Wildcard patterns (like those used for an archive file name
+on Unix, described above) may be used to match multiple members. Again,
+be sure to quote expressions that would otherwise be expanded or
+modified by the operating system or shell.
+.IP
+On Mac OS X systems, file attributes, a resource fork, and similar data
+may be stored in a separate AppleDouble archive member which has a "._"
+name prefix. When restoring files with such attributes (no
+\fB\-J\fP/\fB\-\-junk-attrs\fP option, and the destination file system
+supports such attributes), if the user specifies only the main archive
+member, then \fIUnZip\fP should automatically handle the corresponding
+AppleDouble archive member. If \fB\-J\fP/\fB\-\-junk-attrs\fP is
+specified, or the destination file system does not support such file
+attributes (so that an AppleDouble archive member will be stored as a
+separate file), then AppleDouble archive members are not handled
+automatically, and the user must specify patterns which explicitly
+include any desired AppleDouble archive members.
+.IP
+On VMS systems, the wildcard rules used for archive members are the same
+as on Unix systems. VMS wildcard rules are used only for archive file
+specifications, not for archive member patterns.
+.\" =========================================================================
+.SH OPTIONS
+.PP
+\fIUnZip\fP's usage summary ("\fCunzip\ \-h\fR") is kept short to try to
+accommodate small terminal/emulator screens, so it's normally
+incomplete. The option list below should be complete.
+.\" --------------------------------------------------------------------
+.SH OPTIONS (ZipInfo Mode)
+.PD 0
+.B \-Z
+.TP
+.PD
+.B \-\-zipinfo\-mode
+\fIZipInfo\fP mode. If the first option on the command line is
+\fB\-Z\fP, then the program runs in \fIZipInfo\fP mode. Remaining
+options are interpreted as \fIZipInfo\fP options. See the \fBzipinfo\fP
+manual page for a description of those options.
+.\" --------------------------------------------------------------------
+.SH OPTIONS (Primary Mode)
+Options in this group (\fB\-c \-f \-h \-l \-p \-T \-t \-u \-v \-z\fP)
+specify the primary mode of operation of \fIUnZip\fP. Only one of these
+primary mode options may be specified.
+.PP
+.PD 0
+.B \-c
+.TP
+.PD
+.B \-\-to\-stdout
+.br
+Primary Mode. Extract files to stdout/screen. This option is similar
+to the \fB\-p\fP option except that the name of each file is displayed
+as it is extracted, and the \fB\-a\fP option is allowed, which can
+provide automatic ASCII-EBCDIC conversion, where appropriate.
+.PP
+.PD 0
+.B \-f
+.TP
+.PD
+.B \-\-freshen
+.br
+Primary Mode. Freshen existing files. That is, extract only those
+files that already exist on disk and that are newer than the disk
+copies. By default \fIUnZip\fP queries before overwriting, but the
+\fB\-o\fP option may be used to suppress the queries. Note that on
+many operating systems, the TZ (timezone) environment variable must be
+set correctly in order for \fB\-f\fP/\fB\-\-freshen\fP and
+\fB\-u\fP/\fB\-\-update\fP to work properly. (On Unix the variable is
+usually set automatically.) The reasons for this are somewhat subtle
+but have to do with the differences between DOS-format file times
+(always local time) and Unix-format times (always UTC) and the necessity
+to compare the two. A typical TZ value is "PST8PDT" (US Pacific time
+with automatic adjustment for Daylight Saving Time).
+.PP
+.PD 0
+.B \-h
+.TP
+.PD
+.B \-\-help
+.br
+Primary Mode. Display brief (roughly 24 lines) usage instructions. See
+also \fB\-hh\fP.
+.PP
+.PD 0
+.B \-hh
+.TP
+.PD
+.B \-\-long\-help
+.br
+Primary Mode. Display extended help (more complete usage
+instructions). See also \fB\-h\fP.
+.PP
+.PD 0
+.B \-l
+.TP
+.PD
+.B \-\-list
+.br
+Primary Mode. List archive members. By default, a brief format is
+used, which includes the following items: member name, uncompressed
+file size ("Length"), and modification date-time of the member. A
+summary is included at the end of the report, showing total size and
+count for all the members in the report. Specifying a member list
+limits the report to those members.
+.IP
+Adding \fB\-v\fP (\fB\-\-verbose\fP) to an "unzip \-l" command line adds
+the following items to the report: compression method, compressed size
+("Size"), compression ratio, and 32-bit CRC.
+.IP
+In contrast to some other programs, \fIUnZip\fP does not include the
+12-byte encryption header in the compressed size values for a
+Traditionally encrypted member. Therefore, compressed size and
+compression ratio figures are independent of the member's encryption
+status and show the correct compression performance. (The complete size
+of the encrypted compressed data stream for archive members is reported
+by the more verbose \fIZipInfo\fP reports. See the separate
+\fIzipinfo\fP manual page.)
+.IP
+If \fIUnZip\fP was built with OS2_EAS enabled, then the \fB\-l\fP report
+also includes the sizes of stored OS/2 extended attributes (EAs) and
+OS/2 access control lists (ACLs). In addition, the archive comment and
+individual member comments (if any) are displayed.
+.IP
+If a file was archived from a single-case file system (for example, the
+old MS-DOS FAT file system) and the \fB\-L\fP option was given, the
+filename is converted to lowercase and is shown prefixed with a caret
+(^).
+.IP
+Note: If only \fB\-v\fP (\fB\-\-verbose\fP) is specified with an archive
+name, then \fIUnZip\fP acts as if "\fB\-l\fP \fB\-v\fP" were specified,
+and a detailed listing is generated.
+.PP
+.PD 0
+.B \-\-license
+.TP
+.PD
+Primary Mode. Display the Info-ZIP license.
+.PP
+.PD 0
+.B \-p
+.TP
+.PD
+.B \-\-pipe\-to\-stdout
+.br
+Primary Mode. Extract files to stdout (pipe). Only the actual file
+data for the members are sent to stdout (no file names, or other
+information, as would be displayed with \fB\-c\fP), and the files are
+always extracted in binary format, just as they are stored (no
+line-ending or ASCII-EBCDIC conversions).
+.PP
+.PD 0
+.B \-T
+.TP
+.PD
+.B \-\-timestamp\-new
+.br
+Primary Mode. Set the timestamp on the archive(s) to that of the newest
+file in each one. This corresponds to \fIZip\fP's \fB\-go\fP option,
+except that it can be used on wildcard archives (for example,
+"\fCunzip\ \-T\ '*.zip'\fR") and is much faster.
+.PP
+.PD 0
+.B \-t
+.TP
+.PD
+.B \-\-test
+.br
+Primary Mode. Test archive members. Testing means that each archive
+member is extracted in memory (expanding and decrypting, as needed), but
+not written to a file. The resulting CRC (cyclic redundancy check, an
+enhanced checksum) of the extracted data is then compared with the
+original file's stored CRC value, and an error message is emitted if a
+CRC mismatch is detected.
+.IP
+Adding \fB\-v\fP to \fB\-t\fP adds some diagnostic information to the
+report for archive members with LZMA or PPMd compression.
+.PP
+.PD 0
+.B \-u
+.TP
+.PD
+.B \-\-update
+.br
+Primary mode. Update existing files and create new ones if
+needed. This mode performs the same function as the Freshen (\fB\-f\fP)
+mode, extracting (with query) files that are newer than those with the
+same name on disk, but it also extracts those files that do not already
+exist on disk. See \fB\-f\fP, above, for information on setting the
+timezone properly.
+.PP
+.PD 0
+.B \-v
+.TP
+.PD
+.B \-\-verbose
+.br
+Primary mode (when alone) or option. When used as a primary mode
+(alone), and no archive is specified, an "\fCunzip \-v\fR" command
+generates a report showing the program version, build options, and
+relevant environment variables.
+.IP
+When used with some other primary mode option, \fB\-v\fP can make output
+more verbose.
+.IP
+If no other primary mode is specified, and an archive \fIis\fP
+specified, then \fIUnZip\fP acts as if "\fB\-l\fP \fB\-v\fP" were
+specified, and a detailed listing is generated. See \fB\-l\fP.
+.PP
+.PD 0
+.B \-\-version
+.TP
+.PD
+Primary Mode. Display the program version, build options, and relevant
+environment variables.
+.IP
+Currently, \fB\-\-version\fP is implemented as a synonym for
+\fB\-v\fP/\fB\-\-verbose\fP, so, for proper operation, it must be
+specified with no other options.
+.PP
+.PD 0
+.B \-z
+.TP
+.PD
+.B \-\-zipfile\-comment
+.br
+Primary mode. Display only the archive comment.
+.\" --------------------------------------------------------------------
+.SH OPTIONS (Ordinary)
+.PP
+.PD 0
+.B \-2
+.TP
+.PD
+.B \-\-force\-ods2
+.br
+[VMS] Convert extracted file names to ODS2-compatible names, even on an
+ODS5 file system. By default, if the destination file system is ODS5,
+case is preserved, and extended file name characters are caret-escaped
+as needed, while if the destination file system is ODS2, ODS2-invalid
+characters are replaced by underscores.
+.PP
+.PD 0
+.B \-A
+.TP
+.PD
+.B \-\-api\-help
+.br
+[OS/2, Unix DLL] Print extended help for the DLL's application
+programming interface (API).
+.PP
+.PD 0
+.B \-a
+.TP
+.PD
+.B \-\-ascii
+.br
+Convert text files. Ordinarily, all files are extracted exactly as they
+are stored, byte-for-byte. With \fB\-a\fP, line endings in a text
+file are adjusted to the local standard as the file is extracted. When
+appropriate, ASCII<\-\->EBCDIC conversion is also done.
+.IP
+\fIZip\fP (or a similar archiving program) identifies files as "binary"
+or "text" when they are archived. (A short-format \fIZipInfo\fP report
+denotes a binary file with a "b", and a text file with a "t".)
+\fIZip\fP's identification of text files may not be perfect, so
+\fIUnZip\fP prints "\fC[binary]\fR" or "\fC[text]\fR" as a visual check
+for each file it extracts with \fB\-a\fP. The \fB\-aa\fP option forces
+all files to be extracted (and converted) as text, regardless of the
+supposed file type.
+.IP
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip\ \-V" or "ZIP\ /VMS"), files are always created with their original
+record formats. For archives without VMS attribute information (not
+made with "zip\ \-V" or "ZIP\ /VMS"), all files are normally created
+with Stream_LF record format. With \fB\-a\fP, text files are normally
+created with variable-length record format, but adding \fB\-S\fP gives
+them Stream_LF record format. With \fB\-aa\fP, all files are treated as
+text files. See also \fB\-b\fP and \fB\-S\fP.
+.PP
+.PD 0
+.B \-B
+.TP
+.PD
+.B \-\-backup
+.br
+[when built with UNIXBACKUP enabled] Save a backup copy of each
+overwritten file. The backup file gets the name of the target file with
+a tilde and optionally a unique sequence number (up to 5 digits)
+appended. The sequence number is appended whenever another file with
+the original name plus tilde already exists. When used together with
+the "overwrite all" option, \fB\-o\fP, numbered backup files are never
+created. In this case, all backup files are named as the original file
+with an appended tilde, and existing backup files are deleted without
+notice. This feature works similarly to the default behavior of
+\fIemacs\fP(1) in many locations.
+.IP
+Example: the old copy of "\fCfoo\fR" is renamed to "\fCfoo~\fR".
+.IP
+Warning: Users should be aware that the \fB\-B\fP option does not prevent
+loss of existing data under all circumstances. For example, when
+\fIUnZip\fP is run in overwrite-all mode, an existing "\fCfoo~\fR" file
+is deleted before \fIUnZip\fP attempts to rename "\fCfoo\fR" to
+"\fCfoo~\fR". When this rename attempt fails (because of a file lock,
+insufficient privileges, or any other reason), the extraction of
+"\fCfoo~\fR" gets cancelled, but the old backup file is already lost. A
+similar scenario takes place when the sequence number range for numbered
+backup files gets exhausted (99999, or 65535 for 16-bit systems). In
+this case, the backup file with the maximum sequence number is deleted
+and replaced by the new backup version without notice.
+.PP
+.PD 0
+.B \-b
+.TP
+.PD
+.B \-\-binary
+.br
+[Tandem, VMS] Selects the file record format used when extracting binary
+files. \-b may conflict or interact with \-a in different ways on
+different system types. \-b is ignored on systems other than Tandem and
+VMS.
+.IP
+\fIZip\fP (or a similar archiving program) identifies files as "binary"
+or "text" when they are archived. (A short-format \fIZipInfo\fP report
+denotes a binary file with a "b", and a text file with a "t".)
+.\" \fIZip\fP's identification of text files may not be perfect, so
+.\" \fIUnZip\fP prints "\fC[binary]\fR" or "\fC[text]\fR" as a visual check
+.\" for each file it extracts with \fB\-b\fP. The \fB\-bb\fP option forces
+.\" all files to be extracted (and converted) as binary, regardless of the
+.\" supposed file type.
+.IP
+[Tandem] Force the creation files with filecode type 180 ('C') when
+extracting archive members marked as "text". (On Tandem, \fB\-a\fP is
+enabled by default, see above).
+.IP
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip\ \-V" or "ZIP\ /VMS"), files are always created with their original
+record formats. For archives without VMS attribute information (not
+made with "zip\ \-V" or "ZIP\ /VMS"), files are normally created with
+Stream_LF record format. With \fB\-b\fP, binary files are created with
+fixed-length, 512-byte record format. With \fB\-bb\fP, all files are
+treated as binary files. When extracting to standard output (\fB\-c\fP
+or \fB\-p\fP option in effect), the default conversion of text record
+delimiters is disabled for binary files (with \fB\-b\fP), or for all
+files (with \fB\-bb\fP).
+.PP
+.PD 0
+.B \-C
+.TP
+.PD
+.BR \-\-ignore\-case "\ \ \ \ ([CMS, MVS] " \-\-CMS\-MVS\-lower )
+.br
+Use case-insensitive name matching for names in the member list and
+the \fB\-x\fP excluded-member list on the command line. By default,
+case-sensitive matching is done. For example, specifying
+"\fCmakefile\fR" on the command line will match \fIonly\fP "makefile" in
+the archive, not "Makefile" or "MAKEFILE". On many systems, the local
+file system is case-insensitive, so case-insensitive name matching would
+be more natural. With \fB\-C\fP, "\fCmakefile\fR" would match
+"makefile", "Makefile", or "MAKEFILE".
+.IP
+\fB\-C\fP does not affect the search for the ZIP archive file(s), nor
+the matching of archive members to existing files on the extraction
+path. So, on a case-sensitive file system, \fIUnZip\fP will never try
+to overwrite a file "FOO" when extracting a member named "foo"!
+.PP
+.PD 0
+.B \-c
+.TP
+.PD
+.B \-\-to\-stdout
+.br
+Primary Mode. Extract files to stdout/screen. For details, see Primary
+Mode options.
+.PP
+.PD 0
+.B \-D
+.TP
+.PD
+.B \-\-dir\-timestamps
+.br
+Control timestamps on extracted files and directories. By default,
+\fIUnZip\fP restores timestamps for extracted files, but not for
+directories it creates. Specifying \fB\-D\fP tells \fIUnZip\fP not to
+restore any timestamps. Specifying \fB\-D\-\fP tells \fIUnZip\fP to
+restore timestamps for directories as well as other items. \fB\-D\-\fP
+works only on systems that support setting timestamps for directories
+(currently ATheOS, BeOS, MacOS, OS/2, Unix, VMS, Win32). On other
+systems, \fB\-D\-\fP has no effect.
+.IP
+[Non-VMS] Timestamp restoration behavior changed between \fIUnZip\fP
+versions 6.00 and 6.10. The following table shows the effects of
+various \fB\-D\fP options for both versions.
+.IP
+.EX
+ UnZip version |
+ 6.00 | 6.10 | Restore timestamps on:
+ -----------+-----------+------------------------
+ -DD | -D | Nothing.
+ -D | (default) | Files, not directories.
+ (default) | -D- | Files and directories.
+.EE
+.IP
+[VMS] The old behavior on VMS was the same as the new behavior on all
+systems. (The old negated \fB\-\-D\fP option is now \fB\-D\-\fP,
+because of changes to the command-line parser.)
+.PP
+.PD 0
+.B \-d dest_dir
+.TP
+.PD
+.B \-\-extract\-dir dest_dir
+.br
+Specifies a destination directory for extracted files. By default,
+files are extracted (and subdirectories created) in the current
+(default, working) directory. With \fB\-d dest_dir\fP, extraction is
+done into the specified directory, instead. See also \fB\-da\fP.
+.IP
+The option and directory may be concatenated without any white space
+between them, but this may cause normal shell behavior to be
+suppressed. For example, "\fC\-d\ ~\fR" (tilde) is expanded by Unix
+shells into the name of the user's home directory, but "\fC\-d~\fR"
+is treated as a literal "\fB~\fP" subdirectory of the current directory.
+.IP
+[VMS] On VMS, only a VMS-style device:[directory] specification is
+permitted.
+.PP
+.PD 0
+.B \-da[=reuse]
+.TP
+.PD
+.B \-\-auto\-extract\-dir[=reuse]
+.br
+Specifies a destination directory for extracted files which is derived
+from the base name of the archive. By default, files are extracted
+(and subdirectories created) in the current (default, working)
+directory. With \fB\-da\fP, UnZip automatically derives a subdirectory
+name from the archive name, creates that subdirectory, and extracts
+files into that subdirectory.
+.IP
+For example, with \fB\-da\fP, extraction of "fred.zip" is done into
+subdirectory "fred" instead of into the current directory. (On VMS,
+subdirectory "[.fred]".)
+.IP
+Using this option can help to avoid cluttering the current directory
+with files extracted from an archive whose structure does not include a
+top-level directory.
+.IP
+For greater safety, by default, UnZip will refuse to extract into an
+automatic extraction directory which already exists. Specifying the
+optional keyword "reuse" will allow an existing directory to be used.
+.IP
+If \fB\-da\fP is specified as a default option in an environment
+variable, it can be overridden by either a negated \fB\-da\-\fP option
+or an explicit \fB\-d dest_dir\fP option. See also \fB\-d\fP.
+.PP
+.PD 0
+.B \-E
+.TP
+.PD
+.B \-\-mac\-efs
+.br
+[MacOS\ (pre-OS-X)] Display contents of MacOS extra field during restore
+operation.
+.PP
+.PD 0
+.B \-F
+.TP
+.PD
+.B \-\-keep\-nfs
+.br
+[Acorn] Suppress removal of NFS filetype extension from stored filenames.
+.IP
+[non-Acorn systems supporting long filenames with embedded commas,
+and only if compiled with ACORN_FTYPE_NFS defined] Translate
+filetype information from ACORN RISC OS extra field blocks into a
+NFS filetype extension and append it to the names of the extracted
+files. (When the stored filename appears already to have an appended
+NFS filetype extension, it is replaced by the info from the extra
+field.)
+.PP
+.PD 0
+.B \-f
+.TP
+.PD
+.B \-\-freshen
+.br
+Primary Mode. Freshen existing files. For details, see Primary Mode
+options.
+.PP
+.PD 0
+.B \-h
+.TP
+.PD
+.B \-\-help
+.br
+Primary Mode. Display brief (roughly 24 lines) usage instructions. For
+details, see Primary Mode options.
+.PP
+.PD 0
+.B \-hh
+.TP
+.PD
+.B \-\-long\-help
+.br
+Primary Mode. Display complete usage instructions. For details, see
+Primary Mode options.
+.PP
+.PD 0
+.B \-I char_set
+.TP
+.PD
+.B \-\-iso\-char\-set char_set
+.br
+[Unix] Select ISO character set \fIchar_set\fP.
+.PP
+.PD 0
+.B \-i
+.TP
+.PD
+.B \-\-no\-mac\-ef\-names
+.br
+[MacOS\ (pre-OS-X)] Ignore filenames stored in MacOS extra
+fields. Instead, the most compatible filename stored in the generic
+part of the member's header is used.
+.PP
+.PD 0
+.B \-J
+.TP
+.PD
+.B \-\-junk\-attrs
+.br
+[BeOS] Junk file attributes. The file's BeOS file attributes are not
+restored, only the file's data.
+.IP
+[MacOS\ (pre-OS-X)] Ignore Mac OS extra fields.
+.IP
+[Mac OS X] Do no special Mac-specific processing of AppleDouble
+archive members. An AppleDouble archive member is restored as a
+separate "._name" file, as it would be on a non-Mac file system.
+.IP
+.EX
+Note that "\fB\-J\fP" is \fInot\fP equivalent to
+"\fB\-Je\ \-Jf\ \-Jr\fP". With "\fB\-J\fP", an AppleDouble archive
+member is restored as a separate "._name" file, as it would be on a
+non-Mac file system. With "\fB\-Je\ \-Jf\ \-Jr\fP", all the data in an
+AppleDouble archive member are ignored, so the data fork file is
+restored with no extended attributes (\fB\-Je\fP), no Finder info
+(\fB\-Jf\fP), and no resource fork (\fB\-Jr\fP); no "._name" file is
+created.
+.IP
+Note that \fB\-j\fP acts on the path of an archive member, and is
+independent of the destination directory specified using \fB\-d\fP or
+\fB\-da\fP. For example, with "\fB\-d zz\fP \fB\-j=1\fP", an archive
+member like "a/b/c/d/ee.txt" would be extracted as "zz/b/c/d/ee.txt",
+with \fB\-j=1\fP stripping the "a/" off the archive path, and
+\fB\-d zz\fP adding the "zz/" to the path in the destination file
+system.
+.EE
+.PP
+.PD 0
+.B \-Je
+.TP
+.PD
+.B \-\-junk\-extattr
+.br
+[Mac OS X] Ignore all Mac OS extended attributes. Extended attribute
+processing is available on Mac OS X 10.4 and later. See also \fB\-J\fP,
+\fB\-Jf\fP, \fB\-Jq\fP, and \fB\-Jr\fP.
+.PP
+.PD 0
+.B \-Jf
+.TP
+.PD
+.B \-\-junk\-finder
+.br
+[Mac OS X] Ignore Mac OS Finder info. See also \fB\-J\fP, \fB\-Je\fP,
+\fB\-Jq\fP, and \fB\-Jr\fP.
+.PP
+.PD 0
+.B \-Jq
+.TP
+.PD
+.B \-\-junk\-qtn
+.br
+[Mac OS X] Ignore Mac OS X Quarantine ("com.apple.quarantine") extended
+attribute. Use "\fB\-Je\fP", to ignore this and all other extended
+attributes. Extended attribute processing is available on Mac OS X 10.4
+and later. See also \fB\-J\fP, \fB\-Je\fP, \fB\-Jf\fP, and \fB\-Jr\fP.
+.PP
+.PD 0
+.B \-Jr
+.TP
+.PD
+.B \-\-junk\-rsrc
+.br
+[Mac OS X] Ignore Mac OS Resource fork. See also \fB\-J\fP, \fB\-Je\fP,
+\fB\-Jf\fP, and \fB\-Jq\fP.
+.PP
+.PD 0
+.B \-j[=depth]
+.TP
+.PD
+.B \-\-junk\-dirs[=depth]
+.br
+Junk directories on extracted files. With \fB\-j\fP, all directory
+information is stripped from an archive member name, so all files are
+extracted into the destination directory. (See also \fB\-d\fP and
+\fB\-da\fP.)
+.IP
+If a depth (\fB=depth\fP, where \fBdepth\fP is a positive integer) is
+specified, then that number of directory levels will be stripped from an
+archive member name. For example, an archive member like
+"a/b/c/d/ee.txt" would normally be extracted as "a/b/c/d/ee.txt". With
+\fB\-j\fP, it would be extracted as "ee.txt". With \fB\-j=2\fP, the
+first two directory levels would be stripped, so it would be extracted
+as "c/d/ee.txt".
+.PP
+.PD 0
+.B \-\-jar
+.br
+Treat archive(s) as Java JAR. Over-simplification in Java JAR archives
+can cause \fIUnZip\fP to transform UTF-8 file names according to
+inappropriate (MS-DOS) rules, yielding corrupt names on extracted files
+(typically those with character codes 128-255). Archives containing a
+Java "CAFE" extra field should be detected automatically, and handled
+correctly, but not all JAR archives include that extra
+field. Specifying \-\-jar tells \fIUnZip\fP to expect UTF-8 file names,
+regardless of whether the archive contains a "CAFE" extra field.
+.PP
+.PD 0
+.B \-K
+.TP
+.PD
+.B \-\-keep\-s\-attrs
+.br
+[AtheOS, BeOS, Unix] Retain SUID/SGID/Tacky permission bits. By
+default, these permission bits are cleared, for security reasons.
+.PP
+.PD 0
+.B \-k
+.TP
+.PD
+.B \-\-keep\-permissions
+.br
+[AtheOS, BeOS, Unix, VMS] Control how archived permissions or
+protections are restored on extracted files and directories.
+.IP
+By default, archived permissions are restored with some limitations. On
+AtheOS, BeOS, and Unix, the current umask value is applied (to the
+normal user/group/other permissions). On VMS, the current default
+protection is applied to the UIC-based (SOGW) protections.
+.IP
+With \-k, the archived permissions are restored without regard to the
+Unix umask or VMS default protection. (This was the default behavior in
+\fIUnZip\fP versions before 6.10.)
+.IP
+With \-k\-, the archived permissions are ignored, so only the Unix umask
+or VMS default protection is effective. (On VMS, directories are always
+created without any Delete access.)
+.IP
+On AtheOS, BeOS, and Unix, the SUID/SGID/Tacky permission bits are
+controlled by the \-K/\-\-keep\-s\-attrs option, regardless of the
+\-k/\-\-keep\-permissions setting.
+.PP
+.PD 0
+.B \-ka
+.TP
+.PD
+.B \-\-keep\-acl
+.br
+[VMS] Restore ACLs on extracted files and directories.
+.PP
+.PD 0
+.B \-L
+.TP
+.PD
+.B \-\-lowercase\-names
+.br
+Convert to lowercase any filename originating on an uppercase-only
+operating system or file system. (This was \fIUnZip\fP's default
+behavior in versions before 5.11. The current default behavior is the
+same as the old behavior with the \fB\-U\fP option. \fB\-U\fP is now
+used for another purpose.)
+.IP
+Depending on the archiver, files archived from single-case file systems
+(old MS-DOS FAT, VMS ODS2, and so on) may be stored as all-uppercase
+names; this can be ugly or inconvenient when extracting to a
+case-preserving file system such as OS/2 HPFS or a case-sensitive one
+such as on Unix. By default \fIUnZip\fP lists and extracts such
+filenames exactly as they're stored (excepting truncation, conversion of
+unsupported characters, an so on). With \fB\-L\fP, the names of all
+files from certain systems will be converted to lowercase. With
+\fB\-LL\fP, all file names will be down-cased, regardless of the
+originating file system.
+.PP
+.PD 0
+.B \-l
+.TP
+.PD
+.B \-\-list
+.br
+Primary Mode. List archive members. For details, see Primary Mode
+options.
+.PP
+.PD 0
+.BR \-M "\ \ \ \ ([CMS,MVS] Or: " \-m )
+.TP
+.PD
+.B \-\-more
+.br
+Pipe all output through an internal pager similar to the Unix
+\fImore\fP(1) command. At the end of a screenful of output, \fIUnZip\fP
+pauses with a "\-\-More\-\-" prompt; the next screenful may be viewed by
+pressing the Enter/Return key or the space bar. \fIUnZip\fP can be
+terminated by pressing the "Q" key and, on some systems, the
+Enter/Return key. Unlike Unix \fImore\fP(1), there is no
+forward-searching or editing capability. Also, \fIUnZip\fP doesn't
+notice if long lines wrap at the edge of the screen, effectively
+resulting in the printing of two or more lines and the likelihood that
+some text will scroll off the top of the screen before being viewed. If
+the actual number of lines on the screen can not be determined, 24 lines
+will be assumed.
+.PP
+.PD 0
+.B \-N
+.TP
+.PD
+.B \-\-comment\-to\-note
+.br
+[Amiga] Extract member comments as Amiga filenotes. Member comments are
+created with the \-c option of \fIZip\fP, or with the \-N option of the
+Amiga port of \fIZip\fP, which stores filenotes as comments.
+.PP
+.PD 0
+.B \-n
+.TP
+.PD
+.B \-\-never\-overwrite
+.br
+When extracting, never overwrite existing files. If a file already
+exists, then skip the extraction of that file without asking. See also
+\-o (\-\-overwrite).
+.IP
+By default, \fIUnZip\fP queries the user before extracting any file that
+already exists. The user may choose to overwrite only the current file,
+overwrite all files, skip extraction of the current file, skip
+extraction of all existing files, or rename the current file (choose a
+new name for the extracted file).
+.IP
+[VMS] On VMS, the usual query choices are to create a new version of an
+existing file, to skip extraction, or to rename the current file. In
+the case where an archive member name includes a version number, and \-V
+("retain VMS file version numbers") is in effect, then an additional
+query choice is offered: to overwrite the existing file.
+.PP
+.PD 0
+.B \-O char_set
+.TP
+.PD
+.B \-\-oem\-char\-set char_set
+.br
+[Unix] Select OEM character set \fIchar_set\fP.
+.PP
+.PD 0
+.B \-o
+.TP
+.PD
+.B \-\-overwrite
+.br
+When extracting, always overwrite existing files without
+prompting. This is a \fIdangerous\fP option, so use it with care. (It
+is often used with \fB\-f\fP, however, and is the only way to overwrite
+directory EAs on OS/2.) See also \-n (\-\-never-overwrite).
+.IP
+By default, \fIUnZip\fP queries the user before extracting any file that
+already exists.
+.IP
+[Non-VMS] On non-VMS systems, the user may choose to overwrite only the
+current file, overwrite all files, skip extraction of the current file,
+skip extraction of all existing files, or rename the current file
+(choose a new name for the extracted file).
+.IP
+[VMS] On VMS, the usual query choices are to create a new version of an
+existing file, to skip extraction, or to rename the current file. In
+the case where an archive member name includes a version number, and \-V
+("retain VMS file version numbers") is in effect, then an additional
+query choice is offered: to overwrite the existing file. In this case,
+\-o selects the "new version" choice, and \-oo (or "\-o \-o") selects the
+"overwrite" choice.
+.PP
+.PD 0
+.B \-P password
+.TP
+.PD
+.B \-\-password password
+.br
+Use \fIpassword\fP to decrypt encrypted archive members (if
+any). \fITHIS IS INSECURE!\fP Many multi-user operating systems
+provide ways for any user to see the current command line of any other
+user. Even on stand-alone systems, there is always the threat of
+over-the-shoulder peeking. Storing the plaintext password as part of a
+command line in an automated script can be even less secure, Whenever
+possible, use the non-echoing, interactive prompt to enter
+passwords. Where security is truly important, use a strong encryption
+method, such as AES, instead of the relatively weak encryption provided
+by Traditional ZIP encryption. Or, use an external encryption program,
+such as GnuPG, before archiving the file. (Note that \fIZip\fP will
+probably not be able to do significant compression on a file which has
+already been encrypted.)
+.PP
+.PD 0
+.B \-p
+.TP
+.PD
+.B \-\-pipe\-to\-stdout
+.br
+Primary Mode. Extract files to stdout (pipe). For details, see Primary
+Mode options.
+.PP
+.PD 0
+.B \-q
+.TP
+.PD
+.B \-\-quiet
+.br
+Perform operations quietly. (\fB\-qq\fP: even more quietly). By
+default, \fIUnZip\fP prints the names of the files it's extracting or
+testing, the extraction methods, any member or archive comments that may
+be stored in the archive, and possibly a summary when finished with each
+archive. The \fB\-q\fP[\fBq\fP] options suppress the printing of some
+or all of these messages.
+.PP
+.PD 0
+.B \-r
+.TP
+.PD
+.B \-\-remove\-exts
+.br
+[Tandem] Remove file extensions.
+.PP
+.PD 0
+.B \-S
+.TP
+.PD
+.B \-\-streamlf
+.br
+[VMS] Use Stream_LF record format when converting extracted text files
+(\fB\-a\fP, \fB\-aa\fP), instead of the text-file default,
+variable-length record format.
+.IP
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip\ \-V" or "ZIP\ /VMS"), files are always created with their original
+record formats. For archives without VMS attribute information (not
+made with "zip\ \-V" or "ZIP\ /VMS"), all files are normally created
+with Stream_LF record format. With \fB\-a\fP, text files are normally
+created with variable-length record format, but adding \fB\-S\fP gives
+them Stream_LF record format. With \fB\-aa\fP, all files are treated as
+text files. See also \fB\-a\fP and \fB\-b\fP.
+.PP
+.PD 0
+.B \-s
+.TP
+.PD
+.B \-\-space\-to\-uscore
+.br
+Convert spaces in filenames to underscores. Normally, on a system which
+allows spaces in filenames, \fIUnZip\fP extracts filenames with spaces
+intact (for example, "\fCEA\ DATA.\ SF\fR"). Working with such file
+names can be awkward, however, so \fB\-s\fP can be used to replace
+spaces with underscores.
+.PP
+.PD 0
+.B \-sc
+.TP
+.PD
+.B \-\-show\-command
+.br
+Show processed command line (options, arguments), and then exit.
+.IP
+Strictly speaking this is a primary-mode option, but it's intended for
+use in program development, not for normal use.
+.PP
+.PD 0
+.B \-si
+.TP
+.PD
+.B \-\-show\-pid
+.br
+[Non-VMS] Show the \fIUnZip\fP program's process ID (pid) before
+performing any other work. This value can then be used in a
+"kill \-USR1 pid" command to trigger a user-triggered progress report.
+.PP
+.PD 0
+.B \-so
+.TP
+.PD
+.B \-\-show\-options
+.br
+Display all valid program options, then exit.
+.IP
+Strictly speaking this is a primary-mode option, but it's intended for
+use in program development, not for normal use.
+.PP
+.PD 0
+.B \-T
+.TP
+.PD
+.B \-\-timestamp\-new
+.br
+Primary Mode. Set the timestamp on the archive(s) to that of the newest
+file in each one. For details, see Primary Mode options.
+.PP
+.PD 0
+.B \-t
+.TP
+.PD
+.B \-\-test
+.br
+Primary Mode. Test archive members. For details, see Primary Mode
+options.
+.PP
+.PD 0
+.B \-U
+.TP
+.PD
+.B \-\-unicode
+.br
+[UNICODE_SUPPORT] Control UTF-8 handling. When UNICODE_SUPPORT is
+available, \fB\-U\fP forces \fIUnZip\fP to escape all non-ASCII
+characters from UTF-8 coded filenames as "#Uxxxx' (for UCS-2 characters,
+or "#Lxxxxxx" for Unicode codepoints needing 3 octets). This option is
+provided mainly for debugging, when the fairly new UTF-8 support is
+suspected of mangling extracted filenames.
+.IP
+\fB\-UU\fP disables the recognition of UTF-8 encoded filenames. The
+handling of filename codings within \fIUnZip\fP falls back to the
+behavior of pre-Unicode versions.
+.IP
+[old, obsolete usage] Leave filenames uppercase if created on MS-DOS,
+VMS, and so on. See \fB\-L\fP.
+.PP
+.PD 0
+.B \-u
+.TP
+.PD
+.B \-\-update
+.br
+Primary mode. Update existing files and create new ones if needed. For
+details, see Primary Mode options.
+.PP
+.PD 0
+.B \-V
+.TP
+.PD
+.B \-\-keep\-versions
+.br
+[Non-CMS-MVS] Retain VMS file version numbers. VMS files can be stored
+with a version number, in the format "\fCfile.type;##\fR", where "##" is
+a positive decimal number. By default VMS "\fC;##\fR" version numbers
+are stripped, but this option allows them to be retained. (On file
+systems that limit filenames to particularly short lengths, the version
+numbers may be truncated or stripped regardless of this option.)
+.IP
+[Non-VMS] Note that before \fIUnZip\fP version 6.10, on a non-VMS
+system, a file with a name like "\fCfred;123\fR" would, by default, be
+extracted as "\fCfred\fR", even if the file did not originate on a VMS
+system (so that "\fC;123\fR" was probably not really a VMS version
+number). Beginning with UnZip version 6.10, the default behavior is to
+strip VMS version numbers only from files which were archived on a VMS
+system. To restore the old behavior, and always strip apparent VMS
+version numbers, explicitly negate the option: \fB\-V\-\fP.
+.IP
+[VMS] Note that on VMS, \fB\-V\fP affects \fIonly\fP version numbers,
+and is \fInot\fP needed to restore VMS file attributes. \fBZip\fP's
+\fB\-V\fP (\fB/VMS\fP) option is required to \fIstore\fP VMS attributes
+in an archive. If that was done when an archive was created, then
+\fBUnZip\fP will always \fIrestore\fP those attributes when a file is
+extracted.
+.PP
+.PD 0
+.B \-v
+.TP
+.PD
+.B \-\-verbose
+.br
+When used with some primary mode option, \fB\-v\fP can make output more
+verbose. See also Primary Mode options, and \fB\-l\fP in particular.
+.IP
+Note: If only \fB\-v\fP (\fB\-\-verbose\fP) is specified with an archive
+name, then \fIUnZip\fP acts as if "\fB\-l\fP \fB\-v\fP" were specified,
+and a detailed listing is generated.
+.PP
+.PD 0
+.B \-\-version
+.TP
+.PD
+Primary Mode. Display the program version, build options, and relevant
+environment variables. For details, see Primary Mode options.
+.PP
+.PD 0
+.B \-W
+.TP
+.PD
+.B \-\-wild\-no\-span
+.br
+[WILD_STOP_AT_DIR] (Valid when the program was built with the C macro
+WILD_STOP_AT_DIR defined.) By default, the wildcard characters "?"
+(single-character wildcard) and "*" (multi-character wildcard) match any
+character in a member path/name. "\fC\-W\fR" modifies the
+pattern-matching behavior for archive members so that both "?"
+(single-character wildcard) and "*" (multi-character wildcard) do not
+match the directory separator character "/". (The two-character
+sequence "**" acts as a multi-character wildcard that includes the
+directory separator in its matched characters.) For example, with
+"\fC\-W\fR":
+.PP
+.EX
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "**.c" matches both "foo.c" and "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+.EE
+.IP
+This modified behavior is equivalent to the pattern matching style used
+by the shells of some of \fIUnZip\fP's supported target OSs (one example
+is Acorn RISC OS). This option may not be available on systems where
+the Zip archive's internal directory separator character "/" is allowed
+as regular character in native operating system filenames.
+.IP
+[non-VMS] Currently, \fIUnZip\fP uses the same pattern matching rules
+for both wildcard archive file name specifications and archive member
+selection patterns on most system types. For systems allowing "/" as
+regular filename character, the \-W option would not work as expected on
+a wildcard file name specification.
+.PP
+.PD 0
+.B \-X
+.TP
+.PD
+.B \-\-restore\-owner
+.br
+[NT, OS/2, Unix, VMS, Tandem] Restore owner info (user and group info
+(UID/GID) on Unix, UIC on VMS, or access control lists (ACLs) on certain
+network-enabled versions of OS/2 (Warp Server with IBM LAN
+Server/Requester 3.0 to 5.0; Warp Connect with IBM Peer 1.0), or
+security ACLs on Windows NT.) In most cases this will require special
+system privileges, and doubling the option (\fB\-XX\fP) on NT instructs
+\fIUnZip\fP to use privileges for extraction; but on Unix, for example,
+a user who belongs to several groups can restore files owned by any of
+those groups, so long as the user IDs match the user's own. Note that
+ordinary file attributes are always restored. This option applies only
+to optional, extra ownership info available on some operating
+systems. (NT's access control lists do not appear to be especially
+compatible with OS/2's, so no attempt is made at cross-platform
+portability of access privileges. It is not clear under which
+conditions this would ever be useful anyway.)
+.PP
+.PD 0
+.BR "\-x member" " ..."
+.TP
+.PD
+.BR "\-\-exclude member" " ..."
+.br
+An optional list of archive members to be excluded from
+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. Without the \fB\-x\fP option, all C source files in all
+directories within the archive would be extracted.
+.IP
+When the program sees \fB\-x\fP (\fB\-\-exclude\fP) on a command line,
+it stops scanning for options, and treats every succeeding item as an
+archive member name. To avoid confusion between member names and
+command options, it's simplest to specify \fB\-x\fP (\fB\-\-exclude\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). That is, the following two commands are equivalent:
+.EX
+ unzip fred.zip -b -x file1 file2 file3
+ unzip fred.zip -x file1 file2 file3 @ -b
+.EE
+.PP
+.PD 0
+.B \-Y
+.TP
+.PD
+.B \-\-dot\-version
+.br
+[VMS] Treat archive member name endings of ".nnn" (where "nnn" is a
+decimal number) as if they were VMS version numbers (";nnn"). (The
+default is to treat them as file types.) For example:
+.EX
+ "a.b.3" -> "a.b;3"
+.EE
+.PP
+.PD 0
+.B \-Z
+.TP
+.PD
+.B \-\-zipinfo\-mode
+.br
+\fIZipInfo\fP mode. If the first option on the command line is
+\fB\-Z\fP, then the program runs in \fIZipInfo\fP mode. Remaining
+options are interpreted as \fIZipInfo\fP options. See the
+\fBzipinfo\fP manual page for a description of those options.
+.PP
+.PD 0
+.B \-z
+.TP
+.PD
+.B \-\-zipfile\-comment
+.br
+Primary mode. Display only the archive comment. For details, see
+Primary Mode options.
+.PP
+.PD 0
+.B \-$
+.TP
+.PD
+.B \-\-volume\-labels
+.br
+.\" [Amiga support possible eventually, but not yet.]
+[MS-DOS, NT, OS/2, VMS] Restore the volume label if the extraction
+medium is removable (for example, a diskette). Doubling the option
+(\fB\-$$\fP) allows fixed media (hard disks) to be labeled as well. By
+default, volume labels are ignored.
+.br
+[VMS] On VMS, a volume must be allocated, not shared, for a volume label
+to be set.
+.PP
+.PD 0
+.B \-/
+.TP
+.PD
+.B \-\-extensions
+.br
+[Acorn] Overrides the extension list supplied by the \fBUnzip$Ext\fP
+environment variable. During extraction, filename extensions that match
+one of the items in this extension list are swapped in front of the base
+name of the extracted file.
+.PP
+.PD 0
+.B \-:
+.TP
+.PD
+.B \-\-do\-double\-dots
+.br
+[all but Acorn, VM/CMS, MVS, Tandem] Allows \fIUnZip\fP to extract
+archive members into locations outside of the current extraction
+destination directory (and its subdirectories).
+.IP
+For security reasons, \fIUnZip\fP normally removes "parent directory"
+path components ("../") from the path names of archive members as they
+are extracted. This safety feature (new for version 5.50) prevents
+\fIUnZip\fP from accidentally writing files to directories outside
+the current destination directory tree. The \fB\-:\fP option sets
+\fIUnZip\fP back to its previous, more liberal behavior, allowing exact
+extraction of archives that use "../" path components to create multiple
+directory trees at \fIor above\fP the level of the destination
+directory.
+.IP
+This option does not enable writing explicitly to the root
+directory ("/"). To achieve this, it is necessary to set the extraction
+target folder to "/" (by using an option like "\fB\-d\ /\fP"). However,
+when the \fB\-:\fP option is specified, it is still possible implicitly
+to write to the root directory if member paths specifying enough "../"
+path components.
+.IP
+\fIUse this option with extreme caution.\fP
+.PP
+.PD 0
+.B \-^
+.TP
+.PD
+.B \-\-control\-in\-name
+.br
+[Unix] Allow control characters in file names of extracted ZIP archive
+members. On Unix, a file name may contain any (8-bit) character code
+with the two exceptions of "/" (the directory delimiter) and NUL (0x00,
+the C string-termination character), unless the specific file system has
+more restrictive conventions. Generally, this allows embedding ASCII
+control characters or escape sequences in file names. However, this
+feature allows the use of malicious file names which can cause various
+kinds of bad trouble when displayed on a user's
+terminal/emulator. (Even a file name with unprintable but otherwise
+harmless characters can cause problems for users.)
+.IP
+For these reasons, by default, \fIUnZip\fP applies a filter that removes
+potentially dangerous control characters from the extracted file
+names. The \fB\-^\fP option overrides this filter in the rare case that
+embedded filename dangerous control characters are to be intentionally
+restored.
+.PP
+.\" =========================================================================
+.SH "ENVIRONMENT OPTIONS"
+\fIUnZip\fP's default behavior may be modified by placing command-line
+options in an environment variable. This can be done with any option,
+but it is probably most useful options like \fB\-a\fP (auto-convert text
+files), \fB\-L\fP (downcase file names from systems with all uppercase
+file names), \fB\-C\fP (use case-insensitive name matching), \fB\-q\fP
+(quiet), \fB\-o\fP (always overwrite), or \fB\-n\fP (never overwrite).
+.IP
+For \fIUnZip\fP, the environment variable name is UNZIP, except on VMS,
+where it's UNZIP_OPTS (to avoid conflict with a foreign-command DCL
+symbol, UNZIP). For similarity with \fIZip\fP, if UNZIP (UNZIP_OPTS
+on VMS) is not defined, then \fIUnZip\fP will use UNZIPOPT the same way.
+.IP
+For \fIZipInfo\fP ("\fCunzip -Z\fR"), the environment variable name is
+ZIPINFO, except on VMS, where it's ZIPINFO_OPTS. For similarity with
+\fIZip\fP, if ZIPINFO (ZIPINFO_OPTS on VMS) is not defined, then
+\fIZipInfo\fP will use ZIPINFOOPT the same way.
+.IP
+For example, to make \fIUnZip\fP act as quietly as possible, only
+reporting errors, one could use commands like the following:
+.TP
+ Unix Bourne (or similar) shell:
+UNZIP='\-q\ \-q'; export UNZIP
+.TP
+ Unix C shell:
+setenv\ UNZIP\ '\-q\ \-q'
+.TP
+ OS/2 or MS-DOS:
+set\ UNZIP="\-q\ \-q"
+.TP
+ VMS (with quotation to preserve lower case in DCL):
+define\ UNZIP_OPTS\ "\-q\ \-q" ! Logical name, or
+.br
+UNZIP_OPTS\ =\ "\-q\ \-q" ! DCL symbol. (Either works.)
+.IP
+Environment options are treated the same as any other command-line
+options, except that they are effectively the first options on the
+command line. To override an environment option, one may use an
+explicit option to cancel or override it. For example, to override one
+of the "quiet" flags in the example above, use a command like:
+.EX
+unzip\ \-q\-\ [\fIother\ options\fP]\ archive.zip
+.EE
+.IP
+The leading hyphen is the normal option character, and the trailing one
+negates the option, canceling one level of quietness. To cancel
+multiple "quiet" flags, use multiple \fB\-q\-\fP options:
+.PP
+.EX
+unzip\ \-t\ \-q\-\ \-q\-\ archive
+unzip\ \-q\-\ \-q\-\ \-t\ archive
+.EE
+.IP
+Note that multiple one-character options like "\-q" and "\-q" can be
+combined into a single "\-qq", but it's generally clearer to keep each
+instance of each option separate. Similarly, negated one-character
+options can be combined, as with "\-q\-q\-", but "\-q\-\ \-q\-" is
+generally clearer.
+.IP
+The examples show short (one-character) options, but long ("\-\-")
+options are also allowed.
+.PP
+The timezone variable (TZ) should be set according to the local timezone
+in order for the Freshen (\fB\-f\fP) and Update (\fB\-u\fP) modes to
+operate correctly. For details, see \fB\-f\fP. This variable may also
+be necessary to get timestamps of extracted files to be set correctly.
+.IP
+On Windows systems, \fIUnZip\fP gets the timezone configuration from the
+registry, assuming it is correctly set in the Control Panel. The TZ
+variable is ignored on these systems.
+.PP
+.\" =========================================================================
+.SH ENCRYPTION/DECRYPTION
+\fIZip\fP and \fIUnZip\fP have long supported a relatively weak
+encryption method, which we call Traditional ZIP encryption. The source
+code for Traditional encryption is included in the source kits, and
+support for Traditional encryption is enabled by default. (Build-time C
+macros: IZ_CRYPT_TRAD, NO_CRYPT.)
+.PP
+Beginning with \fIUnZip\fP version 6.10 and \fIZip\fP version 3.1,
+these programs also offer a stronger, Advanced Encryption Standard (AES)
+encryption method, which we call AES WinZip/Gladman (AES_WG)
+encryption. (The encryption code was supplied by Brian Gladman, and the
+archive format is intended to be compatible with that used by the
+\fIWinZip\fP program. \fIWinZip\fP is a registered trademark of WinZip
+International LLC.) The source code for AES_WG encryption is
+distributed in a separate kit (for export control reasons), and support
+for AES_WG encryption must be enabled explicitly at build
+time. (Build-time C macro: IZ_CRYPT_AES_WG.) See the INSTALL file in
+the source kit for details on how to enable AES_WG encryption (or how to
+disable Traditional encryption).
+.TP
+For details on the WinZip AES scheme, see:
+http://www.winzip.com/aes_info.htm
+.TP
+For information on the separate AES_WG source kit, see:
+ftp://ftp.info-zip.org/pub/infozip/crypt/
+.br
+ftp://ftp.info-zip.org/pub/infozip/crypt/README_AES_WG.txt
+.PP
+Normally, encryption passwords are supplied by the user interactively
+when requested by the program. See the \fB\-P\fP option for a (less
+secure) method of specifying a password on the command line.
+.PP
+With Traditional encryption, when decrypting, a password will be checked
+against header data, and used if it appears to be correct. The correct
+password will always check out against the header data, but there is a
+1-in-256 chance that an incorrect password will as well. (This is a
+security feature of the PKWARE archive format; it helps prevent
+brute-force attacks that might otherwise gain a large speed advantage by
+testing only the header.) In the case that an incorrect password is
+given but it passes the header test anyway, either an incorrect CRC will
+be generated for the extracted data or else \fIUnZip\fP will fail during
+the extraction because the "decrypted" bytes do not constitute a valid
+compressed data stream.
+.PP
+If the first password fails the header check on some file, \fIUnZip\fP
+will prompt for another password, and so on until all files are
+extracted. If a password is not known, entering a null password (that
+is, just a carriage return or "Enter") is taken as a signal to skip all
+further prompting. Only unencrypted files in the archive(s) will
+thereafter be extracted. (The situation is actually a little more
+complicated. Some old versions of \fIZip\fP and \fIZipCloak\fP allowed
+null passwords, so \fIUnZip\fP checks each encrypted file to see if the
+null password works. This may result in "false positives" and
+extraction errors, as noted above.)
+.PP
+Archives encrypted with 8-bit-character passwords (for example,
+passwords with accented European characters) may not be portable across
+systems or to other archivers. This problem stems from the use of
+multiple encoding methods for such characters, including Latin-1 (ISO
+8859-1) and OEM code page 850. DOS \fIPKZIP\fP 2.04g uses the OEM code
+page; Windows \fIPKZIP\fP 2.50 uses Latin-1 (and is therefore
+incompatible with DOS \fIPKZIP\fP); Info-ZIP uses the OEM code page on
+DOS, OS/2 and Win3.x ports but ISO coding (Latin-1 etc.) everywhere
+else; and Nico Mak's \fIWinZip\fP 6.x does not allow 8-bit-character
+passwords at all. \fIUnZip\fP 5.3 (or newer) attempts to use the
+default character set first (e.g., Latin-1), followed by the alternate
+one (e.g., OEM code page) to test passwords. On EBCDIC systems, if both
+of these fail, EBCDIC encoding will be tested as a last resort. (EBCDIC
+is not tested on non-EBCDIC systems, because there are no known
+archivers that encrypt using EBCDIC encoding.) ISO character encodings
+other than Latin-1 are not supported. The new addition of (partial)
+Unicode (UTF-8) support in \fIUnZip\fP 6.0 has not yet been adapted to
+the encryption password handling in \fIUnZip\fP. On systems that use
+UTF-8 as native character encoding, \fIUnZip\fP simply tries decryption
+with the native UTF-8 encoded password; the built-in attempts to check
+the password in translated encoding have not yet been adapted for UTF-8
+support and will consequently fail.
+.PP
+.\" =========================================================================
+.SH EXAMPLES
+To use \fIUnZip\fP to extract all members of the archive \fIletters.zip\fP
+into the current directory and subdirectories below it, creating any
+subdirectories as necessary:
+.PP
+.EX
+unzip letters
+.EE
+.PP
+To extract all members of \fIletters.zip\fP into the current directory only:
+.PP
+.EX
+unzip \-j letters
+.EE
+.PP
+To test \fIletters.zip\fP, printing only a summary message indicating
+whether the archive is OK or not:
+.PP
+.EX
+unzip \-t \-q letters
+.EE
+.PP
+To test \fIall\fP ".zip" archives in the current directory, printing
+only the summaries:
+.PP
+.EX
+unzip \-t \-q "*.zip"
+.EE
+.PP
+Here, the wildcard archive name was quoted to keep a Unix shell from
+expanding ("globbing") it. (This would not be necessary on VMS.)
+.PP
+The following command extracts to standard output all members of
+\fIletters.zip\fP whose names end in \fI\.tex\fP, auto-converting to the
+local end-of-line convention, and piping the output into \fImore\fP(1)
+(again, quoting the wildcard member name pattern):
+.PP
+.EX
+unzip \-c \-a letters '*.tex' | more
+.EE
+.PP
+To extract the binary file \fIpaper1.dvi\fP to standard output and pipe it
+to a printing program:
+.PP
+.EX
+unzip \-p articles paper1.dvi | dvips
+.EE
+.PP
+To extract from \fIsource.zip\fP all Fortran and C source files (*.f,
+*.c, *.h) and Makefile into the /tmp directory (again, quoting the
+wildcard):
+.PP
+.EX
+unzip source.zip "*.[fch]" Makefile \-d /tmp
+.EE
+.PP
+To extract all FORTRAN and C source files, regardless of case (for
+example, both *.c and *.C, and any makefile, Makefile, MAKEFILE or
+similar):
+.PP
+.EX
+unzip \-C source.zip "*.[fch]" makefile \-d /tmp
+.EE
+.PP
+To extract any such files but convert any uppercase MS-DOS or VMS names
+to lowercase and convert the line-endings of all of the files to the
+local standard (without respect to any files that might be marked
+"binary"):
+.PP
+.EX
+unzip \-aa \-C \-L source.zip "*.[fch]" makefile \-d /tmp
+.EE
+.PP
+The following command extracts only newer versions of the files already
+in the current directory, without querying. (Note: Be careful of
+extracting in one timezone an archive created in another. ZIP archives
+created by \fIZip\fP versions before 2.1 contain no timezone
+information, and a "newer" file from an eastern timezone may, in fact,
+be older):
+.PP
+.EX
+unzip \-f \-o sources
+.EE
+.PP
+To extract newer versions of the files already in the current directory
+and to create any files not already there (same caveat as previous
+example):
+.PP
+.EX
+unzip \-u \-o sources
+.EE
+.PP
+To display a configuration report showing the program version, the OS
+and compiler used to build it, a list of optional features enabled at
+build time, and the values of all the relevant environment variables:
+.PP
+.EX
+unzip \-v
+.EE
+.PP
+In the last five examples, assume that UNZIP or UNZIP_OPTS is set to
+\-q. To do a (singly) quiet listing:
+.PP
+.EX
+unzip \-l file.zip
+.EE
+.PP
+To do a doubly quiet listing:
+.PP
+.EX
+unzip \-l \-q file.zip
+.EE
+.PP
+(Note that the "\fC\.zip\fR" is generally not necessary.) To do a standard
+listing:
+.PP
+.EX
+unzip \-l \-q\- file.zip
+.EE
+or:
+.EX
+unzip \-lq\- file.zip
+.EE
+or:
+.EX
+unzip \-q\-l file.zip
+.EE
+.PP
+.\" =========================================================================
+.SH "EXIT STATUS"
+The exit status (or error level) approximates the exit codes defined by
+PKWARE and takes on the following values (except on VMS):
+.RS
+.IP 0
+Normal. No errors or warnings detected.
+.IP 1
+One or more warnings were encountered, but processing completed
+successfully. This includes archives where one or more (but not all)
+files were skipped because of an unsupported compression or encryption
+method, or a bad encryption password.
+.IP 2
+Error in the archive format. Processing may or may not have completed
+successfully.
+.IP 3
+Severe error in the archive format. Processing probably failed
+immediately.
+.IP 4
+Memory allocation failed in program initialization.
+.IP 5
+Memory allocation or terminal I/O failed in encryption password
+processing.
+.IP 6
+Memory allocation failed while decompressing to disk.
+.IP 7
+Memory allocation failed while decompressing in memory.
+.IP 8
+Memory allocation failed. (Currently not used.)
+.IP 9
+Specified archive files were not found.
+.IP 10
+Invalid command-line options or parameters.
+.IP 11
+No matching files were found.
+.IP 50
+Disk (file system) filled during extraction.
+.IP 51
+Unexpected end-of-file while reading the archive.
+.IP 80
+User interrupt (Ctrl/C or similar).
+.IP 81
+No files were processed, because of unsupported compression or
+encryption methods.
+.IP 82
+No files were processed, because of bad encryption password(s).
+.IP 83
+Large-file archive could not be processed by this small-file program.
+.IP 84
+Failed to create automatic extraction directory. (Already exists?)
+.RE
+.PP
+[VMS] On VMS, the standard Unix exit status values are translated into
+valid VMS status codes. For details, see the file [.vms]NOTES.TXT in
+the source kit.
+.PP
+.\" =========================================================================
+.SH BUGS
+Multi-part archives are not yet supported, except in conjunction with
+\fIZip\fP. (All parts must be concatenated together in order, and then
+"\fCzip\ \-F\fR" (for Zip 2.x) or "\fCzip\ \-FF\fR" (for Zip 3.x) must be
+performed on the concatenated archive in order to "fix" it. Also,
+\fIzip\fP version 3.0 and later can combine multi-part (split) archives into a
+combined single-file archive using
+"\fCzip\ \-s\-\ inarchive\ \-O\ outarchive\fR". See the \fIzip\fP
+manual page for more information.) This may be corrected in the next
+major release.
+.PP
+Archives read from standard input are not yet supported, except with
+\fIfUnZip\fP (and then only the first member of the archive can be
+extracted).
+.PP
+Archives encrypted with 8-bit-character passwords (such as passwords
+with accented European characters) may not be portable across systems
+and/or other archivers. See also \fBENCRYPTION/DECRYPTION\fP.
+.PP
+\fIUnZip\fP's \fB\-M\fP ("\-\-more") option tries to take into account
+automatic wrapping of long lines. However, the code may fail to detect
+the correct wrapping locations. First, TAB characters (and similar
+control sequences) are not taken into account, they are handled as
+ordinary printable characters. Second, depending on the actual system
+type, \fIUnZip\fP may not detect the true terminal/emulator geometry,
+but instead may rely on "commonly used" default dimensions. The correct
+handling of tabs would require the implementation of a query for the
+actual tab setup on the output terminal/emulator.
+.PP
+[Unix] Unix special files such as FIFO buffers (named pipes), block
+devices and character devices are not restored even if they are somehow
+represented in the archive, nor are hard-linked files
+relinked. Basically, the only file types restored by \fIUnZip\fP are
+regular files, directories, and symbolic (soft) links.
+.PP
+[OS/2] Extended attributes for existing directories are only updated if
+the \fB\-o\fP ("overwrite all") option is given. This is a limitation
+of the operating system; because directories only have a creation time
+associated with them, \fIUnZip\fP has no way to determine whether the
+stored attributes are newer or older than those on disk. In practice
+this may mean a two-pass approach is required: first unpack the archive
+normally (with or without freshening/updating existing files), then
+overwrite just the directory entries (for example,
+"\fCunzip\ \-o\ foo\ */\fR").
+.PP
+.\" =========================================================================
+.SH "SEE ALSO"
+\fIfunzip\fP(1L), \fIunzipsfx\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L),
+.br
+\fIzipgrep\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
+.PP
+.\" =========================================================================
+.SH URL
+.TP
+The Info-ZIP main Web page is:
+.EX
+\fChttp://www.info-zip.org/\fR
+.EE
+.TP
+FTP access is available, too:
+.EX
+\fCftp://ftp.info-zip.org/pub/infozip/\fR
+.EE
+.PP
+.\" =========================================================================
+.SH AUTHORS
+The primary Info-ZIP authors (current semi-active members of the
+Zip-Bugs workgroup) are: Ed Gordon (Zip, general maintenance, shared
+code, Zip64, Win32, Unix, Unicode); Christian Spieler (\fIUnZip\fP
+maintenance coordination, VMS, MS-DOS, Win32, shared code, general Zip
+and \fIUnZip\fP integration and optimization); Onno van der Linden
+(Zip); Mike White (Win32, Windows GUI, Windows DLLs); Kai Uwe Rommel
+(OS/2, Win32); Steven M. Schweda (VMS, Unix, support of new features);
+Paul Kienitz (Amiga, Win32, Unicode); Chris Herborth (BeOS, QNX, Atari);
+Jonathan Hudson (SMS/QDOS); Sergio Monesi (Acorn RISC OS); Harald Denker
+(Atari, MVS); John Bush (Solaris, Amiga); Hunter Goatley (VMS, Info-ZIP
+Site maintenance); Steve Salisbury (Win32); Steve Miller (Windows CE
+GUI), Johnny Lee (MS-DOS, Win32, Zip64); and Dave Smith (Tandem NSK).
+.PP
+The following people are former members of the Info-ZIP development
+group, and provided major contributions to key parts of the current code:
+Greg "Cave Newt" Roelofs (\fIUnZip\fP, unshrink decompression);
+Jean-loup Gailly (deflate compression);
+Mark Adler (inflate decompression, \fIfUnZip\fP).
+.PP
+The author of the original unzip code upon which Info-ZIP's was based
+is Samuel H. Smith; Carl Mascott did the first Unix port; and David P.
+Kirschbaum organized and led Info-ZIP in its early days with Keith Petersen
+hosting the original mailing list at WSMR-SimTel20. The full list of
+contributors to \fIUnZip\fP has grown quite large; please refer to the
+proginfo/CONTRIBS file in the \fIUnZip\fP source distribution for a
+relatively complete version.
+.PP
+.\" =========================================================================
--- /dev/null
+.\" Copyright (c) 1990-2013 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.
+.\" If, for some reason, all these files are missing, the Info-ZIP license
+.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+.\"
+.\" unzipsfx.1 by Greg Roelofs
+.\"
+.\" =========================================================================
+.TH UNZIPSFX 1L "06 Nov 2013 (v6.10)" "Info-ZIP"
+.\" =========================================================================
+.\"
+.\" Define .EX/.EE (for multiline user-command examples; normal Courier font).
+.\" Must follow ".TH"; otherwise macros get redefined.
+.de EX
+.in +4n
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.fi
+.in -4n
+..
+.\" =========================================================================
+.SH NAME
+unzipsfx \- self-extraction (SFX) program. Append a ZIP archive to it
+to make a self-extracting archive bundle.
+.PD
+.SH SYNOPSIS
+.B name_of_unzipsfx+archive_bundle
+.RB "[ " unzip_options " ]"
+.RI "[ " member " ... ]"
+.PP
+.\" =========================================================================
+.SH DESCRIPTION
+\fIUnZipSFX\fP is a special edition of \fIUnZip\fP which is designed to
+be attached to the beginning of an existing, ordinary ZIP archive to
+form a self-extracting (SFX) archive. Unlike the normal \fIUnZip\fP
+program, which works on an archive specified on its command line,
+\fIUnZipSFX\fP works on an archive which has been appended to itself.
+.PP
+Minimizing the size of a self-extracting archive, means minimizing the
+size of the \fIUnZipSFX\fP program itself. Thus \fIUnZipSFX\fP is
+normally built without some of the less important features found in the
+normal \fIUnZip\fP program. Among these are the help/usage displays
+(\fB\-h\fP, \fB\-hh\fP), the listing and diagnostic functions
+(\fB\-l\fP, \fB\-v\fP), the ability to process some older compression
+methods ("Implode", "Reduce", "Shrink"), and, by default, some newer
+compression methods (bzip2, LZMA, PPMd) and any encryption methods.
+.PP
+Starting with \fIUnZipSFX\fP version 5.50, the ability to extract to a
+directory other than the current one (\fB\-d\ dest_dir\fP) has been
+enabled by default. Some or all of the optional compression and/or
+encryption methods can be enabled at build time, at the cost of
+increasing the size of the resulting \fIUnZipSFX\fP program.
+.PP
+Starting with \fIUnZip\fP version 5.50, another build-time option adds a
+simple "run command after extraction" feature. This feature is
+currently incompatible with the "extract to different directory"
+(\fB\-d\ dest_dir\fP) feature, and remains disabled by default.
+.PP
+All the build-time options controlling \fIUnZipSFX\fP features should be
+explained in the \fIUnZip\fP installation instructions (INSTALL). Note
+that the features (such as optional encryption or compression methods)
+which are \fIavailable\fP in an \fIUnZipSFX\fP executable are determined
+when the \fIUnZipSFX\fP executable is built. However, the features
+which are \fIneeded\fP are determined when the ZIP archive is
+created. The user must decide which optional features to include in or
+exclude from the \fIUnZipSFX\fP executable, and then use only the
+available \fIUnZipSFX\fP features when creating an archive for use as a
+self-extracting archive. Enabling optional features in \fIUnZipSFX\fP
+makes the executable bigger (and hence SFX archives made with it). Of
+course, the greater efficiency of some optional compression method might
+save enough space to compensate for the bigger \fIUnZipSFX\fP executable
+which would be needed to deal with it. And, if encryption is desired,
+then the \fIUnZipSFX\fP executable must be able to deal with that.
+.PP
+Users with complex requirements may find it useful to build multiiple
+\fIUnZipSFX\fP executables with different feature sets for different
+purposes. The user is responsible for managing multiple
+\fIUnZipSFX\fP executables. The \fIUnZip\fP builders offer no tools to
+help, and, without a "\fB\-v\fP" report, determining the capabilities of
+an \fIUnZipSFX\fP executable is not very easy. The user is also
+responsible for testing a self-extracting archive on the target system,
+to ensure that the \fIUnZipSFX\fP executable used has all the features
+it needs to process the attached archive.
+.IP
+Note that the \fIUnZipSFX\fP executable in a self-extracting archive is
+a real executable program, and so is not generally portable from one
+operating system or hardware architecture to another. The ZIP archive
+within a self-extracting archive \fIcan\fP be processed anywhere using a
+normal \fIUnZip\fP program. (At worst, \fIUnZip\fP will emit a warning
+like "nnnn extra bytes at beginning or within zipfile", but using
+"zip\ \-A" on an SFX bundle will prevent even that annoyance.)
+.PD
+.\" =========================================================================
+.SH ARGUMENTS
+.TP
+.IR member " ..."
+An optional list of archive members to be processed, separated by
+spaces. If no member list is specified, then all archive members are
+processed. Wildcard patterns may be used to match multiple members. These
+wildcard expressions are similar to those supported (for "globbing") in
+commonly used Unix shells (\fIcsh\fP, \fIksh\fP, \fIsh\fP, and so on)
+and may contain:
+.RS
+.IP *
+matches a sequence of 0 or more characters.
+.IP ?
+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. If an exclamation point ("!") or a caret ("^") follows the
+left bracket, then the range of characters within the brackets is
+complemented. That is, anything \fIexcept\fP the characters inside the
+brackets is considered a match. To specify a literal left bracket, use
+the three-character sequence "[[]".
+.RE
+.IP
+Be sure to escape or quote any character(s) that might otherwise be
+interpreted or modified by the operating system, particularly Unix
+shells.
+.\" =========================================================================
+.SH OPTIONS (Primary Mode)
+Options in this group (\fB\-c \-f \-p \-t \-u \-z\fP)
+specify the primary mode of operation of \fIUnZipSFX\fP. Only one of
+these primary mode options may be specified.
+.PP
+.PD 0
+.B \-c
+.TP
+.PD
+.B \-\-to\-stdout
+.br
+Primary Mode. Extract files to stdout/screen. This option is similar
+to the \fB\-p\fP option except that the name of each file is displayed
+as it is extracted, and the \fB\-a\fP option is allowed, which can
+provide automatic ASCII-EBCDIC conversion, where appropriate.
+.PP
+.PD 0
+.B \-f
+.TP
+.PD
+.B \-\-freshen
+.br
+Primary Mode. Freshen existing files. That is, extract only those
+files that already exist on disk and that are newer than the disk
+copies. By default, \fIUnZipSFX\fP queries before overwriting, but the
+\fB\-o\fP option may be used to suppress the queries. Note that on many
+operating systems, the TZ (timezone) environment variable must be set
+correctly in order for \fB\-f\fP and \fB\-u\fP to work properly. (On
+Unix the variable is usually set automatically.) The reasons for this
+are somewhat subtle but have to do with the differences between
+DOS-format file times (always local time) and Unix-format times (always
+UTC) and the necessity to compare the two. A typical TZ value is
+"PST8PDT" (US Pacific time with automatic adjustment for Daylight Saving
+Time).
+.PP
+.PD 0
+.B \-p
+.TP
+.PD
+.B \-\-pipe\-to\-stdout
+.br
+Primary Mode. Extract files to stdout (pipe). Only the actual file
+data for the members are sent to stdout (no file names, or other
+information, as would be displayed with \fB\-c\fP), and the files are
+always extracted in binary format, just as they are stored (no
+line-ending or ASCII-EBCDIC conversions).
+.PP
+.PD 0
+.B \-t
+.TP
+.PD
+.B \-\-test
+.br
+Primary Mode. Test archive members. Testing means that each archive
+member is extracted in memory (expanding and decrypting, as needed), but
+not written to a file. The resulting CRC (cyclic redundancy check, an
+enhanced checksum) of the extracted data is then compared with the
+original file's stored CRC value, and an error message is emitted if a
+CRC mismatch is detected.
+.PP
+.PD 0
+.B \-u
+.TP
+.PD
+.B \-\-update
+.br
+Primary mode. Update existing files and create new ones if
+needed. This mode performs the same function as the Freshen (\fB\-f\fP)
+mode, extracting (with query) files that are newer than those with the
+same name on disk, but it also extracts those files that do not already
+exist on disk. See \fB\-f\fP, above, for information on setting the
+timezone properly.
+.PP
+.PD 0
+.B \-z
+.TP
+.PD
+.B \-\-zipfile\-comment
+.br
+Primary mode. Display only the archive comment.
+.\" --------------------------------------------------------------------
+.SH OPTIONS (Ordinary)
+.PP
+.PD 0
+.B \-2
+.TP
+.PD
+.B \-\-force\-ods2
+.br
+[VMS] Convert extracted file names to ODS2-compatible names, even on an
+ODS5 file system. By default, if the destination file system is ODS5,
+case is preserved, and extended file name characters are caret-escaped
+as needed, while if the destination file system is ODS2, ODS2-invalid
+characters are replaced by underscores.
+.PP
+.PD 0
+.B \-a
+.TP
+.PD
+.B \-\-ascii
+.br
+Convert text files. Ordinarily, all files are extracted exactly as they
+are stored, byte-for-byte. With \fB\-a\fP, line endings in a text
+file are adjusted to the local standard as the file is extracted. When
+appropriate, ASCII<\-\->EBCDIC conversion is also done.
+.IP
+\fIZip\fP (or a similar archiving program) identifies files as "binary"
+or "text" when they are archived. (A short-format \fIZipInfo\fP report
+denotes a binary file with a "b", and a text file with a "t".)
+\fIZip\fP's identification of text files may not be perfect, so
+\fIUnZipSFX\fP prints "\fC[text]\fR" or "\fC[binary]\fR" as a visual check
+for each file it extracts with \fB\-a\fP. The \fB\-aa\fP option forces
+all files to be extracted (and converted) as text, regardless of the
+supposed file type.
+.IP
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip\ \-V" or "ZIP\ /VMS"), files are always created with their original
+record formats. For archives without VMS attribute information (not
+made with "zip\ \-V" or "ZIP\ /VMS"), all files are normally created
+with Stream_LF record format. With \fB\-a\fP, text files are normally
+created with variable-length record format, but adding \fB\-S\fP gives
+them Stream_LF record format. With \fB\-aa\fP, all files are treated as
+text files. See also \fB\-b\fP and \fB\-S\fP.
+.IP
+Support for line-ending conversion for text files may be removed in some
+future \fIUnZipSFX\fP version, because the creator of a self-ectracting
+archive should easily be able to ensure that text files have the
+appropriate characteristics for the SFX target system (and expecting the
+SFX user to specify the appropriate option is unreliable). ASCII-EBCDIC
+conversion must continue to be supported, because the ZIP archive format
+implies ASCII storage of text files.
+.PP
+.PD 0
+.B \-b
+.TP
+.PD
+.B \-\-binary
+.br
+[Tandem, VMS] Selects the file record format used when extracting binary
+files. -b may conflict or interact with -a in different ways on
+different system types. -b is ignored on systems other than Tandem and
+VMS.
+.IP
+\fIZip\fP (or a similar archiving program) identifies files as "binary"
+or "text" when they are archived. (A short-format \fIZipInfo\fP report
+denotes a binary file with a "b", and a text file with a "t".)
+.\" \fIZip\fP's identification of text files may not be perfect, so
+.\" \fIUnZipSFX\fP prints "\fC[binary]\fR" or "\fC[text]\fR" as a visual check
+.\" for each file it extracts with \fB\-b\fP. The \fB\-bb\fP option forces
+.\" all files to be extracted (and converted) as binary, regardless of the
+.\" supposed file type.
+.IP
+[Tandem] Force the creation files with filecode type 180 ('C') when
+extracting archive members marked as "text". (On Tandem, \fB\-a\fP is
+enabled by default, see above).
+.IP
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip\ \-V" or "ZIP\ /VMS"), files are always created with their original
+record formats. For archives without VMS attribute information (not
+made with "zip\ \-V" or "ZIP\ /VMS"), files are normally created with
+Stream_LF record format. With \fB\-b\fP, binary files are created with
+fixed-length, 512-byte record format. With \fB\-bb\fP, all files are
+treated as binary files. When extracting to standard output (\fB\-c\fP
+or \fB\-p\fP option in effect), the default conversion of text record
+delimiters is disabled for binary files (with \fB\-b\fP), or for all
+files (with \fB\-bb\fP).
+.PP
+.PD 0
+.B \-C
+.TP
+.PD
+.BR \-\-ignore\-case "\ \ \ \ ([CMS, MVS] " \-\-CMS\-MVS\-lower )
+.br
+Use case-insensitive name matching for file names in the file list and
+the \fB\-x\fP excluded-file list on the command line. By default,
+case-sensitive matching is done. For example, specifying
+"\fCmakefile\fR" on the command line will match \fIonly\fP "makefile" in
+the archive, not "Makefile" or "MAKEFILE". On many systems, the local
+file system is case-insensitive, so case-insensitive name matching would
+be more natural. With \fB\-C\fP, "\fCmakefile\fR" would match
+"makefile", "Makefile", or "MAKEFILE".
+.IP
+\fB\-C\fP does not affect the matching of archive members to existing
+files on the extraction path. So, on a case-sensitive file system,
+\fIUnZipSFX\fP will never try to overwrite a file "FOO" when extracting a
+member named "foo"!
+.PP
+.PD 0
+.B \-c
+.TP
+.PD
+.B \-\-to\-stdout
+.br
+Primary Mode. Extract files to stdout/screen. For details, see Primary
+Mode options.
+.PP
+.PD 0
+.B \-D
+.TP
+.PD
+.B \-\-dir\-timestamps
+.br
+Control timestamps on extracted files and directories. By default,
+\fIUnZipSFX\fP restores timestamps for extracted files, but not for
+directories it creates. Specifying \fB\-D\fP tells \fIUnZipSFX\fP not to
+restore any timestamps. Specifying \fB\-D\-\fP tells \fIUnZipSFX\fP to
+restore timestamps for directories as well as other items. \fB\-D\-\fP
+works only on systems that support setting timestamps for directories
+(currently ATheOS, BeOS, MacOS, OS/2, Unix, VMS, Win32). On other
+systems, \fB\-D\-\fP has no effect.
+.IP
+[Non-VMS] Timestamp restoration behavior changed between UnZip versions
+6.00 and 6.10. The following table shows the effects of various
+\fB\-D\fP options for both versions.
+.IP
+.EX
+ UnZip version |
+ 6.00 | 6.10 | Restore timestamps on:
+ -----------+-----------+------------------------
+ -DD | -D | Nothing.
+ -D | (default) | Files, not directories.
+ (default) | -D- | Files and directories.
+.EE
+.IP
+[VMS] The old behavior on VMS was the same as the new behavior on all
+systems. (The old negated \fB\-\-D\fP option is now \fB\-D\-\fP,
+because of changes to the command-line parser.)
+.PP
+.PD 0
+.B \-d dest_dir
+.TP
+.PD
+.B \-\-extract\-dir dest_dir
+.br
+Specifies a destination directory for extracted files. By default,
+files are extracted (and subdirectories created) in the current
+directory. With \fB\-d dest_dir\fP, extraction is done into the
+specified directory, instead.
+.IP
+The option and directory may be concatenated without any white space
+between them, but this may cause normal shell behavior to be
+suppressed. For example, "\fC\-d\ ~\fR" (tilde) is expanded by Unix
+shells into the name of the user's home directory, but "\fC\-d~\fR"
+is treated as a literal "\fB~\fP" subdirectory of the current directory.
+.IP
+[VMS] On VMS, only a VMS-style device:[directory] specification is
+permitted.
+.IP
+This option may be disabled at build time in \fIUnZipSFX\fP.
+.PP
+.PD 0
+.B \-F
+.TP
+.PD
+.B \-\-keep\-nfs
+.br
+[Acorn] Suppress removal of NFS filetype extension from stored
+filenames.
+.IP
+[non-Acorn systems supporting long filenames with embedded commas,
+and only if compiled with ACORN_FTYPE_NFS defined] Translate
+filetype information from ACORN RISC OS extra field blocks into a
+NFS filetype extension and append it to the names of the extracted
+files. (When the stored filename appears already to have an appended
+NFS filetype extension, it is replaced by the info from the extra
+field.)
+.PP
+.PD 0
+.B \-f
+.TP
+.PD
+.B \-\-freshen
+.br
+Primary Mode. Freshen existing files. For details, see Primary Mode
+options.
+.PP
+.PD 0
+.B \-I char_set
+.TP
+.PD
+.B \-\-iso\-char\-set char_set
+.br
+[Unix] Select ISO character set \fIchar_set\fP.
+.PP
+.PD 0
+.B \-J
+.TP
+.PD
+.B \-\-junk\-attrs
+.br
+[BeOS] Junk file attributes. The file's BeOS file attributes are not
+restored, only the file's data.
+.IP
+[MacOS] Ignore MacOS extra fields. All Macintosh-specific info is
+skipped. AppleDouble files are restored as separate files.
+.PP
+.PD 0
+.B \-j[=depth]
+.TP
+.PD
+.B \-\-junk\-dirs[=depth]
+.br
+Junk directories. With \fB\-j\fP, all directory information is stripped
+from an archive member name, so all files are extracted into the
+destination directory. (See also \fB\-d\fP.)
+.IP
+If a depth (\fB=depth\fP, where \fBdepth\fP is a positive integer) is
+specified, then that number of directory levels will be stripped from an
+archive member name. For example, an archive member like
+"a/b/c/d/ee.txt" would normally be extracted as "a/b/c/d/ee.txt". With
+\fB\-j\fP, it would be extracted as "ee.txt". With \fB\-j=2\fP, the
+first two directory levels would be stripped, so it would be extracted
+as "c/d/ee.txt".
+.PP
+.PD 0
+.B \-\-jar
+.br
+Treat archive(s) as Java JAR. Over-simplification in Java JAR archives
+can cause \fIUnZipSFX\fP to transform UTF-8 file names according to
+inappropriate (MS-DOS) rules, yielding corrupt names on extracted files
+(typically those with character codes 128-255). Archives containing a
+Java "CAFE" extra field should be detected automatically, and handled
+correctly, but not all JAR archives include that extra
+field. Specifying \-\-jar tells \fIUnZipSFX\fP to expect UTF-8 file names,
+regardless of whether the archive contains a "CAFE" extra field.
+.PP
+.PD 0
+.B \-k
+.TP
+.PD
+.B \-\-keep\-permissions
+.br
+[AtheOS, BeOS, Unix, VMS] Control how archived permissions or
+protections are restored on extracted files and directories.
+.IP
+By default, archived permissions are restored with some limitations. On
+AtheOS, BeOS, and Unix, the current umask value is applied (to the
+normal user/group/other permissions). On VMS, the current default
+protection is applied to the UIC-based (SOGW) protections.
+.IP
+With \-k, the archived permissions are restored without regard to the
+Unix umask or VMS default protection. (This was the default behavior in
+UnZip versions before 6.10.)
+.IP
+With \-k\-, the archived permissions are ignored, so only the Unix umask
+or VMS default protection is effective. (On VMS, directories are always
+created without any Delete access.)
+.IP
+On AtheOS, BeOS, and Unix, the SUID/SGID/Tacky permission bits are
+controlled by the \-K/\-\-keep\-s\-attrs option, regardless of the
+\-k/\-\-keep\-permissions setting.
+.PP
+.PD 0
+.B \-ka
+.TP
+.PD
+.B \-\-keep\-acl
+.br
+[VMS] Restore ACLs on extracted files and directories.
+.PP
+.PD 0
+.B \-L
+.TP
+.PD
+.B \-\-lowercase\-names
+.br
+Convert to lowercase any filename originating on an uppercase-only
+operating system or file system. (This was \fIUnZipSFX\fP's default
+behavior in versions before 5.11. The current default behavior is the
+same as the old behavior with the \fB\-U\fP option. \fB\-U\fP is now
+used for another purpose.)
+.IP
+Depending on the archiver, files archived from single-case file systems
+(old MS-DOS FAT, VMS ODS2, and so on) may be stored as all-uppercase
+names; this can be ugly or inconvenient when extracting to a
+case-preserving file system such as OS/2 HPFS or a case-sensitive one
+such as on Unix. By default, \fIUnZipSFX\fP lists and extracts such
+filenames exactly as they're stored (excepting truncation, conversion of
+unsupported characters, an so on). With \fB\-L\fP, the names of all
+files from certain systems will be converted to lowercase. With
+\fB\-LL\fP, all file names will be down-cased, regardless of the
+originating file system.
+.PP
+.PD 0
+.BR \-M "\ \ \ \ [CMS,MVS] Or: " \-m )
+.TP
+.PD
+.B \-\-more
+.br
+Pipe all output through an internal pager similar to the Unix
+\fImore\fP(1) command. At the end of a screenful of output, \fIUnZipSFX\fP
+pauses with a "\-\-More\-\-" prompt; the next screenful may be viewed by
+pressing the Enter/Return key or the space bar. \fIUnZipSFX\fP can be
+terminated by pressing the "Q" key and, on some systems, the
+Enter/Return key. Unlike Unix \fImore\fP(1), there is no
+forward-searching or editing capability. Also, \fIUnZipSFX\fP doesn't
+notice if long lines wrap at the edge of the screen, effectively
+resulting in the printing of two or more lines and the likelihood that
+some text will scroll off the top of the screen before being viewed. If
+the actual number of lines on the screen can not be determined, 24 lines
+will be assumed.
+.PP
+.PD 0
+.B \-n
+.TP
+.PD
+.B \-\-never\-overwrite
+.br
+When extracting, never overwrite existing files. If a file already
+exists, then skip the extraction of that file without asking. See also
+\fB\-o\fP (\fB\-\-overwrite\fP).
+.IP
+By default, \fIUnZipSFX\fP queries the user before extracting any file that
+already exists. The user may choose to overwrite only the current file,
+overwrite all files, skip extraction of the current file, skip
+extraction of all existing files, or rename the current file (choose a
+new name for the extracted file).
+.IP
+[VMS] On VMS, the usual query choices are to create a new version of an
+existing file, to skip extraction, or to rename the current file. In
+the case where an archive member name includes a version number, and -V
+("retain VMS file version numbers") is in effect, then an additional
+query choice is offered: to overwrite the existing file.
+.PP
+.PD 0
+.B \-O char_set
+.TP
+.PD
+.B \-\-oem\-char\-set char_set
+.br
+[Unix] Select OEM character set \fIchar_set\fP.
+.PP
+.PD 0
+.B \-o
+.TP
+.PD
+.B \-\-overwrite
+.br
+When extracting, always overwrite existing files without
+prompting. This is a \fIdangerous\fP option, so use it with care. (It
+is often used with \fB\-f\fP, however, and is the only way to overwrite
+directory EAs on OS/2.) See also \fB\-n\fP
+(\fB\-\-never\-overwrite\fP).
+.IP
+By default, \fIUnZipSFX\fP queries the user before extracting any file that
+already exists.
+.IP
+[Non-VMS] On non-VMS systems, the user may choose to overwrite only the
+current file, overwrite all files, skip extraction of the current file,
+skip extraction of all existing files, or rename the current file
+(choose a new name for the extracted file).
+.IP
+[VMS] On VMS, the usual query choices are to create a new version of an
+existing file, to skip extraction, or to rename the current file. In
+the case where an archive member name includes a version number, and -V
+("retain VMS file version numbers") is in effect, then an additional
+query choice is offered: to overwrite the existing file. In this case,
+\fB\-o\fP selects the "new version" choice, and \fB\-oo\fP (or:
+\fB\-o\ \-o\fP) selects the "overwrite" choice.
+.PP
+.PD 0
+.B \-P password
+.TP
+.PD
+.B \-\-password password
+.br
+[CRYPT_AES_WG, CRYPT_TRAD] \fB\-P\fP ("\fB\-\-password\fP") is valid
+only if encryption support was enabled at build-time for the
+\fIUnZipSFX\fP program.
+.IP
+Use \fIpassword\fP to decrypt encrypted archive members (if
+any). \fITHIS IS INSECURE!\fP Many multi-user operating systems
+provide ways for any user to see the current command line of any other
+user. Even on stand-alone systems, there is always the threat of
+over-the-shoulder peeking. Storing the plaintext password as part of a
+command line in an automated script can be even less secure, Whenever
+possible, use the non-echoing, interactive prompt to enter
+passwords. Where security is truly important, use a strong encryption
+method, such as AES, instead of the relatively weak encryption provided
+by Traditional ZIP encryption. Or, use an external encryption program,
+such as GnuPG, before archiving the file. (Note that \fIZip\fP will
+probably not be able to do significant compression on a file which has
+already been encrypted.)
+.PP
+.PD 0
+.B \-p
+.TP
+.PD
+.B \-\-pipe\-to\-stdout
+.br
+Primary Mode. Extract files to stdout (pipe). For details, see Primary
+Mode options.
+.PP
+.PD 0
+.B \-q
+.TP
+.PD
+.B \-\-quiet
+.br
+Perform operations quietly. (\fB\-qq\fP: even more quietly). By
+default, \fIUnZipSFX\fP prints the names of the files it's extracting or
+testing, the extraction methods, any member or archive comments that may
+be stored in the archive, and possibly a summary when finished with each
+archive. The \fB\-q\fP[\fBq\fP] options suppress the printing of some
+or all of these messages.
+.PP
+.PD 0
+.B \-r
+.TP
+.PD
+.B \-\-remove\-exts
+.br
+[Tandem] Remove file extensions.
+.PP
+.PD 0
+.B \-S
+.TP
+.PD
+.B \-\-stream_lf
+.br
+[VMS] Use Stream_LF record format when converting extracted text files
+(\fB\-a\fP, \fB\-aa\fP), instead of the text-file default,
+variable-length record format.
+.IP
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip\ \-V"), files are always created with their original record
+formats. For archives without VMS attribute information (not made with
+"zip\ \-V"), all files are normally created with Stream_LF record
+format. With \fB\-a\fP, text files are normally created with
+variable-length record format, but adding \fB\-S\fP gives them Stream_LF
+record format. With \fB\-aa\fP, all files are treated as text
+files. See also \fB\-a\fP and \fB\-b\fP.
+.PP
+.PD 0
+.B \-s
+.TP
+.PD
+.B \-\-space_to_uscore
+.br
+Convert spaces in filenames to underscores. Normally, on a system which
+allows spaces in filenames, \fIUnZipSFX\fP extracts filenames with spaces
+intact (for example, "\fCEA\ DATA.\ SF\fR"). Working with such file
+names can be awkward, however, so \fB\-s\fP can be used to replace
+spaces with underscores.
+.PP
+.PD 0
+.B \-t
+.TP
+.PD
+.B \-\-test
+.br
+Primary Mode. Test archive members. For details, see Primary Mode
+options.
+.PP
+.PD 0
+.B \-U
+.TP
+.PD
+.B \-\-unicode
+.br
+[UNICODE_SUPPORT] Control UTF-8 handling. When UNICODE_SUPPORT is
+available, \fB\-U\fP forces \fIUnZipSFX\fP to escape all non-ASCII
+characters from UTF-8 coded filenames as "#Uxxxx' (for UCS-2 characters,
+or "#Lxxxxxx" for Unicode codepoints needing 3 octets). This option is
+provided mainly for debugging, when the fairly new UTF-8 support is
+suspected of mangling extracted filenames.
+.IP
+\fB\-UU\fP disables the recognition of UTF-8 encoded filenames. The
+handling of filename codings within \fIUnZipSFX\fP falls back to the
+behavior of pre-Unicode versions.
+.IP
+[old, obsolete usage] Leave filenames uppercase if created on MS-DOS,
+VMS, and so on. See \fB\-L\fP.
+.PP
+.PD 0
+.B \-u
+.TP
+.PD
+.B \-\-update
+.br
+Primary mode. Update existing files and create new ones if needed. For
+details, see Primary Mode options.
+.PP
+.PD 0
+.B \-V
+.TP
+.PD
+.B \-\-keep\-versions
+.br
+[Non-CMS-MVS] Retain VMS file version numbers. VMS files can be stored
+with a version number, in the format \fCfile.type;##\fR, where "##" is a
+positive decimal number. By default, the "\fC;##\fR" version numbers
+are stripped, but this option allows them to be retained. (On file
+systems that limit filenames to particularly short lengths, the version
+numbers may be truncated or stripped regardless of this option.)
+.IP
+[Non-VMS] Note that before UnZip version 6.10, on a non-VMS system, a
+file with a name like "\fCfred;123\fR" would, by default, be extracted
+as "\fCfred\fR", even if the file did not originate on a VMS system (so
+that "\fC;123\fR" was probably not really a VMS version number).
+Beginning with UnZip version 6.10, the default behavior is to strip VMS
+version numbers only from files which were archived on a VMS system. To
+restore the old behavior, and always strip apparent VMS version numbers,
+explicitly negate the option: \fB\-V\-\fP.
+.IP
+[VMS] Note that on VMS, \fB\-V\fP affects \fIonly\fP version numbers,
+and is \fInot\fP needed to restore VMS file attributes. \fBZip\fP's
+\fB\-V\fP (\fB/VMS\fP) option is required to \fIstore\fP VMS attributes
+in an archive. If that was done when an archive was created, then
+\fBUnZipSFX\fP will always \fIrestore\fP those attributes when a file is
+extracted.
+.PP
+.PD 0
+.B \-W
+.TP
+.PD
+.B \-\-wild\-no\-span
+.br
+[WILD_STOP_AT_DIR] (Valid when the program was built with the C macro
+WILD_STOP_AT_DIR defined.) By default, the wildcard characters "?"
+(single-character wildcard) and "*" (multi-character wildcard) match any
+character in a member path/name. "\fC\-W\fR" modifies the
+pattern-matching behavior for archive members so that both "?"
+(single-character wildcard) and "*" (multi-character wildcard) do not
+match the directory separator character "/". (The two-character
+sequence "**" acts as a multi-character wildcard that includes the
+directory separator in its matched characters.) For example, with
+"\fC\-W\fR":
+.PP
+.EX
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "**.c" matches both "foo.c" and "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+.EE
+.IP
+This modified behavior is equivalent to the pattern matching style used
+by the shells of some of \fIUnZipSFX\fP's supported target OSs (one example
+is Acorn RISC OS). This option may not be available on systems where
+the Zip archive's internal directory separator character "/" is allowed
+as regular character in native operating system filenames.
+.IP
+[non-VMS] Currently, \fIUnZipSFX\fP uses the same pattern matching rules
+for both wildcard archive file name specifications and archive member
+selection patterns on most system types. For systems allowing "/" as
+regular filename character, the \fB\-W\fP option would not work as
+expected on a wildcard file name specification.
+.PP
+.PD 0
+.B \-X
+.TP
+.PD
+.B \-\-restore\-info
+.br
+[VMS, Unix, OS/2, NT, Tandem] Restore owner info (UIC on VMS, or user
+and group info (UID/GID) on Unix, or access control lists (ACLs) on
+certain network-enabled versions of OS/2 (Warp Server with IBM LAN
+Server/Requester 3.0 to 5.0; Warp Connect with IBM Peer 1.0), or
+security ACLs on Windows NT.) In most cases this will require special
+system privileges, and doubling the option (\fB\-XX\fP) on NT instructs
+\fIUnZipSFX\fP to use privileges for extraction; but on Unix, for example,
+a user who belongs to several groups can restore files owned by any of
+those groups, so long as the user IDs match the user's own. Note that
+ordinary file attributes are always restored. This option applies only
+to optional, extra ownership info available on some operating systems.
+(NT's access control lists do not appear to be especially compatible
+with OS/2's, so no attempt is made at cross-platform portability of
+access privileges. It is not clear under which conditions this would
+ever be useful anyway.)
+.PP
+.PD 0
+.BR "\-x member" " ..."
+.TP
+.PD
+.BR "\-\-exclude member" " ..."
+.br
+An optional list of archive members to be excluded from
+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.
+Without the \fB\-x\fP option, all C source files in all directories in
+the archive would be extracted.
+.IP
+When the program sees \fB\-x\fP (\fB\-\-exclude\fP) on a command line,
+it stops scanning for options, and treats every succeeding item as an
+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).
+That is, for example, the following two commands are equivalent:
+.EX
+ example_sfx -b -x file1 file2 file3
+ example_sfx -x file1 file2 file3 @ -b
+.EE
+.PP
+.PD 0
+.B \-Y
+.TP
+.PD
+.B \-\-dot\-version
+.br
+[VMS] Treat archive member name endings of ".nnn" (where "nnn" is a
+decimal number) as if they were VMS version numbers (";nnn"). (The
+default is to treat them as file types.) For example:
+.EX
+ "a.b.3" -> "a.b;3"
+.EE
+.PP
+.PD 0
+.B \-z
+.TP
+.PD
+.B \-\-zipfile\-comment
+.br
+Primary mode. Display only the archive comment. For details, see
+Primary Mode options.
+.PP
+.PD 0
+.B \-$
+.TP
+.PD
+.B \-\-volume\-labels
+.br
+.\" [Amiga support possible eventually, but not yet.]
+[MS-DOS, NT, OS/2, VMS] Restore the volume label if the extraction
+medium is removable (for example, a diskette). Doubling the option
+(\fB\-$$\fP) allows fixed media (hard disks) to be labeled as well. By
+default, volume labels are ignored.
+.br
+[VMS] On VMS, a volume must be allocated, not shared, for a volume label
+to be set.
+.PP
+.PD 0
+.B \-/
+.TP
+.PD
+.B \-\-extensions
+.br
+[Acorn] Overrides the extension list supplied by the \fBUnzip$Ext\fP
+environment variable. During extraction, filename extensions that match
+one of the items in this extension list are swapped in front of the base
+name of the extracted file.
+.PP
+.PD 0
+.B \-:
+.TP
+.PD
+.B \-\-do\-double\-dots
+.br
+[all but Acorn, VM/CMS, MVS, Tandem] Allows \fIUnZipSFX\fP to extract
+archive members into locations outside of the current extraction
+destination directory (and its subdirectories).
+.IP
+For security reasons, \fIUnZipSFX\fP normally removes "parent directory"
+path components ("../") from the path names of archive members as they
+are extracted. This safety feature (new for version 5.50) prevents
+\fIUnZipSFX\fP from accidentally writing files to directories outside
+the current destination directory tree. The \fB\-:\fP option sets
+\fIUnZipSFX\fP back to its previous, more liberal behavior, allowing exact
+extraction of archives that use "../" path components to create multiple
+directory trees at \fIor above\fP the level of the destination
+directory.
+.IP
+This option does not enable writing explicitly to the root
+directory ("/"). To achieve this, it is necessary to set the extraction
+target folder to "/" (by using an option like "\fB\-d\ /\fP"). However,
+when the \fB\-:\fP option is specified, it is still possible implicitly
+to write to the root directory if member paths specifying enough "../"
+path components.
+.IP
+\fIUse this option with extreme caution.\fP
+.PP
+.PD 0
+.B \-^
+.TP
+.PD
+.B \-\-control\-in\-name
+.br
+[Unix] Allow control characters in file names of extracted ZIP archive
+members. On Unix, a file name may contain any (8-bit) character code
+with the two exceptions of "/" (the directory delimiter) and NUL (0x00,
+the C string-termination character), unless the specific file system has
+more restrictive conventions. Generally, this allows embedding ASCII
+control characters or escape sequences in file names. However, this
+feature allows the use of malicious file names which can cause various
+kinds of bad trouble when displayed on a user's
+terminal/emulator. (Even a file name with unprintable but otherwise
+harmless characters can cause problems for users.)
+.IP
+For these reasons, by default, \fIUnZipSFX\fP applies a filter that removes
+potentially dangerous control characters from the extracted file
+names. The \fB\-^\fP option overrides this filter in the rare case that
+embedded filename dangerous control characters are to be intentionally
+restored.
+.PP
+.\" =========================================================================
+.SH "ENVIRONMENT OPTIONS"
+\fIUnZipSFX\fP uses the same environment variables as \fIUnZip\fP does,
+although this is more likely to affect the person creating and testing a
+self-extracting archive than it is the SFX user. For details, see the
+\fIunzip\fP manual page.
+.PD
+.\" =========================================================================
+.SH ENCRYPTION/DECRYPTION
+\fIUnZipSFX\fP supports the same encryption methods as \fIUnZip\fP, but
+encryption support in \fIUnZipSFX\fP must be explicitly enabled at build
+time. For details, see the \fIUnZip\fP installation instructions
+(INSTALL).
+.PD
+.\" =========================================================================
+.SH AUTORUN COMMAND
+When \fIUnZipSFX\fP is built with CHEAP_SFX_AUTORUN defined, a simple
+"command autorun" feature is enabled. The command to be run is placed
+at the beginning of the Zip archive comment, using the following format:
+.PP
+.EX
+$AUTORUN$>command-to-be-run
+.EE
+.PP
+When \fIUnZipSFX\fP recognizes the token "$AUTORUN$>" at the beginning
+of the ZIP archive comment, the remainder of the first line of the
+comment (until the first newline character) is passed as a shell command
+to the operating system using the C RTL system() function. Before
+executing the command, \fIUnZipSFX\fP displays the command on the
+console and prompts the user for confirmation. For safety, when the
+user has switched off prompting by specifying the \fB\-q\fP option,
+an autorun command is not executed.
+.PP
+If the archive comment contains additional lines of text, then those
+additional comment lines are displayed normally, unless quiet operation
+was requested using a \fB\-q\fP option.
+.PD
+.\" =========================================================================
+.SH EXAMPLES
+On Unix, the following commands create a self-extracting archive
+(\fIexample_sfx\fP) from an ordinary archive (\fIexample.zip\fP), adjust
+the offsets in the resulting SFX archive, and change the permissions on
+the new SFX archive's to allow execution by everyone:
+.PP
+.EX
+cat /usr/local/bin/unzipsfx example.zip > example_sfx
+zip \-A example_sfx
+chmod 755 example_sfx
+.EE
+.PP
+We assume that the desired \fIUnZipSFX\fP executable is found at
+"/usr/local/bin/unzipsfx", but any path to the desired \fIUnZipSFX\fP
+executable is ok.
+.PP
+On MS-DOS, OS/2, or Windows, the following commands create a similar SFX
+archive. (Note the use of the \fB/b\fP (binary) option in the COPY
+command.):
+.PP
+.EX
+copy /b unzipsfx.exe+example.zip example_sfx.exe
+zip \-A example_sfx.exe
+.EE
+.PP
+If the desired \fIUnZipSFX\fP executable is not in the current
+directory, then an appropriate path should be specified for it.
+.PP
+On VMS the basic commands look like these:
+.PP
+.EX
+copy unzipsfx.exe, example.zip example_sfx.exe
+zip \-A example_sfx.exe
+.EE
+.PP
+If the desired \fIUnZipSFX\fP executable is not in the current
+default directory, then an appropriate path should be specified for
+it. (The VMS APPEND command could be used instead of COPY.)
+.PP
+A slightly more elaborate DCL script to do this job is included in the
+\fIUnZip\fP source kit: [.vms]makesfx.com. It uses a DCL symbol to find
+the \fIUnZipSFX\fP executable. Comments in the script explain its
+usage.
+.PP
+.EX
+@ makesfx.com example.zip example_sfx.exe
+.EE
+.PP
+As usual on VMS, if a program like an \fIUnZipSFX\fP bundle is to be
+executed without options or arguments, then the RUN command may be
+used. For example:
+.EX
+run example_sfx.exe
+.EE
+.PP
+More work is needed when options or arguments are desired. For example:
+.EX
+mcr sys$disk:[]example_sfx.exe -t -x fred.txt
+.EE
+Or, define a foreign-command DCL symbol, and use that:
+.EX
+example_sfx = "$ ''f$environment( "default")'example_sfx.exe"
+example_sfx \-t \-x fred.txt
+.EE
+.PP
+On AmigaDOS:
+.PP
+.EX
+MakeSFX example example.zip UnZipSFX
+.EE
+.PP
+(MakeSFX is included with the UnZip source distribution and with Amiga
+binary distributions. "\fCzip -A\fR" doesn't work on Amiga
+self-extracting archives.)
+.PP
+To test (or list) the newly created self-extracting archive, use
+\fB\-t\fP:
+.PP
+.EX
+example_sfx \-t
+.EE
+.PP
+To test "example_sfx" quietly, printing only a summary message
+indicating whether the archive is OK or not, use \fB\-tqq\fP:
+.PP
+.EX
+example_sfx \-tqq
+.EE
+.PP
+To extract the complete contents into the current directory, recreating
+all files and subdirectories as necessary:
+.PP
+.EX
+example_sfx
+.EE
+.PP
+To extract all \fC*.txt\fR files:
+.PP
+.EX
+example_sfx *.txt
+.EE
+.PP
+On Unix, quote the "*":
+.PP
+.EX
+example_sfx '*.txt'
+.EE
+.PP
+To extract everything \fIexcept\fP the \fC*.txt\fR files:
+.PP
+.EX
+example_sfx \-x *.txt
+.EE
+or:
+.EX
+example_sfx \-x '*.txt'
+.EE
+.PP
+To extract only the README file to standard output (the screen):
+.PP
+.EX
+example_sfx \-c README
+.EE
+.PP
+To print only the archive comment:
+.PP
+.EX
+example_sfx \-z
+.EE
+.PD
+.\" =========================================================================
+.SH LIMITATIONS
+The principal and fundamental limitation of \fIUnZipSFX\fP is that it is
+not generally portable from one operating system or hardware
+architecture to another. Therefore, neither are the resulting SFX
+archives, \fIas self-extracting archives\fP. The ZIP archive within a
+self-extracting archive bundle \fIcan\fP always be processed anywhere
+using a normal \fIUnZip\fP program, even where the \fIUnZipSFX\fP
+program in the bundle can't do the job. At worst, \fIUnZip\fP will emit
+a warning like "nnnn extra bytes at beginning or within zipfile", but
+using "zip\ \-A" on an SFX bundle will prevent even that
+annoyance. (\fIUnZipSFX\fP itself does not emit the "extra bytes"
+warning, even if the "zip\ \-A" adjustment is not done.)
+.PP
+Strictly speaking, until "zip\ \-A" is used to adjust the offsets
+within the \fIUnZipSFX\fP+archive bundle, that bundle is not a valid ZIP
+archive, because the offsets in it are wrong. \fIInfo-ZIP UnZip\fP can
+still work with it (emitting that "extra bytes" warning mentioned
+above), but some other unzipping program might have more trouble with
+it. After the "zip\ \-A" offset adjustment has been done, any unzipping
+program should be able to work with the resulting SFX bundle.
+.PP
+To do its work, the \fIUnZipSFx\fP program in a self-extracting archive
+must open and read the self-extracting archive file itself. (It's not
+enough that the shell can find it. It must be able to find itself.)
+\fIUnZipSFX\fP has no knowledge of the user's PATH, so, in general, a
+self-extracting archive must either be in the current directory when it
+is invoked (and "." must be on the user's PATH), or else some explicit
+(absolute or relative) path must be specified. For example:
+.PP
+.EX
+# example_sfx -t # Fails if "." is not on PATH.
+bash: example_sfx: command not found
+# \&./example_sfx -t # Works.
+.EE
+or:
+.EX
+mkdir sandbox
+cd sandbox
+\&.\&./example_sfx
+.EE
+.PP
+If a user runs a self-extracting archive which is found in a directory
+on the PATH other than the current one ("."), then \fIUnZipSFX\fP may
+fail with a fatal error: "cannot find myself!". This is always true on
+Unix, and may be true in some cases under MS-DOS, depending on the
+compiler used. (Microsoft C may fully qualify the program name, but
+other compilers may not.) Under OS/2 and NT there are operating-system
+functions available that provide the full path name, so the archive may
+be invoked from anywhere in the user's path. On VMS, this problem never
+arises, because the program always sees an absolute path to itself, even
+when DCL$PATH is used. (The situation is unknown for more obscure
+operating systems: AmigaDOS, Atari TOS, and so on. Reports are
+welcome.)
+.PP
+As explained above, some normal \fIUnZip\fP features are omitted from
+\fIUnZipSFX\fP to make it smaller. The diagnostic (\fB\-v\fP) and
+listing (\fB\-l\fP) features are always omitted. Optional compression
+methods (bzip2, LZMA, PPMd) and any encryption methods (Traditional,
+AES_WG) are omitted by default, but may be enabled when \fIUnZipSFX\fP
+is built. For details, see the installation instructions (INSTALL).
+.PP
+\fIUnZipSFX\fP on the Amiga requires the use of a special program,
+\fIMakeSFX\fP, to create working self-extracting archives; simple
+concatenation does not work. (For technically oriented users, the
+attached archive is defined as a "debug hunk".) There may be
+compatibility problems between the ROM levels of older Amigas and newer
+ones.
+.PD
+.\" =========================================================================
+.SH "EXIT STATUS"
+The possible exit status values from \fIUnZipSFX\fP are the same as
+those for \fIUnZipSFX\fP. See the \fIunzip\fP manual page for details.
+.PD
+.\" =========================================================================
+.SH "SEE ALSO"
+\fIfunzip\fP(1L), \fIunzip\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L),
+.br
+\fIzipgrep\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
+.PD
+.\" =========================================================================
+.SH URL
+.TP
+The Info-ZIP main Web page is:
+.EX
+\fChttp://www.info-zip.org/\fR
+.EE
+.TP
+FTP access is available, too:
+.EX
+\fCftp://ftp.info-zip.org/pub/infozip/\fR
+.EE
+.PD
+.\" =========================================================================
+.SH AUTHORS
+Greg Roelofs was responsible for the basic modifications to \fIUnZip\fP
+necessary to create UnZipSFX. See \fIunzip\fP(1L) for the current list
+of Info-ZIP authors.
+.PD
-.\" Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+.\" Copyright (c) 1990-2013 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.
.\" zipgrep.1 by Greg Roelofs.
.\"
.\" =========================================================================
-.TH ZIPGREP 1L "20 April 2009" "Info-ZIP"
+.TH ZIPGREP 1L "25 January 2013" "Info-ZIP"
.SH NAME
zipgrep \- search files in a ZIP archive for lines matching a pattern
.PD
.\" =========================================================================
.SH DESCRIPTION
\fIzipgrep\fP will search files within a ZIP archive for lines matching
-the given string or pattern. \fIzipgrep\fP is a shell script and requires
-\fIegrep\fP(1) and \fIunzip\fP(1L) to function. Its output is identical to
-that of \fIegrep\fP(1).
+the given string or pattern. \fIzipgrep\fP is a shell script and
+requires \fIegrep\fP(1) and \fIunzip\fP(1L) (and \fIbasename\fP(1),
+\fIgrep\fP(1), \fIod\fP(1), and \fIsed\fP(1)) to function. Its output
+is generally similar to that of \fIegrep\fP(1).
.PD
.\" =========================================================================
.SH ARGUMENTS
The pattern to be located within a ZIP archive. Any string or regular
expression accepted by \fIegrep\fP(1) may be used.
.IR file [ .zip ]
-Path of the ZIP archive. (Wildcard expressions for the ZIP archive name are
-not supported.) If the literal filename is not found, the suffix \fC.zip\fR
-is appended. Note that self-extracting ZIP files are supported, as with any
-other ZIP archive; just specify the \fC.exe\fR suffix (if any) explicitly.
+Path of the ZIP archive. (Wildcard expressions for the ZIP archive name
+are not supported.) If the specified filename is not found, then UnZip
+(not the zipgrep script itself) appends the suffix \fC.zip\fR to the
+name, and tries again. Note that self-extracting ZIP files are
+supported, as with any other ZIP archive; just specify the \fC.exe\fR
+(or any other) suffix explicitly.
.IP [\fIfile(s)\fP]
-An optional list of archive members to be processed, separated by spaces.
-If no member files are specified, all members of the ZIP archive are searched.
-Regular expressions (wildcards) may be used to match multiple members:
+An optional list of archive members to be processed, separated by
+spaces. If no member files are specified, then all members of the ZIP
+archive are searched. Regular expressions (wildcards) may be used to
+match multiple members:
.RS
.IP *
matches a sequence of 0 or more characters
.IP ?
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. 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 brackets is considered a match).
+matches any single character found inside the brackets; ranges are
+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
+brackets is considered a match).
.RE
.IP
-(Be sure to quote any character that might otherwise be interpreted or
-modified by the operating system.)
+Be sure to quote any character(s) that might otherwise be interpreted or
+modified by the operating system or shell.
.IP [\fB\-x\fP\ \fIxfile(s)\fP]
An optional list of archive members to be excluded from processing.
-Since wildcard characters match directory separators (`/'), this option
+Because wildcard characters match directory separators ("/"), this option
may be used to exclude any files that are in subdirectories. For
-example, ``\fCzipgrep grumpy foo *.[ch] -x */*\fR'' would search for the
-string ``grumpy'' in all C source files in the main directory of the ``foo''
-archive, but none in any subdirectories. Without the \fB\-x\fP
-option, all C source files in all directories within the zipfile would be
-searched.
+example, "\fCzipgrep grumpy foo *.[ch] -x */*\fR" would search for the
+string "grumpy" in all C source files in the main directory of the
+"foo[.zip]" archive, but none in any subdirectories. Without the
+\fB\-x\fP option, all C source files (in all directories) within the
+archive would be searched.
.\" =========================================================================
.SH OPTIONS
All options prior to the ZIP archive filename are passed to \fIegrep\fP(1).
.PD
.\" =========================================================================
.SH URL
-The Info-ZIP home page is currently at
+.TP
+The Info-ZIP main Web page is:
.EX
-\fChttp://www.info-zip.org/pub/infozip/\fR
+\fChttp://www.info-zip.org/\fR
.EE
-or
+.TP
+FTP access is available, too:
.EX
-\fCftp://ftp.info-zip.org/pub/infozip/\fR .
+\fCftp://ftp.info-zip.org/pub/infozip/\fR
.EE
.PD
.\" =========================================================================
.SH AUTHORS
-\fIzipgrep\fP was written by Jean-loup Gailly.
+\fIzipgrep\fP was written by Jean-loup Gailly and others in the Info-ZIP
+group.
.PD
--- /dev/null
+.\" Copyright (c) 1990-2013 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.
+.\" If, for some reason, all these files are missing, the Info-ZIP license
+.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+.\"
+.\" zipinfo.1 by Greg Roelofs and others.
+.\"
+.\" =========================================================================
+.TH ZIPINFO 1L "06 Nov 2013 (v3.1)" "Info-ZIP"
+.\" =========================================================================
+.\" Define .EX/.EE (for multiline user-command examples; normal Courier font).
+.\" Must follow ".TH"; otherwise macros get redefined.
+.de EX
+.in +4n
+.nf
+.ft CW
+..
+.de EE
+.ft
+.fi
+.in -4n
+..
+.\" define .WX/.WE (wide multiline user-command examples; normal Courier font)
+.de WX
+.in -4n
+.nf
+.ft CW
+..
+.de WE
+.ft
+.fi
+.in +4n
+..
+.\" =========================================================================
+.SH NAME
+zipinfo \- show detailed information about a ZIP archive
+.PD
+.SH SYNOPSIS
+\fBzipinfo\fP [\fB\-12smlvhMtTz\fP] \fIfile\fP[\fI.zip\fP]
+[\fImember\fP\ .\|.\|.] [\fB\-x\fP\ \fImember\fP\ .\|.\|.]
+.PP
+\fBunzip\fP \fB\-Z\fP [\fB\-12smlvhMtTz\fP] \fIfile\fP[\fI.zip\fP]
+[\fImember\fP\ .\|.\|.] [\fB\-x\fP\ \fImember\fP\ .\|.\|.]
+.PD
+.\" =========================================================================
+.SH DESCRIPTION
+\fIZipInfo\fP reports detailed information about a ZIP archive and its
+members. This information may include file access permissions,
+compression method, encryption method, version and operating system (or
+file system) of the archive-creating program, and so on. The default
+behavior (with no options) is to show a single-line entry for each
+member in the archive, with a header and a trailer providing summary
+information for the entire archive. The format is a cross between Unix
+"\fCls \-l\fR" and "\fCunzip \-lv\fR" output. See
+.B "DETAILED DESCRIPTION"
+below. \fIZipInfo\fP is the same program as \fIUnZip\fP. (On Unix,
+"\fCzipinfo\fR" may be a link to "\fCunzip\fR".) However, \fIZipInfo\fP
+support may have been disabled when \fIUnZip\fP was built.
+.PD
+.\" =========================================================================
+.SH ARGUMENTS
+.TP
+.I file[.zip]
+File path/name of a ZIP archive. A wildcard name may be specified (only
+in the filename part of the file specification, not in the directory
+part). If a wildcard is used, then each matching archive file is
+processed in an order determined by the operating system (or file
+system). Wildcard expressions are similar to those supported (for
+"globbing") in commonly used Unix shells (\fIcsh\fP, \fIksh\fP,
+\fIsh\fP, and so on) and may contain:
+.RS
+.IP *
+Matches a sequence of 0 or more characters.
+.IP ?
+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. If an exclamation point ("!") or a caret ("^") follows the
+left bracket, then the range of characters within the brackets is
+complemented. That is, anything \fIexcept\fP the characters inside the
+brackets is considered a match. To specify a literal left bracket, use
+the three-character sequence "[[]".
+.RE
+.IP
+Be sure to escape or quote any character(s) that might otherwise be
+interpreted or modified by the operating system, particularly Unix
+shells. If no wildcard matches are found, then the specification is
+assumed to be a literal filename. If that also fails, then the
+suffix "\fC\.zip\fR" and/or "\fC\.ZIP\fR" is appended, and that is
+tried. (For this reason, if a non-existent file is specified, then the
+resulting error message may mention these other names with
+their "\fC\.zip\fR" or "\fC\.ZIP\fR" suffixes.)
+.IP
+Note that a "\fC\.zip\fR" or "\fC\.ZIP\fR" name ending on an archive is
+merely a convention, not a requirement. For example, a self-extracting
+ZIP archive named "\fCfred\fR" or "\fCfred.exe\fR" could be processed as
+if it were an ordinary archive; just specify the actual file name with
+its actual name ending (if any), whatever that may be.
+.TP
+.IR member " ..."
+An optional list of archive members to be processed, separated by
+spaces. If no member list is specified, then all archive members are
+processed. Wildcard patterns (like those used for an archive file name
+on Unix, described above) may be used to match multiple members. Again,
+be sure to quote expressions that would otherwise be expanded or
+modified by the operating system or shell.
+.IP
+On Mac OS X systems, file attributes, a resource fork, and similar data
+may be stored in a separate AppleDouble archive member which has a "._"
+name prefix. In some cases, UnZip automatically handles these
+AppleDouble archive members when a normal member pattern is specified,
+but with ZipInfo, the user must specify patterns which explicitly
+include any desired AppleDouble archive members.
+.IP
+On VMS systems, the wildcard rules used for archive members are the same
+as on Unix systems. VMS wildcard rules are used only for archive file
+specifications, not for archive member patterns.
+.\" =========================================================================
+.SH OPTIONS (Primary Format)
+.PP
+.PD 0
+.B \-1
+.TP
+.PD
+.B \-\-names\-only
+.br
+Primary Format. Show member names only, one per line. This option
+excludes all others, and the report does not include headers, trailers,
+or archive comments. This format may be useful with Unix shell (or
+other) scripts.
+.PP
+.PD 0
+.B \-2
+.TP
+.PD
+.B \-\-names\-mostly
+.br
+Primary Format. Show member names only, one per line (as with "-1"),
+but allow headers (\fB\-h\fP), trailers (\fB\-t\fP), and archive
+comments (\fB\-z\fP), if requested explicitly.
+.PP
+.PD 0
+.B \-s
+.TP
+.PD
+.B \-\-short\-list
+.br
+Primary Format. Show member info in short Unix "\fCls\ \-l\fR"
+format. This is the default behavior, unless \fB\-h\fP or \fB\-t\fP is
+specified.
+.PP
+.PD 0
+.B \-m
+.TP
+.PD
+.B \-\-medium\-list
+.br
+Primary Format. Show member info in medium-length Unix "\fCls\ \-l\fR"
+format. Like the \fB\-s\fP format, except that the compression factor,
+expressed as a percentage, is also included.
+.PP
+.PD 0
+.B \-l
+.TP
+.PD
+.B \-\-long\-list
+Primary Format. Show member info in long Unix "\fCls\ \-l\fR"
+format. Like the \fB\-m\fP format, except that the compressed size (in
+bytes) is printed instead of the compression ratio.
+.PP
+.PD 0
+.B \-v
+.TP
+.PD
+.B \-\-verbose
+.br
+Primary Format. Show very detailed member info in a multi-line format.
+.IP
+The verbose report is mostly self-explanatory, but it does assume some
+familiarity with the ZIP archive format. It also includes the archive
+comment, if any. Extra fields in the central directory are broken dowm
+into subfields, with brief descriptions of recognized subfields (or
+abbreviated dumps of unrecognized subfields).
+.\" --------------------------------------------------------------------
+.SH OPTIONS (Ordinary)
+.PP
+.PD 0
+.B \-C
+.TP
+.PD
+.BR \-\-ignore\-case "\ \ \ \ ([CMS, MVS] " \-\-CMS\-MVS\-lower )
+.br
+Use case-insensitive name matching for names in the member list and
+the \fB\-x\fP excluded-member list on the command line. By default,
+case-sensitive matching is done. For example, specifying
+"\fCmakefile\fR" on the command line will match \fIonly\fP "makefile" in
+the archive, not "Makefile" or "MAKEFILE". On many systems, the local
+file system is case-insensitive, so case-insensitive name matching would
+be more natural. With \fB\-C\fP, "\fCmakefile\fR" would match
+"makefile", "Makefile", or "MAKEFILE".
+.PP
+.PD 0
+.B \-h
+.TP
+.PD
+.B \-\-header
+.br
+Include a header in the report, showing the archive name, the archive
+size (in bytes), and the number of members in the archive.
+.IP
+For the Unix-format reports (options \fB\-l\fP, \fB\-m\fP, \fB\-s\fP),
+the header is included by default, if no archive members are
+specified. If \fB\-h\fP is specified alone, that is, without one of the
+Unix-format options, and without a member list, then only the header
+lines will be put out.
+.PP
+.PD 0
+.BR \-M "\ \ \ \ ([CMS,MVS] Or: " \-m )
+.TP
+.PD
+.B \-\-more
+.br
+Pipe all output through an internal pager similar to the Unix
+\fImore\fP(1) command. At the end of a screenful of output,
+\fIZipinfo\fP pauses with a "\-\-More\-\-" prompt; the next screenful
+may be viewed by pressing the Enter (Return) key or the space
+bar. \fIZipInfo\fP can be terminated by pressing the "q" key, or, on
+some systems, the Enter/Return key. Unlike Unix \fImore\fP(1), there is
+no forward-searching or editing capability. Also, \fIZipInfo\fP doesn't
+notice if long lines wrap at the edge of the screen, effectively
+resulting in the printing of two or more lines and the likelihood that
+some text will scroll off the top of the screen before being viewed. If
+the actual number of lines on the screen can not be determined, 24 lines
+will be assumed.
+.PP
+.PD 0
+.B \-mc
+.TP
+.PD
+.B \-\-member-counts
+.br
+Control inclusion of separate member counts for directories, files, and
+(if symlinks are supported) links, after the totals summary at the end
+of the report. By default, they are included. Use \fB\-mc\-\fP or
+\-\-member\-counts\- to suppress them. See also /TOTALS.
+.PP
+.PD 0
+.B \-T
+.TP
+.PD
+.B \-\-decimal\-time
+.br
+Show the file date-times in a sortable, all-numeric, "YYYYMMDD.hhmmss"
+format. The default date format is an alpha-numeric
+"YY-Mmm-DD hh:mm". For example ("-s", "-s -T"):
+.PP
+\fC
+.br
+-rw-a-- 3.1 fat 211916 tx defX 10-Jun-18 00:27 zip31c/zip.c
+.br
+-rw-a-- 3.1 fat 211916 tx defX 20100618.002703 zip31c/zip.c
+\fR
+.PP
+.PD 0
+.B \-t
+.TP
+.PD
+.B \-\-totals
+.br
+Include a totals summary at the end of the report, showing the number of
+members in the report, the sum of their uncompressed sizes, the sum of
+their compressed sizes, and the compression factor as a percentage.
+.IP
+For the Unix-format reports (options \fB\-l\fP, \fB\-m\fP, \fB\-s\fP),
+the totals summary is included by default, if no archive members are
+specified. If \fB\-t\fP is specified alone, that is, without one of the
+Unix-format options, and without a member list, then only the totals
+summary trailer lines will be put out.
+.IP
+The total "bytes compressed" reported includes only the actual data, not
+the ZIP archive meta-data, so the size of the archive will always be
+greater than this value.
+.IP
+See also -mc.
+.PP
+.PD 0
+.B \-U
+.TP
+.PD
+.B \-\-unicode
+.br
+[UNICODE_SUPPORT] Control UTF-8 handling. When UNICODE_SUPPORT is
+available, \fB\-U\fP forces \fIZipInfo\fP to escape all non-ASCII
+characters from UTF-8 coded filenames as "#Uxxxx" (for UCS-2 characters,
+or "#Lxxxxxx" for Unicode codepoints needing 3 octets). This option is
+mainly provided for debugging purpose when the fairly new UTF-8 support
+is suspected of damaging extracted filenames.
+.IP
+\fB\-UU\fP disables the recognition of UTF-8 encoded filenames. The
+handling of filename codings within \fIZipInfo\fP falls back to the
+behavior of pre-Unicode versions.
+.PP
+.PD 0
+.B \-W
+.TP
+.PD
+.B \-\-wild\-no\-span
+.br
+[WILD_STOP_AT_DIR] (Valid when the program was built with
+WILD_STOP_AT_DIR enabled.) Modify the pattern-matching behavior so that
+both "?" (single-character wildcard) and "*" (multi-character wildcard)
+do not match the directory separator character "/". (The two-character
+sequence "**" acts as a multi-character wildcard that includes the
+directory separator in its matched characters.) For example, with
+"\fC\-W\fR":
+.PP
+.EX
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "**.c" matches both "foo.c" and "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+.EE
+.IP
+This modified behavior is equivalent to the pattern matching style used
+by the shells of some of \fIUnZip\fP's supported target OSs (one example
+is Acorn RISC OS). This option may not be available on systems where
+the Zip archive's internal directory separator character "/" is allowed
+as regular character in native operating system filenames. (Currently,
+\fIUnZip\fP uses the same pattern matching rules for both wildcard
+archive file name specifications and archive member selection patterns
+on most system types. For systems allowing "/" as regular filename
+character, the \-W option would not work as expected on a wildcard file
+name specification.)
+.PP
+.PD 0
+.BR "\-x member" " ..."
+.TP
+.PD
+.BR "\-\-exclude member" " ..."
+.br
+An optional list of archive members to be excluded from
+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,
+"\fCzipinfo\ foo\ *.[ch]\ \-x\ */*\fR" would report on all C source
+files (*,c, *.h) in the main directory, but none in any
+subdirectories. Without the \fB\-x\fP option, all C source files in all
+directories within the archive would be included in the report.
+.IP
+When the program sees \fB\-x\fP (\fB\-\-exclude\fP) on a command line,
+it stops scanning for options, and treats every succeeding item as an
+archive member name. To avoid confusion between member names and
+command options, it's simplest to specify \fB\-x\fP (\fB\-\-exclude\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). That is, the following two commands are equivalent:
+.EX
+ zipinfo fred.zip -2 -t -x file1 file2 file3
+ zipinfo fred.zip -x file1 file2 file3 @ -2 -t
+.EE
+.PP
+.PD 0
+.B \-z
+.TP
+.PD
+.B \-\-zipfile-comment
+.br
+Include the archive comments (if any) in the report.
+.PD
+.\" =========================================================================
+.SH "DETAILED DESCRIPTION"
+\fIZipInfo\fP has three basic report formats, providing different
+degrees of detail in the information about the members of an archive: a
+simple list of names (\fB\-1\fP, \fB\-2\fP), a Unix \fIls\fP-style
+listing (\fB\-l\fP, \fB\-m\fP, \fB\-s\fP), and a very detailed analysis
+(\fB\-v\fP). Some of the information, such as file sizes, is easy to
+interpret. Some of the information involves fairly obscure details of
+ZIP archive structure. ZIP archive structure is documented in the
+PKWARE Inc.\& APPNOTE.TXT:
+\fChttp://www.pkware.com/documents/casestudies/APPNOTE.TXT\fR
+.PP
+The table below shows some typical \fB\-l\fP report entries:
+.PP
+.WX
+Perm/Prot Zver Ofs UncoSize At CompSize Cmth ModDate Mtime Name
+----------+----+---+--------+--+--------+----+---------------+--------------
+-rw-a-- 3.1 fat 211916 tx 53467 defX 10-Jun-18 00:27 zip31c/zip.c
+-rwxr-x--- 3.1 unx 709 Tx 311 aesw 11-Aug-21 22:20 endian.c
+RWED,RE, 3.1 vms 6656 bx 2295 defN 07-Aug-15 14:12 itrc/TST.EXE;8
+.WE
+.PP
+Field 1 (Perm/Prot) shows the file permission/protection attributes,
+formatted according to the original operating system or file system
+where the archive was created.
+.PP
+Field 2 (Zver) shows the (approximate) version of the Zip program which
+created the archive.
+.PP
+Field 3 (Ofs) shows the original operating system where the archive was
+created, or the file system on which the member file was stored.
+.PP
+Field 4 (UncoSize) shows the original, uncompressed file size.
+.PP
+Field 5 (At) shows some archive member attributes, as detailed in the
+tables below. The first character indicates whether a file was binary
+or text, and whether it was encrypted. The second character indicates
+the presence of a data descriptor (sometimes called an "extended
+header") and/or an extra field in the member data.
+.EX
+
+ | File Type Extra Field |
+ First char | binary text yes no | Second char
+--------------+-------+----- ------+-----+--------------------
+Encrypted no | b t x - | no Data Descriptor
+ yes | B T X l | yes
+.EE
+.IP
+A Data Descriptor holds CRC and size data at an alternate place in the
+archive (after processed member data instead of before), and is
+normally used when the archiving program can't seek in the output
+archive data/file. An Extra Field can hold a wide variety of data,
+including 64-bit file sizes, many kinds of OS-specific attribute data,
+UTC times, and so on.
+.PP
+Field 6 (CompSize) shows the compressed file size. With \fB\-m\fP, this
+field shows the compression fraction as a percentage. With \fB\-s\fP
+(the default), this field is omitted. This compressed size value
+(unlike the one in an "\fCunzip\ -l\fR" report) includes all the
+overhead resulting from Traditional encryption.
+.PP
+Field 7 (Cmth) shows the compression method used. Note that AES_WG
+encryption is treated as a compression method here. Not all of the
+methods shown in the table below are supported. (Some are obsolete.)
+.PP
+.WX
+ Num Abbr Name, description
+----+----+------------------------------------------------------------
+ 0 stor Store (no compression)
+ 1 shrk Shrink
+ 2 re:1 Reduce (factor 1)
+ 3 re:2 Reduce (factor 2)
+ 4 re:3 Reduce (factor 3)
+ 5 re:4 Reduce (factor 4)
+ 6 i#:# Implode (dictonary_size:Shannon-Fano_trees)
+ 7 tokn Tokenize
+ 8 def# Deflate (N: normal, X: maximum, F: fast, S: super-fast)
+ 9 d64# Deflate64 (N: normal, X: maximum, F: fast, S: super-fast)
+ 10 dcli PKWARE Data Compression Library Imploding - IBM TERSE (old)
+ 12 bzp2 bzip2
+ 14 lzma LZMA
+ 18 ters IBM TERSE (new)
+ 19 lz77 IBM LZ77 z Architecture (PFS)
+ 96 jpeg JPEG
+ 97 wavp WavPack
+ 98 ppmd PPMd version I, Rev 1
+ 99 aesw AES_WG encryption
+.WE
+.PP
+Fields 8 and 9 (ModDate, Mtime) show the file modification date-time
+(MS-DOS format, local time).
+.PP
+Field 10 (Name) shows the file path/name.
+.PP
+.PD
+.\" =========================================================================
+.SH "ENVIRONMENT OPTIONS"
+\fIZipInfo\fP's default behavior may be modified by placing command-line
+options in an environment variable. This can be done with any option,
+but it is probably most useful options like \fB\-T\fP (decimal time
+format) or one of the non-default Unix format optiond (\fB\-l\fP,
+\fB\-m\fP).
+.IP
+For \fIZipInfo\fP ("\fCunzip -Z\fR"), the environment variable name is
+ZIPINFO, except on VMS, where it's ZIPINFO_OPTS. For similarity with
+\fIZip\fP, if ZIPINFO (ZIPINFO_OPTS on VMS) is not defined, then
+\fIZipInfo\fP will use ZIPINFOOPT the same way.
+.IP
+For example, to make the default format the long Unix format instead of
+the short Unix format, one could use commands like the following:
+.TP
+ Unix Bourne (or similar) shell:
+ZIPINFO='\-l'; export ZIPINFO
+.TP
+ Unix C shell:
+setenv\ ZIPINFO\ '\-l'
+.TP
+ OS/2 or MS-DOS:
+set\ ZIPINFO="\-l"
+.TP
+ VMS (with quotation to preserve lower case in DCL):
+define\ ZIPINFO_OPTS\ "\-l" ! Logical name, or
+.br
+ZIPINFO_OPTS\ =\ "\-l" ! DCL symbol. (Either works.)
+.IP
+Environment options are treated the same as any other command-line
+options, except that they are effectively the first options on the
+command line. To override an environment option, one may use an
+explicit option to cancel or override it. For example, to disable the
+totals trailer line by default, one could use commands like the
+following:
+.TP
+ Unix Bourne (or similar) shell:
+ZIPINFO='\-t\-'; export ZIPINFO
+.TP
+ Unix C shell:
+setenv\ ZIPINFO\ '\-t\-'
+.TP
+ OS/2 or MS-DOS:
+set\ ZIPINFO="\-t\-"
+.TP
+ VMS (with quotation to preserve lower case in DCL):
+define\ ZIPINFO_OPTS\ "\-t\-" ! Logical name, or
+.br
+ZIPINFO_OPTS\ =\ "\-t\-" ! DCL symbol. (Either works.)
+.IP
+The examples show short (one-character) options, but long ("\-\-")
+options are also allowed.
+.PP
+The timezone variable (TZ) should be set according to the local timezone
+in order for the Freshen (\fB\-f\fP) and Update (\fB\-u\fP) modes to
+operate correctly. For details, see \fB\-f\fP. This variable may also
+be necessary to get timestamps of extracted files to be set correctly.
+.IP
+On Windows systems, \fIUnZip\fP gets the timezone configuration from the
+registry, assuming it is correctly set in the Control Panel. The TZ
+variable is ignored on these systems.
+.PD
+.\" =========================================================================
+.SH EXAMPLES
+To get a basic, short-format listing of the complete contents of a ZIP
+archive \fIzip31c.zip\fP, with both header and totals lines, use only
+the archive name as an argument to zipinfo:
+.PP
+.EX
+zipinfo zip31c.zip
+zipinfo zip31c
+.EE
+.PP
+To produce a basic, long-format listing (not verbose), including header
+and totals lines, use \fB\-l\fP:
+.PP
+.EX
+zipinfo \-l zip31c.zip
+.EE
+.PP
+To list the complete contents of the archive without header and totals
+lines, either negate the \fB\-h\fP and \fB\-t\fP options or else specify
+the contents explicitly:
+.PP
+.EX
+zipinfo \-h\- \-t\- zip31c.zip
+zipinfo zip31c.zip "*"
+.EE
+.PP
+(Here, the wildcard "*" is quoted to prevent a Unix shell from expanding
+(globbing) it.)
+.PP
+To list information on a single archive member, in medium format,
+specify the member name explicitly:
+.PP
+.EX
+zipinfo \-m unzip60.zip "*/unshrink.c"
+.EE
+.PP
+When any member name is specified, the header and totals trailer are, by
+default, not included in the report, but explicitly specifying \fB\-h\fP
+and/or \fB\-t\fP will restore them. For example:
+.PP
+.EX
+zipinfo \-m \-t unzip610b.zip "*.[ch]" "*/Make*"
+.EE
+.PP
+On a Unix system, one could use the \fB\-T\fP option along with an
+external sorting program (and another filter like \fIhead\fP or
+\fItail\fP) to get a listing of the least or most recently modified
+files in the archive:
+.PP
+.EX
+zipinfo -l -T -h- -t- zip31c.zip | sort -k 8 | head -12
+zipinfo -l -T -h- -t- zip31c.zip | sort -r -k 8 | head -12
+.EE
+.PP
+The \fIsort\fP option \fB\-k\ 8\fP tells it to sort on field 8, which is
+the date-time field in a long- or medium-format (\fB\-l\fP, \fB\-m\fP)
+\fIZipInfo\fP report. (Use \fB\-k\ 7\fP for the short (\fB\-s\fP)
+format.) The \fB\-r\fP option reverses the default smallest-to-largest
+sort order.
+.PD
+.\" =========================================================================
+.SH BUGS
+As with \fIUnZip\fP, \fIZipInfo\fP's \fB\-M\fP ("more") option is overly
+simplistic in its handling of screen output. As noted above, it fails
+to detect the wrapping of long lines and may thereby cause lines at the
+top of the screen to be scrolled off before being read. \fIZipInfo\fP
+should detect and treat each occurrence of line-wrap as one additional
+line printed. This requires knowledge of the screen's width as well as
+its height. In addition, \fIZipInfo\fP should detect the true screen
+geometry on all systems.
+.PP
+The interactions among the various listing format, header, and trailer
+options (\fB\-h\fP, \fB\-l\fP, \fB\-m\fP, \fB\-s\fP, \fB\-t\fP) are
+unnecessarily complex and should be simplified, despite the potential
+disruption to current users.
+.PP
+.\" =========================================================================
+.SH "SEE ALSO"
+\fIfunzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L),
+\fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
+.PD
+.\" =========================================================================
+.SH URL
+.TP
+The Info-ZIP main Web page is:
+.EX
+\fChttp://www.info-zip.org/\fR
+.EE
+.TP
+FTP access is available, too:
+.EX
+\fCftp://ftp.info-zip.org/pub/infozip/\fR
+.EE
+.PP
+++ /dev/null
-.\" Copyright (c) 1990-2009 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.
-.\" If, for some reason, all these files are missing, the Info-ZIP license
-.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
-.\"
-.\" unzip.1 by Greg Roelofs, Fulvio Marino, Jim van Zandt and others.
-.\"
-.\" =========================================================================
-.\" define .EX/.EE (for multiline user-command examples; normal Courier font)
-.de EX
-.in +4n
-.nf
-.ft CW
-..
-.de EE
-.ft R
-.fi
-.in -4n
-..
-.\" =========================================================================
-.TH UNZIP 1L "20 April 2009 (v6.0)" "Info-ZIP"
-.SH NAME
-unzip \- list, test and extract compressed files in a ZIP archive
-.PD
-.SH SYNOPSIS
-\fBunzip\fP [\fB\-Z\fP] [\fB\-cflptTuvz\fP[\fBabjnoqsCDKLMUVWX$/:^\fP]]
-\fIfile\fP[\fI.zip\fP] [\fIfile(s)\fP\ .\|.\|.]
-[\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.] [\fB\-d\fP\ \fIexdir\fP]
-.PD
-.\" =========================================================================
-.SH DESCRIPTION
-\fIunzip\fP will list, test, or extract files from a ZIP archive, commonly
-found on MS-DOS systems. The default behavior (with no options) is to extract
-into the current directory (and subdirectories below it) all files from the
-specified ZIP archive. A companion program, \fIzip\fP(1L), creates ZIP
-archives; both programs are compatible with archives created by PKWARE's
-\fIPKZIP\fP and \fIPKUNZIP\fP for MS-DOS, but in many cases the program
-options or default behaviors differ.
-.PD
-.\" =========================================================================
-.SH ARGUMENTS
-.TP
-.IR file [ .zip ]
-Path of the ZIP archive(s). If the file specification is a wildcard,
-each matching file is processed in an order determined by the operating
-system (or file system). Only the filename can be a wildcard; the path
-itself cannot. Wildcard expressions are similar to those supported in
-commonly used Unix shells (\fIsh\fP, \fIksh\fP, \fIcsh\fP) and may contain:
-.RS
-.IP *
-matches a sequence of 0 or more characters
-.IP ?
-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. 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 brackets is considered a match). To specify a
-verbatim left bracket, the three-character sequence ``[[]'' has to be used.
-.RE
-.IP
-(Be sure to quote any character that might otherwise be interpreted or
-modified by the operating system, particularly under Unix and VMS.) If no
-matches are found, the specification is assumed to be a literal filename;
-and if that also fails, the suffix \fC.zip\fR is appended. Note that
-self-extracting ZIP files are supported, as with any other ZIP archive;
-just specify the \fC.exe\fR suffix (if any) explicitly.
-.IP [\fIfile(s)\fP]
-An optional list of archive members to be processed, separated by spaces.
-(VMS versions compiled with VMSCLI defined must delimit files with commas
-instead. See \fB\-v\fP in \fBOPTIONS\fP below.)
-Regular expressions (wildcards) may be used to match multiple members; see
-above. Again, be sure to quote expressions that would otherwise be expanded
-or modified by the operating system.
-.IP [\fB\-x\fP\ \fIxfile(s)\fP]
-An optional list of archive members to be excluded from processing.
-Since 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
-in the main directory, but none in any subdirectories. Without the \fB\-x\fP
-option, all C source files in all directories within the zipfile would be
-extracted.
-.IP [\fB\-d\fP\ \fIexdir\fP]
-An optional directory to which to extract files. By default, all files
-and subdirectories are recreated in the current directory; the \fB\-d\fP
-option allows extraction in an arbitrary directory (always assuming one
-has permission to write to the directory). This option need not appear
-at the end of the command line; it is also accepted before the zipfile
-specification (with the normal options), immediately after the zipfile
-specification, or between the \fIfile(s)\fP and the \fB\-x\fP option.
-The option and directory may be concatenated without any white space
-between them, but note that this may cause normal shell behavior to be
-suppressed. In particular, ``\fC\-d\ ~\fR'' (tilde) is expanded by Unix
-C shells into the name of the user's home directory, but ``\fC\-d~\fR''
-is treated as a literal subdirectory ``\fB~\fP'' of the current directory.
-.\" =========================================================================
-.SH OPTIONS
-Note that, in order to support obsolescent hardware, \fIunzip\fP's usage
-screen is limited to 22 or 23 lines and should therefore be considered
-only a reminder of the basic \fIunzip\fP syntax rather than an exhaustive
-list of all possible flags. The exhaustive list follows:
-.TP
-.B \-Z
-\fIzipinfo\fP(1L) mode. If the first option on the command line is \fB\-Z\fP,
-the remaining options are taken to be \fIzipinfo\fP(1L) options. See the
-appropriate manual page for a description of these options.
-.TP
-.B \-A
-[OS/2, Unix DLL] print extended help for the DLL's programming interface (API).
-.TP
-.B \-c
-extract files to stdout/screen (``CRT''). This option is similar to the
-\fB\-p\fP option except that the name of each file is printed as it is
-extracted, the \fB\-a\fP option is allowed, and ASCII-EBCDIC conversion
-is automatically performed if appropriate. This option is not listed in
-the \fIunzip\fP usage screen.
-.TP
-.B \-f
-freshen existing files, i.e., extract only those files that
-already exist on disk and that are newer than the disk copies. By
-default \fIunzip\fP queries before overwriting, but the \fB\-o\fP option
-may be used to suppress the queries. Note that under many operating systems,
-the TZ (timezone) environment variable must be set correctly in order for
-\fB\-f\fP and \fB\-u\fP to work properly (under Unix the variable is usually
-set automatically). The reasons for this are somewhat subtle but
-have to do with the differences between DOS-format file times (always local
-time) and Unix-format times (always in GMT/UTC) and the necessity to compare
-the two. A typical TZ value is ``PST8PDT'' (US Pacific time with automatic
-adjustment for Daylight Savings Time or ``summer time'').
-.TP
-.B \-l
-list archive files (short format). The names, uncompressed file sizes and
-modification dates and times of the specified files are printed, along
-with totals for all files specified. If UnZip was compiled with OS2_EAS
-defined, the \fB\-l\fP option also lists columns for the sizes of stored
-OS/2 extended attributes (EAs) and OS/2 access control lists (ACLs). In
-addition, the zipfile comment and individual file comments (if any) are
-displayed. If a file was archived from a single-case file system (for
-example, the old MS-DOS FAT file system) and the \fB\-L\fP option was given,
-the filename is converted to lowercase and is prefixed with a caret (^).
-.TP
-.B \-p
-extract files to pipe (stdout). Nothing but the file data is sent to
-stdout, and the files are always extracted in binary format, just as they
-are stored (no conversions).
-.TP
-.B \-t
-test archive files. This option extracts each specified file in memory
-and compares the CRC (cyclic redundancy check, an enhanced checksum) of
-the expanded file with the original file's stored CRC value.
-.TP
-.B \-T
-[most OSes] set the timestamp on the archive(s) to that of the newest file
-in each one. This corresponds to \fIzip\fP's \fB\-go\fP option except that
-it can be used on wildcard zipfiles (e.g., ``\fCunzip \-T \e*.zip\fR'') and
-is much faster.
-.TP
-.B \-u
-update existing files and create new ones if needed. This option performs
-the same function as the \fB\-f\fP option, extracting (with query) files
-that are newer than those with the same name on disk, and in addition it
-extracts those files that do not already exist on disk. See \fB\-f\fP
-above for information on setting the timezone properly.
-.TP
-.B \-v
-list archive files (verbose format) or show diagnostic version info.
-This option has evolved and now behaves as both an option and a modifier.
-As an option it has two purposes: when a zipfile is specified with no
-other options, \fB\-v\fP lists archive files verbosely, adding to the
-basic \fB\-l\fP info the compression method, compressed size,
-compression ratio and 32-bit CRC. In contrast to most of the competing
-utilities, \fIunzip\fP removes the 12 additional header bytes of
-encrypted entries from the compressed size numbers. Therefore,
-compressed size and compression ratio figures are independent of the entry's
-encryption status and show the correct compression performance. (The complete
-size of the encrypted compressed data stream for zipfile entries is reported
-by the more verbose \fIzipinfo\fP(1L) reports, see the separate manual.)
-When no zipfile is specified (that is, the complete command is simply
-``\fCunzip \-v\fR''), a diagnostic screen is printed. In addition to
-the normal header with release date and version, \fIunzip\fP lists the
-home Info-ZIP ftp site and where to find a list of other ftp and non-ftp
-sites; the target operating system for which it was compiled, as well
-as (possibly) the hardware on which it was compiled, the compiler and
-version used, and the compilation date; any special compilation options
-that might affect the program's operation (see also \fBDECRYPTION\fP below);
-and any options stored in environment variables that might do the same
-(see \fBENVIRONMENT OPTIONS\fP below). As a modifier it works in
-conjunction with other options (e.g., \fB\-t\fP) to produce more
-verbose or debugging output; this is not yet fully implemented
-but will be in future releases.
-.TP
-.B \-z
-display only the archive comment.
-.PD
-.\" =========================================================================
-.SH MODIFIERS
-.TP
-.B \-a
-convert text files. Ordinarily all files are extracted exactly as they
-are stored (as ``binary'' files). The \fB\-a\fP option causes files identified
-by \fIzip\fP as text files (those with the `t' label in \fIzipinfo\fP
-listings, rather than `b') to be automatically extracted as such, converting
-line endings, end-of-file characters and the character set itself as necessary.
-(For example, Unix files use line feeds (LFs) for end-of-line (EOL) and
-have no end-of-file (EOF) marker; Macintoshes use carriage returns (CRs)
-for EOLs; and most PC operating systems use CR+LF for EOLs and control-Z for
-EOF. In addition, IBM mainframes and the Michigan Terminal System use EBCDIC
-rather than the more common ASCII character set, and NT supports Unicode.)
-Note that \fIzip\fP's identification of text files is by no means perfect; some
-``text'' files may actually be binary and vice versa. \fIunzip\fP therefore
-prints ``\fC[text]\fR'' or ``\fC[binary]\fR'' as a visual check for each file
-it extracts when using the \fB\-a\fP option. The \fB\-aa\fP option forces
-all files to be extracted as text, regardless of the supposed file type.
-On VMS, see also \fB\-S\fP.
-.TP
-.B \-b
-[general] treat all files as binary (no text conversions). This is a shortcut
-for \fB\-\-\-a\fP.
-.TP
-.B \-b
-[Tandem] force the creation files with filecode type 180 ('C') when
-extracting Zip entries marked as "text". (On Tandem, \fB\-a\fP is enabled
-by default, see above).
-.TP
-.B \-b
-[VMS] auto-convert binary files (see \fB\-a\fP above) to fixed-length,
-512-byte record format. Doubling the option (\fB\-bb\fP) forces all files
-to be extracted in this format. When extracting to standard output
-(\fB\-c\fP or \fB\-p\fP option in effect), the default conversion of text
-record delimiters is disabled for binary (\fB\-b\fP) resp. all (\fB\-bb\fP)
-files.
-.TP
-.B \-B
-[when compiled with UNIXBACKUP defined] save a backup copy of each
-overwritten file. The backup file is gets the name of the target file with
-a tilde and optionally a unique sequence number (up to 5 digits) appended.
-The sequence number is applied whenever another file with the original name
-plus tilde already exists. When used together with the "overwrite all"
-option \fB\-o\fP, numbered backup files are never created. In this case,
-all backup files are named as the original file with an appended tilde,
-existing backup files are deleted without notice.
-This feature works similarly to the default behavior of \fIemacs\fP(1)
-in many locations.
-.IP
-Example: the old copy of ``\fCfoo\fR'' is renamed to ``\fCfoo~\fR''.
-.IP
-Warning: Users should be aware that the \fB-B\fP option does not prevent
-loss of existing data under all circumstances. For example, when
-\fIunzip\fP is run in overwrite-all mode, an existing ``\fCfoo~\fR'' file
-is deleted before \fIunzip\fP attempts to rename ``\fCfoo\fR'' to
-``\fCfoo~\fR''. When this rename attempt fails (because of a file locks,
-insufficient privileges, or ...), the extraction of ``\fCfoo~\fR'' gets
-cancelled, but the old backup file is already lost. A similar scenario
-takes place when the sequence number range for numbered backup files gets
-exhausted (99999, or 65535 for 16-bit systems). In this case, the backup
-file with the maximum sequence number is deleted and replaced by the new
-backup version without notice.
-.TP
-.B \-C
-use case-insensitive matching for the selection of archive entries
-from the command-line list of extract selection patterns.
-\fIunzip\fP's philosophy is ``you get what you ask for'' (this is
-also responsible for the \fB\-L\fP/\fB\-U\fP change; see the relevant
-options below). Because some file systems are fully case-sensitive
-(notably those under the Unix operating system) and because
-both ZIP archives and \fIunzip\fP itself are portable across platforms,
-\fIunzip\fP's default behavior is to match both wildcard and literal
-filenames case-sensitively. That is, specifying ``\fCmakefile\fR''
-on the command line will \fIonly\fP match ``makefile'' in the archive,
-not ``Makefile'' or ``MAKEFILE'' (and similarly for wildcard specifications).
-Since this does not correspond to the behavior of many other
-operating/file systems (for example, OS/2 HPFS, which preserves
-mixed case but is not sensitive to it), the \fB\-C\fP option may be
-used to force all filename matches to be case-insensitive. In the
-example above, all three files would then match ``\fCmakefile\fR''
-(or ``\fCmake*\fR'', or similar). The \fB\-C\fP option affects
-file specs in both the normal file list and the excluded-file list (xlist).
-.IP
-Please note that the \fB\-C\fP option does neither affect the search for
-the zipfile(s) nor the matching of archive entries to existing files on
-the extraction path. On a case-sensitive file system, \fIunzip\fP will
-never try to overwrite a file ``FOO'' when extracting an entry ``foo''!
-.TP
-.B \-D
-skip restoration of timestamps for extracted items. Normally, \fIunzip\fP
-tries to restore all meta-information for extracted items that are supplied
-in the Zip archive (and do not require privileges or impose a security risk).
-By specifying \fB\-D\fP, \fIunzip\fP is told to suppress restoration of
-timestamps for directories explicitly created from Zip archive entries.
-This option only applies to ports that support setting timestamps for
-directories (currently ATheOS, BeOS, MacOS, OS/2, Unix, VMS, Win32, for other
-\fIunzip\fP ports, \fB\-D\fP has no effect).
-The duplicated option \fB\-DD\fP forces suppression of timestamp restoration
-for all extracted entries (files and directories). This option results in
-setting the timestamps for all extracted entries to the current time.
-.IP
-On VMS, the default setting for this option is \fB\-D\fP for consistency
-with the behaviour of BACKUP: file timestamps are restored, timestamps of
-extracted directories are left at the current time. To enable restoration
-of directory timestamps, the negated option \fB\--D\fP should be specified.
-On VMS, the option \fB\-D\fP disables timestamp restoration for all extracted
-Zip archive items. (Here, a single \fB\-D\fP on the command line combines
-with the default \fB\-D\fP to do what an explicit \fB\-DD\fP does on other
-systems.)
-.TP
-.B \-E
-[MacOS only] display contents of MacOS extra field during restore operation.
-.TP
-.B \-F
-[Acorn only] suppress removal of NFS filetype extension from stored filenames.
-.TP
-.B \-F
-[non-Acorn systems supporting long filenames with embedded commas,
-and only if compiled with ACORN_FTYPE_NFS defined] translate
-filetype information from ACORN RISC OS extra field blocks into a
-NFS filetype extension and append it to the names of the extracted files.
-(When the stored filename appears to already have an appended NFS filetype
-extension, it is replaced by the info from the extra field.)
-.TP
-.B \-i
-[MacOS only] ignore filenames stored in MacOS extra fields. Instead, the
-most compatible filename stored in the generic part of the entry's header
-is used.
-.TP
-.B \-j
-junk paths. The archive's directory structure is not recreated; all files
-are deposited in the extraction directory (by default, the current one).
-.TP
-.B \-J
-[BeOS only] junk file attributes. The file's BeOS file attributes are not
-restored, just the file's data.
-.TP
-.B \-J
-[MacOS only] ignore MacOS extra fields. All Macintosh specific info
-is skipped. Data-fork and resource-fork are restored as separate files.
-.TP
-.B \-K
-[AtheOS, BeOS, Unix only] retain SUID/SGID/Tacky file attributes. Without
-this flag, these attribute bits are cleared for security reasons.
-.TP
-.B \-L
-convert to lowercase any filename originating on an uppercase-only operating
-system or file system. (This was \fIunzip\fP's default behavior in releases
-prior to 5.11; the new default behavior is identical to the old behavior with
-the \fB\-U\fP option, which is now obsolete and will be removed in a future
-release.) Depending on the archiver, files archived under single-case
-file systems (VMS, old MS-DOS FAT, etc.) may be stored as all-uppercase names;
-this can be ugly or inconvenient when extracting to a case-preserving
-file system such as OS/2 HPFS or a case-sensitive one such as under
-Unix. By default \fIunzip\fP lists and extracts such filenames exactly as
-they're stored (excepting truncation, conversion of unsupported characters,
-etc.); this option causes the names of all files from certain systems to be
-converted to lowercase. The \fB\-LL\fP option forces conversion of every
-filename to lowercase, regardless of the originating file system.
-.TP
-.B \-M
-pipe all output through an internal pager similar to the Unix \fImore\fP(1)
-command. At the end of a screenful of output, \fIunzip\fP pauses with a
-``\-\-More\-\-'' prompt; the next screenful may be viewed by pressing the
-Enter (Return) key or the space bar. \fIunzip\fP can be terminated by
-pressing the ``q'' key and, on some systems, the Enter/Return key. Unlike
-Unix \fImore\fP(1), there is no forward-searching or editing capability.
-Also, \fIunzip\fP doesn't notice if long lines wrap at the edge of the screen,
-effectively resulting in the printing of two or more lines and the likelihood
-that some text will scroll off the top of the screen before being viewed.
-On some systems the number of available lines on the screen is not detected,
-in which case \fIunzip\fP assumes the height is 24 lines.
-.TP
-.B \-n
-never overwrite existing files. If a file already exists, skip the extraction
-of that file without prompting. By default \fIunzip\fP queries before
-extracting any file that already exists; the user may choose to overwrite
-only the current file, overwrite all files, skip extraction of the current
-file, skip extraction of all existing files, or rename the current file.
-.TP
-.B \-N
-[Amiga] extract file comments as Amiga filenotes. File comments are created
-with the \-c option of \fIzip\fP(1L), or with the \-N option of the Amiga port
-of \fIzip\fP(1L), which stores filenotes as comments.
-.TP
-.B \-o
-overwrite existing files without prompting. This is a dangerous option, so
-use it with care. (It is often used with \fB\-f\fP, however, and is the only
-way to overwrite directory EAs under OS/2.)
-.IP \fB\-P\fP\ \fIpassword\fP
-use \fIpassword\fP to decrypt encrypted zipfile entries (if any). \fBTHIS IS
-INSECURE!\fP Many multi-user operating systems provide ways for any user to
-see the current command line of any other user; even on stand-alone systems
-there is always the threat of over-the-shoulder peeking. Storing the plaintext
-password as part of a command line in an automated script is even worse.
-Whenever possible, use the non-echoing, interactive prompt to enter passwords.
-(And where security is truly important, use strong encryption such as Pretty
-Good Privacy instead of the relatively weak encryption provided by standard
-zipfile utilities.)
-.TP
-.B \-q
-perform operations quietly (\fB\-qq\fP = even quieter). Ordinarily \fIunzip\fP
-prints the names of the files it's extracting or testing, the extraction
-methods, any file or zipfile comments that may be stored in the archive,
-and possibly a summary when finished with each archive. The \fB\-q\fP[\fBq\fP]
-options suppress the printing of some or all of these messages.
-.TP
-.B \-s
-[OS/2, NT, MS-DOS] convert spaces in filenames to underscores. Since all PC
-operating systems allow spaces in filenames, \fIunzip\fP by default extracts
-filenames with spaces intact (e.g., ``\fCEA\ DATA.\ SF\fR''). This can be
-awkward, however, since MS-DOS in particular does not gracefully support
-spaces in filenames. Conversion of spaces to underscores can eliminate the
-awkwardness in some cases.
-.TP
-.B \-S
-[VMS] convert text files (\fB\-a\fP, \fB\-aa\fP) into Stream_LF record format,
-instead of the text-file default, variable-length record format.
-(Stream_LF is the default record format of VMS \fIunzip\fP. It is applied
-unless conversion (\fB\-a\fP, \fB\-aa\fP and/or \fB\-b\fP, \fB\-bb\fP) is
-requested or a VMS-specific entry is processed.)
-.TP
-.B \-U
-[UNICODE_SUPPORT only] modify or disable UTF-8 handling.
-When UNICODE_SUPPORT is available, the option \fB\-U\fP forces \fIunzip\fP
-to escape all non-ASCII characters from UTF-8 coded filenames as ``#Uxxxx''
-(for UCS-2 characters, or ``#Lxxxxxx'' for unicode codepoints needing 3
-octets). This option is mainly provided for debugging purpose when the
-fairly new UTF-8 support is suspected to mangle up extracted filenames.
-.IP
-The option \fB\-UU\fP allows to entirely disable the recognition of UTF-8
-encoded filenames. The handling of filename codings within \fIunzip\fP falls
-back to the behaviour of previous versions.
-.IP
-[old, obsolete usage] leave filenames uppercase if
-created under MS-DOS, VMS, etc. See \fB\-L\fP above.
-.TP
-.B \-V
-retain (VMS) file version numbers. VMS files can be stored with a version
-number, in the format \fCfile.ext;##\fR. By default the ``\fC;##\fR'' version
-numbers are stripped, but this option allows them to be retained. (On
-file systems that limit filenames to particularly short lengths, the version
-numbers may be truncated or stripped regardless of this option.)
-.TP
-.B \-W
-[only when WILD_STOP_AT_DIR compile-time option enabled]
-modifies the pattern matching routine so that both `?' (single-char wildcard)
-and `*' (multi-char wildcard) do not match the directory separator character
-`/'. (The two-character sequence ``**'' acts as a multi-char wildcard that
-includes the directory separator in its matched characters.) Examples:
-.PP
-.EX
- "*.c" matches "foo.c" but not "mydir/foo.c"
- "**.c" matches both "foo.c" and "mydir/foo.c"
- "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
- "??*/*" matches "ab/foo" and "abc/foo"
- but not "a/foo" or "a/b/foo"
-.EE
-.IP
-This modified behaviour is equivalent to the pattern matching style
-used by the shells of some of UnZip's supported target OSs (one
-example is Acorn RISC OS). This option may not be available on systems
-where the Zip archive's internal directory separator character `/' is
-allowed as regular character in native operating system filenames.
-(Currently, UnZip uses the same pattern matching rules for both wildcard
-zipfile specifications and zip entry selection patterns in most ports.
-For systems allowing `/' as regular filename character, the -W option
-would not work as expected on a wildcard zipfile specification.)
-.TP
-.B \-X
-[VMS, Unix, OS/2, NT, Tandem] restore owner/protection info (UICs and ACL
-entries) under VMS, or user and group info (UID/GID) under Unix, or access
-control lists (ACLs) under certain network-enabled versions of OS/2
-(Warp Server with IBM LAN Server/Requester 3.0 to 5.0; Warp Connect with
-IBM Peer 1.0), or security ACLs under Windows NT. In most cases this will
-require special system privileges, and doubling the option (\fB\-XX\fP)
-under NT instructs \fIunzip\fP to use privileges for extraction; but under
-Unix, for example, a user who belongs to several groups can restore files
-owned by any of those groups, as long as the user IDs match his or her own.
-Note that ordinary file attributes are always restored--this option applies
-only to optional, extra ownership info available on some operating systems.
-[NT's access control lists do not appear to be especially compatible with
-OS/2's, so no attempt is made at cross-platform portability of access
-privileges. It is not clear under what conditions this would ever be
-useful anyway.]
-.TP
-.B \-Y
-[VMS] treat archived file name endings of ``.nnn'' (where ``nnn'' is a
-decimal number) as if they were VMS version numbers (``;nnn'').
-(The default is to treat them as file types.) Example:
-.EX
- "a.b.3" -> "a.b;3".
-.EE
-.TP
-.B \-$
-.\" Amiga support possible eventually, but not yet
-[MS-DOS, OS/2, NT] restore the volume label if the extraction medium is
-removable (e.g., a diskette). Doubling the option (\fB\-$$\fP) allows fixed
-media (hard disks) to be labelled as well. By default, volume labels are
-ignored.
-.IP \fB\-/\fP\ \fIextensions\fP
-[Acorn only] overrides the extension list supplied by Unzip$Ext environment
-variable. During extraction, filename extensions that match one of the items
-in this extension list are swapped in front of the base name of the extracted
-file.
-.TP
-.B \-:
-[all but Acorn, VM/CMS, MVS, Tandem] allows to extract archive members into
-locations outside of the current `` extraction root folder''. For security
-reasons, \fIunzip\fP normally removes ``parent dir'' path components
-(``../'') from the names of extracted file. This safety feature (new for
-version 5.50) prevents \fIunzip\fP from accidentally writing files to
-``sensitive'' areas outside the active extraction folder tree head. The
-\fB\-:\fP option lets \fIunzip\fP switch back to its previous, more liberal
-behaviour, to allow exact extraction of (older) archives that used ``../''
-components to create multiple directory trees at the level of the current
-extraction folder. This option does not enable writing explicitly to the
-root directory (``/''). To achieve this, it is necessary to set the
-extraction target folder to root (e.g. \fB\-d / \fP). However, when the
-\fB\-:\fP option is specified, it is still possible to implicitly write to
-the root directory by specifying enough ``../'' path components within the
-zip archive.
-Use this option with extreme caution.
-.TP
-.B \-^
-[Unix only] allow control characters in names of extracted ZIP archive
-entries. On Unix, a file name may contain any (8-bit) character code with
-the two exception '/' (directory delimiter) and NUL (0x00, the C string
-termination indicator), unless the specific file system has more
-restrictive conventions. Generally, this allows to embed ASCII control
-characters (or even sophisticated control sequences) in file names, at least
-on 'native' Unix file systems. However, it may be highly suspicious to
-make use of this Unix "feature". Embedded control characters in file names
-might have nasty side effects when displayed on screen by some listing code
-without sufficient filtering. And, for ordinary users, it may be difficult
-to handle such file names (e.g. when trying to specify it for open, copy,
-move, or delete operations). Therefore, \fIunzip\fP applies a filter by
-default that removes potentially dangerous control characters from the
-extracted file names. The \fB-^\fP option allows to override this filter
-in the rare case that embedded filename control characters are to be
-intentionally restored.
-.TP
-.B \-2
-[VMS] force unconditionally conversion of file names to ODS2-compatible
-names. The default is to exploit the destination file system, preserving
-case and extended file name characters on an ODS5 destination file system;
-and applying the ODS2-compatibility file name filtering on an ODS2 destination
-file system.
-.PD
-.\" =========================================================================
-.SH "ENVIRONMENT OPTIONS"
-\fIunzip\fP's default behavior may be modified via options placed in
-an environment variable. This can be done with any option, but it
-is probably most useful with the \fB\-a\fP, \fB\-L\fP, \fB\-C\fP, \fB\-q\fP,
-\fB\-o\fP, or \fB\-n\fP modifiers: make \fIunzip\fP auto-convert text
-files by default, make it convert filenames from uppercase systems to
-lowercase, make it match names case-insensitively, make it quieter,
-or make it always overwrite or never overwrite files as it extracts
-them. For example, to make \fIunzip\fP act as quietly as possible, only
-reporting errors, one would use one of the following commands:
-.TP
- Unix Bourne shell:
-UNZIP=\-qq; export UNZIP
-.TP
- Unix C shell:
-setenv UNZIP \-qq
-.TP
- OS/2 or MS-DOS:
-set UNZIP=\-qq
-.TP
- VMS (quotes for \fIlowercase\fP):
-define UNZIP_OPTS "\-qq"
-.PP
-Environment options are, in effect, considered to be just like any other
-command-line options, except that they are effectively the first options
-on the command line. To override an environment option, one may use the
-``minus operator'' to remove it. For instance, to override one of the
-quiet-flags in the example above, use the command
-.PP
-.EX
-unzip \-\-q[\fIother options\fP] zipfile
-.EE
-.PP
-The first hyphen is the normal
-switch character, and the second is a minus sign, acting on the q option.
-Thus the effect here is to cancel one quantum of quietness. To cancel
-both quiet flags, two (or more) minuses may be used:
-.PP
-.EX
-unzip \-t\-\-q zipfile
-unzip \-\-\-qt zipfile
-.EE
-.PP
-(the two are equivalent). This may seem awkward
-or confusing, but it is reasonably intuitive: just ignore the first
-hyphen and go from there. It is also consistent with the behavior of
-Unix \fInice\fP(1).
-.PP
-As suggested by the examples above, the default variable names are UNZIP_OPTS
-for VMS (where the symbol used to install \fIunzip\fP as a foreign command
-would otherwise be confused with the environment variable), and UNZIP
-for all other operating systems. For compatibility with \fIzip\fP(1L),
-UNZIPOPT is also accepted (don't ask). If both UNZIP and UNZIPOPT
-are defined, however, UNZIP takes precedence. \fIunzip\fP's diagnostic
-option (\fB\-v\fP with no zipfile name) can be used to check the values
-of all four possible \fIunzip\fP and \fIzipinfo\fP environment variables.
-.PP
-The timezone variable (TZ) should be set according to the local timezone
-in order for the \fB\-f\fP and \fB\-u\fP to operate correctly. See the
-description of \fB\-f\fP above for details. This variable may also be
-necessary to get timestamps of extracted files to be set correctly.
-The WIN32 (Win9x/ME/NT4/2K/XP/2K3) port of \fIunzip\fP gets the timezone
-configuration from the registry, assuming it is correctly set in the
-Control Panel. The TZ variable is ignored for this port.
-.PD
-.\" =========================================================================
-.SH DECRYPTION
-Encrypted archives are fully supported by Info-ZIP software, but due to
-United States export restrictions, de-/encryption support might be disabled
-in your compiled binary. However, since spring 2000, US export restrictions
-have been liberated, and our source archives do now include full crypt code.
-In case you need binary distributions with crypt support enabled, see the
-file ``WHERE'' in any Info-ZIP source or binary distribution for locations
-both inside and outside the US.
-.PP
-Some compiled versions of \fIunzip\fP may not support decryption.
-To check a version for crypt support, either attempt to test or extract
-an encrypted archive, or else check \fIunzip\fP's diagnostic
-screen (see the \fB\-v\fP option above) for ``\fC[decryption]\fR'' as one
-of the special compilation options.
-.PP
-As noted above, the \fB\-P\fP option may be used to supply a password on
-the command line, but at a cost in security. The preferred decryption
-method is simply to extract normally; if a zipfile member is encrypted,
-\fIunzip\fP will prompt for the password without echoing what is typed.
-\fIunzip\fP continues to use the same password as long as it appears to be
-valid, by testing a 12-byte header on each file. The correct password will
-always check out against the header, but there is a 1-in-256 chance that an
-incorrect password will as well. (This is a security feature of the PKWARE
-zipfile format; it helps prevent brute-force attacks that might otherwise
-gain a large speed advantage by testing only the header.) In the case that
-an incorrect password is given but it passes the header test anyway, either
-an incorrect CRC will be generated for the extracted data or else \fIunzip\fP
-will fail during the extraction because the ``decrypted'' bytes do not
-constitute a valid compressed data stream.
-.PP
-If the first password fails the header check on some file, \fIunzip\fP will
-prompt for another password, and so on until all files are extracted. If
-a password is not known, entering a null password (that is, just a carriage
-return or ``Enter'') is taken as a signal to skip all further prompting.
-Only unencrypted files in the archive(s) will thereafter be extracted. (In
-fact, that's not quite true; older versions of \fIzip\fP(1L) and
-\fIzipcloak\fP(1L) allowed null passwords, so \fIunzip\fP checks each encrypted
-file to see if the null password works. This may result in ``false positives''
-and extraction errors, as noted above.)
-.PP
-Archives encrypted with 8-bit passwords (for example, passwords with accented
-European characters) may not be portable across systems and/or other
-archivers. This problem stems from the use of multiple encoding methods for
-such characters, including Latin-1 (ISO 8859-1) and OEM code page 850.
-DOS \fIPKZIP\fP 2.04g uses the OEM code page; Windows \fIPKZIP\fP 2.50
-uses Latin-1 (and is therefore incompatible with DOS \fIPKZIP\fP); Info-ZIP
-uses the OEM code page on DOS, OS/2 and Win3.x ports but ISO coding
-(Latin-1 etc.) everywhere else; and Nico Mak's \fIWinZip\fP 6.x does not
-allow 8-bit passwords at all. \fIUnZip\fP 5.3 (or newer) attempts to use
-the default character set first (e.g., Latin-1), followed by the alternate
-one (e.g., OEM code page) to test passwords. On EBCDIC systems, if both
-of these fail, EBCDIC encoding will be tested as a last resort. (EBCDIC is
-not tested on non-EBCDIC systems, because there are no known archivers
-that encrypt using EBCDIC encoding.) ISO character encodings other than
-Latin-1 are not supported. The new addition of (partially) Unicode (resp.
-UTF-8) support in \fIUnZip\fP 6.0 has not yet been adapted to the encryption
-password handling in \fIunzip\fP. On systems that use UTF-8 as native
-character encoding, \fIunzip\fP simply tries decryption with the native
-UTF-8 encoded password; the built-in attempts to check the password in
-translated encoding have not yet been adapted for UTF-8 support and
-will consequently fail.
-.PD
-.\" =========================================================================
-.SH EXAMPLES
-To use \fIunzip\fP to extract all members of the archive \fIletters.zip\fP
-into the current directory and subdirectories below it, creating any
-subdirectories as necessary:
-.PP
-.EX
-unzip letters
-.EE
-.PP
-To extract all members of \fIletters.zip\fP into the current directory only:
-.PP
-.EX
-unzip -j letters
-.EE
-.PP
-To test \fIletters.zip\fP, printing only a summary message indicating
-whether the archive is OK or not:
-.PP
-.EX
-unzip -tq letters
-.EE
-.PP
-To test \fIall\fP zipfiles in the current directory, printing only the
-summaries:
-.PP
-.EX
-unzip -tq \e*.zip
-.EE
-.PP
-(The backslash before the asterisk is only required if the shell expands
-wildcards, as in Unix; double quotes could have been used instead, as in
-the source examples below.)\ \ To extract to standard output all members of
-\fIletters.zip\fP whose names end in \fI.tex\fP, auto-converting to the
-local end-of-line convention and piping the output into \fImore\fP(1):
-.PP
-.EX
-unzip \-ca letters \e*.tex | more
-.EE
-.PP
-To extract the binary file \fIpaper1.dvi\fP to standard output and pipe it
-to a printing program:
-.PP
-.EX
-unzip \-p articles paper1.dvi | dvips
-.EE
-.PP
-To extract all FORTRAN and C source files--*.f, *.c, *.h, and Makefile--into
-the /tmp directory:
-.PP
-.EX
-unzip source.zip "*.[fch]" Makefile -d /tmp
-.EE
-.PP
-(the double quotes are necessary only in Unix and only if globbing is turned
-on). To extract all FORTRAN and C source files, regardless of case (e.g.,
-both *.c and *.C, and any makefile, Makefile, MAKEFILE or similar):
-.PP
-.EX
-unzip \-C source.zip "*.[fch]" makefile -d /tmp
-.EE
-.PP
-To extract any such files but convert any uppercase MS-DOS or VMS names to
-lowercase and convert the line-endings of all of the files to the local
-standard (without respect to any files that might be marked ``binary''):
-.PP
-.EX
-unzip \-aaCL source.zip "*.[fch]" makefile -d /tmp
-.EE
-.PP
-To extract only newer versions of the files already in the current
-directory, without querying (NOTE: be careful of unzipping in one timezone a
-zipfile created in another--ZIP archives other than those created by Zip 2.1
-or later contain no timezone information, and a ``newer'' file from an eastern
-timezone may, in fact, be older):
-.PP
-.EX
-unzip \-fo sources
-.EE
-.PP
-To extract newer versions of the files already in the current directory and
-to create any files not already there (same caveat as previous example):
-.PP
-.EX
-unzip \-uo sources
-.EE
-.PP
-To display a diagnostic screen showing which \fIunzip\fP and \fIzipinfo\fP
-options are stored in environment variables, whether decryption support was
-compiled in, the compiler with which \fIunzip\fP was compiled, etc.:
-.PP
-.EX
-unzip \-v
-.EE
-.PP
-In the last five examples, assume that UNZIP or UNZIP_OPTS is set to -q.
-To do a singly quiet listing:
-.PP
-.EX
-unzip \-l file.zip
-.EE
-.PP
-To do a doubly quiet listing:
-.PP
-.EX
-unzip \-ql file.zip
-.EE
-.PP
-(Note that the ``\fC.zip\fR'' is generally not necessary.) To do a standard
-listing:
-.PP
-.EX
-unzip \-\-ql file.zip
-.EE
-or
-.EX
-unzip \-l\-q file.zip
-.EE
-or
-.EX
-unzip \-l\-\-q file.zip
-.EE
-\fR(Extra minuses in options don't hurt.)
-.PD
-.\" =========================================================================
-.SH TIPS
-The current maintainer, being a lazy sort, finds it very useful to define
-a pair of aliases: \fCtt\fR for ``\fCunzip \-tq\fR'' and \fCii\fR for
-``\fCunzip \-Z\fR'' (or ``\fCzipinfo\fR''). One may then simply type
-``\fCtt zipfile\fR'' to test an archive, something that is worth making a
-habit of doing. With luck \fIunzip\fP will report ``\fCNo errors detected
-in compressed data of zipfile.zip\fR,'' after which one may breathe a sigh
-of relief.
-.PP
-The maintainer also finds it useful to set the UNZIP environment variable
-to ``\fC\-aL\fR'' and is tempted to add ``\fC\-C\fR'' as well. His ZIPINFO
-variable is set to ``\fC\-z\fR''.
-.PD
-.\" =========================================================================
-.SH DIAGNOSTICS
-The exit status (or error level) approximates the exit codes defined by PKWARE
-and takes on the following values, except under VMS:
-.RS
-.IP 0
-normal; no errors or warnings detected.
-.IP 1
-one or more warning errors were encountered, but processing completed
-successfully anyway. This includes zipfiles where one or more files
-was skipped due to unsupported compression method or encryption with an
-unknown password.
-.IP 2
-a generic error in the zipfile format was detected. Processing may have
-completed successfully anyway; some broken zipfiles created by other
-archivers have simple work-arounds.
-.IP 3
-a severe error in the zipfile format was detected. Processing probably
-failed immediately.
-.IP 4
-\fIunzip\fP was unable to allocate memory for one or more buffers during
-program initialization.
-.IP 5
-\fIunzip\fP was unable to allocate memory or unable to obtain a tty to read
-the decryption password(s).
-.IP 6
-\fIunzip\fP was unable to allocate memory during decompression to disk.
-.IP 7
-\fIunzip\fP was unable to allocate memory during in-memory decompression.
-.IP 8
-[currently not used]
-.IP 9
-the specified zipfiles were not found.
-.IP 10
-invalid options were specified on the command line.
-.IP 11
-no matching files were found.
-.IP 50
-the disk is (or was) full during extraction.
-.IP 51
-the end of the ZIP archive was encountered prematurely.
-.IP 80
-the user aborted \fIunzip\fP prematurely with control-C (or similar)
-.IP 81
-testing or extraction of one or more files failed due to unsupported
-compression methods or unsupported decryption.
-.IP 82
-no files were found due to bad decryption password(s). (If even one file is
-successfully processed, however, the exit status is 1.)
-.RE
-.PP
-VMS interprets standard Unix (or PC) return values as other, scarier-looking
-things, so \fIunzip\fP instead maps them into VMS-style status codes. The
-current mapping is as follows: 1 (success) for normal exit, 0x7fff0001
-for warning errors, and (0x7fff000? + 16*normal_unzip_exit_status) for all
-other errors, where the `?' is 2 (error) for \fIunzip\fP values 2, 9-11 and
-80-82, and 4 (fatal error) for the remaining ones (3-8, 50, 51). In addition,
-there is a compilation option to expand upon this behavior: defining
-RETURN_CODES results in a human-readable explanation of what the error
-status means.
-.PD
-.\" =========================================================================
-.SH BUGS
-Multi-part archives are not yet supported, except in conjunction with
-\fIzip\fP. (All parts must be concatenated together in order, and then
-``\fCzip \-F\fR'' (for \fIzip 2.x\fP) or ``\fCzip \-FF\fR'' (for
-\fIzip 3.x\fP) must be performed on the concatenated archive in order to
-``fix'' it. Also, \fIzip 3.0\fP and later can combine multi-part (split)
-archives into a combined single-file archive using ``\fCzip \-s\- inarchive
--O outarchive\fR''. See the \fIzip 3\fP manual page for more information.)
-This will definitely be corrected in the next major release.
-.PP
-Archives read from standard input are not yet supported, except with
-\fIfunzip\fP (and then only the first member of the archive can be extracted).
-.PP
-Archives encrypted with 8-bit passwords (e.g., passwords with accented
-European characters) may not be portable across systems and/or other
-archivers. See the discussion in \fBDECRYPTION\fP above.
-.PP
-\fIunzip\fP's \fB\-M\fP (``more'') option tries to take into account automatic
-wrapping of long lines. However, the code may fail to detect the correct
-wrapping locations. First, TAB characters (and similar control sequences) are
-not taken into account, they are handled as ordinary printable characters.
-Second, depending on the actual system / OS port, \fIunzip\fP may not detect
-the true screen geometry but rather rely on "commonly used" default dimensions.
-The correct handling of tabs would require the implementation of a query for
-the actual tabulator setup on the output console.
-.PP
-Dates, times and permissions of stored directories are not restored except
-under Unix. (On Windows NT and successors, timestamps are now restored.)
-.PP
-[MS-DOS] When extracting or testing files from an archive on a defective
-floppy diskette, if the ``Fail'' option is chosen from DOS's ``Abort, Retry,
-Fail?'' message, older versions of \fIunzip\fP may hang the system, requiring
-a reboot. This problem appears to be fixed, but control-C (or control-Break)
-can still be used to terminate \fIunzip\fP.
-.PP
-Under DEC Ultrix, \fIunzip\fP would sometimes fail on long zipfiles (bad CRC,
-not always reproducible). This was apparently due either to a hardware bug
-(cache memory) or an operating system bug (improper handling of page faults?).
-Since Ultrix has been abandoned in favor of Digital Unix (OSF/1), this may not
-be an issue anymore.
-.PP
-[Unix] Unix special files such as FIFO buffers (named pipes), block devices
-and character devices are not restored even if they are somehow represented
-in the zipfile, nor are hard-linked files relinked. Basically the only file
-types restored by \fIunzip\fP are regular files, directories and symbolic
-(soft) links.
-.PP
-[OS/2] Extended attributes for existing directories are only updated if the
-\fB\-o\fP (``overwrite all'') option is given. This is a limitation of the
-operating system; because directories only have a creation time associated
-with them, \fIunzip\fP has no way to determine whether the stored attributes
-are newer or older than those on disk. In practice this may mean a two-pass
-approach is required: first unpack the archive normally (with or without
-freshening/updating existing files), then overwrite just the directory entries
-(e.g., ``\fCunzip -o foo */\fR'').
-.PP
-[VMS] When extracting to another directory, only the \fI[.foo]\fP syntax is
-accepted for the \fB\-d\fP option; the simple Unix \fIfoo\fP syntax is
-silently ignored (as is the less common VMS \fIfoo.dir\fP syntax).
-.PP
-[VMS] When the file being extracted already exists, \fIunzip\fP's query only
-allows skipping, overwriting or renaming; there should additionally be a
-choice for creating a new version of the file. In fact, the ``overwrite''
-choice does create a new version; the old version is not overwritten or
-deleted.
-.PD
-.\" =========================================================================
-.SH "SEE ALSO"
-\fIfunzip\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipgrep\fP(1L),
-\fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
-.PD
-.\" =========================================================================
-.SH URL
-The Info-ZIP home page is currently at
-.EX
-\fChttp://www.info-zip.org/pub/infozip/\fR
-.EE
-or
-.EX
-\fCftp://ftp.info-zip.org/pub/infozip/\fR .
-.EE
-.PD
-.\" =========================================================================
-.SH AUTHORS
-The primary Info-ZIP authors (current semi-active members of the Zip-Bugs
-workgroup) are: Ed Gordon (Zip, general maintenance, shared code, Zip64,
-Win32, Unix, Unicode); Christian Spieler (UnZip maintenance coordination,
-VMS, MS-DOS, Win32, shared code, general Zip and UnZip integration and
-optimization); Onno van der Linden (Zip); Mike White (Win32, Windows GUI,
-Windows DLLs); Kai Uwe Rommel (OS/2, Win32); Steven M. Schweda (VMS, Unix,
-support of new features); Paul Kienitz (Amiga, Win32, Unicode); Chris
-Herborth (BeOS, QNX, Atari); Jonathan Hudson (SMS/QDOS); Sergio Monesi
-(Acorn RISC OS); Harald Denker (Atari, MVS); John Bush (Solaris, Amiga);
-Hunter Goatley (VMS, Info-ZIP Site maintenance); Steve Salisbury (Win32);
-Steve Miller (Windows CE GUI), Johnny Lee (MS-DOS, Win32, Zip64); and Dave
-Smith (Tandem NSK).
-.PP
-The following people were former members of the Info-ZIP development group
-and provided major contributions to key parts of the current code:
-Greg ``Cave Newt'' Roelofs (UnZip, unshrink decompression);
-Jean-loup Gailly (deflate compression);
-Mark Adler (inflate decompression, fUnZip).
-.PP
-The author of the original unzip code upon which Info-ZIP's was based
-is Samuel H. Smith; Carl Mascott did the first Unix port; and David P.
-Kirschbaum organized and led Info-ZIP in its early days with Keith Petersen
-hosting the original mailing list at WSMR-SimTel20. The full list of
-contributors to UnZip has grown quite large; please refer to the CONTRIBS
-file in the UnZip source distribution for a relatively complete version.
-.PD
-.\" =========================================================================
-.SH VERSIONS
-.ta \w'vx.xxnn'u +\w'fall 1989'u+3n
-.PD 0
-.IP "v1.2\t15 Mar 89" \w'\t\t'u
-Samuel H. Smith
-.IP "v2.0\t\ 9 Sep 89"
-Samuel H. Smith
-.IP "v2.x\tfall 1989"
-many Usenet contributors
-.IP "v3.0\t\ 1 May 90"
-Info-ZIP (DPK, consolidator)
-.IP "v3.1\t15 Aug 90"
-Info-ZIP (DPK, consolidator)
-.IP "v4.0\t\ 1 Dec 90"
-Info-ZIP (GRR, maintainer)
-.IP "v4.1\t12 May 91"
-Info-ZIP
-.IP "v4.2\t20 Mar 92"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.0\t21 Aug 92"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.01\t15 Jan 93"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.1\t\ 7 Feb 94"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.11\t\ 2 Aug 94"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.12\t28 Aug 94"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.2\t30 Apr 96"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.3\t22 Apr 97"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.31\t31 May 97"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.32\t\ 3 Nov 97"
-Info-ZIP (Zip-Bugs subgroup, GRR)
-.IP "v5.4\t28 Nov 98"
-Info-ZIP (Zip-Bugs subgroup, SPC)
-.IP "v5.41\t16 Apr 00"
-Info-ZIP (Zip-Bugs subgroup, SPC)
-.IP "v5.42\t14 Jan 01"
-Info-ZIP (Zip-Bugs subgroup, SPC)
-.IP "v5.5\t17 Feb 02"
-Info-ZIP (Zip-Bugs subgroup, SPC)
-.IP "v5.51\t22 May 04"
-Info-ZIP (Zip-Bugs subgroup, SPC)
-.IP "v5.52\t28 Feb 05"
-Info-ZIP (Zip-Bugs subgroup, SPC)
-.IP "v6.0\t20 Apr 09"
-Info-ZIP (Zip-Bugs subgroup, SPC)
-.PD
+++ /dev/null
-.\" Copyright (c) 1990-2009 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.
-.\" If, for some reason, all these files are missing, the Info-ZIP license
-.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
-.\"
-.\" unzipsfx.1 by Greg Roelofs
-.\"
-.\" =========================================================================
-.\" define .EX/.EE (for multiline user-command examples; normal Courier font)
-.de EX
-.in +4n
-.nf
-.ft CW
-..
-.de EE
-.ft R
-.fi
-.in -4n
-..
-.\" =========================================================================
-.TH UNZIPSFX 1L "20 April 2009 (v6.0)" "Info-ZIP"
-.SH NAME
-unzipsfx \- self-extracting stub for prepending to ZIP archives
-.PD
-.SH SYNOPSIS
-\fB<name of unzipsfx+archive combo>\fP [\fB\-cfptuz\fP[\fBajnoqsCLV$\fP]]
-[\fIfile(s)\fP\ .\|.\|. [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]]
-.PD
-.\" =========================================================================
-.SH DESCRIPTION
-\fIunzipsfx\fP is a modified version of \fIunzip\fP(1L) designed to be
-prepended to existing ZIP archives in order to form self-extracting archives.
-Instead of taking its first non-flag argument to be the zipfile(s) to be
-extracted, \fIunzipsfx\fP seeks itself under the name by which it was invoked
-and tests or extracts the contents of the appended archive. Because the
-executable stub adds bulk to the archive (the whole purpose of which is to
-be as small as possible), a number of the less-vital capabilities in regular
-\fIunzip\fP have been removed. Among these are the usage (or help) screen,
-the listing and diagnostic functions (\fB\-l\fP and \fB\-v\fP), the ability
-to decompress older compression formats (the ``reduce,'' ``shrink'' and
-``implode'' methods). The ability to extract to a directory other than
-the current one can be selected as a compile-time option, which is now enabled
-by default since UnZipSFX version 5.5. Similarly, decryption is supported as
-a compile-time option but should be avoided unless the attached archive
-contains encrypted files. Starting with release 5.5, another compile-time
-option adds a simple ``run command after extraction'' feature. This feature
-is currently incompatible with the ``extract to different directory''
-feature and remains disabled by default.
-.PP
-\fBNote that
-self-extracting archives made with\fP \fIunzipsfx\fP \fBare no more (or less)
-portable across different operating systems than is
-the\fP \fIunzip\fP \fBexecutable itself.\fP In general a self-extracting
-archive made on
-a particular Unix system, for example, will only self-extract under the same
-flavor of Unix. Regular \fIunzip\fP may still be used to extract the
-embedded archive as with any normal zipfile, although it will generate
-a harmless warning about extra bytes at the beginning of the zipfile.
-\fIDespite this\fP, however, the self-extracting archive is technically
-\fInot\fP a valid ZIP archive, and PKUNZIP may be unable to test or extract
-it. This limitation is due to the simplistic manner in which the archive
-is created; the internal directory structure is not updated to reflect the
-extra bytes prepended to the original zipfile.
-.PD
-.\" =========================================================================
-.SH ARGUMENTS
-.IP [\fIfile(s)\fP]
-An optional list of archive members to be processed.
-Regular expressions (wildcards) similar to those in Unix \fIegrep\fP(1)
-may be used to match multiple members. These wildcards may contain:
-.RS
-.IP *
-matches a sequence of 0 or more characters
-.IP ?
-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. 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 brackets is considered a match).
-.RE
-.IP
-(Be sure to quote any character that might otherwise be interpreted or
-modified by the operating system, particularly under Unix and VMS.)
-.IP [\fB\-x\fP\ \fIxfile(s)\fP]
-An optional list of archive members to be excluded from processing.
-Since wildcard characters match directory separators (`/'), this option
-may be used to exclude any files that are in subdirectories. For
-example, ``\fCfoosfx *.[ch] -x */*\fR'' would extract all C source files
-in the main directory, but none in any subdirectories. Without the \fB\-x\fP
-option, all C source files in all directories within the zipfile would be
-extracted.
-.PP
-If \fIunzipsfx\fP is compiled with SFX_EXDIR defined, the following option
-is also enabled:
-.IP [\fB\-d\fP\ \fIexdir\fP]
-An optional directory to which to extract files. By default, all files
-and subdirectories are recreated in the current directory; the \fB\-d\fP
-option allows extraction in an arbitrary directory (always assuming one
-has permission to write to the directory). The option and directory may
-be concatenated without any white space between them, but note that this
-may cause normal shell behavior to be suppressed. In particular,
-``\fC\-d\ ~\fR'' (tilde) is expanded by Unix C shells into the name
-of the user's home directory, but ``\fC\-d~\fR'' is treated as a
-literal subdirectory ``\fB~\fP'' of the current directory.
-.PD
-.\" =========================================================================
-.SH OPTIONS
-\fIunzipsfx\fP supports the following \fIunzip\fP(1L) options: \fB\-c\fP
-and \fB\-p\fP (extract to standard output/screen), \fB\-f\fP and \fB\-u\fP
-(freshen and update existing files upon extraction), \fB\-t\fP (test
-archive) and \fB\-z\fP (print archive comment). All normal listing options
-(\fB\-l\fP, \fB\-v\fP and \fB\-Z\fP) have been removed, but the testing
-option (\fB\-t\fP) may be used as a ``poor man's'' listing. Alternatively,
-those creating self-extracting archives may wish to include a short listing
-in the zipfile comment.
-.PP
-See \fIunzip\fP(1L) for a more complete description of these options.
-.PD
-.\" =========================================================================
-.SH MODIFIERS
-\fIunzipsfx\fP currently supports all \fIunzip\fP(1L) modifiers: \fB\-a\fP
-(convert text files), \fB\-n\fP (never overwrite), \fB\-o\fP (overwrite
-without prompting), \fB\-q\fP (operate quietly), \fB\-C\fP (match names
-case-insensitively), \fB\-L\fP (convert uppercase-OS names to lowercase),
-\fB\-j\fP (junk paths) and \fB\-V\fP (retain version numbers); plus the
-following operating-system specific options: \fB\-X\fP (restore VMS
-owner/protection info), \fB\-s\fP (convert spaces in filenames to underscores
-[DOS, OS/2, NT]) and \fB\-$\fP (restore volume label [DOS, OS/2, NT, Amiga]).
-.PP
-(Support for regular ASCII text-conversion may be removed in future versions,
-since it is simple enough for the archive's creator to ensure that text
-files have the appropriate format for the local OS. EBCDIC conversion will
-of course continue to be supported since the zipfile format implies ASCII
-storage of text files.)
-.PP
-See \fIunzip\fP(1L) for a more complete description of these modifiers.
-.PD
-.\" =========================================================================
-.SH "ENVIRONMENT OPTIONS"
-\fIunzipsfx\fP uses the same environment variables as \fIunzip\fP(1L) does,
-although this is likely to be an issue only for the person creating and
-testing the self-extracting archive. See \fIunzip\fP(1L) for details.
-.PD
-.\" =========================================================================
-.SH DECRYPTION
-Decryption is supported exactly as in \fIunzip\fP(1L); that is, interactively
-with a non-echoing prompt for the password(s). See \fIunzip\fP(1L) for
-details. Once again, note that if the archive has no encrypted files there
-is no reason to use a version of \fIunzipsfx\fP with decryption support;
-that only adds to the size of the archive.
-.PD
-.\" =========================================================================
-.SH AUTORUN COMMAND
-When \fIunzipsfx\fP was compiled with CHEAP_SFX_AUTORUN defined, a simple
-``command autorun'' feature is supported. You may enter a command into the
-Zip archive comment, using the following format:
-.PP
-.EX
-$AUTORUN$>[command line string]
-.EE
-.PP
-When \fIunzipsfx\fP recognizes the ``$AUTORUN$>'' token at the beginning
-of the Zip archive comment, the remainder of the first line of the comment
-(until the first newline character) is passed as a shell command to the
-operating system using the C rtl ``system'' function. Before executing
-the command, \fIunzipsfx\fP displays the command on the console and prompts
-the user for confirmation. When the user has switched off prompting by
-specifying the \fB-q\fP option, autorun commands are never executed.
-.PP
-In case the archive comment contains additional lines of text, the remainder
-of the archive comment following the first line is displayed normally, unless
-quiet operation was requested by supplying a \fB-q\fP option.
-.PD
-.\" =========================================================================
-.SH EXAMPLES
-To create a self-extracting archive \fIletters\fP from a regular zipfile
-\fIletters.zip\fP and change the new archive's permissions to be
-world-executable under Unix:
-.PP
-.EX
-cat unzipsfx letters.zip > letters
-chmod 755 letters
-zip -A letters
-.EE
-.PP
-To create the same archive under MS-DOS, OS/2 or NT (note the use of the
-\fB/b\fP [binary] option to the \fIcopy\fP command):
-.PP
-.EX
-copy /b unzipsfx.exe+letters.zip letters.exe
-zip -A letters.exe
-.EE
-.PP
-Under VMS:
-.PP
-.EX
-copy unzipsfx.exe,letters.zip letters.exe
-letters == "$currentdisk:[currentdir]letters.exe"
-zip -A letters.exe
-.EE
-.PP
-(The VMS \fIappend\fP command may also be used. The second command installs
-the new program as a ``foreign command'' capable of taking arguments. The
-third line assumes that Zip is already installed as a foreign command.)
-Under AmigaDOS:
-.PP
-.EX
-MakeSFX letters letters.zip UnZipSFX
-.EE
-.PP
-(MakeSFX is included with the UnZip source distribution and with Amiga
-binary distributions. ``\fCzip -A\fR'' doesn't work on Amiga self-extracting
-archives.)
-To test (or list) the newly created self-extracting archive:
-.PP
-.EX
-letters \-t
-.EE
-.PP
-To test \fIletters\fP quietly, printing only a summary message indicating
-whether the archive is OK or not:
-.PP
-.EX
-letters \-tqq
-.EE
-.PP
-To extract the complete contents into the current directory, recreating all
-files and subdirectories as necessary:
-.PP
-.EX
-letters
-.EE
-.PP
-To extract all \fC*.txt\fR files (in Unix quote the `*'):
-.PP
-.EX
-letters *.txt
-.EE
-.PP
-To extract everything \fIexcept\fP the \fC*.txt\fR files:
-.PP
-.EX
-letters -x *.txt
-.EE
-.PP
-To extract only the README file to standard output (the screen):
-.PP
-.EX
-letters -c README
-.EE
-.PP
-To print only the zipfile comment:
-.PP
-.EX
-letters \-z
-.EE
-.PD
-.\" =========================================================================
-.SH LIMITATIONS
-The principle and fundamental limitation of \fIunzipsfx\fP is that it is
-not portable across architectures or operating systems, and therefore
-neither are the resulting archives. For some architectures there is
-limited portability, however (e.g., between some flavors of Intel-based Unix).
-.PP
-Another problem with the current implementation is that any archive
-with ``junk'' prepended to the beginning technically is no longer a zipfile
-(unless \fIzip\fP(1) is used to adjust the zipfile offsets appropriately,
-as noted above). \fIunzip\fP(1) takes note of the prepended bytes
-and ignores them since some file-transfer protocols, notably MacBinary, are
-also known to prepend junk. But PKWARE's archiver suite may not be able to
-deal with the modified archive unless its offsets have been adjusted.
-.PP
-\fIunzipsfx\fP has no knowledge of the user's PATH, so in general an archive
-must either be in the current directory when it is invoked, or else a full
-or relative path must be given. If a user attempts to extract the archive
-from a directory in the PATH other than the current one, \fIunzipsfx\fP will
-print a warning to the effect, ``can't find myself.'' This is always true
-under Unix and may be true in some cases under MS-DOS, depending on the
-compiler used (Microsoft C fully qualifies the program name, but other
-compilers may not). Under OS/2 and NT there are operating-system calls
-available that provide the full path name, so the archive may be invoked
-from anywhere in the user's path. The situation is not known for AmigaDOS,
-Atari TOS, MacOS, etc.
-.PP
-As noted above, a number of the normal \fIunzip\fP(1L) functions have
-been removed in order to make \fIunzipsfx\fP smaller: usage and diagnostic
-info, listing functions and extraction to other directories. Also, only
-stored and deflated files are supported. The latter limitation is mainly
-relevant to those who create SFX archives, however.
-.PP
-VMS users must know how to set up self-extracting archives as foreign
-commands in order to use any of \fIunzipsfx\fP's options. This is not
-necessary for simple extraction, but the command to do so then becomes,
-e.g., ``\fCrun letters\fR'' (to continue the examples given above).
-.PP
-\fIunzipsfx\fP on the Amiga requires the use of a special program, MakeSFX,
-in order to create working self-extracting archives; simple concatenation
-does not work. (For technically oriented users, the attached archive is
-defined as a ``debug hunk.'') There may be compatibility problems between
-the ROM levels of older Amigas and newer ones.
-.PP
-All current bugs in \fIunzip\fP(1L) exist in \fIunzipsfx\fP as well.
-.PD
-.\" =========================================================================
-.SH DIAGNOSTICS
-\fIunzipsfx\fP's exit status (error level) is identical to that of
-\fIunzip\fP(1L); see the corresponding man page.
-.PD
-.\" =========================================================================
-.SH "SEE ALSO"
-\fIfunzip\fP(1L), \fIunzip\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L),
-\fIzipgrep\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
-.PD
-.PD
-.\" =========================================================================
-.SH URL
-The Info-ZIP home page is currently at
-.EX
-\fChttp://www.info-zip.org/pub/infozip/\fR
-.EE
-or
-.EX
-\fCftp://ftp.info-zip.org/pub/infozip/\fR .
-.EE
-.PD
-.\" =========================================================================
-.SH AUTHORS
-Greg Roelofs was responsible for the basic modifications to UnZip necessary
-to create UnZipSFX. See \fIunzip\fP(1L) for the current list of Zip-Bugs
-authors, or the file CONTRIBS in the UnZip source distribution for the
-full list of Info-ZIP contributors.
-.PD
+++ /dev/null
-.\" Copyright (c) 1990-2009 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.
-.\" If, for some reason, all these files are missing, the Info-ZIP license
-.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
-.\"
-.\" zipinfo.1 by Greg Roelofs and others.
-.\"
-.\" =========================================================================
-.\" define .X macro (for long-line ZipInfo output examples; small Courier):
-.de X
-.nf
-.ft CW
-.ie n .ti -5
-.el \{ .ti +2m
-.ps -1 \}
-\&\\$1
-.ie n .ti +5
-.el \{ .ti -2m
-.ps +1 \}
-.ft
-.fi
-..
-.\" define .EX/.EE (for multiline user-command examples; normal Courier font)
-.de EX
-.in +4n
-.nf
-.ft CW
-..
-.de EE
-.ft
-.fi
-.in -4n
-..
-.\" =========================================================================
-.TH ZIPINFO 1L "20 April 2009 (v3.0)" "Info-ZIP"
-.SH NAME
-zipinfo \- list detailed information about a ZIP archive
-.PD
-.SH SYNOPSIS
-\fBzipinfo\fP [\fB\-12smlvhMtTz\fP] \fIfile\fP[\fI.zip\fP]
-[\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]
-.PP
-\fBunzip\fP \fB\-Z\fP [\fB\-12smlvhMtTz\fP] \fIfile\fP[\fI.zip\fP]
-[\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]
-.PD
-.\" =========================================================================
-.SH DESCRIPTION
-\fIzipinfo\fP lists technical information about files in a ZIP archive, most
-commonly found on MS-DOS systems. Such information includes file access
-permissions, encryption status, type of compression, version and operating
-system or file system of compressing program, and the like. The default
-behavior (with no options) is
-to list single-line entries for each file in the archive, with header and
-trailer lines providing summary information for the entire archive. The
-format is a cross between Unix ``\fCls \-l\fR'' and ``\fCunzip \-v\fR''
-output. See
-.B "DETAILED DESCRIPTION"
-below. Note that \fIzipinfo\fP is the same program as \fIunzip\fP (under
-Unix, a link to it); on some systems, however, \fIzipinfo\fP support may
-have been omitted when \fIunzip\fP was compiled.
-.PD
-.\" =========================================================================
-.SH ARGUMENTS
-.TP
-.IR file [ .zip ]
-Path of the ZIP archive(s). If the file specification is a wildcard,
-each matching file is processed in an order determined by the operating
-system (or file system). Only the filename can be a wildcard; the path
-itself cannot. Wildcard expressions are similar to Unix \fIegrep\fP(1)
-(regular) expressions and may contain:
-.RS
-.IP *
-matches a sequence of 0 or more characters
-.IP ?
-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. 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 brackets is considered a match). To specify a
-verbatim left bracket, the three-character sequence ``[[]'' has to be used.
-.RE
-.IP
-(Be sure to quote any character that might otherwise be interpreted or
-modified by the operating system, particularly under Unix and VMS.) If no
-matches are found, the specification is assumed to be a literal filename;
-and if that also fails, the suffix \fC.zip\fR is appended. Note that
-self-extracting ZIP files are supported, as with any other ZIP archive;
-just specify the \fC.exe\fR suffix (if any) explicitly.
-.IP [\fIfile(s)\fP]
-An optional list of archive members to be processed, separated by spaces.
-(VMS versions compiled with VMSCLI defined must delimit files with commas
-instead.)
-Regular expressions (wildcards) may be used to match multiple members; see
-above. Again, be sure to quote expressions that would otherwise be expanded
-or modified by the operating system.
-.IP [\fB\-x\fP\ \fIxfile(s)\fP]
-An optional list of archive members to be excluded from processing.
-.\" =========================================================================
-.SH OPTIONS
-.TP
-.B \-1
-list filenames only, one per line. This option excludes all others; headers,
-trailers and zipfile comments are never printed. It is intended for use in
-Unix shell scripts.
-.TP
-.B \-2
-list filenames only, one per line, but allow headers (\fB\-h\fP), trailers
-(\fB\-t\fP) and zipfile comments (\fB\-z\fP), as well. This option may be
-useful in cases where the stored filenames are particularly long.
-.TP
-.B \-s
-list zipfile info in short Unix ``\fCls \-l\fR'' format. This is the default
-behavior; see below.
-.TP
-.B \-m
-list zipfile info in medium Unix ``\fCls \-l\fR'' format. Identical to the
-\fB\-s\fP output, except that the compression factor, expressed as a
-percentage, is also listed.
-.TP
-.B \-l
-list zipfile info in long Unix ``\fCls \-l\fR'' format. As with \fB\-m\fP
-except that the compressed size (in bytes) is printed instead of the
-compression ratio.
-.TP
-.B \-v
-list zipfile information in verbose, multi-page format.
-.TP
-.B \-h
-list header line. The archive name, actual size (in bytes) and total number
-of files is printed.
-.TP
-.B \-M
-pipe all output through an internal pager similar to the Unix \fImore\fP(1)
-command. At the end of a screenful of output, \fIzipinfo\fP pauses with a
-``\-\-More\-\-'' prompt; the next screenful may be viewed by pressing the
-Enter (Return) key or the space bar. \fIzipinfo\fP can be terminated by
-pressing the ``q'' key and, on some systems, the Enter/Return key. Unlike
-Unix \fImore\fP(1), there is no forward-searching or editing capability.
-Also, \fIzipinfo\fP doesn't notice if long lines wrap at the edge of the
-screen, effectively resulting in the printing of two or more lines and the
-likelihood that some text will scroll off the top of the screen before being
-viewed. On some systems the number of available lines on the screen is not
-detected, in which case \fIzipinfo\fP assumes the height is 24 lines.
-.TP
-.B \-t
-list totals for files listed or for all files. The number of files listed,
-their uncompressed and compressed total sizes , and their overall compression
-factor is printed; or, if only the totals line is being printed, the values
-for the entire archive are given. The compressed total size does not include
-the 12 additional header bytes of each encrypted entry. Note that the total
-compressed (data) size will never match the actual zipfile size, since the
-latter includes all of the internal zipfile headers in addition to the
-compressed data.
-.TP
-.B \-T
-print the file dates and times in a sortable decimal format (yymmdd.hhmmss).
-The default date format is a more standard, human-readable version with
-abbreviated month names (see examples below).
-.TP
-.B \-U
-[UNICODE_SUPPORT only] modify or disable UTF-8 handling.
-When UNICODE_SUPPORT is available, the option \fB\-U\fP forces \fIunzip\fP
-to escape all non-ASCII characters from UTF-8 coded filenames as ``#Uxxxx''.
-This option is mainly provided for debugging purpose when the fairly new
-UTF-8 support is suspected to mangle up extracted filenames.
-.IP
-The option \fB\-UU\fP allows to entirely disable the recognition of UTF-8
-encoded filenames. The handling of filename codings within \fIunzip\fP falls
-back to the behaviour of previous versions.
-.TP
-.B \-z
-include the archive comment (if any) in the listing.
-.PD
-.\" =========================================================================
-.SH "DETAILED DESCRIPTION"
-.I zipinfo
-has a number of modes, and its behavior can be rather difficult to fathom
-if one isn't familiar with Unix \fIls\fP(1) (or even if one is). The default
-behavior is to list files in the following format:
-.PP
-.X "-rw-rws--- 1.9 unx 2802 t- defX 11-Aug-91 13:48 perms.2660"
-.PP
-The last three fields are the modification date and time of
-the file, and its name. The case of the filename is respected; thus
-files that come from MS-DOS PKZIP are always capitalized. If the file
-was zipped with a stored directory name, that is also displayed as part
-of the filename.
-.PP
-The second and third fields indicate that the file was zipped under
-Unix with version 1.9 of \fIzip\fP. Since it comes from Unix, the file
-permissions at the beginning of the line are printed in Unix format.
-The uncompressed file-size (2802 in this example) is the fourth field.
-.PP
-The fifth field consists of two characters, either of which may take
-on several values. The first character may be either `t' or `b', indicating
-that \fIzip\fP believes the file to be text or binary, respectively;
-but if the file is encrypted, \fIzipinfo\fP
-notes this fact by capitalizing the character (`T' or `B'). The second
-character may also take on four values, depending on whether there is
-an extended local header and/or an ``extra field'' associated with the
-file (fully explained in PKWare's APPNOTE.TXT, but basically analogous to
-pragmas in ANSI C--i.e., they provide a standard way to include non-standard
-information in the archive). If neither exists, the character
-will be a hyphen (`\-'); if there is an extended local header but no extra
-field, `l'; if the reverse, `x'; and if both exist, `X'. Thus the
-file in this example is (probably) a text file, is not encrypted, and
-has neither an extra field nor an extended local header associated with it.
-The example below, on the other hand, is an encrypted binary file with an
-extra field:
-.PP
-.X "RWD,R,R 0.9 vms 168 Bx shrk 9-Aug-91 19:15 perms.0644"
-.PP
-Extra fields are used for various purposes (see discussion of the \fB\-v\fP
-option below) including the storage of VMS file attributes, which is
-presumably the case here. Note that the file attributes are listed in
-VMS format. Some other possibilities for the host operating system (which
-is actually a misnomer--host file system is more correct) include
-OS/2 or NT with High Performance File System (HPFS), MS-DOS, OS/2 or NT
-with File Allocation Table (FAT) file system, and Macintosh. These are
-denoted as follows:
-.PP
-.X "-rw-a-- 1.0 hpf 5358 Tl i4:3 4-Dec-91 11:33 longfilename.hpfs"
-.X "-r--ahs 1.1 fat 4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF"
-.X "--w------- 1.0 mac 17357 bx i8:2 4-May-92 04:02 unzip.macr"
-.PP
-File attributes in the first two cases are indicated in a Unix-like format,
-where the seven subfields indicate whether the file: (1) is a directory,
-(2) is readable (always true), (3) is writable, (4) is executable (guessed
-on the basis of the extension--\fI.exe\fP, \fI.com\fP, \fI.bat\fP, \fI.cmd\fP
-and \fI.btm\fP files are assumed to be so), (5) has its archive bit set,
-(6) is hidden, and (7) is a system file. Interpretation of Macintosh file
-attributes is unreliable because some Macintosh archivers don't store any
-attributes in the archive.
-.PP
-Finally, the sixth field indicates
-the compression method and possible sub-method used. There are six methods
-known at present: storing (no compression), reducing, shrinking, imploding,
-tokenizing (never publicly released), and deflating. In addition, there are
-four levels of reducing (1 through 4); four types of imploding (4K or 8K
-sliding dictionary, and 2 or 3 Shannon-Fano trees); and four levels of
-deflating (superfast, fast, normal, maximum compression). \fIzipinfo\fP
-represents these methods and their sub-methods as follows: \fIstor\fP;
-\fIre:1\fP, \fIre:2\fP, etc.; \fIshrk\fP; \fIi4:2\fP, \fIi8:3\fP, etc.;
-\fItokn\fP; and \fIdefS\fP, \fIdefF\fP, \fIdefN\fP, and \fIdefX\fP.
-.PP
-The medium and long listings are almost identical to the short format except
-that they add information on the file's compression. The medium format lists
-the file's compression factor as a percentage indicating the amount of space
-that has been ``removed'':
-.PP
-.X "-rw-rws--- 1.5 unx 2802 t- 81% defX 11-Aug-91 13:48 perms.2660"
-.PP
-In this example, the file has been compressed by more than a factor of
-five; the compressed data are only 19% of the original size. The long
-format gives the compressed file's size in bytes, instead:
-.PP
-.X "-rw-rws--- 1.5 unx 2802 t- 538 defX 11-Aug-91 13:48 perms.2660"
-.PP
-In contrast to the \fIunzip\fP listings, the compressed size figures in
-this listing format denote the complete size of compressed data, including
-the 12 extra header bytes in case of encrypted entries.
-.PP
-Adding the \fB\-T\fP option changes the file date and time to decimal
-format:
-.PP
-.X "-rw-rws--- 1.5 unx 2802 t- 538 defX 910811.134804 perms.2660"
-.PP
-Note that because of limitations in the MS-DOS format used to store file
-times, the seconds field is always rounded to the nearest even second.
-For Unix files this is expected to change in the next major releases of
-\fIzip\fP(1L) and \fIunzip\fP.
-.PP
-In addition to individual file information, a default zipfile listing
-also includes header and trailer lines:
-.PP
-.X "Archive: OS2.zip 5453 bytes 5 files"
-.X ",,rw, 1.0 hpf 730 b- i4:3 26-Jun-92 23:40 Contents"
-.X ",,rw, 1.0 hpf 3710 b- i4:3 26-Jun-92 23:33 makefile.os2"
-.X ",,rw, 1.0 hpf 8753 b- i8:3 26-Jun-92 15:29 os2unzip.c"
-.X ",,rw, 1.0 hpf 98 b- stor 21-Aug-91 15:34 unzip.def"
-.X ",,rw, 1.0 hpf 95 b- stor 21-Aug-91 17:51 zipinfo.def"
-.X "5 files, 13386 bytes uncompressed, 4951 bytes compressed: 63.0%"
-.PP
-The header line gives the name of the archive, its total size, and the
-total number of files; the trailer gives the number of files listed,
-their total uncompressed size, and their total compressed size (not
-including any of \fIzip\fP's internal overhead). If, however, one or
-more \fIfile(s)\fP are provided, the header and trailer lines are
-not listed. This behavior is also similar to that of Unix's ``\fCls \-l\fR'';
-it may be overridden by specifying the \fB\-h\fP and \fB\-t\fP options
-explicitly.
-In such a case the listing format must also be specified explicitly,
-since \fB\-h\fP or \fB\-t\fP (or both) in the absence of other options implies
-that ONLY the header or trailer line (or both) is listed. See the
-\fBEXAMPLES\fP section below for a semi-intelligible translation of this
-nonsense.
-.PP
-The verbose listing is mostly self-explanatory. It also lists file
-comments and the zipfile comment, if any, and the type and number of bytes
-in any stored extra fields. Currently known types of extra fields include
-PKWARE's authentication (``AV'') info; OS/2 extended attributes; VMS
-filesystem info, both PKWARE and Info-ZIP versions; Macintosh resource
-forks; Acorn/Archimedes SparkFS info; and so on. (Note
-that in the case of OS/2 extended attributes--perhaps the most common
-use of zipfile extra fields--the size of the stored EAs as reported by
-\fIzipinfo\fP may not match the number given by OS/2's \fIdir\fP command:
-OS/2 always reports the number of bytes required in 16-bit format, whereas
-\fIzipinfo\fP always reports the 32-bit storage.)
-.PP
-Again, the compressed size figures of the individual entries include the
-12 extra header bytes for encrypted entries. In contrast, the archive total
-compressed size and the average compression ratio shown in the summary
-bottom line are calculated \fBwithout\fP the extra 12 header bytes of
-encrypted entries.
-.PD
-.\" =========================================================================
-.SH "ENVIRONMENT OPTIONS"
-Modifying \fIzipinfo\fP's default behavior via options placed in
-an environment variable can be a bit complicated to explain, due to
-\fIzipinfo\fP's attempts to handle various defaults in an intuitive,
-yet Unix-like, manner. (Try not to laugh.) Nevertheless, there is some
-underlying logic. In brief,
-there are three ``priority levels'' of options: the default options;
-environment options, which can override or add to the defaults; and
-explicit options given by the user, which can override or add to
-either of the above.
-.PP
-The default listing format, as noted above, corresponds roughly
-to the "\fCzipinfo \-hst\fR" command (except when individual zipfile members
-are specified).
-A user who prefers the long-listing format (\fB\-l\fP) can make use of the
-\fIzipinfo\fP's environment variable to change this default:
-.TP
-Unix Bourne shell:
-\f(CW\&ZIPINFO=\-l; export ZIPINFO\fP
-.TP
-Unix C shell:
-\f(CW\&setenv ZIPINFO \-l\fP
-.TP
-OS/2 or MS-DOS:
-\f(CW\&set ZIPINFO=\-l\fP
-.TP
-VMS (quotes for \fIlowercase\fP):
-\f(CW\&define ZIPINFO_OPTS "\-l"\fP
-.EE
-.PP
-If, in addition, the user dislikes the trailer line, \fIzipinfo\fP's
-concept of ``negative options'' may be used to override the default
-inclusion of the line. This is accomplished by preceding the undesired
-option with one or more minuses: e.g., ``\fC\-l\-t\fR'' or ``\fC\-\-tl\fR'',
-in this example. The first hyphen is the regular switch character, but the
-one before the `t' is a minus sign. The dual use of hyphens may seem a
-little awkward, but it's reasonably intuitive nonetheless: simply ignore
-the first hyphen and go from there. It is also consistent with the behavior
-of the Unix command \fInice\fP(1).
-.PP
-As suggested above, the default variable names are ZIPINFO_OPTS for VMS
-(where the symbol used to install \fIzipinfo\fP as a foreign command
-would otherwise be confused with the environment variable), and ZIPINFO
-for all other operating systems. For compatibility with \fIzip\fP(1L),
-ZIPINFOOPT is also accepted (don't ask). If both ZIPINFO and ZIPINFOOPT
-are defined, however, ZIPINFO takes precedence. \fIunzip\fP's diagnostic
-option (\fB\-v\fP with no zipfile name) can be used to check the values
-of all four possible \fIunzip\fP and \fIzipinfo\fP environment variables.
-.PD
-.\" =========================================================================
-.SH EXAMPLES
-To get a basic, short-format listing of the complete contents of a ZIP
-archive \fIstorage.zip\fP, with both header and totals lines, use only
-the archive name as an argument to zipinfo:
-.PP
-.EX
-zipinfo storage
-.EE
-.PP
-To produce a basic, long-format listing (not verbose), including header and
-totals lines, use \fB\-l\fP:
-.PP
-.EX
-zipinfo \-l storage
-.EE
-.PP
-To list the complete contents of the archive without header and totals
-lines, either negate the \fB\-h\fP and \fB\-t\fP options or else specify the
-contents explicitly:
-.PP
-.EX
-zipinfo \-\-h\-t storage
-zipinfo storage \e*
-.EE
-.PP
-(where the backslash is required only if the shell would otherwise expand
-the `*' wildcard, as in Unix when globbing is turned on--double quotes around
-the asterisk would have worked as well). To turn off the totals line by
-default, use the environment variable (C shell is assumed here):
-.PP
-.EX
-setenv ZIPINFO \-\-t
-zipinfo storage
-.EE
-.PP
-To get the full, short-format listing of the first example again, given
-that the environment variable is set as in the previous example, it is
-necessary to specify the \fB\-s\fP option explicitly, since the \fB\-t\fP
-option by itself implies that ONLY the footer line is to be printed:
-.PP
-.EX
-setenv ZIPINFO \-\-t
-zipinfo \-t storage \fR[only totals line]\fP
-zipinfo \-st storage \fR[full listing]\fP
-.EE
-.PP
-The \fB\-s\fP option, like \fB\-m\fP and \fB\-l\fP, includes headers and
-footers by default, unless otherwise specified. Since the environment
-variable specified no footers and that has a higher precedence than the
-default behavior of \fB\-s\fP, an explicit \fB\-t\fP option was necessary
-to produce the full listing. Nothing was indicated about the header,
-however, so the \fB\-s\fP option was sufficient. Note that both the
-\fB\-h\fP and \fB\-t\fP options, when used by themselves or with
-each other, override any default listing of member files; only the header
-and/or footer are printed. This behavior is useful when \fIzipinfo\fP is
-used with a wildcard zipfile specification; the contents of all zipfiles
-are then summarized with a single command.
-.PP
-To list information on a single file within the archive, in medium format,
-specify the filename explicitly:
-.PP
-.EX
-zipinfo \-m storage unshrink.c
-.EE
-.PP
-The specification of any member file, as in this example, will override
-the default header and totals lines; only the single line of information
-about the requested file will be printed. This is intuitively what one
-would expect when requesting information about a single file. For multiple
-files, it is often useful to know the total compressed and uncompressed
-size; in such cases \fB\-t\fP may be specified explicitly:
-.PP
-.EX
-zipinfo \-mt storage "*.[ch]" Mak\e*
-.EE
-.PP
-To get maximal information about the ZIP archive, use the verbose
-option. It is usually wise to pipe the output into a filter such as
-Unix \fImore\fP(1) if the operating system allows it:
-.PP
-.EX
-zipinfo \-v storage | more
-.EE
-.PP
-Finally, to see the most recently modified files in the archive, use
-the \fB\-T\fP option in conjunction with an external sorting utility
-such as Unix \fIsort\fP(1) (and \fIsed\fP(1) as well, in this example):
-.PP
-.EX
-zipinfo \-T storage | sort -nr -k 7 | sed 15q
-.EE
-.PP
-The \fB\-nr\fP option to \fIsort\fP(1) tells it to sort numerically
-in reverse order rather than in textual order, and the \fB\-k\ 7\fP option
-tells it to sort on the seventh field. This
-assumes the default short-listing format; if \fB\-m\fP or \fB\-l\fP is
-used, the proper \fIsort\fP(1) option would be \fB\-k\ 8\fP.
-Older versions of \fIsort\fP(1) do not support the \fB\-k\fP option,
-but you can use the traditional \fB\+\fP option instead, e.g.,
-\fB\+6\fP instead of \fB\-k\ 7\fP. The \fIsed\fP(1)
-command filters out all but the first 15 lines of the listing. Future
-releases of \fIzipinfo\fP may incorporate date/time and filename sorting
-as built-in options.
-.PD
-.\" =========================================================================
-.SH TIPS
-The author finds it convenient to define an alias \fIii\fP for \fIzipinfo\fP
-on systems that allow aliases (or, on other systems, copy/rename the
-executable, create a link or create a command file with the name \fIii\fP).
-The \fIii\fP usage parallels the common \fIll\fP alias for long listings in
-Unix, and the similarity between the outputs of the two commands was
-intentional.
-.PD
-.\" =========================================================================
-.SH BUGS
-As with \fIunzip\fP, \fIzipinfo\fP's \fB\-M\fP (``more'') option is overly
-simplistic in its handling of screen output; as noted above, it fails to detect
-the wrapping of long lines and may thereby cause lines at the top of the screen
-to be scrolled off before being read. \fIzipinfo\fP should detect and treat
-each occurrence of line-wrap as one additional line printed. This requires
-knowledge of the screen's width as well as its height. In addition,
-\fIzipinfo\fP should detect the true screen geometry on all systems.
-.PP
-\fIzipinfo\fP's listing-format behavior is unnecessarily complex and should
-be simplified. (This is not to say that it will be.)
-.PP
-.\" =========================================================================
-.SH "SEE ALSO"
-\fIls\fP(1), \fIfunzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L),
-\fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
-.PD
-.\" =========================================================================
-.SH URL
-The Info-ZIP home page is currently at
-.EX
-\fChttp://www.info-zip.org/pub/infozip/\fR
-.EE
-or
-.EX
-\fCftp://ftp.info-zip.org/pub/infozip/\fR .
-.EE
-.PD
-.\" =========================================================================
-.SH AUTHOR
-Greg ``Cave Newt'' Roelofs. ZipInfo contains pattern-matching code
-by Mark Adler and fixes/improvements by many others. Please refer to the
-CONTRIBS file in the UnZip source distribution for a more complete list.
/*
- Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
match.) This causes "a*.*" and "a*." to behave as MS-DOS users expect.
---------------------------------------------------------------------------*/
- if ((dospattern = (char *)malloc(j+1)) != NULL) {
+ if ((dospattern = (char *)izu_malloc(j+1)) != NULL) {
strcpy(dospattern, pattern);
if (!strcmp(dospattern+j-3, "*.*")) {
dospattern[j-2] = '\0'; /* nuke the ".*" */
char *p = MBSCHR(string, '.');
if (p) { /* found a dot: match fails */
- free(dospattern);
+ izu_free(dospattern);
return 0;
}
dospattern[j-1] = '\0'; /* nuke the end "." */
}
j = recmatch((uch *)dospattern, (uch *)string, ignore_case __WDL);
- free(dospattern);
+ izu_free(dospattern);
return j == 1;
} else
#endif /* MSDOS && DOSWILD */
} /* end function iswild() */
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+int iswildw(pw) /* originally only used for stat()-bug workaround in */
+ ZCONST wchar_t *pw; /* VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */
+{ /* now used in process_zipfiles() as well */
+ for (; *pw; pw++)
+ if (*pw == '\\' && *(pw+1))
+ ++pw;
+ else if (*pw == '?' || *pw == '*' || *pw == '[')
+ return TRUE;
+
+ return FALSE;
+} /* end function iswildw() */
+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
--- /dev/null
+
+#ifdef MEMDIAG
+
+/* Memory diagnostics. Currently assume 32-bit pointer. */
+
+/* Diagnostic structure:
+ * ___ md structure ___ fill_beg store_req fill_end
+ * / siz ptr_bck ptr_fwd \
+ */
+
+#include <string.h>
+
+#define MD_FILL_BEG_SIZE 512
+#define MD_FILL_BEG_FILL 0x5a
+#define MD_FILL_END_SIZE 512
+#define MD_FILL_END_FILL 0xa5
+
+typedef struct md
+{
+ int siz;
+ struct md *bck;
+ struct md *fwd;
+} md_t, *md_ptr_t;
+
+md_t md_ht = { 0, &md_ht, &md_ht };
+
+
+void izu_md_check( void)
+{
+ md_ptr_t mdp;
+ int i;
+ int idd = 0;
+
+ mdp = &md_ht;
+ while ((mdp = mdp->fwd) != &md_ht)
+ {
+ /* md fill_beg store_req fill_end */
+
+ /* Verify contents of beginning fill region. */
+ for (i = 0; i < MD_FILL_BEG_SIZE; i++)
+ {
+ if (((unsigned char *)((unsigned char *)mdp)+ (sizeof md_ht))[ i] !=
+ MD_FILL_BEG_FILL)
+ {
+ if (idd == 0)
+ {
+ idd = 1;
+ fprintf( stderr, " mdp = %08x , siz = %8ld.\n", mdp, mdp->siz);
+ }
+ fprintf( stderr, " bf[%d] = %02x.\n",
+ i,
+ ((unsigned char *)((unsigned char *)mdp)+ (sizeof md_ht))[ i]);
+ }
+ }
+
+ /* Verify contents of ending fill region. */
+ for (i = 0; i < MD_FILL_END_SIZE; i++)
+ {
+ if (((unsigned char *)((unsigned char *)mdp)+ (sizeof md_ht)+
+ MD_FILL_BEG_SIZE+ mdp->siz)[ i] != MD_FILL_END_FILL)
+ {
+ if (idd == 0)
+ {
+ idd = 1;
+ fprintf( stderr, " mdp = %08x , siz = %8ld.\n", mdp, mdp->siz);
+ }
+ fprintf( stderr, " ef[%d] = %02x.\n",
+ i,
+ ((unsigned char *)((unsigned char *)mdp)+ (sizeof md_ht)+
+ MD_FILL_BEG_SIZE+ mdp->siz)[ i]);
+ }
+ }
+ }
+}
+
+
+void izu_free( void *ptr)
+{
+ md_ptr_t mdp;
+
+ /* md fill_beg store_req fill_end */
+
+ mdp = (md_ptr_t)(((unsigned char *)ptr)- (sizeof md_ht)- MD_FILL_BEG_SIZE);
+
+ fprintf( stderr, "<MD> f %8ld %08x (act: %08x)\n", mdp->siz, ptr, mdp);
+
+ izu_md_check(); /* Check before work. */
+
+ mdp->bck->fwd = mdp->fwd; /* Re-link forward. */
+ mdp->fwd->bck = mdp->bck; /* Re-link backward. */
+
+ free( mdp);
+
+ fprintf( stderr, "<MD> F\n");
+}
+
+
+void *izu_malloc( size_t siz)
+{
+ md_ptr_t mdp;
+ size_t siz2;
+ void *ptr;
+
+ fprintf( stderr, "<MD> m %8ld\n", siz);
+
+ izu_md_check(); /* Check before work. */
+
+ siz2 = (sizeof md_ht)+ MD_FILL_BEG_SIZE+ siz+ MD_FILL_END_SIZE;
+ mdp = malloc( siz2);
+
+ /* Add new member at tail. */
+ mdp->bck = md_ht.bck; /* New backward link = Old tail. */
+ md_ht.bck->fwd = mdp; /* Old tail forward link = New. */
+ md_ht.bck = mdp; /* Tail = New. */
+ mdp->fwd = &md_ht; /* New forward link = Tail. */
+ mdp->siz = siz; /* New size. */
+
+ /* md fill_beg store_req fill_end */
+
+ /* Set beginning and ending fill regions. */
+ memset( ((unsigned char *)mdp+ (sizeof md_ht)),
+ MD_FILL_BEG_FILL, MD_FILL_BEG_SIZE);
+ memset( ((unsigned char *)mdp+ (sizeof md_ht)+ MD_FILL_BEG_SIZE+ siz),
+ MD_FILL_END_FILL, MD_FILL_END_SIZE);
+
+ /* Public pointer. */
+ ptr = (unsigned char *)mdp+ (sizeof md_ht)+ MD_FILL_BEG_SIZE;
+
+ fprintf( stderr, "<MD> M %8ld %08x (act: %8ld %08x)\n",
+ siz, ptr, siz2, mdp);
+
+ return ptr;
+}
+
+
+void *izu_realloc( void* ptr, size_t siz)
+{
+ void *ptr2;
+ size_t siz2;
+ md_ptr_t mdp;
+
+ /* md fill_beg store_req fill_end */
+
+ mdp = (md_ptr_t)(((unsigned char *)ptr)- (sizeof md_ht)- MD_FILL_BEG_SIZE);
+ siz2 = (sizeof md_ht)+ MD_FILL_BEG_SIZE+ siz+ MD_FILL_END_SIZE;
+
+ fprintf( stderr, "<MD> r %08x %8ld (act:%08x %ld)\n",
+ ptr, siz, mdp, siz2);
+
+ izu_md_check(); /* Check before work. */
+
+ ptr2 = realloc( mdp, siz2);
+
+ if (ptr2 == mdp)
+ {
+ /* No pointer change. */
+ fprintf( stderr, "<MD> R %08x (%c=) (act: %08x) %8ld\n",
+ ptr, '=', ptr2, siz);
+ }
+ else
+ {
+ /* Pointer changed. Calculate new public pointer. */
+ ptr = (unsigned char *)mdp+ (sizeof md_ht)+ MD_FILL_BEG_SIZE;
+
+ fprintf( stderr, "<MD> R %08x (%c=) (act: %08x) %8ld\n",
+ ptr, '!', ptr2, siz);
+
+ mdp->bck->fwd = ptr2; /* Forward pointer to new. */
+ mdp->fwd->bck = ptr2; /* Backward pointer to new. */
+ ((md_ptr_t)ptr2)->bck = mdp->bck; /* New backward pointer. */
+ ((md_ptr_t)ptr2)->fwd = mdp->fwd; /* New forward pointer. */
+ mdp = ptr2;
+ }
+
+ /* Set (new?) ending fill region. */
+ memset( ((unsigned char *)mdp+ (sizeof md_ht)+ MD_FILL_BEG_SIZE+ siz),
+ MD_FILL_END_FILL, MD_FILL_END_SIZE);
+
+ mdp->siz = siz; /* New size. */
+
+ return ptr;
+}
+
+#endif /* def MEMDIAG */
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2012 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.
/* for MSC 5.1, prevent macro expansion space overflow in DEBUG mode */
# define NO_DEBUG_IN_MACROS
# endif
-# ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
# if (defined(M_I86TM) || defined(M_I86SM) || defined(M_I86MM))
# error Deflate64(tm) requires compact or large memory model
# endif
/* the 64k history buffer for Deflate64 must be allocated specially */
# define MALLOC_WORK
# define MY_ZCALLOC
-# endif
+# endif /* def DEFLATE64_SUPPORT */
#endif
/* 32-bit MSDOS supports the 32-bit optimized CRC-32 C code */
# Makefile for Info-ZIP's UnZip, UnZipSFX and fUnZip using DJGPP v2.01 or
-# higher, by Frank Donahoe. Last updated: 21 Jul 2008
+# higher, by Frank Donahoe. Last updated: 16 Jan 2012
# This Makefile is specifically tailored for GNU make and GNU C and
# may not work with a generic Unix-compatible make utility. The latest
IZ_BZIP2 = bzip2
ifdef USEBZ2
INC_BZ2LIB = -I$(IZ_BZIP2)
-LOCAL_UNZIP:=-DUSE_BZIP2 $(LOCAL_UNZIP)
+LOCAL_UNZIP:=-DBZIP2_SUPPORT $(LOCAL_UNZIP)
LD_BZ2LIB = -L$(IZ_BZIP2) -lbz2
LIBBZIP2 = $(IZ_BZIP2)/libbz2.a
else
IZ_BZIP2 = bzip2
!ifdef USEBZ2
!ifdef PM
-cvars = $+$(cvars)$- -DUSE_BZIP2 -I$(IZ_BZIP2)
+cvars = $+$(cvars)$- -DBZIP2_SUPPORT -I$(IZ_BZIP2)
bz2errob = $(O)ubz2err.obj
bz2errox = $(O)ubz2err.obj
BZIPLIB = $(IZ_BZIP2)/$(OBDIR)/bz2.lib
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
static ZCONST char Far Creating[] = " creating: %s\n";
static ZCONST char Far ConversionFailed[] =
"mapname: conversion of %s failed\n";
-static ZCONST char Far Labelling[] = "labelling %c: %-22s\n";
+static ZCONST char Far Labeling[] = "labeling %c: %-22s\n";
static ZCONST char Far ErrSetVolLabel[] =
"mapname: error setting volume label\n";
static ZCONST char Far PathTooLong[] = "checkdir error: path too long: %s\n";
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
if (!renamed) { /* cp already set if renamed */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
}
/*---------------------------------------------------------------------------
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
#ifndef MAYBE_PLAIN_FAT
pp = lastsemi + 1;
#else
pp = lastsemi; /* semi-colon was omitted: expect all #'s */
# endif
#endif
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
#ifdef MAYBE_PLAIN_FAT
if (G.pInfo->vollabel) { /* set the volume label now */
if (QCOND2)
- Info(slide, 0, ((char *)slide, LoadFarString(Labelling),
+ Info(slide, 0, ((char *)slide, LoadFarString(Labeling),
(nLabelDrive + 'a' - 1),
FnFilter1(G.filename)));
if (volumelabel(G.filename)) {
char *plu = strrchr(pathcomp, '_'); /* pointer to last underscore */
if ((plu != (char *)NULL) && /* found underscore: convert to dot? */
- (MIN(plu - pathcomp, 8) + MIN(pEnd - plu - 1, 3) > 8)) {
+ (IZ_MIN(plu - pathcomp, 8) + IZ_MIN(pEnd - plu - 1, 3) > 8)) {
last_dot = plu; /* be lazy: drop through to next if-block */
} else if ((pEnd - pathcomp) > 8)
/* no underscore; or converting underscore to dot would save less
(unsigned int)(sregs.ds),
(unsigned int)(WREGS(regs,dx))));
Trace((stderr, "&fcb = %lx, pfcb = %lx\n", (ulg)&fcb, (ulg)pfcb));
- Trace((stderr, "(2nd check: labelling drive %c:)\n", pfcb->drive-1+'A'));
+ Trace((stderr, "(2nd check: labeling drive %c:)\n", pfcb->drive-1+'A'));
if (pfcb->flag != fcb.flag)
fprintf(stderr, "error: pfcb->flag = %d, fcb.flag = %d\n",
pfcb->flag, fcb.flag);
F_intdosx(®s, ®s, &sregs);
/*---------------------------------------------------------------------------
- If not previously labelled, write a new label. Otherwise just rename,
+ If not previously labeled, write a new label. Otherwise just rename,
since MS-DOS 2.x has a bug that damages the FAT when the old label is
deleted.
---------------------------------------------------------------------------*/
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2007-Mar-04 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
#ifdef ACORN_FTYPE_NFS
+++ /dev/null
-diff -ru2 unz60e03/unzip.c u6e3_np/unzip.c
---- unz60e03/unzip.c Wed Mar 19 13:08:38 2008
-+++ u6e3_np/unzip.c Mon Mar 24 14:16:58 2008
-@@ -128,4 +128,6 @@
- "error: command line parameter #%d exceeds internal size limit\n";
- #endif /* !SFX */
-+static ZCONST char Far NoMemArgsList[] =
-+ "error: no memory for arguments list";
-
- #if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
-@@ -245,5 +247,5 @@
- static ZCONST char Far local3[] = "\
- -Y treat \".nnn\" as \";nnn\" version -2 force ODS2 names\n\
-- --D restore dir (-D: no) timestamps -M pipe through \"more\" pager\n\
-+ -D- restore dir (-D: no) timestamps -M pipe through \"more\" pager\n\
- (Must quote upper-case options, like \"-V\", unless SET PROC/PARSE=EXTEND.)\
- \n\n";
-@@ -251,5 +253,5 @@
- static ZCONST char Far local3[] = "\n\
- -Y treat \".nnn\" as \";nnn\" version -2 force ODS2 names\n\
-- --D restore dir (-D: no) timestamps\n\
-+ -D- restore dir (-D: no) timestamps\n\
- (Must quote upper-case options, like \"-V\", unless SET PROC/PARSE=EXTEND.)\
- \n\n";
-@@ -694,5 +696,5 @@
- char *p;
- #endif
--#if (defined(DOS_FLX_H68_NLM_OS2_W32) || !defined(SFX))
-+#if ((defined(WIN32) && defined(__RSXNT__)) || !defined(SFX))
- int i;
- #endif
-@@ -1053,4 +1055,45 @@
- * 'forward slashes' for user's convenience (include zipfile name itself)
- */
-+ {
-+ /* pfnames */
-+
-+ char **names;
-+
-+ for (names = G.pfnames; *names; names++) {
-+#ifdef __human68k__
-+ extern char *_toslash(char *);
-+ _toslash(*names);
-+#else /* !__human68k__ */
-+ char *q = *names;
-+
-+ while (*q != '\0') {
-+ if (*q == '\\')
-+ *q = '/';
-+ INCSTR(q);
-+ }
-+#endif /* ?__human68k__ */
-+ }
-+ }
-+ {
-+ /* G.wildzipfn */
-+
-+#ifdef __human68k__
-+ extern char *_toslash(char *);
-+ _toslash(*G.wildzipfn);
-+#else /* !__human68k__ */
-+ char *q = G.wildzipfn;
-+
-+ while (*q != '\0') {
-+ if (*q == '\\')
-+ *q = '/';
-+ INCSTR(q);
-+ }
-+#endif /* ?__human68k__ */
-+ }
-+#endif /* DOS_FLX_H68_NLM_OS2_W32 */
-+
-+
-+#if 0
-+#ifdef DOS_FLX_H68_NLM_OS2_W32
- #ifdef SFX
- for (G.pfnames = argv, i = argc; i > 0; --i) {
-@@ -1074,11 +1117,18 @@
- }
- #endif /* DOS_FLX_H68_NLM_OS2_W32 */
-+#endif /* 0 */
-
-+/*
- #ifndef SFX
- G.wildzipfn = *argv++;
- #endif
-+*/
-
- #if (defined(SFX) && !defined(SFX_EXDIR)) /* only check for -x */
-
-+# if 0
-+ /* all this should be done in the options call now */
-+
-+
- G.filespecs = argc;
- G.xfilespecs = 0;
-@@ -1104,7 +1154,10 @@
- } else
- G.process_all_files = TRUE; /* for speed */
-+# endif
-
- #else /* !SFX || SFX_EXDIR */ /* check for -x or -d */
-
-+# if 0
-+
- G.filespecs = argc;
- G.xfilespecs = 0;
-@@ -1118,9 +1171,9 @@
- while (*++pp) {
- Trace((stderr, "pp - argv = %d\n", pp-argv));
--#ifdef CMS_MVS
-+# ifdef CMS_MVS
- if (!uO.exdir && STRNICMP(*pp, "-d", 2) == 0) {
--#else
-+# else
- if (!uO.exdir && strncmp(*pp, "-d", 2) == 0) {
--#endif
-+# endif
- int firstarg = (pp == argv);
-
-@@ -1177,4 +1230,5 @@
- } else
- G.process_all_files = TRUE; /* for speed */
-+# endif
-
- if (uO.exdir != (char *)NULL && !G.extract_flag) /* -d ignored */
-@@ -1260,4 +1314,269 @@
-
-
-+/*
-+ -------------------------------------------------------
-+ Command Line Options
-+ -------------------------------------------------------
-+
-+ Valid command line options.
-+
-+ The function get_option() uses this table to check if an
-+ option is valid and if it takes a value (also called an
-+ option parameter). To add an option to unzip just add it
-+ to this table and add a case in the main switch to handle
-+ it. If either shortopt or longopt not used set to "".
-+
-+ The fields:
-+ option_group - UZO for UnZip option, ZIO for ZipInfo option
-+ shortopt - short option name (1 or 2 chars)
-+ longopt - long option name
-+ value_type - see zip.h for constants
-+ negatable - option is negatable with trailing -
-+ ID - unsigned long int returned for option
-+ name - short description of option which is
-+ returned on some errors and when options
-+ are listed with -so option, can be NULL
-+*/
-+
-+/* Most option IDs are set to the shortopt char. For
-+ multichar short options set to arbitrary unused constant. */
-+#define o_so 0x101
-+
-+
-+/* The below is from the old main command line code with a few changes.
-+ Note that UnZip and ZipInfo filter out their own options based on the
-+ option_group value, so the same option letter can be used for both. */
-+
-+static struct option_struct far options[] = {
-+
-+ /* UnZip options */
-+
-+ /* short longopt value_type negatable
-+ ID name */
-+#ifdef RISCOS
-+ {UZO, "/", "", o_REQUIRED_VALUE, o_NEGATABLE,
-+ '/', "override Unzip$Exts"},
-+#endif
-+ {UZO, "a", "", o_NO_VALUE, o_NEGATABLE,
-+ 'a', "text conv (EOL char, ASCII->EBCDIC"},
-+#if (defined(DLL) && defined(API_DOC))
-+ {UZO, "A", "", o_NO_VALUE, o_NEGATABLE,
-+ 'A', "extended help for API"},
-+#endif
-+ {UZO, "b", "", o_NO_VALUE, o_NEGATABLE,
-+ 'b', "binary, no ASCII conversions"},
-+#ifdef UNIXBACKUP
-+ {UZO, "B", "", o_NO_VALUE, o_NEGATABLE,
-+ 'B', "back up existing files"},
-+#endif
-+#ifdef CMS_MVS
-+ {UZO, "B", "", o_NO_VALUE, o_NEGATABLE,
-+ 'b', "CMS/MVS binary"},
-+#endif
-+ {UZO, "c", "", o_NO_VALUE, o_NEGATABLE,
-+ 'c', "output to stdout"},
-+#ifdef CMS_MVS
-+ /* for CMS_MVS map to lower case */
-+ {UZO, "C", "", o_NO_VALUE, o_NEGATABLE,
-+ 'C', "CMS/MVS lower case"},
-+#endif
-+#if (!defined(SFX) || defined(SFX_EXDIR))
-+ {UZO, "d", "", o_REQUIRED_VALUE, o_NEGATABLE,
-+ 'd', "extraction root directory"},
-+#endif
-+#if (!defined(NO_TIMESTAMPS))
-+ {UZO, "D", "", o_NO_VALUE, o_NEGATABLE,
-+ 'D', "don't restore dir (-DD: any) timestamps"},
-+#endif
-+ {UZO, "e", "", o_NO_VALUE, o_NEGATABLE,
-+ 'e', "extract (not used?)"},
-+#ifdef MACOS
-+ {UZO, "E", "", o_NO_VALUE, o_NEGATABLE,
-+ 'E', "display Mac e.f. when restoring"},
-+#endif
-+ {UZO, "f", "", o_NO_VALUE, o_NEGATABLE,
-+ 'f', "freshen (extract only newer files)"},
-+#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
-+ {UZO, "F", "", o_NO_VALUE, o_NEGATABLE,
-+ 'F', "Acorn filetype & NFS extension handling"},
-+#endif
-+ {UZO, "h", "", o_NO_VALUE, o_NOT_NEGATABLE,
-+ 'h', "help"},
-+#ifdef MACOS
-+ {UZO, "i", "", o_NO_VALUE, o_NEGATABLE,
-+ 'i', "ignore filenames stored in Mac ef"},
-+#endif
-+ {UZO, "j", "", o_NO_VALUE, o_NEGATABLE,
-+ 'j', "junk directories, extract names only"},
-+#if (defined(ATH_BEO) || defined(MACOS))
-+ {UZO, "J", "", o_NO_VALUE, o_NEGATABLE,
-+ 'J', "Junk AtheOS, BeOS or MacOS file attrs"},
-+#endif
-+#ifdef ATH_BEO_UNX
-+ {UZO, "K", "", o_NO_VALUE, o_NEGATABLE,
-+ 'K', "retain SUID/SGID/Tacky attrs"},
-+#endif
-+#ifndef SFX
-+ {UZO, "l", "", o_NO_VALUE, o_NEGATABLE,
-+ 'l', "listing verbosity"},
-+#endif
-+#ifndef CMS_MVS
-+ {UZO, "L", "", o_NO_VALUE, o_NEGATABLE,
-+ 'L', "convert (some) names to lower"},
-+#endif
-+#ifdef MORE
-+# ifdef CMS_MVS
-+ {UZO, "m", "", o_NO_VALUE, o_NEGATABLE,
-+ 'm', "pipe output through more"},
-+# endif
-+ {UZO, "M", "", o_NO_VALUE, o_NEGATABLE,
-+ 'M', "pipe output through more"},
-+#endif /* MORE */
-+ {UZO, "n", "", o_NO_VALUE, o_NEGATABLE,
-+ 'n', "never overwrite files (no prompting)"},
-+#ifdef AMIGA
-+ {UZO, "N", "", o_NO_VALUE, o_NEGATABLE,
-+ 'N', "restore comments as filenotes"},
-+#endif
-+ {UZO, "o", "", o_NO_VALUE, o_NEGATABLE,
-+ 'o', "overwrite files without prompting"},
-+ {UZO, "p", "", o_NO_VALUE, o_NEGATABLE,
-+ 'p', "pipe extraction to stdout, no messages"},
-+#if CRYPT
-+ {UZO, "P", "", o_REQUIRED_VALUE, o_NEGATABLE,
-+ 'P', "password"},
-+#endif
-+ {UZO, "q", "", o_NO_VALUE, o_NEGATABLE,
-+ 'q', "quiet"},
-+#ifdef QDOS
-+ {UZO, "Q", "", o_NO_VALUE, o_NEGATABLE,
-+ 'Q', "QDOS flags"},
-+#endif
-+#ifdef TANDEM
-+ {UZO, "r", "", o_NO_VALUE, o_NEGATABLE,
-+ 'r', "remove file extensions"},
-+#endif
-+#ifdef DOS_FLX_NLM_OS2_W32
-+ {UZO, "s", "", o_NO_VALUE, o_NEGATABLE,
-+ 's', "spaces to underscores"},
-+#endif
-+#ifdef VMS
-+ {UZO, "S", "", o_NO_VALUE, o_NEGATABLE,
-+ 'S', "VMS extract text as Stream LF"},
-+#endif
-+ {UZO, "t", "", o_NO_VALUE, o_NEGATABLE,
-+ 't', "test"},
-+#ifdef TIMESTAMP
-+ {UZO, "T", "", o_NO_VALUE, o_NEGATABLE,
-+ 'T', "timestamps"},
-+#endif
-+ {UZO, "u", "", o_NO_VALUE, o_NEGATABLE,
-+ 'u', "update (extract only new/newer files)"},
-+#ifdef UNICODE_SUPPORT
-+ {UZO, "U", "", o_NO_VALUE, o_NEGATABLE,
-+ 'U', "escape non-ASCII Unicode, disable Unicode"},
-+#else /* !UNICODE_SUPPORT */
-+# ifndef CMS_MVS
-+ {UZO, "U", "", o_NO_VALUE, o_NEGATABLE,
-+ 'U', "names to lower case"},
-+# endif /* !CMS_MVS */
-+#endif /* ?UNICODE_SUPPORT */
-+#ifndef SFX
-+ {UZO, "v", "", o_NO_VALUE, o_NEGATABLE,
-+ 'v', "verbose"},
-+#endif
-+#ifndef CMS_MVS
-+ {UZO, "V", "", o_NO_VALUE, o_NEGATABLE,
-+ 'V', "don't strip VMS version numbers"},
-+#endif
-+#ifdef WILD_STOP_AT_DIR
-+ {UZO, "W", "", o_NO_VALUE, o_NEGATABLE,
-+ 'W', "wildcard * doesn't span /"},
-+#endif
-+ {UZO, "x", "", o_VALUE_LIST, o_NOT_NEGATABLE,
-+ 'x', "exclude this list of files"},
-+#if (defined(RESTORE_UIDGID) || defined(RESTORE_ACL))
-+ {UZO, "X", "", o_NO_VALUE, o_NEGATABLE,
-+ 'X', "restore owner/prot or UID/GID or ACLs"},
-+#endif
-+#ifdef VMS
-+ {UZO, "Y", "", o_NO_VALUE, o_NEGATABLE,
-+ 'Y', "VMS treat .nnn as ;nnn version"},
-+#endif
-+ {UZO, "z", "", o_NO_VALUE, o_NEGATABLE,
-+ 'z', "display zipfile comment"},
-+#ifndef SFX
-+ {UZO, "Z", "", o_NO_VALUE, o_NOT_NEGATABLE,
-+ 'Z', "ZipInfo mode"},
-+#endif
-+#ifdef VMS
-+ {UZO, "2", "", o_NO_VALUE, o_NEGATABLE,
-+ '2', "Force ODS2-compliant names."},
-+#endif
-+#ifdef DOS_H68_OS2_W32
-+ {UZO, "$", "", o_NO_VALUE, o_NEGATABLE,
-+ '$', "extract volume labels"},
-+#endif
-+#if (!defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM))
-+ {UZO, ":", "", o_NO_VALUE, o_NEGATABLE,
-+ ':', "don't skip ../ path elements"},
-+#endif
-+#ifdef UNIX
-+ {UZO, "^", "", o_NO_VALUE, o_NEGATABLE,
-+ '^', "allow control chars in filenames"},
-+#endif
-+
-+#ifndef NO_ZIPINFO
-+ /* ZipInfo options */
-+
-+ /* short longopt value_type negatable
-+ ID name (help text) */
-+ {ZIO, "1", "", o_NO_VALUE, o_NEGATABLE,
-+ '1', "shortest list"},
-+ {ZIO, "2", "", o_NO_VALUE, o_NEGATABLE,
-+ '2', "names and headers"},
-+#ifndef CMS_MVS
-+ {ZIO, "C", "", o_NO_VALUE, o_NEGATABLE,
-+ 'C', "ignore case"},
-+#endif
-+ {ZIO, "h", "", o_NO_VALUE, o_NEGATABLE,
-+ 'h', "header line"},
-+ {ZIO, "l", "", o_NO_VALUE, o_NEGATABLE,
-+ 'l', "longer listing"},
-+ {ZIO, "m", "", o_NO_VALUE, o_NEGATABLE,
-+ 'm', "medium listing"},
-+#ifdef MORE
-+ {ZIO, "M", "", o_NO_VALUE, o_NEGATABLE,
-+ 'M', "output like more"},
-+#endif
-+ {ZIO, "s", "", o_NO_VALUE, o_NEGATABLE,
-+ 's', "shorter list"},
-+ {ZIO, "t", "", o_NO_VALUE, o_NEGATABLE,
-+ 't', "totals line"},
-+ {ZIO, "T", "", o_NO_VALUE, o_NEGATABLE,
-+ 'T', "decimal time format"},
-+#ifdef UNICODE_SUPPORT
-+ {ZIO, "U", "", o_NO_VALUE, o_NEGATABLE,
-+ 'U', "escape non-ASCII Unicode, disable Unicode"},
-+#endif
-+ {ZIO, "v", "", o_NO_VALUE, o_NEGATABLE,
-+ 'v', "turbo-verbose listing"},
-+#ifdef WILD_STOP_AT_DIR
-+ {ZIO, "W", "", o_NO_VALUE, o_NEGATABLE,
-+ 'W', "wild stop at /"},
-+#endif
-+ {ZIO, "x", "", o_VALUE_LIST, o_NOT_NEGATABLE,
-+ 'x', "exclude this list of files"},
-+ {ZIO, "z", "", o_NO_VALUE, o_NEGATABLE,
-+ 'z', "print zipfile comment"},
-+ {ZIO, "Z", "", o_NO_VALUE, o_NEGATABLE,
-+ 'Z', "ZipInfo mode"},
-+#endif /* !NO_ZIPINFO */
-+
-+ /* the end of the list */
-+ {0, NULL, NULL, o_NO_VALUE, o_NOT_NEGATABLE,
-+ 0, NULL} /* end has option_ID = 0 */
-+ };
-+
-
-
-@@ -1271,502 +1590,649 @@
- char ***pargv;
- {
-- char **argv, *s;
-- int argc, c, error=FALSE, negative=0;
-+ char **args;
-+ int argc, error=FALSE;
-
-+ /* used by get_option */
-+ unsigned long option; /* option ID returned by get_option */
-+ int argcnt = 0; /* current argcnt in args */
-+ int argnum = 0; /* arg number */
-+ int optchar = 0; /* option state */
-+ char *value = NULL; /* non-option arg, option value or NULL */
-+ int negative = 0; /* 1 = option negated */
-+ int fna = 0; /* current first non-opt arg */
-+ int optnum = 0; /* index in table */
-
-- argc = *pargc;
-- argv = *pargv;
-
-- while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) {
-- s = *argv + 1;
-- while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */
--#ifdef CMS_MVS
-- switch (tolower(c))
--#else
-- switch (c)
--#endif
-- {
-- case ('-'):
-- ++negative;
-- break;
-+ /* since get_option() returns xfiles and files one at a time, store them
-+ in linked lists until have them all */
-+
-+ int file_count = 0;
-+ struct file_list *next_file;
-+
-+ /* files to extract */
-+ int in_files_count = 0;
-+ struct file_list *in_files = NULL;
-+ struct file_list *next_in_files = NULL;
-+
-+ /* files to exclude in -x list */
-+ int in_xfiles_count = 0;
-+ struct file_list *in_xfiles = NULL;
-+ struct file_list *next_in_xfiles = NULL;
-+
-+ G.wildzipfn = NULL;
-+
-+ /* make copy of args that can use with insert_arg() used by get_option() */
-+ args = copy_args(*pargv, 0);
-+
-+
-+ /* Initialize lists */
-+ G.filespecs = 0;
-+ G.xfilespecs = 0;
-+
-+
-+ /*
-+ -------------------------------------------
-+ Process command line using get_option
-+ -------------------------------------------
-+
-+ Each call to get_option() returns either a command
-+ line option and possible value or a non-option argument.
-+ Arguments are permuted so that all options (-r, -b temp)
-+ are returned before non-option arguments (zipfile).
-+ Returns 0 when nothing left to read.
-+ */
-+
-+ /* set argnum = 0 on first call to init get_option */
-+ argnum = 0;
-+
-+ /* get_option returns the option ID and updates parameters:
-+ args - usually same as argv if no argument file support
-+ argcnt - current argc for args
-+ value - char* to value (free() when done with it) or NULL if none
-+ negated - option was negated with trailing -
-+ */
-+
-+ while ((option = get_option(UZO, &args, &argcnt, &argnum,
-+ &optchar, &value, &negative,
-+ &fna, &optnum, 0)))
-+ {
-+ if(option == o_BAD_ERR) {
-+ return(PK_PARAM);
-+ }
-+
-+ switch (option)
-+ {
- #ifdef RISCOS
-- case ('/'):
-- if (negative) { /* negative not allowed with -/ swap */
-- Info(slide, 0x401, ((char *)slide,
-- "error: must give extensions list"));
-- return(PK_PARAM); /* don't extract here by accident */
-- }
-- exts2swap = s; /* override Unzip$Exts */
-- s += strlen(s);
-- break;
--#endif
-- case ('a'):
-- if (negative) {
-- uO.aflag = MAX(uO.aflag-negative,0);
-- negative = 0;
-- } else
-- ++uO.aflag;
-- break;
-+ case ('/'):
-+ if (negative) { /* negative not allowed with -/ swap */
-+ Info(slide, 0x401, ((char *)slide,
-+ "error: must give extensions list"));
-+ return(PK_PARAM); /* don't extract here by accident */
-+ }
-+ exts2swap = value; /* override Unzip$Exts */
-+ break;
-+#endif
-+ case ('a'):
-+ if (negative) {
-+ uO.aflag = MAX(uO.aflag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.aflag;
-+ break;
- #if (defined(DLL) && defined(API_DOC))
-- case ('A'): /* extended help for API */
-- APIhelp(__G__ argc, argv);
-- *pargc = -1; /* signal to exit successfully */
-- return 0;
-+ case ('A'): /* extended help for API */
-+ APIhelp(__G__ argc, args);
-+ *pargc = -1; /* signal to exit successfully */
-+ return 0;
- #endif
-- case ('b'):
-- if (negative) {
-+ case ('b'):
-+ if (negative) {
- #if (defined(TANDEM) || defined(VMS))
-- uO.bflag = MAX(uO.bflag-negative,0);
-+ uO.bflag = MAX(uO.bflag-negative,0);
- #endif
-- negative = 0; /* do nothing: "-b" is default */
-- } else {
-+ negative = 0; /* do nothing: "-b" is default */
-+ } else {
- #ifdef VMS
-- if (uO.aflag == 0)
-- ++uO.bflag;
-+ if (uO.aflag == 0)
-+ ++uO.bflag;
- #endif
- #ifdef TANDEM
-- ++uO.bflag;
-+ ++uO.bflag;
- #endif
-- uO.aflag = 0;
-- }
-- break;
-+ uO.aflag = 0;
-+ }
-+ break;
- #ifdef UNIXBACKUP
-- case ('B'): /* -B: back up existing files */
-- if (negative)
-- uO.B_flag = FALSE, negative = 0;
-- else
-- uO.B_flag = TRUE;
-- break;
--#endif
-- case ('c'):
-- if (negative) {
-- uO.cflag = FALSE, negative = 0;
-+ case ('B'): /* -B: back up existing files */
-+ if (negative)
-+ uO.B_flag = FALSE, negative = 0;
-+ else
-+ uO.B_flag = TRUE;
-+ break;
-+#endif
-+ case ('c'):
-+ if (negative) {
-+ uO.cflag = FALSE, negative = 0;
- #ifdef NATIVE
-- uO.aflag = 0;
-+ uO.aflag = 0;
- #endif
-- } else {
-- uO.cflag = TRUE;
-+ } else {
-+ uO.cflag = TRUE;
- #ifdef NATIVE
-- uO.aflag = 2; /* so you can read it on the screen */
-+ uO.aflag = 2; /* so you can read it on the screen */
- #endif
- #ifdef DLL
-- if (G.redirect_text)
-- G.redirect_data = 2;
-+ if (G.redirect_text)
-+ G.redirect_data = 2;
- #endif
-- }
-- break;
-+ }
-+ break;
- #ifndef CMS_MVS
-- case ('C'): /* -C: match filenames case-insensitively */
-- if (negative)
-- uO.C_flag = FALSE, negative = 0;
-- else
-- uO.C_flag = TRUE;
-- break;
-+ case ('C'): /* -C: match filenames case-insensitively */
-+ if (negative)
-+ uO.C_flag = FALSE, negative = 0;
-+ else
-+ uO.C_flag = TRUE;
-+ break;
- #endif /* !CMS_MVS */
- #if (!defined(SFX) || defined(SFX_EXDIR))
-- case ('d'):
-- if (negative) { /* negative not allowed with -d exdir */
-+ case ('d'):
-+ if (negative) { /* negative not allowed with -d exdir */
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(MustGiveExdir)));
-+ return(PK_PARAM); /* don't extract here by accident */
-+ }
-+ if (uO.exdir != (char *)NULL) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(OnlyOneExdir)));
-+ return(PK_PARAM); /* GRR: stupid restriction? */
-+ } else {
-+ /* first check for "-dexdir", then for "-d exdir" */
-+ uO.exdir = value;
-+ if (uO.exdir == NULL || *uO.exdir == '\0') {
- Info(slide, 0x401, ((char *)slide,
- LoadFarString(MustGiveExdir)));
-- return(PK_PARAM); /* don't extract here by accident */
-- }
-- if (uO.exdir != (char *)NULL) {
-- Info(slide, 0x401, ((char *)slide,
-- LoadFarString(OnlyOneExdir)));
-- return(PK_PARAM); /* GRR: stupid restriction? */
-- } else {
-- /* first check for "-dexdir", then for "-d exdir" */
-- uO.exdir = s;
-- if (*uO.exdir == '\0') {
-- if (argc > 1) {
-- --argc;
-- uO.exdir = *++argv;
-- if (*uO.exdir == '-') {
-- Info(slide, 0x401, ((char *)slide,
-- LoadFarString(MustGiveExdir)));
-- return(PK_PARAM);
-- }
-- /* else uO.exdir points at extraction dir */
-- } else {
-- Info(slide, 0x401, ((char *)slide,
-- LoadFarString(MustGiveExdir)));
-- return(PK_PARAM);
-- }
-- }
-- /* uO.exdir now points at extraction dir (-dexdir or
-- * -d exdir); point s at end of exdir to avoid mis-
-- * interpretation of exdir characters as more options
-- */
-- if (*s != 0)
-- while (*++s != 0)
-- ;
-+ return(PK_PARAM);
- }
-- break;
-+ /* else uO.exdir points at extraction dir */
-+ }
-+ break;
- #endif /* !SFX || SFX_EXDIR */
- #if (!defined(NO_TIMESTAMPS))
-- case ('D'): /* -D: Skip restoring dir (or any) timestamp. */
-- if (negative) {
-- uO.D_flag = MAX(uO.D_flag-negative,0);
-- negative = 0;
-- } else
-- uO.D_flag++;
-- break;
-+ case ('D'): /* -D: Skip restoring dir (or any) timestamp. */
-+ if (negative) {
-+ uO.D_flag = MAX(uO.D_flag-negative,0);
-+ negative = 0;
-+ } else
-+ uO.D_flag++;
-+ break;
- #endif /* (!NO_TIMESTAMPS) */
-- case ('e'): /* just ignore -e, -x options (extract) */
-- break;
-+ case ('e'): /* just ignore -e, -x options (extract) */
-+ break;
- #ifdef MACOS
-- case ('E'): /* -E [MacOS] display Mac e.f. when restoring */
-- if( negative ) {
-- uO.E_flag = FALSE, negative = 0;
-- } else {
-- uO.E_flag = TRUE;
-- }
-- break;
-+ case ('E'): /* -E [MacOS] display Mac e.f. when restoring */
-+ if( negative ) {
-+ uO.E_flag = FALSE, negative = 0;
-+ } else {
-+ uO.E_flag = TRUE;
-+ }
-+ break;
- #endif /* MACOS */
-- case ('f'): /* "freshen" (extract only newer files) */
-- if (negative)
-- uO.fflag = uO.uflag = FALSE, negative = 0;
-- else
-- uO.fflag = uO.uflag = TRUE;
-- break;
-+ case ('f'): /* "freshen" (extract only newer files) */
-+ if (negative)
-+ uO.fflag = uO.uflag = FALSE, negative = 0;
-+ else
-+ uO.fflag = uO.uflag = TRUE;
-+ break;
- #if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
-- case ('F'): /* Acorn filetype & NFS extension handling */
-- if (negative)
-- uO.acorn_nfs_ext = FALSE, negative = 0;
-- else
-- uO.acorn_nfs_ext = TRUE;
-- break;
-+ case ('F'): /* Acorn filetype & NFS extension handling */
-+ if (negative)
-+ uO.acorn_nfs_ext = FALSE, negative = 0;
-+ else
-+ uO.acorn_nfs_ext = TRUE;
-+ break;
- #endif /* RISCOS || ACORN_FTYPE_NFS */
-- case ('h'): /* just print help message and quit */
-- *pargc = -1;
-- return USAGE(PK_OK);
-+ case ('h'): /* just print help message and quit */
-+ *pargc = -1;
-+ return USAGE(PK_OK);
- #ifdef MACOS
-- case ('i'): /* -i [MacOS] ignore filenames stored in Mac ef */
-- if( negative ) {
-- uO.i_flag = FALSE, negative = 0;
-- } else {
-- uO.i_flag = TRUE;
-- }
-- break;
-+ case ('i'): /* -i [MacOS] ignore filenames stored in Mac ef */
-+ if( negative ) {
-+ uO.i_flag = FALSE, negative = 0;
-+ } else {
-+ uO.i_flag = TRUE;
-+ }
-+ break;
- #endif /* MACOS */
-- case ('j'): /* junk pathnames/directory structure */
-- if (negative)
-- uO.jflag = FALSE, negative = 0;
-- else
-- uO.jflag = TRUE;
-- break;
-+ case ('j'): /* junk pathnames/directory structure */
-+ if (negative)
-+ uO.jflag = FALSE, negative = 0;
-+ else
-+ uO.jflag = TRUE;
-+ break;
- #if (defined(ATH_BEO) || defined(MACOS))
-- case ('J'): /* Junk AtheOS, BeOS or MacOS file attributes */
-- if( negative ) {
-- uO.J_flag = FALSE, negative = 0;
-- } else {
-- uO.J_flag = TRUE;
-- }
-- break;
-+ case ('J'): /* Junk AtheOS, BeOS or MacOS file attributes */
-+ if( negative ) {
-+ uO.J_flag = FALSE, negative = 0;
-+ } else {
-+ uO.J_flag = TRUE;
-+ }
-+ break;
- #endif /* ATH_BEO || MACOS */
- #ifdef ATH_BEO_UNX
-- case ('K'):
-- if (negative) {
-- uO.K_flag = FALSE, negative = 0;
-- } else {
-- uO.K_flag = TRUE;
-- }
-- break;
-+ case ('K'):
-+ if (negative) {
-+ uO.K_flag = FALSE, negative = 0;
-+ } else {
-+ uO.K_flag = TRUE;
-+ }
-+ break;
- #endif /* ATH_BEO_UNX */
- #ifndef SFX
-- case ('l'):
-- if (negative) {
-- uO.vflag = MAX(uO.vflag-negative,0);
-- negative = 0;
-- } else
-- ++uO.vflag;
-- break;
-+ case ('l'):
-+ if (negative) {
-+ uO.vflag = MAX(uO.vflag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.vflag;
-+ break;
- #endif /* !SFX */
- #ifndef CMS_MVS
-- case ('L'): /* convert (some) filenames to lowercase */
-- if (negative) {
-- uO.L_flag = MAX(uO.L_flag-negative,0);
-- negative = 0;
-- } else
-- ++uO.L_flag;
-- break;
-+ case ('L'): /* convert (some) filenames to lowercase */
-+ if (negative) {
-+ uO.L_flag = MAX(uO.L_flag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.L_flag;
-+ break;
- #endif /* !CMS_MVS */
- #ifdef MORE
- #ifdef CMS_MVS
-- case ('m'):
-+ case ('m'):
- #endif
-- case ('M'): /* send all screen output through "more" fn. */
-+ case ('M'): /* send all screen output through "more" fn. */
- /* GRR: eventually check for numerical argument => height */
-- if (negative)
-- G.M_flag = FALSE, negative = 0;
-- else
-- G.M_flag = TRUE;
-- break;
-+ if (negative)
-+ G.M_flag = FALSE, negative = 0;
-+ else
-+ G.M_flag = TRUE;
-+ break;
- #endif /* MORE */
-- case ('n'): /* don't overwrite any files */
-- if (negative)
-- uO.overwrite_none = FALSE, negative = 0;
-- else
-- uO.overwrite_none = TRUE;
-- break;
-+ case ('n'): /* don't overwrite any files */
-+ if (negative)
-+ uO.overwrite_none = FALSE, negative = 0;
-+ else
-+ uO.overwrite_none = TRUE;
-+ break;
- #ifdef AMIGA
-- case ('N'): /* restore comments as filenotes */
-- if (negative)
-- uO.N_flag = FALSE, negative = 0;
-- else
-- uO.N_flag = TRUE;
-- break;
-+ case ('N'): /* restore comments as filenotes */
-+ if (negative)
-+ uO.N_flag = FALSE, negative = 0;
-+ else
-+ uO.N_flag = TRUE;
-+ break;
- #endif /* AMIGA */
-- case ('o'): /* OK to overwrite files without prompting */
-- if (negative) {
-- uO.overwrite_all = MAX(uO.overwrite_all-negative,0);
-- negative = 0;
-- } else
-- ++uO.overwrite_all;
-- break;
-- case ('p'): /* pipes: extract to stdout, no messages */
-- if (negative) {
-- uO.cflag = FALSE;
-- uO.qflag = MAX(uO.qflag-999,0);
-- negative = 0;
-- } else {
-- uO.cflag = TRUE;
-- uO.qflag += 999;
-- }
-- break;
-+ case ('o'): /* OK to overwrite files without prompting */
-+ if (negative) {
-+ uO.overwrite_all = MAX(uO.overwrite_all-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.overwrite_all;
-+ break;
-+ case ('p'): /* pipes: extract to stdout, no messages */
-+ if (negative) {
-+ uO.cflag = FALSE;
-+ uO.qflag = MAX(uO.qflag-999,0);
-+ negative = 0;
-+ } else {
-+ uO.cflag = TRUE;
-+ uO.qflag += 999;
-+ }
-+ break;
- #if CRYPT
-- /* GRR: yes, this is highly insecure, but dozens of people
-- * have pestered us for this, so here we go... */
-- case ('P'):
-- if (negative) { /* negative not allowed with -P passwd */
-- Info(slide, 0x401, ((char *)slide,
-- LoadFarString(MustGivePasswd)));
-- return(PK_PARAM); /* don't extract here by accident */
-- }
-- if (uO.pwdarg != (char *)NULL) {
-+ /* GRR: yes, this is highly insecure, but dozens of people
-+ * have pestered us for this, so here we go... */
-+ case ('P'):
-+ if (negative) { /* negative not allowed with -P passwd */
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(MustGivePasswd)));
-+ return(PK_PARAM); /* don't extract here by accident */
-+ }
-+ if (uO.pwdarg != (char *)NULL) {
- /*
-- GRR: eventually support multiple passwords?
-+ GRR: eventually support multiple passwords?
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(OnlyOnePasswd)));
-+ return(PK_PARAM);
-+*/
-+ } else {
-+ /* first check for "-Ppasswd", then for "-P passwd" */
-+ uO.pwdarg = value;
-+ if (uO.pwdarg == NULL || *uO.pwdarg == '\0') {
- Info(slide, 0x401, ((char *)slide,
-- LoadFarString(OnlyOnePasswd)));
-+ LoadFarString(MustGivePasswd)));
- return(PK_PARAM);
-- */
-- } else {
-- /* first check for "-Ppasswd", then for "-P passwd" */
-- uO.pwdarg = s;
-- if (*uO.pwdarg == '\0') {
-- if (argc > 1) {
-- --argc;
-- uO.pwdarg = *++argv;
-- if (*uO.pwdarg == '-') {
-- Info(slide, 0x401, ((char *)slide,
-- LoadFarString(MustGivePasswd)));
-- return(PK_PARAM);
-- }
-- /* else pwdarg points at decryption password */
-- } else {
-- Info(slide, 0x401, ((char *)slide,
-- LoadFarString(MustGivePasswd)));
-- return(PK_PARAM);
-- }
-- }
-- /* pwdarg now points at decryption password (-Ppasswd or
-- * -P passwd); point s at end of passwd to avoid mis-
-- * interpretation of passwd characters as more options
-- */
-- if (*s != 0)
-- while (*++s != 0)
-- ;
-+ /* else pwdarg points at decryption password */
- }
-- break;
-+ }
-+ break;
- #endif /* CRYPT */
-- case ('q'): /* quiet: fewer comments/messages */
-- if (negative) {
-- uO.qflag = MAX(uO.qflag-negative,0);
-- negative = 0;
-- } else
-- ++uO.qflag;
-- break;
-+ case ('q'): /* quiet: fewer comments/messages */
-+ if (negative) {
-+ uO.qflag = MAX(uO.qflag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.qflag;
-+ break;
- #ifdef QDOS
-- case ('Q'): /* QDOS flags */
-- qlflag ^= strtol(s, &s, 10);
-- break; /* we XOR this as we can config qlflags */
-+ case ('Q'): /* QDOS flags */
-+ qlflag ^= strtol(value, &value, 10);
-+ break; /* we XOR this as we can config qlflags */
- #endif
- #ifdef TANDEM
-- case ('r'): /* remove file extensions */
-- if (negative)
-- uO.rflag = FALSE, negative = 0;
-- else
-- uO.rflag = TRUE;
-- break;
-+ case ('r'): /* remove file extensions */
-+ if (negative)
-+ uO.rflag = FALSE, negative = 0;
-+ else
-+ uO.rflag = TRUE;
-+ break;
- #endif /* TANDEM */
- #ifdef DOS_FLX_NLM_OS2_W32
-- case ('s'): /* spaces in filenames: allow by default */
-- if (negative)
-- uO.sflag = FALSE, negative = 0;
-- else
-- uO.sflag = TRUE;
-- break;
-+ case ('s'): /* spaces in filenames: allow by default */
-+ if (negative)
-+ uO.sflag = FALSE, negative = 0;
-+ else
-+ uO.sflag = TRUE;
-+ break;
- #endif /* DOS_FLX_NLM_OS2_W32 */
- #ifdef VMS
-- /* VMS: extract "text" files in Stream_LF format (-a[a]) */
-- case ('S'):
-- if (negative)
-- uO.S_flag = FALSE, negative = 0;
-- else
-- uO.S_flag = TRUE;
-- break;
-+ /* VMS: extract "text" files in Stream_LF format (-a[a]) */
-+ case ('S'):
-+ if (negative)
-+ uO.S_flag = FALSE, negative = 0;
-+ else
-+ uO.S_flag = TRUE;
-+ break;
- #endif /* VMS */
-- case ('t'):
-- if (negative)
-- uO.tflag = FALSE, negative = 0;
-- else
-- uO.tflag = TRUE;
-- break;
-+ case ('t'):
-+ if (negative)
-+ uO.tflag = FALSE, negative = 0;
-+ else
-+ uO.tflag = TRUE;
-+ break;
- #ifdef TIMESTAMP
-- case ('T'):
-- if (negative)
-- uO.T_flag = FALSE, negative = 0;
-- else
-- uO.T_flag = TRUE;
-- break;
--#endif
-- case ('u'): /* update (extract only new and newer files) */
-- if (negative)
-- uO.uflag = FALSE, negative = 0;
-- else
-- uO.uflag = TRUE;
-- break;
-+ case ('T'):
-+ if (negative)
-+ uO.T_flag = FALSE, negative = 0;
-+ else
-+ uO.T_flag = TRUE;
-+ break;
-+#endif
-+ case ('u'): /* update (extract only new and newer files) */
-+ if (negative)
-+ uO.uflag = FALSE, negative = 0;
-+ else
-+ uO.uflag = TRUE;
-+ break;
- #ifdef UNICODE_SUPPORT
-- case ('U'): /* escape UTF-8, or disable UTF-8 support */
-- if (negative) {
-- uO.U_flag = MAX(uO.U_flag-negative,0);
-- negative = 0;
-- } else
-- uO.U_flag++;
-- break;
-+ case ('U'): /* escape UTF-8, or disable UTF-8 support */
-+ if (negative)
-+ uO.U_flag = MAX(uO.U_flag - 1, 0);
-+ else
-+ uO.U_flag++;
-+ break;
- #else /* !UNICODE_SUPPORT */
- #ifndef CMS_MVS
-- case ('U'): /* obsolete; to be removed in version 6.0 */
-- if (negative)
-- uO.L_flag = TRUE, negative = 0;
-- else
-- uO.L_flag = FALSE;
-- break;
-+ case ('U'): /* obsolete; to be removed in version 6.0 */
-+ if (negative)
-+ uO.L_flag = TRUE, negative = 0;
-+ else
-+ uO.L_flag = FALSE;
-+ break;
- #endif /* !CMS_MVS */
- #endif /* ?UNICODE_SUPPORT */
- #ifndef SFX
-- case ('v'): /* verbose */
-- if (negative) {
-- uO.vflag = MAX(uO.vflag-negative,0);
-- negative = 0;
-- } else if (uO.vflag)
-- ++uO.vflag;
-- else
-- uO.vflag = 2;
-- break;
-+ case ('v'): /* verbose */
-+ if (negative) {
-+ uO.vflag = MAX(uO.vflag-negative,0);
-+ negative = 0;
-+ } else if (uO.vflag)
-+ ++uO.vflag;
-+ else
-+ uO.vflag = 2;
-+ break;
- #endif /* !SFX */
- #ifndef CMS_MVS
-- case ('V'): /* Version (retain VMS/DEC-20 file versions) */
-- if (negative)
-- uO.V_flag = FALSE, negative = 0;
-- else
-- uO.V_flag = TRUE;
-- break;
-+ case ('V'): /* Version (retain VMS/DEC-20 file versions) */
-+ if (negative)
-+ uO.V_flag = FALSE, negative = 0;
-+ else
-+ uO.V_flag = TRUE;
-+ break;
- #endif /* !CMS_MVS */
- #ifdef WILD_STOP_AT_DIR
-- case ('W'): /* Wildcard interpretation (stop at '/'?) */
-- if (negative)
-- uO.W_flag = FALSE, negative = 0;
-- else
-- uO.W_flag = TRUE;
-- break;
-+ case ('W'): /* Wildcard interpretation (stop at '/'?) */
-+ if (negative)
-+ uO.W_flag = FALSE, negative = 0;
-+ else
-+ uO.W_flag = TRUE;
-+ break;
- #endif /* WILD_STOP_AT_DIR */
-- case ('x'): /* extract: default */
--#ifdef SFX
-- /* when 'x' is the only option in this argument, and the
-- * next arg is not an option, assume this initiates an
-- * exclusion list (-x xlist): terminate option-scanning
-- * and leave uz_opts with argv still pointing to "-x";
-- * the xlist is processed later
-- */
-- if (s - argv[0] == 2 && *s == '\0' &&
-- argc > 1 && argv[1][0] != '-') {
-- /* break out of nested loops without "++argv;--argc" */
-- goto opts_done;
-+ case ('x'): /* extract: default */
-+ /* add -x file to linked list */
-+
-+ if (in_xfiles_count == 0) {
-+ /* first entry */
-+ if ((in_xfiles = (struct file_list *)
-+ malloc(sizeof(struct file_list))
-+ ) == NULL) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(NoMemArgsList)));
-+ return PK_MEM;
-+ }
-+ in_xfiles->name = value;
-+ in_xfiles->next = NULL;
-+ next_in_xfiles = in_xfiles;
-+ } else {
-+ /* add next entry */
-+ if ((next_file = (struct file_list *)
-+ malloc(sizeof(struct file_list))
-+ ) == NULL) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(NoMemArgsList)));
-+ return PK_MEM;
- }
-+ next_in_xfiles->next = next_file;
-+ next_file->name = value;
-+ next_file->next = NULL;
-+ next_in_xfiles = next_file;
-+ }
-+ in_xfiles_count++;
-+
-+#if 0
-+#ifdef SFX
-+ /* now get -x list one entry at a time */
-+
-+
-+
-+ /* when 'x' is the only option in this argument, and the
-+ * next arg is not an option, assume this initiates an
-+ * exclusion list (-x xlist): terminate option-scanning
-+ * and leave uz_opts with argv still pointing to "-x";
-+ * the xlist is processed later
-+ */
-+ if (s - argv[0] == 2 && *s == '\0' &&
-+ argc > 1 && argv[1][0] != '-') {
-+ /* break out of nested loops without "++argv;--argc" */
-+ goto opts_done;
-+ }
- #endif /* SFX */
-- break;
-+#endif
-+ break;
- #if (defined(RESTORE_UIDGID) || defined(RESTORE_ACL))
-- case ('X'): /* restore owner/protection info (need privs?) */
-- if (negative) {
-- uO.X_flag = MAX(uO.X_flag-negative,0);
-- negative = 0;
-- } else
-- ++uO.X_flag;
-- break;
-+ case ('X'): /* restore owner/protection info (need privs?) */
-+ if (negative) {
-+ uO.X_flag = MAX(uO.X_flag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.X_flag;
-+ break;
- #endif /* RESTORE_UIDGID || RESTORE_ACL */
- #ifdef VMS
-- case ('Y'): /* Treat ".nnn" as ";nnn" version. */
-- if (negative)
-- uO.Y_flag = FALSE, negative = 0;
-- else
-- uO.Y_flag = TRUE;
-- break;
-+ case ('Y'): /* Treat ".nnn" as ";nnn" version. */
-+ if (negative)
-+ uO.Y_flag = FALSE, negative = 0;
-+ else
-+ uO.Y_flag = TRUE;
-+ break;
- #endif /* VMS */
-- case ('z'): /* display only the archive comment */
-- if (negative) {
-- uO.zflag = MAX(uO.zflag-negative,0);
-- negative = 0;
-- } else
-- ++uO.zflag;
-- break;
-+ case ('z'): /* display only the archive comment */
-+ if (negative) {
-+ uO.zflag = MAX(uO.zflag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.zflag;
-+ break;
- #ifndef SFX
-- case ('Z'): /* should have been first option (ZipInfo) */
-- Info(slide, 0x401, ((char *)slide, LoadFarString(Zfirst)));
-- error = TRUE;
-- break;
-+ case ('Z'): /* should have been first option (ZipInfo) */
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(Zfirst)));
-+ error = TRUE;
-+ break;
- #endif /* !SFX */
- #ifdef VMS
-- case ('2'): /* Force ODS2-compliant names. */
-- if (negative)
-- uO.ods2_flag = FALSE, negative = 0;
-- else
-- uO.ods2_flag = TRUE;
-- break;
-+ case ('2'): /* Force ODS2-compliant names. */
-+ if (negative)
-+ uO.ods2_flag = FALSE, negative = 0;
-+ else
-+ uO.ods2_flag = TRUE;
-+ break;
- #endif /* VMS */
- #ifdef DOS_H68_OS2_W32
-- case ('$'):
-- if (negative) {
-- uO.volflag = MAX(uO.volflag-negative,0);
-- negative = 0;
-- } else
-- ++uO.volflag;
-- break;
-+ case ('$'):
-+ if (negative) {
-+ uO.volflag = MAX(uO.volflag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.volflag;
-+ break;
- #endif /* DOS_H68_OS2_W32 */
- #if (!defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM))
-- case (':'): /* allow "parent dir" path components */
-- if (negative) {
-- uO.ddotflag = MAX(uO.ddotflag-negative,0);
-- negative = 0;
-- } else
-- ++uO.ddotflag;
-- break;
-+ case (':'): /* allow "parent dir" path components */
-+ if (negative) {
-+ uO.ddotflag = MAX(uO.ddotflag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.ddotflag;
-+ break;
- #endif /* !RISCOS && !CMS_MVS && !TANDEM */
- #ifdef UNIX
-- case ('^'): /* allow control chars in filenames */
-- if (negative) {
-- uO.cflxflag = MAX(uO.cflxflag-negative,0);
-- negative = 0;
-- } else
-- ++uO.cflxflag;
-- break;
-+ case ('^'): /* allow control chars in filenames */
-+ if (negative) {
-+ uO.cflxflag = MAX(uO.cflxflag-negative,0);
-+ negative = 0;
-+ } else
-+ ++uO.cflxflag;
-+ break;
- #endif /* UNIX */
-- default:
-- error = TRUE;
-- break;
--
-- } /* end switch */
-- } /* end while (not end of argument string) */
-- } /* end while (not done with switches) */
-+ case o_NON_OPTION_ARG:
-+ /* not an option */
-+ /* no more options as permuting */
-+
-+
-+ if (G.wildzipfn == NULL) {
-+ /* first non-option argument is zip file */
-+ G.wildzipfn = value;
-+
-+ } else {
-+ /* add include file to list */
-+ if (in_files_count == 0) {
-+ /* first entry */
-+ if ((next_file = (struct file_list *)
-+ malloc(sizeof(struct file_list))
-+ ) == NULL) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(NoMemArgsList)));
-+ return PK_MEM;
-+ }
-+ next_file->name = value;
-+ next_file->next = NULL;
-+ in_files = next_file;
-+ next_in_files = next_file;
-+ } else {
-+ /* add next entry */
-+ if ((next_file = (struct file_list *)
-+ malloc(sizeof(struct file_list))
-+ ) == NULL) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(NoMemArgsList)));
-+ return PK_MEM;
-+ }
-+ next_in_files->next = next_file;
-+ next_file->name = value;
-+ next_file->next = NULL;
-+ next_in_files = next_file;
-+ }
-+ in_files_count++;
-+ }
-+ break;
-+ default:
-+ error = TRUE;
-+ break;
-+
-+ } /* end switch */
-+ } /* get_option() */
-+
-+
-+ /* convert files and xfiles lists to arrays */
-+
-+ /* convert files list to array */
-+ if (in_files_count) {
-+ if ((G.pfnames = (char **) malloc((in_files_count + 1) * sizeof(char *))
-+ ) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArgsList)));
-+ return PK_MEM;
-+ }
-+ file_count = 0;
-+ for (next_file = in_files; next_file;) {
-+ G.pfnames[file_count] = next_file->name;
-+ in_files = next_file;
-+ next_file = next_file->next;
-+ free(in_files);
-+ file_count++;
-+ }
-+ G.pfnames[file_count] = NULL;
-+ G.filespecs = in_files_count;
-+ }
-+
-+ /* convert xfiles list to array */
-+ if (in_xfiles_count) {
-+ if ((G.pxnames = (char **) malloc((in_xfiles_count + 1) * sizeof(char *))
-+ ) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArgsList)));
-+ return PK_MEM;
-+ }
-+ file_count = 0;
-+ for (next_file = in_xfiles; next_file;) {
-+ G.pxnames[file_count] = next_file->name;
-+ in_xfiles = next_file;
-+ next_file = next_file->next;
-+ free(in_xfiles);
-+ file_count++;
-+ }
-+ G.pxnames[file_count] = NULL;
-+ G.xfilespecs = in_xfiles_count;
-+ }
-+
-+ if (in_files_count || in_xfiles_count) {
-+ G.process_all_files = FALSE;
-+ } else {
-+ G.process_all_files = TRUE; /* for speed */
-+ }
-+
-+
-+ /* it's possible the arg count could have been changed by get_option() */
-+ argc = arg_count(args);
-+
-+
-
- /*---------------------------------------------------------------------------
-@@ -1774,7 +2240,77 @@
- ---------------------------------------------------------------------------*/
-
-+ if ((uO.cflag && (uO.tflag || uO.uflag)) ||
-+ (uO.tflag && uO.uflag) || (uO.fflag && uO.overwrite_none))
-+ {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(InvalidOptionsMsg)));
-+ error = TRUE;
-+ }
-+ if (uO.aflag > 2)
-+ uO.aflag = 2;
-+#ifdef VMS
-+ if (uO.bflag > 2)
-+ uO.bflag = 2;
-+ /* Clear -s flag when converting text files. */
-+ if (uO.aflag <= 0)
-+ uO.S_flag = 0;
-+#endif /* VMS */
-+ if (uO.overwrite_all && uO.overwrite_none) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(IgnoreOOptionMsg)));
-+ uO.overwrite_all = FALSE;
-+ }
-+#ifdef MORE
-+ if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func. useless */
-+ G.M_flag = 0;
-+#endif
-+
-+#ifdef SFX
-+ if (error)
-+#else
-+ if ((G.wildzipfn == NULL) || error)
-+#endif
-+ {
-+ /* tell caller to exit */
-+ if (argc <= 2)
-+ argc = -1;
-+
-+ *pargc = argc;
-+ *pargv = args;
-+#ifndef SFX
-+ if (uO.vflag >= 2 && argc == -1) { /* "unzip -v" */
-+ show_version_info(__G);
-+ return PK_OK;
-+ }
-+ if (!G.noargs && !error)
-+ error = TRUE; /* had options (not -h or -v) but no zipfile */
-+#endif /* !SFX */
-+ return USAGE(error);
-+ }
-+
- #ifdef SFX
--opts_done: /* yes, very ugly...but only used by UnZipSFX with -x xlist */
-+ /* print our banner unless we're being fairly quiet */
-+ if (uO.qflag < 2)
-+ Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner),
-+ UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
-+ LoadFarStringSmall(VersionDate)));
-+#ifdef BETA
-+ /* always print the beta warning: no unauthorized distribution!! */
-+ Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n",
-+ "SFX"));
-+#endif
-+#endif /* SFX */
-+
-+ if (uO.cflag || uO.tflag || uO.vflag || uO.zflag
-+#ifdef TIMESTAMP
-+ || uO.T_flag
- #endif
-+ )
-+ G.extract_flag = FALSE;
-+ else
-+ G.extract_flag = TRUE;
-+
-+#if 0
-+# ifdef SFX
-+opts_done: /* yes, very ugly...but only used by UnZipSFX with -x xlist */
-+# endif
-
- if ((uO.cflag && (uO.tflag || uO.uflag)) ||
-@@ -1786,5 +2322,5 @@
- if (uO.aflag > 2)
- uO.aflag = 2;
--#ifdef VMS
-+# ifdef VMS
- if (uO.bflag > 2)
- uO.bflag = 2;
-@@ -1792,23 +2328,23 @@
- if (uO.aflag <= 0)
- uO.S_flag = 0;
--#endif /* VMS */
-+# endif /* VMS */
- if (uO.overwrite_all && uO.overwrite_none) {
- Info(slide, 0x401, ((char *)slide, LoadFarString(IgnoreOOptionMsg)));
- uO.overwrite_all = FALSE;
- }
--#ifdef MORE
-+# ifdef MORE
- if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func. useless */
- G.M_flag = 0;
--#endif
-+# endif
-
--#ifdef SFX
-+# ifdef SFX
- if (error)
--#else
-+# else
- if ((argc-- == 0) || error)
--#endif
-+# endif
- {
- *pargc = argc;
-- *pargv = argv;
--#ifndef SFX
-+ *pargv = args;
-+# ifndef SFX
- if (uO.vflag >= 2 && argc == -1) { /* "unzip -v" */
- show_version_info(__G);
-@@ -1817,9 +2353,9 @@
- if (!G.noargs && !error)
- error = TRUE; /* had options (not -h or -v) but no zipfile */
--#endif /* !SFX */
-+# endif /* !SFX */
- return USAGE(error);
- }
-
--#ifdef SFX
-+# ifdef SFX
- /* print our banner unless we're being fairly quiet */
- if (uO.qflag < 2)
-@@ -1827,22 +2363,23 @@
- UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
- LoadFarStringSmall(VersionDate)));
--#ifdef BETA
-+# ifdef BETA
- /* always print the beta warning: no unauthorized distribution!! */
- Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n",
- "SFX"));
--#endif
--#endif /* SFX */
-+# endif
-+# endif /* SFX */
-
- if (uO.cflag || uO.tflag || uO.vflag || uO.zflag
--#ifdef TIMESTAMP
-+# ifdef TIMESTAMP
- || uO.T_flag
--#endif
-+# endif
- )
- G.extract_flag = FALSE;
- else
- G.extract_flag = TRUE;
-+#endif
-
- *pargc = argc;
-- *pargv = argv;
-+ *pargv = args;
- return PK_OK;
-
-@@ -2314,2 +2851,1366 @@
- #endif /* !SFX */
- #endif /* !WINDLL */
-+
-+
-+
-+
-+
-+
-+/*---------------------------------------------------------------
-+ * Long option support
-+ * 8/23/2003
-+ * Updated 3/1/2008 to support UnZip
-+ *
-+ * Defines function get_option() to get and process the command
-+ * line options and arguments from argv[]. The caller calls
-+ * get_option() in a loop to get either one option and possible
-+ * value or a non-option argument each loop.
-+ *
-+ * This version has been modified to work with UnZip and ZipInfo.
-+ * the major changes are removing the error returns, instead
-+ * passing back error codes for errors, and supporting separate
-+ * groups of options for UnZip and ZipInfo and selecting the option
-+ * group by an argument.
-+ *
-+ * This version does not include argument file support and can
-+ * work directly on argv. The argument file code complicates things and
-+ * it seemed best to leave it out for now. If argument file support
-+ * (reading in command line arguments stored in a file and inserting into
-+ * command line where @filename is found) is added later the arguments
-+ * can change and a freeable copy of argv will be needed and can be
-+ * created using copy_args in the left out code.
-+ *
-+ * Supports short and long options as defined in the array options[]
-+ * in zip.c, multiple short options in an argument (like -jlv), long
-+ * option abbreviation (like --te for --temp-file if --te unique),
-+ * short and long option values (like -b filename or --temp-file filename
-+ * or --temp-file=filename), optional and required values, option negation
-+ * by trailing - (like -S- to not include hidden and system files in MSDOS),
-+ * value lists (like -x a b c), argument permuting (returning all options
-+ * and values before any non-option arguments), and argument files (where
-+ * any non-option non-value argument in form @path gets substituted with
-+ * the white space separated arguments in the text file at path). In this
-+ * version argument file support has been removed to simplify development
-+ * but may be added later.
-+ *
-+ * E. Gordon
-+ */
-+
-+
-+/* message output - char casts are needed to handle constants */
-+#define oWARN(message) Info(slide, 0x401, ((char *)slide, (char *)message))
-+
-+
-+
-+/* Although the below provides some support for multibyte characters
-+ the proper thing to do may be to use wide characters and support
-+ Unicode. May get to it soon. Wide support would likely require
-+ the ability to convert the command line to wide strings, which most
-+ modern OS should support now. EG
-+ */
-+
-+/* For now stay with multi-byte characters. May support wide characters
-+ in Zip 3.1 and UnZip 6.1.
-+ */
-+
-+/* multibyte character set support
-+ Multibyte characters use typically two or more sequential bytes
-+ to represent additional characters than can fit in a single byte
-+ character set. The code used here is based on the ANSI mblen function. */
-+#define MB_CLEN(ptr) CLEN(ptr)
-+#define MB_NEXTCHAR(ptr) PREINCSTR(ptr)
-+
-+
-+/* constants */
-+
-+/* function get_args_from_arg_file() can return this in depth parameter */
-+#define ARG_FILE_ERR -1
-+
-+/* internal settings for optchar */
-+#define SKIP_VALUE_ARG -1
-+#define THIS_ARG_DONE -2
-+#define START_VALUE_LIST -3
-+#define IN_VALUE_LIST -4
-+#define NON_OPTION_ARG -5
-+#define STOP_VALUE_LIST -6
-+/* 7/25/04 EG */
-+#define READ_REST_ARGS_VERBATIM -7
-+
-+
-+/* global veriables */
-+
-+int enable_permute = 1; /* yes - return options first */
-+/* 7/25/04 EG */
-+int doubledash_ends_options = 1; /* when -- what follows are not options */
-+
-+/* buffer for error messages (this sizing is a guess but must hold 2 paths) */
-+#define OPTIONERR_BUF_SIZE (80+ 2*FILENAME_MAX)
-+char optionerrbuf[OPTIONERR_BUF_SIZE + 1];
-+
-+/* error messages */
-+static ZCONST char Far op_not_neg_err[] =
-+ "option %s not negatable";
-+static ZCONST char Far op_req_val_err[] =
-+ "option %s requires a value";
-+static ZCONST char Far op_no_allow_val_err[] =
-+ "option %s does not allow a value";
-+static ZCONST char Far sh_op_not_sup_err[] =
-+ "short option '%c' not supported";
-+static ZCONST char Far oco_req_val_err[] =
-+ "option %s requires one character value";
-+static ZCONST char Far oco_no_mbc_err[] =
-+ "option %s does not support multibyte values";
-+static ZCONST char Far num_req_val_err[] =
-+ "option %s requires number value";
-+static ZCONST char Far long_op_ambig_err[] =
-+ "long option '%s' ambiguous";
-+static ZCONST char Far long_op_not_sup_err[] =
-+ "long option '%s' not supported";
-+
-+static ZCONST char Far no_arg_files_err[] = "argument files not enabled\n";
-+
-+
-+/* below removed as only used for processing argument files */
-+
-+/* get_nextarg */
-+/* get_args_from_string */
-+/* get_args_from_arg_file */
-+
-+
-+/* copy error, option name, and option description if any to buf */
-+static int optionerr(options, buf, err, optind, islong)
-+ struct option_struct *options;
-+ char *buf;
-+ ZCONST char Far *err;
-+ int optind;
-+ int islong;
-+{
-+ char optname[50];
-+
-+ if (options[optind].name && options[optind].name[0] != '\0') {
-+ sprintf(optname, "'%s' (%s)",
-+ LoadFarStringSmall2(islong ? options[optind].longopt
-+ : options[optind].shortopt),
-+ LoadFarStringSmall(options[optind].name));
-+ } else {
-+ sprintf(optname, "'%s'",
-+ LoadFarStringSmall2(islong ? options[optind].longopt
-+ : options[optind].shortopt));
-+ }
-+ sprintf(buf, LoadFarStringSmall(err), optname);
-+ return 0;
-+}
-+
-+
-+/* copy_args
-+ *
-+ * Copy arguments in args, allocating storage with malloc.
-+ * Copies until a NULL argument is found or until max_args args
-+ * including args[0] are copied. Set max_args to 0 to copy
-+ * until NULL. Always terminates returned args[] with NULL arg.
-+ *
-+ * Any argument in the returned args can be freed with free(). Any
-+ * freed argument should be replaced with either another string
-+ * allocated with malloc or by NULL if last argument so that free_args
-+ * will properly work.
-+ */
-+char **copy_args(args, max_args)
-+ char **args;
-+ int max_args;
-+{
-+ int j;
-+ char **new_args;
-+
-+ if (args == NULL) {
-+ return NULL;
-+ }
-+
-+ /* count args */
-+ for (j = 0; args[j] && (max_args == 0 || j < max_args); j++) ;
-+
-+ if ((new_args = (char **) malloc((j + 1) * sizeof(char *))) == NULL) {
-+ oWARN("memory - ca");
-+ return NULL;
-+ }
-+
-+ for (j = 0; args[j] && (max_args == 0 || j < max_args); j++) {
-+ if (args[j] == NULL) {
-+ /* null argument is end of args */
-+ new_args[j] = NULL;
-+ break;
-+ }
-+ if ((new_args[j] = malloc(strlen(args[j]) + 1)) == NULL) {
-+ free_args(new_args);
-+ oWARN("memory - ca");
-+ return NULL;
-+ }
-+ strcpy(new_args[j], args[j]);
-+ }
-+ new_args[j] = NULL;
-+
-+ return new_args;
-+}
-+
-+
-+/* count args - count args in argv like array */
-+int arg_count(args)
-+ char **args;
-+{
-+ int i;
-+
-+ if (args == NULL) {
-+ return 0;
-+ }
-+
-+ for (i = 0; args[i]; i++) {
-+ }
-+ return i;
-+}
-+
-+
-+/* free args - free args created with one of these functions */
-+int free_args(args)
-+ char **args;
-+{
-+ int i;
-+
-+ if (args == NULL) {
-+ return 0;
-+ }
-+
-+ for (i = 0; args[i]; i++) {
-+ free(args[i]);
-+ }
-+ free(args);
-+ return i;
-+}
-+
-+
-+/* insert_arg
-+ *
-+ * Insert the argument arg into the array args before argument at_arg.
-+ * If at_arg = -1 then append to end.
-+ * Return the new count of arguments (argc).
-+ *
-+ * If free_args is true, this function frees the old args array
-+ * (but not the component strings). DO NOT set free_args on original
-+ * argv but only on args allocated with malloc.
-+ */
-+
-+int insert_arg(pargs, arg, at_arg, free_args)
-+ char ***pargs;
-+ ZCONST char *arg;
-+ int at_arg;
-+ int free_args;
-+{
-+ char *newarg = NULL;
-+ char **args;
-+ char **newargs = NULL;
-+ int argnum;
-+ int newargnum;
-+ int argcnt;
-+ int newargcnt;
-+
-+ if (pargs == NULL) {
-+ return 0;
-+ }
-+ args = *pargs;
-+
-+ /* count args */
-+ if (args == NULL) {
-+ argcnt = 0;
-+ } else {
-+ for (argcnt = 0; args[argcnt]; argcnt++) ;
-+ }
-+ if (arg == NULL) {
-+ /* done */
-+ return argcnt;
-+ }
-+ if (at_arg == -1) {
-+ at_arg = argcnt;
-+ }
-+ newargcnt = argcnt + 1;
-+
-+ /* get storage for new args */
-+ if ((newargs = (char **) malloc((newargcnt + 1) * sizeof(char *))) == NULL)
-+ {
-+ oWARN("memory - ia");
-+ return 0;
-+ }
-+
-+ /* copy argument pointers from args to position at_arg, copy the new arg,
-+ then copy the rest of the args */
-+ argnum = 0;
-+ newargnum = 0;
-+ if (args) {
-+ for (; args[argnum] && argnum < at_arg; argnum++) {
-+ newargs[newargnum++] = args[argnum];
-+ }
-+ }
-+ /* copy new arg */
-+ if ((newarg = (char *) malloc(strlen(arg) + 1)) == NULL) {
-+ oWARN("memory - ia");
-+ return 0;
-+ }
-+ strcpy(newarg, arg);
-+
-+ newargs[newargnum++] = newarg;
-+ if (args) {
-+ for ( ; args[argnum]; argnum++) {
-+ newargs[newargnum++] = args[argnum];
-+ }
-+ }
-+ newargs[newargnum] = NULL;
-+
-+ /* free old args array but not component strings - this assumes that
-+ args was allocated with malloc as copy_args does. DO NOT DO THIS
-+ on the original argv.
-+ */
-+ if (free_args)
-+ free(args);
-+
-+ *pargs = newargs;
-+
-+ return newargnum;
-+}
-+
-+/* ------------------------------------- */
-+
-+/* get_shortopt
-+ *
-+ * Get next short option from arg. The state is stored in argnum, optchar, and
-+ * option_num so no static storage is used. Returns the option_ID.
-+ *
-+ * parameters:
-+ * option_group - either UZO for UnZip options or ZIO for ZipInfo options
-+ * args - argv array of arguments
-+ * argnum - index of current arg in args
-+ * optchar - pointer to index of next char to process. Can be 0 or
-+ * const defined at top of this file like THIS_ARG_DONE
-+ * negated - on return pointer to int set to 1 if option negated
-+ * or 0 otherwise
-+ * value - on return pointer to string set to value of option if any
-+ * or NULL if none. If value is returned then the caller
-+ * should free() it when not needed anymore.
-+ * option_num - pointer to index in options[] of returned option or
-+ * o_NO_OPTION_MATCH if none. Do not change as used by
-+ * value lists.
-+ * depth - recursion depth (0 at top level, 1 or more in arg files)
-+ */
-+static unsigned long get_shortopt(option_group, args, argnum, optchar, negated,
-+ value, option_num, depth)
-+ int option_group;
-+ ZCONST char **args;
-+ int argnum;
-+ int *optchar;
-+ int *negated;
-+ char **value;
-+ int *option_num;
-+ int depth;
-+{
-+ ZCONST char *shortopt;
-+ int clen;
-+ ZCONST char *nextchar;
-+ ZCONST char *s;
-+ ZCONST char *start;
-+ int op;
-+ ZCONST char *arg;
-+ int match = -1;
-+
-+
-+ /* get arg */
-+ arg = args[argnum];
-+ /* current char in arg */
-+ nextchar = arg + (*optchar);
-+ clen = MB_CLEN(nextchar);
-+ /* next char in arg */
-+ (*optchar) += clen;
-+ /* get first char of short option */
-+ shortopt = arg + (*optchar);
-+ /* no value */
-+ *value = NULL;
-+
-+ if (*shortopt == '\0') {
-+ /* no more options in arg */
-+ *optchar = 0;
-+ *option_num = o_NO_OPTION_MATCH;
-+ return 0;
-+ }
-+
-+ /* look for match in options */
-+ clen = MB_CLEN(shortopt);
-+ for (op = 0; options[op].option_ID; op++) {
-+ /* Only look at options in this option group */
-+ if (options[op].option_group == option_group) {
-+ s = options[op].shortopt;
-+ if (s && s[0] == shortopt[0]) {
-+ if (s[1] == '\0' && clen == 1) {
-+ /* single char match */
-+ match = op;
-+ } else {
-+ /* 2 wide short opt. Could support more chars but should use long opts instead */
-+ if (s[1] == shortopt[1]) {
-+ /* match 2 char short opt or 2 byte char */
-+ match = op;
-+ if (clen == 1) (*optchar)++;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ }
-+
-+ if (match > -1) {
-+ /* match */
-+ clen = MB_CLEN(shortopt);
-+ nextchar = arg + (*optchar) + clen;
-+ /* check for trailing dash negating option */
-+ if (*nextchar == '-') {
-+ /* negated */
-+ if (options[match].negatable == o_NOT_NEGATABLE) {
-+ if (options[match].value_type == o_NO_VALUE) {
-+ optionerr(options, optionerrbuf, op_not_neg_err, match, 0);
-+ if (depth > 0) {
-+ /* unwind */
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ } else {
-+ *negated = 1;
-+ /* set up to skip negating dash */
-+ (*optchar) += clen;
-+ clen = 1;
-+ }
-+ }
-+
-+ /* value */
-+ clen = MB_CLEN(arg + (*optchar));
-+ /* optional value, one char value, and number value must follow option */
-+ if (options[match].value_type == o_ONE_CHAR_VALUE) {
-+ /* one char value */
-+ if (arg[(*optchar) + clen]) {
-+ /* has value */
-+ if (MB_CLEN(arg + (*optchar) + clen) > 1) {
-+ /* multibyte value not allowed for now */
-+ optionerr(options, optionerrbuf, oco_no_mbc_err, match, 0);
-+ if (depth > 0) {
-+ /* unwind */
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ if ((*value = (char *) malloc(2)) == NULL) {
-+ oWARN("memory - gso");
-+ return o_BAD_ERR;
-+ }
-+ (*value)[0] = *(arg + (*optchar) + clen);
-+ (*value)[1] = '\0';
-+ *optchar += clen;
-+ clen = 1;
-+ } else {
-+ /* one char values require a value */
-+ optionerr(options, optionerrbuf, oco_req_val_err, match, 0);
-+ if (depth > 0) {
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ } else if (options[match].value_type == o_NUMBER_VALUE) {
-+ /* read chars until end of number */
-+ start = arg + (*optchar) + clen;
-+ if (*start == '+' || *start == '-') {
-+ start++;
-+ }
-+ s = start;
-+ for (; isdigit(*s); MB_NEXTCHAR(s)) ;
-+ if (s == start) {
-+ /* no digits */
-+ optionerr(options, optionerrbuf, num_req_val_err, match, 0);
-+ if (depth > 0) {
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ start = arg + (*optchar) + clen;
-+ if ((*value = (char *) malloc((int)(s - start) + 1)) == NULL) {
-+ oWARN("memory - gso");
-+ return o_BAD_ERR;
-+ }
-+ *optchar += (int)(s - start);
-+ strncpy(*value, start, (int)(s - start));
-+ (*value)[(int)(s - start)] = '\0';
-+ clen = MB_CLEN(s);
-+ } else if (options[match].value_type == o_OPTIONAL_VALUE) {
-+ /* optional value */
-+ /* This seemed inconsistent so now if no value attached to argument look
-+ to the next argument if that argument is not an option for option
-+ value - 11/12/04 EG */
-+ if (arg[(*optchar) + clen]) {
-+ /* has value */
-+ /* add support for optional = - 2/6/05 EG */
-+ if (arg[(*optchar) + clen] == '=') {
-+ /* skip = */
-+ clen++;
-+ }
-+ if (arg[(*optchar) + clen]) {
-+ if ((*value = (char *)malloc(strlen(arg + (*optchar) + clen) + 1))
-+ == NULL) {
-+ oWARN("memory - gso");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, arg + (*optchar) + clen);
-+ }
-+ *optchar = THIS_ARG_DONE;
-+ } else if (args[argnum + 1] && args[argnum + 1][0] != '-') {
-+ /* use next arg for value */
-+ if ((*value = (char *)malloc(strlen(args[argnum + 1]) + 1)) == NULL) {
-+ oWARN("memory - gso");
-+ return o_BAD_ERR;
-+ }
-+ /* using next arg as value */
-+ strcpy(*value, args[argnum + 1]);
-+ *optchar = SKIP_VALUE_ARG;
-+ }
-+ } else if (options[match].value_type == o_REQUIRED_VALUE ||
-+ options[match].value_type == o_VALUE_LIST) {
-+ /* see if follows option */
-+ if (arg[(*optchar) + clen]) {
-+ /* has value following option as -ovalue */
-+ /* add support for optional = - 6/5/05 EG */
-+ if (arg[(*optchar) + clen] == '=') {
-+ /* skip = */
-+ clen++;
-+ }
-+ if ((*value = (char *)malloc(strlen(arg + (*optchar) + clen) + 1))
-+ == NULL) {
-+ oWARN("memory - gso");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, arg + (*optchar) + clen);
-+ *optchar = THIS_ARG_DONE;
-+ } else {
-+ /* use next arg for value */
-+ if (args[argnum + 1]) {
-+ if ((*value = (char *)malloc(strlen(args[argnum + 1]) + 1))
-+ == NULL) {
-+ oWARN("memory - gso");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, args[argnum + 1]);
-+ if (options[match].value_type == o_VALUE_LIST) {
-+ *optchar = START_VALUE_LIST;
-+ } else {
-+ *optchar = SKIP_VALUE_ARG;
-+ }
-+ } else {
-+ /* no value found */
-+ optionerr(options, optionerrbuf, op_req_val_err, match, 0);
-+ if (depth > 0) {
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ }
-+ }
-+
-+ *option_num = match;
-+ return options[match].option_ID;
-+ }
-+ sprintf(optionerrbuf, LoadFarStringSmall(sh_op_not_sup_err), *shortopt);
-+ if (depth > 0) {
-+ /* unwind */
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ return 0;
-+}
-+
-+
-+/* get_longopt
-+ *
-+ * Get the long option in args array at argnum.
-+ * Parameters same as for get_shortopt.
-+ */
-+
-+static unsigned long get_longopt(option_group, args, argnum, optchar, negated,
-+ value, option_num, depth)
-+ int option_group;
-+ ZCONST char **args;
-+ int argnum;
-+ int *optchar;
-+ int *negated;
-+ char **value;
-+ int *option_num;
-+ int depth;
-+{
-+ char *longopt;
-+ char *lastchr;
-+ char *valuestart;
-+ int op;
-+ char *arg;
-+ int match = -1;
-+ *value = NULL;
-+
-+ if (args == NULL) {
-+ *option_num = o_NO_OPTION_MATCH;
-+ return 0;
-+ }
-+ if (args[argnum] == NULL) {
-+ *option_num = o_NO_OPTION_MATCH;
-+ return 0;
-+ }
-+ /* copy arg so can chop end if value */
-+ if ((arg = (char *)malloc(strlen(args[argnum]) + 1)) == NULL) {
-+ oWARN("memory - glo");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(arg, args[argnum]);
-+
-+ /* get option */
-+ longopt = arg + 2;
-+ /* no value */
-+ *value = NULL;
-+
-+ /* find = */
-+ for (lastchr = longopt, valuestart = longopt;
-+ *valuestart && *valuestart != '=';
-+ lastchr = valuestart, MB_NEXTCHAR(valuestart)) ;
-+ if (*valuestart) {
-+ /* found =value */
-+ *valuestart = '\0';
-+ valuestart++;
-+ } else {
-+ valuestart = NULL;
-+ }
-+
-+ if (*lastchr == '-') {
-+ /* option negated */
-+ *negated = 1;
-+ *lastchr = '\0';
-+ } else {
-+ *negated = 0;
-+ }
-+
-+ /* look for long option match */
-+ for (op = 0; options[op].option_ID; op++) {
-+ /* Only look at options in the option group */
-+ if (options[op].option_group == option_group) {
-+ if (options[op].longopt &&
-+ strcmp(LoadFarStringSmall(options[op].longopt), longopt) == 0) {
-+ /* exact match */
-+ match = op;
-+ break;
-+ }
-+ if (options[op].longopt &&
-+ strncmp(LoadFarStringSmall(options[op].longopt),
-+ longopt, strlen(longopt)) == 0) {
-+ if (match > -1) {
-+ sprintf(optionerrbuf, LoadFarStringSmall(long_op_ambig_err),
-+ longopt);
-+ free(arg);
-+ if (depth > 0) {
-+ /* unwind */
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ match = op;
-+ }
-+ }
-+ }
-+
-+ if (match == -1) {
-+ sprintf(optionerrbuf, LoadFarStringSmall(long_op_not_sup_err), longopt);
-+ free(arg);
-+ if (depth > 0) {
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+
-+ /* one long option an arg */
-+ *optchar = THIS_ARG_DONE;
-+
-+ /* if negated then see if allowed */
-+ if (*negated && options[match].negatable == o_NOT_NEGATABLE) {
-+ optionerr(options, optionerrbuf, op_not_neg_err, match, 1);
-+ free(arg);
-+ if (depth > 0) {
-+ /* unwind */
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ /* get value */
-+ if (options[match].value_type == o_OPTIONAL_VALUE) {
-+ /* optional value in form option=value */
-+ if (valuestart) {
-+ /* option=value */
-+ if ((*value = (char *)malloc(strlen(valuestart) + 1)) == NULL) {
-+ free(arg);
-+ oWARN("memory - glo");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, valuestart);
-+ }
-+ } else if (options[match].value_type == o_REQUIRED_VALUE ||
-+ options[match].value_type == o_NUMBER_VALUE ||
-+ options[match].value_type == o_ONE_CHAR_VALUE ||
-+ options[match].value_type == o_VALUE_LIST) {
-+ /* handle long option one char and number value as required value */
-+ if (valuestart) {
-+ /* option=value */
-+ if ((*value = (char *)malloc(strlen(valuestart) + 1)) == NULL) {
-+ free(arg);
-+ oWARN("memory - glo");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, valuestart);
-+ } else {
-+ /* use next arg */
-+ if (args[argnum + 1]) {
-+ if ((*value = (char *)malloc(strlen(args[argnum + 1]) + 1)) == NULL) {
-+ free(arg);
-+ oWARN("memory - glo");
-+ return o_BAD_ERR;
-+ }
-+ /* using next arg as value */
-+ strcpy(*value, args[argnum + 1]);
-+ if (options[match].value_type == o_VALUE_LIST) {
-+ *optchar = START_VALUE_LIST;
-+ } else {
-+ *optchar = SKIP_VALUE_ARG;
-+ }
-+ } else {
-+ /* no value found */
-+ optionerr(options, optionerrbuf, op_req_val_err, match, 1);
-+ free(arg);
-+ if (depth > 0) {
-+ /* unwind */
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ }
-+ } else if (options[match].value_type == o_NO_VALUE) {
-+ /* this option does not accept a value */
-+ if (valuestart) {
-+ /* --option=value */
-+ optionerr(options, optionerrbuf, op_no_allow_val_err, match, 1);
-+ free(arg);
-+ if (depth > 0) {
-+ oWARN(optionerrbuf);
-+ return o_ARG_FILE_ERR;
-+ } else {
-+ oWARN(optionerrbuf);
-+ return o_BAD_ERR;
-+ }
-+ }
-+ }
-+ free(arg);
-+
-+ *option_num = match;
-+ return options[match].option_ID;
-+}
-+
-+
-+
-+/* get_option
-+ *
-+ * Main interface for user. Use this function to get options, values and
-+ * non-option arguments from a command line provided in argv form.
-+ *
-+ * To use get_option() first define valid options by setting
-+ * the global variable options[] to an array of option_struct. Also
-+ * either change defaults below or make variables global and set elsewhere.
-+ * Zip uses below defaults.
-+ *
-+ * Call get_option() to get an option (like -b or --temp-file) and any
-+ * value for that option (like filename for -b) or a non-option argument
-+ * (like archive name) each call. If *value* is not NULL after calling
-+ * get_option() it is a returned value and the caller should either store
-+ * the char pointer or free() it before calling get_option() again to avoid
-+ * leaking memory. If a non-option non-value argument is returned get_option()
-+ * returns o_NON_OPTION_ARG and value is set to the entire argument.
-+ * When there are no more arguments get_option() returns 0.
-+ *
-+ * The parameters argnum (after set to 0 on initial call),
-+ * optchar, first_nonopt_arg, option_num, and depth (after initial
-+ * call) are set and maintained by get_option() and should not be
-+ * changed. The parameters argc, negated, and value are outputs and
-+ * can be used by the calling program. get_option() returns either the
-+ * option_ID for the current option, a special value defined in
-+ * zip.h, or 0 when no more arguments.
-+ *
-+ * The value returned by get_option() is the ID value in the options
-+ * table. This value can be duplicated in the table if different
-+ * options are really the same option. The index into the options[]
-+ * table is given by option_num, though the ID should be used as
-+ * option numbers change when the table is changed. The ID must
-+ * not be 0 for any option as this ends the table. If get_option()
-+ * finds an option not in the table it calls oERR to post an
-+ * error and exit. Errors also result if the option requires a
-+ * value that is missing, a value is present but the option does
-+ * not take one, and an option is negated but is not
-+ * negatable. Non-option arguments return o_NON_OPTION_ARG
-+ * with the entire argument in value.
-+ *
-+ * For Zip and UnZip, permuting is on and all options and their values
-+ * are returned before any non-option arguments like archive name.
-+ *
-+ * The arguments "-" alone and "--" alone return as non-option arguments.
-+ * Note that "-" should not be used as part of a short option
-+ * entry in the table but can be used in the middle of long
-+ * options such as in the long option "a-long-option". Now "--" alone
-+ * stops option processing, returning any arguments following "--" as
-+ * non-option arguments instead of options.
-+ *
-+ * Argument file support is removed from this version. It may be added later.
-+ *
-+ * After each call:
-+ * argc is set to the current size of args[] but should not change
-+ * with argument file support removed,
-+ * argnum is the index of the current arg,
-+ * value is either the value of the returned option or non-option
-+ * argument or NULL if option with no value,
-+ * negated is set if the option was negated by a trailing dash (-)
-+ * option_num is set to either the index in options[] for the option or
-+ * o_NO_OPTION_MATCH if no match.
-+ * Negation is checked before the value is read if the option is negatable so
-+ * that the - is not included in the value. If the option is not negatable
-+ * but takes a value then the - will start the value. If permuting then
-+ * argnum and first_nonopt_arg are unreliable and should not be used.
-+ *
-+ * Command line is read from left to right. As get_option() finds non-option
-+ * arguments (arguments not starting with - and that are not values to options)
-+ * it moves later options and values in front of the non-option arguments.
-+ * This permuting is turned off by setting enable_permute to 0. Then
-+ * get_option() will return options and non-option arguments in the order
-+ * found. Currently permuting is only done after an argument is completely
-+ * processed so that any value can be moved with options they go with. All
-+ * state information is stored in the parameters argnum, optchar,
-+ * first_nonopt_arg and option_num. You should not change these after the
-+ * first call to get_option(). If you need to back up to a previous arg then
-+ * set argnum to that arg (remembering that args may have been permuted) and
-+ * set optchar = 0 and first_nonopt_arg to the first non-option argument if
-+ * permuting. After all arguments are returned the next call to get_option()
-+ * returns 0. The caller can then call free_args(args) if appropriate.
-+ *
-+ * get_option() accepts arguments in the following forms:
-+ * short options
-+ * of 1 and 2 characters, e.g. a, b, cc, d, and ba, after a single
-+ * leading -, as in -abccdba. In this example if 'b' is followed by 'a'
-+ * it matches short option 'ba' else it is interpreted as short option
-+ * b followed by another option. The character - is not legal as a
-+ * short option or as part of a 2 character short option.
-+ *
-+ * If a short option has a value it immediately follows the option or
-+ * if that option is the end of the arg then the next arg is used as
-+ * the value. So if short option e has a value, it can be given as
-+ * -evalue
-+ * or
-+ * -e value
-+ * and now
-+ * -e=value
-+ * but now that = is optional a leading = is stripped for the first.
-+ * This change allows optional short option values to be defaulted as
-+ * -e=
-+ * Either optional or required values can be specified. Optional values
-+ * now use both forms as ignoring the later got confusing. Any
-+ * non-value short options can preceed a valued short option as in
-+ * -abevalue
-+ * Some value types (one_char and number) allow options after the value
-+ * so if oc is an option that takes a character and n takes a number
-+ * then
-+ * -abocVccn42evalue
-+ * returns value V for oc and value 42 for n. All values are strings
-+ * so programs may have to convert the "42" to a number. See long
-+ * options below for how value lists are handled.
-+ *
-+ * Any short option can be negated by following it with -. Any - is
-+ * handled and skipped over before any value is read unless the option
-+ * is not negatable but takes a value and then - starts the value.
-+ *
-+ * If the value for an optional value is just =, then treated as no
-+ * value.
-+ *
-+ * long options
-+ * of arbitrary length are assumed if an arg starts with -- but is not
-+ * exactly --. Long options are given one per arg and can be abbreviated
-+ * if the abbreviation uniquely matches one of the long options.
-+ * Exact matches always match before partial matches. If ambiguous an
-+ * error is generated.
-+ *
-+ * Values are specified either in the form
-+ * --longoption=value
-+ * or can be the following arg if the value is required as in
-+ * --longoption value
-+ * Optional values to long options must be in the first form.
-+ *
-+ * Value lists are specified by o_VALUE_LIST and consist of an option
-+ * that takes a value followed by one or more value arguments.
-+ * The two forms are
-+ * --option=value
-+ * or
-+ * -ovalue
-+ * for a single value or
-+ * --option value1 value2 value3 ... --option2
-+ * or
-+ * -o value1 value2 value3 ...
-+ * for a list of values. The list ends at the next option, the
-+ * end of the command line, or at a single "@" argument.
-+ * Each value is treated as if it was preceeded by the option, so
-+ * --option1 val1 val2
-+ * with option1 value_type set to o_VALUE_LIST is the same as
-+ * --option1=val1 --option1=val2
-+ *
-+ * Long options can be negated by following the option with - as in
-+ * --longoption-
-+ * Long options with values can also be negated if this makes sense for
-+ * the caller as:
-+ * --longoption-=value
-+ * If = is not followed by anything it is treated as no value.
-+ *
-+ * @path
-+ * Argument files support removed from this version. It may be added
-+ * back later.
-+ *
-+ * non-option argument
-+ * is any argument not given above. If enable_permute is 1 then
-+ * these are returned after all options, otherwise all options and
-+ * args are returned in order. Returns option ID o_NON_OPTION_ARG
-+ * and sets value to the argument.
-+ *
-+ *
-+ * Arguments to get_option:
-+ * int option_group - either UZO for UnZip or ZIO for ZipInfo
-+ * char ***pargs - pointer to arg array in the argv form
-+ * int *argc - returns the current argc for args incl. args[0]
-+ * int *argnum - the index of the current argument (caller
-+ * should set = 0 on first call and not change
-+ * after that)
-+ * int *optchar - index of next short opt in arg or special
-+ * int *first_nonopt_arg - used by get_option to permute args
-+ * int *negated - option was negated (had trailing -)
-+ * char *value - value of option if any (free when done with it)
-+ * or NULL
-+ * int *option_num - the index in options of the last option returned
-+ * (can be o_NO_OPTION_MATCH)
-+ * int recursion_depth - current depth of recursion
-+ * (always set to 0 by caller)
-+ * (always 0 with argument files support removed)
-+ *
-+ * Caller should only read the returned option ID and the value, negated,
-+ * and option_num (if required) parameters after each call.
-+ *
-+ * Ed Gordon
-+ * 8/24/2003 (last updated 3/1/2008 EG)
-+ *
-+ */
-+
-+unsigned long get_option(option_group, pargs, argc, argnum, optchar, value,
-+ negated, first_nonopt_arg, option_num, recursion_depth)
-+ int option_group;
-+ char ***pargs;
-+ int *argc;
-+ int *argnum;
-+ int *optchar;
-+ char **value;
-+ int *negated;
-+ int *first_nonopt_arg;
-+ int *option_num;
-+ int recursion_depth;
-+{
-+ char **args;
-+ unsigned long option_ID;
-+
-+ int argcnt;
-+ int first_nonoption_arg;
-+ char *arg = NULL;
-+ int h;
-+ int optc;
-+ int argn;
-+ int j;
-+ int v;
-+ int read_rest_args_verbatim = 0; /* 7/25/04 - ignore options and arg files for rest args */
-+
-+ /* caller should free value or assign it to another
-+ variable before calling get_option again. */
-+ *value = NULL;
-+
-+ /* if args is NULL then done */
-+ if (pargs == NULL) {
-+ *argc = 0;
-+ return 0;
-+ }
-+ args = *pargs;
-+ if (args == NULL) {
-+ *argc = 0;
-+ return 0;
-+ }
-+
-+ /* count args */
-+ for (argcnt = 0; args[argcnt]; argcnt++) ;
-+
-+ /* if no provided args then nothing to do */
-+ if (argcnt < 1 || (recursion_depth == 0 && argcnt < 2)) {
-+ *argc = argcnt;
-+ /* return 0 to note that no args are left */
-+ return 0;
-+ }
-+
-+ *negated = 0;
-+ first_nonoption_arg = *first_nonopt_arg;
-+ argn = *argnum;
-+ optc = *optchar;
-+
-+ if (optc == READ_REST_ARGS_VERBATIM) {
-+ read_rest_args_verbatim = 1;
-+ }
-+
-+ if (argn == -1 || (recursion_depth == 0 && argn == 0)) {
-+ /* first call */
-+ /* if depth = 0 then args[0] is argv[0] so skip */
-+ *option_num = o_NO_OPTION_MATCH;
-+ optc = THIS_ARG_DONE;
-+ first_nonoption_arg = -1;
-+ }
-+
-+ /* if option_num is set then restore last option_ID in case continuing
-+ value list */
-+ option_ID = 0;
-+ if (*option_num != o_NO_OPTION_MATCH) {
-+ option_ID = options[*option_num].option_ID;
-+ }
-+
-+ /* get next option if any */
-+ for (;;) {
-+ if (read_rest_args_verbatim) {
-+ /* rest of args after "--" are non-option args if doubledash_ends_options
-+ set */
-+ argn++;
-+ if (argn > argcnt || args[argn] == NULL) {
-+ /* done */
-+ option_ID = 0;
-+ break;
-+ }
-+ arg = args[argn];
-+ if ((*value = (char *)malloc(strlen(arg) + 1)) == NULL) {
-+ oWARN("memory - go");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, arg);
-+ *option_num = o_NO_OPTION_MATCH;
-+ option_ID = o_NON_OPTION_ARG;
-+ break;
-+
-+ /* permute non-option args after option args so options are returned
-+ first */
-+ } else if (enable_permute) {
-+ if (optc == SKIP_VALUE_ARG || optc == THIS_ARG_DONE ||
-+ optc == START_VALUE_LIST || optc == IN_VALUE_LIST ||
-+ optc == STOP_VALUE_LIST) {
-+ /* moved to new arg */
-+ if (first_nonoption_arg > -1 && args[first_nonoption_arg]) {
-+ /* do the permuting - move non-options after this option */
-+ /* if option and value separate args or starting list skip option */
-+ if (optc == SKIP_VALUE_ARG || optc == START_VALUE_LIST) {
-+ v = 1;
-+ } else {
-+ v = 0;
-+ }
-+ for (h = first_nonoption_arg; h < argn; h++) {
-+ arg = args[first_nonoption_arg];
-+ for (j = first_nonoption_arg; j < argn + v; j++) {
-+ args[j] = args[j + 1];
-+ }
-+ args[j] = arg;
-+ }
-+ first_nonoption_arg += 1 + v;
-+ }
-+ }
-+ } else if (optc == NON_OPTION_ARG) {
-+ /* if not permuting then already returned arg */
-+ optc = THIS_ARG_DONE;
-+ }
-+
-+ /* value lists */
-+ if (optc == STOP_VALUE_LIST) {
-+ optc = THIS_ARG_DONE;
-+ }
-+
-+ if (optc == START_VALUE_LIST || optc == IN_VALUE_LIST) {
-+ if (optc == START_VALUE_LIST) {
-+ /* already returned first value */
-+ argn++;
-+ optc = IN_VALUE_LIST;
-+ }
-+ argn++;
-+ arg = args[argn];
-+ /* if end of args and still in list and there are non-option args then
-+ terminate list */
-+ if (arg == NULL && (optc == START_VALUE_LIST || optc == IN_VALUE_LIST)
-+ && first_nonoption_arg > -1) {
-+ /* terminate value list with @ */
-+ /* this is only needed for argument files */
-+ /* but is also good for show command line so command lines with lists
-+ can always be read back in */
-+ argcnt = insert_arg(&args, "@", first_nonoption_arg, 1);
-+ argn++;
-+ if (first_nonoption_arg > -1) {
-+ first_nonoption_arg++;
-+ }
-+ }
-+
-+ arg = args[argn];
-+ if (arg && arg[0] == '@' && arg[1] == '\0') {
-+ /* inserted arguments terminator */
-+ optc = STOP_VALUE_LIST;
-+ continue;
-+ } else if (arg && arg[0] != '-') { /* not option */
-+ /* - and -- are not allowed in value lists unless escaped */
-+ /* another value in value list */
-+ if ((*value = (char *)malloc(strlen(args[argn]) + 1)) == NULL) {
-+ oWARN("memory - go");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, args[argn]);
-+ break;
-+
-+ } else {
-+ argn--;
-+ optc = THIS_ARG_DONE;
-+ }
-+ }
-+
-+ /* move to next arg */
-+ if (optc == SKIP_VALUE_ARG) {
-+ argn += 2;
-+ optc = 0;
-+ } else if (optc == THIS_ARG_DONE) {
-+ argn++;
-+ optc = 0;
-+ }
-+ if (argn > argcnt) {
-+ break;
-+ }
-+ if (args[argn] == NULL) {
-+ /* done unless permuting and non-option args */
-+ if (first_nonoption_arg > -1 && args[first_nonoption_arg]) {
-+ /* return non-option arguments at end */
-+ if (optc == NON_OPTION_ARG) {
-+ first_nonoption_arg++;
-+ }
-+ /* after first pass args are permuted but skipped over non-option
-+ args */
-+ /* swap so argn points to first non-option arg */
-+ j = argn;
-+ argn = first_nonoption_arg;
-+ first_nonoption_arg = j;
-+ }
-+ if (argn > argcnt || args[argn] == NULL) {
-+ /* done */
-+ option_ID = 0;
-+ break;
-+ }
-+ }
-+
-+ /* after swap first_nonoption_arg points to end which is NULL */
-+ if (first_nonoption_arg > -1 && (args[first_nonoption_arg] == NULL)) {
-+ /* only non-option args left */
-+ if (optc == NON_OPTION_ARG) {
-+ argn++;
-+ }
-+ if (argn > argcnt || args[argn] == NULL) {
-+ /* done */
-+ option_ID = 0;
-+ break;
-+ }
-+ if ((*value = (char *)malloc(strlen(args[argn]) + 1)) == NULL) {
-+ oWARN("memory - go");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, args[argn]);
-+ optc = NON_OPTION_ARG;
-+ option_ID = o_NON_OPTION_ARG;
-+ break;
-+ }
-+
-+ arg = args[argn];
-+
-+ /* is it an option */
-+ if (arg[0] == '-') {
-+ /* option */
-+ if (arg[1] == '\0') {
-+ /* arg = - */
-+ /* treat like non-option arg */
-+ *option_num = o_NO_OPTION_MATCH;
-+ if (enable_permute) {
-+ /* permute args to move all non-option args to end */
-+ if (first_nonoption_arg < 0) {
-+ first_nonoption_arg = argn;
-+ }
-+ argn++;
-+ } else {
-+ /* not permute args so return non-option args when found */
-+ if ((*value = (char *)malloc(strlen(arg) + 1)) == NULL) {
-+ oWARN("memory - go");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, arg);
-+ optc = NON_OPTION_ARG;
-+ option_ID = o_NON_OPTION_ARG;
-+ break;
-+ }
-+
-+ } else if (arg[1] == '-') {
-+ /* long option */
-+ if (arg[2] == '\0') {
-+ /* arg = -- */
-+ if (doubledash_ends_options) {
-+ /* Now -- stops permuting and forces the rest of
-+ the command line to be read verbatim - 7/25/04 EG */
-+
-+ /* never permute args after -- and return as non-option args */
-+ if (first_nonoption_arg < 1) {
-+ /* -- is first non-option argument - 8/7/04 EG */
-+ argn--;
-+ } else {
-+ /* go back to start of non-option args - 8/7/04 EG */
-+ argn = first_nonoption_arg - 1;
-+ }
-+
-+ /* disable permuting and treat remaining arguments as not
-+ options */
-+ read_rest_args_verbatim = 1;
-+ optc = READ_REST_ARGS_VERBATIM;
-+
-+ } else {
-+ /* treat like non-option arg */
-+ *option_num = o_NO_OPTION_MATCH;
-+ if (enable_permute) {
-+ /* permute args to move all non-option args to end */
-+ if (first_nonoption_arg < 0) {
-+ first_nonoption_arg = argn;
-+ }
-+ argn++;
-+ } else {
-+ /* not permute args so return non-option args when found */
-+ if ((*value = (char *)malloc(strlen(arg) + 1)) == NULL) {
-+ oWARN("memory - go");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, arg);
-+ optc = NON_OPTION_ARG;
-+ option_ID = o_NON_OPTION_ARG;
-+ break;
-+ }
-+ }
-+
-+ } else {
-+ option_ID = get_longopt(option_group, (ZCONST char **)args, argn,
-+ &optc, negated,
-+ value, option_num, recursion_depth);
-+ if (option_ID == o_BAD_ERR) {
-+ return o_BAD_ERR;
-+ } else if (option_ID == o_ARG_FILE_ERR) {
-+ /* unwind as only get this if recursion_depth > 0 */
-+ return option_ID;
-+ }
-+ break;
-+ }
-+
-+ } else {
-+ /* short option */
-+ option_ID = get_shortopt(option_group, (ZCONST char **)args, argn,
-+ &optc, negated,
-+ value, option_num, recursion_depth);
-+
-+ if (option_ID == o_BAD_ERR) {
-+ return o_BAD_ERR;
-+ } else if (option_ID == o_ARG_FILE_ERR) {
-+ /* unwind as only get this if recursion_depth > 0 */
-+ return option_ID;
-+ }
-+
-+ if (optc == 0) {
-+ /* if optc = 0 then ran out of short opts this arg */
-+ optc = THIS_ARG_DONE;
-+ } else {
-+ break;
-+ }
-+ }
-+
-+#if 0
-+ /* argument file code left out
-+ so for now let filenames start with @
-+ */
-+
-+ } else if (allow_arg_files && arg[0] == '@') {
-+ /* arg file */
-+ oERR(PK_PARMS, no_arg_files_err);
-+#endif
-+
-+ } else {
-+ /* non-option */
-+ if (enable_permute) {
-+ /* permute args to move all non-option args to end */
-+ if (first_nonoption_arg < 0) {
-+ first_nonoption_arg = argn;
-+ }
-+ argn++;
-+ } else {
-+ /* no permute args so return non-option args when found */
-+ if ((*value = (char *)malloc(strlen(arg) + 1)) == NULL) {
-+ oWARN("memory - go");
-+ return o_BAD_ERR;
-+ }
-+ strcpy(*value, arg);
-+ *option_num = o_NO_OPTION_MATCH;
-+ optc = NON_OPTION_ARG;
-+ option_ID = o_NON_OPTION_ARG;
-+ break;
-+ }
-+
-+ }
-+ }
-+
-+ *pargs = args;
-+ *argc = argcnt;
-+ *first_nonopt_arg = first_nonoption_arg;
-+ *argnum = argn;
-+ *optchar = optc;
-+
-+ return option_ID;
-+}
-diff -ru2 unz60e03/unzpriv.h u6e3_np/unzpriv.h
---- unz60e03/unzpriv.h Mon Mar 24 11:53:24 2008
-+++ u6e3_np/unzpriv.h Mon Mar 24 14:13:02 2008
-@@ -1271,4 +1271,89 @@
- #endif
-
-+
-+/*--------------------------------------------------------------------
-+ Long option support
-+ 23 August 2003
-+ Updated for UnZip 1 March 2008
-+ See unzip.c
-+ --------------------------------------------------------------------*/
-+
-+/* The below is for use in the caller-provided options table */
-+
-+/* option groups */
-+#define UZO 1 /* UnZip option */
-+#define ZIO 2 /* ZipInfo option */
-+
-+
-+/* value_type - value is always returned as a string. */
-+#define o_NO_VALUE 0 /* this option does not take a value */
-+#define o_REQUIRED_VALUE 1 /* this option requires a value */
-+#define o_OPTIONAL_VALUE 2 /* value is optional (see get_option() for details) */
-+#define o_VALUE_LIST 3 /* this option takes a list of values */
-+#define o_ONE_CHAR_VALUE 4 /* next char is value (does not end short opt string) */
-+#define o_NUMBER_VALUE 5 /* value is integer (does not end short opt string) */
-+
-+
-+/* negatable - a dash following the option (but before any value) sets negated. */
-+#define o_NOT_NEGATABLE 0 /* trailing '-' to negate either starts value or generates error */
-+#define o_NEGATABLE 1 /* trailing '-' sets negated to TRUE */
-+
-+
-+/* option_num can be this when option not in options table */
-+#define o_NO_OPTION_MATCH -1
-+
-+/* special values returned by get_option - do not use these as option IDs */
-+#define o_NON_OPTION_ARG ((unsigned long) 0xFFFF) /* returned for non-option
-+ args */
-+#define o_ARG_FILE_ERR ((unsigned long) 0xFFFE) /* internal recursion
-+ return (user never sees) */
-+#define o_BAD_ERR ((unsigned long) 0xFFFD) /* bad error */
-+
-+/* options array is set in unzip.c */
-+struct option_struct {
-+ int option_group; /* either UZO for UnZip or ZIO for ZipInfo syntax */
-+ char Far *shortopt; /* pointer to short option string */
-+ char Far *longopt; /* pointer to long option string */
-+ int value_type; /* from above */
-+ int negatable; /* from above */
-+ unsigned long option_ID; /* value returned by get_option when this option
-+ is found */
-+ char Far *name; /* optional string for option returned on some
-+ errors */
-+};
-+
-+/* structure used to create -x and include file lists */
-+struct file_list {
-+ char *name;
-+ struct file_list *next;
-+};
-+
-+
-+/* function prototypes */
-+
-+/* get the next option from args */
-+unsigned long get_option OF((int option_group,
-+ char ***pargs, int *argc, int *argnum,
-+ int *optchar,
-+ char **value, int *negated, int *first_nonopt_arg,
-+ int *option_num, int recursion_depth));
-+
-+/* copy args - copy an args array, allocating space as needed */
-+char **copy_args OF((char **args, int max_args));
-+
-+/* arg count - count args in argv like array */
-+int arg_count OF((char **args));
-+
-+/* free args - free args created with one of these functions */
-+int free_args OF((char **args));
-+
-+/* insert arg - copy an arg into args */
-+int insert_arg OF((char ***args, ZCONST char *arg, int insert_at,
-+ int free_args));
-+
-+/*--------------------------------------------------------------------
-+ End of Long option support
-+ --------------------------------------------------------------------*/
-+
- /***********************************/
- /* LARGE_FILE_SUPPORT */
-diff -ru2 unz60e03/vms/cmdline.c u6e3_np/vms/cmdline.c
---- unz60e03/vms/cmdline.c Tue Feb 12 01:37:42 2008
-+++ u6e3_np/vms/cmdline.c Mon Mar 24 14:13:10 2008
-@@ -34,4 +34,6 @@
- ** Modified by:
- **
-+** 02-014 E. Gordon 10-Mar-2008 03:12
-+** Modified to work with get_options().
- ** 02-013 S. Schweda, C. Spieler 29-Dec-2007 03:34
- ** Extended /RESTORE qualifier to support timestamp restoration
-@@ -172,10 +174,10 @@
- $DESCRIPTOR(cli_text_auto, "TEXT.AUTO"); /* -a */
- $DESCRIPTOR(cli_text_all, "TEXT.ALL"); /* -aa */
--$DESCRIPTOR(cli_text_none, "TEXT.NONE"); /* ---a */
-+$DESCRIPTOR(cli_text_none, "TEXT.NONE"); /* -a- */
- $DESCRIPTOR(cli_text_stmlf, "TEXT.STMLF"); /* -S */
- $DESCRIPTOR(cli_binary, "BINARY"); /* -b[b] */
- $DESCRIPTOR(cli_binary_auto, "BINARY.AUTO"); /* -b */
- $DESCRIPTOR(cli_binary_all, "BINARY.ALL"); /* -bb */
--$DESCRIPTOR(cli_binary_none, "BINARY.NONE"); /* ---b */
-+$DESCRIPTOR(cli_binary_none, "BINARY.NONE"); /* -b- */
- $DESCRIPTOR(cli_case_insensitive,"CASE_INSENSITIVE"); /* -C */
- $DESCRIPTOR(cli_screen, "SCREEN"); /* -c */
-@@ -202,5 +204,5 @@
- $DESCRIPTOR(cli_restore_own, "RESTORE.OWNER_PROT"); /* -X */
- $DESCRIPTOR(cli_restore_date, "RESTORE.DATE"); /* -DD */
--$DESCRIPTOR(cli_restore_date_all, "RESTORE.DATE.ALL"); /* --D */
-+$DESCRIPTOR(cli_restore_date_all, "RESTORE.DATE.ALL"); /* -D- */
- $DESCRIPTOR(cli_restore_date_files, "RESTORE.DATE.FILES"); /* -D */
- $DESCRIPTOR(cli_dot_version, "DOT_VERSION"); /* -Y */
-@@ -299,4 +301,6 @@
- ** SS$_ABORT - Bad time value
- **
-+** Modified to work with the get_option() command line parser. 10 March 2008
-+**
- */
- register unsigned long status;
-@@ -419,5 +423,4 @@
- if (status != CLI$_ABSENT) {
- *ptr++ = '-';
-- *ptr++ = '-';
- *ptr++ = 'b';
- if ((status & 1) &&
-@@ -427,4 +430,5 @@
- *ptr++ = 'b';
- }
-+ *ptr++ = '-';
- }
-
-@@ -436,5 +440,4 @@
- if (status != CLI$_ABSENT) {
- *ptr++ = '-';
-- *ptr++ = '-';
- *ptr++ = 'a';
- if ((status & 1) &&
-@@ -446,4 +449,5 @@
- *ptr++ = 'S';
- }
-+ *ptr++ = '-';
- }
-
-diff -ru2 unz60e03/zipinfo.c u6e3_np/zipinfo.c
---- unz60e03/zipinfo.c Mon Mar 24 14:23:54 2008
-+++ u6e3_np/zipinfo.c Mon Mar 24 14:25:24 2008
-@@ -171,4 +171,6 @@
- static ZCONST char Far ZipfileCommTruncMsg[] =
- "\ncaution: zipfile comment truncated\n";
-+static ZCONST char Far NoMemArguments[] =
-+ "envargs: cannot get memory for arguments";
-
- static ZCONST char Far CentralDirEntry[] =
-@@ -459,10 +461,48 @@
- __GDEF
- {
-- char **argv, *s;
-- int argc, c, error=FALSE, negative=0;
-+ int argc, error=FALSE;
- int hflag_slmv=TRUE, hflag_2=FALSE; /* diff options => diff defaults */
- int tflag_slm=TRUE, tflag_2v=FALSE;
- int explicit_h=FALSE, explicit_t=FALSE;
-
-+ char **args;
-+
-+
-+ /* used by get_option */
-+ unsigned long option; /* option ID returned by get_option */
-+ int argcnt = 0; /* current argcnt in args */
-+ int argnum = 0; /* arg number */
-+ int optchar = 0; /* option state */
-+ char *value = NULL; /* non-option arg, option value or NULL */
-+ int negative = 0; /* 1 = option negated */
-+ int fna = 0; /* current first non-opt arg */
-+ int optnum = 0; /* index in table */
-+
-+
-+ /* since get_option() returns xfiles and files one at a time, store them in
-+ linked lists until have them all */
-+
-+ int file_count;
-+ struct file_list *next_file;
-+
-+ /* files to extract */
-+ int in_files_count = 0;
-+ struct file_list *in_files = NULL;
-+ struct file_list *next_in_files = NULL;
-+
-+ /* files to exclude in -x list */
-+ int in_xfiles_count = 0;
-+ struct file_list *in_xfiles = NULL;
-+ struct file_list *next_in_xfiles = NULL;
-+
-+ G.wildzipfn = NULL;
-+
-+ /* make copy of args that can use with insert_arg() used by get_option() */
-+ args = copy_args(*pargv, 0);
-+
-+
-+ /* Initialize lists */
-+ G.filespecs = 0;
-+ G.xfilespecs = 0;
-
- #ifdef MACOS
-@@ -470,17 +510,41 @@
- #endif
- G.extract_flag = FALSE; /* zipinfo does not extract to disk */
-- argc = *pargc;
-- argv = *pargv;
-
-- while (--argc > 0 && (*++argv)[0] == '-') {
-- s = argv[0] + 1;
-- while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */
-- switch (c) {
-- case '-':
-- ++negative;
-- break;
-+
-+ /*
-+ -------------------------------------------
-+ Process command line using get_option
-+ -------------------------------------------
-+
-+ Each call to get_option() returns either a command
-+ line option and possible value or a non-option argument.
-+ Arguments are permuted so that all options (-r, -b temp)
-+ are returned before non-option arguments (zipfile).
-+ Returns 0 when nothing left to read.
-+ */
-+
-+ /* set argnum = 0 on first call to init get_option */
-+ argnum = 0;
-+
-+ /* get_option returns the option ID and updates parameters:
-+ args - usually same as argv if no argument file support
-+ argcnt - current argc for args
-+ value - char* to value (free() when done with it) or NULL if no value
-+ negated - option was negated with trailing -
-+ */
-+
-+ while ((option = get_option(ZIO, &args, &argcnt, &argnum,
-+ &optchar, &value, &negative,
-+ &fna, &optnum, 0)))
-+ {
-+ if(option == o_BAD_ERR) {
-+ return(PK_PARAM);
-+ }
-+
-+ switch (option)
-+ {
- case '1': /* shortest listing: JUST filenames */
- if (negative)
-- uO.lflag = -2, negative = 0;
-+ uO.lflag = -2;
- else
- uO.lflag = 1;
-@@ -488,5 +552,5 @@
- case '2': /* just filenames, plus headers if specified */
- if (negative)
-- uO.lflag = -2, negative = 0;
-+ uO.lflag = -2;
- else
- uO.lflag = 2;
-@@ -495,5 +559,5 @@
- case ('C'): /* -C: match filenames case-insensitively */
- if (negative)
-- uO.C_flag = FALSE, negative = 0;
-+ uO.C_flag = FALSE;
- else
- uO.C_flag = TRUE;
-@@ -502,5 +566,5 @@
- case 'h': /* header line */
- if (negative)
-- hflag_2 = hflag_slmv = FALSE, negative = 0;
-+ hflag_2 = hflag_slmv = FALSE;
- else {
- hflag_2 = hflag_slmv = explicit_h = TRUE;
-@@ -511,5 +575,5 @@
- case 'l': /* longer form of "ls -l" type listing */
- if (negative)
-- uO.lflag = -2, negative = 0;
-+ uO.lflag = -2;
- else
- uO.lflag = 5;
-@@ -517,5 +581,5 @@
- case 'm': /* medium form of "ls -l" type listing */
- if (negative)
-- uO.lflag = -2, negative = 0;
-+ uO.lflag = -2;
- else
- uO.lflag = 4;
-@@ -524,5 +588,5 @@
- case 'M': /* send output through built-in "more" */
- if (negative)
-- G.M_flag = FALSE, negative = 0;
-+ G.M_flag = FALSE;
- else
- G.M_flag = TRUE;
-@@ -531,5 +595,5 @@
- case 's': /* default: shorter "ls -l" type listing */
- if (negative)
-- uO.lflag = -2, negative = 0;
-+ uO.lflag = -2;
- else
- uO.lflag = 3;
-@@ -537,5 +601,5 @@
- case 't': /* totals line */
- if (negative)
-- tflag_2v = tflag_slm = FALSE, negative = 0;
-+ tflag_2v = tflag_slm = FALSE;
- else {
- tflag_2v = tflag_slm = explicit_t = TRUE;
-@@ -546,5 +610,5 @@
- case ('T'): /* use (sortable) decimal time format */
- if (negative)
-- uO.T_flag = FALSE, negative = 0;
-+ uO.T_flag = FALSE;
- else
- uO.T_flag = TRUE;
-@@ -552,8 +616,7 @@
- #ifdef UNICODE_SUPPORT
- case ('U'): /* escape UTF-8, or disable UTF-8 support */
-- if (negative) {
-- uO.U_flag = MAX(uO.U_flag-negative,0);
-- negative = 0;
-- } else
-+ if (negative)
-+ uO.U_flag = MAX(uO.U_flag - 1, 0);
-+ else
- uO.U_flag++;
- break;
-@@ -561,5 +624,5 @@
- case 'v': /* turbo-verbose listing */
- if (negative)
-- uO.lflag = -2, negative = 0;
-+ uO.lflag = -2;
- else
- uO.lflag = 10;
-@@ -568,12 +631,36 @@
- case ('W'): /* Wildcard interpretation (stop at '/'?) */
- if (negative)
-- uO.W_flag = FALSE, negative = 0;
-+ uO.W_flag = FALSE;
- else
- uO.W_flag = TRUE;
- break;
- #endif /* WILD_STOP_AT_DIR */
-+ case ('x'): /* extract: default */
-+ /* add -x file to linked list */
-+
-+ if (in_xfiles_count == 0) {
-+ /* first entry */
-+ if ((in_xfiles = (struct file_list *) malloc(sizeof(struct file_list))) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArguments)));
-+ return PK_MEM;
-+ }
-+ in_xfiles->name = value;
-+ in_xfiles->next = NULL;
-+ next_in_xfiles = in_xfiles;
-+ } else {
-+ /* add next entry */
-+ if ((next_file = (struct file_list *) malloc(sizeof(struct file_list))) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArguments)));
-+ return PK_MEM;
-+ }
-+ next_in_xfiles->next = next_file;
-+ next_file->name = value;
-+ next_file->next = NULL;
-+ next_in_xfiles = next_file;
-+ }
-+ in_xfiles_count++;
- case 'z': /* print zipfile comment */
- if (negative)
-- uO.zflag = negative = 0;
-+ uO.zflag = 0;
- else
- uO.zflag = 1;
-@@ -581,13 +668,96 @@
- case 'Z': /* ZipInfo mode: ignore */
- break;
-+ case o_NON_OPTION_ARG:
-+ /* not an option */
-+ /* no more options as permuting */
-+
-+
-+ if (G.wildzipfn == NULL) {
-+ /* first non-option argument is zip file */
-+ G.wildzipfn = value;
-+
-+ } else {
-+ /* add include file to list */
-+ if (in_files_count == 0) {
-+ /* first entry */
-+ if ((next_file = (struct file_list *) malloc(sizeof(struct file_list))) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArguments)));
-+ return PK_MEM;
-+ }
-+ next_file->name = value;
-+ next_file->next = NULL;
-+ in_files = next_file;
-+ next_in_files = next_file;
-+ } else {
-+ /* add next entry */
-+ if ((next_file = (struct file_list *) malloc(sizeof(struct file_list))) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArguments)));
-+ return PK_MEM;
-+ }
-+ next_in_files->next = next_file;
-+ next_file->name = value;
-+ next_file->next = NULL;
-+ next_in_files = next_file;
-+ }
-+ in_files_count++;
-+ }
-+ break;
- default:
- error = TRUE;
- break;
-- }
-- }
-+ } /* switch */
-+ } /* get_option() */
-+
-+ /* convert files and xfiles lists to arrays */
-+
-+ /* convert files list to array */
-+ if (in_files_count) {
-+ if ((G.pfnames = (char **) malloc((in_files_count + 1) * sizeof(char *))) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArguments)));
-+ return PK_MEM;
-+ }
-+ file_count = 0;
-+ for (next_file = in_files; next_file;) {
-+ G.pfnames[file_count] = next_file->name;
-+ in_files = next_file;
-+ next_file = next_file->next;
-+ free(in_files);
-+ file_count++;
-+ }
-+ G.pfnames[file_count] = NULL;
-+ G.filespecs = in_files_count;
-+ }
-+
-+ /* convert xfiles list to array */
-+ if (in_xfiles_count) {
-+ if ((G.pxnames = (char **) malloc((in_xfiles_count + 1) * sizeof(char *))) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArguments)));
-+ return PK_MEM;
-+ }
-+ file_count = 0;
-+ for (next_file = in_xfiles; next_file;) {
-+ G.pxnames[file_count] = next_file->name;
-+ in_xfiles = next_file;
-+ next_file = next_file->next;
-+ free(in_xfiles);
-+ file_count++;
-+ }
-+ G.pxnames[file_count] = NULL;
-+ G.xfilespecs = in_xfiles_count;
- }
-- if ((argc-- == 0) || error) {
-+
-+ if (in_files_count || in_xfiles_count) {
-+ G.process_all_files = FALSE;
-+ } else {
-+ G.process_all_files = TRUE; /* for speed */
-+ }
-+
-+ /* it's possible the arg count could have been changed by get_option() */
-+ argc = arg_count(args);
-+
-+ if ((G.wildzipfn == NULL) || error) {
-+ argc = -1; /* tell the caller to stop processing */
- *pargc = argc;
-- *pargv = argv;
-+ *pargv = args;
- return USAGE(error);
- }
-@@ -628,5 +798,5 @@
-
- *pargc = argc;
-- *pargv = argv;
-+ *pargv = args;
- return 0;
-
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
#include "os2acl.h"
-extern ZCONST char Far TruncEAs[];
-
/* local prototypes */
#ifdef TIMESTAMP
static ZCONST char Far Creating[] = " creating: %-22s ";
static ZCONST char Far ConversionFailed[] =
"mapname: conversion of %s failed\n";
-static ZCONST char Far Labelling[] = "labelling %c: %-22s\n";
+static ZCONST char Far Labeling[] = "labeling %c: %-22s\n";
static ZCONST char Far ErrSetVolLabel[] =
"mapname: error setting volume label\n";
static ZCONST char Far PathTooLong[] = "checkdir error: path too long: %s\n";
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
if (!renamed) { /* cp already set if renamed */
- if (uO.jflag) /* junking directories */
-/* GRR: watch out for VMS version... */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
}
/*---------------------------------------------------------------------------
Info(slide, 1, ((char *)slide, "%-22s ",
FnFilter1(G.filename)));
Info(slide, 1, ((char *)slide, LoadFarString(TruncEAs),
- makeword(G.extra_field+2)-10, "\n"));
+ (long)makeword(G.extra_field+2)-10, "\n"));
} else if (!uO.qflag)
(*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0);
} else if (!uO.qflag)
Info(slide, 0x421, ((char *)slide, "%-22s ",
FnFilter1(G.filename)));
Info(slide, 0x401, ((char *)slide, LoadFarString(TruncEAs),
- makeword(G.extra_field+2)-10, "\n"));
+ (long)makeword(G.extra_field+2)-10, "\n"));
}
/* set date/time stamps (dirs only have creation times) */
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended "###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1; /* semi-colon was kept: expect #s after */
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
#ifdef ACORN_FTYPE_NFS
FSInfoBuf.cch = (BYTE)strlen(FSInfoBuf.szVolLabel);
if (!uO.qflag)
- Info(slide, 0, ((char *)slide, LoadFarString(Labelling),
+ Info(slide, 0, ((char *)slide, LoadFarString(Labeling),
(char)(G.os2.nLabelDrive + 'a' - 1), FnFilter1(G.filename)));
if (DosSetFSInfo(G.os2.nLabelDrive, FSIL_VOLSER, (PBYTE)&FSInfoBuf,
sizeof(VOLUMELABEL)))
*pEndFAT = pEnd; /* oops...didn't have 8 chars to truncate */
else
**pEndFAT = '\0';
- } else if (MIN(plu - pBegin, 8) + MIN(pEnd - plu - 1, 3) > 8) {
+ } else if (IZ_MIN(plu - pBegin, 8) + IZ_MIN(pEnd - plu - 1, 3) > 8) {
last_dot = plu; /* be lazy: drop through to next if-block */
} else if ((pEnd - *pEndFAT) > 8) {
*pEndFAT += 8; /* more fits into just basename than if */
Info(slide, 1, ((char *)slide, "%-22s ",
FnFilter1(G.filename)));
Info(slide, 1, ((char *)slide, LoadFarString(TruncEAs),
- makeword(G.extra_field+2)-10, uO.qflag? "\n" : ""));
+ (long)makeword(G.extra_field+2)-10, uO.qflag? "\n" : ""));
}
}
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2012 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.
# define nearmalloc malloc
# define nearfree free
# endif
-# ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
# if (defined(M_I86TM) || defined(M_I86SM) || defined(M_I86MM))
# error Deflate64(tm) requires compact or large memory model
# endif
/* the 64k history buffer for Deflate64 must be allocated specially */
# define MALLOC_WORK
# define MY_ZCALLOC
-# endif
+# endif /* def DEFLATE64_SUPPORT */
#endif
/* TIMESTAMP is now supported on OS/2, so enable it by default */
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
#define UNZIP_INTERNAL
#include "unzip.h"
#ifdef WINDLL
-# ifdef POCKET_UNZIP
-# include "wince/intrface.h"
-# else
-# include "windll/windll.h"
-# endif
+# ifdef POCKET_UNZIP
+# include "wince/intrface.h"
+# else
+# include "windll/windll.h"
+# endif
#endif
#if defined(DYNALLOC_CRCTAB) || defined(UNICODE_SUPPORT)
-# include "crc32.h"
+# include "crc32.h"
#endif
static int do_seekable OF((__GPRO__ int lastchance));
"\nAuto-run command: %s\nExecute this command? [y/n] ";
static ZCONST char Far NotAutoRunning[] =
"Not executing auto-run command.";
-# endif
-
-#else /* !SFX */
+# endif /* def CHEAP_SFX_AUTORUN */
+#else /* def SFX */
/* process_zipfiles() strings */
+# ifdef VMS
+ static ZCONST char Far DestDirPrompt[] =
+ "\nDestination subdirectory name (only -- No \"[\", \"]\", \".DIR\"): ";
+# else /* def VMS */
+ static ZCONST char Far DestDirPrompt[] =
+ "\nDestination subdirectory name: ";
+#endif /* def VMS [else] */
+ static ZCONST char Far InputError[] =
+ " NULL\n(EOF or read error)\n";
# if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME))
static ZCONST char Far WarnInvalidTZ[] =
"Warning: TZ environment variable not found, cannot use UTC times!!\n";
# if !(defined(UNIX) || defined(AMIGA))
static ZCONST char Far CannotFindWildcardMatch[] =
"%s: cannot find any matches for wildcard specification \"%s\".\n";
-# endif /* !(UNIX || AMIGA) */
+# endif /* !(defined(UNIX) || defined(AMIGA)) */
+ static ZCONST char Far AutoDestDirQuery[] =
+"[D]ifferent destination, [R]etry, re[U]se existing dir, or [S]kip archive? ";
+ static ZCONST char Far BadAutoDestDir[] =
+ " Automatic destination directory exists: %s\n";
+ static ZCONST char Far BadDestDir[] =
+ " Destination directory exists: %s\n";
static ZCONST char Far FilesProcessOK[] =
"%d archive%s successfully processed.\n";
static ZCONST char Far ArchiveWarning[] =
%s%s.zip, and cannot find %s, period.\n";
static ZCONST char Far CannotFindEitherZipfile[] =
"%s: cannot find or open %s, %s.zip or %s.\n";
-# else /* !UNIX */
+# else /* def UNIX */
static ZCONST char Far CannotFindZipfileDirMsg[] =
"%s: cannot find zipfile directory in %s,\n\
%sand cannot find %s, period.\n";
-# ifdef VMS
+# ifdef VMS
static ZCONST char Far CannotFindEitherZipfile[] =
"%s: cannot find %s (%s).\n";
-# else /* !VMS */
+# else /* def VMS */
static ZCONST char Far CannotFindEitherZipfile[] =
"%s: cannot find either %s or %s.\n";
-# endif /* ?VMS */
-# endif /* ?UNIX */
- extern ZCONST char Far Zipnfo[]; /* in unzip.c */
-#ifndef WINDLL
+# endif /* def VMS [else] */
+# endif /* def UNIX [else] */
+# ifndef WINDLL
static ZCONST char Far Unzip[] = "unzip";
-#else
+# else
static ZCONST char Far Unzip[] = "UnZip DLL";
-#endif
-#ifdef DO_SAFECHECK_2GB
+# endif
+# ifdef DO_SAFECHECK_2GB
static ZCONST char Far ZipfileTooBig[] =
"Trying to read large file (> 2 GiB) without large file support\n";
-#endif /* DO_SAFECHECK_2GB */
+# endif /* DO_SAFECHECK_2GB */
static ZCONST char Far MaybeExe[] =
"note: %s may be a plain executable, not an archive\n";
- static ZCONST char Far CentDirNotInZipMsg[] = "\n\
+ static ZCONST char Far CentDirNotInZipMsg[] = "\
[%s]:\n\
Zipfile is disk %lu of a multi-disk archive, and this is not the disk on\n\
which the central zipfile directory begins (disk %lu).\n";
static ZCONST char Far EndCentDirBogus[] =
- "\nwarning [%s]: end-of-central-directory record claims this\n\
+ "warning [%s]: end-of-central-directory record claims this\n\
is disk %lu but that the central directory starts on disk %lu; this is a\n\
contradiction. Attempting to process anyway.\n";
# ifdef NO_MULTIPART
static ZCONST char Far NoMultiDiskArcSupport[] =
- "\nerror [%s]: zipfile is part of multi-disk archive\n\
+ "error [%s]: zipfile is part of multi-disk archive\n\
(sorry, not yet supported).\n";
static ZCONST char Far MaybePakBug[] = "warning [%s]:\
zipfile claims to be 2nd disk of a 2-part archive;\n\
static ZCONST char Far ExtraBytesAtStart[] =
"warning [%s]: %s extra byte%s at beginning or within zipfile\n\
(attempting to process anyway)\n";
-#endif /* ?SFX */
+#endif /* def SFX [else] */
#if ((!defined(WINDLL) && !defined(SFX)) || !defined(NO_ZIPINFO))
static ZCONST char Far LogInitline[] = "Archive: %s\n";
static ZCONST char Far Cent64EndSigSearchOff[] =
"error: End-of-centdir-64 signature not where expected (prepended bytes?)\n\
(attempting to process anyway)\n";
-#ifndef SFX
+#ifdef SFX
+ static ZCONST char Far CentDirEndSigNotFound[] =
+ " End-of-central-directory signature not found.\n";
+#else /* def SFX */
static ZCONST char Far CentDirTooLong[] =
"error [%s]: reported length of central directory is\n\
%s bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1\n\
a zipfile, or it constitutes one disk of a multi-part archive. In the\n\
latter case the central directory and zipfile comment will be found on\n\
the last disk(s) of this archive.\n";
-#else /* SFX */
- static ZCONST char Far CentDirEndSigNotFound[] =
- " End-of-central-directory signature not found.\n";
-#endif /* ?SFX */
+#endif /* def SFX [else] */
#ifdef TIMESTAMP
static ZCONST char Far ZipTimeStampFailed[] =
"warning: cannot set time for %s\n";
"Updated time stamp for %s.\n";
#endif
static ZCONST char Far ZipfileCommTrunc1[] =
- "\ncaution: zipfile comment truncated\n";
+ "caution: zipfile comment truncated\n";
#ifndef NO_ZIPINFO
static ZCONST char Far NoZipfileComment[] =
"There is no zipfile comment.\n";
"========================= zipfile comment ends\
===========================\n";
static ZCONST char Far ZipfileCommTrunc2[] =
- "\n The zipfile comment is truncated.\n";
-#endif /* !NO_ZIPINFO */
+ " The zipfile comment is truncated.\n";
+#endif /* ndef NO_ZIPINFO */
#ifdef UNICODE_SUPPORT
static ZCONST char Far UnicodeVersionError[] =
- "\nwarning: Unicode Path version > 1\n";
+ "warning: Unicode Path version > 1\n";
static ZCONST char Far UnicodeMismatchError[] =
- "\nwarning: Unicode Path checksum invalid\n";
+ "warning: Unicode Path checksum invalid\n";
#endif
__GDEF
{
#ifndef SFX
- char *lastzipfn = (char *)NULL;
- int NumWinFiles, NumLoseFiles, NumWarnFiles;
- int NumMissDirs, NumMissFiles;
-#endif
- int error=0, error_in_archive=0;
-
+ char *zipfn_prev = (char *)NULL;
+ int NumLoseFiles;
+ int NumMissDirs;
+ int NumMissFiles;
+ int NumWarnFiles;
+ int NumWinFiles;
+
+ char *auto_dest_dir;
+# ifdef VMS
+# define AUTO_DEST_DIR_NAME auto_dest_dir_name
+ char *auto_dest_dir_name = NULL;
+# else /* def VMS */
+# define AUTO_DEST_DIR_NAME auto_dest_dir
+# endif /* def VMS [else] */
+#endif /* ndef SFX */
+
+ int error = 0;
+ int error_auto_dest = 0;
+ int error_in_archive = 0;
+ int want_blank = 0;
/*---------------------------------------------------------------------------
Start by allocating buffers and (re)constructing the various PK signature
strings.
---------------------------------------------------------------------------*/
- G.inbuf = (uch *)malloc(INBUFSIZ + 4); /* 4 extra for hold[] (below) */
- G.outbuf = (uch *)malloc(OUTBUFSIZ + 1); /* 1 extra for string term. */
+ G.inbuf = (uch *)izu_malloc(INBUFSIZ + 4); /* +4 for hold[] (below) */
+ G.outbuf = (uch *)izu_malloc(OUTBUFSIZ + 1); /* +1 for string term. */
if ((G.inbuf == (uch *)NULL) || (G.outbuf == (uch *)NULL)) {
Info(slide, 0x401, ((char *)slide,
}
G.hold = G.inbuf + INBUFSIZ; /* to check for boundary-spanning sigs */
#ifndef VMS /* VMS uses its own buffer scheme for textmode flush(). */
-#ifdef SMALL_MEM
+# ifdef SMALL_MEM
G.outbuf2 = G.outbuf+RAWBUFSIZ; /* never changes */
-#endif
-#endif /* !VMS */
+# endif
+#endif /* ndef VMS */
#if 0 /* CRC_32_TAB has been NULLified by CONSTRUCTGLOBALS !!!! */
/* allocate the CRC table later when we know we can read zipfile data */
iz_w32_prepareTZenv();
#endif
-#if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME))
-# ifndef VALID_TIMEZONE
-# define VALID_TIMEZONE(tmp) \
- (((tmp = getenv("TZ")) != NULL) && (*tmp != '\0'))
-# endif
+#if defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME)
+# ifndef VALID_TIMEZONE
+# define VALID_TIMEZONE(tmp) \
+ (((tmp = getenv("TZ")) != NULL) && (*tmp != '\0'))
+# endif
{
char *p;
G.tz_is_valid = VALID_TIMEZONE(p);
-# ifndef SFX
+# ifndef SFX
if (!G.tz_is_valid) {
Info(slide, 0x401, ((char *)slide, LoadFarString(WarnInvalidTZ)));
error_in_archive = error = PK_WARN;
}
-# endif /* !SFX */
+# endif /* ndef SFX */
}
-#endif /* IZ_CHECK_TZ && USE_EF_UT_TIME */
+#endif /* defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME) */
/* For systems that do not have tzset() but supply this function using another
name (_tzset() or something similar), an appropiate "#define tzset ..."
should be added to the system specifc configuration section. */
#if (!defined(T20_VMS) && !defined(MACOS) && !defined(RISCOS) && !defined(QDOS))
-#if (!defined(BSD) && !defined(MTS) && !defined(CMS_MVS) && !defined(TANDEM))
+# if (!defined(BSD) && !defined(MTS) && !defined(CMS_MVS) && !defined(TANDEM))
tzset();
-#endif
+# endif
#endif
/* Initialize UnZip's built-in pseudo hard-coded "ISO <--> OEM" translation,
#ifdef SFX
if ((error = do_seekable(__G__ 0)) == PK_NOZIP) {
-#ifdef EXE_EXTENSION
+# ifdef EXE_EXTENSION
int len=strlen(G.argv0);
/* append .exe if appropriate; also .sfx? */
- if ( (G.zipfn = (char *)malloc(len+sizeof(EXE_EXTENSION))) !=
+ if ( (G.zipfn = (char *)izu_malloc(len+sizeof(EXE_EXTENSION))) !=
(char *)NULL ) {
strcpy(G.zipfn, G.argv0);
strcpy(G.zipfn+len, EXE_EXTENSION);
error = do_seekable(__G__ 0);
- free(G.zipfn);
+ izu_free(G.zipfn);
G.zipfn = G.argv0; /* for "cannot find myself" message only */
}
-#endif /* EXE_EXTENSION */
-#ifdef WIN32
+# endif /* def EXE_EXTENSION */
+# ifdef WIN32
G.zipfn = G.argv0; /* for "cannot find myself" message only */
-#endif
+# endif
}
if (error) {
if (error == IZ_DIR)
Info(slide, 1, ((char *)slide, LoadFarString(CannotFindMyself),
G.zipfn));
}
-#ifdef CHEAP_SFX_AUTORUN
+# ifdef CHEAP_SFX_AUTORUN
if (G.autorun_command[0] && !uO.qflag) { /* NO autorun without prompt! */
Info(slide, 0x81, ((char *)slide, LoadFarString(AutorunPrompt),
FnFilter1(G.autorun_command)));
- if (fgets(G.answerbuf, 9, stdin) != (char *)NULL
- && toupper(*G.answerbuf) == 'Y')
+ if ((fgets_ans( __G) >= 0) && (toupper( *G.answerbuf) == 'Y'))
system(G.autorun_command);
else
Info(slide, 1, ((char *)slide, LoadFarString(NotAutoRunning)));
}
-#endif /* CHEAP_SFX_AUTORUN */
+# endif /* CHEAP_SFX_AUTORUN */
-#else /* !SFX */
+#else /* def SFX */
NumWinFiles = NumLoseFiles = NumWarnFiles = 0;
NumMissDirs = NumMissFiles = 0;
- while ((G.zipfn = do_wild(__G__ G.wildzipfn)) != (char *)NULL) {
+ while ((G.zipfn = do_wild(__G__ G.wildzipfn)) != (char *)NULL)
+ {
Trace((stderr, "do_wild( %s ) returns %s\n", G.wildzipfn, G.zipfn));
- lastzipfn = G.zipfn;
+ zipfn_prev = G.zipfn;
- /* print a blank line between the output of different zipfiles */
- if (!uO.qflag && error != PK_NOZIP && error != IZ_DIR
-#ifdef TIMESTAMP
- && (!uO.T_flag || uO.zipinfo_mode)
-#endif
- && (NumWinFiles+NumLoseFiles+NumWarnFiles+NumMissFiles) > 0)
+ /* Print a blank line between the output of different zipfiles. */
+ if (!uO.qflag && (want_blank != 0)
+# ifdef TIMESTAMP
+ && (!uO.T_flag || uO.zipinfo_mode)
+# endif
+ )
+ {
(*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0);
+ }
+ else
+ want_blank = 1;
- if ((error = do_seekable(__G__ 0)) == PK_WARN)
- ++NumWarnFiles;
- else if (error == IZ_DIR)
- ++NumMissDirs;
- else if (error == PK_NOZIP)
- ++NumMissFiles;
- else if (error != PK_OK)
+# ifndef SFX
+# define ANS ((char *)(slide + (extent)(WSIZE>> 1)))
+ /* Automatic destination subdirectory? */
+ if (uO.auto_exdir > 0)
+ {
+ int auto_exdir_state;
+ int temp_reuse;
+
+ auto_exdir_state = 1; /* Initial state. */
+ temp_reuse = 0;
+ while (auto_exdir_state > 0) /* Still ok? */
+ {
+ auto_exdir_state &= 3; /* Clear transient error flag. */
+ if ((auto_exdir_state& 3) == 1)
+ {
+ /* Get subdirectory name from archive name. */
+ auto_dest_dir = name_only( G.zipfn);
+ }
+ else if ((auto_exdir_state& 3) == 2)
+ {
+ /* Get subdirectory name from user. */
+ Info( slide, 0x81, ((char *)slide,
+ LoadFarString( DestDirPrompt)));
+ if (fgets( ANS, (WSIZE>> 1), stdin) == (char *)NULL)
+ {
+ /* fgets() failed (Null, EOF?). */
+ Info(slide, 1, ((char *)slide,
+ LoadFarString( InputError)));
+ auto_exdir_state = -1; /* Fatal error. */
+ }
+ else
+ {
+ /* Trim trailing newline. */
+ if ((strlen( ANS) > 0) && (ANS[ strlen( ANS)- 1] == '\n'))
+ {
+ ANS[ strlen( ANS)- 1] = '\0';
+ }
+ if (strlen( ANS) == 0)
+ {
+ /* Bad (null) response from user. */
+ auto_exdir_state |= 4; /* Transient error. */
+ }
+ else
+ {
+ /* Store the user-specified name. */
+ auto_dest_dir = izu_malloc( strlen( ANS)+ 1);
+ if (auto_dest_dir == NULL)
+ {
+ auto_exdir_state = -1; /* Fatal error. */
+ }
+ else
+ {
+ strcpy( auto_dest_dir, ANS);
+ }
+ }
+ }
+ } /* (Else, retry the same name.) */
+
+ if ((auto_exdir_state > 0) && (auto_exdir_state < 4))
+ {
+# ifdef VMS
+ /* For the existence test, VMS wants "directory_name.DIR". */
+ if (auto_dest_dir != NULL)
+ {
+# define DIR_TYPE ".DIR"
+ auto_dest_dir_name =
+ izu_malloc( (strlen( auto_dest_dir)+ sizeof( DIR_TYPE)));
+ if (auto_dest_dir_name != NULL)
+ {
+ strcpy( auto_dest_dir_name, auto_dest_dir);
+ strcpy( (auto_dest_dir_name+ strlen( auto_dest_dir)),
+ DIR_TYPE);
+ }
+ }
+# endif /* def VMS */
+ if (AUTO_DEST_DIR_NAME != NULL)
+ {
+ /* Name not found, or it's a directory, and reuse is ok? */
+ if ((SSTAT( AUTO_DEST_DIR_NAME, &G.statbuf) != 0) ||
+ ((S_ISDIR( G.statbuf.st_mode) &&
+ ((uO.auto_exdir > 1) || (temp_reuse != 0)))))
+ {
+# ifdef VMS
+ /* For use, VMS wants "[.directory_name]", so form it
+ * (in already allocated storage).
+ */
+ strcpy( AUTO_DEST_DIR_NAME, "[.");
+ strcat( AUTO_DEST_DIR_NAME, auto_dest_dir);
+ strcat( AUTO_DEST_DIR_NAME, "]");
+ izu_free( auto_dest_dir); /* Free the raw name storage. */
+# endif /* def VMS */
+ if (uO.exdir != NULL) /* Free any old storage. */
+ izu_free( uO.exdir);
+ uO.exdir = AUTO_DEST_DIR_NAME; /* Set the new dir name. */
+ auto_exdir_state = 0; /* Happy. */
+ }
+ else
+ {
+ auto_exdir_state |= 4; /* Transient error. */
+ }
+ }
+ else
+ {
+ auto_exdir_state |= 4; /* Transient error. */
+ }
+ }
+ if (auto_exdir_state >= 4)
+ {
+ /* Show the name of the archive being skipped. */
+# ifdef WIN32 /* Win32 console may require codepage conversion for G.zipfn. */
+ Info( slide, 0, ((char *)slide,
+ LoadFarString( LogInitline), FnFilter1( G.zipfn)));
+# else
+ Info( slide, 0, ((char *)slide,
+ LoadFarString( LogInitline), G.zipfn));
+# endif
+ /* Show the name of the bad destination directory. */
+ if ((auto_exdir_state& 1) != 0)
+ {
+ Info( slide, 1, ((char *)slide,
+ LoadFarString( BadAutoDestDir), AUTO_DEST_DIR_NAME));
+ auto_exdir_state = 2; /* Next, ask user. */
+ }
+ else
+ {
+ Info( slide, 1, ((char *)slide,
+ LoadFarString( BadDestDir), AUTO_DEST_DIR_NAME));
+ }
+
+ /* Ask Dest, Retry, reUse, Skip? */
+ *ANS = ' ';
+ while (*ANS == ' ')
+ {
+ temp_reuse = 0; /* Reset temp reuse flag. */
+ Info( slide, 0x81, ((char *)slide,
+ LoadFarString( AutoDestDirQuery)));
+ if (fgets( ANS, (WSIZE>> 1), stdin) == (char *)NULL)
+ {
+ /* fgets() failed (Null, EOF?). */
+ Info(slide, 1, ((char *)slide,
+ LoadFarString( InputError)));
+ auto_exdir_state = -1; /* Fatal error. */
+ *ANS = '\0';
+ }
+ else
+ {
+ /* Parse user input (first character). */
+ switch (*ANS)
+ {
+ case 'D':
+ case 'd':
+ auto_exdir_state = 2; /* Ask user. */
+ break;
+ case 'U':
+ case 'u': /* Same as 'R', except... */
+ temp_reuse = 1; /* Allow dest dir reuse (once). */
+ case 'R':
+ case 'r':
+ auto_exdir_state = 3; /* Retry. */
+ break;
+ case 'S':
+ case 's':
+ auto_exdir_state = -1; /* Fatal error. */
+ break;
+ default:
+ *ANS = ' '; /* Ask again. */
+ } /* switch */
+ }
+ } /* while (*ANS == ' ') (Dest, Retry, reUse, Skip?) */
+ }
+ } /* while (auto_exdir_state > 0) (Destination query.) */
+
+ if (auto_exdir_state != 0)
+ {
+ error_auto_dest = 1;
+ error = IZ_BADDEST;
++NumLoseFiles;
+ }
+ } /* if (uO.auto_exdir > 0) */
+
+ if (error_auto_dest == 0)
+# endif /* ndef SFX */
+ {
+ /* No auto dest dir problem. Process normally. */
+ error = do_seekable(__G__ 0);
+ Trace((stderr, "do_seekable(0) returns %d\n", error));
+
+ if (error == PK_WARN)
+ ++NumWarnFiles;
+ else if (error == IZ_DIR)
+ ++NumMissDirs;
+ else if (error == PK_NOZIP)
+ ++NumMissFiles;
+ else if (error != PK_OK)
+ ++NumLoseFiles;
+ else
+ ++NumWinFiles;
+ }
+# ifndef SFX
else
- ++NumWinFiles;
+ {
+ /* Bad auto dest dir. Don't process archive. Reset flag. */
+ error_auto_dest = 0;
+ }
+# endif /* ndef SFX */
- Trace((stderr, "do_seekable(0) returns %d\n", error));
if (error != IZ_DIR && error > error_in_archive)
error_in_archive = error;
-#ifdef WINDLL
+# ifdef WINDLL
if (error == IZ_CTRLC) {
free_G_buffers(__G);
return error;
}
-#endif
+# endif
+# ifndef SFX
+ if (uO.auto_exdir > 0)
+ {
+ /* Reset the root directory storage indicator to make ready
+ * for the next wildcard archive name (and its corresponding
+ * destination directory).
+ */
+ checkdir( __G__ (char *)NULL, END);
+ }
+# endif /* ndef SFX */
} /* end while-loop (wildcard zipfiles) */
- if ((NumWinFiles + NumWarnFiles + NumLoseFiles) == 0 &&
- (NumMissDirs + NumMissFiles) == 1 && lastzipfn != (char *)NULL)
+ if (((NumWinFiles + NumWarnFiles + NumLoseFiles) == 0) &&
+ ((NumMissDirs + NumMissFiles) == 1) && (zipfn_prev != (char *)NULL))
{
-#if (!defined(UNIX) && !defined(AMIGA)) /* filenames with wildcard characters */
- if (iswild(G.wildzipfn)) {
- if (iswild(lastzipfn)) {
+# if !defined(UNIX) && !defined(AMIGA) /* Filenames with wildcard chars. */
+ if (iswild(G.wildzipfn))
+ {
+ if (iswild(zipfn_prev)) {
NumMissDirs = NumMissFiles = 0;
error_in_archive = PK_COOL;
if (uO.qflag < 3)
LoadFarStringSmall((uO.zipinfo_mode ? Zipnfo : Unzip)),
G.wildzipfn));
}
- } else
-#endif
+ }
+ else
+# endif /* !defined(UNIX) && !defined(AMIGA) */
{
-#ifndef VMS
+# ifndef VMS
/* 2004-11-24 SMS.
* VMS has already tried a default file type of ".zip" in
* do_wild(), so adding ZSUFX here only causes confusion by
* do_seekable() again with the same zipfile name (and the
* lastchance flag set), just to trigger the error report...
*/
-#if defined(UNIX) || defined(QDOS)
+# if defined(UNIX) || defined(QDOS)
char *p =
-#endif
- strcpy(lastzipfn + strlen(lastzipfn), ZSUFX);
-#endif /* !VMS */
+# endif
+ strcpy( zipfn_prev+ strlen( zipfn_prev), ZSUFX);
+# endif /* ndef VMS */
- G.zipfn = lastzipfn;
+ G.zipfn = zipfn_prev;
NumMissDirs = NumMissFiles = 0;
error_in_archive = PK_COOL;
-#if defined(UNIX) || defined(QDOS)
+# if defined(UNIX) || defined(QDOS)
/* only Unix has case-sensitive filesystems */
/* Well FlexOS (sometimes) also has them, but support is per media */
/* and a pig to code for, so treat as case insensitive for now */
/* we do this under QDOS to check for .zip as well as _zip */
- if ((error = do_seekable(__G__ 0)) == PK_NOZIP || error == IZ_DIR) {
+ if (((error = do_seekable(__G__ 0)) == PK_NOZIP) ||
+ (error == IZ_DIR))
+ {
if (error == IZ_DIR)
++NumMissDirs;
strcpy(p, ALT_ZSUFX);
error = do_seekable(__G__ 1);
}
-#else
+# else
error = do_seekable(__G__ 1);
-#endif
+# endif
Trace((stderr, "do_seekable(1) returns %d\n", error));
switch (error) {
case PK_WARN:
if (error > error_in_archive)
error_in_archive = error;
-#ifdef WINDLL
+# ifdef WINDLL
if (error == IZ_CTRLC) {
free_G_buffers(__G);
return error;
}
-#endif
+# endif
}
}
-#endif /* ?SFX */
+#endif /* def SFX [else] */
/*---------------------------------------------------------------------------
Print summary of all zipfiles, assuming zipfile spec was a wildcard (no
---------------------------------------------------------------------------*/
#ifndef SFX
- if (iswild(G.wildzipfn) && uO.qflag < 3
-#ifdef TIMESTAMP
- && !(uO.T_flag && !uO.zipinfo_mode && uO.qflag > 1)
-#endif
+ if (iswild(G.wildzipfn) && (uO.qflag < 3)
+# ifdef TIMESTAMP
+ && !(uO.T_flag && !uO.zipinfo_mode && (uO.qflag > 1))
+# endif
)
{
- if ((NumMissFiles + NumLoseFiles + NumWarnFiles > 0 || NumWinFiles != 1)
-#ifdef TIMESTAMP
+ if (((NumMissFiles+ NumLoseFiles+ NumWarnFiles > 0) ||
+ (NumWinFiles != 1))
+# ifdef TIMESTAMP
&& !(uO.T_flag && !uO.zipinfo_mode && uO.qflag)
-#endif
+# endif
&& !(uO.tflag && uO.qflag > 1))
- (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0x401);
+ (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0x401);
+
if ((NumWinFiles > 1) ||
(NumWinFiles == 1 &&
NumMissDirs + NumMissFiles + NumLoseFiles + NumWarnFiles > 0))
if (NumWinFiles + NumLoseFiles + NumWarnFiles == 0)
Info(slide, 0x401, ((char *)slide, LoadFarString(NoZipfileFound)));
}
-#endif /* !SFX */
+#endif /* ndef SFX */
+ /* 2012-12-11 SMS.
+ * Freeing dynamic storage is now done by globals.h:DESTROYGLOBALS()
+ * (using free_G_buffers()), but only if REENTRANT.
+ */
+#if 0
/* free allocated memory */
free_G_buffers(__G);
+#endif /* 0 */
return error_in_archive;
+#ifdef REENTRANT
/*****************************/
/* Function free_G_buffers() */
void free_G_buffers(__G) /* releases all memory allocated in global vars */
__GDEF
{
-#ifndef SFX
+# ifndef SFX
unsigned i;
-#endif
+# endif
-#ifdef SYSTEM_SPECIFIC_DTOR
+# ifdef SYSTEM_SPECIFIC_DTOR
SYSTEM_SPECIFIC_DTOR(__G);
-#endif
+# endif
+# ifdef DEFLATE_SUPPORT
inflate_free(__G);
+# endif
+
+# ifdef UNICODE_SUPPORT
+ if (G.filename_full)
+ {
+ izu_free(G.filename_full);
+ G.filename_full = (char *)NULL;
+ G.fnfull_bufsize = 0;
+ }
+
+ if ((G.unipath_filename != NULL) &&
+ (G.unipath_filename != G.filename_full))
+ {
+ izu_free( G.unipath_filename);
+ }
+ G.unipath_filename = (char *)NULL;
+
+# ifdef WIN32_WIDE
+# ifdef DYNAMIC_WIDE_NAME
+ if (G.unipath_widefilename)
+ {
+ izu_free( G.unipath_widefilename);
+ G.unipath_widefilename = (wchar_t *)NULL;
+ }
+# else /* def DYNAMIC_WIDE_NAME */
+ *G.unipath_widefilename = L'\0';
+# endif /* def DYNAMIC_WIDE_NAME [else] */
+
+ if (G.has_win32_wide)
+ checkdirw(__G__ (wchar_t *)NULL, END);
+ else
+ checkdir(__G__ (char *)NULL, END);
+# else /* def WIN32_WIDE */
checkdir(__G__ (char *)NULL, END);
+# endif /* def WIN32_WIDE [else] */
+# endif /* def UNICODE_SUPPORT */
-#ifdef DYNALLOC_CRCTAB
+# ifdef DYNALLOC_CRCTAB
if (CRC_32_TAB) {
free_crc_table();
CRC_32_TAB = NULL;
}
-#endif
+# endif
if (G.key != (char *)NULL) {
- free(G.key);
+ izu_free(G.key);
G.key = (char *)NULL;
}
if (G.extra_field != (uch *)NULL) {
- free(G.extra_field);
+ izu_free(G.extra_field);
G.extra_field = (uch *)NULL;
}
-#if (!defined(VMS) && !defined(SMALL_MEM))
+# if (!defined(VMS) && !defined(SMALL_MEM))
/* VMS uses its own buffer scheme for textmode flush() */
if (G.outbuf2) {
- free(G.outbuf2); /* malloc'd ONLY if unshrink and -a */
+ izu_free(G.outbuf2); /* malloc'd ONLY if unshrink and -a */
G.outbuf2 = (uch *)NULL;
}
-#endif
+# endif
if (G.outbuf)
- free(G.outbuf);
+ izu_free(G.outbuf);
if (G.inbuf)
- free(G.inbuf);
+ izu_free(G.inbuf);
G.inbuf = G.outbuf = (uch *)NULL;
-#ifdef UNICODE_SUPPORT
- if (G.filename_full) {
- free(G.filename_full);
- G.filename_full = (char *)NULL;
- G.fnfull_bufsize = 0;
+# ifdef LZMA_SUPPORT
+ /* Free any LZMA-related dynamic storage.
+ * (Note that LzmaDec_Free() does not check for pointer validity.)
+ */
+ if (G.state_lzma.probs != NULL)
+ {
+ LzmaDec_Free( &G.state_lzma, &G.g_Alloc);
}
-#endif /* UNICODE_SUPPORT */
+# endif /* def LZMA_SUPPORT */
-#ifndef SFX
+# ifdef PPMD_SUPPORT
+ /* Free any PPMd-related dynamic storage.
+ * (Note that Ppmd8_Free() does not check for pointer validity.)
+ */
+ if (G.ppmd8.Base != NULL)
+ {
+ Ppmd8_Free( &G.ppmd8, &G.g_Alloc);
+ }
+# endif /* def PPMD_SUPPORT */
+
+# ifndef SFX
for (i = 0; i < DIR_BLKSIZ; i++) {
if (G.info[i].cfilname != (char Far *)NULL) {
zffree(G.info[i].cfilname);
G.info[i].cfilname = (char Far *)NULL;
}
}
-#endif
+# endif
-#ifdef MALLOC_WORK
+# ifdef MALLOC_WORK
if (G.area.Slide) {
- free(G.area.Slide);
+ izu_free(G.area.Slide);
G.area.Slide = (uch *)NULL;
}
-#endif
+# endif
+
+ /* 2012-12-11 SMS.
+ * Free any command-line-related storage.
+ */
+# ifndef WINDLL
+ /* Include and exclude name lists. (free_args() checks for NULL.) */
+ free_args( G.pfnames);
+ free_args( G.pxnames);
+# endif /* ndef WINDLL */
+ /* Extraction root directory (-d/--extract-dir). */
+ if (uO.exdir != NULL)
+ izu_free( uO.exdir);
+ /* Encryption password (-P/--password). */
+ if (uO.pwdarg != NULL)
+ izu_free( uO.pwdarg);
+ /* Archive path name. */
+ if (G.wildzipfn != NULL)
+ izu_free( G.wildzipfn);
+
+# if defined( UNIX) && defined( __APPLE__)
+ /* AppleDouble header buffer. (G.apl_dbl_hdr_alloc > 0?) */
+ if (G.apl_dbl_hdr != NULL)
+ {
+ izu_free( G.apl_dbl_hdr);
+ G.apl_dbl_hdr_alloc = 0;
+ }
+# endif /* defined( UNIX) && defined( __APPLE__) */
} /* end function free_G_buffers() */
+#endif /* def REENTRANT */
/* static int no_ecrec = FALSE; SKM: moved to globals.h */
int maybe_exe=FALSE;
int too_weird_to_continue=FALSE;
-#ifdef TIMESTAMP
+# ifdef TIMESTAMP
time_t uxstamp;
ulg nmember = 0L;
+# endif
#endif
-#endif
- int error=0, error_in_archive;
+ int error = 0;
+ int error_in_archive;
/*---------------------------------------------------------------------------
{
#ifndef SFX
if (lastchance && (uO.qflag < 3)) {
-#if defined(UNIX) || defined(QDOS)
+# if defined(UNIX) || defined(QDOS)
if (G.no_ecrec)
Info(slide, 1, ((char *)slide,
LoadFarString(CannotFindZipfileDirMsg),
LoadFarString(CannotFindEitherZipfile),
LoadFarStringSmall((uO.zipinfo_mode ? Zipnfo : Unzip)),
G.wildzipfn, G.wildzipfn, G.zipfn));
-#else /* !(UNIX || QDOS) */
+# else /* defined(UNIX) || defined(QDOS) */
if (G.no_ecrec)
Info(slide, 0x401, ((char *)slide,
LoadFarString(CannotFindZipfileDirMsg),
LoadFarStringSmall((uO.zipinfo_mode ? Zipnfo : Unzip)),
G.wildzipfn, uO.zipinfo_mode? " " : "", G.zipfn));
else
-#ifdef VMS
+# ifdef VMS
Info(slide, 0x401, ((char *)slide,
LoadFarString(CannotFindEitherZipfile),
LoadFarStringSmall((uO.zipinfo_mode ? Zipnfo : Unzip)),
G.wildzipfn,
(*G.zipfn ? G.zipfn : vms_msg_text())));
-#else /* !VMS */
+# else /* def VMS */
Info(slide, 0x401, ((char *)slide,
LoadFarString(CannotFindEitherZipfile),
LoadFarStringSmall((uO.zipinfo_mode ? Zipnfo : Unzip)),
G.wildzipfn, G.zipfn));
-#endif /* ?VMS */
-#endif /* ?(UNIX || QDOS) */
+# endif /* def VMS [else] */
+# endif /* defined(UNIX) || defined(QDOS) [else] */
}
-#endif /* !SFX */
+#endif /* ndef SFX */
return error? IZ_DIR : PK_NOZIP;
}
G.ziplen = G.statbuf.st_size;
#ifndef SFX
-#if defined(UNIX) || defined(DOS_OS2_W32) || defined(THEOS)
- if (G.statbuf.st_mode & S_IEXEC) /* no extension on Unix exes: might */
- maybe_exe = TRUE; /* find unzip, not unzip.zip; etc. */
-#endif
-#endif /* !SFX */
+# if defined(UNIX) || defined(DOS_OS2_W32) || defined(THEOS)
+ if (G.statbuf.st_mode & S_IEXEC) /* No extension on Unix exes. Might */
+ maybe_exe = TRUE; /* find unzip, not unzip.zip; etc. */
+# endif
+#endif /* ndef SFX */
-#ifdef VMS
+#ifdef VMS
if (check_format(__G)) /* check for variable-length format */
return PK_ERR;
#endif
G.inptr = G.inbuf;
#if ((!defined(WINDLL) && !defined(SFX)) || !defined(NO_ZIPINFO))
-# if (!defined(WINDLL) && !defined(SFX))
+# if !defined(WINDLL) && !defined(SFX)
if ( (!uO.zipinfo_mode && !uO.qflag
# ifdef TIMESTAMP
&& !uO.T_flag
|| (uO.zipinfo_mode && uO.hflag)
# endif
)
-# else /* not (!WINDLL && !SFX) ==> !NO_ZIPINFO !! */
+# else /* !defined(WINDLL) && !defined(SFX) */
if (uO.zipinfo_mode && uO.hflag)
-# endif /* if..else..: (!WINDLL && !SFX) */
+# endif /* !defined(WINDLL) && !defined(SFX) [else] */
# ifdef WIN32 /* Win32 console may require codepage conversion for G.zipfn */
Info(slide, 0, ((char *)slide, LoadFarString(LogInitline),
FnFilter1(G.zipfn)));
# else
Info(slide, 0, ((char *)slide, LoadFarString(LogInitline), G.zipfn));
# endif
-#endif /* (!WINDLL && !SFX) || !NO_ZIPINFO */
+#endif /* ((!defined(WINDLL) && !defined(SFX)) || !defined(NO_ZIPINFO)) */
if ( (error_in_archive = find_ecrec(__G__
#ifndef NO_ZIPINFO
uO.zipinfo_mode ? G.ziplen :
#endif
- MIN(G.ziplen, 66000L)))
+ IZ_MIN(G.ziplen, 66000L)))
> PK_WARN )
{
CLOSE_INFILE();
#ifdef SFX
++lastchance; /* avoid picky compiler warnings */
return error_in_archive;
-#else
+#else /* def SFX */
if (maybe_exe)
Info(slide, 0x401, ((char *)slide, LoadFarString(MaybeExe),
G.zipfn));
G.no_ecrec = TRUE; /* assume we found wrong file: e.g., */
return PK_NOZIP; /* unzip instead of unzip.zip */
}
-#endif /* ?SFX */
+#endif /* def SFX [else] */
}
if ((uO.zflag > 0) && !uO.zipinfo_mode) { /* unzip: zflag = comment ONLY */
archives) or inconsistencies (missing or extra bytes in zipfile).
---------------------------------------------------------------------------*/
+ /* Apparently a few archives out there use 1 as the disk number in a
+ one disk archive, incorrectly. Need to change this to allow for that
+ case. */
+
#ifdef NO_MULTIPART
error = !uO.zipinfo_mode && (G.ecrec.number_this_disk == 1) &&
(G.ecrec.num_disk_start_cdir == 1);
(ulg)G.ecrec.num_disk_start_cdir));
error_in_archive = PK_WARN;
}
-#ifdef NO_MULTIPART /* concatenation of multiple parts works in some cases */
+# ifdef NO_MULTIPART /* concatenation of multiple parts works in some cases */
} else if (!uO.zipinfo_mode && !error && G.ecrec.number_this_disk != 0) {
Info(slide, 0x401, ((char *)slide, LoadFarString(NoMultiDiskArcSupport),
G.zipfn));
error_in_archive = PK_FIND;
too_weird_to_continue = TRUE;
-#endif
+# endif
}
if (!too_weird_to_continue) { /* (relatively) normal zipfile: go for it */
G.zipfn));
error_in_archive = PK_WARN;
}
-#endif /* !SFX */
+#endif /* ndef SFX */
if ((G.extra_bytes = G.real_ecrec_offset-G.expect_ecrec_offset) <
(zoff_t)0)
{
(G.extra_bytes == 1)? "":"s"));
error_in_archive = PK_WARN;
}
-#endif /* !SFX */
+#endif /* ndef SFX */
}
/*-----------------------------------------------------------------------
return PK_ERR; /* file may be locked, or possibly disk error(?) */
}
if (memcmp(G.sig, central_hdr_sig, 4))
-#else
+#else /* def OLD_SEEK_TEST */
if ((error != PK_OK) || (readbuf(__G__ G.sig, 4) == 0) ||
memcmp(G.sig, central_hdr_sig, 4))
-#endif
+#endif /* def OLD_SEEK_TEST [else] */
{
#ifndef SFX
zoff_t tmp = G.extra_bytes;
-#endif
+#endif /* ndef SFX */
G.extra_bytes = 0;
error = seek_zipf(__G__ G.ecrec.offset_start_central_directory);
#ifndef SFX
Info(slide, 0x401, ((char *)slide, LoadFarString(CentDirTooLong),
G.zipfn, FmZofft((-tmp), NULL, NULL)));
-#endif
+#endif /* ndef SFX */
error_in_archive = PK_ERR;
}
or not to display the inner archives.
*/
if (!G.fValidate)
-#endif
+#endif /* def DLL */
{
#ifndef NO_ZIPINFO
if (uO.zipinfo_mode)
- error = zipinfo(__G); /* ZIPINFO 'EM */
+ error = zipinform(__G); /* ZIPINFO 'EM */
else
-#endif
+#endif /* ndef NO_ZIPINFO */
#ifndef SFX
-#ifdef TIMESTAMP
+# ifdef TIMESTAMP
if (uO.T_flag)
error = get_time_stamp(__G__ &uxstamp, &nmember);
else
-#endif
+# endif /* def TIMESTAMP */
if (uO.vflag && !uO.tflag && !uO.cflag)
error = list_files(__G); /* LIST 'EM */
else
-#endif /* !SFX */
+#endif /* ndef SFX */
error = extract_or_test_files(__G); /* EXTRACT OR TEST 'EM */
Trace((stderr, "done with extract/list files (error = %d)\n",
if (uO.T_flag && !uO.zipinfo_mode && (nmember > 0L)) {
# ifdef WIN32
if (stamp_file(__G__ G.zipfn, uxstamp)) { /* TIME-STAMP 'EM */
-# else
+# else /* def WIN32 */
if (stamp_file(G.zipfn, uxstamp)) { /* TIME-STAMP 'EM */
-# endif
+# endif /* def WIN32 [else] */
if (uO.qflag < 3)
Info(slide, 0x201, ((char *)slide,
LoadFarString(ZipTimeStampFailed), G.zipfn));
LoadFarString(ZipTimeStampSuccess), G.zipfn));
}
}
-#endif
+#endif /* def TIMESTAMP */
return error_in_archive;
} /* end function do_seekable() */
small-file program. Probably should be somewhere else.
The file has to be opened previously
*/
-#ifdef USE_STRM_INPUT
+# ifdef USE_STRM_INPUT
static zoff_t file_size(file)
FILE *file;
{
int sts;
size_t siz;
-#else /* !USE_STRM_INPUT */
+# else /* def USE_STRM_INPUT */
static zoff_t file_size(fh)
int fh;
{
int siz;
-#endif /* ?USE_STRM_INPUT */
+# endif /* def USE_STRM_INPUT [else] */
zoff_t ofs;
char waste[4];
-#ifdef USE_STRM_INPUT
+# ifdef USE_STRM_INPUT
/* Seek to actual EOF. */
sts = zfseeko(file, 0, SEEK_END);
if (sts != 0) {
}
}
}
-#else /* !USE_STRM_INPUT */
+# else /* def USE_STRM_INPUT */
/* Seek to actual EOF. */
ofs = zlseek(fh, 0, SEEK_END);
if (ofs == (zoff_t) -1) {
}
}
}
-#endif /* ?USE_STRM_INPUT */
+# endif /* def USE_STRM_INPUT [else] */
return ofs;
} /* end function file_size() */
-#endif /* DO_SAFECHECK_2GB */
+#endif /* def DO_SAFECHECK_2GB */
#ifdef USE_STRM_INPUT
zfseeko(G.zipfd, G.ziplen-tail_len, SEEK_SET);
G.cur_zipfile_bufstart = zftello(G.zipfd);
-#else /* !USE_STRM_INPUT */
+#else /* def USE_STRM_INPUT */
G.cur_zipfile_bufstart = zlseek(G.zipfd, G.ziplen-tail_len, SEEK_SET);
-#endif /* ?USE_STRM_INPUT */
+#endif /* def USE_STRM_INPUT [else] */
if ((G.incnt = read(G.zipfd, (char *)G.inbuf,
(unsigned int)tail_len)) != (int)tail_len)
return 2; /* it's expedient... */
G.cur_zipfile_bufstart -= INBUFSIZ;
#ifdef USE_STRM_INPUT
zfseeko(G.zipfd, G.cur_zipfile_bufstart, SEEK_SET);
-#else /* !USE_STRM_INPUT */
+#else /* def USE_STRM_INPUT */
zlseek(G.zipfd, G.cur_zipfile_bufstart, SEEK_SET);
-#endif /* ?USE_STRM_INPUT */
+#endif /* def USE_STRM_INPUT [else] */
if ((G.incnt = read(G.zipfd,(char *)G.inbuf,INBUFSIZ))
!= INBUFSIZ)
return 2; /* read error is fatal failure */
|| G.ecrec.num_disk_start_cdir == 0xFFFF
|| G.ecrec.number_this_disk == 0xFFFF;
} /* end function check_ecrec_zip64() */
-#endif /* never */
+#endif /* 0 */
#ifdef USE_STRM_INPUT
zfseeko(G.zipfd, ecloc64_start_offset, SEEK_SET);
G.cur_zipfile_bufstart = zftello(G.zipfd);
-#else /* !USE_STRM_INPUT */
+#else /* def USE_STRM_INPUT */
G.cur_zipfile_bufstart = zlseek(G.zipfd, ecloc64_start_offset, SEEK_SET);
-#endif /* ?USE_STRM_INPUT */
+#endif /* def USE_STRM_INPUT [else] */
if ((G.incnt = read(G.zipfd, (char *)byterecL, ECLOC64_SIZE+4))
!= (ECLOC64_SIZE+4)) {
/* Check for consistency */
#ifdef TEST
- fprintf(stdout,"\nnumber of disks (ECR) %u, (ECLOC64) %lu\n",
+ fprintf(stdout, "\nnumber of disks (ECR) %u, (ECLOC64) %u\n",
G.ecrec.number_this_disk, ecloc64_total_disks); fflush(stdout);
#endif
if ((G.ecrec.number_this_disk != 0xFFFF) &&
- (G.ecrec.number_this_disk != ecloc64_total_disks - 1)) {
+ (G.ecrec.number_this_disk != ecloc64_total_disks - 1) &&
+ (ecloc64_total_disks != 0)) {
/* Note: For some unknown reason, the developers at PKWARE decided to
store the "zip64 total disks" value as a counter starting from 1,
whereas all other "split/span volume" related fields use 0-based
When this is not the case, the found ecrec64 locator cannot be valid.
-> This is not a Zip64 archive.
*/
+ /* Actually the central directory can span multiple disks, and the above
+ total - 1 check would fail in this case. Should fix this.
+
+ There are archive creators that put 0 in total disks when it should
+ be 1. We should handle this. This is done by the added check above.
+ */
Trace((stderr,
- "\ninvalid ECLOC64, differing disk# (ECR %u, ECL64 %lu)\n",
- G.ecrec.number_this_disk, ecloc64_total_disks - 1));
+ "\ninvalid ECLOC64, differing disk# (ECR %u, ECL64 %lu)\n",
+ G.ecrec.number_this_disk, (unsigned long)(ecloc64_total_disks - 1)));
return PK_COOL;
}
#ifdef USE_STRM_INPUT
zfseeko(G.zipfd, ecrec64_start_offset, SEEK_SET);
G.cur_zipfile_bufstart = zftello(G.zipfd);
-#else /* !USE_STRM_INPUT */
+#else /* def USE_STRM_INPUT */
G.cur_zipfile_bufstart = zlseek(G.zipfd, ecrec64_start_offset, SEEK_SET);
-#endif /* ?USE_STRM_INPUT */
+#endif /* def USE_STRM_INPUT [else] */
if ((G.incnt = read(G.zipfd, (char *)byterec, ECREC64_SIZE+4))
!= (ECREC64_SIZE+4)) {
#ifdef USE_STRM_INPUT
zfseeko(G.zipfd, ecrec64_start_offset, SEEK_SET);
G.cur_zipfile_bufstart = zftello(G.zipfd);
-#else /* !USE_STRM_INPUT */
+#else /* def USE_STRM_INPUT */
G.cur_zipfile_bufstart = zlseek(G.zipfd, ecrec64_start_offset, SEEK_SET);
-#endif /* ?USE_STRM_INPUT */
+#endif /* def USE_STRM_INPUT [else] */
if ((G.incnt = read(G.zipfd, (char *)byterec, ECREC64_SIZE+4))
!= (ECREC64_SIZE+4)) {
if (G.ziplen <= INBUFSIZ) {
#ifdef USE_STRM_INPUT
zfseeko(G.zipfd, 0L, SEEK_SET);
-#else /* !USE_STRM_INPUT */
+#else /* def USE_STRM_INPUT */
zlseek(G.zipfd, 0L, SEEK_SET);
-#endif /* ?USE_STRM_INPUT */
+#endif /* def USE_STRM_INPUT [else] */
if ((G.incnt = read(G.zipfd,(char *)G.inbuf,(unsigned int)G.ziplen))
== (int)G.ziplen)
*/
zi_end_central(__G);
}
-#endif
+#endif /* ndef NO_ZIPINFO */
return error_in_archive;
/* for comment button: */
if ((!G.fValidate) && (G.lpUserFunctions != NULL))
G.lpUserFunctions->cchComment = G.ecrec.zipfile_comment_length;
-#endif /* WINDLL */
+#endif /* def WINDLL */
#ifndef NO_ZIPINFO
/* ZipInfo, verbose format */
error = PK_WARN;
}
} else
-#endif /* !NO_ZIPINFO */
+#endif /* ndef NO_ZIPINFO */
if ( G.ecrec.zipfile_comment_length &&
(uO.zflag > 0
#ifndef WINDLL
&& !uO.T_flag
# endif
&& !uO.qflag)
-#endif /* !WINDLL */
+#endif /* ndef WINDLL */
) )
{
if (do_string(__G__ G.ecrec.zipfile_comment_length,
-#if (defined(SFX) && defined(CHEAP_SFX_AUTORUN))
-# ifndef NO_ZIPINFO
- (oU.zipinfo_mode ? DISPLAY : CHECK_AUTORUN)
-# else
+#if defined(SFX) && defined(CHEAP_SFX_AUTORUN)
+# ifdef NO_ZIPINFO
CHECK_AUTORUN
-# endif
-#else
+# else /* def NO_ZIPINFO */
+ (oU.zipinfo_mode ? DISPLAY : CHECK_AUTORUN)
+# endif /* def NO_ZIPINFO [else] */
+#else /* defined(SFX) && defined(CHEAP_SFX_AUTORUN) */
DISPLAY
-#endif
+#endif /* defined(SFX) && defined(CHEAP_SFX_AUTORUN) [else] */
))
{
Info(slide, 0x401, ((char *)slide,
error = PK_WARN;
}
}
-#if (defined(SFX) && defined(CHEAP_SFX_AUTORUN))
+#if defined(SFX) && defined(CHEAP_SFX_AUTORUN)
else if (G.ecrec.zipfile_comment_length) {
if (do_string(__G__ G.ecrec.zipfile_comment_length, CHECK_AUTORUN_Q))
{
error = PK_WARN;
}
}
-#endif
+#endif /* defined(SFX) && defined(CHEAP_SFX_AUTORUN) */
return error;
} /* end function process_zip_cmmnt() */
return error;
G.pInfo->hostver = G.crec.version_made_by[0];
- G.pInfo->hostnum = MIN(G.crec.version_made_by[1], NUM_HOSTS);
-/* extnum = MIN(crec.version_needed_to_extract[1], NUM_HOSTS); */
+ G.pInfo->hostnum = IZ_MIN(G.crec.version_made_by[1], NUM_HOSTS);
+/* extnum = IZ_MIN(crec.version_needed_to_extract[1], NUM_HOSTS); */
G.pInfo->lcflag = 0;
if (uO.L_flag == 1) /* name conversion for monocase systems */
else if (uO.L_flag > 1) /* let -LL force lower case for all names */
G.pInfo->lcflag = 1;
+ /* Handle the PKWare verification bit, bit 2 (0x0004) of internal
+ * attributes. If this is set, then a verification checksum is in
+ * the first 3 bytes of the external attributes. In this case all
+ * we can use for setting file attributes is the last external
+ * attributes byte.
+ *
+ * Use of this bit is incompatible with symlinks, which require use
+ * of the symlink bit in the high end of the external attributes.
+ */
+ if (G.crec.internal_file_attributes & 0x0004)
+ G.crec.external_file_attributes &= (ulg)0xff;
+
/* do Amigas (AMIGA_) also have volume labels? */
if (IS_VOLID(G.crec.external_file_attributes) &&
(G.pInfo->hostnum == FS_FAT_ || G.pInfo->hostnum == FS_HPFS_ ||
- G.pInfo->hostnum == FS_NTFS_ || G.pInfo->hostnum == ATARI_))
+ G.pInfo->hostnum == FS_NTFS_ || G.pInfo->hostnum == ATARI_ ||
+ G.pInfo->hostnum == VMS_))
{
G.pInfo->vollabel = TRUE;
G.pInfo->lcflag = 0; /* preserve case of volume labels */
G.pInfo->HasUxAtt = (G.crec.external_file_attributes & 0xffff0000L) != 0L;
#ifdef UNICODE_SUPPORT
- /* remember the state of GPB11 (General Purpuse Bit 11) which indicates
+ /* remember the state of GPB11 (General Purpose Bit 11) which indicates
that the standard path and comment are UTF-8. */
- G.pInfo->GPFIsUTF8
- = (G.crec.general_purpose_bit_flag & (1 << 11)) == (1 << 11);
+ G.pInfo->GPFIsUTF8 = (G.crec.general_purpose_bit_flag & UTF8_BIT) != 0;
+#endif
+
+#ifdef SYMLINKS
+ /* Initialize the symlink flag. The system-specific mapattr() (or
+ * other) function should set it properly.
+ */
+ G.pInfo->symlink = 0;
#endif
return PK_COOL;
/* Function getZip64Data() */
/*******************************/
+/* 2012-11-25 SMS. (OUSPG report.)
+ * Changed eb_len and ef_len from unsigned to signed, to catch underflow
+ * of ef_len caused by corrupt/malicious data. (32-bit is adequate.
+ * Used "long" to accommodate any systems with 16-bit "int".)
+ */
+
int getZip64Data(__G__ ef_buf, ef_len)
__GDEF
ZCONST uch *ef_buf; /* buffer containing extra field */
- unsigned ef_len; /* total length of extra field */
+ long ef_len; /* total length of extra field */
{
unsigned eb_id;
- unsigned eb_len;
+ long eb_len;
/*---------------------------------------------------------------------------
This function scans the extra field for zip64 information, ie 8-byte
if (ef_len == 0 || ef_buf == NULL)
return PK_COOL;
- Trace((stderr,"\ngetZip64Data: scanning extra field of length %u\n",
+ Trace((stderr, "\ngetZip64Data: scanning extra field of length %ld\n",
ef_len));
while (ef_len >= EB_HEADSIZE) {
if (eb_len > (ef_len - EB_HEADSIZE)) {
/* discovered some extra field inconsistency! */
Trace((stderr,
- "getZip64Data: block length %u > rest ef_size %u\n", eb_len,
+ "getZip64Data: block length %ld > rest ef_size %ld\n", eb_len,
ef_len - EB_HEADSIZE));
break;
}
/* Function getUnicodeData() */
/*******************************/
+/* 2012-11-25 SMS. (OUSPG report.)
+ * See note at getZip64Data().
+ */
+
int getUnicodeData(__G__ ef_buf, ef_len)
__GDEF
ZCONST uch *ef_buf; /* buffer containing extra field */
- unsigned ef_len; /* total length of extra field */
+ long ef_len; /* total length of extra field */
{
unsigned eb_id;
- unsigned eb_len;
+ long eb_len;
/*---------------------------------------------------------------------------
This function scans the extra field for Unicode information, ie UTF-8
path extra fields.
+ Caller should first set G.unipath_filename to NULL (after freeing
+ old storage, as needed.)
On return, G.unipath_filename =
- NULL, if no Unicode path extra field or error
- "", if the standard path is UTF-8 (free when done)
- null-terminated UTF-8 path (free when done)
+ <unchanged> (NULL), if error or no Unicode path extra field
+ "", if the standard path is UTF-8
+ NUL-terminated UTF-8 path from extra field
+ Any non-NULL G.unipath_filename (including "") was malloc()'d here,
+ and the caller is resposible for free()-ing it.
Return PK_COOL if no error.
---------------------------------------------------------------------------*/
- G.unipath_filename = NULL;
-
if (ef_len == 0 || ef_buf == NULL)
return PK_COOL;
- Trace((stderr,"\ngetUnicodeData: scanning extra field of length %u\n",
+ Trace((stderr, "\ngetUnicodeData: scanning extra field of length %ld\n",
ef_len));
while (ef_len >= EB_HEADSIZE) {
if (eb_len > (ef_len - EB_HEADSIZE)) {
/* discovered some extra field inconsistency! */
Trace((stderr,
- "getUnicodeData: block length %u > rest ef_size %u\n", eb_len,
- ef_len - EB_HEADSIZE));
+ "getUnicodeData: block length %ld > rest ef_size %ld\n",
+ eb_len, ef_len - EB_HEADSIZE));
break;
}
if (eb_id == EF_UNIPATH) {
int offset = EB_HEADSIZE;
- ush ULen = eb_len - 5;
+ ush ULen = (ush)(eb_len - 5);
ulg chksum = CRCVAL_INITIAL;
/* version */
}
/* UTF-8 Path */
- if ((G.unipath_filename = malloc(ULen + 1)) == NULL) {
+ if ((G.unipath_filename = izu_malloc(ULen + 1)) == NULL) {
return PK_ERR;
}
if (ULen == 0) {
-#ifdef UNICODE_WCHAR
+# ifdef UNICODE_WCHAR
/*---------------------------------------------
* Unicode conversion functions
*
*utf8buf++ = (char) (0x80 | ((ch >> (6 * trailing)) & 0x3F));
return ret;
}
-#endif /* unused */
+#endif /* 0 */
/*===================================================================*/
for (;;)
{
ulg ch = ucs4_char_from_utf8(&utf8);
- if (ch == ~0L)
+ if (ch == (ulg)~0L)
return -1;
else
{
{
return utf8_to_ucs4_string(utf8, NULL, 0);
}
-#endif /* unused */
+#endif /* 0 */
/* --------------------------------------------------- */
/* Unicode Support
{
return wide_to_utf8_string(local_to_wide_string(local_string));
}
-# endif /* unused */
+# endif /* 0 */
/* wide_to_escape_string
provides a string that represents a wide char not in local char set
*/
/* set this to the max bytes an escape can be */
-#define MAX_ESCAPE_BYTES 8
+# define MAX_ESCAPE_BYTES 8
char *wide_to_escape_string(wide_char)
zwchar wide_char;
sprintf(d, "%02x", b[i]);
strcat(e, d);
}
- if ((r = malloc(strlen(e) + 1)) == NULL) {
+ if ((r = izu_malloc(strlen(e) + 1)) == NULL) {
return NULL;
}
strcpy(r, e);
}
return w;
}
-#endif /* unused */
+#endif /* 0 */
-#ifndef WIN32 /* WIN32 supplies a special variant of this function */
+# ifndef WIN32 /* WIN32 supplies a special variant of this function */
/* convert wide character string to multi-byte character string */
char *wide_to_local_string(wide_string, escape_all)
ZCONST zwchar *wide_string;
if (max_bytes < MAX_ESCAPE_BYTES)
max_bytes = MAX_ESCAPE_BYTES;
- if ((buffer = (char *)malloc(wsize * max_bytes + 1)) == NULL) {
+ if ((buffer = (char *)izu_malloc(wsize * max_bytes + 1)) == NULL) {
return NULL;
}
/* use escape for wide character */
char *escape_string = wide_to_escape_string(wide_string[i]);
strcat(buffer, escape_string);
- free(escape_string);
+ izu_free(escape_string);
}
} else if (b > 0) {
/* multi-byte char */
/* use escape for wide character */
char *escape_string = wide_to_escape_string(wide_string[i]);
strcat(buffer, escape_string);
- free(escape_string);
+ izu_free(escape_string);
}
}
- if ((local_string = (char *)malloc(strlen(buffer) + 1)) != NULL) {
+ if ((local_string = (char *)izu_malloc(strlen(buffer) + 1)) != NULL) {
strcpy(local_string, buffer);
}
- free(buffer);
+ izu_free(buffer);
return local_string;
}
-#endif /* !WIN32 */
+# endif /* ndef WIN32 */
#if 0 /* currently unused */
/* convert local string to display character set string */
CharToOem description.
For all other ports, just make a copy of local_string.
*/
- if ((display_string = (char *)malloc(strlen(local_string) + 1)) == NULL) {
+ if ((display_string = (char *)izu_malloc(
+ strlen(local_string) + 1)) == NULL) {
return NULL;
}
strcpy(display_string, local_string);
-#ifdef EBCDIC
+# ifdef EBCDIC
{
char *ebc;
- if ((ebc = malloc(strlen(display_string) + 1)) == NULL) {
+ if ((ebc = izu_malloc(strlen(display_string) + 1)) == NULL) {
return NULL;
}
strtoebc(ebc, display_string);
- free(display_string);
+ izu_free(display_string);
display_string = ebc;
}
-#endif
+# endif
return display_string;
}
-#endif /* unused */
+#endif /* 0 */
/* UTF-8 to local */
char *utf8_to_local_string(utf8_string, escape_all)
{
zwchar *wide = utf8_to_wide_string(utf8_string);
char *loc = wide_to_local_string(wide, escape_all);
- free(wide);
+ izu_free(wide);
return loc;
}
-#if 0 /* currently unused */
+wchar_t *wide_to_wchar_string(wide_string)
+ zwchar *wide_string;
+{
+ wchar_t *wstring;
+ int i;
+ int zwlen;
+
+ for (zwlen = 0; wide_string[zwlen]; zwlen++) ;
+
+ if ((wstring = izu_malloc((zwlen + 1) * sizeof(wchar_t))) == NULL) {
+ return NULL;
+ }
+
+ for (i = 0; wide_string[i]; i++) {
+ wstring[i] = (wchar_t)wide_string[i];
+ }
+ wstring[i] = (wchar_t)0;
+
+ return wstring;
+}
+
+zwchar *wchar_to_wide_string(wchar_string)
+ wchar_t *wchar_string;
+{
+ zwchar *zwstring;
+ int i;
+ int wlen;
+
+ for (wlen = 0; wchar_string[wlen]; wlen++) ;
+
+ if ((zwstring = izu_malloc((wlen + 1) * sizeof(zwchar))) == NULL) {
+ return NULL;
+ }
+
+ for (i = 0; wchar_string[i]; i++) {
+ zwstring[i] = (zwchar)wchar_string[i];
+ }
+ zwstring[i] = (zwchar)0;
+
+ return zwstring;
+}
+
+
/* convert multi-byte character string to wide character string */
zwchar *local_to_wide_string(local_string)
ZCONST char *local_string;
}
/* convert it */
- if ((wc_string = (wchar_t *)malloc((wsize + 1) * sizeof(wchar_t))) == NULL) {
+ if ((wc_string = (wchar_t *)izu_malloc(
+ (wsize + 1) * sizeof(wchar_t))) == NULL) {
return NULL;
}
wsize = mbstowcs(wc_string, local_string, strlen(local_string) + 1);
wc_string[wsize] = (wchar_t) 0;
/* in case wchar_t is not zwchar */
- if ((wide_string = (zwchar *)malloc((wsize + 1) * sizeof(zwchar))) == NULL) {
+ if ((wide_string = (zwchar *)izu_malloc(
+ (wsize + 1) * sizeof(zwchar))) == NULL) {
+ izu_free( wc_string);
return NULL;
}
- for (wsize = 0; wide_string[wsize] = (zwchar)wc_string[wsize]; wsize++) ;
+ for (wsize = 0; (wide_string[wsize] = (zwchar)wc_string[wsize]); wsize++) ;
wide_string[wsize] = (zwchar) 0;
- free(wc_string);
+ izu_free(wc_string);
return wide_string;
}
+#if 0 /* currently unused */
/* convert wide string to UTF-8 */
char *wide_to_utf8_string(wide_string)
mbcount = ucs4_string_to_utf8(wide_string, NULL, 0);
if (mbcount == -1)
return NULL;
- if ((utf8_string = (char *) malloc(mbcount + 1)) == NULL) {
+ if ((utf8_string = (char *) izu_malloc(mbcount + 1)) == NULL) {
return NULL;
}
mbcount = ucs4_string_to_utf8(wide_string, utf8_string, mbcount + 1);
return utf8_string;
}
-#endif /* unused */
+
+zwchar *wchar_to_wide_string(wchar_string)
+ wchar_t *wchar_string;
+{
+ int i;
+ int wchar_len;
+ zwchar *wide_string;
+
+ wchar_len = wcslen(wchar_string);
+
+ if ((wide_string = izu_malloc((wchar_len + 1) * sizeof(zwchar))) == NULL) {
+ return NULL;
+ }
+ for (i = 0; i <= wchar_len; i++) {
+ wide_string[i] = wchar_string[i];
+ }
+
+ return wide_string;
+}
+
+#endif /* 0 */
+
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+
+char *wchar_to_local_string(wchar_string, escape_all)
+ wchar_t *wchar_string;
+ int escape_all;
+{
+ zwchar *wide_string = wchar_to_wide_string(wchar_string);
+ char *local_string = wide_to_local_string(wide_string, escape_all);
+
+ izu_free(wide_string);
+
+ return local_string;
+}
+
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
/* convert UTF-8 string to wide string */
zwchar *utf8_to_wide_string(utf8_string)
wcount = utf8_to_ucs4_string(utf8_string, NULL, 0);
if (wcount == -1)
return NULL;
- if ((wide_string = (zwchar *) malloc((wcount + 1) * sizeof(zwchar)))
+ if ((wide_string = (zwchar *) izu_malloc((wcount + 1) * sizeof(zwchar)))
== NULL) {
return NULL;
}
return wide_string;
}
-#endif /* UNICODE_WCHAR */
-#endif /* UNICODE_SUPPORT */
-
-
+# endif /* def UNICODE_WCHAR */
+#endif /* def UNICODE_SUPPORT */
#ifdef USE_EF_UT_TIME
-#ifdef IZ_HAVE_UXUIDGID
+# ifdef IZ_HAVE_UXUIDGID
static int read_ux3_value(dbuf, uidgid_sz, p_uidgid)
ZCONST uch *dbuf; /* buffer a uid or gid value */
unsigned uidgid_sz; /* size of uid/gid value */
break;
case 8:
uidgid64 = makeint64(dbuf);
-#ifndef LARGE_FILE_SUPPORT
+# ifndef LARGE_FILE_SUPPORT
if (uidgid64 == (zusz_t)0xffffffffL)
return FALSE;
-#endif
+# endif
*p_uidgid = (ulg)uidgid64;
if ((zusz_t)(*p_uidgid) != uidgid64)
return FALSE;
}
return TRUE;
}
-#endif /* IZ_HAVE_UXUIDGID */
+# endif /* IZ_HAVE_UXUIDGID */
/*******************************/
/* Function ef_scan_for_izux() */
/*******************************/
+/* 2012-11-25 SMS. (OUSPG report.)
+ * See note at getZip64Data().
+ */
+
unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime,
z_utim, z_uidgid)
ZCONST uch *ef_buf; /* buffer containing extra field */
- unsigned ef_len; /* total length of extra field */
+ long ef_len; /* total length of extra field */
int ef_is_c; /* flag indicating "is central extra field" */
ulg dos_mdatetime; /* last_mod_file_date_time in DOS format */
iztimes *z_utim; /* return storage: atime, mtime, ctime */
{
unsigned flags = 0;
unsigned eb_id;
- unsigned eb_len;
+ long eb_len;
int have_new_type_eb = 0;
long i_time; /* buffer for Unix style 32-bit integer time value */
-#ifdef TIME_T_TYPE_DOUBLE
+# ifdef TIME_T_TYPE_DOUBLE
int ut_in_archive_sgn = 0;
-#else
+# else
int ut_zip_unzip_compatible = FALSE;
-#endif
+# endif
/*---------------------------------------------------------------------------
This function scans the extra field for EF_TIME, EF_IZUNIX2, EF_IZUNIX, or
if (ef_len == 0 || ef_buf == NULL || (z_utim == 0 && z_uidgid == NULL))
return 0;
- TTrace((stderr,"\nef_scan_for_izux: scanning extra field of length %u\n",
- ef_len));
+ TTrace((stderr,
+ "\nef_scan_for_izux: scanning extra field of length %ld\n", ef_len));
while (ef_len >= EB_HEADSIZE) {
eb_id = makeword(EB_ID + ef_buf);
if (eb_len > (ef_len - EB_HEADSIZE)) {
/* discovered some extra field inconsistency! */
TTrace((stderr,
- "ef_scan_for_izux: block length %u > rest ef_size %u\n", eb_len,
- ef_len - EB_HEADSIZE));
+ "ef_scan_for_izux: block length %ld > rest ef_size %ld\n",
+ eb_len, ef_len - EB_HEADSIZE));
break;
}
have_new_type_eb = 1;
if ( eb_len >= EB_UT_MINLEN && z_utim != NULL) {
unsigned eb_idx = EB_UT_TIME1;
- TTrace((stderr,"ef_scan_for_izux: found TIME extra field\n"));
+ TTrace((stderr, "ef_scan_for_izux: found TIME extra field\n"));
flags |= (ef_buf[EB_HEADSIZE+EB_UT_FLAGS] & 0x0ff);
if ((flags & EB_UT_FL_MTIME)) {
- if ((eb_idx+4) <= eb_len) {
+ if ((long)(eb_idx+4) <= eb_len) {
i_time = (long)makelong((EB_HEADSIZE+eb_idx) + ef_buf);
eb_idx += 4;
- TTrace((stderr," UT e.f. modification time = %ld\n",
- i_time));
+ TTrace((stderr, " UT e.f. modification time = %ld\n",
+ i_time));
-#ifdef TIME_T_TYPE_DOUBLE
+# ifdef TIME_T_TYPE_DOUBLE
if ((ulg)(i_time) & (ulg)(0x80000000L)) {
if (dos_mdatetime == DOSTIME_MINIMUM) {
ut_in_archive_sgn = -1;
without modtime: ignore complete UT field */
flags &= ~0x0ff; /* no time_t times available */
TTrace((stderr,
- " UT modtime range error; ignore e.f.!\n"));
+ " UT modtime range error; ignore e.f.!\n"));
break; /* stop scanning this field */
}
} else {
ut_in_archive_sgn = 0;
z_utim->mtime = (time_t)i_time;
}
-#else /* !TIME_T_TYPE_DOUBLE */
+# else /* def TIME_T_TYPE_DOUBLE */
if ((ulg)(i_time) & (ulg)(0x80000000L)) {
ut_zip_unzip_compatible =
((time_t)0x80000000L < (time_t)0L)
without modtime: ignore complete UT field */
flags &= ~0x0ff; /* no time_t times available */
TTrace((stderr,
- " UT modtime range error; ignore e.f.!\n"));
+ " UT modtime range error; ignore e.f.!\n"));
break; /* stop scanning this field */
}
} else {
ut_zip_unzip_compatible = FALSE;
}
z_utim->mtime = (time_t)i_time;
-#endif /* ?TIME_T_TYPE_DOUBLE */
+# endif /* def TIME_T_TYPE_DOUBLE [else] */
} else {
flags &= ~EB_UT_FL_MTIME;
- TTrace((stderr," UT e.f. truncated; no modtime\n"));
+ TTrace((stderr, " UT e.f. truncated; no modtime\n"));
}
}
if (ef_is_c) {
}
if (flags & EB_UT_FL_ATIME) {
- if ((eb_idx+4) <= eb_len) {
+ if ((long)(eb_idx+4) <= eb_len) {
i_time = (long)makelong((EB_HEADSIZE+eb_idx) + ef_buf);
eb_idx += 4;
- TTrace((stderr," UT e.f. access time = %ld\n",
- i_time));
-#ifdef TIME_T_TYPE_DOUBLE
+ TTrace((stderr, " UT e.f. access time = %ld\n",
+ i_time));
+# ifdef TIME_T_TYPE_DOUBLE
if ((ulg)(i_time) & (ulg)(0x80000000L)) {
if (ut_in_archive_sgn == -1)
z_utim->atime =
/* sign of 32-bit time is unknown -> ignore it */
flags &= ~EB_UT_FL_ATIME;
TTrace((stderr,
- " UT access time range error: skip time!\n"));
+ " UT access time range error: skip time!\n"));
}
} else {
z_utim->atime = (time_t)i_time;
}
-#else /* !TIME_T_TYPE_DOUBLE */
+# else /* def TIME_T_TYPE_DOUBLE */
if (((ulg)(i_time) & (ulg)(0x80000000L)) &&
!ut_zip_unzip_compatible) {
flags &= ~EB_UT_FL_ATIME;
TTrace((stderr,
- " UT access time range error: skip time!\n"));
+ " UT access time range error: skip time!\n"));
} else {
z_utim->atime = (time_t)i_time;
}
-#endif /* ?TIME_T_TYPE_DOUBLE */
+# endif /* def TIME_T_TYPE_DOUBLE [else] */
} else {
flags &= ~EB_UT_FL_ATIME;
}
}
if (flags & EB_UT_FL_CTIME) {
- if ((eb_idx+4) <= eb_len) {
+ if ((long)(eb_idx+4) <= eb_len) {
i_time = (long)makelong((EB_HEADSIZE+eb_idx) + ef_buf);
- TTrace((stderr," UT e.f. creation time = %ld\n",
- i_time));
-#ifdef TIME_T_TYPE_DOUBLE
+ TTrace((stderr, " UT e.f. creation time = %ld\n",
+ i_time));
+# ifdef TIME_T_TYPE_DOUBLE
if ((ulg)(i_time) & (ulg)(0x80000000L)) {
if (ut_in_archive_sgn == -1)
z_utim->ctime =
/* sign of 32-bit time is unknown -> ignore it */
flags &= ~EB_UT_FL_CTIME;
TTrace((stderr,
- " UT creation time range error: skip time!\n"));
+ " UT creation time range error: skip time!\n"));
}
} else {
z_utim->ctime = (time_t)i_time;
}
-#else /* !TIME_T_TYPE_DOUBLE */
+# else /* def TIME_T_TYPE_DOUBLE */
if (((ulg)(i_time) & (ulg)(0x80000000L)) &&
!ut_zip_unzip_compatible) {
flags &= ~EB_UT_FL_CTIME;
TTrace((stderr,
- " UT creation time range error: skip time!\n"));
+ " UT creation time range error: skip time!\n"));
} else {
z_utim->ctime = (time_t)i_time;
}
-#endif /* ?TIME_T_TYPE_DOUBLE */
+# endif /* def TIME_T_TYPE_DOUBLE [else] */
} else {
flags &= ~EB_UT_FL_CTIME;
}
flags &= ~0x0ff; /* ignore any previous IZUNIX field */
have_new_type_eb = 1;
}
-#ifdef IZ_HAVE_UXUIDGID
+# ifdef IZ_HAVE_UXUIDGID
if (have_new_type_eb > 1)
break; /* IZUNIX3 overrides IZUNIX2 e.f. block ! */
if (eb_len == EB_UX2_MINLEN && z_uidgid != NULL) {
z_uidgid[1] = (ulg)makeword((EB_HEADSIZE+EB_UX2_GID) + ef_buf);
flags |= EB_UX2_VALID; /* signal success */
}
-#endif
+# endif
break;
case EF_IZUNIX3:
/*
Version 1 byte version of this extra field, currently 1
- UIDSize 1 byte Size of UID field
+ UIDSize 1 byte Size of UID field (min = 2)
UID Variable UID for this entry
- GIDSize 1 byte Size of GID field
+ GIDSize 1 byte Size of GID field (min = 2)
GID Variable GID for this entry
*/
-#ifdef IZ_HAVE_UXUIDGID
- if (eb_len >= EB_UX3_MINLEN
- && z_uidgid != NULL
- && (*((EB_HEADSIZE + 0) + ef_buf) == 1)
- /* only know about version 1 */
+# ifdef IZ_HAVE_UXUIDGID
+ /* Check for a legitimate extra block length, a non-NULL
+ * destination pointer, and "ux" version 1 (which is all we
+ * understand).
+ */
+ if ((eb_len >= EB_UX3_MINLEN) &&
+ (z_uidgid != NULL) &&
+ (*((EB_HEADSIZE + 0) + ef_buf) == 1))
{
- uch uid_size;
- uch gid_size;
+ /* 2012-12-07 SMS. (OUSPG report.)
+ * First, clear "flags". Then, check the validity of
+ * uid_size before using it to find gid_size.
+ * Made Xid_size bigger than "uch" for safer arithmetic.
+ */
+ unsigned uid_size;
+ unsigned gid_size;
- uid_size = *((EB_HEADSIZE + 1) + ef_buf);
- gid_size = *((EB_HEADSIZE + uid_size + 2) + ef_buf);
+ flags &= ~0x0ff; /* Ignore any previous UNIX field. */
- flags &= ~0x0ff; /* ignore any previous UNIX field */
+ uid_size = *((EB_HEADSIZE + 1) + ef_buf);
- if ( read_ux3_value((EB_HEADSIZE + 2) + ef_buf,
- uid_size, z_uidgid[0])
- &&
- read_ux3_value((EB_HEADSIZE + uid_size + 3) + ef_buf,
- gid_size, z_uidgid[1]) )
+ /* Valid: 1 (Version) + 1 (UIDSize) + UIDSize +
+ * 1 (GIDSize) + 2 (min GIDSize) <= eb_len.
+ */
+ if (5+ uid_size <= eb_len)
{
- flags |= EB_UX2_VALID; /* signal success */
+ gid_size = *((EB_HEADSIZE + uid_size + 2) + ef_buf);
+
+ /* Last, check total claimed xID sizes against eb_len. */
+ if (3+ uid_size+ gid_size == eb_len)
+ {
+ if (read_ux3_value( (EB_HEADSIZE + 2) + ef_buf,
+ uid_size, &z_uidgid[0]) &&
+ read_ux3_value( (EB_HEADSIZE + uid_size + 3) + ef_buf,
+ gid_size, &z_uidgid[1]))
+ {
+ flags |= EB_UX2_VALID; /* signal success */
+ }
+ }
}
}
-#endif /* IZ_HAVE_UXUIDGID */
+# endif /* def IZ_HAVE_UXUIDGID */
break;
case EF_IZUNIX:
case EF_PKUNIX: /* PKUNIX e.f. layout is identical to IZUNIX */
if (eb_len >= EB_UX_MINLEN) {
- TTrace((stderr,"ef_scan_for_izux: found %s extra field\n",
- (eb_id == EF_IZUNIX ? "IZUNIX" : "PKUNIX")));
+ TTrace((stderr, "ef_scan_for_izux: found %s extra field\n",
+ (eb_id == EF_IZUNIX ? "IZUNIX" : "PKUNIX")));
if (have_new_type_eb > 0) {
break; /* Ignore IZUNIX extra field block ! */
}
if (z_utim != NULL) {
flags |= (EB_UT_FL_MTIME | EB_UT_FL_ATIME);
i_time = (long)makelong((EB_HEADSIZE+EB_UX_MTIME)+ef_buf);
- TTrace((stderr," Unix EF modtime = %ld\n", i_time));
-#ifdef TIME_T_TYPE_DOUBLE
+ TTrace((stderr, " Unix EF modtime = %ld\n", i_time));
+# ifdef TIME_T_TYPE_DOUBLE
if ((ulg)(i_time) & (ulg)(0x80000000L)) {
if (dos_mdatetime == DOSTIME_MINIMUM) {
ut_in_archive_sgn = -1;
without modtime: ignore complete UT field */
flags &= ~0x0ff; /* no time_t times available */
TTrace((stderr,
- " UX modtime range error: ignore e.f.!\n"));
+ " UX modtime range error: ignore e.f.!\n"));
}
} else {
/* cannot determine, safe assumption is FALSE */
ut_in_archive_sgn = 0;
z_utim->mtime = (time_t)i_time;
}
-#else /* !TIME_T_TYPE_DOUBLE */
+# else /* def TIME_T_TYPE_DOUBLE */
if ((ulg)(i_time) & (ulg)(0x80000000L)) {
ut_zip_unzip_compatible =
((time_t)0x80000000L < (time_t)0L)
without modtime: ignore complete UT field */
flags &= ~0x0ff; /* no time_t times available */
TTrace((stderr,
- " UX modtime range error: ignore e.f.!\n"));
+ " UX modtime range error: ignore e.f.!\n"));
}
} else {
/* cannot determine, safe assumption is FALSE */
ut_zip_unzip_compatible = FALSE;
}
z_utim->mtime = (time_t)i_time;
-#endif /* ?TIME_T_TYPE_DOUBLE */
+# endif /* def TIME_T_TYPE_DOUBLE [else] */
i_time = (long)makelong((EB_HEADSIZE+EB_UX_ATIME)+ef_buf);
- TTrace((stderr," Unix EF actime = %ld\n", i_time));
-#ifdef TIME_T_TYPE_DOUBLE
+ TTrace((stderr, " Unix EF actime = %ld\n", i_time));
+# ifdef TIME_T_TYPE_DOUBLE
if ((ulg)(i_time) & (ulg)(0x80000000L)) {
if (ut_in_archive_sgn == -1)
z_utim->atime =
/* sign of 32-bit time is unknown -> ignore it */
flags &= ~EB_UT_FL_ATIME;
TTrace((stderr,
- " UX access time range error: skip time!\n"));
+ " UX access time range error: skip time!\n"));
}
} else {
z_utim->atime = (time_t)i_time;
}
-#else /* !TIME_T_TYPE_DOUBLE */
+# else /* def TIME_T_TYPE_DOUBLE */
if (((ulg)(i_time) & (ulg)(0x80000000L)) &&
!ut_zip_unzip_compatible && (flags & 0x0ff)) {
/* atime not in range of UnZip's time_t */
flags &= ~EB_UT_FL_ATIME;
TTrace((stderr,
- " UX access time range error: skip time!\n"));
+ " UX access time range error: skip time!\n"));
} else {
z_utim->atime = (time_t)i_time;
}
-#endif /* ?TIME_T_TYPE_DOUBLE */
+# endif /* def TIME_T_TYPE_DOUBLE [else] */
}
-#ifdef IZ_HAVE_UXUIDGID
+# ifdef IZ_HAVE_UXUIDGID
if (eb_len >= EB_UX_FULLSIZE && z_uidgid != NULL) {
z_uidgid[0] = makeword((EB_HEADSIZE+EB_UX_UID) + ef_buf);
z_uidgid[1] = makeword((EB_HEADSIZE+EB_UX_GID) + ef_buf);
flags |= EB_UX2_VALID;
}
-#endif /* IZ_HAVE_UXUIDGID */
+# endif /* IZ_HAVE_UXUIDGID */
}
break;
#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
-#define SPARKID_2 0x30435241 /* = "ARC0" */
+# define SPARKID_2 0x30435241 /* = "ARC0" */
/*******************************/
/* Function getRISCOSexfield() */
/*******************************/
+/* 2012-11-25 SMS. (OUSPG report.)
+ * See note at getZip64Data().
+ */
+
zvoid *getRISCOSexfield(ef_buf, ef_len)
ZCONST uch *ef_buf; /* buffer containing extra field */
- unsigned ef_len; /* total length of extra field */
+ long ef_len; /* total length of extra field */
{
unsigned eb_id;
- unsigned eb_len;
+ long eb_len;
/*---------------------------------------------------------------------------
This function scans the extra field for a Acorn SPARK filetype ef-block.
if (ef_len == 0 || ef_buf == NULL)
return NULL;
- Trace((stderr,"\ngetRISCOSexfield: scanning extra field of length %u\n",
- ef_len));
+ Trace((stderr,
+ "\ngetRISCOSexfield: scanning extra field of length %ld\n", ef_len));
while (ef_len >= EB_HEADSIZE) {
eb_id = makeword(EB_ID + ef_buf);
if (eb_len > (ef_len - EB_HEADSIZE)) {
/* discovered some extra field inconsistency! */
Trace((stderr,
- "getRISCOSexfield: block length %u > rest ef_size %u\n", eb_len,
- ef_len - EB_HEADSIZE));
+ "getRISCOSexfield: block length %ld > rest ef_size %ld\n",
+ eb_len, ef_len - EB_HEADSIZE));
break;
}
The following are the known types of zipfile extra fields as of this
writing. Extra fields are documented in PKWARE's appnote.txt and are
-intended to allow for backward- and forward-compatible extensions to
-the zipfile format. Multiple extra-field types may be chained together,
-provided that the total length of all extra-field data is less than 64KB.
-(In fact, PKWARE requires that the total length of the entire file header,
-including timestamp, file attributes, filename, comment, extra field, etc.,
-be no more than 64KB.)
-
-Each extra-field type (or subblock) must contain a four-byte header con-
-sisting of a two-byte header ID and a two-byte length (little-endian) for
-the remaining data in the subblock. If there are additional subblocks
-within the extra field, the header for each one will appear immediately
-following the data for the previous subblock (i.e., with no padding for
-alignment).
-
-All integer fields in the descriptions below are in little-endian (Intel)
-format unless otherwise specified. Note that "Short" means two bytes,
-"Long" means four bytes, and "Long-Long" means eight bytes, regardless
-of their native sizes. Unless specifically noted, all integer fields should
-be interpreted as unsigned (non-negative) numbers.
+intended to allow for backward- and forward-compatible extensions to the
+zipfile format. Multiple extra-field types may be chained together,
+provided that the total length of all extra-field data is less than
+64KB. (In fact, PKWARE requires that the total length of the entire file
+header, including timestamp, file attributes, filename, comment, extra
+field, etc., be no more than 64KB.)
+
+Each extra-field type (or subblock) must contain a four-byte header
+consisting of a two-byte header ID and a two-byte length (little-endian)
+for the remaining data in the subblock. If there are additional
+subblocks within the extra field, the header for each one will appear
+immediately following the data for the previous subblock (i.e., with no
+padding for alignment).
+
+All integer fields in the descriptions below are in little-endian
+(Intel) format unless otherwise specified. Note that "Short" means two
+bytes, "Long" means four bytes, and "Long-Long" means eight bytes,
+regardless of their native sizes. Unless specifically noted, all
+integer fields should be interpreted as unsigned (non-negative) numbers.
Christian Spieler, Ed Gordon, 20080717
-------------------------
- Header ID's of 0 thru 31 are reserved for use by PKWARE.
+ Header ID's of 0 through 31 are reserved for use by PKWARE.
The remaining ID's can be used by third party vendors for
proprietary usage.
The current Header ID mappings defined by PKWARE are:
- 0x0001 Zip64 extended information extra field
+ 0x0001 Zip64 extended information
0x0007 AV Info
0x0008 Reserved for extended language encoding data (PFS)
0x0009 OS/2 extended attributes (also Info-ZIP)
0x4453 Windows NT security descriptor (binary ACL)
0x4704 VM/CMS
0x470f MVS
- 0x4854 Theos, old inofficial port
+ 0x4854 Theos, old unofficial port
0x4b46 FWKCS MD5 (see below)
0x4c41 OS/2 access control list (text ACL)
- 0x4d49 Info-ZIP OpenVMS (obsolete)
+ 0x4d49 Info-ZIP OpenVMS ("IM", obsolete)
0x4d63 Macintosh SmartZIP, by Macro Bambini
0x4f4c Xceed original location extra field
0x5356 AOS/VS (binary ACL)
The following are detailed descriptions of the known extra-field block types:
- -Zip64 Extended Information Extra Field (0x0001):
- ===============================================
+ -Zip64 Extended Information (0x0001):
+ ===================================
- The following is the layout of the zip64 extended
- information "extra" block. If one of the size or
- offset fields in the Local or Central directory
- record is too small to hold the required data,
- a zip64 extended information record is created.
- The order of the fields in the zip64 extended
- information record is fixed, but the fields will
- only appear if the corresponding Local or Central
- directory record field is set to 0xFFFF or 0xFFFFFFFF.
+ The following is the layout of the Zip64 extended information
+ extra block. If one of the size or offset fields in the Local
+ or Central directory record is too small to hold the required
+ data, a Zip64 extended information record is created. The
+ order of the fields in the Zip64 extended information record
+ is fixed, but the fields will only appear if the corresponding
+ Local or Central directory record field is set to 0xFFFF or
+ 0xFFFFFFFF.
- Note: all fields stored in Intel low-byte/high-byte order.
+ Note: All fields stored in Intel low-byte/high-byte order.
Value Size Description
----- ---- -----------
- (ZIP64) 0x0001 2 bytes Tag for this "extra" block type
- Size 2 bytes Size of this "extra" block
+ (ZIP64) 0x0001 2 bytes Tag for this extra block type
+ Size 2 bytes Size of this extra block
Original
Size 8 bytes Original uncompressed file size
Compressed
Local Header for the original file size will be zero.
- -OS/2 Extended Attributes Extra Field (0x0009):
- =============================================
+ -OS/2 Extended Attributes (0x0009):
+ =================================
- The following is the layout of the OS/2 extended attributes "extra"
- block. (Last Revision 19960922)
+ The following is the layout of the OS/2 extended attributes
+ extra block. (Last Revision 19960922)
- Note: all fields stored in Intel low-byte/high-byte order.
+ Note: All fields stored in Intel low-byte/high-byte order.
Local-header version:
the variable-length field.
- -OS/2 Access Control List Extra Field:
- ====================================
+ -OS/2 Access Control List:
+ ========================
The following is the layout of the OS/2 ACL extra block.
(Last Revision 19960922)
method" section above; i.e., 0 for stored, 8 for deflated, etc.
The uncompressed ACL data consist of a text header of the form
- "ACL1:%hX,%hd\n", where the first field is the OS/2 ACCINFO acc_attr
- member and the second is acc_count, followed by acc_count strings
- of the form "%s,%hx\n", where the first field is acl_ugname (user
- group name) and the second acl_access. This block type will be
- extended for other operating systems as needed.
+ "ACL1:%hX,%hd\n", where the first field is the OS/2 ACCINFO
+ acc_attr member and the second is acc_count, followed by
+ acc_count strings of the form "%s,%hx\n", where the first
+ field is acl_ugname (user group name) and the second
+ acl_access. This block type will be extended for other
+ operating systems as needed.
- -Windows NT Security Descriptor Extra Field (0x4453):
- ===================================================
+ -Windows NT Security Descriptor (0x4453):
+ =======================================
- The following is the layout of the NT Security Descriptor (another
- type of ACL) extra block. (Last Revision 19960922)
+ The following is the layout of the NT Security Descriptor
+ (another type of ACL) extra block. (Last Revision 19960922)
Local-header version:
TSize Short total data size for this block (4)
BSize Long size of uncompressed local SD data
- The value of CType is interpreted according to the "compression
- method" section above; i.e., 0 for stored, 8 for deflated, etc.
- Version specifies how the compressed data are to be interpreted
- and allows for future expansion of this extra field type. Currently
- only version 0 is defined.
+ The value of CType is interpreted according to the
+ "compression method" section above; i.e., 0 for stored, 8 for
+ deflated, etc. Version specifies how the compressed data are
+ to be interpreted and allows for future expansion of this
+ extra block type. Currently only version 0 is defined.
- For version 0, the compressed data are to be interpreted as a single
- valid Windows NT SECURITY_DESCRIPTOR data structure, in self-relative
- format.
+ For version 0, the compressed data are to be interpreted as a
+ single valid Windows NT SECURITY_DESCRIPTOR data structure, in
+ self-relative format.
- -PKWARE Win95/WinNT Extra Field (0x000a):
- =======================================
+ -PKWARE Win95/WinNT (0x000a):
+ ===========================
The following description covers PKWARE's "NTFS" attributes
- "extra" block, introduced with the release of PKZIP 2.50 for
+ extra block, introduced with the release of PKZIP 2.50 for
Windows. (Last Revision 20001118)
- (Note: At this time the Mtime, Atime and Ctime values may
- be used on any WIN32 system.)
- [Info-ZIP note: In the current implementations, this field has
- a fixed total data size of 32 bytes and is only stored as local
- extra field.]
+ (Note: At this time the Mtime, Atime, and Ctime values may be
+ used on any WIN32 system.)
+ [Info-ZIP note: In the current implementations, this field has
+ a fixed total data size of 32 bytes and is stored only as a
+ local extra block.]
Value Size Description
----- ---- -----------
- (NTFS) 0x000a Short Tag for this "extra" block type
+ (NTFS) 0x000a Short Tag for this extra block type
TSize Short Total Data Size for this block
Reserved Long for future use
Tag1 Short NTFS attribute tag value #1
The total length for this block is 28 bytes, resulting in a
fixed size value of 32 for the TSize field of the NTFS block.
- The NTFS filetimes are 64-bit unsigned integers, stored in Intel
- (least significant byte first) byte order. They determine the
- number of 1.0E-07 seconds (1/10th microseconds!) past WinNT "epoch",
- which is "01-Jan-1601 00:00:00 UTC".
+ The NTFS filetimes are 64-bit unsigned integers, stored in
+ Intel (least significant byte first) byte order. They
+ determine the number of 1.0E-07 seconds (1/10th microseconds!)
+ past WinNT "epoch", which is "01-Jan-1601 00:00:00 UTC".
- -PKWARE OpenVMS Extra Field (0x000c):
- ===================================
+ -PKWARE OpenVMS (0x000c):
+ =======================
The following is the layout of PKWARE's OpenVMS attributes
- "extra" block. (Last Revision 12/17/91)
+ extra block. (Last Revision 12/17/91)
- Note: all fields stored in Intel low-byte/high-byte order.
+ Note: All fields stored in Intel low-byte/high-byte order.
Value Size Description
----- ---- -----------
- (VMS) 0x000c Short Tag for this "extra" block type
+ (VMS) 0x000c Short Tag for this extra block type
TSize Short Total Data Size for this block
CRC Long 32-bit CRC for remainder of the block
Tag1 Short OpenVMS attribute tag value #1
Rules:
- 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 ATR.H under
- OpenVMS C. Neither of these values will ever be zero.
+ 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.
+ Neither of these values will ever be zero.
2. No word alignment or padding is performed.
3. A well-behaved PKZIP/OpenVMS program should never produce
more than one sub-block with the same TagX value. Also,
- there will never be more than one "extra" block of type
+ there will never be more than one extra block of type
0x000c in a particular directory record.
- -Info-ZIP VMS Extra Field:
- ========================
+ -Info-ZIP VMS "IM":
+ =================
- The following is the layout of Info-ZIP's VMS attributes extra
- block for VAX or Alpha AXP. The local-header and central-header
- versions are identical. (Last Revision 19960922)
+ The following is the layout of Info-ZIP's "IM" VMS attributes
+ extra block. The local-header and central-header versions are
+ identical. (Last Revision 19960922)
Value Size Description
----- ---- -----------
- (VMS2) 0x4d49 Short tag for this extra block type ("JM")
+ (VMS2) 0x4d49 Short tag for this extra block type ("IM")
TSize Short total data size for this block
ID Long block ID
Flags Short info bytes
bits and non-zero-valued bytes with a "1" bit followed by the byte
value.
- The variable-length compressed data contains only the data corre-
- sponding to the indicated structure or string. Typically multiple
- VMS2 extra fields are present (each with a unique block type).
+ The variable-length compressed data contains only the data
+ corresponding to the indicated structure or string.
+ Typically, multiple VMS2 extra blocks are present (each with a
+ unique block ID).
- -Info-ZIP Macintosh Extra Field:
- ==============================
+ -Info-ZIP Macintosh:
+ ==================
- The following is the layout of the (old) Info-ZIP resource-fork extra
- block for Macintosh. The local-header and central-header versions
- are identical. (Last Revision 19960922)
+ The following is the layout of the (old) Info-ZIP
+ resource-fork extra block for Macintosh (pre-Mac-OS-X). The
+ local-header and central-header versions are identical. (Last
+ Revision 19960922)
Value Size Description
----- ---- -----------
VolName 28 bytes volume name (optional)
All fields but the first two are in native Macintosh format
- (big-endian Motorola order, not little-endian Intel). The least
- significant bit of Flags is 1 if the file is a data fork, 0 other-
- wise. In addition, if this extra field is present, the filename
- has an extra 'd' or 'r' appended to indicate data fork or resource
- fork. The 28-byte VolName field may be omitted.
+ (big-endian Motorola order, not little-endian Intel). The
+ least significant bit of Flags is 1 if the file is a data
+ fork, 0 otherwise. In addition, if this extra field is
+ present, the filename has an extra 'd' or 'r' appended to
+ indicate data fork or resource fork. The 28-byte VolName
+ field may be omitted.
- -ZipIt Macintosh Extra Field (long):
- ==================================
+ -ZipIt Macintosh (long):
+ ======================
- The following is the layout of the ZipIt extra block for Macintosh.
- The local-header and central-header versions are identical.
- (Last Revision 19970130)
+ The following is the layout of the ZipIt extra block for
+ Macintosh (pre-Mac-OS-X). The local-header and central-header
+ versions are identical. (Last Revision 19970130)
Value Size Description
----- ---- -----------
Creator Byte[4] four-byte Mac creator string
- -ZipIt Macintosh Extra Field (short, for files):
- ==============================================
+ -ZipIt Macintosh (short, for files):
+ ==================================
The following is the layout of a shortened variant of the
- ZipIt extra block for Macintosh (without "full name" entry).
- This variant is used by ZipIt 1.3.5 and newer for entries of
- files (not directories) that do not have a MacBinary encoded
- file. The local-header and central-header versions are identical.
- (Last Revision 20030602)
+ ZipIt extra block for Macintosh (pre-Mac-OS-X) (without "full
+ name" entry). This variant is used by ZipIt 1.3.5 and newer
+ for entries of files (not directories) that do not have a
+ MacBinary encoded file. The local-header and central-header
+ versions are identical. (Last Revision 20030602)
Value Size Description
----- ---- -----------
0x0000 beShort reserved, may be omitted
- -ZipIt Macintosh Extra Field (short, for directories):
- ====================================================
+ -ZipIt Macintosh (short, for directories):
+ ========================================
The following is the layout of a shortened variant of the
- ZipIt extra block for Macintosh used only for directory
- entries. This variant is used by ZipIt 1.3.5 and newer to
- save some optional Mac-specific information about directories.
- The local-header and central-header versions are identical.
+ ZipIt extra block for Macintosh (pre-Mac-OS-X) used only for
+ directory entries. This variant is used by ZipIt 1.3.5 and
+ newer to save some optional Mac-specific information about
+ directories. The local-header and central-header versions are
+ identical.
Value Size Description
----- ---- -----------
bits 1-15 reserved, zero;
- -Info-ZIP Macintosh Extra Field (new):
- ====================================
+ -Info-ZIP Macintosh (new):
+ ========================
- The following is the layout of the (new) Info-ZIP extra
- block for Macintosh, designed by Dirk Haase.
- All values are in little-endian.
- (Last Revision 19981005)
+ The following is the layout of the (new) Info-ZIP extra block
+ for Macintosh (pre-Mac-OS-X), designed by Dirk Haase. All
+ values are in little-endian order. (Last Revision 19981005)
Local-header version:
Attributes:
- Attribs is a Mac-specific block of data in little-endian format with
- the following structure (if compressed, uncompress it first):
+ Attribs is a Mac-specific block of data in little-endian
+ format with the following structure (if compressed, uncompress
+ it first):
Value Size Description
----- ---- -----------
CrGMTOffs Long(signed!) difference "local Creat. time - UTC"
MdGMTOffs Long(signed!) difference "local Modif. time - UTC"
BkGMTOffs Long(signed!) difference "local Backup time - UTC"
- These "local time - UTC" differences (stored in seconds) may be
- used to support timestamp adjustment after inter-timezone transfer.
- These fields are optional; bit 4 of the flags word controls their
- presence.
+ These "local time - UTC" differences (stored in seconds) may
+ be used to support timestamp adjustment after inter-timezone
+ transfer. These fields are optional; bit 4 of the flags
+ word controls their presence.
Charset Short TextEncodingBase (Charset)
valid for the following two fields
Currently coded in the native Charset.
- -SmartZIP Macintosh Extra Field:
- ====================================
+ -SmartZIP Macintosh:
+ ==================
- The following is the layout of the SmartZIP extra
- block for Macintosh, designed by Marco Bambini.
+ The following is the layout of the SmartZIP extra block for
+ Macintosh (pre-Mac-OS-X), designed by Marco Bambini.
Local-header version:
The local-header and central-header versions are identical.
- -Acorn SparkFS Extra Field:
- =========================
+ -Acorn SparkFS:
+ =============
- The following is the layout of David Pilling's SparkFS extra block
- for Acorn RISC OS. The local-header and central-header versions are
- identical. (Last Revision 19960922)
+ The following is the layout of David Pilling's SparkFS extra
+ block for Acorn RISC OS. The local-header and central-header
+ versions are identical. (Last Revision 19960922)
Value Size Description
----- ---- -----------
bit 7 reserved
- -VM/CMS Extra Field:
- ==================
+ -VM/CMS:
+ ======
- The following is the layout of the file-attributes extra block for
- VM/CMS. The local-header and central-header versions are
+ The following is the layout of the file-attributes extra block
+ for VM/CMS. The local-header and central-header versions are
identical. (Last Revision 19960922)
Value Size Description
flData is an uncompressed fldata_t struct.
- -MVS Extra Field:
- ===============
+ -MVS:
+ ===
- The following is the layout of the file-attributes extra block for
- MVS. The local-header and central-header versions are identical.
- (Last Revision 19960922)
+ The following is the layout of the file-attributes extra block
+ for MVS. The local-header and central-header versions are
+ identical. (Last Revision 19960922)
Value Size Description
----- ---- -----------
flData is an uncompressed fldata_t struct.
- -PKWARE Unix Extra Field (0x000d):
- ================================
+ -PKWARE Unix (0x000d):
+ ====================
- 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.
+ 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.
(Last Revision 19980901)
- This field has a minimum data size of 12 bytes and is only stored
- as local extra field.
+ This block has a minimum data size of 12 bytes and is only
+ stored as a local extra field.
Value Size Description
----- ---- -----------
- (Unix0) 0x000d Short Tag for this "extra" block type
+ (Unix0) 0x000d Short Tag for this extra block type
TSize Short Total Data Size for this block
AcTime Long time of last access (UTC/GMT)
ModTime Long time of last modification (UTC/GMT)
GID Short Unix group ID
(var) variable Variable length data field
- The variable length data field will contain file type
- specific data. Currently the only values allowed are
- the original "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. 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 first entry
- will be the major device number, and the second the minor
- device number.
-
- [Info-ZIP note: The fixed part of this field has the same layout as
- Info-ZIP's abandoned "Unix1 timestamps & owner ID info" extra field;
- only the two tag bytes are different.]
-
-
- -PATCH Descriptor Extra Field (0x000f):
- =====================================
-
- The following is the layout of the Patch Descriptor "extra"
+ The variable length data field will contain file-type-specific
+ data. Currently the only values allowed are the original
+ "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.
+ 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
+ first entry will be the major device number, and the second
+ the minor device number.
+
+ [Info-ZIP note: The fixed part of this field has the same
+ layout as Info-ZIP's abandoned "Unix1 timestamps & owner ID
+ info" extra field; only the two tag bytes are different.]
+
+
+ -PATCH Descriptor (0x000f):
+ =========================
+
+ The following is the layout of the Patch Descriptor extra
block.
- Note: all fields stored in Intel low-byte/high-byte order.
+ Note: All fields stored in Intel low-byte/high-byte order.
Value Size Description
----- ---- -----------
- (Patch) 0x000f Short Tag for this "extra" block type
- TSize Short Size of the total "extra" block
+ (Patch) 0x000f Short Tag for this extra block type
+ TSize Short Size of the total extra block
Version Short Version of the descriptor
Flags Long Actions and reactions (see below)
OldSize Long Size of the file about to be patched
ignore 2
fail 3
- Patch support is provided by PKPatchMaker(tm) technology and is
- covered under U.S. Patents and Patents Pending. The use or
- implementation in a product of certain technological aspects set
- forth in the current APPNOTE, including those with regard to
- strong encryption, patching, or extended tape operations requires
- a license from PKWARE. Please contact PKWARE with regard to
- acquiring a license.
+ Patch support is provided by PKPatchMaker(tm) technology and
+ is covered under U.S. Patents and Patents Pending. The use or
+ implementation in a product of certain technological aspects
+ set forth in the current APPNOTE, including those with regard
+ to strong encryption, patching, or extended tape operations
+ requires a license from PKWARE. Please contact PKWARE with
+ regard to acquiring a license.
-PKCS#7 Store for X.509 Certificates (0x0014):
============================================
This field contains information about each of the certificates
- files may be signed with. When the Central Directory Encryption
- feature is enabled for a ZIP file, this record will appear in
- the Archive Extra Data Record, otherwise it will appear in the
- first central directory record and will be ignored in any
- other record.
+ files may be signed with. When the Central Directory
+ Encryption feature is enabled for a ZIP file, this record will
+ appear in the Archive Extra Data Record, otherwise it will
+ appear in the first central directory record and will be
+ ignored in any other record.
- Note: all fields stored in Intel low-byte/high-byte order.
+ Note: All fields stored in Intel low-byte/high-byte order.
Value Size Description
----- ---- -----------
- (Store) 0x0014 2 bytes Tag for this "extra" block type
+ (Store) 0x0014 2 bytes Tag for this extra block type
TSize 2 bytes Size of the store data
SData TSize Data about the store
Version 2 bytes Version number, 0x0001 for now
StoreD (variable) Actual store data
- The StoreD member is suitable for passing as the pbData
- member of a CRYPT_DATA_BLOB to the CertOpenStore() function
- in Microsoft's CryptoAPI. The SSize member above will be
+ The StoreD member is suitable for passing as the pbData member
+ of a CRYPT_DATA_BLOB to the CertOpenStore() function in
+ Microsoft's CryptoAPI. The SSize member above will be
cbData + 6, where cbData is the cbData member of the same
- CRYPT_DATA_BLOB. The encoding type to pass to
- CertOpenStore() should be
- PKCS_7_ANS_ENCODING | X509_ASN_ENCODING.
+ CRYPT_DATA_BLOB. The encoding type to pass to CertOpenStore()
+ should be PKCS_7_ANS_ENCODING | X509_ASN_ENCODING.
-X.509 Certificate ID and Signature for individual file (0x0015):
contains the signature data. This field can appear multiple
times, but can only appear once per certificate.
- Note: all fields stored in Intel low-byte/high-byte order.
+ Note: All fields stored in Intel low-byte/high-byte order.
Value Size Description
----- ---- -----------
- (CID) 0x0015 2 bytes Tag for this "extra" block type
+ (CID) 0x0015 2 bytes Tag for this extra block type
CSize 2 bytes Size of Method
Method (variable)
Serial (variable) Serial Number data
The Issuer and IssSize members are suitable for creating a
- CRYPT_DATA_BLOB to be the Issuer member of a CERT_INFO
- struct. The Serial and SerSize members would be the
- SerialNumber member of the same CERT_INFO struct. This
- struct would be used to find the certificate in the store
- the file was signed with. Those structures are from the MS
- CryptoAPI.
+ CRYPT_DATA_BLOB to be the Issuer member of a CERT_INFO struct.
+ The Serial and SerSize members would be the SerialNumber
+ member of the same CERT_INFO struct. This struct would be
+ used to find the certificate in the store the file was signed
+ with. Those structures are from the MS CryptoAPI.
Sig and SigSize are the actual signature data and size
generated by signing the file with the MS CryptoAPI using a
=================================================================
This field contains the information about which certificate in
- the PKCS#7 store was used to sign the central directory structure.
- When the Central Directory Encryption feature is enabled for a
- ZIP file, this record will appear in the Archive Extra Data Record,
- otherwise it will appear in the first central directory record,
- along with the store. The data structure is the
- same as the CID, except that SigSize will be 0, and there
- will be no Sig member.
+ the PKCS#7 store was used to sign the central directory
+ structure. When the Central Directory Encryption feature is
+ enabled for a ZIP file, this record will appear in the Archive
+ Extra Data Record, otherwise it will appear in the first
+ central directory record, along with the store. The data
+ structure is the same as the CID, except that SigSize will be
+ 0, and there will be no Sig member.
This field is also kept after the last central directory
- record, as the signature data (ID 0x05054b50, it looks like
- a central directory record of a different type). This
- second copy of the data is the Signature Data member of the
- record, and will have a SigSize that is non-zero, and will
- have Sig data.
+ record, as the signature data (ID 0x05054b50, it looks like a
+ central directory record of a different type). This second
+ copy of the data is the Signature Data member of the record,
+ and will have a SigSize that is non-zero, and will have Sig
+ data.
- Note: all fields stored in Intel low-byte/high-byte order.
+ Note: All fields stored in Intel low-byte/high-byte order.
Value Size Description
----- ---- -----------
- (CDID) 0x0016 2 bytes Tag for this "extra" block type
+ (CDID) 0x0016 2 bytes Tag for this extra block type
TSize 2 bytes Size of data that follows
TData TSize Data
Value Size Description
----- ---- -----------
- 0x0017 2 bytes Tag for this "extra" block type
+ 0x0017 2 bytes Tag for this extra block type
TSize 2 bytes Size of data that follows
Format 2 bytes Format definition for this record
AlgID 2 bytes Encryption algorithm identifier
Bitlen 2 bytes Bit length of encryption key
Flags 2 bytes Processing flags
CertData TSize-8 Certificate decryption extra field data
- (refer to the explanation for CertData
- in the section describing the
- Certificate Processing Method under
- the Strong Encryption Specification)
+ (Refer to the explanation for CertData in
+ the section describing the Certificate
+ Processing Method under the Strong
+ Encryption Specification.)
-Record Management Controls (0x0018):
Value Size Description
----- ---- -----------
-(Rec-CTL) 0x0018 2 bytes Tag for this "extra" block type
+(Rec-CTL) 0x0018 2 bytes Tag for this extra block type
CSize 2 bytes Size of total extra block data
Tag1 2 bytes Record control attribute 1
Size1 2 bytes Size of attribute 1, in bytes
=====================================================
This field contains information about each of the certificates
- used in encryption processing and it can be used to identify who is
- allowed to decrypt encrypted files. This field should only appear
- in the archive extra data record. This field is not required and
- serves only to aide archive modifications by preserving public
- encryption key data. Individual security requirements may dictate
- that this data be omitted to deter information exposure.
+ used in encryption processing and it can be used to identify
+ who is allowed to decrypt encrypted files. This field should
+ only appear in the archive extra data record. This field is
+ not required and serves only to aid archive modifications by
+ preserving public encryption key data. Individual security
+ requirements may dictate that these data be omitted to deter
+ information exposure.
- Note: all fields stored in Intel low-byte/high-byte order.
+ Note: All fields stored in Intel low-byte/high-byte order.
Value Size Description
----- ---- -----------
- (CStore) 0x0019 2 bytes Tag for this "extra" block type
+ (CStore) 0x0019 2 bytes Tag for this extra block type
TSize 2 bytes Size of the store data
TData TSize Data about the store
CStore (var) PKCS#7 data blob
- -MVS Extra Field (PKWARE, 0x0065):
- ================================
+ -MVS (PKWARE, 0x0065):
+ ====================
- The following is the layout of the MVS "extra" block.
+ The following is the layout of the MVS extra block.
Note: Some fields are stored in Big Endian format.
All text is in EBCDIC format unless otherwise specified.
Value Size Description
----- ---- -----------
- (MVS) 0x0065 2 bytes Tag for this "extra" block type
+ (MVS) 0x0065 2 bytes Tag for this extra block type
TSize 2 bytes Size for the following data block
ID 4 bytes EBCDIC "Z390" 0xE9F3F9F0 or
"T4MV" for TargetFour
(var) TSize-4 Attribute data
- -OS/400 Extra Field (0x0065):
- ===========================
+ -OS/400 (0x0065):
+ ===============
- The following is the layout of the OS/400 "extra" block.
+ The following is the layout of the OS/400 extra block.
Note: Some fields are stored in Big Endian format.
All text is in EBCDIC format unless otherwise specified.
Value Size Description
----- ---- -----------
- (OS400) 0x0065 2 bytes Tag for this "extra" block type
+ (OS400) 0x0065 2 bytes Tag for this extra block type
TSize 2 bytes Size for the following data block
ID 4 bytes EBCDIC "I400" 0xC9F4F0F0 or
"T4MV" for TargetFour
(var) TSize-4 Attribute data
- -Info-ZIP Unicode Path Extra Field:
- =================================
+ -Info-ZIP Unicode Path:
+ =====================
- Stores the UTF-8 version of the entry path as stored in the
- local header and central directory header.
- (Last Revision 20070912)
+ The following is the layout of the Info-ZIP Unicode Path extra
+ block. It stores the UTF-8 version of the entry path as
+ stored (in some other form) in the local header and central
+ directory header. (Last Revision 20070912)
Value Size Description
----- ---- -----------
NameCRC32 Long CRC-32 checksum of standard name field
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. Changes
- may not be backward compatible so this extra field should not be
- used if the version is not recognized.
+ Currently, Version is set to the number 1. If there is a need
+ 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.
- The NameCRC32 is the standard zip CRC32 checksum of the File Name
+ NameCRC32 is the standard zip CRC32 checksum of the File Name
field in the header. This is used to verify that the header
- File Name field has not changed since the Unicode Path extra field
- was created. This can happen if a utility renames the entry but
- does not update the UTF-8 path extra field. If the CRC check fails,
- this UTF-8 Path Extra Field should be ignored and the File Name field
- in the header should be used instead.
-
- The UnicodeName is the UTF-8 version of the contents of the File
- Name field in the header, without any trailing NUL. The standard
- name field in the Zip entry header remains filled with the entry
- name coded in the local machine's extended ASCII system charset.
- As UnicodeName is defined to be UTF-8, no UTF-8 byte order mark
- (BOM) is used. The length of this field is determined by
- subtracting the size of the previous fields from TSize.
- If both the File Name and Comment fields are UTF-8, the new General
- Purpose Bit Flag, bit 11 (Language encoding flag (EFS)), should be
- used to indicate that both the header File Name and Comment fields
- are UTF-8 and, in this case, the Unicode Path and Unicode Comment
- extra fields are not needed and should not be created. Note that,
- for backward compatibility, bit 11 should only be used if the native
- character set of the paths and comments being zipped up are already
- in UTF-8. The same method, either general purpose bit 11 or extra
- fields, should be used in both the Local and Central Directory Header
- for a file.
-
- Utilisation rules:
- 1. This field shall never be created for names consisting solely of
- 7-bit ASCII characters.
- 2. On a system that already uses UTF-8 as system charset, this field
- shall not repeat the string pattern already stored in the Zip
- entry's standard name field. Instead, a field of exactly 9 bytes
- (70 75 05 00 01 and 4 bytes CRC) should be created.
- In this form with 5 data bytes, the field serves as indicator
- for the UTF-8 encoding of the standard Zip header's name field.
- 3. This field shall not be used whenever the calculated CRC-32 of
- the entry's standard name field does not match the provided
- CRC checksum value. A mismatch of the CRC check indicates that
- the standard name field was changed by some non-"up"-aware
- utility without synchronizing this UTF-8 name e.f. block.
-
-
- -Info-ZIP Unicode Comment Extra Field:
- ====================================
-
- Stores the UTF-8 version of the entry comment as stored in the
- central directory header.
- (Last Revision 20070912)
+ File Name field has not changed since the Unicode Path extra
+ field was created. This can happen if a utility renames the
+ entry but does not update the UTF-8 path extra field. If the
+ CRC check fails, this UTF-8 Path Extra Field should be ignored
+ and the File Name field in the header should be used instead.
+
+ UnicodeName is the UTF-8 version of the contents of the File
+ Name field in the header, without any trailing NUL. The
+ standard name field in the Zip entry header remains filled
+ with the entry name coded in the local machine's extended
+ ASCII system charset. UnicodeName is defined to be UTF-8, so
+ no UTF-8 byte order mark (BOM) is used. The length of this
+ field is determined by subtracting the size of the previous
+ fields from TSize. If both the File Name and Comment fields
+ are UTF-8, the new General Purpose Bit Flag, bit 11 (Language
+ encoding flag (EFS)), should be used to indicate that both the
+ header File Name and Comment fields are UTF-8, and, in this
+ case, the Unicode Path and Unicode Comment extra fields are
+ not needed and should not be created. Note that, for backward
+ compatibility, bit 11 should only be used if the native
+ character set of the paths and comments being zipped up are
+ already in UTF-8. The same method, either general purpose bit
+ 11 or extra fields, should be used in both the Local and
+ Central Directory Header for a file.
+
+ Utilization rules:
+ 1. This field shall never be created for names consisting
+ solely of 7-bit ASCII characters.
+ 2. On a system that already uses UTF-8 as system charset, this
+ field shall not repeat the string pattern already stored in
+ the Zip entry's standard name field. Instead, a field of
+ exactly 9 bytes (70 75 05 00 01 and 4 bytes CRC) should be
+ created. In this form, with 5 data bytes, the field serves
+ to indicate the UTF-8 encoding of the standard Zip header's
+ name field.
+ 3. This field shall not be used whenever the calculated CRC-32
+ of the entry's standard name field does not match the
+ provided CRC checksum value. A mismatch of the CRC check
+ indicates that the standard name field was changed by some
+ non-"up"-aware utility without synchronizing this UTF-8
+ name extra block.
+
+
+ -Info-ZIP Unicode Comment:
+ ========================
+
+ The following is the layout of the Info-ZIP Unicode Comment
+ extra block. It stores the UTF-8 version of the entry comment
+ as stored (in some other form) in the central directory
+ header. (Last Revision 20070912)
Value Size Description
----- ---- -----------
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. Changes
- may not be backward compatible so this extra field should not be
- used if the version is not recognized.
-
- The ComCRC32 is the standard zip CRC32 checksum of the Comment
- field in the central directory header. This is used to verify that
- the comment field has not changed since the Unicode Comment extra
- field was created. This can happen if a utility changes the Comment
- field but does not update the UTF-8 Comment extra field. If the CRC
- check fails, this Unicode Comment extra field should be ignored and
- the Comment field in the header used.
-
- The UnicodeCom field is the UTF-8 version of the entry comment field
- in the header. As UnicodeCom is defined to be UTF-8, no UTF-8 byte
- order mark (BOM) is used. The length of this field is determined by
- subtracting the size of the previous fields from TSize. If both the
- File Name and Comment fields are UTF-8, the new General Purpose Bit
- Flag, bit 11 (Language encoding flag (EFS)), can be used to indicate
- both the header File Name and Comment fields are UTF-8 and, in this
- case, the Unicode Path and Unicode Comment extra fields are not
- needed and should not be created. Note that, for backward
- compatibility, bit 11 should only be used if the native character set
- of the paths and comments being zipped up are already in UTF-8. The
- same method, either bit 11 or extra fields, should be used in both
- the local and central directory headers.
-
-
- -Extended Timestamp Extra Field:
- ==============================
-
- The following is the layout of the extended-timestamp extra block.
- (Last Revision 19970118)
+ 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.
+
+ ComCRC32 is the standard zip CRC32 checksum of the Comment
+ field in the central directory header. This is used to verify
+ that the comment field has not changed since the Unicode
+ Comment extra field was created. This can happen if a utility
+ changes the Comment field but does not update the UTF-8
+ Comment extra field. If the CRC check fails, this Unicode
+ Comment extra field should be ignored, and the Comment field
+ in the header used.
+
+ The UnicodeCom field is the UTF-8 version of the entry comment
+ field in the header. UnicodeCom is defined to be UTF-8, so no
+ UTF-8 byte order mark (BOM) is used. The length of this field
+ is determined by subtracting the size of the previous fields
+ from TSize. If both the File Name and Comment fields are
+ UTF-8, the new General Purpose Bit Flag, bit 11 (Language
+ encoding flag (EFS)), can be used to indicate both the header
+ File Name and Comment fields are UTF-8 and, in this case, the
+ Unicode Path and Unicode Comment extra fields are not needed
+ and should not be created. Note that, for backward
+ compatibility, bit 11 should only be used if the native
+ character set of the paths and comments being zipped are
+ already in UTF-8. The same method, either bit 11 or extra
+ fields, should be used in both the local and central directory
+ headers.
+
+
+ -Extended Timestamp:
+ ==================
+
+ The following is the layout of the extended-timestamp extra
+ block. (Last Revision 19970118)
Local-header version:
Flags Byte info bits (refers to local header!)
(ModTime) Long time of last modification (UTC/GMT)
- The central-header extra field contains the modification time only,
- or no timestamp at all. TSize is used to flag its presence or
- absence. But note:
+ The central-header extra field contains the modification time
+ only, or no timestamp at all. TSize is used to flag its
+ presence or absence. But note:
- If "Flags" indicates that Modtime is present in the local header
- field, it MUST be present in the central header field, too!
- This correspondence is required because the modification time
- value may be used to support trans-timezone freshening and
- updating operations with zip archives.
+ If "Flags" indicates that Modtime is present in the local
+ header field, it MUST be present in the central header
+ field, too! This correspondence is required because the
+ modification time value may be used to support
+ trans-timezone freshening and updating operations with zip
+ archives.
- The time values are in standard Unix signed-long format, indicating
- the number of seconds since 1 January 1970 00:00:00. The times
- are relative to Coordinated Universal Time (UTC), also sometimes
- referred to as Greenwich Mean Time (GMT). To convert to local time,
- the software must know the local timezone offset from UTC/GMT.
+ The time values are in standard Unix signed-long format,
+ indicating the number of seconds since 1 January 1970
+ 00:00:00. The times are Coordinated Universal Time (UTC),
+ also sometimes referred to as Greenwich Mean Time (GMT). To
+ convert to local time, the software must know the local
+ timezone offset from UTC/GMT.
- The lower three bits of Flags in both headers indicate which time-
- stamps are present in the LOCAL extra field:
+ The lower three bits of Flags in both headers indicate which
+ time-stamps are present in the LOCAL extra field:
bit 0 if set, modification time is present
bit 1 if set, access time is present
bit 2 if set, creation time is present
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. (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 may be added in the future.
+ Those times that are present will appear in the order
+ 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
+ may be added in the future.
- -Info-ZIP Unix Extra Field (type 1):
- ==================================
+ -Info-ZIP Unix (type 1, "UX"):
+ ============================
- The following is the layout of the old Info-ZIP extra block for
- Unix. It has been replaced by the extended-timestamp extra block
- (0x5455) and the Unix type 2 extra block (0x7855).
- (Last Revision 19970118)
+ The following is the layout of the old Info-ZIP extra block
+ for Unix. It has been replaced by the extended-timestamp
+ extra block (0x5455, "UT") and the Unix type 2 extra block
+ (0x7855, "Ux"). (Last Revision 19970118)
Local-header version:
AcTime Long time of last access (GMT/UTC)
ModTime Long time of last modification (GMT/UTC)
- The file access and modification times are in standard Unix signed-
- long format, indicating the number of seconds since 1 January 1970
- 00:00:00. The times are relative to Coordinated Universal Time
- (UTC), also sometimes referred to as Greenwich Mean Time (GMT). To
- convert to local time, the software must know the local timezone
- offset from UTC/GMT. The modification time may be used by non-Unix
- systems to support inter-timezone freshening and updating of zip
- archives.
-
- The local-header extra block may optionally contain UID and GID
- info for the file. The local-header TSize value is the only
- indication of this. Note that Unix UIDs and GIDs are usually
- specific to a particular machine, and they generally require root
- access to restore.
+ The file access and modification times are in standard Unix
+ signed-long format, indicating the number of seconds since
+ 1 January 1970 00:00:00. The times are Coordinated Universal
+ Time (UTC), also sometimes referred to as Greenwich Mean Time
+ (GMT). To convert to local time, the software must know the
+ local timezone offset from UTC/GMT. The modification time may
+ be used by non-Unix systems to support inter-timezone
+ freshening and updating of zip archives.
+
+ The local-header extra block may optionally contain UID and
+ GID info for the file. The local-header TSize value is the
+ only indication of this. Note that Unix UIDs and GIDs are
+ usually specific to a particular machine, and they generally
+ require root privilege to restore.
This extra field type is obsolete, but it has been in use since
mid-1994. Therefore future archiving software should continue to
support it. Some guidelines:
- An archive member should either contain the old "Unix1"
- extra field block or the new extra field types "time" and/or
- "Unix2".
+ An archive member should contain either the old "Unix1"
+ (0x5855, "UX") extra block or the new extra block types
+ "time" (0x5455, "UT") and/or "Unix2" (0x7855, "Ux").
- If both the old "Unix1" block type and one or both of the new
- block types "time" and "Unix2" are found, the "Unix1" block
- should be considered invalid and ignored.
+ If both the old "Unix1" block type and one or both of the
+ new block types "time" and "Unix2" are found, the "Unix1"
+ block should be considered invalid and ignored.
- Unarchiving software should recognize both old and new extra
- field block types, but the info from new types overrides the
- old "Unix1" field.
+ Unarchiving software should recognize both old and new
+ extra block types, but the info from new types
+ overrides the old "Unix1" field.
- Archiving software should recognize "Unix1" extra fields for
- timestamp comparison but never create it for updated, freshened
- or new archive members. When copying existing members to a new
- archive, any "Unix1" extra field blocks should be converted to
- the new "time" and/or "Unix2" types.
+ Archiving software should recognize a "Unix1" extra field
+ for timestamp comparison but never create it for updated,
+ freshened or new archive members. When copying existing
+ members to a new archive, any "Unix1" extra blocks should
+ be converted to the new "time" and/or "Unix2" types.
- -Info-ZIP UNIX Extra Field (type 2):
- ==================================
+ -Info-ZIP UNIX (type 2, "Ux"):
+ ============================
- The following is the layout of the new Info-ZIP extra block for
- Unix. (Last Revision 19960922)
+ The following is the layout of the new Info-ZIP extra block
+ for Unix. (Last Revision 19960922)
Local-header version:
(Unix2) 0x7855 Short tag for this extra block type ("Ux")
TSize Short total data size for this block (0)
- The data size of the central-header version is zero; it is used
- solely as a flag that UID/GID info is present in the local-header
- extra field. If additional fields are ever added to the local
- version, the central version may be extended to indicate this.
+ The data size of the central-header version is zero; it is
+ used solely as a flag that UID/GID info is present in the
+ local-header extra field. If additional fields are ever added
+ to the local version, the central version may be extended to
+ indicate this.
- Note that Unix UIDs and GIDs are usually specific to a particular
- machine, and they generally require root access to restore.
+ Note that Unix UIDs and GIDs may be specific to a particular
+ machine, and they may require root privilege to restore.
- -Info-ZIP New Unix Extra Field:
- ====================================
+ -Info-ZIP New Unix ("ux"):
+ ========================
- Currently stores Unix UIDs/GIDs up to 32 bits.
- (Last Revision 20080509)
+ The following is the layout of the Info-ZIP New Unix extra
+ 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)
Value Size Description
----- ---- -----------
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. Changes
- may not be backward compatible so this extra field should not be
- used if the version is not recognized.
+ 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.
- UIDSize is the size of the UID field in bytes. This size should
- match the size of the UID field on the target OS.
+ UIDSize is the size of the UID field in bytes. This size
+ should match the size of the UID field on the target OS.
- UID is the UID for this entry in standard little endian format.
+ UID is the UID for this entry in standard little endian
+ format.
- GIDSize is the size of the GID field in bytes. This size should
- match the size of the GID field on the target OS.
+ GIDSize is the size of the GID field in bytes. This size
+ should match the size of the GID field on the target OS.
- GID is the GID for this entry in standard little endian format.
+ GID is the GID for this entry in standard little endian
+ format.
- If both the old 16-bit Unix extra field (tag 0x7855, Info-ZIP Unix2)
- and this extra field are present, the values in this extra field
- supercede the values in that extra field.
+ If both the old 16-bit Unix extra block (Info-ZIP "Unix2",
+ 0x7855. "Ux"), and this extra block are present, the values in
+ this extra block supercede the values in that extra block.
- -ASi UNIX Extra Field:
- ====================
+ -ASi UNIX:
+ ========
- The following is the layout of the ASi extra block for Unix. The
- local-header and central-header versions are identical.
+ The following is the layout of the ASi extra block for Unix.
+ The local-header and central-header versions are identical.
(Last Revision 19960916)
Value Size Description
GID Short group ID
(var.) variable symbolic link filename
- Mode is the standard Unix st_mode field from struct stat, containing
- user/group/other permissions, setuid/setgid and symlink info, etc.
+ Mode is the standard Unix st_mode field from struct stat,
+ containing user/group/other permissions, setuid/setgid and
+ symlink info, etc.
- If Mode indicates that this file is a symbolic link, SizDev is the
- size of the file to which the link points. Otherwise, if the file
- is a device, SizDev contains the standard Unix st_rdev field from
- struct stat (includes the major and minor numbers of the device).
- SizDev is undefined in other cases.
+ If Mode indicates that this file is a symbolic link, SizDev is
+ the size of the file to which the link points. Otherwise, if
+ the file is a device, SizDev contains the standard Unix
+ st_rdev field from struct stat (includes the major and minor
+ 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. The file-
- name length can be inferred from TSize.
+ 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.
+ The filename length can be inferred from TSize.
- [Note that TSize may incorrectly refer to the data size not counting
- the CRC; i.e., it may be four bytes too small.]
+ [Note that TSize may incorrectly refer to the data size not
+ counting the CRC; i.e., it may be four bytes too small.]
- -BeOS Extra Field:
- ================
+ -BeOS:
+ ====
- The following is the layout of the file-attributes extra block for
- BeOS. (Last Revision 19970531)
+ The following is the layout of the file-attributes extra block
+ for BeOS. (Last Revision 19970531)
Local-header version:
BSize Long size of uncompr. local EF block data
Flags Byte info bits
- The least significant bit of Flags in both headers indicates whether
- the LOCAL extra field is uncompressed (and therefore whether CType
- and CRC are omitted):
+ The least significant bit of Flags in both headers indicates
+ whether the LOCAL extra field is uncompressed (and therefore
+ whether CType and CRC are omitted):
bit 0 if set, Attribs is uncompressed (no CType, CRC)
bits 1-7 reserved; if set, assume error or unknown data
- Currently the only supported compression types are deflated (type 8)
- and stored (type 0); the latter is not used by Info-ZIP's Zip but is
- supported by UnZip.
+ Currently the only supported compression types are deflated
+ (type 8) and stored (type 0); the latter is not used by
+ Info-ZIP's Zip but is supported by UnZip.
- Attribs is a BeOS-specific block of data in big-endian format with
- the following structure (if compressed, uncompress it first):
+ Attribs is a BeOS-specific block of data in big-endian format
+ with the following structure (if compressed, uncompress it
+ first):
Value Size Description
----- ---- -----------
Size Long Long data size for this sub-block (64 bits)
Data variable attribute data
- The attribute structure is repeated for every attribute. The Data
- field may contain anything--text, flags, bitmaps, etc.
+ The attribute structure is repeated for every attribute. The
+ Data field may contain anything--text, flags, bitmaps, etc.
- -AtheOS Extra Field:
- ==================
+ -AtheOS:
+ ======
- The following is the layout of the file-attributes extra block for
- AtheOS. This field is a very close spin-off from the BeOS e.f.
- The only differences are:
+ The following is the layout of the file-attributes extra block
+ for AtheOS. This block is a very close spin-off from the BeOS
+ extra block. The only differences are:
- a new extra field signature
- - numeric field in the attributes data are stored in little-endian
- format ("i386" was initial hardware for AtheOS)
+ - numeric field in the attributes data are stored in
+ little-endian format ("i386" was initial hardware for AtheOS)
(Last Revision 20040908)
Local-header version:
BSize Long size of uncompr. local EF block data
Flags Byte info bits
- The least significant bit of Flags in both headers indicates whether
- the LOCAL extra field is uncompressed (and therefore whether CType
- and CRC are omitted):
+ The least significant bit of Flags in both headers indicates
+ whether the LOCAL extra field is uncompressed (and therefore
+ whether CType and CRC are omitted):
bit 0 if set, Attribs is uncompressed (no CType, CRC)
bits 1-7 reserved; if set, assume error or unknown data
- Currently the only supported compression types are deflated (type 8)
- and stored (type 0); the latter is not used by Info-ZIP's Zip but is
- supported by UnZip.
+ Currently the only supported compression types are deflated
+ (type 8) and stored (type 0); the latter is not used by
+ Info-ZIP's Zip but is supported by UnZip.
- Attribs is a AtheOS-specific block of data in little-endian format
- with the following structure (if compressed, uncompress it first):
+ Attribs is a AtheOS-specific block of data in little-endian
+ format with the following structure (if compressed, uncompress
+ it first):
Value Size Description
----- ---- -----------
Size Long Long data size for this sub-block (64 bits)
Data variable attribute data
- The attribute structure is repeated for every attribute. The Data
- field may contain anything--text, flags, bitmaps, etc.
+ The attribute structure is repeated for every attribute. The
+ Data field may contain anything--text, flags, bitmaps, etc.
- -SMS/QDOS Extra Field:
- ====================
+ -SMS/QDOS:
+ ========
- The following is the layout of the file-attributes extra block for
- SMS/QDOS. The local-header and central-header versions are identical.
- (Last Revision 19960929)
+ The following is the layout of the file-attributes extra block
+ for SMS/QDOS. The local-header and central-header versions
+ are identical. (Last Revision 19960929)
Value Size Description
----- ---- -----------
(ExtraID) Long additional signature/flag bytes
QDirect 64 bytes qdirect structure
- LongID may be "QZHD" or "QDOS". In the latter case, ExtraID will
- be present. Its first three bytes are "02\0"; the last byte is
- currently undefined.
+ LongID may be "QZHD" or "QDOS". In the latter case, ExtraID
+ will be present. Its first three bytes are "02\0"; the last
+ byte is currently undefined.
- QDirect contains the file's uncompressed directory info (qdirect
- struct). Its elements are in native (big-endian) format:
+ QDirect contains the file's uncompressed directory info
+ (qdirect struct). Its elements are in native (big-endian)
+ format:
d_length beLong file length
d_access byte file access type
d_backup beLong time of last backup (archive date)
- -AOS/VS Extra Field:
- ==================
+ -AOS/VS:
+ ======
- The following is the layout of the extra block for Data General
- AOS/VS. The local-header and central-header versions are identical.
- (Last Revision 19961125)
+ The following is the layout of the extra block for Data
+ General AOS/VS. The local-header and central-header versions
+ are identical. (Last Revision 19961125)
Value Size Description
----- ---- -----------
Fstat variable fstat packet
AclBuf variable raw ACL data ($MXACL bytes)
- Fstat contains the file's uncompressed fstat packet, which is one of
- the following:
+ Fstat contains the file's uncompressed fstat packet, which is
+ one of the following:
normal fstat packet (P_FSTAT struct)
DIR/CPD fstat packet (P_FSTAT_DIR struct)
AclBuf contains the raw ACL data; its length is $MXACL.
- -Tandem NSK Extra Field:
- ======================
+ -Tandem NSK:
+ ==========
- The following is the layout of the file-attributes extra block for
- Tandem NSK. The local-header and central-header versions are
- identical. (Last Revision 19981221)
+ The following is the layout of the file-attributes extra block
+ for Tandem NSK. The local-header and central-header versions
+ are identical. (Last Revision 19981221)
Value Size Description
----- ---- -----------
NSKattrs 20 Bytes NSK attributes
- -THEOS Extra Field:
- =================
+ -THEOS:
+ =====
- The following is the layout of the file-attributes extra block for
- Theos. The local-header and central-header versions are identical.
- (Last Revision 19990206)
+ The following is the layout of the file-attributes extra block
+ for Theos. The local-header and central-header versions are
+ identical. (Last Revision 19990206)
Value Size Description
----- ---- -----------
0x80 not hidden
- -THEOS old inofficial Extra Field:
- ================================
+ -THEOS old unofficial:
+ ====================
- The following is the layout of an inoffical former version of a
- Theos file-attributes extra blocks. This layout was never published
- and is no longer created. However, UnZip can optionally support it
- when compiling with the option flag OLD_THEOS_EXTRA defined.
- Both the local-header and central-header versions are identical.
- (Last Revision 19990206)
+ The following is the layout of an unoffical former version of
+ a Theos file-attributes extra blocks. This layout was never
+ published and is no longer created. However, UnZip can
+ optionally support it when compiling with the option flag
+ OLD_THEOS_EXTRA defined. The local-header and central-header
+ versions are identical. (Last Revision 19990206)
Value Size Description
----- ---- -----------
reserved 3 Bytes reserved for future use
- -FWKCS MD5 Extra Field (0x4b46):
- ==============================
+ -FWKCS MD5 (0x4b46, "FK"):
+ ========================
The FWKCS Contents_Signature System, used in automatically
- 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. (Last Revision 19961207)
+ 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.
+ (Last Revision 19961207)
Central-header version:
MD5hash 16 bytes 128-bit MD5 hash of uncompressed data
(low byte first)
- When FWKCS revises a .ZIP file central directory to add
- this extra field for a file, it also replaces the
- central directory entry for that file's uncompressed
- file length with a measured value.
+ When FWKCS revises a .ZIP file central directory to add this
+ extra block for a file, it also replaces the central directory
+ entry for that file's uncompressed file length with a measured
+ value.
- FWKCS provides an option to strip this extra field, if
- present, from a .ZIP file central directory. In adding
- this extra field, FWKCS preserves .ZIP file Authenticity
- Verification; if stripping this extra field, FWKCS
- preserves all versions of AV through PKZIP version 2.04g.
+ FWKCS provides an option to strip this extra block, if
+ present, from a .ZIP file central directory. In adding this
+ extra block, FWKCS preserves .ZIP file Authenticity
+ Verification; if stripping this extra block, FWKCS preserves
+ all versions of AV through PKZIP version 2.04g.
- FWKCS, and FWKCS Contents_Signature System, are
- trademarks of Frederick W. Kantor.
+ FWKCS, and FWKCS Contents_Signature System, are trademarks of
+ Frederick W. Kantor.
(1) R. Rivest, RFC1321.TXT, MIT Laboratory for Computer
Science and RSA Data Security, Inc., April 1992.
/*
- Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
int main(void)
{
int con;
- int r,n;
+ int r = 0 /* ,n 2014-03-13 SMS. Uninitialized (r), unused (n). */;
__QA(PATH_MAX) tmpdir;
__QA(PATH_MAX) outdir;
char basfil[PATH_MAX];
/*
- Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
* created by Jonathan Hudson, 04/09/95
*/
+/* 2013-03-13 SMS.
+ * No error checking/handling on malloc(), realloc().
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int fs_headr (int fd, long t, struct qdirect *qs, short size)
{
NTC ntc;
- int r = -1;
+ int r /* = -1 2014-03-13 SMS. Unused. */;
struct stat s;
fstat(fd, &s);
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
if (*pathcomp == '\0') {
#endif /* !SFX */
#endif /* !FUNZIP */
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
char *getp(__G__ m, p, n)
__GDEF
} /* end function getp() */
-#endif /* CRYPT */
+#endif /* def IZ_CRYPT_ANY */
--- /dev/null
+/* CpuArch.h -- CPU specific code
+2010-10-26: Igor Pavlov : Public domain */
+
+#ifndef __CPU_ARCH_H
+#define __CPU_ARCH_H
+
+#include "Types.h"
+
+EXTERN_C_BEGIN
+
+/*
+MY_CPU_LE means that CPU is LITTLE ENDIAN.
+If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN).
+
+MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses.
+If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform.
+*/
+
+#if defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__)
+#define MY_CPU_AMD64
+#endif
+
+#if defined(MY_CPU_AMD64) || defined(_M_IA64)
+#define MY_CPU_64BIT
+#endif
+
+#if defined(_M_IX86) || defined(__i386__)
+#define MY_CPU_X86
+#endif
+
+#if defined(MY_CPU_X86) || defined(MY_CPU_AMD64)
+#define MY_CPU_X86_OR_AMD64
+#endif
+
+#if defined(MY_CPU_X86) || defined(_M_ARM)
+#define MY_CPU_32BIT
+#endif
+
+#if defined(_WIN32) && defined(_M_ARM)
+#define MY_CPU_ARM_LE
+#endif
+
+#if defined(_WIN32) && defined(_M_IA64)
+#define MY_CPU_IA64_LE
+#endif
+
+#if defined(MY_CPU_X86_OR_AMD64)
+#define MY_CPU_LE_UNALIGN
+#endif
+
+#if defined(MY_CPU_X86_OR_AMD64) || defined(MY_CPU_ARM_LE) || defined(MY_CPU_IA64_LE) || defined(__ARMEL__) || defined(__MIPSEL__) || defined(__LITTLE_ENDIAN__)
+#define MY_CPU_LE
+#endif
+
+#if defined(__BIG_ENDIAN__)
+#define MY_CPU_BE
+#endif
+
+#if defined(MY_CPU_LE) && defined(MY_CPU_BE)
+Stop_Compiling_Bad_Endian
+#endif
+
+#ifdef MY_CPU_LE_UNALIGN
+
+#define GetUi16(p) (*(const UInt16 *)(p))
+#define GetUi32(p) (*(const UInt32 *)(p))
+#define GetUi64(p) (*(const UInt64 *)(p))
+#define SetUi16(p, d) *(UInt16 *)(p) = (d);
+#define SetUi32(p, d) *(UInt32 *)(p) = (d);
+#define SetUi64(p, d) *(UInt64 *)(p) = (d);
+
+#else
+
+#define GetUi16(p) (((const Byte *)(p))[0] | ((UInt16)((const Byte *)(p))[1] << 8))
+
+#define GetUi32(p) ( \
+ ((const Byte *)(p))[0] | \
+ ((UInt32)((const Byte *)(p))[1] << 8) | \
+ ((UInt32)((const Byte *)(p))[2] << 16) | \
+ ((UInt32)((const Byte *)(p))[3] << 24))
+
+#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
+
+#define SetUi16(p, d) { UInt32 _x_ = (d); \
+ ((Byte *)(p))[0] = (Byte)_x_; \
+ ((Byte *)(p))[1] = (Byte)(_x_ >> 8); }
+
+#define SetUi32(p, d) { UInt32 _x_ = (d); \
+ ((Byte *)(p))[0] = (Byte)_x_; \
+ ((Byte *)(p))[1] = (Byte)(_x_ >> 8); \
+ ((Byte *)(p))[2] = (Byte)(_x_ >> 16); \
+ ((Byte *)(p))[3] = (Byte)(_x_ >> 24); }
+
+#define SetUi64(p, d) { UInt64 _x64_ = (d); \
+ SetUi32(p, (UInt32)_x64_); \
+ SetUi32(((Byte *)(p)) + 4, (UInt32)(_x64_ >> 32)); }
+
+#endif
+
+#if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300)
+
+#pragma intrinsic(_byteswap_ulong)
+#pragma intrinsic(_byteswap_uint64)
+#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p))
+#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p))
+
+#else
+
+#define GetBe32(p) ( \
+ ((UInt32)((const Byte *)(p))[0] << 24) | \
+ ((UInt32)((const Byte *)(p))[1] << 16) | \
+ ((UInt32)((const Byte *)(p))[2] << 8) | \
+ ((const Byte *)(p))[3] )
+
+#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
+
+#endif
+
+#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1])
+
+
+#ifdef MY_CPU_X86_OR_AMD64
+
+typedef struct
+{
+ UInt32 maxFunc;
+ UInt32 vendor[3];
+ UInt32 ver;
+ UInt32 b;
+ UInt32 c;
+ UInt32 d;
+} Cx86cpuid;
+
+enum
+{
+ CPU_FIRM_INTEL,
+ CPU_FIRM_AMD,
+ CPU_FIRM_VIA
+};
+
+Bool x86cpuid_CheckAndRead(Cx86cpuid *p);
+int x86cpuid_GetFirm(const Cx86cpuid *p);
+
+#define x86cpuid_GetFamily(p) (((p)->ver >> 8) & 0xFF00F)
+#define x86cpuid_GetModel(p) (((p)->ver >> 4) & 0xF00F)
+#define x86cpuid_GetStepping(p) ((p)->ver & 0xF)
+
+Bool CPU_Is_InOrder();
+Bool CPU_Is_Aes_Supported();
+
+#endif
+
+EXTERN_C_END
+
+#endif
--- /dev/null
+/* LzFind.c -- Match finder for LZ algorithms
+2009-04-22 : Igor Pavlov : Public domain */
+
+#include <string.h>
+
+#include "LzFind.h"
+#include "LzHash.h"
+
+#define kEmptyHashValue 0
+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
+#define kNormalizeMask (~(kNormalizeStepMin - 1))
+#define kMaxHistorySize ((UInt32)3 << 30)
+
+#define kStartMaxLen 3
+
+static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
+{
+ if (!p->directInput)
+ {
+ alloc->Free(alloc, p->bufferBase);
+ p->bufferBase = 0;
+ }
+}
+
+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
+
+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
+{
+ UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
+ if (p->directInput)
+ {
+ p->blockSize = blockSize;
+ return 1;
+ }
+ if (p->bufferBase == 0 || p->blockSize != blockSize)
+ {
+ LzInWindow_Free(p, alloc);
+ p->blockSize = blockSize;
+ p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize);
+ }
+ return (p->bufferBase != 0);
+}
+
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
+
+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
+
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
+{
+ p->posLimit -= subValue;
+ p->pos -= subValue;
+ p->streamPos -= subValue;
+}
+
+static void MatchFinder_ReadBlock(CMatchFinder *p)
+{
+ if (p->streamEndWasReached || p->result != SZ_OK)
+ return;
+ if (p->directInput)
+ {
+ UInt32 curSize = 0xFFFFFFFF - p->streamPos;
+ if (curSize > p->directInputRem)
+ curSize = (UInt32)p->directInputRem;
+ p->directInputRem -= curSize;
+ p->streamPos += curSize;
+ if (p->directInputRem == 0)
+ p->streamEndWasReached = 1;
+ return;
+ }
+ for (;;)
+ {
+ Byte *dest = p->buffer + (p->streamPos - p->pos);
+ size_t size = (p->bufferBase + p->blockSize - dest);
+ if (size == 0)
+ return;
+ p->result = p->stream->Read(p->stream, dest, &size);
+ if (p->result != SZ_OK)
+ return;
+ if (size == 0)
+ {
+ p->streamEndWasReached = 1;
+ return;
+ }
+ p->streamPos += (UInt32)size;
+ if (p->streamPos - p->pos > p->keepSizeAfter)
+ return;
+ }
+}
+
+void MatchFinder_MoveBlock(CMatchFinder *p)
+{
+ memmove(p->bufferBase,
+ p->buffer - p->keepSizeBefore,
+ (size_t)(p->streamPos - p->pos + p->keepSizeBefore));
+ p->buffer = p->bufferBase + p->keepSizeBefore;
+}
+
+int MatchFinder_NeedMove(CMatchFinder *p)
+{
+ if (p->directInput)
+ return 0;
+ /* if (p->streamEndWasReached) return 0; */
+ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
+}
+
+void MatchFinder_ReadIfRequired(CMatchFinder *p)
+{
+ if (p->streamEndWasReached)
+ return;
+ if (p->keepSizeAfter >= p->streamPos - p->pos)
+ MatchFinder_ReadBlock(p);
+}
+
+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
+{
+ if (MatchFinder_NeedMove(p))
+ MatchFinder_MoveBlock(p);
+ MatchFinder_ReadBlock(p);
+}
+
+static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
+{
+ p->cutValue = 32;
+ p->btMode = 1;
+ p->numHashBytes = 4;
+ p->bigHash = 0;
+}
+
+#define kCrcPoly 0xEDB88320
+
+void MatchFinder_Construct(CMatchFinder *p)
+{
+ UInt32 i;
+ p->bufferBase = 0;
+ p->directInput = 0;
+ p->hash = 0;
+ MatchFinder_SetDefaultSettings(p);
+
+ for (i = 0; i < 256; i++)
+ {
+ UInt32 r = i;
+ int j;
+ for (j = 0; j < 8; j++)
+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
+ p->crc[i] = r;
+ }
+}
+
+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
+{
+ alloc->Free(alloc, p->hash);
+ p->hash = 0;
+}
+
+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
+{
+ MatchFinder_FreeThisClassMemory(p, alloc);
+ LzInWindow_Free(p, alloc);
+}
+
+static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc)
+{
+ size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
+ if (sizeInBytes / sizeof(CLzRef) != num)
+ return 0;
+ return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
+}
+
+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+ ISzAlloc *alloc)
+{
+ UInt32 sizeReserv;
+ if (historySize > kMaxHistorySize)
+ {
+ MatchFinder_Free(p, alloc);
+ return 0;
+ }
+ sizeReserv = historySize >> 1;
+ if (historySize > ((UInt32)2 << 30))
+ sizeReserv = historySize >> 2;
+ sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
+
+ p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
+ p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
+ /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
+ if (LzInWindow_Create(p, sizeReserv, alloc))
+ {
+ UInt32 newCyclicBufferSize = historySize + 1;
+ UInt32 hs;
+ p->matchMaxLen = matchMaxLen;
+ {
+ p->fixedHashSize = 0;
+ if (p->numHashBytes == 2)
+ hs = (1 << 16) - 1;
+ else
+ {
+ hs = historySize - 1;
+ hs |= (hs >> 1);
+ hs |= (hs >> 2);
+ hs |= (hs >> 4);
+ hs |= (hs >> 8);
+ hs >>= 1;
+ hs |= 0xFFFF; /* don't change it! It's required for Deflate */
+ if (hs > (1 << 24))
+ {
+ if (p->numHashBytes == 3)
+ hs = (1 << 24) - 1;
+ else
+ hs >>= 1;
+ }
+ }
+ p->hashMask = hs;
+ hs++;
+ if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
+ if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
+ if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
+ hs += p->fixedHashSize;
+ }
+
+ {
+ UInt32 prevSize = p->hashSizeSum + p->numSons;
+ UInt32 newSize;
+ p->historySize = historySize;
+ p->hashSizeSum = hs;
+ p->cyclicBufferSize = newCyclicBufferSize;
+ p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize);
+ newSize = p->hashSizeSum + p->numSons;
+ if (p->hash != 0 && prevSize == newSize)
+ return 1;
+ MatchFinder_FreeThisClassMemory(p, alloc);
+ p->hash = AllocRefs(newSize, alloc);
+ if (p->hash != 0)
+ {
+ p->son = p->hash + p->hashSizeSum;
+ return 1;
+ }
+ }
+ }
+ MatchFinder_Free(p, alloc);
+ return 0;
+}
+
+static void MatchFinder_SetLimits(CMatchFinder *p)
+{
+ UInt32 limit = kMaxValForNormalize - p->pos;
+ UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
+ if (limit2 < limit)
+ limit = limit2;
+ limit2 = p->streamPos - p->pos;
+ if (limit2 <= p->keepSizeAfter)
+ {
+ if (limit2 > 0)
+ limit2 = 1;
+ }
+ else
+ limit2 -= p->keepSizeAfter;
+ if (limit2 < limit)
+ limit = limit2;
+ {
+ UInt32 lenLimit = p->streamPos - p->pos;
+ if (lenLimit > p->matchMaxLen)
+ lenLimit = p->matchMaxLen;
+ p->lenLimit = lenLimit;
+ }
+ p->posLimit = p->pos + limit;
+}
+
+void MatchFinder_Init(CMatchFinder *p)
+{
+ UInt32 i;
+ for (i = 0; i < p->hashSizeSum; i++)
+ p->hash[i] = kEmptyHashValue;
+ p->cyclicBufferPos = 0;
+ p->buffer = p->bufferBase;
+ p->pos = p->streamPos = p->cyclicBufferSize;
+ p->result = SZ_OK;
+ p->streamEndWasReached = 0;
+ MatchFinder_ReadBlock(p);
+ MatchFinder_SetLimits(p);
+}
+
+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p)
+{
+ return (p->pos - p->historySize - 1) & kNormalizeMask;
+}
+
+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
+{
+ UInt32 i;
+ for (i = 0; i < numItems; i++)
+ {
+ UInt32 value = items[i];
+ if (value <= subValue)
+ value = kEmptyHashValue;
+ else
+ value -= subValue;
+ items[i] = value;
+ }
+}
+
+static void MatchFinder_Normalize(CMatchFinder *p)
+{
+ UInt32 subValue = MatchFinder_GetSubValue(p);
+ MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons);
+ MatchFinder_ReduceOffsets(p, subValue);
+}
+
+static void MatchFinder_CheckLimits(CMatchFinder *p)
+{
+ if (p->pos == kMaxValForNormalize)
+ MatchFinder_Normalize(p);
+ if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
+ MatchFinder_CheckAndMoveAndRead(p);
+ if (p->cyclicBufferPos == p->cyclicBufferSize)
+ p->cyclicBufferPos = 0;
+ MatchFinder_SetLimits(p);
+}
+
+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
+ UInt32 *distances, UInt32 maxLen)
+{
+ son[_cyclicBufferPos] = curMatch;
+ for (;;)
+ {
+ UInt32 delta = pos - curMatch;
+ if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+ return distances;
+ {
+ const Byte *pb = cur - delta;
+ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
+ if (pb[maxLen] == cur[maxLen] && *pb == *cur)
+ {
+ UInt32 len = 0;
+ while (++len != lenLimit)
+ if (pb[len] != cur[len])
+ break;
+ if (maxLen < len)
+ {
+ *distances++ = maxLen = len;
+ *distances++ = delta - 1;
+ if (len == lenLimit)
+ return distances;
+ }
+ }
+ }
+ }
+}
+
+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
+ UInt32 *distances, UInt32 maxLen)
+{
+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
+ UInt32 len0 = 0, len1 = 0;
+ for (;;)
+ {
+ UInt32 delta = pos - curMatch;
+ if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+ {
+ *ptr0 = *ptr1 = kEmptyHashValue;
+ return distances;
+ }
+ {
+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
+ const Byte *pb = cur - delta;
+ UInt32 len = (len0 < len1 ? len0 : len1);
+ if (pb[len] == cur[len])
+ {
+ if (++len != lenLimit && pb[len] == cur[len])
+ while (++len != lenLimit)
+ if (pb[len] != cur[len])
+ break;
+ if (maxLen < len)
+ {
+ *distances++ = maxLen = len;
+ *distances++ = delta - 1;
+ if (len == lenLimit)
+ {
+ *ptr1 = pair[0];
+ *ptr0 = pair[1];
+ return distances;
+ }
+ }
+ }
+ if (pb[len] < cur[len])
+ {
+ *ptr1 = curMatch;
+ ptr1 = pair + 1;
+ curMatch = *ptr1;
+ len1 = len;
+ }
+ else
+ {
+ *ptr0 = curMatch;
+ ptr0 = pair;
+ curMatch = *ptr0;
+ len0 = len;
+ }
+ }
+ }
+}
+
+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
+{
+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
+ UInt32 len0 = 0, len1 = 0;
+ for (;;)
+ {
+ UInt32 delta = pos - curMatch;
+ if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+ {
+ *ptr0 = *ptr1 = kEmptyHashValue;
+ return;
+ }
+ {
+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
+ const Byte *pb = cur - delta;
+ UInt32 len = (len0 < len1 ? len0 : len1);
+ if (pb[len] == cur[len])
+ {
+ while (++len != lenLimit)
+ if (pb[len] != cur[len])
+ break;
+ {
+ if (len == lenLimit)
+ {
+ *ptr1 = pair[0];
+ *ptr0 = pair[1];
+ return;
+ }
+ }
+ }
+ if (pb[len] < cur[len])
+ {
+ *ptr1 = curMatch;
+ ptr1 = pair + 1;
+ curMatch = *ptr1;
+ len1 = len;
+ }
+ else
+ {
+ *ptr0 = curMatch;
+ ptr0 = pair;
+ curMatch = *ptr0;
+ len0 = len;
+ }
+ }
+ }
+}
+
+#define MOVE_POS \
+ ++p->cyclicBufferPos; \
+ p->buffer++; \
+ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
+
+#define MOVE_POS_RET MOVE_POS return offset;
+
+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
+
+#define GET_MATCHES_HEADER2(minLen, ret_op) \
+ UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
+ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
+ cur = p->buffer;
+
+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
+#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue)
+
+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
+
+#define GET_MATCHES_FOOTER(offset, maxLen) \
+ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
+ distances + offset, maxLen) - distances); MOVE_POS_RET;
+
+#define SKIP_FOOTER \
+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
+
+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 offset;
+ GET_MATCHES_HEADER(2)
+ HASH2_CALC;
+ curMatch = p->hash[hashValue];
+ p->hash[hashValue] = p->pos;
+ offset = 0;
+ GET_MATCHES_FOOTER(offset, 1)
+}
+
+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 offset;
+ GET_MATCHES_HEADER(3)
+ HASH_ZIP_CALC;
+ curMatch = p->hash[hashValue];
+ p->hash[hashValue] = p->pos;
+ offset = 0;
+ GET_MATCHES_FOOTER(offset, 2)
+}
+
+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 hash2Value, delta2, maxLen, offset;
+ GET_MATCHES_HEADER(3)
+
+ HASH3_CALC;
+
+ delta2 = p->pos - p->hash[hash2Value];
+ curMatch = p->hash[kFix3HashSize + hashValue];
+
+ p->hash[hash2Value] =
+ p->hash[kFix3HashSize + hashValue] = p->pos;
+
+
+ maxLen = 2;
+ offset = 0;
+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
+ {
+ for (; maxLen != lenLimit; maxLen++)
+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
+ break;
+ distances[0] = maxLen;
+ distances[1] = delta2 - 1;
+ offset = 2;
+ if (maxLen == lenLimit)
+ {
+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
+ MOVE_POS_RET;
+ }
+ }
+ GET_MATCHES_FOOTER(offset, maxLen)
+}
+
+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
+ GET_MATCHES_HEADER(4)
+
+ HASH4_CALC;
+
+ delta2 = p->pos - p->hash[ hash2Value];
+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
+ curMatch = p->hash[kFix4HashSize + hashValue];
+
+ p->hash[ hash2Value] =
+ p->hash[kFix3HashSize + hash3Value] =
+ p->hash[kFix4HashSize + hashValue] = p->pos;
+
+ maxLen = 1;
+ offset = 0;
+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
+ {
+ distances[0] = maxLen = 2;
+ distances[1] = delta2 - 1;
+ offset = 2;
+ }
+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
+ {
+ maxLen = 3;
+ distances[offset + 1] = delta3 - 1;
+ offset += 2;
+ delta2 = delta3;
+ }
+ if (offset != 0)
+ {
+ for (; maxLen != lenLimit; maxLen++)
+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
+ break;
+ distances[offset - 2] = maxLen;
+ if (maxLen == lenLimit)
+ {
+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
+ MOVE_POS_RET;
+ }
+ }
+ if (maxLen < 3)
+ maxLen = 3;
+ GET_MATCHES_FOOTER(offset, maxLen)
+}
+
+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
+ GET_MATCHES_HEADER(4)
+
+ HASH4_CALC;
+
+ delta2 = p->pos - p->hash[ hash2Value];
+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
+ curMatch = p->hash[kFix4HashSize + hashValue];
+
+ p->hash[ hash2Value] =
+ p->hash[kFix3HashSize + hash3Value] =
+ p->hash[kFix4HashSize + hashValue] = p->pos;
+
+ maxLen = 1;
+ offset = 0;
+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
+ {
+ distances[0] = maxLen = 2;
+ distances[1] = delta2 - 1;
+ offset = 2;
+ }
+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
+ {
+ maxLen = 3;
+ distances[offset + 1] = delta3 - 1;
+ offset += 2;
+ delta2 = delta3;
+ }
+ if (offset != 0)
+ {
+ for (; maxLen != lenLimit; maxLen++)
+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
+ break;
+ distances[offset - 2] = maxLen;
+ if (maxLen == lenLimit)
+ {
+ p->son[p->cyclicBufferPos] = curMatch;
+ MOVE_POS_RET;
+ }
+ }
+ if (maxLen < 3)
+ maxLen = 3;
+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
+ distances + offset, maxLen) - (distances));
+ MOVE_POS_RET
+}
+
+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 offset;
+ GET_MATCHES_HEADER(3)
+ HASH_ZIP_CALC;
+ curMatch = p->hash[hashValue];
+ p->hash[hashValue] = p->pos;
+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
+ distances, 2) - (distances));
+ MOVE_POS_RET
+}
+
+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ SKIP_HEADER(2)
+ HASH2_CALC;
+ curMatch = p->hash[hashValue];
+ p->hash[hashValue] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+
+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ SKIP_HEADER(3)
+ HASH_ZIP_CALC;
+ curMatch = p->hash[hashValue];
+ p->hash[hashValue] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+
+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ UInt32 hash2Value;
+ SKIP_HEADER(3)
+ HASH3_CALC;
+ curMatch = p->hash[kFix3HashSize + hashValue];
+ p->hash[hash2Value] =
+ p->hash[kFix3HashSize + hashValue] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+
+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ UInt32 hash2Value, hash3Value;
+ SKIP_HEADER(4)
+ HASH4_CALC;
+ curMatch = p->hash[kFix4HashSize + hashValue];
+ p->hash[ hash2Value] =
+ p->hash[kFix3HashSize + hash3Value] = p->pos;
+ p->hash[kFix4HashSize + hashValue] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+
+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ UInt32 hash2Value, hash3Value;
+ SKIP_HEADER(4)
+ HASH4_CALC;
+ curMatch = p->hash[kFix4HashSize + hashValue];
+ p->hash[ hash2Value] =
+ p->hash[kFix3HashSize + hash3Value] =
+ p->hash[kFix4HashSize + hashValue] = p->pos;
+ p->son[p->cyclicBufferPos] = curMatch;
+ MOVE_POS
+ }
+ while (--num != 0);
+}
+
+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ SKIP_HEADER(3)
+ HASH_ZIP_CALC;
+ curMatch = p->hash[hashValue];
+ p->hash[hashValue] = p->pos;
+ p->son[p->cyclicBufferPos] = curMatch;
+ MOVE_POS
+ }
+ while (--num != 0);
+}
+
+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
+{
+ vTable->Init = (Mf_Init_Func)MatchFinder_Init;
+ vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
+ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
+ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
+ if (!p->btMode)
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
+ }
+ else if (p->numHashBytes == 2)
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
+ }
+ else if (p->numHashBytes == 3)
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
+ }
+ else
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
+ }
+}
--- /dev/null
+/* LzFind.h -- Match finder for LZ algorithms
+2009-04-22 : Igor Pavlov : Public domain */
+
+#ifndef __LZ_FIND_H
+#define __LZ_FIND_H
+
+#include "Types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* ================================================================== */
+
+/* 2011-07-30 SMS for Info-ZIP.
+ * Shorten names longer than 31 characters on VMS.
+ */
+#ifdef VMS
+# define MatchFinder_GetNumAvailableBytes MatchFinder_GetNumAvailBytes
+# define MatchFinder_GetPointerToCurrentPos MatchFinder_GetPtrToCurrentPos
+#endif /* def VMS */
+
+/* ================================================================== */
+
+
+typedef UInt32 CLzRef;
+
+typedef struct _CMatchFinder
+{
+ Byte *buffer;
+ UInt32 pos;
+ UInt32 posLimit;
+ UInt32 streamPos;
+ UInt32 lenLimit;
+
+ UInt32 cyclicBufferPos;
+ UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
+
+ UInt32 matchMaxLen;
+ CLzRef *hash;
+ CLzRef *son;
+ UInt32 hashMask;
+ UInt32 cutValue;
+
+ Byte *bufferBase;
+ ISeqInStream *stream;
+ int streamEndWasReached;
+
+ UInt32 blockSize;
+ UInt32 keepSizeBefore;
+ UInt32 keepSizeAfter;
+
+ UInt32 numHashBytes;
+ int directInput;
+ size_t directInputRem;
+ int btMode;
+ int bigHash;
+ UInt32 historySize;
+ UInt32 fixedHashSize;
+ UInt32 hashSizeSum;
+ UInt32 numSons;
+ SRes result;
+ UInt32 crc[256];
+} CMatchFinder;
+
+#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
+#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
+
+#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
+
+int MatchFinder_NeedMove(CMatchFinder *p);
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
+void MatchFinder_MoveBlock(CMatchFinder *p);
+void MatchFinder_ReadIfRequired(CMatchFinder *p);
+
+void MatchFinder_Construct(CMatchFinder *p);
+
+/* Conditions:
+ historySize <= 3 GB
+ keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
+*/
+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+ ISzAlloc *alloc);
+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
+
+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
+ UInt32 *distances, UInt32 maxLen);
+
+/*
+Conditions:
+ Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
+ Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
+*/
+
+typedef void (*Mf_Init_Func)(void *object);
+typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
+typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
+typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
+typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
+typedef void (*Mf_Skip_Func)(void *object, UInt32);
+
+typedef struct _IMatchFinder
+{
+ Mf_Init_Func Init;
+ Mf_GetIndexByte_Func GetIndexByte;
+ Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
+ Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
+ Mf_GetMatches_Func GetMatches;
+ Mf_Skip_Func Skip;
+} IMatchFinder;
+
+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
+
+void MatchFinder_Init(CMatchFinder *p);
+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/* LzHash.h -- HASH functions for LZ algorithms
+2009-02-07 : Igor Pavlov : Public domain */
+
+#ifndef __LZ_HASH_H
+#define __LZ_HASH_H
+
+#define kHash2Size (1 << 10)
+#define kHash3Size (1 << 16)
+#define kHash4Size (1 << 20)
+
+#define kFix3HashSize (kHash2Size)
+#define kFix4HashSize (kHash2Size + kHash3Size)
+#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
+
+#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
+
+#define HASH3_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ hash2Value = temp & (kHash2Size - 1); \
+ hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
+
+#define HASH4_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ hash2Value = temp & (kHash2Size - 1); \
+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
+ hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
+
+#define HASH5_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ hash2Value = temp & (kHash2Size - 1); \
+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
+ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
+ hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
+ hash4Value &= (kHash4Size - 1); }
+
+/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
+#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
+
+
+#define MT_HASH2_CALC \
+ hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
+
+#define MT_HASH3_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ hash2Value = temp & (kHash2Size - 1); \
+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
+
+#define MT_HASH4_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ hash2Value = temp & (kHash2Size - 1); \
+ hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
+ hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
+
+#endif
--- /dev/null
+/* LzmaDec.c -- LZMA Decoder
+2009-09-20 : Igor Pavlov : Public domain */
+
+#include "LzmaDec.h"
+
+#include <string.h>
+
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+
+#define RC_INIT_SIZE 5
+
+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
+
+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
+ { UPDATE_0(p); i = (i + i); A0; } else \
+ { UPDATE_1(p); i = (i + i) + 1; A1; }
+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
+
+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
+#define TREE_DECODE(probs, limit, i) \
+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
+
+/* #define _LZMA_SIZE_OPT */
+
+#ifdef _LZMA_SIZE_OPT
+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
+#else
+#define TREE_6_DECODE(probs, i) \
+ { i = 1; \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ i -= 0x40; }
+#endif
+
+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
+
+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
+#define UPDATE_0_CHECK range = bound;
+#define UPDATE_1_CHECK range -= bound; code -= bound;
+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
+ { UPDATE_0_CHECK; i = (i + i); A0; } else \
+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
+#define TREE_DECODE_CHECK(probs, limit, i) \
+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
+
+
+#define kNumPosBitsMax 4
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumMidBits 3
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+
+#define LenChoice 0
+#define LenChoice2 (LenChoice + 1)
+#define LenLow (LenChoice2 + 1)
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
+
+
+#define kNumStates 12
+#define kNumLitStates 7
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+#define kNumPosSlotBits 6
+#define kNumLenToPosStates 4
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+
+#define kMatchMinLen 2
+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
+
+#define IsMatch 0
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
+#define IsRepG0 (IsRep + kNumStates)
+#define IsRepG1 (IsRepG0 + kNumStates)
+#define IsRepG2 (IsRepG1 + kNumStates)
+#define IsRep0Long (IsRepG2 + kNumStates)
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
+#define LenCoder (Align + kAlignTableSize)
+#define RepLenCoder (LenCoder + kNumLenProbs)
+#define Literal (RepLenCoder + kNumLenProbs)
+
+#define LZMA_BASE_SIZE 1846
+#define LZMA_LIT_SIZE 768
+
+#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
+
+#if Literal != LZMA_BASE_SIZE
+StopCompilingDueBUG
+#endif
+
+#define LZMA_DIC_MIN (1 << 12)
+
+/* First LZMA-symbol is always decoded.
+And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
+Out:
+ Result:
+ SZ_OK - OK
+ SZ_ERROR_DATA - Error
+ p->remainLen:
+ < kMatchSpecLenStart : normal remain
+ = kMatchSpecLenStart : finished
+ = kMatchSpecLenStart + 1 : Flush marker
+ = kMatchSpecLenStart + 2 : State Init Marker
+*/
+
+static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+{
+ CLzmaProb *probs = p->probs;
+
+ unsigned state = p->state;
+ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
+ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
+ unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1;
+ unsigned lc = p->prop.lc;
+
+ Byte *dic = p->dic;
+ SizeT dicBufSize = p->dicBufSize;
+ SizeT dicPos = p->dicPos;
+
+ UInt32 processedPos = p->processedPos;
+ UInt32 checkDicSize = p->checkDicSize;
+ unsigned len = 0;
+
+ const Byte *buf = p->buf;
+ UInt32 range = p->range;
+ UInt32 code = p->code;
+
+ do
+ {
+ CLzmaProb *prob;
+ UInt32 bound;
+ unsigned ttt;
+ unsigned posState = processedPos & pbMask;
+
+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
+ IF_BIT_0(prob)
+ {
+ unsigned symbol;
+ UPDATE_0(prob);
+ prob = probs + Literal;
+ if (checkDicSize != 0 || processedPos != 0)
+ prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) +
+ (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
+
+ if (state < kNumLitStates)
+ {
+ state -= (state < 4) ? state : 3;
+ symbol = 1;
+ do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
+ }
+ else
+ {
+ unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
+ unsigned offs = 0x100;
+ state -= (state < 10) ? 3 : 6;
+ symbol = 1;
+ do
+ {
+ unsigned bit;
+ CLzmaProb *probLit;
+ matchByte <<= 1;
+ bit = (matchByte & offs);
+ probLit = prob + offs + bit + symbol;
+ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
+ }
+ while (symbol < 0x100);
+ }
+ dic[dicPos++] = (Byte)symbol;
+ processedPos++;
+ continue;
+ }
+ else
+ {
+ UPDATE_1(prob);
+ prob = probs + IsRep + state;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ state += kNumStates;
+ prob = probs + LenCoder;
+ }
+ else
+ {
+ UPDATE_1(prob);
+ if (checkDicSize == 0 && processedPos == 0)
+ return SZ_ERROR_DATA;
+ prob = probs + IsRepG0 + state;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
+ dicPos++;
+ processedPos++;
+ state = state < kNumLitStates ? 9 : 11;
+ continue;
+ }
+ UPDATE_1(prob);
+ }
+ else
+ {
+ UInt32 distance;
+ UPDATE_1(prob);
+ prob = probs + IsRepG1 + state;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ distance = rep1;
+ }
+ else
+ {
+ UPDATE_1(prob);
+ prob = probs + IsRepG2 + state;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ distance = rep2;
+ }
+ else
+ {
+ UPDATE_1(prob);
+ distance = rep3;
+ rep3 = rep2;
+ }
+ rep2 = rep1;
+ }
+ rep1 = rep0;
+ rep0 = distance;
+ }
+ state = state < kNumLitStates ? 8 : 11;
+ prob = probs + RepLenCoder;
+ }
+ {
+ unsigned limit, offset;
+ CLzmaProb *probLen = prob + LenChoice;
+ IF_BIT_0(probLen)
+ {
+ UPDATE_0(probLen);
+ probLen = prob + LenLow + (posState << kLenNumLowBits);
+ offset = 0;
+ limit = (1 << kLenNumLowBits);
+ }
+ else
+ {
+ UPDATE_1(probLen);
+ probLen = prob + LenChoice2;
+ IF_BIT_0(probLen)
+ {
+ UPDATE_0(probLen);
+ probLen = prob + LenMid + (posState << kLenNumMidBits);
+ offset = kLenNumLowSymbols;
+ limit = (1 << kLenNumMidBits);
+ }
+ else
+ {
+ UPDATE_1(probLen);
+ probLen = prob + LenHigh;
+ offset = kLenNumLowSymbols + kLenNumMidSymbols;
+ limit = (1 << kLenNumHighBits);
+ }
+ }
+ TREE_DECODE(probLen, limit, len);
+ len += offset;
+ }
+
+ if (state >= kNumStates)
+ {
+ UInt32 distance;
+ prob = probs + PosSlot +
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
+ TREE_6_DECODE(prob, distance);
+ if (distance >= kStartPosModelIndex)
+ {
+ unsigned posSlot = (unsigned)distance;
+ int numDirectBits = (int)(((distance >> 1) - 1));
+ distance = (2 | (distance & 1));
+ if (posSlot < kEndPosModelIndex)
+ {
+ distance <<= numDirectBits;
+ prob = probs + SpecPos + distance - posSlot - 1;
+ {
+ UInt32 mask = 1;
+ unsigned i = 1;
+ do
+ {
+ GET_BIT2(prob + i, i, ; , distance |= mask);
+ mask <<= 1;
+ }
+ while (--numDirectBits != 0);
+ }
+ }
+ else
+ {
+ numDirectBits -= kNumAlignBits;
+ do
+ {
+ NORMALIZE
+ range >>= 1;
+
+ {
+ UInt32 t;
+ code -= range;
+ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
+ distance = (distance << 1) + (t + 1);
+ code += range & t;
+ }
+ /*
+ distance <<= 1;
+ if (code >= range)
+ {
+ code -= range;
+ distance |= 1;
+ }
+ */
+ }
+ while (--numDirectBits != 0);
+ prob = probs + Align;
+ distance <<= kNumAlignBits;
+ {
+ unsigned i = 1;
+ GET_BIT2(prob + i, i, ; , distance |= 1);
+ GET_BIT2(prob + i, i, ; , distance |= 2);
+ GET_BIT2(prob + i, i, ; , distance |= 4);
+ GET_BIT2(prob + i, i, ; , distance |= 8);
+ }
+ if (distance == (UInt32)0xFFFFFFFF)
+ {
+ len += kMatchSpecLenStart;
+ state -= kNumStates;
+ break;
+ }
+ }
+ }
+ rep3 = rep2;
+ rep2 = rep1;
+ rep1 = rep0;
+ rep0 = distance + 1;
+ if (checkDicSize == 0)
+ {
+ if (distance >= processedPos)
+ return SZ_ERROR_DATA;
+ }
+ else if (distance >= checkDicSize)
+ return SZ_ERROR_DATA;
+ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
+ }
+
+ len += kMatchMinLen;
+
+ if (limit == dicPos)
+ return SZ_ERROR_DATA;
+ {
+ SizeT rem = limit - dicPos;
+ unsigned curLen = ((rem < len) ? (unsigned)rem : len);
+ SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
+
+ processedPos += curLen;
+
+ len -= curLen;
+ if (pos + curLen <= dicBufSize)
+ {
+ Byte *dest = dic + dicPos;
+ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
+ const Byte *lim = dest + curLen;
+ dicPos += curLen;
+ do
+ *(dest) = (Byte)*(dest + src);
+ while (++dest != lim);
+ }
+ else
+ {
+ do
+ {
+ dic[dicPos++] = dic[pos];
+ if (++pos == dicBufSize)
+ pos = 0;
+ }
+ while (--curLen != 0);
+ }
+ }
+ }
+ }
+ while (dicPos < limit && buf < bufLimit);
+ NORMALIZE;
+ p->buf = buf;
+ p->range = range;
+ p->code = code;
+ p->remainLen = len;
+ p->dicPos = dicPos;
+ p->processedPos = processedPos;
+ p->reps[0] = rep0;
+ p->reps[1] = rep1;
+ p->reps[2] = rep2;
+ p->reps[3] = rep3;
+ p->state = state;
+
+ return SZ_OK;
+}
+
+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
+{
+ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
+ {
+ Byte *dic = p->dic;
+ SizeT dicPos = p->dicPos;
+ SizeT dicBufSize = p->dicBufSize;
+ unsigned len = p->remainLen;
+ UInt32 rep0 = p->reps[0];
+ if (limit - dicPos < len)
+ len = (unsigned)(limit - dicPos);
+
+ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
+ p->checkDicSize = p->prop.dicSize;
+
+ p->processedPos += len;
+ p->remainLen -= len;
+ while (len-- != 0)
+ {
+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
+ dicPos++;
+ }
+ p->dicPos = dicPos;
+ }
+}
+
+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+{
+ do
+ {
+ SizeT limit2 = limit;
+ if (p->checkDicSize == 0)
+ {
+ UInt32 rem = p->prop.dicSize - p->processedPos;
+ if (limit - p->dicPos > rem)
+ limit2 = p->dicPos + rem;
+ }
+ RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit));
+ if (p->processedPos >= p->prop.dicSize)
+ p->checkDicSize = p->prop.dicSize;
+ LzmaDec_WriteRem(p, limit);
+ }
+ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
+
+ if (p->remainLen > kMatchSpecLenStart)
+ {
+ p->remainLen = kMatchSpecLenStart;
+ }
+ return 0;
+}
+
+typedef enum
+{
+ DUMMY_ERROR, /* unexpected end of input stream */
+ DUMMY_LIT,
+ DUMMY_MATCH,
+ DUMMY_REP
+} ELzmaDummy;
+
+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
+{
+ UInt32 range = p->range;
+ UInt32 code = p->code;
+ const Byte *bufLimit = buf + inSize;
+ CLzmaProb *probs = p->probs;
+ unsigned state = p->state;
+ ELzmaDummy res;
+
+ {
+ CLzmaProb *prob;
+ UInt32 bound;
+ unsigned ttt;
+ unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1);
+
+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK
+
+ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */
+
+ prob = probs + Literal;
+ if (p->checkDicSize != 0 || p->processedPos != 0)
+ prob += (LZMA_LIT_SIZE *
+ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
+ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
+
+ if (state < kNumLitStates)
+ {
+ unsigned symbol = 1;
+ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
+ }
+ else
+ {
+ unsigned matchByte = p->dic[p->dicPos - p->reps[0] +
+ ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)];
+ unsigned offs = 0x100;
+ unsigned symbol = 1;
+ do
+ {
+ unsigned bit;
+ CLzmaProb *probLit;
+ matchByte <<= 1;
+ bit = (matchByte & offs);
+ probLit = prob + offs + bit + symbol;
+ GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
+ }
+ while (symbol < 0x100);
+ }
+ res = DUMMY_LIT;
+ }
+ else
+ {
+ unsigned len;
+ UPDATE_1_CHECK;
+
+ prob = probs + IsRep + state;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ state = 0;
+ prob = probs + LenCoder;
+ res = DUMMY_MATCH;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ res = DUMMY_REP;
+ prob = probs + IsRepG0 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ NORMALIZE_CHECK;
+ return DUMMY_REP;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ }
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ prob = probs + IsRepG1 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ prob = probs + IsRepG2 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ }
+ }
+ }
+ state = kNumStates;
+ prob = probs + RepLenCoder;
+ }
+ {
+ unsigned limit, offset;
+ CLzmaProb *probLen = prob + LenChoice;
+ IF_BIT_0_CHECK(probLen)
+ {
+ UPDATE_0_CHECK;
+ probLen = prob + LenLow + (posState << kLenNumLowBits);
+ offset = 0;
+ limit = 1 << kLenNumLowBits;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ probLen = prob + LenChoice2;
+ IF_BIT_0_CHECK(probLen)
+ {
+ UPDATE_0_CHECK;
+ probLen = prob + LenMid + (posState << kLenNumMidBits);
+ offset = kLenNumLowSymbols;
+ limit = 1 << kLenNumMidBits;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ probLen = prob + LenHigh;
+ offset = kLenNumLowSymbols + kLenNumMidSymbols;
+ limit = 1 << kLenNumHighBits;
+ }
+ }
+ TREE_DECODE_CHECK(probLen, limit, len);
+ len += offset;
+ }
+
+ if (state < 4)
+ {
+ unsigned posSlot;
+ prob = probs + PosSlot +
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
+ kNumPosSlotBits);
+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
+ if (posSlot >= kStartPosModelIndex)
+ {
+ int numDirectBits = ((posSlot >> 1) - 1);
+
+ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
+
+ if (posSlot < kEndPosModelIndex)
+ {
+ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1;
+ }
+ else
+ {
+ numDirectBits -= kNumAlignBits;
+ do
+ {
+ NORMALIZE_CHECK
+ range >>= 1;
+ code -= range & (((code - range) >> 31) - 1);
+ /* if (code >= range) code -= range; */
+ }
+ while (--numDirectBits != 0);
+ prob = probs + Align;
+ numDirectBits = kNumAlignBits;
+ }
+ {
+ unsigned i = 1;
+ do
+ {
+ GET_BIT_CHECK(prob + i, i);
+ }
+ while (--numDirectBits != 0);
+ }
+ }
+ }
+ }
+ }
+ NORMALIZE_CHECK;
+ return res;
+}
+
+
+static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
+{
+ p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
+ p->range = 0xFFFFFFFF;
+ p->needFlush = 0;
+}
+
+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
+{
+ p->needFlush = 1;
+ p->remainLen = 0;
+ p->tempBufSize = 0;
+
+ if (initDic)
+ {
+ p->processedPos = 0;
+ p->checkDicSize = 0;
+ p->needInitState = 1;
+ }
+ if (initState)
+ p->needInitState = 1;
+}
+
+void LzmaDec_Init(CLzmaDec *p)
+{
+ p->dicPos = 0;
+ LzmaDec_InitDicAndState(p, True, True);
+}
+
+static void LzmaDec_InitStateReal(CLzmaDec *p)
+{
+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp));
+ UInt32 i;
+ CLzmaProb *probs = p->probs;
+ for (i = 0; i < numProbs; i++)
+ probs[i] = kBitModelTotal >> 1;
+ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
+ p->state = 0;
+ p->needInitState = 0;
+}
+
+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
+ ELzmaFinishMode finishMode, ELzmaStatus *status)
+{
+ SizeT inSize = *srcLen;
+ (*srcLen) = 0;
+ LzmaDec_WriteRem(p, dicLimit);
+
+ *status = LZMA_STATUS_NOT_SPECIFIED;
+
+ while (p->remainLen != kMatchSpecLenStart)
+ {
+ int checkEndMarkNow;
+
+ if (p->needFlush != 0)
+ {
+ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
+ p->tempBuf[p->tempBufSize++] = *src++;
+ if (p->tempBufSize < RC_INIT_SIZE)
+ {
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+ return SZ_OK;
+ }
+ if (p->tempBuf[0] != 0)
+ return SZ_ERROR_DATA;
+
+ LzmaDec_InitRc(p, p->tempBuf);
+ p->tempBufSize = 0;
+ }
+
+ checkEndMarkNow = 0;
+ if (p->dicPos >= dicLimit)
+ {
+ if (p->remainLen == 0 && p->code == 0)
+ {
+ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
+ return SZ_OK;
+ }
+ if (finishMode == LZMA_FINISH_ANY)
+ {
+ *status = LZMA_STATUS_NOT_FINISHED;
+ return SZ_OK;
+ }
+ if (p->remainLen != 0)
+ {
+ *status = LZMA_STATUS_NOT_FINISHED;
+ return SZ_ERROR_DATA;
+ }
+ checkEndMarkNow = 1;
+ }
+
+ if (p->needInitState)
+ LzmaDec_InitStateReal(p);
+
+ if (p->tempBufSize == 0)
+ {
+ SizeT processed;
+ const Byte *bufLimit;
+ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
+ {
+ int dummyRes = LzmaDec_TryDummy(p, src, inSize);
+ if (dummyRes == DUMMY_ERROR)
+ {
+ memcpy(p->tempBuf, src, inSize);
+ p->tempBufSize = (unsigned)inSize;
+ (*srcLen) += inSize;
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+ return SZ_OK;
+ }
+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
+ {
+ *status = LZMA_STATUS_NOT_FINISHED;
+ return SZ_ERROR_DATA;
+ }
+ bufLimit = src;
+ }
+ else
+ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
+ p->buf = src;
+ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
+ return SZ_ERROR_DATA;
+ processed = (SizeT)(p->buf - src);
+ (*srcLen) += processed;
+ src += processed;
+ inSize -= processed;
+ }
+ else
+ {
+ unsigned rem = p->tempBufSize, lookAhead = 0;
+ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
+ p->tempBuf[rem++] = src[lookAhead++];
+ p->tempBufSize = rem;
+ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
+ {
+ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
+ if (dummyRes == DUMMY_ERROR)
+ {
+ (*srcLen) += lookAhead;
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+ return SZ_OK;
+ }
+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
+ {
+ *status = LZMA_STATUS_NOT_FINISHED;
+ return SZ_ERROR_DATA;
+ }
+ }
+ p->buf = p->tempBuf;
+ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
+ return SZ_ERROR_DATA;
+ lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
+ (*srcLen) += lookAhead;
+ src += lookAhead;
+ inSize -= lookAhead;
+ p->tempBufSize = 0;
+ }
+ }
+ if (p->code == 0)
+ *status = LZMA_STATUS_FINISHED_WITH_MARK;
+ return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
+}
+
+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
+{
+ SizeT outSize = *destLen;
+ SizeT inSize = *srcLen;
+ *srcLen = *destLen = 0;
+ for (;;)
+ {
+ SizeT inSizeCur = inSize, outSizeCur, dicPos;
+ ELzmaFinishMode curFinishMode;
+ SRes res;
+ if (p->dicPos == p->dicBufSize)
+ p->dicPos = 0;
+ dicPos = p->dicPos;
+ if (outSize > p->dicBufSize - dicPos)
+ {
+ outSizeCur = p->dicBufSize;
+ curFinishMode = LZMA_FINISH_ANY;
+ }
+ else
+ {
+ outSizeCur = dicPos + outSize;
+ curFinishMode = finishMode;
+ }
+
+ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
+ src += inSizeCur;
+ inSize -= inSizeCur;
+ *srcLen += inSizeCur;
+ outSizeCur = p->dicPos - dicPos;
+ memcpy(dest, p->dic + dicPos, outSizeCur);
+ dest += outSizeCur;
+ outSize -= outSizeCur;
+ *destLen += outSizeCur;
+ if (res != 0)
+ return res;
+ if (outSizeCur == 0 || outSize == 0)
+ return SZ_OK;
+ }
+}
+
+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
+{
+ alloc->Free(alloc, p->probs);
+ p->probs = 0;
+}
+
+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc)
+{
+ alloc->Free(alloc, p->dic);
+ p->dic = 0;
+}
+
+void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
+{
+ LzmaDec_FreeProbs(p, alloc);
+ LzmaDec_FreeDict(p, alloc);
+}
+
+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
+{
+ UInt32 dicSize;
+ Byte d;
+
+ if (size < LZMA_PROPS_SIZE)
+ return SZ_ERROR_UNSUPPORTED;
+ else
+ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
+
+ if (dicSize < LZMA_DIC_MIN)
+ dicSize = LZMA_DIC_MIN;
+ p->dicSize = dicSize;
+
+ d = data[0];
+ if (d >= (9 * 5 * 5))
+ return SZ_ERROR_UNSUPPORTED;
+
+ p->lc = d % 9;
+ d /= 9;
+ p->pb = d / 5;
+ p->lp = d % 5;
+
+ return SZ_OK;
+}
+
+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
+{
+ UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
+ if (p->probs == 0 || numProbs != p->numProbs)
+ {
+ LzmaDec_FreeProbs(p, alloc);
+ p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb));
+ p->numProbs = numProbs;
+ if (p->probs == 0)
+ return SZ_ERROR_MEM;
+ }
+ return SZ_OK;
+}
+
+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
+{
+ CLzmaProps propNew;
+ RINOK(LzmaProps_Decode(&propNew, props, propsSize));
+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
+ p->prop = propNew;
+ return SZ_OK;
+}
+
+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
+{
+ CLzmaProps propNew;
+ SizeT dicBufSize;
+ RINOK(LzmaProps_Decode(&propNew, props, propsSize));
+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
+ dicBufSize = propNew.dicSize;
+ if (p->dic == 0 || dicBufSize != p->dicBufSize)
+ {
+ LzmaDec_FreeDict(p, alloc);
+ p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
+ if (p->dic == 0)
+ {
+ LzmaDec_FreeProbs(p, alloc);
+ return SZ_ERROR_MEM;
+ }
+ }
+ p->dicBufSize = dicBufSize;
+ p->prop = propNew;
+ return SZ_OK;
+}
+
+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
+ ELzmaStatus *status, ISzAlloc *alloc)
+{
+ CLzmaDec p;
+ SRes res;
+ SizeT inSize = *srcLen;
+ SizeT outSize = *destLen;
+ *srcLen = *destLen = 0;
+ if (inSize < RC_INIT_SIZE)
+ return SZ_ERROR_INPUT_EOF;
+
+ LzmaDec_Construct(&p);
+ res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc);
+ if (res != 0)
+ return res;
+ p.dic = dest;
+ p.dicBufSize = outSize;
+
+ LzmaDec_Init(&p);
+
+ *srcLen = inSize;
+ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
+
+ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
+ res = SZ_ERROR_INPUT_EOF;
+
+ (*destLen) = p.dicPos;
+ LzmaDec_FreeProbs(&p, alloc);
+ return res;
+}
--- /dev/null
+/* LzmaDec.h -- LZMA Decoder
+2009-02-07 : Igor Pavlov : Public domain */
+
+#ifndef __LZMA_DEC_H
+#define __LZMA_DEC_H
+
+#include "Types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* #define _LZMA_PROB32 */
+/* _LZMA_PROB32 can increase the speed on some CPUs,
+ but memory usage for CLzmaDec::probs will be doubled in that case */
+
+#ifdef _LZMA_PROB32
+#define CLzmaProb UInt32
+#else
+#define CLzmaProb UInt16
+#endif
+
+
+/* ---------- LZMA Properties ---------- */
+
+#define LZMA_PROPS_SIZE 5
+
+typedef struct _CLzmaProps
+{
+ unsigned lc, lp, pb;
+ UInt32 dicSize;
+} CLzmaProps;
+
+/* LzmaProps_Decode - decodes properties
+Returns:
+ SZ_OK
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
+*/
+
+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
+
+
+/* ---------- LZMA Decoder state ---------- */
+
+/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
+ Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
+
+#define LZMA_REQUIRED_INPUT_MAX 20
+
+typedef struct
+{
+ CLzmaProps prop;
+ CLzmaProb *probs;
+ Byte *dic;
+ const Byte *buf;
+ UInt32 range, code;
+ SizeT dicPos;
+ SizeT dicBufSize;
+ UInt32 processedPos;
+ UInt32 checkDicSize;
+ unsigned state;
+ UInt32 reps[4];
+ unsigned remainLen;
+ int needFlush;
+ int needInitState;
+ UInt32 numProbs;
+ unsigned tempBufSize;
+ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
+} CLzmaDec;
+
+#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
+
+void LzmaDec_Init(CLzmaDec *p);
+
+/* There are two types of LZMA streams:
+ 0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
+ 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
+
+typedef enum
+{
+ LZMA_FINISH_ANY, /* finish at any point */
+ LZMA_FINISH_END /* block must be finished at the end */
+} ELzmaFinishMode;
+
+/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
+
+ You must use LZMA_FINISH_END, when you know that current output buffer
+ covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
+
+ If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
+ and output value of destLen will be less than output buffer size limit.
+ You can check status result also.
+
+ You can use multiple checks to test data integrity after full decompression:
+ 1) Check Result and "status" variable.
+ 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
+ 3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
+ You must use correct finish mode in that case. */
+
+typedef enum
+{
+ LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
+ LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
+ LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
+ LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
+} ELzmaStatus;
+
+/* ELzmaStatus is used only as output value for function call */
+
+
+/* ---------- Interfaces ---------- */
+
+/* There are 3 levels of interfaces:
+ 1) Dictionary Interface
+ 2) Buffer Interface
+ 3) One Call Interface
+ You can select any of these interfaces, but don't mix functions from different
+ groups for same object. */
+
+
+/* There are two variants to allocate state for Dictionary Interface:
+ 1) LzmaDec_Allocate / LzmaDec_Free
+ 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
+ You can use variant 2, if you set dictionary buffer manually.
+ For Buffer Interface you must always use variant 1.
+
+LzmaDec_Allocate* can return:
+ SZ_OK
+ SZ_ERROR_MEM - Memory allocation error
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
+*/
+
+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
+
+SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
+void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
+
+/* ---------- Dictionary Interface ---------- */
+
+/* You can use it, if you want to eliminate the overhead for data copying from
+ dictionary to some other external buffer.
+ You must work with CLzmaDec variables directly in this interface.
+
+ STEPS:
+ LzmaDec_Constr()
+ LzmaDec_Allocate()
+ for (each new stream)
+ {
+ LzmaDec_Init()
+ while (it needs more decompression)
+ {
+ LzmaDec_DecodeToDic()
+ use data from CLzmaDec::dic and update CLzmaDec::dicPos
+ }
+ }
+ LzmaDec_Free()
+*/
+
+/* LzmaDec_DecodeToDic
+
+ The decoding to internal dictionary buffer (CLzmaDec::dic).
+ You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
+
+finishMode:
+ It has meaning only if the decoding reaches output limit (dicLimit).
+ LZMA_FINISH_ANY - Decode just dicLimit bytes.
+ LZMA_FINISH_END - Stream must be finished after dicLimit.
+
+Returns:
+ SZ_OK
+ status:
+ LZMA_STATUS_FINISHED_WITH_MARK
+ LZMA_STATUS_NOT_FINISHED
+ LZMA_STATUS_NEEDS_MORE_INPUT
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
+ SZ_ERROR_DATA - Data error
+*/
+
+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
+
+
+/* ---------- Buffer Interface ---------- */
+
+/* It's zlib-like interface.
+ See LzmaDec_DecodeToDic description for information about STEPS and return results,
+ but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
+ to work with CLzmaDec variables manually.
+
+finishMode:
+ It has meaning only if the decoding reaches output limit (*destLen).
+ LZMA_FINISH_ANY - Decode just destLen bytes.
+ LZMA_FINISH_END - Stream must be finished after (*destLen).
+*/
+
+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
+
+
+/* ---------- One Call Interface ---------- */
+
+/* LzmaDecode
+
+finishMode:
+ It has meaning only if the decoding reaches output limit (*destLen).
+ LZMA_FINISH_ANY - Decode just destLen bytes.
+ LZMA_FINISH_END - Stream must be finished after (*destLen).
+
+Returns:
+ SZ_OK
+ status:
+ LZMA_STATUS_FINISHED_WITH_MARK
+ LZMA_STATUS_NOT_FINISHED
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
+ SZ_ERROR_DATA - Data error
+ SZ_ERROR_MEM - Memory allocation error
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
+ SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
+*/
+
+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
+ ELzmaStatus *status, ISzAlloc *alloc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/* LzmaEnc.c -- LZMA Encoder
+2010-04-16 : Igor Pavlov : Public domain */
+
+#include <string.h>
+
+/* #define SHOW_STAT */
+/* #define SHOW_STAT2 */
+
+#if defined(SHOW_STAT) || defined(SHOW_STAT2)
+#include <stdio.h>
+#endif
+
+#include "LzmaEnc.h"
+
+#include "LzFind.h"
+#ifndef _7ZIP_ST
+#include "LzFindMt.h"
+#endif
+
+#ifdef SHOW_STAT
+static int ttt = 0;
+#endif
+
+#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1)
+
+#define kBlockSize (9 << 10)
+#define kUnpackBlockSize (1 << 18)
+#define kMatchArraySize (1 << 21)
+#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX)
+
+#define kNumMaxDirectBits (31)
+
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+#define kProbInitValue (kBitModelTotal >> 1)
+
+#define kNumMoveReducingBits 4
+#define kNumBitPriceShiftBits 4
+#define kBitPrice (1 << kNumBitPriceShiftBits)
+
+void LzmaEncProps_Init(CLzmaEncProps *p)
+{
+ p->level = 5;
+ p->dictSize = p->mc = 0;
+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
+ p->writeEndMark = 0;
+}
+
+void LzmaEncProps_Normalize(CLzmaEncProps *p)
+{
+ int level = p->level;
+ if (level < 0) level = 5;
+ p->level = level;
+ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26)));
+ if (p->lc < 0) p->lc = 3;
+ if (p->lp < 0) p->lp = 0;
+ if (p->pb < 0) p->pb = 2;
+ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1);
+ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64);
+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1);
+ if (p->numHashBytes < 0) p->numHashBytes = 4;
+ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
+ if (p->numThreads < 0)
+ p->numThreads =
+#ifndef _7ZIP_ST
+ ((p->btMode && p->algo) ? 2 : 1);
+#else
+ 1;
+#endif
+}
+
+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
+{
+ CLzmaEncProps props = *props2;
+ LzmaEncProps_Normalize(&props);
+ return props.dictSize;
+}
+
+/* #define LZMA_LOG_BSR */
+/* Define it for Intel's CPU */
+
+
+#ifdef LZMA_LOG_BSR
+
+#define kDicLogSizeMaxCompress 30
+
+#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
+
+UInt32 GetPosSlot1(UInt32 pos)
+{
+ UInt32 res;
+ BSR2_RET(pos, res);
+ return res;
+}
+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
+
+#else
+
+#define kNumLogBits (9 + (int)sizeof(size_t) / 2)
+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
+
+void LzmaEnc_FastPosInit(Byte *g_FastPos)
+{
+ int c = 2, slotFast;
+ g_FastPos[0] = 0;
+ g_FastPos[1] = 1;
+
+ for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++)
+ {
+ UInt32 k = (1 << ((slotFast >> 1) - 1));
+ UInt32 j;
+ for (j = 0; j < k; j++, c++)
+ g_FastPos[c] = (Byte)slotFast;
+ }
+}
+
+#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \
+ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
+ res = p->g_FastPos[pos >> i] + (i * 2); }
+/*
+#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
+ p->g_FastPos[pos >> 6] + 12 : \
+ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
+*/
+
+#define GetPosSlot1(pos) p->g_FastPos[pos]
+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
+#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); }
+
+#endif
+
+
+#define LZMA_NUM_REPS 4
+
+typedef unsigned CState;
+
+typedef struct
+{
+ UInt32 price;
+
+ CState state;
+ int prev1IsChar;
+ int prev2;
+
+ UInt32 posPrev2;
+ UInt32 backPrev2;
+
+ UInt32 posPrev;
+ UInt32 backPrev;
+ UInt32 backs[LZMA_NUM_REPS];
+} COptimal;
+
+#define kNumOpts (1 << 12)
+
+#define kNumLenToPosStates 4
+#define kNumPosSlotBits 6
+#define kDicLogSizeMin 0
+#define kDicLogSizeMax 32
+#define kDistTableSizeMax (kDicLogSizeMax * 2)
+
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+#define kAlignMask (kAlignTableSize - 1)
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex)
+
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+#ifdef _LZMA_PROB32
+#define CLzmaProb UInt32
+#else
+#define CLzmaProb UInt16
+#endif
+
+#define LZMA_PB_MAX 4
+#define LZMA_LC_MAX 8
+#define LZMA_LP_MAX 4
+
+#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
+
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumMidBits 3
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+
+#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
+
+#define LZMA_MATCH_LEN_MIN 2
+#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1)
+
+#define kNumStates 12
+
+typedef struct
+{
+ CLzmaProb choice;
+ CLzmaProb choice2;
+ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits];
+ CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits];
+ CLzmaProb high[kLenNumHighSymbols];
+} CLenEnc;
+
+typedef struct
+{
+ CLenEnc p;
+ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal];
+ UInt32 tableSize;
+ UInt32 counters[LZMA_NUM_PB_STATES_MAX];
+} CLenPriceEnc;
+
+typedef struct
+{
+ UInt32 range;
+ Byte cache;
+ UInt64 low;
+ UInt64 cacheSize;
+ Byte *buf;
+ Byte *bufLim;
+ Byte *bufBase;
+ ISeqOutStream *outStream;
+ UInt64 processed;
+ SRes res;
+} CRangeEnc;
+
+typedef struct
+{
+ CLzmaProb *litProbs;
+
+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
+ CLzmaProb isRep[kNumStates];
+ CLzmaProb isRepG0[kNumStates];
+ CLzmaProb isRepG1[kNumStates];
+ CLzmaProb isRepG2[kNumStates];
+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
+
+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
+ CLzmaProb posAlignEncoder[1 << kNumAlignBits];
+
+ CLenPriceEnc lenEnc;
+ CLenPriceEnc repLenEnc;
+
+ UInt32 reps[LZMA_NUM_REPS];
+ UInt32 state;
+} CSaveState;
+
+typedef struct
+{
+ IMatchFinder matchFinder;
+ void *matchFinderObj;
+
+#ifndef _7ZIP_ST
+ Bool mtMode;
+ CMatchFinderMt matchFinderMt;
+#endif
+
+ CMatchFinder matchFinderBase;
+
+#ifndef _7ZIP_ST
+ Byte pad[128];
+#endif
+
+ UInt32 optimumEndIndex;
+ UInt32 optimumCurrentIndex;
+
+ UInt32 longestMatchLength;
+ UInt32 numPairs;
+ UInt32 numAvail;
+ COptimal opt[kNumOpts];
+
+#ifndef LZMA_LOG_BSR
+ Byte g_FastPos[1 << kNumLogBits];
+#endif
+
+ UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
+ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
+ UInt32 numFastBytes;
+ UInt32 additionalOffset;
+ UInt32 reps[LZMA_NUM_REPS];
+ UInt32 state;
+
+ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
+ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances];
+ UInt32 alignPrices[kAlignTableSize];
+ UInt32 alignPriceCount;
+
+ UInt32 distTableSize;
+
+ unsigned lc, lp, pb;
+ unsigned lpMask, pbMask;
+
+ CLzmaProb *litProbs;
+
+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
+ CLzmaProb isRep[kNumStates];
+ CLzmaProb isRepG0[kNumStates];
+ CLzmaProb isRepG1[kNumStates];
+ CLzmaProb isRepG2[kNumStates];
+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
+
+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
+ CLzmaProb posAlignEncoder[1 << kNumAlignBits];
+
+ CLenPriceEnc lenEnc;
+ CLenPriceEnc repLenEnc;
+
+ unsigned lclp;
+
+ Bool fastMode;
+
+ CRangeEnc rc;
+
+ Bool writeEndMark;
+ UInt64 nowPos64;
+ UInt32 matchPriceCount;
+ Bool finished;
+ Bool multiThread;
+
+ SRes result;
+ UInt32 dictSize;
+ UInt32 matchFinderCycles;
+
+ int needInit;
+
+ CSaveState saveState;
+} CLzmaEnc;
+
+void LzmaEnc_SaveState(CLzmaEncHandle pp)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ CSaveState *dest = &p->saveState;
+ int i;
+ dest->lenEnc = p->lenEnc;
+ dest->repLenEnc = p->repLenEnc;
+ dest->state = p->state;
+
+ for (i = 0; i < kNumStates; i++)
+ {
+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
+ }
+ for (i = 0; i < kNumLenToPosStates; i++)
+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
+ memcpy(dest->reps, p->reps, sizeof(p->reps));
+ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
+}
+
+void LzmaEnc_RestoreState(CLzmaEncHandle pp)
+{
+ CLzmaEnc *dest = (CLzmaEnc *)pp;
+ const CSaveState *p = &dest->saveState;
+ int i;
+ dest->lenEnc = p->lenEnc;
+ dest->repLenEnc = p->repLenEnc;
+ dest->state = p->state;
+
+ for (i = 0; i < kNumStates; i++)
+ {
+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
+ }
+ for (i = 0; i < kNumLenToPosStates; i++)
+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
+ memcpy(dest->reps, p->reps, sizeof(p->reps));
+ memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb));
+}
+
+SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ CLzmaEncProps props = *props2;
+ LzmaEncProps_Normalize(&props);
+
+ if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX ||
+ props.dictSize > ((UInt32)1 << kDicLogSizeMaxCompress) || props.dictSize > ((UInt32)1 << 30))
+ return SZ_ERROR_PARAM;
+ p->dictSize = props.dictSize;
+ p->matchFinderCycles = props.mc;
+ {
+ unsigned fb = props.fb;
+ if (fb < 5)
+ fb = 5;
+ if (fb > LZMA_MATCH_LEN_MAX)
+ fb = LZMA_MATCH_LEN_MAX;
+ p->numFastBytes = fb;
+ }
+ p->lc = props.lc;
+ p->lp = props.lp;
+ p->pb = props.pb;
+ p->fastMode = (props.algo == 0);
+ p->matchFinderBase.btMode = props.btMode;
+ {
+ UInt32 numHashBytes = 4;
+ if (props.btMode)
+ {
+ if (props.numHashBytes < 2)
+ numHashBytes = 2;
+ else if (props.numHashBytes < 4)
+ numHashBytes = props.numHashBytes;
+ }
+ p->matchFinderBase.numHashBytes = numHashBytes;
+ }
+
+ p->matchFinderBase.cutValue = props.mc;
+
+ p->writeEndMark = props.writeEndMark;
+
+#ifndef _7ZIP_ST
+ /*
+ if (newMultiThread != _multiThread)
+ {
+ ReleaseMatchFinder();
+ _multiThread = newMultiThread;
+ }
+ */
+ p->multiThread = (props.numThreads > 1);
+#endif
+
+ return SZ_OK;
+}
+
+static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
+static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
+static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
+static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
+
+#define IsCharState(s) ((s) < 7)
+
+#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1)
+
+#define kInfinityPrice (1 << 30)
+
+static void RangeEnc_Construct(CRangeEnc *p)
+{
+ p->outStream = 0;
+ p->bufBase = 0;
+}
+
+#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize)
+
+#define RC_BUF_SIZE (1 << 16)
+static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc)
+{
+ if (p->bufBase == 0)
+ {
+ p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE);
+ if (p->bufBase == 0)
+ return 0;
+ p->bufLim = p->bufBase + RC_BUF_SIZE;
+ }
+ return 1;
+}
+
+static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc)
+{
+ alloc->Free(alloc, p->bufBase);
+ p->bufBase = 0;
+}
+
+static void RangeEnc_Init(CRangeEnc *p)
+{
+ /* Stream.Init(); */
+ p->low = 0;
+ p->range = 0xFFFFFFFF;
+ p->cacheSize = 1;
+ p->cache = 0;
+
+ p->buf = p->bufBase;
+
+ p->processed = 0;
+ p->res = SZ_OK;
+}
+
+static void RangeEnc_FlushStream(CRangeEnc *p)
+{
+ size_t num;
+ if (p->res != SZ_OK)
+ return;
+ num = p->buf - p->bufBase;
+ if (num != p->outStream->Write(p->outStream, p->bufBase, num))
+ p->res = SZ_ERROR_WRITE;
+ p->processed += num;
+ p->buf = p->bufBase;
+}
+
+static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
+{
+ if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0)
+ {
+ Byte temp = p->cache;
+ do
+ {
+ Byte *buf = p->buf;
+ *buf++ = (Byte)(temp + (Byte)(p->low >> 32));
+ p->buf = buf;
+ if (buf == p->bufLim)
+ RangeEnc_FlushStream(p);
+ temp = 0xFF;
+ }
+ while (--p->cacheSize != 0);
+ p->cache = (Byte)((UInt32)p->low >> 24);
+ }
+ p->cacheSize++;
+ p->low = (UInt32)p->low << 8;
+}
+
+static void RangeEnc_FlushData(CRangeEnc *p)
+{
+ int i;
+ for (i = 0; i < 5; i++)
+ RangeEnc_ShiftLow(p);
+}
+
+static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits)
+{
+ do
+ {
+ p->range >>= 1;
+ p->low += p->range & (0 - ((value >> --numBits) & 1));
+ if (p->range < kTopValue)
+ {
+ p->range <<= 8;
+ RangeEnc_ShiftLow(p);
+ }
+ }
+ while (numBits != 0);
+}
+
+static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol)
+{
+ UInt32 ttt = *prob;
+ UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt;
+ if (symbol == 0)
+ {
+ p->range = newBound;
+ ttt += (kBitModelTotal - ttt) >> kNumMoveBits;
+ }
+ else
+ {
+ p->low += newBound;
+ p->range -= newBound;
+ ttt -= ttt >> kNumMoveBits;
+ }
+ *prob = (CLzmaProb)ttt;
+ if (p->range < kTopValue)
+ {
+ p->range <<= 8;
+ RangeEnc_ShiftLow(p);
+ }
+}
+
+static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol)
+{
+ symbol |= 0x100;
+ do
+ {
+ RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1);
+ symbol <<= 1;
+ }
+ while (symbol < 0x10000);
+}
+
+static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte)
+{
+ UInt32 offs = 0x100;
+ symbol |= 0x100;
+ do
+ {
+ matchByte <<= 1;
+ RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1);
+ symbol <<= 1;
+ offs &= ~(matchByte ^ symbol);
+ }
+ while (symbol < 0x10000);
+}
+
+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
+{
+ UInt32 i;
+ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
+ {
+ const int kCyclesBits = kNumBitPriceShiftBits;
+ UInt32 w = i;
+ UInt32 bitCount = 0;
+ int j;
+ for (j = 0; j < kCyclesBits; j++)
+ {
+ w = w * w;
+ bitCount <<= 1;
+ while (w >= ((UInt32)1 << 16))
+ {
+ w >>= 1;
+ bitCount++;
+ }
+ }
+ ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
+ }
+}
+
+
+#define GET_PRICE(prob, symbol) \
+ p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
+
+#define GET_PRICEa(prob, symbol) \
+ ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
+
+#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
+#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
+
+#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits]
+#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
+
+static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices)
+{
+ UInt32 price = 0;
+ symbol |= 0x100;
+ do
+ {
+ price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1);
+ symbol <<= 1;
+ }
+ while (symbol < 0x10000);
+ return price;
+}
+
+static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices)
+{
+ UInt32 price = 0;
+ UInt32 offs = 0x100;
+ symbol |= 0x100;
+ do
+ {
+ matchByte <<= 1;
+ price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1);
+ symbol <<= 1;
+ offs &= ~(matchByte ^ symbol);
+ }
+ while (symbol < 0x10000);
+ return price;
+}
+
+
+static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
+{
+ UInt32 m = 1;
+ int i;
+ for (i = numBitLevels; i != 0;)
+ {
+ UInt32 bit;
+ i--;
+ bit = (symbol >> i) & 1;
+ RangeEnc_EncodeBit(rc, probs + m, bit);
+ m = (m << 1) | bit;
+ }
+}
+
+static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
+{
+ UInt32 m = 1;
+ int i;
+ for (i = 0; i < numBitLevels; i++)
+ {
+ UInt32 bit = symbol & 1;
+ RangeEnc_EncodeBit(rc, probs + m, bit);
+ m = (m << 1) | bit;
+ symbol >>= 1;
+ }
+}
+
+static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
+{
+ UInt32 price = 0;
+ symbol |= (1 << numBitLevels);
+ while (symbol != 1)
+ {
+ price += GET_PRICEa(probs[symbol >> 1], symbol & 1);
+ symbol >>= 1;
+ }
+ return price;
+}
+
+static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
+{
+ UInt32 price = 0;
+ UInt32 m = 1;
+ int i;
+ for (i = numBitLevels; i != 0; i--)
+ {
+ UInt32 bit = symbol & 1;
+ symbol >>= 1;
+ price += GET_PRICEa(probs[m], bit);
+ m = (m << 1) | bit;
+ }
+ return price;
+}
+
+
+static void LenEnc_Init(CLenEnc *p)
+{
+ unsigned i;
+ p->choice = p->choice2 = kProbInitValue;
+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++)
+ p->low[i] = kProbInitValue;
+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++)
+ p->mid[i] = kProbInitValue;
+ for (i = 0; i < kLenNumHighSymbols; i++)
+ p->high[i] = kProbInitValue;
+}
+
+static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState)
+{
+ if (symbol < kLenNumLowSymbols)
+ {
+ RangeEnc_EncodeBit(rc, &p->choice, 0);
+ RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol);
+ }
+ else
+ {
+ RangeEnc_EncodeBit(rc, &p->choice, 1);
+ if (symbol < kLenNumLowSymbols + kLenNumMidSymbols)
+ {
+ RangeEnc_EncodeBit(rc, &p->choice2, 0);
+ RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols);
+ }
+ else
+ {
+ RangeEnc_EncodeBit(rc, &p->choice2, 1);
+ RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols);
+ }
+ }
+}
+
+static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices)
+{
+ UInt32 a0 = GET_PRICE_0a(p->choice);
+ UInt32 a1 = GET_PRICE_1a(p->choice);
+ UInt32 b0 = a1 + GET_PRICE_0a(p->choice2);
+ UInt32 b1 = a1 + GET_PRICE_1a(p->choice2);
+ UInt32 i = 0;
+ for (i = 0; i < kLenNumLowSymbols; i++)
+ {
+ if (i >= numSymbols)
+ return;
+ prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices);
+ }
+ for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++)
+ {
+ if (i >= numSymbols)
+ return;
+ prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices);
+ }
+ for (; i < numSymbols; i++)
+ prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices);
+}
+
+static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices)
+{
+ LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices);
+ p->counters[posState] = p->tableSize;
+}
+
+static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices)
+{
+ UInt32 posState;
+ for (posState = 0; posState < numPosStates; posState++)
+ LenPriceEnc_UpdateTable(p, posState, ProbPrices);
+}
+
+static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices)
+{
+ LenEnc_Encode(&p->p, rc, symbol, posState);
+ if (updatePrice)
+ if (--p->counters[posState] == 0)
+ LenPriceEnc_UpdateTable(p, posState, ProbPrices);
+}
+
+
+
+
+static void MovePos(CLzmaEnc *p, UInt32 num)
+{
+#ifdef SHOW_STAT
+ ttt += num;
+ printf("\n MovePos %d", num);
+#endif
+ if (num != 0)
+ {
+ p->additionalOffset += num;
+ p->matchFinder.Skip(p->matchFinderObj, num);
+ }
+}
+
+static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
+{
+ UInt32 lenRes = 0, numPairs;
+ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
+ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
+#ifdef SHOW_STAT
+ printf("\n i = %d numPairs = %d ", ttt, numPairs / 2);
+ ttt++;
+ {
+ UInt32 i;
+ for (i = 0; i < numPairs; i += 2)
+ printf("%2d %6d | ", p->matches[i], p->matches[i + 1]);
+ }
+#endif
+ if (numPairs > 0)
+ {
+ lenRes = p->matches[numPairs - 2];
+ if (lenRes == p->numFastBytes)
+ {
+ const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+ UInt32 distance = p->matches[numPairs - 1] + 1;
+ UInt32 numAvail = p->numAvail;
+ if (numAvail > LZMA_MATCH_LEN_MAX)
+ numAvail = LZMA_MATCH_LEN_MAX;
+ {
+ const Byte *pby2 = pby - distance;
+ for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++);
+ }
+ }
+ }
+ p->additionalOffset++;
+ *numDistancePairsRes = numPairs;
+ return lenRes;
+}
+
+
+#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False;
+#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False;
+#define IsShortRep(p) ((p)->backPrev == 0)
+
+static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState)
+{
+ return
+ GET_PRICE_0(p->isRepG0[state]) +
+ GET_PRICE_0(p->isRep0Long[state][posState]);
+}
+
+static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState)
+{
+ UInt32 price;
+ if (repIndex == 0)
+ {
+ price = GET_PRICE_0(p->isRepG0[state]);
+ price += GET_PRICE_1(p->isRep0Long[state][posState]);
+ }
+ else
+ {
+ price = GET_PRICE_1(p->isRepG0[state]);
+ if (repIndex == 1)
+ price += GET_PRICE_0(p->isRepG1[state]);
+ else
+ {
+ price += GET_PRICE_1(p->isRepG1[state]);
+ price += GET_PRICE(p->isRepG2[state], repIndex - 2);
+ }
+ }
+ return price;
+}
+
+static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState)
+{
+ return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] +
+ GetPureRepPrice(p, repIndex, state, posState);
+}
+
+static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
+{
+ UInt32 posMem = p->opt[cur].posPrev;
+ UInt32 backMem = p->opt[cur].backPrev;
+ p->optimumEndIndex = cur;
+ do
+ {
+ if (p->opt[cur].prev1IsChar)
+ {
+ MakeAsChar(&p->opt[posMem])
+ p->opt[posMem].posPrev = posMem - 1;
+ if (p->opt[cur].prev2)
+ {
+ p->opt[posMem - 1].prev1IsChar = False;
+ p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2;
+ p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2;
+ }
+ }
+ {
+ UInt32 posPrev = posMem;
+ UInt32 backCur = backMem;
+
+ backMem = p->opt[posPrev].backPrev;
+ posMem = p->opt[posPrev].posPrev;
+
+ p->opt[posPrev].backPrev = backCur;
+ p->opt[posPrev].posPrev = cur;
+ cur = posPrev;
+ }
+ }
+ while (cur != 0);
+ *backRes = p->opt[0].backPrev;
+ p->optimumCurrentIndex = p->opt[0].posPrev;
+ return p->optimumCurrentIndex;
+}
+
+#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300)
+
+static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
+{
+ UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur;
+ UInt32 matchPrice, repMatchPrice, normalMatchPrice;
+ UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS];
+ UInt32 *matches;
+ const Byte *data;
+ Byte curByte, matchByte;
+ if (p->optimumEndIndex != p->optimumCurrentIndex)
+ {
+ const COptimal *opt = &p->opt[p->optimumCurrentIndex];
+ UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex;
+ *backRes = opt->backPrev;
+ p->optimumCurrentIndex = opt->posPrev;
+ return lenRes;
+ }
+ p->optimumCurrentIndex = p->optimumEndIndex = 0;
+
+ if (p->additionalOffset == 0)
+ mainLen = ReadMatchDistances(p, &numPairs);
+ else
+ {
+ mainLen = p->longestMatchLength;
+ numPairs = p->numPairs;
+ }
+
+ numAvail = p->numAvail;
+ if (numAvail < 2)
+ {
+ *backRes = (UInt32)(-1);
+ return 1;
+ }
+ if (numAvail > LZMA_MATCH_LEN_MAX)
+ numAvail = LZMA_MATCH_LEN_MAX;
+
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+ repMaxIndex = 0;
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ {
+ UInt32 lenTest;
+ const Byte *data2;
+ reps[i] = p->reps[i];
+ data2 = data - (reps[i] + 1);
+ if (data[0] != data2[0] || data[1] != data2[1])
+ {
+ repLens[i] = 0;
+ continue;
+ }
+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++);
+ repLens[i] = lenTest;
+ if (lenTest > repLens[repMaxIndex])
+ repMaxIndex = i;
+ }
+ if (repLens[repMaxIndex] >= p->numFastBytes)
+ {
+ UInt32 lenRes;
+ *backRes = repMaxIndex;
+ lenRes = repLens[repMaxIndex];
+ MovePos(p, lenRes - 1);
+ return lenRes;
+ }
+
+ matches = p->matches;
+ if (mainLen >= p->numFastBytes)
+ {
+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS;
+ MovePos(p, mainLen - 1);
+ return mainLen;
+ }
+ curByte = *data;
+ matchByte = *(data - (reps[0] + 1));
+
+ if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2)
+ {
+ *backRes = (UInt32)-1;
+ return 1;
+ }
+
+ p->opt[0].state = (CState)p->state;
+
+ posState = (position & p->pbMask);
+
+ {
+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
+ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) +
+ (!IsCharState(p->state) ?
+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) :
+ LitEnc_GetPrice(probs, curByte, p->ProbPrices));
+ }
+
+ MakeAsChar(&p->opt[1]);
+
+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
+
+ if (matchByte == curByte)
+ {
+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState);
+ if (shortRepPrice < p->opt[1].price)
+ {
+ p->opt[1].price = shortRepPrice;
+ MakeAsShortRep(&p->opt[1]);
+ }
+ }
+ lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]);
+
+ if (lenEnd < 2)
+ {
+ *backRes = p->opt[1].backPrev;
+ return 1;
+ }
+
+ p->opt[1].posPrev = 0;
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ p->opt[0].backs[i] = reps[i];
+
+ len = lenEnd;
+ do
+ p->opt[len--].price = kInfinityPrice;
+ while (len >= 2);
+
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ {
+ UInt32 repLen = repLens[i];
+ UInt32 price;
+ if (repLen < 2)
+ continue;
+ price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState);
+ do
+ {
+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2];
+ COptimal *opt = &p->opt[repLen];
+ if (curAndLenPrice < opt->price)
+ {
+ opt->price = curAndLenPrice;
+ opt->posPrev = 0;
+ opt->backPrev = i;
+ opt->prev1IsChar = False;
+ }
+ }
+ while (--repLen >= 2);
+ }
+
+ normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
+
+ len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
+ if (len <= mainLen)
+ {
+ UInt32 offs = 0;
+ while (len > matches[offs])
+ offs += 2;
+ for (; ; len++)
+ {
+ COptimal *opt;
+ UInt32 distance = matches[offs + 1];
+
+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN];
+ UInt32 lenToPosState = GetLenToPosState(len);
+ if (distance < kNumFullDistances)
+ curAndLenPrice += p->distancesPrices[lenToPosState][distance];
+ else
+ {
+ UInt32 slot;
+ GetPosSlot2(distance, slot);
+ curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot];
+ }
+ opt = &p->opt[len];
+ if (curAndLenPrice < opt->price)
+ {
+ opt->price = curAndLenPrice;
+ opt->posPrev = 0;
+ opt->backPrev = distance + LZMA_NUM_REPS;
+ opt->prev1IsChar = False;
+ }
+ if (len == matches[offs])
+ {
+ offs += 2;
+ if (offs == numPairs)
+ break;
+ }
+ }
+ }
+
+ cur = 0;
+
+#ifdef SHOW_STAT2
+ if (position >= 0)
+ {
+ unsigned i;
+ printf("\n pos = %4X", position);
+ for (i = cur; i <= lenEnd; i++)
+ printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
+ }
+#endif
+
+ for (;;)
+ {
+ UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen;
+ UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice;
+ Bool nextIsChar;
+ Byte curByte, matchByte;
+ const Byte *data;
+ COptimal *curOpt;
+ COptimal *nextOpt;
+
+ cur++;
+ if (cur == lenEnd)
+ return Backward(p, backRes, cur);
+
+ newLen = ReadMatchDistances(p, &numPairs);
+ if (newLen >= p->numFastBytes)
+ {
+ p->numPairs = numPairs;
+ p->longestMatchLength = newLen;
+ return Backward(p, backRes, cur);
+ }
+ position++;
+ curOpt = &p->opt[cur];
+ posPrev = curOpt->posPrev;
+ if (curOpt->prev1IsChar)
+ {
+ posPrev--;
+ if (curOpt->prev2)
+ {
+ state = p->opt[curOpt->posPrev2].state;
+ if (curOpt->backPrev2 < LZMA_NUM_REPS)
+ state = kRepNextStates[state];
+ else
+ state = kMatchNextStates[state];
+ }
+ else
+ state = p->opt[posPrev].state;
+ state = kLiteralNextStates[state];
+ }
+ else
+ state = p->opt[posPrev].state;
+ if (posPrev == cur - 1)
+ {
+ if (IsShortRep(curOpt))
+ state = kShortRepNextStates[state];
+ else
+ state = kLiteralNextStates[state];
+ }
+ else
+ {
+ UInt32 pos;
+ const COptimal *prevOpt;
+ if (curOpt->prev1IsChar && curOpt->prev2)
+ {
+ posPrev = curOpt->posPrev2;
+ pos = curOpt->backPrev2;
+ state = kRepNextStates[state];
+ }
+ else
+ {
+ pos = curOpt->backPrev;
+ if (pos < LZMA_NUM_REPS)
+ state = kRepNextStates[state];
+ else
+ state = kMatchNextStates[state];
+ }
+ prevOpt = &p->opt[posPrev];
+ if (pos < LZMA_NUM_REPS)
+ {
+ UInt32 i;
+ reps[0] = prevOpt->backs[pos];
+ for (i = 1; i <= pos; i++)
+ reps[i] = prevOpt->backs[i - 1];
+ for (; i < LZMA_NUM_REPS; i++)
+ reps[i] = prevOpt->backs[i];
+ }
+ else
+ {
+ UInt32 i;
+ reps[0] = (pos - LZMA_NUM_REPS);
+ for (i = 1; i < LZMA_NUM_REPS; i++)
+ reps[i] = prevOpt->backs[i - 1];
+ }
+ }
+ curOpt->state = (CState)state;
+
+ curOpt->backs[0] = reps[0];
+ curOpt->backs[1] = reps[1];
+ curOpt->backs[2] = reps[2];
+ curOpt->backs[3] = reps[3];
+
+ curPrice = curOpt->price;
+ nextIsChar = False;
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+ curByte = *data;
+ matchByte = *(data - (reps[0] + 1));
+
+ posState = (position & p->pbMask);
+
+ curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]);
+ {
+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
+ curAnd1Price +=
+ (!IsCharState(state) ?
+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) :
+ LitEnc_GetPrice(probs, curByte, p->ProbPrices));
+ }
+
+ nextOpt = &p->opt[cur + 1];
+
+ if (curAnd1Price < nextOpt->price)
+ {
+ nextOpt->price = curAnd1Price;
+ nextOpt->posPrev = cur;
+ MakeAsChar(nextOpt);
+ nextIsChar = True;
+ }
+
+ matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]);
+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
+
+ if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0))
+ {
+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState);
+ if (shortRepPrice <= nextOpt->price)
+ {
+ nextOpt->price = shortRepPrice;
+ nextOpt->posPrev = cur;
+ MakeAsShortRep(nextOpt);
+ nextIsChar = True;
+ }
+ }
+ numAvailFull = p->numAvail;
+ {
+ UInt32 temp = kNumOpts - 1 - cur;
+ if (temp < numAvailFull)
+ numAvailFull = temp;
+ }
+
+ if (numAvailFull < 2)
+ continue;
+ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes);
+
+ if (!nextIsChar && matchByte != curByte) /* speed optimization */
+ {
+ /* try Literal + rep0 */
+ UInt32 temp;
+ UInt32 lenTest2;
+ const Byte *data2 = data - (reps[0] + 1);
+ UInt32 limit = p->numFastBytes + 1;
+ if (limit > numAvailFull)
+ limit = numAvailFull;
+
+ for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++);
+ lenTest2 = temp - 1;
+ if (lenTest2 >= 2)
+ {
+ UInt32 state2 = kLiteralNextStates[state];
+ UInt32 posStateNext = (position + 1) & p->pbMask;
+ UInt32 nextRepMatchPrice = curAnd1Price +
+ GET_PRICE_1(p->isMatch[state2][posStateNext]) +
+ GET_PRICE_1(p->isRep[state2]);
+ /* for (; lenTest2 >= 2; lenTest2--) */
+ {
+ UInt32 curAndLenPrice;
+ COptimal *opt;
+ UInt32 offset = cur + 1 + lenTest2;
+ while (lenEnd < offset)
+ p->opt[++lenEnd].price = kInfinityPrice;
+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
+ opt = &p->opt[offset];
+ if (curAndLenPrice < opt->price)
+ {
+ opt->price = curAndLenPrice;
+ opt->posPrev = cur + 1;
+ opt->backPrev = 0;
+ opt->prev1IsChar = True;
+ opt->prev2 = False;
+ }
+ }
+ }
+ }
+
+ startLen = 2; /* speed optimization */
+ {
+ UInt32 repIndex;
+ for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++)
+ {
+ UInt32 lenTest;
+ UInt32 lenTestTemp;
+ UInt32 price;
+ const Byte *data2 = data - (reps[repIndex] + 1);
+ if (data[0] != data2[0] || data[1] != data2[1])
+ continue;
+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++);
+ while (lenEnd < cur + lenTest)
+ p->opt[++lenEnd].price = kInfinityPrice;
+ lenTestTemp = lenTest;
+ price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState);
+ do
+ {
+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2];
+ COptimal *opt = &p->opt[cur + lenTest];
+ if (curAndLenPrice < opt->price)
+ {
+ opt->price = curAndLenPrice;
+ opt->posPrev = cur;
+ opt->backPrev = repIndex;
+ opt->prev1IsChar = False;
+ }
+ }
+ while (--lenTest >= 2);
+ lenTest = lenTestTemp;
+
+ if (repIndex == 0)
+ startLen = lenTest + 1;
+
+ /* if (_maxMode) */
+ {
+ UInt32 lenTest2 = lenTest + 1;
+ UInt32 limit = lenTest2 + p->numFastBytes;
+ UInt32 nextRepMatchPrice;
+ if (limit > numAvailFull)
+ limit = numAvailFull;
+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
+ lenTest2 -= lenTest + 1;
+ if (lenTest2 >= 2)
+ {
+ UInt32 state2 = kRepNextStates[state];
+ UInt32 posStateNext = (position + lenTest) & p->pbMask;
+ UInt32 curAndLenCharPrice =
+ price + p->repLenEnc.prices[posState][lenTest - 2] +
+ GET_PRICE_0(p->isMatch[state2][posStateNext]) +
+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
+ data[lenTest], data2[lenTest], p->ProbPrices);
+ state2 = kLiteralNextStates[state2];
+ posStateNext = (position + lenTest + 1) & p->pbMask;
+ nextRepMatchPrice = curAndLenCharPrice +
+ GET_PRICE_1(p->isMatch[state2][posStateNext]) +
+ GET_PRICE_1(p->isRep[state2]);
+
+ /* for (; lenTest2 >= 2; lenTest2--) */
+ {
+ UInt32 curAndLenPrice;
+ COptimal *opt;
+ UInt32 offset = cur + lenTest + 1 + lenTest2;
+ while (lenEnd < offset)
+ p->opt[++lenEnd].price = kInfinityPrice;
+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
+ opt = &p->opt[offset];
+ if (curAndLenPrice < opt->price)
+ {
+ opt->price = curAndLenPrice;
+ opt->posPrev = cur + lenTest + 1;
+ opt->backPrev = 0;
+ opt->prev1IsChar = True;
+ opt->prev2 = True;
+ opt->posPrev2 = cur;
+ opt->backPrev2 = repIndex;
+ }
+ }
+ }
+ }
+ }
+ }
+ /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */
+ if (newLen > numAvail)
+ {
+ newLen = numAvail;
+ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2);
+ matches[numPairs] = newLen;
+ numPairs += 2;
+ }
+ if (newLen >= startLen)
+ {
+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);
+ UInt32 offs, curBack, posSlot;
+ UInt32 lenTest;
+ while (lenEnd < cur + newLen)
+ p->opt[++lenEnd].price = kInfinityPrice;
+
+ offs = 0;
+ while (startLen > matches[offs])
+ offs += 2;
+ curBack = matches[offs + 1];
+ GetPosSlot2(curBack, posSlot);
+ for (lenTest = /*2*/ startLen; ; lenTest++)
+ {
+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
+ UInt32 lenToPosState = GetLenToPosState(lenTest);
+ COptimal *opt;
+ if (curBack < kNumFullDistances)
+ curAndLenPrice += p->distancesPrices[lenToPosState][curBack];
+ else
+ curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask];
+
+ opt = &p->opt[cur + lenTest];
+ if (curAndLenPrice < opt->price)
+ {
+ opt->price = curAndLenPrice;
+ opt->posPrev = cur;
+ opt->backPrev = curBack + LZMA_NUM_REPS;
+ opt->prev1IsChar = False;
+ }
+
+ if (/*_maxMode && */lenTest == matches[offs])
+ {
+ /* Try Match + Literal + Rep0 */
+ const Byte *data2 = data - (curBack + 1);
+ UInt32 lenTest2 = lenTest + 1;
+ UInt32 limit = lenTest2 + p->numFastBytes;
+ UInt32 nextRepMatchPrice;
+ if (limit > numAvailFull)
+ limit = numAvailFull;
+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
+ lenTest2 -= lenTest + 1;
+ if (lenTest2 >= 2)
+ {
+ UInt32 state2 = kMatchNextStates[state];
+ UInt32 posStateNext = (position + lenTest) & p->pbMask;
+ UInt32 curAndLenCharPrice = curAndLenPrice +
+ GET_PRICE_0(p->isMatch[state2][posStateNext]) +
+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
+ data[lenTest], data2[lenTest], p->ProbPrices);
+ state2 = kLiteralNextStates[state2];
+ posStateNext = (posStateNext + 1) & p->pbMask;
+ nextRepMatchPrice = curAndLenCharPrice +
+ GET_PRICE_1(p->isMatch[state2][posStateNext]) +
+ GET_PRICE_1(p->isRep[state2]);
+
+ /* for (; lenTest2 >= 2; lenTest2--) */
+ {
+ UInt32 offset = cur + lenTest + 1 + lenTest2;
+ UInt32 curAndLenPrice;
+ COptimal *opt;
+ while (lenEnd < offset)
+ p->opt[++lenEnd].price = kInfinityPrice;
+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
+ opt = &p->opt[offset];
+ if (curAndLenPrice < opt->price)
+ {
+ opt->price = curAndLenPrice;
+ opt->posPrev = cur + lenTest + 1;
+ opt->backPrev = 0;
+ opt->prev1IsChar = True;
+ opt->prev2 = True;
+ opt->posPrev2 = cur;
+ opt->backPrev2 = curBack + LZMA_NUM_REPS;
+ }
+ }
+ }
+ offs += 2;
+ if (offs == numPairs)
+ break;
+ curBack = matches[offs + 1];
+ if (curBack >= kNumFullDistances)
+ GetPosSlot2(curBack, posSlot);
+ }
+ }
+ }
+ }
+}
+
+#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist))
+
+static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
+{
+ UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i;
+ const Byte *data;
+ const UInt32 *matches;
+
+ if (p->additionalOffset == 0)
+ mainLen = ReadMatchDistances(p, &numPairs);
+ else
+ {
+ mainLen = p->longestMatchLength;
+ numPairs = p->numPairs;
+ }
+
+ numAvail = p->numAvail;
+ *backRes = (UInt32)-1;
+ if (numAvail < 2)
+ return 1;
+ if (numAvail > LZMA_MATCH_LEN_MAX)
+ numAvail = LZMA_MATCH_LEN_MAX;
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+
+ repLen = repIndex = 0;
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ {
+ UInt32 len;
+ const Byte *data2 = data - (p->reps[i] + 1);
+ if (data[0] != data2[0] || data[1] != data2[1])
+ continue;
+ for (len = 2; len < numAvail && data[len] == data2[len]; len++);
+ if (len >= p->numFastBytes)
+ {
+ *backRes = i;
+ MovePos(p, len - 1);
+ return len;
+ }
+ if (len > repLen)
+ {
+ repIndex = i;
+ repLen = len;
+ }
+ }
+
+ matches = p->matches;
+ if (mainLen >= p->numFastBytes)
+ {
+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS;
+ MovePos(p, mainLen - 1);
+ return mainLen;
+ }
+
+ mainDist = 0; /* for GCC */
+ if (mainLen >= 2)
+ {
+ mainDist = matches[numPairs - 1];
+ while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1)
+ {
+ if (!ChangePair(matches[numPairs - 3], mainDist))
+ break;
+ numPairs -= 2;
+ mainLen = matches[numPairs - 2];
+ mainDist = matches[numPairs - 1];
+ }
+ if (mainLen == 2 && mainDist >= 0x80)
+ mainLen = 1;
+ }
+
+ if (repLen >= 2 && (
+ (repLen + 1 >= mainLen) ||
+ (repLen + 2 >= mainLen && mainDist >= (1 << 9)) ||
+ (repLen + 3 >= mainLen && mainDist >= (1 << 15))))
+ {
+ *backRes = repIndex;
+ MovePos(p, repLen - 1);
+ return repLen;
+ }
+
+ if (mainLen < 2 || numAvail <= 2)
+ return 1;
+
+ p->longestMatchLength = ReadMatchDistances(p, &p->numPairs);
+ if (p->longestMatchLength >= 2)
+ {
+ UInt32 newDistance = matches[p->numPairs - 1];
+ if ((p->longestMatchLength >= mainLen && newDistance < mainDist) ||
+ (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) ||
+ (p->longestMatchLength > mainLen + 1) ||
+ (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist)))
+ return 1;
+ }
+
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ {
+ UInt32 len, limit;
+ const Byte *data2 = data - (p->reps[i] + 1);
+ if (data[0] != data2[0] || data[1] != data2[1])
+ continue;
+ limit = mainLen - 1;
+ for (len = 2; len < limit && data[len] == data2[len]; len++);
+ if (len >= limit)
+ return 1;
+ }
+ *backRes = mainDist + LZMA_NUM_REPS;
+ MovePos(p, mainLen - 2);
+ return mainLen;
+}
+
+static void WriteEndMarker(CLzmaEnc *p, UInt32 posState)
+{
+ UInt32 len;
+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
+ p->state = kMatchNextStates[p->state];
+ len = LZMA_MATCH_LEN_MIN;
+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1);
+ RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits);
+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask);
+}
+
+static SRes CheckErrors(CLzmaEnc *p)
+{
+ if (p->result != SZ_OK)
+ return p->result;
+ if (p->rc.res != SZ_OK)
+ p->result = SZ_ERROR_WRITE;
+ if (p->matchFinderBase.result != SZ_OK)
+ p->result = SZ_ERROR_READ;
+ if (p->result != SZ_OK)
+ p->finished = True;
+ return p->result;
+}
+
+static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
+{
+ /* ReleaseMFStream(); */
+ p->finished = True;
+ if (p->writeEndMark)
+ WriteEndMarker(p, nowPos & p->pbMask);
+ RangeEnc_FlushData(&p->rc);
+ RangeEnc_FlushStream(&p->rc);
+ return CheckErrors(p);
+}
+
+static void FillAlignPrices(CLzmaEnc *p)
+{
+ UInt32 i;
+ for (i = 0; i < kAlignTableSize; i++)
+ p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices);
+ p->alignPriceCount = 0;
+}
+
+static void FillDistancesPrices(CLzmaEnc *p)
+{
+ UInt32 tempPrices[kNumFullDistances];
+ UInt32 i, lenToPosState;
+ for (i = kStartPosModelIndex; i < kNumFullDistances; i++)
+ {
+ UInt32 posSlot = GetPosSlot1(i);
+ UInt32 footerBits = ((posSlot >> 1) - 1);
+ UInt32 base = ((2 | (posSlot & 1)) << footerBits);
+ tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices);
+ }
+
+ for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++)
+ {
+ UInt32 posSlot;
+ const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState];
+ UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState];
+ for (posSlot = 0; posSlot < p->distTableSize; posSlot++)
+ posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices);
+ for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++)
+ posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits);
+
+ {
+ UInt32 *distancesPrices = p->distancesPrices[lenToPosState];
+ UInt32 i;
+ for (i = 0; i < kStartPosModelIndex; i++)
+ distancesPrices[i] = posSlotPrices[i];
+ for (; i < kNumFullDistances; i++)
+ distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i];
+ }
+ }
+ p->matchPriceCount = 0;
+}
+
+void LzmaEnc_Construct(CLzmaEnc *p)
+{
+ RangeEnc_Construct(&p->rc);
+ MatchFinder_Construct(&p->matchFinderBase);
+#ifndef _7ZIP_ST
+ MatchFinderMt_Construct(&p->matchFinderMt);
+ p->matchFinderMt.MatchFinder = &p->matchFinderBase;
+#endif
+
+ {
+ CLzmaEncProps props;
+ LzmaEncProps_Init(&props);
+ LzmaEnc_SetProps(p, &props);
+ }
+
+#ifndef LZMA_LOG_BSR
+ LzmaEnc_FastPosInit(p->g_FastPos);
+#endif
+
+ LzmaEnc_InitPriceTables(p->ProbPrices);
+ p->litProbs = 0;
+ p->saveState.litProbs = 0;
+}
+
+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc)
+{
+ void *p;
+ p = alloc->Alloc(alloc, sizeof(CLzmaEnc));
+ if (p != 0)
+ LzmaEnc_Construct((CLzmaEnc *)p);
+ return p;
+}
+
+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
+{
+ alloc->Free(alloc, p->litProbs);
+ alloc->Free(alloc, p->saveState.litProbs);
+ p->litProbs = 0;
+ p->saveState.litProbs = 0;
+}
+
+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+#ifndef _7ZIP_ST
+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
+#endif
+ MatchFinder_Free(&p->matchFinderBase, allocBig);
+ LzmaEnc_FreeLits(p, alloc);
+ RangeEnc_Free(&p->rc, alloc);
+}
+
+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
+ alloc->Free(alloc, p);
+}
+
+static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize)
+{
+ UInt32 nowPos32, startPos32;
+ if (p->needInit)
+ {
+ p->matchFinder.Init(p->matchFinderObj);
+ p->needInit = 0;
+ }
+
+ if (p->finished)
+ return p->result;
+ RINOK(CheckErrors(p));
+
+ nowPos32 = (UInt32)p->nowPos64;
+ startPos32 = nowPos32;
+
+ if (p->nowPos64 == 0)
+ {
+ UInt32 numPairs;
+ Byte curByte;
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
+ return Flush(p, nowPos32);
+ ReadMatchDistances(p, &numPairs);
+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0);
+ p->state = kLiteralNextStates[p->state];
+ curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset);
+ LitEnc_Encode(&p->rc, p->litProbs, curByte);
+ p->additionalOffset--;
+ nowPos32++;
+ }
+
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0)
+ for (;;)
+ {
+ UInt32 pos, len, posState;
+
+ if (p->fastMode)
+ len = GetOptimumFast(p, &pos);
+ else
+ len = GetOptimum(p, nowPos32, &pos);
+
+#ifdef SHOW_STAT2
+ printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos);
+#endif
+
+ posState = nowPos32 & p->pbMask;
+ if (len == 1 && pos == (UInt32)-1)
+ {
+ Byte curByte;
+ CLzmaProb *probs;
+ const Byte *data;
+
+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0);
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
+ curByte = *data;
+ probs = LIT_PROBS(nowPos32, *(data - 1));
+ if (IsCharState(p->state))
+ LitEnc_Encode(&p->rc, probs, curByte);
+ else
+ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1));
+ p->state = kLiteralNextStates[p->state];
+ }
+ else
+ {
+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
+ if (pos < LZMA_NUM_REPS)
+ {
+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1);
+ if (pos == 0)
+ {
+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0);
+ RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1));
+ }
+ else
+ {
+ UInt32 distance = p->reps[pos];
+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1);
+ if (pos == 1)
+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0);
+ else
+ {
+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1);
+ RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2);
+ if (pos == 3)
+ p->reps[3] = p->reps[2];
+ p->reps[2] = p->reps[1];
+ }
+ p->reps[1] = p->reps[0];
+ p->reps[0] = distance;
+ }
+ if (len == 1)
+ p->state = kShortRepNextStates[p->state];
+ else
+ {
+ LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
+ p->state = kRepNextStates[p->state];
+ }
+ }
+ else
+ {
+ UInt32 posSlot;
+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
+ p->state = kMatchNextStates[p->state];
+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
+ pos -= LZMA_NUM_REPS;
+ GetPosSlot(pos, posSlot);
+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
+
+ if (posSlot >= kStartPosModelIndex)
+ {
+ UInt32 footerBits = ((posSlot >> 1) - 1);
+ UInt32 base = ((2 | (posSlot & 1)) << footerBits);
+ UInt32 posReduced = pos - base;
+
+ if (posSlot < kEndPosModelIndex)
+ RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced);
+ else
+ {
+ RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits);
+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask);
+ p->alignPriceCount++;
+ }
+ }
+ p->reps[3] = p->reps[2];
+ p->reps[2] = p->reps[1];
+ p->reps[1] = p->reps[0];
+ p->reps[0] = pos;
+ p->matchPriceCount++;
+ }
+ }
+ p->additionalOffset -= len;
+ nowPos32 += len;
+ if (p->additionalOffset == 0)
+ {
+ UInt32 processed;
+ if (!p->fastMode)
+ {
+ if (p->matchPriceCount >= (1 << 7))
+ FillDistancesPrices(p);
+ if (p->alignPriceCount >= kAlignTableSize)
+ FillAlignPrices(p);
+ }
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
+ break;
+ processed = nowPos32 - startPos32;
+ if (useLimits)
+ {
+ if (processed + kNumOpts + 300 >= maxUnpackSize ||
+ RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize)
+ break;
+ }
+ else if (processed >= (1 << 15))
+ {
+ p->nowPos64 += nowPos32 - startPos32;
+ return CheckErrors(p);
+ }
+ }
+ }
+ p->nowPos64 += nowPos32 - startPos32;
+ return Flush(p, nowPos32);
+}
+
+#define kBigHashDicLimit ((UInt32)1 << 24)
+
+static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ UInt32 beforeSize = kNumOpts;
+ Bool btMode;
+ if (!RangeEnc_Alloc(&p->rc, alloc))
+ return SZ_ERROR_MEM;
+ btMode = (p->matchFinderBase.btMode != 0);
+#ifndef _7ZIP_ST
+ p->mtMode = (p->multiThread && !p->fastMode && btMode);
+#endif
+
+ {
+ unsigned lclp = p->lc + p->lp;
+ if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp)
+ {
+ LzmaEnc_FreeLits(p, alloc);
+ p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
+ p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
+ if (p->litProbs == 0 || p->saveState.litProbs == 0)
+ {
+ LzmaEnc_FreeLits(p, alloc);
+ return SZ_ERROR_MEM;
+ }
+ p->lclp = lclp;
+ }
+ }
+
+ p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit);
+
+ if (beforeSize + p->dictSize < keepWindowSize)
+ beforeSize = keepWindowSize - p->dictSize;
+
+#ifndef _7ZIP_ST
+ if (p->mtMode)
+ {
+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
+ p->matchFinderObj = &p->matchFinderMt;
+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
+ }
+ else
+#endif
+ {
+ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
+ return SZ_ERROR_MEM;
+ p->matchFinderObj = &p->matchFinderBase;
+ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder);
+ }
+ return SZ_OK;
+}
+
+void LzmaEnc_Init(CLzmaEnc *p)
+{
+ UInt32 i;
+ p->state = 0;
+ for (i = 0 ; i < LZMA_NUM_REPS; i++)
+ p->reps[i] = 0;
+
+ RangeEnc_Init(&p->rc);
+
+
+ for (i = 0; i < kNumStates; i++)
+ {
+ UInt32 j;
+ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++)
+ {
+ p->isMatch[i][j] = kProbInitValue;
+ p->isRep0Long[i][j] = kProbInitValue;
+ }
+ p->isRep[i] = kProbInitValue;
+ p->isRepG0[i] = kProbInitValue;
+ p->isRepG1[i] = kProbInitValue;
+ p->isRepG2[i] = kProbInitValue;
+ }
+
+ {
+ UInt32 num = 0x300 << (p->lp + p->lc);
+ for (i = 0; i < num; i++)
+ p->litProbs[i] = kProbInitValue;
+ }
+
+ {
+ for (i = 0; i < kNumLenToPosStates; i++)
+ {
+ CLzmaProb *probs = p->posSlotEncoder[i];
+ UInt32 j;
+ for (j = 0; j < (1 << kNumPosSlotBits); j++)
+ probs[j] = kProbInitValue;
+ }
+ }
+ {
+ for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++)
+ p->posEncoders[i] = kProbInitValue;
+ }
+
+ LenEnc_Init(&p->lenEnc.p);
+ LenEnc_Init(&p->repLenEnc.p);
+
+ for (i = 0; i < (1 << kNumAlignBits); i++)
+ p->posAlignEncoder[i] = kProbInitValue;
+
+ p->optimumEndIndex = 0;
+ p->optimumCurrentIndex = 0;
+ p->additionalOffset = 0;
+
+ p->pbMask = (1 << p->pb) - 1;
+ p->lpMask = (1 << p->lp) - 1;
+}
+
+void LzmaEnc_InitPrices(CLzmaEnc *p)
+{
+ if (!p->fastMode)
+ {
+ FillDistancesPrices(p);
+ FillAlignPrices(p);
+ }
+
+ p->lenEnc.tableSize =
+ p->repLenEnc.tableSize =
+ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN;
+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices);
+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices);
+}
+
+static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ UInt32 i;
+ for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++)
+ if (p->dictSize <= ((UInt32)1 << i))
+ break;
+ p->distTableSize = i * 2;
+
+ p->finished = False;
+ p->result = SZ_OK;
+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
+ LzmaEnc_Init(p);
+ LzmaEnc_InitPrices(p);
+ p->nowPos64 = 0;
+ return SZ_OK;
+}
+
+static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream,
+ ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ p->matchFinderBase.stream = inStream;
+ p->needInit = 1;
+ p->rc.outStream = outStream;
+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
+}
+
+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
+ ISeqInStream *inStream, UInt32 keepWindowSize,
+ ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ p->matchFinderBase.stream = inStream;
+ p->needInit = 1;
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
+}
+
+static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
+{
+ p->matchFinderBase.directInput = 1;
+ p->matchFinderBase.bufferBase = (Byte *)src;
+ p->matchFinderBase.directInputRem = srcLen;
+}
+
+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
+ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ LzmaEnc_SetInputBuf(p, src, srcLen);
+ p->needInit = 1;
+
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
+}
+
+void LzmaEnc_Finish(CLzmaEncHandle pp)
+{
+#ifndef _7ZIP_ST
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ if (p->mtMode)
+ MatchFinderMt_ReleaseStream(&p->matchFinderMt);
+#else
+ pp = pp;
+#endif
+}
+
+typedef struct
+{
+ ISeqOutStream funcTable;
+ Byte *data;
+ SizeT rem;
+ Bool overflow;
+} CSeqOutStreamBuf;
+
+static size_t MyWrite(void *pp, const void *data, size_t size)
+{
+ CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp;
+ if (p->rem < size)
+ {
+ size = p->rem;
+ p->overflow = True;
+ }
+ memcpy(p->data, data, size);
+ p->rem -= size;
+ p->data += size;
+ return size;
+}
+
+
+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
+{
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
+}
+
+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
+{
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
+}
+
+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ UInt64 nowPos64;
+ SRes res;
+ CSeqOutStreamBuf outStream;
+
+ outStream.funcTable.Write = MyWrite;
+ outStream.data = dest;
+ outStream.rem = *destLen;
+ outStream.overflow = False;
+
+ p->writeEndMark = False;
+ p->finished = False;
+ p->result = SZ_OK;
+
+ if (reInit)
+ LzmaEnc_Init(p);
+ LzmaEnc_InitPrices(p);
+ nowPos64 = p->nowPos64;
+ RangeEnc_Init(&p->rc);
+ p->rc.outStream = &outStream.funcTable;
+
+ res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize);
+
+ *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
+ *destLen -= outStream.rem;
+ if (outStream.overflow)
+ return SZ_ERROR_OUTPUT_EOF;
+
+ return res;
+}
+
+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
+{
+ SRes res = SZ_OK;
+
+#ifndef _7ZIP_ST
+ Byte allocaDummy[0x300];
+ int i = 0;
+ for (i = 0; i < 16; i++)
+ allocaDummy[i] = (Byte)i;
+#endif
+
+ for (;;)
+ {
+ res = LzmaEnc_CodeOneBlock(p, False, 0, 0);
+ if (res != SZ_OK || p->finished != 0)
+ break;
+ if (progress != 0)
+ {
+ res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc));
+ if (res != SZ_OK)
+ {
+ res = SZ_ERROR_PROGRESS;
+ break;
+ }
+ }
+ }
+ LzmaEnc_Finish(p);
+ return res;
+}
+
+SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
+ ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig));
+ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress);
+}
+
+SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ int i;
+ UInt32 dictSize = p->dictSize;
+ if (*size < LZMA_PROPS_SIZE)
+ return SZ_ERROR_PARAM;
+ *size = LZMA_PROPS_SIZE;
+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
+
+ for (i = 11; i <= 30; i++)
+ {
+ if (dictSize <= ((UInt32)2 << i))
+ {
+ dictSize = (2 << i);
+ break;
+ }
+ if (dictSize <= ((UInt32)3 << i))
+ {
+ dictSize = (3 << i);
+ break;
+ }
+ }
+
+ for (i = 0; i < 4; i++)
+ props[1 + i] = (Byte)(dictSize >> (8 * i));
+ return SZ_OK;
+}
+
+SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ SRes res;
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+
+ CSeqOutStreamBuf outStream;
+
+ LzmaEnc_SetInputBuf(p, src, srcLen);
+
+ outStream.funcTable.Write = MyWrite;
+ outStream.data = dest;
+ outStream.rem = *destLen;
+ outStream.overflow = False;
+
+ p->writeEndMark = writeEndMark;
+
+ p->rc.outStream = &outStream.funcTable;
+ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig);
+ if (res == SZ_OK)
+ res = LzmaEnc_Encode2(p, progress);
+
+ *destLen -= outStream.rem;
+ if (outStream.overflow)
+ return SZ_ERROR_OUTPUT_EOF;
+ return res;
+}
+
+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
+{
+ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
+ SRes res;
+ if (p == 0)
+ return SZ_ERROR_MEM;
+
+ res = LzmaEnc_SetProps(p, props);
+ if (res == SZ_OK)
+ {
+ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
+ if (res == SZ_OK)
+ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
+ writeEndMark, progress, alloc, allocBig);
+ }
+
+ LzmaEnc_Destroy(p, alloc, allocBig);
+ return res;
+}
--- /dev/null
+/* LzmaEnc.h -- LZMA Encoder
+2009-02-07 : Igor Pavlov : Public domain */
+
+#ifndef __LZMA_ENC_H
+#define __LZMA_ENC_H
+
+#include "Types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LZMA_PROPS_SIZE 5
+
+typedef struct _CLzmaEncProps
+{
+ int level; /* 0 <= level <= 9 */
+ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
+ (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
+ default = (1 << 24) */
+ int lc; /* 0 <= lc <= 8, default = 3 */
+ int lp; /* 0 <= lp <= 4, default = 0 */
+ int pb; /* 0 <= pb <= 4, default = 2 */
+ int algo; /* 0 - fast, 1 - normal, default = 1 */
+ int fb; /* 5 <= fb <= 273, default = 32 */
+ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
+ int numHashBytes; /* 2, 3 or 4, default = 4 */
+ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
+ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
+ int numThreads; /* 1 or 2, default = 2 */
+} CLzmaEncProps;
+
+void LzmaEncProps_Init(CLzmaEncProps *p);
+void LzmaEncProps_Normalize(CLzmaEncProps *p);
+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
+
+
+/* ---------- CLzmaEncHandle Interface ---------- */
+
+/* LzmaEnc_* functions can return the following exit codes:
+Returns:
+ SZ_OK - OK
+ SZ_ERROR_MEM - Memory allocation error
+ SZ_ERROR_PARAM - Incorrect paramater in props
+ SZ_ERROR_WRITE - Write callback error.
+ SZ_ERROR_PROGRESS - some break from progress callback
+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
+*/
+
+typedef void * CLzmaEncHandle;
+
+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
+SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
+SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
+SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
+SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
+
+/* ---------- One Call Interface ---------- */
+
+/* LzmaEncode
+Return code:
+ SZ_OK - OK
+ SZ_ERROR_MEM - Memory allocation error
+ SZ_ERROR_PARAM - Incorrect paramater
+ SZ_ERROR_OUTPUT_EOF - output buffer overflow
+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
+*/
+
+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/* Ppmd.h -- PPMD codec common code
+2010-03-12 : Igor Pavlov : Public domain
+This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
+
+#ifndef __PPMD_H
+#define __PPMD_H
+
+#include "Types.h"
+#include "CpuArch.h"
+
+EXTERN_C_BEGIN
+
+#ifdef MY_CPU_32BIT
+# define PPMD_32BIT
+#endif
+
+#define PPMD_INT_BITS 7
+#define PPMD_PERIOD_BITS 7
+#define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS))
+
+#define PPMD_GET_MEAN_SPEC(summ, shift, round) (((summ) + (1 << ((shift) - (round)))) >> (shift))
+#define PPMD_GET_MEAN(summ) PPMD_GET_MEAN_SPEC((summ), PPMD_PERIOD_BITS, 2)
+#define PPMD_UPDATE_PROB_0(prob) ((prob) + (1 << PPMD_INT_BITS) - PPMD_GET_MEAN(prob))
+#define PPMD_UPDATE_PROB_1(prob) ((prob) - PPMD_GET_MEAN(prob))
+
+#define PPMD_N1 4
+#define PPMD_N2 4
+#define PPMD_N3 4
+#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
+#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
+
+/* SEE-contexts for PPM-contexts with masked symbols */
+typedef struct
+{
+ UInt16 Summ; /* Freq */
+ Byte Shift; /* Speed of Freq change; low Shift is for fast change */
+ Byte Count; /* Count to next change of Shift */
+} CPpmd_See;
+
+#define Ppmd_See_Update(p) if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \
+ { (p)->Summ <<= 1; (p)->Count = (Byte)(3 << (p)->Shift++); }
+
+typedef struct
+{
+ Byte Symbol;
+ Byte Freq;
+ UInt16 SuccessorLow;
+ UInt16 SuccessorHigh;
+} CPpmd_State;
+
+typedef
+#ifdef PPMD_32BIT
+ CPpmd_State *
+#else
+ UInt32
+#endif
+ CPpmd_State_Ref;
+
+typedef
+#ifdef PPMD_32BIT
+ void *
+#else
+ UInt32
+#endif
+ CPpmd_Void_Ref;
+
+typedef
+#ifdef PPMD_32BIT
+ Byte *
+#else
+ UInt32
+#endif
+ CPpmd_Byte_Ref;
+
+#define PPMD_SetAllBitsIn256Bytes(p) \
+ { unsigned i; for (i = 0; i < 256 / sizeof(p[0]); i += 8) { \
+ p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }}
+
+EXTERN_C_END
+
+#endif
--- /dev/null
+/* Ppmd8.c -- PPMdI codec
+2010-03-24 : Igor Pavlov : Public domain
+This code is based on PPMd var.I (2002): Dmitry Shkarin : Public domain */
+
+#include <memory.h>
+
+#include "Ppmd8.h"
+
+const Byte PPMD8_kExpEscape[16] = { 25, 14, 9, 7, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2 };
+static const UInt16 kInitBinEsc[] = { 0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x5ABC, 0x6632, 0x6051};
+
+#define MAX_FREQ 124
+#define UNIT_SIZE 12
+
+#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
+#define U2I(nu) (p->Units2Indx[(nu) - 1])
+#define I2U(indx) (p->Indx2Units[indx])
+
+#ifdef PPMD_32BIT
+# define REF(ptr) (ptr)
+#else
+# define REF(ptr) ((UInt32)((Byte *)(ptr) - (p)->Base))
+#endif
+
+#define STATS_REF(ptr) ((CPpmd_State_Ref)REF(ptr))
+
+#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
+#define STATS(ctx) Ppmd8_GetStats(p, ctx)
+#define ONE_STATE(ctx) Ppmd8Context_OneState(ctx)
+#define SUFFIX(ctx) CTX((ctx)->Suffix)
+
+typedef CPpmd8_Context * CTX_PTR;
+
+struct CPpmd8_Node_;
+
+typedef
+# ifdef PPMD_32BIT
+ struct CPpmd8_Node_ *
+# else
+ UInt32
+# endif
+ CPpmd8_Node_Ref;
+
+typedef struct CPpmd8_Node_
+{
+ UInt32 Stamp;
+ CPpmd8_Node_Ref Next;
+ UInt32 NU;
+} CPpmd8_Node;
+
+#ifdef PPMD_32BIT
+# define NODE(ptr) (ptr)
+#else
+# define NODE(offs) ((CPpmd8_Node *)(p->Base + (offs)))
+#endif
+
+#define EMPTY_NODE 0xFFFFFFFF
+
+void Ppmd8_Construct(CPpmd8 *p)
+{
+ unsigned i, k, m;
+
+ p->Base = 0;
+
+ for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++)
+ {
+ unsigned step = (i >= 12 ? 4 : (i >> 2) + 1);
+ do { p->Units2Indx[k++] = (Byte)i; } while(--step);
+ p->Indx2Units[i] = (Byte)k;
+ }
+
+ p->NS2BSIndx[0] = (0 << 1);
+ p->NS2BSIndx[1] = (1 << 1);
+ memset(p->NS2BSIndx + 2, (2 << 1), 9);
+ memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11);
+
+ for (i = 0; i < 5; i++)
+ p->NS2Indx[i] = (Byte)i;
+ for (m = i, k = 1; i < 260; i++)
+ {
+ p->NS2Indx[i] = (Byte)m;
+ if (--k == 0)
+ k = (++m) - 4;
+ }
+}
+
+void Ppmd8_Free(CPpmd8 *p, ISzAlloc *alloc)
+{
+ alloc->Free(alloc, p->Base);
+ p->Size = 0;
+ p->Base = 0;
+}
+
+Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAlloc *alloc)
+{
+ if (p->Base == 0 || p->Size != size)
+ {
+ Ppmd8_Free(p, alloc);
+ p->AlignOffset =
+#ifdef PPMD_32BIT
+ (4 - size) & 3;
+#else
+ 4 - (size & 3);
+#endif
+ if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size)) == 0)
+ return False;
+ p->Size = size;
+ }
+ return True;
+}
+
+static void InsertNode(CPpmd8 *p, void *node, unsigned indx)
+{
+ ((CPpmd8_Node *)node)->Stamp = EMPTY_NODE;
+ ((CPpmd8_Node *)node)->Next = (CPpmd8_Node_Ref)p->FreeList[indx];
+ ((CPpmd8_Node *)node)->NU = I2U(indx);
+ p->FreeList[indx] = REF(node);
+ p->Stamps[indx]++;
+}
+
+static void *RemoveNode(CPpmd8 *p, unsigned indx)
+{
+ CPpmd8_Node *node = NODE((CPpmd8_Node_Ref)p->FreeList[indx]);
+ p->FreeList[indx] = node->Next;
+ p->Stamps[indx]--;
+ return node;
+}
+
+static void SplitBlock(CPpmd8 *p, void *ptr, unsigned oldIndx, unsigned newIndx)
+{
+ unsigned i, nu = I2U(oldIndx) - I2U(newIndx);
+ ptr = (Byte *)ptr + U2B(I2U(newIndx));
+ if (I2U(i = U2I(nu)) != nu)
+ {
+ unsigned k = I2U(--i);
+ InsertNode(p, ((Byte *)ptr) + U2B(k), nu - k - 1);
+ }
+ InsertNode(p, ptr, i);
+}
+
+static void GlueFreeBlocks(CPpmd8 *p)
+{
+ CPpmd8_Node_Ref head = 0;
+ CPpmd8_Node_Ref *prev = &head;
+ unsigned i;
+
+ p->GlueCount = 1 << 13;
+ memset(p->Stamps, 0, sizeof(p->Stamps));
+
+ /* Order-0 context is always at top UNIT, so we don't need guard NODE at the end.
+ All blocks up to p->LoUnit can be free, so we need guard NODE at LoUnit. */
+ if (p->LoUnit != p->HiUnit)
+ ((CPpmd8_Node *)p->LoUnit)->Stamp = 0;
+
+ /* Glue free blocks */
+ for (i = 0; i < PPMD_NUM_INDEXES; i++)
+ {
+ CPpmd8_Node_Ref next = (CPpmd8_Node_Ref)p->FreeList[i];
+ p->FreeList[i] = 0;
+ while (next != 0)
+ {
+ CPpmd8_Node *node = NODE(next);
+ if (node->NU != 0)
+ {
+ CPpmd8_Node *node2;
+ *prev = next;
+ prev = &(node->Next);
+ while ((node2 = node + node->NU)->Stamp == EMPTY_NODE)
+ {
+ node->NU += node2->NU;
+ node2->NU = 0;
+ }
+ }
+ next = node->Next;
+ }
+ }
+ *prev = 0;
+
+ /* Fill lists of free blocks */
+ while (head != 0)
+ {
+ CPpmd8_Node *node = NODE(head);
+ unsigned nu;
+ head = node->Next;
+ nu = node->NU;
+ if (nu == 0)
+ continue;
+ for (; nu > 128; nu -= 128, node += 128)
+ InsertNode(p, node, PPMD_NUM_INDEXES - 1);
+ if (I2U(i = U2I(nu)) != nu)
+ {
+ unsigned k = I2U(--i);
+ InsertNode(p, node + k, nu - k - 1);
+ }
+ InsertNode(p, node, i);
+ }
+}
+
+static void *AllocUnitsRare(CPpmd8 *p, unsigned indx)
+{
+ unsigned i;
+ void *retVal;
+ if (p->GlueCount == 0)
+ {
+ GlueFreeBlocks(p);
+ if (p->FreeList[indx] != 0)
+ return RemoveNode(p, indx);
+ }
+ i = indx;
+ do
+ {
+ if (++i == PPMD_NUM_INDEXES)
+ {
+ UInt32 numBytes = U2B(I2U(indx));
+ p->GlueCount--;
+ return ((UInt32)(p->UnitsStart - p->Text) > numBytes) ? (p->UnitsStart -= numBytes) : (NULL);
+ }
+ }
+ while (p->FreeList[i] == 0);
+ retVal = RemoveNode(p, i);
+ SplitBlock(p, retVal, i, indx);
+ return retVal;
+}
+
+static void *AllocUnits(CPpmd8 *p, unsigned indx)
+{
+ UInt32 numBytes;
+ if (p->FreeList[indx] != 0)
+ return RemoveNode(p, indx);
+ numBytes = U2B(I2U(indx));
+ if (numBytes <= (UInt32)(p->HiUnit - p->LoUnit))
+ {
+ void *retVal = p->LoUnit;
+ p->LoUnit += numBytes;
+ return retVal;
+ }
+ return AllocUnitsRare(p, indx);
+}
+
+#define MyMem12Cpy(dest, src, num) \
+ { UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \
+ do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while(--n); }
+
+static void *ShrinkUnits(CPpmd8 *p, void *oldPtr, unsigned oldNU, unsigned newNU)
+{
+ unsigned i0 = U2I(oldNU);
+ unsigned i1 = U2I(newNU);
+ if (i0 == i1)
+ return oldPtr;
+ if (p->FreeList[i1] != 0)
+ {
+ void *ptr = RemoveNode(p, i1);
+ MyMem12Cpy(ptr, oldPtr, newNU);
+ InsertNode(p, oldPtr, i0);
+ return ptr;
+ }
+ SplitBlock(p, oldPtr, i0, i1);
+ return oldPtr;
+}
+
+static void FreeUnits(CPpmd8 *p, void *ptr, unsigned nu)
+{
+ InsertNode(p, ptr, U2I(nu));
+}
+
+static void SpecialFreeUnit(CPpmd8 *p, void *ptr)
+{
+ if ((Byte *)ptr != p->UnitsStart)
+ InsertNode(p, ptr, 0);
+ else
+ {
+#ifdef PPMD8_FREEZE_SUPPORT
+ *(UInt32 *)ptr = EMPTY_NODE; /* it's used for (Flags == 0xFF) check in RemoveBinContexts */
+#endif
+ p->UnitsStart += UNIT_SIZE;
+ }
+}
+
+static void *MoveUnitsUp(CPpmd8 *p, void *oldPtr, unsigned nu)
+{
+ unsigned indx = U2I(nu);
+ void *ptr;
+ if ((Byte *)oldPtr > p->UnitsStart + 16 * 1024 || REF(oldPtr) > p->FreeList[indx])
+ return oldPtr;
+ ptr = RemoveNode(p, indx);
+ MyMem12Cpy(ptr, oldPtr, nu);
+ if ((Byte*)oldPtr != p->UnitsStart)
+ InsertNode(p, oldPtr, indx);
+ else
+ p->UnitsStart += U2B(I2U(indx));
+ return ptr;
+}
+
+static void ExpandTextArea(CPpmd8 *p)
+{
+ UInt32 count[PPMD_NUM_INDEXES];
+ unsigned i;
+ memset(count, 0, sizeof(count));
+ if (p->LoUnit != p->HiUnit)
+ ((CPpmd8_Node *)p->LoUnit)->Stamp = 0;
+
+ {
+ CPpmd8_Node *node = (CPpmd8_Node *)p->UnitsStart;
+ for (; node->Stamp == EMPTY_NODE; node += node->NU)
+ {
+ node->Stamp = 0;
+ count[U2I(node->NU)]++;
+ }
+ p->UnitsStart = (Byte *)node;
+ }
+
+ for (i = 0; i < PPMD_NUM_INDEXES; i++)
+ {
+ CPpmd8_Node_Ref *next = (CPpmd8_Node_Ref *)&p->FreeList[i];
+ while (count[i] != 0)
+ {
+ CPpmd8_Node *node = NODE(*next);
+ while (node->Stamp == 0)
+ {
+ *next = node->Next;
+ node = NODE(*next);
+ p->Stamps[i]--;
+ if (--count[i] == 0)
+ break;
+ }
+ next = &node->Next;
+ }
+ }
+}
+
+#define SUCCESSOR(p) ((CPpmd_Void_Ref)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16)))
+
+static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v)
+{
+ (p)->SuccessorLow = (UInt16)((UInt32)(v) & 0xFFFF);
+ (p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF);
+}
+
+#define RESET_TEXT(offs) { p->Text = p->Base + p->AlignOffset + (offs); }
+
+static void RestartModel(CPpmd8 *p)
+{
+ unsigned i, k, m, r;
+
+ memset(p->FreeList, 0, sizeof(p->FreeList));
+ memset(p->Stamps, 0, sizeof(p->Stamps));
+ RESET_TEXT(0);
+ p->HiUnit = p->Text + p->Size;
+ p->LoUnit = p->UnitsStart = p->HiUnit - p->Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE;
+ p->GlueCount = 0;
+
+ p->OrderFall = p->MaxOrder;
+ p->RunLength = p->InitRL = -(Int32)((p->MaxOrder < 12) ? p->MaxOrder : 12) - 1;
+ p->PrevSuccess = 0;
+
+ p->MinContext = p->MaxContext = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); /* AllocContext(p); */
+ p->MinContext->Suffix = 0;
+ p->MinContext->NumStats = 255;
+ p->MinContext->Flags = 0;
+ p->MinContext->SummFreq = 256 + 1;
+ p->FoundState = (CPpmd_State *)p->LoUnit; /* AllocUnits(p, PPMD_NUM_INDEXES - 1); */
+ p->LoUnit += U2B(256 / 2);
+ p->MinContext->Stats = REF(p->FoundState);
+ for (i = 0; i < 256; i++)
+ {
+ CPpmd_State *s = &p->FoundState[i];
+ s->Symbol = (Byte)i;
+ s->Freq = 1;
+ SetSuccessor(s, 0);
+ }
+
+ for (i = m = 0; m < 25; m++)
+ {
+ while (p->NS2Indx[i] == m)
+ i++;
+ for (k = 0; k < 8; k++)
+ {
+ UInt16 val = (UInt16)(PPMD_BIN_SCALE - kInitBinEsc[k] / (i + 1));
+ UInt16 *dest = p->BinSumm[m] + k;
+ for (r = 0; r < 64; r += 8)
+ dest[r] = val;
+ }
+ }
+
+ for (i = m = 0; m < 24; m++)
+ {
+ while (p->NS2Indx[i + 3] == m + 3)
+ i++;
+ for (k = 0; k < 32; k++)
+ {
+ CPpmd_See *s = &p->See[m][k];
+ s->Summ = (UInt16)((2 * i + 5) << (s->Shift = PPMD_PERIOD_BITS - 4));
+ s->Count = 7;
+ }
+ }
+}
+
+void Ppmd8_Init(CPpmd8 *p, unsigned maxOrder, unsigned restoreMethod)
+{
+ p->MaxOrder = maxOrder;
+ p->RestoreMethod = restoreMethod;
+ RestartModel(p);
+ p->DummySee.Shift = PPMD_PERIOD_BITS;
+ p->DummySee.Summ = 0; /* unused */
+ p->DummySee.Count = 64; /* unused */
+}
+
+static void Refresh(CPpmd8 *p, CTX_PTR ctx, unsigned oldNU, unsigned scale)
+{
+ unsigned i = ctx->NumStats, escFreq, sumFreq, flags;
+ CPpmd_State *s = (CPpmd_State *)ShrinkUnits(p, STATS(ctx), oldNU, (i + 2) >> 1);
+ ctx->Stats = REF(s);
+#ifdef PPMD8_FREEZE_SUPPORT
+ /* fixed over Shkarin's code. Fixed code is not compatible with original code for some files in FREEZE mode. */
+ scale |= (ctx->SummFreq >= ((UInt32)1 << 15));
+#endif
+ flags = (ctx->Flags & (0x10 + 0x04 * scale)) + 0x08 * (s->Symbol >= 0x40);
+ escFreq = ctx->SummFreq - s->Freq;
+ sumFreq = (s->Freq = (Byte)((s->Freq + scale) >> scale));
+ do
+ {
+ escFreq -= (++s)->Freq;
+ sumFreq += (s->Freq = (Byte)((s->Freq + scale) >> scale));
+ flags |= 0x08 * (s->Symbol >= 0x40);
+ }
+ while (--i);
+ ctx->SummFreq = (UInt16)(sumFreq + ((escFreq + scale) >> scale));
+ ctx->Flags = (Byte)flags;
+}
+
+static void SwapStates(CPpmd_State *t1, CPpmd_State *t2)
+{
+ CPpmd_State tmp = *t1;
+ *t1 = *t2;
+ *t2 = tmp;
+}
+
+static CPpmd_Void_Ref CutOff(CPpmd8 *p, CTX_PTR ctx, unsigned order)
+{
+ int i;
+ unsigned tmp;
+ CPpmd_State *s;
+
+ if (!ctx->NumStats)
+ {
+ s = ONE_STATE(ctx);
+ if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart)
+ {
+ if (order < p->MaxOrder)
+ SetSuccessor(s, CutOff(p, CTX(SUCCESSOR(s)), order + 1));
+ else
+ SetSuccessor(s, 0);
+ if (SUCCESSOR(s) || order <= 9) /* O_BOUND */
+ return REF(ctx);
+ }
+ SpecialFreeUnit(p, ctx);
+ return 0;
+ }
+
+ ctx->Stats = STATS_REF(MoveUnitsUp(p, STATS(ctx), tmp = ((unsigned)ctx->NumStats + 2) >> 1));
+
+ for (s = STATS(ctx) + (i = ctx->NumStats); s >= STATS(ctx); s--)
+ if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) < p->UnitsStart)
+ {
+ CPpmd_State *s2 = STATS(ctx) + (i--);
+ SetSuccessor(s, 0);
+ SwapStates(s, s2);
+ }
+ else if (order < p->MaxOrder)
+ SetSuccessor(s, CutOff(p, CTX(SUCCESSOR(s)), order + 1));
+ else
+ SetSuccessor(s, 0);
+
+ if (i != ctx->NumStats && order)
+ {
+ ctx->NumStats = (Byte)i;
+ s = STATS(ctx);
+ if (i < 0)
+ {
+ FreeUnits(p, s, tmp);
+ SpecialFreeUnit(p, ctx);
+ return 0;
+ }
+ if (i == 0)
+ {
+ ctx->Flags = (ctx->Flags & 0x10) + 0x08 * (s->Symbol >= 0x40);
+ *ONE_STATE(ctx) = *s;
+ FreeUnits(p, s, tmp);
+ ONE_STATE(ctx)->Freq = (Byte)((unsigned)ONE_STATE(ctx)->Freq + 11) >> 3;
+ }
+ else
+ Refresh(p, ctx, tmp, ctx->SummFreq > 16 * i);
+ }
+ return REF(ctx);
+}
+
+#ifdef PPMD8_FREEZE_SUPPORT
+static CPpmd_Void_Ref RemoveBinContexts(CPpmd8 *p, CTX_PTR ctx, unsigned order)
+{
+ CPpmd_State *s;
+ if (!ctx->NumStats)
+ {
+ s = ONE_STATE(ctx);
+ if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart && order < p->MaxOrder)
+ SetSuccessor(s, RemoveBinContexts(p, CTX(SUCCESSOR(s)), order + 1));
+ else
+ SetSuccessor(s, 0);
+ /* Suffix context can be removed already, since different (high-order)
+ Successors may refer to same context. So we check Flags == 0xFF (Stamp == EMPTY_NODE) */
+ if (!SUCCESSOR(s) && (!SUFFIX(ctx)->NumStats || SUFFIX(ctx)->Flags == 0xFF))
+ {
+ FreeUnits(p, ctx, 1);
+ return 0;
+ }
+ else
+ return REF(ctx);
+ }
+
+ for (s = STATS(ctx) + ctx->NumStats; s >= STATS(ctx); s--)
+ if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart && order < p->MaxOrder)
+ SetSuccessor(s, RemoveBinContexts(p, CTX(SUCCESSOR(s)), order + 1));
+ else
+ SetSuccessor(s, 0);
+
+ return REF(ctx);
+}
+#endif
+
+static UInt32 GetUsedMemory(const CPpmd8 *p)
+{
+ UInt32 v = 0;
+ unsigned i;
+ for (i = 0; i < PPMD_NUM_INDEXES; i++)
+ v += p->Stamps[i] * I2U(i);
+ return p->Size - (UInt32)(p->HiUnit - p->LoUnit) - (UInt32)(p->UnitsStart - p->Text) - U2B(v);
+}
+
+#ifdef PPMD8_FREEZE_SUPPORT
+# define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1, fSuccessor)
+#else
+# define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1)
+#endif
+
+static void RestoreModel(CPpmd8 *p, CTX_PTR c1
+#ifdef PPMD8_FREEZE_SUPPORT
+ , CTX_PTR fSuccessor
+#endif
+ )
+{
+ CTX_PTR c;
+ CPpmd_State *s;
+ RESET_TEXT(0);
+ for (c = p->MaxContext; c != c1; c = SUFFIX(c))
+ if (--(c->NumStats) == 0)
+ {
+ s = STATS(c);
+ c->Flags = (c->Flags & 0x10) + 0x08 * (s->Symbol >= 0x40);
+ *ONE_STATE(c) = *s;
+ SpecialFreeUnit(p, s);
+ ONE_STATE(c)->Freq = (ONE_STATE(c)->Freq + 11) >> 3;
+ }
+ else
+ Refresh(p, c, (c->NumStats+3) >> 1, 0);
+
+ for (; c != p->MinContext; c = SUFFIX(c))
+ if (!c->NumStats)
+ ONE_STATE(c)->Freq -= ONE_STATE(c)->Freq >> 1;
+ else if ((c->SummFreq += 4) > 128 + 4 * c->NumStats)
+ Refresh(p, c, (c->NumStats + 2) >> 1, 1);
+
+#ifdef PPMD8_FREEZE_SUPPORT
+ if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ p->MaxContext = fSuccessor;
+ p->GlueCount += !(p->Stamps[1] & 1);
+ }
+ else if (p->RestoreMethod == PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ while (p->MaxContext->Suffix)
+ p->MaxContext = SUFFIX(p->MaxContext);
+ RemoveBinContexts(p, p->MaxContext, 0);
+ p->RestoreMethod++;
+ p->GlueCount = 0;
+ p->OrderFall = p->MaxOrder;
+ }
+ else
+#endif
+ if (p->RestoreMethod == PPMD8_RESTORE_METHOD_RESTART || GetUsedMemory(p) < (p->Size >> 1))
+ RestartModel(p);
+ else
+ {
+ while (p->MaxContext->Suffix)
+ p->MaxContext = SUFFIX(p->MaxContext);
+ do
+ {
+ CutOff(p, p->MaxContext, 0);
+ ExpandTextArea(p);
+ }
+ while (GetUsedMemory(p) > 3 * (p->Size >> 2));
+ p->GlueCount = 0;
+ p->OrderFall = p->MaxOrder;
+ }
+}
+
+static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c)
+{
+ CPpmd_State upState;
+ Byte flags;
+ CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
+ /* fixed over Shkarin's code. Maybe it could work without + 1 too. */
+ CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
+ unsigned numPs = 0;
+
+ if (!skip)
+ ps[numPs++] = p->FoundState;
+
+ while (c->Suffix)
+ {
+ CPpmd_Void_Ref successor;
+ CPpmd_State *s;
+ c = SUFFIX(c);
+ if (s1)
+ {
+ s = s1;
+ s1 = NULL;
+ }
+ else if (c->NumStats != 0)
+ {
+ for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
+ if (s->Freq < MAX_FREQ - 9)
+ {
+ s->Freq++;
+ c->SummFreq++;
+ }
+ }
+ else
+ {
+ s = ONE_STATE(c);
+ s->Freq += (!SUFFIX(c)->NumStats & (s->Freq < 24));
+ }
+ successor = SUCCESSOR(s);
+ if (successor != upBranch)
+ {
+ c = CTX(successor);
+ if (numPs == 0)
+ return c;
+ break;
+ }
+ ps[numPs++] = s;
+ }
+
+ upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch);
+ SetSuccessor(&upState, upBranch + 1);
+ flags = 0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40);
+
+ if (c->NumStats == 0)
+ upState.Freq = ONE_STATE(c)->Freq;
+ else
+ {
+ UInt32 cf, s0;
+ CPpmd_State *s;
+ for (s = STATS(c); s->Symbol != upState.Symbol; s++);
+ cf = s->Freq - 1;
+ s0 = c->SummFreq - c->NumStats - cf;
+ upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0)));
+ }
+
+ do
+ {
+ /* Create Child */
+ CTX_PTR c1; /* = AllocContext(p); */
+ if (p->HiUnit != p->LoUnit)
+ c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
+ else if (p->FreeList[0] != 0)
+ c1 = (CTX_PTR)RemoveNode(p, 0);
+ else
+ {
+ c1 = (CTX_PTR)AllocUnitsRare(p, 0);
+ if (!c1)
+ return NULL;
+ }
+ c1->NumStats = 0;
+ c1->Flags = flags;
+ *ONE_STATE(c1) = upState;
+ c1->Suffix = REF(c);
+ SetSuccessor(ps[--numPs], REF(c1));
+ c = c1;
+ }
+ while (numPs != 0);
+
+ return c;
+}
+
+static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
+{
+ CPpmd_State *s = NULL;
+ CTX_PTR c1 = c;
+ CPpmd_Void_Ref upBranch = REF(p->Text);
+
+#ifdef PPMD8_FREEZE_SUPPORT
+ /* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
+ CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
+ unsigned numPs = 0;
+ ps[numPs++] = p->FoundState;
+#endif
+
+ SetSuccessor(p->FoundState, upBranch);
+ p->OrderFall++;
+
+ for (;;)
+ {
+ if (s1)
+ {
+ c = SUFFIX(c);
+ s = s1;
+ s1 = NULL;
+ }
+ else
+ {
+ if (!c->Suffix)
+ {
+#ifdef PPMD8_FREEZE_SUPPORT
+ if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
+ RESET_TEXT(1);
+ p->OrderFall = 1;
+ }
+#endif
+ return c;
+ }
+ c = SUFFIX(c);
+ if (c->NumStats)
+ {
+ if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
+ do { s++; } while (s->Symbol != p->FoundState->Symbol);
+ if (s->Freq < MAX_FREQ - 9)
+ {
+ s->Freq += 2;
+ c->SummFreq += 2;
+ }
+ }
+ else
+ {
+ s = ONE_STATE(c);
+ s->Freq += (s->Freq < 32);
+ }
+ }
+ if (SUCCESSOR(s))
+ break;
+#ifdef PPMD8_FREEZE_SUPPORT
+ ps[numPs++] = s;
+#endif
+ SetSuccessor(s, upBranch);
+ p->OrderFall++;
+ }
+
+#ifdef PPMD8_FREEZE_SUPPORT
+ if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ c = CTX(SUCCESSOR(s));
+ do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
+ RESET_TEXT(1);
+ p->OrderFall = 1;
+ return c;
+ }
+ else
+#endif
+ if (SUCCESSOR(s) <= upBranch)
+ {
+ CTX_PTR successor;
+ CPpmd_State *s1 = p->FoundState;
+ p->FoundState = s;
+
+ successor = CreateSuccessors(p, False, NULL, c);
+ if (successor == NULL)
+ SetSuccessor(s, 0);
+ else
+ SetSuccessor(s, REF(successor));
+ p->FoundState = s1;
+ }
+
+ if (p->OrderFall == 1 && c1 == p->MaxContext)
+ {
+ SetSuccessor(p->FoundState, SUCCESSOR(s));
+ p->Text--;
+ }
+ if (SUCCESSOR(s) == 0)
+ return NULL;
+ return CTX(SUCCESSOR(s));
+}
+
+static void UpdateModel(CPpmd8 *p)
+{
+ CPpmd_Void_Ref successor, fSuccessor = SUCCESSOR(p->FoundState);
+ CTX_PTR c;
+ unsigned s0, ns, fFreq = p->FoundState->Freq;
+ Byte flag, fSymbol = p->FoundState->Symbol;
+ CPpmd_State *s = NULL;
+
+ if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0)
+ {
+ c = SUFFIX(p->MinContext);
+
+ if (c->NumStats == 0)
+ {
+ s = ONE_STATE(c);
+ if (s->Freq < 32)
+ s->Freq++;
+ }
+ else
+ {
+ s = STATS(c);
+ if (s->Symbol != p->FoundState->Symbol)
+ {
+ do { s++; } while (s->Symbol != p->FoundState->Symbol);
+ if (s[0].Freq >= s[-1].Freq)
+ {
+ SwapStates(&s[0], &s[-1]);
+ s--;
+ }
+ }
+ if (s->Freq < MAX_FREQ - 9)
+ {
+ s->Freq += 2;
+ c->SummFreq += 2;
+ }
+ }
+ }
+
+ c = p->MaxContext;
+ if (p->OrderFall == 0 && fSuccessor)
+ {
+ CTX_PTR cs = CreateSuccessors(p, True, s, p->MinContext);
+ if (cs == 0)
+ {
+ SetSuccessor(p->FoundState, 0);
+ RESTORE_MODEL(c, CTX(fSuccessor));
+ }
+ else
+ {
+ SetSuccessor(p->FoundState, REF(cs));
+ p->MaxContext = cs;
+ }
+ return;
+ }
+
+ *p->Text++ = p->FoundState->Symbol;
+ successor = REF(p->Text);
+ if (p->Text >= p->UnitsStart)
+ {
+ RESTORE_MODEL(c, CTX(fSuccessor)); /* check it */
+ return;
+ }
+
+ if (!fSuccessor)
+ {
+ CTX_PTR cs = ReduceOrder(p, s, p->MinContext);
+ if (cs == NULL)
+ {
+ RESTORE_MODEL(c, 0);
+ return;
+ }
+ fSuccessor = REF(cs);
+ }
+ else if ((Byte *)Ppmd8_GetPtr(p, fSuccessor) < p->UnitsStart)
+ {
+ CTX_PTR cs = CreateSuccessors(p, False, s, p->MinContext);
+ if (cs == NULL)
+ {
+ RESTORE_MODEL(c, 0);
+ return;
+ }
+ fSuccessor = REF(cs);
+ }
+
+ if (--p->OrderFall == 0)
+ {
+ successor = fSuccessor;
+ p->Text -= (p->MaxContext != p->MinContext);
+ }
+#ifdef PPMD8_FREEZE_SUPPORT
+ else if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ successor = fSuccessor;
+ RESET_TEXT(0);
+ p->OrderFall = 0;
+ }
+#endif
+
+ s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - fFreq;
+ flag = 0x08 * (fSymbol >= 0x40);
+
+ for (; c != p->MinContext; c = SUFFIX(c))
+ {
+ unsigned ns1;
+ UInt32 cf, sf;
+ if ((ns1 = c->NumStats) != 0)
+ {
+ if ((ns1 & 1) != 0)
+ {
+ /* Expand for one UNIT */
+ unsigned oldNU = (ns1 + 1) >> 1;
+ unsigned i = U2I(oldNU);
+ if (i != U2I(oldNU + 1))
+ {
+ void *ptr = AllocUnits(p, i + 1);
+ void *oldPtr;
+ if (!ptr)
+ {
+ RESTORE_MODEL(c, CTX(fSuccessor));
+ return;
+ }
+ oldPtr = STATS(c);
+ MyMem12Cpy(ptr, oldPtr, oldNU);
+ InsertNode(p, oldPtr, i);
+ c->Stats = STATS_REF(ptr);
+ }
+ }
+ c->SummFreq = (UInt16)(c->SummFreq + (3 * ns1 + 1 < ns));
+ }
+ else
+ {
+ CPpmd_State *s = (CPpmd_State*)AllocUnits(p, 0);
+ if (!s)
+ {
+ RESTORE_MODEL(c, CTX(fSuccessor));
+ return;
+ }
+ *s = *ONE_STATE(c);
+ c->Stats = REF(s);
+ if (s->Freq < MAX_FREQ / 4 - 1)
+ s->Freq <<= 1;
+ else
+ s->Freq = MAX_FREQ - 4;
+ c->SummFreq = (UInt16)(s->Freq + p->InitEsc + (ns > 2));
+ }
+ cf = 2 * fFreq * (c->SummFreq + 6);
+ sf = (UInt32)s0 + c->SummFreq;
+ if (cf < 6 * sf)
+ {
+ cf = 1 + (cf > sf) + (cf >= 4 * sf);
+ c->SummFreq += 4;
+ }
+ else
+ {
+ cf = 4 + (cf > 9 * sf) + (cf > 12 * sf) + (cf > 15 * sf);
+ c->SummFreq = (UInt16)(c->SummFreq + cf);
+ }
+ {
+ CPpmd_State *s = STATS(c) + ns1 + 1;
+ SetSuccessor(s, successor);
+ s->Symbol = fSymbol;
+ s->Freq = (Byte)cf;
+ c->Flags |= flag;
+ c->NumStats = (Byte)(ns1 + 1);
+ }
+ }
+ p->MaxContext = p->MinContext = CTX(fSuccessor);
+}
+
+static void Rescale(CPpmd8 *p)
+{
+ unsigned i, adder, sumFreq, escFreq;
+ CPpmd_State *stats = STATS(p->MinContext);
+ CPpmd_State *s = p->FoundState;
+ {
+ CPpmd_State tmp = *s;
+ for (; s != stats; s--)
+ s[0] = s[-1];
+ *s = tmp;
+ }
+ escFreq = p->MinContext->SummFreq - s->Freq;
+ s->Freq += 4;
+ adder = (p->OrderFall != 0
+#ifdef PPMD8_FREEZE_SUPPORT
+ || p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE
+#endif
+ );
+ s->Freq = (Byte)((s->Freq + adder) >> 1);
+ sumFreq = s->Freq;
+
+ i = p->MinContext->NumStats;
+ do
+ {
+ escFreq -= (++s)->Freq;
+ s->Freq = (Byte)((s->Freq + adder) >> 1);
+ sumFreq += s->Freq;
+ if (s[0].Freq > s[-1].Freq)
+ {
+ CPpmd_State *s1 = s;
+ CPpmd_State tmp = *s1;
+ do
+ s1[0] = s1[-1];
+ while (--s1 != stats && tmp.Freq > s1[-1].Freq);
+ *s1 = tmp;
+ }
+ }
+ while (--i);
+
+ if (s->Freq == 0)
+ {
+ unsigned numStats = p->MinContext->NumStats;
+ unsigned n0, n1;
+ do { i++; } while ((--s)->Freq == 0);
+ escFreq += i;
+ p->MinContext->NumStats = (Byte)(p->MinContext->NumStats - i);
+ if (p->MinContext->NumStats == 0)
+ {
+ CPpmd_State tmp = *stats;
+ tmp.Freq = (Byte)((2 * tmp.Freq + escFreq - 1) / escFreq);
+ if (tmp.Freq > MAX_FREQ / 3)
+ tmp.Freq = MAX_FREQ / 3;
+ InsertNode(p, stats, U2I((numStats + 2) >> 1));
+ p->MinContext->Flags = (p->MinContext->Flags & 0x10) + 0x08 * (tmp.Symbol >= 0x40);
+ *(p->FoundState = ONE_STATE(p->MinContext)) = tmp;
+ return;
+ }
+ n0 = (numStats + 2) >> 1;
+ n1 = (p->MinContext->NumStats + 2) >> 1;
+ if (n0 != n1)
+ p->MinContext->Stats = STATS_REF(ShrinkUnits(p, stats, n0, n1));
+ p->MinContext->Flags &= ~0x08;
+ p->MinContext->Flags |= 0x08 * ((s = STATS(p->MinContext))->Symbol >= 0x40);
+ i = p->MinContext->NumStats;
+ do { p->MinContext->Flags |= 0x08*((++s)->Symbol >= 0x40); } while (--i);
+ }
+ p->MinContext->SummFreq = (UInt16)(sumFreq + escFreq - (escFreq >> 1));
+ p->MinContext->Flags |= 0x4;
+ p->FoundState = STATS(p->MinContext);
+}
+
+CPpmd_See *Ppmd8_MakeEscFreq(CPpmd8 *p, unsigned numMasked1, UInt32 *escFreq)
+{
+ CPpmd_See *see;
+ if (p->MinContext->NumStats != 0xFF)
+ {
+ see = p->See[p->NS2Indx[p->MinContext->NumStats + 2] - 3] +
+ (p->MinContext->SummFreq > 11 * ((unsigned)p->MinContext->NumStats + 1)) +
+ 2 * (2 * (unsigned)p->MinContext->NumStats <
+ ((unsigned)SUFFIX(p->MinContext)->NumStats + numMasked1)) +
+ p->MinContext->Flags;
+ {
+ unsigned r = (see->Summ >> see->Shift);
+ see->Summ = (UInt16)(see->Summ - r);
+ *escFreq = r + (r == 0);
+ }
+ }
+ else
+ {
+ see = &p->DummySee;
+ *escFreq = 1;
+ }
+ return see;
+}
+
+static void NextContext(CPpmd8 *p)
+{
+ CTX_PTR c = CTX(SUCCESSOR(p->FoundState));
+ if (p->OrderFall == 0 && (Byte *)c >= p->UnitsStart)
+ p->MinContext = p->MaxContext = c;
+ else
+ {
+ UpdateModel(p);
+ p->MinContext = p->MaxContext;
+ }
+}
+
+void Ppmd8_Update1(CPpmd8 *p)
+{
+ CPpmd_State *s = p->FoundState;
+ s->Freq += 4;
+ p->MinContext->SummFreq += 4;
+ if (s[0].Freq > s[-1].Freq)
+ {
+ SwapStates(&s[0], &s[-1]);
+ p->FoundState = --s;
+ if (s->Freq > MAX_FREQ)
+ Rescale(p);
+ }
+ NextContext(p);
+}
+
+void Ppmd8_Update1_0(CPpmd8 *p)
+{
+ p->PrevSuccess = (2 * p->FoundState->Freq >= p->MinContext->SummFreq);
+ p->RunLength += p->PrevSuccess;
+ p->MinContext->SummFreq += 4;
+ if ((p->FoundState->Freq += 4) > MAX_FREQ)
+ Rescale(p);
+ NextContext(p);
+}
+
+void Ppmd8_UpdateBin(CPpmd8 *p)
+{
+ p->FoundState->Freq = (Byte)(p->FoundState->Freq + (p->FoundState->Freq < 196));
+ p->PrevSuccess = 1;
+ p->RunLength++;
+ NextContext(p);
+}
+
+void Ppmd8_Update2(CPpmd8 *p)
+{
+ p->MinContext->SummFreq += 4;
+ if ((p->FoundState->Freq += 4) > MAX_FREQ)
+ Rescale(p);
+ p->RunLength = p->InitRL;
+ UpdateModel(p);
+ p->MinContext = p->MaxContext;
+}
+
+/* H->I changes:
+ NS2Indx
+ GlewCount, and Glue method
+ BinSum
+ See / EscFreq
+ CreateSuccessors updates more suffix contexts
+ UpdateModel consts.
+ PrevSuccess Update
+*/
--- /dev/null
+/* Ppmd8.h -- PPMdI codec
+2010-03-24 : Igor Pavlov : Public domain
+This code is based on:
+ PPMd var.I (2002): Dmitry Shkarin : Public domain
+ Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
+
+#ifndef __PPMD8_H
+#define __PPMD8_H
+
+#include "Ppmd.h"
+
+EXTERN_C_BEGIN
+
+#define PPMD8_MIN_ORDER 2
+#define PPMD8_MAX_ORDER 16
+
+struct CPpmd8_Context_;
+
+typedef
+#ifdef PPMD_32BIT
+ struct CPpmd8_Context_ *
+#else
+ UInt32
+#endif
+ CPpmd8_Context_Ref;
+
+typedef struct CPpmd8_Context_
+{
+ Byte NumStats;
+ Byte Flags;
+ UInt16 SummFreq;
+ CPpmd_State_Ref Stats;
+ CPpmd8_Context_Ref Suffix;
+} CPpmd8_Context;
+
+#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq)
+
+/* The BUG in Shkarin's code for FREEZE mode was fixed, but that fixed
+ code is not compatible with original code for some files compressed
+ in FREEZE mode. So we disable FREEZE mode support. */
+
+enum
+{
+ PPMD8_RESTORE_METHOD_RESTART,
+ PPMD8_RESTORE_METHOD_CUT_OFF
+#ifdef PPMD8_FREEZE_SUPPORT
+ , PPMD8_RESTORE_METHOD_FREEZE
+#endif
+};
+
+typedef struct
+{
+ CPpmd8_Context *MinContext, *MaxContext;
+ CPpmd_State *FoundState;
+ unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder;
+ Int32 RunLength, InitRL; /* must be 32-bit at least */
+
+ UInt32 Size;
+ UInt32 GlueCount;
+ Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart;
+ UInt32 AlignOffset;
+ unsigned RestoreMethod;
+
+ /* Range Coder */
+ UInt32 Range;
+ UInt32 Code;
+ UInt32 Low;
+ union
+ {
+ IByteIn *In;
+ IByteOut *Out;
+ } Stream;
+
+ Byte Indx2Units[PPMD_NUM_INDEXES];
+ Byte Units2Indx[128];
+ CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES];
+ UInt32 Stamps[PPMD_NUM_INDEXES];
+
+ Byte NS2BSIndx[256], NS2Indx[260];
+ CPpmd_See DummySee, See[24][32];
+ UInt16 BinSumm[25][64];
+} CPpmd8;
+
+void Ppmd8_Construct(CPpmd8 *p);
+Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAlloc *alloc);
+void Ppmd8_Free(CPpmd8 *p, ISzAlloc *alloc);
+void Ppmd8_Init(CPpmd8 *p, unsigned maxOrder, unsigned restoreMethod);
+#define Ppmd8_WasAllocated(p) ((p)->Base != NULL)
+
+
+/* ---------- Internal Functions ---------- */
+
+extern const Byte PPMD8_kExpEscape[16];
+
+#ifdef PPMD_32BIT
+# define Ppmd8_GetPtr(p, ptr) (ptr)
+# define Ppmd8_GetContext(p, ptr) (ptr)
+# define Ppmd8_GetStats(p, ctx) ((ctx)->Stats)
+#else
+# define Ppmd8_GetPtr(p, offs) ((void *)((p)->Base + (offs)))
+# define Ppmd8_GetContext(p, offs) ((CPpmd8_Context *)Ppmd8_GetPtr((p), (offs)))
+# define Ppmd8_GetStats(p, ctx) ((CPpmd_State *)Ppmd8_GetPtr((p), ((ctx)->Stats)))
+#endif
+
+void Ppmd8_Update1(CPpmd8 *p);
+void Ppmd8_Update1_0(CPpmd8 *p);
+void Ppmd8_Update2(CPpmd8 *p);
+void Ppmd8_UpdateBin(CPpmd8 *p);
+
+#define Ppmd8_GetBinSumm(p) \
+ &p->BinSumm[p->NS2Indx[Ppmd8Context_OneState(p->MinContext)->Freq - 1]][ \
+ p->NS2BSIndx[Ppmd8_GetContext(p, p->MinContext->Suffix)->NumStats] + \
+ p->PrevSuccess + p->MinContext->Flags + ((p->RunLength >> 26) & 0x20)]
+
+CPpmd_See *Ppmd8_MakeEscFreq(CPpmd8 *p, unsigned numMasked, UInt32 *scale);
+
+
+/* ---------- Decode ---------- */
+
+Bool Ppmd8_RangeDec_Init(CPpmd8 *p);
+#define Ppmd8_RangeDec_IsFinishedOK(p) ((p)->Code == 0)
+int Ppmd8_DecodeSymbol(CPpmd8 *p); /* returns: -1 as EndMarker, -2 as DataError */
+
+
+/* ---------- Encode ---------- */
+
+#define Ppmd8_RangeEnc_Init(p) { (p)->Low = 0; (p)->Range = 0xFFFFFFFF; }
+void Ppmd8_RangeEnc_FlushData(CPpmd8 *p);
+void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol); /* symbol = -1 means EndMarker */
+
+EXTERN_C_END
+
+#endif
--- /dev/null
+/* Ppmd8Dec.c -- PPMdI Decoder
+2010-04-16 : Igor Pavlov : Public domain
+This code is based on:
+ PPMd var.I (2002): Dmitry Shkarin : Public domain
+ Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
+
+#include "Ppmd8.h"
+
+#define kTop (1 << 24)
+#define kBot (1 << 15)
+
+Bool Ppmd8_RangeDec_Init(CPpmd8 *p)
+{
+ unsigned i;
+ p->Low = 0;
+ p->Range = 0xFFFFFFFF;
+ p->Code = 0;
+ for (i = 0; i < 4; i++)
+ p->Code = (p->Code << 8) | p->Stream.In->Read(p->Stream.In);
+ return (p->Code < 0xFFFFFFFF);
+}
+
+static UInt32 RangeDec_GetThreshold(CPpmd8 *p, UInt32 total)
+{
+ return p->Code / (p->Range /= total);
+}
+
+static void RangeDec_Decode(CPpmd8 *p, UInt32 start, UInt32 size)
+{
+ start *= p->Range;
+ p->Low += start;
+ p->Code -= start;
+ p->Range *= size;
+
+ while ((p->Low ^ (p->Low + p->Range)) < kTop ||
+ (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1)))
+ {
+ p->Code = (p->Code << 8) | p->Stream.In->Read(p->Stream.In);
+ p->Range <<= 8;
+ p->Low <<= 8;
+ }
+}
+
+/* 2012-04-10 SMS for Info-ZIP.
+ * Old compilers which don't like "signed char" must have a signed
+ * "char" type. Originally:
+ * #define MASK(sym) ((signed char *)charMask)[sym]
+ */
+#ifdef NO_SIGNED_CHAR
+# define MASK(sym) ((char *)charMask)[sym]
+#else
+# define MASK(sym) ((signed char *)charMask)[sym]
+#endif
+
+int Ppmd8_DecodeSymbol(CPpmd8 *p)
+{
+ size_t charMask[256 / sizeof(size_t)];
+ if (p->MinContext->NumStats != 0)
+ {
+ CPpmd_State *s = Ppmd8_GetStats(p, p->MinContext);
+ unsigned i;
+ UInt32 count, hiCnt;
+ if ((count = RangeDec_GetThreshold(p, p->MinContext->SummFreq)) < (hiCnt = s->Freq))
+ {
+ Byte symbol;
+ RangeDec_Decode(p, 0, s->Freq);
+ p->FoundState = s;
+ symbol = s->Symbol;
+ Ppmd8_Update1_0(p);
+ return symbol;
+ }
+ p->PrevSuccess = 0;
+ i = p->MinContext->NumStats;
+ do
+ {
+ if ((hiCnt += (++s)->Freq) > count)
+ {
+ Byte symbol;
+ RangeDec_Decode(p, hiCnt - s->Freq, s->Freq);
+ p->FoundState = s;
+ symbol = s->Symbol;
+ Ppmd8_Update1(p);
+ return symbol;
+ }
+ }
+ while (--i);
+ if (count >= p->MinContext->SummFreq)
+ return -2;
+ RangeDec_Decode(p, hiCnt, p->MinContext->SummFreq - hiCnt);
+ PPMD_SetAllBitsIn256Bytes(charMask);
+ MASK(s->Symbol) = 0;
+ i = p->MinContext->NumStats;
+ do { MASK((--s)->Symbol) = 0; } while (--i);
+ }
+ else
+ {
+ UInt16 *prob = Ppmd8_GetBinSumm(p);
+ if (((p->Code / (p->Range >>= 14)) < *prob))
+ {
+ Byte symbol;
+ RangeDec_Decode(p, 0, *prob);
+ *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob);
+ symbol = (p->FoundState = Ppmd8Context_OneState(p->MinContext))->Symbol;
+ Ppmd8_UpdateBin(p);
+ return symbol;
+ }
+ RangeDec_Decode(p, *prob, (1 << 14) - *prob);
+ *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob);
+ p->InitEsc = PPMD8_kExpEscape[*prob >> 10];
+ PPMD_SetAllBitsIn256Bytes(charMask);
+ MASK(Ppmd8Context_OneState(p->MinContext)->Symbol) = 0;
+ p->PrevSuccess = 0;
+ }
+ for (;;)
+ {
+ CPpmd_State *ps[256], *s;
+ UInt32 freqSum, count, hiCnt;
+ CPpmd_See *see;
+ unsigned i, num, numMasked = p->MinContext->NumStats;
+ do
+ {
+ p->OrderFall++;
+ if (!p->MinContext->Suffix)
+ return -1;
+ p->MinContext = Ppmd8_GetContext(p, p->MinContext->Suffix);
+ }
+ while (p->MinContext->NumStats == numMasked);
+ hiCnt = 0;
+ s = Ppmd8_GetStats(p, p->MinContext);
+ i = 0;
+ num = p->MinContext->NumStats - numMasked;
+ do
+ {
+ int k = (int)(MASK(s->Symbol));
+ hiCnt += (s->Freq & k);
+ ps[i] = s++;
+ i -= k;
+ }
+ while (i != num);
+
+ see = Ppmd8_MakeEscFreq(p, numMasked, &freqSum);
+ freqSum += hiCnt;
+ count = RangeDec_GetThreshold(p, freqSum);
+
+ if (count < hiCnt)
+ {
+ Byte symbol;
+ CPpmd_State **pps = ps;
+ for (hiCnt = 0; (hiCnt += (*pps)->Freq) <= count; pps++);
+ s = *pps;
+ RangeDec_Decode(p, hiCnt - s->Freq, s->Freq);
+ Ppmd_See_Update(see);
+ p->FoundState = s;
+ symbol = s->Symbol;
+ Ppmd8_Update2(p);
+ return symbol;
+ }
+ if (count >= freqSum)
+ return -2;
+ RangeDec_Decode(p, hiCnt, freqSum - hiCnt);
+ see->Summ = (UInt16)(see->Summ + freqSum);
+ do { MASK(ps[--i]->Symbol) = 0; } while (i != 0);
+ }
+}
--- /dev/null
+/* Ppmd8Enc.c -- PPMdI Encoder
+2010-04-16 : Igor Pavlov : Public domain
+This code is based on:
+ PPMd var.I (2002): Dmitry Shkarin : Public domain
+ Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
+
+#include "Ppmd8.h"
+
+#define kTop (1 << 24)
+#define kBot (1 << 15)
+
+void Ppmd8_RangeEnc_FlushData(CPpmd8 *p)
+{
+ unsigned i;
+ for (i = 0; i < 4; i++, p->Low <<= 8 )
+ p->Stream.Out->Write(p->Stream.Out, (Byte)(p->Low >> 24));
+}
+
+static void RangeEnc_Normalize(CPpmd8 *p)
+{
+ while ((p->Low ^ (p->Low + p->Range)) < kTop ||
+ (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1)))
+ {
+ p->Stream.Out->Write(p->Stream.Out, (Byte)(p->Low >> 24));
+ p->Range <<= 8;
+ p->Low <<= 8;
+ }
+}
+
+static void RangeEnc_Encode(CPpmd8 *p, UInt32 start, UInt32 size, UInt32 total)
+{
+ p->Low += start * (p->Range /= total);
+ p->Range *= size;
+ RangeEnc_Normalize(p);
+}
+
+static void RangeEnc_EncodeBit_0(CPpmd8 *p, UInt32 size0)
+{
+ p->Range >>= 14;
+ p->Range *= size0;
+ RangeEnc_Normalize(p);
+}
+
+static void RangeEnc_EncodeBit_1(CPpmd8 *p, UInt32 size0)
+{
+ p->Low += size0 * (p->Range >>= 14);
+ p->Range *= ((1 << 14) - size0);
+ RangeEnc_Normalize(p);
+}
+
+/* 2012-04-10 SMS for Info-ZIP.
+ * Old compilers which don't like "signed char" must have a signed
+ * "char" type. Originally:
+ * #define MASK(sym) ((signed char *)charMask)[sym]
+ */
+#ifdef NO_SIGNED_CHAR
+# define MASK(sym) ((char *)charMask)[sym]
+#else
+# define MASK(sym) ((signed char *)charMask)[sym]
+#endif
+
+void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol)
+{
+ size_t charMask[256 / sizeof(size_t)];
+ if (p->MinContext->NumStats != 0)
+ {
+ CPpmd_State *s = Ppmd8_GetStats(p, p->MinContext);
+ UInt32 sum;
+ unsigned i;
+ if (s->Symbol == symbol)
+ {
+ RangeEnc_Encode(p, 0, s->Freq, p->MinContext->SummFreq);
+ p->FoundState = s;
+ Ppmd8_Update1_0(p);
+ return;
+ }
+ p->PrevSuccess = 0;
+ sum = s->Freq;
+ i = p->MinContext->NumStats;
+ do
+ {
+ if ((++s)->Symbol == symbol)
+ {
+ RangeEnc_Encode(p, sum, s->Freq, p->MinContext->SummFreq);
+ p->FoundState = s;
+ Ppmd8_Update1(p);
+ return;
+ }
+ sum += s->Freq;
+ }
+ while (--i);
+
+ PPMD_SetAllBitsIn256Bytes(charMask);
+ MASK(s->Symbol) = 0;
+ i = p->MinContext->NumStats;
+ do { MASK((--s)->Symbol) = 0; } while (--i);
+ RangeEnc_Encode(p, sum, p->MinContext->SummFreq - sum, p->MinContext->SummFreq);
+ }
+ else
+ {
+ UInt16 *prob = Ppmd8_GetBinSumm(p);
+ CPpmd_State *s = Ppmd8Context_OneState(p->MinContext);
+ if (s->Symbol == symbol)
+ {
+ RangeEnc_EncodeBit_0(p, *prob);
+ *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob);
+ p->FoundState = s;
+ Ppmd8_UpdateBin(p);
+ return;
+ }
+ else
+ {
+ RangeEnc_EncodeBit_1(p, *prob);
+ *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob);
+ p->InitEsc = PPMD8_kExpEscape[*prob >> 10];
+ PPMD_SetAllBitsIn256Bytes(charMask);
+ MASK(s->Symbol) = 0;
+ p->PrevSuccess = 0;
+ }
+ }
+ for (;;)
+ {
+ UInt32 escFreq;
+ CPpmd_See *see;
+ CPpmd_State *s;
+ UInt32 sum;
+ unsigned i, numMasked = p->MinContext->NumStats;
+ do
+ {
+ p->OrderFall++;
+ if (!p->MinContext->Suffix)
+ return; /* EndMarker (symbol = -1) */
+ p->MinContext = Ppmd8_GetContext(p, p->MinContext->Suffix);
+ }
+ while (p->MinContext->NumStats == numMasked);
+
+ see = Ppmd8_MakeEscFreq(p, numMasked, &escFreq);
+ s = Ppmd8_GetStats(p, p->MinContext);
+ sum = 0;
+ i = p->MinContext->NumStats + 1;
+ do
+ {
+ int cur = s->Symbol;
+ if (cur == symbol)
+ {
+ UInt32 low = sum;
+ CPpmd_State *s1 = s;
+ do
+ {
+ sum += (s->Freq & (int)(MASK(s->Symbol)));
+ s++;
+ }
+ while (--i);
+ RangeEnc_Encode(p, low, s1->Freq, sum + escFreq);
+ Ppmd_See_Update(see);
+ p->FoundState = s1;
+ Ppmd8_Update2(p);
+ return;
+ }
+ sum += (s->Freq & (int)(MASK(cur)));
+ MASK(cur) = 0;
+ s++;
+ }
+ while (--i);
+
+ RangeEnc_Encode(p, sum, escFreq, sum + escFreq);
+ see->Summ = (UInt16)(see->Summ + sum + escFreq);
+ }
+}
--- /dev/null
+ README_SZIP.txt
+ ---------------
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Description
+ -----------
+
+ The Info-ZIP programs UnZip (version 6.1 and later) and Zip (version
+3.1 and later) offer optional support for LZMA compression (method 14)
+and PPMd compression (method 98). The PKWARE, Inc. APPNOTE describes
+the LZMA method as an Early Feature Specification, hence subject to
+change.
+
+ http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+
+ Our LZMA implementation uses public-domain code from the LZMA
+Software Development Kit (SDK) provided by Igor Pavlov:
+
+ http://www.7-zip.org/sdk.html
+
+Only a small subset of the LZMA SDK is used by (and provided with) the
+Info-ZIP programs, in an "szip/" subdirectory.
+
+ Our PPMd implementation uses additional public-domain code from the
+p7zip project:
+
+ http://p7zip.sourceforge.net/
+ http://sourceforge.net/projects/p7zip/
+
+The PPMd-related files (also in the "szip/" subdirectory) are:
+
+ From the LZMA SDK:
+ szip/Ppmd.h
+
+ From the p7zip (version 9.20.1) kit:
+ szip/Ppmd8.c
+ szip/Ppmd8.h
+ szip/Ppmd8Dec.c
+ szip/Ppmd8Enc.c
+
+ Minor changes were made to various files to improve portability.
+Indentation was changed to keep "#" in column one. Some global names
+longer than 31 characters were shortened for VMS. The use of "signed
+char" was made conditional. "7zVersion.h" was renamed to "SzVersion.h"
+to accommodate some IBM operating systems. Originals of the changed
+files may be found in the "szip/orig/" directory.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Building UnZip and Zip with LZMA and/or PPMd Compression Support
+ ----------------------------------------------------------------
+
+ The build instructions (in the file INSTALL or an OS-specific
+INSTALL supplement, in the UnZip and Zip source kits) describe how to
+build UnZip and Zip with support for LZMA and/or PPMd compression.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Acknowledgement
+ ---------------
+
+ We're grateful to Igor Pavlov for providing the LZMA and PPMd
+compression code, and to Dmitry Shkarin for the p7zip material. Any
+problems involving LZMA or PPMd compression in Info-ZIP programs should
+be reported to the Info-ZIP team, not to Mr. Pavlov or Mr. Shkarin.
+However, any questions on LZMA or PPMd compression algorithms, or
+regarding the original LZMA SDK or PPMd code (except as we modified and
+use it) should be addressed to the original authors.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Document Revision History
+ -------------------------
+
+ 2011-08-14 New. LZMA SDK version 9.20. (SMS)
+
+ 2011-12-24 Added PPMd from p7zip version 9.20.1. (SMS)
+
+ 2011-12-24 Removed references to 7zFile.[ch], SzFile.[ch]. (SMS)
+
+ 2012-04-21 Renamed "lzma/" directory to "szip/". (SMS)
+
--- /dev/null
+/* 2011-08-14 SMS for Info-ZIP.
+ * Rename 7z*.* to Sz*.*, for IBM compatibility.
+ */
+
+#define MY_VER_MAJOR 9
+#define MY_VER_MINOR 20
+#define MY_VER_BUILD 0
+#define MY_VERSION "9.20"
+#define MY_DATE "2010-11-18"
+#define MY_COPYRIGHT ": Igor Pavlov : Public domain"
+#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE
--- /dev/null
+/* Types.h -- Basic types
+2010-10-09 : Igor Pavlov : Public domain */
+
+#ifndef __7Z_TYPES_H
+#define __7Z_TYPES_H
+
+#include <stddef.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#ifndef EXTERN_C_BEGIN
+#ifdef __cplusplus
+#define EXTERN_C_BEGIN extern "C" {
+#define EXTERN_C_END }
+#else
+#define EXTERN_C_BEGIN
+#define EXTERN_C_END
+#endif
+#endif
+
+EXTERN_C_BEGIN
+
+#define SZ_OK 0
+
+#define SZ_ERROR_DATA 1
+#define SZ_ERROR_MEM 2
+#define SZ_ERROR_CRC 3
+#define SZ_ERROR_UNSUPPORTED 4
+#define SZ_ERROR_PARAM 5
+#define SZ_ERROR_INPUT_EOF 6
+#define SZ_ERROR_OUTPUT_EOF 7
+#define SZ_ERROR_READ 8
+#define SZ_ERROR_WRITE 9
+#define SZ_ERROR_PROGRESS 10
+#define SZ_ERROR_FAIL 11
+#define SZ_ERROR_THREAD 12
+
+#define SZ_ERROR_ARCHIVE 16
+#define SZ_ERROR_NO_ARCHIVE 17
+
+typedef int SRes;
+
+#ifdef _WIN32
+typedef DWORD WRes;
+#else
+typedef int WRes;
+#endif
+
+#ifndef RINOK
+#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
+#endif
+
+/* ================================================================== */
+
+/* 2011-09-15 SMS for Info-ZIP.
+ * Avoid conflict with (equivalent) zlib declaration of Byte.
+ */
+#ifndef ZLIB_H
+typedef unsigned char Byte;
+#endif
+
+/* 2012-03-20 EG, SMS for Info-ZIP.
+ * We need _7ZIP_ST for LzmaEnc.c (for Zip), and it's easier to define
+ * it here than in all the builders.
+ */
+#ifndef _7ZIP_ST
+# define _7ZIP_ST
+#endif
+
+/* ================================================================== */
+
+typedef short Int16;
+typedef unsigned short UInt16;
+
+#ifdef _LZMA_UINT32_IS_ULONG
+typedef long Int32;
+typedef unsigned long UInt32;
+#else
+typedef int Int32;
+typedef unsigned int UInt32;
+#endif
+
+#ifdef _SZ_NO_INT_64
+
+/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
+ NOTES: Some code will work incorrectly in that case! */
+
+typedef long Int64;
+typedef unsigned long UInt64;
+
+#else
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+typedef __int64 Int64;
+typedef unsigned __int64 UInt64;
+#define UINT64_CONST(n) n
+#else
+typedef long long int Int64;
+typedef unsigned long long int UInt64;
+#define UINT64_CONST(n) n ## ULL
+#endif
+
+#endif
+
+#ifdef _LZMA_NO_SYSTEM_SIZE_T
+typedef UInt32 SizeT;
+#else
+typedef size_t SizeT;
+#endif
+
+typedef int Bool;
+#define True 1
+#define False 0
+
+
+#ifdef _WIN32
+#define MY_STD_CALL __stdcall
+#else
+#define MY_STD_CALL
+#endif
+
+#ifdef _MSC_VER
+
+#if _MSC_VER >= 1300
+#define MY_NO_INLINE __declspec(noinline)
+#else
+#define MY_NO_INLINE
+#endif
+
+#define MY_CDECL __cdecl
+#define MY_FAST_CALL __fastcall
+
+#else
+
+#define MY_CDECL
+#define MY_FAST_CALL
+
+#endif
+
+
+/* The following interfaces use first parameter as pointer to structure */
+
+typedef struct
+{
+ Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */
+} IByteIn;
+
+typedef struct
+{
+ void (*Write)(void *p, Byte b);
+} IByteOut;
+
+typedef struct
+{
+ SRes (*Read)(void *p, void *buf, size_t *size);
+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
+ (output(*size) < input(*size)) is allowed */
+} ISeqInStream;
+
+/* it can return SZ_ERROR_INPUT_EOF */
+SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
+SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
+SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
+
+typedef struct
+{
+ size_t (*Write)(void *p, const void *buf, size_t size);
+ /* Returns: result - the number of actually written bytes.
+ (result < size) means error */
+} ISeqOutStream;
+
+typedef enum
+{
+ SZ_SEEK_SET = 0,
+ SZ_SEEK_CUR = 1,
+ SZ_SEEK_END = 2
+} ESzSeek;
+
+typedef struct
+{
+ SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
+} ISeekInStream;
+
+typedef struct
+{
+ SRes (*Look)(void *p, const void **buf, size_t *size);
+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
+ (output(*size) > input(*size)) is not allowed
+ (output(*size) < input(*size)) is allowed */
+ SRes (*Skip)(void *p, size_t offset);
+ /* offset must be <= output(*size) of Look */
+
+ SRes (*Read)(void *p, void *buf, size_t *size);
+ /* reads directly (without buffer). It's same as ISeqInStream::Read */
+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
+} ILookInStream;
+
+SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
+SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
+
+/* reads via ILookInStream::Read */
+SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
+SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
+
+#define LookToRead_BUF_SIZE (1 << 14)
+
+typedef struct
+{
+ ILookInStream s;
+ ISeekInStream *realStream;
+ size_t pos;
+ size_t size;
+ Byte buf[LookToRead_BUF_SIZE];
+} CLookToRead;
+
+void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
+void LookToRead_Init(CLookToRead *p);
+
+typedef struct
+{
+ ISeqInStream s;
+ ILookInStream *realStream;
+} CSecToLook;
+
+void SecToLook_CreateVTable(CSecToLook *p);
+
+typedef struct
+{
+ ISeqInStream s;
+ ILookInStream *realStream;
+} CSecToRead;
+
+void SecToRead_CreateVTable(CSecToRead *p);
+
+typedef struct
+{
+ SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
+ /* Returns: result. (result != SZ_OK) means break.
+ Value (UInt64)(Int64)-1 for size means unknown value. */
+} ICompressProgress;
+
+typedef struct
+{
+ void *(*Alloc)(void *p, size_t size);
+ void (*Free)(void *p, void *address); /* address can be 0 */
+} ISzAlloc;
+
+#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
+#define IAlloc_Free(p, a) (p)->Free((p), a)
+
+#ifdef _WIN32
+
+#define CHAR_PATH_SEPARATOR '\\'
+#define WCHAR_PATH_SEPARATOR L'\\'
+#define STRING_PATH_SEPARATOR "\\"
+#define WSTRING_PATH_SEPARATOR L"\\"
+
+#else
+
+#define CHAR_PATH_SEPARATOR '/'
+#define WCHAR_PATH_SEPARATOR L'/'
+#define STRING_PATH_SEPARATOR "/"
+#define WSTRING_PATH_SEPARATOR L"/"
+
+#endif
+
+EXTERN_C_END
+
+#endif
--- /dev/null
+#define MY_VER_MAJOR 9
+#define MY_VER_MINOR 20
+#define MY_VER_BUILD 0
+#define MY_VERSION "9.20"
+#define MY_DATE "2010-11-18"
+#define MY_COPYRIGHT ": Igor Pavlov : Public domain"
+#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE
--- /dev/null
+/* LzFind.h -- Match finder for LZ algorithms
+2009-04-22 : Igor Pavlov : Public domain */
+
+#ifndef __LZ_FIND_H
+#define __LZ_FIND_H
+
+#include "Types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef UInt32 CLzRef;
+
+typedef struct _CMatchFinder
+{
+ Byte *buffer;
+ UInt32 pos;
+ UInt32 posLimit;
+ UInt32 streamPos;
+ UInt32 lenLimit;
+
+ UInt32 cyclicBufferPos;
+ UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
+
+ UInt32 matchMaxLen;
+ CLzRef *hash;
+ CLzRef *son;
+ UInt32 hashMask;
+ UInt32 cutValue;
+
+ Byte *bufferBase;
+ ISeqInStream *stream;
+ int streamEndWasReached;
+
+ UInt32 blockSize;
+ UInt32 keepSizeBefore;
+ UInt32 keepSizeAfter;
+
+ UInt32 numHashBytes;
+ int directInput;
+ size_t directInputRem;
+ int btMode;
+ int bigHash;
+ UInt32 historySize;
+ UInt32 fixedHashSize;
+ UInt32 hashSizeSum;
+ UInt32 numSons;
+ SRes result;
+ UInt32 crc[256];
+} CMatchFinder;
+
+#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
+#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
+
+#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
+
+int MatchFinder_NeedMove(CMatchFinder *p);
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
+void MatchFinder_MoveBlock(CMatchFinder *p);
+void MatchFinder_ReadIfRequired(CMatchFinder *p);
+
+void MatchFinder_Construct(CMatchFinder *p);
+
+/* Conditions:
+ historySize <= 3 GB
+ keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
+*/
+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+ ISzAlloc *alloc);
+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
+
+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
+ UInt32 *distances, UInt32 maxLen);
+
+/*
+Conditions:
+ Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
+ Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
+*/
+
+typedef void (*Mf_Init_Func)(void *object);
+typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
+typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
+typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
+typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
+typedef void (*Mf_Skip_Func)(void *object, UInt32);
+
+typedef struct _IMatchFinder
+{
+ Mf_Init_Func Init;
+ Mf_GetIndexByte_Func GetIndexByte;
+ Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
+ Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
+ Mf_GetMatches_Func GetMatches;
+ Mf_Skip_Func Skip;
+} IMatchFinder;
+
+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
+
+void MatchFinder_Init(CMatchFinder *p);
+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/* Ppmd.h -- PPMD codec common code
+2010-03-12 : Igor Pavlov : Public domain
+This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
+
+#ifndef __PPMD_H
+#define __PPMD_H
+
+#include "Types.h"
+#include "CpuArch.h"
+
+EXTERN_C_BEGIN
+
+#ifdef MY_CPU_32BIT
+ #define PPMD_32BIT
+#endif
+
+#define PPMD_INT_BITS 7
+#define PPMD_PERIOD_BITS 7
+#define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS))
+
+#define PPMD_GET_MEAN_SPEC(summ, shift, round) (((summ) + (1 << ((shift) - (round)))) >> (shift))
+#define PPMD_GET_MEAN(summ) PPMD_GET_MEAN_SPEC((summ), PPMD_PERIOD_BITS, 2)
+#define PPMD_UPDATE_PROB_0(prob) ((prob) + (1 << PPMD_INT_BITS) - PPMD_GET_MEAN(prob))
+#define PPMD_UPDATE_PROB_1(prob) ((prob) - PPMD_GET_MEAN(prob))
+
+#define PPMD_N1 4
+#define PPMD_N2 4
+#define PPMD_N3 4
+#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
+#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
+
+/* SEE-contexts for PPM-contexts with masked symbols */
+typedef struct
+{
+ UInt16 Summ; /* Freq */
+ Byte Shift; /* Speed of Freq change; low Shift is for fast change */
+ Byte Count; /* Count to next change of Shift */
+} CPpmd_See;
+
+#define Ppmd_See_Update(p) if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \
+ { (p)->Summ <<= 1; (p)->Count = (Byte)(3 << (p)->Shift++); }
+
+typedef struct
+{
+ Byte Symbol;
+ Byte Freq;
+ UInt16 SuccessorLow;
+ UInt16 SuccessorHigh;
+} CPpmd_State;
+
+typedef
+ #ifdef PPMD_32BIT
+ CPpmd_State *
+ #else
+ UInt32
+ #endif
+ CPpmd_State_Ref;
+
+typedef
+ #ifdef PPMD_32BIT
+ void *
+ #else
+ UInt32
+ #endif
+ CPpmd_Void_Ref;
+
+typedef
+ #ifdef PPMD_32BIT
+ Byte *
+ #else
+ UInt32
+ #endif
+ CPpmd_Byte_Ref;
+
+#define PPMD_SetAllBitsIn256Bytes(p) \
+ { unsigned i; for (i = 0; i < 256 / sizeof(p[0]); i += 8) { \
+ p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }}
+
+EXTERN_C_END
+
+#endif
--- /dev/null
+/* Ppmd8.c -- PPMdI codec
+2010-03-24 : Igor Pavlov : Public domain
+This code is based on PPMd var.I (2002): Dmitry Shkarin : Public domain */
+
+#include <memory.h>
+
+#include "Ppmd8.h"
+
+const Byte PPMD8_kExpEscape[16] = { 25, 14, 9, 7, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2 };
+static const UInt16 kInitBinEsc[] = { 0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x5ABC, 0x6632, 0x6051};
+
+#define MAX_FREQ 124
+#define UNIT_SIZE 12
+
+#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
+#define U2I(nu) (p->Units2Indx[(nu) - 1])
+#define I2U(indx) (p->Indx2Units[indx])
+
+#ifdef PPMD_32BIT
+ #define REF(ptr) (ptr)
+#else
+ #define REF(ptr) ((UInt32)((Byte *)(ptr) - (p)->Base))
+#endif
+
+#define STATS_REF(ptr) ((CPpmd_State_Ref)REF(ptr))
+
+#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
+#define STATS(ctx) Ppmd8_GetStats(p, ctx)
+#define ONE_STATE(ctx) Ppmd8Context_OneState(ctx)
+#define SUFFIX(ctx) CTX((ctx)->Suffix)
+
+typedef CPpmd8_Context * CTX_PTR;
+
+struct CPpmd8_Node_;
+
+typedef
+ #ifdef PPMD_32BIT
+ struct CPpmd8_Node_ *
+ #else
+ UInt32
+ #endif
+ CPpmd8_Node_Ref;
+
+typedef struct CPpmd8_Node_
+{
+ UInt32 Stamp;
+ CPpmd8_Node_Ref Next;
+ UInt32 NU;
+} CPpmd8_Node;
+
+#ifdef PPMD_32BIT
+ #define NODE(ptr) (ptr)
+#else
+ #define NODE(offs) ((CPpmd8_Node *)(p->Base + (offs)))
+#endif
+
+#define EMPTY_NODE 0xFFFFFFFF
+
+void Ppmd8_Construct(CPpmd8 *p)
+{
+ unsigned i, k, m;
+
+ p->Base = 0;
+
+ for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++)
+ {
+ unsigned step = (i >= 12 ? 4 : (i >> 2) + 1);
+ do { p->Units2Indx[k++] = (Byte)i; } while(--step);
+ p->Indx2Units[i] = (Byte)k;
+ }
+
+ p->NS2BSIndx[0] = (0 << 1);
+ p->NS2BSIndx[1] = (1 << 1);
+ memset(p->NS2BSIndx + 2, (2 << 1), 9);
+ memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11);
+
+ for (i = 0; i < 5; i++)
+ p->NS2Indx[i] = (Byte)i;
+ for (m = i, k = 1; i < 260; i++)
+ {
+ p->NS2Indx[i] = (Byte)m;
+ if (--k == 0)
+ k = (++m) - 4;
+ }
+}
+
+void Ppmd8_Free(CPpmd8 *p, ISzAlloc *alloc)
+{
+ alloc->Free(alloc, p->Base);
+ p->Size = 0;
+ p->Base = 0;
+}
+
+Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAlloc *alloc)
+{
+ if (p->Base == 0 || p->Size != size)
+ {
+ Ppmd8_Free(p, alloc);
+ p->AlignOffset =
+ #ifdef PPMD_32BIT
+ (4 - size) & 3;
+ #else
+ 4 - (size & 3);
+ #endif
+ if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size)) == 0)
+ return False;
+ p->Size = size;
+ }
+ return True;
+}
+
+static void InsertNode(CPpmd8 *p, void *node, unsigned indx)
+{
+ ((CPpmd8_Node *)node)->Stamp = EMPTY_NODE;
+ ((CPpmd8_Node *)node)->Next = (CPpmd8_Node_Ref)p->FreeList[indx];
+ ((CPpmd8_Node *)node)->NU = I2U(indx);
+ p->FreeList[indx] = REF(node);
+ p->Stamps[indx]++;
+}
+
+static void *RemoveNode(CPpmd8 *p, unsigned indx)
+{
+ CPpmd8_Node *node = NODE((CPpmd8_Node_Ref)p->FreeList[indx]);
+ p->FreeList[indx] = node->Next;
+ p->Stamps[indx]--;
+ return node;
+}
+
+static void SplitBlock(CPpmd8 *p, void *ptr, unsigned oldIndx, unsigned newIndx)
+{
+ unsigned i, nu = I2U(oldIndx) - I2U(newIndx);
+ ptr = (Byte *)ptr + U2B(I2U(newIndx));
+ if (I2U(i = U2I(nu)) != nu)
+ {
+ unsigned k = I2U(--i);
+ InsertNode(p, ((Byte *)ptr) + U2B(k), nu - k - 1);
+ }
+ InsertNode(p, ptr, i);
+}
+
+static void GlueFreeBlocks(CPpmd8 *p)
+{
+ CPpmd8_Node_Ref head = 0;
+ CPpmd8_Node_Ref *prev = &head;
+ unsigned i;
+
+ p->GlueCount = 1 << 13;
+ memset(p->Stamps, 0, sizeof(p->Stamps));
+
+ /* Order-0 context is always at top UNIT, so we don't need guard NODE at the end.
+ All blocks up to p->LoUnit can be free, so we need guard NODE at LoUnit. */
+ if (p->LoUnit != p->HiUnit)
+ ((CPpmd8_Node *)p->LoUnit)->Stamp = 0;
+
+ /* Glue free blocks */
+ for (i = 0; i < PPMD_NUM_INDEXES; i++)
+ {
+ CPpmd8_Node_Ref next = (CPpmd8_Node_Ref)p->FreeList[i];
+ p->FreeList[i] = 0;
+ while (next != 0)
+ {
+ CPpmd8_Node *node = NODE(next);
+ if (node->NU != 0)
+ {
+ CPpmd8_Node *node2;
+ *prev = next;
+ prev = &(node->Next);
+ while ((node2 = node + node->NU)->Stamp == EMPTY_NODE)
+ {
+ node->NU += node2->NU;
+ node2->NU = 0;
+ }
+ }
+ next = node->Next;
+ }
+ }
+ *prev = 0;
+
+ /* Fill lists of free blocks */
+ while (head != 0)
+ {
+ CPpmd8_Node *node = NODE(head);
+ unsigned nu;
+ head = node->Next;
+ nu = node->NU;
+ if (nu == 0)
+ continue;
+ for (; nu > 128; nu -= 128, node += 128)
+ InsertNode(p, node, PPMD_NUM_INDEXES - 1);
+ if (I2U(i = U2I(nu)) != nu)
+ {
+ unsigned k = I2U(--i);
+ InsertNode(p, node + k, nu - k - 1);
+ }
+ InsertNode(p, node, i);
+ }
+}
+
+static void *AllocUnitsRare(CPpmd8 *p, unsigned indx)
+{
+ unsigned i;
+ void *retVal;
+ if (p->GlueCount == 0)
+ {
+ GlueFreeBlocks(p);
+ if (p->FreeList[indx] != 0)
+ return RemoveNode(p, indx);
+ }
+ i = indx;
+ do
+ {
+ if (++i == PPMD_NUM_INDEXES)
+ {
+ UInt32 numBytes = U2B(I2U(indx));
+ p->GlueCount--;
+ return ((UInt32)(p->UnitsStart - p->Text) > numBytes) ? (p->UnitsStart -= numBytes) : (NULL);
+ }
+ }
+ while (p->FreeList[i] == 0);
+ retVal = RemoveNode(p, i);
+ SplitBlock(p, retVal, i, indx);
+ return retVal;
+}
+
+static void *AllocUnits(CPpmd8 *p, unsigned indx)
+{
+ UInt32 numBytes;
+ if (p->FreeList[indx] != 0)
+ return RemoveNode(p, indx);
+ numBytes = U2B(I2U(indx));
+ if (numBytes <= (UInt32)(p->HiUnit - p->LoUnit))
+ {
+ void *retVal = p->LoUnit;
+ p->LoUnit += numBytes;
+ return retVal;
+ }
+ return AllocUnitsRare(p, indx);
+}
+
+#define MyMem12Cpy(dest, src, num) \
+ { UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \
+ do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while(--n); }
+
+static void *ShrinkUnits(CPpmd8 *p, void *oldPtr, unsigned oldNU, unsigned newNU)
+{
+ unsigned i0 = U2I(oldNU);
+ unsigned i1 = U2I(newNU);
+ if (i0 == i1)
+ return oldPtr;
+ if (p->FreeList[i1] != 0)
+ {
+ void *ptr = RemoveNode(p, i1);
+ MyMem12Cpy(ptr, oldPtr, newNU);
+ InsertNode(p, oldPtr, i0);
+ return ptr;
+ }
+ SplitBlock(p, oldPtr, i0, i1);
+ return oldPtr;
+}
+
+static void FreeUnits(CPpmd8 *p, void *ptr, unsigned nu)
+{
+ InsertNode(p, ptr, U2I(nu));
+}
+
+static void SpecialFreeUnit(CPpmd8 *p, void *ptr)
+{
+ if ((Byte *)ptr != p->UnitsStart)
+ InsertNode(p, ptr, 0);
+ else
+ {
+ #ifdef PPMD8_FREEZE_SUPPORT
+ *(UInt32 *)ptr = EMPTY_NODE; /* it's used for (Flags == 0xFF) check in RemoveBinContexts */
+ #endif
+ p->UnitsStart += UNIT_SIZE;
+ }
+}
+
+static void *MoveUnitsUp(CPpmd8 *p, void *oldPtr, unsigned nu)
+{
+ unsigned indx = U2I(nu);
+ void *ptr;
+ if ((Byte *)oldPtr > p->UnitsStart + 16 * 1024 || REF(oldPtr) > p->FreeList[indx])
+ return oldPtr;
+ ptr = RemoveNode(p, indx);
+ MyMem12Cpy(ptr, oldPtr, nu);
+ if ((Byte*)oldPtr != p->UnitsStart)
+ InsertNode(p, oldPtr, indx);
+ else
+ p->UnitsStart += U2B(I2U(indx));
+ return ptr;
+}
+
+static void ExpandTextArea(CPpmd8 *p)
+{
+ UInt32 count[PPMD_NUM_INDEXES];
+ unsigned i;
+ memset(count, 0, sizeof(count));
+ if (p->LoUnit != p->HiUnit)
+ ((CPpmd8_Node *)p->LoUnit)->Stamp = 0;
+
+ {
+ CPpmd8_Node *node = (CPpmd8_Node *)p->UnitsStart;
+ for (; node->Stamp == EMPTY_NODE; node += node->NU)
+ {
+ node->Stamp = 0;
+ count[U2I(node->NU)]++;
+ }
+ p->UnitsStart = (Byte *)node;
+ }
+
+ for (i = 0; i < PPMD_NUM_INDEXES; i++)
+ {
+ CPpmd8_Node_Ref *next = (CPpmd8_Node_Ref *)&p->FreeList[i];
+ while (count[i] != 0)
+ {
+ CPpmd8_Node *node = NODE(*next);
+ while (node->Stamp == 0)
+ {
+ *next = node->Next;
+ node = NODE(*next);
+ p->Stamps[i]--;
+ if (--count[i] == 0)
+ break;
+ }
+ next = &node->Next;
+ }
+ }
+}
+
+#define SUCCESSOR(p) ((CPpmd_Void_Ref)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16)))
+
+static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v)
+{
+ (p)->SuccessorLow = (UInt16)((UInt32)(v) & 0xFFFF);
+ (p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF);
+}
+
+#define RESET_TEXT(offs) { p->Text = p->Base + p->AlignOffset + (offs); }
+
+static void RestartModel(CPpmd8 *p)
+{
+ unsigned i, k, m, r;
+
+ memset(p->FreeList, 0, sizeof(p->FreeList));
+ memset(p->Stamps, 0, sizeof(p->Stamps));
+ RESET_TEXT(0);
+ p->HiUnit = p->Text + p->Size;
+ p->LoUnit = p->UnitsStart = p->HiUnit - p->Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE;
+ p->GlueCount = 0;
+
+ p->OrderFall = p->MaxOrder;
+ p->RunLength = p->InitRL = -(Int32)((p->MaxOrder < 12) ? p->MaxOrder : 12) - 1;
+ p->PrevSuccess = 0;
+
+ p->MinContext = p->MaxContext = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); /* AllocContext(p); */
+ p->MinContext->Suffix = 0;
+ p->MinContext->NumStats = 255;
+ p->MinContext->Flags = 0;
+ p->MinContext->SummFreq = 256 + 1;
+ p->FoundState = (CPpmd_State *)p->LoUnit; /* AllocUnits(p, PPMD_NUM_INDEXES - 1); */
+ p->LoUnit += U2B(256 / 2);
+ p->MinContext->Stats = REF(p->FoundState);
+ for (i = 0; i < 256; i++)
+ {
+ CPpmd_State *s = &p->FoundState[i];
+ s->Symbol = (Byte)i;
+ s->Freq = 1;
+ SetSuccessor(s, 0);
+ }
+
+ for (i = m = 0; m < 25; m++)
+ {
+ while (p->NS2Indx[i] == m)
+ i++;
+ for (k = 0; k < 8; k++)
+ {
+ UInt16 val = (UInt16)(PPMD_BIN_SCALE - kInitBinEsc[k] / (i + 1));
+ UInt16 *dest = p->BinSumm[m] + k;
+ for (r = 0; r < 64; r += 8)
+ dest[r] = val;
+ }
+ }
+
+ for (i = m = 0; m < 24; m++)
+ {
+ while (p->NS2Indx[i + 3] == m + 3)
+ i++;
+ for (k = 0; k < 32; k++)
+ {
+ CPpmd_See *s = &p->See[m][k];
+ s->Summ = (UInt16)((2 * i + 5) << (s->Shift = PPMD_PERIOD_BITS - 4));
+ s->Count = 7;
+ }
+ }
+}
+
+void Ppmd8_Init(CPpmd8 *p, unsigned maxOrder, unsigned restoreMethod)
+{
+ p->MaxOrder = maxOrder;
+ p->RestoreMethod = restoreMethod;
+ RestartModel(p);
+ p->DummySee.Shift = PPMD_PERIOD_BITS;
+ p->DummySee.Summ = 0; /* unused */
+ p->DummySee.Count = 64; /* unused */
+}
+
+static void Refresh(CPpmd8 *p, CTX_PTR ctx, unsigned oldNU, unsigned scale)
+{
+ unsigned i = ctx->NumStats, escFreq, sumFreq, flags;
+ CPpmd_State *s = (CPpmd_State *)ShrinkUnits(p, STATS(ctx), oldNU, (i + 2) >> 1);
+ ctx->Stats = REF(s);
+ #ifdef PPMD8_FREEZE_SUPPORT
+ /* fixed over Shkarin's code. Fixed code is not compatible with original code for some files in FREEZE mode. */
+ scale |= (ctx->SummFreq >= ((UInt32)1 << 15));
+ #endif
+ flags = (ctx->Flags & (0x10 + 0x04 * scale)) + 0x08 * (s->Symbol >= 0x40);
+ escFreq = ctx->SummFreq - s->Freq;
+ sumFreq = (s->Freq = (Byte)((s->Freq + scale) >> scale));
+ do
+ {
+ escFreq -= (++s)->Freq;
+ sumFreq += (s->Freq = (Byte)((s->Freq + scale) >> scale));
+ flags |= 0x08 * (s->Symbol >= 0x40);
+ }
+ while (--i);
+ ctx->SummFreq = (UInt16)(sumFreq + ((escFreq + scale) >> scale));
+ ctx->Flags = (Byte)flags;
+}
+
+static void SwapStates(CPpmd_State *t1, CPpmd_State *t2)
+{
+ CPpmd_State tmp = *t1;
+ *t1 = *t2;
+ *t2 = tmp;
+}
+
+static CPpmd_Void_Ref CutOff(CPpmd8 *p, CTX_PTR ctx, unsigned order)
+{
+ int i;
+ unsigned tmp;
+ CPpmd_State *s;
+
+ if (!ctx->NumStats)
+ {
+ s = ONE_STATE(ctx);
+ if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart)
+ {
+ if (order < p->MaxOrder)
+ SetSuccessor(s, CutOff(p, CTX(SUCCESSOR(s)), order + 1));
+ else
+ SetSuccessor(s, 0);
+ if (SUCCESSOR(s) || order <= 9) /* O_BOUND */
+ return REF(ctx);
+ }
+ SpecialFreeUnit(p, ctx);
+ return 0;
+ }
+
+ ctx->Stats = STATS_REF(MoveUnitsUp(p, STATS(ctx), tmp = ((unsigned)ctx->NumStats + 2) >> 1));
+
+ for (s = STATS(ctx) + (i = ctx->NumStats); s >= STATS(ctx); s--)
+ if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) < p->UnitsStart)
+ {
+ CPpmd_State *s2 = STATS(ctx) + (i--);
+ SetSuccessor(s, 0);
+ SwapStates(s, s2);
+ }
+ else if (order < p->MaxOrder)
+ SetSuccessor(s, CutOff(p, CTX(SUCCESSOR(s)), order + 1));
+ else
+ SetSuccessor(s, 0);
+
+ if (i != ctx->NumStats && order)
+ {
+ ctx->NumStats = (Byte)i;
+ s = STATS(ctx);
+ if (i < 0)
+ {
+ FreeUnits(p, s, tmp);
+ SpecialFreeUnit(p, ctx);
+ return 0;
+ }
+ if (i == 0)
+ {
+ ctx->Flags = (ctx->Flags & 0x10) + 0x08 * (s->Symbol >= 0x40);
+ *ONE_STATE(ctx) = *s;
+ FreeUnits(p, s, tmp);
+ ONE_STATE(ctx)->Freq = (Byte)((unsigned)ONE_STATE(ctx)->Freq + 11) >> 3;
+ }
+ else
+ Refresh(p, ctx, tmp, ctx->SummFreq > 16 * i);
+ }
+ return REF(ctx);
+}
+
+#ifdef PPMD8_FREEZE_SUPPORT
+static CPpmd_Void_Ref RemoveBinContexts(CPpmd8 *p, CTX_PTR ctx, unsigned order)
+{
+ CPpmd_State *s;
+ if (!ctx->NumStats)
+ {
+ s = ONE_STATE(ctx);
+ if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart && order < p->MaxOrder)
+ SetSuccessor(s, RemoveBinContexts(p, CTX(SUCCESSOR(s)), order + 1));
+ else
+ SetSuccessor(s, 0);
+ /* Suffix context can be removed already, since different (high-order)
+ Successors may refer to same context. So we check Flags == 0xFF (Stamp == EMPTY_NODE) */
+ if (!SUCCESSOR(s) && (!SUFFIX(ctx)->NumStats || SUFFIX(ctx)->Flags == 0xFF))
+ {
+ FreeUnits(p, ctx, 1);
+ return 0;
+ }
+ else
+ return REF(ctx);
+ }
+
+ for (s = STATS(ctx) + ctx->NumStats; s >= STATS(ctx); s--)
+ if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart && order < p->MaxOrder)
+ SetSuccessor(s, RemoveBinContexts(p, CTX(SUCCESSOR(s)), order + 1));
+ else
+ SetSuccessor(s, 0);
+
+ return REF(ctx);
+}
+#endif
+
+static UInt32 GetUsedMemory(const CPpmd8 *p)
+{
+ UInt32 v = 0;
+ unsigned i;
+ for (i = 0; i < PPMD_NUM_INDEXES; i++)
+ v += p->Stamps[i] * I2U(i);
+ return p->Size - (UInt32)(p->HiUnit - p->LoUnit) - (UInt32)(p->UnitsStart - p->Text) - U2B(v);
+}
+
+#ifdef PPMD8_FREEZE_SUPPORT
+ #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1, fSuccessor)
+#else
+ #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1)
+#endif
+
+static void RestoreModel(CPpmd8 *p, CTX_PTR c1
+ #ifdef PPMD8_FREEZE_SUPPORT
+ , CTX_PTR fSuccessor
+ #endif
+ )
+{
+ CTX_PTR c;
+ CPpmd_State *s;
+ RESET_TEXT(0);
+ for (c = p->MaxContext; c != c1; c = SUFFIX(c))
+ if (--(c->NumStats) == 0)
+ {
+ s = STATS(c);
+ c->Flags = (c->Flags & 0x10) + 0x08 * (s->Symbol >= 0x40);
+ *ONE_STATE(c) = *s;
+ SpecialFreeUnit(p, s);
+ ONE_STATE(c)->Freq = (ONE_STATE(c)->Freq + 11) >> 3;
+ }
+ else
+ Refresh(p, c, (c->NumStats+3) >> 1, 0);
+
+ for (; c != p->MinContext; c = SUFFIX(c))
+ if (!c->NumStats)
+ ONE_STATE(c)->Freq -= ONE_STATE(c)->Freq >> 1;
+ else if ((c->SummFreq += 4) > 128 + 4 * c->NumStats)
+ Refresh(p, c, (c->NumStats + 2) >> 1, 1);
+
+ #ifdef PPMD8_FREEZE_SUPPORT
+ if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ p->MaxContext = fSuccessor;
+ p->GlueCount += !(p->Stamps[1] & 1);
+ }
+ else if (p->RestoreMethod == PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ while (p->MaxContext->Suffix)
+ p->MaxContext = SUFFIX(p->MaxContext);
+ RemoveBinContexts(p, p->MaxContext, 0);
+ p->RestoreMethod++;
+ p->GlueCount = 0;
+ p->OrderFall = p->MaxOrder;
+ }
+ else
+ #endif
+ if (p->RestoreMethod == PPMD8_RESTORE_METHOD_RESTART || GetUsedMemory(p) < (p->Size >> 1))
+ RestartModel(p);
+ else
+ {
+ while (p->MaxContext->Suffix)
+ p->MaxContext = SUFFIX(p->MaxContext);
+ do
+ {
+ CutOff(p, p->MaxContext, 0);
+ ExpandTextArea(p);
+ }
+ while (GetUsedMemory(p) > 3 * (p->Size >> 2));
+ p->GlueCount = 0;
+ p->OrderFall = p->MaxOrder;
+ }
+}
+
+static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c)
+{
+ CPpmd_State upState;
+ Byte flags;
+ CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
+ /* fixed over Shkarin's code. Maybe it could work without + 1 too. */
+ CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
+ unsigned numPs = 0;
+
+ if (!skip)
+ ps[numPs++] = p->FoundState;
+
+ while (c->Suffix)
+ {
+ CPpmd_Void_Ref successor;
+ CPpmd_State *s;
+ c = SUFFIX(c);
+ if (s1)
+ {
+ s = s1;
+ s1 = NULL;
+ }
+ else if (c->NumStats != 0)
+ {
+ for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
+ if (s->Freq < MAX_FREQ - 9)
+ {
+ s->Freq++;
+ c->SummFreq++;
+ }
+ }
+ else
+ {
+ s = ONE_STATE(c);
+ s->Freq += (!SUFFIX(c)->NumStats & (s->Freq < 24));
+ }
+ successor = SUCCESSOR(s);
+ if (successor != upBranch)
+ {
+ c = CTX(successor);
+ if (numPs == 0)
+ return c;
+ break;
+ }
+ ps[numPs++] = s;
+ }
+
+ upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch);
+ SetSuccessor(&upState, upBranch + 1);
+ flags = 0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40);
+
+ if (c->NumStats == 0)
+ upState.Freq = ONE_STATE(c)->Freq;
+ else
+ {
+ UInt32 cf, s0;
+ CPpmd_State *s;
+ for (s = STATS(c); s->Symbol != upState.Symbol; s++);
+ cf = s->Freq - 1;
+ s0 = c->SummFreq - c->NumStats - cf;
+ upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0)));
+ }
+
+ do
+ {
+ /* Create Child */
+ CTX_PTR c1; /* = AllocContext(p); */
+ if (p->HiUnit != p->LoUnit)
+ c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
+ else if (p->FreeList[0] != 0)
+ c1 = (CTX_PTR)RemoveNode(p, 0);
+ else
+ {
+ c1 = (CTX_PTR)AllocUnitsRare(p, 0);
+ if (!c1)
+ return NULL;
+ }
+ c1->NumStats = 0;
+ c1->Flags = flags;
+ *ONE_STATE(c1) = upState;
+ c1->Suffix = REF(c);
+ SetSuccessor(ps[--numPs], REF(c1));
+ c = c1;
+ }
+ while (numPs != 0);
+
+ return c;
+}
+
+static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
+{
+ CPpmd_State *s = NULL;
+ CTX_PTR c1 = c;
+ CPpmd_Void_Ref upBranch = REF(p->Text);
+
+ #ifdef PPMD8_FREEZE_SUPPORT
+ /* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
+ CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
+ unsigned numPs = 0;
+ ps[numPs++] = p->FoundState;
+ #endif
+
+ SetSuccessor(p->FoundState, upBranch);
+ p->OrderFall++;
+
+ for (;;)
+ {
+ if (s1)
+ {
+ c = SUFFIX(c);
+ s = s1;
+ s1 = NULL;
+ }
+ else
+ {
+ if (!c->Suffix)
+ {
+ #ifdef PPMD8_FREEZE_SUPPORT
+ if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
+ RESET_TEXT(1);
+ p->OrderFall = 1;
+ }
+ #endif
+ return c;
+ }
+ c = SUFFIX(c);
+ if (c->NumStats)
+ {
+ if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
+ do { s++; } while (s->Symbol != p->FoundState->Symbol);
+ if (s->Freq < MAX_FREQ - 9)
+ {
+ s->Freq += 2;
+ c->SummFreq += 2;
+ }
+ }
+ else
+ {
+ s = ONE_STATE(c);
+ s->Freq += (s->Freq < 32);
+ }
+ }
+ if (SUCCESSOR(s))
+ break;
+ #ifdef PPMD8_FREEZE_SUPPORT
+ ps[numPs++] = s;
+ #endif
+ SetSuccessor(s, upBranch);
+ p->OrderFall++;
+ }
+
+ #ifdef PPMD8_FREEZE_SUPPORT
+ if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ c = CTX(SUCCESSOR(s));
+ do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
+ RESET_TEXT(1);
+ p->OrderFall = 1;
+ return c;
+ }
+ else
+ #endif
+ if (SUCCESSOR(s) <= upBranch)
+ {
+ CTX_PTR successor;
+ CPpmd_State *s1 = p->FoundState;
+ p->FoundState = s;
+
+ successor = CreateSuccessors(p, False, NULL, c);
+ if (successor == NULL)
+ SetSuccessor(s, 0);
+ else
+ SetSuccessor(s, REF(successor));
+ p->FoundState = s1;
+ }
+
+ if (p->OrderFall == 1 && c1 == p->MaxContext)
+ {
+ SetSuccessor(p->FoundState, SUCCESSOR(s));
+ p->Text--;
+ }
+ if (SUCCESSOR(s) == 0)
+ return NULL;
+ return CTX(SUCCESSOR(s));
+}
+
+static void UpdateModel(CPpmd8 *p)
+{
+ CPpmd_Void_Ref successor, fSuccessor = SUCCESSOR(p->FoundState);
+ CTX_PTR c;
+ unsigned s0, ns, fFreq = p->FoundState->Freq;
+ Byte flag, fSymbol = p->FoundState->Symbol;
+ CPpmd_State *s = NULL;
+
+ if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0)
+ {
+ c = SUFFIX(p->MinContext);
+
+ if (c->NumStats == 0)
+ {
+ s = ONE_STATE(c);
+ if (s->Freq < 32)
+ s->Freq++;
+ }
+ else
+ {
+ s = STATS(c);
+ if (s->Symbol != p->FoundState->Symbol)
+ {
+ do { s++; } while (s->Symbol != p->FoundState->Symbol);
+ if (s[0].Freq >= s[-1].Freq)
+ {
+ SwapStates(&s[0], &s[-1]);
+ s--;
+ }
+ }
+ if (s->Freq < MAX_FREQ - 9)
+ {
+ s->Freq += 2;
+ c->SummFreq += 2;
+ }
+ }
+ }
+
+ c = p->MaxContext;
+ if (p->OrderFall == 0 && fSuccessor)
+ {
+ CTX_PTR cs = CreateSuccessors(p, True, s, p->MinContext);
+ if (cs == 0)
+ {
+ SetSuccessor(p->FoundState, 0);
+ RESTORE_MODEL(c, CTX(fSuccessor));
+ }
+ else
+ {
+ SetSuccessor(p->FoundState, REF(cs));
+ p->MaxContext = cs;
+ }
+ return;
+ }
+
+ *p->Text++ = p->FoundState->Symbol;
+ successor = REF(p->Text);
+ if (p->Text >= p->UnitsStart)
+ {
+ RESTORE_MODEL(c, CTX(fSuccessor)); /* check it */
+ return;
+ }
+
+ if (!fSuccessor)
+ {
+ CTX_PTR cs = ReduceOrder(p, s, p->MinContext);
+ if (cs == NULL)
+ {
+ RESTORE_MODEL(c, 0);
+ return;
+ }
+ fSuccessor = REF(cs);
+ }
+ else if ((Byte *)Ppmd8_GetPtr(p, fSuccessor) < p->UnitsStart)
+ {
+ CTX_PTR cs = CreateSuccessors(p, False, s, p->MinContext);
+ if (cs == NULL)
+ {
+ RESTORE_MODEL(c, 0);
+ return;
+ }
+ fSuccessor = REF(cs);
+ }
+
+ if (--p->OrderFall == 0)
+ {
+ successor = fSuccessor;
+ p->Text -= (p->MaxContext != p->MinContext);
+ }
+ #ifdef PPMD8_FREEZE_SUPPORT
+ else if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
+ {
+ successor = fSuccessor;
+ RESET_TEXT(0);
+ p->OrderFall = 0;
+ }
+ #endif
+
+ s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - fFreq;
+ flag = 0x08 * (fSymbol >= 0x40);
+
+ for (; c != p->MinContext; c = SUFFIX(c))
+ {
+ unsigned ns1;
+ UInt32 cf, sf;
+ if ((ns1 = c->NumStats) != 0)
+ {
+ if ((ns1 & 1) != 0)
+ {
+ /* Expand for one UNIT */
+ unsigned oldNU = (ns1 + 1) >> 1;
+ unsigned i = U2I(oldNU);
+ if (i != U2I(oldNU + 1))
+ {
+ void *ptr = AllocUnits(p, i + 1);
+ void *oldPtr;
+ if (!ptr)
+ {
+ RESTORE_MODEL(c, CTX(fSuccessor));
+ return;
+ }
+ oldPtr = STATS(c);
+ MyMem12Cpy(ptr, oldPtr, oldNU);
+ InsertNode(p, oldPtr, i);
+ c->Stats = STATS_REF(ptr);
+ }
+ }
+ c->SummFreq = (UInt16)(c->SummFreq + (3 * ns1 + 1 < ns));
+ }
+ else
+ {
+ CPpmd_State *s = (CPpmd_State*)AllocUnits(p, 0);
+ if (!s)
+ {
+ RESTORE_MODEL(c, CTX(fSuccessor));
+ return;
+ }
+ *s = *ONE_STATE(c);
+ c->Stats = REF(s);
+ if (s->Freq < MAX_FREQ / 4 - 1)
+ s->Freq <<= 1;
+ else
+ s->Freq = MAX_FREQ - 4;
+ c->SummFreq = (UInt16)(s->Freq + p->InitEsc + (ns > 2));
+ }
+ cf = 2 * fFreq * (c->SummFreq + 6);
+ sf = (UInt32)s0 + c->SummFreq;
+ if (cf < 6 * sf)
+ {
+ cf = 1 + (cf > sf) + (cf >= 4 * sf);
+ c->SummFreq += 4;
+ }
+ else
+ {
+ cf = 4 + (cf > 9 * sf) + (cf > 12 * sf) + (cf > 15 * sf);
+ c->SummFreq = (UInt16)(c->SummFreq + cf);
+ }
+ {
+ CPpmd_State *s = STATS(c) + ns1 + 1;
+ SetSuccessor(s, successor);
+ s->Symbol = fSymbol;
+ s->Freq = (Byte)cf;
+ c->Flags |= flag;
+ c->NumStats = (Byte)(ns1 + 1);
+ }
+ }
+ p->MaxContext = p->MinContext = CTX(fSuccessor);
+}
+
+static void Rescale(CPpmd8 *p)
+{
+ unsigned i, adder, sumFreq, escFreq;
+ CPpmd_State *stats = STATS(p->MinContext);
+ CPpmd_State *s = p->FoundState;
+ {
+ CPpmd_State tmp = *s;
+ for (; s != stats; s--)
+ s[0] = s[-1];
+ *s = tmp;
+ }
+ escFreq = p->MinContext->SummFreq - s->Freq;
+ s->Freq += 4;
+ adder = (p->OrderFall != 0
+ #ifdef PPMD8_FREEZE_SUPPORT
+ || p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE
+ #endif
+ );
+ s->Freq = (Byte)((s->Freq + adder) >> 1);
+ sumFreq = s->Freq;
+
+ i = p->MinContext->NumStats;
+ do
+ {
+ escFreq -= (++s)->Freq;
+ s->Freq = (Byte)((s->Freq + adder) >> 1);
+ sumFreq += s->Freq;
+ if (s[0].Freq > s[-1].Freq)
+ {
+ CPpmd_State *s1 = s;
+ CPpmd_State tmp = *s1;
+ do
+ s1[0] = s1[-1];
+ while (--s1 != stats && tmp.Freq > s1[-1].Freq);
+ *s1 = tmp;
+ }
+ }
+ while (--i);
+
+ if (s->Freq == 0)
+ {
+ unsigned numStats = p->MinContext->NumStats;
+ unsigned n0, n1;
+ do { i++; } while ((--s)->Freq == 0);
+ escFreq += i;
+ p->MinContext->NumStats = (Byte)(p->MinContext->NumStats - i);
+ if (p->MinContext->NumStats == 0)
+ {
+ CPpmd_State tmp = *stats;
+ tmp.Freq = (Byte)((2 * tmp.Freq + escFreq - 1) / escFreq);
+ if (tmp.Freq > MAX_FREQ / 3)
+ tmp.Freq = MAX_FREQ / 3;
+ InsertNode(p, stats, U2I((numStats + 2) >> 1));
+ p->MinContext->Flags = (p->MinContext->Flags & 0x10) + 0x08 * (tmp.Symbol >= 0x40);
+ *(p->FoundState = ONE_STATE(p->MinContext)) = tmp;
+ return;
+ }
+ n0 = (numStats + 2) >> 1;
+ n1 = (p->MinContext->NumStats + 2) >> 1;
+ if (n0 != n1)
+ p->MinContext->Stats = STATS_REF(ShrinkUnits(p, stats, n0, n1));
+ p->MinContext->Flags &= ~0x08;
+ p->MinContext->Flags |= 0x08 * ((s = STATS(p->MinContext))->Symbol >= 0x40);
+ i = p->MinContext->NumStats;
+ do { p->MinContext->Flags |= 0x08*((++s)->Symbol >= 0x40); } while (--i);
+ }
+ p->MinContext->SummFreq = (UInt16)(sumFreq + escFreq - (escFreq >> 1));
+ p->MinContext->Flags |= 0x4;
+ p->FoundState = STATS(p->MinContext);
+}
+
+CPpmd_See *Ppmd8_MakeEscFreq(CPpmd8 *p, unsigned numMasked1, UInt32 *escFreq)
+{
+ CPpmd_See *see;
+ if (p->MinContext->NumStats != 0xFF)
+ {
+ see = p->See[p->NS2Indx[p->MinContext->NumStats + 2] - 3] +
+ (p->MinContext->SummFreq > 11 * ((unsigned)p->MinContext->NumStats + 1)) +
+ 2 * (2 * (unsigned)p->MinContext->NumStats <
+ ((unsigned)SUFFIX(p->MinContext)->NumStats + numMasked1)) +
+ p->MinContext->Flags;
+ {
+ unsigned r = (see->Summ >> see->Shift);
+ see->Summ = (UInt16)(see->Summ - r);
+ *escFreq = r + (r == 0);
+ }
+ }
+ else
+ {
+ see = &p->DummySee;
+ *escFreq = 1;
+ }
+ return see;
+}
+
+static void NextContext(CPpmd8 *p)
+{
+ CTX_PTR c = CTX(SUCCESSOR(p->FoundState));
+ if (p->OrderFall == 0 && (Byte *)c >= p->UnitsStart)
+ p->MinContext = p->MaxContext = c;
+ else
+ {
+ UpdateModel(p);
+ p->MinContext = p->MaxContext;
+ }
+}
+
+void Ppmd8_Update1(CPpmd8 *p)
+{
+ CPpmd_State *s = p->FoundState;
+ s->Freq += 4;
+ p->MinContext->SummFreq += 4;
+ if (s[0].Freq > s[-1].Freq)
+ {
+ SwapStates(&s[0], &s[-1]);
+ p->FoundState = --s;
+ if (s->Freq > MAX_FREQ)
+ Rescale(p);
+ }
+ NextContext(p);
+}
+
+void Ppmd8_Update1_0(CPpmd8 *p)
+{
+ p->PrevSuccess = (2 * p->FoundState->Freq >= p->MinContext->SummFreq);
+ p->RunLength += p->PrevSuccess;
+ p->MinContext->SummFreq += 4;
+ if ((p->FoundState->Freq += 4) > MAX_FREQ)
+ Rescale(p);
+ NextContext(p);
+}
+
+void Ppmd8_UpdateBin(CPpmd8 *p)
+{
+ p->FoundState->Freq = (Byte)(p->FoundState->Freq + (p->FoundState->Freq < 196));
+ p->PrevSuccess = 1;
+ p->RunLength++;
+ NextContext(p);
+}
+
+void Ppmd8_Update2(CPpmd8 *p)
+{
+ p->MinContext->SummFreq += 4;
+ if ((p->FoundState->Freq += 4) > MAX_FREQ)
+ Rescale(p);
+ p->RunLength = p->InitRL;
+ UpdateModel(p);
+ p->MinContext = p->MaxContext;
+}
+
+/* H->I changes:
+ NS2Indx
+ GlewCount, and Glue method
+ BinSum
+ See / EscFreq
+ CreateSuccessors updates more suffix contexts
+ UpdateModel consts.
+ PrevSuccess Update
+*/
--- /dev/null
+/* Ppmd8.h -- PPMdI codec
+2010-03-24 : Igor Pavlov : Public domain
+This code is based on:
+ PPMd var.I (2002): Dmitry Shkarin : Public domain
+ Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
+
+#ifndef __PPMD8_H
+#define __PPMD8_H
+
+#include "Ppmd.h"
+
+EXTERN_C_BEGIN
+
+#define PPMD8_MIN_ORDER 2
+#define PPMD8_MAX_ORDER 16
+
+struct CPpmd8_Context_;
+
+typedef
+ #ifdef PPMD_32BIT
+ struct CPpmd8_Context_ *
+ #else
+ UInt32
+ #endif
+ CPpmd8_Context_Ref;
+
+typedef struct CPpmd8_Context_
+{
+ Byte NumStats;
+ Byte Flags;
+ UInt16 SummFreq;
+ CPpmd_State_Ref Stats;
+ CPpmd8_Context_Ref Suffix;
+} CPpmd8_Context;
+
+#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq)
+
+/* The BUG in Shkarin's code for FREEZE mode was fixed, but that fixed
+ code is not compatible with original code for some files compressed
+ in FREEZE mode. So we disable FREEZE mode support. */
+
+enum
+{
+ PPMD8_RESTORE_METHOD_RESTART,
+ PPMD8_RESTORE_METHOD_CUT_OFF
+ #ifdef PPMD8_FREEZE_SUPPORT
+ , PPMD8_RESTORE_METHOD_FREEZE
+ #endif
+};
+
+typedef struct
+{
+ CPpmd8_Context *MinContext, *MaxContext;
+ CPpmd_State *FoundState;
+ unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder;
+ Int32 RunLength, InitRL; /* must be 32-bit at least */
+
+ UInt32 Size;
+ UInt32 GlueCount;
+ Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart;
+ UInt32 AlignOffset;
+ unsigned RestoreMethod;
+
+ /* Range Coder */
+ UInt32 Range;
+ UInt32 Code;
+ UInt32 Low;
+ union
+ {
+ IByteIn *In;
+ IByteOut *Out;
+ } Stream;
+
+ Byte Indx2Units[PPMD_NUM_INDEXES];
+ Byte Units2Indx[128];
+ CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES];
+ UInt32 Stamps[PPMD_NUM_INDEXES];
+
+ Byte NS2BSIndx[256], NS2Indx[260];
+ CPpmd_See DummySee, See[24][32];
+ UInt16 BinSumm[25][64];
+} CPpmd8;
+
+void Ppmd8_Construct(CPpmd8 *p);
+Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAlloc *alloc);
+void Ppmd8_Free(CPpmd8 *p, ISzAlloc *alloc);
+void Ppmd8_Init(CPpmd8 *p, unsigned maxOrder, unsigned restoreMethod);
+#define Ppmd8_WasAllocated(p) ((p)->Base != NULL)
+
+
+/* ---------- Internal Functions ---------- */
+
+extern const Byte PPMD8_kExpEscape[16];
+
+#ifdef PPMD_32BIT
+ #define Ppmd8_GetPtr(p, ptr) (ptr)
+ #define Ppmd8_GetContext(p, ptr) (ptr)
+ #define Ppmd8_GetStats(p, ctx) ((ctx)->Stats)
+#else
+ #define Ppmd8_GetPtr(p, offs) ((void *)((p)->Base + (offs)))
+ #define Ppmd8_GetContext(p, offs) ((CPpmd8_Context *)Ppmd8_GetPtr((p), (offs)))
+ #define Ppmd8_GetStats(p, ctx) ((CPpmd_State *)Ppmd8_GetPtr((p), ((ctx)->Stats)))
+#endif
+
+void Ppmd8_Update1(CPpmd8 *p);
+void Ppmd8_Update1_0(CPpmd8 *p);
+void Ppmd8_Update2(CPpmd8 *p);
+void Ppmd8_UpdateBin(CPpmd8 *p);
+
+#define Ppmd8_GetBinSumm(p) \
+ &p->BinSumm[p->NS2Indx[Ppmd8Context_OneState(p->MinContext)->Freq - 1]][ \
+ p->NS2BSIndx[Ppmd8_GetContext(p, p->MinContext->Suffix)->NumStats] + \
+ p->PrevSuccess + p->MinContext->Flags + ((p->RunLength >> 26) & 0x20)]
+
+CPpmd_See *Ppmd8_MakeEscFreq(CPpmd8 *p, unsigned numMasked, UInt32 *scale);
+
+
+/* ---------- Decode ---------- */
+
+Bool Ppmd8_RangeDec_Init(CPpmd8 *p);
+#define Ppmd8_RangeDec_IsFinishedOK(p) ((p)->Code == 0)
+int Ppmd8_DecodeSymbol(CPpmd8 *p); /* returns: -1 as EndMarker, -2 as DataError */
+
+
+/* ---------- Encode ---------- */
+
+#define Ppmd8_RangeEnc_Init(p) { (p)->Low = 0; (p)->Range = 0xFFFFFFFF; }
+void Ppmd8_RangeEnc_FlushData(CPpmd8 *p);
+void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol); /* symbol = -1 means EndMarker */
+
+EXTERN_C_END
+
+#endif
--- /dev/null
+/* Ppmd8Dec.c -- PPMdI Decoder
+2010-04-16 : Igor Pavlov : Public domain
+This code is based on:
+ PPMd var.I (2002): Dmitry Shkarin : Public domain
+ Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
+
+#include "Ppmd8.h"
+
+#define kTop (1 << 24)
+#define kBot (1 << 15)
+
+Bool Ppmd8_RangeDec_Init(CPpmd8 *p)
+{
+ unsigned i;
+ p->Low = 0;
+ p->Range = 0xFFFFFFFF;
+ p->Code = 0;
+ for (i = 0; i < 4; i++)
+ p->Code = (p->Code << 8) | p->Stream.In->Read(p->Stream.In);
+ return (p->Code < 0xFFFFFFFF);
+}
+
+static UInt32 RangeDec_GetThreshold(CPpmd8 *p, UInt32 total)
+{
+ return p->Code / (p->Range /= total);
+}
+
+static void RangeDec_Decode(CPpmd8 *p, UInt32 start, UInt32 size)
+{
+ start *= p->Range;
+ p->Low += start;
+ p->Code -= start;
+ p->Range *= size;
+
+ while ((p->Low ^ (p->Low + p->Range)) < kTop ||
+ (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1)))
+ {
+ p->Code = (p->Code << 8) | p->Stream.In->Read(p->Stream.In);
+ p->Range <<= 8;
+ p->Low <<= 8;
+ }
+}
+
+#define MASK(sym) ((signed char *)charMask)[sym]
+
+int Ppmd8_DecodeSymbol(CPpmd8 *p)
+{
+ size_t charMask[256 / sizeof(size_t)];
+ if (p->MinContext->NumStats != 0)
+ {
+ CPpmd_State *s = Ppmd8_GetStats(p, p->MinContext);
+ unsigned i;
+ UInt32 count, hiCnt;
+ if ((count = RangeDec_GetThreshold(p, p->MinContext->SummFreq)) < (hiCnt = s->Freq))
+ {
+ Byte symbol;
+ RangeDec_Decode(p, 0, s->Freq);
+ p->FoundState = s;
+ symbol = s->Symbol;
+ Ppmd8_Update1_0(p);
+ return symbol;
+ }
+ p->PrevSuccess = 0;
+ i = p->MinContext->NumStats;
+ do
+ {
+ if ((hiCnt += (++s)->Freq) > count)
+ {
+ Byte symbol;
+ RangeDec_Decode(p, hiCnt - s->Freq, s->Freq);
+ p->FoundState = s;
+ symbol = s->Symbol;
+ Ppmd8_Update1(p);
+ return symbol;
+ }
+ }
+ while (--i);
+ if (count >= p->MinContext->SummFreq)
+ return -2;
+ RangeDec_Decode(p, hiCnt, p->MinContext->SummFreq - hiCnt);
+ PPMD_SetAllBitsIn256Bytes(charMask);
+ MASK(s->Symbol) = 0;
+ i = p->MinContext->NumStats;
+ do { MASK((--s)->Symbol) = 0; } while (--i);
+ }
+ else
+ {
+ UInt16 *prob = Ppmd8_GetBinSumm(p);
+ if (((p->Code / (p->Range >>= 14)) < *prob))
+ {
+ Byte symbol;
+ RangeDec_Decode(p, 0, *prob);
+ *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob);
+ symbol = (p->FoundState = Ppmd8Context_OneState(p->MinContext))->Symbol;
+ Ppmd8_UpdateBin(p);
+ return symbol;
+ }
+ RangeDec_Decode(p, *prob, (1 << 14) - *prob);
+ *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob);
+ p->InitEsc = PPMD8_kExpEscape[*prob >> 10];
+ PPMD_SetAllBitsIn256Bytes(charMask);
+ MASK(Ppmd8Context_OneState(p->MinContext)->Symbol) = 0;
+ p->PrevSuccess = 0;
+ }
+ for (;;)
+ {
+ CPpmd_State *ps[256], *s;
+ UInt32 freqSum, count, hiCnt;
+ CPpmd_See *see;
+ unsigned i, num, numMasked = p->MinContext->NumStats;
+ do
+ {
+ p->OrderFall++;
+ if (!p->MinContext->Suffix)
+ return -1;
+ p->MinContext = Ppmd8_GetContext(p, p->MinContext->Suffix);
+ }
+ while (p->MinContext->NumStats == numMasked);
+ hiCnt = 0;
+ s = Ppmd8_GetStats(p, p->MinContext);
+ i = 0;
+ num = p->MinContext->NumStats - numMasked;
+ do
+ {
+ int k = (int)(MASK(s->Symbol));
+ hiCnt += (s->Freq & k);
+ ps[i] = s++;
+ i -= k;
+ }
+ while (i != num);
+
+ see = Ppmd8_MakeEscFreq(p, numMasked, &freqSum);
+ freqSum += hiCnt;
+ count = RangeDec_GetThreshold(p, freqSum);
+
+ if (count < hiCnt)
+ {
+ Byte symbol;
+ CPpmd_State **pps = ps;
+ for (hiCnt = 0; (hiCnt += (*pps)->Freq) <= count; pps++);
+ s = *pps;
+ RangeDec_Decode(p, hiCnt - s->Freq, s->Freq);
+ Ppmd_See_Update(see);
+ p->FoundState = s;
+ symbol = s->Symbol;
+ Ppmd8_Update2(p);
+ return symbol;
+ }
+ if (count >= freqSum)
+ return -2;
+ RangeDec_Decode(p, hiCnt, freqSum - hiCnt);
+ see->Summ = (UInt16)(see->Summ + freqSum);
+ do { MASK(ps[--i]->Symbol) = 0; } while (i != 0);
+ }
+}
--- /dev/null
+/* Ppmd8Enc.c -- PPMdI Encoder
+2010-04-16 : Igor Pavlov : Public domain
+This code is based on:
+ PPMd var.I (2002): Dmitry Shkarin : Public domain
+ Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
+
+#include "Ppmd8.h"
+
+#define kTop (1 << 24)
+#define kBot (1 << 15)
+
+void Ppmd8_RangeEnc_FlushData(CPpmd8 *p)
+{
+ unsigned i;
+ for (i = 0; i < 4; i++, p->Low <<= 8 )
+ p->Stream.Out->Write(p->Stream.Out, (Byte)(p->Low >> 24));
+}
+
+static void RangeEnc_Normalize(CPpmd8 *p)
+{
+ while ((p->Low ^ (p->Low + p->Range)) < kTop ||
+ (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1)))
+ {
+ p->Stream.Out->Write(p->Stream.Out, (Byte)(p->Low >> 24));
+ p->Range <<= 8;
+ p->Low <<= 8;
+ }
+}
+
+static void RangeEnc_Encode(CPpmd8 *p, UInt32 start, UInt32 size, UInt32 total)
+{
+ p->Low += start * (p->Range /= total);
+ p->Range *= size;
+ RangeEnc_Normalize(p);
+}
+
+static void RangeEnc_EncodeBit_0(CPpmd8 *p, UInt32 size0)
+{
+ p->Range >>= 14;
+ p->Range *= size0;
+ RangeEnc_Normalize(p);
+}
+
+static void RangeEnc_EncodeBit_1(CPpmd8 *p, UInt32 size0)
+{
+ p->Low += size0 * (p->Range >>= 14);
+ p->Range *= ((1 << 14) - size0);
+ RangeEnc_Normalize(p);
+}
+
+
+#define MASK(sym) ((signed char *)charMask)[sym]
+
+void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol)
+{
+ size_t charMask[256 / sizeof(size_t)];
+ if (p->MinContext->NumStats != 0)
+ {
+ CPpmd_State *s = Ppmd8_GetStats(p, p->MinContext);
+ UInt32 sum;
+ unsigned i;
+ if (s->Symbol == symbol)
+ {
+ RangeEnc_Encode(p, 0, s->Freq, p->MinContext->SummFreq);
+ p->FoundState = s;
+ Ppmd8_Update1_0(p);
+ return;
+ }
+ p->PrevSuccess = 0;
+ sum = s->Freq;
+ i = p->MinContext->NumStats;
+ do
+ {
+ if ((++s)->Symbol == symbol)
+ {
+ RangeEnc_Encode(p, sum, s->Freq, p->MinContext->SummFreq);
+ p->FoundState = s;
+ Ppmd8_Update1(p);
+ return;
+ }
+ sum += s->Freq;
+ }
+ while (--i);
+
+ PPMD_SetAllBitsIn256Bytes(charMask);
+ MASK(s->Symbol) = 0;
+ i = p->MinContext->NumStats;
+ do { MASK((--s)->Symbol) = 0; } while (--i);
+ RangeEnc_Encode(p, sum, p->MinContext->SummFreq - sum, p->MinContext->SummFreq);
+ }
+ else
+ {
+ UInt16 *prob = Ppmd8_GetBinSumm(p);
+ CPpmd_State *s = Ppmd8Context_OneState(p->MinContext);
+ if (s->Symbol == symbol)
+ {
+ RangeEnc_EncodeBit_0(p, *prob);
+ *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob);
+ p->FoundState = s;
+ Ppmd8_UpdateBin(p);
+ return;
+ }
+ else
+ {
+ RangeEnc_EncodeBit_1(p, *prob);
+ *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob);
+ p->InitEsc = PPMD8_kExpEscape[*prob >> 10];
+ PPMD_SetAllBitsIn256Bytes(charMask);
+ MASK(s->Symbol) = 0;
+ p->PrevSuccess = 0;
+ }
+ }
+ for (;;)
+ {
+ UInt32 escFreq;
+ CPpmd_See *see;
+ CPpmd_State *s;
+ UInt32 sum;
+ unsigned i, numMasked = p->MinContext->NumStats;
+ do
+ {
+ p->OrderFall++;
+ if (!p->MinContext->Suffix)
+ return; /* EndMarker (symbol = -1) */
+ p->MinContext = Ppmd8_GetContext(p, p->MinContext->Suffix);
+ }
+ while (p->MinContext->NumStats == numMasked);
+
+ see = Ppmd8_MakeEscFreq(p, numMasked, &escFreq);
+ s = Ppmd8_GetStats(p, p->MinContext);
+ sum = 0;
+ i = p->MinContext->NumStats + 1;
+ do
+ {
+ int cur = s->Symbol;
+ if (cur == symbol)
+ {
+ UInt32 low = sum;
+ CPpmd_State *s1 = s;
+ do
+ {
+ sum += (s->Freq & (int)(MASK(s->Symbol)));
+ s++;
+ }
+ while (--i);
+ RangeEnc_Encode(p, low, s1->Freq, sum + escFreq);
+ Ppmd_See_Update(see);
+ p->FoundState = s1;
+ Ppmd8_Update2(p);
+ return;
+ }
+ sum += (s->Freq & (int)(MASK(cur)));
+ MASK(cur) = 0;
+ s++;
+ }
+ while (--i);
+
+ RangeEnc_Encode(p, sum, escFreq, sum + escFreq);
+ see->Summ = (UInt16)(see->Summ + sum + escFreq);
+ }
+}
--- /dev/null
+/* Types.h -- Basic types
+2010-10-09 : Igor Pavlov : Public domain */
+
+#ifndef __7Z_TYPES_H
+#define __7Z_TYPES_H
+
+#include <stddef.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#ifndef EXTERN_C_BEGIN
+#ifdef __cplusplus
+#define EXTERN_C_BEGIN extern "C" {
+#define EXTERN_C_END }
+#else
+#define EXTERN_C_BEGIN
+#define EXTERN_C_END
+#endif
+#endif
+
+EXTERN_C_BEGIN
+
+#define SZ_OK 0
+
+#define SZ_ERROR_DATA 1
+#define SZ_ERROR_MEM 2
+#define SZ_ERROR_CRC 3
+#define SZ_ERROR_UNSUPPORTED 4
+#define SZ_ERROR_PARAM 5
+#define SZ_ERROR_INPUT_EOF 6
+#define SZ_ERROR_OUTPUT_EOF 7
+#define SZ_ERROR_READ 8
+#define SZ_ERROR_WRITE 9
+#define SZ_ERROR_PROGRESS 10
+#define SZ_ERROR_FAIL 11
+#define SZ_ERROR_THREAD 12
+
+#define SZ_ERROR_ARCHIVE 16
+#define SZ_ERROR_NO_ARCHIVE 17
+
+typedef int SRes;
+
+#ifdef _WIN32
+typedef DWORD WRes;
+#else
+typedef int WRes;
+#endif
+
+#ifndef RINOK
+#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
+#endif
+
+typedef unsigned char Byte;
+typedef short Int16;
+typedef unsigned short UInt16;
+
+#ifdef _LZMA_UINT32_IS_ULONG
+typedef long Int32;
+typedef unsigned long UInt32;
+#else
+typedef int Int32;
+typedef unsigned int UInt32;
+#endif
+
+#ifdef _SZ_NO_INT_64
+
+/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
+ NOTES: Some code will work incorrectly in that case! */
+
+typedef long Int64;
+typedef unsigned long UInt64;
+
+#else
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+typedef __int64 Int64;
+typedef unsigned __int64 UInt64;
+#define UINT64_CONST(n) n
+#else
+typedef long long int Int64;
+typedef unsigned long long int UInt64;
+#define UINT64_CONST(n) n ## ULL
+#endif
+
+#endif
+
+#ifdef _LZMA_NO_SYSTEM_SIZE_T
+typedef UInt32 SizeT;
+#else
+typedef size_t SizeT;
+#endif
+
+typedef int Bool;
+#define True 1
+#define False 0
+
+
+#ifdef _WIN32
+#define MY_STD_CALL __stdcall
+#else
+#define MY_STD_CALL
+#endif
+
+#ifdef _MSC_VER
+
+#if _MSC_VER >= 1300
+#define MY_NO_INLINE __declspec(noinline)
+#else
+#define MY_NO_INLINE
+#endif
+
+#define MY_CDECL __cdecl
+#define MY_FAST_CALL __fastcall
+
+#else
+
+#define MY_CDECL
+#define MY_FAST_CALL
+
+#endif
+
+
+/* The following interfaces use first parameter as pointer to structure */
+
+typedef struct
+{
+ Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */
+} IByteIn;
+
+typedef struct
+{
+ void (*Write)(void *p, Byte b);
+} IByteOut;
+
+typedef struct
+{
+ SRes (*Read)(void *p, void *buf, size_t *size);
+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
+ (output(*size) < input(*size)) is allowed */
+} ISeqInStream;
+
+/* it can return SZ_ERROR_INPUT_EOF */
+SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
+SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
+SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
+
+typedef struct
+{
+ size_t (*Write)(void *p, const void *buf, size_t size);
+ /* Returns: result - the number of actually written bytes.
+ (result < size) means error */
+} ISeqOutStream;
+
+typedef enum
+{
+ SZ_SEEK_SET = 0,
+ SZ_SEEK_CUR = 1,
+ SZ_SEEK_END = 2
+} ESzSeek;
+
+typedef struct
+{
+ SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
+} ISeekInStream;
+
+typedef struct
+{
+ SRes (*Look)(void *p, const void **buf, size_t *size);
+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
+ (output(*size) > input(*size)) is not allowed
+ (output(*size) < input(*size)) is allowed */
+ SRes (*Skip)(void *p, size_t offset);
+ /* offset must be <= output(*size) of Look */
+
+ SRes (*Read)(void *p, void *buf, size_t *size);
+ /* reads directly (without buffer). It's same as ISeqInStream::Read */
+ SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
+} ILookInStream;
+
+SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
+SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
+
+/* reads via ILookInStream::Read */
+SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
+SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
+
+#define LookToRead_BUF_SIZE (1 << 14)
+
+typedef struct
+{
+ ILookInStream s;
+ ISeekInStream *realStream;
+ size_t pos;
+ size_t size;
+ Byte buf[LookToRead_BUF_SIZE];
+} CLookToRead;
+
+void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
+void LookToRead_Init(CLookToRead *p);
+
+typedef struct
+{
+ ISeqInStream s;
+ ILookInStream *realStream;
+} CSecToLook;
+
+void SecToLook_CreateVTable(CSecToLook *p);
+
+typedef struct
+{
+ ISeqInStream s;
+ ILookInStream *realStream;
+} CSecToRead;
+
+void SecToRead_CreateVTable(CSecToRead *p);
+
+typedef struct
+{
+ SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
+ /* Returns: result. (result != SZ_OK) means break.
+ Value (UInt64)(Int64)-1 for size means unknown value. */
+} ICompressProgress;
+
+typedef struct
+{
+ void *(*Alloc)(void *p, size_t size);
+ void (*Free)(void *p, void *address); /* address can be 0 */
+} ISzAlloc;
+
+#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
+#define IAlloc_Free(p, a) (p)->Free((p), a)
+
+#ifdef _WIN32
+
+#define CHAR_PATH_SEPARATOR '\\'
+#define WCHAR_PATH_SEPARATOR L'\\'
+#define STRING_PATH_SEPARATOR "\\"
+#define WSTRING_PATH_SEPARATOR L"\\"
+
+#else
+
+#define CHAR_PATH_SEPARATOR '/'
+#define WCHAR_PATH_SEPARATOR L'/'
+#define STRING_PATH_SEPARATOR "/"
+#define WSTRING_PATH_SEPARATOR L"/"
+
+#endif
+
+EXTERN_C_END
+
+#endif
I then added the ability to update the unzipped files last modified and last
open timestamps - this required help from TNSC to allow me access to the
-priviliged procedure call. Also can give the files back to the original user
+privileged procedure call. Also can give the files back to the original user
by use of the '-X' flag.
At the end of 1998 I was given the go ahead to add the zipping of Enscribe
/*
- Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2000-Apr-09 or later
(the contents of which are also included in zip.h) for terms of use.
char fname[FILENAME_MAX + 1];
short fnamelen;
char *p;
- short searchid, err, end;
+ short searchid, err /* , end 2014-03-13 SMS. Unused. */;
struct dirent *entry;
DIR *dirp;
char ext[EXTENSION_MAX + 1];
DISK_DEVICE
);
if (err != 0) {
- end = FILENAME_FINDFINISH_(searchid);
+ /* end = */ FILENAME_FINDFINISH_(searchid);
return NULL;
}
/* Create DIR structure */
if ((dirp = malloc(sizeof(DIR))) == NULL ) {
- end = FILENAME_FINDFINISH_(searchid);
+ /* end = */ FILENAME_FINDFINISH_(searchid);
return NULL;
}
dirp->D_list = dirp->D_curpos = NULL;
) == 0 ){
/* Create space for entry */
if ((entry = malloc (sizeof(struct dirent))) == NULL) {
- end = FILENAME_FINDFINISH_(searchid);
+ /* end = */ FILENAME_FINDFINISH_(searchid);
return NULL;
}
dirp->D_curpos->d_next = NULL;
};
- end = FILENAME_FINDFINISH_(searchid);
+ /* end = */ FILENAME_FINDFINISH_(searchid);
if (err == 1) { /* Should return EOF at end of search */
dirp->D_curpos = dirp->D_list; /* Set current pos to start */
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
if (*pathcomp == '\0') {
---------------------------------------------------------------------------*/
if (FUNCTION == APPEND_DIR) {
- int too_long = FALSE;
+ /* int too_long = FALSE; 2014-03-13 SMS. Unused. */
Trace((stderr, "appending dir segment [%s]\n", FnFilter1(pathcomp)));
while ((*end = *pathcomp++) != '\0')
/*
- Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
{
register int nargc; /* New arguments counter */
char **nargv; /* New arguments pointers */
- register int i, j;
+ register int i /* , j 2014-03-13 SMS. Unused. */ ;
int asize; /* argv array size */
char *arg;
char lib[256];
short insert;
strcpy(lib, libname(arg));
/* add library name if necessary */
- for (j = 2, insert = 1; i < nargc; i++) {
+ for (/* j = 2 */, insert = 1; i < nargc; i++) {
if (ismember(nargv[i])
&& ! strcmp(lib, libname(nargv[i]))) {
insert = 0;
/*
- Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
Info(slide, 1, ((char*)slide,
"checkdir error: can't create library %s\n\
unable to process %s.\n",
- FnFilter2(buildpath), FnFilter1(G.filename));
+ FnFilter2(buildpath), FnFilter1(G.filename)));
free(buildpath);
/* path didn't exist, tried to create, failed */
return MPN_ERR_SKIP;
Info(slide, 1, ((char *)slide,
"checkdir error: cannot create %s\n\
unable to process %s.\n",
- FnFilter2(buildpath), FnFilter1(G.filename));
+ FnFilter2(buildpath), FnFilter1(G.filename)));
free(buildpath);
/* path didn't exist, tried to create, failed */
return MPN_ERR_SKIP;
Info(slide, 1, ((char *)slide,
"checkdir error: %s exists but is not directory\n\
unable to process %s.\n",
- FnFilter2(buildpath), FnFilter1(G.filename));
+ FnFilter2(buildpath), FnFilter1(G.filename)));
free(buildpath);
/* path existed but wasn't dir */
return MPN_ERR_SKIP;
Info(slide, 1, ((char *)slide,
"checkdir error: %s exists but is not library\n\
unable to process %s.\n",
- FnFilter2(buildpath), FnFilter1(G.filename));
+ FnFilter2(buildpath), FnFilter1(G.filename)));
free(buildpath);
/* path existed but wasn't lib */
return MPN_ERR_SKIP;
/*
- Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2000-Apr-09 or later
(the contents of which are also included in zip.h) for terms of use.
tzname[0] = statism.chars + statism.ttis[dstfirst].tt_abbrind;
tzname[1] = statism.chars + statism.ttis[!dstfirst].tt_abbrind;
real_timezone_is_set = TRUE;
- if (TZstring) {
+ if (TZstring)
+ {
if (old_TZstring)
- old_TZstring = realloc(old_TZstring, strlen(TZstring) + 1);
+ {
+ char *temp_TZstring = old_TZstring;
+
+ old_TZstring =
+ izu_realloc( old_TZstring, (strlen( TZstring)+ 1));
+ if (old_TZstring == NULL)
+ izu_free( temp_TZstring);
+ }
else
- old_TZstring = malloc(strlen(TZstring) + 1);
+ old_TZstring = izu_malloc(strlen(TZstring) + 1);
if (old_TZstring)
strcpy(old_TZstring, TZstring);
}
daylight = 0; /* from local system time */
real_timezone_is_set = FALSE;
if (old_TZstring) {
- free(old_TZstring);
+ izu_free(old_TZstring);
old_TZstring = NULL;
}
}
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
- (the contents of which are also included in zip.h) for terms of use.
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
#include "zip.h"
#include "crypt.h"
-#if (CRYPT || (defined(UNZIP) && !defined(FUNZIP)))
+#if defined(IZ_CRYPT_ANY) || (defined(UNZIP) && !defined(FUNZIP))
/* Non-echo console/keyboard input is needed for (en/de)cryption's password
* entry, and for UnZip(SFX)'s MORE and Pause features.
* (The corresponding #endif is found at the end of this module.)
# include <descrip.h>
# include <iodef.h>
# include <ttdef.h>
- /* Workaround for broken header files of older DECC distributions
- * that are incompatible with the /NAMES=AS_IS qualifier. */
-# define sys$assign SYS$ASSIGN
-# define sys$dassgn SYS$DASSGN
-# define sys$qiow SYS$QIOW
# include <starlet.h>
# include <ssdef.h>
+# include <stsdef.h>
# else /* !VMS */
# ifdef HAVE_TERMIOS_H
# include <termios.h>
* fixed-length descriptor info: Programming, Vol. 3, System Services,
* Intro to System Routines, sec. 2.9.2
* Greg Roelofs, 15 Aug 91
+ *
+ * 2011-05-05 SMS.
+ * Added code to save the echo state on the first normal call, and
+ * to restore the original state when called with opt < 0 (as by,
+ * say, an exit handler, to avoid leaving the terminal in a noecho
+ * state if the user aborts (Ctrl/C) at a password prompt).
*/
- short DevChan, iosb[4];
- long status;
- unsigned long ttmode[2]; /* space for 8 bytes */
-
+ short DevChan;
+ short iosb[4];
+ int status;
+ unsigned int ttmode[2]; /* space for 8 bytes */
+ static int echo_orig = -1; /* Original echo state. */
+ int ret_status = 0; /* Status value to return. */
+
+ if ((opt < 0) && (echo_orig < 0))
+ {
+ /* Final call, but no original echo state to restore.
+ * Return immediately with success status.
+ */
+ return SS$_NORMAL;
+ }
- /* assign a channel to standard input */
+ /* Assign a channel to SYS$COMMAND (the user's terminal, _not_
+ * standard input, SYS$INPUT).
+ */
status = sys$assign(&DevDesc, &DevChan, 0, 0);
- if (!(status & 1))
+ /* If we can't talk to the terminal, then fail now. No clean up needed. */
+ if ((status& STS$M_SEVERITY) != STS$K_SUCCESS)
return status;
/* use sys$qio and the IO$_SENSEMODE function to determine the current
*/
status = sys$qiow(0, DevChan, IO$_SENSEMODE, &iosb, 0, 0,
ttmode, 8, 0, 0, 0, 0);
- if (!(status & 1))
- return status;
- status = iosb[0];
- if (!(status & 1))
- return status;
+
+ if ((status& STS$M_SEVERITY) == STS$K_SUCCESS)
+ {
+ /* Initial success. Use IOSB status. */
+ status = iosb[0];
+ }
+ if ((status& STS$M_SEVERITY) != STS$K_SUCCESS)
+ {
+ /* I/O error. Return error status. */
+ ret_status = status;
+ goto clean_up_and_return;
+ }
+
+ if (opt < 0)
+ {
+ /* Final (restore) call. Replace (negative) opt value with the
+ * (known) orginal echo stste.
+ */
+ opt = echo_orig;
+ }
+ else if (echo_orig < 0)
+ {
+ /* On the first (non-restore) call, save the original echo state. */
+ echo_orig = ((ttmode[ 1]& TT$M_NOECHO) ? 0 : 1);
+ }
/* modify mode buffer to be either NOECHO or ECHO
* (depending on function argument opt)
*/
- if (opt == 0) /* off */
- ttmode[1] |= TT$M_NOECHO; /* set NOECHO bit */
- else
- ttmode[1] &= ~((unsigned long) TT$M_NOECHO); /* clear NOECHO bit */
+ if (opt == 0) /* Echo off. */
+ ttmode[1] |= TT$M_NOECHO; /* Set NOECHO bit. */
+ else /* Echo on. */
+ ttmode[1] &= (~TT$M_NOECHO); /* Clear NOECHO bit. */
- /* use the IO$_SETMODE function to change the tty status */
+ /* Use the IO$_SETMODE function to change the terminal echo mode. */
status = sys$qiow(0, DevChan, IO$_SETMODE, &iosb, 0, 0,
ttmode, 8, 0, 0, 0, 0);
- if (!(status & 1))
- return status;
- status = iosb[0];
- if (!(status & 1))
- return status;
- /* deassign the sys$input channel by way of clean-up */
+ if ((status& STS$M_SEVERITY) == STS$K_SUCCESS)
+ {
+ /* Initial success. Use IOSB status. */
+ status = iosb[0];
+ }
+ if ((status& STS$M_SEVERITY) != STS$K_SUCCESS)
+ {
+ /* I/O error. Return error status. */
+ ret_status = status;
+ goto clean_up_and_return;
+ }
+
+ /* Clean-up. Deassign the terminal (SYS$COMMAND) channel. */
+clean_up_and_return:
status = sys$dassgn(DevChan);
- if (!(status & 1))
- return status;
+ if ((status& STS$M_SEVERITY) != STS$K_SUCCESS)
+ {
+ /* I/O error. Return error status. */
+ ret_status = status;
+ }
+
+ /* If no one has yet set a bad status, then use the last success. */
+ if (ret_status == 0)
+ {
+ ret_status = status;
+ }
- return SS$_NORMAL; /* we be happy */
+ return ret_status;
} /* end function echo() */
#endif
char c;
struct sgttyb sg; /* tty device structure */
+ int bc; /* read() result. */
GTTY(f, &sg); /* get settings */
#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS))
STTY(f, &sg); /* set cbreak mode */
GLOBAL(echofd) = f; /* in case ^C hit (not perfect: still CBREAK) */
- read(f, &c, 1); /* read our character */
+ bc = read(f, &c, 1); /* read our character */
#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS))
sg.c_cc[VMIN] = oldmin; /* restore old values */
STTY(f, &sg); /* restore canonical mode */
GLOBAL(echofd) = -1;
- return (int)(uch)c;
+ return (bc > 0) ? (int)(uch)c : -1;
}
int f; /* file descriptor from which to read (must be open already) */
{
char c, c2;
+ int bc; /* read() result. */
+ int bc2; /* read() result. */
/*---------------------------------------------------------------------------
Get a character from the given file descriptor without echo; can't fake
---------------------------------------------------------------------------*/
echoff(f);
- read(f, &c, 1);
- if (c != '\n')
+ bc = read(f, &c, 1);
+ if ((bc > 0) && (c != '\n'))
do {
- read(f, &c2, 1); /* throw away all other chars up thru newline */
- } while (c2 != '\n');
+ bc2 = read(f, &c2, 1); /* Discard remaining chars (through NL). */
+ } while ((c2 != '\n') && (bc2 > 0));
echon();
- return (int)c;
+ return (bc > 0) ? (int)c : -1;
}
#endif /* !VMS */
#endif /* !HAVE_WORKING_GETCH */
-#if CRYPT /* getp() is only used with full encryption */
+#ifdef IZ_CRYPT_ANY /* getp() is only used with full encryption */
/*
* Simple compile-time check for source compatibility between
* zcrypt and ttyio:
*/
-#if (!defined(CR_MAJORVER) || (CR_MAJORVER < 2) || (CR_MINORVER < 7))
+#if (!defined(CR_MAJORVER) || (CR_MAJORVER* 10 + CR_MINORVER < 27))
error: This Info-ZIP tool requires zcrypt 2.7 or later.
#endif
int i; /* number of characters input */
char *w; /* warning on retry */
int f; /* file descriptor for tty device */
+ int bc; /* read() result. */
#ifdef PASSWD_FROM_STDIN
/* Read from stdin. This is unsafe if the password is stored on disk. */
i = 0;
echoff(f);
do { /* read line, keeping n */
- read(f, &c, 1);
+ bc = read(f, &c, 1);
if (i < n)
p[i++] = c;
- } while (c != '\n');
+ } while ((c != '\n') && (bc > 0));
echon();
PUTC('\n', stderr); fflush(stderr);
w = "(line too long--try again)\n";
#endif /* VMS || CMS_MVS */
#endif /* ?HAVE_WORKING_GETCH */
-#endif /* CRYPT */
-#endif /* CRYPT || (UNZIP && !FUNZIP) */
+#endif /* def IZ_CRYPT_ANY */
+#endif /* defined(IZ_CRYPT_ANY) || (defined(UNZIP) && !defined(FUNZIP)) */
/*
- Copyright (c) 1990-2004 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2011 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
- (the contents of which are also included in zip.h) for terms of use.
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
# include "crypt.h" /* ensure that encryption header file has been seen */
#endif
-#if (CRYPT || (defined(UNZIP) && !defined(FUNZIP)))
+#if defined( IZ_CRYPT_ANY) || (defined(UNZIP) && !defined(FUNZIP))
/*
* Non-echo keyboard/console input support is needed and enabled.
*/
#ifdef AMIGA
# define echoff(f)
# define echon()
+# define echorig()
# define getch() Agetch()
# define HAVE_WORKING_GETCH
#endif /* AMIGA */
#ifdef ATARI
# define echoff(f)
# define echon()
+# define echorig()
# include <osbind.h>
# define getch() (Cnecin() & 0x000000ff)
# define HAVE_WORKING_GETCH
#ifdef MACOS
# define echoff(f)
# define echon()
+# define echorig()
# define getch() macgetch()
# define HAVE_WORKING_GETCH
#endif
#ifdef NLM
# define echoff(f)
# define echon()
+# define echorig()
# define HAVE_WORKING_GETCH
#endif
#ifdef QDOS
# define echoff(f)
# define echon()
+# define echorig()
# define HAVE_WORKING_GETCH
#endif
#ifdef RISCOS
# define echoff(f)
# define echon()
+# define echorig()
# define getch() SWI_OS_ReadC()
# define HAVE_WORKING_GETCH
#endif
#ifdef DOS_H68_OS2_W32
# define echoff(f)
# define echon()
+# define echorig()
# ifdef WIN32
# ifndef getch
# define getch() getch_win32()
#ifdef FLEXOS
# define echoff(f)
# define echon()
+# define echorig()
# define getch() getchar() /* not correct, but may not be on a console */
# define HAVE_WORKING_GETCH
#endif
#ifdef CMS_MVS
# define echoff(f)
# define echon()
+# define echorig()
#endif
#ifdef TANDEM
# define echoff(f)
# define echon()
+# define echorig()
# define getch() zgetch() /* defined in TANDEMC */
# define HAVE_WORKING_GETCH
#endif
#ifdef THEOS
# define echoff(f)
# define echon()
+# define echorig()
# define HAVE_WORKING_GETCH
#endif
#ifdef VMS
# define echoff(f) echo(0)
# define echon() echo(1)
+# define echorig() echo(-1)
# define getch() tt_getch()
# define FGETCH(f) tt_getch()
int echo OF((int));
#ifndef echoff
# define echoff(f) Echoff(__G__ f)
# define echon() Echon(__G)
+# define echorig() Echon(__G)
void Echoff OF((__GPRO__ int f));
void Echon OF((__GPRO));
#endif
# endif
#endif /* UNZIP && !FUNZIP */
-#if (CRYPT && !defined(WINDLL))
+#if defined(IZ_CRYPT_ANY) && !defined(WINDLL)
char *getp OF((__GPRO__ ZCONST char *m, char *p, int n));
#endif
-#else /* !(CRYPT || (UNZIP && !FUNZIP)) */
+#else /* defined( IZ_CRYPT_ANY || (defined(UNZIP) && !defined(FUNZIP)) */
/*
* No need for non-echo keyboard/console input; provide dummy definitions.
*/
-#define echoff(f)
-#define echon()
+# define echoff(f)
+# define echon()
+# define echorig()
-#endif /* ?(CRYPT || (UNZIP && !FUNZIP)) */
+#endif /* defined( IZ_CRYPT_ANY || (defined(UNZIP) && !defined(FUNZIP)) [else] */
#endif /* !__ttyio_h */
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2007-Mar-04 or later
(the contents of which are also included in unzip.h) for terms of use.
usage for building a monolythic binary of the Windows application "WiZ"
that supports bzip2 both in compression and decompression operations.
- Contains: bz_internal_error() (USE_BZIP2 only)
+ Contains: bz_internal_error() (BZIP2_SUPPORT only)
---------------------------------------------------------------------------*/
#define UNZIP_INTERNAL
#include "unzip.h"
#ifdef WINDLL
-# ifdef POCKET_UNZIP
-# include "wince/intrface.h"
-# else
-# include "windll/windll.h"
-# endif
+# ifdef POCKET_UNZIP
+# include "wince/intrface.h"
+# else
+# include "windll/windll.h"
+# endif
#endif
-#ifdef USE_BZIP2
+#ifdef BZIP2_SUPPORT
+
+/* Ask the MS VS linker to search for the bzip2 library. */
+# ifdef WIN32
+# pragma comment( lib, "libbz2")
+# endif
/**********************************/
/* Function bz_internal_error() */
Info(slide, 0x421, ((char *)slide,
"error: internal fatal libbzip2 error number %d\n", bzerrcode));
-#ifdef WINDLL
+#if defined( WINDLL) || defined( DLL)
longjmp(dll_error_return, 1);
#else
DESTROYGLOBALS();
#endif
} /* end function bz_internal_error() */
-#endif /* USE_BZIP2 */
+#endif /* BZIP2_SUPPORT */
-Contents of the "unix" subdirectory for UnZip 6.0 and later:
+ Contents of the UnZip 6.10 Source Archive "unix" Directory
+ ----------------------------------------------------------
- Contents this file
- Makefile makefile for UnZip for various architectures and OS's
- configure automatic build configuration script
- unix.c Unix-specific support routines
- unxcfg.h Unix-specific configuration settings
- zipgrep script to scan zip archive entries for lines matching a pattern
- Packaging/ subdirectory containing SysV.4 (e.g., Solaris 2.x) package info
+configure Shell script to probe system environment, capabilities
+configure.txt Change notes on "configure"
+Contents This file
+macosx.h Mac-OS-X-specific header file
+Makefile "make" file for various Unix-like systems
+mlz.sh Shell script to extract all objects from an object library
+README.zOS Notes for z/OS UNIX environment
+test_unzip.sh Shell script to run basic UnZip tests
+unix.c Unix-specific support routines
+unsafe_prod.sh Shell script to check for an unsafe PROD directory spec
+unxcfg.h Unix-specific configuration settings
+zipgrep Shell script to use egrep on zip archive members
+Packaging/ Solaris (SysV) package info
-Type "make" or "make help" to get general compile instructions (beyond
-those in the INSTALL file), or "make list" for a list of makefile targets.
-Note that there are some MS-DOS and cross-compilation targets thrown in
-just to make things more exciting.
#==============================================================================
-# Makefile for UnZip, UnZipSFX and fUnZip: Unix and MS-DOS ("real" makes only)
-# Version: 6.0 18 Jan 2009
+# unix/Makefile
+# - For UnZip, fUnZip, UnZipSFX, and ZipInfo Revised: 2014-05-14
+#
+# Copyright (c) 2004-2014 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. If,
+# for some reason, all these files are missing, the Info-ZIP license may
+# also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
#==============================================================================
-
-# INSTRUCTIONS (such as they are):
+#==============================================================================
+#
+# INSTRUCTIONS
+#
+# "make -f unix/Makefile generic" Make UnZip on most systems using cc.
+#
+# "make -f unix/Makefile generic CC=gcc" Make UnZip on most systems using gcc.
+#
+# "make -f unix/Makefile list" List all supported targets.
+#
+# "make -f unix/Makefile help" Limited advice on which targets to
+# try if problems occur.
+#
+# CF are flags for the C compiler. LF are flags for the linker. LF2
+# are more flags for the linker, if they need to be at the end of the
+# line instead of at the beginning (for example, some libraries).
+# LOCAL_UNZIP is a "make" macro that can be used to add default C flags
+# to your compile without editing "make" file (e.g., -DDEBUG_STRUC, or
+# -FPi87 on PCs using Microsoft C).
+#
+# The "generic" target invokes the "unix/configure" script to test the
+# compile and other parts of the environment to see what's supported.
+# The results are used to adjust the build procedure and to enable or
+# disable some program features. unix/configure builds a $(PROD)/flags
+# file with appropriate values for a number of "make" macros, which is
+# used by this "make" file when performing the actual builds. A separate
+# flags file for building BZIP2 may also be created. This "make" file
+# recursively invokes itself to perform the actual builds.
+#
+# While oriented towards building Unix (and Unix work-alike) ports of
+# UnZip, this file and/or unix/configure are also used by other ports of
+# UnZip. See below.
+#
+# If at all possible, use the generic targets. The other (older)
+# targets are less well tested, and may need considerable help from the
+# user to get optimal results (or any success at all).
+#
+# Optional UnZip features are controlled by setting "make" macros as
+# described below or by the results of tests done by configure (such as
+# checking if the needed files are in an appropriate directory).
+#
+# Optional features include (see INSTALL for installation instructions):
+#
+# AES encryption - See the files INSTALL and aes_wg/README_AES_WG.txt
+# for more information. To include AES_WG (WinZip/Gladman) encryption
+# support, unpack a compatible AES_WG source kit (iz_aes_wg13.zip, or
+# the latest compatible kit available on the Info-ZIP server) to
+# populate the local ./aes_wg subdirectory. To disable AES_WG
+# encryption support (when the source kit is present), set the "make"
+# macro NO_AES_WG to 1.
#
-# "make sunos" -- makes UnZip in current directory on a generic SunOS 4.x Sun
-# "make list" -- lists all supported systems (targets)
-# "make help" -- provides pointers on what targets to try if problems occur
-# "make wombat" -- chokes and dies if you haven't added the specifics for your
-# Wombat 68000 (or whatever) to the systems list
+# LZMA compression - See the files INSTALL and szip/README_LZMA.txt for
+# more information. To disable LZMA compression support, set the
+# "make" macro NO_LZMA to 1.
#
-# CF are flags for the C compiler. LF are flags for the loader. LF2 are more
-# flags for the loader, if they need to be at the end of the line instead of at
-# the beginning (for example, some libraries). FL and FL2 are the corre-
-# sponding flags for fUnZip. LOCAL_UNZIP is an environment variable that can
-# be used to add default C flags to your compile without editing the Makefile
-# (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C).
+# PPMd compression - See the files INSTALL and szip/README_LZMA.txt for
+# more information. To disable PPMd compression support, set the
+# "make" macro NO_PPMD to 1.
#
-# Some versions of make do not define the macro "$(MAKE)"; this is rare, but
-# if things don't work, try using "make" instead of "$(MAKE)" in your system's
-# makerule. Or try adding the following line to your .login file:
-# setenv MAKE "make"
-# (That never works--makes that are too stupid to define MAKE are also too
-# stupid to look in the environment--but try it anyway for kicks. :-) )
+# Bzip2 compression - See the files INSTALL and bzip2/README_BZIP2.txt
+# for more information. To disable bzip2 compression support, set the
+# "make" macro NO_IZ_BZIP2 to 1.
+# To include bzip2 compression support, there are three options:
+# - Let the UnZip builders build a bzip2 object library from the
+# source kit in the bzip2 subdirectory.
+# - Use an existing build of the bzip2 library by setting the "make"
+# macro IZ_BZIP2 to a directory containing the bzip2 header file and
+# object (and/or shared) library files.
+# - Use the system bzip2 library. To do this, ensure that the local
+# ./bzip2 subdirectory exists and does not contain the files
+# Makefile, libbz2.a, or bzlib.h. It may be safer to use one of the
+# above options first, if possible, to avoid an possible problem
+# with error handling that may not be done as expected by the system
+# library.
#
-# Memcpy and memset are provided for those systems that don't have them; they
-# are in fileio.c and will be used if -DZMEM is included in CF. These days
-# almost all systems have them.
+# Zlib deflation - To use zlib to handle Deflate compression instead of
+# UnZip's built-in Deflate code, there are two options:
+# - Use an existing build of the zlib support by setting the "make"
+# macro IZ_ZLIB to a directory containing suitable zlib header and
+# object/shared library files.
+# - Use the system zlib support by ensuring that the local ./zlib
+# subdirectory exists, and does not contain the files libz.a or
+# bzlib.h. Set the "make" macro IZ_ZLIB to "zlib".
#
-# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila-
-# tion does not always imply a working program.
+# UnZip Ports:
+#
+# This "make" file and/or the unix/configure script support a number of
+# non-Unix UnZip ports, where the UnZip program build is under Unix (or a
+# Unix work-alike), but the UnZip program execution may be on another
+# system or execution environment. The unix/configure script will be
+# invoked from either unix/Makefile, or from a "make" file located in
+# another port directory.
+#
+# The port may be explicitly identified by the PORT parameter, or
+# implicitly detected by compiler configuration tests.
+#
+# Supported ports include:
+# msdos : DOS port built using the DJGPP (or Cygwin) cross-compiler
+# os2 : OS/2 port
+# qdos : Sinclair Q-DOS port built using a gcc cross-compiler
+# zos : z/OS MVS port built under z/OS UNIX
+# zvm : z/VM CMS port built under z/VM OpenExtensions
+#
+# Be sure to test your new UnZip (and UnZipSFX and fUnZip and ZipInfo). A
+# successful build does not guarantee a working program.
+
+###########
+# TARGETS #
+###########
+
+# List of supported systems/targets in this version
+GENERIC_TARGETS1 = generic generic_pkg config_flags
+GENERIC_TARGETS2 = generic1 generic2 generic3
+
+MISC_TARGETS = clean clean_bzip2 clean_docs clean_exe dashv
+
+SYS_TARGETS01 = 386i 3Bx 7300 7300_gcc amdahl amdahl_eft apollo aviion
+SYS_TARGETS02 = bsd bsdi bsdi_noasm bull coherent convex cray cray_opt
+SYS_TARGETS03 = cyber_sgi cygwin dec dnix encore eta freebsd gcc gould
+SYS_TARGETS04 = hk68 hp hpux isc isc_gcc isi linux linux_dos linux_noasm
+SYS_TARGETS05 = lynx macosx macosx_gcc minix mips
+SYS_TARGETS06 = mpeix next next10 next2x next3x nextfat osf1 pixel ptx
+SYS_TARGETS07 = pyramid qnxnto realix regulus sco sco_dos sco_sl sco_x286
+SYS_TARGETS08 = sequent sgi solaris stardent stellar sunos3 sunos4
+SYS_TARGETS09 = sysv sysv_gcc sysv6300 tahoe ti_sysv ultrix vax v7
+SYS_TARGETS10 = xenix xos
+# By default, print help on which "make" targets to try.
+
+# What you can make ...
+help:
+ @echo ''
+ @echo 'Make what? You must specify which system to make UnZip for.'
+ @echo 'The "make" generic target choices are:'
+ @echo ''
+ @echo " $(GENERIC_TARGETS1)"
+ @echo " $(GENERIC_TARGETS2)"
+ @echo ''
+ @echo 'Additional "make" targets include:'
+ @echo ''
+ @echo " $(MISC_TARGETS)"
+ @echo ''
+ @echo 'For a list including specific targets for older systems:'
+ @echo ' make -f unix/Makefile list'
+ @echo ''
+ @echo '"make" macros to control various optional features:'
+ @echo ' "NO_AES_WG=1" Disable AES_WG encryption.'
+ @echo ' "BINS=[L][M][U] Binaries build list:'
+ @echo ' L: object library (libizunzip.a)'
+ @echo ' M: main program (UnZip)'
+ @echo ' U: utility programs (fUnZip, UnZipSFX)'
+ @echo ' Default: MU.'
+ @echo ' "CC=gcc" Use "gcc" instead of "cc" for C compiler.'
+ @echo ' "NO_ICONV=1" Disable ISO/OEM (iconv) conversion.'
+ @echo ' "IZ_BZIP2=bz2dir" Use bzip2 compression from dir "bz2dir".'
+ @echo ' "NO_IZ_BZIP2=1" Disable bzip2 compression.'
+ @echo ' "IZ_ZLIB=zdir" Use zlib from dir "zdir" for Deflate.'
+ @echo ' "LIST=1" Generate C compiler and linker listing.'
+ @echo ' "LOCAL_UNZIP=opts" Add C compiler options, "opts".'
+ @echo ' "NO_LZMA=1" Disable LZMA compression.'
+ @echo ' "NO_PPMD=1" Disable PPMd compression.'
+ @echo ' "PROD=subdir" Build product files in "subdir", not ".".'
+ @echo ''
+ @echo 'Examples:'
+ @echo ' make -f unix/Makefile generic'
+ @echo ' - make UnZip programs using cc.'
+ @echo ' make -f unix/Makefile generic CC=gcc AES_WG=1'
+ @echo ' - make UnZip programs using gcc, with AES_WG encryption.'
+ @echo ''
+ @echo 'Note that many of these optional "make" macros direct the'
+ @echo '"unix/configure" script, and so may work only with the'
+ @echo '"generic" target.'
+ @echo ''
+ @echo 'First try "make -f unix/Makefile generic" (to use "cc")'
+ @echo '(or "make -f unix/Makefile generic CC=gcc" (to use "gcc")),'
+ @echo 'as "generic" should automatically set the proper flags.'
+ @echo ''
+ @echo 'Use the "clean" target to delete any product files before'
+ @echo 'using one of the other "make" targets. The generic targets'
+ @echo 'use the unix/configure script to generate an intermediate'
+ @echo '"flags" file which is used by unix/Makefile. For debugging'
+ @echo 'purposes, the "config_flags" target can be used to generate'
+ @echo 'the "flags" file only.'
+ @echo ''
+ @echo 'Use the "docs" target to make the plain-text "man" output'
+ @echo 'files. These are the files, like "unzip.txt", that are'
+ @echo 'supplied in the "docs" directory. Newly generated ".txt"'
+ @echo 'files will be placed in the "$(PROD)/manout" directory.'
+ @echo ''
+ @echo 'After UnZip has been built, use dashv to get an "unzip -v"'
+ @echo 'report from the created executable.'
+ @echo ''
+ @echo 'See the files INSTALL, unzip.txt, and unix/Makefile for more'
+ @echo 'information.'
+ @echo ''
+ @echo ' For most users, the best build method is the generic target'
+ @echo ' using the default compiler (cc is often gcc), or by specifying'
+ @echo ' an explicit CC=gcc override.'
+ @echo ''
+ @echo ' Other (older) targets are less well tested, and may need'
+ @echo ' considerable help from the user to get optimal results (or'
+ @echo ' any success at all). Use "make -f unix/Makefile list" to'
+ @echo ' get a list of valid targets.'
+ @echo ''
+ @echo ' Always do "make -f unix/Makefile clean clean_bzip2" before'
+ @echo ' attempting to build UnZip using a different target.'
+ @echo ''
+ @echo ' If the "generic" target fails, you might try an older generic'
+ @echo ' target that is now called "generic1".'
+ @echo ''
+ @echo ' If the compiler complains about "timezone redefined", then'
+ @echo ' the "generic2" target may work better. If the linker'
+ @echo ' complains about an undefined symbol, "_ftime", then the'
+ @echo ' "generic3" target may work better.'
+ @echo ''
+ @echo ' One of these actions should produce working UnZip programs on'
+ @echo ' most Unix(-like) systems. If you know a bit more about the'
+ @echo ' system on which you work, then you might try "make -f'
+ @echo ' unix/Makefile list" for a list of the system-specific targets'
+ @echo ' supported herein. (Many of them do exactly the same thing,'
+ @echo ' so do not agonize too much over which to pick if two or more'
+ @echo ' sound equally likely.)'
+ @echo ''
+
+# list
+# - Display list of supported systems/targets in this version.
+# - The SYSTEM variable is no longer supported. Instead, use:
+# - make -f unix/Makefile <target>
+list:
+ @echo ''
+ @echo 'Type "make -f unix/Makefile <target>", where <target> is one of'
+ @echo 'the following:'
+ @echo ''
+ @echo 'Generic targets:'
+ @echo " $(GENERIC_TARGETS1)"
+ @echo " $(GENERIC_TARGETS2)"
+ @echo ''
+ @echo 'Specific targets:'
+ @echo " $(SYS_TARGETS01)"
+ @echo " $(SYS_TARGETS02)"
+ @echo " $(SYS_TARGETS03)"
+ @echo " $(SYS_TARGETS04)"
+ @echo " $(SYS_TARGETS05)"
+ @echo " $(SYS_TARGETS06)"
+ @echo " $(SYS_TARGETS07)"
+ @echo " $(SYS_TARGETS08)"
+ @echo " $(SYS_TARGETS09)"
+ @echo " $(SYS_TARGETS10)"
+ @echo ''
+ @echo 'Miscellaneous targets:'
+ @echo " $(MISC_TARGETS)"
+ @echo ''
+ @echo 'Use one of the generic targets if possible, as the specific'
+ @echo 'targets tend to be woefully out of date.'
+ @echo ''
+ @echo 'For further (very useful) information, please read the comments'
+ @echo 'in unix/Makefile.'
#####################
# MACRO DEFINITIONS #
#####################
-# Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
-# such as -DDOSWILD).
+#----------------------------------------------------------------------------
+# Defaults most systems use
+# - The generic target invokes unix/configure to build $(PROD)/flags and
+# $(PROD)/flags_bz containing system derived settings that are used by
+# this "make" file.
+# - use "make" macro LOCAL_UNZIP to add C compiler flags (such as
+# -DDOSWILD).
+#----------------------------------------------------------------------------
-# UnZip flags
-CC = cc# try using "gcc" target rather than changing this (CC and LD
-LD = $(CC)# must match, else "unresolved symbol: ___main" is possible)
-AS = as
-LOC = $(D_USE_BZ2) $(LOCAL_UNZIP)
-AF = $(LOC)
-CFLAGS = -O
-CF_NOOPT = -I. -I$(IZ_BZIP2) -DUNIX $(LOC)
-CF = $(CFLAGS) $(CF_NOOPT)
-LFLAGS1 =
-LF = -o unzip$E $(LFLAGS1)
-LF2 = -s
-
-# UnZipSFX flags
-SL = -o unzipsfx$E $(LFLAGS1)
-SL2 = $(LF2)
-
-# fUnZip flags
-FL = -o funzip$E $(LFLAGS1)
-FL2 = $(LF2)
-
-# general-purpose stuff
-#CP = cp
-CP = ln
-LN = ln
-RM = rm -f
-CHMOD = chmod
+# This file name as "make" parameter, for recursion.
+MAKEF = '-f unix/Makefile'
+
+# Product file directory default is "."
+PROD = .
+
+# Build Dependencies for "make"
+# - Optional object library names
+# AES (WinZip/Gladman) encryption
+# BZIP2 compression
+# LZMA compression
+# PPMd compression
+# ZLIB compression
+LIB_AES_WG =
+LIB_BZ =
+LIB_LZMA =
+LIB_PPMD =
+LIB_Z =
+
+# Binaries build list (executables and/or object library).
+# - Default: main program and utilities.
+BINS = MU
+
+# Build "make" files
+# - Alternatively, use bzip2/Makebz2.iz
+# BZIP2 compression
+MK_BZ = Makefile
+
+# OS-dependent files
+# - Default: Unix port.
+# - Compilation and execution are both for Unix (or a Unix-like) environment.
+# The files in the UnZip root and unix directories are used.
+# - The vast majority of you out there will likely use this
+# configuration, and do not have to ever worry about this.
+# - Where required by a specific UnZip port, a generic target (in this
+# "make" file or a "make" file located in another port directory) uses
+# the PORT macro to set the correct OS dependent files via
+# unix/configure. Or you can (very carefully) override as required.
+# C header files
+# C object files for funzip
+# C object files for unzipsfx
+# C object files for unzip
+# Assembler object files
+OSDEP_H = unix/unxcfg.h
+OSDEP_OCF =
+OSDEP_OCS = $(PROD)/unix.o
+OSDEP_OCU = $(PROD)/unix.o
+OSDEP_OS =
+
+# OS-dependent file extensions
+# - This default may be customized by unix/configure based on PORT
+# Executable programs
+# DLL (.so) (currently not used)
+# man page (section) suffix
+PGMEXT =
+DLLEXT = .so
+MANSUFX =
+
+# OS-dependent installation directories: executables and man pages
+# - This default may be customized by unix/configure based on PORT
+PREFIX = /usr/local
+BINDIR = $(PREFIX)/bin
+MANDIR = $(PREFIX)/man
+
+MANDIR1 = $(MANDIR)/man1
+
+# OS-dependent installation file permissions: executables and man pages
+# - This default may be customized by unix/configure based on PORT
BINPERMS = 755
MANPERMS = 644
-STRIP = strip
-E =
-O = .o
-M = unix
-SHELL = /bin/sh
-MAKEF = -f unix/Makefile
-
-# Version info for unix/unix.c
-HOST_VERSINFO=-DIZ_CC_NAME='\"\$$(CC) \"' -DIZ_OS_NAME='\"`uname -a`\"'
-
-# defaults for crc32 stuff and system dependent headers
-CRCA_O =
-OSDEP_H = unix/unxcfg.h
-# default for dependency on auto-configure result, is an empty symbol
-# so that the static non-autoconfigure targets continue to work
+
+# C compiler and flags: core and bzip2
+# - CC and LD must match, else "unresolved symbol: ___main" is possible)
+# - To use "gcc", specify "make" macro, "CC=gcc", instead of editing here.
+CC = cc
+CC_BZ = $(CC)
+
+CF_NOOPT = -I. -DUNIX $(LOCAL_UNZIP)
+CFLAGS = -O
+CF = $(CFLAGS) $(CF_NOOPT)
+CF_BZ = $(CF)
+
+# C preprocessor
+CPP = $(CC) -E
+
+# Assembler and assembler flags
+AS = as
+AF = $(LOCAL_UNZIP)
+
+# Linker and linker flags (early and late)
+# - CC and LD must match, else "unresolved symbol: ___main" is possible)
+# - To use "gcc", specify "make" macro, "CC=gcc", instead of editing here.
+LD = $(CC)
+LF1 =
+LF2 = -s
+
+# Other utility programs
+AR = ar cq
+CHMOD = chmod
+COL = col
+LN = ln
+RANLIB = ranlib
+RM = rm -f
+SHELL = /bin/sh
+STRIP = strip
+PGM_ZIP = zip
+
+# Default for dependency on unix/configure result, is an empty symbol
+# so that the static non-unix/configure targets continue to work
ACONF_DEP =
-# optional inclusion of bzip2 decompression
-IZ_OUR_BZIP2_DIR = bzip2
-IZ_BZIP2 = $(IZ_OUR_BZIP2_DIR)
-## The following symbols definitions need to be set to activate bzip2 support:
-#D_USE_BZ2 = -DUSE_BZIP2
-#L_BZ2 = -lbz2
-#LIBBZ2 = $(IZ_BZIP2)/libbz2.a
-
-# defaults for unzip's "built-in" bzip2 library compilation
-CC_BZ = $(CC)
-CFLAGS_BZ = $(CFLAGS)
-
-# object files
-OBJS1 = unzip$O crc32$O $(CRCA_O) crypt$O envargs$O explode$O
-OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
-OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
-OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
-LOBJS = $(OBJS)
-OBJSDLL = $(OBJS:.o=.pic.o) api.pic.o
-OBJX = unzipsfx$O crc32_$O $(CRCA_O) crypt_$O extract_$O fileio_$O \
- globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
-LOBJX = $(OBJX)
-OBJF = funzip$O crc32$O $(CRCA_O) cryptf$O globalsf$O inflatef$O ttyiof$O
-#OBJS_OS2 = $(OBJS1:.o=.obj) $(OBJS2:.o=.obj) os2.obj
-#OBJF_OS2 = $(OBJF:.o=.obj)
-UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H) $(ACONF_DEP)
-
-# installation
-# (probably can change next two to `install' and `install -d' if you have it)
-INSTALL = cp
+#----------------------------------------------------------------------------
+# Build configuration: header files
+#----------------------------------------------------------------------------
+
+# OSDEP_H is port-dependent and can be updated by unix/configure
+
+# C header files: unzip
+H_UNZIP = unzip.h \
+ unzpriv.h \
+ globals.h \
+ $(OSDEP_H) \
+ $(ACONF_DEP)
+
+H_UNZIPL = api.h $(H_UNZIP)
+
+# C header files: AES (WinZip/Gladman) encryption
+H_AES = aes_wg/aes.h \
+ aes_wg/aesopt.h \
+ aes_wg/fileenc.h \
+ aes_wg/hmac.h \
+ aes_wg/prng.h \
+ aes_wg/pwd2key.h \
+ aes_wg/sha1.h
+
+# C header files: LZMA compression
+H_LZMA = szip/SzVersion.h \
+ szip/LzFind.h \
+ szip/LzHash.h \
+ szip/LzmaDec.h \
+ szip/Types.h
+
+# C header files: PPMd compression
+H_PPMD = szip/Ppmd.h \
+ szip/Ppmd8.h
+
+#----------------------------------------------------------------------------
+# Build configuration: object files
+#----------------------------------------------------------------------------
+
+# OSDEP_* are port-dependent and can be updated by unix/configure.
+
+# object files: unzip
+O_UNZIP = $(PROD)/unzip.o \
+ $(PROD)/crc32.o \
+ $(PROD)/crypt.o \
+ $(PROD)/envargs.o \
+ $(PROD)/explode.o \
+ $(PROD)/extract.o \
+ $(PROD)/fileio.o \
+ $(PROD)/globals.o \
+ $(PROD)/inflate.o \
+ $(PROD)/list.o \
+ $(PROD)/match.o \
+ $(PROD)/process.o \
+ $(PROD)/ttyio.o \
+ $(PROD)/ubz2err.o \
+ $(PROD)/unreduce.o \
+ $(PROD)/unshrink.o \
+ $(PROD)/zipinfo.o \
+ $(OSDEP_OCU) \
+ $(OSDEP_OS)
+
+# object files: UnZip object library. Modules sensitive to DLL/REENTRANT.
+O_UNZIPL = $(PROD)/api_l.o \
+ $(PROD)/apihelp_l.o \
+ $(PROD)/crypt_l.o \
+ $(PROD)/explode_l.o \
+ $(PROD)/extract_l.o \
+ $(PROD)/fileio_l.o \
+ $(PROD)/globals_l.o \
+ $(PROD)/inflate_l.o \
+ $(PROD)/list_l.o \
+ $(PROD)/process_l.o \
+ $(PROD)/ttyio_l.o \
+ $(PROD)/ubz2err_l.o \
+ $(PROD)/unshrink_l.o \
+ $(PROD)/unzip_l.o \
+ $(PROD)/zipinfo_l.o \
+ $(OSDEP_OCU:.o=_l.o)
+
+# object files: UnZip object library. Modules insensitive to DLL/REENTRANT.
+O_UNZIPN = $(PROD)/crc32.o \
+ $(PROD)/envargs.o \
+ $(PROD)/match.o \
+ $(PROD)/unreduce.o \
+ $(OSDEP_OS)
+
+# object files: UnZip DLL
+O_DLL = $(O_UNZIP) \
+ $(PROD)/api.o \
+ $(PROD)/apihelp.o
+
+O_STUB = $(PROD)/unzipstb.o
+
+# object files: unzipsfx
+O_SFX = $(PROD)/unzipsfx.o \
+ $(PROD)/crc32_s.o \
+ $(PROD)/crypt_s.o \
+ $(PROD)/extract_s.o \
+ $(PROD)/fileio_s.o \
+ $(PROD)/globals_s.o \
+ $(PROD)/inflate_s.o \
+ $(PROD)/match_s.o \
+ $(PROD)/process_s.o \
+ $(PROD)/ttyio_s.o \
+ $(PROD)/ubz2err_s.o \
+ $(OSDEP_OCS:.o=_s.o) \
+ $(OSDEP_OS)
+
+# object files: funzip
+O_FUZ = $(PROD)/funzip.o \
+ $(PROD)/crc32_f.o \
+ $(PROD)/crypt_f.o \
+ $(PROD)/globals_f.o \
+ $(PROD)/inflate_f.o \
+ $(PROD)/ttyio_f.o \
+ $(OSDEP_OCF:.o=_f.o) \
+ $(OSDEP_OS)
+
+# object files: Assembler CRC (Source: msdos/crc_i86.S)
+# - All OS-dependent, by unix/configure based on PORT
+O_CRC_I = $(PROD)/crc_i86.o
+
+# object files: Assembler CRC (Source: crc_i386.S)
+# - All OS-dependent, by unix/configure based on PORT
+O_CRC_G = $(PROD)/crc_gcc.o
+O_CRC_SV = $(PROD)/crc_sysv.o
+
+# object files: AES (WinZip/Gladman) encryption
+O_AES = $(PROD)/aescrypt.o \
+ $(PROD)/aeskey.o \
+ $(PROD)/aestab.o \
+ $(PROD)/fileenc.o \
+ $(PROD)/hmac.o \
+ $(PROD)/prng.o \
+ $(PROD)/pwd2key.o \
+ $(PROD)/sha1.o
+
+# object files: LZMA compression
+O_LZMA = $(PROD)/LzFind.o \
+ $(PROD)/LzmaDec.o
+
+# object files: PPMd compression
+O_PPMD = $(PROD)/Ppmd8.o \
+ $(PROD)/Ppmd8Dec.o
+
+# object files: ZLIB compression
+# - N/A. ZLIB is not built as part of UnZip
+
+#----------------------------------------------------------------------------
+# Build configuration: object archive libraries
+#----------------------------------------------------------------------------
+
+# object archive: AES (WinZip/Gladman) encryption
+AR_AES = $(PROD)/libiz_aes_wg.a
+
+# object archive: BZIP2 compression
+AR_BZ = bzip2/libbz2.a
+
+# object archive: LZMA compression
+AR_LZMA = $(PROD)/libiz_lzma.a
+
+# object archive: PPMd compression
+AR_PPMD = $(PROD)/libiz_ppmd.a
+
+# object archive: Callable UnZip
+AR_UNZIP = $(PROD)/libizunzip.a
+
+# object archive: ZLIB compression
+AR_Z = zlib/libz.a
+
+#----------------------------------------------------------------------------
+# Build configuration: Executable programs
+#----------------------------------------------------------------------------
+LIB_UNZIP = $(PROD)/libizunzip.a
+
+PGM_FUZ = funzip$(PGMEXT)
+PGM_SFX = unzipsfx$(PGMEXT)
+PGM_UNZIP = unzip$(PGMEXT)
+PGM_ZGREP = zipgrep
+PGM_ZINFO = zipinfo$(PGMEXT)
+
+PPGM_FUZ = $(PROD)/$(PGM_FUZ)
+PPGM_SFX = $(PROD)/$(PGM_SFX)
+PPGM_UNZIP = $(PROD)/$(PGM_UNZIP)
+PPGM_ZGREP = unix/zipgrep
+PPGM_ZINFO = $(PROD)/$(PGM_ZINFO)
+
+UNZIP_PPGMS = $(PPGM_FUZ) \
+ $(PPGM_SFX) \
+ $(PPGM_UNZIP)
+
+#----------------------------------------------------------------------------
+# Build configuration: Manuals
+#----------------------------------------------------------------------------
+MAN_FUZ = funzip.1$(MANSUFX)
+MAN_SFX = unzipsfx.1$(MANSUFX)
+MAN_UNZIP = unzip.1$(MANSUFX)
+MAN_ZGREP = zipgrep.1$(MANSUFX)
+MAN_ZINFO = zipinfo.1$(MANSUFX)
+
+PMAN_FUZ = $(PROD)/manout/funzip.txtr
+PMAN_SFX = $(PROD)/manout/unzipsfx.txtr
+PMAN_UNZIP = $(PROD)/manout/unzip.txtr
+PMAN_ZGREP = $(PROD)/manout/zipgrep.txtr
+PMAN_ZINFO = $(PROD)/manout/zipinfo.txtr
+
+UNZIP_PMANS = $(PMAN_UNZIP) \
+ $(PMAN_SFX) \
+ $(PMAN_FUZ) \
+ $(PMAN_ZGREP) \
+ $(PMAN_ZINFO)
+
+DOC_FUZ = $(PROD)/manout/funzip.txt
+DOC_SFX = $(PROD)/manout/unzipsfx.txt
+DOC_UNZIP = $(PROD)/manout/unzip.txt
+DOC_ZGREP = $(PROD)/manout/zipgrep.txt
+DOC_ZINFO = $(PROD)/manout/zipinfo.txt
+
+UNZIP_DOCS = $(DOC_UNZIP) \
+ $(DOC_SFX) \
+ $(DOC_FUZ) \
+ $(DOC_ZINFO) \
+ $(DOC_ZGREP)
+
+#----------------------------------------------------------------------------
+# Build configuration: Installation
+#----------------------------------------------------------------------------
+
+# (Probably can change next two to "install" and "install -d", if you have it.)
+INSTALL = cp
INSTALL_PROGRAM = $(INSTALL)
INSTALL_D = mkdir -p
-# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
-manext = 1
-prefix = /usr/local
-BINDIR = $(prefix)/bin# where to install executables
-MANDIR = $(prefix)/man/man$(manext)# where to install man pages
-INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/unzip$E $(BINDIR)/unzipsfx$E \
- $(BINDIR)/zipgrep$E $(BINDIR)/zipinfo$E
-INSTALLEDMAN = $(MANDIR)/funzip.$(manext) $(MANDIR)/unzip.$(manext) \
- $(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipgrep.$(manext) \
- $(MANDIR)/zipinfo.$(manext)
-
-# Solaris 2.x stuff:
-PKGDIR = IZunzip
-VERSION = Version 6.0
-
-UNZIPS = unzip$E funzip$E unzipsfx$E
-# this is a little ugly...well, OK, it's a lot ugly:
-MANS = man/funzip.1 man/unzip.1 man/unzipsfx.1 man/zipgrep.1 man/zipinfo.1
-DOCS = funzip.txt unzip.txt unzipsfx.txt zipgrep.txt zipinfo.txt
-
-# list of supported systems/targets in this version
-SYSTEMG1 = generic generic_gcc generic_pkg generic_gccpkg
-SYSTEMG2 = generic1 generic2 generic3 generic_bz2 generic_zlib generic_shlib
-SYSTEMS1 = 386i 3Bx 7300 7300_gcc aix aix_rt amdahl amdahl_eft apollo aviion
-SYSTEMS2 = bsd bsdi bsdi_noasm bull coherent convex cray cray_opt cyber_sgi
-SYSTEMS3 = cygwin dec dnix encore eta freebsd gcc gould hk68 hp hpux
-SYSTEMS4 = isc isc_gcc isi linux linux_dos linux_noasm linux_shlib linux_shlibz
-SYSTEMS5 = lynx macosx macosx_gcc minix mips mpeix next next10 next2x next3x
-SYSTEMS6 = nextfat osf1 pixel ptx pyramid qnxnto realix regulus rs6000 sco
-SYSTEMS7 = sco_dos sco_sl sco_x286 sequent sgi solaris solaris_pkg stardent
-SYSTEMS8 = stellar sunos3 sunos4 sysv sysv_gcc sysv6300 tahoe ti_sysv ultrix
-SYSTEMS9 = vax v7 wombat xenix xos
-
-
-####################
-# DEFAULT HANDLING #
-####################
-
-# By default, print help on which makefile targets to try. (The SYSTEM
-# variable is no longer supported; use "make <target>" instead.)
-help:
- @echo ""
- @echo " If you're not sure about the characteristics of your system, try typing"
- @echo " \"make generic\". This is new and uses the configure script, though it is"
- @echo " still being worked on."
- @echo ""
- @echo " If that does not do it, try the original generic which is \"make generic1\"."
- @echo ""
- @echo " If the compiler barfs and says something unpleasant about \"timezone redefined\","
- @echo " try typing \"make clean\" followed by \"make generic2\". If, on the other"
- @echo " hand, it complains about an undefined symbol _ftime, try typing \"make clean\""
- @echo " followed by \"make generic3\"."
- @echo ""
- @echo " One of these actions should produce a working copy of unzip on most Unix"
- @echo " systems. If you know a bit more about the machine on which you work, you"
- @echo " might try \"make list\" for a list of the specific systems supported herein."
- @echo " (Many of them do exactly the same thing, so don't agonize too much over"
- @echo " which to pick if two or more sound equally likely.) Also check out the"
- @echo " INSTALL file for notes on compiling various targets. As a last resort,"
- @echo " feel free to read the numerous comments within the Makefile itself."
- @echo ""
- @echo " Have a mostly pretty good day."
- @echo ""
+BIN_FUZ = $(BINDIR)/$(PGM_FUZ)
+BIN_SFX = $(BINDIR)/$(PGM_SFX)
+BIN_UNZIP = $(BINDIR)/$(PGM_UNZIP)
+BIN_ZGREP = $(BINDIR)/$(PGM_ZGREP)
+BIN_ZINFO = $(BINDIR)/$(PGM_ZINFO)
-list:
- @echo ""
- @echo\
- 'Type "make <system>", where <system> is one of the following:'
- @echo ""
- @echo " $(SYSTEMG1)"
- @echo " $(SYSTEMG2)"
- @echo ""
- @echo " $(SYSTEMS1)"
- @echo " $(SYSTEMS2)"
- @echo " $(SYSTEMS3)"
- @echo " $(SYSTEMS4)"
- @echo " $(SYSTEMS5)"
- @echo " $(SYSTEMS6)"
- @echo " $(SYSTEMS7)"
- @echo " $(SYSTEMS8)"
- @echo " $(SYSTEMS9)"
-# @echo ""
-# @echo\
-# 'Targets for related utilities (ZipInfo and fUnZip) include:'
-# @echo ""
-# @echo " $(SYS_UTIL1)"
-# @echo " $(SYS_UTIL2)"
- @echo ""
- @echo\
- 'For further (very useful) information, please read the comments in Makefile.'
- @echo ""
+INSTALLEDBIN = $(BIN_FUZ) \
+ $(BIN_SFX) \
+ $(BIN_UNZIP) \
+ $(BIN_ZGREP) \
+ $(BIN_ZINFO)
-generic_msg:
- @echo ""
- @echo\
- ' Attempting "make generic" now. If this fails for some reason, type'
- @echo\
- ' "make help" and/or "make list" for suggestions.'
- @echo ""
+INSTALLEDMAN = $(MANDIR1)/$(MAN_FUZ) \
+ $(MANDIR1)/$(MAN_SFX) \
+ $(MANDIR1)/$(MAN_UNZIP) \
+ $(MANDIR1)/$(MAN_ZGREP) \
+ $(MANDIR1)/$(MAN_ZINFO)
+
+INSTALLEDMAN_GZ = $(MANDIR1)/$(MAN_FUZ).gz \
+ $(MANDIR1)/$(MAN_SFX).gz \
+ $(MANDIR1)/$(MAN_UNZIP).gz \
+ $(MANDIR1)/$(MAN_ZGREP).gz \
+ $(MANDIR1)/$(MAN_ZINFO).gz
+
+# Solaris 2.x package stuff:
+PKGDIR = IZunzip
+VERSION = Version 6.1
###############################################
# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
###############################################
-# this is for GNU make; comment out and notify zip-bugs if it causes errors
-.SUFFIXES: .c .o .obj .pic.o
-
-# yes, we should be able to use the $O macro to combine these two, but it
-# fails on some brain-damaged makes (e.g., AIX's)...no big deal
-.c.o:
- $(CC) -c $(CF) $*.c
-
-.c.obj:
- $(CC) -c $(CF) $*.c
-
-.c.pic.o:
- $(CC) -c $(CF) -o $@ $*.c
-
-# this doesn't work...directories are always a pain with implicit rules
-#.1.txt: man/$<
-# nroff -Tman -man $< | col -b | uniq | \
-# sed 's/Sun Release ..../Info-ZIP /' > $@
-
-
-# these rules may be specific to Linux (or at least the GNU groff package)
-# and are really intended only for the authors' use in creating non-Unix
-# documentation files (which are provided with both source and binary
-# distributions). We should probably add a ".1.txt" rule for more generic
-# systems...
-
-funzip.txt: man/funzip.1
- nroff -Tascii -man man/funzip.1 | col -bx | uniq | expand > $@
-
-unzip.txt: man/unzip.1
- nroff -Tascii -man man/unzip.1 | col -bx | uniq | expand > $@
-
-unzipsfx.txt: man/unzipsfx.1
- nroff -Tascii -man man/unzipsfx.1 | col -bx | uniq | expand > $@
-
-zipgrep.txt: man/zipgrep.1
- nroff -Tascii -man man/zipgrep.1 | col -bx | uniq | expand > $@
-
-zipinfo.txt: man/zipinfo.1
- nroff -Tascii -man man/zipinfo.1 | col -bx | uniq | expand > $@
-
-
-all: generic_msg generic
-unzips: $(UNZIPS)
-objs: $(OBJS)
-objsdll: $(OBJSDLL)
-docs: $(DOCS)
-unzipsman: unzips docs
-unzipsdocs: unzips docs
-
-
-# EDIT HERE FOR PARALLEL MAKES on Sequent (and others?)--screws up MS-DOS
-# make utilities if default: change "unzip$E:" to "unzip$E:&"
-
-unzip$E: $(OBJS) $(LIBBZ2) # add `&' for parallel makes
- $(LD) $(LF) -L$(IZ_BZIP2) $(LOBJS) $(L_BZ2) $(LF2)
-
-unzipsfx$E: $(OBJX) # add `&' for parallel makes
- $(LD) $(SL) $(LOBJX) $(SL2)
-
-funzip$E: $(OBJF) # add `&' for parallel makes
- $(LD) $(FL) $(OBJF) $(FL2)
-
-zipinfo$E: unzip$E # `&' is pointless here...
- @echo\
- ' This is a Unix-specific target. ZipInfo is not enabled in some MS-DOS'
- @echo\
- ' versions of UnZip; if it is in yours, copy unzip.exe to zipinfo.exe'
- @echo\
- ' or else invoke as "unzip -Z" (in a batch file, for example).'
- $(LN) unzip$E zipinfo$E
-
-# when the optional bzip2 support is provided (as recommended) by sources
-# in the 'bzip2' subdirectory, create/update the library:
-$(IZ_OUR_BZIP2_DIR)/libbz2.a:
- @echo "Building/updating bzip2 object library..."
- ( cd $(IZ_OUR_BZIP2_DIR) ; $(MAKE) -f Makebz2.iz CC="$(CC_BZ)"\
- CFLAGS="$(CFLAGS_BZ)" RM="rm -f" )
-
-
-crc32$O: crc32.c $(UNZIP_H) zip.h crc32.h
-crypt$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
-envargs$O: envargs.c $(UNZIP_H)
-explode$O: explode.c $(UNZIP_H)
-extract$O: extract.c $(UNZIP_H) crc32.h crypt.h
-fileio$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
-funzip$O: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
-globals$O: globals.c $(UNZIP_H)
-inflate$O: inflate.c inflate.h $(UNZIP_H)
-list$O: list.c $(UNZIP_H)
-match$O: match.c $(UNZIP_H)
-process$O: process.c $(UNZIP_H) crc32.h
-ttyio$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
-ubz2err$O: ubz2err.c $(UNZIP_H)
-unreduce$O: unreduce.c $(UNZIP_H)
-unshrink$O: unshrink.c $(UNZIP_H)
-unzip$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
-zipinfo$O: zipinfo.c $(UNZIP_H)
-
-# unzipsfx compilation section
-unzipsfx$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
+#----------------------------------------------------------------------------
+# Build rules: File suffixes
+# - Disable all built-in rules.
+# - Only explicit 1:1 rules are used.
+#----------------------------------------------------------------------------
+.SUFFIXES:
+
+#----------------------------------------------------------------------------
+# Build rules: C compile (.c -> .o)
+# - Explicit 1:1 rules are used.
+# - Across various "make" utilities, pattern rule support is inconsistent.
+# - Sys V "make" may have problems with $< when input and output names differ.
+#----------------------------------------------------------------------------
+
+# C Compile rules: UnZip
+
+# A) Core UnZip C files
+
+$(PROD)/unzip.o: unzip.c $(H_UNZIP) consts.h crypt.h unzvers.h
+ $(CC) -c $(CF) -o $@ unzip.c
+
+$(PROD)/crc32.o: crc32.c $(H_UNZIP) crc32.h zip.h
+ $(CC) -c $(CF) -o $@ crc32.c
+
+$(PROD)/crypt.o: crypt.c $(H_UNZIP) crc32.h crypt.h ttyio.h zip.h
+ $(CC) -c $(CF) -o $@ crypt.c
+
+$(PROD)/envargs.o: envargs.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ envargs.c
+
+$(PROD)/explode.o: explode.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ explode.c
+
+$(PROD)/extract.o: extract.c $(H_UNZIP) crc32.h crypt.h
+ $(CC) -c $(CF) -o $@ extract.c
+
+$(PROD)/fileio.o: fileio.c $(H_UNZIP) crc32.h crypt.h ebcdic.h ttyio.h
+ $(CC) -c $(CF) -o $@ fileio.c
+
+$(PROD)/globals.o: globals.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ globals.c
+
+$(PROD)/inflate.o: inflate.c $(H_UNZIP) inflate.h
+ $(CC) -c $(CF) -o $@ inflate.c
+
+$(PROD)/list.o: list.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ list.c
+
+$(PROD)/match.o: match.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ match.c
+
+$(PROD)/process.o: process.c $(H_UNZIP) crc32.h
+ $(CC) -c $(CF) -o $@ process.c
+
+$(PROD)/ttyio.o: ttyio.c $(H_UNZIP) crypt.h ttyio.h zip.h
+ $(CC) -c $(CF) -o $@ ttyio.c
+
+$(PROD)/ubz2err.o: ubz2err.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ ubz2err.c
+
+$(PROD)/unreduce.o: unreduce.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ unreduce.c
+
+$(PROD)/unshrink.o: unshrink.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ unshrink.c
+
+$(PROD)/zipinfo.o: zipinfo.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ zipinfo.c
+
+# A') Callable UnZip C files
+
+$(PROD)/api_l.o: api.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ api.c
+
+$(PROD)/apihelp_l.o: apihelp.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ apihelp.c
+
+$(PROD)/crypt_l.o: crypt.c $(H_UNZIPL) crc32.h crypt.h ttyio.h zip.h
+ $(CC) -c $(CF) -DDLL -o $@ crypt.c
+
+$(PROD)/explode_l.o: explode.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ explode.c
+
+$(PROD)/extract_l.o: extract.c $(H_UNZIPL) crc32.h crypt.h
+ $(CC) -c $(CF) -DDLL -o $@ extract.c
+
+$(PROD)/fileio_l.o: fileio.c $(H_UNZIPL) crc32.h crypt.h ebcdic.h ttyio.h
+ $(CC) -c $(CF) -DDLL -o $@ fileio.c
+
+$(PROD)/globals_l.o: globals.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ globals.c
+
+$(PROD)/inflate_l.o: inflate.c $(H_UNZIPL) inflate.h
+ $(CC) -c $(CF) -DDLL -o $@ inflate.c
+
+$(PROD)/list_l.o: list.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ list.c
+
+$(PROD)/process_l.o: process.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ process.c
+
+$(PROD)/ttyio_l.o: ttyio.c $(H_UNZIPL) crypt.h ttyio.h zip.h
+ $(CC) -c $(CF) -DDLL -o $@ ttyio.c
+
+$(PROD)/ubz2err_l.o: ubz2err.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ ubz2err.c
+
+$(PROD)/unreduce_l.o: unreduce.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ unreduce.c
+
+$(PROD)/unshrink_l.o: unshrink.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ unshrink.c
+
+$(PROD)/unzip_l.o: unzip.c $(H_UNZIPL) consts.h crypt.h unzvers.h
+ $(CC) -c $(CF) -DDLL -o $@ unzip.c
+
+$(PROD)/zipinfo_l.o: zipinfo.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ zipinfo.c
+
+$(PROD)/unix_l.o: unix/unix.c $(H_UNZIPL) unix/macosx.h
+ $(CC) -c $(CF) -DDLL -o $@ unix/unix.c
+
+# B) UnZip C files for specific ports
+# - Files under msdos and os2 are used when cross compiling for those ports
+# - Generated when referenced by OSDEP_OC*
+# - OSDEP_OC* are customized by unix/configure, based on PORT macro
+
+$(PROD)/msdos.o: msdos/msdos.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ msdos/msdos.c
+
+$(PROD)/os2.o: os2/os2.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ os2/os2.c
+
+$(PROD)/unix.o: unix/unix.c $(H_UNZIP) unix/macosx.h
+ $(CC) -c $(CF) -o $@ unix/unix.c
+
+$(PROD)/nt.o: win32/nt.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ win32/nt.c
+
+$(PROD)/win32.o: win32/win32.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ win32/win32.c
+
+$(PROD)/win32i64.o: win32/win32i64.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ win32/win32i64.c
+
+# C Compile rules: UnZip DLL
+$(PROD)/api.o: api.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ api.c
+
+$(PROD)/apihelp.o: apihelp.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ apihelp.c
+
+$(PROD)/unzipstb.o: unzipstb.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ unzipstb.c
+
+# B) UnZip DLL C files for specific ports
+# - Generated when referenced by OSDEP_OC*
+# - OSDEP_OC* are customized by unix/configure, based on PORT macro
+
+$(PROD)/nt_l.o: win32/nt.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ win32/nt.c
+
+$(PROD)/win32_l.o: win32/win32.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ win32/win32.c
+
+$(PROD)/win32i64_l.o: win32/win32i64.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ win32/win32i64.c
+
+# C Compile rules: UnZipSFX
+
+# A) Core UnZipSFX C files
+$(PROD)/unzipsfx.o: unzip.c $(H_UNZIP) crypt.h unzvers.h consts.h
$(CC) -c $(CF) -DSFX -o $@ unzip.c
-crc32_$O: crc32.c $(UNZIP_H) zip.h crc32.h
+$(PROD)/crc32_s.o: crc32.c $(H_UNZIP) zip.h crc32.h
$(CC) -c $(CF) -DSFX -o $@ crc32.c
-crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
+$(PROD)/crypt_s.o: crypt.c $(H_UNZIP) zip.h crypt.h crc32.h ttyio.h
$(CC) -c $(CF) -DSFX -o $@ crypt.c
-extract_$O: extract.c $(UNZIP_H) crc32.h crypt.h
+$(PROD)/extract_s.o: extract.c $(H_UNZIP) crc32.h crypt.h
$(CC) -c $(CF) -DSFX -o $@ extract.c
-fileio_$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
+$(PROD)/fileio_s.o: fileio.c $(H_UNZIP) crc32.h crypt.h ttyio.h ebcdic.h
$(CC) -c $(CF) -DSFX -o $@ fileio.c
-globals_$O: globals.c $(UNZIP_H)
+$(PROD)/globals_s.o: globals.c $(H_UNZIP)
$(CC) -c $(CF) -DSFX -o $@ globals.c
-inflate_$O: inflate.c inflate.h $(UNZIP_H) crypt.h
+$(PROD)/inflate_s.o: inflate.c $(H_UNZIP) inflate.h
$(CC) -c $(CF) -DSFX -o $@ inflate.c
-match_$O: match.c $(UNZIP_H)
+$(PROD)/match_s.o: match.c $(H_UNZIP)
$(CC) -c $(CF) -DSFX -o $@ match.c
-process_$O: process.c $(UNZIP_H) crc32.h
+$(PROD)/process_s.o: process.c $(H_UNZIP) crc32.h
$(CC) -c $(CF) -DSFX -o $@ process.c
-ttyio_$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
+$(PROD)/ttyio_s.o: ttyio.c $(H_UNZIP) zip.h crypt.h ttyio.h
$(CC) -c $(CF) -DSFX -o $@ ttyio.c
-ubz2err_$O: ubz2err.c $(UNZIP_H)
+$(PROD)/ubz2err_s.o: ubz2err.c $(H_UNZIP)
$(CC) -c $(CF) -DSFX -o $@ ubz2err.c
+# B) UnZipSFX C files for specific ports
+# - Generated when referenced by OSDEP_OC*
+# - OSDEP_OC* are customized by unix/configure, based on PORT macro
+
+$(PROD)/msdos_s.o: msdos/msdos.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ msdos/msdos.c
+
+$(PROD)/os2_s.o: os2/os2.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ os2/os2.c
+
+$(PROD)/unix_s.o: unix/unix.c $(H_UNZIP) unix/macosx.h
+ $(CC) -c $(CF) -DSFX -o $@ unix/unix.c
+
+$(PROD)/nt_s.o: win32/nt.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ win32/nt.c
+
+$(PROD)/win32_s.o: win32/win32.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ win32/win32.c
-# funzip compilation section
-cryptf$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
+$(PROD)/win32i64_s.o: win32/win32i64.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ win32/win32i64.c
+
+# C Compile rules: fUnZip
+$(PROD)/funzip.o: funzip.c $(H_UNZIP) crc32.h crypt.h ttyio.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ funzip.c
+
+$(PROD)/crc32_f.o: crc32.c $(H_UNZIP) zip.h crc32.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ crc32.c
+
+$(PROD)/crypt_f.o: crypt.c $(H_UNZIP) zip.h crypt.h crc32.h ttyio.h
$(CC) -c $(CF) -DFUNZIP -o $@ crypt.c
-globalsf$O: globals.c $(UNZIP_H)
+$(PROD)/globals_f.o: globals.c $(H_UNZIP)
$(CC) -c $(CF) -DFUNZIP -o $@ globals.c
-inflatef$O: inflate.c inflate.h $(UNZIP_H) crypt.h
+$(PROD)/inflate_f.o: inflate.c $(H_UNZIP) inflate.h
$(CC) -c $(CF) -DFUNZIP -o $@ inflate.c
-ttyiof$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
+$(PROD)/ttyio_f.o: ttyio.c $(H_UNZIP) zip.h crypt.h ttyio.h
$(CC) -c $(CF) -DFUNZIP -o $@ ttyio.c
+# B) fUnZip C files for specific ports
+# - Generated when referenced by OSDEP_OC*
+# - OSDEP_OC* are customized by unix/configure, based on PORT macro
+
+$(PROD)/unix_f.o: unix/unix.c $(H_UNZIP) unix/macosx.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ unix/unix.c
+
+$(PROD)/win32_f.o: win32/win32.c $(H_UNZIP)
+ $(CC) -c $(CF) -DFUNZIP -o $@ win32/win32.c
+
+$(PROD)/win32i64_f.o: win32/win32i64.c $(H_UNZIP)
+ $(CC) -c $(CF) -DFUNZIP -o $@ win32/win32i64.c
+
+#----------------------------------------------------------------------------
+
+# C Compile rules: AES (WinZip/Gladman) encryption
+
+$(PROD)/aescrypt.o: aes_wg/aescrypt.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/aescrypt.c
+
+$(PROD)/aeskey.o: aes_wg/aeskey.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/aeskey.c
+
+$(PROD)/aestab.o: aes_wg/aestab.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/aestab.c
+
+$(PROD)/fileenc.o: aes_wg/fileenc.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/fileenc.c
+
+$(PROD)/hmac.o: aes_wg/hmac.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/hmac.c
+
+$(PROD)/prng.o: aes_wg/prng.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/prng.c
+
+$(PROD)/pwd2key.o: aes_wg/pwd2key.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/pwd2key.c
+
+$(PROD)/sha1.o: aes_wg/sha1.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/sha1.c
+
+#----------------------------------------------------------------------------
+
+# C Compile rules: LZMA compression
+
+$(PROD)/LzFind.o: szip/LzFind.c $(H_LZMA)
+ $(CC) -c $(CF) -o $@ szip/LzFind.c
+
+$(PROD)/LzmaDec.o: szip/LzmaDec.c $(H_LZMA)
+ $(CC) -c $(CF) -o $@ szip/LzmaDec.c
+
+#----------------------------------------------------------------------------
+
+# C Compile rules: PPMd compression
-# optional assembler replacements
-crc_i86$O: msdos/crc_i86.asm # 16bit only
- $(AS) $(AF) msdos/crc_i86.asm $(ASEOL)
+$(PROD)/Ppmd8.o: szip/Ppmd8.c $(H_PPMD)
+ $(CC) -c $(CF) -o $@ szip/Ppmd8.c
-crc_gcc$O: crc_i386.S $(ACONF_DEP) # 32bit, GNU AS
- $(AS) $(AF) -x assembler-with-cpp -c -o $@ crc_i386.S
+$(PROD)/Ppmd8Dec.o: szip/Ppmd8Dec.c $(H_PPMD)
+ $(CC) -c $(CF) -o $@ szip/Ppmd8Dec.c
-crc_gcc.pic.o: crc_i386.S $(ACONF_DEP) # 32bit, GNU AS
- $(AS) $(AF) -x assembler-with-cpp -c -o $@ crc_i386.S
+#----------------------------------------------------------------------------
+# Build rules: Assemble (.S -> .o)
+# - Optional assembler replacements for C routines
+# - All are port-specific
+# - Generated when referenced by OSDEP_OS
+# - OSDEP_OS is customized by unix/configure, based on PORT macro
+#----------------------------------------------------------------------------
-crc_sysv$O: crc_i386.S $(ACONF_DEP) # 32bit, SysV AS
- $(CC) -E $(AF) crc_i386.S > crc_i386s.s
- $(AS) -o $@ crc_i386s.s
+# Assembler rule: CRC-32
+#
+# 1) Assembler rule: CRC, 16-bit only, MSDOS
+$(O_CRC_I): msdos/crc_i86.asm
+ $(AS) $(AF) -c -o $@ msdos/crc_i86.asm $(ASEOL)
+
+# 2) Assembler rule: CRC 32bit, GNU AS
+$(O_CRC_G): crc_i386.S $(ACONF_DEP)
+ $(AS) $(AF) -c -o $@ crc_i386.S
+
+# 3) Assembler rule: CRC 32bit, SysV AS
+$(O_CRC_SV): crc_i386.S $(ACONF_DEP)
+ $(CPP) $(AF) crc_i386.S > _crc_i386s.s
+ $(AS) -c -o $@ crc_i386s.s
$(RM) crc_i386s.s
-msdos$O: msdos/msdos.c $(UNZIP_H) unzvers.h # DOS only
- $(CC) -c $(CF) msdos/msdos.c
+#----------------------------------------------------------------------------
+# Build rules: Object archives (.o -> .a)
+#----------------------------------------------------------------------------
+
+# Object archive rule: AES (WinZip/Gladman) encryption
+
+$(AR_AES): $(O_AES)
+ @echo 'Building/updating AES (WinZip/Gladman) object library...'
+ -$(RM) $@
+ $(AR) $@ $(O_AES)
+ -$(RANLIB) $@
+
+# Object archive rule: LZMA compression
+
+$(AR_LZMA): $(O_LZMA)
+ @echo 'Building/updating LZMA object library...'
+ -$(RM) $@
+ $(AR) $@ $(O_LZMA)
+ -$(RANLIB) $@
+
+# Object archive rule: PPMd compression
+
+$(AR_PPMD): $(O_PPMD)
+ @echo 'Building/updating PPMd object library...'
+ -$(RM) $@
+ $(AR) $@ $(O_PPMD)
+ -$(RANLIB) $@
+
+# Object archive rule: BZIP2 compression
+
+$(AR_BZ):
+ @echo 'Building/updating BZIP2 object library...'
+ @if [ -f $(PROD)/flags_bz ]; then \
+ ( cd bzip2/; \
+ echo "Using flags_bz overrides"; \
+ eval $(MAKE) -f $(MK_BZ) libbz2.a ACONF_DEP=$(PROD)/flags_bz \
+ `cat ../$(PROD)/flags_bz`; \
+ ); \
+ else \
+ ( cd bzip2/; \
+ eval $(MAKE) -f $(MK_BZ) CC="$(CC_BZ)" CFLAGS="$(CF_BZ)" \
+ RANLIB="$(RANLIB)" RM="rm -f" libbz2.a; \
+ ); \
+ fi
+
+# Object archive rule: ZLIB compression
+
+$(AR_Z):
+ @echo 'Building/updating ZLIB object library...'
+ ( cd zlib/; \
+ eval $(MAKE) -f Makefile libz.a ACONF_DEP=$(PROD)/flags \
+ `cat ../$(PROD)/flags`; \
+ )
+
+# Object archive rule: Callable UnZip
+
+$(AR_UNZIP): $(O_UNZIPL) $(O_UNZIPN) $(LIB_AES_WG) $(LIB_LZMA) $(LIB_PPMD)
+ @echo 'Building/updating Callable UnZip object library...'
+ unix/mlz.sh "$(AR_UNZIP)" "$(O_UNZIPL) $(O_UNZIPN)" \
+ $(LIB_AES_WG) $(LIB_LZMA) $(LIB_PPMD)
+ -$(RANLIB) $@
-msdos_$O: msdos/msdos.c $(UNZIP_H) # DOS unzipsfx
- -$(CP) msdos/msdos.c msdos_.c > nul
- $(CC) -c $(CF) -DSFX msdos_.c
- $(RM) msdos_.c
+#----------------------------------------------------------------------------
+# Build rules: Link programs (.o + .a -> unzips)
+#----------------------------------------------------------------------------
-#os2$O: os2/os2.c $(UNZIP_H) # OS/2 only
-# $(CC) -c $(CF) os2/os2.c
+# Link rule: unzip
-unix$O: unix/unix.c $(UNZIP_H) unzvers.h # Unix only
- $(CC) -c $(CF) unix/unix.c
+$(PPGM_UNZIP): $(O_UNZIP) $(LIB_AES_WG) $(LIB_BZ) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LIB_Z)
+ $(LD) -o $@ $(LF1) $(O_UNZIP) $(LIB_AES_WG) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LF2)
-unix_$O: unix/unix.c $(UNZIP_H) # Unix unzipsfx
- $(CC) -c $(CF) -DSFX -o $@ unix/unix.c
+# Link rule: unzipsfx
-unix.pic.o: unix/unix.c $(UNZIP_H) unzvers.h # Unix shlib
- $(CC) -c $(CF) -o $@ unix/unix.c
+$(PPGM_SFX): $(O_SFX) $(LIB_AES_WG) $(LIB_BZ) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LIB_Z)
+ $(LD) -o $@ $(LF1) $(O_SFX) $(LIB_AES_WG) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LF2)
+
+# Link rule: funzip
+
+$(PPGM_FUZ): $(O_FUZ) $(LIB_AES_WG) $(LIB_BZ) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LIB_Z)
+ $(LD) -o $@ $(LF1) $(O_FUZ) $(LIB_AES_WG) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LF2)
+
+# Link rule: zipinfo
+
+$(PPGM_ZINFO): $(PPGM_UNZIP)
+ @echo ' This is a Unix-specific target.'
+ @echo ''
+ @echo ' ZipInfo is not enabled in some MS-DOS versions of UnZip;'
+ @echo ' if it is in yours, copy unzip.exe to zipinfo.exe, or else'
+ @echo ' invoke as "unzip -Z" (in a batch file, for example).'
+ $(LN) $(PPGM_UNZIP) $(PPGM_ZINFO)
+
+#----------------------------------------------------------------------------
+# Build rules: Documentation
+# - Explicit 1:1 rules are used.
+# - Across various "make" utilities, pattern rule support is inconsistent.
+# - Sys V "make" ay hava problems with $< when input and output names differ.
+#----------------------------------------------------------------------------
+
+# UnZip documentation output directory rules
+# - Creates $(PROD)/manout directory if unix/configure not executed
+
+$(PROD)/manout:
+ if [ ! -d "$(PROD)" ]; then mkdir "$(PROD)"; fi
+ if [ ! -d "$@" ]; then mkdir "$@"; fi
+
+# UnZip text documentation generation rules
+#
+# SunOS 4.x quirks:
+# "man -M" requires an absolute path, hence "`pwd`/".
+# /bin/man does not support "-x". Specify "COL=/usr/5bin/col".
+
+$(DOC_UNZIP): man/man1/unzip.1
+ man -M ` pwd `/man unzip | $(COL) -bx | uniq | expand > $@
+ @echo ''
+
+$(DOC_SFX): man/man1/unzipsfx.1
+ man -M ` pwd `/man unzipsfx | $(COL) -bx | uniq | expand > $@
+ @echo ''
+
+$(DOC_FUZ): man/man1/funzip.1
+ man -M ` pwd `/man funzip | $(COL) -bx | uniq | expand > $@
+ @echo ''
+
+$(DOC_ZINFO): man/man1/zipinfo.1
+ man -M ` pwd `/man zipinfo | $(COL) -bx | uniq | expand > $@
+ @echo ''
+
+$(DOC_ZGREP): man/man1/zipgrep.1
+ man -M ` pwd `/man zipgrep | $(COL) -bx | uniq | expand > $@
+ @echo ''
+
+# UnZip man page generation rule
+# - Requires nroff, or GNU groff package
+
+$(PMAN_UNZIP): man/man1/unzip.1
+ nroff -man man/man1/unzip.1 | $(COL) -bx | uniq > $@
+
+$(PMAN_SFX): man/man1/unzipsfx.1
+ nroff -man man/man1/unzipsfx.1 | $(COL) -bx | uniq > $@
+$(PMAN_FUZ): man/man1/funzip.1
+ nroff -man man/man1/funzip.1 | $(COL) -bx | uniq > $@
+$(PMAN_ZINFO): man/man1/zipinfo.1
+ nroff -man man/man1/zipinfo.1 | $(COL) -bx | uniq > $@
+
+$(PMAN_ZGREP): man/man1/zipgrep.1
+ nroff -man man/man1/zipgrep.1 | $(COL) -bx | uniq > $@
+
+#----------------------------------------------------------------------------
+# Build rules: Standard build targets
+#----------------------------------------------------------------------------
+
+all: generic_msg generic
+docs: $(PROD)/manout $(UNZIP_DOCS)
+manuals: $(PROD)/manout $(UNZIP_PMANS)
+
+# Binaries build list (BINS) options:
+L: $(LIB_UNZIP)
+LM: $(LIB_UNZIP) $(PPGM_UNZIP)
+LMU: $(LIB_UNZIP) $(UNZIP_PPGMS)
+LU: $(LIB_UNZIP) $(PPGM_FUZ) $(PPGM_SFX)
+M: $(PPGM_UNZIP)
+MU: $(UNZIP_PPGMS)
+U: $(PPGM_FUZ) $(PPGM_SFX)
+
+#----------------------------------------------------------------------------
+# Build rules: ???????
+# FIX_ME: ??????
+#----------------------------------------------------------------------------
unix_make:
-# @echo\
+# @echo \
# '(Ignore any errors from `make'"' due to the following command; it's harmless.)"
-@2>&1 $(LN) unix/Makefile . > /dev/null || echo > /dev/null
+ if [ ! -d $(PROD) ]; then mkdir "$(PROD)"; fi
+
+#----------------------------------------------------------------------------
+# Build rules: Configuration flags.
+# - Creates files containing system-dependent flag values.
+# - Generated by unix/configure based on build utility program, platform and
+# features selected.
+#----------------------------------------------------------------------------
+
+# Main flags
+
+config_flags: $(PROD)/flags
+
+$(PROD)/flags: unix/configure
+ @echo "Running: unix/configure"
+ @sh unix/configure \
+ "PROD='$(PROD)'" \
+ "LIST='$(LIST)'" \
+ "CC='$(CC)'" \
+ "CFLAGS='$(LOCAL_UNZIP)'" \
+ "LFLAGS1='$(LFLAGS1)'" \
+ "LFLAGS2='$(LFLAGS2)'" \
+ "NO_AES_WG='$(NO_AES_WG)'" \
+ "IZ_BZIP2='$(IZ_BZIP2)'" \
+ "NO_IZ_BZIP2='$(NO_IZ_BZIP2)'" \
+ "NO_LZMA='$(NO_LZMA)'" \
+ "NO_PPMD='$(NO_PPMD)'" \
+ "IZ_ZLIB='$(IZ_ZLIB)'"
+
+# BZIP2 flags
+
+config_flags_bz: $(PROD)/flags_bz
+
+$(PROD)/flags_bz: $(PROD)/flags
+
+# C macros, and their effects:
+# ZMEM - includes C language versions of memset(), memcpy(),
+# and memcmp() (util.c).
+# HAVE_DIRENT_H - use <dirent.h> instead of <sys/dir.h>
+# NODIR - for 3B1, which has neither getdents() nor opendir().
+# HAVE_NDIR_H - use <ndir.h> (unix/unix.c).
+# HAVE_SYS_DIR_H - use <sys/dir.h>
+# HAVE_SYS_NDIR_H - use <sys/ndir.h>
+# UTIL - select routines for utilities (note, cloak, split)
+# NO_RMDIR - remove directories using a system("rmdir ...") call.
+# NO_PROTO - cannot handle ANSI prototypes
+# NO_CONST - cannot handle ANSI const
+# NO_LARGE_FILE_SUPPORT - do not enable Large File support even if available.
+# NO_ZIP64_SUPPORT - do not enable Zip64 archive support even if available.
+# NO_UNICODE_SUPPORT - do not enable Unicode support even if available.
+# NO_BZIP2_SUPPORT - do not compile in bzip2 code even if available.
+
+#----------------------------------------------------------------------------
+# Build rules: Clean-up targets
+# - Used to remove old output files before performing a new build
+# - Used when incompatible build options (or source changes) are required.
+#----------------------------------------------------------------------------
-# this really only works for Unix targets, unless E and O specified on cmd line
clean:
- @echo ""
- @echo ' This is a Unix-specific target. (Just so you know.)'
- @echo ""
- -( cd $(IZ_OUR_BZIP2_DIR); $(MAKE) -f Makebz2.iz RM="rm -f" clean )
- rm -f $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O \
- crc_sysv$O unzipstb$O crypt_.c extract_.c globals_.c inflate_.c \
- ttyio_.c crc_i386s.s msdos_.c process_.c unix_.c unzipsfx.c
- rm -f flags
- rm -rf ./$(PKGDIR)
-
-# Package generation interface (by J.Bush). Originally tested under Sun
-# Solaris 2.x. Other SVr4s may be very similar and could possibly use this.
-# Note: expects version info to be stored in VERSION macro variable.
-# See "README" under ./unix/Packaging
-#
-svr4package: unzips
- @echo "Creating SVR4 package for Unix ..."
- -@rm -rf ./$(PKGDIR) ./$(PKGDIR)_`uname -p`.pkg
- -@sed -e "s/.VERSION./$(VERSION)/g" \
- -e "s/.PSTAMP./$(LOGNAME)_`date | tr ' ' '_'`/g" \
- -e "s/.ARCH./Solaris_`uname -rp | tr ' ' ','`/g" \
- ./unix/Packaging/pkginfo.in > ./unix/Packaging/pkginfo
- -@sed -e "s/.ARCH./`uname -p`/g" \
- ./unix/Packaging/preinstall.in > ./unix/Packaging/preinstall
- /usr/bin/pkgmk -d . -b . -r . -f ./unix/Packaging/prototype $(PKGDIR)
- /usr/bin/pkgtrans -o -s . $(PKGDIR)_`uname -p`.pkg $(PKGDIR)
- @echo " "
- @echo "To install, copy $(PKGDIR)_`uname -p`.pkg to the target system, and"
- @echo "issue the command (as root): pkgadd -d $(PKGDIR)_`uname -p`.pkg"
- @echo " "
+ @if unix/unsafe_prod.sh "$(PROD)"; then \
+ echo "Won't clean absolute (/x) or rising (../) PROD: $(PROD)"; \
+ else \
+ echo "rm -f \"$(PROD)\"/*.o \"$(PROD)\"/*.a $(UNZIP_PPGMS)"; \
+ rm -f "$(PROD)"/*.o "$(PROD)"/*.a $(UNZIP_PPGMS); \
+ echo "rm -f \"$(PROD)\"/flags \"$(PROD)\"/flags_bz"; \
+ rm -f "$(PROD)"/flags "$(PROD)"/flags_bz; \
+ echo "rm -f $(PROD)/manout"; \
+ rm -rf "$(PROD)"/manout; \
+ fi
+# # Remove empty $(PROD) directory.
+ if [ -d "$(PROD)" ]; then \
+ ls -1 "${PROD}"/* > /dev/null 2>&1 || \
+ rm -r "$(PROD)" ; \
+ fi
+ rm -rf $(PKGDIR)
+
+clean_bzip2:
+ @if [ -f bzip2/$(MK_BZ) ]; then \
+ ( cd bzip2; make -f $(MK_BZ) clean ); \
+ else \
+ echo "Expected bzip2 \"make\" file not found: bzip2/$(MK_BZ)"; \
+ fi;
+
+clean_exe:
+ rm -f $(UNZIP_PPGMS) $(PPGM_ZINFO)
+
+clean_docs:
+ rm -f $(UNZIP_DOCS)
+
+#----------------------------------------------------------------------------
+# Build rules: Installation-related
+#----------------------------------------------------------------------------
+
+install: install_bin install_man
-install: $(MANS)
+install_gz: install_bin install_man_gz
+
+install_bin:
-$(INSTALL_D) $(BINDIR)
- $(INSTALL_PROGRAM) $(UNZIPS) $(BINDIR)
- $(INSTALL) unix/zipgrep $(BINDIR)
- $(RM) $(BINDIR)/zipinfo$E
- $(LN) $(BINDIR)/unzip$E $(BINDIR)/zipinfo$E
- -$(INSTALL_D) $(MANDIR)
- $(INSTALL) man/funzip.1 $(MANDIR)/funzip.$(manext)
- $(INSTALL) man/unzip.1 $(MANDIR)/unzip.$(manext)
- $(INSTALL) man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
- $(INSTALL) man/zipgrep.1 $(MANDIR)/zipgrep.$(manext)
- $(INSTALL) man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
+ $(INSTALL_PROGRAM) $(UNZIP_PPGMS) $(PPGM_ZGREP) $(BINDIR)
+ $(RM) $(BIN_ZINFO)
+ $(LN) $(BIN_UNZIP) $(BIN_ZINFO)
$(CHMOD) $(BINPERMS) $(INSTALLEDBIN)
+
+install_man:
+ -$(INSTALL_D) $(MANDIR1)
+ $(INSTALL) man/man1/funzip.1 $(MANDIR1)/$(MAN_FUZ)
+ $(INSTALL) man/man1/unzip.1 $(MANDIR1)/$(MAN_UNZIP)
+ $(INSTALL) man/man1/unzipsfx.1 $(MANDIR1)/$(MAN_SFX)
+ $(INSTALL) man/man1/zipgrep.1 $(MANDIR1)/$(MAN_ZGREP)
+ $(INSTALL) man/man1/zipinfo.1 $(MANDIR1)/$(MAN_ZINFO)
$(CHMOD) $(MANPERMS) $(INSTALLEDMAN)
+install_man_gz: install_man
+ gzip $(INSTALLEDMAN)
+
uninstall:
- $(RM) $(INSTALLEDBIN) $(INSTALLEDMAN)
+ $(RM) $(INSTALLEDBIN) $(INSTALLEDMAN) $(INSTALLEDMAN_GZ)
+
+#----------------------------------------------------------------------------
+# Build rules: SVR4 Package generation Interface
+# - Originally tested under Sun Solaris 2.x (by JBush)
+# - Other SVr4s may be very similar, and could possibly use this
+# Note: Expects version info to be stored in VERSION macro variable
+# See "README" under unix/Packaging
+#----------------------------------------------------------------------------
+
+svr4package: $(BINS)
+ @echo 'Creating SVR4 package for Unix ...'
+ -@rm -rf $(PKGDIR) $(PKGDIR)_`uname -p`.pkg
+ -@sed -e "s/.VERSION./$(VERSION)/g" \
+ -e "s/.PSTAMP./$(LOGNAME)_`date | tr ' ' '_'`/g" \
+ -e "s/.ARCH./Solaris_`uname -rp | tr ' ' ','`/g" \
+ unix/Packaging/pkginfo.in > unix/Packaging/pkginfo
+ -@sed -e "s/.ARCH./`uname -p`/g" \
+ unix/Packaging/preinstall.in > unix/Packaging/preinstall
+ /usr/bin/pkgmk -d . -b . -r . -f unix/Packaging/prototype $(PKGDIR)
+ /usr/bin/pkgtrans -o -s . $(PKGDIR)_`uname -p`.pkg $(PKGDIR)
+ @echo ''
+ @echo \
+ "To install, copy $(PKGDIR)_`uname -p`.pkg to the target system, and"
+ @echo \
+ "issue the command (as root): pkgadd -d $(PKGDIR)_`uname -p`.pkg"
+ @echo ''
+
+#----------------------------------------------------------------------------
+# Build rules: Make a distribution
+#----------------------------------------------------------------------------
-# added 10/28/04 EG
-flags: unix/configure
- sh unix/configure "${CC}" "${CF_NOOPT}" "${IZ_BZIP2}"
+dist: $(DOC_UNZIP)
+ eval unzip -r9 unzip`sed -e '/VERSION/!d' -e 's/.*"\(.*\)".*/\1/' \
+ -e 's/[.]//g' -e 's/ .*//g' -e q revision.h` *
+
+#----------------------------------------------------------------------------
+# Build rules: Unzip validation tests
+#----------------------------------------------------------------------------
-# the test zipfile
+# Test archives.
TESTZIP = testmake.zip
+TESTZIP_PPMD = testmake_ppmd.zip
-# test some basic features of the build
-test: check
-
-check:
- @echo '##### This is a Unix-specific target. (Just so you know.)'
- @echo '##### Make sure unzip, funzip and unzipsfx are compiled and'
- @echo '##### in this directory.'
- @if test ! -f ./unzip; then \
- echo "##### ERROR: can't find ./unzip"; exit 1; fi
- @if test ! -f ./funzip; then \
- echo "##### ERROR: can't find ./funzip"; exit 1; fi
- @if test ! -f ./unzipsfx; then \
- echo "##### ERROR: can't find ./unzipsfx"; exit 1; fi
-#
- @if test ! -f $(TESTZIP); then \
- echo "##### ERROR: can't find test file $(TESTZIP)"; exit 1; fi
-#
- @echo "##### testing extraction"
- @./unzip -bo $(TESTZIP) testmake.zipinfo
- @if test ! -f testmake.zipinfo ; then \
- echo "##### ERROR: file extraction from $(TESTZIP) failed"; \
- exit 1; fi
-#
- @echo '##### testing zipinfo (unzip -Z)'
- @./unzip -Z $(TESTZIP) > testmake.unzip-Z
- @if diff testmake.unzip-Z testmake.zipinfo; then echo "OK."; else \
- echo "##### WARNING: zipinfo output doesn't match stored version"; \
- echo '##### (If the only difference is the file times, compare your'; \
- echo '##### timezone with the Central European timezone, which is one'; \
- echo '##### hour east of Greenwich but effectively 2 hours east'; \
- echo '##### during summer Daylight Savings Time. The upper two'; \
- echo '##### lines should correspond to your local time when the'; \
- echo '##### files were created, on 19 November 1998 at 10:46pm CET.'; \
- echo '##### If the times are consistent, please ignore this warning.)'; \
- fi
- @$(RM) testmake.unzip-Z testmake.zipinfo
-#
- @echo '##### testing unzip -d exdir option'
- @./unzip -bo $(TESTZIP) -d testun notes
- @cat testun/notes
+# Test some basic features of the build.
+check: test
+
+dashv:
+ $(PROD)/unzip -v
+
+test:
+ sh unix/test_unzip.sh $(TESTZIP) $(PROD)
+
+test_ppmd:
+ sh unix/test_unzip.sh $(TESTZIP_PPMD) $(PROD) NOFUNSFX
+
+# Create a new testmake.zip or testmake_ppmd.zip.
#
- @echo '##### testing unzip -o and funzip (ignore funzip warning)'
- @./unzip -boq $(TESTZIP) notes -d testun
- @./funzip < $(TESTZIP) > testun/notes2
- @if diff testun/notes testun/notes2; then true; else \
- echo '##### ERROR: funzip output disagrees with unzip'; fi
+# These targets are intended for use by UnZip developers, not by normal
+# users. The method used relies on an existing testmake.zip file to
+# provide "notes", which historically has non-Unix line endings.
#
- @echo '##### testing unzipsfx (self-extractor)'
- @cat unzipsfx $(TESTZIP) > testsfx
- @$(CHMOD) 0700 testsfx
- @./testsfx -bo notes
- @if diff notes testun/notes; then true; else \
- echo '##### ERROR: unzipsfx file disagrees with unzip'; fi
- @$(RM) testsfx notes testun/notes testun/notes2
- @rmdir testun
+# Note that this is typically an iterative process, because the test
+# archive includes an "unzip -Z" report on itself, which often results
+# in mismatches on date-time and file size data. If the results don't
+# converge within a few iterations, then it may help to wait a minute (to
+# get a different date-time), or to replace the current testmake.zip with
+# the original (or some other old version).
#
- @echo '##### testing complete.'
-
-
-################################
-# INDIVIDUAL MACHINE MAKERULES #
-################################
+# While crude, the method used here does try to save the original
+# testmake[_ppmd].zip file as testmake[_ppmd].zip_orig, which is deleted
+# only if the "diff" succeeds, which normally allows a manual restoration
+# to the original state, if success remains elusive.
+
+testmake_zip:
+ @if test ! -f $(TESTZIP) ; then \
+ echo "***" ; \
+ echo "*** Missing \"$(TESTZIP)\". Expect chronic failure. ***" ; \
+ echo "***" ; \
+ fi
+ if test -f $(TESTZIP) -a ! -f $(TESTZIP)_orig ; then \
+ cp -p $(TESTZIP) $(TESTZIP)_orig ; \
+ fi
+ @rm -rf testmake
+ @mkdir testmake
+ @( cd testmake ; \
+ ../$(PROD)/unzip ../$(TESTZIP) > /dev/null ; \
+ touch testmake.zipinfo ; \
+ $(PGM_ZIP) -X $(TESTZIP) notes testmake.zipinfo > /dev/null ; \
+ ../$(PROD)/unzip -Z -mc- $(TESTZIP) > testmake.zipinfo ; \
+ $(PGM_ZIP) -X $(TESTZIP) notes testmake.zipinfo > /dev/null ; \
+ ../$(PROD)/unzip -Z -mc- $(TESTZIP) > testmake.zipinfo_new ; \
+ mv $(TESTZIP) ../$(TESTZIP) )
+ @if diff testmake/testmake.zipinfo \
+ testmake/testmake.zipinfo_new 2> /dev/null ; then \
+ echo '' ; echo " It's a miracle!" ; echo '' ; \
+ rm $(TESTZIP)_orig ; \
+ else \
+ echo '' ; echo ' Try again?' ; echo '' ; \
+ fi
+ @rm -r testmake
+
+testmake_ppmd_zip:
+ @if test ! -f $(TESTZIP_PPMD) ; then \
+ cp -p $(TESTZIP) $(TESTZIP_PPMD) ; \
+ fi
+ if test -f $(TESTZIP_PPMD) -a ! -f $(TESTZIP_PPMD)_orig ; then \
+ cp -p $(TESTZIP_PPMD) $(TESTZIP_PPMD)_orig ; \
+ fi
+ @rm -rf testmake
+ @mkdir testmake
+ @( cd testmake ; \
+ ../$(PROD)/unzip ../$(TESTZIP_PPMD) > /dev/null ; \
+ touch testmake.zipinfo ; \
+ $(PGM_ZIP) -X -Z ppmd $(TESTZIP_PPMD) notes testmake.zipinfo > \
+ /dev/null ; \
+ ../$(PROD)/unzip -Z -mc- $(TESTZIP_PPMD) > testmake.zipinfo ; \
+ $(PGM_ZIP) -X -Z ppmd $(TESTZIP_PPMD) notes testmake.zipinfo > \
+ /dev/null ; \
+ ../$(PROD)/unzip -Z -mc- $(TESTZIP_PPMD) > testmake.zipinfo_new ; \
+ mv $(TESTZIP_PPMD) ../$(TESTZIP_PPMD) )
+ @if diff testmake/testmake.zipinfo \
+ testmake/testmake.zipinfo_new 2> /dev/null ; then \
+ echo '' ; echo " It's a miracle!" ; echo '' ; \
+ rm $(TESTZIP_PPMD)_orig ; \
+ else \
+ echo '' ; echo ' Try again?' ; echo '' ; \
+ fi
+ @rm -r testmake
+
+############################
+# INDIVIDUAL MACHINE RULES #
+############################
#----------------------------------------------------------------------------
-# Generic targets using the configure script to determine configuration.
+# Generic targets
+# - These invoke the configure script to determine configuration.
#----------------------------------------------------------------------------
-# Well, try MAKE and see. By now everyone may be happy. 10/28/04 EG
-generic: flags # now try autoconfigure first
- eval $(MAKE) $(MAKEF) unzips ACONF_DEP=flags `cat flags`
-# make $(MAKEF) unzips CF="${CF} `cat flags`"
+# generic_msg
+# - Issue warning message before generic build
+
+generic_msg:
+ @echo ''
+ @echo ' Attempting "make generic" now. If this fails for some reason, type'
+ @echo ' "make help" for suggestions. If none of the targets work for you,'
+ @echo ' contact us using the information in README so we can work the'
+ @echo ' problems.'
+ @echo ''
+
+# generic
+# - Generate flags file (if doesn't exist), then unzip modules
-generic_gcc:
- $(MAKE) $(MAKEF) generic CC=gcc IZ_BZIP2="$(IZ_BZIP2)"
+generic: $(PROD)/flags
+ eval $(MAKE) $(MAKEF) $(BINS) ACONF_DEP=$(PROD)/flags \
+ `cat $(PROD)/flags`
-# extensions to perform SVR4 package-creation after compilation
-generic_pkg: generic svr4package
-generic_gccpkg: generic_gcc svr4package
+# generic_pkg
+# - Generate flags file (if doesn't exist), then UnZip modules, then perform
+# SVR4 package-creation
+
+generic_pkg: generic svr4package
#----------------------------------------------------------------------------
-# Old static generic targets (can't assume make utility groks "$(MAKE)")
+# Old, non-"generic" targets
+# - For those systems which do not work with the generic targets.
+# - Can not assume that the "make" utility groks "$(MAKE)".
#----------------------------------------------------------------------------
-generic1: unzips # first try if unknown
-
-generic2: unix_make # second try if unknown: hope make is called "make"
- make $(MAKEF) unzips CF="$(CF) -DBSD"
-
-generic3: unix_make # third try if unknown: hope make is called "make"
- make $(MAKEF) unzips CF="$(CF) -DSYSV"
-
-# Generic build including bzip2 decompression support for unzip.
-# Requires presence of the bzip2 sources in subdirectory bzip2.
-
-generic_bz2: unix_make
- @echo\
- "This target assumes bzip2 sources are available in subfolder bzip2/."
- $(MAKE) $(MAKEF) unzips D_USE_BZ2="-DUSE_BZIP2"\
- L_BZ2="-lbz2" LIBBZ2="$(IZ_OUR_BZIP2_DIR)/libbz2.a" \
- CC_BZ="$(CC)" CFLAGS_BZ="$(CFLAGS)"
-
-# Generic unzip and funzip target using either shared or static zlib for
-# inflate rather than the original UnZip version. (libz was libgz prior
-# to 0.94) Need to figure out how to force unzipsfx to use static libz.
-
-generic_zlib: unix_make
- @echo\
- "This target assumes zlib (libz.a or libz.so.*) is already installed."
- $(MAKE) unzip funzip CF="$(CF) -DUSE_ZLIB" LF2="-lz $(LF2)"
-
-# Generic GNU C shared library. This is an example of how to compile UnZip as
-# a shared library. (Doing so as a static library would be similar.) See also
-# the linux_shlib target.
-
-generic_shlib: unix_make
- @echo\
- 'This target requires GNU C. When done, do "setenv LD_LIBRARY_PATH `pwd`"'
- @echo\
- 'or similar in order to test the shared library in place (with ./unzip_shlib ,'
- @echo\
- 'which is UnZip linked with the DLL). This target is an example only.'
- @echo ""
- $(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC -DDLL"
- gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)
- $(RM) libunzip.so.0 libunzip.so
- $(LN) -s libunzip.so.0.4 libunzip.so.0
- $(LN) -s libunzip.so.0 libunzip.so
- gcc -c -O unzipstb.c
- gcc -o unzip_shlib unzipstb.o -L. -lunzip
+generic1: $(BINS) # first try if unknown
+
+generic2: unix_make # second try if unknown: hope make is called "make"
+ make $(MAKEF) $(BINS) CF="$(CF) -DBSD"
+
+generic3: unix_make # third try if unknown: hope make is called "make"
+ make $(MAKEF) $(BINS) CF="$(CF) -DSYSV"
#----------------------------------------------------------------------------
# "Autoconfig" group, aliases for the generic targets using configure:
#----------------------------------------------------------------------------
# Solaris: generic, plus generation of installable package.
-solaris_pkg: generic_pkg
-
-# Solaris: forcing usage of GCC, plus generation of installable package.
-solaris_gccpkg: generic_gcc_pkg
+solaris: generic_pkg
#----------------------------------------------------------------------------
# "Normal" group (BSD vs. SysV may be set in unzip.h via predefined macros):
#----------------------------------------------------------------------------
-386i: unzips # sun386i, SunOS 4.0.2
-#3Bx: unzips # AT&T 3B2/1000-80; should work on any WE32XXX machine
-#aix_rt: unzips # IBM RT 6150 under AIX 2.2.1
-bull: unzips # Bull DPX/2, BOS 2.00.45 (doesn't require -Xk switch)
-convex: unzips # Convex C-120 and C-210 (-O is enough; -ext is default)
-cray: unzips # Cray-2 and Y-MP, using default (possibly old) compiler
-dec: unzips # DEC 5820 (MIPS RISC), test version of Ultrix v4.0
-encore: unzips # Multimax
-eta: unzips # ETA-10P*, hybrid SysV with BSD 4.3 enhancements
-gould: unzips # Gould PN9000 running UTX/32 2.1Bu01
-hp: unzips # HP 9000 series (68020), 4.3BSD or HP-UX A.B3.10 Ver D
-hpux: unzips # (to match zip's makefile entry)
-mips: unzips # MIPS M120-5(?), SysV.3 [error in sys/param.h file?]
-next10: unzips # NeXT (generic; use next2x or next3x for better opt.)
-osf1: unzips # DECstation, including Alpha-based; DEC OSF/1 v1.x
-pyr_: unzips # [failsafe target for pyramid target below]
-pyr_ucb: unzips # Pyramids running BSD universe by default (see below)
-realix: unzips # Modcomp Real/IX (SysV.3); note "gcc" = GLS C, not GNU
-sco: unzips # Xenix/386 (tested on 2.3.1); SCO Unix 3.2.0.
-sgi: unzips # Silicon Graphics; Irix 3.3.2, 4.0.x, 5.2, etc.
-stellar: unzips # gs-2000
-sun: unzips # old target; no good with solaris...use "sunos" now
-sunos: unzips # no good with SunOS 3.x...use "sunos3" or "sunos4" now
-sunos4: unzips # Sun 3, 4; SunOS 4.x (SOME SYSTEMS ARE SYSTEM V!)
-tahoe: unzips # tahoe (CCI Power6/32), 4.3BSD
-ultrix: unzips # VAXen, DEC 58x0 (MIPS guts), DECstation 2100; v4.x
-vax: unzips # general-purpose VAX target (not counting VMS)
+386i: $(BINS) # sun386i, SunOS 4.0.2
+#3Bx: $(BINS) # AT&T 3B2/1000-80; should work on any WE32XXX machine
+bull: $(BINS) # Bull DPX/2, BOS 2.00.45 (doesn't require -Xk switch)
+convex: $(BINS) # Convex C-120 and C-210 (-O is enough; -ext is default)
+cray: $(BINS) # Cray-2 and Y-MP, using default (possibly old) compiler
+dec: $(BINS) # DEC 5820 (MIPS RISC), test version of Ultrix v4.0
+encore: $(BINS) # Multimax
+eta: $(BINS) # ETA-10P*, hybrid SysV with BSD 4.3 enhancements
+gould: $(BINS) # Gould PN9000 running UTX/32 2.1Bu01
+hp: $(BINS) # HP 9000 series (68020), 4.3BSD or HP-UX A.B3.10 Ver D
+hpux: $(BINS) # (to match Zip's makefile entry)
+mips: $(BINS) # MIPS M120-5(?), SysV.3 [error in sys/param.h file?]
+next10: $(BINS) # NeXT (generic; use next2x or next3x for better opt.)
+osf1: $(BINS) # DECstation, including Alpha-based; DEC OSF/1 v1.x
+pyr_: $(BINS) # [failsafe target for pyramid target below]
+pyr_ucb: $(BINS) # Pyramids running BSD universe by default (see below)
+realix: $(BINS) # Modcomp Real/IX (SysV.3); note "gcc" = GLS C, not GNU
+sco: $(BINS) # Xenix/386 (tested on 2.3.1); SCO Unix 3.2.0.
+sgi: $(BINS) # Silicon Graphics; Irix 3.3.2, 4.0.x, 5.2, etc.
+stellar: $(BINS) # gs-2000
+sun: $(BINS) # old target; no good with solaris...use "sunos" now
+sunos: $(BINS) # no good with SunOS 3.x...use "sunos3" or "sunos4" now
+sunos4: $(BINS) # Sun 3, 4; SunOS 4.x (SOME SYSTEMS ARE SYSTEM V!)
+tahoe: $(BINS) # tahoe (CCI Power6/32), 4.3BSD
+ultrix: $(BINS) # VAXen, DEC 58x0 (MIPS guts), DECstation 2100; v4.x
+vax: $(BINS) # general-purpose VAX target (not counting VMS)
#----------------------------------------------------------------------------
# BSD group (for timezone structs [struct timeb]):
#----------------------------------------------------------------------------
-bsd: _bsd # generic BSD (BSD 4.2 & Ultrix handled in unzip.h)
+bsd: _bsd # generic BSD (BSD 4.2 & Ultrix handled in unzip.h)
-_bsd: unix_make
- $(MAKE) unzips CF="$(CF) -DBSD"
+_bsd: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -DBSD"
#----------------------------------------------------------------------------
# SysV group (for extern long timezone and ioctl.h instead of sgtty.h):
#----------------------------------------------------------------------------
-aix_rt: _sysv # IBM RT 6150 under AIX 2.2.1
-aviion: _sysv # Data General AViiONs, DG/UX 4.3x
-pyr_att: _sysv # Pyramids running AT&T (SysV) universe by default
-stardent: _sysv # Stardent ...
-sysv: _sysv # generic System V Unix (Xenix handled in unzip.h)
-xos: _sysv # Olivetti LSX-3005..3045, X/OS 2.3 and 2.4
+aviion: _sysv # Data General AViiONs, DG/UX 4.3x
+pyr_att: _sysv # Pyramids running AT&T (SysV) universe by default
+stardent: _sysv # Stardent ...
+sysv: _sysv # generic System V Unix (Xenix handled in unzip.h)
+xos: _sysv # Olivetti LSX-3005..3045, X/OS 2.3 and 2.4
-_sysv: unix_make
- $(MAKE) unzips CF="$(CF) -DSYSV"
+_sysv: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -DSYSV"
# extension to perform SVR4 package-creation after compilation
-_sysvp: _sysv svr4package
+_sysvp: _sysv svr4package
#----------------------------------------------------------------------------
# Version 7 group (old/obsolescent):
#----------------------------------------------------------------------------
-pixel: _v7 # Pixel 80, 100 (68000-based, V7/mostly BSD4.1 compat.)
-v7: _v7 # generic Unix Version 7 box (prob. only Pixel...)
+pixel: _v7 # Pixel 80, 100 (68000-based, V7/mostly BSD4.1 compat.)
+v7: _v7 # generic Unix Version 7 box (prob. only Pixel...)
_v7:
- make $(MAKEF) unzips \
- CF="$(CF) -DV7 -DNO_PARAM_H -DSHORT_NAMES -DBSD -DZMEM -DNO_LCHOWN -DNO_LCHMOD"
+ if [ ! -d $(PROD) ]; then mkdir "$(PROD)"; fi
+ make $(MAKEF) $(BINS) CF="$(CF) -DV7 -DNO_PARAM_H \
+ -DSHORT_NAMES -DBSD -DZMEM -DNO_LCHOWN -DNO_LCHMOD"
#----------------------------------------------------------------------------
# "Unique" group (require non-standard options):
#----------------------------------------------------------------------------
# AT&T 3B2/1000-80; should work on any WE32XXX machine
-3Bx: unix_make
- $(MAKE) unzips CF="$(CF) -DCBREAK=2"
+3Bx: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -DCBREAK=2"
# AT&T 7300 (M68000/SysV.3) (add -DSYSV? -DNO_LIMITS?)
-7300: unix_make
- $(MAKE) unzips CF="$(CF) -DNO_DIR -DNO_MKDIR -DNO_STRNICMP -DNO_UID_GID -DNO_FCHMOD -DNO_LCHOWN -DNO_LCHMOD -DCBREAK=2"
+7300: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -DNO_DIR -DNO_MKDIR -DNO_STRNICMP \
+ -DNO_UID_GID -DNO_FCHMOD -DNO_LCHOWN -DNO_LCHMOD -DCBREAK=2"
-7300_gcc: unix_make
- $(MAKE) unzips CC=gcc LD=gcc LF2="" CFLAGS="-O2" \
- LOC="-DNO_DIR -DNO_MKDIR -DNO_STDLIB_H -DNO_STRNICMP -DNO_UID_GID -DNO_FCHMOD -DNO_LCHOWN -DNO_LCHMOD -DCBREAK=2 $(LOC)"
- $(STRIP) $(UNZIPS)
-
-# IBM AIX 3.x on an RS/6000: see rs6000 target below
-aix: rs6000
+7300_gcc: unix_make
+ $(MAKE) $(BINS) CC=gcc LD=gcc LF2="" CFLAGS="-O2" \
+ LOC="-DNO_DIR -DNO_MKDIR -DNO_STDLIB_H -DNO_STRNICMP \
+ -DNO_UID_GID -DNO_FCHMOD -DNO_LCHOWN -DNO_LCHMOD -DCBREAK=2 $(LOC)"
+ $(STRIP) $(UNZIP_PPGMS)
# Amdahl (IBMish) mainframe, UTS (SysV) 1.2.4, 2.0.1, 3.x
-amdahl: unix_make
- $(MAKE) unzips CF="$(CF) -DSYSV -DNO_UID_GID -DNO_LCHOWN -DNO_LCHMOD"
+amdahl: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -DSYSV -DNO_UID_GID -DNO_LCHOWN -DNO_LCHMOD"
# Amdahl UTS 2.1.4 with "extended file types" filesystem (aarrrggghhhh...)
-amdahl_eft: unix_make
- $(MAKE) unzips CF="$(CF) -eft -DSYSV -DNO_UID_GID -DNO_LCHOWN -DNO_LCHMOD"
+amdahl_eft: unix_make
+ $(MAKE) $(BINS) \
+ CF="$(CF) -eft -DSYSV -DNO_UID_GID -DNO_LCHOWN -DNO_LCHMOD"
# Apollo Domain/OS machines (added -D...SOURCE options) [Gordon Fox, 960810]
-apollo: unix_make
- $(MAKE) unzips CF="$(CF) -D_INCLUDE_BSD_SOURCE -D_INCLUDE_XOPEN_SOURCE -DNO_LCHOWN -DNO_LCHMOD"
+apollo: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -D_INCLUDE_BSD_SOURCE \
+ -D_INCLUDE_XOPEN_SOURCE -DNO_LCHOWN -DNO_LCHMOD"
# BSDI BSD/OS on 386 platform, using the assembler replacement for crc32.c
-bsdi: unix_make
+bsdi: unix_make
@echo 'NOTE: use bsdi_noasm target for non-Intel BSD/OS compiles.'
- $(MAKE) unzips CC=gcc2 LD=shlicc2 AS=gcc2\
- CFLAGS="-O3 -Wall -DASM_CRC -DBSD" CRCA_O=crc_gcc$O
+ $(MAKE) $(BINS) CC=gcc2 LD=shlicc2 AS=gcc2 \
+ CFLAGS="-O3 -Wall -DASM_CRC -DBSD" OSDEP_OS="$(PROD)/crc_gcc.o"
# BSDI BSD/OS
-bsdi_noasm: unix_make
-# @echo 'NOTE: use bsd target for non-Intel BSD/OS compiles.'
- $(MAKE) unzips CC=gcc2 LD=shlicc2 AS=gcc2\
- CFLAGS="-O3 -Wall -DBSD"
+bsdi_noasm: unix_make
+# @echo 'NOTE: use bsd target for non-Intel BSD/OS compiles.'
+ $(MAKE) $(BINS) CC=gcc2 LD=shlicc2 AS=gcc2 \
+ CFLAGS="-O3 -Wall -DBSD"
# Coherent 3.x/4.x, Mark Williams C. ``For Coherent's CC, it needs either
# -T0 or -T150000 (or bigger) added to the CFLAGS, otherwise the compiler
# runs out of memory and dies in zipinfo.c.'' [Fred "Fredex" Smith, 940719]
-coherent: unix_make
- $(MAKE) unzips CFLAGS="$(CFLAGS) -T0 -DNO_LCHOWN -DNO_LCHMOD"
+coherent: unix_make
+ $(MAKE) $(BINS) CFLAGS="$(CFLAGS) -T0 -DNO_LCHOWN -DNO_LCHMOD"
# Cray-2, Y-MP or C90, running Unicos 5.x to 8.x (SysV + BSD enhancements)
# and Standard (ANSI) C compiler 3.0 or later.
-cray_opt: unix_make
- $(MAKE) unzips CFLAGS="$(CFLAGS) -h scalar3 -h vector3 -DNO_LCHOWN -DNO_LCHMOD"
+cray_opt: unix_make
+ $(MAKE) $(BINS) \
+ CFLAGS="$(CFLAGS) -h scalar3 -h vector3 -DNO_LCHOWN -DNO_LCHMOD"
# The unzip41 build on a Cyber 910/SGI running Irix v3.3.3 was successful
# with the following change to Makefile:
-cyber_sgi: unix_make
- $(MAKE) unzips CFLAGS="$(CFLAGS) -I/usr/include/bsd -DNO_LCHOWN -DNO_LCHMOD"\
- LF="-lbsd $(LF)" SL="-lbsd $(SL)"
-
-# The Cygwin environment on a Win32 system, treated as an UNIX emulator.
+cyber_sgi: unix_make
+ $(MAKE) $(BINS) \
+ CFLAGS="$(CFLAGS) -I/usr/include/bsd -DNO_LCHOWN -DNO_LCHMOD" \
+ LF="-lbsd $(LF)" SL="-lbsd $(SL)"
+
+# The "generic" target should work with Cygwin on Windows. The
+# following instructons are old, and probably obsolete...
+# The Cygwin environment on a Win32 system, treated as a Unix emulator.
# This port does not offer full access to the Windows file system.
# Info-ZIP recommends using "win32/Makefile.gcc" instead.
-cygwin: unix_make
- $(MAKE) unzips CC=gcc LD=gcc AS=gcc\
- CFLAGS="-O3 -DASM_CRC -DNO_LCHOWN -DNO_LCHMOD"\
- AF="-Di386 $(AF)" CRCA_O=crc_gcc$O\
- E=".exe" CP="cp" LN="ln -s"
+cygwin: unix_make
+ $(MAKE) $(BINS) CC=gcc LD=gcc AS=gcc \
+ CFLAGS="-O3 -DASM_CRC -DNO_LCHOWN -DNO_LCHMOD" \
+ AF="-Di386 $(AF)" OSDEP_OS="$(PROD)/crc_gcc.o" \
+ E=".exe" CP="cp" LN="ln -s"
# 680x0, DIAB dnix 5.2/5.3 (a Swedish System V clone)
#
# -X7 = cc is strict ANSI C
# -X9 = warnings if a function is used without a declaration
#
-dnix: unix_make
- $(MAKE) unzips CFLAGS="$(CFLAGS) -X7 -X9 -DDNIX"
+dnix: unix_make
+ $(MAKE) $(BINS) CFLAGS="$(CFLAGS) -X7 -X9 -DDNIX"
# FreeBSD on Intel:
-freebsd: unix_make
+freebsd: unix_make
@echo 'NOTE: use bsd target for non-Intel FreeBSD compiles (if any).'
- $(MAKE) unzips CC=gcc LD=gcc AS=gcc\
- CFLAGS="-O3 -Wall -DASM_CRC -DBSD"\
- AF="-Di386 $(AF)" CRCA_O=crc_gcc$O
+ $(MAKE) $(BINS) CC=gcc LD=gcc AS=gcc \
+ CFLAGS="-O3 -Wall -DASM_CRC -DBSD" \
+ AF="-Di386 $(AF)" OSDEP_OS="$(PROD)/crc_gcc.o"
# Generic BSDish Unix gcc. ``The -O3 only works with later versions of gcc;
# you may have to use -O2 or -O for earlier versions. I have no idea why
# worry about it (it just makes the executable smaller and can be replaced
# with "echo" instead).
#
-gcc: unix_make
- $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O3" LF2=""
- $(STRIP) $(UNZIPS)
+gcc: unix_make
+ $(MAKE) $(BINS) CC=gcc LD=gcc CFLAGS="-O3" LF2=""
+ $(STRIP) $(UNZIP_PPGMS)
# Heurikon HK68 (68010), UniPlus+ System V 5.0, Green Hills C-68000
-hk68: unix_make
- $(MAKE) unzips CC="gcc" LD="gcc"\
- LF="-n $(LF)" SL="-n $(SL)" FL="-n $(FL)"\
- CFLAGS="-ga -X138 -Dlocaltime=localti -Dtimezone=timezon"
+hk68: unix_make
+ $(MAKE) $(BINS) CC="gcc" LD="gcc" \
+ LF="-n $(LF)" SL="-n $(SL)" FL="-n $(FL)" \
+ CFLAGS="-ga -X138 -Dlocaltime=localti -Dtimezone=timezon"
# ISC Unix on 386 platform
-isc: unix_make
- $(MAKE) unzips LF2="-lc_s $(LF2)" CRCA_O=crc_sysv$O \
- CFLAGS="-O" LOC="-DASM_CRC -DSYSV -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN -DNO_LCHMOD $(LOC)" \
- AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)"
-
-isc_gcc: unix_make
- $(MAKE) unzips AS=gcc CC=gcc LD=gcc CRCA_O=crc_gcc$O \
- LF="-shlib $(LF)" SL="-shlib $(SL)" FL="-shlib $(FL)" LF2="" \
- CFLAGS="-O3" LOC="-DSYSV -DASM_CRC -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN -DNO_LCHMOD $(LOC)" \
- AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)"
- $(STRIP) $(UNZIPS)
+isc: unix_make
+ $(MAKE) $(BINS) LF2="-lc_s $(LF2)" OSDEP_OS="$(PROD)/crc_sysv.o" \
+ CFLAGS="-O" \
+ LOC="-DASM_CRC -DSYSV -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN \
+ -DNO_LCHMOD $(LOC)" \
+ AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)"
+
+isc_gcc: unix_make
+ $(MAKE) $(BINS) AS=gcc CC=gcc LD=gcc OSDEP_OS="$(PROD)/crc_gcc.o" \
+ LF="-shlib $(LF)" SL="-shlib $(SL)" FL="-shlib $(FL)" LF2="" \
+ CFLAGS="-O3" \
+ LOC="-DSYSV -DASM_CRC -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN \
+ -DNO_LCHMOD $(LOC)" \
+ AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)"
+ $(STRIP) $(UNZIP_PPGMS)
# "ISI machine (68025 CPU)" (based on e-mail from Rob White <rsw@tfs.com>;
# no further information). May also need DIRENT defined.
-isi: unix_make
- $(MAKE) unzips CF="$(CF) -DDECLARE_ERRNO -DNO_LCHOWN -DNO_LCHMOD"
+isi: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -DDECLARE_ERRNO -DNO_LCHOWN -DNO_LCHMOD"
+# The "generic" target should work with GNU/Linux. The following
+# instructons are old, and probably obsolete...
# Linux on 386 platform, using the assembler replacement for crc32.c. (-O4 and
# -fno-strength-reduce have virtually no effect beyond -O3. Add "-m486
# -malign-functions=2 -malign-jumps=2 -malign-loops=2" for Pentium [Pro]
# systems.)
-linux: unix_make
+linux: unix_make
@echo 'NOTE: use linux_noasm target for non-Intel Linux compiles.'
- $(MAKE) unzips CC=gcc LD=gcc AS=gcc\
- CFLAGS="-O3 -Wall -DASM_CRC"\
- AF="-Di386 $(AF)" CRCA_O=crc_gcc$O
-# GRR: this echo is pointless; if user gets this far, no difference to install
-# @echo 'Be sure to use the install_asm target rather than the install target'
+ $(MAKE) $(BINS) CC=gcc LD=gcc AS=gcc \
+ CFLAGS="-O3 -Wall -DASM_CRC" \
+ AF="-Di386 $(AF)" OSDEP_OS="$(PROD)/crc_gcc.o"
-linux_asm: linux
+linux_asm: linux
# Linux (Posix, approximately SysV): virtually any version since before 0.96,
# for any platform. Change "-O" to "-O3" or whatever, as desired...
-linux_noasm: unix_make
- $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O -Wall"
+linux_noasm: unix_make
+ $(MAKE) $(BINS) CC=gcc LD=gcc CFLAGS="-O -Wall"
# Linux with lcc compiler: __inline__ (stat.h) not recognized, and must edit
# /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined. -O3
# (or -O2 or -O) is ignored. [GRR 960828: test target only]
#
-linux_lcc: unix_make
- $(MAKE) unzips CC=lcc LD=lcc CFLAGS="-O3 -Wall -D__inline__= "
+linux_lcc: unix_make
+ $(MAKE) $(BINS) CC=lcc LD=lcc CFLAGS="-O3 -Wall -D__inline__= "
# Linux host with go32 (djgpp) cross-compiler (go32crs.tgz) for 32-bit DOS.
-linux_dos: unix_make
- $(MAKE) unzips CC=go32gcc LD=go32gcc M=msdos OSDEP_H="msdos/doscfg.h" \
- CFLAGS="-O2 -Wall"
-# go32-strip unzip
-# Due to limitations of the cross-compiling package, this has to be
-# done manually:
- @echo Copy $(UNZIPS) to your DOS partition and use coff2exe.
-
-# Linux ELF shared library (ooo, it's so easy). This is a test target for
-# now, and it only makes the UnZip/ZipInfo stuff (not fUnZip or UnZipSFX).
-# The version number may eventually change to match the UnZip version. Or
-# not. Whatever. Also do "setenv LD_LIBRARY_PATH `pwd`" or similar to test
-# the DLL in place (with unzip_shlib, which is UnZip linked with the shared
-# library).
-#
-linux_shlib: unix_make
- $(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC"\
- LOC="-DDLL -DASM_CRC $(LOC)"\
- AS=gcc AF="-fPIC -Di386 $(AF)" CRCA_O=crc_gcc$O
- gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)\
- crc_gcc.pic.o
- ln -sf libunzip.so.0.4 libunzip.so.0
- ln -sf libunzip.so.0 libunzip.so
- gcc -c -O unzipstb.c
- gcc -o unzip_shlib unzipstb.o -L. -lunzip
-
-# Linux ELF shared library, as above, but using inflate() from zlib (libz.so)
-# instead of the original UnZip version. (libz was libgz prior to 0.94)
-linux_shlibz: unix_make
- $(MAKE) objsdll CC=gcc AS=gcc AF="-fPIC -Di386 $(AF)" CRCA_O=crc_gcc$O\
- CFLAGS="-O3 -Wall -fPIC" LOC="-DDLL -DUSE_ZLIB -DASM_CRC $(LOC)"
- gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)\
- crc_gcc.pic.o
- ln -sf libunzip.so.0.4 libunzip.so.0
- gcc -c -O unzipstb.c
- gcc -o unzip unzipstb.o -L. -lunzip -lz
+linux_dos: unix_make
+ $(MAKE) $(BINS) CC=go32gcc CFLAGS="-O2 -Wall" \
+ LD=go32gcc \
+ OSDEP_H="msdos/doscfg.h" \
+ OSDEP_OCF="$(PROD)/msdos.o" \
+ OSDEP_OCS="$(PROD)/msdos.o" \
+ OSDEP_OCU="$(PROD)/msdos.o" \
+ OSDEP_OS=""
+# go32-strip unzip
+# Due to limitations of the cross-compiling package, this has to be
+# done manually:
+ @echo "Copy $(UNZIP_PPGMS) to your DOS partition and use coff2exe."
# LynxOS-x86 2.3.0 and newer, a real-time BSD-like OS; uses gcc.
-lynx: unix_make
- $(MAKE) unzips CC=gcc CF="$(CF) -DLynx -DLYNX -DBSD -DUNIX"
+lynx: unix_make
+ $(MAKE) $(BINS) CC=gcc CF="$(CF) -DLynx -DLYNX -DBSD -DUNIX"
# Macintosh MacOS X (Unix-compatible enviroment), using standard compiler
-macosx: unix_make
- $(MAKE) unzips CFLAGS="-O3 -Wall -DBSD" LF2=""
- $(STRIP) $(UNZIPS)
+macosx: unix_make
+ $(MAKE) $(BINS) CFLAGS="-O3 -Wall -DBSD" LF2=""
+ $(STRIP) $(UNZIP_PPGMS)
# Macintosh MacOS X (Unix-compatible enviroment), using gcc
-macosx_gcc: unix_make
- $(MAKE) unzips CC=gcc CFLAGS="-O3 -Wall -DBSD" LF2=""
- $(STRIP) $(UNZIPS)
+macosx_gcc: unix_make
+ $(MAKE) $(BINS) CC=gcc CFLAGS="-O3 -Wall -DBSD" LF2=""
+ $(STRIP) $(UNZIP_PPGMS)
# Minix 1.5 PC for the 386. Invoke as is to use default cc, or as "make
# minix CC=gcc" to use gcc. Try "make linux" if you have a working termios.h.
-minix: unix_make
- $(MAKE) unzips CF="$(CF) -DMINIX -DSHORT_NAMES -DNO_LCHOWN -DNO_LCHMOD" CC=$(CC) LD=$(CC)
+minix: unix_make
+ $(MAKE) $(BINS) \
+ CF="$(CF) -DMINIX -DSHORT_NAMES -DNO_LCHOWN -DNO_LCHMOD" \
+ CC=$(CC) LD=$(CC)
# MPE/iX, the Unix variant for HP 3000 systems.
-mpeix: unix_make
- $(MAKE) unzips CC=c89\
- CF="$(CF) -DUNIX -D_POSIX_SOURCE -DHAVE_TERMIOS_H -DPASSWD_FROM_STDIN -DNO_PARAM_H -DNO_LCHOWN -DNO_LCHMOD"\
- LF2=-lbsd CP=cp LN="ln -s"
+mpeix: unix_make
+ $(MAKE) $(BINS) CC=c89 \
+ CF="$(CF) -DUNIX -D_POSIX_SOURCE -DHAVE_TERMIOS_H \
+ -DPASSWD_FROM_STDIN -DNO_PARAM_H -DNO_LCHOWN -DNO_LCHMOD" \
+ LF2=-lbsd CP=cp LN="ln -s"
# NeXT info.
next:
- @echo
- @echo\
+ @echo ''
+ @echo \
' Please pick a specific NeXT target: "make next10" will create a generic'
- @echo\
+ @echo \
' NeXT executable; "make next2x" will create a smaller executable (for'
- @echo\
+ @echo \
' NeXTstep 2.0 and higher); "make next3x" will create a small executable'
- @echo\
+ @echo \
' with significantly better optimization (NeXTstep 3.0 and higher only);'
- @echo\
+ @echo \
' "make nextfat" will create a fat, multi-architecture (NeXT plus Intel)'
- @echo\
+ @echo \
' executable (NeXTstep 3.1 and higher only).'
- @echo
+ @echo ''
# 68030 BSD 4.3+Mach. NeXT 2.x: make the executable smaller.
-next2x: unix_make
- $(MAKE) unzips LF2="-object -s"
+next2x: unix_make
+ $(MAKE) $(BINS) LF2="-object -s"
# NeXT 3.x: as above, plus better optimization.
-next3x: unix_make
- $(MAKE) unzips CFLAGS="-O2" LF2="-object -s"
+next3x: unix_make
+ $(MAKE) $(BINS) CFLAGS="-O2" LF2="-object -s"
# NeXT 3.1+: make the executable fat (multi-architecture binary [MAB],
# for "black" [NeXT] and "white" [x86] hardware, so far).
-nextfat: unix_make
- $(MAKE) unzips CFLAGS="-O2 -arch i386 -arch m68k" \
- LF2="-arch i386 -arch m68k -object -s"
-
-# IBM OS/390 (formerly MVS) compiled under "OpenEdition" shell
-os390: unix_make
- set -x; \
- $(MAKE) $(MAKEF) unzips \
- CC=c89 LD="\$$(CC) -Wl,EDIT=NO" \
- CF="$(CF) -DSYSV -DUNIX -DOS390 -DEBCDIC -DNO_PARAM_H \
- -DNO_LCHOWN -DNO_LCHMOD \
- -D_ALL_SOURCE $(HOST_VERSINFO)" LF2=""
+nextfat: unix_make
+ $(MAKE) $(BINS) CFLAGS="-O2 -arch i386 -arch m68k" \
+ LF2="-arch i386 -arch m68k -object -s"
# Sequent Symmetry running Dynix/ptx (sort of SysV.3): needs to link
# with libseq to get symlink().
-ptx: unix_make
- $(MAKE) unzips CF="$(CF) -DSYSV -DTERMIO -DPTX -DNO_LCHOWN -DNO_LCHMOD" LF2="$(LF2) -lseq"
+ptx: unix_make
+ $(MAKE) $(BINS) \
+ CF="$(CF) -DSYSV -DTERMIO -DPTX -DNO_LCHOWN -DNO_LCHMOD" \
+ LF2="$(LF2) -lseq"
# Pyramid 90X (probably all) under >= OSx4.1, either universe. (This is an
# experimental target! If it fails, use either pyr_ucb or pyr_att instead.)
-# The make in the BSD half is too stupid to understand $(MAKE), sigh...
-pyramid: unix_make
+# The "make" in the BSD half is too stupid to understand $(MAKE), sigh...
+pyramid: unix_make
-make $(MAKEF) pyr_`universe`
-# QNX/Neutrino is "special" because you don't have any native development
-# tools yet. Set ARCH to "x86", "ppcbe", "ppcle", "mipsbe", or "mipsle"
-# to produce x86, PowerPC (big- or little-endian) and MIPS (big-
-# or little-endian) using gcc. [cjh]
-qnxnto: unix_make
+# QNX/Neutrino
+# - No native development tools, so cross-build environement is used.
+# - Use gcc and set ARCH as follows:
+# "x86" to produce x86
+# "ppcbe" PowerPC (big-endian)
+# "ppcle" PowerPC (little-endian)
+# "mipsbe" MIPS (big-endian)
+# "mipsle" MIPS (little-endian)
+qnxnto: unix_make
@if [ "$(ARCH)" = "" ] ; then \
- echo "You didn't set ARCH; I'll assume you meant ARCH=x86..." ; \
- echo "" ; \
- $(MAKE) $(MAKEF) CC="qcc -Vgcc_ntox86" unzips ; \
- else \
- echo "Making unzip for $(ARCH)..." ; \
- echo "" ; \
- $(MAKE) $(MAKEF) CC="qcc -Vgcc_nto$(ARCH)" unzips ; \
- fi
+ echo "You didn't set ARCH; I'll assume you meant ARCH=x86..." ; \
+ echo '' ; \
+ $(MAKE) $(MAKEF) CC="qcc -Vgcc_ntox86" $(BINS) ; \
+ else \
+ echo "Making UnZip for $(ARCH)..." ; \
+ echo '' ; \
+ $(MAKE) $(MAKEF) CC="qcc -Vgcc_nto$(ARCH)" $(BINS) ; \
+ fi
# REGULUS: 68040-based, "real-time" SysV.3 mutant; uses gcc, with "REGULUS"
# predefined.
-regulus: unix_make
- $(MAKE) unzips CF="$(CF) -traditional -DSYSV -DNO_MKDIR -DNO_LCHOWN -DNO_LCHMOD"
-
-# IBM RS/6000 under AIX 3.2
-rs6000: unix_make
- $(MAKE) unzips CF="$(CF) -DBSD -D_BSD -DUNIX" LF2="-lbsd"
-
-# SCO cross compile from Unix to DOS. Tested with Xenix/386 and OpenDeskTop.
-# Should work with Xenix/286 as well. (davidsen) Note that you *must* remove
-# the Unix objects and executable before doing this! (Piet Plomp: gcc won't
-# recognize the -M0 flag that forces 8086 code.) (GRR: may need to reduce
-# stack to 0c00h if using 286/small-model code...?)
-sco_dos: unix_make
- $(MAKE) unzips CFLAGS="-O -dos -M0" M=msdos OSDEP_H="msdos/doscfg.h" \
- LF="-dos -F 2000" LF2="-o unzip.exe" \
- FL="-dos" FL2="-o funzip.exe" SL="-dos" SL2="-o unzipsfx.exe"
+regulus: unix_make
+ $(MAKE) $(BINS) \
+ CF="$(CF) -traditional -DSYSV -DNO_MKDIR -DNO_LCHOWN -DNO_LCHMOD"
# SCO UNIX with shared libraries and no international support. If you are
# not using a USA-style keyboard and display, you may want to remove -nointl
# to get support. It adds quite a bit to the size of the executable.
-sco_sl: unix_make
- $(MAKE) unzips LF="$(LF) -nointl" LF2="$(LF2) -lc_s"\
- SL="$(SL) -nointl" FL="$(FL) -nointl"
+sco_sl: unix_make
+ $(MAKE) $(BINS) LF="$(LF) -nointl" LF2="$(LF2) -lc_s" \
+ SL="$(SL) -nointl" FL="$(FL) -nointl"
# SCO Xenix/286 2.2.3 or later with development system 2.2.1 or later
-sco_x286: unix_make
- $(MAKE) unzips CF="$(CF) -Mel2 -LARGE -DNO_MKDIR -DNO_LCHOWN -DNO_LCHMOD" \
- LF="$(LF) -Mel2 -LARGE -lx" SL="$(SL) -Mel2 -LARGE" \
- FL="$(FL) -Mel2 -LARGE"
+sco_x286: unix_make
+ $(MAKE) $(BINS) \
+ CF="$(CF) -Mel2 -LARGE -DNO_MKDIR -DNO_LCHOWN -DNO_LCHMOD" \
+ LF="$(LF) -Mel2 -LARGE -lx" SL="$(SL) -Mel2 -LARGE" \
+ FL="$(FL) -Mel2 -LARGE"
# Sequent Symmetry with Dynix. (386, but needs -DZMEM)
# This should also work on Balance but I can't test it just yet.
-sequent: unix_make
- $(MAKE) unzips CF="$(CF) -DBSD -DZMEM -DNO_LCHOWN -DNO_LCHMOD"
+sequent: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -DBSD -DZMEM -DNO_LCHOWN -DNO_LCHMOD"
# Sun 2, 3, 4 running SunOS 3.x
-sunos3: unix_make
- $(MAKE) unzips CF="$(CF) -DNO_UID_GID -DUID_USHORT -DNO_LCHOWN -DNO_LCHMOD"
+sunos3: unix_make
+ $(MAKE) $(BINS) \
+ CF="$(CF) -DNO_UID_GID -DUID_USHORT -DNO_LCHOWN -DNO_LCHMOD"
# Generic System V + GNU C
-sysv_gcc: unix_make
- $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O2 -DSYSV" LF2=""
- $(STRIP) $(UNZIPS)
+sysv_gcc: unix_make
+ $(MAKE) $(BINS) CC=gcc LD=gcc CFLAGS="-O2 -DSYSV" LF2=""
+ $(STRIP) $(UNZIP_PPGMS)
# AT&T 6300+, System V.2 Unix: run-time out-of-memory error if don't use -Ml;
# also compile-time error if work arrays dimensioned at HSIZE+2 (>32K)
-sysv6300: unix_make
- $(MAKE) unzips CF="$(CF) -Ml -DSYSV -DNO_LCHOWN -DNO_LCHMOD" LF="$(LF) -Ml"\
- SL="$(SL) -Ml" FL="$(FL) -Ml"
+sysv6300: unix_make
+ $(MAKE) $(BINS) CF="$(CF) -Ml -DSYSV -DNO_LCHOWN -DNO_LCHMOD" \
+ LF="$(LF) -Ml" SL="$(SL) -Ml" FL="$(FL) -Ml"
# Texas Instruments System V.3 (running on HP 9000-1500)
-ti_sysv: unix_make
- $(MAKE) unzips CF="$(CF) -DSYSV -DNO_UID_GID -DUID_USHORT -DNO_LCHOWN -DNO_LCHMOD"
-
-# SCO Xenix (Joe Foster 950508: "unzip needs to be linked with -lx [for the
-# opendir(), readdir(), telldir(), rewinddir(), and closedir() calls]")
-xenix: unix_make
- $(MAKE) unzips LF2="$(LF2) -lx"
-
-# Wombat 68000 (or whatever).
-# I didn't do this. I swear. No, really.
-wombat: unix_make
- @echo
- @echo ' Ha ha! Just kidding.'
- @echo
+ti_sysv: unix_make
+ $(MAKE) $(BINS) \
+ CF="$(CF) -DSYSV -DNO_UID_GID -DUID_USHORT -DNO_LCHOWN -DNO_LCHMOD"
+
+# SCO Xenix
+# - Joe Foster 1995/05/08
+# - unzip needs to be linked with -lx [for the opendir(), readdir(),
+# telldir(), rewinddir(), and closedir() calls]")
+xenix: unix_make
+ $(MAKE) $(BINS) LF2="$(LF2) -lx"
+
--- /dev/null
+#==============================================================================
+# unix/Makefile_old
+# - For UnZip, fUnZip, UnZipSFX, and ZipInfo Revised: 2013-11-29
+#
+# Copyright (c) 2004-2013 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. If,
+# for some reason, all these files are missing, the Info-ZIP license may
+# also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#==============================================================================
+
+###############################################################################
+# This file was renamed from "unix/Makefile" to "unix/Makefile_old".
+# Similarly, "unix/configure" was renamed to "unix/configure_old".
+# Please keep this in mind when reading the comments and instructions below.
+###############################################################################
+
+#==============================================================================
+#
+# INSTRUCTIONS (such as they are):
+#
+# "make -f unix/Makefile generic" Make UnZip on most systems using cc.
+#
+# "make -f unix/Makefile generic CC=gcc" Make UnZip on most systems using gcc.
+#
+# "make -f unix/Makefile list" List all supported targets.
+#
+# "make -f unix/Makefile help" Limited advice on which targets to
+# try if problems occur.
+#
+# CF are flags for the C compiler. LF are flags for the linker. LF2 are more
+# flags for the linker, if they need to be at the end of the line instead of
+# at the beginning (for example, some libraries). LOCAL_UNZIP is a "make"
+# macro that can be used to add default C flags to your compile without
+# editing the Makefile (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft
+# C).
+#
+# The "generic" target invokes the "unix/configure" script to test the compile
+# and other parts of the environment to see what's supported. The results are
+# used to adjust the build procedure and to enable or disable some program
+# features. unix/configure builds a "flags" file with appropriate values for
+# a number of "make" variables, which is used by this Makefile when performing
+# the actual builds. A separate flags file for building BZIP2 may also be
+# created. This Makefile recursively invokes this Makefile to perform the
+# actual builds.
+#
+# While oriented towards building Unix (and Unix work-alike) ports of UnZip,
+# this file and/or unix/configure are also used by other ports of UnZip. See
+# below.
+#
+# If at all possible, use the generic targets. The other (older) targets are
+# less well tested, and may need considerable help from the user to get
+# optimal results (or any success at all).
+#
+# The "generic_docs" and "generic_man" targets also invoke "unix/configure",
+# and generate the UnZip documentation files.
+#
+# Optional UnZip features are controlled by setting "make" macros as described
+# below or by the results of tests done by configure (such as checking if the
+# needed files are in an appropriate directory).
+#
+# Optional features include (see INSTALL for installation instructions):
+#
+# AES encryption - If you want AES encryption (WinZip/Gladman) support
+# included, unzip the AES_WG source kit (iz_aes_wg13.zip, or whatever
+# is the latest version, available on the Info-ZIP server) to populate
+# the local ./aes_wg subdirectory, and set the "make" macro AES_WG to
+# 1. See the files INSTALL and aes_wg/README_AES_WG.txt for more
+# information.
+#
+# LZMA compression - If you want LZMA compression support included, set
+# the "make" macro LZMA to 1. See the files INSTALL and
+# szip/README_LZMA.txt and INSTALL for more information.
+#
+# PPMd compression - If you want PPMd compression support included, set
+# the "make" macro PPMD to 1. See the files INSTALL and
+# szip/README_LZMA.txt and INSTALL for more information.
+#
+# Bzip2 compression - If you want bzip2 compression support included, there
+# are three options:
+# - Create a local build of bzip2 by unzipping the latest bzip2 source
+# archive into the ./bzip2 subdirectory and setting the "make" macro
+# IS_BZIP2 to bzip2. unix/Makefile will attempt to properly build the
+# library using the bzip2 make file.
+# - Use an existing build of the bzip2 library by setting the "make" macro
+# IZ_BZIP2 to a directory containing the bzip2 header file and object
+# (and/or shared) library files.
+# - Use the system bzip2 library. Ensure the local ./bzip2 subdirectory
+# exists and does not contain the files Makefile, libbz2.a, or bzlib.h.
+# Set the "make" macro IZ_BZIP2 to bzip2. However, use one of the above
+# options first, if possible, to avoid an issue with error handling that
+# may not be corrected in the system library.
+# See the files INSTALL and bzip2/README_BZIP2.txt for more information.
+#
+# Zlib deflation - If you want to use zlib for decompressing instead of UnZip's
+# built-in code, there are two options:
+# - Use an existing build of the zlib support by setting the "make" macro
+# IZ_ZLIB to a directory containing suitable zlib header and object/shared
+# library files.
+# - Use the system zlib support by ensuring the local ./zlib subdirectory
+# exists, and does not contain the files libz.a or bzlib.h. Set the "make"
+# macro IZ_BZIP2 to zlib.
+#
+# UnZip Ports:
+#
+# This Makefile and/or the unix/configure script support a number of non-Unix
+# UnZip ports, where the UnZip program build is under Unix (or a Unix
+# work-alike), but the UnZip program execution may be on another system or
+# execution environment. The unix/configure script will be invoked from
+# either unix/Makefile, or from a Makefile located in another port directory.
+#
+# The port may be explicitly identified by the PORT parameter, or implicitly
+# detected by compiler configuration tests.
+#
+# Supported ports include:
+# msdos : DOS port built using the DJGPP (or Cygwin) cross-compiler
+# os2 : OS/2 port
+# qdos : Sinclair Q-DOS port built using a gcc cross-compiler
+# zos : z/OS MVS port built under z/OS UNIX
+# zvm : z/VM CMS port built under z/VM OpenExtensions
+#
+# Be sure to test your new UnZip (and UnZipSFX and fUnZip and ZipInfo). A
+# successful build does not guarantee a working program.
+
+#####################
+# DEFAULT TARGETS #
+#####################
+
+# List of supported systems/targets in this version
+GENERIC_TARGETS1 = generic generic_man generic_docs generic_pkg flags
+GENERIC_TARGETS2 = generic1 generic2 generic3 generic_bz2 generic_zlib
+GENERIC_TARGETS3 = generic_shlib
+
+MISC_TARGETS = clean clean_bzip2 clean_docs clean_exe dashv
+
+SYS_TARGETS01 = 386i 3Bx 7300 7300_gcc amdahl amdahl_eft apollo aviion
+SYS_TARGETS02 = bsd bsdi bsdi_noasm bull coherent convex cray cray_opt
+SYS_TARGETS03 = cyber_sgi cygwin dec dnix encore eta freebsd gcc gould
+SYS_TARGETS04 = hk68 hp hpux isc isc_gcc isi linux linux_dos linux_noasm
+SYS_TARGETS05 = linux_shlib linux_shlibz lynx macosx macosx_gcc minix mips
+SYS_TARGETS06 = mpeix next next10 next2x next3x nextfat osf1 pixel ptx
+SYS_TARGETS07 = pyramid qnxnto realix regulus sco sco_dos sco_sl sco_x286
+SYS_TARGETS08 = sequent sgi solaris stardent stellar sunos3 sunos4
+SYS_TARGETS09 = sysv sysv_gcc sysv6300 tahoe ti_sysv ultrix vax v7
+SYS_TARGETS10 = xenix xos
+
+# By default, print help on which makefile targets to try.
+
+# What you can make ...
+help:
+ @echo ''
+ @echo 'Make what? You must specify which system to make UnZip for.'
+ @echo 'The "make" generic target choices are:'
+ @echo ''
+ @echo " $(GENERIC_TARGETS1)"
+ @echo " $(GENERIC_TARGETS2)"
+ @echo " $(GENERIC_TARGETS3)"
+ @echo ''
+ @echo 'Additional "make" targets include:'
+ @echo ''
+ @echo " $(MISC_TARGETS)"
+ @echo ''
+ @echo 'For a list including specific targets for older systems:'
+ @echo ' make -f unix/Makefile list'
+ @echo ''
+ @echo '"make" macros to enable varions optional features:'
+ @echo ' "AES_WG=1" Add AES encryption (WinZip/Gladman).'
+ @echo ' "CC=gcc" Use "gcc" instead of "cc" for C compiler.'
+ @echo ' "ICONV=1" Enable ISO/OEM (iconv) conversion.'
+ @echo ' "IZ_BZIP2=bz2dir" Add BZIP2 compression from dir bz2dir.'
+ @echo ' "IZ_ZLIB=zdir" Use ZLIB from dir zdir for deflate.'
+ @echo ' "LIBUNZIP=1" Create UnZip object library.'
+ @echo ' "LIST=1" Generate C compiler and linker listing.'
+ @echo ' "LOCAL_UNZIP=opts" Add C compiler options, "opts".'
+ @echo ' "LZMA=1" Add LZMA compression.'
+ @echo ' "PPMD=1" Add PPMd compression.'
+ @echo ''
+ @echo 'Examples:'
+ @echo ' make -f unix/Makefile generic'
+ @echo ' - make UnZip programs using cc.'
+ @echo ' make -f unix/Makefile generic CC=gcc AES_WG=1'
+ @echo ' - make UnZip programs using gcc, with AES_WG encryption.'
+ @echo ''
+ @echo 'Note that many of these optional "make" macros direct the'
+ @echo '"unix/configure" script, and so may work only with the'
+ @echo '"generic" target.'
+ @echo ''
+ @echo 'First try "make -f unix/Makefile generic" (to use "cc")'
+ @echo '(or "make -f unix/Makefile generic CC=gcc" (to use "gcc")),'
+ @echo 'as "generic" should automatically set the proper flags.'
+ @echo ''
+ @echo 'Use the "clean" target to delete any product files before'
+ @echo 'using one of the other "make" targets. The generic targets'
+ @echo 'use the unix/configure script to generate an intermediate'
+ @echo '"flags" file which is used by unix/Makefile. For debugging'
+ @echo 'purposes, the "flags" target can be used to generate the'
+ @echo '"flags" file only.'
+ @echo ''
+ @echo 'To make the manuals use "make -f unix/Makefile generic_man" to'
+ @echo 'autodetect and use the proper flags.'
+ @echo ''
+ @echo 'Use generic_docs to make the plain text docs. These are the'
+ @echo 'files, like unzip.txt, that should already be in the UnZip root'
+ @echo 'directory. To recreate these files, clear out the originals'
+ @echo 'using the clean_docs target, then use the generic_docs target.'
+ @echo ''
+ @echo 'After UnZip has been built, use dashv to get an "unzip -v"'
+ @echo 'report from the created executable.'
+ @echo ''
+ @echo 'See the files INSTALL, unzip.txt, and unix/Makefile for more'
+ @echo 'information.'
+ @echo ''
+ @echo ' For most users, the best build method is the generic target'
+ @echo ' using the default compiler (cc is often gcc), or by specifying'
+ @echo ' an explicit CC=gcc override.'
+ @echo ''
+ @echo ' Other (older) targets are less well tested, and may need'
+ @echo ' considerable help from the user to get optimal results (or'
+ @echo ' any success at all). Use "make -f unix/Makefile list" to'
+ @echo ' get a list of valid targets.'
+ @echo ''
+ @echo ' Always do "make -f unix/Makefile clean clean_bzip2" before'
+ @echo ' attempting to build UnZip using a different target.'
+ @echo ''
+ @echo ' If the "generic" target fails, you might try an older generic'
+ @echo ' target that is now called "generic1".'
+ @echo ''
+ @echo ' If the compiler complains about "timezone redefined", then'
+ @echo ' the "generic2" target may work better. If the linker'
+ @echo ' complains about an undefined symbol, "_ftime", then the'
+ @echo ' "generic3" target may work better.'
+ @echo ''
+ @echo ' One of these actions should produce working UnZip programs on'
+ @echo ' most Unix(-like) systems. If you know a bit more about the'
+ @echo ' system on which you work, then you might try "make -f'
+ @echo ' unix/Makefile list" for a list of the system-specific targets'
+ @echo ' supported herein. (Many of them do exactly the same thing,'
+ @echo ' so do not agonize too much over which to pick if two or more'
+ @echo ' sound equally likely.)'
+ @echo ''
+
+# list
+# - Display list of supported systems/targets in this version.
+# - The SYSTEM variable is no longer supported. Instead, use:
+# - make -f unix/Makefile <target>
+list:
+ @echo ''
+ @echo 'Type "make -f unix/Makefile <target>", where <target> is one of'
+ @echo 'the following:'
+ @echo ''
+ @echo 'Generic targets:'
+ @echo " $(GENERIC_TARGETS1)"
+ @echo " $(GENERIC_TARGETS2)"
+ @echo " $(GENERIC_TARGETS3)"
+ @echo ''
+ @echo 'Specific targets:'
+ @echo " $(SYS_TARGETS01)"
+ @echo " $(SYS_TARGETS02)"
+ @echo " $(SYS_TARGETS03)"
+ @echo " $(SYS_TARGETS04)"
+ @echo " $(SYS_TARGETS05)"
+ @echo " $(SYS_TARGETS06)"
+ @echo " $(SYS_TARGETS07)"
+ @echo " $(SYS_TARGETS08)"
+ @echo " $(SYS_TARGETS09)"
+ @echo " $(SYS_TARGETS10)"
+ @echo ''
+ @echo 'Miscellaneous targets:'
+ @echo " $(MISC_TARGETS)"
+ @echo ''
+ @echo 'Use one of the generic targets if possible, as the specific'
+ @echo 'targets tend to be woefully out of date.'
+ @echo ''
+ @echo 'For further (very useful) information, please read the comments'
+ @echo 'in unix/Makefile.'
+
+#####################
+# MACRO DEFINITIONS #
+#####################
+
+#----------------------------------------------------------------------------
+# Defaults most systems use
+# - The generic target invokes unix/configure to build ./flags and
+# ./flags_bz containing system derived settings that are used by
+# this makefile.
+# - use "make" macro LOCAL_UNZIP to add C compiler flags (such as
+# -DDOSWILD).
+#----------------------------------------------------------------------------
+
+# This file name as make parameter, for recursion
+MAKEF = '-f unix/Makefile_old'
+
+# Build Directories
+# - Root build directory is "."
+# - Manuals build directory is "./manout"
+
+# Build Dependencies for make
+# - Optional object library names
+# AES (WinZip/Gladman) encryption
+# BZIP2 compression
+# LZMA compression
+# PPMd compression
+# Callable UnZip
+# ZLIB compression
+LIB_AES_WG =
+LIB_BZ =
+LIB_LZMA =
+LIB_PPMD =
+LIB_UNZIP =
+LIB_Z =
+
+# Build makefiles
+# - Alternatively, use bzip2/Makebz2.iz
+# BZIP2 compression
+MK_BZ = Makefile
+
+# OS-dependent files
+# - Default: Unix port.
+# - Compilation and execution are both for Unix (or a Unix-like) environment.
+# The files in the UnZip root and unix directories are used.
+# - The vast majority of you out there will likely use this configuration, and
+# do not have to ever worry about this.
+# - Where required by a specific UnZip port, a generic target (in this Makefile
+# or a Makefile located in another port directory) uses the PORT macro to set
+# the correct OS dependent files via unix/configure. Or you can (very
+# carefully) override as required.
+# C header files
+# C object files for funzip
+# C object files for unzipsfx
+# C object files for unzip
+# Assembler object files
+OSDEP_H = unix/unxcfg.h
+OSDEP_OCF =
+OSDEP_OCS = ./unix.o
+OSDEP_OCU = ./unix.o
+OSDEP_OS =
+
+# OS-dependent file extensions
+# - This default may be customized by unix/configure based on PORT
+# Executable programs
+# DLL (.so) (currently not used)
+# man page
+PGMEXT =
+DLLEXT = .so
+MANEXT = 1
+
+# OS-dependent installation directories: executables and man pages
+# - This default may be customized by unix/configure based on PORT
+BINDIR = /usr/local/bin
+MANDIR = /usr/local/man/man$(MANEXT)
+
+# OS-dependent installation file permissions: executables and man pages
+# - This default may be customized by unix/configure based on PORT
+BINPERMS = 755
+MANPERMS = 644
+
+# C compiler and flags: core and bzip2
+# - CC and LD must match, else "unresolved symbol: ___main" is possible)
+# - To use "gcc", specify "make" macro, "CC=gcc", instead of editing here.
+CC = cc
+CC_BZ = $(CC)
+
+CF_NOOPT = -I. -DUNIX $(LOCAL_UNZIP)
+CFLAGS = -O
+CF = $(CFLAGS) $(CF_NOOPT)
+CF_BZ = $(CF)
+
+# C preprocessor
+CPP = $(CC) -E
+
+# Assembler and assembler flags
+AS = as
+AF = $(LOCAL_UNZIP)
+
+# Linker and linker flags (early and late)
+# - CC and LD must match, else "unresolved symbol: ___main" is possible)
+# - To use "gcc", specify "make" macro, "CC=gcc", instead of editing here.
+LD = $(CC)
+LF1 =
+LF2 = -s
+
+# Other utility programs
+AR = ar cq
+CHMOD = chmod
+LN = ln
+RANLIB = ranlib
+RM = rm -f
+SHELL = /bin/sh
+STRIP = strip
+PGM_ZIP = zip
+
+# Default for dependency on auto-configure result, is an empty symbol
+# so that the static non-autoconfigure targets continue to work
+ACONF_DEP =
+
+#----------------------------------------------------------------------------
+# Build configuration: header files
+#----------------------------------------------------------------------------
+
+# OSDEP_H is port-dependent and can be updated by unix/configure
+
+# C header files: unzip
+H_UNZIP = unzip.h \
+ unzpriv.h \
+ globals.h \
+ $(OSDEP_H) \
+ $(ACONF_DEP)
+
+H_UNZIPL = api.h $(H_UNZIP)
+
+# C header files: AES (WinZip/Gladman) encryption
+H_AES = aes_wg/aes.h \
+ aes_wg/aesopt.h \
+ aes_wg/fileenc.h \
+ aes_wg/hmac.h \
+ aes_wg/prng.h \
+ aes_wg/pwd2key.h \
+ aes_wg/sha1.h
+
+# C header files: LZMA compression
+H_LZMA = szip/SzVersion.h \
+ szip/LzFind.h \
+ szip/LzHash.h \
+ szip/LzmaDec.h \
+ szip/Types.h
+
+# C header files: PPMd compression
+H_PPMD = szip/Ppmd.h \
+ szip/Ppmd8.h
+
+#----------------------------------------------------------------------------
+# Build configuration: object files
+#----------------------------------------------------------------------------
+
+# OSDEP_* are port-dependent and can be updated by unix/configure.
+
+# object files: unzip
+O_UNZIP = unzip.o \
+ crc32.o \
+ crypt.o \
+ envargs.o \
+ explode.o \
+ extract.o \
+ fileio.o \
+ globals.o \
+ inflate.o \
+ list.o \
+ match.o \
+ process.o \
+ ttyio.o \
+ ubz2err.o \
+ unreduce.o \
+ unshrink.o \
+ zipinfo.o \
+ $(OSDEP_OCU) \
+ $(OSDEP_OS)
+
+# object files: UnZip object library. Modules sensitive to DLL/REENTRANT.
+O_UNZIPL = api_l.o \
+ apihelp_l.o \
+ crypt_l.o \
+ explode_l.o \
+ extract_l.o \
+ fileio_l.o \
+ globals_l.o \
+ inflate_l.o \
+ list_l.o \
+ process_l.o \
+ ttyio_l.o \
+ ubz2err_l.o \
+ unshrink_l.o \
+ unzip_l.o \
+ zipinfo_l.o \
+ $(OSDEP_OCU:.o=_l.o)
+
+# object files: UnZip object library. Modules insensitive to DLL/REENTRANT.
+O_UNZIPN = crc32.o \
+ envargs.o \
+ match.o \
+ unreduce.o \
+ $(OSDEP_OS)
+
+# object files: UnZip DLL
+O_DLL = $(O_UNZIP) \
+ api.o \
+ apihelp.o
+
+O_STUB = unzipstb.o
+
+# object files: unzipsfx
+O_SFX = unzipsfx.o \
+ crc32_s.o \
+ crypt_s.o \
+ extract_s.o \
+ fileio_s.o \
+ globals_s.o \
+ inflate_s.o \
+ match_s.o \
+ process_s.o \
+ ttyio_s.o \
+ ubz2err_s.o \
+ $(OSDEP_OCS:.o=_s.o) \
+ $(OSDEP_OS)
+
+# object files: funzip
+O_FUZ = funzip.o \
+ crc32_f.o \
+ crypt_f.o \
+ globals_f.o \
+ inflate_f.o \
+ ttyio_f.o \
+ $(OSDEP_OCF:.o=_f.o) \
+ $(OSDEP_OS)
+
+# object files: Assembler CRC (Source: msdos/crc_i86.S)
+# - All OS-dependent, by unix/configure based on PORT
+O_CRC_I = ./crc_i86.o
+
+# object files: Assembler CRC (Source: crc_i386.S)
+# - All OS-dependent, by unix/configure based on PORT
+O_CRC_G = ./crc_gcc.o
+O_CRC_SV = ./crc_sysv.o
+
+# object files: AES (WinZip/Gladman) encryption
+O_AES = aescrypt.o \
+ aeskey.o \
+ aestab.o \
+ fileenc.o \
+ hmac.o \
+ prng.o \
+ pwd2key.o \
+ sha1.o
+
+# object files: LZMA compression
+O_LZMA = LzFind.o \
+ LzmaDec.o
+
+# object files: PPMd compression
+O_PPMD = Ppmd8.o \
+ Ppmd8Dec.o
+
+# object files: ZLIB compression
+# - N/A. ZLIB is not built as part of UnZip
+
+#----------------------------------------------------------------------------
+# Build configuration: object archive libraries
+#----------------------------------------------------------------------------
+
+# object archive: AES (WinZip/Gladman) encryption
+AR_AES = libaes.a
+
+# object archive: BZIP2 compression
+AR_BZ = bzip2/libbz2.a
+
+# object archive: LZMA compression
+AR_LZMA = liblzma.a
+
+# object archive: PPMd compression
+AR_PPMD = libppmd.a
+
+# object archive: Callable UnZip
+AR_UNZIP = libizunzip.a
+
+# object archive: ZLIB compression
+AR_Z = zlib/libz.a
+
+#----------------------------------------------------------------------------
+# Build configuration: Executable programs
+#----------------------------------------------------------------------------
+PGM_UNZIP = unzip$(PGMEXT)
+PGM_DLL = unzip$(DLLEXT)
+PGM_SFX = unzipsfx$(PGMEXT)
+PGM_FUZ = funzip$(PGMEXT)
+PGM_ZINFO = zipinfo$(PGMEXT)
+PGM_ZGREP = unix/zipgrep
+
+UNZIP_PGMS = $(PGM_UNZIP) \
+ $(PGM_SFX) \
+ $(PGM_FUZ) \
+ $(LIB_UNZIP)
+
+#----------------------------------------------------------------------------
+# Build configuration: Manuals
+#----------------------------------------------------------------------------
+MAN_UNZIP = manout/unzip.$(MANEXT)
+MAN_SFX = manout/unzipsfx.$(MANEXT)
+MAN_FUZ = manout/funzip.$(MANEXT)
+MAN_ZINFO = manout/zipinfo.$(MANEXT)
+MAN_ZGREP = manout/zipgrep.$(MANEXT)
+
+UNZIP_MANS = $(MAN_UNZIP) \
+ $(MAN_SFX) \
+ $(MAN_FUZ) \
+ $(MAN_ZINFO) \
+ $(MAN_ZGREP)
+
+# Plain text versions go in the root directory for easy user access
+
+DOC_UNZIP = unzip.txt
+DOC_SFX = unzipsfx.txt
+DOC_FUZ = funzip.txt
+DOC_ZINFO = zipinfo.txt
+DOC_ZGREP = zipgrep.txt
+
+UNZIP_DOCS = $(DOC_UNZIP) \
+ $(DOC_SFX) \
+ $(DOC_FUZ) \
+ $(DOC_ZINFO) \
+ $(DOC_ZGREP)
+
+#----------------------------------------------------------------------------
+# Build configuration: Installation
+#----------------------------------------------------------------------------
+
+# (probably can change next two to `install' and `install -d' if you have it)
+INSTALL = cp
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_D = mkdir -p
+
+BIN_UNZIP = $(BINDIR)/$(PGM_UNZIP)
+BIN_DLL = $(BINDIR)/$(PGM_DLL)
+BIN_SFX = $(BINDIR)/$(PGM_SFX)
+BIN_FUZ = $(BINDIR)/$(PGM_FUZ)
+BIN_ZINFO = $(BINDIR)/$(PGM_ZINFO)
+BIN_ZGREP = $(BINDIR)/zipgrep
+
+INSTALLEDBIN = $(BIN_UNZIP) \
+ $(BIN_SFX) \
+ $(BIN_FUZ) \
+ $(BIN_ZINFO) \
+ $(BIN_ZGREP)
+
+INSTALLEDMAN = $(MANDIR)/unzip.$(MANEXT) \
+ $(MANDIR)/unzipsfx.$(MANEXT) \
+ $(MANDIR)/funzip.$(MANEXT) \
+ $(MANDIR)/zipgrep.$(MANEXT) \
+ $(MANDIR)/zipinfo.$(MANEXT)
+
+# Solaris 2.x package stuff:
+PKGDIR = IZunzip
+VERSION = Version 6.1
+
+
+###############################################
+# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
+###############################################
+
+#----------------------------------------------------------------------------
+# Build rules: File suffixes
+# - Remove all built-in rules
+# - Only explicit 1:1 rules are used
+#----------------------------------------------------------------------------
+.SUFFIXES:
+
+#----------------------------------------------------------------------------
+# Build rules: C compile (.c -> .o)
+# - Explicit 1:1 rules are used
+# - Across various make utilities, pattern rule support is inconsistent
+# - Sys V make has issues with $< when input and output names differ
+#----------------------------------------------------------------------------
+
+# C Compile rule: unzip
+
+# A) Core UnZip C files
+unzip.o: unzip.c $(H_UNZIP) consts.h crypt.h unzvers.h
+ $(CC) -c $(CF) -o $@ unzip.c
+
+crc32.o: crc32.c $(H_UNZIP) crc32.h zip.h
+ $(CC) -c $(CF) -o $@ crc32.c
+
+crypt.o: crypt.c $(H_UNZIP) crc32.h crypt.h ttyio.h zip.h
+ $(CC) -c $(CF) -o $@ crypt.c
+
+envargs.o: envargs.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ envargs.c
+
+explode.o: explode.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ explode.c
+
+extract.o: extract.c $(H_UNZIP) crc32.h crypt.h
+ $(CC) -c $(CF) -o $@ extract.c
+
+fileio.o: fileio.c $(H_UNZIP) crc32.h crypt.h ebcdic.h ttyio.h
+ $(CC) -c $(CF) -o $@ fileio.c
+
+globals.o: globals.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ globals.c
+
+inflate.o: inflate.c $(H_UNZIP) inflate.h
+ $(CC) -c $(CF) -o $@ inflate.c
+
+list.o: list.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ list.c
+
+match.o: match.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ match.c
+
+process.o: process.c $(H_UNZIP) crc32.h
+ $(CC) -c $(CF) -o $@ process.c
+
+ttyio.o: ttyio.c $(H_UNZIP) crypt.h ttyio.h zip.h
+ $(CC) -c $(CF) -o $@ ttyio.c
+
+ubz2err.o: ubz2err.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ ubz2err.c
+
+unreduce.o: unreduce.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ unreduce.c
+
+unshrink.o: unshrink.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ unshrink.c
+
+zipinfo.o: zipinfo.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ zipinfo.c
+
+# A') Callable UnZip C files
+
+api_l.o: api.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ api.c
+
+apihelp_l.o: apihelp.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ apihelp.c
+
+crypt_l.o: crypt.c $(H_UNZIPL) crc32.h crypt.h ttyio.h zip.h
+ $(CC) -c $(CF) -DDLL -o $@ crypt.c
+
+explode_l.o: explode.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ explode.c
+
+extract_l.o: extract.c $(H_UNZIPL) crc32.h crypt.h
+ $(CC) -c $(CF) -DDLL -o $@ extract.c
+
+fileio_l.o: fileio.c $(H_UNZIPL) crc32.h crypt.h ebcdic.h ttyio.h
+ $(CC) -c $(CF) -DDLL -o $@ fileio.c
+
+globals_l.o: globals.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ globals.c
+
+inflate_l.o: inflate.c $(H_UNZIPL) inflate.h
+ $(CC) -c $(CF) -DDLL -o $@ inflate.c
+
+list_l.o: list.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ list.c
+
+process_l.o: process.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ process.c
+
+ttyio_l.o: ttyio.c $(H_UNZIPL) crypt.h ttyio.h zip.h
+ $(CC) -c $(CF) -DDLL -o $@ ttyio.c
+
+ubz2err_l.o: ubz2err.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ ubz2err.c
+
+unreduce_l.o: unreduce.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ unreduce.c
+
+unshrink_l.o: unshrink.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ unshrink.c
+
+unzip_l.o: unzip.c $(H_UNZIPL) consts.h crypt.h unzvers.h
+ $(CC) -c $(CF) -DDLL -o $@ unzip.c
+
+zipinfo_l.o: zipinfo.c $(H_UNZIPL)
+ $(CC) -c $(CF) -DDLL -o $@ zipinfo.c
+
+./unix_l.o: unix/unix.c $(H_UNZIPL) unix/macosx.h
+ $(CC) -c $(CF) -DDLL -o $@ unix/unix.c
+
+# B) UnZip C files for specific ports
+# - Files under msdos and os2 are used when cross compiling for those ports
+# - Generated when referenced by OSDEP_OC*
+# - OSDEP_OC* are customized by unix/configure, based on PORT macro
+
+./msdos.o: msdos/msdos.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ msdos/msdos.c
+
+./os2.o: os2/os2.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ os2/os2.c
+
+./unix.o: unix/unix.c $(H_UNZIP) unix/macosx.h
+ $(CC) -c $(CF) -o $@ unix/unix.c
+
+./nt.o: win32/nt.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ win32/nt.c
+
+./win32.o: win32/win32.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ win32/win32.c
+
+./win32i64.o: win32/win32i64.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ win32/win32i64.c
+
+# C Compile rule: UnZip DLL
+api.o: api.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ api.c
+
+apihelp.o: apihelp.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ apihelp.c
+
+unzipstb.o: unzipstb.c $(H_UNZIP)
+ $(CC) -c $(CF) -o $@ unzipstb.c
+
+# B) UnZip DLL C files for specific ports
+# - Generated when referenced by OSDEP_OC*
+# - OSDEP_OC* are customized by unix/configure, based on PORT macro
+
+./nt_l.o: win32/nt.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ win32/nt.c
+
+./win32_l.o: win32/win32.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ win32/win32.c
+
+./win32i64_l.o: win32/win32i64.c $(H_UNZIP)
+ $(CC) -c $(CF) -DDLL -o $@ win32/win32i64.c
+
+# C Compile rule: unzipsfx
+
+# A) Core UnZipSFX C files
+unzipsfx.o: unzip.c $(H_UNZIP) crypt.h unzvers.h consts.h
+ $(CC) -c $(CF) -DSFX -o $@ unzip.c
+
+crc32_s.o: crc32.c $(H_UNZIP) zip.h crc32.h
+ $(CC) -c $(CF) -DSFX -o $@ crc32.c
+
+crypt_s.o: crypt.c $(H_UNZIP) zip.h crypt.h crc32.h ttyio.h
+ $(CC) -c $(CF) -DSFX -o $@ crypt.c
+
+extract_s.o: extract.c $(H_UNZIP) crc32.h crypt.h
+ $(CC) -c $(CF) -DSFX -o $@ extract.c
+
+fileio_s.o: fileio.c $(H_UNZIP) crc32.h crypt.h ttyio.h ebcdic.h
+ $(CC) -c $(CF) -DSFX -o $@ fileio.c
+
+globals_s.o: globals.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ globals.c
+
+inflate_s.o: inflate.c $(H_UNZIP) inflate.h
+ $(CC) -c $(CF) -DSFX -o $@ inflate.c
+
+match_s.o: match.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ match.c
+
+process_s.o: process.c $(H_UNZIP) crc32.h
+ $(CC) -c $(CF) -DSFX -o $@ process.c
+
+ttyio_s.o: ttyio.c $(H_UNZIP) zip.h crypt.h ttyio.h
+ $(CC) -c $(CF) -DSFX -o $@ ttyio.c
+
+ubz2err_s.o: ubz2err.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ ubz2err.c
+
+# B) UnZipSFX C files for specific ports
+# - Generated when referenced by OSDEP_OC*
+# - OSDEP_OC* are customized by unix/configure, based on PORT macro
+
+./msdos_s.o: msdos/msdos.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ msdos/msdos.c
+
+./os2_s.o: os2/os2.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ os2/os2.c
+
+./unix_s.o: unix/unix.c $(H_UNZIP) unix/macosx.h
+ $(CC) -c $(CF) -DSFX -o $@ unix/unix.c
+
+./nt_s.o: win32/nt.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ win32/nt.c
+
+./win32_s.o: win32/win32.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ win32/win32.c
+
+./win32i64_s.o: win32/win32i64.c $(H_UNZIP)
+ $(CC) -c $(CF) -DSFX -o $@ win32/win32i64.c
+
+# C Compile rule: funzip
+funzip.o: funzip.c $(H_UNZIP) crc32.h crypt.h ttyio.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ funzip.c
+
+crc32_f.o: crc32.c $(H_UNZIP) zip.h crc32.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ crc32.c
+
+crypt_f.o: crypt.c $(H_UNZIP) zip.h crypt.h crc32.h ttyio.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ crypt.c
+
+globals_f.o: globals.c $(H_UNZIP)
+ $(CC) -c $(CF) -DFUNZIP -o $@ globals.c
+
+inflate_f.o: inflate.c $(H_UNZIP) inflate.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ inflate.c
+
+ttyio_f.o: ttyio.c $(H_UNZIP) zip.h crypt.h ttyio.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ ttyio.c
+
+# B) fUnZip C files for specific ports
+# - Generated when referenced by OSDEP_OC*
+# - OSDEP_OC* are customized by unix/configure, based on PORT macro
+
+./unix_f.o: unix/unix.c $(H_UNZIP) unix/macosx.h
+ $(CC) -c $(CF) -DFUNZIP -o $@ unix/unix.c
+
+./win32_f.o: win32/win32.c $(H_UNZIP)
+ $(CC) -c $(CF) -DFUNZIP -o $@ win32/win32.c
+
+./win32i64_f.o: win32/win32i64.c $(H_UNZIP)
+ $(CC) -c $(CF) -DFUNZIP -o $@ win32/win32i64.c
+
+#----------------------------------------------------------------------------
+
+# C Compile rules: AES (WinZip/Gladman) encryption
+
+aescrypt.o: aes_wg/aescrypt.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/aescrypt.c
+
+aeskey.o: aes_wg/aeskey.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/aeskey.c
+
+aestab.o: aes_wg/aestab.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/aestab.c
+
+fileenc.o: aes_wg/fileenc.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/fileenc.c
+
+hmac.o: aes_wg/hmac.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/hmac.c
+
+prng.o: aes_wg/prng.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/prng.c
+
+pwd2key.o: aes_wg/pwd2key.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/pwd2key.c
+
+sha1.o: aes_wg/sha1.c $(H_AES)
+ $(CC) -c $(CF) -o $@ aes_wg/sha1.c
+
+#----------------------------------------------------------------------------
+
+# C Compile rules: LZMA compression
+
+LzFind.o: szip/LzFind.c $(H_LZMA)
+ $(CC) -c $(CF) -o $@ szip/LzFind.c
+
+LzmaDec.o: szip/LzmaDec.c $(H_LZMA)
+ $(CC) -c $(CF) -o $@ szip/LzmaDec.c
+
+#----------------------------------------------------------------------------
+
+# C Compile rules: PPMd compression
+
+Ppmd8.o: szip/Ppmd8.c $(H_PPMD)
+ $(CC) -c $(CF) -o $@ szip/Ppmd8.c
+
+Ppmd8Dec.o: szip/Ppmd8Dec.c $(H_PPMD)
+ $(CC) -c $(CF) -o $@ szip/Ppmd8Dec.c
+
+#----------------------------------------------------------------------------
+# Build rules: Assemble (.S -> .o)
+# - Optional assembler replacements for C routines
+# - All are port-specific
+# - Generated when referenced by OSDEP_OS
+# - OSDEP_OS is customized by unix/configure, based on PORT macro
+#----------------------------------------------------------------------------
+
+# Assembler rule: CRC-32
+#
+# 1) Assembler rule: CRC, 16-bit only, MSDOS
+$(O_CRC_I): msdos/crc_i86.asm
+ $(AS) $(AF) -c msdos/crc_i86.asm $(ASEOL)
+
+# 2) Assembler rule: CRC 32bit, GNU AS
+$(O_CRC_G): crc_i386.S $(ACONF_DEP)
+ $(AS) $(AF) -c -o $@ crc_i386.S
+
+# 3) Assembler rule: CRC 32bit, SysV AS
+$(O_CRC_SV): crc_i386.S $(ACONF_DEP)
+ $(CPP) $(AF) crc_i386.S > _crc_i386s.s
+ $(AS) -c -o $@ crc_i386s.s
+ $(RM) crc_i386s.s
+
+#----------------------------------------------------------------------------
+# Build rules: Object archives (.o -> .a)
+#----------------------------------------------------------------------------
+
+# Object archive rule: AES (WinZip/Gladman) encryption
+$(AR_AES): $(O_AES)
+ @echo 'Building/updating AES (WinZip/Gladman) object library...'
+ -$(RM) libaes.a
+ $(AR) libaes.a $(O_AES)
+ -$(RANLIB) libaes.a
+
+# Object archive rule: LZMA compression
+$(AR_LZMA): $(O_LZMA)
+ @echo 'Building/updating LZMA object library...'
+ -$(RM) liblzma.a
+ $(AR) liblzma.a $(O_LZMA)
+ -$(RANLIB) liblzma.a
+
+# Object archive rule: PPMd compression
+$(AR_PPMD): $(O_PPMD)
+ @echo 'Building/updating PPMd object library...'
+ -$(RM) libppmd.a
+ $(AR) libppmd.a $(O_PPMD)
+ -$(RANLIB) libppmd.a
+
+# Object archive rule: BZIP2 compression
+$(AR_BZ):
+ @echo 'Building/updating BZIP2 object library...'
+ @if [ -f flags_bz ]; then \
+ ( cd bzip2/; \
+ echo "Using flags_bz overrides"; \
+ eval $(MAKE) -f $(MK_BZ) libbz2.a ACONF_DEP=flags_bz \
+ `cat ../flags_bz`; \
+ ); \
+ else \
+ ( cd bzip2/; \
+ eval $(MAKE) -f $(MK_BZ) CC="$(CC_BZ)" CFLAGS="$(CF_BZ)" \
+ RANLIB="$(RANLIB)" RM="rm -f" libbz2.a; \
+ ); \
+ fi
+
+# Object archive rule: ZLIB compression
+$(AR_Z):
+ @echo 'Building/updating ZLIB object library...'
+ ( cd zlib/; \
+ eval $(MAKE) -f Makefile libz.a ACONF_DEP=flags `cat ../flags`; \
+ )
+
+# Object archive rule: Callable UnZip
+
+$(AR_UNZIP): $(O_UNZIPL) $(O_UNZIPN) $(LIB_AES_WG) $(LIB_LZMA) $(LIB_PPMD)
+ @echo 'Building/updating Callable UnZip object library...'
+ unix/mlz.sh "$(AR_UNZIP)" "$(O_UNZIPL) $(O_UNZIPN)" \
+ $(LIB_AES_WG) $(LIB_LZMA) $(LIB_PPMD)
+
+#----------------------------------------------------------------------------
+# Build rules: Link programs (.o + .a -> unzips)
+#----------------------------------------------------------------------------
+
+# Link rule: unzip
+$(PGM_UNZIP): $(O_UNZIP) $(LIB_AES_WG) $(LIB_BZ) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LIB_Z)
+ $(LD) -o $@ $(LF1) $(O_UNZIP) $(LF2)
+
+# Link rule: unzipsfx
+$(PGM_SFX): $(O_SFX) $(LIB_AES_WG) $(LIB_BZ) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LIB_Z)
+ $(LD) -o $@ $(LF1) $(O_SFX) $(LF2)
+
+# Link rule: funzip
+$(PGM_FUZ): $(O_FUZ) $(LIB_AES_WG) $(LIB_BZ) $(LIB_LZMA) \
+ $(LIB_PPMD) $(LIB_Z)
+ $(LD) -o $@ $(LF1) $(O_FUZ) $(LF2)
+
+# Link rule: zipinfo
+$(PGM_ZINFO): $(PGM_UNZIP)
+ @echo ' This is a Unix-specific target.'
+ @echo ''
+ @echo ' ZipInfo is not enabled in some MS-DOS versions of UnZip;'
+ @echo ' if it is in yours, copy unzip.exe to zipinfo.exe, or else'
+ @echo ' invoke as "unzip -Z" (in a batch file, for example).'
+ $(LN) $(PGM_UNZIP) $(PGM_ZINFO)
+
+#----------------------------------------------------------------------------
+# Build rules: Documentation
+# - Explicit 1:1 rules are used
+# - Across various make utilities, pattern rule support is inconsistent
+# - Sys V make has issues with $< when input and output names differ
+#----------------------------------------------------------------------------
+
+# UnZip documentation output directory rules
+# - Creates manout directory if unix/configure not executed
+manout:
+ mkdir manout
+
+# UnZip text documentation generation rules
+
+$(DOC_UNZIP): man/unzip.1
+ man man/unzip.1 | col -bx | uniq | expand > $@
+
+$(DOC_SFX): man/unzipsfx.1
+ man man/unzipsfx.1 | col -bx | uniq | expand > $@
+
+$(DOC_FUZ): man/funzip.1
+ man man/funzip.1 | col -bx | uniq | expand > $@
+
+$(DOC_ZINFO): man/zipinfo.1
+ man man/zipinfo.1 | col -bx | uniq | expand > $@
+
+$(DOC_ZGREP): man/zipgrep.1
+ man man/zipgrep.1 | col -bx | uniq | expand > $@
+
+# UnZip man page generation rule
+# - Requires nroff, or GNU groff package
+
+$(MAN_UNZIP): man/unzip.1
+ nroff -man man/unzip.1 | col -bx | uniq > $@
+
+$(MAN_SFX): man/unzipsfx.1
+ nroff -man man/unzipsfx.1 | col -bx | uniq > $@
+
+$(MAN_FUZ): man/funzip.1
+ nroff -man man/funzip.1 | col -bx | uniq > $@
+
+$(MAN_ZINFO): man/zipinfo.1
+ nroff -man man/zipinfo.1 | col -bx | uniq > $@
+
+$(MAN_ZGREP): man/zipgrep.1
+ nroff -man man/zipgrep.1 | col -bx | uniq > $@
+
+#----------------------------------------------------------------------------
+# Build rules: Standard build targets
+#----------------------------------------------------------------------------
+
+all: generic_msg generic
+unzips: $(UNZIP_PGMS)
+objs: $(O_UNZIP)
+objsdll: $(O_DLL)
+docs: manout $(UNZIP_DOCS)
+manuals: manout $(UNZIP_MANS)
+unzipsman: unzips manuals
+unzipsdoc: unzips docs
+
+#----------------------------------------------------------------------------
+# Build rules: ???????
+# FIX_ME: ??????
+#----------------------------------------------------------------------------
+unix_make:
+# @echo \
+# '(Ignore any errors from `make'"' due to the following command; it's harmless.)"
+ -@2>&1 $(LN) unix/Makefile_old . > /dev/null || echo > /dev/null
+
+#----------------------------------------------------------------------------
+# Build rules: Configuration flags.
+# - Creates files containing system-dependent flag values.
+# - Generated by unix/configure based on build utility program, platform and
+# features selected.
+#----------------------------------------------------------------------------
+
+# Main flags
+
+flags: unix/configure_old
+ @echo "Running: unix/configure_old"
+ @sh unix/configure_old \
+ "PROD='$(PROD)'" \
+ "LIST='$(LIST)'" \
+ "CC='$(CC)'" \
+ "CFLAGS='$(LOCAL_UNZIP)'" \
+ "LFLAGS1='$(LFLAGS1)'" \
+ "LFLAGS2='$(LFLAGS2)'" \
+ "AES_WG='$(AES_WG)'" \
+ "LZMA='$(LZMA)'" \
+ "PPMD='$(PPMD)'" \
+ "IZ_BZIP2='$(IZ_BZIP2)'" \
+ "IZ_ZLIB='$(IZ_ZLIB)'"
+
+# BZIP2 flags
+
+flags_bz: flags
+
+# These symbols, when #defined using -D have these effects on compilation:
+# ZMEM - includes C language versions of memset(), memcpy(),
+# and memcmp() (util.c).
+# HAVE_DIRENT_H - use <dirent.h> instead of <sys/dir.h>
+# NODIR - for 3B1, which has neither getdents() nor opendir().
+# HAVE_NDIR_H - use <ndir.h> (unix/unix.c).
+# HAVE_SYS_DIR_H - use <sys/dir.h>
+# HAVE_SYS_NDIR_H - use <sys/ndir.h>
+# UTIL - select routines for utilities (note, cloak, split)
+# NO_RMDIR - remove directories using a system("rmdir ...") call.
+# NO_PROTO - cannot handle ANSI prototypes
+# NO_CONST - cannot handle ANSI const
+# NO_LARGE_FILE_SUPPORT - do not enable Large File support even if available.
+# NO_ZIP64_SUPPORT - do not enable Zip64 archive support even if available.
+# NO_UNICODE_SUPPORT - do not enable Unicode support even if available.
+# NO_BZIP2_SUPPORT - do not compile in bzip2 code even if available.
+
+#----------------------------------------------------------------------------
+# Build rules: Clean-up targets
+# - Used to remove old output files before performing a new build
+# - Used when incompatible build options (or source changes) are required.
+#----------------------------------------------------------------------------
+
+clean:
+ rm -f *.o *.a $(UNZIP_PGMS) $(PGM_ZINFO) flags flags_bz
+ rm -rf manout
+ rm -rf $(PKGDIR)
+
+clean_bzip2:
+ @if [ -f bzip2/$(MK_BZ) ]; then \
+ ( cd bzip2; make -f $(MK_BZ) clean ); \
+ else \
+ echo "No bzip2 make file found: bzip2/$(MK_BZ)"; \
+ fi;
+
+clean_exe:
+ rm -f $(UNZIP_PGMS) $(PGM_ZINFO)
+
+clean_docs:
+ rm -f $(UNZIP_DOCS)
+
+#----------------------------------------------------------------------------
+# Build rules: Installation-related
+#----------------------------------------------------------------------------
+
+install: unzips manuals
+ -$(INSTALL_D) $(BINDIR)
+ $(INSTALL_PROGRAM) $(UNZIP_PGMS) $(BINDIR)
+ $(INSTALL) $(PGM_ZGREP) $(BINDIR)
+ $(RM) $(BIN_ZINFO)
+ $(LN) $(BIN_UNZIP) $(BIN_ZINFO)
+ -$(INSTALL_D) $(MANDIR)
+ $(INSTALL) $(UNZIP_MANS) $(MANDIR)
+ $(CHMOD) $(BINPERMS) $(INSTALLEDBIN)
+ $(CHMOD) $(MANPERMS) $(INSTALLEDMAN)
+
+uninstall:
+ $(RM) $(INSTALLEDBIN) $(INSTALLEDMAN)
+
+#----------------------------------------------------------------------------
+# Build rules: SVR4 Package generation Interface
+# - Originally tested under Sun Solaris 2.x (by JBush)
+# - Other SVr4s may be very similar, and could possibly use this
+# Note: Expects version info to be stored in VERSION macro variable
+# See "README" under unix/Packaging
+#----------------------------------------------------------------------------
+
+svr4package: unzips
+ @echo 'Creating SVR4 package for Unix ...'
+ -@rm -rf $(PKGDIR) $(PKGDIR)_`uname -p`.pkg
+ -@sed -e "s/.VERSION./$(VERSION)/g" \
+ -e "s/.PSTAMP./$(LOGNAME)_`date | tr ' ' '_'`/g" \
+ -e "s/.ARCH./Solaris_`uname -rp | tr ' ' ','`/g" \
+ unix/Packaging/pkginfo.in > unix/Packaging/pkginfo
+ -@sed -e "s/.ARCH./`uname -p`/g" \
+ unix/Packaging/preinstall.in > unix/Packaging/preinstall
+ /usr/bin/pkgmk -d . -b . -r . -f unix/Packaging/prototype $(PKGDIR)
+ /usr/bin/pkgtrans -o -s . $(PKGDIR)_`uname -p`.pkg $(PKGDIR)
+ @echo ''
+ @echo \
+ "To install, copy $(PKGDIR)_`uname -p`.pkg to the target system, and"
+ @echo \
+ "issue the command (as root): pkgadd -d $(PKGDIR)_`uname -p`.pkg"
+ @echo ''
+
+#----------------------------------------------------------------------------
+# Build rules: Make a distribution
+#----------------------------------------------------------------------------
+
+dist: $(DOC_UNZIP)
+ eval unzip -r9 unzip`sed -e '/VERSION/!d' -e 's/.*"\(.*\)".*/\1/' \
+ -e 's/[.]//g' -e 's/ .*//g' -e q revision.h` *
+
+#----------------------------------------------------------------------------
+# Build rules: Unzip validation tests
+#----------------------------------------------------------------------------
+
+# Test archives.
+TESTZIP = testmake.zip
+TESTZIP_PPMD = testmake_ppmd.zip
+
+# test some basic features of the build
+check: test
+
+dashv:
+ ./unzip -v
+
+test:
+ sh unix/test_unzip.sh $(TESTZIP)
+
+test_ppmd:
+ sh unix/test_unzip.sh $(TESTZIP_PPMD) . NOFUNSFX
+
+# Create a new testmake.zip or testmake_ppmd.zip.
+#
+# These targets are intended for use by UnZip developers, not by normal
+# users. The method used relies on an existing testmake.zip file to
+# provide "notes", which historically has non-Unix line endings.
+#
+# Note that this is typically an iterative process, because the test
+# archive includes an "unzip -Z" report on itself, which often results
+# in mismatches on date-time and file size data. If the results don't
+# converge within a few iterations, then it may help to wait a minute (to
+# get a different date-time), or to replace the current testmake.zip with
+# the original (or some other old version).
+#
+# While crude, the method used here does try to save the original
+# testmake[_ppmd].zip file as testmake[_ppmd].zip_orig, which is deleted
+# only if the "diff" succeeds, which normally allows a manual restoration
+# to the original state, if success remains elusive.
+
+testmake_zip:
+ @if test ! -f $(TESTZIP) ; then \
+ echo "***" ; \
+ echo "*** Missing \"$(TESTZIP)\". Expect chronic failure. ***" ; \
+ echo "***" ; \
+ fi
+ if test -f $(TESTZIP) -a ! -f $(TESTZIP)_orig ; then \
+ cp -p $(TESTZIP) $(TESTZIP)_orig ; \
+ fi
+ @rm -rf testmake
+ @mkdir testmake
+ @( cd testmake ; \
+ ../unzip ../$(TESTZIP) > /dev/null ; \
+ touch testmake.zipinfo ; \
+ $(PGM_ZIP) -X $(TESTZIP) notes testmake.zipinfo > /dev/null ; \
+ ../unzip -Z -mc- $(TESTZIP) > testmake.zipinfo ; \
+ $(PGM_ZIP) -X $(TESTZIP) notes testmake.zipinfo > /dev/null ; \
+ ../unzip -Z -mc- $(TESTZIP) > testmake.zipinfo_new ; \
+ mv $(TESTZIP) ../$(TESTZIP) )
+ @if diff testmake/testmake.zipinfo \
+ testmake/testmake.zipinfo_new 2> /dev/null ; then \
+ echo '' ; echo " It's a miracle!" ; echo '' ; \
+ rm $(TESTZIP)_orig ; \
+ else \
+ echo '' ; echo ' Try again?' ; echo '' ; \
+ fi
+ @rm -r testmake
+
+testmake_ppmd_zip:
+ @if test ! -f $(TESTZIP_PPMD) ; then \
+ cp -p $(TESTZIP) $(TESTZIP_PPMD) ; \
+ fi
+ if test -f $(TESTZIP_PPMD) -a ! -f $(TESTZIP_PPMD)_orig ; then \
+ cp -p $(TESTZIP_PPMD) $(TESTZIP_PPMD)_orig ; \
+ fi
+ @rm -rf testmake
+ @mkdir testmake
+ @( cd testmake ; \
+ ../unzip ../$(TESTZIP_PPMD) > /dev/null ; \
+ touch testmake.zipinfo ; \
+ $(PGM_ZIP) -X -Z ppmd $(TESTZIP_PPMD) notes testmake.zipinfo > \
+ /dev/null ; \
+ ../unzip -Z -mc- $(TESTZIP_PPMD) > testmake.zipinfo ; \
+ $(PGM_ZIP) -X -Z ppmd $(TESTZIP_PPMD) notes testmake.zipinfo > \
+ /dev/null ; \
+ ../unzip -Z -mc- $(TESTZIP_PPMD) > testmake.zipinfo_new ; \
+ mv $(TESTZIP_PPMD) ../$(TESTZIP_PPMD) )
+ @if diff testmake/testmake.zipinfo \
+ testmake/testmake.zipinfo_new 2> /dev/null ; then \
+ echo '' ; echo " It's a miracle!" ; echo '' ; \
+ rm $(TESTZIP_PPMD)_orig ; \
+ else \
+ echo '' ; echo ' Try again?' ; echo '' ; \
+ fi
+ @rm -r testmake
+
+################################
+# INDIVIDUAL MACHINE MAKERULES #
+################################
+
+#----------------------------------------------------------------------------
+# Generic targets
+# - These invoke the configure script to determine configuration.
+#----------------------------------------------------------------------------
+
+# generic_msg
+# - Issue warning message before generic build
+generic_msg:
+ @echo ''
+ @echo ' Attempting "make generic" now. If this fails for some reason, type'
+ @echo ' "make help" for suggestions. If none of the targets work for you,'
+ @echo ' contact us using the information in README so we can work the'
+ @echo ' problems.'
+ @echo ''
+
+# generic
+# - Generate flags file (if doesn't exist), then unzip modules
+
+generic: flags
+ eval $(MAKE) $(MAKEF) unzips ACONF_DEP=flags `cat flags`
+
+# generic_man
+# - Generate flags file (if doesn't exist), then man pages
+
+generic_man: flags
+ eval $(MAKE) $(MAKEF) manuals ACONF_DEP=flags `cat flags`
+
+# generic_docs
+# - Generate flags file (if doesn't exist), then plain text docs
+
+generic_docs: flags
+ eval $(MAKE) $(MAKEF) docs ACONF_DEP=flags`cat flags`
+
+# generic_pkg
+# - Generate flags file (if doesn't exist), then UnZip modules, then perform
+# SVR4 package-creation
+
+generic_pkg: generic svr4package
+
+#----------------------------------------------------------------------------
+# Old static generic targets
+# - For those systems which do not work with the generic targets.
+# - Can not assume that the make utility groks "$(MAKE)"
+#----------------------------------------------------------------------------
+
+generic1: unzips # first try if unknown
+
+generic2: unix_make # second try if unknown: hope make is called "make"
+ make $(MAKEF) unzips CF="$(CF) -DBSD"
+
+generic3: unix_make # third try if unknown: hope make is called "make"
+ make $(MAKEF) unzips CF="$(CF) -DSYSV"
+
+# Generic build including bzip2 decompression support for UnZip.
+# Requires presence of the bzip2 sources in subdirectory bzip2.
+generic_bz2: flags_bz $(AR_BZ)
+
+# Generic unzip and funzip target using either shared or static zlib for
+# inflate rather than the original UnZip version. (libz was libgz prior
+# to 0.94) Need to figure out how to force unzipsfx to use static libz.
+generic_zlib: ./flags $(AR_Z)
+
+# Generic GNU C shared library. This is an example of how to compile UnZip as
+# a shared library. (Doing so as a static library would be similar.) See also
+# the linux_shlib target.
+
+generic_shlib: unix_make
+ @echo \
+ 'This target requires GNU C. When done, do "setenv LD_LIBRARY_PATH `pwd`"'
+ @echo \
+ 'or similar in order to test the shared library in place (with ./unzip_shlib ,'
+ @echo \
+ 'which is UnZip linked with the DLL). This target is an example only.'
+ @echo ''
+ $(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC -DDLL"
+ gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(O_DLL)
+ $(RM) libunzip.so.0 libunzip.so
+ $(LN) -s libunzip.so.0.4 libunzip.so.0
+ $(LN) -s libunzip.so.0 libunzip.so
+ gcc -c -O unzipstb.c
+ gcc -o unzip_shlib $(O_STUB) -L. -lunzip
+
+#----------------------------------------------------------------------------
+# "Autoconfig" group, aliases for the generic targets using configure:
+#----------------------------------------------------------------------------
+
+# Solaris: generic, plus generation of installable package.
+solaris: generic_pkg
+
+#----------------------------------------------------------------------------
+# "Normal" group (BSD vs. SysV may be set in unzip.h via predefined macros):
+#----------------------------------------------------------------------------
+
+386i: unzips # sun386i, SunOS 4.0.2
+#3Bx: unzips # AT&T 3B2/1000-80; should work on any WE32XXX machine
+bull: unzips # Bull DPX/2, BOS 2.00.45 (doesn't require -Xk switch)
+convex: unzips # Convex C-120 and C-210 (-O is enough; -ext is default)
+cray: unzips # Cray-2 and Y-MP, using default (possibly old) compiler
+dec: unzips # DEC 5820 (MIPS RISC), test version of Ultrix v4.0
+encore: unzips # Multimax
+eta: unzips # ETA-10P*, hybrid SysV with BSD 4.3 enhancements
+gould: unzips # Gould PN9000 running UTX/32 2.1Bu01
+hp: unzips # HP 9000 series (68020), 4.3BSD or HP-UX A.B3.10 Ver D
+hpux: unzips # (to match Zip's makefile entry)
+mips: unzips # MIPS M120-5(?), SysV.3 [error in sys/param.h file?]
+next10: unzips # NeXT (generic; use next2x or next3x for better opt.)
+osf1: unzips # DECstation, including Alpha-based; DEC OSF/1 v1.x
+pyr_: unzips # [failsafe target for pyramid target below]
+pyr_ucb: unzips # Pyramids running BSD universe by default (see below)
+realix: unzips # Modcomp Real/IX (SysV.3); note "gcc" = GLS C, not GNU
+sco: unzips # Xenix/386 (tested on 2.3.1); SCO Unix 3.2.0.
+sgi: unzips # Silicon Graphics; Irix 3.3.2, 4.0.x, 5.2, etc.
+stellar: unzips # gs-2000
+sun: unzips # old target; no good with solaris...use "sunos" now
+sunos: unzips # no good with SunOS 3.x...use "sunos3" or "sunos4" now
+sunos4: unzips # Sun 3, 4; SunOS 4.x (SOME SYSTEMS ARE SYSTEM V!)
+tahoe: unzips # tahoe (CCI Power6/32), 4.3BSD
+ultrix: unzips # VAXen, DEC 58x0 (MIPS guts), DECstation 2100; v4.x
+vax: unzips # general-purpose VAX target (not counting VMS)
+
+#----------------------------------------------------------------------------
+# BSD group (for timezone structs [struct timeb]):
+#----------------------------------------------------------------------------
+
+bsd: _bsd # generic BSD (BSD 4.2 & Ultrix handled in unzip.h)
+
+_bsd: unix_make
+ $(MAKE) unzips CF="$(CF) -DBSD"
+
+#----------------------------------------------------------------------------
+# SysV group (for extern long timezone and ioctl.h instead of sgtty.h):
+#----------------------------------------------------------------------------
+
+aviion: _sysv # Data General AViiONs, DG/UX 4.3x
+pyr_att: _sysv # Pyramids running AT&T (SysV) universe by default
+stardent: _sysv # Stardent ...
+sysv: _sysv # generic System V Unix (Xenix handled in unzip.h)
+xos: _sysv # Olivetti LSX-3005..3045, X/OS 2.3 and 2.4
+
+_sysv: unix_make
+ $(MAKE) unzips CF="$(CF) -DSYSV"
+
+# extension to perform SVR4 package-creation after compilation
+_sysvp: _sysv svr4package
+
+#----------------------------------------------------------------------------
+# Version 7 group (old/obsolescent):
+#----------------------------------------------------------------------------
+
+pixel: _v7 # Pixel 80, 100 (68000-based, V7/mostly BSD4.1 compat.)
+v7: _v7 # generic Unix Version 7 box (prob. only Pixel...)
+
+_v7:
+ make $(MAKEF) unzips \
+ CF="$(CF) -DV7 -DNO_PARAM_H -DSHORT_NAMES -DBSD -DZMEM -DNO_LCHOWN -DNO_LCHMOD"
+
+#----------------------------------------------------------------------------
+# "Unique" group (require non-standard options):
+#----------------------------------------------------------------------------
+
+# AT&T 3B2/1000-80; should work on any WE32XXX machine
+3Bx: unix_make
+ $(MAKE) unzips CF="$(CF) -DCBREAK=2"
+
+# AT&T 7300 (M68000/SysV.3) (add -DSYSV? -DNO_LIMITS?)
+7300: unix_make
+ $(MAKE) unzips CF="$(CF) -DNO_DIR -DNO_MKDIR -DNO_STRNICMP -DNO_UID_GID -DNO_FCHMOD -DNO_LCHOWN -DNO_LCHMOD -DCBREAK=2"
+
+7300_gcc: unix_make
+ $(MAKE) unzips CC=gcc LD=gcc LF2="" CFLAGS="-O2" \
+ LOC="-DNO_DIR -DNO_MKDIR -DNO_STDLIB_H -DNO_STRNICMP -DNO_UID_GID -DNO_FCHMOD -DNO_LCHOWN -DNO_LCHMOD -DCBREAK=2 $(LOC)"
+ $(STRIP) $(UNZIP_PGMS)
+
+# Amdahl (IBMish) mainframe, UTS (SysV) 1.2.4, 2.0.1, 3.x
+amdahl: unix_make
+ $(MAKE) unzips CF="$(CF) -DSYSV -DNO_UID_GID -DNO_LCHOWN -DNO_LCHMOD"
+
+# Amdahl UTS 2.1.4 with "extended file types" filesystem (aarrrggghhhh...)
+amdahl_eft: unix_make
+ $(MAKE) unzips CF="$(CF) -eft -DSYSV -DNO_UID_GID -DNO_LCHOWN -DNO_LCHMOD"
+
+# Apollo Domain/OS machines (added -D...SOURCE options) [Gordon Fox, 960810]
+apollo: unix_make
+ $(MAKE) unzips CF="$(CF) -D_INCLUDE_BSD_SOURCE -D_INCLUDE_XOPEN_SOURCE -DNO_LCHOWN -DNO_LCHMOD"
+
+# BSDI BSD/OS on 386 platform, using the assembler replacement for crc32.c
+bsdi: unix_make
+ @echo 'NOTE: use bsdi_noasm target for non-Intel BSD/OS compiles.'
+ $(MAKE) unzips CC=gcc2 LD=shlicc2 AS=gcc2 \
+ CFLAGS="-O3 -Wall -DASM_CRC -DBSD" OSDEP_OS="./crc_gcc.o"
+
+# BSDI BSD/OS
+bsdi_noasm: unix_make
+# @echo 'NOTE: use bsd target for non-Intel BSD/OS compiles.'
+ $(MAKE) unzips CC=gcc2 LD=shlicc2 AS=gcc2 \
+ CFLAGS="-O3 -Wall -DBSD"
+
+# Coherent 3.x/4.x, Mark Williams C. ``For Coherent's CC, it needs either
+# -T0 or -T150000 (or bigger) added to the CFLAGS, otherwise the compiler
+# runs out of memory and dies in zipinfo.c.'' [Fred "Fredex" Smith, 940719]
+coherent: unix_make
+ $(MAKE) unzips CFLAGS="$(CFLAGS) -T0 -DNO_LCHOWN -DNO_LCHMOD"
+
+# Cray-2, Y-MP or C90, running Unicos 5.x to 8.x (SysV + BSD enhancements)
+# and Standard (ANSI) C compiler 3.0 or later.
+cray_opt: unix_make
+ $(MAKE) unzips CFLAGS="$(CFLAGS) -h scalar3 -h vector3 -DNO_LCHOWN -DNO_LCHMOD"
+
+# The unzip41 build on a Cyber 910/SGI running Irix v3.3.3 was successful
+# with the following change to Makefile:
+cyber_sgi: unix_make
+ $(MAKE) unzips \
+ CFLAGS="$(CFLAGS) -I/usr/include/bsd -DNO_LCHOWN -DNO_LCHMOD" \
+ LF="-lbsd $(LF)" SL="-lbsd $(SL)"
+
+# The "generic" target should work with Cygwin on Windows. The
+# following instructons are old, and probably obsolete...
+# The Cygwin environment on a Win32 system, treated as a Unix emulator.
+# This port does not offer full access to the Windows file system.
+# Info-ZIP recommends using "win32/Makefile.gcc" instead.
+cygwin: unix_make
+ $(MAKE) unzips CC=gcc LD=gcc AS=gcc \
+ CFLAGS="-O3 -DASM_CRC -DNO_LCHOWN -DNO_LCHMOD" \
+ AF="-Di386 $(AF)" OSDEP_OS="./crc_gcc.o" \
+ E=".exe" CP="cp" LN="ln -s"
+
+# 680x0, DIAB dnix 5.2/5.3 (a Swedish System V clone)
+#
+# Options for the dnix cc:
+# -X7 = cc is strict ANSI C
+# -X9 = warnings if a function is used without a declaration
+#
+dnix: unix_make
+ $(MAKE) unzips CFLAGS="$(CFLAGS) -X7 -X9 -DDNIX"
+
+# FreeBSD on Intel:
+freebsd: unix_make
+ @echo 'NOTE: use bsd target for non-Intel FreeBSD compiles (if any).'
+ $(MAKE) unzips CC=gcc LD=gcc AS=gcc \
+ CFLAGS="-O3 -Wall -DASM_CRC -DBSD" \
+ AF="-Di386 $(AF)" OSDEP_OS="./crc_gcc.o"
+
+# Generic BSDish Unix gcc. ``The -O3 only works with later versions of gcc;
+# you may have to use -O2 or -O for earlier versions. I have no idea why
+# -s causes this bug in gcc.'' [Bug: "nm: unzip: no name list", "collect:
+# /usr/bin/nm returned 1 exit status".] If you don't have strip, don't
+# worry about it (it just makes the executable smaller and can be replaced
+# with "echo" instead).
+#
+gcc: unix_make
+ $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O3" LF2=""
+ $(STRIP) $(UNZIP_PGMS)
+
+# Heurikon HK68 (68010), UniPlus+ System V 5.0, Green Hills C-68000
+hk68: unix_make
+ $(MAKE) unzips CC="gcc" LD="gcc" \
+ LF="-n $(LF)" SL="-n $(SL)" FL="-n $(FL)" \
+ CFLAGS="-ga -X138 -Dlocaltime=localti -Dtimezone=timezon"
+
+# ISC Unix on 386 platform
+isc: unix_make
+ $(MAKE) unzips LF2="-lc_s $(LF2)" OSDEP_OS="./crc_sysv.o" \
+ CFLAGS="-O" \
+ LOC="-DASM_CRC -DSYSV -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN -DNO_LCHMOD $(LOC)" \
+ AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)"
+
+isc_gcc: unix_make
+ $(MAKE) unzips AS=gcc CC=gcc LD=gcc OSDEP_OS="./crc_gcc.o" \
+ LF="-shlib $(LF)" SL="-shlib $(SL)" FL="-shlib $(FL)" LF2="" \
+ CFLAGS="-O3" \
+ LOC="-DSYSV -DASM_CRC -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN -DNO_LCHMOD $(LOC)" \
+ AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)"
+ $(STRIP) $(UNZIP_PGMS)
+
+# "ISI machine (68025 CPU)" (based on e-mail from Rob White <rsw@tfs.com>;
+# no further information). May also need DIRENT defined.
+isi: unix_make
+ $(MAKE) unzips CF="$(CF) -DDECLARE_ERRNO -DNO_LCHOWN -DNO_LCHMOD"
+
+# The "generic" target should work with GNU/Linux. The following
+# instructons are old, and probably obsolete...
+# Linux on 386 platform, using the assembler replacement for crc32.c. (-O4 and
+# -fno-strength-reduce have virtually no effect beyond -O3. Add "-m486
+# -malign-functions=2 -malign-jumps=2 -malign-loops=2" for Pentium [Pro]
+# systems.)
+linux: unix_make
+ @echo 'NOTE: use linux_noasm target for non-Intel Linux compiles.'
+ $(MAKE) unzips CC=gcc LD=gcc AS=gcc \
+ CFLAGS="-O3 -Wall -DASM_CRC" \
+ AF="-Di386 $(AF)" OSDEP_OS="./crc_gcc.o"
+
+linux_asm: linux
+
+# Linux (Posix, approximately SysV): virtually any version since before 0.96,
+# for any platform. Change "-O" to "-O3" or whatever, as desired...
+linux_noasm: unix_make
+ $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O -Wall"
+
+# Linux with lcc compiler: __inline__ (stat.h) not recognized, and must edit
+# /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined. -O3
+# (or -O2 or -O) is ignored. [GRR 960828: test target only]
+#
+linux_lcc: unix_make
+ $(MAKE) unzips CC=lcc LD=lcc CFLAGS="-O3 -Wall -D__inline__= "
+
+# Linux host with go32 (djgpp) cross-compiler (go32crs.tgz) for 32-bit DOS.
+linux_dos: unix_make
+ $(MAKE) unzips CC=go32gcc CFLAGS="-O2 -Wall" \
+ LD=go32gcc \
+ OSDEP_H="msdos/doscfg.h" \
+ OSDEP_OCF="./msdos.o" \
+ OSDEP_OCS="./msdos.o" \
+ OSDEP_OCU="./msdos.o" \
+ OSDEP_OS=""
+# go32-strip unzip
+# Due to limitations of the cross-compiling package, this has to be
+# done manually:
+ @echo "Copy $(UNZIP_PGMS) to your DOS partition and use coff2exe."
+
+# Linux ELF shared library (ooo, it's so easy). This is a test target for
+# now, and it only makes the UnZip/ZipInfo stuff (not fUnZip or UnZipSFX).
+# The version number may eventually change to match the UnZip version. Or
+# not. Whatever. Also do "setenv LD_LIBRARY_PATH `pwd`" or similar to test
+# the DLL in place (with unzip_shlib, which is UnZip linked with the shared
+# library).
+#
+linux_shlib: unix_make
+ $(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC" \
+ LOC="-DDLL -DASM_CRC $(LOC)" \
+ AS=gcc AF="-fPIC -Di386 $(AF)" OSDEP_OS="./crc_gcc.o"
+ gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(O_DLL) \
+ crc_gcc.pic.o
+ ln -sf libunzip.so.0.4 libunzip.so.0
+ ln -sf libunzip.so.0 libunzip.so
+ gcc -c -O unzipstb.c
+ gcc -o unzip_shlib $(O_STUB) -L. -lunzip
+
+# Linux ELF shared library, as above, but using inflate() from zlib (libz.so)
+# instead of the original UnZip version. (libz was libgz prior to 0.94)
+linux_shlibz: unix_make
+ $(MAKE) objsdll CC=gcc AS=gcc AF="-fPIC -Di386 $(AF)" \
+ OSDEP_OS="./crc_gcc.o" CFLAGS="-O3 -Wall -fPIC" \
+ LOC="-DDLL -DUSE_ZLIB -DASM_CRC $(LOC)"
+ gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(O_DLL) \
+ crc_gcc.pic.o
+ ln -sf libunzip.so.0.4 libunzip.so.0
+ gcc -c -O unzipstb.c
+ gcc -o unzip $(O_STUB) -L. -lunzip -lz
+
+# LynxOS-x86 2.3.0 and newer, a real-time BSD-like OS; uses gcc.
+lynx: unix_make
+ $(MAKE) unzips CC=gcc CF="$(CF) -DLynx -DLYNX -DBSD -DUNIX"
+
+# Macintosh MacOS X (Unix-compatible enviroment), using standard compiler
+macosx: unix_make
+ $(MAKE) unzips CFLAGS="-O3 -Wall -DBSD" LF2=""
+ $(STRIP) $(UNZIP_PGMS)
+
+# Macintosh MacOS X (Unix-compatible enviroment), using gcc
+macosx_gcc: unix_make
+ $(MAKE) unzips CC=gcc CFLAGS="-O3 -Wall -DBSD" LF2=""
+ $(STRIP) $(UNZIP_PGMS)
+
+# Minix 1.5 PC for the 386. Invoke as is to use default cc, or as "make
+# minix CC=gcc" to use gcc. Try "make linux" if you have a working termios.h.
+minix: unix_make
+ $(MAKE) unzips CF="$(CF) -DMINIX -DSHORT_NAMES -DNO_LCHOWN -DNO_LCHMOD" CC=$(CC) LD=$(CC)
+
+# MPE/iX, the Unix variant for HP 3000 systems.
+mpeix: unix_make
+ $(MAKE) unzips CC=c89 \
+ CF="$(CF) -DUNIX -D_POSIX_SOURCE -DHAVE_TERMIOS_H -DPASSWD_FROM_STDIN -DNO_PARAM_H -DNO_LCHOWN -DNO_LCHMOD" \
+ LF2=-lbsd CP=cp LN="ln -s"
+
+# NeXT info.
+next:
+ @echo ''
+ @echo \
+ ' Please pick a specific NeXT target: "make next10" will create a generic'
+ @echo \
+ ' NeXT executable; "make next2x" will create a smaller executable (for'
+ @echo \
+ ' NeXTstep 2.0 and higher); "make next3x" will create a small executable'
+ @echo \
+ ' with significantly better optimization (NeXTstep 3.0 and higher only);'
+ @echo \
+ ' "make nextfat" will create a fat, multi-architecture (NeXT plus Intel)'
+ @echo \
+ ' executable (NeXTstep 3.1 and higher only).'
+ @echo ''
+
+# 68030 BSD 4.3+Mach. NeXT 2.x: make the executable smaller.
+next2x: unix_make
+ $(MAKE) unzips LF2="-object -s"
+
+# NeXT 3.x: as above, plus better optimization.
+next3x: unix_make
+ $(MAKE) unzips CFLAGS="-O2" LF2="-object -s"
+
+# NeXT 3.1+: make the executable fat (multi-architecture binary [MAB],
+# for "black" [NeXT] and "white" [x86] hardware, so far).
+nextfat: unix_make
+ $(MAKE) unzips CFLAGS="-O2 -arch i386 -arch m68k" \
+ LF2="-arch i386 -arch m68k -object -s"
+
+# Sequent Symmetry running Dynix/ptx (sort of SysV.3): needs to link
+# with libseq to get symlink().
+ptx: unix_make
+ $(MAKE) unzips CF="$(CF) -DSYSV -DTERMIO -DPTX -DNO_LCHOWN -DNO_LCHMOD" LF2="$(LF2) -lseq"
+
+# Pyramid 90X (probably all) under >= OSx4.1, either universe. (This is an
+# experimental target! If it fails, use either pyr_ucb or pyr_att instead.)
+# The make in the BSD half is too stupid to understand $(MAKE), sigh...
+pyramid: unix_make
+ -make $(MAKEF) pyr_`universe`
+
+# QNX/Neutrino
+# - No native development tools, so cross-build environement is used.
+# - Use gcc and set ARCH as follows:
+# "x86" to produce x86
+# "ppcbe" PowerPC (big-endian)
+# "ppcle" PowerPC (little-endian)
+# "mipsbe" MIPS (big-endian)
+# "mipsle" MIPS (little-endian)
+qnxnto: unix_make
+ @if [ "$(ARCH)" = "" ] ; then \
+ echo "You didn't set ARCH; I'll assume you meant ARCH=x86..." ; \
+ echo '' ; \
+ $(MAKE) $(MAKEF) CC="qcc -Vgcc_ntox86" unzips ; \
+ else \
+ echo "Making UnZip for $(ARCH)..." ; \
+ echo '' ; \
+ $(MAKE) $(MAKEF) CC="qcc -Vgcc_nto$(ARCH)" unzips ; \
+ fi
+
+# REGULUS: 68040-based, "real-time" SysV.3 mutant; uses gcc, with "REGULUS"
+# predefined.
+regulus: unix_make
+ $(MAKE) unzips CF="$(CF) -traditional -DSYSV -DNO_MKDIR -DNO_LCHOWN -DNO_LCHMOD"
+
+# SCO UNIX with shared libraries and no international support. If you are
+# not using a USA-style keyboard and display, you may want to remove -nointl
+# to get support. It adds quite a bit to the size of the executable.
+sco_sl: unix_make
+ $(MAKE) unzips LF="$(LF) -nointl" LF2="$(LF2) -lc_s" \
+ SL="$(SL) -nointl" FL="$(FL) -nointl"
+
+# SCO Xenix/286 2.2.3 or later with development system 2.2.1 or later
+sco_x286: unix_make
+ $(MAKE) unzips \
+ CF="$(CF) -Mel2 -LARGE -DNO_MKDIR -DNO_LCHOWN -DNO_LCHMOD" \
+ LF="$(LF) -Mel2 -LARGE -lx" SL="$(SL) -Mel2 -LARGE" \
+ FL="$(FL) -Mel2 -LARGE"
+
+# Sequent Symmetry with Dynix. (386, but needs -DZMEM)
+# This should also work on Balance but I can't test it just yet.
+sequent: unix_make
+ $(MAKE) unzips CF="$(CF) -DBSD -DZMEM -DNO_LCHOWN -DNO_LCHMOD"
+
+# Sun 2, 3, 4 running SunOS 3.x
+sunos3: unix_make
+ $(MAKE) unzips CF="$(CF) -DNO_UID_GID -DUID_USHORT -DNO_LCHOWN -DNO_LCHMOD"
+
+# Generic System V + GNU C
+sysv_gcc: unix_make
+ $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O2 -DSYSV" LF2=""
+ $(STRIP) $(UNZIP_PGMS)
+
+# AT&T 6300+, System V.2 Unix: run-time out-of-memory error if don't use -Ml;
+# also compile-time error if work arrays dimensioned at HSIZE+2 (>32K)
+sysv6300: unix_make
+ $(MAKE) unzips CF="$(CF) -Ml -DSYSV -DNO_LCHOWN -DNO_LCHMOD" \
+ LF="$(LF) -Ml" SL="$(SL) -Ml" FL="$(FL) -Ml"
+
+# Texas Instruments System V.3 (running on HP 9000-1500)
+ti_sysv: unix_make
+ $(MAKE) unzips CF="$(CF) -DSYSV -DNO_UID_GID -DUID_USHORT -DNO_LCHOWN -DNO_LCHMOD"
+
+# SCO Xenix
+# - Joe Foster 1995/05/08
+# - unzip needs to be linked with -lx [for the opendir(), readdir(), telldir(),
+# rewinddir(), and closedir() calls]")
+xenix: unix_make
+ $(MAKE) unzips LF2="$(LF2) -lx"
+
--- /dev/null
+unix/README.zOS - UnZip 6.10 09 Sept 2011
+
+ Copyright (c) 2011 Info-ZIP. All rights reserved.
+
+z/OS is IBM's follow-on to both the OS/390 and MVS operating systems.
+
+The UNIX System Services element of z/OS is a UNIX operating environment,
+implemented within the z/OS operating system. It is also known as z/OS UNIX.
+The z/OS support enables two open systems interfaces on the z/OS operating
+system: an application programming interface (API) and an interactive shell
+interface.
+
+z/OS UNIX System Services provides:
+- XPG4 UNIX 1995 conformance
+- Assembler callable services
+- TSO/E commands to manage the file system
+- ISPF shell environment
+
+The z/OS UNIX environment complies at the source and operational level with
+the POSIX open system environment (POSIX OSE), XOPEN and related standards.
+This includes:
+- A POSIX (Born) shell
+- A standard UNIX build environment and utilities
+- UNIX-style POSIX filesystems
+ - Older form is Hierarchial File System (HFS), where the filesystem storage is
+ contained within a z/OS MVS PDSE library.
+ - Newer form is z File System (zFS), where the filesystem storage is contained
+ within one or more z/OS disk volumes. Unrelated to Solaris ZFS filesystem.
+
+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 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.
+ - This reflects the influence of the z/VM environment on z/OS UNIX.
+ - The EBCDIC Carriage Return (CR, 0x0D) and Line Feed (LF, 0x25) characters
+ derive from the legacy MVS serial communications (BiSync) telecomunications
+ interfaces, and are not normally used in z/OS UNIX text files.
+
+While the z/OS UNIX environment also provides some rather limited support for
+ASCII programs and files, this support is not used by the z/OS UNIX port of
+InfoZIP UNZIP.
+
+UNZIP for z/OS UNIX
+-----------------
+Allows you to extract files from ZIP archives, when invoked from the z/OS UNIX
+System Services shell command prompt. This port uses standard Unix-style I/O
+routines and only supports POSIX-style files in HFS or zFS filesystems.
+
++----------------------------------------------------------------------------+
+| NOTE: This port does *NOT* work with non-POSIX (traditional MVS) files. |
+| |
+| A new z/OS port is under development that will operate in both z/OS |
+| UNIX and MVS environments, and support both POSIX and non-POSIX |
+| z/OS files. |
+| |
++----------------------------------------------------------------------------+
+
+Usage
+-----
+By default, UNZIP does not perform character-set translation, but has
+options to make it easy to convert text files to be compatible with
+other systems
+ unzip zipfile # extract the members from the archive 'zipfile'
+ unzip -a zipfile # same as above, but translate text files to EBCDIC
+ unzip -al zipfile # same as above, but translates all files to EBCDIC
+
+Build process
+-------------
+This port is normally built using the z/OS UNIX make and cc utilities, as
+follows:
+
+* Determine the z/OS POSIX directory where the build is to be performed,
+ and create as required.
+
+* Use a binary-mode transfer utility such as FTP or SFTP to transport the ZIP
+ source archive file to that directory. The archive file to be used depends on
+ the utility that is available to unpack the archive.
+
+ * One may choose to use an existing or new installation of the z/OS UNIX
+ InfoZIP UNZIP utility.
+
+ Upload the unzip610.zip file, and issue the following command at the z/OS
+ UNIX shell prompt to extract the UNZIP source archive files, with text files
+ in EBCDIC:
+
+ unzip -a unzip610
+
+ * In the absence of InfoZIP UNZIP, one will use the zip610.tar.gz GNU zip
+ archive.
+
+ * If the z/OS UNIX port of GNU zip (gzip) is available, upload the archive
+ in binary and issue the command
+
+ gzip -d unzip610.tar.gz
+
+ and create the unzip610.tar file.
+
+ * Otherwise, this command must be issued on a convenient workstation and
+ the resulting unzip610.tar file uploaded in binary to z/OS UNIX.
+
+ Unpack the archive and convert to EBCDIC with pax
+
+ pax -r -ofrom=ISO8859-1,to=IBM-1047 -f ../unzip610.tar
+
+* Switch to the resulting unzip610 directory.
+
+* Use the cat command on a sample of the source files to verify that they are
+ encoded in EBCDIC and suitable for input to the IBM z/OS XL C compiler.
+
+* Compile and link the z/OS UNIX UNZIP utility, using make and cc:
+
+ make -f unix/Makefile generic
+
+ This will generate the main unzip executable, as well as the other utility
+ executables (unzipsfx, funzip, and zipinfo).
+
+ Alternatively, one can use the GNU make (gmake utility) and cc:
+
+ gmake -f unix/Makefile generic
+
+* 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
+
+ or
+
+ gmake -f unix/Makefile clean
+
+* Optionally, InfoZIP UNZIP can be built with WinZIP-compatible AES encryption
+ support (based on Dr Brian Gladman's AES libraries).
+
+ make -f unix/Makefile generic AES_WG=1
+
+ or
+
+ gmake -f unix/Makefile generic AES_WG=1
+
+* Optionally, InfoZIP UNZIP can be built with LZMA compression support.
+
+ make -f unix/Makefile generic LZMA=1
+
+ or
+
+ gmake -f unix/Makefile generic LZMA=1
+
+
+* 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.
+
+ make -f unix/Makefile generic IZ_BZIP2=bzip2
+
+ or
+
+ gmake -f unix/Makefile generic IZ_BZIP2=bzip2
+
+ Note: While InfoZIP UNZIP can extract BZIP2-compressed files, there is an
+ an outstanding bug that prevents InfoZIP ZIP from adding new archive
+ members encoded with the BZIP2 compression.
+
++----------------------------------------------------------------------------+
+| Overview of Changes for z/OS UNIX port |
++----------------------------------------------------------------------------+
+UNZIP 6.10 changes by Al Dunsmuir (09 Sept 2011)
+
+The z/OS UNIX port is based on (and replaces) the original updated UNZIP 6.10
+"OS/390" port by Bob Woodside.
+
+- Replaced make target for _.o files by providing standard file-pattern rules
+ 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.
+ - 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.
+
+- Improve configure support for the IBM compilers (z/OS, z/VM. AIX. iSeries)
+ - Recognize compilers, use system-specific compiler and build options
+ - Build z/OS, z/VM and AIX UNIX ports with c89, with function checking.
+ - On z/OS, use "uname -I" to get z/OS-specific info (vs OS/390 compat info)
+ - Add zos/zcpp shell script for C preprocessor-based configure tests
+
+- Updated unix/unix.c to display actual IBM compiler identifier and z/OS
+ build system identifier.
+
+- Add support for listing file generation, with LIST=1 make parm
+ - Generates appropriate options to generate listings, and switches from
+ the generic cc driver to zos/zcc and zos/zld shell scripts that support
+ compile and link listing capture (respectively).
+
+- Add zos/zcpp shell script to support unix/configure C preprocessor tests.
+
+- Eliminate make zos and os390 targets
+
+- Replaced all z/OS UNIX-specific (#ifdef OS390) preprocessor statements by
+ the more explicit (#ifdef ZOS_UNIX)
+
+- Add notes describing LZMA and BZIP2 compression support.
+
+- Add unix/README.zOS
+
:
#!/bin/sh -x
-# The above : is necessary on some buggy systems.
+# The above ":" is necessary on some buggy systems.
-# configure: Guess values for system-dependent variables
-# Output the flag definitions to the file "flags".
-# Parameters: $1 = $(CC), $2 = $(CFLAGS), $3 = $(IZ_BZIP2)
-# To construct unzip automatically using this file, type
-# "make -f unix/Makefile generic".
-# If this fails, then type "make list" to get a list of special targets.
+#==============================================================================
+# unix/configure: Detect feature support and pass that information to Makefile.
+# - For UnZip, UnZipSFX, fUnZip, and ZipInfo Revised: 2014-08-18
+#
+# Copyright (c) 2004-2014 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. If,
+# for some reason, all these files are missing, the Info-ZIP license may
+# also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#==============================================================================
+
+#==============================================================================
+# Purpose:
+#
+# This unix/configure script is invoked by unix/Makefile for generic targets
+# to probe the system, the compiler, and other parts of the environment to
+# determine values for system-dependent "make" macros. It generates the
+# files "$PROD/flags" and "$PROD/flags_bz" that hold the flags used by
+# unix/Makefile to enable or disable features based on available support for
+# them.
+#
+# This script checks for the build and manual directories, and will try to
+# create them if necessary.
+#
+# This shell script is typically invoked by unix/Makefile (via sh) rather than
+# being executed directly by the user.
+#
+# To build UnZip automatically using this file, type:
+# make -f unix/Makefile generic
+# If this fails, then type "make list" to get a list of specific targets.
+# However, the specific targets tend to be out of date and may not enable all
+# available features. In many cases, the specific targets may not even work
+# anymore.
+#
+#
+# Parameters:
+#
+# Setting parameters allows enabling optional features (such as optional
+# compression methods), disabling features, and pointing the script to
+# available libraries.
+#
+# Parameters are usually provided by the Makefile and are specified by the
+# user on the initial "make" invocation. Note that some parameters take
+# values, in the form "var=value", where var is one of the parameters listed
+# below.
+#
+# In most cases, setting a parameter to 1 enables a feature and to 0 (or
+# omitting the parameter) disables it.
+#
+#
+# Environment variables:
+#
+# Compilation parameters can also be set in the environment.
+# export "var=value" for var names like:
+# LOCAL_UNZIP
+#
+#
+# UnZip Ports:
+#
+# This configure script support a number of non-unix UnZip ports, where UnZip
+# is built is under Unix (or a Unix work-alike), but the resulting UnZip
+# program may be for another system or execution environment. This script
+# will be invoked from either unix/Makefile, or from a port-specific Makefile.
+# The port may be explicitly identified by the PORT parameter, or implicitly
+# detected by compiler configuration tests.
+#
+# Supported ports include:
+# msdos : DOS port built using the DJGPP native or cross-compiler
+# os2 : OS/2 port
+# qdos : Sinclair Q-DOS port built using a gcc cross-compiler
+# zos : z/OS MVS port built under z/OS UNIX
+# zvm : z/VM CMS port built under z/VM UNIX
+#
+#==============================================================================
+# Parameter and Environment variables supported:
+#
+# Build utility configuration:
+# PROD - Build directory root (default: .)
+# PORT - Port name (default: unix)
+#
+# CC - C Compiler program name (for core components)
+# (default: cc)
+# CC_BZ - C Compiler program name (for BZIP2 components)
+# (default: cc)
+# CPP - C Preprocessor program name (default: $CC -E)
+# AS - Assembler program name (default: $CC -c)
+# LD - Linker program name (default: $CC)
+# RANLIB - Archive index program name (default: ranlib)
+#
+# CFLAGS - C Compiler flag initial values
+# CFLAGS_OPT - C Compiler optimization option override (non-null)
+# LOCAL_UNZIP - C compiler flag user override values
+#
+# AFLAGS - Assembler flag initial values
+#
+# LFLAGS1 - Linker flag initial values (before output file spec)
+# LFLAGS2 - Linker flag initial values (after output file spec)
+#
+# OSDEP_H - OS-dependent C header file names
+# OSDEP_OCF - OS-dependent C object file names, funzip
+# OSDEP_OCS - OS-dependent C object file names, unzipsfx
+# OSDEP_OCU - OS-dependent C object file names, unzip
+# OSDEP_OS - OS-dependent Assembler object file names
+#
+# PGMEXT - Binary program file extension
+# DLLEXT - Binary program DLL (.so) file extension
+#
+# LIST - Enable compile/linker listing generation
+#
+# UnZip optional feature configuration:
+# NO_AES_WG - Disable AES encryption (WinZip/Gladman).
+# IZ_BZIP2 - Enable/direct BZIP2 compression.
+# NO_IZ_BZIP2 - Disable BZIP2 compression.
+# NO_ICONV - Disable ISO/OEM character conversion using iconv.
+# NO_LZMA - Disable LZMA compression.
+# NO_PPMD - Disable PPMd compression.
+# IZ_ZLIB - Use ZLIB for deflate compression.
+#
+#==============================================================================
+# Build utility generated configuration flags:
+#
+# - Generated based on build utility program, platform and features selected
+# - Generated flags are appended to initial user-specified value
+# - LOCAL_UNZIP value is appended to final CF and CF_BZ values
+#
+# CC - C Compiler program name (for core components)
+# CC_BZ - C Compiler program name (for BZIP2 components)
+# CF - C Compiler flag values (for core components)
+# CF_BZ - C Compiler flag values (for BZIP2 components)
+# CPP - C Preprocessor program name
+# AS - Assembler program name
+# AF - Assembler flag initial values
+# LD - Linker program name
+# LF1 - Linker flags (before output file spec)
+# LF2 - Linker flags (after output file spec)
+# AR - Archive program name (and options)
+# RANLIB - Archive index program name
+# LN - File link program name (and options)
+# PROD - Root build directory
+# PORT - Port name build control
+# IZ_BZIP2 - BZIP2 compression build directory
+# IZ_ZLIB - ZLIB compression build directory
+# LIB_AES_WG - AES (WinZip/Gladman) encryption build dependencies
+# LIB_BZ - BZIP2 compression build dependencies
+# LIB_LZMA - LZMA compression build dependencies
+# LIB_PPMD - PPMd compression build dependencies
+# LIB_Z - ZLIB compression build dependencies
+# MK_BZ - BZIP2 compression build makefile
+# OSDEP_H - OS-dependent C header file names
+# OSDEP_OCF - OS-dependent C object file names, funzip
+# OSDEP_OCS - OS-dependent C object file names, unzipsfx
+# OSDEP_OCU - OS-dependent C object file names, unzip
+# OSDEP_OS - OS-dependent Assembler object file names
+# PGMEXT - Binary program file extension
+# DLLEXT - Binary program DLL (.so) file extension
+#
+#==============================================================================
trap "rm -f conftest* core a.out; exit 1" 1 2 3 15
-CC=${1-cc}
-CFLAGS=${2}
-CFLAGSR=${CFLAGS}
-IZ_BZIP2=${3}
-CFLAGS="${CFLAGS} -I. -DUNIX"
-LFLAGS1=""
-LFLAGS2="-s"
-LN="ln -s"
+# No-newline "echo" function.
+if echo -n abc | grep n > /dev/null ; then
+ echon()
+ {
+ echo "$@"\\c
+ }
+else
+ echon()
+ {
+ echo -n "$@"
+ }
+fi
+
+#==============================================================================
+# Evaluate command-line "make"-macro-like var=value expressions.
+#==============================================================================
+echo ''
+echo 'Generating system-dependent flags...'
+
+# Evaluate only variables in this list. Complain about others, but continue.
+valid_v1='|AFLAGS|AS|CC|CC_BZ|CFLAGS|CFLAGS_OPT|CPP|DLLEXT'
+valid_v2='|IZ_BZIP2|IZ_ZLIB|LD|LFLAGS1|LFLAGS2|LIST|LOCAL_UNZIP'
+valid_v3='|NO_AES_WG|NO_ICONV|NO_IZ_BZIP2|NO_LZMA|NO_PPMD'
+valid_v4='|OSDEP_H|OSDEP_OCF|OSDEP_OCS|OSDEP_OCU|OSDEP_OS'
+valid_v5='|PGMEXT|PROD|RANLIB|'
+valid_vars="${valid_v1}${valid_v2}${valid_v3}${valid_v4}${valid_v5}"
+
+argc=$#
+while [ ${argc} -gt 0 ]; do
+ var=` echo "${1}" | sed -e 's/=.*//' `
+ val=` echo "${1}" | sed -e 's/^[^=]*=//' `
+ if echo "${valid_vars}" | grep "|${var}|" >/dev/null 2>&1 ; then
+ eval ${1}
+ else
+ echo " Unrecognized variable name \"${var}\" in \"${1}\"."
+ fi
+ shift
+ argc=` expr ${argc} - 1 `
+done
+
+#==============================================================================
+# Build utility names, command-line option variables, default values.
+#==============================================================================
+CC=${CC:-cc} # C compiler name (core components)
+CC_BZ=${CC_BZ:-${CC}} # C compiler name (BZIP2 components)
+CC_LIST='' # C compiler name, if LIST enabled
+CFLAGS=${CFLAGS:-}' -I.' # C compiler flags (core components)
+CFLAGS_BZ=${CFLAGS_BZ:-}' -I' # C cmplr flags (BZIP2 components)
+CFLAGS_OPT=${CFLAGS_OPT:-} # C cmplr optimze (and list) options
+CFLAGS_USR=${LOCAL_UNZIP:-} # C compiler user override options
+
+CPP=${CPP:-"${CC} -E"} # C preprocessor name
+
+AS=${AS:-"${CC}"} # Assembler name (core components)
+AFLAGS=${AFLAGS:-} # Assembler flags
+
+LD=${LD:-"${CC}"} # Linker name
+LD_LIST='' # Linker name, if LIST enabled
+LFLAGS1=${LFLAGS1:-} # Linker options, part 1
+LFLAGS2=${LFLAGS2:--s} # Linker options, part 2
+
+CC_TST=$CC # C cmplr/options for feature tests
+BIF_TST='' # C builtin fnctn feature test flags
+CFLAGS_TST='' # C cmplr feature test optns (core)
+CFLAGS_TST_BZ='' # C cmplr feature test optns (BZIP2)
+
+CPP_TST=$CPP # C preprocessor for feature tests
+
+AR='ar cq' # Object archive prgrm name/options
+AR_BZ='ar' # (BZIP2)
+RANLIB=${RANLIB:-ranlib} # Object archive index utility
+
+LN='ln -s' # Create symbolic link
+RM='rm -f' # Remove file(s)
+
+# Miscellaneous command macros.
+MKDIR='mkdir' # Create directory
+
+# Build Directories
+PROD=${PROD:-.} # Root
+
+# Build Controls
+PORT=${PORT:-} # UnZip port name
+ # - Configure tests may set if null
+ # - Default is "unix" (set below).
+
+PORT_SPEC='' # Port specification method
+ # - Explicit ('E') via PORT=port
+ # Implicit ('I') via config test
+
+NO_AES_WG=${NO_AES_WG:-} # AES (WinZip/Gladman) encryption
+IZ_BZIP2=${IZ_BZIP2:-} # BZIP2 compression (directory)
+NO_IZ_BZIP2=${NO_IZ_BZIP2:-} # BZIP2 compression (disable)
+NO_ICONV=${NO_ICONV:-} # ISO/OEM (iconv) conversion
+NO_LZMA=${NO_LZMA:-} # LZMA compression
+NO_PPMD=${NO_PPMD:-} # PPMd compression
+IZ_ZLIB=${IZ_ZLIB:-} # ZLIB compression
+
+# Generated Build Dependencies for "make".
+# These contain an object library name, if the feature is enabled.
+LIB_AES_WG='' # AES (WinZip/Gladman) encryption
+LIB_BZ='' # BZIP2 compression
+LIB_LZMA='' # LZMA compression
+LIB_PPMD='' # PPMd compression
+LIB_Z='' # ZLIB compression
+
+# Private object library base names.
+L_AES_WG='iz_aes_wg'
+L_LZMA='iz_lzma'
+L_PPMD='iz_ppmd'
+
+# Build makefiles.
+MK_BZ='Makefile' # BZIP2 compression
+
+# OS-dependent files.
+# Defaults to unix files, customized based on PORT and tests.
+OSDEP_H=${OSDEP_H:-'unix/unxcfg.h'} # C header file names
+OSDEP_OCF=${OSDEP_OC:-} # C object file names, funzip
+OSDEP_OCS=${OSDEP_OC:-"${PROD}/unix.o"} # C object file names, unzipsfx
+OSDEP_OCU=${OSDEP_OC:-"${PROD}/unix.o"} # C object file names, unzip
+OSDEP_OS=${OSDEP_OS:-} # Assembler object file names
+
+# OS-dependent file extensions.
+# Defaults to unix files, customized based on PORT and tests.
+PGMEXT=${PGMEXT:-} # Program file extension
+DLLEXT=${DLLEXT:-'.so'} # DLL (.so) file extension
+
+# System identification (raw).
+UNAME_S='' # System/kernel name
+UNAME_V='' # System/kernel major version
+UNAME_R='' # System/kernel minor version
+UNAME_O='' # Operating system
+UNAME_M='' # Machine hardware name
+UNAME_P='' # Processor name
+UNAME_X='' # Expanded system info (not saved)
+SIZER_V='' # Tru64 system/kernel info
+
+
+#==============================================================================
+# Check for build root directory. Create if required.
+#==============================================================================
+echo "Check build root directory: (${PROD})"
+if [ -d "${PROD}" ]; then
+ echo "-- Build root directory OK."
+elif [ -f "${PROD}" ]; then
+ echo "^^ Directory name exists as an ordinary file. Unable to build."
+ exit 1
+else
+ if unix/unsafe_prod.sh "${PROD}"; then
+ echo "^^ Unsafe absolute (/x) or rising (../) PROD: ${PROD}"
+ exit 13
+ else
+ echo "-- Creating build root directory."
+ ${MKDIR} ${PROD}
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo ''
+ echo "^^ Directory creation failed (${status})."
+ exit $status
+ fi
+ fi
+fi
+
+
+#==============================================================================
+# Assign default PORT. Note if explicit or implicit specification.
+#==============================================================================
+if [ -z "${PORT}" ]; then
+ PORT='unix'
+ PORT_SPEC='I'
+else
+ PORT_SPEC='E'
+fi
+
+
+#==============================================================================
+# Save the source directory. Resolve possible relative paths.
+# Enter the build root directory.
+#==============================================================================
+
+SRCDIR=` pwd `
+
+IZ_BZIP2_A=''
+if [ -z "${IZ_BZIP2}" ]; then
+ IZ_BZIP2='bzip2'
+fi
+tmp=` ( cd "${IZ_BZIP2}" && pwd ) 2> /dev/null `
+if [ -n "$tmp" ]; then
+ IZ_BZIP2_A="$tmp"
+fi
+
+IZ_ZLIB_A=''
+if [ -n "${IZ_ZLIB}" ]; then
+ tmp=` ( cd "${IZ_ZLIB}" && pwd ) 2> /dev/null `
+ if [ -n "$tmp" ]; then
+ IZ_ZLIB_A="$tmp"
+ fi
+fi
+
+cd ${PROD}
+
+#==============================================================================
+# Query the system information.
+#==============================================================================
+echon "Query for system identification..."
+UNAME_S=` uname -s 2>/dev/null `
+case "${UNAME_S}" in
+ 'OS/390' )
+ # z/OS kernel still announces itself as OS/390 (for compatibility)
+ # - Must request for current product info via -I
+ UNAME_S=` uname -Is 2>/dev/null `
+ UNAME_V=` uname -Iv 2>/dev/null `
+ UNAME_R=` uname -Ir 2>/dev/null `
+ UNAME_M=` uname -Im 2>/dev/null `
+ ;;
+
+ * )
+ # All others use standard uname query
+ UNAME_V=` uname -v 2>/dev/null `
+ UNAME_R=` uname -r 2>/dev/null `
+ UNAME_O=` uname -o 2>/dev/null `
+ UNAME_M=` uname -m 2>/dev/null `
+ UNAME_P=` uname -p 2>/dev/null `
+ UNAME_X=` uname -X 2>/dev/null `
+
+ # Use sizer to capture more system configuration details
+ # - Tru64 UNIX, and relatives
+ if [ -f /usr/sbin/sizer ]; then
+ SIZER_V=` /usr/sbin/sizer -v 2>/dev/null | \
+ sed -e 's/^[^ ]* [^ ]* [^ ]* \([^ ]*\) .*/\1/' `
+ fi
+ ;;
+esac
+
+echo " OS name: ${UNAME_S}"
-CFLAGS_OPT=''
-CFLAGS_BZ=''
-BZLF=''
-echo "Check C compiler operation"
+#==============================================================================
+# Validate basic compiler and linker operation.
+#==============================================================================
+echon "Check C compiler+linker operation..."
cat > conftest.c << _EOF_
+#include <stdio.h>
int main()
{
+ printf( " Ok.\n");
return 0;
}
_EOF_
-$CC $CFLAGS -c conftest.c
+$CC $CFLAGS -o conftest conftest.c
status=$?
-if test $status -ne 0; then
+if [ $status -ne 0 ]; then
echo ''
- echo "C compiler \"${CC}\" does not work as expected."
- echo "Failing command was: $CC $CFLAGS -c conftest.c"
+ echo "^^ C compiler+linker \"${CC}\" does not work as expected."
+ echo "^^ Failing command was: $CC $CFLAGS -o conftest conftest.c"
exit $status
else
- echo ' Ok'
+ ./conftest
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo ' No.'
+ echo "^^ Test executable exited with bad status: ${status}."
+ exit $status
+ else
+ : # Program echoes " Ok."
+ fi
fi
-echo 'Check C compiler type (optimization options)'
-# Sun C?
-cat > conftest.c << _EOF_
+
+#==============================================================================
+# Perform compile- and link-based configuration discovery tests.
+#==============================================================================
+
+#------------------------------------------------------------------------------
+# A) Determine C compiler type, set appropriate compile and linker options.
+#------------------------------------------------------------------------------
+
+# Each compiler is recognized using standard pre-defined preprocessor symbols.
+#
+# The options set in for each compiler includes the basic options required for
+# successful compilation of UnZip, as well as the options for standard code
+# optimization.
+
+echon 'Check C compiler type (opt and list options)...'
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Sun C?
+ cat > conftest.c << _EOF_
int main()
{
#ifndef __SUNPRO_C
return 0;
}
_EOF_
-$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
-if test $? -eq 0; then
- CFLAGS_OPT='-xO3'
- echo " Sun C ($CFLAGS_OPT)"
-else
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-xO3'
+ echo " Sun C ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
# Tru64 DEC/Compaq/HP C?
cat > conftest.c << _EOF_
int main()
return 0;
}
_EOF_
- $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
- if test $? -eq 0; then
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
CFLAGS_OPT='-O3'
echo " DEC C ($CFLAGS_OPT)"
- else
- # HP-UX HP C?
- cat > conftest.c << _EOF_
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # HP-UX HP C?
+ cat > conftest.c << _EOF_
int main()
{
#ifdef __GNUC__
return 0;
}
_EOF_
- $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
- if test $? -eq 0; then
- # HP-UX, not GCC. Lame bundled or real ANSI compiler?
- CFLAGS_OPT_TRY="+O3 +Onolimit"
- $CC $CFLAGS $CFLAGS_OPT_TRY -c conftest.c 2>&1 | \
- grep '(Bundled)' > /dev/null
- if test $? -ne 0; then
- CFLAGS_OPT="$CFLAGS_OPT_TRY"
- echo " HP-UX ANSI C ($CFLAGS_OPT)"
- else
- echo ' HP-UX Bundled C (no opt)'
- fi
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # HP-UX, not GCC. Lame bundled or real ANSI compiler?
+ CFLAGS_OPT_TRY="+O3 +Onolimit"
+ $CC $CFLAGS $CFLAGS_OPT_TRY -c conftest.c 2>&1 | \
+ grep '(Bundled)' >/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ CFLAGS_OPT="${CFLAGS_OPT_TRY}"
+ echo " HP-UX ANSI C ($CFLAGS_OPT)"
else
- # GNU C?
+ CFLAGS_OPT=' ' #Blank = Lame bundled compiler recognized.
+ echo ' HP-UX Bundled C (no opt)'
+ fi
+# Note: Your HP-UX system may require addition of -DNO_MKSTEMP
+# - In HP-UX versions below 11.31, writes to the temporary
+# file may fail. Refer to INSTALL for details.
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # MinGW 64-bit C?
+ # MinGW also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __MINGW64__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ PORT='mingw64'
+ echo " MinGW 64 ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # MinGW 32-bit C?
+ # MinGW also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __MINGW32__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ PORT='mingw32'
+ echo " MinGW 32 ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # LLVM-based C?
+ # LLVM also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __llvm__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # LLVM-based C. Determine specific compiler.
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # LLVM Clang?
cat > conftest.c << _EOF_
int main()
{
-#ifndef __GNUC__
+#ifndef __clang__
bad code
#endif
return 0;
}
_EOF_
- $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
- if test $? -eq 0; then
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
CFLAGS_OPT='-O3'
- echo " GNU C ($CFLAGS_OPT)"
- # Special Mac OS X shared library "ld" option?
- if test ` uname -s 2> /dev/null ` = 'Darwin'; then
- lf='-Wl,-search_paths_first'
- $CC $CFLAGS $lf conftest.c > /dev/null 2>/dev/null
- if test $? -eq 0; then
- BZLF=${lf}
- fi
- rm -f conftest
- fi
- else
- CFLAGS_OPT='-O'
- echo " Other-unknown C ($CFLAGS_OPT)"
+ echo " LLVM Clang ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # LLVM Apple GCC?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __APPLE_CC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " LLVM Apple GCC ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # Default to LLVM GCC.
+ CFLAGS_OPT='-O3'
+ echo " LLVM GCC ($CFLAGS_OPT)"
+ fi
+
+ # Special Mac OS X shared library "ld" option?
+ if [ "${UNAME_S}" = 'Darwin' ]; then
+ OSDEP_H="${OSDEP_H} unix/macosx.h"
+
+ # "ld64: warning: option -s is obsolete and being ignored"
+ if [ "${LFLAGS2}" = '-s' ]; then
+ LFLAGS2=''
+ fi
+
+ lflags2_try='-Wl,-search_paths_first'
+ $CC $CFLAGS ${lflags2_try} conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LFLAGS2="${LFLAGS2} ${lflags2_try}"
fi
+ rm -f conftest
fi
fi
fi
-# optimization flags
-if test -n "${CFLAGS_OPT}"; then
- CFLAGSR="${CFLAGSR} ${CFLAGS_OPT}"
- CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Portable C Compiler (PCC)?
+ # PCC also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __PCC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O'
+ echo " Portable C Compiler (PCC) ($CFLAGS_OPT)"
+ fi
fi
-echo Check for the C preprocessor
-# on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
-CPP="${CC} -E"
-# solaris as(1) needs -P, maybe others as well ?
-[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
-[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
-[ -f /lib/cpp ] && CPP=/lib/cpp
-[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
-[ -f /xenix ] && CPP="${CC} -E"
-[ -f /lynx.os ] && CPP="${CC} -E"
-
-echo "#include <stdio.h>" > conftest.c
-$CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
-
-echo Check if we can use asm code
-CRC32OA=""
-if eval "$CPP crc_i386.S > _crc_i386.s 2>/dev/null"; then
- if test ! -s _crc_i386.s || grep error < _crc_i386.s > /dev/null; then
- :
- elif eval "$CC -c _crc_i386.s >/dev/null 2>/dev/null" && [ -f _crc_i386.o ]; then
- CFLAGSR="${CFLAGSR} -DASM_CRC"
- CRC32OA="crc_gcc.o"
- echo "int foo() { return 0;}" > conftest.c
- $CC -c conftest.c >/dev/null 2>/dev/null
- echo Check if compiler generates underlines
- nm conftest.o | grep "(^|[^_])foo" >/dev/null 2>/dev/null
- [ $? -eq 0 ] && CPP="${CPP} -DNO_UNDERLINE"
- fi
-fi
-rm -f _crc_i386.s _crc_i386.o
-
-# ANSI options for compilers that don't have __STDC__ defined by default
-# Currently HPUX, pyramid, Dynix, AIX, OSF/1 and ultrix
-
-echo Check for ANSI options
-cat > conftest.c << _EOF_
+if [ -z "${CFLAGS_OPT}" ]; then
+ # EKOPath C?
+ # EKOPath also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
int main()
{
-#ifndef __STDC__
- forget it
+#ifndef __PATHCC__
+ bad code
#endif
return 0;
}
_EOF_
-$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
- for OPT in "-Aa -D_HPUX_SOURCE" -Xa -qlanglvl=ansi -std1 -std
- do
- $CC $CFLAGS $OPT -c conftest.c > /dev/null 2>/dev/null
- [ $? -eq 0 ] && CFLAGSR="${CFLAGSR} ${OPT}" && break
- done
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " EKOPAth C ($CFLAGS_OPT)"
+ fi
fi
-echo Check for prototypes
-echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c
-$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_PROTO"
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Intel C?
+ # Intel also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __INTEL_COMPILER
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " Intel C ($CFLAGS_OPT)"
+ fi
+fi
-# const check currently handles mips cc and non ANSI compilers.
-# does it need more ?
-echo Check the handling of const
-cat > conftest.c << _EOF_
-typedef int charset[2];
+if [ -z "${CFLAGS_OPT}" ]; then
+ # GNU C?
+ cat > conftest.c << _EOF_
int main()
{
- const charset x;
- const char *foo;
- return 0;
+#ifndef __GNUC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # GNU C. Check for special-case platforms.
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # GNU C for MAC OS X (Darwin)?
+ cat > conftest.c << _EOF_
+int main()
+{
+#if !(defined(__APPLE__) || defined(__darwin__))
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ OSDEP_H="${OSDEP_H} unix/macosx.h"
+
+ # "ld64: warning: option -s is obsolete and being ignored"
+ if [ "${LFLAGS2}" = '-s' ]; then
+ LFLAGS2=''
+ fi
+
+ # Special Mac OS X shared library "ld" option?
+ lflags2_try='-Wl,-search_paths_first'
+ $CC $CFLAGS ${lflags2_try} conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LFLAGS2="${LFLAGS2} ${lflags2_try}"
+ fi
+ rm -f conftest
+
+ echo " GNU C for Mac OS X Darwin ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # GNU C for AIX?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef _AIX
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC_TST="${CC_TST} -D_ALL_SOURCE"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_OPT='-O3'
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ echo " GNU C for AIX ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # Other GNU C
+ CFLAGS_OPT='-O3'
+ echo " GNU C ($CFLAGS_OPT)"
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __IBMC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # IBM C. Determine platform.
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM XL C for Linux?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __TOS_LINUX__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ C_PARMS="-q64 -qlonglong -qlibansi -qnoignerrno"
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC='c89'
+ LD='c89'
+ CC_TST="c89 ${C_PARMS} -D_ALL_SOURCE"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_OPT="-O3 ${C_PARMS}"
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_TST="${CFLAGS_TST} -DICONV=1"
+ LFLAGS2="${LFLAGS2} -q64"
+ AR='ar -X64 -cq'
+ AR_BZ='ar -X64'
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CFLAGS_OPT="${CFLAGS_OPT} -qlist -qsource -qshowinc -qreport"
+ fi
+ echo " IBM XL C for Linux ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM XL C for AIX?
+ cat > conftest.c << _EOF_
+int main()
+{
+#if !(defined(_AIX) && defined(__PPC__))
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ C_PARMS="-q64 -qlonglong -qlibansi -qnoignerrno"
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC='c89'
+ LD='c89'
+ CC_TST="c89 ${C_PARMS} -D_ALL_SOURCE"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_OPT="-O3 ${C_PARMS}"
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_TST="${CFLAGS_TST} -DICONV=1"
+ LFLAGS2="${LFLAGS2} -q64"
+ AR='ar -X64 -cq'
+ AR_BZ='ar -X64'
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CFLAGS_OPT="${CFLAGS_OPT} -qlist -qsource -qshowinc -qreport"
+ fi
+ echo " IBM XL C for AIX ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM z/OS XL C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __MVS__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ C_PARMS="-Wc,longlong,libansi,noignerrno"
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # Use c89 to get ANSI
+ # - Avoid xlc (terminates with sigkill on compile error)
+ CC='c89'
+ LD='c89'
+ CC_TST="c89 ${C_PARMS}"
+ CFLAGS_OPT="-O3 ${C_PARMS} -Wc,'langlvl(extended)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,checkout,'flag(i)',inline"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3389,ccn3374,ccn3413)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3495,ccn3409,ccn3469)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3457)'"
+ LFLAGS1='-Wl,EDIT=NO'
+ LFLAGS2=''
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CC_LIST="sh ./zos/zcc c89" # Script does listing capture
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,list,source,showinc,inlrpt"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,aggr,expmac"
+ LD_LIST="sh ./zos/zld c89" # Script does listing capture
+ LFLAGS1="${LFLAGS1} -Wl,map,xref"
+ fi
+ #FIX_ME[AD]: Switch to 64-bit after 32-bit is fully debugged
+ #if echo "${LOCAL_UNZIP}" | grep -i ILP32 >/dev/null 2>&1 ; then
+ # :
+ #else # Default to 64-bit build
+ # CC_TST="${CC_TST} -Wc,lp64 -Wl,lp64"
+ # CFLAGS_OPT="${CFLAGS_OPT} -Wc,lp64"
+ # LFLAGS1="${LFLAGS1} -Wl,lp64"
+ #fi
+ CC_TST="${CC_TST} -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE_EXTENDED=1"
+ if [ "${PORT}" = 'unix' ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DZOS_UNIX"
+ fi
+ # Oldest supported z/OS release
+ CFLAGS_TST="${CFLAGS_TST} -Wc,'target(zOSV1R10)'"
+ CFLAGS_TST="${CFLAGS_TST} -DEBCDIC -DSYSV"
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_TST="${CFLAGS_TST} -DICONV=1"
+ RANLIB="echo" # z/OS UNIX has no ranlib utility
+ echo " IBM z/OS XL C ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM XL C for z/VM?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __VM__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ C_PARMS="-Wc,longlong,libansi,noignerrno"
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC='c89'
+ LD='c89'
+ CC_TST="c89 ${C_PARMS}"
+ CFLAGS_OPT="-O3 ${C_PARMS} -Wc,'langlvl(extended)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,checkout,'flag(i)',inline"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3389,ccn3374,ccn3413)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3495,ccn3409,ccn3469)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3457)'"
+ LFLAGS1='-Wl,EDIT=NO'
+ LFLAGS2=''
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CC_LIST="sh ./zos/zcc c89" # Script does listing capture
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,list,source,showinc,inlrpt"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,aggr,expmac"
+ LD_LIST="sh ./zos/zld c89" # Script does listing capture
+ LFLAGS1="${LFLAGS1} -Wl,map,xref"
+ fi
+ CC_TST="${CC_TST} -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE_EXTENDED=1"
+ if [ "${PORT}" = 'unix' ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DZOS_UNIX"
+ fi
+ CFLAGS_TST="${CFLAGS_TST} -DEBCDIC -DSYSV"
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_TST="${CFLAGS_TST} -DICONV=1"
+ RANLIB="echo" # z/VM UNIX has no ranlib utility
+ echo " IBM XL C for z/VM ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM ILE C for iSeries?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __OS400__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC='c89'
+ LD='c89'
+ CC_TST='c89'
+ CFLAGS_OPT='-O3 -Wc,inline'
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CFLAGS_OPT="${CFLAGS_OPT} -qlist -qsource -qshowinc -qreport"
+ fi
+ echo " IBM ILE C for iSeries ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM XL C for other platform.
+ CFLAGS_OPT='-O3'
+ echo " IBM XL C ($CFLAGS_OPT)"
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # DJGPP C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __DJGPP__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " DJGPP C ($CFLAGS_OPT)"
+ # Set port values, if defaulted.
+ if [ -z "${PORT}" ]; then
+ PORT='msdos'
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Cygnus C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __CYGWIN__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " Cygwin C ($CFLAGS_OPT)"
+ # Set port values, if defaulted.
+ if [ -z "${PORT}" ]; then
+ PORT='msdos'
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ CFLAGS_OPT='-O'
+ echo " Other-unknown C ($CFLAGS_OPT)"
+fi
+
+if [ "${CC}" != "${CC_TST}" ]; then
+ echo " Feature test compiler updated (${CC_TST})"
+fi
+
+#------------------------------------------------------------------------------
+# B) Finalize specific customizations for target port.
+#------------------------------------------------------------------------------
+if [ "${PORT}" = "unix" ]; then
+ echo "Standard Unix target."
+ CFLAGS="${CFLAGS} -DUNIX"
+ CFLAGS_BZ="${CFLAGS_BZ} -DUNIX"
+else
+ echo "Set build configuration for target \"${PORT}\" port."
+ case "${PORT}" in
+ unix )
+ # UNIX values set in defaults, customized based on tests.
+ ;;
+
+ mingw* )
+ CFLAGS="${CFLAGS} -DWIN32"
+ CFLAGS_BZ="${CFLAGS_BZ} -D_WIN32"
+ OSDEP_H='win32/nt.h win32/rsxntwin.h win32/w32cfg.h'
+ OSDEP_OCF="${PROD}/win32.o ${PROD}/win32i64.o"
+ OSDEP_OCS="${PROD}/nt.o ${PROD}/win32.o ${PROD}/win32i64.o"
+ OSDEP_OCU="${PROD}/nt.o ${PROD}/win32.o ${PROD}/win32i64.o"
+ OSDEP_OS=''
+ PGMEXT='.exe'
+ DLLEXT='.dll'
+ ;;
+
+ msdos )
+ CFLAGS="${CFLAGS} -DMSDOS"
+ CFLAGS_BZ="${CFLAGS_BZ} -DMSDOS"
+ OSDEP_H='msdos/doscfg.h'
+ OSDEP_OCF="${PROD}/msdos.o"
+ OSDEP_OCS="${PROD}/msdos.o"
+ OSDEP_OCU="${PROD}/msdos.o"
+ OSDEP_OS=''
+ PGMEXT='.EXE'
+ DLLEXT='.DLL'
+ ;;
+
+ os2 )
+ CFLAGS="${CFLAGS} -DOS2"
+ CFLAGS_BZ="${CFLAGS_BZ} -DOS2"
+ OSDEP_H='os2/os2acl.h os2/os2cfg.h os2/os2data.h'
+ OSDEP_OCF="${PROD}/os2.o"
+ OSDEP_OCS="${PROD}/os2.o"
+ OSDEP_OCU="${PROD}/os2.o"
+ OSDEP_OS=''
+ PGMEXT='.EXE'
+ DLLEXT='.DLL'
+ ;;
+
+ qdos )
+ CFLAGS="${CFLAGS} -DQDOS"
+ CFLAGS_BZ="${CFLAGS_BZ} -DQDOS"
+ OSDEP_H='qdos/izqdos.h'
+ OSDEP_OCF="${PROD}/qdos.o ${PROD}/qfileio.o"
+ OSDEP_OCS="${PROD}/qdos.o ${PROD}/qfileio.o"
+ OSDEP_OCU="${PROD}/qdos.o ${PROD}/qfileio.o"
+ OSDEP_OS=''
+ PGMEXT=''
+ DLLEXT=''
+ ;;
+
+ zos )
+ CFLAGS="${CFLAGS} -DMVS"
+ CFLAGS_BZ="${CFLAGS_BZ} -DMVS"
+ OSDEP_H='zos/vmmvs.h'
+ OSDEP_OCF="${PROD}/vmmvs.o"
+ OSDEP_OCS="${PROD}/vmmvs.o"
+ OSDEP_OCU="${PROD}/vmmvs.o"
+ OSDEP_OS=''
+ PGMEXT=''
+ DLLEXT=''
+ ;;
+
+ zvm )
+ CFLAGS="${CFLAGS} -DVM_CMS"
+ CFLAGS_BZ="${CFLAGS_BZ} -DVM_CMS"
+ OSDEP_H='zvm/cstat.h zos/vmmvs.h'
+ OSDEP_OCF="${PROD}/vmmvs.o"
+ OSDEP_OCS="${PROD}/vmmvs.o"
+ OSDEP_OCU="${PROD}/vmmvs.o"
+ OSDEP_OS=''
+ PGMEXT=''
+ DLLEXT=''
+ ;;
+
+ * )
+ echo "^^ UnZip port not recognized. Unable to build."
+ exit 1
+ ;;
+ esac
+fi
+
+#------------------------------------------------------------------------------
+# C) Determine C preprocessor type.
+#------------------------------------------------------------------------------
+echo 'Check C preprocessor type...'
+case "${UNAME_S}" in
+ 'z/OS'|'z/VM')
+ # z/OS UNIX, z/VM UNIX requires wrapper script for CPP tests.
+ # "cc -E" returns 0 even when warning/error detected.
+ CPP="${CC} -E"
+
+ CPP_TST="sh ./zos/zcpp ${CPP}" # Wrapper script checks stderr.
+ ;;
+
+ * )
+ # Other UNIX systems.
+ # On SVR4, cc -E does not produce correct assembler files. Use /lib/cpp.
+ # Solaris as(1) needs -P, maybe others as well ?
+ CPP="${CC} -E"
+ [ -f /usr/ccs/lib/cpp ] && CPP='/usr/ccs/lib/cpp -P'
+ [ -f /usr/lib/cpp ] && CPP='/usr/lib/cpp'
+ [ -f /lib/cpp ] && CPP='/lib/cpp'
+ [ -f /usr/bin/cpp ] && CPP='/usr/bin/cpp'
+ [ -f /xenix ] && CPP="${CC} -E"
+ [ -f /lynx.os ] && CPP="${CC} -E"
+
+ # Verify operation with tentative CPP.
+ echo "#include <stdio.h>" >conftest.c
+ $CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
+
+ CPP_TST="${CPP}"
+ ;;
+esac
+
+#------------------------------------------------------------------------------
+# D) Determine if assembler CRC routines can be used.
+#------------------------------------------------------------------------------
+case "${UNAME_S}" in
+ 'z/OS'|'z/VM')
+ # z/OS UNIX, z/VM UNIX can not run i386 code.
+ # Host assembler uses unique internal macro phase, not CPP.
+ ;;
+
+ * )
+ # Other UNIX systems.
+ # FIX_ME: Need to customize for ports.
+ echon 'Check if we can (and want to) use assembly code for CRC...'
+ asm_crc=0
+ # CRC. Fail intentionally, if NO_ASM or NO_ASM_CRC is defined.
+ cat > conftest.S << _EOF_
+#if defined( NO_ASM) || defined( NO_ASM_CRC)
+ bad code
+#else
+# include "crc_i386.S"
+#endif
+_EOF_
+ ${CPP_TST} -I${SRCDIR} ${CFLAGS} conftest.S > _crc_i386.s 2> /dev/null
+ status=$?
+ if [ $status -eq 0 -a -s _crc_i386.s ]; then
+ grep error _crc_i386.s > /dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ $AS -c _crc_i386.s > /dev/null 2> /dev/null
+ status=$?
+ if [ $status -eq 0 -a -f _crc_i386.o ]; then
+ echo ' Yes.'
+ asm_crc=1
+ CFLAGS_TST="${CFLAGS_TST} -DASM_CRC"
+ OSDEP_OS="${OSDEP_OS} ${PROD}/crc_gcc.o"
+ fi
+ fi
+ fi
+ if [ $asm_crc -eq 0 ]; then
+ echo ' No.'
+ fi
+
+ # If using assembler for anything, then check the C compiler for a
+ # "_" prefix on global names.
+ if [ $asm_crc -ne 0 ]; then
+ echon 'Check if C compiler adds "_" prefix to global names...'
+ echo "int foo() { return 0;}" > conftest.c
+ $CC -c conftest.c >/dev/null 2>/dev/null
+ nm conftest.o | grep foo >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # Found "foo". Look for "_foo".
+ nm conftest.o | grep _foo >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo ' No (NO_UNDERLINE).'
+ AFLAGS="${AFLAGS} -DNO_UNDERLINE"
+ else
+ echo ' Yes.'
+ fi
+ fi
+ fi
+ rm -f conftest.c conftest.S _crc_i386.s _crc_i386.o
+ ;;
+esac
+
+#------------------------------------------------------------------------------
+# E) Configure optional AES (WinZip/Gladman) encryption library.
+#------------------------------------------------------------------------------
+# AES (WinZip/Gladman) encryption. (User may disable: NO_AES_WG=1.)
+if [ -n "${NO_AES_WG}" ]; then
+ echo "AES WG encryption disabled."
+else
+ echon "Check AES_WG (AES WinZip/Gladman) encryption support..."
+ if [ -d "${SRCDIR}/aes_wg" ]; then
+ echo ''
+ echon " Check for AES_WG header file in aes_wg/ directory..."
+ if [ -f "${SRCDIR}/aes_wg/aes.h" ]; then
+ cat > conftest.c << _EOF_
+int main()
+{
+#include "aes_wg/aes.h"
+#ifndef CRYPT_AES_WG
+ forget it
+#endif
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -I${SRCDIR} -DCRYPT_AES_WG -c conftest.c \
+ >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LIB_AES_WG="${PROD}/lib${L_AES_WG}.a"
+ CFLAGS_TST="${CFLAGS_TST} -DCRYPT_AES_WG"
+ echo ' Yes.'
+ echo "-- Including AES_WG encryption support."
+ echo "-- Building ${PROD}/lib${L_AES_WG}.a."
+ else
+ echo ' No.'
+ echo "^^ AES_WG test build failed. Check aes_wg/ directory."
+ echo "^^ Unable to include AES_WG encryption support."
+ fi
+ else
+ echo ' No.'
+ echo "^^ AES_WG source code not found in aes_wg/ directory."
+ echo "^^ Unable to include AES_WG encryption support."
+ fi
+ else
+ echo ' No.'
+ echo "^^ Directory aes_wg not found."
+ echo "^^ Unable to include AES_WG encryption support."
+ fi
+fi
+
+#------------------------------------------------------------------------------
+# F) Configure optional LZMA compression library.
+#------------------------------------------------------------------------------
+# LZMA compression. (User may disable: NO_LZMA=1.)
+if [ -n "${NO_LZMA}" ]; then
+ echo "LZMA compression disabled."
+else
+ echon "Check LZMA compression support..."
+ if [ -d "${SRCDIR}/szip" ]; then
+ echo ''
+ echon " Check for LZMA header file in szip/ directory..."
+ if [ -f "${SRCDIR}/szip/LzmaDec.h" ]; then
+ cat > conftest.c << _EOF_
+#include "szip/LzmaDec.h"
+int main()
+{
+ typedef int zoff_t;
+#ifndef LZMA_SUPPORT
+ forget it
+#endif
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -I${SRCDIR} -DLZMA_SUPPORT -c conftest.c \
+ >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LIB_LZMA="${PROD}/lib${L_LZMA}.a"
+ CFLAGS_TST="${CFLAGS_TST} -DLZMA_SUPPORT"
+ echo ' Yes.'
+ echo "-- Including LZMA compression support."
+ echo "-- Building ${PROD}/lib${L_LZMA}.a."
+ else
+ echo ' No.'
+ echo "^^ LZMA test build failed. Check szip/ directory."
+ echo "^^ Unable to include LZMA compression support."
+ fi
+ else
+ echo ' No.'
+ echo "^^ LZMA source code not found in szip/ directory."
+ echo "^^ Unable to include LZMA compression support."
+ fi
+ else
+ echo ' No.'
+ echo "^^ Directory szip/ not found."
+ echo "^^ Unable to include LZMA compression support."
+ fi
+fi
+
+#------------------------------------------------------------------------------
+# F'') Configure optional PPMd compression library.
+#------------------------------------------------------------------------------
+# PPMd compression. (User may disable: NO_PPMD=1.)
+if [ -n "${NO_PPMD}" ]; then
+ echo "PPMd compression disabled."
+else
+ echon "Check PPMd compression support..."
+ if [ -d "${SRCDIR}/szip" ]; then
+ echo ''
+ echon " Check for PPMd header file in szip/ directory..."
+ if [ -f "${SRCDIR}/szip/Ppmd.h" ]; then
+ cat > conftest.c << _EOF_
+#include "szip/Ppmd.h"
+int main()
+{
+ typedef int zoff_t;
+#ifndef PPMD_SUPPORT
+ forget it
+#endif
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -I${SRCDIR} -DPPMD_SUPPORT -c conftest.c \
+ >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LIB_PPMD="${PROD}/lib${L_PPMD}.a"
+ CFLAGS_TST="${CFLAGS_TST} -DPPMD_SUPPORT"
+ echo ' Yes.'
+ echo "-- Including PPMd compression support."
+ echo "-- Building ${PROD}/lib${L_PPMD}.a."
+ else
+ echo ' No.'
+ echo "^^ PPMd test build failed. Check szip/ directory."
+ echo "^^ Unable to include PPMd compression support."
+ fi
+ else
+ echo ' No.'
+ echo "^^ PPMd source code not found in szip/ directory."
+ echo "^^ Unable to include PPMd compression support."
+ fi
+ else
+ echo ' No.'
+ echo "^^ Directory szip/ not found."
+ echo "^^ Unable to include PPMd compression support."
+ fi
+fi
+
+#------------------------------------------------------------------------------
+# G) Configure optional BZIP2 compression library.
+#------------------------------------------------------------------------------
+# BZIP2 compression.
+# (User may disable or direct: "NO_IZ_BZIP2=1", "IZ_BZIP2=bzip2_dir".)
+if [ -n "${NO_IZ_BZIP2}" ]; then
+ echo "BZIP2 compression disabled."
+else
+ echon "Check BZIP2 compression support..."
+ if [ -d "${IZ_BZIP2_A}" ]; then
+ echo ''
+ echon " Check for BZIP2 header file in IZ_BZIP2 (${IZ_BZIP2})..."
+ if [ -f "${IZ_BZIP2_A}/bzlib.h" ]; then
+ if [ "${IZ_BZIP2}" = "bzip2" ]; then
+ echo ''
+ echo " BZIP2 files found within UnZip tree."
+ echon " Check for BZIP2 compiled library in IZ_BZIP2 (${IZ_BZIP2})..."
+ if [ -f "${IZ_BZIP2_A}/libbz2.a" ]; then
+#
+# A bzip2 library built with BZ_NO_STDIO should have an
+# unresolved external, "bz_internal_error". The default,
+# full-function library will not mention it.
+#
+ nm ${IZ_BZIP2_A}/libbz2.a | grep bz_internal_error >/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo ' Yes.'
+ echo "-- Found BZIP2 BZ_NO_STDIO library: ${IZ_BZIP2}/libbz2.a"
+ LIB_BZ="${IZ_BZIP2}/libbz2.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
+ LFLAGS1="${LFLAGS1} -L${IZ_BZIP2}"
+ LFLAGS2="${LFLAGS2} -lbz2"
+ echo "-- Including BZIP2 compression support."
+ echo "-- Using libbz2.a in IZ_BZIP2 (${IZ_BZIP2})."
+ else
+ echo ' No.'
+ echo " -----------------------------------------------------"
+ echo " Found BZIP2 library, ${IZ_BZIP2}/libbz2.a, but the"
+ echo " library was not compiled with BZ_NO_STDIO."
+ echo " ERROR: This (default) variant of bzip2 library is NOT"
+ echo " supported with UnZip because of its incompatible"
+ echo " error handling."
+ echo " Please see the UnZip installation instructions in"
+ echo " the INSTALL text file."
+ echo " -----------------------------------------------------"
+ echo " ^^ Incompatible BZIP2 library within the UnZip tree."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ else
+ echo ''
+ echon " Check for BZIP2 Makefile in IZ_BZIP2 (${IZ_BZIP2})..."
+ if [ -f "${IZ_BZIP2_A}/Makefile" ]; then
+ LIB_BZ="${IZ_BZIP2}/libbz2.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
+ LFLAGS1="${LFLAGS1} -L${IZ_BZIP2}"
+ LFLAGS2="${LFLAGS2} -lbz2"
+ echo ' Yes.'
+ echo "-- Including BZIP2 compression support."
+ echo "-- Building libbz2.a in ${IZ_BZIP2}."
+ else
+ echo ' No.'
+ echo " ^^ Incomplete BZIP2 support within the UnZip tree."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ fi
+ else
+ echo ''
+ echo "-- BZIP2 support is outside the UnZip tree."
+ echon " Check for BZIP2 compiled library in IZ_BZIP2 (${IZ_BZIP2})..."
+ if [ -f "${IZ_BZIP2_A}/libbz2.a" ]; then
+#
+# A bzip2 library built with BZ_NO_STDIO should have an
+# unresolved external, "bz_internal_error". The default,
+# full-function library will not mention it.
+#
+ nm ${IZ_BZIP2_A}/libbz2.a | grep bz_internal_error >/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo ' Yes.'
+ echo "-- Found BZIP2 BZ_NO_STDIO library: ${IZ_BZIP2}/libbz2.a"
+ LIB_BZ="${IZ_BZIP2}/libbz2.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
+ LFLAGS1="${LFLAGS1} -L${IZ_BZIP2}"
+ LFLAGS2="${LFLAGS2} -lbz2"
+ echo "-- Including BZIP2 compression support."
+ echo "-- Using libbz2.a in IZ_BZIP2 (${IZ_BZIP2})."
+ else
+ echo ' No.'
+ echo " -----------------------------------------------------"
+ echo " Found BZIP2 library, ${IZ_BZIP2}/libbz2.a, but the"
+ echo " library was not compiled with BZ_NO_STDIO."
+ echo " ERROR: This (default) variant of bzip2 library is NOT"
+ echo " supported with UnZip because of its incompatible"
+ echo " error handling."
+ echo " Please see the UnZip installation instructions in"
+ echo " the INSTALL text file."
+ echo " -----------------------------------------------------"
+ echo " ^^ Incompatible BZIP2 library outside the UnZip tree."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ else
+ echo ' No.'
+ echo " ^^ ${IZ_BZIP2}/libbz2.a not found (IZ_BZIP2 != \"bzip2\")."
+ echo " ^^ Incomplete BZIP2 support outside the UnZip tree."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ fi
+ else
+ echo ''
+ echo " -- ${IZ_BZIP2}/bzlib.h not found."
+ echon " Check if OS already has BZIP2 library available..."
+ cat > conftest.c << _EOF_
+#include "bzlib.h"
+int main()
+{
+ bz_stream strm;
+ BZ2_bzCompressEnd(&strm);
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -I${SRCDIR} -o conftest conftest.c -lbz2 \
+ >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo ' Yes.'
+ echo " -- OS supports BZIP2 - linking in bzip2."
+ CFLAGS_TST="${CFLAGS_TST} -DBZIP2_SUPPORT"
+ LFLAGS2="${LFLAGS2} -lbz2"
+ echo "-- Including OS BZIP2 compression support."
+ else
+ echo ' No.'
+ echo " ^^ Neither bzlib.h nor libbz2.a was found."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ fi
+ else
+ echo ' No.'
+ echo "^^ Directory ${IZ_BZIP2} not found."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+fi
+
+#------------------------------------------------------------------------------
+# H) Configure optional ZLIB compression library.
+#------------------------------------------------------------------------------
+# ZLIB compression. (User must request: "IZ_ZLIB=zlib_dir".)
+if [ -n "${IZ_ZLIB}" ]; then
+ echon "Check ZLIB deflate compression support..."
+ if [ -d "${IZ_ZLIB_A}" ]; then
+ echo ''
+ echo " Check for ZLIB header file in IZ_ZLIB (${IZ_ZLIB})."
+ if [ -f "${IZ_ZLIB_A}/zlib.h" ]; then
+ if [ "${IZ_ZLIB}" = "zlib" ]; then
+ echo ''
+ echo " ZLIB found within the UnZip tree."
+ echon " Check for zlib compiled library in IZ_ZLIB (${IZ_ZLIB})..."
+ if [ -f "${IZ_ZLIB_A}/libz.a" ]; then
+ LIB_Z="${IZ_ZLIB}/libz.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_ZLIB} -DUSE_ZLIB"
+ LFLAGS1="${LFLAGS1} -L${IZ_ZLIB}"
+ LFLAGS2="${LFLAGS2} -lz"
+ echo ' Yes.'
+ echo "-- Including ZLIB deflate compression support."
+ echo "-- Using libz.a in IZ_ZLIB (${IZ_ZLIB})."
+ else
+ echo ''
+ echon " Check for ZLIB Makefile in IZ_ZLIB (${IZ_ZLIB})..."
+ if [ -f "${IZ_ZLIB_A}/Makefile" ]; then
+ LIB_Z="${IZ_ZLIB}/libz.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_ZLIB} -DUSE_ZLIB"
+ LFLAGS1="${LFLAGS1} -L${IZ_ZLIB}"
+ LFLAGS2="${LFLAGS2} -lz"
+ echo ' Yes.'
+ echo "-- Including ZLIB deflate compression support."
+ echo "-- Building libz.a in ${IZ_ZLIB}."
+ else
+ echo ' No.'
+ echo " ^^ Incomplete ZLIB support within the UnZip tree."
+ echo "^^ Unable to include ZLIB compression support."
+ fi
+ fi
+ else
+ echo ''
+ echo " ZLIB support is outside the UnZip tree."
+ echon " Check for ZLIB compiled library in IZ_ZLIB (${IZ_ZLIB})..."
+ if [ -f "${IZ_ZLIB_A}/libz.a" ]; then
+ echo ' Yes.'
+ echo " Found ZLIB library: ${IZ_ZLIB}/libz.a"
+ LIB_Z="${IZ_ZLIB}/libz.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_ZLIB} -DUSE_ZLIB"
+ LFLAGS1="${LFLAGS1} -L${IZ_ZLIB}"
+ LFLAGS2="${LFLAGS2} -lz"
+ echo "-- Including ZLIB deflate compression support."
+ echo "-- Using libz.a in IZ_ZLIB (${IZ_ZLIB})."
+ else
+ echo ' No.'
+ echo " ^^ ${IZ_ZLIB}/libz.a not found (IZ_ZLIB != \"zlib\")."
+ echo " ^^ Incomplete ZLIB support outside the UnZip tree."
+ echo "^^ Unable to include ZLIB compression support."
+ fi
+ fi
+ else
+ echo ' No.'
+ echo " -- ${IZ_ZLIB}/zlib.h not found"
+ echon " Check if OS already has ZLIB library available..."
+ cat > conftest.c << _EOF_
+#include "zlib.h"
+int main()
+{
+ z_streamp strm;
+ inflateReset(&strm);
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -o conftest conftest.c -lz >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo ' Yes.'
+ echo " -- OS supports ZLIB - linking in zlib."
+ CFLAGS_TST="${CFLAGS_TST} -DUSE_ZLIB"
+ LFLAGS2="${LFLAGS2} -lz"
+ echo "-- Including OS ZLIB compression support."
+ else
+ echo ' No.'
+ echo " ^^ Neither zlib.h nor libz.a was found."
+ echo "^^ Unable to include ZLIB compression support."
+ fi
+ fi
+ else
+ echo ' No.'
+ echo "^^ Directory ${IZ_ZLIB} not found."
+ echo "^^ Unable to include ZLIB compression support."
+ fi
+else
+ echo "ZLIB not requested."
+fi
+
+#------------------------------------------------------------------------------
+# I) Common compiler feature checks.
+#------------------------------------------------------------------------------
+# Feature macro common conventions:
+#
+# HAVE_HEADER_H
+# - Indicates that <header.h> is available.
+# - Preferred for new header tests
+#
+# HAVE_DIR_HEADER_H
+# - Indicates that <dir/header.h> is available.
+# - Preferred for new header tests
+#
+# NO_HEADER_H
+# - Indicates that <header.h> is not available.
+#
+# NO_DIR_HEADER_H
+# - Indicates that <dir/header.h> is not available.
+#
+# FUNCTION=function
+# - Indicates that function() is available.
+# - If not available, UnZip provides a replacement as follows:
+# - unzpriv.h:
+# - Replacement FUNCTION macro defined to declare replacement function.
+# - NEED_FUNCTION defined to enable compile of replacment function.
+# - fileio.c:
+# - Defines body of the replacement function, but this is compiled only
+# when NEED_FUNCTION is defined.
+# - All code references to function() must be coded as FUNCTION()
+#
+# NO_FUNCTION
+# - Indicates that function() is not available.
+# - No replacement is provided for these cases.
+
+
+# Disable ANSI function prototypes where not supported.
+echon 'Check for prototypes...'
+echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NO_PROTO).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_PROTO"
+else
+ echo ' Yes.'
+fi
+
+# Check if compiler supports "const" keyword.
+# - Handles mips cc and non ANSI compilers.
+# - Does it need more?
+echon 'Check the handling of const...'
+cat > conftest.c << _EOF_
+typedef int charset[2];
+int main()
+{
+ const charset x;
+ const char *foo;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NO_CONST).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_CONST"
+else
+ echo ' Yes.'
+fi
+
+# Check for size_t type.
+echon 'Check for size_t...'
+cat > conftest.c << _EOF_
+#include <sys/types.h>
+int main()
+{
+ size_t s;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No. (NO_SIZE_T).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_SIZE_T"
+else
+ echo ' Yes.'
+fi
+
+# Check for off_t type.
+echon 'Check for off_t...'
+cat > conftest.c << _EOF_
+#include <sys/types.h>
+int main()
+{
+ off_t s;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DNO_OFF_T"
+ echo ' No. (NO_OFF_T).'
+else
+ echo ' Yes.'
+fi
+
+# Check for signed char type.
+echon 'Check for signed char type...'
+cat > conftest.c << _EOF_
+int main()
+{
+ signed char s;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NO_SIGNED_CHAR).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_SIGNED_CHAR"
+else
+ echo ' Yes.'
+fi
+
+# Check for Large File Support (required for ZIP64).
+# - Now we set the 64-bit file environment and check the size of off_t.
+echon 'Check for Large File Support...'
+cat > conftest.c << _EOF_
+#define _LARGEFILE_SOURCE /* Some OSes need this for fseeko(). */
+#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64 /* Select default interface as 64 bit. */
+#define _LARGE_FILES /* Some OSes need this for 64-bit off_t. */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+int main()
+{
+ off_t offset;
+ struct stat s;
+ /* See if have 64-bit off_t. */
+ if (sizeof(offset) < 8) {
+ printf(" off_t is %d bytes\n", sizeof(off_t));
+ return 1;
+ }
+ /* See if have 64-bit stat. */
+ if (sizeof(s.st_size) < 8) {
+ printf(" s.st_size is %d bytes\n", sizeof(s.st_size));
+ return 2;
+ }
+ printf(" off_t is %d bytes\n", sizeof(off_t));
+ printf(" s.st_size is %d bytes\n", sizeof(s.st_size));
+ return 3;
+}
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No.'
+else
+ echo ''
+ ./conftest
+ status=$?
+ if [ $status -eq 1 ]; then
+ echo '-- No Large File Support - no 64-bit off_t.'
+ elif [ $status -eq 2 ]; then
+ echo '-- No Large File Support - no 64-bit stat.'
+ elif [ $status -eq 3 ]; then
+ echo '-- Yes, we have Large File Support.'
+ CFLAGS_TST="${CFLAGS_TST} -DLARGE_FILE_SUPPORT"
+ CFLAGS_TST_BZ="${CFLAGS_TST_BZ} -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
+ else
+ echo "-- No Large File Support - conftest returned $status."
+ fi
+fi
+
+# Check size of UIDs and GIDs.
+# (Now zip stores variable size UIDs/GIDs using a new extra field. This
+# tests if this OS uses 16-bit UIDs/GIDs and so if the old 16-bit storage
+# should also be used for backward compatibility.)
+
+echon 'Check size of UIDs and GIDs...'
+cat > conftest.c << _EOF_
+#define _LARGEFILE_SOURCE /* Some OSes need this for fseeko */
+#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64 /* Select default interface as 64 bit */
+#define _LARGE_FILES /* Some OSes need this for 64-bit off_t */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+int main( )
+{
+ struct stat s;
+
+#if !defined(__MVS__) && !defined(__VM__)
+ /*
+ 2011/09/02 [AD] Comment out: Problem reported to IBM
+ - Over-optimized trivial program fails during printf()
+ */
+ printf(" s.st_uid is %u bytes\n", sizeof(s.st_uid));
+ printf(" s.st_gid is %u bytes\n", sizeof(s.st_gid));
+#endif
+
+ /* See if have 16-bit UID. */
+ if (sizeof(s.st_uid) != 2) {
+ return 1;
+ }
+ /* See if have 16-bit GID. */
+ if (sizeof(s.st_gid) != 2) {
+ return 2;
+ }
+ return 3;
}
_EOF_
-$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_CONST"
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' Unknown (IZ_HAVE_UXUIDGID).'
+ errmes="-- UID/GID test failed on compile"
+ errmes="${errmes} - disabling old 16-bit UID/GID support"
+ echo "${errmes}"
+ CFLAGS_TST="${CFLAGS_TST} -DIZ_HAVE_UXUIDGID"
+else
+ echo ''
+ ./conftest
+ status=$?
+ if [ $status -eq 1 ]; then
+ echo ' UID != 16 bits (IZ_HAVE_UXUIDGID).'
+ echo '-- Enabling "ux" UID/GID support.'
+ CFLAGS_TST="${CFLAGS_TST} -DIZ_HAVE_UXUIDGID"
+ elif [ $status -eq 2 ]; then
+ echo ' GID != 16 bits (IZ_HAVE_UXUIDGID).'
+ echo '-- Enabling "ux" UID/GID support.'
+ CFLAGS_TST="${CFLAGS_TST} -DIZ_HAVE_UXUIDGID"
+ elif [ $status -eq 3 ]; then
+ echo ' UID, GID = 16 bits.'
+ echo '-- 16-bit UIDs and GIDs - keeping old 16-bit UID/GID support.'
+ else
+ echo ' Unknown (IZ_HAVE_UXUIDGID).'
+ errmes="-- Test failed - conftest returned $status."
+ errmes="${errmes} - Enabling "ux" UID/GID support"
+ echo "${errmes}"
+ CFLAGS_TST="${CFLAGS_TST} -DIZ_HAVE_UXUIDGID"
+ fi
+fi
-echo Check for time_t
+# Check for time_t structure.
+echon 'Check for time_t...'
cat > conftest.c << _EOF_
#include <sys/types.h>
#include <time.h>
return 0;
}
_EOF_
-$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_TIME_T"
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NO_TIME_T).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_TIME_T"
+else
+ echo ' Yes.'
+fi
-echo Check for size_t
-cat > conftest.c << _EOF_
-#include <sys/types.h>
-int main()
-{
- size_t s;
- return 0;
-}
-_EOF_
-$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_SIZE_T"
+# Check for utime.h header.
+echon 'Check for utime.h...'
+echo "#include <utime.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ echo ' Yes (HAVE_UTIME_H).'
+ CFLAGS_TST="${CFLAGS_TST} -DHAVE_UTIME_H"
+else
+ echo ' No.'
+fi
-echo Check for off_t
-cat > conftest.c << _EOF_
-#include <sys/types.h>
+# Check for sys/timeb.h header.
+echon 'Check for sys/timeb.h...'
+echo "#include <sys/timeb.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ echo ' Yes (HAVE_SYS_TIMEB_H).'
+ CFLAGS_TST="${CFLAGS_TST} -DHAVE_SYS_TIMEB_H"
+else
+ echo ' No.'
+fi
+
+# Check for sys/time.h header and gettimeofday() function.
+echo 'Check for sys/time.h and gettimeofday() needed for entry timing...'
+echon ' Check for sys/time.h...'
+echo "#include <sys/time.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No.'
+ echo "-- No sys/time.h - usec timing using gettimeofday() not supported."
+else
+ echo ' Yes (HAVE_SYS_TIME_H).'
+ CFLAGS_TST="${CFLAGS_TST} -DHAVE_SYS_TIME_H"
+ echon ' Check for gettimeofday()...'
+ cat > conftest.c << _EOF_
+#include "stdio.h"
+#include <sys/time.h>
int main()
{
- off_t s;
+ struct timeval now;
+ unsigned long long usec_time;
+
+ gettimeofday(&now, NULL);
+ usec_time = now.tv_sec * 1000000 + now.tv_usec;
return 0;
}
_EOF_
-$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_OFF_T"
+ $CC_TST -o conftest conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo ' No.'
+ echo "^^ Returned $status - usec timing using gettimeofday() not supported."
+ else
+ echo ' Yes (ENABLE_ENTRY_TIMING).'
+ echo '-- Enabling usec timing using gettimeofday().'
+ CFLAGS_TST="${CFLAGS_TST} -DENABLE_ENTRY_TIMING"
+ fi
+fi
-# Added 11/4/2003 EG
-# Revised 8/12/04 EG
-# Now we set the 64-bit file environment and check the size of off_t
-echo Check for Large File Support
-cat > conftest.c << _EOF_
-# define _LARGEFILE_SOURCE /* some OSes need this for fseeko */
-# define _LARGEFILE64_SOURCE
-# define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */
-# define _LARGE_FILES /* some OSes need this for 64-bit off_t */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+# Check for optional header files.
+# - If found, define HAVE_HEADER_H macro.
+INCLS='ctype.h wctype.h langinfo.h locale.h'
+for inc in $INCLS
+do
+ echon "Check for ${inc}..."
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ucname=` echo $inc | tr '[a-z]./' '[A-Z]__' `
+ mname="HAVE_${ucname}"
+ echo " Yes (${mname})."
+ CFLAGS_TST="${CFLAGS_TST} -D${mname}"
+ else
+ echo ' No.'
+ fi
+done
+
+# This all needs some work. See note at the top of unzpriv.h.
+
+# Check for wchar.h header.
+echon 'Check for wchar.h...'
+echo "#include <wchar.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ echo ' Yes (HAVE_WCHAR_H).'
+ CFLAGS_TST="${CFLAGS_TST} -DHAVE_WCHAR_H"
+
+ # Realistic check for working wide char library functions.
+ # - Add FUNCTION_NAME='function_name' to flags if found.
+ FUNCS='towupper towlower iswprint'
+ for func in $FUNCS
+ do
+ echon "Check for wide char ${func}..."
+ cat > conftest.c << _EOF_
+#include <stdlib.h>
#include <stdio.h>
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
int main()
{
- off_t offset;
- struct stat s;
- /* see if have 64-bit off_t */
- if (sizeof(offset) < 8)
- return 1;
- printf(" off_t is %d bytes\n", sizeof(off_t));
- /* see if have 64-bit stat */
- if (sizeof(s.st_size) < 8) {
- printf(" s.st_size is %d bytes\n", sizeof(s.st_size));
- return 2;
- }
- return 3;
+ int out;
+ out = $func( 'a' );
+ printf( " out: >0x%X<.\n", out);
+ return (out == 0);
}
_EOF_
-# compile it
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
- echo -- no Large File Support
-else
-# run it
- ./conftest
- r=$?
- if [ $r -eq 1 ]; then
- echo -- no Large File Support - no 64-bit off_t
- elif [ $r -eq 2 ]; then
- echo -- no Large File Support - no 64-bit stat
- elif [ $r -eq 3 ]; then
- echo -- yes we have Large File Support!
- CFLAGSR="${CFLAGSR} -DLARGE_FILE_SUPPORT"
- else
- echo -- no Large File Support - conftest returned $r
- fi
-fi
+ ${CC_TST} ${CFLAGS} ${CFLAGS_OPT} ${CFLAGS_TST} ${CFLAGS_USR} \
+ -o conftest conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ucname=` echo ${func} | tr '[a-z]' '[A-Z]' `
+ mname="${ucname}=${func}"
+ echo " Yes (${mname})."
+ CFLAGS_TST="${CFLAGS_TST} -D${mname}"
+ else
+ echo ' No.'
+ fi
+ done
-# Added 11/24/2005 EG
-# Check for wide char for Unicode support
-echo Check for wide char support
-cat > conftest.c << _EOF_
+ # Check for wide char for Unicode support.
+ iconv_ok=0
+ echon 'Check for wide char Unicode support...'
+ cat > conftest.c << _EOF_
#include <stdlib.h>
#include <stdio.h>
-#include <wchar.h>
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
int main()
{
size_t wsize;
wchar_t *wide_string;
+ wchar_t wc = (wchar_t)'a'; /* any old character will do */
+ wchar_t wco;
+ int i;
if ((wide_string = (wchar_t *)malloc(4 * sizeof(wchar_t))) == NULL) {
return 0;
}
- /* get wide string */
+
+ /* Get wide string. */
wsize = mbstowcs(wide_string, "foo", 3);
wide_string[wsize] = (wchar_t) NULL;
+
+ /* Make sure we have everything we need for wide support. */
+ wco = towupper(wc);
+ wco = towlower(wc);
+ i = iswprint(wc);
+
#ifndef __STDC_ISO_10646__
return 1;
#else
- printf(" __STDC_ISO_10646__ = %d\n", __STDC_ISO_10646__);
+ printf(" __STDC_ISO_10646__ = %d (yyyymm)\n", __STDC_ISO_10646__);
return 2;
#endif
}
_EOF_
-# compile it
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
- echo "-- no Unicode (wchar_t) support"
-else
-# have wide char support
-# run it
- ./conftest
- r=$?
- if [ $r -eq 0 ]; then
- echo -- no Unicode wchar_t support - wchar_t allocation error
- elif [ $r -eq 1 ]; then
- echo -- no Unicode support - wchar_t encoding unspecified
- elif [ $r -eq 2 ]; then
- echo -- have wchar_t with known UCS encoding - enabling Unicode support!
- CFLAGSR="${CFLAGSR} -DUNICODE_SUPPORT -DUNICODE_WCHAR"
+ ${CC_TST} ${CFLAGS} ${CFLAGS_OPT} ${CFLAGS_TST} ${CFLAGS_USR} \
+ -o conftest conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo ' No.'
else
- echo "-- no Unicode (wchar_t) support - conftest returned $r"
+ echo ''
+ ./conftest
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo '-- No Unicode wchar_t support - wchar_t allocation error.'
+ elif [ $status -eq 1 ]; then
+ errmes="^^ No Unicode support"
+ echo "${errmes} - wchar_t encoding unspecified, may not be UCS."
+ elif [ $status -eq 2 ]; then
+ echo '-- Have wchar_t with known UCS encoding - enabling Unicode support.'
+ CFLAGS_TST="${CFLAGS_TST} -DUNICODE_SUPPORT -DUNICODE_WCHAR"
+ iconv_ok=1
+ else
+ echo "^^ No Unicode (wchar_t) support - conftest returned $status."
+ fi
fi
+else
+ echo ' No.'
fi
-echo "Check for setlocale support (needed for UNICODE Native check)"
+# Check for setlocale() support.
+echon "Check for setlocale() support..."
cat > conftest.c << _EOF_
#include <locale.h>
int main()
return 0;
}
_EOF_
-$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-if [ $? -eq 0 ]; then
- echo "-- have setlocale, can check for charset type"
- echo "-- - enabling UTF8-native support!"
- CFLAGSR="${CFLAGSR} -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE"
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ echo ' Yes (UNICODE_SUPPORT, UTF8_MAYBE_NATIVE).'
+ echo '-- Enabling UTF8-native support.'
+ CFLAGS_TST="${CFLAGS_TST} -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE"
+else
+ echo ' No (NO_SETLOCALE).'
+ echo '^^ No Unicode (UTF-8 native) support.'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_SETLOCALE"
+fi
+
+# Configure optional ISO/OEM (iconv) conversion library.
+# (User may disable: "NO_ICONV=1", and UNICODE_SUPPORT must be enabled.)
+if [ -n "${NO_ICONV}" ]; then
+ echo "ISO/OEM (iconv) conversion support disabled."
else
- echo "-- no Unicode (UTF-8 native) support!"
- CFLAGSR="${CFLAGSR} -DNO_SETLOCALE"
+ echon "Check ISO/OEM (iconv) conversion support..."
+ if [ $iconv_ok -eq 0 ]; then
+ echo ' No.'
+ echo "^^ No wide Unicode support, so no ISO/OEM (iconv) conversion support."
+ else
+ cat > conftest.c << _EOF_
+#include <iconv.h>
+int main()
+{
+#ifndef ICONV_MAPPING
+ forget it
+#endif
+ iconv_t rslt;
+ rslt = iconv_open( "ASCII", "ASCII");
+ return ((rslt == (iconv_t)(-1)) ? -1 : 0);
+}
+_EOF_
+ $CC_TST $CFLAGS -DICONV_MAPPING -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # Try linking with no special library.
+ $CC_TST $LFLAGS1 -o conftest conftest.o >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ # That failed, so try linking with libiconv.
+ $CC_TST $LFLAGS1 -liconv -o conftest conftest.o >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LFLAGS2="${LFLAGS2} -liconv"
+ fi
+ fi
+ fi
+ if [ $status -eq 0 ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DICONV_MAPPING"
+ echo ' Yes (ICONV_MAPPING).'
+ else
+ echo ' No.'
+ echo "^^ Unable to include ISO/OEM (iconv) conversion support."
+ fi
+ fi
fi
-# from configure 2.4i (Onno) 12/5/04
-echo Check for gcc no-builtin flag
-# -fno-builtin since version 2
+
+# Check for gcc no-builtin flag.
+# - gnu C supports -fno-builtin since version 2
+# - from configure 2.4i (Onno) 2004-12-05
+echon 'Check for gcc no-builtin flag...'
cat > conftest.c << _EOF_
int main()
{
#endif
}
_EOF_
-$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -eq 0 ] && BFLAG="-fno-builtin"
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ echo ' No (-fno-builtin).'
+ BIF_TST="${BIF_TST} -fno-builtin"
+else
+ echo ' Yes.'
+fi
-# Check for missing functions
-# add NO_'function_name' to flags if missing
-for func in fchmod fchown lchown nl_langinfo
+# Check for missing functions.
+# - add NO_'function_name' to flags if missing.
+FUNCS='chmod chown fchmod fchown lchown localtime_r mktemp mktime mkstemp'
+FUNCS="${FUNCS} nl_langinfo rename rmdir strchr strrchr"
+#echo "Check for expected functions..."
+for func in $FUNCS
do
- echo Check for $func
+ echon "Check for ${func}()..."
echo "int main(){ $func(); return 0; }" > conftest.c
- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
- [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
+ $CC_TST $CFLAGS $BIF_TST -o conftest conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ ucname=` echo ${func} | tr '[a-z]' '[A-Z]' `
+ mname="NO_${ucname}"
+ echo " No (${mname})."
+ CFLAGS_TST="${CFLAGS_TST} -D${mname}"
+ else
+ echo ' Yes.'
+ fi
done
-# Check (seriously) for a working lchmod.
-echo 'Check for lchmod'
+# Check (very seriously) for a working lchmod().
+# On GNU/Linux (Clang, GCC) look for a # compile-time warning like
+# "lchmod is not implemented and will always fail".
+echon 'Check for lchmod()...'
temp_file="/tmp/unzip_test_$$"
temp_link="link_$$"
( echo '#include <unistd.h>' ; \
echo "int main() { lchmod(\"${temp_file}\", 0666); }" \
) > conftest.c
ln -s "${temp_link}" "${temp_file}" && \
- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null && \
- ./conftest
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_LCHMOD"
-rm -f "${temp_file}"
+$CC_TST $CFLAGS $BIF_TST -o conftest conftest.c >/dev/null 2> conftest.err
+status=$?
+if [ $status -eq 0 ]; then
+ grep implemented < conftest.err > /dev/null 2> /dev/null
+ status=$?
+ [ $status -eq 0 ] && status=666
+fi
+if [ $status -eq 0 ]; then
+ ./conftest
+ status=$?
+fi
+if [ $status -ne 0 ]; then
+ echo ' No (NO_LCHMOD).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_LCHMOD"
+else
+ echo ' Yes.'
+fi
+rm -f "${temp_file}" conftest.err
-echo Check for memset
+# Check for memset().
+echon 'Check for memset()...'
echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DZMEM"
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (ZMEM).'
+ CFLAGS_TST="${CFLAGS_TST} -DZMEM"
+else
+ echo ' Yes.'
+fi
+
+# Check for memmove().
+echon 'Check for memmove()...'
+cat > conftest.c << _EOF_
+#include <string.h>
+int main() { int a; int b = 0; memmove( &a, &b, sizeof( a)); return a; }
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NEED_MEMMOVE).'
+ CFLAGS_TST="${CFLAGS_TST} -DNEED_MEMMOVE"
+else
+ echo ' Yes.'
+fi
-echo Check for errno declaration
+# Check for errno declaration.
+echon 'Check for errno declaration...'
cat > conftest.c << _EOF_
#include <errno.h>
main()
return 0;
}
_EOF_
-$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_ERRNO"
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NO_ERRNO).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_ERRNO"
+else
+ echo ' Yes.'
+fi
-echo Check for directory libraries
+# Check for labs().
+echon 'Check for labs()...'
cat > conftest.c << _EOF_
-int main() { return closedir(opendir(".")); }
+#include <stdlib.h>
+int main() { labs( 0); return 0; }
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NEED_LABS).'
+ CFLAGS_TST="${CFLAGS_TST} -DNEED_LABS"
+else
+ echo ' Yes.'
+fi
+
+# Check for strerror().
+echon 'Check for strerror()...'
+cat > conftest.c << _EOF_
+#include <string.h>
+int main() { strerror( 0); return 0; }
_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NEED_STRERROR).'
+ CFLAGS_TST="${CFLAGS_TST} -DNEED_STRERROR"
+else
+ echo ' Yes.'
+fi
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
+# Check for directory libraries.
+echon 'Check for directory libraries...'
+cat > conftest.c << _EOF_
+int main() { return closedir(opendir(".")); }
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ echo ' None needed.'
+else
OPT=""
- for lib in ndir dir ucb bsd BSD PW x dirent
+ LIBS='ndir dir ucb bsd BSD PW x dirent'
+ for lib in $LIBS
do
- $CC -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
- [ $? -eq 0 ] && OPT=-l$lib && break
+ $CC_TST $CFLAGS -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && OPT=-l$lib && break
done
if [ ${OPT} ]; then
- LFLAGS2="${LFLAGS2} ${OPT}"
+ echo " Found: ${OPT}"
+ LFLAGS="${LFLAGS2} ${OPT}"
else
- CFLAGSR="${CFLAGSR} -DNO_DIR"
+ echo ' Found none (NO_DIR).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_DIR"
fi
fi
-# Dynix/ptx 1.3 needed this
-echo Check for readlink
+# Check for readlink().
+# - Dynix/ptx 1.3 needed this.
+echon 'Check for readlink()...'
echo "int main(){ return readlink(); }" > conftest.c
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
- $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
- [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ echo ' Yes.'
+else
+ $CC_TST $CFLAGS -o conftest conftest.c -lseq >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo ' Yes (-lseq).'
+ LFLAGS2="${LFLAGS2} -lseq"
+ else
+ echo ' No.'
+ fi
fi
-echo Check for directory include file
+# Check for directory header.
+echo 'Check for directory header file...'
OPT=""
-for inc in dirent.h sys/ndir.h ndir.h sys/dir.h
+INCLS='dirent.h sys/ndir.h ndir.h sys/dir.h'
+for inc in $INCLS
do
- echo "#include <$inc>" > conftest.c
- $CPP conftest.c > /dev/null 2>/dev/null
- [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
+ echon " <${inc}>..."
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ucname=` echo $inc | tr '[a-z]./' '[A-Z]__' `
+ mname="HAVE_${ucname}"
+ echo " Yes (${mname})."
+ CFLAGS_TST="${CFLAGS_TST} -D${mname}"
+ break
+ else
+ echo ' No.'
+ fi
done
-CFLAGSR="${CFLAGSR} ${OPT}"
-echo Check for non existent include files
-for inc in stdlib.h stddef.h unistd.h fcntl.h string.h langinfo.h
+# Check for sys/param.h.
+echon 'Check for sys/param.h...'
+echo "#include <sys/param.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NO_PARAM_H).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_PARAM_H"
+else
+ echo ' Yes.'
+fi
+
+# Check for nonexistent header files.
+# - If not found, define NO_HEADER symbol.
+# FIX_ME: Remove langinfo.h after all NO_LANGINFO uses removed.
+# FIX_ME: Move some of these (langinfo.h + ?) to HAVE_.
+echo 'Check for expected header files...'
+INCLS='stdlib.h stddef.h stdint.h unistd.h fcntl.h string.h langinfo.h'
+for inc in $INCLS
do
- echo "#include <$inc>" > conftest.c
- $CPP conftest.c >/dev/null 2>/dev/null
- [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
+ echon " <${inc}>..."
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ ucname=` echo $inc | tr '[a-z]./' '[A-Z]__' `
+ mname="NO_${ucname}"
+ echo " No. (${mname})."
+ CFLAGS_TST="${CFLAGS_TST} -D${mname}"
+ else
+ echo ' Yes.'
+ fi
done
-echo Check for term I/O include file
+# Check for terminal I/O header file.
+echo 'Check for terminal I/O header file...'
OPT=""
-for inc in termios.h termio.h sgtty.h
+INCLS='termios.h termio.h sgtty.h'
+for inc in $INCLS
do
- echo "#include <$inc>" > conftest.c
- $CPP conftest.c > /dev/null 2>/dev/null
- [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
+ echon " <${inc}>..."
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ucname=` echo $inc | tr '[a-z]./' '[A-Z]__' `
+ mname="HAVE_${ucname}"
+ echo " Yes (${mname})."
+ CFLAGS_TST="${CFLAGS_TST} -D${mname}"
+ break
+ else
+ echo ' No.'
+ fi
done
-CFLAGSR="${CFLAGSR} ${OPT}"
-echo Check for MBCS include files
+# Check for MBCS header files.
+echo 'Check for MBCS header files...'
OPT=""
-for inc in mbstring.h mbctype.h
+INCLS='mbstr.h mbstring.h mbctype.h'
+for inc in $INCLS
do
- echo "#include <$inc>" > conftest.c
- $CPP conftest.c > /dev/null 2>/dev/null
- [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
+ echon " <${inc}>..."
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ucname=` echo ${inc} | tr '[a-z]./' '[A-Z]__' `
+ mname="HAVE_${ucname}"
+ echo " Yes (${mname})."
+ CFLAGS_TST="${CFLAGS_TST} -D${mname}"
+ break
+ else
+ echo " No."
+ fi
done
-CFLAGSR="${CFLAGSR} ${OPT}"
-# Check for MBCS support
-echo Check for MBCS support
+# Check for MBCS support.
+echon 'Check for MBCS (multi-byte character) support...'
cat > conftest.c << _EOF_
#include <stdlib.h>
#include <stdio.h>
-#include <wchar.h>
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
#ifdef HAVE_MBSTRING_H
-# include <mbstring.h>
+# include <mbstring.h>
#endif
int main()
{
return mblen(tst, MB_CUR_MAX);
}
_EOF_
-# compile it
-$CC ${CFLAGS} ${CFLAGSR} -o conftest conftest.c >/dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
- echo "-- no MBCS support"
- CFLAGSR="${CFLAGSR} -DNO_MBCS"
+${CC_TST} ${CFLAGS} ${CFLAGS_OPT} ${CFLAGS_TST} ${CFLAGS_USR} \
+ -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NO_MBCS).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_MBCS"
else
-#
- echo "-- have MBCS support"
- CFLAGSR="${CFLAGSR} -D_MBCS"
-# check for library-supplied functions
-# add FUNCTION_NAME='function_name' to flags if found
- for func in mbschr mbsrchr
- do
- echo Check for MBCS $func
- echo "int main() { $func(); return 0; }" > conftest.c
- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
- [ $? -eq 0 ] && CFLAGSR="${CFLAGSR} -D`echo $func | tr '[a-z]' '[A-Z]'`=$func"
- done
+ echo ' Yes (_MBCS).'
+ CFLAGS_TST="${CFLAGS_TST} -D_MBCS"
fi
-# needed for AIX (and others ?) when mmap is used
-echo Check for valloc
+# Realistic check for working MBCS library functions.
+# - Add FUNCTION_NAME='function_name' to flags if found.
+FUNCS='mbschr mbsrchr'
+for func in $FUNCS
+do
+ echon "Check for MBCS ${func}()..."
+ cat > conftest.c << _EOF_
+#include <stdlib.h>
+#ifdef HAVE_MBSTR_H
+# include <mbstr.h>
+#endif
+int main()
+{
+ char *tst;
+ tst = $func( "abc", 'b');
+ printf( " $func(\"abc\", 'b') = \"%s\"\n", tst);
+ return (tst == NULL);
+}
+_EOF_
+ ${CC_TST} ${CFLAGS} ${CFLAGS_OPT} ${CFLAGS_TST} ${CFLAGS_USR} \
+ -o conftest conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ./conftest >/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ucname=` echo ${func} | tr '[a-z]' '[A-Z]' `
+ mname="${ucname}=${func}"
+ echo " Yes (${mname})."
+ CFLAGS_TST="${CFLAGS_TST} -D${mname}"
+ else
+ echo ' No.'
+ fi
+ else
+ echo ' No.'
+ fi
+done
+
+# Needed for AIX (and others ?) when mmap is used.
+echon 'Check for valloc()...'
cat > conftest.c << _EOF_
main()
{
#endif
}
_EOF_
-$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_VALLOC"
-
-echo Check for /usr/local/bin and /usr/local/man
-BINDIR=$HOME/bin
-[ -d /usr/local/bin ] && BINDIR=/usr/local/bin
+${CC_TST} ${CFLAGS} ${CFLAGS_OPT} ${CFLAGS_TST} ${CFLAGS_USR} \
+ -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo ' No (NO_VALLOC).'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_VALLOC"
+else
+ echo ' Yes.'
+fi
-MANDIR=manl
-[ -d /usr/man/manl ] && MANDIR=/usr/man/manl
-[ -d /usr/local/man/manl ] && MANDIR=/usr/local/man/manl
-[ -d /usr/local/man/man1 ] && MANDIR=/usr/local/man/man1
+#------------------------------------------------------------------------------
+# J) Perform OS-specific tests.
+#------------------------------------------------------------------------------
+# Check for OS-specific flags.
+ossf=0
+echon 'Check for OS-specific flags...'
+if [ -n "${UNAME_S}" ]; then
+ echo "int main() { return 0;}" > conftest.c
+ case "${UNAME_S}" in
+ OSF1|ULTRIX)
+ ossf=1
+ echo ''
+ echo ' Check for -Olimit option...'
+ $CC_TST ${CFLAGS} -Olimit 1000 -o conftest conftest.c \
+ >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo ' Yes.'
+ CFLAGS_TST="${CFLAGS_TST} -Olimit 1000"
+ else
+ echo ' No.'
+ fi
+ ;;
-echo Checking for OS specialties
-if [ -f /usr/bin/hostinfo ]; then
- if /usr/bin/hostinfo | grep NeXT > /dev/null; then
- CFLAGSR="${CFLAGSR} -posix"
- LFLAGS1="${LFLAGS1} -posix -object"
+ Darwin)
+ # Have (and user accepts) extended attribute support? (OS X >= 10.4?)
+ # "defined( XATTR_NOFOLLOW)" indicates feature availability.
+ # "defined( NO_APPLE_XATTR)" indicates user rejection.
+ ossf=1
+ echo ''
+ echon ' Check for extended attribute support...'
+ cat > conftest.c << _EOF_
+#include <sys/xattr.h>
+int main()
+{
+#if defined( NO_APPLE_XATTR) || !defined( XATTR_NOFOLLOW)
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo ' Yes (APPLE_XATTR).'
+ CC_TST="${CC_TST} -DAPPLE_XATTR"
+ CFLAGS_TST="${CFLAGS_TST} -DAPPLE_XATTR"
+ else
+ echo ' No.'
+ fi
+ ;;
+ esac
+elif [ -n "${UNAME_X}" ]; then
+# SCO shared library check. ??? Where's the "SCO" test"???
+ echo "int main() { return 0;}" > conftest.c
+ $CC_TST $CFLAGS -o conftest conftest.c -lc_s -nointl >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ossf=1
+ echo ' Yes (SCO???).'
+ LFLAGS2="-lc_s -nointl"
fi
-# XXX ATT6300, Cray
-elif [ -f /xenix ]; then
- if uname -p | grep 286 > /dev/null; then
- CFLAGSR="${CFLAGSR} -LARGE -Mel2 -DMEDIUM_MEM -DWSIZE=16384 -DNO_VOID"
- LFLAGS1="${LFLAGS1} -LARGE -Mel2"
+else
+ # No explicit identification. Test for files/directories.
+ if [ -f /usr/bin/hostinfo ]; then
+ if /usr/bin/hostinfo | grep NeXT >/dev/null; then
+ ossf=1
+ echo ' Yes (NeXT).'
+ CFLAGS_TST="${CFLAGS_TST} -posix"
+ LFLAGS1="${LFLAGS1} -posix -object"
+ fi
+# XXX ATT6300, Cray.
+ elif [ -f /xenix ]; then
+ if echo "${UNAME_P}" | grep 286 >/dev/null; then
+ ossf=1
+ echo ' Yes (xenix-286).'
+ CFLAGS_TST="${CFLAGS_TST} -LARGE -Mel2 -DMEDIUM_MEM -DWSIZE=16384"
+ CFLAGS_TST="${CFLAGS_TST} -DNO_VOID"
+ LFLAGS1="${LFLAGS1} -LARGE -Mel2"
+ fi
fi
-elif uname -X >/dev/null 2>/dev/null; then
-# SCO shared library check
- echo "int main() { return 0;}" > conftest.c
- $CC -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
- [ $? -eq 0 ] && LFLAGS2="-lc_s -nointl"
+fi
+if [ $ossf -eq 0 ]; then
+ echo ' No.'
+fi
+
+#------------------------------------------------------------------------------
+# K) Configure system-specific resources.
+#------------------------------------------------------------------------------
+# Check symbolic links.
+echon 'Check symbolic links...'
+if ln -s /dev/null null >/dev/null 2>/dev/null ; then
+ echo ' Yes.'
else
- SYSTEM=`uname -s 2>/dev/null` || SYSTEM="unknown"
- echo "int main() { return 0;}" > conftest.c
- case $SYSTEM in
- OSF1|ULTRIX)
- echo Check for -Olimit option
- $CC ${CFLAGS} -Olimit 1000 -o conftest conftest.c >/dev/null 2>/dev/null
- [ $? -eq 0 ] && CFLAGSR="${CFLAGSR} -Olimit 1000"
- ;;
-### HP-UX)
-### echo Check for +Onolimit option
-### $CC ${CFLAGS} +Onolimit -o conftest conftest.c >/dev/null 2>/dev/null
-### [ $? -eq 0 ] && CFLAGSR="${CFLAGSR} +Onolimit"
-### ;;
-### SunOS)
-### CFLAGSR="${CFLAGSR} -D_FILE_OFFSET_BITS=64"
-### ;;
- esac
+ echo ' No.'
+ LN=ln
fi
-echo Check for symbolic links
-ln -s /dev/null null > /dev/null 2>/dev/null || LN=ln
+#------------------------------------------------------------------------------
+# L) Generate system identification.
+#------------------------------------------------------------------------------
+if [ -n "${UNAME_S}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_S='\\\"${UNAME_S}\\\"'"
+fi
-rm -f a.out conftest.c conftest.o conftest null
+if [ -n "${UNAME_V}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_V='\\\"${UNAME_V}\\\"'"
+fi
+if [ -n "${UNAME_R}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_R='\\\"${UNAME_R}\\\"'"
+fi
-# bzip2
+if [ -n "${UNAME_O}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_O='\\\"${UNAME_O}\\\"'"
+fi
-echo "Check bzip2 support"
-D_USE_BZ2=""
-LIBBZ2=""
-L_BZ2=""
-CC_BZ="${CC}"
+if [ -n "${UNAME_M}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_M='\\\"${UNAME_M}\\\"'"
+fi
-if test -n "${IZ_BZIP2}" -a "${IZ_BZIP2}" != "bzip2" ; then
- echo " Check for bzip2 compiled library in IZ_BZIP2 (${IZ_BZIP2})"
- if test -f "${IZ_BZIP2}/libbz2.a"; then
-#
-# A bzip2 library built with BZ_NO_STDIO should have an
-# unresolved external, "bz_internal_error". The default,
-# full-function library will not mention it.
-#
- nm ${IZ_BZIP2}/libbz2.a | grep bz_internal_error > /dev/null
- if test $? -eq 0; then
- echo " Found bzip2 BZ_NO_STDIO library, ${IZ_BZIP2}/libbz2.a"
- if test -f "${IZ_BZIP2}/bzlib.h"; then
- LIBBZ2="${IZ_BZIP2}/libbz2.a"
- D_USE_BZ2="-DUSE_BZIP2"
- L_BZ2="${BZLF} -lbz2"
- echo "-- Found bzip2 library - linking in bzip2"
- else
- echo " ${IZ_BZIP2}/bzlib.h not found"
- echo "-- Since IZ_BZIP2 defined (!= \"bzip2\"),"
- echo "-- => skipping OS and bzip2 dir checks."
- echo "-- NO bzip2 support !"
- fi
- else
- echo " Found bzip2 library, ${IZ_BZIP2}/libbz2.a,"
- echo " but library not compiled with BZ_NO_STDIO."
- echo " ERROR: This (default) variant of bzip2 library is NOT"
- echo " supported with UnZip because of its incompatible"
- echo " error handling!"
- echo " Please see the UnZip installation instructions in"
- echo " the INSTALL text file."
- echo " Skipping bzip2 support..."
- fi
+if [ -n "${UNAME_P}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_P='\\\"${UNAME_P}\\\"'"
+fi
+
+if [ -n "${SIZER_V}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DSIZER_V='\\\"${SIZER_V}\\\"'"
+fi
+
+#------------------------------------------------------------------------------
+# M) Additional compiler command options.
+#------------------------------------------------------------------------------
+# Check validity of -Wno-format-security (for modern GCC).
+CF_TEST='-Wno-format-security'
+echon "Check ${CF_TEST}..."
+cat > conftest.c << _EOF_
+int main() { return 0; }
+_EOF_
+${CC_TST} ${CFLAGS} ${CF_TEST} -o conftest conftest.c > /dev/null \
+ 2> conftest.err
+status=$?
+if [ $status -eq 0 ]; then
+ grep -i unknown < conftest.err > /dev/null 2> /dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ status=666;
else
- echo " ${IZ_BZIP2}/libbz2.a not found"
- echo "-- Since IZ_BZIP2 defined (!= \"bzip2\"),"
- echo "-- => skipping OS and bzip2 dir checks."
- echo "-- NO bzip2 support !"
- fi
-else
- echo " Check for bzip2 sources in unzip's bzip2 subdirectory"
- if test -f "${IZ_BZIP2}/bzlib.c" -a -f "${IZ_BZIP2}/bzlib.h"; then
- echo "-- Found bzip2 source in ${IZ_BZIP2}/ directory"
- echo "-- Will try to build bzip2 library from source and link in"
- LIBBZ2="${IZ_BZIP2}/libbz2.a"
- D_USE_BZ2="-DUSE_BZIP2"
- L_BZ2="${BZLF} -lbz2"
+ status=0
+ fi
+fi
+if [ $status -eq 0 ]; then
+ echo ' Yes.'
+ CFLAGS_TST="${CFLAGS_TST} ${CF_TEST}"
+else
+ echo ' No.'
+fi
+
+# Check validity of -Wno-format-nonliteral (for Clang).
+CF_TEST='-Wno-format-nonliteral'
+echon "Check ${CF_TEST}..."
+cat > conftest.c << _EOF_
+int main() { return 0; }
+_EOF_
+${CC_TST} ${CFLAGS} ${CF_TEST} -o conftest conftest.c > /dev/null \
+ 2> conftest.err
+status=$?
+if [ $status -eq 0 ]; then
+ grep -i unknown < conftest.err > /dev/null 2> /dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ status=666;
else
- echo "-- bzip2 sources not found - no bzip2 support"
+ status=0
fi
fi
+if [ $status -eq 0 ]; then
+ echo ' Yes.'
+ CFLAGS_TST="${CFLAGS_TST} ${CF_TEST}"
+else
+ echo ' No.'
+fi
+
+# Remove work files from configuration tests.
+rm -f a.out conftest.c conftest.o conftest.err conftest.lst conftest null
+
+#------------------------------------------------------------------------------
+# Finalize the configuration values.
+#------------------------------------------------------------------------------
+# Add optimization (and listing) flags to initial C flags.
+if [ -n "${CFLAGS_OPT}" ]; then
+ CFLAGS="${CFLAGS} ${CFLAGS_OPT}"
+ CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
+fi
+
+# Add standard bzip2 configuration flags.
+CFLAGS_BZ="${CFLAGS_BZ} -DBZ_NO_STDIO"
+
+# Add test configuration flags.
+if [ -n "${CFLAGS_TST}" ]; then
+ CFLAGS="${CFLAGS} ${CFLAGS_TST}"
+fi
+if [ -n "${CFLAGS_TST_BZ}" ]; then
+ CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_TST_BZ}"
+fi
+
+# Add user override flags.
+if [ -n "${CFLAGS_USR}" ]; then
+ CFLAGS="${CFLAGS} ${CFLAGS_USR}"
+fi
+
+# Use listing-specific CC if required.
+if [ -n "${CC_LIST}" ]; then
+ CC="${CC_LIST}"
+ CC_BZ="${CC_LIST}"
+fi
+
+# Use listing-specific LD if required.
+if [ -n "${LD_LIST}" ]; then
+ LD="${LD_LIST}"
+fi
+#------------------------------------------------------------------------------
+# Emit the primary configuration values in the $PROD/flags file.
+#------------------------------------------------------------------------------
+echo "CC=\"${CC}\" CF=\"${CFLAGS}\"" \
+ "CC_BZ=\"${CC_BZ}\" CF_BZ=\"${CFLAGS_BZ}\"" \
+ "CPP=\"${CPP}\"" \
+ "AS=\"${AS}\" AF=\"${AFLAGS}\"" \
+ "LD=\"${LD}\" LF1=\"${LFLAGS1}\" LF2=\"${LFLAGS2}\"" \
+ "AR=\"${AR}\" RANLIB=\"${RANLIB}\"" \
+ "LN=\"${LN}\"" \
+ "RM=\"${RM}\"" \
+ "PROD=\"${PROD}\"" \
+ "PORT=\"${PORT}\"" \
+ "LIB_AES_WG=\"${LIB_AES_WG}\"" \
+ "LIB_BZ=\"${LIB_BZ}\"" \
+ "LIB_LZMA=\"${LIB_LZMA}\"" \
+ "LIB_PPMD=\"${LIB_PPMD}\"" \
+ "LIB_Z=\"${LIB_Z}\"" \
+ "MK_BZ=\"${MK_BZ}\"" \
+ "OSDEP_H=\"${OSDEP_H}\"" \
+ "OSDEP_OCF=\"${OSDEP_OCF}\"" \
+ "OSDEP_OCS=\"${OSDEP_OCS}\"" \
+ "OSDEP_OCU=\"${OSDEP_OCU}\"" \
+ "OSDEP_OS=\"${OSDEP_OS}\"" \
+ "PGMEXT=\"${PGMEXT}\"" \
+ "DLLEXT=\"${DLLEXT}\"" \
+ > flags
-echo CC=\"${CC}\" CF=\"${CFLAGSR} ${D_USE_BZ2}\" CRCA_O=\"${CRC32OA}\" \
- AS=\"${CC} -c\" LFLAGS1=\"${LFLAGS1}\" LF2=\"${LFLAGS2}\" \
- CC_BZ=\"${CC_BZ}\" CFLAGS_BZ=\"${CFLAGS_BZ}\" \
- IZ_BZIP2=\"${IZ_BZIP2}\" D_USE_BZ2=\"${D_USE_BZ2}\" \
- L_BZ2=\"${L_BZ2}\" LIBBZ2=\"${LIBBZ2}\" > flags
+#------------------------------------------------------------------------------
+# Emit the libbz2 configuration values in the $PROD/flags_bz file.
+#------------------------------------------------------------------------------
+echo "CC=\"${CC_BZ}\" CFLAGS=\"${CFLAGS_BZ}\"" \
+ "AR=\"${AR_BZ}\" RANLIB=\"${RANLIB}\"" \
+ "RM=\"${RM}\"" \
+ > flags_bz
+echo ""
--- /dev/null
++==============================================================================
+| unix/configure.txt: Notes on unix/configure and unix/Makefile
+| Version: Zip 3.1 and UnZip 6.10 10 Sept 2011
++==============================================================================
+
+This brief document describing the updated unix/configure flags, and the
+differences from that generated by the original unix.configure script.
+
+Changes:
+1. A new file $PROD/flags_bz is generated containing just the bzip2
+ compilation-related flags.
+2. UNAME-related flags now in more legible order
+3. For z/OS, use "uname -I" to generate current z/OS information
+4. Now generates installation flags (BINDIR, BINPERMS)
+5. Now generates man page flags (MANEXT, MANDIR, MANPERMS)
+ - unix/Makefile supports generic_man and generic_doc
+6. Now generates man page nroff option
+ - Currently "-Tascii" or ""
+7. Flags renamed for consistency between zip and unzip:
+ - CFLAGS -> CF
+ - CFLAGS_BZ -> CF_BZ
+ - LFLAGS1 -> LF1
+ - LFLAGS2 -> LF2
+8. Flags generated are a superset of zip and unzip (additional header checks)
+9. OSDEP_xxxx flags contain OS-dependent values:
+ - OSDEP_C C source files
+ - OSDEP_H C header files
+ - OSDEP_S Assembler source files
+ - OSDEP_OC Object files (C)
+ - OSDEP_OS Object files (assembler)
+ These allows multiple OS-dependent C or assembler source files
+10. Use consistent configuration, naming and recipes for assembler files
+11. Add $PROD/flags values for program extensions:
+ - PMGEXT Executables
+ - DLLEXT DLLs (Shared objects)
+12. Add $PROD/flags values for RANLIB, RM and LN
+13: Add $PROD/flags values for AR
+ - Required by IBM XLC for AIX 64-bit compiles
+14. Object archive dependencies. Non-blank if library is required
+ - LIB_AES_WG
+ LIB_LZMA
+ LIB_BZ
+ LIB_Z
+15: ZLIB and BZIP2 support now consistent
+ - Supports build within tree via bzip2/Makefile or zlib/Makefile (if present)
+ - Supports build with OS-owned libbz2.a (IZ_BZIP2=bzip2, ./bzip2 is empty)
+ - Supports build with OS-owned libz.a (IZ_ZLIB=zlib, ./zlib is empty)
+ - Returns MK_BZ to allow configure to return system-specific BZIP2 makefile name
+16: Now supports AF for assembler flags
+17: Support compiler listing options (+ CC on z/OS) for LIST=1
+18: Cleanup targets now same on zip and unzip (clean, clean_bzip2, clean_exe)
+19: All make targets are now explicit for portability
+ - SysV make pattern matching is not as powerful as gmane or z/OS make (MKS)
+20: .SUFFIX reset to prevent builds from using default .c -> .o rules
+
+21: On z/OS, use CC=c89 (xlc ends with sigkill for failing compiles)
+22: On AIX (with IBM XL C) use CC=c89
+23: Use unzip nl_langinfo() test instead of following zip test (which fails because
+ codeset is not an int).
+
+ echo Check for nl_langinfo
+ cat > conftest.c << _EOF_
+ #include <langinfo.h>
+ int main() { char *codeset; codeset = nl_langinfo(CODESET); return codeset; }
+ _EOF_
+ $CC -o conftest conftest.c >/dev/null 2>/dev/null
+ [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_NL_LANGINFO"
+24: Add test for sys/param.h (for -DNO_PARAM_H)
+25: Add test for sys/time.h (separate from entry timing)
+26: Add tests for sys/timeb.h and utime.h
+27: Set z/OS linker flags
+28. Add PORT unix/configure parm [AD]
+ - Allows reuse by z/OS MVS build (under z/OS UNIX)
+
+Fixes:
+1. CF_BZ now has "-DBZ_NO_STDIO" to build correct bzip2 variation
+2. CF_BZ now contains "-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" if large files supported
+3. Customize unzip unix/unxcfg.h for time.h et al
+
+To Do:
+1. Ensure all Unicode/wchar bits and pieces work
+2. Emit CC with system-dependent ANSI build compiler name (gcc, c89, xlc) automatically
+ - Check system, compiler version
+3. Generation of man pages needs to be corrected
+
+
++-----------------------------------------------------------------------------+
+| Flag output |
++-----------------------------------------------------------------------------+
+--- On Fedora 14 Linux X84_64: GCC 4.5.1) ---
+For make -f unix/Makefile generic AES_WG=1 LZMA=1 IZ_BZIP2=bzip2 IZ_ZLIB=zlib
+
+New:
+[al@leeloo base]$ cat flags
+CC="cc" CF="-I. -DUNIX -O3 -DCRYPT_AES_WG -DUSE_LZMA -D_7ZIP_ST -DUSE_BZIP2 -DUSE_ZLIB -DLARGE_FILE_SUPPORT -DUIDGID_NOT_16BIT -DENABLE_ENTRY_TIMING -DHAVE_SYS_TIME_H -DUNICODE_SUPPORT -DUNICODE_WCHAR -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE -fno-builtin -DNO_STRCHR -DNO_STRRCHR -DNO_LCHMOD -DHAVE_DIRENT_H -DNO_PARAM_H -DHAVE_TERMIOS_H -D_MBCS -DUNAME_S='\"Linux\"' -DUNAME_V='\"#1 SMP Tue Aug 16 21:01:58 UTC 2011\"' -DUNAME_R='\"2.6.35.14-95.fc14.x86_64\"' -DUNAME_O='\"GNU/Linux\"' -DUNAME_M='\"x86_64\"' -DUNAME_P='\"x86_64\"'" CC_BZ="cc" CF_BZ="-I. -DUNIX -O3 -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" CPP="/usr/bin/cpp" AS="cc -c" AF="" LD="cc" LF1=" -L. -L." LF2="-s -laes -llzma -lbz2 -lz" AR="ar -cq" RANLIB="ranlib" LN="ln -s" RM="rm -f" PROD="." DEP_AS="" DEP_AES_WG="./libaes.a" DEP_LZMA="./liblzma.a" DEP_BZ="" DEP_Z="" MK_BZ="Makefile" OSDEP_C="unix/unix.c" OSDEP_H="unix/unxcfg.h" OSDEP_O="./unix.o" OSDEP_S="" PGMEXT="" DLLEXT=".so" BINDIR="/usr/local/bin" BINPERMS="755" MANEXT=".1" MANDIR="manl" MANPERMS="644"
+
+[al@leeloo base]$ cat flags_bz
+CC="cc" CFLAGS="-I. -DUNIX -O3 -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" AR="ar -cq" RANLIB="ranlib" RM="rm -f"
+
+Old:
+[al@leeloo orig]$ cat flags
+CC="cc" CF="-I. -DUNIX -O3 -DLARGE_FILE_SUPPORT -DUNICODE_SUPPORT -DUNICODE_WCHAR -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE -DNO_LCHMOD -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -D_MBCS -DUNAME_M='\"x86_64\"' -DUNAME_O='\"GNU/Linux\"' -DUNAME_P='\"x86_64\"' -DUNAME_R='\"2.6.35.14-95.fc14.x86_64\"' -DUNAME_S='\"Linux\"' -DUNAME_V='\"#1 SMP Tue Aug 16 21:01:58 UTC 2011\"'" CRCA_O="" AS="cc -c" LFLAGS1="" LF2="-s" CC_BZ="cc" CFLAGS_BZ=" -O3" IZ_BZIP2="" LIBBZ2="" LIB_AES_WG="" LIB_LZMA=""
+
+--- On AIX 6.1 (cc=cc:IBM XL C for AIX) ---
+For make -f unix/Makefile generic AES_WG=1 LZMA=1
+
+New:
+[q4xtwnb:/apps/eq00/infozip/unzip/6.10/unzip610c06/base]$cat flags
+CC="cc" CF="-I. -DUNIX -O3 -q64 -qlonglong -DCRYPT_AES_WG -DUSE_LZMA -D_7ZIP_ST -qlanglvl=ansi -DLARGE_FILE_SUPPORT -DUIDGID_NOT_16BIT -DENABLE_ENTRY_TIMING -DHAVE_SYS_TIME_H -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE -DNO_LCHMOD -DHAVE_DIRENT_H -DNO_PARAM_H -DHAVE_TERMIOS_H -DHAVE_MBSTR_H -D_MBCS -DUNAME_S='\"AIX\"' -DUNAME_V='\"6\"' -DUNAME_R='\"1\"' -DUNAME_M='\"00F64BF34C00\"' -DUNAME_P='\"powerpc\"'" CC_BZ="cc" CF_BZ="-I. -DUNIX -O3 -q64 -qlonglong -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" CPP="/usr/bin/cpp" AS="cc -c" AF="" LD="cc" LF1=" -L. -L." LF2="-s -q64 -laes -llzma" AR="ar -cq -X64" RANLIB="ranlib" LN="ln -s" RM="rm -f" PROD="." DEP_AS="" LIB_AES_WG="libaes.a" LIB_LZMA="liblzma.a" LIB_BZ="" LIB_Z="" MK_BZ="Makefile" OSDEP_C="unix/unix.c" OSDEP_H="unix/unxcfg.h" OSDEP_O="./unix.o" OSDEP_S="" PGMEXT="" DLLEXT=".so" BINDIR="/usr/local/bin" BINPERMS="755" MANEXT=".1" MANDIR="manl" MANPERMS="644"
+
+[q4xtwnb:/apps/eq00/infozip/unzip/6.10/unzip610c06/base]$cat flags_bz
+CC="cc" CFLAGS="-I. -DUNIX -O3 -q64 -qlonglong -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" AR="ar -cq -X64" RANLIB="ranlib" RM="rm -f"
+
+--- On AIX 6.1 (cc=gcc:GCC 4.2.0)
+For make -f unix/Makefile generic AES_WG=1 LZMA=1
+
+New:
+[q4xtwnb:/apps/eq00/infozip/unzip/6.10/unzip610c06/base]$cat flags
+CC="gcc" CF="-I. -DUNIX -O3 -DCRYPT_AES_WG -DUSE_LZMA -D_7ZIP_ST -DLARGE_FILE_SUPPORT -DUIDGID_NOT_16BIT -DENABLE_ENTRY_TIMING -DHAVE_SYS_TIME_H -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE -fno-builtin -DNO_STRCHR -DNO_STRRCHR -DNO_LCHMOD -DHAVE_DIRENT_H -DNO_PARAM_H -DHAVE_TERMIOS_H -DHAVE_MBSTR_H -D_MBCS -DMBSCHR=mbschr -DMBSRCHR=mbsrchr -DUNAME_S='\"AIX\"' -DUNAME_V='\"6\"' -DUNAME_R='\"1\"' -DUNAME_M='\"00F64BF34C00\"' -DUNAME_P='\"powerpc\"'" CC_BZ="gcc" CF_BZ="-I. -DUNIX -O3 -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" CPP="/usr/bin/cpp" AS="gcc -c" AF="" LD="gcc" LF1=" -L. -L." LF2="-s -laes -llzma" AR="ar -cq" RANLIB="ranlib" LN="ln -s" RM="rm -f" PROD="." DEP_AS="" LIB_AES_WG="libaes.a" LIB_LZMA="liblzma.a" LIB_BZ="" LIB_Z="" MK_BZ="Makefile" OSDEP_C="unix/unix.c" OSDEP_H="unix/unxcfg.h" OSDEP_O="./unix.o" OSDEP_S="" PGMEXT="" DLLEXT=".so" BINDIR="/usr/local/bin" BINPERMS="755" MANEXT=".1" MANDIR="manl" MANPERMS="644"
+
+[q4xtwnb:/apps/eq00/infozip/unzip/6.10/unzip610c06/base]$cat flags_bz
+CC="gcc" CFLAGS="-I. -DUNIX -O3 -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" AR="ar -cq" RANLIB="ranlib" RM="rm -f"
+
+Old:
+[q4xtwnb:/apps/eq00/infozip/unzip/6.10/unzip610c06/orig]$cat flags
+CC="gcc" CF="-I. -DUNIX -O3 -DLARGE_FILE_SUPPORT -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE -DNO_LCHMOD -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -DHAVE_MBSTR_H -D_MBCS -DMBSCHR=mbschr -DMBSRCHR=mbsrchr -DUNAME_M='\"00F64BF34C00\"' -DUNAME_P='\"powerpc\"' -DUNAME_R='\"1\"' -DUNAME_S='\"AIX\"' -DUNAME_V='\"6\"'" CRCA_O="" AS="gcc -c" LFLAGS1="" LF2="-s" CC_BZ="gcc" CFLAGS_BZ=" -O3" IZ_BZIP2="" LIBBZ2="" LIB_AES_WG="" LIB_LZMA=""
+
+--- On z/OS 1.12 (cc=c89:IBM z/OS XL C)
+For make -f unix/Makefile generic AES_WG=1 LZMA=1
+
+New:
+(Q4XTWNB:/u/q4xtwnb/infozip/unzip/6.10/unzip610c06/base)$cat flags
+CC="c89" CF="-I. -DUNIX -O3 -Wc,longlong,'langlvl(extended)',checkout,'flag(i)',inline -Wc,'suppress(ccn3389,ccn3374,ccn3495,ccn3409,ccn3469,ccn3457)' -DZOS_UNIX -DEBCDIC -DSYSV -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT -D_XOPEN_SOURCE_EXTENDED=1 -DCRYPT_AES_WG -DUSE_LZMA -D_7ZIP_ST -DLARGE_FILE_SUPPORT -DUIDGID_NOT_16BIT -DENABLE_ENTRY_TIMING -DHAVE_SYS_TIME_H -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE -DNO_LCHMOD -DHAVE_DIRENT_H -DNO_PARAM_H -DHAVE_TERMIOS_H -DHAVE_MBSTR_H -D_MBCS -DUNAME_S='\"z/OS\"' -DUNAME_V='\"01\"' -DUNAME_R='\"12.00\"' -DUNAME_M='\"2817\"'" CC_BZ="cc" CF_BZ="-I. -DUNIX -O3 -Wc,longlong,'langlvl(extended)',checkout,'flag(i)',inline -Wc,'suppress(ccn3389,ccn3374,ccn3495,ccn3409,ccn3469,ccn3457)' -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" CPP="c89 -E" AS="cc -c" AF="" LD="c89" LF1="-Wl,EDIT=NO -L. -L." LF2=" -laes -llzma" AR="ar -cq" RANLIB="echo" LN="ln -s" RM="rm -f" PROD="." DEP_AS="" LIB_AES_WG="libaes.a" LIB_LZMA="liblzma.a" LIB_BZ="" LIB_Z="" MK_BZ="Makefile" OSDEP_C="unix/unix.c" OSDEP_H="unix/unxcfg.h" OSDEP_O="./unix.o" OSDEP_S="" PGMEXT="" DLLEXT=".so" BINDIR="/usr/local/bin" BINPERMS="755" MANEXT=".1" MANDIR="manl" MANPERMS="644"
+
+(Q4XTWNB:/u/q4xtwnb/infozip/unzip/6.10/unzip610c06/base)$cat flags_bz
+CC="cc" CFLAGS="-I. -DUNIX -O3 -Wc,longlong,'langlvl(extended)',checkout,'flag(i)',inline -Wc,'suppress(ccn3389,ccn3374,ccn3495,ccn3409,ccn3469,ccn3457)' -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES" AR="ar -cq" RANLIB="echo" RM="rm -f"
--- /dev/null
+:
+#!/bin/sh -x
+# The above ":" is necessary on some buggy systems.
+
+#==============================================================================
+# unix/configure: Detect feature support and pass that information to Makefile.
+# - For UnZip, UnZipSFX, fUnZip and ZipInfo Revised: 2013-11-29
+#
+# Copyright (c) 2004-2013 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. If,
+# for some reason, all these files are missing, the Info-ZIP license may
+# also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#==============================================================================
+
+###############################################################################
+# This file was renamed from "unix/configure" to "unix/configure_old".
+# Similarly, "unix/Makefile" was renamed to "unix/Makefile_old".
+# Please keep this in mind when reading the comments and instructions below.
+###############################################################################
+
+#==============================================================================
+# Purpose:
+#
+# This unix/configure script is invoked by unix/Makefile for generic targets
+# to probe the system, the compiler, and other parts of the environment to
+# determine values for system-dependent "make" macros. It generates the
+# files "$PROD/flags" and "$PROD/flags_bz" that hold the flags used by
+# unix/Makefile to enable or disable features based on available support for
+# them.
+#
+# This script checks for the build and manual directories, and will try to
+# create them if necessary.
+#
+# This shell script is typically invoked by unix/Makefile (via sh) rather than
+# being executed directly by the user.
+#
+# To build UnZip automatically using this file, type:
+# make -f unix/Makefile generic
+# If this fails, then type "make list" to get a list of specific targets.
+# However, the specific targets tend to be out of date and may not enable all
+# available features. In many cases, the specific targets may not even work
+# anymore.
+#
+#
+# Parameters:
+#
+# Setting parameters allows enabling optional features (such as optional
+# compression methods), disabling features, and pointing the script to
+# available libraries.
+#
+# Parameters are usually provided by the Makefile and are specified by the
+# user on the initial "make" invocation. Note that some parameters take
+# values, in the form "var=value", where var is one of the parameters listed
+# below.
+#
+# In most cases, setting a parameter to 1 enables a feature and to 0 (or
+# omitting the parameter) disables it.
+#
+#
+# Environment variables:
+#
+# Compilation parameters can also be set in the environment.
+# export "var=value" for var names like:
+# LOCAL_UNZIP
+#
+#
+# UnZip Ports:
+#
+# This configure script support a number of non-unix UnZip ports, where UnZip
+# is built is under Unix (or a Unix work-alike), but the resulting UnZip
+# program may be for another system or execution environment. This script
+# will be invoked from either unix/Makefile, or from a port-specific Makefile.
+# The port may be explicitly identified by the PORT parameter, or implicitly
+# detected by compiler configuration tests.
+#
+# Supported ports include:
+# msdos : DOS port built using the DJGPP native or cross-compiler
+# os2 : OS/2 port
+# qdos : Sinclair Q-DOS port built using a gcc cross-compiler
+# zos : z/OS MVS port built under z/OS UNIX
+# zvm : z/VM CMS port built under z/VM UNIX
+#
+#==============================================================================
+# Parameter and Environment variables supported:
+#
+# Build utility configuration:
+# PROD - Build directory root (default: .)
+# PORT - Port name (default: unix)
+#
+# CC - C Compiler program name (for core components)
+# (default: cc)
+# CC_BZ - C Compiler program name (for BZIP2 components)
+# (default: cc)
+# CPP - C Preprocessor program name (default: $CC -E)
+# AS - Assembler program name (default: $CC -c)
+# LD - Linker program name (default: $CC)
+# RANLIB - Archive index program name (default: ranlib)
+#
+# CFLAGS - C Compiler flag initial values
+# CFLAGS_OPT - C Compiler optimization option override (non-null)
+# LOCAL_UNZIP - C compiler flag user override values
+#
+# AFLAGS - Assembler flag initial values
+#
+# LFLAGS1 - Linker flag initial values (before output file spec)
+# LFLAGS2 - Linker flag initial values (after output file spec)
+#
+# OSDEP_H - OS-dependent C header file names
+# OSDEP_OCF - OS-dependent C object file names, funzip
+# OSDEP_OCS - OS-dependent C object file names, unzipsfx
+# OSDEP_OCU - OS-dependent C object file names, unzip
+# OSDEP_OS - OS-dependent Assembler object file names
+#
+# PGMEXT - Binary program file extension
+# DLLEXT - Binary program DLL (.so) file extension
+#
+# LIST - Enable compile/linker listing generation
+#
+# UnZip optional feature configuration:
+# AES_WG - Enable AES encryption (WinZip/Gladman)
+# ICONV - Enable ISO/OEM character conversion using iconv.
+# IZ_BZIP2 - Enable BZIP2 compression
+# IZ_ZLIB - Use ZLIB for deflate compression
+# LIBUNZIP - Build UnZip object library
+# LZMA - Enable LZMA compression
+# PPMD - Enable PPMd compression
+#
+#==============================================================================
+# Build utility generated configuration flags:
+#
+# - Generated based on build utility program, platform and features selected
+# - Generated flags are appended to initial user-specified value
+# - LOCAL_UNZIP value is appended to final CF and CF_BZ values
+#
+# CC - C Compiler program name (for core components)
+# CC_BZ - C Compiler program name (for BZIP2 components)
+# CF - C Compiler flag values (for core components)
+# CF_BZ - C Compiler flag values (for BZIP2 components)
+# CPP - C Preprocessor program name
+# AS - Assembler program name
+# AF - Assembler flag initial values
+# LD - Linker program name
+# LF1 - Linker flags (before output file spec)
+# LF2 - Linker flags (after output file spec)
+# AR - Archive program name (and options)
+# RANLIB - Archive index program name
+# LN - File link program name (and options)
+# PROD - Root build directory
+# PORT - Port name build control
+# IZ_BZIP2 - BZIP2 compression build directory
+# IZ_ZLIB - ZLIB compression build directory
+# LIB_AES_WG - AES (WinZip/Gladman) encryption build dependencies
+# LIB_BZ - BZIP2 compression build dependencies
+# LIB_LZMA - LZMA compression build dependencies
+# LIB_PPMD - PPMd compression build dependencies
+# LIB_UNZIP - UnZip object library
+# LIB_Z - ZLIB compression build dependencies
+# MK_BZ - BZIP2 compression build makefile
+# OSDEP_H - OS-dependent C header file names
+# OSDEP_OCF - OS-dependent C object file names, funzip
+# OSDEP_OCS - OS-dependent C object file names, unzipsfx
+# OSDEP_OCU - OS-dependent C object file names, unzip
+# OSDEP_OS - OS-dependent Assembler object file names
+# PGMEXT - Binary program file extension
+# DLLEXT - Binary program DLL (.so) file extension
+# BINDIR - Binary program installation directory
+# BINPERMS - Binary program installation file permissions
+# MANEXT - Manual page file extension
+# MANDIR - Manual page installation directory
+# MANPERMS - Manual page installation file permissions
+#
+#==============================================================================
+
+trap "rm -f conftest* core a.out; exit 1" 1 2 3 15
+
+#==============================================================================
+# Evaluate command-line "make"-macro-like var=value expressions.
+#==============================================================================
+echo ''
+echo 'Generating system-dependent flags...'
+
+# Evaluate only variables in this list. Complain about others, but continue.
+valid_vars1='|AES_WG|AFLAGS|AS|CC|CC_BZ|CFLAGS|CFLAGS_OPT|CPP|DLLEXT|ICONV'
+valid_vars2='|IZ_BZIP2|IZ_ZLIB|LD|LFLAGS1|LFLAGS2|LIST|LOCAL_UNZIP|LZMA'
+valid_vars3='|OSDEP_H|OSDEP_OCF|OSDEP_OCS|OSDEP_OCU|OSDEP_OS'
+valid_vars4='|PGMEXT|PPMD|PROD|RANLIB|'
+valid_vars="${valid_vars1}${valid_vars2}${valid_vars3}${valid_vars4}"
+
+argc=$#
+while [ ${argc} -gt 0 ]; do
+ var=` echo "${1}" | sed -e 's/=.*//' `
+ val=` echo "${1}" | sed -e 's/^[^=]*=//' `
+ if echo "${valid_vars}" | grep "|${var}|" >/dev/null 2>&1 ; then
+ eval ${1}
+ else
+ echo " Unrecognized variable name \"${var}\" in \"${1}\"."
+ fi
+ shift
+ argc=` expr ${argc} - 1 `
+done
+
+#==============================================================================
+# Build utility names, command-line option variables, default values.
+#==============================================================================
+CC=${CC:-cc} # C compiler name (core components)
+CC_BZ=${CC_BZ:-${CC}} # C compiler name (BZIP2 components)
+CC_LIST='' # C compiler name, if LIST enabled
+CFLAGS=${CFLAGS:-}' -I.' # C compiler flags (core components)
+CFLAGS_BZ=${CFLAGS_BZ:-}' -I' # C cmplr flags (BZIP2 components)
+CFLAGS_OPT=${CFLAGS_OPT:-} # C cmplr optimze (and list) options
+CFLAGS_USR=${LOCAL_UNZIP:-} # C compiler user override options
+
+CPP=${CPP:-"${CC} -E"} # C preprocessor name
+
+AS=${AS:-"${CC}"} # Assembler name (core components)
+AFLAGS=${AFLAGS:-} # Assembler flags
+
+LD=${LD:-"${CC}"} # Linker name
+LD_LIST='' # Linker name, if LIST enabled
+LFLAGS1=${LFLAGS1:-} # Linker options, part 1
+LFLAGS2=${LFLAGS2:--s} # Linker options, part 2
+
+CC_TST=$CC # C cmplr/options for feature tests
+BIF_TST='' # C builtin fnctn feature test flags
+CFLAGS_TST='' # C cmplr feature test optns (core)
+CFLAGS_TST_BZ='' # C cmplr feature test optns (BZIP2)
+
+CPP_TST=$CPP # C preprocessor for feature tests
+
+AR='ar cq' # Object archive prgrm name/options
+AR_BZ='ar' # (BZIP2)
+RANLIB=${RANLIB:-ranlib} # Object archive index utility
+
+LN='ln -s' # Create symbolic link
+RM='rm -f' # Remove file(s)
+
+# Miscellaneous command macros.
+MKDIR='mkdir' # Create directory
+
+# Build Directories
+PROD=${PROD:-.} # Root
+PROD_MAN="${PROD}/manout" # Manuals
+
+# Build Controls
+PORT=${PORT:-} # UnZip port name
+ # - Configure tests may set if null
+ # - Default is "unix" (set below).
+
+PORT_SPEC='' # Port specification method
+ # - Explicit ('E') via PORT=port
+ # Implicit ('I') via config test
+
+AES_WG=${AES_WG:-} # AES (WinZip/Gladman) encryption
+ICONV=${ICONV:-} # ISO/OEM (iconv) conversion
+IZ_BZIP2=${IZ_BZIP2:-} # BZIP2 compression
+IZ_ZLIB=${IZ_ZLIB:-} # ZLIB compression
+LZMA=${LZMA:-} # LZMA compression
+PPMD=${PPMD:-} # PPMd compression
+
+# Generated Build Dependencies for "make".
+# These contain an object library name, if the feature is enabled.
+LIB_AES_WG='' # AES (WinZip/Gladman) encryption
+LIB_BZ='' # BZIP2 compression
+LIB_LZMA='' # LZMA compression
+LIB_PPMD='' # PPMd compression
+LIB_UNZIP='' # UnZip object library
+LIB_Z='' # ZLIB compression
+
+# Build makefiles.
+MK_BZ='Makefile' # BZIP2 compression
+
+# OS-dependent files.
+# Defaults to unix files, customized based on PORT and tests.
+OSDEP_H=${OSDEP_H:-'unix/unxcfg.h'} # C header file names
+OSDEP_OCF=${OSDEP_OC:-} # C object file names, funzip
+OSDEP_OCS=${OSDEP_OC:-"${PROD}/unix.o"} # C object file names, unzipsfx
+OSDEP_OCU=${OSDEP_OC:-"${PROD}/unix.o"} # C object file names, unzip
+OSDEP_OS=${OSDEP_OS:-} # Assembler object file names
+
+# OS-dependent file extensions.
+# Defaults to unix files, customized based on PORT and tests.
+PGMEXT=${PGMEXT:-} # Program file extension
+DLLEXT=${DLLEXT:-'.so'} # DLL (.so) file extension
+MANEXT=${MANEXT:-'.l'} # man page file extension
+
+# OS-dependent installation directories.
+BINDIR=${BINDIR:-"$HOME/bin"} # Where to install executables
+MANDIR=${MANDIR:-'manl'} # Where to install man pages
+
+# OS-dependent installation file permissions.
+BINPERMS=${BINPERMS:-'755'} # Executable programs
+MANPERMS=${MANPERMS:-'644'} # man pages
+
+# System identification (raw).
+UNAME_S='' # System/kernel name
+UNAME_V='' # System/kernel major version
+UNAME_R='' # System/kernel minor version
+UNAME_O='' # Operating system
+UNAME_M='' # Machine hardware name
+UNAME_P='' # Processor name
+UNAME_X='' # Expanded system info (not saved)
+SIZER_V='' # Tru64 system/kernel info
+
+
+#==============================================================================
+# Check for build root directory. Create if required.
+#==============================================================================
+echo "Check build root directory: (${PROD})"
+if [ -d "${PROD}" ]; then
+ echo "-- Build root directory OK."
+elif [ -f "${PROD}" ]; then
+ echo "^^ Directory name exists as an ordinary file. Unable to build."
+ exit 1
+else
+ echo "-- Creating build root directory."
+ ${MKDIR} ${PROD}
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo ''
+ echo "^^ Directory creation failed (${status})."
+ exit $status
+ fi
+fi
+
+
+#==============================================================================
+# Check for build manuals directory. Create if required.
+#==============================================================================
+echo "Check build directory for manuals: (${PROD_MAN})"
+if [ -d "${PROD_MAN}" ]; then
+ echo "-- Build manuals directory is OK."
+elif [ -f "${PROD_MAN}" ]; then
+ echo "^^ Directory name exists as an ordinary file. Unable to build."
+ exit 1
+else
+ echo "-- Creating build manuals directory."
+ ${MKDIR} ${PROD_MAN}
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo ''
+ echo "^^ Directory creation failed (${status})."
+ exit $status
+ fi
+fi
+
+
+#==============================================================================
+# Assign default PORT. Note if explicit or implicit specification.
+#==============================================================================
+if [ -z "${PORT}" ]; then
+ PORT='unix'
+ PORT_SPEC='I'
+else
+ PORT_SPEC='E'
+fi
+
+
+#==============================================================================
+# Query the system information.
+#==============================================================================
+echo "Query for system identification..."
+UNAME_S=` uname -s 2>/dev/null `
+case "${UNAME_S}" in
+ 'OS/390' )
+ # z/OS kernel still announces itself as OS/390 (for compatibility)
+ # - Must request for current product info via -I
+ UNAME_S=` uname -Is 2>/dev/null `
+ UNAME_V=` uname -Iv 2>/dev/null `
+ UNAME_R=` uname -Ir 2>/dev/null `
+ UNAME_M=` uname -Im 2>/dev/null `
+ ;;
+
+ * )
+ # All others use standard uname query
+ UNAME_V=` uname -v 2>/dev/null `
+ UNAME_R=` uname -r 2>/dev/null `
+ UNAME_O=` uname -o 2>/dev/null `
+ UNAME_M=` uname -m 2>/dev/null `
+ UNAME_P=` uname -p 2>/dev/null `
+ UNAME_X=` uname -X 2>/dev/null `
+
+ # Use sizer to capture more system configuration details
+ # - Tru64 UNIX, and relatives
+ if [ -f /usr/sbin/sizer ]; then
+ SIZER_V=` /usr/sbin/sizer -v 2>/dev/null | \
+ sed -e 's/^[^ ]* [^ ]* [^ ]* \([^ ]*\) .*/\1/' `
+ fi
+ ;;
+esac
+
+echo " OS name: ${UNAME_S}"
+
+
+#==============================================================================
+# Validate basic compiler and linker operation.
+#==============================================================================
+echo "Check C compiler+linker operation..."
+cat > conftest.c << _EOF_
+#include <stdio.h>
+int main()
+{
+ printf( " Ok\n");
+ return 0;
+}
+_EOF_
+$CC $CFLAGS -o conftest conftest.c
+status=$?
+if [ $status -ne 0 ]; then
+ echo ''
+ echo "^^ C compiler+linker \"${CC}\" does not work as expected."
+ echo "^^ Failing command was: $CC $CFLAGS -o conftest conftest.c"
+ exit $status
+else
+ ./conftest
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo "^^ Test executable exited with bad status: ${status}."
+ exit $status
+ fi
+fi
+
+
+#==============================================================================
+# Perform compile- and link-based configuration discovery tests.
+#==============================================================================
+
+#------------------------------------------------------------------------------
+# A) Determine C compiler type, set appropriate compile and linker options.
+#------------------------------------------------------------------------------
+
+# Each compiler is recognized using standard pre-defined preprocessor symbols.
+#
+# The options set in for each compiler includes the basic options required for
+# successful compilation of UnZip, as well as the options for standard code
+# optimization.
+
+echo 'Check C compiler type (optimization and listing options)...'
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Sun C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __SUNPRO_C
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-xO3'
+ echo " Sun C ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Tru64 DEC/Compaq/HP C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __DECC
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " DEC C ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # HP-UX HP C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifdef __GNUC__
+ bad code
+#endif
+#ifndef __hpux
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # HP-UX, not GCC. Lame bundled or real ANSI compiler?
+ CFLAGS_OPT_TRY="+O3 +Onolimit"
+ $CC $CFLAGS $CFLAGS_OPT_TRY -c conftest.c 2>&1 | \
+ grep '(Bundled)' >/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ CFLAGS_OPT="${CFLAGS_OPT_TRY}"
+ echo " HP-UX ANSI C ($CFLAGS_OPT)"
+ else
+ CFLAGS_OPT=' ' #Blank = Lame bundled compiler recognized.
+ echo ' HP-UX Bundled C (no opt)'
+ fi
+# Note: Your HP-UX system may require addition of -DNO_MKSTEMP
+# - In HP-UX versions below 11.31, writes to the temporary
+# file may fail. Refer to INSTALL for details.
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # MinGW 64-bit C?
+ # MinGW also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __MINGW64__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ PORT='mingw64'
+ echo " MinGW 64 ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # MinGW 32-bit C?
+ # MinGW also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __MINGW32__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ PORT='mingw32'
+ echo " MinGW 32 ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # LLVM-based C?
+ # LLVM also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __llvm__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # LLVM-based C. Determine specific compiler.
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # LLVM Clang?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __clang__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " LLVM Clang ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # LLVM Apple GCC?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __APPLE_CC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " LLVM Apple GCC ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # Default to LLVM GCC.
+ CFLAGS_OPT='-O3'
+ echo " LLVM GCC ($CFLAGS_OPT)"
+ fi
+
+ # Special Mac OS X shared library "ld" option?
+ if [ "${UNAME_S}" = 'Darwin' ]; then
+ OSDEP_H="${OSDEP_H} unix/macosx.h"
+
+ # "ld64: warning: option -s is obsolete and being ignored"
+ if [ "${LFLAGS2}" = '-s' ]; then
+ LFLAGS2=''
+ fi
+
+ lflags2_try='-Wl,-search_paths_first'
+ $CC $CFLAGS ${lflags2_try} conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LFLAGS2="${LFLAGS2} ${lflags2_try}"
+ fi
+ rm -f conftest
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Portable C Compiler (PCC)?
+ # PCC also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __PCC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O'
+ echo " Portable C Compiler (PCC) ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # EKOPath C?
+ # EKOPath also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __PATHCC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " EKOPAth C ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Intel C?
+ # Intel also defines __GNUC__, so must be tested before GCC.
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __INTEL_COMPILER
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " Intel C ($CFLAGS_OPT)"
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # GNU C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __GNUC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # GNU C. Check for special-case platforms.
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # GNU C for MAC OS X (Darwin)?
+ cat > conftest.c << _EOF_
+int main()
+{
+#if !(defined(__APPLE__) || defined(__darwin__))
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ OSDEP_H="${OSDEP_H} unix/macosx.h"
+
+ # "ld64: warning: option -s is obsolete and being ignored"
+ if [ "${LFLAGS2}" = '-s' ]; then
+ LFLAGS2=''
+ fi
+
+ # Special Mac OS X shared library "ld" option?
+ lflags2_try='-Wl,-search_paths_first'
+ $CC $CFLAGS ${lflags2_try} conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LFLAGS2="${LFLAGS2} ${lflags2_try}"
+ fi
+ rm -f conftest
+
+ echo " GNU C for Mac OS X Darwin ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # GNU C for AIX?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef _AIX
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC_TST="${CC_TST} -D_ALL_SOURCE"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_OPT='-O3'
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ echo " GNU C for AIX ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # Other GNU C
+ CFLAGS_OPT='-O3'
+ echo " GNU C ($CFLAGS_OPT)"
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __IBMC__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # IBM C. Determine platform.
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM XL C for Linux?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __TOS_LINUX__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ C_PARMS="-q64 -qlonglong -qlibansi -qnoignerrno"
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC='c89'
+ LD='c89'
+ CC_TST="c89 ${C_PARMS} -D_ALL_SOURCE"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_OPT="-O3 ${C_PARMS}"
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ LFLAGS2="${LFLAGS2} -q64"
+ AR='ar -cq -X64'
+ AR_BZ='ar -X64'
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CFLAGS_OPT="${CFLAGS_OPT} -qlist -qsource -qshowinc -qreport"
+ fi
+ echo " IBM XL C for Linux ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM XL C for AIX?
+ cat > conftest.c << _EOF_
+int main()
+{
+#if !(defined(_AIX) && defined(__PPC__))
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ C_PARMS="-q64 -qlonglong -qlibansi -qnoignerrno"
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC='c89'
+ LD='c89'
+ CC_TST="c89 ${C_PARMS} -D_ALL_SOURCE"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CFLAGS_OPT="-O3 ${C_PARMS}"
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ LFLAGS2="${LFLAGS2} -q64"
+ AR='ar -cq -X64'
+ AR_BZ='ar -X64'
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CFLAGS_OPT="${CFLAGS_OPT} -qlist -qsource -qshowinc -qreport"
+ fi
+ echo " IBM XL C for AIX ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM z/OS XL C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __MVS__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ C_PARMS="-Wc,longlong,libansi,noignerrno"
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # Use c89 to get ANSI
+ # - Avoid xlc (terminates with sigkill on compile error)
+ CC='c89'
+ LD='c89'
+ CC_TST="c89 ${C_PARMS}"
+ CFLAGS_OPT="-O3 ${C_PARMS} -Wc,'langlvl(extended)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,checkout,'flag(i)',inline"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3389,ccn3374,ccn3413)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3495,ccn3409,ccn3469)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3457)'"
+ LFLAGS1='-Wl,EDIT=NO'
+ LFLAGS2=''
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CC_LIST="sh ./zos/zcc c89" # Script does listing capture
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,list,source,showinc,inlrpt"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,aggr,expmac"
+ LD_LIST="sh ./zos/zld c89" # Script does listing capture
+ LFLAGS1="${LFLAGS1} -Wl,map,xref"
+ fi
+ #FIX_ME[AD]: Switch to 64-bit after 32-bit is fully debugged
+ #if echo "${LOCAL_UNZIP}" | grep -i ILP32 >/dev/null 2>&1 ; then
+ # :
+ #else # Default to 64-bit build
+ # CC_TST="${CC_TST} -Wc,lp64 -Wl,lp64"
+ # CFLAGS_OPT="${CFLAGS_OPT} -Wc,lp64"
+ # LFLAGS1="${LFLAGS1} -Wl,lp64"
+ #fi
+ CC_TST="${CC_TST} -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE_EXTENDED=1"
+ if [ "${PORT}" = 'unix' ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DZOS_UNIX"
+ fi
+ # Oldest supported z/OS release
+ CFLAGS_TST="${CFLAGS_TST} -Wc,'target(zOSV1R10)'"
+ CFLAGS_TST="${CFLAGS_TST} -DEBCDIC -DSYSV"
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE_EXTENDED=1"
+ RANLIB="echo" # z/OS UNIX has no ranlib utility
+ echo " IBM z/OS XL C ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM XL C for z/VM?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __VM__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ C_PARMS="-Wc,longlong,libansi,noignerrno"
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC='c89'
+ LD='c89'
+ CC_TST="c89 ${C_PARMS}"
+ CFLAGS_OPT="-O3 ${C_PARMS} -Wc,'langlvl(extended)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,checkout,'flag(i)',inline"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3389,ccn3374,ccn3413)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3495,ccn3409,ccn3469)'"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,'suppress(ccn3457)'"
+ LFLAGS1='-Wl,EDIT=NO'
+ LFLAGS2=''
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CC_LIST="sh ./zos/zcc c89" # Script does listing capture
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,list,source,showinc,inlrpt"
+ CFLAGS_OPT="${CFLAGS_OPT} -Wc,aggr,expmac"
+ LD_LIST="sh ./zos/zld c89" # Script does listing capture
+ LFLAGS1="${LFLAGS1} -Wl,map,xref"
+ fi
+ CC_TST="${CC_TST} -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT"
+ CC_TST="${CC_TST} -D_XOPEN_SOURCE_EXTENDED=1"
+ if [ "${PORT}" = 'unix' ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DZOS_UNIX"
+ fi
+ CFLAGS_TST="${CFLAGS_TST} -DEBCDIC -DSYSV"
+ CFLAGS_TST="${CFLAGS_TST} -D_ALL_SOURCE -D_OPEN_SYS_TIMED_EXT"
+ CFLAGS_TST="${CFLAGS_TST} -D_XOPEN_SOURCE_EXTENDED=1"
+ RANLIB="echo" # z/VM UNIX has no ranlib utility
+ echo " IBM XL C for z/VM ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM ILE C for iSeries?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __OS400__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC='c89'
+ LD='c89'
+ CC_TST='c89'
+ CFLAGS_OPT='-O3 -Wc,inline'
+ if [ -n "${LIST}" ]; then # Listings enabled?
+ CFLAGS_OPT="${CFLAGS_OPT} -qlist -qsource -qshowinc -qreport"
+ fi
+ echo " IBM ILE C for iSeries ($CFLAGS_OPT)"
+ fi
+ fi
+
+ if [ -z "${CFLAGS_OPT}" ]; then
+ # IBM XL C for other platform.
+ CFLAGS_OPT='-O3'
+ echo " IBM XL C ($CFLAGS_OPT)"
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # DJGPP C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __DJGPP__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " DJGPP C ($CFLAGS_OPT)"
+ # Set port values, if defaulted.
+ if [ -z "${PORT}" ]; then
+ PORT='msdos'
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ # Cygnus C?
+ cat > conftest.c << _EOF_
+int main()
+{
+#ifndef __CYGWIN__
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_OPT='-O3'
+ echo " Cygwin C ($CFLAGS_OPT)"
+ # Set port values, if defaulted.
+ if [ -z "${PORT}" ]; then
+ PORT='msdos'
+ fi
+ fi
+fi
+
+if [ -z "${CFLAGS_OPT}" ]; then
+ CFLAGS_OPT='-O'
+ echo " Other-unknown C ($CFLAGS_OPT)"
+fi
+
+if [ "${CC}" != "${CC_TST}" ]; then
+ echo " Feature test compiler updated (${CC_TST})"
+fi
+
+#------------------------------------------------------------------------------
+# B) Finalize specific customizations for target port.
+#------------------------------------------------------------------------------
+if [ "${PORT}" = "unix" ]; then
+ echo "Standard Unix target."
+ CFLAGS="${CFLAGS} -DUNIX"
+ CFLAGS_BZ="${CFLAGS_BZ} -DUNIX"
+else
+ echo "Set build configuration for target \"${PORT}\" port."
+ case "${PORT}" in
+ unix )
+ # UNIX values set in defaults, customized based on tests.
+ ;;
+
+ mingw* )
+ CFLAGS="${CFLAGS} -DWIN32"
+ CFLAGS_BZ="${CFLAGS_BZ} -D_WIN32"
+ OSDEP_H='win32/nt.h win32/rsxntwin.h win32/w32cfg.h'
+ OSDEP_OCF="${PROD}/win32.o ${PROD}/win32i64.o"
+ OSDEP_OCS="${PROD}/nt.o ${PROD}/win32.o ${PROD}/win32i64.o"
+ OSDEP_OCU="${PROD}/nt.o ${PROD}/win32.o ${PROD}/win32i64.o"
+ OSDEP_OS=''
+ PGMEXT='.exe'
+ DLLEXT='.dll'
+ ;;
+
+ msdos )
+ CFLAGS="${CFLAGS} -DMSDOS"
+ CFLAGS_BZ="${CFLAGS_BZ} -DMSDOS"
+ OSDEP_H='msdos/doscfg.h'
+ OSDEP_OCF="${PROD}/msdos.o"
+ OSDEP_OCS="${PROD}/msdos.o"
+ OSDEP_OCU="${PROD}/msdos.o"
+ OSDEP_OS=''
+ PGMEXT='.EXE'
+ DLLEXT='.DLL'
+ ;;
+
+ os2 )
+ CFLAGS="${CFLAGS} -DOS2"
+ CFLAGS_BZ="${CFLAGS_BZ} -DOS2"
+ OSDEP_H='os2/os2acl.h os2/os2cfg.h os2/os2data.h'
+ OSDEP_OCF="${PROD}/os2.o"
+ OSDEP_OCS="${PROD}/os2.o"
+ OSDEP_OCU="${PROD}/os2.o"
+ OSDEP_OS=''
+ PGMEXT='.EXE'
+ DLLEXT='.DLL'
+ ;;
+
+ qdos )
+ CFLAGS="${CFLAGS} -DQDOS"
+ CFLAGS_BZ="${CFLAGS_BZ} -DQDOS"
+ OSDEP_H='qdos/izqdos.h'
+ OSDEP_OCF="${PROD}/qdos.o ${PROD}/qfileio.o"
+ OSDEP_OCS="${PROD}/qdos.o ${PROD}/qfileio.o"
+ OSDEP_OCU="${PROD}/qdos.o ${PROD}/qfileio.o"
+ OSDEP_OS=''
+ PGMEXT=''
+ DLLEXT=''
+ ;;
+
+ zos )
+ CFLAGS="${CFLAGS} -DMVS"
+ CFLAGS_BZ="${CFLAGS_BZ} -DMVS"
+ OSDEP_H='zos/vmmvs.h'
+ OSDEP_OCF="${PROD}/vmmvs.o"
+ OSDEP_OCS="${PROD}/vmmvs.o"
+ OSDEP_OCU="${PROD}/vmmvs.o"
+ OSDEP_OS=''
+ PGMEXT=''
+ DLLEXT=''
+ ;;
+
+ zvm )
+ CFLAGS="${CFLAGS} -DVM_CMS"
+ CFLAGS_BZ="${CFLAGS_BZ} -DVM_CMS"
+ OSDEP_H='zvm/cstat.h zos/vmmvs.h'
+ OSDEP_OCF="${PROD}/vmmvs.o"
+ OSDEP_OCS="${PROD}/vmmvs.o"
+ OSDEP_OCU="${PROD}/vmmvs.o"
+ OSDEP_OS=''
+ PGMEXT=''
+ DLLEXT=''
+ ;;
+
+ * )
+ echo "^^ UnZip port not recognized. Unable to build."
+ exit 1
+ ;;
+ esac
+fi
+
+#------------------------------------------------------------------------------
+# C) Determine C preprocessor type.
+#------------------------------------------------------------------------------
+echo 'Check C preprocessor type...'
+case "${UNAME_S}" in
+ 'z/OS'|'z/VM')
+ # z/OS UNIX, z/VM UNIX requires wrapper script for CPP tests.
+ # "cc -E" returns 0 even when warning/error detected.
+ CPP="${CC} -E"
+
+ CPP_TST="sh ./zos/zcpp ${CPP}" # Wrapper script checks stderr.
+ ;;
+
+ * )
+ # Other UNIX systems.
+ # On SVR4, cc -E does not produce correct assembler files. Use /lib/cpp.
+ # Solaris as(1) needs -P, maybe others as well ?
+ CPP="${CC} -E"
+ [ -f /usr/ccs/lib/cpp ] && CPP='/usr/ccs/lib/cpp -P'
+ [ -f /usr/lib/cpp ] && CPP='/usr/lib/cpp'
+ [ -f /lib/cpp ] && CPP='/lib/cpp'
+ [ -f /usr/bin/cpp ] && CPP='/usr/bin/cpp'
+ [ -f /xenix ] && CPP="${CC} -E"
+ [ -f /lynx.os ] && CPP="${CC} -E"
+
+ # Verify operation with tentative CPP.
+ echo "#include <stdio.h>" >conftest.c
+ $CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
+
+ CPP_TST="${CPP}"
+ ;;
+esac
+
+#------------------------------------------------------------------------------
+# D) Determine if assembler CRC routines can be used.
+#------------------------------------------------------------------------------
+case "${UNAME_S}" in
+ 'z/OS'|'z/VM')
+ # z/OS UNIX, z/VM UNIX can not run i386 code.
+ # Host assembler uses unique internal macro phase, not CPP.
+ ;;
+
+ * )
+ # Other UNIX systems.
+ # FIX_ME: Need to customize for ports.
+ echo 'Check if we can (and want to) use assembly code for CRC...'
+ asm_crc=0
+ # CRC. Fail intentionally, if NO_ASM or NO_ASM_CRC is defined.
+ cat > conftest.S << _EOF_
+#if defined( NO_ASM) || defined( NO_ASM_CRC)
+ bad code
+#else
+# include "crc_i386.S"
+#endif
+_EOF_
+ ${CPP_TST} ${CFLAGS} conftest.S > _crc_i386.s 2> /dev/null
+ status=$?
+ if [ $status -eq 0 -a -s _crc_i386.s ]; then
+ grep error _crc_i386.s > /dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ $AS -c _crc_i386.s > /dev/null 2> /dev/null
+ status=$?
+ if [ $status -eq 0 -a -f _crc_i386.o ]; then
+ echo '-- Using assembly code for CRC.'
+ asm_crc=1
+ CFLAGS_TST="${CFLAGS_TST} -DASM_CRC"
+ OSDEP_OS="${OSDEP_OS} ${PROD}/crc_gcc.o"
+ fi
+ fi
+ fi
+ # If using assembler for anything, then check the C compiler for a
+ # "_" prefix on global names.
+ if [ $asm_crc -ne 0 ]; then
+ echo 'Check if C compiler adds "_" prefix to global names...'
+ echo "int foo() { return 0;}" > conftest.c
+ $CC -c conftest.c >/dev/null 2>/dev/null
+ nm conftest.o | grep foo >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # Found "foo". Look for "_foo".
+ nm conftest.o | grep _foo >/dev/null 2>/dev/null
+ status=$?
+ [ $status -ne 0 ] && AFLAGS="${AFLAGS} -DNO_UNDERLINE"
+ fi
+ fi
+ rm -f conftest.c conftest.S _crc_i386.s _crc_i386.o
+ ;;
+esac
+
+lprod=0
+#------------------------------------------------------------------------------
+# E) Configure optional AES (WinZip/Gladman) encryption library.
+#------------------------------------------------------------------------------
+# AES (WinZip/Gladman) encryption. (User must request: "AES_WG=1".)
+if [ -n "${AES_WG}" ]; then
+ echo "Check AES_WG (AES WinZip/Gladman) encryption support..."
+ if [ -d "aes_wg" ]; then
+ echo " Check for AES_WG header file in aes_wg/ directory..."
+ if [ -f "aes_wg/aes.h" ]; then
+ cat > conftest.c << _EOF_
+int main()
+{
+#include "aes_wg/aes.h"
+#ifndef CRYPT_AES_WG
+ forget it
+#endif
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -DCRYPT_AES_WG -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LIB_AES_WG="${PROD}/libaes.a"
+ CFLAGS_TST="${CFLAGS_TST} -DCRYPT_AES_WG"
+ if [ $lprod -eq 0 ]; then
+ lprod=1
+ LFLAGS1="${LFLAGS1} -L${PROD}"
+ fi
+ LFLAGS2="${LFLAGS2} -laes"
+ echo "-- Including AES_WG encryption support."
+ echo "-- Building libaes.a in ${PROD}."
+ else
+ echo "^^ AES_WG test build failed. Check aes_wg/ directory."
+ echo "^^ Unable to include AES_WG encryption support."
+ fi
+ else
+ echo "^^ AES_WG source code not found in aes_wg/ directory."
+ echo "^^ Unable to include AES_WG encryption support."
+ fi
+ else
+ echo "^^ Directory aes_wg not found."
+ echo "^^ Unable to include AES_WG encryption support."
+ fi
+else
+ echo "No AES WG encryption."
+fi
+
+#------------------------------------------------------------------------------
+# F) Configure optional LZMA compression library.
+#------------------------------------------------------------------------------
+# LZMA compression. (User must request: "LZMA=1".)
+if [ -n "${LZMA}" ]; then
+ echo "Check LZMA compression support..."
+ if [ -d "szip" ]; then
+ echo " Check for LZMA header file in szip/ directory..."
+ if [ -f "szip/LzmaDec.h" ]; then
+ cat > conftest.c << _EOF_
+#include "szip/LzmaDec.h"
+int main()
+{
+ typedef int zoff_t;
+#ifndef LZMA_SUPPORT
+ forget it
+#endif
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -DLZMA_SUPPORT -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LIB_LZMA="${PROD}/liblzma.a"
+ CFLAGS_TST="${CFLAGS_TST} -DLZMA_SUPPORT"
+ if [ $lprod -eq 0 ]; then
+ lprod=1
+ LFLAGS1="${LFLAGS1} -L${PROD}"
+ fi
+ LFLAGS2="${LFLAGS2} -llzma"
+ echo "-- Including LZMA compression support."
+ echo "-- Building liblzma.a in ${PROD}."
+ else
+ echo "^^ LZMA test build failed. Check szip/ directory."
+ echo "^^ Unable to include LZMA compression support."
+ fi
+ else
+ echo "^^ LZMA source code not found in szip/ directory."
+ echo "^^ Unable to include LZMA compression support."
+ fi
+ else
+ echo "^^ Directory szip/ not found."
+ echo "^^ Unable to include LZMA compression support."
+ fi
+else
+ echo "No LZMA compression."
+fi
+
+#------------------------------------------------------------------------------
+# F'') Configure optional PPMd compression library.
+#------------------------------------------------------------------------------
+# PPMd compression. (User must request: "PPMD=1".)
+if [ -n "${PPMD}" ]; then
+ echo "Check PPMd compression support..."
+ if [ -d "szip" ]; then
+ echo " Check for PPMd header file in szip/ directory..."
+ if [ -f "szip/Ppmd.h" ]; then
+ cat > conftest.c << _EOF_
+#include "szip/Ppmd.h"
+int main()
+{
+ typedef int zoff_t;
+#ifndef PPMD_SUPPORT
+ forget it
+#endif
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -DPPMD_SUPPORT -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LIB_PPMD="${PROD}/libppmd.a"
+ CFLAGS_TST="${CFLAGS_TST} -DPPMD_SUPPORT"
+ if [ $lprod -eq 0 ]; then
+ lprod=1
+ LFLAGS1="${LFLAGS1} -L${PROD}"
+ fi
+ LFLAGS2="${LFLAGS2} -lppmd"
+ echo "-- Including PPMd compression support."
+ echo "-- Building libppmd.a in ${PROD}."
+ else
+ echo "^^ PPMd test build failed. Check szip/ directory."
+ echo "^^ Unable to include PPMd compression support."
+ fi
+ else
+ echo "^^ PPMd source code not found in szip/ directory."
+ echo "^^ Unable to include PPMd compression support."
+ fi
+ else
+ echo "^^ Directory szip/ not found."
+ echo "^^ Unable to include PPMd compression support."
+ fi
+else
+ echo "No PPMd compression."
+fi
+
+#------------------------------------------------------------------------------
+# G) Configure optional BZIP2 compression library.
+#------------------------------------------------------------------------------
+# BZIP2 compression. (User must request: "IZ_BZIP2=bzip2_dir".)
+if [ -n "${IZ_BZIP2}" ]; then
+ echo "Check BZIP2 compression support..."
+ if [ -d "${IZ_BZIP2}" ]; then
+ echo " Check for BZIP2 header file in IZ_BZIP2 (${IZ_BZIP2})..."
+ if [ -f "${IZ_BZIP2}/bzlib.h" ]; then
+ if [ "${IZ_BZIP2}" = "bzip2" ]; then
+ echo " BZIP2 files found within UnZip tree."
+ echo " Check for BZIP2 compiled library in IZ_BZIP2 (${IZ_BZIP2})..."
+ if [ -f "${IZ_BZIP2}/libbz2.a" ]; then
+#
+# A bzip2 library built with BZ_NO_STDIO should have an
+# unresolved external, "bz_internal_error". The default,
+# full-function library will not mention it.
+#
+ nm ${IZ_BZIP2}/libbz2.a | grep bz_internal_error >/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo " Found BZIP2 BZ_NO_STDIO library: ${IZ_BZIP2}/libbz2.a"
+ LIB_BZ="${IZ_BZIP2}/libbz2.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
+ LFLAGS1="${LFLAGS1} -L${IZ_BZIP2}"
+ LFLAGS2="${LFLAGS2} -lbz2"
+ echo "-- Including BZIP2 compression support."
+ echo "-- Using libbz2.a in IZ_BZIP2 (${IZ_BZIP2})."
+ else
+ echo " -----------------------------------------------------"
+ echo " Found BZIP2 library, ${IZ_BZIP2}/libbz2.a, but the"
+ echo " library was not compiled with BZ_NO_STDIO."
+ echo " ERROR: This (default) variant of bzip2 library is NOT"
+ echo " supported with UnZip because of its incompatible"
+ echo " error handling."
+ echo " Please see the UnZip installation instructions in"
+ echo " the INSTALL text file."
+ echo " -----------------------------------------------------"
+ echo " ^^ Incompatible BZIP2 library within the UnZip tree."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ else
+ echo " Check for BZIP2 Makefile in I_BZIP2 (${IZ_BZIP2})..."
+ if [ -f "${IZ_BZIP2}/Makefile" ]; then
+ LIB_BZ="${IZ_BZIP2}/libbz2.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
+ LFLAGS1="${LFLAGS1} -L${IZ_BZIP2}"
+ LFLAGS2="${LFLAGS2} -lbz2"
+ echo "-- Including BZIP2 compression support."
+ echo "-- Building libbz2.a in ${IZ_BZIP2}."
+ else
+ echo " ^^ Incomplete BZIP2 support within the UnZip tree."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ fi
+ else
+ echo " BZIP2 support is outside the UnZip tree."
+ echo " Check for BZIP2 compiled library in IZ_BZIP2 (${IZ_BZIP2})."
+ if [ -f "${IZ_BZIP2}/libbz2.a" ]; then
+#
+# A bzip2 library built with BZ_NO_STDIO should have an
+# unresolved external, "bz_internal_error". The default,
+# full-function library will not mention it.
+#
+ nm ${IZ_BZIP2}/libbz2.a | grep bz_internal_error >/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo " Found BZIP2 BZ_NO_STDIO library: ${IZ_BZIP2}/libbz2.a"
+ LIB_BZ="${IZ_BZIP2}/libbz2.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
+ LFLAGS1="${LFLAGS1} -L${IZ_BZIP2}"
+ LFLAGS2="${LFLAGS2} -lbz2"
+ echo "-- Including BZIP2 compression support."
+ echo "-- Using libbz2.a in IZ_BZIP2 (${IZ_BZIP2})."
+ else
+ echo " -----------------------------------------------------"
+ echo " Found BZIP2 library, ${IZ_BZIP2}/libbz2.a, but the"
+ echo " library was not compiled with BZ_NO_STDIO."
+ echo " ERROR: This (default) variant of bzip2 library is NOT"
+ echo " supported with UnZip because of its incompatible"
+ echo " error handling."
+ echo " Please see the UnZip installation instructions in"
+ echo " the INSTALL text file."
+ echo " -----------------------------------------------------"
+ echo " ^^ Incompatible BZIP2 library outside the UnZip tree."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ else
+ echo " ^^ ${IZ_BZIP2}/libbz2.a not found (IZ_BZIP2 != \"bzip2\")."
+ echo " ^^ Incomplete BZIP2 support outside the UnZip tree."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ fi
+ else
+ echo " -- ${IZ_BZIP2}/bzlib.h not found."
+ echo " Check if OS already has BZIP2 library available..."
+ cat > conftest.c << _EOF_
+#include "bzlib.h"
+int main()
+{
+ bz_stream strm;
+ BZ2_bzCompressEnd(&strm);
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -o conftest conftest.c -lbz2 >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo " -- OS supports BZIP2 - linking in bzip2."
+ CFLAGS_TST="${CFLAGS_TST} -DBZIP2_SUPPORT"
+ LFLAGS2="${LFLAGS2} -lbz2"
+ echo "-- Including OS BZIP2 compression support."
+ else
+ echo " ^^ Neither bzlib.h nor libbz2.a was found."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+ fi
+ else
+ echo "^^ Directory ${IZ_BZIP2} not found."
+ echo "^^ Unable to include BZIP2 compression support."
+ fi
+else
+ echo "No BZIP2 compression."
+fi
+
+#------------------------------------------------------------------------------
+# H) Configure optional ZLIB compression library.
+#------------------------------------------------------------------------------
+# ZLIB compression. (User must request: "IZ_ZLIB=zlib_dir".)
+if [ -n "${IZ_ZLIB}" ]; then
+ echo "Check ZLIB deflate compression support..."
+ if [ -d "${IZ_ZLIB}" ]; then
+ echo " Check for ZLIB header file in IZ_ZLIB (${IZ_ZLIB})."
+ if [ -f "${IZ_ZLIB}/zlib.h" ]; then
+ if [ "${IZ_ZLIB}" = "zlib" ]; then
+ echo " ZLIB found within the UnZip tree."
+ echo " Check for zlib compiled library in IZ_ZLIB (${IZ_ZLIB})"
+ if [ -f "${IZ_ZLIB}/libz.a" ]; then
+ LIB_Z="${IZ_ZLIB}/libz.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_ZLIB} -DUSE_ZLIB"
+ LFLAGS1="${LFLAGS1} -L${IZ_ZLIB}"
+ LFLAGS2="${LFLAGS2} -lz"
+ echo "-- Including ZLIB deflate compression support."
+ echo "-- Using libz.a in IZ_ZLIB (${IZ_ZLIB})."
+ else
+ echo " Check for ZLIB Makefile in IZ_ZLIB (${IZ_ZLIB})..."
+ if [ -f "${IZ_ZLIB}/Makefile" ]; then
+ LIB_Z="${IZ_ZLIB}/libz.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_ZLIB} -DUSE_ZLIB"
+ LFLAGS1="${LFLAGS1} -L${IZ_ZLIB}"
+ LFLAGS2="${LFLAGS2} -lz"
+ echo "-- Including ZLIB deflate compression support."
+ echo "-- Building libz.a in ${IZ_ZLIB}."
+ else
+ echo " ^^ Incomplete ZLIB support within the UnZip tree."
+ echo "^^ Unable to include ZLIB compression support."
+ fi
+ fi
+ else
+ echo " ZLIB support is outside the UnZip tree."
+ echo " Check for ZLIB compiled library in IZ_ZLIB (${IZ_ZLIB})..."
+ if [ -f "${IZ_ZLIB}/libz.a" ]; then
+ echo " Found ZLIB library: ${IZ_ZLIB}/libz.a"
+ LIB_Z="${IZ_ZLIB}/libz.a"
+ CFLAGS_TST="${CFLAGS_TST} -I${IZ_ZLIB} -DUSE_ZLIB"
+ LFLAGS1="${LFLAGS1} -L${IZ_ZLIB}"
+ LFLAGS2="${LFLAGS2} -lz"
+ echo "-- Including ZLIB deflate compression support."
+ echo "-- Using libz.a in IZ_ZLIB (${IZ_ZLIB})."
+ else
+ echo " ^^ ${IZ_ZLIB}/libz.a not found (IZ_ZLIB != \"zlib\")."
+ echo " ^^ Incomplete ZLIB support outside the UnZip tree."
+ echo "^^ Unable to include ZLIB compression support."
+ fi
+ fi
+ else
+ echo " -- ${IZ_ZLIB}/zlib.h not found"
+ echo " Check if OS already has ZLIB library available..."
+ cat > conftest.c << _EOF_
+#include "zlib.h"
+int main()
+{
+ z_streamp strm;
+ inflateReset(&strm);
+ return 0;
+}
+_EOF_
+ $CC_TST $CFLAGS -o conftest conftest.c -lz >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo " -- OS supports ZLIB - linking in zlib."
+ CFLAGS_TST="${CFLAGS_TST} -DUSE_ZLIB"
+ LFLAGS2="${LFLAGS2} -lz"
+ echo "-- Including OS ZLIB compression support."
+ else
+ echo " ^^ Neither zlib.h nor libz.a was found."
+ echo "^^ Unable to include ZLIB compression support."
+ fi
+ fi
+ else
+ echo "^^ Directory ${IZ_ZLIB} not found."
+ echo "^^ Unable to include ZLIB compression support."
+ fi
+else
+ echo "ZLIB not used."
+fi
+
+#------------------------------------------------------------------------------
+# H') Configure UnZip object library.
+#------------------------------------------------------------------------------
+# UnZip object library. (User must request: "LIBUNZIP=1".)
+if [ -n "${LIBUNZIP}" ]; then
+ LIB_UNZIP="${PROD}/libizunzip.a"
+ echo "-- Building UnZip object library (${LIB_UNZIP})"
+fi
+
+#------------------------------------------------------------------------------
+# I) Common compiler feature checks.
+#------------------------------------------------------------------------------
+
+# Feature macro common conventions:
+#
+# HAVE_HEADER_H
+# - Indicates that <header.h> is available.
+# - Preferred for new header tests
+#
+# HAVE_DIR_HEADER_H
+# - Indicates that <dir/header.h> is available.
+# - Preferred for new header tests
+#
+# NO_HEADER_H
+# - Indicates that <header.h> is not available.
+#
+# NO_DIR_HEADER_H
+# - Indicates that <dir/header.h> is not available.
+#
+# FUNCTION=function
+# - Indicates that function() is available.
+# - If not available, UnZip provides a replacement as follows:
+# - unzpriv.h:
+# - Replacement FUNCTION macro defined to declare replacement function.
+# - NEED_FUNCTION defined to enable compile of replacment function.
+# - fileio.c:
+# - Defines body of the replacement function, but this is compiled only
+# when NEED_FUNCTION is defined.
+# - All code references to function() must be coded as FUNCTION()
+#
+# NO_FUNCTION
+# - Indicates that function() is not available.
+# - No replacement is provided for these cases.
+
+
+# Disable ANSI function prototypes where not supported.
+echo 'Check for prototypes...'
+echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_PROTO"
+
+# Check if compiler supports "const" keyword.
+# - Handles mips cc and non ANSI compilers.
+# - Does it need more?
+echo 'Check the handling of const...'
+cat > conftest.c << _EOF_
+typedef int charset[2];
+int main()
+{
+ const charset x;
+ const char *foo;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_CONST"
+
+# Check for size_t type.
+echo 'Check for size_t...'
+cat > conftest.c << _EOF_
+#include <sys/types.h>
+int main()
+{
+ size_t s;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_SIZE_T"
+
+# Check for off_t type.
+echo 'Check for off_t...'
+cat > conftest.c << _EOF_
+#include <sys/types.h>
+int main()
+{
+ off_t s;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_OFF_T"
+
+# Check for signed char type.
+echo 'Check for signed char type...'
+cat > conftest.c << _EOF_
+int main()
+{
+ signed char s;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_SIGNED_CHAR"
+
+# Check for Large File Support (required for ZIP64).
+# - Now we set the 64-bit file environment and check the size of off_t.
+echo 'Check for Large File Support...'
+cat > conftest.c << _EOF_
+#define _LARGEFILE_SOURCE /* Some OSes need this for fseeko(). */
+#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64 /* Select default interface as 64 bit. */
+#define _LARGE_FILES /* Some OSes need this for 64-bit off_t. */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+int main()
+{
+ off_t offset;
+ struct stat s;
+ /* See if have 64-bit off_t. */
+ if (sizeof(offset) < 8) {
+ printf(" off_t is %d bytes\n", sizeof(off_t));
+ return 1;
+ }
+ /* See if have 64-bit stat. */
+ if (sizeof(s.st_size) < 8) {
+ printf(" s.st_size is %d bytes\n", sizeof(s.st_size));
+ return 2;
+ }
+ printf(" off_t is %d bytes\n", sizeof(off_t));
+ printf(" s.st_size is %d bytes\n", sizeof(s.st_size));
+ return 3;
+}
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo '-- No Large File Support.'
+else
+ ./conftest
+ status=$?
+ if [ $status -eq 1 ]; then
+ echo '-- No Large File Support - no 64-bit off_t.'
+ elif [ $status -eq 2 ]; then
+ echo '-- No Large File Support - no 64-bit stat.'
+ elif [ $status -eq 3 ]; then
+ echo '-- Yes, we have Large File Support.'
+ CFLAGS_TST="${CFLAGS_TST} -DLARGE_FILE_SUPPORT"
+ CFLAGS_TST_BZ="${CFLAGS_TST_BZ} -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
+ else
+ echo "-- No Large File Support - conftest returned $status."
+ fi
+fi
+
+# Check size of UIDs and GIDs.
+# (Now zip stores variable size UIDs/GIDs using a new extra field. This
+# tests if this OS uses 16-bit UIDs/GIDs and so if the old 16-bit storage
+# should also be used for backward compatibility.)
+
+echo 'Check size of UIDs and GIDs...'
+cat > conftest.c << _EOF_
+#define _LARGEFILE_SOURCE /* Some OSes need this for fseeko */
+#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64 /* Select default interface as 64 bit */
+#define _LARGE_FILES /* Some OSes need this for 64-bit off_t */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+int main( )
+{
+ struct stat s;
+
+#if !defined(__MVS__) && !defined(__VM__)
+ /*
+ 2011/09/02 [AD] Comment out: Problem reported to IBM
+ - Over-optimized trivial program fails during printf()
+ */
+ printf(" s.st_uid is %u bytes\n", sizeof(s.st_uid));
+ printf(" s.st_gid is %u bytes\n", sizeof(s.st_gid));
+#endif
+
+ /* See if have 16-bit UID. */
+ if (sizeof(s.st_uid) != 2) {
+ return 1;
+ }
+ /* See if have 16-bit GID. */
+ if (sizeof(s.st_gid) != 2) {
+ return 2;
+ }
+ return 3;
+}
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ errmes="-- UID/GID test failed on compile"
+ errmes="${errmes} - disabling old 16-bit UID/GID support"
+ echo "${errmes}"
+ CFLAGS_TST="${CFLAGS_TST} -DIZ_HAVE_UXUIDGID"
+else
+ ./conftest
+ status=$?
+ if [ $status -eq 1 ]; then
+ echo '-- UID not 2 bytes - enabling "ux" UID/GID support.'
+ CFLAGS_TST="${CFLAGS_TST} -DIZ_HAVE_UXUIDGID"
+ elif [ $status -eq 2 ]; then
+ echo '-- GID not 2 bytes - enabling "ux" UID/GID support.'
+ CFLAGS_TST="${CFLAGS_TST} -DIZ_HAVE_UXUIDGID"
+ elif [ $status -eq 3 ]; then
+ echo '-- 16-bit UIDs and GIDs - keeping old 16-bit UID/GID support.'
+ else
+ errmes="-- Test failed - conftest returned $status."
+ errmes="${errmes} - enabling "ux" UID/GID support"
+ echo "${errmes}"
+ CFLAGS_TST="${CFLAGS_TST} -DIZ_HAVE_UXUIDGID"
+ fi
+fi
+
+# Check for time_t structure.
+echo 'Check for time_t...'
+cat > conftest.c << _EOF_
+#include <sys/types.h>
+#include <time.h>
+int main()
+{
+ time_t t;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_TIME_T"
+
+# Check for utime.h header.
+echo 'Check for utime.h...'
+echo "#include <utime.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -eq 0 ] && CFLAGS_TST="${CFLAGS_TST} -DHAVE_UTIME_H"
+
+# Check for sys/timeb.h header.
+echo 'Check for sys/timeb.h...'
+echo "#include <sys/timeb.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -eq 0 ] && CFLAGS_TST="${CFLAGS_TST} -DHAVE_SYS_TIMEB_H"
+
+# Check for sys/time.h header and gettimeofday() function.
+echo 'Check for sys/time.h and gettimeofday() needed for entry timing...'
+echo ' Check for sys/time.h...'
+echo "#include <sys/time.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo "-- No sys/time.h - usec timing using gettimeofday() not supported."
+else
+ CFLAGS_TST="${CFLAGS_TST} -DHAVE_SYS_TIME_H"
+ echo ' Check for gettimeofday()...'
+ cat > conftest.c << _EOF_
+#include "stdio.h"
+#include <sys/time.h>
+int main()
+{
+ struct timeval now;
+ unsigned long long usec_time;
+
+ gettimeofday(&now, NULL);
+ usec_time = now.tv_sec * 1000000 + now.tv_usec;
+ return 0;
+}
+_EOF_
+ $CC_TST -o conftest conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo "^^ Returned $status - usec timing using gettimeofday() not supported."
+ else
+ echo '-- Enabling usec timing using gettimeofday().'
+ CFLAGS_TST="${CFLAGS_TST} -DENABLE_ENTRY_TIMING"
+ fi
+fi
+
+# Check for optional header files.
+# - If found, define HAVE_HEADER_H macro.
+INCLS='ctype.h wctype.h langinfo.h locale.h'
+for inc in $INCLS
+do
+ echo "Check for ${inc}..."
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && \
+ CFLAGS_TST="${CFLAGS_TST} -DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
+done
+
+# This all needs some work. See note at the top of unzpriv.h.
+
+# Check for wchar.h header.
+echo 'Check for wchar.h...'
+echo "#include <wchar.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DHAVE_WCHAR_H"
+
+ # Realistic check for working wide char library functions.
+ # - Add FUNCTION_NAME='function_name' to flags if found.
+ FUNCS='towupper towlower iswprint'
+ for func in $FUNCS
+ do
+ echo "Check for wide char ${func}..."
+ cat > conftest.c << _EOF_
+#include <stdlib.h>
+#include <stdio.h>
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
+int main()
+{
+ int out;
+ out = $func( 'a' );
+ printf( " out: >0x%X<.\n", out);
+ return (out == 0);
+}
+_EOF_
+ $CC_TST ${CFLAGS} ${CFLAGS_OPT} ${CFLAGS_TST} ${CFLAGS_USR} -o conftest \
+ conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ./conftest >/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_TST="${CFLAGS_TST} -D`echo $func | tr '[a-z]' '[A-Z]'`=$func"
+ fi
+ fi
+ done
+
+ # Check for wide char for Unicode support.
+ iconv_ok=0
+ echo 'Check for wide char Unicode support...'
+ cat > conftest.c << _EOF_
+#include <stdlib.h>
+#include <stdio.h>
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
+int main()
+{
+ size_t wsize;
+ wchar_t *wide_string;
+ wchar_t wc = (wchar_t)'a'; /* any old character will do */
+ wchar_t wco;
+ int i;
+
+ if ((wide_string = (wchar_t *)malloc(4 * sizeof(wchar_t))) == NULL) {
+ return 0;
+ }
+
+ /* Get wide string. */
+ wsize = mbstowcs(wide_string, "foo", 3);
+ wide_string[wsize] = (wchar_t) NULL;
+
+ /* Make sure we have everything we need for wide support. */
+ wco = towupper(wc);
+ wco = towlower(wc);
+ i = iswprint(wc);
+
+#ifndef __STDC_ISO_10646__
+ return 1;
+#else
+ printf(" __STDC_ISO_10646__ = %d (yyyymm)\n", __STDC_ISO_10646__);
+ return 2;
+#endif
+}
+_EOF_
+ $CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo '^^ No Unicode (wchar_t) support.'
+ else
+ ./conftest
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo '-- No Unicode wchar_t support - wchar_t allocation error.'
+ elif [ $status -eq 1 ]; then
+ errmes="^^ No Unicode support"
+ echo "${errmes} - wchar_t encoding unspecified, may not be UCS."
+ elif [ $status -eq 2 ]; then
+ echo '-- Have wchar_t with known UCS encoding - enabling Unicode support.'
+ CFLAGS_TST="${CFLAGS_TST} -DUNICODE_SUPPORT -DUNICODE_WCHAR"
+ iconv_ok=1
+ else
+ echo "^^ No Unicode (wchar_t) support - conftest returned $status."
+ fi
+ fi
+fi
+
+# Check for setlocale() support.
+echo "Check for setlocale() support (needed for UNICODE Native check)..."
+cat > conftest.c << _EOF_
+#include <locale.h>
+int main()
+{
+ char *loc = setlocale(LC_CTYPE, "");
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -eq 0 ]; then
+ echo ' Have setlocale, can check for charset type.'
+ echo '-- Enabling UTF8-native support.'
+ CFLAGS_TST="${CFLAGS_TST} -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE"
+else
+ echo '^^ No Unicode (UTF-8 native) support.'
+ CFLAGS_TST="${CFLAGS_TST} -DNO_SETLOCALE"
+fi
+
+# Configure optional ISO/OEM (iconv) conversion library.
+# (User must request: "ICONV=1", and UNICODE_SUPPORT must be enabled.)
+if [ -n "${ICONV}" ]; then
+ if [ $iconv_ok -eq 0 ]; then
+ echo "^^ No wide Unicode support, so no ISO/OEM (iconv) conversion support."
+ else
+ echo "Check ISO/OEM (iconv) conversion support..."
+ cat > conftest.c << _EOF_
+#include <iconv.h>
+int main()
+{
+#ifndef ICONV_MAPPING
+ forget it
+#endif
+ iconv_t rslt;
+ rslt = iconv_open( "ASCII", "ASCII");
+ return ((rslt == (iconv_t)(-1)) ? -1 : 0);
+}
+_EOF_
+ $CC_TST $CFLAGS -DICONV_MAPPING -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ # Try linking with no special library.
+ $CC_TST $LFLAGS1 -o conftest conftest.o >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -ne 0 ]; then
+ # That failed, so try linking with libiconv.
+ $CC_TST $LFLAGS1 -liconv -o conftest conftest.o >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ LFLAGS2="${LFLAGS2} -liconv"
+ fi
+ fi
+ fi
+ if [ $status -eq 0 ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DICONV_MAPPING"
+ echo "-- Including ISO/OEM (iconv) conversion support."
+ else
+ echo "^^ Unable to include ISO/OEM (iconv) conversion support."
+ fi
+ fi
+else
+ echo "No ISO/OEM (iconv) conversion support."
+fi
+
+
+# Check for gcc no-builtin flag.
+# - gnu C supports -fno-builtin since version 2
+# - from configure 2.4i (Onno) 2004-12-05
+echo 'Check for gcc no-builtin flag...'
+cat > conftest.c << _EOF_
+int main()
+{
+#if __GNUC__ >= 2
+ return 0;
+#else
+ forget it
+#endif
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -eq 0 ] && BIF_TST="${BIF_TST} -fno-builtin"
+
+# Check for missing functions.
+# - add NO_'function_name' to flags if missing.
+FUNCS='chmod chown fchmod fchown lchown localtime_r mktemp mktime mkstemp'
+FUNCS="${FUNCS} nl_langinfo rename rmdir strchr strrchr"
+#echo "Check for missing functions..."
+for func in $FUNCS
+do
+ echo "Check for ${func}()..."
+ echo "int main(){ $func(); return 0; }" > conftest.c
+ $CC_TST $CFLAGS $BIF_TST -o conftest conftest.c >/dev/null 2>/dev/null
+ status=$?
+ [ $status -ne 0 ] && \
+ CFLAGS_TST="${CFLAGS_TST} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
+done
+
+# Check (very seriously) for a working lchmod().
+# On GNU/Linux (Clang, GCC) look for a # compile-time warning like
+# "lchmod is not implemented and will always fail".
+echo 'Check for lchmod()...'
+temp_file="/tmp/unzip_test_$$"
+temp_link="link_$$"
+( echo '#include <unistd.h>' ; \
+ echo "int main() { lchmod(\"${temp_file}\", 0666); }" \
+) > conftest.c
+ln -s "${temp_link}" "${temp_file}" && \
+$CC_TST $CFLAGS $BIF_TST -o conftest conftest.c >/dev/null 2> conftest.err
+status=$?
+if [ $status -eq 0 ]; then
+ grep implemented < conftest.err > /dev/null 2> /dev/null
+ status=$?
+ [ $status -eq 0 ] && status=666
+fi
+if [ $status -eq 0 ]; then
+ ./conftest
+ status=$?
+fi
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_LCHMOD"
+rm -f "${temp_file}" conftest.err
+
+# Check for memset().
+echo 'Check for memset()...'
+echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DZMEM"
+
+# Check for memmove().
+echo 'Check for memmove()...'
+cat > conftest.c << _EOF_
+#include <string.h>
+int main() { int a; int b = 0; memmove( &a, &b, sizeof( a)); return a; }
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNEED_MEMMOVE"
+
+# Check for errno declaration.
+echo 'Check for errno declaration...'
+cat > conftest.c << _EOF_
+#include <errno.h>
+main()
+{
+ errno = 0;
+ return 0;
+}
+_EOF_
+$CC_TST $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_ERRNO"
+
+# Check for labs().
+echo 'Check for labs()...'
+cat > conftest.c << _EOF_
+#include <stdlib.h>
+int main() { labs( 0); return 0; }
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNEED_LABS"
+
+# Check for strerror().
+echo 'Check for strerror()...'
+cat > conftest.c << _EOF_
+#include <string.h>
+int main() { strerror( 0); return 0; }
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNEED_STRERROR"
+
+# Check for directory libraries.
+echo 'Check for directory libraries...'
+cat > conftest.c << _EOF_
+int main() { return closedir(opendir(".")); }
+_EOF_
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ OPT=""
+ LIBS='ndir dir ucb bsd BSD PW x dirent'
+ for lib in $LIBS
+ do
+ $CC_TST $CFLAGS -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && OPT=-l$lib && break
+ done
+ if [ ${OPT} ]; then
+ LFLAGS="${LFLAGS2} ${OPT}"
+ else
+ CFLAGS_TST="${CFLAGS_TST} -DNO_DIR"
+ fi
+fi
+
+# Check for readlink().
+# - Dynix/ptx 1.3 needed this.
+echo 'Check for readlink()...'
+echo "int main(){ return readlink(); }" > conftest.c
+$CC_TST $CFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ $CC_TST $CFLAGS -o conftest conftest.c -lseq >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
+fi
+
+# Check for directory header.
+echo 'Check for directory header file...'
+OPT=""
+INCLS='dirent.h sys/ndir.h ndir.h sys/dir.h'
+for inc in $INCLS
+do
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" \
+ && break
+done
+CFLAGS_TST="${CFLAGS_TST} ${OPT}"
+
+# Check for sys/param.h.
+echo 'Check for sys/param.h...'
+echo "#include <sys/param.h>" > conftest.c
+$CPP_TST conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_PARAM_H"
+
+# Check for nonexistent header files.
+# - If not found, define NO_HEADER symbol.
+# FIX_ME: Remove langinfo.h after all NO_LANGINFO uses removed.
+# FIX_ME: Move some of these (langinfo.h + ?) to HAVE_.
+echo 'Check for nonexistent header files...'
+INCLS='stdlib.h stddef.h stdint.h unistd.h fcntl.h string.h langinfo.h'
+for inc in $INCLS
+do
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ [ $status -ne 0 ] && \
+ CFLAGS_TST="${CFLAGS_TST} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
+done
+
+# Check for terminal I/O header file.
+echo 'Check for terminal I/O header file...'
+OPT=""
+INCLS='termios.h termio.h sgtty.h'
+for inc in $INCLS
+do
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" \
+ && break
+done
+CFLAGS_TST="${CFLAGS_TST} ${OPT}"
+
+# Check for MBCS header files.
+echo 'Check for MBCS header files...'
+OPT=""
+INCLS='mbstr.h mbstring.h mbctype.h'
+for inc in $INCLS
+do
+ echo "#include <$inc>" > conftest.c
+ $CPP_TST conftest.c >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" \
+ && break
+done
+CFLAGS_TST="${CFLAGS_TST} ${OPT}"
+
+# Check for MBCS support.
+echo 'Check for MBCS (multi-byte character) support...'
+cat > conftest.c << _EOF_
+#include <stdlib.h>
+#include <stdio.h>
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
+#ifdef HAVE_MBSTRING_H
+# include <mbstring.h>
+#endif
+int main()
+{
+ char *tst;
+ tst = "Hallo";
+ return mblen(tst, MB_CUR_MAX);
+}
+_EOF_
+$CC_TST ${CFLAGS} -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+if [ $status -ne 0 ]; then
+ echo "^^ No MBCS support."
+ CFLAGS_TST="${CFLAGS_TST} -DNO_MBCS"
+else
+ echo "-- Have MBCS support."
+ CFLAGS_TST="${CFLAGS_TST} -D_MBCS"
+
+ # Realistic check for working MBCS library functions.
+ # - Add FUNCTION_NAME='function_name' to flags if found.
+ FUNCS='mbschr mbsrchr'
+ for func in $FUNCS
+ do
+ echo "Check for MBCS ${func}()..."
+ cat > conftest.c << _EOF_
+#include <stdlib.h>
+#ifdef HAVE_MBSTR_H
+# include <mbstr.h>
+#endif
+int main()
+{
+ char *tst;
+ tst = $func( "abc", 'b');
+ printf( " $func(\"abc\", 'b') = \"%s\"\n", tst);
+ return (tst == NULL);
+}
+_EOF_
+ $CC_TST ${CFLAGS} ${CFLAGS_OPT} ${CFLAGS_TST} ${CFLAGS_USR} -o conftest \
+ conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ ./conftest >/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CFLAGS_TST="${CFLAGS_TST} -D`echo $func | tr '[a-z]' '[A-Z]'`=$func"
+ fi
+ fi
+ done
+fi
+
+# Needed for AIX (and others ?) when mmap is used.
+echo 'Check for valloc()...'
+cat > conftest.c << _EOF_
+main()
+{
+#ifdef MMAP
+ valloc();
+#endif
+}
+_EOF_
+$CC_TST ${CFLAGS} -c conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -ne 0 ] && CFLAGS_TST="${CFLAGS_TST} -DNO_VALLOC"
+
+
+#------------------------------------------------------------------------------
+# J) Perform OS-specific tests.
+#------------------------------------------------------------------------------
+
+# Check for OS-specific flags.
+echo 'Check for OS-specific flags...'
+if [ -n "${UNAME_S}" ]; then
+ case "${UNAME_S}" in
+
+ OSF1|ULTRIX)
+ echo 'Check for -Olimit option...'
+ echo "int main() { return 0;}" > conftest.c
+ $CC_TST ${CFLAGS} -Olimit 1000 -o conftest conftest.c \
+ >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && CFLAGS_TST="${CFLAGS_TST} -Olimit 1000"
+ ;;
+
+ Darwin)
+ # Have (and user wants) extended attribute support? (OS X >= 10.4?)
+ cat > conftest.c << _EOF_
+#include <sys/xattr.h>
+int main()
+{
+#if defined( NO_APPLE_XATTR) || !defined( XATTR_NOFOLLOW)
+ bad code
+#endif
+ return 0;
+}
+_EOF_
+ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ CC_TST="${CC_TST} -DAPPLE_XATTR"
+ CFLAGS_TST="${CFLAGS_TST} -DAPPLE_XATTR"
+ fi
+ ;;
+ esac
+elif [ -n "${UNAME_X}" ]; then
+# SCO shared library check.
+ echo "int main() { return 0;}" > conftest.c
+ $CC_TST $CFLAGS -o conftest conftest.c -lc_s -nointl >/dev/null 2>/dev/null
+ status=$?
+ [ $status -eq 0 ] && LFLAGS2="-lc_s -nointl"
+else
+ # No explicit identification. Test for files/directories.
+ if [ -f /usr/bin/hostinfo ]; then
+ if /usr/bin/hostinfo | grep NeXT >/dev/null; then
+ CFLAGS_TST="${CFLAGS_TST} -posix"
+ LFLAGS1="${LFLAGS1} -posix -object"
+ fi
+# XXX ATT6300, Cray.
+ elif [ -f /xenix ]; then
+ if echo "${UNAME_P}" | grep 286 >/dev/null; then
+ CFLAGS_TST="${CFLAGS_TST} -LARGE -Mel2 -DMEDIUM_MEM -DWSIZE=16384"
+ CFLAGS_TST="${CFLAGS_TST} -DNO_VOID"
+ LFLAGS1="${LFLAGS1} -LARGE -Mel2"
+ fi
+ fi
+fi
+
+#------------------------------------------------------------------------------
+# K) Configure system-specific resources.
+#------------------------------------------------------------------------------
+
+# Check for /usr/local/bin.
+echo 'Check for /usr/local/bin...'
+[ -d /usr/local/bin ] && BINDIR='/usr/local/bin'
+
+# Check for /usr/local/man.
+echo 'Check for /usr/local/man...'
+[ -d /usr/man/manl ] && MANDIR='/usr/man/manl'
+[ -d /usr/local/man/manl ] && MANDIR='/usr/local/man/manl'
+[ -d /usr/local/man/man1 ] && MANDIR='/usr/local/man/man1'; MANEXT='.1'
+
+# Check for symbolic links.
+echo 'Check for symbolic links...'
+ln -s /dev/null null >/dev/null 2>/dev/null || LN=ln
+
+
+#------------------------------------------------------------------------------
+# L) Generate system identification.
+#------------------------------------------------------------------------------
+
+if [ -n "${UNAME_S}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_S='\\\"${UNAME_S}\\\"'"
+fi
+
+if [ -n "${UNAME_V}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_V='\\\"${UNAME_V}\\\"'"
+fi
+
+if [ -n "${UNAME_R}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_R='\\\"${UNAME_R}\\\"'"
+fi
+
+if [ -n "${UNAME_O}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_O='\\\"${UNAME_O}\\\"'"
+fi
+
+if [ -n "${UNAME_M}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_M='\\\"${UNAME_M}\\\"'"
+fi
+
+if [ -n "${UNAME_P}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DUNAME_P='\\\"${UNAME_P}\\\"'"
+fi
+
+if [ -n "${SIZER_V}" ]; then
+ CFLAGS_TST="${CFLAGS_TST} -DSIZER_V='\\\"${SIZER_V}\\\"'"
+fi
+
+
+#------------------------------------------------------------------------------
+# M) Additional compiler command options.
+#------------------------------------------------------------------------------
+
+# Check validity of -Wno-format-security (for modern GCC).
+CF_TEST='-Wno-format-security'
+echo "Check ${CF_TEST}..."
+cat > conftest.c << _EOF_
+int main() { return 0; }
+_EOF_
+${CC_TST} ${CFLAGS} ${CF_TEST} -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -eq 0 ] && CFLAGS_TST="${CFLAGS_TST} ${CF_TEST}"
+
+# Check validity of -Wno-format-nonliteral (for Clang).
+CF_TEST='-Wno-format-nonliteral'
+echo "Check ${CF_TEST}..."
+cat > conftest.c << _EOF_
+int main() { return 0; }
+_EOF_
+${CC_TST} ${CFLAGS} ${CF_TEST} -o conftest conftest.c >/dev/null 2>/dev/null
+status=$?
+[ $status -eq 0 ] && CFLAGS_TST="${CFLAGS_TST} ${CF_TEST}"
+
+
+# Remove work files from configuration tests.
+rm -f a.out conftest.c conftest.o conftest.err conftest.lst conftest null
+
+
+#------------------------------------------------------------------------------
+# Finalize the configuration values.
+#------------------------------------------------------------------------------
+
+# Add optimization (and listing) flags to initial C flags.
+if [ -n "${CFLAGS_OPT}" ]; then
+ CFLAGS="${CFLAGS} ${CFLAGS_OPT}"
+ CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
+fi
+
+# Add standard bzip2 configuration flags.
+CFLAGS_BZ="${CFLAGS_BZ} -DBZ_NO_STDIO"
+
+# Add test configuration flags.
+if [ -n "${CFLAGS_TST}" ]; then
+ CFLAGS="${CFLAGS} ${CFLAGS_TST}"
+fi
+if [ -n "${CFLAGS_TST_BZ}" ]; then
+ CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_TST_BZ}"
+fi
+
+# Add user override flags.
+if [ -n "${CFLAGS_USR}" ]; then
+ CFLAGS="${CFLAGS} ${CFLAGS_USR}"
+fi
+
+# Use listing-specific CC if required.
+if [ -n "${CC_LIST}" ]; then
+ CC="${CC_LIST}"
+ CC_BZ="${CC_LIST}"
+fi
+
+# Use listing-specific LD if required.
+if [ -n "${LD_LIST}" ]; then
+ LD="${LD_LIST}"
+fi
+
+#------------------------------------------------------------------------------
+# Emit the primary configuration values in the $PATH/flags file.
+#------------------------------------------------------------------------------
+echo "CC=\"${CC}\" CF=\"${CFLAGS}\"" \
+ "CC_BZ=\"${CC_BZ}\" CF_BZ=\"${CFLAGS_BZ}\"" \
+ "CPP=\"${CPP}\"" \
+ "AS=\"${AS}\" AF=\"${AFLAGS}\"" \
+ "LD=\"${LD}\" LF1=\"${LFLAGS1}\" LF2=\"${LFLAGS2}\"" \
+ "AR=\"${AR}\" RANLIB=\"${RANLIB}\"" \
+ "LN=\"${LN}\"" \
+ "RM=\"${RM}\"" \
+ "PROD=\"${PROD}\"" \
+ "PORT=\"${PORT}\"" \
+ "LIB_AES_WG=\"${LIB_AES_WG}\"" \
+ "LIB_BZ=\"${LIB_BZ}\"" \
+ "LIB_LZMA=\"${LIB_LZMA}\"" \
+ "LIB_PPMD=\"${LIB_PPMD}\"" \
+ "LIB_UNZIP=\"${LIB_UNZIP}\"" \
+ "LIB_Z=\"${LIB_Z}\"" \
+ "MK_BZ=\"${MK_BZ}\"" \
+ "OSDEP_H=\"${OSDEP_H}\"" \
+ "OSDEP_OCF=\"${OSDEP_OCF}\"" \
+ "OSDEP_OCS=\"${OSDEP_OCS}\"" \
+ "OSDEP_OCU=\"${OSDEP_OCU}\"" \
+ "OSDEP_OS=\"${OSDEP_OS}\"" \
+ "PGMEXT=\"${PGMEXT}\" DLLEXT=\"${DLLEXT}\"" \
+ "BINDIR=\"${BINDIR}\" BINPERMS=\"${BINPERMS}\"" \
+ "MANDIR=\"${MANDIR}\" MANPERMS=\"${MANPERMS}\"" \
+ "MANEXT=\"${MANEXT}\""\
+ >"$PROD"/flags
+
+#------------------------------------------------------------------------------
+# Emit the libbz2 configuration values in the $PATH/flags_bz file.
+#------------------------------------------------------------------------------
+echo "CC=\"${CC_BZ}\" CFLAGS=\"${CFLAGS_BZ}\"" \
+ "AR=\"${AR_BZ}\" RANLIB=\"${RANLIB}\"" \
+ "RM=\"${RM}\"" \
+ >"$PROD"/flags_bz
+echo ""
--- /dev/null
+/*
+ macosx.h - UnZip 6.1
+
+ Copyright (c) 2008-2013 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 2007-Mar-4 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+#ifndef __MACOSX_H
+# define __MACOSX_H
+
+# if defined( UNIX) && defined( __APPLE__)
+
+# include <sys/attr.h>
+# include <sys/vnode.h>
+# ifdef APPLE_XATTR
+# include <sys/xattr.h>
+# endif /* def APPLE_XATTR */
+
+# define APL_DBL_PFX "._"
+# define APL_DBL_PFX_SQR "__MACOSX/"
+
+ /* Select modern ("/..namedfork/rsrc") or old ("/rsrc") suffix
+ * for resource fork access.
+ */
+# ifndef APPLE_NFRSRC
+# if defined( __ppc__) || defined( __ppc64__)
+# define APPLE_NFRSRC 0
+# else /* defined( __ppc__) || defined( __ppc64__) */
+# define APPLE_NFRSRC 1
+# endif /* defined( __ppc__) || defined( __ppc64__) [else] */
+# endif /* ndef APPLE_NFRSRC */
+# if APPLE_NFRSRC
+# define APL_DBL_SUFX "/..namedfork/rsrc"
+# else /* APPLE_NFRSRC */
+# define APL_DBL_SUFX "/rsrc"
+# endif /* APPLE_NFRSRC [else] */
+
+# define APL_DBL_OFS_MAGIC 0
+# define APL_DBL_OFS_VERSION 4
+# define APL_DBL_OFS_FILLER 8
+# define APL_DBL_OFS_ENT_CNT 24
+# define APL_DBL_OFS_ENT_DSCR 28
+# define APL_DBL_OFS_ENT_DSCR_OFS1 42
+# define APL_DBL_OFS_FNDR_INFO 50
+# define APL_DBL_SIZE_FNDR_INFO 32
+# define APL_DBL_SIZE_HDR \
+ (APL_DBL_OFS_FNDR_INFO+ APL_DBL_SIZE_FNDR_INFO)
+# define APL_DBL_OFS_ATTR (APL_DBL_SIZE_HDR+ 2) /* 2-byte pad. */
+
+ /* Macros to convert big-endian byte (unsigned char) array segments
+ * to 16- or 32-bit entities.
+ * Note that the larger entities must be naturally aligned in the
+ * byte array for the simple type casts to work (on PowerPC). This
+ * should be true for the AppleDouble data where we use these macros.
+ */
+# if defined( __ppc__) || defined( __ppc64__)
+ /* Big-endian to Big-endian. */
+# define BIGC_TO_HOST16( i16) (*((unsigned short *)(i16)))
+# define BIGC_TO_HOST32( i32) (*((unsigned int *)(i32)))
+# else /* defined( __ppc__) || defined( __ppc64__) */
+ /* Little-endian to Big-endian. */
+# define BIGC_TO_HOST16( i16) \
+ (((unsigned short)*(i16)<< 8)+ (unsigned short)*(i16+ 1))
+# define BIGC_TO_HOST32( i32) \
+ (((unsigned int)*(i32)<< 24) + ((unsigned int)*(i32+ 1)<< 16) +\
+ ((unsigned int)*(i32+ 2)<< 8)+ ((unsigned int)*(i32+ 3)))
+# endif /* defined( __ppc__) || defined( __ppc64__) [else] */
+
+# endif /* defined( unix) && defined( __APPLE__) */
+
+#endif /* ndef __MACOSX_H */
+
--- /dev/null
+#!/bin/sh
+
+#==============================================================================
+# unix/mlz.sh: Combine loose object files and existing object libraries
+# into a new (big) object library. Revised: 2013-11-29
+#
+# Copyright (c) 2012-2013 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. If,
+# for some reason, all these files are missing, the Info-ZIP license may
+# also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#==============================================================================
+
+#==============================================================================
+# This script combines a set of loose object files ($2) with the object
+# files in a set of object libraries ($3, ...), to make a new (big)
+# object library ($1).
+#
+# $1 Output archive.
+# $2 ".o" file list.
+# $3 ... ".a" file list.
+# ${PROD} Product file directory.
+#
+# Currently, each section of the optional code (AES_WG, LZMA, PPMd, ...)
+# goes into its own, separate object library ($(LIB_AES_WG),
+# $(LIB_LZMA), $(LIB_PPMD), ...). It's easier to extract the object
+# files from each of these object libraries than to keep their component
+# object files around, and to maintain lists of what's in them.
+#==============================================================================
+
+tmpdir="` basename $0 `_$$_tmp"
+
+trap "sts=$? ; rm -rf $tmpdir; exit $sts" 0 1 2 3 15
+
+mkdir "$tmpdir"
+
+aro="$1"
+o_zip="$2"
+shift
+shift
+
+if test -z "${PROD}" ; then
+ PROD=.
+fi
+
+cd "$tmpdir"
+
+for ar in "$@"
+do
+ ar x ../$ar
+done
+
+cd ..
+
+if test -f "$aro" ; then
+ rm -f "$aro"
+fi
+ar r "$aro" $o_zip \
+ ` ( cd "$tmpdir" ; find . -name '*.o' -print | sed -e "s|^.|${PROD}|" ) `
+
--- /dev/null
+#!/bin/sh
+
+#==============================================================================
+# unix/test_unzip.sh: UnZip (basic) test script.
+# - For UnZip, UnZipSFX, fUnZip and ZipInfo Revised: 2013-11-29
+#
+# Copyright (c) 2011-2013 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. If,
+# for some reason, all these files are missing, the Info-ZIP license may
+# also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#==============================================================================
+
+#==============================================================================
+# UnZip test script.
+#
+# $1 = test archive name. Default: testmake.zip
+# $2 = program directory (relative). Default: .
+# $3 = non-null to skip funzip and SFX tests.
+#
+# 2013-11-29 SMS. Copyright, documentation, license.
+# 2013-06-03 SMS. Added exit status value.
+# 2012-12-16 SMS. Added "-mc-" to UnZip "-Z" command to suppress
+# member counts by dir/file/link, because not all
+# systems have links, which changes the report.
+# 2012-06-22 SMS. MinGW accommodation. Changed to try
+# "unzipsfx.exe" when plain "unzipsfx" is missing.
+# Use "unzip -a" to avoid line-ending differences.
+# 2012-02-24 SMS. Added $3 check for PPMd test.
+# Added exit status tests.
+# 2011-08-05 SMS. New.
+#==============================================================================
+
+test_archive=${1:-testmake.zip}
+prod=${2:-.}
+
+pass=0
+fail=0
+
+# Clean environment.
+
+if test -n "${UNZIP}" ; then
+ UNZIP='' ; export UNZIP
+fi
+
+if test -n "${UNZIPOPT}" ; then
+ UNZIPOPT='' ; export UNZIPOPT
+fi
+
+if test -n "${ZIPINFO}" ; then
+ ZIPINFO='' ; export ZIPINFO
+fi
+
+if test -n "${ZIPINFOOPT}" ; then
+ ZIPINFOOPT='' ; export ZIPINFOOPT
+fi
+
+# Check for existence of expected programs.
+
+if test -z "$3" ; then
+ program_list='funzip unzip unzipsfx'
+else
+ program_list='unzip'
+fi
+
+for program in $program_list ; do
+ if test -f "${prod}/${program}" ; then
+ echo ">>> Found executable: ${program}"
+ else
+ echo ">>> CAN'T FIND EXECUTABLE: ${prod}/${program}"
+ fi
+done
+
+# Check for existence of test archive.
+
+if test -f "${test_archive}" ; then
+ echo ">>> Found test archive: ${test_archive}"
+else
+ echo ">>> CAN'T FIND TEST ARCHIVE: ${test_archive}"
+fi
+
+# Error/exit handler.
+
+dir_orig=` pwd `
+
+trap 'cd "${dir_orig}" ;
+if test -n "${tmp_dir}" -a -d "${tmp_dir}" ; then
+ rm -r "${tmp_dir}"
+fi' 0 2 3 6 15
+
+# Create and move into a temporary test directory.
+
+tmp_dir="test_dir_$$"
+mkdir "${tmp_dir}"
+cd "${tmp_dir}"
+
+# Expected test archive member names.
+
+member_1='notes'
+member_2='testmake.zipinfo'
+
+# Test simple UnZip extraction.
+
+echo ''
+echo '>>> UnZip extraction test...'
+
+../${prod}/unzip -b "../${test_archive}" "${member_1}"
+status=$?
+
+if test ${status} -ne 0 ; then
+ echo ">>> Fail: UnZip exit status = ${status}."
+ fail=` expr $fail + 1 `
+elif test -f "${member_1}" -a ! -f "${member_2}" ; then
+ echo ">>> Pass."
+ pass=` expr $pass + 1 `
+else
+ echo ">>> Fail: Can't find (only) expected extracted file: ${member_1}"
+ pwd ; ls -l
+ fail=` expr $fail + 1 `
+fi
+
+# Test UnZip extraction with "-x" option.
+# (Use "-a" to get proper local line endings for "-Z" test below.)
+
+echo ''
+echo '>>> UnZip "-x" extraction test...'
+
+../${prod}/unzip -ao "../${test_archive}" -x "${member_1}"
+status=$?
+
+if test ${status} -ne 0 ; then
+ echo ">>> Fail: UnZip exit status = ${status}."
+ fail=` expr $fail + 1 `
+elif test -f "${member_2}"; then
+ echo ">>> Pass."
+ pass=` expr $pass + 1 `
+else
+ echo ">>> Fail: Can't find expected extracted file: ${member_2}"
+ fail=` expr $fail + 1 `
+fi
+
+# Test UnZip extraction with "-d dest_dir" option.
+
+echo ''
+echo '>>> UnZip "-d dest_dir" extraction test...'
+
+if test -f "${member_1}" ; then
+ ../${prod}/unzip -bo "../${test_archive}" -d dest_dir "${member_1}"
+ status=$?
+
+ if test ${status} -ne 0 ; then
+ echo ">>> Fail: UnZip exit status = ${status}."
+ fail=` expr $fail + 1 `
+ elif test -f "dest_dir/${member_1}"; then
+ if diff "${member_1}" "dest_dir/${member_1}" ; then
+ echo ">>> Pass."
+ pass=` expr $pass + 1 `
+ else
+ echo ">>> Fail: Extracted file contents mismatch."
+ fail=` expr $fail + 1 `
+ fi
+ else
+ echo \
+ ">>> Fail: Can't find expected extracted file: dest_dir/${member_1}"
+ fail=` expr $fail + 1 `
+ fi
+else
+ echo \
+ ">>> Fail: The UnZip \"-d\" test relies on success in the UnZip \"-x\" test."
+ fail=` expr $fail + 1 `
+fi
+
+# Test UnZip extraction with "-o" option.
+
+echo ''
+echo '>>> UnZip "-o" extraction test...'
+
+../${prod}/unzip -bo "../${test_archive}" "${member_1}"
+status=$?
+
+if test ${status} -ne 0 ; then
+ echo ">>> Fail: UnZip exit status = ${status}."
+ fail=` expr $fail + 1 `
+elif test -f "${member_1}"; then
+ echo ">>> Pass."
+ pass=` expr $pass + 1 `
+else
+ echo ">>> Fail: Can't find expected extracted file: ${member_1}"
+ fail=` expr $fail + 1 `
+fi
+
+# Test ZipInfo ("unzip -Z").
+
+echo ''
+echo '>>> ZipInfo ("unzip -Z") test...'
+
+if test -f "${member_2}"; then
+ (
+ cd ..
+ ${prod}/unzip -Z -mc- "${test_archive}" > "${tmp_dir}/testmake.unzip-Z"
+ )
+ status=$?
+
+ if test ${status} -ne 0 ; then
+ echo ">>> Fail: UnZip exit status = ${status}."
+ fail=` expr $fail + 1 `
+ elif diff testmake.unzip-Z "${member_2}" ; then
+ echo ">>> Pass."
+ pass=` expr $pass + 1 `
+ else
+ echo ">>> Fail: ZipInfo output mismatch."
+ cat <<EOD
+
+>>> ### ZipInfo output does not match the expected output.
+>>> ### (If the only difference is in the date-time values, then this may
+>>> ### be caused by a time-zone difference, which may not be important.)
+
+EOD
+ fail=` expr $fail + 1 `
+ fi
+else
+ echo ">>> Fail: The ZipInfo test relies on success in the UnZip test."
+ fail=` expr $fail + 1 `
+fi
+
+# Test FunZip extraction.
+
+if test -z "$3" ; then
+ echo ''
+ echo '>>> FunZip extraction test...'
+ echo '>>> (Expect a "zipfile has more than one entry" warning.)'
+
+ if test -f "${member_1}" ; then
+
+ ../${prod}/funzip < "../${test_archive}" > "dest_dir/${member_1}_fun"
+ status=$?
+
+ if test ${status} -ne 0 ; then
+ echo ">>> Fail: FunZip exit status = ${status}."
+ fail=` expr $fail + 1 `
+ elif test -f "dest_dir/${member_1}_fun"; then
+ if diff "${member_1}" "dest_dir/${member_1}_fun" ; then
+ echo ">>> Pass."
+ pass=` expr $pass + 1 `
+ else
+ echo ">>> Fail: Extracted file contents mismatch."
+ fail=` expr $fail + 1 `
+ fi
+ else
+ echo \
+ ">>> Fail: Can't find expected extracted file: dest_dir/${member_1}_fun"
+ fail=` expr $fail + 1 `
+ fi
+ else
+ echo ">>> Fail: The FunZip test relies on success in the UnZip test."
+ fail=` expr $fail + 1 `
+ fi
+fi
+
+# Test UnZipSFX.
+
+if test -z "$3" ; then
+ echo ''
+ echo '>>> UnZipSFX test...'
+
+ if test -f "dest_dir/${member_1}" ; then
+
+ rm ${member_1} ${member_2}
+ # MinGW "test -f fred" detects "fred.exe", but the "cat" below
+ # needs the real name, so we use a more realistic test.
+ uzs='unzipsfx'
+ cat ../${prod}/${uzs} > /dev/null 2> /dev/null
+ if [ $? -ne 0 ]; then
+ uzs="${uzs}.exe"
+ fi
+ cat ../${prod}/${uzs} "../${test_archive}" > test_sfx
+ chmod 0700 test_sfx
+ ./test_sfx -b ${member_1}
+ status=$?
+
+ if test ${status} -ne 0 ; then
+ echo ">>> Fail: UnZipSFX exit status = ${status}."
+ fail=` expr $fail + 1 `
+ elif test -f "${member_1}"; then
+ if diff "${member_1}" "dest_dir/${member_1}" ; then
+ echo ">>> Pass."
+ pass=` expr $pass + 1 `
+ else
+ echo ">>> Fail: Extracted file contents mismatch."
+ fail=` expr $fail + 1 `
+ fi
+ else
+ echo ">>> Fail: Can't find expected extracted file: ${member_1}"
+ fail=` expr $fail + 1 `
+ fi
+ else
+ echo \
+ ">>> Fail: The UnZipSFX test relies on success in the UnZip \"-d\" test."
+ fail=` expr $fail + 1 `
+ fi
+fi
+
+# Expected results.
+
+fail_expected=0
+if test -z "$3" ; then
+ pass_expected=7
+else
+ pass_expected=5
+fi
+
+# Result summary.
+
+echo ''
+echo ">>> Test Results: Pass: ${pass}, Fail: ${fail}"
+exit_status=0
+if test $pass -ne $pass_expected -o $fail -ne $fail_expected ; then
+ echo ">>> ### Expected: Pass: ${pass_expected}, Fail: ${fail_expected}"
+ exit_status=1
+fi
+echo ''
+
+exit ${exit_status}
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
Contains: readdir()
do_wild() <-- generic enough to put in fileio.c?
+ filtattr()
mapattr()
mapname()
checkdir()
#define UNZIP_INTERNAL
#include "unzip.h"
+#ifdef ICONV_MAPPING
+# include <iconv.h>
+# include <langinfo.h>
+#endif /* ICONV_MAPPING */
+
#ifdef SCO_XENIX
-# define SYSNDIR
+# define SYSNDIR
#else /* SCO Unix, AIX, DNIX, TI SysV, Coherent 4.x, ... */
-# if defined(__convexc__) || defined(SYSV) || defined(CRAY) || defined(BSD4_4)
-# define DIRENT
-# endif
+# if defined(__convexc__) || defined(SYSV) || defined(CRAY) || defined(BSD4_4)
+# define DIRENT
+# endif
#endif
+
#if defined(_AIX) || defined(__mpexl)
-# define DIRENT
+# define DIRENT
#endif
+
#ifdef COHERENT
-# if defined(_I386) || (defined(__COHERENT__) && (__COHERENT__ >= 0x420))
-# define DIRENT
-# endif
+# if defined(_I386) || (defined(__COHERENT__) && (__COHERENT__ >= 0x420))
+# define DIRENT
+# endif
#endif
#ifdef _POSIX_VERSION
-# ifndef DIRENT
-# define DIRENT
-# endif
+# ifndef DIRENT
+# define DIRENT
+# endif
#endif
#ifdef DIRENT
-# include <dirent.h>
+# include <dirent.h>
#else
-# ifdef SYSV
-# ifdef SYSNDIR
-# include <sys/ndir.h>
-# else
-# include <ndir.h>
-# endif
-# else /* !SYSV */
-# ifndef NO_SYSDIR
-# include <sys/dir.h>
-# endif
-# endif /* ?SYSV */
-# ifndef dirent
-# define dirent direct
+# ifdef SYSV
+# ifdef SYSNDIR
+# include <sys/ndir.h>
+# else
+# include <ndir.h>
+# endif
+# else /* !SYSV */
+# ifndef NO_SYSDIR
+# include <sys/dir.h>
# endif
+# endif /* ?SYSV */
+# ifndef dirent
+# define dirent direct
+# endif
#endif /* ?DIRENT */
+#if defined( UNIX) && defined( __APPLE__)
+# include <sys/attr.h>
+# include <sys/mount.h>
+# include <sys/vnode.h>
+# include "macosx.h"
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
#ifdef SET_DIR_ATTRIB
typedef struct uxdirattr { /* struct for holding unix style directory */
struct uxdirattr *next; /* info until can be sorted and set at end */
ulg uidgid[2];
char fnbuf[1]; /* buffer stub for directory name */
} uxdirattr;
-#define UxAtt(d) ((uxdirattr *)d) /* typecast shortcut */
+# define UxAtt(d) ((uxdirattr *)d) /* typecast shortcut */
#endif /* SET_DIR_ATTRIB */
#ifdef ACORN_FTYPE_NFS
/* static int created_dir; */ /* used in mapname(), checkdir() */
/* static int renamed_fullpath; */ /* ditto */
-static unsigned filtattr OF((__GPRO__ unsigned perms));
-
/*****************************/
/* Strings used multiple */
#ifndef SFX
-#ifdef NO_DIR /* for AT&T 3B1 */
+# ifdef NO_DIR /* for AT&T 3B1 */
#define opendir(path) fopen(path,"r")
#define closedir(dir) fclose(dir)
{
DIR *dirp;
- if ((dirp = malloc(sizeof(DIR)) != NULL) {
+ if ((dirp = izu_malloc(sizeof(DIR))) != NULL) {
if ((dirp->dirhandle = fopen(dirspec, "r")) == NULL) {
- free(dirp);
+ izu_free(dirp);
dirp = NULL;
}
}
DIR *dirp;
{
fclose(dirp->dirhandle);
- free(dirp);
+ izu_free(dirp);
}
/*
} /* end function readdir() */
-#endif /* NO_DIR */
+# endif /* NO_DIR */
+
/**********************/
} else {
++G.wildname; /* point at character after '/' */
G.dirnamelen = G.wildname - wildspec;
- if ((G.dirname = (char *)malloc(G.dirnamelen+1)) == (char *)NULL) {
+ if ((G.dirname =
+ (char *)izu_malloc( G.dirnamelen+ 1)) == (char *)NULL) {
Info(slide, 0x201, ((char *)slide,
"warning: cannot allocate wildcard buffers\n"));
strncpy(G.matchname, wildspec, FILNAMSIZ);
if ((DIR *)G.wild_dir == (DIR *)NULL) {
G.notfirstcall = FALSE; /* nothing left--reset for new wildspec */
if (G.have_dirname)
- free(G.dirname);
+ izu_free(G.dirname);
return (char *)NULL;
}
G.wild_dir = (zvoid *)NULL;
G.notfirstcall = FALSE; /* reset for new wildspec */
if (G.have_dirname)
- free(G.dirname);
+ izu_free(G.dirname);
return (char *)NULL;
} /* end function do_wild() */
-#endif /* !SFX */
-
+#endif /* ndef SFX */
#ifndef S_ISUID
-# define S_ISUID 0004000 /* set user id on execution */
+# define S_ISUID 0004000 /* set user id on execution */
#endif
#ifndef S_ISGID
-# define S_ISGID 0002000 /* set group id on execution */
+# define S_ISGID 0002000 /* set group id on execution */
#endif
#ifndef S_ISVTX
-# define S_ISVTX 0001000 /* save swapped text even after use */
+# define S_ISVTX 0001000 /* save swapped text even after use */
#endif
/************************/
/* Function filtattr() */
/************************/
-/* This is used to clear or keep the SUID and SGID bits on file permissions.
- * It's possible that a file in an archive could have one of these bits set
- * and, unknown to the person unzipping, could allow others to execute the
- * file as the user or group. The new option -K bypasses this check.
+/* For safety/security, clear SUID and SGID permission bits, unless -K
+ * was specified to allow their preservation.
+ * For safety/security (and consistency with the default behavior of
+ * "tar"), apply umask to archive permissions, unless -k was specified
+ * to preserve the archive permissions (always subject to -K, above).
*/
static unsigned filtattr(__G__ perms)
__GDEF
unsigned perms;
{
- /* keep setuid/setgid/tacky perms? */
+ /* Keep setuid/setgid/tacky perms? */
if (!uO.K_flag)
perms &= ~(S_ISUID | S_ISGID | S_ISVTX);
+#ifdef KFLAG
+ /* Apply umask to archive permissions? */
+ if (uO.kflag == 0)
+ perms &= ~G.umask_val;
+#endif /* def KFLAG */
+
+ /* Mask off any non-permission bits, and return the result. */
return (0xffff & perms);
} /* end function filtattr() */
-
-
/**********************/
/* Function mapattr() */
/**********************/
*/
G.pInfo->symlink = S_ISLNK(G.pInfo->file_attr) &&
SYMLINK_HOST(G.pInfo->hostnum);
-#endif
+#endif /* def SYMLINKS */
return 0;
}
/* fall through! */
*/
G.pInfo->symlink = S_ISLNK(G.pInfo->file_attr) &&
(G.pInfo->hostnum == FS_FAT_);
-#endif
+#endif /* def SYMLINKS */
return 0;
}
G.pInfo->file_attr = (unsigned)(0444 | tmp<<6 | tmp<<3 | tmp);
break;
} /* end switch (host-OS-created-by) */
- /* for originating systems with no concept of "group," "other," "system": */
- umask( (int)(tmp=umask(0)) ); /* apply mask to expanded r/w(/x) perms */
- G.pInfo->file_attr &= ~tmp;
+ /* For originating systems with no concept of "group", "other",
+ * "system", apply mask to expanded r/w(/x) permissions.
+ */
+ G.pInfo->file_attr &= ~G.umask_val;
return 0;
-
-
/************************/
/* Function mapname() */
/************************/
*/
{
char pathcomp[FILNAMSIZ]; /* path-component buffer */
+#ifdef SYMLINKS
+ char pathcopy[FILNAMSIZ]; /* Copy of path we can alter. */
+#endif /* def SYMLINKS */
char *pp, *cp=(char *)NULL; /* character pointers */
char *lastsemi=(char *)NULL; /* pointer to last semi-colon in pathcomp */
#ifdef ACORN_FTYPE_NFS
int error = MPN_OK;
register unsigned workch; /* hold the character being tested */
-
/*---------------------------------------------------------------------------
Initialize various pointers and counters and stuff.
---------------------------------------------------------------------------*/
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
- if (uO.jflag) /* junking directories */
- cp = (char *)strrchr(G.filename, '/');
- if (cp == (char *)NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
+
+#ifdef SYMLINKS
+ /* If a symlink with a trailing "/", then use a copy without the "/". */
+ if (G.pInfo->symlink)
+ {
+ size_t lenm1;
+
+ lenm1 = strlen( cp)- 1;
+ if (cp[ lenm1] == '/')
+ {
+ strncpy( pathcopy, cp, lenm1);
+ pathcopy[ lenm1] = '\0';
+ cp = pathcopy;
+ }
+ }
+#endif /* def SYMLINKS */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
lastsemi = (char *)NULL; /* leave direct. semi-colons alone */
break;
-#ifdef __CYGWIN__ /* Cygwin runs on Win32, apply FAT/NTFS filename rules */
- case ':': /* drive spec not stored, so no colon allowed */
- case '\\': /* '\\' may come as normal filename char (not */
- case '<': /* dir sep char!) from unix-like file system */
- case '>': /* no redirection symbols allowed either */
- case '|': /* no pipe signs allowed */
- case '"': /* no double quotes allowed */
- case '?': /* no wildcards allowed */
+#ifdef __CYGWIN__ /* Cygwin runs on Win32, apply FAT/NTFS filename rules */
+ case ':': /* drive spec not stored, so no colon allowed */
+ case '\\': /* '\\' may come as normal filename char (not */
+ case '<': /* dir sep char!) from unix-like file system */
+ case '>': /* no redirection symbols allowed either */
+ case '|': /* no pipe signs allowed */
+ case '"': /* no double quotes allowed */
+ case '?': /* no wildcards allowed */
case '*':
*pp++ = '_'; /* these rules apply equally to FAT and NTFS */
break;
case ' ': /* change spaces to underscore under */
*pp++ = '_'; /* MTS; leave as spaces under Unix */
break;
-#endif
+#else /* def MTS */ /* 2012-08-08 SMS. Added "-s" processing. */
+ case ' ':
+ if (uO.sflag)
+ {
+ *pp++ = '_'; /* With "-s", change space to underscore. */
+ break;
+ }
+#endif /* def MTS [else] */
default:
/* disable control character filter when requested,
fore exiting.
---------------------------------------------------------------------------*/
- if (G.filename[strlen(G.filename) - 1] == '/') {
+ if (G.filename[strlen(G.filename) - 1] == '/'
+#ifdef SYMLINKS
+ /* Process a symlink as a file, even if it looks like a directory.
+ * (Which a Windows directory symlink might do.)
+ */
+ && !G.pInfo->symlink
+#endif /* def SYMLINKS */
+ )
+ {
checkdir(__G__ G.filename, GETPATH);
if (G.created_dir) {
if (QCOND2) {
- Info(slide, 0, ((char *)slide, " creating: %s\n",
- FnFilter1(G.filename)));
+ Info( slide, 0, ((char *)slide, ExtractMsg, "creat",
+ FnFilter1( G.filename), "", "\n"));
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "creat";
+#endif /* def ENABLE_USER_PROGRESS */
}
#ifndef NO_CHMOD
- /* Filter out security-relevant attributes bits. */
- G.pInfo->file_attr = filtattr(__G__ G.pInfo->file_attr);
- /* When extracting non-UNIX directories or when extracting
- * without UID/GID restoration or SGID preservation, any
- * SGID flag inherited from the parent directory should be
- * maintained to allow files extracted into this new folder
- * to inherit the GID setting from the parent directory.
- */
- if (G.pInfo->hostnum != UNIX_ || !(uO.X_flag || uO.K_flag)) {
- /* preserve SGID bit when inherited from parent dir */
- if (!SSTAT(G.filename, &G.statbuf)) {
- G.pInfo->file_attr |= G.statbuf.st_mode & S_ISGID;
- } else {
- perror("Could not read directory attributes");
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ /* Filter out security-relevant attributes bits. */
+ G.pInfo->file_attr = filtattr(__G__ G.pInfo->file_attr);
+ /* When extracting non-UNIX directories or when extracting
+ * without UID/GID restoration or SGID preservation, any
+ * SGID flag inherited from the parent directory should be
+ * maintained to allow files extracted into this new folder
+ * to inherit the GID setting from the parent directory.
+ */
+ if (G.pInfo->hostnum != UNIX_ ||
+ !((uO.X_flag > 0) || uO.K_flag)) {
+ /* preserve SGID bit when inherited from parent dir */
+ if (!SSTAT(G.filename, &G.statbuf)) {
+ G.pInfo->file_attr |= G.statbuf.st_mode & S_ISGID;
+ } else {
+ perror("Could not read directory attributes");
+ }
}
- }
- /* set approx. dir perms (make sure can still read/write in dir) */
- if (chmod(G.filename, G.pInfo->file_attr | 0700))
- perror("chmod (directory attributes) error");
-#endif
+ /* set approx. dir perms (make sure can still read/write in dir) */
+ if (chmod(G.filename, G.pInfo->file_attr | 0700))
+ perror("chmod (directory attributes) error");
+ }
+#endif /* ndef NO_CHMOD */
/* set dir time (note trailing '/') */
return (error & ~MPN_MASK) | MPN_CREATED_DIR;
}
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended ";###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1;
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
/* On UNIX (and compatible systems), "." and ".." are reserved for
if ((ft & 1<<31)==0) ft=0x000FFD00;
sprintf(pathcomp+strlen(pathcomp), ",%03x", (int)(ft>>8) & 0xFFF);
}
-#endif /* ACORN_FTYPE_NFS */
+#endif /* def ACORN_FTYPE_NFS */
if (*pathcomp == '\0') {
- Info(slide, 1, ((char *)slide, "mapname: conversion of %s failed\n",
+ Info(slide, 1, ((char *)slide,
+ "mapname: conversion of \"%s\" failed\n",
FnFilter1(G.filename)));
return (error & ~MPN_MASK) | MPN_ERR_SKIP;
}
-
#if 0 /*========== NOTES ==========*/
extract-to dir: a:path/
-
/***********************/
/* Function checkdir() */
/***********************/
/* static int rootlen = 0; */ /* length of rootpath */
/* static char *rootpath; */ /* user's "extract-to" directory */
/* static char *buildpath; */ /* full path (so far) to extracted file */
- /* static char *end; */ /* pointer to end of buildpath ('\0') */
+#ifdef SHORT_NAMES
+ static char *end; /* pointer to end of buildpath ('\0') */
+#endif /* def SHORT_NAMES */
-# define FN_MASK 7
-# define FUNCTION (flag & FN_MASK)
+#define FN_MASK 7
+#define FUNCTION (flag & FN_MASK)
too_long = TRUE; /* check if extracting dir? */
if (SSTAT(G.buildpath, &G.statbuf)) { /* path doesn't exist */
if (!G.create_dirs) { /* told not to create (freshening) */
- free(G.buildpath);
+ izu_free(G.buildpath);
return MPN_INF_SKIP; /* path doesn't exist: nothing to do */
}
if (too_long) {
Info(slide, 1, ((char *)slide,
"checkdir error: path too long: %s\n",
FnFilter1(G.buildpath)));
- free(G.buildpath);
+ izu_free(G.buildpath);
/* no room for filenames: fatal */
return MPN_ERR_TOOLONG;
}
FnFilter2(G.buildpath),
strerror(errno),
FnFilter1(G.filename)));
- free(G.buildpath);
+ izu_free(G.buildpath);
/* path didn't exist, tried to create, failed */
return MPN_ERR_SKIP;
}
"checkdir error: %s exists but is not directory\n\
unable to process %s.\n",
FnFilter2(G.buildpath), FnFilter1(G.filename)));
- free(G.buildpath);
+ izu_free(G.buildpath);
/* path existed but wasn't dir */
return MPN_ERR_SKIP;
}
if (too_long) {
Info(slide, 1, ((char *)slide,
"checkdir error: path too long: %s\n", FnFilter1(G.buildpath)));
- free(G.buildpath);
+ izu_free(G.buildpath);
/* no room for filenames: fatal */
return MPN_ERR_TOOLONG;
}
strcpy(pathcomp, G.buildpath);
Trace((stderr, "getting and freeing path [%s]\n",
FnFilter1(pathcomp)));
- free(G.buildpath);
+ izu_free(G.buildpath);
G.buildpath = G.end = (char *)NULL;
return MPN_OK;
}
if (FUNCTION == INIT) {
Trace((stderr, "initializing buildpath to "));
#ifdef ACORN_FTYPE_NFS
- if ((G.buildpath = (char *)malloc(strlen(G.filename)+G.rootlen+
+ if ((G.buildpath = (char *)izu_malloc(strlen(G.filename)+G.rootlen+
(uO.acorn_nfs_ext ? 5 : 1)))
#else
- if ((G.buildpath = (char *)malloc(strlen(G.filename)+G.rootlen+1))
+ if ((G.buildpath = (char *)izu_malloc(strlen(G.filename)+G.rootlen+1))
#endif
== (char *)NULL)
return MPN_NOMEM;
on the command line.
---------------------------------------------------------------------------*/
+/* 2014-03-10 SMS.
+ * Changed to create multiple directory levels, as needed.
+ */
+
#if (!defined(SFX) || defined(SFX_EXDIR))
- if (FUNCTION == ROOT) {
+ if (FUNCTION == ROOT)
+ {
+ char *tmproot; /* Temporary path storage. */
+
Trace((stderr, "initializing root path to [%s]\n",
- FnFilter1(pathcomp)));
- if (pathcomp == (char *)NULL) {
- G.rootlen = 0;
+ FnFilter1( pathcomp)));
+
+ /* If NULL arg, then clear any current root path (and length). */
+ if (pathcomp == (char *)NULL)
+ {
+ if (G.rootlen > 0)
+ {
+ izu_free( G.rootpath);
+ G.rootlen = 0;
+ }
return MPN_OK;
}
- if (G.rootlen > 0) /* rootpath was already set, nothing to do */
+
+ /* If rootpath has already been set, then do nothing, be happy. */
+ if (G.rootlen > 0)
return MPN_OK;
- if ((G.rootlen = strlen(pathcomp)) > 0) {
- char *tmproot;
- if ((tmproot = (char *)malloc(G.rootlen+2)) == (char *)NULL) {
+ /* Allocate temporary path storage, if needed. (+2 for slash + NUL.) */
+ if ((G.rootlen = strlen( pathcomp)) > 0)
+ {
+ if ((tmproot = (char *)izu_malloc( G.rootlen+ 2)) == (char *)NULL)
+ {
G.rootlen = 0;
return MPN_NOMEM;
}
- strcpy(tmproot, pathcomp);
- if (tmproot[G.rootlen-1] == '/') {
- tmproot[--G.rootlen] = '\0';
+ strcpy( tmproot, pathcomp);
+ if (tmproot[ G.rootlen- 1] == '/')
+ {
+ tmproot[ --G.rootlen] = '\0'; /* Trim trailing slash. */
}
- if (G.rootlen > 0 && (SSTAT(tmproot, &G.statbuf) ||
- !S_ISDIR(G.statbuf.st_mode)))
- { /* path does not exist */
- if (!G.create_dirs /* || iswild(tmproot) */ ) {
- free(tmproot);
- G.rootlen = 0;
- /* skip (or treat as stored file) */
- return MPN_INF_SKIP;
+ }
+ if (G.rootlen > 0) /* If any path remains, ... */
+ {
+ int not_done;
+ char *slash;
+
+ /* Create the directory (tree), as needed, if allowed. */
+ not_done = 1;
+ slash = tmproot; /* (-1 to do a leading slash.) */
+ while (not_done)
+ {
+ slash = strchr( (slash+ 1), '/');
+ if (slash == NULL)
+ {
+ not_done = 0; /* No more slashes. */
+ }
+ else
+ {
+ *slash = '\0'; /* Temp'ly truncate path at next slash. */
}
- /* create the directory (could add loop here scanning tmproot
- * to create more than one level, but why really necessary?) */
- if (mkdir(tmproot, 0777) == -1) {
- Info(slide, 1, ((char *)slide,
- "checkdir: cannot create extraction directory: %s\n\
+ if (SSTAT( tmproot, &G.statbuf) ||
+ !S_ISDIR( G.statbuf.st_mode))
+ { /* Path (segment) does not exist (or is not dir). */
+ if (!G.create_dirs)
+ {
+ izu_free( tmproot);
+ G.rootlen = 0;
+ /* Skip (or treat as stored file). */
+ return MPN_INF_SKIP;
+ }
+ if (mkdir(tmproot, 0777) == -1)
+ {
+ Info(slide, 1, ((char *)slide,
+ "checkdir: cannot create extraction directory: %s\n\
%s\n",
- FnFilter1(tmproot), strerror(errno)));
- free(tmproot);
- G.rootlen = 0;
- /* path didn't exist, tried to create, and failed: */
- /* file exists, or 2+ subdir levels required */
- return MPN_ERR_SKIP;
+ FnFilter1( tmproot), strerror( errno)));
+ izu_free( tmproot);
+ G.rootlen = 0;
+ /* Path didn't exist. Creation failed. */
+ return MPN_ERR_SKIP;
+ }
}
- }
- tmproot[G.rootlen++] = '/';
- tmproot[G.rootlen] = '\0';
- if ((G.rootpath = (char *)realloc(tmproot, G.rootlen+1)) == NULL) {
- free(tmproot);
+ if (slash != NULL)
+ {
+ *(slash++) = '/'; /* Restore the NUL'd slash. */
+ }
+ } /* while (Path segments.) */
+ tmproot[ G.rootlen++] = '/'; /* Append slash. */
+ tmproot[ G.rootlen] = '\0'; /* NUL terminate. */
+ /* Right-size the rootpath storage. */
+ if ((G.rootpath =
+ (char *)izu_realloc( tmproot, (G.rootlen+ 1))) == NULL)
+ {
+ izu_free( tmproot);
G.rootlen = 0;
return MPN_NOMEM;
}
- Trace((stderr, "rootpath now = [%s]\n", FnFilter1(G.rootpath)));
+ Trace((stderr, "rootpath now = [%s]\n", FnFilter1( G.rootpath)));
}
return MPN_OK;
}
END: free rootpath, immediately prior to program exit.
---------------------------------------------------------------------------*/
- if (FUNCTION == END) {
+ if (FUNCTION == END)
+ {
Trace((stderr, "freeing rootpath\n"));
- if (G.rootlen > 0) {
- free(G.rootpath);
+ if (G.rootlen > 0)
+ {
+ izu_free( G.rootpath);
G.rootlen = 0;
}
return MPN_OK;
-
-
#ifdef NO_MKDIR
/********************/
-
#if (!defined(MTS) || defined(SET_DIR_ATTRIB))
static int get_extattribs OF((__GPRO__ iztimes *pzt, ulg z_uidgid[2]));
eb_izux_flg = (G.extra_field ? ef_scan_for_izux(G.extra_field,
G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime,
-#ifdef IZ_CHECK_TZ
+# ifdef IZ_CHECK_TZ
(G.tz_is_valid ? pzt : NULL),
-#else
+# else
pzt,
-#endif
+# endif
z_uidgid) : 0);
if (eb_izux_flg & EB_UT_FL_MTIME) {
TTrace((stderr, "\nget_extattribs: Unix e.f. modif. time = %ld\n",
/* if -X option was specified and we have UID/GID info, restore it */
have_uidgid_flg =
-#ifdef RESTORE_UIDGID
- (uO.X_flag && (eb_izux_flg & EB_UX2_VALID));
-#else
+# ifdef RESTORE_UIDGID
+ ((uO.X_flag > 0) && (eb_izux_flg & EB_UX2_VALID));
+# else
0;
-#endif
+# endif
return have_uidgid_flg;
}
#endif /* !MTS || SET_DIR_ATTRIB */
unsigned ints with unsigned longs.
---------------------------------------------------------------------------*/
-#ifdef SYMLINKS
+# ifdef SYMLINKS
if (G.symlnk) {
extent ucsize = (extent)G.lrec.ucsize;
-# ifdef SET_SYMLINK_ATTRIBS
+# ifdef SET_SYMLINK_ATTRIBS
extent attribsize = sizeof(unsigned) +
(have_uidgid_flg ? sizeof(z_uidgid) : 0);
-# else
+# else
extent attribsize = 0;
-# endif
+# endif
/* size of the symlink entry is the sum of
* (struct size (includes 1st '\0') + 1 additional trailing '\0'),
* system specific attribute data size (might be 0),
return;
}
- if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
+ if ((slnk_entry = (slinkentry *)izu_malloc(slnk_entrysize)) == NULL) {
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed: no mem\n",
FnFilter1(G.filename)));
slnk_entry->next = NULL;
slnk_entry->targetlen = ucsize;
slnk_entry->attriblen = attribsize;
-# ifdef SET_SYMLINK_ATTRIBS
+# ifdef SET_SYMLINK_ATTRIBS
memcpy(slnk_entry->buf, &(G.pInfo->file_attr),
sizeof(unsigned));
if (have_uidgid_flg)
memcpy(slnk_entry->buf + 4, z_uidgid, sizeof(z_uidgid));
-# endif
+# endif
slnk_entry->target = slnk_entry->buf + slnk_entry->attriblen;
slnk_entry->fname = slnk_entry->target + ucsize + 1;
strcpy(slnk_entry->fname, G.filename);
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed\n",
FnFilter1(G.filename)));
- free(slnk_entry);
+ izu_free(slnk_entry);
fclose(G.outfile);
return;
}
G.slink_last = slnk_entry;
return;
}
-#endif /* SYMLINKS */
+# endif /* def SYMLINKS */
-#ifdef QLZIP
+# ifdef QLZIP
if (G.extra_field) {
static void qlfix OF((__GPRO__ uch *ef_ptr, unsigned ef_len));
qlfix(__G__ G.extra_field, G.lrec.extra_field_length);
}
-#endif
-
-#if (defined(NO_FCHOWN))
- fclose(G.outfile);
-#endif
+# endif
+ /* Change file ownership, if possible and desired. */
+# if !defined( NO_CHOWN) || !defined( NO_FCHOWN)
+ /* We have some kind of [f]chown(), so keep working. */
/* if -X option was specified and we have UID/GID info, restore it */
if (have_uidgid_flg
/* check that both uid and gid values fit into their data sizes */
&& ((ulg)(uid_t)(z_uidgid[0]) == z_uidgid[0])
- && ((ulg)(gid_t)(z_uidgid[1]) == z_uidgid[1])) {
+ && ((ulg)(gid_t)(z_uidgid[1]) == z_uidgid[1]))
+ {
TTrace((stderr, "close_outfile: restoring Unix UID/GID info\n"));
-#if (defined(NO_FCHOWN))
+# ifdef NO_FCHOWN
+ /* If we lack fchown(), then close the file (precluding use of
+ * fchmod(), below), and use chown() (and, below, chmod()).
+ */
+ fclose(G.outfile); /* Nothing else to do while the file is open. */
if (chown(G.filename, (uid_t)z_uidgid[0], (gid_t)z_uidgid[1]))
-#else
+# else /* def NO_FCHOWN */
if (fchown(fileno(G.outfile), (uid_t)z_uidgid[0], (gid_t)z_uidgid[1]))
-#endif
+# endif /* def NO_FCHOWN [else] */
{
if (uO.qflag)
Info(slide, 0x201, ((char *)slide, CannotSetItemUidGid,
z_uidgid[0], z_uidgid[1], strerror(errno)));
}
}
+# endif /* !defined( NO_CHOWN) || !defined( NO_FCHOWN) */
-#if (!defined(NO_FCHOWN) && defined(NO_FCHMOD))
- fclose(G.outfile);
-#endif
+# if !defined( NO_FCHOWN) && defined(NO_FCHMOD)
+ /* File is still open (because we have fchown()), but we lack
+ * fchmod(), so we close the file now.
+ */
+ fclose(G.outfile); /* Nothing else to do while the file is open. */
+# endif /* !defined( NO_FCHOWN) && defined(NO_FCHMOD) */
-#if (!defined(NO_FCHOWN) && !defined(NO_FCHMOD))
+# if !defined( NO_FCHOWN) && !defined( NO_FCHMOD)
+ /* File is still open (because we have fchown()), and we have fchmod(). */
/*---------------------------------------------------------------------------
Change the file permissions from default ones to those stored in the
zipfile.
---------------------------------------------------------------------------*/
- if (fchmod(fileno(G.outfile), filtattr(__G__ G.pInfo->file_attr)))
- perror("fchmod (file attributes) error");
+# if defined( UNIX) && defined( __APPLE__)
+ /* 2009-04-19 SMS.
+ * Skip fchmod() for an AppleDouble file. (Doing the normal file
+ * is enough, and fchmod() will fail on a "/rsrc" pseudo-file.)
+ */
+ if (!G.apple_double)
+ {
+# endif /* defined( UNIX) && defined( __APPLE__) */
+
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ if (fchmod(fileno(G.outfile), filtattr(__G__ G.pInfo->file_attr)))
+ perror("fchmod (file attributes) error");
+ }
+
+# if defined( UNIX) && defined( __APPLE__)
+ }
+# endif /* defined( UNIX) && defined( __APPLE__) */
+ /* We're done with fchown() and fchmod(), so we can close the file. */
fclose(G.outfile);
-#endif /* !NO_FCHOWN && !NO_FCHMOD */
+# endif /* !defined( NO_FCHOWN) && !defined( NO_FCHMOD) */
+
+ /* Skip restoring time stamps on user's request. */
+ if (uO.D_flag <= 1)
+ {
+# if defined( UNIX) && defined( __APPLE__)
+ /* 2013-09-02 SMS.
+ * Attribute setting may have disturbed the times on the
+ * original file, so re-do utime() for an AppleDouble file,
+ * using the normal file name.
+ */
+ {
+ char btrbslash; /* Saved character had better be a slash. */
+
+ if (G.apple_double)
+ {
+ /* Truncate name at "/rsrc" for utime(). */
+ btrbslash =
+ G.filename[ strlen( G.filename)- strlen( APL_DBL_SUFX)];
+ G.filename[ strlen( G.filename)- strlen( APL_DBL_SUFX)] = '\0';
+ }
+# endif /* defined( UNIX) && defined( __APPLE__) */
- /* skip restoring time stamps on user's request */
- if (uO.D_flag <= 1) {
/* set the file's access and modification times */
- if (utime(G.filename, &(zt.t2))) {
+ if (utime(G.filename, &(zt.t2)))
+ {
if (uO.qflag)
+ {
Info(slide, 0x201, ((char *)slide, CannotSetItemTimestamps,
FnFilter1(G.filename), strerror(errno)));
+ }
else
+ {
Info(slide, 0x201, ((char *)slide, CannotSetTimestamps,
strerror(errno)));
+ }
+ }
+
+# if defined( UNIX) && defined( __APPLE__)
+ if (G.apple_double)
+ {
+ /* Restore name suffix ("/rsrc"), in case anyone still cares. */
+ G.filename[ strlen( G.filename)] = btrbslash;
+ }
}
+# endif /* defined( UNIX) && defined( __APPLE__) */
}
-#if (defined(NO_FCHOWN) || defined(NO_FCHMOD))
+# if defined( NO_FCHOWN) || defined( NO_FCHMOD)
+ /* We lack fchown() or fchmod(), so the file has been closed. We may
+ * have done chown() above, but not chmod().
+ */
/*---------------------------------------------------------------------------
Change the file permissions from default ones to those stored in the
zipfile.
---------------------------------------------------------------------------*/
-#ifndef NO_CHMOD
- if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
- perror("chmod (file attributes) error");
-#endif
-#endif /* NO_FCHOWN || NO_FCHMOD */
+# ifndef NO_CHMOD
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
+ perror("chmod (file attributes) error");
+ }
+# endif /* ndef NO_CHMOD */
+# endif /* defined( NO_FCHOWN) || defined( NO_FCHMOD) */
} /* end function close_outfile() */
slinkentry *slnk_entry;
{
if (slnk_entry->attriblen > 0) {
-# if (!defined(NO_LCHOWN))
+# ifndef NO_LCHOWN
if (slnk_entry->attriblen > sizeof(unsigned)) {
ulg *z_uidgid_p = (zvoid *)(slnk_entry->buf + sizeof(unsigned));
/* check that both uid and gid values fit into their data sizes */
}
}
}
-# endif /* !NO_LCHOWN */
-# if (!defined(NO_LCHMOD))
- TTrace((stderr,
- "set_symlnk_attribs: restoring Unix attributes for\n %s\n",
- FnFilter1(slnk_entry->fname)));
- if (lchmod(slnk_entry->fname,
- filtattr(__G__ *(unsigned *)(zvoid *)slnk_entry->buf)))
- perror("lchmod (file attributes) error");
-# endif /* !NO_LCHMOD */
+# endif /* ndef NO_LCHOWN */
+# ifndef NO_LCHMOD
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ TTrace((stderr,
+ "set_symlnk_attribs: restoring Unix attributes for\n %s\n",
+ FnFilter1(slnk_entry->fname)));
+ if (lchmod(slnk_entry->fname,
+ filtattr(__G__ *(unsigned *)(zvoid *)slnk_entry->buf)))
+ perror("lchmod (file attributes) error");
+ }
+# endif /* ndef NO_LCHMOD */
}
/* currently, no error propagation... */
return PK_OK;
#ifdef SET_DIR_ATTRIB
/* messages of code for setting directory attributes */
-# ifndef NO_CHMOD
+# ifndef NO_CHMOD
static ZCONST char DirlistChmodFailed[] =
"warning: cannot set permissions for %s\n %s\n";
-# endif
+# endif
int defer_dir_attribs(__G__ pd)
{
uxdirattr *d_entry;
- d_entry = (uxdirattr *)malloc(sizeof(uxdirattr) + strlen(G.filename));
+ d_entry = (uxdirattr *)izu_malloc(sizeof(uxdirattr) + strlen(G.filename));
*pd = (direntry *)d_entry;
if (d_entry == (uxdirattr *)NULL) {
return PK_MEM;
} /* end function defer_dir_attribs() */
+
int set_direc_attribs(__G__ d)
__GDEF
direntry *d;
{
int errval = PK_OK;
+# ifndef NO_CHOWN
+ /* Set directory owner (if possible). */
if (UxAtt(d)->have_uidgid &&
/* check that both uid and gid values fit into their data sizes */
((ulg)(uid_t)(UxAtt(d)->uidgid[0]) == UxAtt(d)->uidgid[0]) &&
if (!errval)
errval = PK_WARN;
}
- /* Skip restoring directory time stamps on user' request. */
+# endif /* ndef NO_CHOWN */
+
+ /* Skip restoring directory time stamps on user request. */
if (uO.D_flag <= 0) {
/* restore directory timestamps */
if (utime(d->fn, &UxAtt(d)->u.t2)) {
errval = PK_WARN;
}
}
-#ifndef NO_CHMOD
- if (chmod(d->fn, UxAtt(d)->perms)) {
- Info(slide, 0x201, ((char *)slide, DirlistChmodFailed,
- FnFilter1(d->fn), strerror(errno)));
- if (!errval)
- errval = PK_WARN;
+
+# ifndef NO_CHMOD
+ /* Do chmod() last, to avoid trying to change some attribute on a
+ * read-only file.
+ */
+# ifdef KFLAG
+ if (uO.kflag >= 0)
+# endif
+ {
+ if (chmod(d->fn, UxAtt(d)->perms)) {
+ Info(slide, 0x201, ((char *)slide, DirlistChmodFailed,
+ FnFilter1(d->fn), strerror(errno)));
+ if (!errval)
+ errval = PK_WARN;
+ }
}
-#endif /* !NO_CHMOD */
+# endif /* ndef NO_CHMOD */
+
return errval;
} /* end function set_direc_attribs() */
-
#ifdef TIMESTAMP
/***************************/
-
#ifndef SFX
/************************/
void version(__G)
__GDEF
{
-#if (defined(__GNUC__) && defined(NX_CURRENT_COMPILER_RELEASE))
- char cc_namebuf[40];
+# if defined(__GNUC__)
+ /* __GNUC__ is generated by gcc and gcc-based compilers */
+ /* - Other compilers define __GNUC__ for compatibility */
+# if (defined(NX_CURRENT_COMPILER_RELEASE) || \
+ defined(__MINGW64__) || \
+ defined(__MINGW32__) || \
+ defined(__llvm__) || \
+ defined(__PCC__) || \
+ defined(__PATHCC__) || \
+ defined(__INTEL_COMPILER) || \
+ defined(__GNUC_PATCHLEVEL__) )
+ char cc_namebuf[80];
+# endif /* __GNUC__ with computed name */
+# if (defined(NX_CURRENT_COMPILER_RELEASE) || \
+ defined(__MINGW64__) || \
+ defined(__MINGW32__) || \
+ defined(__llvm__) || \
+ defined(__PCC__) || \
+ defined(__PATHCC__) || \
+ defined(__INTEL_COMPILER) || \
+ defined(__GNUC_PATCHLEVEL__) )
char cc_versbuf[40];
-#else
-#if (defined(__SUNPRO_C))
+# endif /* __GNUC__ with computed version */
+# else /* !__GNUC__ */
+# if (defined(__SUNPRO_C))
char cc_versbuf[17];
-#else
-#if (defined(__HP_cc) || defined(__IBMC__))
+# else
+# if (defined(__HP_cc))
char cc_versbuf[25];
-#else
-#if (defined(__DECC_VER))
+# else
+# if (defined(__IBMC__))
+ char cc_versbuf[40];
+# else
+# if (defined(__DECC_VER))
char cc_versbuf[17];
int cc_verstyp;
-#else
-#if (defined(CRAY) && defined(_RELEASE))
+# else
+# if (defined(CRAY) && defined(_RELEASE))
char cc_versbuf[40];
-#endif /* (CRAY && _RELEASE) */
-#endif /* __DECC_VER */
-#endif /* __HP_cc || __IBMC__ */
-#endif /* __SUNPRO_C */
-#endif /* (__GNUC__ && NX_CURRENT_COMPILER_RELEASE) */
-
-#if ((defined(CRAY) || defined(cray)) && defined(_UNICOS))
+# endif /* (CRAY && _RELEASE) */
+# endif /* (__DECC_VER) */
+# endif /* (__IBMC__) */
+# endif /* (__HP_cc) */
+# endif /* (__SUNPRO_C) */
+# endif /* (__GNUC__) */
+
+# if ((defined(CRAY) || defined(cray)) && defined(_UNICOS))
char os_namebuf[40];
-#else
-#if defined(__NetBSD__)
+# else
+# if defined(__NetBSD__)
char os_namebuf[40];
-#endif
-#endif
+# endif
+# endif
/* Pyramid, NeXT have problems with huge macro expansion, too: no Info() */
sprintf((char *)slide, LoadFarString(CompiledWith),
-#ifdef __GNUC__
-# ifdef NX_CURRENT_COMPILER_RELEASE
- (sprintf(cc_namebuf, "NeXT DevKit %d.%02d ",
- NX_CURRENT_COMPILER_RELEASE/100, NX_CURRENT_COMPILER_RELEASE%100),
+# if defined(__GNUC__)
+ /* __GNUC__ is generated by gcc and gcc-based compilers */
+ /* - Other compilers define __GNUC__ for compatibility */
+# if defined(NX_CURRENT_COMPILER_RELEASE)
+ (sprintf( cc_namebuf, "NeXT DevKit %d.%02d ",
+ (NX_CURRENT_COMPILER_RELEASE / 100),
+ (NX_CURRENT_COMPILER_RELEASE % 100) ),
cc_namebuf),
- (strlen(__VERSION__) > 8)? "(gcc)" :
- (sprintf(cc_versbuf, "(gcc %s)", __VERSION__), cc_versbuf),
+ (strlen(__VERSION__) > 8)?
+ "(GCC)" :
+ (sprintf(cc_versbuf, "(GCC %s)",
+ __VERSION__),
+ cc_versbuf),
# else
- "gcc ", __VERSION__,
-# endif
-#else
-#if defined(__SUNPRO_C)
- "Sun C ", (sprintf(cc_versbuf, "version %x", __SUNPRO_C), cc_versbuf),
-#else
-#if (defined(__HP_cc))
+# if defined(__MINGW64__)
+ (sprintf( cc_namebuf, "MinGW 64 GCC "),
+ cc_namebuf),
+ (sprintf( cc_versbuf, "%d.%d.%d",
+ __GNUC__,
+ __GNUC_MINOR__,
+ __GNUC_PATCHLEVEL__ ),
+ cc_versbuf),
+# else
+# if defined(__MINGW32__)
+ (sprintf( cc_namebuf, "MinGW 32 GCC "),
+ cc_namebuf),
+ (sprintf( cc_versbuf, "%d.%d.%d",
+ __GNUC__,
+ __GNUC_MINOR__,
+ __GNUC_PATCHLEVEL__ ),
+ cc_versbuf),
+# else
+# if defined(__llvm__)
+# if defined(__clang__)
+# ifdef __clang_major__
+ (sprintf( cc_namebuf, "LLVM Clang %d.%d.%d ",
+ __clang_major__,
+ __clang_minor__,
+ __clang_patchlevel__),
+ cc_namebuf),
+# else /* def __clang_major__ */
+ /* Before version 2.0, Clang lacked __clang_major__ and friends. */
+ (sprintf( cc_namebuf, "LLVM Clang 1.x(?) "),
+ cc_namebuf),
+# endif /* def __clang_major__ [else] */
+ (sprintf( cc_versbuf, "(GCC %d.%d.%d)",
+ __GNUC__,
+ __GNUC_MINOR__,
+ __GNUC_PATCHLEVEL__ ),
+ cc_versbuf),
+# else
+# if defined(__APPLE_CC__)
+ (sprintf( cc_namebuf, "LLVM Apple GCC "),
+ cc_namebuf),
+ (sprintf( cc_versbuf, "%d.%d.%d",
+ __GNUC__,
+ __GNUC_MINOR__,
+ __GNUC_PATCHLEVEL__ ),
+ cc_versbuf),
+# else
+ (sprintf( cc_namebuf, "LLVM GCC "),
+ cc_namebuf),
+ (sprintf( cc_versbuf, "%d.%d.%d",
+ __GNUC__,
+ __GNUC_MINOR__,
+ __GNUC_PATCHLEVEL__ ),
+ cc_versbuf),
+# endif /* (__APPLE_CC__) */
+# endif /* (__clang__) */
+# else
+# if defined(__PCC__)
+ (sprintf( cc_namebuf, "Portable C compiler "),
+ cc_namebuf),
+ (sprintf( cc_versbuf, "%d.%d.%d",
+ __PCC__,
+ __PCC_MINOR__,
+ __PCC_MINORMINOR__ ),
+ cc_versbuf),
+# else
+# if defined(__PATHCC__)
+ (sprintf( cc_namebuf, "EKOPath C compiler "),
+ cc_namebuf),
+ (sprintf( cc_versbuf, "%d.%d.%d",
+ __PATHCC__,
+ __PATHCC_MINOR__,
+ __PATHCC_PATCHLEVEL__ ),
+ cc_versbuf),
+# else
+# if defined(__INTEL_COMPILER)
+ (sprintf( cc_namebuf, "Intel C compiler "),
+ cc_namebuf),
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+ (sprintf( cc_versbuf, "%d.%d (%s)",
+ (__INTEL_COMPILER / 100),
+ (__INTEL_COMPILER % 100),
+ __INTEL_COMPILER_BUILD_DATE ),
+ cc_versbuf),
+# else
+ (sprintf( cc_versbuf, "%d.%d",
+ (__INTEL_COMPILER / 100),
+ (__INTEL_COMPILER % 100) ),
+ cc_versbuf),
+# endif /* (__INTEL_COMPILER_BUILD_DATE) */
+# else
+# if defined(__GNUC_PATCHLEVEL__)
+ (sprintf( cc_namebuf, "GCC "),
+ cc_namebuf),
+ (sprintf( cc_versbuf, "%d.%d.%d",
+ __GNUC__,
+ __GNUC_MINOR__,
+ __GNUC_PATCHLEVEL__ ),
+ cc_versbuf),
+# else
+ "GCC ", __VERSION__,
+# endif /* (__GNUC_PATCHLEVEL__) */
+# endif /* (__INTEL_COMPILER) */
+# endif /* (__PATHCC__) */
+# endif /* (__PCC__) */
+# endif /* (__llvm__) */
+# endif /* (__MINGW32__) */
+# endif /* (__MINGW64__) */
+# endif /* (NX_CURRENT_COMPILER_RELEASE) */
+# else /* !__GNUC__ */
+# if defined(__SUNPRO_C)
+ "Sun C ",
+ (sprintf( cc_versbuf, "version %x",
+ __SUNPRO_C ),
+ cc_versbuf),
+# else
+# if (defined(__HP_cc))
"HP C ",
(((__HP_cc% 100) == 0) ?
- (sprintf(cc_versbuf, "version A.%02d.%02d",
- (__HP_cc/ 10000), ((__HP_cc% 10000)/ 100))) :
- (sprintf(cc_versbuf, "version A.%02d.%02d.%02d",
- (__HP_cc/ 10000), ((__HP_cc% 10000)/ 100), (__HP_cc% 100))),
- cc_versbuf),
-#else
-#if (defined(__DECC_VER))
+ (sprintf( cc_versbuf, "version A.%02d.%02d",
+ (__HP_cc/ 10000),
+ ((__HP_cc% 10000)/ 100)) ) :
+ (sprintf( cc_versbuf, "version A.%02d.%02d.%02d",
+ (__HP_cc/ 10000),
+ ((__HP_cc% 10000)/ 100),
+ (__HP_cc% 100)) ),
+ cc_versbuf),
+# else
+# if (defined(__DECC_VER))
"DEC C ",
- (sprintf(cc_versbuf, "%c%d.%d-%03d",
- ((cc_verstyp = (__DECC_VER / 10000) % 10) == 6 ? 'T' :
- (cc_verstyp == 8 ? 'S' : 'V')),
- __DECC_VER / 10000000,
- (__DECC_VER % 10000000) / 100000, __DECC_VER % 1000),
+ (sprintf( cc_versbuf, "%c%d.%d-%03d",
+ ((cc_verstyp = (__DECC_VER / 10000) % 10) == 6 ? 'T' :
+ (cc_verstyp == 8 ? 'S' : 'V')),
+ __DECC_VER / 10000000,
+ (__DECC_VER % 10000000) / 100000,
+ __DECC_VER % 1000 ),
cc_versbuf),
-#else
-#if defined(CRAY) && defined(_RELEASE)
- "cc ", (sprintf(cc_versbuf, "version %d", _RELEASE), cc_versbuf),
-#else
-#ifdef __IBMC__
+# else
+# if ((defined(CRAY) || defined(cray)) && defined(_RELEASE))
+ "Cray cc ",
+ (sprintf( cc_versbuf, "version %d",
+ _RELEASE ),
+ cc_versbuf),
+# else
+# ifdef __IBMC__
+# if (defined(__TOS_LINUX__))
+ "IBM XL C for Linux ",
+# else
+# if (defined(__PPC__))
+ "IBM XL C for AIX ",
+# else
+# if (defined(__MVS__))
+ "IBM z/OS XL C ",
+# else
+# if (defined(__VM__))
+ "IBM XL C for z/VM ",
+# else
+# if (defined(__OS400__))
+ "IBM ILC C for iSeries ",
+# else
"IBM C ",
- (sprintf(cc_versbuf, "version %d.%d.%d",
- (__IBMC__ / 100), ((__IBMC__ / 10) % 10), (__IBMC__ % 10)),
- cc_versbuf),
-#else
-#ifdef __VERSION__
-# ifndef IZ_CC_NAME
-# define IZ_CC_NAME "cc "
-# endif
+# endif /* (__OS400__) */
+# endif /* (__VM__) */
+# endif /* (__MVS__) */
+# endif /* (__PPC__) */
+# endif /* (__TOS_LINUX__) */
+ (sprintf( cc_versbuf, "version %d.%d.%d",
+# if (defined(__MVS__) || defined(__VM__))
+ (((__IBMC__/ 1000)& 3)% 1000),
+ ((__IBMC__/ 10)% 100),
+ (__IBMC__% 10) ),
+# else /* !(__MVS__ || __VM__) */
+ (__IBMC__/ 100),
+ ((__IBMC__/ 10)% 10),
+ (__IBMC__% 10) ),
+# endif /* ?(__MVS__ || __VM__) */
+ cc_versbuf),
+# else
+# ifdef __VERSION__
+# ifndef IZ_CC_NAME
+# define IZ_CC_NAME "cc "
+# endif
IZ_CC_NAME, __VERSION__
-#else
-# ifndef IZ_CC_NAME
-# define IZ_CC_NAME "cc"
-# endif
+# else
+# ifndef IZ_CC_NAME
+# define IZ_CC_NAME "cc"
+# endif
IZ_CC_NAME, "",
-#endif /* ?__VERSION__ */
-#endif /* ?__IBMC__ */
-#endif /* ?(CRAY && _RELEASE) */
-#endif /* ?__DECC_VER */
-#endif /* ?__HP_cc */
-#endif /* ?__SUNPRO_C */
-#endif /* ?__GNUC__ */
-
-#ifndef IZ_OS_NAME
+# endif /* ?__VERSION__ */
+# endif /* ?__IBMC__ */
+# endif /* ?(CRAY && _RELEASE) */
+# endif /* ?__DECC_VER */
+# endif /* ?__HP_cc */
+# endif /* ?__SUNPRO_C */
+# endif /* ?__GNUC__ */
+
+# ifndef IZ_OS_NAME
# define IZ_OS_NAME "Unix"
-#endif
+# endif
IZ_OS_NAME,
-#if defined(sgi) || defined(__sgi)
+# if defined(sgi) || defined(__sgi)
" (Silicon Graphics IRIX)",
-#else
-#ifdef sun
-# ifdef sparc
-# ifdef __SVR4
+# else
+# ifdef sun
+# if defined(UNAME_P) && defined(UNAME_R) && defined(UNAME_S)
+ " ("UNAME_S" "UNAME_R" "UNAME_P")",
+# else
+# ifdef sparc
+# ifdef __SVR4
" (Sun SPARC/Solaris)",
-# else /* may or may not be SunOS */
+# else /* may or may not be SunOS */
" (Sun SPARC)",
-# endif
-# else
-# if defined(sun386) || defined(i386)
+# endif
+# else
+# if defined(sun386) || defined(i386)
" (Sun 386i)",
-# else
-# if defined(mc68020) || defined(__mc68020__)
+# else
+# if defined(mc68020) || defined(__mc68020__)
" (Sun 3)",
-# else /* mc68010 or mc68000: Sun 2 or earlier */
+# else /* mc68010 or mc68000: Sun 2 or earlier */
" (Sun 2)",
-# endif
-# endif
-# endif
-#else
-#ifdef __hpux
+# endif
+# endif
+# endif
+# endif
+# else /* def sun */
+# ifdef __hpux
+# if defined(UNAME_M) && defined(UNAME_R) && defined(UNAME_S)
+ " ("UNAME_S" "UNAME_R" "UNAME_M")",
+# else
" (HP-UX)",
-#else
-#ifdef __osf__
- " (DEC OSF/1)",
-#else
-#ifdef _AIX
+# endif
+# else
+# ifdef __osf__
+# if defined( SIZER_V)
+ " (Tru64 "SIZER_V")"
+# else /* defined( SIZER_V) */
+ " (Tru64)",
+# endif /* defined( SIZER_V) [else] */
+# else
+# ifdef _AIX
+# if defined( UNAME_R) && defined( UNAME_S) && defined( UNAME_V)
+ " ("UNAME_S" "UNAME_V"."UNAME_R")",
+# else /* */
" (IBM AIX)",
-#else
-#ifdef aiws
+# endif /* [else] */
+# else
+# ifdef aiws
" (IBM RT/AIX)",
-#else
-#if defined(CRAY) || defined(cray)
-# ifdef _UNICOS
+# else
+# ifdef __MVS__
+# if defined( UNAME_R) && defined( UNAME_S) && defined( UNAME_V)
+ " ("UNAME_S" "UNAME_V"."UNAME_R")",
+# else
+ " (IBM z/OS)",
+# endif
+# else
+# ifdef __VM__
+# if defined( UNAME_R) && defined( UNAME_S) && defined( UNAME_V)
+ " ("UNAME_S" "UNAME_V"."UNAME_R")",
+# else
+ " (IBM z/VM)",
+# endif
+# else
+# if defined(CRAY) || defined(cray)
+# ifdef _UNICOS
(sprintf(os_namebuf, " (Cray UNICOS release %d)", _UNICOS), os_namebuf),
-# else
+# else
" (Cray UNICOS)",
-# endif
-#else
-#if defined(uts) || defined(UTS)
+# endif
+# else
+# if defined(uts) || defined(UTS)
" (Amdahl UTS)",
-#else
-#ifdef NeXT
-# ifdef mc68000
+# else
+# ifdef NeXT
+# ifdef mc68000
" (NeXTStep/black)",
-# else
+# else
" (NeXTStep for Intel)",
-# endif
-#else /* the next dozen or so are somewhat order-dependent */
-#ifdef LINUX
-# ifdef __ELF__
+# endif
+# else /* the next dozen or so are somewhat order-dependent */
+# ifdef LINUX
+# if defined( UNAME_M) && defined( UNAME_O)
+ " ("UNAME_O" "UNAME_M")",
+# else
+# ifdef __ELF__
" (Linux ELF)",
-# else
+# else
" (Linux a.out)",
-# endif
-#else
-#ifdef MINIX
+# endif
+# endif
+# else
+# ifdef MINIX
" (Minix)",
-#else
-#ifdef M_UNIX
+# else
+# ifdef M_UNIX
" (SCO Unix)",
-#else
-#ifdef M_XENIX
+# else
+# ifdef M_XENIX
" (SCO Xenix)",
-#else
-#ifdef __NetBSD__
-# ifdef NetBSD0_8
- (sprintf(os_namebuf, " (NetBSD 0.8%c)", (char)(NetBSD0_8 - 1 + 'A')),
+# else
+# ifdef __NetBSD__
+# ifdef NetBSD0_8
+ (sprintf( os_namebuf, " (NetBSD 0.8%c)",
+ (char)(NetBSD0_8 - 1 + 'A')),
os_namebuf),
-# else
-# ifdef NetBSD0_9
- (sprintf(os_namebuf, " (NetBSD 0.9%c)", (char)(NetBSD0_9 - 1 + 'A')),
+# else
+# ifdef NetBSD0_9
+ (sprintf( os_namebuf, " (NetBSD 0.9%c)",
+ (char)(NetBSD0_9 - 1 + 'A')),
os_namebuf),
-# else
-# ifdef NetBSD1_0
- (sprintf(os_namebuf, " (NetBSD 1.0%c)", (char)(NetBSD1_0 - 1 + 'A')),
+# else
+# ifdef NetBSD1_0
+ (sprintf(os_namebuf, " (NetBSD 1.0%c)",
+ (char)(NetBSD1_0 - 1 + 'A')),
os_namebuf),
-# else
- (BSD4_4 == 0.5)? " (NetBSD before 0.9)" : " (NetBSD 1.1 or later)",
-# endif
-# endif
-# endif
-#else
-#ifdef __FreeBSD__
- (BSD4_4 == 0.5)? " (FreeBSD 1.x)" : " (FreeBSD 2.0 or later)",
-#else
-#ifdef __bsdi__
- (BSD4_4 == 0.5)? " (BSD/386 1.0)" : " (BSD/386 1.1 or later)",
-#else
-#ifdef __386BSD__
- (BSD4_4 == 1)? " (386BSD, post-4.4 release)" : " (386BSD)",
-#else
-#ifdef __CYGWIN__
+# else
+ (BSD4_4 == 0.5)? " (NetBSD before 0.9)" :
+ " (NetBSD 1.1 or later)",
+# endif
+# endif
+# endif
+# else
+# ifdef __FreeBSD__
+ (BSD4_4 == 0.5)? " (FreeBSD 1.x)" :
+ " (FreeBSD 2.0 or later)",
+# else
+# ifdef __bsdi__
+ (BSD4_4 == 0.5)? " (BSD/386 1.0)" :
+ " (BSD/386 1.1 or later)",
+# else
+# ifdef __386BSD__
+ (BSD4_4 == 1)? " (386BSD, post-4.4 release)" :
+ " (386BSD)",
+# else
+# ifdef __CYGWIN__
" (Cygwin)",
-#else
-#if defined(i686) || defined(__i686) || defined(__i686__)
+# else
+# if defined(i686) || defined(__i686) || defined(__i686__)
" (Intel 686)",
-#else
-#if defined(i586) || defined(__i586) || defined(__i586__)
+# else
+# if defined(i586) || defined(__i586) || defined(__i586__)
" (Intel 586)",
-#else
-#if defined(i486) || defined(__i486) || defined(__i486__)
+# else
+# if defined(i486) || defined(__i486) || defined(__i486__)
" (Intel 486)",
-#else
-#if defined(i386) || defined(__i386) || defined(__i386__)
+# else
+# if defined(i386) || defined(__i386) || defined(__i386__)
" (Intel 386)",
-#else
-#ifdef pyr
+# else
+# ifdef pyr
" (Pyramid)",
-#else
-#ifdef ultrix
-# ifdef mips
+# else
+# ifdef ultrix
+# ifdef mips
" (DEC/MIPS)",
-# else
-# ifdef vax
+# else
+# ifdef vax
" (DEC/VAX)",
-# else /* __alpha? */
+# else /* __alpha? */
" (DEC/Alpha)",
-# endif
-# endif
-#else
-#ifdef gould
+# endif
+# endif
+# else
+# ifdef gould
" (Gould)",
-#else
-#ifdef MTS
+# else
+# ifdef MTS
" (MTS)",
-#else
-#ifdef __convexc__
+# else
+# ifdef __convexc__
" (Convex)",
-#else
-#ifdef __QNX__
+# else
+# ifdef __QNX__
" (QNX 4)",
-#else
-#ifdef __QNXNTO__
+# else
+# ifdef __QNXNTO__
" (QNX Neutrino)",
-#else
-#ifdef Lynx
+# else
+# ifdef Lynx
" (LynxOS)",
-#else
-#ifdef __APPLE__
-# ifdef __i386__
- " Mac OS X Intel i32",
-# else
-# ifdef __ppc__
- " Mac OS X PowerPC",
-# else
-# ifdef __ppc64__
- " Mac OS X PowerPC64",
-# else
- " Mac OS X",
-# endif /* __ppc64__ */
-# endif /* __ppc__ */
-# endif /* __i386__ */
-#else
+# else
+# ifdef __APPLE__
+# if defined(UNAME_P) && defined(UNAME_R) && defined(UNAME_S)
+ " ("UNAME_S" "UNAME_R" "UNAME_P")",
+# else
+# ifdef __i386__
+ " (Mac OS X Intel i32)",
+# else
+# ifdef __ppc__
+ " (Mac OS X PowerPC)",
+# else
+# ifdef __ppc64__
+ " (Mac OS X PowerPC64)",
+# else
+ " (Mac OS X)",
+# endif /* __ppc64__ */
+# endif /* __ppc__ */
+# endif /* __i386__ */
+# endif
+# else
"",
-#endif /* Apple */
-#endif /* Lynx */
-#endif /* QNX Neutrino */
-#endif /* QNX 4 */
-#endif /* Convex */
-#endif /* MTS */
-#endif /* Gould */
-#endif /* DEC */
-#endif /* Pyramid */
-#endif /* 386 */
-#endif /* 486 */
-#endif /* 586 */
-#endif /* 686 */
-#endif /* Cygwin */
-#endif /* 386BSD */
-#endif /* BSDI BSD/386 */
-#endif /* NetBSD */
-#endif /* FreeBSD */
-#endif /* SCO Xenix */
-#endif /* SCO Unix */
-#endif /* Minix */
-#endif /* Linux */
-#endif /* NeXT */
-#endif /* Amdahl */
-#endif /* Cray */
-#endif /* RT/AIX */
-#endif /* AIX */
-#endif /* OSF/1 */
-#endif /* HP-UX */
-#endif /* Sun */
-#endif /* SGI */
-
-#ifdef __DATE__
+# endif /* Apple */
+# endif /* Lynx */
+# endif /* QNX Neutrino */
+# endif /* QNX 4 */
+# endif /* Convex */
+# endif /* MTS */
+# endif /* Gould */
+# endif /* DEC */
+# endif /* Pyramid */
+# endif /* 386 */
+# endif /* 486 */
+# endif /* 586 */
+# endif /* 686 */
+# endif /* Cygwin */
+# endif /* 386BSD */
+# endif /* BSDI BSD/386 */
+# endif /* NetBSD */
+# endif /* FreeBSD */
+# endif /* SCO Xenix */
+# endif /* SCO Unix */
+# endif /* Minix */
+# endif /* Linux */
+# endif /* NeXT */
+# endif /* Amdahl */
+# endif /* Cray */
+# endif /* z/VM */
+# endif /* z/OS */
+# endif /* RT/AIX */
+# endif /* AIX */
+# endif /* OSF/1 */
+# endif /* HP-UX */
+# endif /* Sun */
+# endif /* SGI */
+
+# ifdef __DATE__
" on ", __DATE__
-#else
+# else
"", ""
-#endif
+# endif
);
(*G.message)((zvoid *)&G, slide, (ulg)strlen((char *)slide), 0);
} /* end function version() */
-#endif /* !SFX */
-
-
-
+#endif /* ndef SFX */
#ifdef QLZIP
long d_backup __attribute__ ((packed)); /* EOD */
};
-#define LONGID "QDOS02"
-#define EXTRALEN (sizeof(struct qdirect) + 8)
-#define JBLONGID "QZHD"
-#define JBEXTRALEN (sizeof(jbextra) - 4 * sizeof(char))
+# define LONGID "QDOS02"
+# define EXTRALEN (sizeof(struct qdirect) + 8)
+# define JBLONGID "QZHD"
+# define JBEXTRALEN (sizeof(jbextra) - 4 * sizeof(char))
typedef struct {
char eb_header[4] __attribute__ ((packed)); /* place_holder */
ef_len -= (eb_len + EB_HEADSIZE);
}
}
-#endif /* QLZIP */
+#endif /* def QLZIP */
+
+
+/* ISO/OEM (iconv) character conversion. */
+
+#ifdef ICONV_MAPPING
+
+typedef struct {
+/* char *local_charset; */
+ char *local_lang;
+ char *archive_charset;
+} CHARSET_MAP;
+
+/* Was: A mapping of local <-> archive charsets used by default to convert
+ * filenames of DOS/Windows Zip archives. Currently very basic.
+ */
+/* Now: A mapping of environment language <-> archive charsets used by default
+ * to convert filenames of DOS/Windows Zip archives. Currently incomplete.
+ */
+
+/*
+ * static CHARSET_MAP dos_charset_map[] = {
+ * { "ANSI_X3.4-1968", "CP850" },
+ * { "ISO-8859-1", "CP850" },
+ * { "CP1252", "CP850" },
+ * { "UTF-8", "CP866" },
+ * { "KOI8-R", "CP866" },
+ * { "KOI8-U", "CP866" },
+ * { "ISO-8859-5", "CP866" }
+ * };
+ */
+
+static CHARSET_MAP dos_charset_map[] = {
+ { "C", "CP850" },
+ { "en", "CP850" },
+ /* a lot of latin1 not included, by default it will be "CP850" */
+ { "bs", "CP852" },
+ { "cs", "CP852" },
+ { "hr", "CP852" },
+ { "hsb", "CP852" },
+ { "hu", "CP852" },
+ { "pl", "CP852" },
+ { "ro", "CP852" },
+ { "sk", "CP852" },
+ { "sl", "CP852" },
+ { "ru", "CP866" },
+ { "be", "CP866" },
+ { "bg", "CP866" },
+ { "mk", "CP866" },
+ { "uk", "CP866" },
+ { "ar", "CP864" },
+ { "el", "CP869" },
+ { "he", "CP862" },
+ { "iw", "CP862" },
+ { "ku", "CP857" },
+ { "tr", "CP857" },
+ { "zh", "CP950" }, /* CP936 */
+ { "ja", "CP932" },
+ { "ko", "CP949" },
+ { "th", "CP874" },
+ { "da", "CP865" },
+ { "nb", "CP865" },
+ { "nn", "CP865" },
+ { "no", "CP865" },
+ { "is", "CP861" },
+ { "lt", "CP775" },
+ { "lv", "CP775" },
+};
+
+
+/* Try to guess the default value of G.oem_cp based on the current locale.
+ * G.iso_cp is left alone for now.
+ */
+void init_conversion_charsets( __G)
+ __GDEF
+{
+/*
+ * const char *local_charset;
+ * int i;
+ */
+ char *locale;
+ char *loc = NULL;
+
+ /* Make a guess only if G.oem_cp is not already set. */
+/*
+ * if(*OEM_CP == '\0') {
+ * local_charset = nl_langinfo(CODESET);
+ * for (i = 0; i < sizeof(dos_charset_map)/sizeof(CHARSET_MAP); i++)
+ * if (!strcasecmp(local_charset, dos_charset_map[i].local_charset)) {
+ * strncpy(OEM_CP, dos_charset_map[i].archive_charset,
+ * sizeof(OEM_CP));
+ * break;
+ * }
+ * }
+ */
+
+ if (*G.oem_cp != '\0')
+ return;
+
+ locale = getenv("LC_ALL");
+ if (!locale)
+ locale = getenv("LANG");
+
+ if (locale && (loc = izu_malloc(strlen(locale) + 1)) != NULL)
+ {
+ char *p;
+ int i;
+
+ strcpy(loc, locale);
+
+ /* Extract language part. */
+ p = strchr(loc, '.');
+ if (p)
+ *p = '\0';
+
+ /* Extract main language part. */
+ p = strchr(loc, '_');
+ if (p)
+ *p = '\0';
+
+ for (i = 0; i < sizeof(dos_charset_map)/sizeof(CHARSET_MAP); i++)
+ {
+ if (!strcmp(loc, dos_charset_map[i].local_lang))
+ {
+ strncpy( G.oem_cp, dos_charset_map[i].archive_charset,
+ sizeof( G.oem_cp));
+ break;
+ }
+ }
+ /* 2012-11-27 SMS. */
+ izu_free( loc);
+ }
+
+ if (*G.oem_cp == '\0') /* Set default one. */
+ strncpy( G.oem_cp, "CP850", sizeof( G.oem_cp));
+}
+
+/* Convert a string from one encoding to the current locale using iconv().
+ * Be as non-intrusive as possible. If error is encountered during
+ * conversion, just leave the string intact.
+ */
+void charset_to_intern(char *string, char *from_charset)
+{
+ iconv_t cd;
+ char *buf;
+ char *d;
+ const char *local_charset;
+ ICONV_ARG2 char *s;
+ size_t buflen;
+ size_t dlen;
+ size_t slen;
+
+ if (*from_charset == '\0')
+ return;
+
+ buf = NULL;
+ local_charset = nl_langinfo(CODESET);
+
+ if ((cd = iconv_open(local_charset, from_charset)) == (iconv_t)-1)
+ return;
+
+ slen = strlen(string);
+ s = string;
+ dlen = buflen = 2 * slen;
+ d = buf = izu_malloc(buflen + 1);
+ if (d)
+ {
+ memset( buf, 0, buflen);
+ if(iconv(cd, &s, &slen, &d, &dlen) != (size_t)-1)
+ strncpy(string, buf, buflen);
+ izu_free(buf);
+ }
+ iconv_close(cd);
+}
+
+#endif /* def ICONV_MAPPING */
+
+
+#if defined( UNIX) && defined( __APPLE__)
+
+/* revert_apl_dbl_path().
+ *
+ * Remove an AppleDouble sequester path prefix, APL_DBL_PFX_SQR
+ * ("__MACOSX/"), from a possible AppleDouble path name, "path",
+ * overwriting the original "path".
+ * If "ad_name" is non-NULL, and an AppleDouble name prefix, APL_DBL_PFX
+ * ("._"), is detected, then also remove the name prefix from the name,
+ * and store that result at "ad_name". ("ad_name" may overlap "path".)
+ * Return value: 0: Not an AppleDouble path.
+ * 1: AppleDouble path detected/modified.
+ */
+int revert_apl_dbl_path( char *path, char *ad_name)
+{
+ int apple_double;
+ char *post_sqr_pfx;
+ char *rslash; /* Right-most slash. */
+
+ apple_double = 0;
+
+ /* Detect, and prepare to ignore, an AppleDouble sequester path
+ * prefix, APL_DBL_PFX_SQR ("__MACOSX/").
+ * We could add a warning if we see the path prefix here,
+ * but not the name prefix ("._") below. (Does anyone _not_ use the
+ * "._" prefix in a sequestered AppleDouble archive?)
+ */
+ if (strncmp( path, APL_DBL_PFX_SQR, (sizeof( APL_DBL_PFX_SQR)- 1)) == 0)
+ {
+ post_sqr_pfx = path+ sizeof( APL_DBL_PFX_SQR)- 1;
+
+ /* Skip any sequestration directory, including "__MACOSX/",
+ * itself. The (non-directory) files will all be placed into
+ * the real directories, not the sequestration directories.
+ */
+ if (post_sqr_pfx[ strlen( post_sqr_pfx)- 1] == '/')
+ {
+ /* Skip this sequestration directory. */
+ return -1;
+ }
+ else
+ {
+ /* Replace the sequestered path with the
+ * unsequestered path.
+ */
+ memmove( path, post_sqr_pfx, (strlen( post_sqr_pfx)+ 1));
+ }
+ }
+
+ /* Detect/remove "._" prefix. Set AppleDouble flag if present. */
+ rslash = strrchr( path, '/');
+ if (rslash == NULL)
+ {
+ /* "._name"? */
+ if (strncmp( path, APL_DBL_PFX, (sizeof( APL_DBL_PFX)- 1)) == 0)
+ {
+ apple_double = 1; /* Found the name prefix. */
+ if (ad_name != NULL)
+ {
+ /* Store path (name) without "._" name prefix. */
+ memmove( ad_name, (path+ sizeof( APL_DBL_PFX)- 1),
+ (strlen( path+ sizeof( APL_DBL_PFX)- 1)+ 1));
+ }
+ }
+ }
+ else
+ {
+ /* v--- rslash (before).
+ * "dir/._name"?
+ * ^--- rslash (after).
+ */
+ if (strncmp( (++rslash), APL_DBL_PFX, (sizeof( APL_DBL_PFX)- 1)) == 0)
+ {
+ apple_double = 1; /* Found the name prefix. */
+ if (ad_name != NULL)
+ {
+ /* Store path without "._" name prefix. */
+ memmove( ad_name, path, (rslash- path));
+ memmove( ad_name+ (rslash- path),
+ (rslash+ sizeof( APL_DBL_PFX)- 1),
+ (strlen( rslash+ sizeof( APL_DBL_PFX)- 1)+ 1));
+ }
+ }
+ }
+ return apple_double;
+}
+
+
+
+/* vol_attr_ok().
+ *
+ * Determine if the volume where "path" resides supports getattrlist()
+ * and setattrlist(), that is, if we can do the special AppleDouble
+ * file processing using setattrlist(). Otherwise, we should pretend
+ * that "-J" is in effect, to bypass the special AppleDouble processing,
+ * and leave the separate file elements separate.
+ *
+ * Return value Meaning
+ * -1 Error. See errno.
+ * 0 Volume does not support getattrlist() and setattrlist().
+ * 1 Volume does support getattrlist() and setattrlist().
+ */
+int vol_attr_ok( const char *path)
+{
+
+ int sts;
+ struct statfs statfs_buf;
+ struct attrlist attr_list_volattr;
+ struct attr_bufr_volattr {
+ unsigned int ret_length;
+ vol_capabilities_attr_t vol_caps;
+ } attr_bufr_volattr;
+
+ /* Get file system info (in particular, the mounted volume name) for
+ * the specified path.
+ */
+ sts = statfs( path, &statfs_buf);
+
+ /* If that worked, get the interesting volume capability attributes. */
+ if (sts == 0)
+ {
+ /* Clear attribute list structure. */
+ memset( &attr_list_volattr, 0, sizeof( attr_list_volattr));
+ /* Set attribute list bits for volume capabilities. */
+ attr_list_volattr.bitmapcount = ATTR_BIT_MAP_COUNT;
+ attr_list_volattr.volattr = ATTR_VOL_INFO| ATTR_VOL_CAPABILITIES;
+
+ sts = getattrlist( statfs_buf.f_mntonname, /* Path. */
+ &attr_list_volattr, /* Attrib list. */
+ &attr_bufr_volattr, /* Dest buffer. */
+ sizeof( attr_bufr_volattr), /* Dest buffer size. */
+ 0);
+
+ if (sts == 0)
+ {
+ /* Set a valid return value. */
+ sts = ((attr_bufr_volattr.vol_caps.capabilities[
+ VOL_CAPABILITIES_INTERFACES]&
+ VOL_CAP_INT_ATTRLIST) != 0);
+ }
+ }
+ return sts;
+}
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
+
+/* 2006-03-23 SMS.
+ * Emergency replacement for strerror(). (Useful on SunOS 4.*.)
+ * Enable by specifying "LOCAL_UNZIP=-DNEED_STRERROR=1" on the "make"
+ * command line.
+ */
+
+#ifdef NEED_STRERROR
+
+char *strerror( err)
+ int err;
+{
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+
+ static char no_msg[ 64];
+
+ if ((err >= 0) && (err < sys_nerr))
+ {
+ return sys_errlist[ err];
+ }
+ else
+ {
+ sprintf( no_msg, "(no message, code = %d.)", err);
+ return no_msg;
+ }
+}
+
+#endif /* def NEED_STRERROR */
--- /dev/null
+#!/bin/sh
+
+#==============================================================================
+# unix/unsafe_prod.sh: Check PROD directory safety. Revised: 2014-01-21
+#
+# Copyright (c) 2014 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. If,
+# for some reason, all these files are missing, the Info-ZIP license may
+# also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#==============================================================================
+
+if [ -n "$1" ]; then
+ prod="$1"
+else
+ prod='.'
+fi
+
+# Return zero, if unsafe.
+unsafe_prod=0
+
+if [ "${prod}" = '.' ]; then
+ unsafe_prod=1
+fi
+
+if [ ${unsafe_prod} -eq 0 ]; then
+ echo "${prod}" | grep -e '^/' -e '\.\./' > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ unsafe_prod=1
+ fi
+fi
+
+exit ${unsafe_prod}
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 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.
/* LARGE FILE SUPPORT - 10/6/04 EG */
/* This needs to be set before the includes so they set the right sizes */
-#if (defined(NO_LARGE_FILE_SUPPORT) && defined(LARGE_FILE_SUPPORT))
+# if (defined(NO_LARGE_FILE_SUPPORT) && defined(LARGE_FILE_SUPPORT))
# undef LARGE_FILE_SUPPORT
-#endif
+# endif
/* Automatically set ZIP64_SUPPORT if LFS */
-#ifdef LARGE_FILE_SUPPORT
-# if (!defined(NO_ZIP64_SUPPORT) && !defined(ZIP64_SUPPORT))
+# ifdef LARGE_FILE_SUPPORT
+# if (!defined(NO_ZIP64_SUPPORT) && !defined(ZIP64_SUPPORT))
# define ZIP64_SUPPORT
+# endif
# endif
-#endif
/* NO_ZIP64_SUPPORT takes preceedence over ZIP64_SUPPORT */
-#if defined(NO_ZIP64_SUPPORT) && defined(ZIP64_SUPPORT)
+# if defined(NO_ZIP64_SUPPORT) && defined(ZIP64_SUPPORT)
# undef ZIP64_SUPPORT
-#endif
+# endif
-#ifdef LARGE_FILE_SUPPORT
+# ifdef LARGE_FILE_SUPPORT
/* 64-bit Large File Support */
/* The following Large File Summit (LFS) defines turn on large file support
/* These have to be before any include that sets types so the large file
versions of the types are set in the includes */
+
+# define _LARGEFILE_SOURCE /* some OSes need this for fseeko */
+# define _LARGEFILE64_SOURCE
+# define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */
+# define _LARGE_FILES /* some OSes need this for 64-bit off_t */
+# define __USE_LARGEFILE64
+# endif /* LARGE_FILE_SUPPORT */
-# define _LARGEFILE_SOURCE /* some OSes need this for fseeko */
-# define _LARGEFILE64_SOURCE
-# define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */
-# define _LARGE_FILES /* some OSes need this for 64-bit off_t */
-# define __USE_LARGEFILE64
-#endif /* LARGE_FILE_SUPPORT */
+# include <sys/types.h> /* off_t, time_t, dev_t, ... */
+# include <sys/stat.h>
-#include <sys/types.h> /* off_t, time_t, dev_t, ... */
-#include <sys/stat.h>
-
-#ifdef NO_OFF_T
+# ifdef NO_OFF_T
typedef long zoff_t;
-#else
+# else
typedef off_t zoff_t;
-#endif
-#define ZOFF_T_DEFINED
+# endif
+# define ZOFF_T_DEFINED
typedef struct stat z_stat;
-#define Z_STAT_DEFINED
+# define Z_STAT_DEFINED
-#ifndef COHERENT
+# ifndef COHERENT
# include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */
-#else /* COHERENT */
+# else /* ndef COHERENT */
# ifdef _I386
-# include <fcntl.h> /* Coherent 4.0.x, Mark Williams C */
+# include <fcntl.h> /* Coherent 4.0.x, Mark Williams C */
# else
-# include <sys/fcntl.h> /* Coherent 3.10, Mark Williams C */
+# include <sys/fcntl.h> /* Coherent 3.10, Mark Williams C */
# endif
# define SHORT_SYMS
# ifndef __COHERENT__ /* Coherent 4.2 has tzset() */
-# define tzset settz
+# define tzset settz
# endif
-#endif /* ?COHERENT */
+# endif /* ndef COHERENT [else] */
-#ifndef NO_PARAM_H
+# ifndef NO_PARAM_H
# ifdef NGROUPS_MAX
-# undef NGROUPS_MAX /* SCO bug: defined again in <sys/param.h> */
+# undef NGROUPS_MAX /* SCO bug: defined again in <sys/param.h> */
# endif
# ifdef BSD
-# define TEMP_BSD /* may be defined again in <sys/param.h> */
-# undef BSD
+# define TEMP_BSD /* may be defined again in <sys/param.h> */
+# undef BSD
# endif
# include <sys/param.h> /* conflict with <sys/types.h>, some systems? */
# ifdef TEMP_BSD
-# undef TEMP_BSD
-# ifndef BSD
-# define BSD
-# endif
+# undef TEMP_BSD
+# ifndef BSD
+# define BSD 1
+# endif
# endif
-#endif /* !NO_PARAM_H */
+# endif /* ndef NO_PARAM_H */
-#ifdef __osf__
+# ifdef __osf__
# define DIRENT
# ifdef BSD
-# undef BSD
+# undef BSD
# endif
-#endif /* __osf__ */
+# endif /* __osf__ */
-#ifdef __CYGWIN__
+# ifdef __CYGWIN__
# include <unistd.h>
# define DIRENT
-# define HAVE_TERMIOS_H
+# ifndef HAVE_TERMIOS_H
+# define HAVE_TERMIOS_H
+# endif
# ifndef timezone
-# define timezone _timezone
+# define timezone _timezone
# endif
-#endif
+# endif
+
-#ifdef BSD
+# ifdef BSD
# include <sys/time.h>
-# include <sys/timeb.h>
+# ifndef BSD4_4
+# include <sys/timeb.h>
+# endif /* ndef BSD4_4 */
# if (defined(_AIX) || defined(__GLIBC__) || defined(__GNU__))
-# include <time.h>
+# include <time.h>
+# endif
+# else
+# if (defined(HAVE_SYS_TIME_H))
+# include <sys/time.h>
+# endif
+# if (defined(HAVE_SYS_TIMEB_H))
+# include <sys/timeb.h>
# endif
-#else
# include <time.h>
+# if (!defined(__IBMC__))
struct tm *gmtime(), *localtime();
-#endif
+# endif
+# endif
-#if (defined(BSD4_4) || (defined(SYSV) && defined(MODERN)))
+# if (defined(BSD4_4) || (defined(SYSV) && defined(MODERN)))
# include <unistd.h> /* this includes utime.h on SGIs */
# if (defined(BSD4_4) || defined(linux) || defined(__GLIBC__))
-# include <utime.h>
-# define GOT_UTIMBUF
+# include <utime.h>
+# define GOT_UTIMBUF
# endif
# if (!defined(GOT_UTIMBUF) && (defined(__hpux) || defined(__SUNPRO_C)))
-# include <utime.h>
-# define GOT_UTIMBUF
+# include <utime.h>
+# define GOT_UTIMBUF
# endif
# if (!defined(GOT_UTIMBUF) && defined(__GNU__))
-# include <utime.h>
-# define GOT_UTIMBUF
+# include <utime.h>
+# define GOT_UTIMBUF
+# endif
+# else
+# if (defined(HAVE_UTIME_H))
+# include <utime.h>
+# define GOT_UTIMBUF
# endif
-#endif
-#if (defined(__DGUX__) && !defined(GOT_UTIMBUF))
+# endif
+# if (!defined(GOT_UTIMBUF) && (defined(__DGUX__)))
/* DG/UX requires this because of a non-standard struct utimebuf */
# include <utime.h>
# define GOT_UTIMBUF
-#endif
+# endif
-#if (defined(V7) || defined(pyr_bsd))
+# if (defined(V7) || defined(pyr_bsd))
# define strchr index
# define strrchr rindex
-#endif
-#ifdef V7
+# endif
+# ifdef V7
# define O_RDONLY 0
# define O_WRONLY 1
# define O_RDWR 2
-#endif
+# endif
-#if defined(NO_UNICODE_SUPPORT) && defined(UNICODE_SUPPORT)
+# if defined(NO_UNICODE_SUPPORT) && defined(UNICODE_SUPPORT)
/* disable Unicode (UTF-8) support when requested */
# undef UNICODE_SUPPORT
-#endif
+# endif
-#if (defined(_MBCS) && defined(NO_MBCS))
+# if (defined(_MBCS) && defined(NO_MBCS))
/* disable MBCS support when requested */
# undef _MBCS
-#endif
+# endif
-#if (!defined(NO_SETLOCALE) && !defined(_MBCS))
-# if (!defined(UNICODE_SUPPORT) || !defined(UTF8_MAYBE_NATIVE))
+# if (!defined(NO_SETLOCALE) && !defined(_MBCS))
+# if (!defined(UNICODE_SUPPORT) || !defined(UTF8_MAYBE_NATIVE))
/* enable setlocale here, unless this happens later for UTF-8 and/or
* MBCS support */
-# include <locale.h>
-# ifndef SETLOCALE
+# include <locale.h>
+# ifndef SETLOCALE
# define SETLOCALE(category, locale) setlocale(category, locale)
+# endif
# endif
# endif
-#endif
-#ifndef NO_SETLOCALE
-# if (!defined(NO_WORKING_ISPRINT) && !defined(HAVE_WORKING_ISPRINT))
+# ifndef NO_SETLOCALE
+# if (!defined(NO_WORKING_ISPRINT) && !defined(HAVE_WORKING_ISPRINT))
/* enable "enhanced" unprintable chars detection in fnfilter() */
-# define HAVE_WORKING_ISPRINT
+# define HAVE_WORKING_ISPRINT
+# endif
# endif
-#endif
-#ifdef MINIX
+# ifdef MINIX
# include <stdio.h>
-#endif
-#if (!defined(HAVE_STRNICMP) & !defined(NO_STRNICMP))
+# endif
+# if (!defined(HAVE_STRNICMP) & !defined(NO_STRNICMP))
# define NO_STRNICMP
-#endif
-#ifndef DATE_FORMAT
+# endif
+# ifndef DATE_FORMAT
# define DATE_FORMAT DF_MDY /* GRR: customize with locale.h somehow? */
-#endif
-#define lenEOL 1
-#ifdef EBCDIC
+# endif
+# define lenEOL 1
+# ifdef EBCDIC
# define PutNativeEOL *q++ = '\n';
-#else
+# else
# define PutNativeEOL *q++ = native(LF);
-#endif
-#define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols)
-#define SCREENWIDTH 80
-#define SCREENLWRAP 1
-#define USE_EF_UT_TIME
-#if (!defined(NO_LCHOWN) || !defined(NO_LCHMOD))
+# endif
+# define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols)
+# define SCREENWIDTH 80
+# define SCREENLWRAP 1
+# define USE_EF_UT_TIME
+# if (!defined(NO_LCHOWN) || !defined(NO_LCHMOD))
# define SET_SYMLINK_ATTRIBS
-#endif
-#ifdef MTS
+# endif
+# ifdef MTS
# ifdef SET_DIR_ATTRIB
-# undef SET_DIR_ATTRIB
+# undef SET_DIR_ATTRIB
# endif
-#else /* !MTS */
+# else /* def MTS */
# define SET_DIR_ATTRIB
# if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) /* GRR 970513 */
-# define TIMESTAMP
+# define TIMESTAMP
# endif
# define RESTORE_UIDGID
-#endif /* ?MTS */
+# endif /* def MTS [else] */
+
+/* Static variables that we have to add to Uz_Globs. */
-/* Static variables that we have to add to Uz_Globs: */
-#define SYSTEM_SPECIFIC_GLOBALS \
+# ifdef KFLAG
+# define UMASK_VAL mode_t umask_val;
+# else /* def KFLAG */
+# define UMASK_VAL
+# endif /* def KFLAG [else] */
+
+# define SYSTEM_SPECIFIC_GLOBALS \
int created_dir, renamed_fullpath;\
char *rootpath, *buildpath, *end;\
ZCONST char *wildname;\
char *dirname, matchname[FILNAMSIZ];\
int rootlen, have_dirname, dirnamelen, notfirstcall;\
- zvoid *wild_dir;
+ zvoid *wild_dir;\
+ UMASK_VAL
/* created_dir, and renamed_fullpath are used by both mapname() and */
/* checkdir(). */
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
/* and notfirstcall are used by do_wild(). */
-#endif /* !__unxcfg_h */
+
+/* ISO/OEM (iconv) character conversion. */
+
+# ifdef ICONV_MAPPING
+
+# 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
+# define _ISO_INTERN( string) charset_to_intern( string, G.iso_cp)
+
+# ifdef _OEM_INTERN
+# undef _OEM_INTERN
+# endif
+# ifndef IZ_OEM2ISO_ARRAY
+# define IZ_OEM2ISO_ARRAY
+# endif
+# define _OEM_INTERN( string) charset_to_intern( string, G.oem_cp)
+
+/* Possible "const" type qualifier for arg 2 of iconv(). */
+# ifndef ICONV_ARG2
+# define ICONV_ARG2
+# endif /* ndef ICONV_ARG2 */
+
+# endif /* def ICONV_MAPPING */
+
+#endif /* ndef __unxcfg_h */
#!/bin/sh
+
+#==============================================================================
+# unix/zipgrep: Use unzip and egrep to search the specified members of a
+# Zip archive for a string or pattern. Revised: 2013-11-29
+#
+# Copyright (c) 2000-2013 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. If,
+# for some reason, all these files are missing, the Info-ZIP license may
+# also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#==============================================================================
#
# zipgrep: Use unzip and egrep to search the specified members of a
# Zip archive for a string or pattern. Search all members if no members
# are specified explicitly. The script attempts to handle egrep's "-h"
# and "-l" options internally.
#
-# This script assumes that the desired "unzip" and "egrep" (and "sed")
-# programs are on the user's PATH.
-#
+# This script assumes that the desired "unzip" and "egrep" (and "grep",
+# "od", and "sed") programs are on the user's PATH. The user may specify
+# a particular "unzip" path in the environment variable ZIPGREP_UNZIP.
+#==============================================================================
+
+# UnZip command.
+unzip=${ZIPGREP_UNZIP:-unzip}
+# UnZip command options. (Note: Shell quoting can cause problems with
+# enbedded spaces in a single options variable.)
+unzopts1='-L-'
+unzopts2='-p'
+unzopts3=''
+
+# ASCII/EBCDIC test. (Note: Simple-looking test, if [[ "a" < "A" ]], is
+# too modern for an old shell (like Solaris /bin/sh)).
+echo A | od -x | grep -i "C115" > /dev/null
+if test $? -eq 0; then
+ unzopts2='-cq'
+ unzopts3='-aa'
+fi
+
+optl0=''
+optl1=''
+optl2=''
+optl3=''
+optlc=0
+optok=1
+opts=""
pat=""
-opt=""
+list=0
+silent=0
while test $# -ne 0; do
- case "$1" in
- -e | -f) opt="$opt $1"; shift; pat="$1";;
- -*) opt="$opt $1";;
- *) if test -z "$pat"; then
- pat="$1"
- else
- break;
- fi;;
- esac
+ if test $optok -ne 0; then
+ case "$1" in
+ -e | -f) opts="$opts $1"; shift; pat="$1";;
+ --) optok=0;;
+ --*) if test "$1" = '--files-with-matches'; then
+ list=1
+ else
+ if test "$1" = '--no-filename'; then
+ silent=1
+ opts="$opts h"
+ else
+ if test $optlc -lt 4; then
+ eval optl${optlc}="$1"
+ optlc=` expr $optlc + 1 `
+ fi
+ fi
+ fi;;
+ -*) opts="$opts $1";;
+ *) if test -z "$pat"; then
+ pat="$1"
+ else
+ break;
+ fi;;
+ esac
+ else
+ if test -z "$pat"; then
+ pat="$1"
+ else
+ break;
+ fi
+ fi
shift
done
fi
zipfile="$1"; shift
-list=0
-silent=0
-opt=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
-case "$opt" in
- *l*) list=1; opt=`echo $opt | sed s/l//`
+opts=`echo "$opts" | sed -e 's/ //g' -e 's/-//g'`
+case "$opst" in
+ *l*) list=1; opts=`echo $opts | sed s/l//`
esac
-case "$opt" in
+case "$opts" in
*h*) silent=1
esac
-if test -n "$opt"; then
- opt="-$opt"
+if test -n "$opts"; then
+ opts="-$opts"
fi
status_grep_global=1
# Escape shell-special characters in "pat".
pat=` echo "$pat" | \
- sed -e 's/\\\\/\\\\\\\\/g' -e 's/|/\\\|/g' -e 's/&/\\\&/g' `
+ sed -e 's/\\\\/\\\\\\\\/g' -e 's/|/\\\|/g' -e 's/&/\\\&/g' \
+ -e 's/*/\\\*/g' -e 's/?/\\\?/g' -e 's/\[/\\\[/g' `
# Use "unzip -Z1" to get a listing of the specified members from the
# specified archive. Escape any backslashes in a file name.
-for i in `unzip -Z1 "$zipfile" ${1+"$@"} | sed -e 's/\\\\/\\\\\\\\/g' `; do
+for i in `$unzip -Z1 "$zipfile" ${1+"$@"} | sed -e 's/\\\\/\\\\\\\\/g' `; do
if test $list -eq 1; then
# "-l": Show only the archive member name, not the matching line(s).
- unzip -p-L "$zipfile" "$i" | \
- egrep $opt "$pat" > /dev/null && echo "$i"
+ $unzip $unzopts1 $unzopts2 $unzopts3 "$zipfile" "$i" | \
+ egrep $opts $optl0 $optl1 $optl2 $optl3 "$pat" > /dev/null && echo "$i"
status_grep=$?
elif test $silent -eq 1; then
# "-h": Show only the matching line(s), not the archive member name.
- # ("-s" in "opt" will silence "egrep", stopping all output.)
- unzip -p-L "$zipfile" "$i" | \
- egrep $opt "$pat"
+ # ("-s" in "opts" will silence "egrep", stopping all output.)
+ $unzip $unzopts1 $unzopts2 $unzopts3 "$zipfile" "$i" | \
+ egrep $opts $optl0 $optl1 $optl2 $optl3 "$pat"
status_grep=$?
else
# Escape (or re-escape) shell-special characters in the archive
# member name, "i".
i=` echo "$i" | \
- sed -e 's/\\\\/\\\\\\\\/g' -e 's/|/\\\|/g' -e 's/&/\\\&/g' `
+ sed -e 's/\\\\/\\\\\\\\/g' -e 's/|/\\\|/g' -e 's/&/\\\&/g' \
+ -e 's/*/\\\*/g' -e 's/?/\\\?/g' -e 's/\[/\\\[/g' `
# Globally, send fd 4 to stdout. In the pipeline, send normal
# stdout to fd 4, and send grep status to fd 3. Collect fd 3
# with ``.
exec 4>&1
status_grep=` ( \
- ( unzip -p-L "$zipfile" "$i" | \
- egrep $opt "$pat" 1>&4 ; echo $? >&3 ) 4>&1 | \
+ ( $unzip $unzopts1 $unzopts2 $unzopts3 "$zipfile" "$i" | \
+ egrep $opts $optl0 $optl1 $optl2 $optl3 "$pat" 1>&4 ; \
+ echo $? >&3 ) 4>&1 | \
sed "s|^|${i}:|" 1>&4 \
) 3>&1 `
fi
# Save the primary command status. (May be the grep status.)
sts=$?
+ if test -z "$status_grep"; then
+ status_grep=${sts}
+ fi
# If this grep status was zero, set the global grep status to zero.
test "$status_grep" -eq 0 && status_grep_global=0
# If this grep status was not zero or one, exit now.
done
+# If "sts" was not set, then assume disaster. (UnZip failed?)
+if test -z "$sts"; then
+ exit 2
+fi
+
# If "sts" is good (0), then exit with the global grep status.
# Else, when "sts" is bad, exit with the worst status we can find.
if test $sts -eq 0 ; then
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 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.
/* non-memory-limited machines: allocate second (large) buffer for
* textmode conversion in flush(), but only if needed */
if (G.pInfo->textmode && !G.outbuf2 &&
- (G.outbuf2 = (uch *)malloc(TRANSBUFSIZ)) == (uch *)NULL)
+ (G.outbuf2 = (uch *)izu_malloc(TRANSBUFSIZ)) == (uch *)NULL)
return PK_MEM3;
#endif
#endif /* !VMS */
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
which in turn was almost a complete rewrite of version 3.x. For a detailed
revision history, see UnzpHist.zip at quest.jpl.nasa.gov. For a list of
the many (near infinite) contributors, see "CONTRIBS" in the UnZip source
- distribution.
+ distribution. (Some of this information is outdated and needs to be
+ updated.)
UnZip 6.0 adds support for archives larger than 4 GiB using the Zip64
extensions as well as support for Unicode information embedded per the
---------------------------------------------------------------------------
- Version: unzip5??.{tar.Z | tar.gz | zip} for Unix, VMS, OS/2, MS-DOS, Amiga,
- Atari, Windows 3.x/95/NT/CE, Macintosh, Human68K, Acorn RISC OS,
- AtheOS, BeOS, SMS/QDOS, VM/CMS, MVS, AOS/VS, Tandem NSK, Theos
- and TOPS-20.
-
Copyrights: see accompanying file "LICENSE" in UnZip source distribution.
(This software is free but NOT IN THE PUBLIC DOMAIN.)
#include "crypt.h"
#include "unzvers.h"
-#ifndef WINDLL /* The WINDLL port uses windll/windll.c instead... */
+#if defined( UNIX) && defined( __APPLE__)
+# include "unix/macosx.h"
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
+#ifdef IZ_CRYPT_AES_WG
+# include "aes_wg/aesopt.h"
+# include "aes_wg/iz_aes_wg.h"
+#endif /* def IZ_CRYPT_AES_WG */
+
+#if defined( LZMA_SUPPORT) || defined( PPMD_SUPPORT)
+# include "szip/SzVersion.h"
+#endif /* defined( LZMA_SUPPORT) || defined( PPMD_SUPPORT) */
+
+#ifndef WINDLL_OLD /* The WINDLL port uses windll/windll.c instead... */
+
+# ifdef DLL
+# ifndef NO_EXCEPT_SIGNALS
+# define NO_EXCEPT_SIGNALS
+# endif /* ndef NO_EXCEPT_SIGNALS */
+# endif /* def DLL */
/***************************/
/* Local type declarations */
/***************************/
-#if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
+# if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
typedef struct _sign_info
{
struct _sign_info *previous;
void (*sighandler)(int);
int sigtype;
} savsigs_info;
-#endif
+# endif /* (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS)) */
/*******************/
/* Local Functions */
/*******************/
-#if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
+# if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
static int setsignalhandler OF((__GPRO__ savsigs_info **p_savedhandler_chain,
int signal_type, void (*newhandler)(int)));
-#endif
-#ifndef SFX
+# endif
+
+static void show_license OF((__GPRO));
+# ifndef SFX
static void help_extended OF((__GPRO));
+static void show_options OF((__GPRO));
+# endif /* ndef SFX */
+# if !defined( SFX) || defined( DIAG_SFX)
static void show_version_info OF((__GPRO));
-#endif
+# endif /* !defined( SFX) || defined( DIAG_SFX) */
+
+# ifdef ENABLE_USER_PROGRESS
+# ifdef VMS
+# define USER_PROGRESS_CLASS extern
+# else /* def VMS */
+# define USER_PROGRESS_CLASS static
+# endif /* def VMS [else] */
+USER_PROGRESS_CLASS void user_progress OF((int));
+# endif /* def ENABLE_USER_PROGRESS */
/*************/
/* Constants */
/*************/
-#include "consts.h" /* all constant global variables are in here */
+# include "consts.h" /* all constant global variables are in here */
/* (non-constant globals were moved to globals.c) */
/* constant local variables: */
-#ifndef SFX
-#ifndef _WIN32_WCE /* Win CE does not support environment variables */
- static ZCONST char Far EnvUnZip[] = ENV_UNZIP;
- static ZCONST char Far EnvUnZip2[] = ENV_UNZIP2;
- static ZCONST char Far EnvZipInfo[] = ENV_ZIPINFO;
- static ZCONST char Far EnvZipInfo2[] = ENV_ZIPINFO2;
-#ifdef RISCOS
- static ZCONST char Far EnvUnZipExts[] = ENV_UNZIPEXTS;
-#endif /* RISCOS */
- static ZCONST char Far NoMemEnvArguments[] =
- "envargs: cannot get memory for arguments";
-#endif /* !_WIN32_WCE */
- static ZCONST char Far CmdLineParamTooLong[] =
- "error: command line parameter #%d exceeds internal size limit\n";
-#endif /* !SFX */
-
-#if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
- static ZCONST char Far CantSaveSigHandler[] =
- "error: cannot save signal handler settings\n";
-#endif
-
-#if (!defined(SFX) || defined(SFX_EXDIR))
- static ZCONST char Far NotExtracting[] =
- "caution: not extracting; -d ignored\n";
- static ZCONST char Far MustGiveExdir[] =
- "error: must specify directory to which to extract with -d option\n";
- static ZCONST char Far OnlyOneExdir[] =
- "error: -d option used more than once (only one exdir allowed)\n";
-#endif
-#if (defined(UNICODE_SUPPORT) && !defined(UNICODE_WCHAR))
- static ZCONST char Far UTF8EscapeUnSupp[] =
- "warning: -U \"escape all non-ASCII UTF-8 chars\" is not supported\n";
-#endif
-
-#if CRYPT
- static ZCONST char Far MustGivePasswd[] =
- "error: must give decryption password with -P option\n";
-#endif
-
-#ifndef SFX
- static ZCONST char Far Zfirst[] =
- "error: -Z must be first option for ZipInfo mode (check UNZIP variable?)\n";
-#endif
+# if !defined( SFX) || defined( DIAG_SFX)
+# ifndef _WIN32_WCE /* Win CE does not support environment variables */
+static ZCONST char Far EnvUnZip[] = ENV_UNZIP;
+static ZCONST char Far EnvUnZip2[] = ENV_UNZIP2;
+static ZCONST char Far EnvZipInfo[] = ENV_ZIPINFO;
+static ZCONST char Far EnvZipInfo2[] = ENV_ZIPINFO2;
+# ifdef RISCOS
+static ZCONST char Far EnvUnZipExts[] = ENV_UNZIPEXTS;
+# endif /* RISCOS */
+static ZCONST char Far NoMemEnvArguments[] =
+ "envargs: cannot get memory for arguments";
+# endif /* !_WIN32_WCE */
+static ZCONST char Far CmdLineParamTooLong[] =
+ "error: command line parameter #%d exceeds internal size limit\n";
+# endif /* !defined( SFX) || defined( DIAG_SFX) */
+
+static ZCONST char Far NoMemArgsList[] =
+ "error: no memory for arguments list";
+
+# if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
+static ZCONST char Far CantSaveSigHandler[] =
+ "error: cannot save signal handler settings\n";
+# endif
+
+# if !defined( SFX) || defined( DIAG_SFX) || defined( SFX_EXDIR)
+static ZCONST char Far NotExtracting[] =
+ "caution: not extracting; -d ignored\n";
+static ZCONST char Far MustGiveExdir[] =
+ "error: must specify directory to which to extract with -d option\n";
+static ZCONST char Far OnlyOneExdir[] =
+ "error: -d option used more than once (only one exdir allowed)\n";
+# endif /* !defined( SFX) || defined( DIAG_SFX) || defined( SFX_EXDIR) */
+
+# if (defined(UNICODE_SUPPORT) && !defined(UNICODE_WCHAR))
+static ZCONST char Far UTF8EscapeUnSupp[] =
+ "warning: -U \"escape all non-ASCII UTF-8 chars\" is not supported\n";
+# endif
+
+# ifdef IZ_CRYPT_ANY
+static ZCONST char Far MustGivePasswd[] =
+ "error: must give decryption password with -P option\n";
+# endif
+
+# ifndef SFX
+static ZCONST char Far Zfirst[] =
+ "error: -Z must be first option for ZipInfo mode (check UNZIP variable?)\n";
+static ZCONST char Far BadAutoDestValue[] =
+ "error: option -da/auto-extract-dir value must be 'reuse'\n";
+# endif /* ndef SFX */
+
static ZCONST char Far InvalidOptionsMsg[] = "error:\
-fn or any combination of -c, -l, -p, -t, -u and -v options invalid\n";
static ZCONST char Far IgnoreOOptionMsg[] =
- "caution: both -n and -o specified; ignoring -o\n";
+ "caution: both -n and -o specified; ignoring -o\n";
+static ZCONST char Far BadJunkDirsValue[] =
+ "error: option -j/--junk-dirs value must be numeric\n";
/* usage() strings */
-#ifndef SFX
-#ifdef VMS
- static ZCONST char Far Example3[] = "vms.c";
- static ZCONST char Far Example2[] = " unzip \"-V\" foo \"Bar\"\
+# ifndef SFX
+# ifdef VMS
+static ZCONST char Far Example3[] = "vms.c";
+static ZCONST char Far Example2[] = " unzip \"-V\" foo \"Bar\"\
(Quote names to preserve case, unless SET PROC/PARS=EXT)\n";
-#else /* !VMS */
- static ZCONST char Far Example3[] = "ReadMe";
-#ifdef RISCOS
- static ZCONST char Far Example2[] =
-" unzip foo -d RAM:$ => extract all files from foo into RAMDisc\n";
-#else /* !RISCOS */
-#if (defined(OS2) || (defined(DOS_FLX_OS2_W32) && defined(MORE)))
- static ZCONST char Far Example2[] =
- ""; /* no room: too many local3[] items */
-#else /* !OS2 */
-#ifdef MACOS
- static ZCONST char Far Example2[] = ""; /* not needed */
-#else /* !MACOS */
- static ZCONST char Far Example2[] = " \
+# else /* !VMS */
+static ZCONST char Far Example3[] = "ReadMe";
+# ifdef RISCOS
+static ZCONST char Far Example2[] =
+ " unzip foo -d RAM:$ => extract all files from foo into RAMDisc\n";
+# else /* !RISCOS */
+# if (defined(OS2) || (defined(DOS_FLX_OS2_W32) && defined(MORE)))
+static ZCONST char Far Example2[] =
+ ""; /* no room: too many local3[] items */
+# else /* !OS2 */
+# ifdef MACOS
+static ZCONST char Far Example2[] = ""; /* not needed */
+# else /* !MACOS */
+static ZCONST char Far Example2[] = " \
unzip -p foo | more => send contents of foo.zip via pipe into program more\n";
-#endif /* ?MACOS */
-#endif /* ?OS2 */
-#endif /* ?RISCOS */
-#endif /* ?VMS */
+# endif /* ?MACOS */
+# endif /* ?OS2 */
+# endif /* ?RISCOS */
+# endif /* ?VMS */
/* local1[]: command options */
-#if defined(TIMESTAMP)
- static ZCONST char Far local1[] =
- " -T timestamp archive to latest";
-#else /* !TIMESTAMP */
- static ZCONST char Far local1[] = "";
-#endif /* ?TIMESTAMP */
+# if defined(TIMESTAMP)
+static ZCONST char Far local1[] =
+ " -T timestamp archive to latest";
+# else /* !TIMESTAMP */
+static ZCONST char Far local1[] = "";
+# endif /* ?TIMESTAMP */
/* local2[] and local3[]: modifier options */
-#ifdef DOS_FLX_H68_OS2_W32
-#ifdef FLEXOS
- static ZCONST char Far local2[] = "";
-#else
- static ZCONST char Far local2[] =
- " -$ label removables (-$$ => fixed disks)";
-#endif
-#ifdef OS2
-#ifdef MORE
- static ZCONST char Far local3[] = "\
+# ifdef DOS_FLX_H68_OS2_W32
+# ifdef FLEXOS
+static ZCONST char Far local2[] = "";
+# else
+static ZCONST char Far local2[] =
+ " -$ label removables (-$$ => fixed disks)";
+# endif
+# ifdef OS2
+# ifdef MORE
+static ZCONST char Far local3[] = "\
-X restore ACLs if supported -s spaces in filenames => '_'\n\
-M pipe through \"more\" pager\n";
-#else
- static ZCONST char Far local3[] = " \
+# else
+static ZCONST char Far local3[] = " \
-X restore ACLs if supported -s spaces in filenames => '_'\n\n";
-#endif /* ?MORE */
-#else /* !OS2 */
-#ifdef WIN32
-#ifdef NTSD_EAS
-#ifdef MORE
- static ZCONST char Far local3[] = "\
+# endif /* ?MORE */
+# else /* !OS2 */
+# ifdef WIN32
+# ifdef NTSD_EAS
+# ifdef MORE
+static ZCONST char Far local3[] = "\
-X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'\n\
-M pipe through \"more\" pager\n";
-#else
- static ZCONST char Far local3[] = " \
+# else
+static ZCONST char Far local3[] = " \
-X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'\n\n";
-#endif /* ?MORE */
-#else /* !NTSD_EAS */
-#ifdef MORE
- static ZCONST char Far local3[] = "\
+# endif /* ?MORE */
+# else /* !NTSD_EAS */
+# ifdef MORE
+static ZCONST char Far local3[] = "\
-M pipe through \"more\" pager \
-s spaces in filenames => '_'\n\n";
-#else
- static ZCONST char Far local3[] = " \
+# else
+static ZCONST char Far local3[] = " \
-s spaces in filenames => '_'\n\n";
-#endif /* ?MORE */
-#endif /* ?NTSD_EAS */
-#else /* !WIN32 */
-#ifdef MORE
- static ZCONST char Far local3[] = " -\
+# endif /* ?MORE */
+# endif /* ?NTSD_EAS */
+# else /* !WIN32 */
+# ifdef MORE
+static ZCONST char Far local3[] = " -\
M pipe through \"more\" pager -s spaces in filenames => '_'\n\n";
-#else
- static ZCONST char Far local3[] = "\
+# else /* def MORE */
+static ZCONST char Far local3[] = "\
-s spaces in filenames => '_'\n";
-#endif
-#endif /* ?WIN32 */
-#endif /* ?OS2 || ?WIN32 */
-#else /* !DOS_FLX_OS2_W32 */
-#ifdef VMS
- static ZCONST char Far local2[] = " -X restore owner/ACL protection info";
-#ifdef MORE
- static ZCONST char Far local3[] = "\
+# endif /* def MORE [else] */
+# endif /* ?WIN32 */
+# endif /* ?OS2 || ?WIN32 */
+# else /* !DOS_FLX_OS2_W32 */
+# ifdef VMS
+# ifdef KFLAG
+static ZCONST char Far local2[] = " -X | -k | -ka restore UIC | prot | ACL";
+# else /* def KFLAG */
+static ZCONST char Far local2[] = " -X | -ka restore UIC | ACL";
+# endif /* def KFLAG [else] */
+# ifdef MORE
+static ZCONST char Far local3[] = "\
-Y treat \".nnn\" as \";nnn\" version -2 force ODS2 names\n\
- --D restore dir (-D: no) timestamps -M pipe through \"more\" pager\n\
+ -D- restore dir (-D: no) timestamps -M pipe through \"more\" pager\n\
(Must quote upper-case options, like \"-V\", unless SET PROC/PARSE=EXTEND.)\
\n\n";
-#else
- static ZCONST char Far local3[] = "\n\
+# else /* def MORE */
+static ZCONST char Far local3[] = "\n\
-Y treat \".nnn\" as \";nnn\" version -2 force ODS2 names\n\
- --D restore dir (-D: no) timestamps\n\
+ -D- restore dir (-D: no) timestamps\n\
(Must quote upper-case options, like \"-V\", unless SET PROC/PARSE=EXTEND.)\
\n\n";
-#endif
-#else /* !VMS */
-#ifdef ATH_BEO_UNX
- static ZCONST char Far local2[] = " -X restore UID/GID info";
-#ifdef MORE
- static ZCONST char Far local3[] = "\
+# endif /* def MORE [else] */
+# else /* !VMS */
+# ifdef ATH_BEO_UNX
+# ifdef KFLAG
+static ZCONST char Far local2[] = " -X | -k restore UID/GID | permissions";
+# else /* def KFLAG */
+static ZCONST char Far local2[] = " -X restore UID/GID info";
+# endif /* def KFLAG [else] */
+# ifdef __APPLE__
+# ifdef MORE
+static ZCONST char Far local3[] = "\
+ -K keep setuid/setgid/tacky permissions -M pipe through \"more\" pager\n\
+ -J No special AppleDouble file handling\n\
+ -Je/-Jf/-Jq/-Jr ignore extended attrs/Finder info/quarantine/resource fork\
+\n";
+# else /* def MORE */
+static ZCONST char Far local3[] = "\
+ -K keep setuid/setgid/tacky permissions -J No spec'l AplDbl file handling\
+\n\
+ -Je/-Jf/-Jq/-Jr ignore extended attrs/Finder info/quarantine/resource fork\
+\n";
+# endif /* def MORE [else] */
+# else /* def __APPLE__ */
+# ifdef MORE
+static ZCONST char Far local3[] = "\
-K keep setuid/setgid/tacky permissions -M pipe through \"more\" pager\n";
-#else
- static ZCONST char Far local3[] = "\
+# else /* def MORE */
+static ZCONST char Far local3[] = "\
-K keep setuid/setgid/tacky permissions\n";
-#endif
-#else /* !ATH_BEO_UNX */
-#ifdef TANDEM
- static ZCONST char Far local2[] = "\
+# endif /* def MORE [else] */
+# endif /* def __APPLE__ [else] */
+# else /* !ATH_BEO_UNX */
+# ifdef TANDEM
+static ZCONST char Far local2[] = "\
-X restore Tandem User ID -r remove file extensions\n\
-b create 'C' (180) text files ";
-#ifdef MORE
- static ZCONST char Far local3[] = " \
+# ifdef MORE
+static ZCONST char Far local3[] = " \
-M pipe through \"more\" pager\n";
-#else
- static ZCONST char Far local3[] = "\n";
-#endif
-#else /* !TANDEM */
-#ifdef AMIGA
- static ZCONST char Far local2[] = " -N restore comments as filenotes";
-#ifdef MORE
- static ZCONST char Far local3[] = " \
+# else /* def MORE */
+static ZCONST char Far local3[] = "\n";
+# endif /* def MORE [else] */
+# else /* !TANDEM */
+# ifdef AMIGA
+static ZCONST char Far local2[] = " -N restore comments as filenotes";
+# ifdef MORE
+static ZCONST char Far local3[] = " \
-M pipe through \"more\" pager\n";
-#else
- static ZCONST char Far local3[] = "\n";
-#endif
-#else /* !AMIGA */
-#ifdef MACOS
- static ZCONST char Far local2[] = " -E show Mac info during extraction";
- static ZCONST char Far local3[] = " \
+# else /* def MORE */
+static ZCONST char Far local3[] = "\n";
+# endif /* def MORE [else] */
+# else /* !AMIGA */
+# ifdef MACOS
+static ZCONST char Far local2[] = " -E show Mac info during extraction";
+static ZCONST char Far local3[] = " \
-i ignore filenames in mac extra info -J junk (ignore) Mac extra info\n\
\n";
-#else /* !MACOS */
-#ifdef MORE
- static ZCONST char Far local2[] = " -M pipe through \"more\" pager";
- static ZCONST char Far local3[] = "\n";
-#else
- static ZCONST char Far local2[] = ""; /* Atari, Mac, CMS/MVS etc. */
- static ZCONST char Far local3[] = "";
-#endif
-#endif /* ?MACOS */
-#endif /* ?AMIGA */
-#endif /* ?TANDEM */
-#endif /* ?ATH_BEO_UNX */
-#endif /* ?VMS */
-#endif /* ?DOS_FLX_OS2_W32 */
-#endif /* !SFX */
-
-#ifndef NO_ZIPINFO
-#ifdef VMS
- static ZCONST char Far ZipInfoExample[] = "* or % (e.g., \"*font-%.zip\")";
-#else
- static ZCONST char Far ZipInfoExample[] = "*, ?, [] (e.g., \"[a-j]*.zip\")";
-#endif
+# else /* !MACOS */
+# ifdef MORE
+static ZCONST char Far local2[] = " -M pipe through \"more\" pager";
+static ZCONST char Far local3[] = "\n";
+# else /* def MORE */
+static ZCONST char Far local2[] = ""; /* Atari, Mac, CMS/MVS etc. */
+static ZCONST char Far local3[] = "";
+# endif /* def MORE [else] */
+# endif /* ?MACOS */
+# endif /* ?AMIGA */
+# endif /* ?TANDEM */
+# endif /* ?ATH_BEO_UNX */
+# endif /* ?VMS */
+# endif /* ?DOS_FLX_OS2_W32 */
+# endif /* ndef SFX */
+
+# ifndef NO_ZIPINFO
+# ifdef VMS
+static ZCONST char Far ZipInfoExample[] = "* or % (e.g., \"*font-%.zip\")";
+# else
+static ZCONST char Far ZipInfoExample[] = "*, ?, [] (e.g., \"[a-j]*.zip\")";
+# endif
static ZCONST char Far ZipInfoUsageLine1[] = "\
ZipInfo %d.%d%d%s of %s, by Greg Roelofs and the Info-ZIP group.\n\
-z print zipfile comment -T print file times in sortable decimal format\
\n -C be case-insensitive %s\
-x exclude filenames that follow from listing\n";
-#ifdef MORE
- static ZCONST char Far ZipInfoUsageLine4[] =
+# ifdef MORE
+static ZCONST char Far ZipInfoUsageLine4[] =
" -M page output through built-in \"more\"\n";
-#else /* !MORE */
- static ZCONST char Far ZipInfoUsageLine4[] = "";
-#endif /* ?MORE */
-#endif /* !NO_ZIPINFO */
-
-#ifdef BETA
-# ifdef VMSCLI
- /* BetaVersion[] is also used in vms/cmdline.c: do not make it static */
- ZCONST char Far BetaVersion[] = "%s\
+# else /* !MORE */
+static ZCONST char Far ZipInfoUsageLine4[] = "";
+# endif /* ?MORE */
+# endif /* !NO_ZIPINFO */
+
+# ifdef BETA
+# ifndef VMSCLI
+static /* Used in vms/cmdline.c, so not static in VMS CLI. */
+# endif /* ndef VMSCLI */
+ZCONST char Far BetaVersion[] = "%s\
THIS IS STILL A BETA VERSION OF UNZIP%s -- DO NOT DISTRIBUTE.\n\n";
-# else
- static ZCONST char Far BetaVersion[] = "%s\
- THIS IS STILL A BETA VERSION OF UNZIP%s -- DO NOT DISTRIBUTE.\n\n";
-# endif
-#endif
+# endif
-#ifdef SFX
-# ifdef VMSCLI
- /* UnzipSFXBanner[] is also used in vms/cmdline.c: do not make it static */
- ZCONST char Far UnzipSFXBanner[] =
-# else
- static ZCONST char Far UnzipSFXBanner[] =
-# endif
+# ifdef SFX
+# ifndef VMSCLI
+static /* Used in vms/cmdline.c, so not static in VMS CLI. */
+# endif /* ndef VMSCLI */
+ZCONST char Far UnzipSFXBanner[] =
"UnZipSFX %d.%d%d%s of %s, by Info-ZIP (http://www.info-zip.org).\n";
# ifdef SFX_EXDIR
- static ZCONST char Far UnzipSFXOpts[] =
- "Valid options are -tfupcz and -d <exdir>; modifiers are -abjnoqCL%sV%s.\n";
+static ZCONST char Far UnzipSFXOpts[] =
+ "Valid options are -cfptuz; modifiers are -abCdjLnoPq%sV%s.\n";
# else
- static ZCONST char Far UnzipSFXOpts[] =
- "Valid options are -tfupcz; modifiers are -abjnoqCL%sV%s.\n";
-# endif
-#else /* !SFX */
- static ZCONST char Far CompileOptions[] =
- "UnZip special compilation options:\n";
- static ZCONST char Far CompileOptFormat[] = " %s\n";
-#ifndef _WIN32_WCE /* Win CE does not support environment variables */
- static ZCONST char Far EnvOptions[] =
- "\nUnZip and ZipInfo environment options:\n";
- static ZCONST char Far EnvOptFormat[] = "%16s: %.1024s\n";
-#endif
- static ZCONST char Far None[] = "[none]";
+static ZCONST char Far UnzipSFXOpts[] =
+ "Valid options are -cfptuz; modifiers are -abCjLnoPq%sV%s.\n";
+# endif
+# ifdef VMS
+static ZCONST char Far UnzipSFXOptsV[] =
+"(Must quote upper-case options, like \"-V\", unless SET PROC/PARSE=EXTEND.)\n";
+# endif /* def VMS */
+static ZCONST char Far UnzipSFXOpts2[] =
+ "For license info: \"--license\".\n";
+# endif /* def SFX */
+
+# if !defined( SFX) || defined( DIAG_SFX)
+static ZCONST char Far CompileOptions[] =
+ "UnZip special compilation options:\n";
+static ZCONST char Far CompileOptFormat[] = " %s\n";
+# ifndef _WIN32_WCE /* Win CE does not support environment variables */
+static ZCONST char Far EnvOptions[] =
+ "\nUnZip and ZipInfo environment options:\n";
+static ZCONST char Far EnvOptFormat[] = "%16s: %.1024s\n";
+# endif
+static ZCONST char Far None[] = "[none]";
# ifdef ACORN_FTYPE_NFS
- static ZCONST char Far AcornFtypeNFS[] = "ACORN_FTYPE_NFS";
+static ZCONST char Far AcornFtypeNFS[] = "ACORN_FTYPE_NFS";
# endif
+
+# if defined( UNIX) && defined( __APPLE__)
+# ifndef APPLE_NFRSRC
+ /* Next "#" indented to accommodate K&R (#error-ignorant) compilers. */
+ # error APPLE_NFRSRC not defined.
+# endif
+# if defined( __ppc__) || defined( __ppc64__)
+# if APPLE_NFRSRC
+# define APPLE_NFRSRC_MSG
+static ZCONST char Far AppleNFRSRC[] =
+ "APPLE_NFRSRC (\"/..namedfork/rsrc\" suffix for resource fork)";
+# endif /* APPLE_NFRSRC */
+# else /* defined( __ppc__) || defined( __ppc64__) */
+# if ! APPLE_NFRSRC
+# define APPLE_NFRSRC_MSG
+static ZCONST char Far AppleNFRSRC[] =
+ "APPLE_NFRSRC (NOT! \"/rsrc\" suffix for resource fork)";
+# endif /* ! APPLE_NFRSRC */
+# endif /* defined( __ppc__) || defined( __ppc64__) [else] */
+# ifdef APPLE_XATTR
+static ZCONST char Far AppleXATTR[] =
+ "APPLE_XATTR (Apple extended attributes supported)";
+# endif /* def APPLE_XATTR */
+# endif /* defined( UNIX) && defined( __APPLE__) */
+
# ifdef ASM_CRC
- static ZCONST char Far AsmCRC[] = "ASM_CRC";
+static ZCONST char Far AsmCRC[] =
+ "ASM_CRC (Assembly code used for CRC calculation)";
# endif
# ifdef ASM_INFLATECODES
- static ZCONST char Far AsmInflateCodes[] = "ASM_INFLATECODES";
+static ZCONST char Far AsmInflateCodes[] =
+ "ASM_INFLATECODES (Assembly code used for Inflate)";
# endif
# ifdef CHECK_VERSIONS
- static ZCONST char Far Check_Versions[] = "CHECK_VERSIONS";
+static ZCONST char Far Check_Versions[] =
+ "CHECK_VERSIONS (Check VMS versions, build v. run-time)";
# endif
# ifdef COPYRIGHT_CLEAN
- static ZCONST char Far Copyright_Clean[] =
- "COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)";
+static ZCONST char Far Copyright_Clean[] =
+ "COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)";
# endif
# ifdef DEBUG
- static ZCONST char Far UDebug[] = "DEBUG";
+static ZCONST char Far UDebug[] = "DEBUG";
# endif
# ifdef DEBUG_TIME
- static ZCONST char Far DebugTime[] = "DEBUG_TIME";
+static ZCONST char Far DebugTime[] = "DEBUG_TIME";
+# endif
+# ifdef DEFLATE64_SUPPORT
+static ZCONST char Far Deflate64_Sup[] =
+ "DEFLATE64_SUPPORT (PKZIP 4.x Deflate64(tm) supported)";
# endif
# ifdef DLL
- static ZCONST char Far Dll[] = "DLL";
+static ZCONST char Far Dll[] =
+ "DLL (UnZip built as DLL or object library)";
# endif
# ifdef DOSWILD
- static ZCONST char Far DosWild[] = "DOSWILD";
+static ZCONST char Far DosWild[] = "DOSWILD";
+# endif
+# ifdef ICONV_MAPPING
+static ZCONST char Far Iconv[] =
+ "ICONV_MAPPING (ISO/OEM (iconv, -I/-O) conversion supported)";
+# endif
+# ifdef IZ_HAVE_UXUIDGID
+static ZCONST char Far ux_Uid_Gid[] =
+ "IZ_HAVE_UXUIDGID (UID, GID > 16-bit (\"ux\" extra block) supported)";
# endif
# ifdef LZW_CLEAN
- static ZCONST char Far LZW_Clean[] =
- "LZW_CLEAN (PKZIP/Zip 1.x unshrinking method not supported)";
+static ZCONST char Far LZW_Clean[] =
+ "LZW_CLEAN (PKZIP/Zip 1.x unshrink method not supported)";
# endif
# ifndef MORE
- static ZCONST char Far No_More[] = "NO_MORE";
+static ZCONST char Far No_More[] =
+ "NO_MORE (Built-in -M pager (\"more\") disabled)";
# endif
# ifdef NO_ZIPINFO
- static ZCONST char Far No_ZipInfo[] = "NO_ZIPINFO";
+static ZCONST char Far No_ZipInfo[] =
+ "NO_ZIPINFO (ZipInfo -Z mode disabled)";
# endif
# ifdef NTSD_EAS
- static ZCONST char Far NTSDExtAttrib[] = "NTSD_EAS";
+static ZCONST char Far NTSDExtAttrib[] =
+ "NTSD_EAS (Windows NT extended attributes supported)";
# endif
# if defined(WIN32) && defined(NO_W32TIMES_IZFIX)
- static ZCONST char Far W32NoIZTimeFix[] = "NO_W32TIMES_IZFIX";
+static ZCONST char Far W32NoIZTimeFix[] = "NO_W32TIMES_IZFIX";
# endif
# ifdef OLD_THEOS_EXTRA
- static ZCONST char Far OldTheosExtra[] =
- "OLD_THEOS_EXTRA (handle also old Theos port extra field)";
+static ZCONST char Far OldTheosExtra[] =
+ "OLD_THEOS_EXTRA (Handle also old Theos port extra field)";
# endif
# ifdef OS2_EAS
- static ZCONST char Far OS2ExtAttrib[] = "OS2_EAS";
+static ZCONST char Far OS2ExtAttrib[] =
+ "OS2_EAS (OS/2 extended attributes supported)";
# endif
# ifdef QLZIP
- static ZCONST char Far SMSExFldOnUnix[] = "QLZIP";
+static ZCONST char Far SMSExFldOnUnix[] = "QLZIP";
# endif
# ifdef REENTRANT
- static ZCONST char Far Reentrant[] = "REENTRANT";
+static ZCONST char Far Reentrant[] =
+ "REENTRANT (UnZip built for reentrancy)";
# endif
# ifdef REGARGS
- static ZCONST char Far RegArgs[] = "REGARGS";
+static ZCONST char Far RegArgs[] = "REGARGS";
# endif
# ifdef RETURN_CODES
- static ZCONST char Far Return_Codes[] = "RETURN_CODES";
+static ZCONST char Far Return_Codes[] =
+ "RETURN_CODES (Display error message at exit)";
# endif
# ifdef SET_DIR_ATTRIB
- static ZCONST char Far SetDirAttrib[] = "SET_DIR_ATTRIB";
+static ZCONST char Far SetDirAttrib[] =
+ "SET_DIR_ATTRIB (Setting directory attributes supported)";
# endif
# ifdef SYMLINKS
- static ZCONST char Far SymLinkSupport[] =
- "SYMLINKS (symbolic links supported, if RTL and file system permit)";
+static ZCONST char Far SymLinkSupport[] =
+ "SYMLINKS (Symbolic links supported, if RTL and file sys do)";
# endif
# ifdef TIMESTAMP
- static ZCONST char Far TimeStamp[] = "TIMESTAMP";
+static ZCONST char Far TimeStamp[] =
+ "TIMESTAMP (Restoring file timestamps supported)";
# endif
# ifdef UNIXBACKUP
- static ZCONST char Far UnixBackup[] = "UNIXBACKUP";
+static ZCONST char Far UnixBackup[] =
+ "UNIXBACKUP (-B creates backup files)";
# endif
# ifdef USE_EF_UT_TIME
- static ZCONST char Far Use_EF_UT_time[] = "USE_EF_UT_TIME";
+static ZCONST char Far Use_EF_UT_time[] =
+ "USE_EF_UT_TIME (Use Universal Time, if available)";
# endif
# ifndef LZW_CLEAN
- static ZCONST char Far Use_Unshrink[] =
- "USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)";
+static ZCONST char Far Unshrink_Sup[] =
+ "UNSHRINK_SUPPORT (PKZIP/Zip 1.x unshrinking method supported)";
# endif
# ifndef COPYRIGHT_CLEAN
- static ZCONST char Far Use_Smith_Code[] =
- "USE_SMITH_CODE (PKZIP 0.9x unreducing method supported)";
-# endif
-# ifdef USE_DEFLATE64
- static ZCONST char Far Use_Deflate64[] =
- "USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)";
+static ZCONST char Far Use_Smith_Code[] =
+ "USE_SMITH_CODE (PKZIP 0.9x unreducing method supported)";
# endif
# ifdef UNICODE_SUPPORT
# ifdef UTF8_MAYBE_NATIVE
# ifdef UNICODE_WCHAR
/* direct native UTF-8 check AND charset transform via wchar_t */
- static ZCONST char Far Use_Unicode[] =
- "UNICODE_SUPPORT [wide-chars, char coding: %s] (handle UTF-8 paths)";
+static ZCONST char Far Unicode_Sup[] =
+ "UNICODE_SUPPORT [wide-chars, char coding: %s] (handle UTF-8 paths)";
# else
/* direct native UTF-8 check, only */
- static ZCONST char Far Use_Unicode[] =
- "UNICODE_SUPPORT [char coding: %s] (handle UTF-8 paths)";
+static ZCONST char Far Unicode_Sup[] =
+ "UNICODE_SUPPORT [char coding: %s] (handle UTF-8 paths)";
# endif
- static ZCONST char Far SysChUTF8[] = "UTF-8";
- static ZCONST char Far SysChOther[] = "other";
+static ZCONST char Far SysChUTF8[] = "UTF-8";
+static ZCONST char Far SysChOther[] = "other";
# else /* !UTF8_MAYBE_NATIVE */
/* charset transform via wchar_t, no native UTF-8 support */
- static ZCONST char Far Use_Unicode[] =
- "UNICODE_SUPPORT [wide-chars] (handle UTF-8 paths)";
+static ZCONST char Far Unicode_Sup[] =
+ "UNICODE_SUPPORT [wide-chars] (handle UTF-8 paths)";
# endif /* ?UTF8_MAYBE_NATIVE */
# endif /* UNICODE_SUPPORT */
+# ifdef WIN32_WIDE
+static ZCONST char Far Win32_Wide_Sup[] =
+ "WIN32_WIDE (Wide characters supported)";
+# endif
# ifdef _MBCS
- static ZCONST char Far Have_MBCS_Support[] =
- "MBCS-support (multibyte character support, MB_CUR_MAX = %u)";
+static ZCONST char Far Have_MBCS_Support[] =
+ "MBCS-support (Multibyte character support, MB_CUR_MAX = %u)";
# endif
# ifdef MULT_VOLUME
- static ZCONST char Far Use_MultiVol[] =
- "MULT_VOLUME (multi-volume archives supported)";
+static ZCONST char Far MultiVol_Sup[] =
+ "MULT_VOLUME (Multi-volume archives supported)";
# endif
# ifdef LARGE_FILE_SUPPORT
- static ZCONST char Far Use_LFS[] =
- "LARGE_FILE_SUPPORT (large files over 2 GiB supported)";
+static ZCONST char Far LFS_Sup[] =
+ "LARGE_FILE_SUPPORT (Large files over 2 GiB supported)";
# endif
# ifdef ZIP64_SUPPORT
- static ZCONST char Far Use_Zip64[] =
- "ZIP64_SUPPORT (archives using Zip64 for large files supported)";
+static ZCONST char Far Zip64_Sup[] =
+ "ZIP64_SUPPORT (Archives using Zip64 for large files supported)";
# endif
# if (defined(__DJGPP__) && (__DJGPP__ >= 2))
-# ifdef USE_DJGPP_ENV
- static ZCONST char Far Use_DJGPP_Env[] = "USE_DJGPP_ENV";
-# endif
-# ifdef USE_DJGPP_GLOB
- static ZCONST char Far Use_DJGPP_Glob[] = "USE_DJGPP_GLOB";
-# endif
+# ifdef USE_DJGPP_ENV
+static ZCONST char Far Use_DJGPP_Env[] = "USE_DJGPP_ENV";
+# endif
+# ifdef USE_DJGPP_GLOB
+static ZCONST char Far Use_DJGPP_Glob[] = "USE_DJGPP_GLOB";
+# endif
# endif /* __DJGPP__ && (__DJGPP__ >= 2) */
# ifdef USE_VFAT
- static ZCONST char Far Use_VFAT_support[] = "USE_VFAT";
+static ZCONST char Far Use_VFAT_support[] = "USE_VFAT";
# endif
# ifdef USE_ZLIB
- static ZCONST char Far UseZlib[] =
- "USE_ZLIB (compiled with version %s; using version %s)";
-# endif
-# ifdef USE_BZIP2
- static ZCONST char Far UseBZip2[] =
- "USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version %s)";
-# endif
+static ZCONST char Far UseZlib[] =
+ "USE_ZLIB (Using ZLIB, build ver %s, run-time %s)";
+# endif /* def USE_ZLIB */
+# ifdef BZIP2_SUPPORT
+static ZCONST char Far BZip2_Sup[] =
+ "BZIP2_SUPPORT (PKZIP 4.6+, bzip2 lib ver %s)";
+# endif /* def BZIP2_SUPPORT */
+# ifdef LZMA_SUPPORT
+static ZCONST char Far LZMA_Sup[] =
+ "LZMA_SUPPORT (PKZIP 6.3+, LZMA compression, ver %s)";
+# endif /* def LZMA_SUPPORT */
+# ifdef PPMD_SUPPORT
+static ZCONST char Far PPMD_Sup[] =
+ "PPMD_SUPPORT (PKZIP 6.3+, PPMd compression, ver %s)";
+# endif /* def PPMD_SUPPORT */
# ifdef VMS_TEXT_CONV
- static ZCONST char Far VmsTextConv[] = "VMS_TEXT_CONV";
+static ZCONST char Far VmsTextConv[] =
+ "VMS_TEXT_CONV (Conversion of VMS var-len rec fmt text supported)";
# endif
# ifdef VMSCLI
- static ZCONST char Far VmsCLI[] = "VMSCLI";
+static ZCONST char Far VmsCLI[] =
+ "VMSCLI (Use VMS command-line interface)";
# endif
# ifdef VMSWILD
- static ZCONST char Far VmsWild[] = "VMSWILD";
+static ZCONST char Far VmsWild[] =
+ "VMSWILD (Use VMS-style wildcard characters)";
# endif
# ifdef WILD_STOP_AT_DIR
- static ZCONST char Far WildStopAtDir[] = "WILD_STOP_AT_DIR";
+static ZCONST char Far WildStopAtDir[] =
+ "WILD_STOP_AT_DIR (Wildcard \"*\" doesn't span \"/\" dir delimiter)";
# endif
-# if CRYPT
-# ifdef PASSWD_FROM_STDIN
- static ZCONST char Far PasswdStdin[] = "PASSWD_FROM_STDIN";
-# endif
- static ZCONST char Far Decryption[] =
- " [decryption, version %d.%d%s of %s]\n";
- static ZCONST char Far CryptDate[] = CR_VERSION_DATE;
+# ifdef IZ_CRYPT_AES_WG
+static ZCONST char Far AesWgEncryptionNotice1[] =
+ "\nAES Strong Encryption notice:\n";
+static ZCONST char Far AesWgEncryptionNotice2[] =
+ "\
+ This executable includes 256-bit AES strong encryption and may be\n\
+ subject to export restrictions in many countries, including the USA.\n";
+
+ static ZCONST char Far AesWgDecryption[] =
+" IZ_CRYPT_AES_WG (AES encryption (WinZip/Gladman), ver %d.%d%s)\n";
# endif
+# ifdef IZ_CRYPT_ANY
+# ifdef IZ_CRYPT_TRAD
+static ZCONST char Far TraditionalEncryptionNotice1[] =
+ "\nTraditional Zip Encryption notice:\n";
+static ZCONST char Far TraditionalEncryptionNotice2[] =
+ "\
+ The traditional zip encryption code of this program is not\n\
+ copyrighted, and is put in the public domain. It was originally\n\
+ written in Europe, and, to the best of our knowledge, can be freely\n\
+ distributed in both source and object forms from any country,\n\
+ including the USA under License Exception TSU of the U.S. Export\n\
+ Administration Regulations (section 740.13(e)) of 6 June 2002.\n";
+static ZCONST char Far Decryption[] =
+ " IZ_CRYPT_TRAD (Traditional (weak) encryption, ver %d.%d%s)\n";
+static ZCONST char Far CryptDate[] = CR_VERSION_DATE;
+# endif /* def IZ_CRYPT_TRAD */
+# ifdef PASSWD_FROM_STDIN
+static ZCONST char Far PasswdStdin[] = "PASSWD_FROM_STDIN";
+# endif
+# endif /* def IZ_CRYPT_ANY */
# ifndef __RSXNT__
-# ifdef __EMX__
- static ZCONST char Far EnvEMX[] = "EMX";
- static ZCONST char Far EnvEMXOPT[] = "EMXOPT";
-# endif
-# if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2)))
- static ZCONST char Far EnvGO32[] = "GO32";
- static ZCONST char Far EnvGO32TMP[] = "GO32TMP";
-# endif
+# ifdef __EMX__
+static ZCONST char Far EnvEMX[] = "EMX";
+static ZCONST char Far EnvEMXOPT[] = "EMXOPT";
+# endif
+# if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2)))
+static ZCONST char Far EnvGO32[] = "GO32";
+static ZCONST char Far EnvGO32TMP[] = "GO32TMP";
+# endif
# endif /* !__RSXNT__ */
-
-#ifdef VMS
-/* UnzipUsageLine1[] is also used in vms/cmdline.c: do not make it static */
- ZCONST char Far UnzipUsageLine1[] = "\
-UnZip %d.%d%d%s of %s, by Info-ZIP. For more details see: unzip -v.\n\n";
-# ifdef COPYRIGHT_CLEAN
- static ZCONST char Far UnzipUsageLine1v[] = "\
-UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\
-bug reports using http://www.info-zip.org/zip-bug.html; see README for details.\
-\n\n";
-# else
- static ZCONST char Far UnzipUsageLine1v[] = "\
+# endif /* !defined( SFX) || defined( DIAG_SFX) */
+
+# ifndef SFX
+# ifdef COPYRIGHT_CLEAN /* Maintainer, not Smith copyright. */
+# ifdef VMSCLI
+ /* Used in vms/cmdline.c, so not static in VMS CLI. "/lic" v. "--lic". */
+ZCONST char Far UnzipUsageLine1[] = "\
+UnZip %d.%d%d%s of %s, by Info-ZIP. Maintainer: <Apply Within>\n\
+ Copyright (c) 1990-2014 Info-ZIP. For software license: unzip /license\n";
+# else /* def VMSCLI */
+ static ZCONST char Far UnzipUsageLine1[] = "\
+UnZip %d.%d%d%s of %s, by Info-ZIP. Maintainer: <Apply Within>\n\
+ Copyright (c) 1990-2014 Info-ZIP. For software license: unzip --license\n";
+# endif /* def VMSCLI [else] */
+# else /* def COPYRIGHT_CLEAN */ /* Smith copyright, not maintainer. */
+# ifdef VMSCLI
+ /* Used in vms/cmdline.c, so not static in VMS CLI. "/lic" v. "--lic". */
+ZCONST char Far UnzipUsageLine1[] = "\
UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\
-Send bug reports using //www.info-zip.org/zip-bug.html; see README for details.\
-\n\n";
-# endif /* ?COPYRIGHT_CLEAN */
-#else /* !VMS */
-# ifdef COPYRIGHT_CLEAN
- static ZCONST char Far UnzipUsageLine1[] = "\
-UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\
-bug reports using http://www.info-zip.org/zip-bug.html; see README for details.\
-\n\n";
-# else
- static ZCONST char Far UnzipUsageLine1[] = "\
+ Copyright (c) 1990-2014 Info-ZIP. For software license: unzip /license\n";
+# else /* def VMSCLI */
+static ZCONST char Far UnzipUsageLine1[] = "\
UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\
-Send bug reports using //www.info-zip.org/zip-bug.html; see README for details.\
-\n\n";
-# endif /* ?COPYRIGHT_CLEAN */
-# define UnzipUsageLine1v UnzipUsageLine1
-#endif /* ?VMS */
+ Copyright (c) 1990-2014 Info-ZIP. For software license: unzip --license\n";
+# endif /* def VMSCLI [else] */
+# endif /* def COPYRIGHT_CLEAN [else] */
+# define UnzipUsageLine1v UnzipUsageLine1
static ZCONST char Far UnzipUsageLine2v[] = "\
-Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;\
-\nsee ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.\
-\n\n";
+ See README for details. More info: http://info-zip.org/UnZip.html\n\n";
-#ifdef MACOS
+# ifdef MACOS
static ZCONST char Far UnzipUsageLine2[] = "\
-Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-d exdir]\n \
+Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-d exdir]\n\
Default action is to extract files in list, to exdir;\n\
file[.zip] may be a wildcard. %s\n";
-#else /* !MACOS */
-#ifdef VM_CMS
+# else /* !MACOS */
+# ifdef VM_CMS
static ZCONST char Far UnzipUsageLine2[] = "\
-Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d fm]\n \
+Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d fm]\n\
Default action is to extract files in list, except those in xlist, to disk fm;\
\n file[.zip] may be a wildcard. %s\n";
-#else /* !VM_CMS */
+# else /* !VM_CMS */
static ZCONST char Far UnzipUsageLine2[] = "\
-Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]\n \
+Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]\n\
Default action is to extract files in list, except those in xlist, to exdir;\n\
- file[.zip] may be a wildcard. %s\n";
-#endif /* ?VM_CMS */
-#endif /* ?MACOS */
+ file[.zip] may be a wildcard. %s\n";
+# endif /* ?VM_CMS */
+# endif /* ?MACOS */
-#ifdef NO_ZIPINFO
+# ifdef NO_ZIPINFO
# define ZIPINFO_MODE_OPTION ""
- static ZCONST char Far ZipInfoMode[] =
- "(ZipInfo mode is disabled in this version.)";
-#else
+static ZCONST char Far ZipInfoMode[] =
+ "(ZipInfo mode is disabled in this version.)";
+# else
# define ZIPINFO_MODE_OPTION "[-Z] "
- static ZCONST char Far ZipInfoMode[] =
- "-Z => ZipInfo mode (\"unzip -Z\" for usage).";
-#endif /* ?NO_ZIPINFO */
+static ZCONST char Far ZipInfoMode[] =
+ "-Z => ZipInfo mode (\"unzip -Z\" for usage).";
+# endif /* ?NO_ZIPINFO */
-#ifdef VMS
- static ZCONST char Far VMSusageLine2b[] = "\
-=> define foreign command symbol in LOGIN.COM: $ unzip :== $dev:[dir]unzip.exe\
-\n";
-#endif
+# ifdef VMS
+static ZCONST char Far VMSusageLine2b[] = "\
+=> Define foreign command symbol in LOGIN.COM: \
+unzip == \"$ dev:[dir]unzip.exe\"\n";
+# endif
-#ifdef MACOS
+# ifdef MACOS
static ZCONST char Far UnzipUsageLine3[] = "\n\
-d extract files into exdir -l list files (short format)\n\
-f freshen existing files, create none -t test compressed archive data\n\
-u update files, create if necessary -z display archive comment only\n\
-v list verbosely/show version info %s\n";
-#else /* !MACOS */
-#ifdef VM_CMS
+# else /* !MACOS */
+# ifdef VM_CMS
static ZCONST char Far UnzipUsageLine3[] = "\n\
-p extract files to pipe, no messages -l list files (short format)\n\
-f freshen existing files, create none -t test compressed archive data\n\
-u update files, create if necessary -z display archive comment only\n\
-v list verbosely/show version info %s\n\
-x exclude files that follow (in xlist) -d extract files onto disk fm\n";
-#else /* !VM_CMS */
+# else /* !VM_CMS */
static ZCONST char Far UnzipUsageLine3[] = "\n\
-p extract files to pipe, no messages -l list files (short format)\n\
-f freshen existing files, create none -t test compressed archive data\n\
-u update files, create if necessary -z display archive comment only\n\
-v list verbosely/show version info %s\n\
-x exclude files that follow (in xlist) -d extract files into exdir\n";
-#endif /* ?VM_CMS */
-#endif /* ?MACOS */
+# endif /* ?VM_CMS */
+# endif /* ?MACOS */
/* There is not enough space on a standard 80x25 Windows console screen for
* the additional line advertising the UTF-8 debugging options. This may
* Likely, other advanced options should be moved to an extended help page and
* the option to list that page put here. [E. Gordon, 2008-3-16]
*/
-#if (defined(UNICODE_SUPPORT) && !defined(WIN32))
-#ifdef VMS
+# if (defined(UNICODE_SUPPORT) && !defined(WIN32))
+# ifdef VMS
static ZCONST char Far UnzipUsageLine4[] = "\
-modifiers:\n\
+Modifiers:\n\
-n never overwrite or make a new version of an existing file\n\
-o always make a new version (-oo: overwrite original) of an existing file\n\
-q quiet mode (-qq => quieter) -a auto-convert any text files\n\
- -j junk paths (do not make directories) -aa treat ALL files as text\n\
+ -j[=N] junk paths (strip all/top-N dirs) -aa treat ALL files as text\n\
-U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields\n\
-C match filenames case-insensitively -L make (some) names \
lowercase\n %-42s -V retain VMS version numbers\n%s";
-#else /* !VMS */
+# else /* !VMS */
static ZCONST char Far UnzipUsageLine4[] = "\
-modifiers:\n\
+Modifiers:\n\
-n never overwrite existing files -q quiet mode (-qq => quieter)\n\
-o overwrite files WITHOUT prompting -a auto-convert any text files\n\
- -j junk paths (do not make directories) -aa treat ALL files as text\n\
+ -j[=N] junk paths (strip all/top-N dirs) -aa treat ALL files as text\n\
-U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields\n\
-C match filenames case-insensitively -L make (some) names \
lowercase\n %-42s -V retain VMS version numbers\n%s";
-#endif /* ?VMS */
-#else /* !UNICODE_SUPPORT */
-#ifdef VMS
+# endif /* ?VMS */
+# else /* !UNICODE_SUPPORT */
+# ifdef VMS
static ZCONST char Far UnzipUsageLine4[] = "\
-modifiers:\n\
+Modifiers:\n\
-n never overwrite or make a new version of an existing file\n\
-o always make a new version (-oo: overwrite original) of an existing file\n\
-q quiet mode (-qq => quieter) -a auto-convert any text files\n\
- -j junk paths (do not make directories) -aa treat ALL files as text\n\
+ -j[=N] junk paths (strip all/top-N dirs) -aa treat ALL files as text\n\
-C match filenames case-insensitively -L make (some) names \
lowercase\n %-42s -V retain VMS version numbers\n%s";
-#else /* !VMS */
+# else /* !VMS */
static ZCONST char Far UnzipUsageLine4[] = "\
-modifiers:\n\
+Modifiers:\n\
-n never overwrite existing files -q quiet mode (-qq => quieter)\n\
-o overwrite files WITHOUT prompting -a auto-convert any text files\n\
- -j junk paths (do not make directories) -aa treat ALL files as text\n\
+ -j[=N] junk paths (strip all/top-N dirs) -aa treat ALL files as text\n\
-C match filenames case-insensitively -L make (some) names \
lowercase\n %-42s -V retain VMS version numbers\n%s";
-#endif /* ?VMS */
-#endif /* ?UNICODE_SUPPORT */
+# endif /* ?VMS */
+# endif /* ?UNICODE_SUPPORT */
static ZCONST char Far UnzipUsageLine5[] = "\
-See \"unzip -hh\" or unzip.txt for more help. Examples:\n\
- unzip data1 -x joe => extract all files except joe from zipfile data1.zip\n\
+See \"unzip -hh\" for more help. Examples:\n\
+ unzip data1 -x joe => extract all files except joe from archive data1.zip\n\
%s\
unzip -fo foo %-6s => quietly replace existing %s if archive file newer\n";
-#endif /* ?SFX */
-
+# endif /* ndef SFX */
int r;
CONSTRUCTGLOBALS();
+
+/* Microsoft memory allocation debug.
+ * Enable dump of memory leaks on program exit.
+ */
+# if defined(_MSC_VER) && defined(_DEBUG) && !defined( NO_IZ_DEBUG_ALLOC)
+ _CrtSetDbgFlag(
+ _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF);
+# endif
+
r = unzip(__G__ argc, argv);
DESTROYGLOBALS();
RETURN(r);
int argc;
char *argv[];
{
-#ifndef NO_ZIPINFO
- char *p;
-#endif
-#if (defined(DOS_FLX_H68_NLM_OS2_W32) || !defined(SFX))
+/* Ignore argv[0] for DLL or object library.
+ * (Must use "-Z" for ZipInfo mode.)
+ */
+# ifdef DLL
+# ifndef IGNORE_ARGV0
+# define IGNORE_ARGV0
+# endif
+# endif
+
+# if !defined( NO_ZIPINFO) && !defined( IGNORE_ARGV0)
+ char *p; /* Temp character pointer for argv[0]. */
+# endif
+
+# if (defined(DOS_FLX_H68_NLM_OS2_W32) || !defined(SFX))
int i;
-#endif
- int retcode, error=FALSE;
-#ifndef NO_EXCEPT_SIGNALS
-#ifdef REENTRANT
+# endif
+ int retcode;
+ int error = FALSE;
+
+# ifndef NO_EXCEPT_SIGNALS
+# ifdef REENTRANT
savsigs_info *oldsighandlers = NULL;
# define SET_SIGHANDLER(sigtype, newsighandler) \
if ((retcode = setsignalhandler(__G__ &oldsighandlers, (sigtype), \
(newsighandler))) > PK_WARN) \
goto cleanup_and_exit
-#else
+# else
# define SET_SIGHANDLER(sigtype, newsighandler) \
signal((sigtype), (newsighandler))
-#endif
-#endif /* NO_EXCEPT_SIGNALS */
+# endif
+# endif /* NO_EXCEPT_SIGNALS */
+
+# ifdef DLL
+ /* Verify NULL termination of (user-supplied) argv[]. */
+ if (argv[ argc] != NULL)
+ {
+ retcode = PK_PARAM;
+ goto cleanup_and_exit;
+ }
+# endif /* def DLL */
+
+# ifdef ENABLE_USER_PROGRESS
+# ifdef VMS
+ establish_ctrl_t( user_progress);
+# else /* def VMS */
+# ifdef SIGUSR1
+ signal( SIGUSR1, user_progress);
+# endif /* def SIGUSR1 */
+# endif /* def VMS [else] */
+# endif /* def ENABLE_USER_PROGRESS */
/* initialize international char support to the current environment */
SETLOCALE(LC_CTYPE, "");
-#ifdef UNICODE_SUPPORT
+# ifdef UNICODE_SUPPORT
/* see if can use UTF-8 Unicode locale */
-# ifdef UTF8_MAYBE_NATIVE
+# ifdef UTF8_MAYBE_NATIVE
{
char *codeset;
-# if !(defined(NO_NL_LANGINFO) || defined(NO_LANGINFO_H))
+# if !(defined(NO_NL_LANGINFO) || defined(NO_LANGINFO_H))
/* get the codeset (character set encoding) currently used */
# include <langinfo.h>
codeset = nl_langinfo(CODESET);
-# else /* NO_NL_LANGINFO || NO_LANGINFO_H */
+# else /* NO_NL_LANGINFO || NO_LANGINFO_H */
/* query the current locale setting for character classification */
codeset = setlocale(LC_CTYPE, NULL);
if (codeset != NULL) {
codeset = strchr(codeset, '.');
if (codeset != NULL) ++codeset;
}
-# endif /* ?(NO_NL_LANGINFO || NO_LANGINFO_H) */
+# endif /* ?(NO_NL_LANGINFO || NO_LANGINFO_H) */
/* is the current codeset UTF-8 ? */
if ((codeset != NULL) && (strcmp(codeset, "UTF-8") == 0)) {
/* successfully found UTF-8 char coding */
* UnZip maintainer, a successful switch to "en-US.UTF-8"
* resulted in garbage display of all non-basic ASCII characters.
*/
+ /* On openSUSE 11.3 it appears that the console is UTF-8 aware by
+ * default. Makes using UTF-8 aware console applications, like
+ * UnZip, easy. Supplying UTF-8 arguments seems to work correctly,
+ * allowing input patterns to include Japanese directly, for instance.
+ */
}
-# endif /* UTF8_MAYBE_NATIVE */
+# endif /* UTF8_MAYBE_NATIVE */
/* initialize Unicode */
G.unicode_escape_all = 0;
G.unipath_version = 0;
G.unipath_checksum = 0;
G.unipath_filename = NULL;
-#endif /* UNICODE_SUPPORT */
+# ifdef WIN32_WIDE
+# ifdef DYNAMIC_WIDE_NAME
+ G.unipath_widefilename = NULL;
+# else /* def DYNAMIC_WIDE_NAME */
+ *G.unipath_widefilename = L'\0';
+# endif /* def DYNAMIC_WIDE_NAME [else] */
+
+ G.has_win32_wide = has_win32_wide();
+# endif
+
+# endif /* UNICODE_SUPPORT */
+
+
+# ifdef ICONV_MAPPING
+# ifdef UNIX
+ init_conversion_charsets( __G);
+# endif
+# endif /* def ICONV_MAPPING */
-#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__))
+# if (defined(__IBMC__) && defined(__DEBUG_ALLOC__))
extern void DebugMalloc(void);
atexit(DebugMalloc);
-#endif
+# endif
-#ifdef MALLOC_WORK
+# ifdef MALLOC_WORK
/* The following (rather complex) expression determines the allocation
size of the decompression work area. It simulates what the
combined "union" and "struct" declaration of the "static" work
G.area.shrink.value = G.area.Slide + (sizeof(shrint)*(HSIZE));
G.area.shrink.Stack = G.area.Slide +
(sizeof(shrint) + sizeof(uch))*(HSIZE);
-#endif
+# endif
/*---------------------------------------------------------------------------
Set signal handler for restoring echo, warn of zipfile corruption, etc.
---------------------------------------------------------------------------*/
-#ifndef NO_EXCEPT_SIGNALS
-#ifdef SIGINT
+# ifndef NO_EXCEPT_SIGNALS
+# ifdef SIGINT
SET_SIGHANDLER(SIGINT, handler);
-#endif
-#ifdef SIGTERM /* some systems really have no SIGTERM */
+# endif
+# ifdef SIGTERM /* some systems really have no SIGTERM */
SET_SIGHANDLER(SIGTERM, handler);
-#endif
-#if defined(SIGABRT) && !(defined(AMIGA) && defined(__SASC))
+# endif
+# if defined(SIGABRT) && !(defined(AMIGA) && defined(__SASC))
SET_SIGHANDLER(SIGABRT, handler);
-#endif
-#ifdef SIGBREAK
+# endif
+# ifdef SIGBREAK
SET_SIGHANDLER(SIGBREAK, handler);
-#endif
-#ifdef SIGBUS
+# endif
+# ifdef SIGBUS
SET_SIGHANDLER(SIGBUS, handler);
-#endif
-#ifdef SIGILL
+# endif
+# ifdef SIGILL
SET_SIGHANDLER(SIGILL, handler);
-#endif
-#ifdef SIGSEGV
+# endif
+# ifdef SIGSEGV
SET_SIGHANDLER(SIGSEGV, handler);
-#endif
-#endif /* NO_EXCEPT_SIGNALS */
+# endif
+# endif /* NO_EXCEPT_SIGNALS */
-#if (defined(WIN32) && defined(__RSXNT__))
+# if (defined(WIN32) && defined(__RSXNT__))
for (i = 0 ; i < argc; i++) {
_ISO_INTERN(argv[i]);
}
-#endif
+# endif
/*---------------------------------------------------------------------------
Macintosh initialization code.
---------------------------------------------------------------------------*/
-#ifdef MACOS
+# ifdef MACOS
{
int a;
G.rghCursor[a] = GetCursor(a+128);
G.giCursor = 0;
}
-#endif
+# endif
/*---------------------------------------------------------------------------
NetWare initialization code.
---------------------------------------------------------------------------*/
-#ifdef NLM
+# ifdef NLM
InitUnZipConsole();
-#endif
+# endif
/*---------------------------------------------------------------------------
Acorn RISC OS initialization code.
---------------------------------------------------------------------------*/
-#ifdef RISCOS
+# ifdef RISCOS
set_prefix();
-#endif
+# endif
/*---------------------------------------------------------------------------
Theos initialization code.
---------------------------------------------------------------------------*/
-#ifdef THEOS
+# ifdef THEOS
/* The easiest way found to force creation of libraries when selected
* members are to be unzipped. Explicitly add libraries names to the
* arguments list before the first member of the library.
retcode = PK_MEM;
goto cleanup_and_exit;
}
-#endif
+# endif
+
+/*---------------------------------------------------------------------------
+ VMS initialization code.
+ ---------------------------------------------------------------------------*/
+
+# ifdef VMS
+ /* Get the RMS default protections for mapattr() and VMS-specific
+ * file and directory protection-setting.
+ */
+ get_rms_fileprot();
+# endif
/*---------------------------------------------------------------------------
Sanity checks. Commentary by Otis B. Driftwood and Fiorello:
Claus.
---------------------------------------------------------------------------*/
-#ifdef DEBUG
# ifdef LARGE_FILE_SUPPORT
/* test if we can support large files - 10/6/04 EG */
if (sizeof(zoff_t) < 8) {
- Info(slide, 0x401, ((char *)slide, "LARGE_FILE_SUPPORT set but not supported\n"));
- retcode = PK_BADERR;
+ Info(slide, 0x401, ((char *)slide,
+ "LARGE_FILE_SUPPORT set but not supported\n"));
+ retcode = PK_COMPERR;
goto cleanup_and_exit;
}
/* test if we can show 64-bit values */
{
Info(slide, 0x401, ((char *)slide,
"Can't show 64-bit values correctly\n"));
- retcode = PK_BADERR;
+ retcode = PK_COMPERR;
goto cleanup_and_exit;
}
}
# endif /* LARGE_FILE_SUPPORT */
+# ifdef IZ_CRYPT_AES_WG
+ /* Verify the AES compile-time endian decision. */
+ {
+ union {
+ unsigned int i;
+ unsigned char b[ 4];
+ } bi;
+
+# ifndef PLATFORM_BYTE_ORDER
+# define ENDI_BYTE 0x00
+# define ENDI_PROB "(Undefined)"
+# else
+# if PLATFORM_BYTE_ORDER == AES_LITTLE_ENDIAN
+# define ENDI_BYTE 0x78
+# define ENDI_PROB "Little"
+# else
+# if PLATFORM_BYTE_ORDER == AES_BIG_ENDIAN
+# define ENDI_BYTE 0x12
+# define ENDI_PROB "Big"
+# else
+# define ENDI_BYTE 0xff
+# define ENDI_PROB "(Unknown)"
+# endif
+# endif
+# endif
+
+ bi.i = 0x12345678;
+ if (bi.b[ 0] != ENDI_BYTE)
+ {
+ Info(slide, 0x401, ((char *)slide,
+ "Bad AES_WG compile-time endian: %s\n", ENDI_PROB));
+ retcode = PK_COMPERR;
+ goto cleanup_and_exit;
+ }
+ }
+# endif /* def IZ_CRYPT_AES_WG */
+
+# ifdef DEBUG
/* 2004-11-30 SMS.
Test the NEXTBYTE macro for proper operation.
*/
Info(slide, 0x401, ((char *)slide,
"NEXTBYTE macro failed. Try compiling with ALT_NEXTBYTE defined?"));
- retcode = PK_BADERR;
+ retcode = PK_COMPERR;
goto cleanup_and_exit;
}
}
-#endif /* DEBUG */
+# endif /* DEBUG */
/*---------------------------------------------------------------------------
First figure out if we're running in UnZip mode or ZipInfo mode, and put
through any command-line options lurking about...
---------------------------------------------------------------------------*/
-#ifdef SFX
+# ifdef SFX
G.argv0 = argv[0];
-#if (defined(OS2) || defined(WIN32))
+# if (defined(OS2) || defined(WIN32))
G.zipfn = GetLoadPath(__G);/* non-MSC NT puts path into G.filename[] */
-#else
+# else
G.zipfn = G.argv0;
-#endif
+# endif
-#ifdef VMSCLI
+# ifdef VMSCLI
{
ulg status = vms_unzip_cmdline(&argc, &argv);
if (!(status & 1)) {
goto cleanup_and_exit;
}
}
-#endif /* VMSCLI */
+# endif /* VMSCLI */
uO.zipinfo_mode = FALSE;
error = uz_opts(__G__ &argc, &argv); /* UnZipSFX call only */
+ if (error) {
+ /* Parsing error message already emitted.
+ * Leave a blank line, and add the (brief) SFX usage message.
+ */
+ Info(slide, 0x401, ((char *)slide, "\n"));
+ USAGE( error);
+ }
-#else /* !SFX */
+# else /* !SFX */
-#ifdef RISCOS
+# ifdef RISCOS
/* get the extensions to swap from environment */
getRISCOSexts(ENV_UNZIPEXTS);
-#endif
+# endif
-#ifdef MSDOS
+# ifdef MSDOS
/* extract MKS extended argument list from environment (before envargs!) */
mksargs(&argc, &argv);
-#endif
+# endif
-#ifdef VMSCLI
+# ifdef VMSCLI
{
ulg status = vms_unzip_cmdline(&argc, &argv);
if (!(status & 1)) {
goto cleanup_and_exit;
}
}
-#endif /* VMSCLI */
+# endif /* VMSCLI */
G.noargs = (argc == 1); /* no options, no zipfile, no anything */
-#ifndef NO_ZIPINFO
+# ifndef NO_ZIPINFO
+# ifndef IGNORE_ARGV0
for (p = argv[0] + strlen(argv[0]); p >= argv[0]; --p) {
if (*p == DIR_END
-#ifdef DIR_END2
+# ifdef DIR_END2
|| *p == DIR_END2
-#endif
+# endif
)
break;
}
++p;
+# endif /* ndef IGNORE_ARGV0 */
-#ifdef THEOS
+# ifdef IGNORE_ARGV0
+ if (
+# else /* def IGNORE_ARGV0 */
+# ifdef THEOS
if (strncmp(p, "ZIPINFO.",8) == 0 || strstr(p, ".ZIPINFO:") != NULL ||
strncmp(p, "II.",3) == 0 || strstr(p, ".II:") != NULL ||
-#else
+# else /* def THEOS */
if (STRNICMP(p, LoadFarStringSmall(Zipnfo), 7) == 0 ||
STRNICMP(p, "ii", 2) == 0 ||
-#endif
- (argc > 1 && strncmp(argv[1], "-Z", 2) == 0))
+# endif /* def THEOS [else] */
+# endif /* def IGNORE_ARGV0 [else] */
+ /* Check first arg for "-Z" or "--zipinfo-mode"
+ * (but not "--zipfile-comment").
+ */
+ ((argc > 1) &&
+ ((strncmp( argv[ 1], "-Z", 2) == 0) ||
+ ((strlen( argv[ 1]) > 5) &&
+ (strncmp( argv[ 1], "--zipinfo-mode", strlen( argv[ 1])) == 0)
+ )))
+ )
{
uO.zipinfo_mode = TRUE;
-#ifndef _WIN32_WCE /* Win CE does not support environment variables */
+# ifndef _WIN32_WCE /* Win CE does not support environment variables */
if ((error = envargs(&argc, &argv, LoadFarStringSmall(EnvZipInfo),
LoadFarStringSmall2(EnvZipInfo2))) != PK_OK)
perror(LoadFarString(NoMemEnvArguments));
-#endif
+# endif
} else
-#endif /* !NO_ZIPINFO */
+# endif /* !NO_ZIPINFO */
{
uO.zipinfo_mode = FALSE;
-#ifndef _WIN32_WCE /* Win CE does not support environment variables */
+# ifndef _WIN32_WCE /* Win CE does not support environment variables */
if ((error = envargs(&argc, &argv, LoadFarStringSmall(EnvUnZip),
LoadFarStringSmall2(EnvUnZip2))) != PK_OK)
perror(LoadFarString(NoMemEnvArguments));
-#endif
+# endif
}
if (!error) {
goto cleanup_and_exit;
}
}
-#ifndef NO_ZIPINFO
+# ifndef NO_ZIPINFO
if (uO.zipinfo_mode)
error = zi_opts(__G__ &argc, &argv);
else
-#endif /* !NO_ZIPINFO */
+# endif /* !NO_ZIPINFO */
error = uz_opts(__G__ &argc, &argv);
}
-#endif /* ?SFX */
+# endif /* ?SFX */
if ((argc < 0) || error) {
retcode = error;
+ if ((argc < -1) || error)
+ {
+ Info(slide, 0x401, ((char *)slide, "\n"));
+ USAGE( error);
+ }
goto cleanup_and_exit;
}
maining options and file specifications.
---------------------------------------------------------------------------*/
-#ifdef DOS_FLX_H68_NLM_OS2_W32
+# ifdef DOS_FLX_H68_NLM_OS2_W32
/* convert MSDOS-style 'backward slash' directory separators to Unix-style
* 'forward slashes' for user's convenience (include zipfile name itself)
*/
-#ifdef SFX
- for (G.pfnames = argv, i = argc; i > 0; --i) {
-#else
+ {
+ /* 2012-06-23 SMS.
+ * Use a local variable here to avoid damage to the global
+ * G.pfnames, which may be used later by UnZipSFX (at least).
+ */
+ char **G_pfnames;
+
+# ifdef SFX
+ for (G_pfnames = argv, i = argc; i > 0; --i)
+# else
/* argc does not include the zipfile specification */
- for (G.pfnames = argv, i = argc+1; i > 0; --i) {
-#endif
-#ifdef __human68k__
- extern char *_toslash(char *);
- _toslash(*G.pfnames);
-#else /* !__human68k__ */
- char *q = *G.pfnames;
-
- while (*q != '\0') {
- if (*q == '\\')
- *q = '/';
- INCSTR(q);
+ for (G_pfnames = argv, i = argc; i > 0; --i)
+# endif
+ {
+# ifdef __human68k__
+ extern char *_toslash(char *);
+ _toslash(*G_pfnames);
+# else /* !__human68k__ */
+ char *q = *G_pfnames;
+
+ while (*q != '\0') {
+ if (*q == '\\')
+ *q = '/';
+ INCSTR(q);
+ }
+# endif /* ?__human68k__ */
+ ++G_pfnames;
}
-#endif /* ?__human68k__ */
- ++G.pfnames;
}
-#endif /* DOS_FLX_H68_NLM_OS2_W32 */
+# endif /* DOS_FLX_H68_NLM_OS2_W32 */
-#ifndef SFX
+# if 0
+/* G.wildzipfn now set in command line switch as first non-option argument */
+# ifndef SFX
G.wildzipfn = *argv++;
-#endif
+# endif
+# endif
+
+# if (defined(SFX) && !defined(SFX_EXDIR)) /* only check for -x */
+
+# if 0
+ /* all this should be done in the options call now */
-#if (defined(SFX) && !defined(SFX_EXDIR)) /* only check for -x */
G.filespecs = argc;
G.xfilespecs = 0;
G.process_all_files = FALSE;
} else
G.process_all_files = TRUE; /* for speed */
+# endif
+
+# else /* !SFX || SFX_EXDIR */ /* check for -x or -d */
-#else /* !SFX || SFX_EXDIR */ /* check for -x or -d */
+# if 0
+ /* all this should be done in the options call now */
G.filespecs = argc;
G.xfilespecs = 0;
G.pfnames = argv;
while (*++pp) {
Trace((stderr, "pp - argv = %d\n", pp-argv));
-#ifdef CMS_MVS
+# ifdef CMS_MVS
if (!uO.exdir && STRNICMP(*pp, "-d", 2) == 0) {
-#else
+# else
if (!uO.exdir && strncmp(*pp, "-d", 2) == 0) {
-#endif
+# endif
int firstarg = (pp == argv);
uO.exdir = (*pp) + 2;
}
} else
G.process_all_files = TRUE; /* for speed */
+# endif /* 0 */
if (uO.exdir != (char *)NULL && !G.extract_flag) /* -d ignored */
Info(slide, 0x401, ((char *)slide, LoadFarString(NotExtracting)));
-#endif /* ?(SFX && !SFX_EXDIR) */
+# endif /* ?(SFX && !SFX_EXDIR) */
-#ifdef UNICODE_SUPPORT
+# ifdef UNICODE_SUPPORT
/* set Unicode-escape-all if option -U used */
if (uO.U_flag == 1)
-# ifdef UNICODE_WCHAR
+# ifdef UNICODE_WCHAR
G.unicode_escape_all = TRUE;
-# else
+# else
Info(slide, 0x401, ((char *)slide, LoadFarString(UTF8EscapeUnSupp)));
+# endif
# endif
-#endif
+
+# if defined( UNIX) && defined( __APPLE__)
+ /* Set flag according to the capabilities of the destination volume. */
+ G.exdir_attr_ok = vol_attr_ok( (uO.exdir == NULL) ? "." : uO.exdir);
+# endif /* defined( UNIX) && defined( __APPLE__) */
+
+# ifdef KFLAG
+ /* Get Unix umask value. (Already have VMS default protection value.) */
+# if defined( __ATHEOS__) || defined( __BEOS__) || defined( UNIX)
+ umask( G.umask_val = umask( 0));
+# endif
+# endif /* def KFLAG */
/*---------------------------------------------------------------------------
retcode = process_zipfiles(__G);
cleanup_and_exit:
-#if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
+# if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
/* restore all signal handlers back to their state at function entry */
while (oldsighandlers != NULL) {
savsigs_info *thissigsav = oldsighandlers;
signal(thissigsav->sigtype, thissigsav->sighandler);
oldsighandlers = thissigsav->previous;
- free(thissigsav);
+ izu_free(thissigsav);
}
-#endif
-#if (defined(MALLOC_WORK) && !defined(REENTRANT))
+# endif
+
+# if 0
+ /* 2012-12-11 SMS.
+ * Disabled call of free_G_buffers() from
+ * process.c:process_zipfiles(), so now DESTROYGLOBALS() should do all
+ * the work (if any).
+ *
+ * On the other hand, the revised/reallocated argv[] is known only
+ * locally, so we should free it.
+ */
+ /* 2012-12-10 SMS.
+ * This code appears to be goofy/redundant.
+ * Normally, process.c:process_zipfiles()
+ * calls process.c:free_G_buffers(), which, "#ifdef MALLOC_WORK",
+ * frees G.area.Slide, just like here. (With REENTRANT defined,
+ * DESTROYGLOBALS() includes at least one call to free_G_buffers(), so
+ * the "!defined(REENTRANT)" condition makes some sense, but why free
+ * this stuff and not anything else, if not REENTRANT?)
+ */
+# if defined(MALLOC_WORK) && !defined(REENTRANT)
if (G.area.Slide != (uch *)NULL) {
- free(G.area.Slide);
+ izu_free(G.area.Slide);
G.area.Slide = (uch *)NULL;
}
-#endif
-#if (defined(MSDOS) && !defined(SFX) && !defined(WINDLL))
+# endif /* defined(MALLOC_WORK) && !defined(REENTRANT) */
+# endif /* 0 */
+
+# ifdef REENTRANT
+ free_args( argv);
+# endif /* def REENTRANT */
+
+
+# if (defined(MSDOS) && !defined(SFX) && !defined(WINDLL))
if (retcode != PK_OK)
check_for_windows("UnZip");
-#endif
+# endif
return(retcode);
} /* end main()/unzip() */
-#if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
+# if (defined(REENTRANT) && !defined(NO_EXCEPT_SIGNALS))
/*******************************/
/* Function setsignalhandler() */
/*******************************/
{
savsigs_info *savsig;
- savsig = malloc(sizeof(savsigs_info));
+ savsig = izu_malloc(sizeof(savsigs_info));
if (savsig == NULL) {
/* error message and break */
Info(slide, 0x401, ((char *)slide, LoadFarString(CantSaveSigHandler)));
savsig->sigtype = signal_type;
savsig->sighandler = signal(SIGINT, newhandler);
if (savsig->sighandler == SIG_ERR) {
- free(savsig);
+ izu_free(savsig);
} else {
savsig->previous = *p_savedhandler_chain;
*p_savedhandler_chain = savsig;
} /* end function setsignalhandler() */
-#endif /* REENTRANT && !NO_EXCEPT_SIGNALS */
+# endif /* REENTRANT && !NO_EXCEPT_SIGNALS */
+
+
+/*
+ * -------------------------------------------------------
+ * Command Line Options
+ * -------------------------------------------------------
+ *
+ * Valid command line options.
+ *
+ * The function get_option() uses this table to check if an option is
+ * valid, and if it takes a value (also called an option parameter).
+ * To add an option to UnZip, add it to this table, and add a case in
+ * the main switch to handle it.
+ *
+ * The fields:
+ * option_group - UZO for UnZip option, ZIO for ZipInfo option
+ * shortopt - short option name (1 or 2 chars)
+ * longopt - long option name
+ * value_type - see unzpriv.h for constants
+ * negatable - option is negatable with trailing -
+ * ID - unsigned long int returned for option
+ * name - short description of option which is
+ * returned on some errors and when options
+ * are listed with -so option, can be NULL
+ *
+ * If shortopt or longopt is not used, then set it to "".
+ *
+ * Most option IDs are set to the shortopt char. For multichar short
+ * options, ID is set to an arbitrary unused constant. See list in
+ * unzpriv.h.
+ */
+
+/* The table below is based on the old main command line code, with a
+ * few changes. Note that UnZip and ZipInfo filter out their own
+ * options based on the option_group value, so the same option letter
+ * can be used for both.
+ */
+
+static struct option_struct far options[] = {
+ /* UnZip options */
+ /* short longopt value_type negatable
+ ID name */
+# ifdef VMS
+ {UZO, "2", "force-ods2", o_NO_VALUE, o_NEGATABLE,
+ '2', "Force ODS2-compliant names."},
+# endif
+ {UZO, "a", "ascii", o_NO_VALUE, o_NEGATABLE,
+ 'a', "text convert (EOL char, ASCII->EBCDIC)"},
+# if (defined(DLL) && defined(API_DOC))
+ {UZO, "A", "api-help", o_OPTIONAL_VALUE, o_NOT_NEGATABLE,
+ 'A', "extended help for API"},
+# endif
+ {UZO, "b", "binary", o_NO_VALUE, o_NEGATABLE,
+ 'b', "binary, no ASCII conversions"},
+# ifdef UNIXBACKUP
+ {UZO, "B", "backup", o_NO_VALUE, o_NEGATABLE,
+ 'B', "back up existing files"},
+# endif
+# ifdef CMS_MVS
+ {UZO, "B", "cms-mvs-binary", o_NO_VALUE, o_NEGATABLE,
+ 'b', "CMS/MVS binary"},
+# endif
+ {UZO, "c", "to-stdout", o_NO_VALUE, o_NEGATABLE,
+ 'c', "output to stdout"},
+# ifdef CMS_MVS
+ /* for CMS_MVS map to lower case */
+ {UZO, "C", "cms-mvs-lower", o_NO_VALUE, o_NEGATABLE,
+ 'C', "CMS/MVS lower case"},
+# else /* ifdef CMS_MVS */
+ {UZO, "C", "ignore-case", o_NO_VALUE, o_NEGATABLE,
+ 'C', "ignore case"},
+# endif /* ifdef CMS_MVS [else] */
+# if (!defined(SFX) || defined(SFX_EXDIR))
+ {UZO, "d", "extract-dir", o_REQUIRED_VALUE, o_NEGATABLE,
+ 'd', "extraction root directory"},
+# endif
+# ifndef SFX
+ {UZO, "da", "auto-extract-dir", o_OPT_EQ_VALUE, o_NEGATABLE,
+ o_da, "automatic extraction root directory"},
+# endif /* ndef SFX */
+# if (!defined(NO_TIMESTAMPS))
+ /* seems the best long option name I can think of */
+ {UZO, "D", "dir-timestamps", o_NO_VALUE, o_NEGATABLE,
+ 'D', "restore no times (-D- = dir and file)"},
+# endif
+ {UZO, "e", "extract", o_NO_VALUE, o_NEGATABLE,
+ 'e', "extract (not used?)"},
+# ifdef MACOS
+ {UZO, "E", "mac-efs", o_NO_VALUE, o_NEGATABLE,
+ 'E', "display Mac e.f. when restoring"},
+# endif
+ {UZO, "f", "freshen", o_NO_VALUE, o_NEGATABLE,
+ 'f', "freshen (extract only newer files)"},
+# if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
+ {UZO, "F", "keep-nfs", o_NO_VALUE, o_NEGATABLE,
+ 'F', "Acorn filetype & NFS extension handling"},
+# endif
+ {UZO, "h", "help", o_NO_VALUE, o_NOT_NEGATABLE,
+ 'h', "help"},
+ {UZO, "hh", "long-help", o_NO_VALUE, o_NOT_NEGATABLE,
+ o_hh, "long help"},
+# ifdef MACOS
+ {UZO, "i", "no-mac-ef-names", o_NO_VALUE, o_NEGATABLE,
+ 'i', "ignore filenames stored in Mac ef"},
+# endif
+# ifdef ICONV_MAPPING
+# ifdef UNIX
+ {UZO, "I", "iso-char-set", o_REQUIRED_VALUE, o_NOT_NEGATABLE,
+ 'I', "ISO char set to use"},
+# endif /* def ICONV_MAPPING */
+# endif
+ {UZO, "j", "junk-dirs", o_OPT_EQ_VALUE, o_NEGATABLE,
+ 'j', "junk directories, extract names only"},
+# ifdef J_FLAG
+ {UZO, "J", "junk-attrs", o_NO_VALUE, o_NEGATABLE,
+ 'J', "Junk AtheOS, BeOS, or MacOS file attrs"},
+# endif
+# if defined( UNIX) && defined( __APPLE__)
+ {UZO, "Je", "junk-extattrs", o_NO_VALUE, o_NEGATABLE,
+ o_Je, "Junk Mac OS X extended attributes"},
+ {UZO, "Jf", "junk-finder", o_NO_VALUE, o_NEGATABLE,
+ o_Jf, "Junk Mac OS X Finder info"},
+ {UZO, "Jq", "junk-qtn", o_NO_VALUE, o_NEGATABLE,
+ o_Jq, "Junk Mac OS X quarantine"},
+ {UZO, "Jr", "junk-rsrc", o_NO_VALUE, o_NEGATABLE,
+ o_Jr, "Junk Mac OS X resource fork"},
+# endif /* defined( UNIX) && defined( __APPLE__) */
+ {UZO, "", "jar", o_NO_VALUE, o_NEGATABLE,
+ o_ja, "Treat archive(s) as Java JAR (UTF-8)"},
+# ifdef ATH_BEO_UNX
+ {UZO, "K", "keep-s-attrs", o_NO_VALUE, o_NEGATABLE,
+ 'K', "retain SUID/SGID/Tacky attrs"},
+# endif
+# ifdef KFLAG
+ {UZO, "k", "keep-permissions", o_NO_VALUE, o_NEGATABLE,
+ 'k', "retain permissions"},
+# endif
+# ifdef VMS
+ {UZO, "ka", "keep-acl", o_NO_VALUE, o_NEGATABLE,
+ o_ka, "restore (VMS) ACL"},
+# endif
+# ifndef SFX
+ {UZO, "l", "list", o_NO_VALUE, o_NEGATABLE,
+ 'l', "list archive members"},
+# endif
+# ifndef CMS_MVS
+ {UZO, "L", "lowercase-names", o_NO_VALUE, o_NEGATABLE,
+ 'L', "convert (some) names to lower"},
+# endif
+ {UZO, "", "license", o_NO_VALUE, o_NOT_NEGATABLE,
+ o_LI, "Info-ZIP license"},
+# ifdef MORE
+# ifdef CMS_MVS
+ {UZO, "m", "more", o_NO_VALUE, o_NEGATABLE,
+ 'm', "pipe output through more"},
+# endif
+ {UZO, "M", "more", o_NO_VALUE, o_NEGATABLE,
+ 'M', "pipe output through more"},
+# endif /* MORE */
+ {UZO, "n", "never-overwrite", o_NO_VALUE, o_NEGATABLE,
+ 'n', "never overwrite files (no prompting)"},
+# ifdef AMIGA
+ {UZO, "N", "comment-to-note", o_NO_VALUE, o_NEGATABLE,
+ 'N', "restore comments as filenotes"},
+# endif
+# ifdef ICONV_MAPPING
+# ifdef UNIX
+ {UZO, "O", "oem-char-set", o_REQUIRED_VALUE, o_NOT_NEGATABLE,
+ 'O', "OEM char set to use"},
+# endif /* def ICONV_MAPPING */
+# endif
+ {UZO, "o", "overwrite", o_NO_VALUE, o_NEGATABLE,
+ 'o', "overwrite files without prompting"},
+ {UZO, "p", "pipe-to-stdout", o_NO_VALUE, o_NEGATABLE,
+ 'p', "pipe extraction to stdout, no messages"},
+# ifdef IZ_CRYPT_ANY
+ {UZO, "P", "password", o_REQUIRED_VALUE, o_NEGATABLE,
+ 'P', "password"},
+# endif
+ {UZO, "q", "quiet", o_NO_VALUE, o_NEGATABLE,
+ 'q', "quiet mode (additional q's => more quiet)"},
+# ifdef QDOS
+ {UZO, "Q", "QDOS", o_NO_VALUE, o_NEGATABLE,
+ 'Q', "QDOS flags"},
+# endif
+# ifdef TANDEM
+ {UZO, "r", "remove-exts", o_NO_VALUE, o_NEGATABLE,
+ 'r', "remove file extensions"},
+# endif
+ {UZO, "s", "space-to-uscore", o_NO_VALUE, o_NEGATABLE,
+ 's', "spaces to underscores"},
+# ifdef VMS
+ {UZO, "S", "streamlf", o_NO_VALUE, o_NEGATABLE,
+ 'S', "VMS extract text as Stream_LF"},
+# endif
+# ifndef SFX
+ {UZO, "sc", "show-command", o_NO_VALUE, o_NEGATABLE,
+ o_sc, "show processed command line and exit"},
+# if !defined( VMS) && defined( ENABLE_USER_PROGRESS)
+ {UZO, "si", "show-pid", o_NO_VALUE, o_NEGATABLE,
+ o_si, "show process ID"},
+# endif /* !defined( VMS) && defined( ENABLE_USER_PROGRESS) */
+ {UZO, "so", "show-options", o_NO_VALUE, o_NEGATABLE,
+ o_so, "show available options on this system"},
+# endif /* ndef SFX */
+ {UZO, "t", "test", o_NO_VALUE, o_NEGATABLE,
+ 't', "test archive"},
+# ifdef TIMESTAMP
+ {UZO, "T", "timestamp-new", o_NO_VALUE, o_NEGATABLE,
+ 'T', "timestamp archive same as newest file"},
+# endif
+ {UZO, "u", "update", o_NO_VALUE, o_NEGATABLE,
+ 'u', "update (extract only new/newer files)"},
+# ifdef UNICODE_SUPPORT
+ {UZO, "U", "unicode", o_NO_VALUE, o_NEGATABLE,
+ 'U', "escape non-ASCII Unicode, disable Unicode"},
+# endif /* ?UNICODE_SUPPORT */
+# if !defined( SFX) || defined( DIAG_SFX)
+ {UZO, "v", "verbose", o_NO_VALUE, o_NEGATABLE,
+ 'v', "verbose"},
+ {UZO, "", "version", o_NO_VALUE, o_NEGATABLE,
+ o_ve, "version"},
+# endif
+# ifndef CMS_MVS
+ {UZO, "V", "keep-versions", o_NO_VALUE, o_NEGATABLE,
+ 'V', "don't strip VMS version numbers"},
+# endif
+# ifdef WILD_STOP_AT_DIR
+ {UZO, "W", "wild-no-span", o_NO_VALUE, o_NEGATABLE,
+ 'W', "wildcard * doesn't span /"},
+# endif
+ {UZO, "x", "exclude", o_VALUE_LIST, o_NOT_NEGATABLE,
+ 'x', "exclude this list of files"},
+# if (defined(RESTORE_UIDGID) || defined(RESTORE_ACL))
+ {UZO, "X", "restore-owner", o_NO_VALUE, o_NEGATABLE,
+ 'X', "restore owner/group (UID/GID, UIC, ...)"},
+# endif
+# ifdef VMS
+ {UZO, "Y", "dot-version", o_NO_VALUE, o_NEGATABLE,
+ 'Y', "VMS treat .nnn as ;nnn version"},
+# endif
+ {UZO, "z", "zipfile-comment", o_NO_VALUE, o_NEGATABLE,
+ 'z', "display zipfile comment"},
+# if !defined( SFX) && !defined( NO_ZIPINFO)
+ {UZO, "Z", "zipinfo-mode", o_NO_VALUE, o_NOT_NEGATABLE,
+ 'Z', "ZipInfo mode (must be first option)"},
+# endif
+# ifdef RISCOS
+ {UZO, "/", "extensions", o_REQUIRED_VALUE, o_NEGATABLE,
+ '/', "override Unzip$Exts"},
+# endif
+# ifdef VOLFLAG
+ {UZO, "$", "volume-labels", o_NO_VALUE, o_NEGATABLE,
+ '$', "extract volume labels"},
+# endif
+# if (!defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM))
+ {UZO, ":", "do-double-dots", o_NO_VALUE, o_NEGATABLE,
+ ':', "don't skip ../ path elements"},
+# endif
+# ifdef UNIX
+ {UZO, "^", "control-in-name", o_NO_VALUE, o_NEGATABLE,
+ '^', "allow control chars in filenames"},
+# endif
+# ifndef NO_ZIPINFO
+ /* ZipInfo options */
+
+ /* short longopt value_type negatable
+ ID name (help text) */
+ {ZIO, "1", "names-only", o_NO_VALUE, o_NEGATABLE,
+ '1', "names-only list"},
+ {ZIO, "2", "names-mostly", o_NO_VALUE, o_NEGATABLE,
+ '2', "names-mostly list"},
+# ifndef CMS_MVS
+ {ZIO, "C", "ignore-case", o_NO_VALUE, o_NEGATABLE,
+ 'C', "ignore case"},
+# endif
+ {ZIO, "h", "header", o_NO_VALUE, o_NEGATABLE,
+ 'h', "header line"},
+# ifdef ICONV_MAPPING
+# ifdef UNIX
+ {ZIO, "I", "iso-char-set", o_REQUIRED_VALUE, o_NOT_NEGATABLE,
+ 'I', "ISO charset to use"},
+# endif /* def ICONV_MAPPING */
+# endif
+ {ZIO, "l", "long-list", o_NO_VALUE, o_NEGATABLE,
+ 'l', "long list"},
+ {ZIO, "m", "medium-list", o_NO_VALUE, o_NEGATABLE,
+ 'm', "medium list"},
+# ifdef MORE
+ {ZIO, "M", "more", o_NO_VALUE, o_NEGATABLE,
+ 'M', "output like more"},
+# endif
+ {ZIO, "mc", "member-counts", o_NO_VALUE, o_NEGATABLE,
+ o_mc, "show separate dir/file/link member counts"},
+# ifdef ICONV_MAPPING
+# ifdef UNIX
+ {ZIO, "O", "oem-char-set", o_REQUIRED_VALUE, o_NOT_NEGATABLE,
+ 'O', "OEM charset to use"},
+# endif /* def ICONV_MAPPING */
+# endif
+ {ZIO, "s", "short-list", o_NO_VALUE, o_NEGATABLE,
+ 's', "short list"},
+# ifndef SFX
+ {ZIO, "sc", "show-command", o_NO_VALUE, o_NEGATABLE,
+ o_sc, "show processed command line and exit"},
+ {ZIO, "so", "show-options", o_NO_VALUE, o_NEGATABLE,
+ o_so, "show available options on this system"},
+# endif /* ndef SFX */
+ {ZIO, "t", "totals", o_NO_VALUE, o_NEGATABLE,
+ 't', "totals line"},
+ {ZIO, "T", "decimal-time", o_NO_VALUE, o_NEGATABLE,
+ 'T', "decimal time format"},
+# ifdef UNICODE_SUPPORT
+ {ZIO, "U", "unicode", o_NO_VALUE, o_NEGATABLE,
+ 'U', "escape non-ASCII Unicode, disable Unicode"},
+# endif
+ {ZIO, "v", "verbose", o_NO_VALUE, o_NEGATABLE,
+ 'v', "very detailed list"},
+# ifdef WILD_STOP_AT_DIR
+ {ZIO, "W", "wild-no-span", o_NO_VALUE, o_NEGATABLE,
+ 'W', "wildcard * doesn't span /"},
+# endif
+ {ZIO, "x", "exclude", o_VALUE_LIST, o_NOT_NEGATABLE,
+ 'x', "exclude this list of files"},
+ {ZIO, "z", "zipfile-comment", o_NO_VALUE, o_NEGATABLE,
+ 'z', "print zipfile comment"},
+ {ZIO, "Z", "zipinfo-mode", o_NO_VALUE, o_NEGATABLE,
+ 'Z', "ZipInfo mode"},
+# endif /* ndef NO_ZIPINFO */
+
+ /* the end of the list */
+ {0, NULL, NULL, o_NO_VALUE, o_NOT_NEGATABLE,
+ 0, NULL} /* end has option_ID = 0 */
+ };
+
+
+/* 2012-12-12 SMS.
+ * Free some storage, if it was allocated, and we care.
+ * (Use before a fatal error exit.)
+ */
+# ifdef REENTRANT
+# define FREE_NON_NULL( x) if ((x) != NULL) izu_free( x)
+# define UPDATE_PARGV *pargv = args
+# else
+# define FREE_NON_NULL( x)
+# define UPDATE_PARGV
+# endif
/**********************/
int *pargc;
char ***pargv;
{
- char **argv, *s;
- int argc, c, error=FALSE, negative=0, showhelp=0;
-
-
- argc = *pargc;
- argv = *pargv;
-
- while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) {
- s = *argv + 1;
- while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */
-#ifdef CMS_MVS
- switch (tolower(c))
-#else
- switch (c)
-#endif
- {
- case ('-'):
- ++negative;
- break;
-#ifdef RISCOS
- case ('/'):
- if (negative) { /* negative not allowed with -/ swap */
+ char **args;
+ int argc;
+ int uzo_err = FALSE;
+ int showhelp = 0;
+# ifdef ENABLE_USER_PROGRESS
+ int show_pid = 0;
+# endif /* def ENABLE_USER_PROGRESS */
+
+ /* used by get_option */
+ unsigned long option; /* option ID returned by get_option */
+ int argcnt = 0; /* current argcnt in args */
+ int argnum = 0; /* arg number */
+ int optchar = 0; /* option state */
+ char *value = NULL; /* non-option arg, option value or NULL */
+ int negative = 0; /* 1 = option negated */
+ int fna = 0; /* current first non-opt arg */
+ int optnum = 0; /* index in table */
+
+
+ /* since get_option() returns xfiles and files one at a time, store them
+ in linked lists until have them all */
+
+ int file_count = 0;
+ struct file_list *next_file;
+
+ /* files to extract */
+ int in_files_count = 0;
+ struct file_list *in_files = NULL;
+ struct file_list *next_in_files = NULL;
+
+ /* files to exclude in -x list */
+ int in_xfiles_count = 0;
+ struct file_list *in_xfiles = NULL;
+ struct file_list *next_in_xfiles = NULL;
+
+ G.wildzipfn = NULL;
+
+ /* make copy of args that can use with insert_arg() used by get_option() */
+ args = copy_args(__G__ *pargv, 0);
+
+ /* 2013-01-17 SMS.
+ * Note that before any early exit, we must inform the caller of our
+ * new argv[], because he will want to izu_free() ours, not the
+ * original:
+ * UPDATE_PARGV; (*pargv = args;)
+ * return PK_xxx;
+ * In principle, this could be done here, and by anyone who changes
+ * "args", but that looked like more work.
+ */
+
+ /* Initialize lists */
+ G.filespecs = 0;
+ G.xfilespecs = 0;
+
+
+ /*
+ -------------------------------------------
+ Process command line using get_option
+ -------------------------------------------
+
+ Each call to get_option() returns either a command
+ line option and possible value or a non-option argument.
+ Arguments are permuted so that all options (-r, -b temp)
+ are returned before non-option arguments (zipfile).
+ Returns 0 when nothing left to read.
+ */
+
+ /* set argnum = 0 on first call to init get_option */
+ argnum = 0;
+
+ /* get_option returns the option ID and updates parameters:
+ args - usually same as argv if no argument file support
+ argcnt - current argc for args
+ value - char* to value (free() when done with it) or NULL if none
+ negative - option was negated with trailing -
+
+ The first argument, UZO, tells get_option() that these are the UnZip
+ options (not ZipInfo options).
+
+ See the comments for get_option() for the other parameters.
+ */
+
+ /* 2012-12-12 SMS.
+ * get_option() may allocate storage for "value". If exiting early
+ * (typically because of an error condition), then use
+ * "FREE_NON_NULL( value)" to free this storage. (See comments
+ * above, where FREE_NON_NULL() is defined.) If saving "value"
+ * in some persistent location, then set "value = NULL" to prevent
+ * this storage from being free()'d. Otherwise, at the bottom of
+ * the "while" loop, this storage will be free()'d.
+ */
+
+ while ((option = get_option(__G__ UZO, &args, &argcnt, &argnum,
+ &optchar, &value, &negative,
+ &fna, &optnum, 0)))
+ {
+ if(option == o_BAD_ERR) {
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return(PK_PARAM);
+ }
+
+ switch (option)
+ {
+# ifdef RISCOS
+ case ('/'):
+ if (negative) { /* negative not allowed with -/ swap */
+ Info(slide, 0x401, ((char *)slide,
+ "error: must give extensions list"));
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return(PK_PARAM); /* don't extract here by accident */
+ }
+ /* 2012-12-11 SMS.
+ * Note that this Acorn-RISC-OS-specific variable,
+ * exts2swap, is getting dynamic memory which will not
+ * be free()'d. Most likely, it really should be moved
+ * into the general globals atructure, and dealt with
+ * properly, so someone who cares might wish to do that.
+ */
+ exts2swap = value; /* override Unzip$Exts */
+ value = NULL; /* In use. Don't free it. */
+ break;
+# endif /* def RISCOS */
+ case ('a'):
+ if (negative) {
+ uO.aflag = IZ_MAX(uO.aflag-negative,0);
+ } else
+ ++uO.aflag;
+ break;
+# if defined(DLL) && defined(API_DOC)
+ case ('A'): /* extended help for API */
+ APIhelp(__G__ value);
+ *pargc = -1; /* signal to exit successfully */
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_OK;
+# endif /* defined(DLL) && defined(API_DOC) */
+ case ('b'):
+ if (negative) {
+# if defined(TANDEM) || defined(VMS)
+ /* AS negative IS ALWAYS 1, IS THIS RIGHT? */
+ uO.bflag = IZ_MAX(uO.bflag-negative,0);
+# endif /* defined(TANDEM) || defined(VMS) */
+ /* do nothing: "-b" is default */
+ } else {
+# ifdef VMS
+ if (uO.aflag == 0)
+ ++uO.bflag;
+# endif /* def VMS */
+# ifdef TANDEM
+ ++uO.bflag;
+# endif /* def TANDEM */
+ uO.aflag = 0;
+ }
+ break;
+# ifdef UNIXBACKUP
+ case ('B'): /* -B: back up existing files */
+ if (negative)
+ uO.B_flag = FALSE;
+ else
+ uO.B_flag = TRUE;
+ break;
+# endif /* def UNIXBACKUP */
+ case ('c'):
+ if (negative) {
+ uO.cflag = FALSE;
+# ifdef NATIVE
+ uO.aflag = 0;
+# endif /* def NATIVE */
+ } else {
+ uO.cflag = TRUE;
+# ifdef NATIVE
+ uO.aflag = 2; /* so you can read it on the screen */
+# endif /* def NATIVE */
+# ifdef DLL
+ if (G.redirect_text)
+ G.redirect_data = 2;
+# endif /* def DLL */
+ }
+ break;
+# ifndef CMS_MVS
+ case ('C'): /* -C: match filenames case-insensitively */
+ if (negative)
+ uO.C_flag = FALSE, negative = 0;
+ else
+ uO.C_flag = TRUE;
+ break;
+# endif /* ndef CMS_MVS */
+# if !defined(SFX) || defined(SFX_EXDIR)
+ case ('d'):
+ /* 2014-02-19 SMS. Negative is allowed why? */
+ if (negative) { /* negative not allowed with -d exdir */
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(MustGiveExdir)));
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return(PK_PARAM); /* don't extract here by accident */
+ }
+# ifndef SFX
+ uO.auto_exdir = 0; /* -d overrides -da. */
+# endif /* ndef SFX */
+ if (uO.exdir != (char *)NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(OnlyOneExdir)));
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return(PK_PARAM); /* GRR: stupid restriction? */
+ } else {
+ /* first check for "-dexdir", then for "-d exdir" */
+ uO.exdir = value;
+ if (uO.exdir == NULL || *uO.exdir == '\0') {
Info(slide, 0x401, ((char *)slide,
- "error: must give extensions list"));
+ LoadFarString(MustGiveExdir)));
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
return(PK_PARAM); /* don't extract here by accident */
}
- exts2swap = s; /* override Unzip$Exts */
- s += strlen(s);
- break;
-#endif
- case ('a'):
- if (negative) {
- uO.aflag = MAX(uO.aflag-negative,0);
- negative = 0;
- } else
- ++uO.aflag;
- break;
-#if (defined(DLL) && defined(API_DOC))
- case ('A'): /* extended help for API */
- APIhelp(__G__ argc, argv);
- *pargc = -1; /* signal to exit successfully */
- return 0;
-#endif
- case ('b'):
- if (negative) {
-#if (defined(TANDEM) || defined(VMS))
- uO.bflag = MAX(uO.bflag-negative,0);
-#endif
- negative = 0; /* do nothing: "-b" is default */
- } else {
-#ifdef VMS
- if (uO.aflag == 0)
- ++uO.bflag;
-#endif
-#ifdef TANDEM
- ++uO.bflag;
-#endif
- uO.aflag = 0;
- }
- break;
-#ifdef UNIXBACKUP
- case ('B'): /* -B: back up existing files */
- if (negative)
- uO.B_flag = FALSE, negative = 0;
- else
- uO.B_flag = TRUE;
- break;
-#endif
- case ('c'):
- if (negative) {
- uO.cflag = FALSE, negative = 0;
-#ifdef NATIVE
- uO.aflag = 0;
-#endif
- } else {
- uO.cflag = TRUE;
-#ifdef NATIVE
- uO.aflag = 2; /* so you can read it on the screen */
-#endif
-#ifdef DLL
- if (G.redirect_text)
- G.redirect_data = 2;
-#endif
- }
- break;
-#ifndef CMS_MVS
- case ('C'): /* -C: match filenames case-insensitively */
- if (negative)
- uO.C_flag = FALSE, negative = 0;
- else
- uO.C_flag = TRUE;
- break;
-#endif /* !CMS_MVS */
-#if (!defined(SFX) || defined(SFX_EXDIR))
- case ('d'):
- if (negative) { /* negative not allowed with -d exdir */
- Info(slide, 0x401, ((char *)slide,
- LoadFarString(MustGiveExdir)));
- return(PK_PARAM); /* don't extract here by accident */
- }
- if (uO.exdir != (char *)NULL) {
- Info(slide, 0x401, ((char *)slide,
- LoadFarString(OnlyOneExdir)));
- return(PK_PARAM); /* GRR: stupid restriction? */
- } else {
- /* first check for "-dexdir", then for "-d exdir" */
- uO.exdir = s;
- if (*uO.exdir == '\0') {
- if (argc > 1) {
- --argc;
- uO.exdir = *++argv;
- if (*uO.exdir == '-') {
- Info(slide, 0x401, ((char *)slide,
- LoadFarString(MustGiveExdir)));
- return(PK_PARAM);
- }
- /* else uO.exdir points at extraction dir */
- } else {
- Info(slide, 0x401, ((char *)slide,
- LoadFarString(MustGiveExdir)));
- return(PK_PARAM);
- }
- }
- /* uO.exdir now points at extraction dir (-dexdir or
- * -d exdir); point s at end of exdir to avoid mis-
- * interpretation of exdir characters as more options
- */
- if (*s != 0)
- while (*++s != 0)
- ;
- }
- break;
-#endif /* !SFX || SFX_EXDIR */
-#if (!defined(NO_TIMESTAMPS))
- case ('D'): /* -D: Skip restoring dir (or any) timestamp. */
- if (negative) {
- uO.D_flag = MAX(uO.D_flag-negative,0);
- negative = 0;
- } else
- uO.D_flag++;
- break;
-#endif /* (!NO_TIMESTAMPS) */
- case ('e'): /* just ignore -e, -x options (extract) */
- break;
-#ifdef MACOS
- case ('E'): /* -E [MacOS] display Mac e.f. when restoring */
- if( negative ) {
- uO.E_flag = FALSE, negative = 0;
- } else {
- uO.E_flag = TRUE;
+ /* else uO.exdir points at extraction dir */
+ }
+ value = NULL; /* In use. Don't free it. */
+ break;
+ case (o_da):
+# ifndef SFX /* SFX ignores -da. */
+ if (negative)
+ {
+ uO.auto_exdir = IZ_MAX( (uO.auto_exdir- 1), 0);
+ negative = 0;
+ }
+ else if (value == NULL)
+ {
+ uO.auto_exdir = 1; /* Create new dest dir. */
+ }
+ else if (STRNICMP( value, "reuse", strlen( value)) == 0)
+ {
+ uO.auto_exdir = 2; /* Create new or reuse old dest dir. */
+ }
+ else
+ {
+ /* Some invalid (non-"reuse") value found. */
+ Info( slide, 0x401, ((char *)slide,
+ LoadFarString( BadAutoDestValue)));
+ /* Leaving early. Free it. */
+ FREE_NON_NULL( value);
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_PARAM;
+ }
+# endif /* ndef SFX */
+ break;
+# endif /* !defined(SFX) || defined(SFX_EXDIR) */
+# if !defined(NO_TIMESTAMPS)
+ case ('D'): /* -D: Skip restoring dir (or any) timestamp. */
+ if (negative) {
+ uO.D_flag = IZ_MAX(uO.D_flag-negative,0);
+ negative = 0;
+ } else
+ uO.D_flag++;
+ break;
+# endif /* !defined(NO_TIMESTAMPS) */
+ case ('e'): /* just ignore -e, -x options (extract) */
+ break;
+# ifdef MACOS
+ case ('E'): /* -E [MacOS] display Mac e.f. when restoring */
+ if( negative ) {
+ uO.E_flag = FALSE, negative = 0;
+ } else {
+ uO.E_flag = TRUE;
+ }
+ break;
+# endif /* def MACOS */
+ case ('f'): /* "freshen" (extract only newer files) */
+ if (negative)
+ uO.fflag = uO.uflag = FALSE, negative = 0;
+ else
+ uO.fflag = uO.uflag = TRUE;
+ break;
+# if defined(RISCOS) || defined(ACORN_FTYPE_NFS)
+ case ('F'): /* Acorn filetype & NFS extension handling */
+ if (negative)
+ uO.acorn_nfs_ext = FALSE, negative = 0;
+ else
+ uO.acorn_nfs_ext = TRUE;
+ break;
+# endif /* defined(RISCOS) || defined(ACORN_FTYPE_NFS) */
+ case ('h'): /* just print help message and quit */
+ if (showhelp == 0) {
+ showhelp = 1;
+ }
+ break;
+# ifndef SFX
+ case (o_hh): /* just print long help message and quit */
+ if (showhelp == 0) {
+ showhelp = 2;
+ }
+ break;
+# endif /* ndef SFX */
+# ifdef MACOS
+ case ('i'): /* -i [MacOS] ignore filenames stored in Mac ef */
+ if( negative ) {
+ uO.i_flag = FALSE;
+ } else {
+ uO.i_flag = TRUE;
+ }
+ break;
+# endif /* def MACOS */
+# if defined( UNICODE_SUPPORT) && defined( ICONV_MAPPING)
+# ifdef UNIX
+ case ('I'): /* -I [UNIX] ISO char set of input entries */
+ strncpy( G.iso_cp, value, sizeof( G.iso_cp));
+ break;
+# endif /* def UNIX */
+# endif /* defined( UNICODE_SUPPORT) && defined( ICONV_MAPPING) */
+ case ('j'): /* junk pathnames/directory structure */
+ if (negative)
+ {
+ /* "-j-". Junk nothing. Keep all directories. */
+ uO.jflag = 0;
+ }
+ else
+ {
+ /* Analyze any option value (junk depth). */
+ if (value == NULL)
+ {
+ /* No value specified. Junk all directories. */
+ uO.jflag = -1; /* "-j", or equivalent. */
}
- break;
-#endif /* MACOS */
- case ('f'): /* "freshen" (extract only newer files) */
- if (negative)
- uO.fflag = uO.uflag = FALSE, negative = 0;
else
- uO.fflag = uO.uflag = TRUE;
- break;
-#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
- case ('F'): /* Acorn filetype & NFS extension handling */
- if (negative)
- uO.acorn_nfs_ext = FALSE, negative = 0;
- else
- uO.acorn_nfs_ext = TRUE;
- break;
-#endif /* RISCOS || ACORN_FTYPE_NFS */
- case ('h'): /* just print help message and quit */
- if (showhelp == 0) {
-#ifndef SFX
- if (*s == 'h')
- showhelp = 2;
+ {
+ /* Some value specified. Decode it. */
+ long val;
+ char *ep;
+
+ val = strtol( value, &ep, 10);
+ if (ep < value+ strlen( value))
+ {
+ /* Some non-numeric character found. */
+ Info( slide, 0x401, ((char *)slide,
+ LoadFarString( BadJunkDirsValue)));
+ /* Leaving early. Free it. */
+ FREE_NON_NULL( value);
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_PARAM;
+ }
else
-#endif /* !SFX */
{
- showhelp = 1;
+ /* "-j=N". Junk specified number of dirs. */
+ uO.jflag = val;
}
}
- break;
-#ifdef MACOS
- case ('i'): /* -i [MacOS] ignore filenames stored in Mac ef */
- if( negative ) {
- uO.i_flag = FALSE, negative = 0;
- } else {
- uO.i_flag = TRUE;
- }
- break;
-#endif /* MACOS */
- case ('j'): /* junk pathnames/directory structure */
- if (negative)
- uO.jflag = FALSE, negative = 0;
- else
- uO.jflag = TRUE;
- break;
-#if (defined(ATH_BEO) || defined(MACOS))
- case ('J'): /* Junk AtheOS, BeOS or MacOS file attributes */
- if( negative ) {
- uO.J_flag = FALSE, negative = 0;
- } else {
- uO.J_flag = TRUE;
- }
- break;
-#endif /* ATH_BEO || MACOS */
-#ifdef ATH_BEO_UNX
- case ('K'):
- if (negative) {
- uO.K_flag = FALSE, negative = 0;
- } else {
- uO.K_flag = TRUE;
- }
- break;
-#endif /* ATH_BEO_UNX */
-#ifndef SFX
- case ('l'):
- if (negative) {
- uO.vflag = MAX(uO.vflag-negative,0);
- negative = 0;
- } else
- ++uO.vflag;
- break;
-#endif /* !SFX */
-#ifndef CMS_MVS
- case ('L'): /* convert (some) filenames to lowercase */
- if (negative) {
- uO.L_flag = MAX(uO.L_flag-negative,0);
- negative = 0;
- } else
- ++uO.L_flag;
- break;
-#endif /* !CMS_MVS */
-#ifdef MORE
-#ifdef CMS_MVS
- case ('m'):
-#endif
- case ('M'): /* send all screen output through "more" fn. */
+ }
+ break;
+# ifdef J_FLAG
+ case ('J'): /* Junk AtheOS, BeOS or MacOS[X] file attributes */
+ if( negative ) {
+ uO.J_flag = FALSE;
+ } else {
+ uO.J_flag = TRUE;
+ }
+ break;
+# endif /* def J_FLAG */
+# if defined( UNIX) && defined( __APPLE__)
+ case (o_Je): /* Junk (all) extended attributes. */
+ if( negative ) {
+ uO.Je_flag = FALSE;
+ } else {
+ uO.Je_flag = TRUE;
+ }
+ break;
+ case (o_Jf): /* Junk Finder info. */
+ if( negative ) {
+ uO.Jf_flag = FALSE;
+ } else {
+ uO.Jf_flag = TRUE;
+ }
+ break;
+ case (o_Jq): /* Junk quarantine ("com.apple.quarantine") */
+ if( negative ) {
+ uO.Jq_flag = FALSE;
+ } else {
+ uO.Jq_flag = TRUE;
+ }
+ break;
+ case (o_Jr): /* Junk Resource fork. */
+ if( negative ) {
+ uO.Jr_flag = FALSE;
+ } else {
+ uO.Jr_flag = TRUE;
+ }
+ break;
+# endif /* defined( UNIX) && defined( __APPLE__) */
+ case (o_ja): /* --java-cafe. */
+ if (negative) {
+ --uO.java_cafe;
+ negative = 0;
+ } else
+ ++uO.java_cafe;
+ break;
+# ifdef ATH_BEO_UNX
+ case ('K'):
+ if (negative) {
+ uO.K_flag = FALSE;
+ } else {
+ uO.K_flag = TRUE;
+ }
+ break;
+# endif /* ATH_BEO_UNX */
+# ifdef KFLAG
+ case ('k'):
+ if (negative) {
+ uO.kflag = IZ_MAX( -1, (uO.kflag- 1));
+ } else {
+ uO.kflag = IZ_MIN( 1, (uO.kflag+ 1));
+ }
+ break;
+# endif /* def KFLAG */
+# ifdef VMS
+ case (o_ka):
+ if (negative) {
+ uO.ka_flag = FALSE;
+ } else {
+ uO.ka_flag = TRUE;
+ }
+ break;
+# endif /* def VMS */
+# ifndef SFX
+ case ('l'):
+ if (negative) {
+ uO.vflag = IZ_MAX( (uO.vflag- negative), 0);
+ negative = 0;
+ } else
+ ++uO.vflag;
+ break;
+# endif /* ndef SFX */
+# ifndef CMS_MVS
+ case ('L'): /* convert (some) filenames to lowercase */
+ if (negative) {
+ uO.L_flag = IZ_MAX(uO.L_flag-1,0);
+ } else
+ ++uO.L_flag;
+ break;
+# endif /* ndef CMS_MVS */
+ case (o_LI): /* show license */
+ showhelp = -1;
+ break;
+# ifdef MORE
+# ifdef CMS_MVS
+ case ('m'):
+# endif /* def CMS_MVS */
+ case ('M'): /* send all screen output through "more" fn. */
/* GRR: eventually check for numerical argument => height */
- if (negative)
- G.M_flag = FALSE, negative = 0;
- else
- G.M_flag = TRUE;
- break;
-#endif /* MORE */
- case ('n'): /* don't overwrite any files */
- if (negative)
- uO.overwrite_none = FALSE, negative = 0;
- else
- uO.overwrite_none = TRUE;
- break;
-#ifdef AMIGA
- case ('N'): /* restore comments as filenotes */
- if (negative)
- uO.N_flag = FALSE, negative = 0;
- else
- uO.N_flag = TRUE;
- break;
-#endif /* AMIGA */
- case ('o'): /* OK to overwrite files without prompting */
- if (negative) {
- uO.overwrite_all = MAX(uO.overwrite_all-negative,0);
- negative = 0;
- } else
- ++uO.overwrite_all;
- break;
- case ('p'): /* pipes: extract to stdout, no messages */
- if (negative) {
- uO.cflag = FALSE;
- uO.qflag = MAX(uO.qflag-999,0);
- negative = 0;
- } else {
- uO.cflag = TRUE;
- uO.qflag += 999;
- }
- break;
-#if CRYPT
- /* GRR: yes, this is highly insecure, but dozens of people
- * have pestered us for this, so here we go... */
- case ('P'):
- if (negative) { /* negative not allowed with -P passwd */
+ if (negative)
+ G.M_flag = FALSE;
+ else
+ G.M_flag = TRUE;
+ break;
+# endif /* def MORE */
+ case ('n'): /* don't overwrite any files */
+ if (negative)
+ uO.overwrite_none = FALSE;
+ else
+ uO.overwrite_none = TRUE;
+ break;
+# ifdef AMIGA
+ case ('N'): /* restore comments as filenotes */
+ if (negative)
+ uO.N_flag = FALSE;
+ else
+ uO.N_flag = TRUE;
+ break;
+# endif /* def AMIGA */
+ case ('o'): /* OK to overwrite files without prompting */
+ if (negative) {
+ uO.overwrite_all = IZ_MAX(uO.overwrite_all-negative,0);
+ negative = 0;
+ } else
+ ++uO.overwrite_all;
+ break;
+# if defined( UNICODE_SUPPORT) && defined( ICONV_MAPPING)
+# ifdef UNIX
+ case ('O'): /* -O [UNIX] OEM char set of input entries */
+ strncpy( G.oem_cp, value, sizeof( G.oem_cp));
+ break;
+# endif /* def UNIX */
+# endif /* defined( UNICODE_SUPPORT) && defined( ICONV_MAPPING) */
+ case ('p'): /* pipes: extract to stdout, no messages */
+ if (negative) {
+ uO.cflag = FALSE;
+ uO.qflag = IZ_MAX(uO.qflag-999,0);
+ negative = 0;
+ } else {
+ uO.cflag = TRUE;
+ uO.qflag += 999;
+ }
+ break;
+# ifdef IZ_CRYPT_ANY
+ /* GRR: yes, this is highly insecure, but dozens of people
+ * have pestered us for this, so here we go... */
+ case ('P'):
+ if (negative) { /* negative not allowed with -P passwd */
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(MustGivePasswd)));
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return(PK_PARAM); /* don't extract here by accident */
+ }
+ if (uO.pwdarg != (char *)NULL) {
+#if 0
+ GRR: eventually support multiple passwords?
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(OnlyOnePasswd)));
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return(PK_PARAM);
+#endif /* 0 */
+ } else {
+ /* first check for "-Ppasswd", then for "-P passwd" */
+ uO.pwdarg = value;
+ if (uO.pwdarg == NULL || *uO.pwdarg == '\0') {
Info(slide, 0x401, ((char *)slide,
LoadFarString(MustGivePasswd)));
- return(PK_PARAM); /* don't extract here by accident */
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return(PK_PARAM);
}
- if (uO.pwdarg != (char *)NULL) {
-/*
- GRR: eventually support multiple passwords?
+ /* else pwdarg points at decryption password */
+ }
+ value = NULL; /* In use. Don't free it. */
+ break;
+# endif /* def IZ_CRYPT_ANY */
+ case ('q'): /* quiet: fewer comments/messages */
+ if (negative) {
+ uO.qflag = IZ_MAX(uO.qflag-negative,0);
+ negative = 0;
+ } else
+ ++uO.qflag;
+ break;
+# ifdef QDOS
+ case ('Q'): /* QDOS flags */
+ qlflag ^= strtol(value, &value, 10);
+ break; /* we XOR this as we can config qlflags */
+# endif /* def QDOS */
+# ifdef TANDEM
+ case ('r'): /* remove file extensions */
+ if (negative)
+ uO.rflag = FALSE;
+ else
+ uO.rflag = TRUE;
+ break;
+# endif /* def TANDEM */
+ case ('s'): /* spaces in filenames: allow by default */
+ if (negative)
+ uO.sflag = FALSE;
+ else
+ uO.sflag = TRUE;
+ break;
+# ifndef SFX
+ case (o_sc): /* show processed command line and exit */
+ showhelp = -3;
+ break;
+ case (o_so): /* show available options on this system */
+ showhelp = -2;
+ break;
+# endif /* ndef SFX */
+
+# if !defined( VMS) && defined( ENABLE_USER_PROGRESS)
+ case (o_si): /* Show process ID. */
+ show_pid = 1;
+ break;
+# endif /* !defined( VMS) && defined( ENABLE_USER_PROGRESS) */
+
+# ifdef VMS
+ /* VMS: extract "text" files in Stream_LF format (-a[a]) */
+ case ('S'):
+ if (negative)
+ uO.S_flag = FALSE;
+ else
+ uO.S_flag = TRUE;
+ break;
+# endif /* def VMS */
+ case ('t'):
+ if (negative)
+ uO.tflag = FALSE;
+ else
+ uO.tflag = TRUE;
+ break;
+# ifdef TIMESTAMP
+ case ('T'):
+ if (negative)
+ uO.T_flag = FALSE;
+ else
+ uO.T_flag = TRUE;
+ break;
+# endif /* def TIMESTAMP */
+ case ('u'): /* update (extract only new and newer files) */
+ if (negative)
+ uO.uflag = FALSE;
+ else
+ uO.uflag = TRUE;
+ break;
+# ifdef UNICODE_SUPPORT
+ case ('U'): /* escape UTF-8, or disable UTF-8 support */
+ if (negative)
+ uO.U_flag = IZ_MAX(uO.U_flag - 1, 0);
+ else
+ uO.U_flag++;
+ break;
+# endif /* def UNICODE_SUPPORT */
+# if !defined( SFX) || defined( DIAG_SFX)
+ case ('v'): /* verbose */
+ case (o_ve): /* version */
+ if (negative) {
+ uO.vflag = IZ_MAX( (uO.vflag- negative), 0);
+ negative = 0;
+ } else if (uO.vflag)
+ ++uO.vflag;
+ else
+ uO.vflag = 2;
+ break;
+# endif /* !defined( SFX) || defined( DIAG_SFX) */
+# ifndef CMS_MVS
+ case ('V'): /* Version (retain VMS/DEC-20 file versions) */
+ if (negative)
+ uO.V_flag = IZ_MAX( (uO.V_flag- 1), -1);
+ else
+ uO.V_flag = IZ_MIN( (uO.V_flag+ 1), 1);
+ break;
+# endif /* ndef CMS_MVS */
+# ifdef WILD_STOP_AT_DIR
+ case ('W'): /* Wildcard interpretation (stop at '/'?) */
+ if (negative)
+ uO.W_flag = FALSE;
+ else
+ uO.W_flag = TRUE;
+ break;
+# endif /* def WILD_STOP_AT_DIR */
+ case ('x'): /* Exclude. Add -x file to linked list. */
+ if (in_xfiles_count == 0) {
+ /* first entry */
+ if ((in_xfiles = (struct file_list *)
+ izu_malloc(sizeof(struct file_list))
+ ) == NULL) {
Info(slide, 0x401, ((char *)slide,
- LoadFarString(OnlyOnePasswd)));
- return(PK_PARAM);
- */
+ LoadFarString(NoMemArgsList)));
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ in_xfiles->name = value;
+ in_xfiles->next = NULL;
+ next_in_xfiles = in_xfiles;
+ } else {
+ /* add next entry */
+ if ((next_file = (struct file_list *)
+ izu_malloc(sizeof(struct file_list))
+ ) == NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(NoMemArgsList)));
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ next_in_xfiles->next = next_file;
+ next_file->name = value;
+ next_file->next = NULL;
+ next_in_xfiles = next_file;
+ }
+ in_xfiles_count++;
+ value = NULL; /* In use. Don't free it. */
+
+# if 0
+# ifdef SFX
+ /* now get -x list one entry at a time */
+
+
+
+ /* when 'x' is the only option in this argument, and the
+ * next arg is not an option, assume this initiates an
+ * exclusion list (-x xlist): terminate option-scanning
+ * and leave uz_opts with argv still pointing to "-x";
+ * the xlist is processed later
+ */
+ if (s - argv[0] == 2 && *s == '\0' &&
+ argc > 1 && argv[1][0] != '-') {
+ /* break out of nested loops without "++argv;--argc" */
+ goto opts_done;
+ }
+# endif /* def SFX */
+# endif /* 0 */
+ break;
+# if defined(RESTORE_UIDGID) || defined(RESTORE_ACL)
+ case ('X'): /* restore owner/group (more?) info (need privs?) */
+ if (negative) {
+ uO.X_flag = IZ_MAX(uO.X_flag-negative, -1);
+ negative = 0;
+ } else
+ ++uO.X_flag;
+ break;
+# endif /* defined(RESTORE_UIDGID) || defined(RESTORE_ACL) */
+# ifdef VMS
+ case ('Y'): /* Treat ".nnn" as ";nnn" version. */
+ if (negative)
+ uO.Y_flag = FALSE;
+ else
+ uO.Y_flag = TRUE;
+ break;
+# endif /* def VMS */
+ case ('z'): /* display only the archive comment */
+ if (negative) {
+ uO.zflag = IZ_MAX(uO.zflag-negative,0);
+ negative = 0;
+ } else
+ ++uO.zflag;
+ break;
+# ifndef SFX
+ case ('Z'): /* should have been first option (ZipInfo) */
+ Info(slide, 0x401, ((char *)slide, LoadFarString(Zfirst)));
+ uzo_err = TRUE;
+ break;
+# endif /* ndef SFX */
+# ifdef VMS
+ case ('2'): /* Force ODS2-compliant names. */
+ if (negative)
+ uO.ods2_flag = FALSE, negative = 0;
+ else
+ uO.ods2_flag = TRUE;
+ break;
+# endif /* def VMS */
+# ifdef VOLFLAG
+ case ('$'):
+ if (negative) {
+ uO.volflag = IZ_MAX(uO.volflag-negative,0);
+ negative = 0;
+ } else
+ ++uO.volflag;
+ break;
+# endif /* def VOLFLAG */
+# if !defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM)
+ case (':'): /* allow "parent dir" path components */
+ if (negative) {
+ uO.ddotflag = IZ_MAX(uO.ddotflag-negative,0);
+ negative = 0;
+ } else
+ ++uO.ddotflag;
+ break;
+# endif /* !defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM) */
+# ifdef UNIX
+ case ('^'): /* allow control chars in filenames */
+ if (negative) {
+ uO.cflxflag = IZ_MAX(uO.cflxflag-negative,0);
+ negative = 0;
+ } else
+ ++uO.cflxflag;
+ break;
+# endif /* def UNIX */
+ case o_NON_OPTION_ARG:
+ /* Not an option. (Because of permutation, no more
+ * "-" options are expected henceforth.)
+ */
+# ifndef SFX
+ /* For non-SFX (only), the first non-option argument is
+ * the archive name. (For SFX, every non-option argument
+ * is an archive member name.)
+ */
+ if (G.wildzipfn == NULL)
+ {
+ /* first non-option argument is zip file */
+ G.wildzipfn = value;
+
+ } else
+# endif /* ndef SFX */
+ {
+ /* add include file to list */
+ if (in_files_count == 0) {
+ /* first entry */
+ if ((next_file = (struct file_list *)
+ izu_malloc(sizeof(struct file_list))
+ ) == NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(NoMemArgsList)));
+ /* Leaving early. Free it. */
+ FREE_NON_NULL( value);
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ next_file->name = value;
+ next_file->next = NULL;
+ in_files = next_file;
+ next_in_files = next_file;
} else {
- /* first check for "-Ppasswd", then for "-P passwd" */
- uO.pwdarg = s;
- if (*uO.pwdarg == '\0') {
- if (argc > 1) {
- --argc;
- uO.pwdarg = *++argv;
- if (*uO.pwdarg == '-') {
- Info(slide, 0x401, ((char *)slide,
- LoadFarString(MustGivePasswd)));
- return(PK_PARAM);
- }
- /* else pwdarg points at decryption password */
- } else {
- Info(slide, 0x401, ((char *)slide,
- LoadFarString(MustGivePasswd)));
- return(PK_PARAM);
- }
+ /* add next entry */
+ if ((next_file = (struct file_list *)
+ izu_malloc(sizeof(struct file_list))
+ ) == NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(NoMemArgsList)));
+ /* Leaving early. Free it. */
+ FREE_NON_NULL( value);
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
}
- /* pwdarg now points at decryption password (-Ppasswd or
- * -P passwd); point s at end of passwd to avoid mis-
- * interpretation of passwd characters as more options
- */
- if (*s != 0)
- while (*++s != 0)
- ;
- }
- break;
-#endif /* CRYPT */
- case ('q'): /* quiet: fewer comments/messages */
- if (negative) {
- uO.qflag = MAX(uO.qflag-negative,0);
- negative = 0;
- } else
- ++uO.qflag;
- break;
-#ifdef QDOS
- case ('Q'): /* QDOS flags */
- qlflag ^= strtol(s, &s, 10);
- break; /* we XOR this as we can config qlflags */
-#endif
-#ifdef TANDEM
- case ('r'): /* remove file extensions */
- if (negative)
- uO.rflag = FALSE, negative = 0;
- else
- uO.rflag = TRUE;
- break;
-#endif /* TANDEM */
-#ifdef DOS_FLX_NLM_OS2_W32
- case ('s'): /* spaces in filenames: allow by default */
- if (negative)
- uO.sflag = FALSE, negative = 0;
- else
- uO.sflag = TRUE;
- break;
-#endif /* DOS_FLX_NLM_OS2_W32 */
-#ifdef VMS
- /* VMS: extract "text" files in Stream_LF format (-a[a]) */
- case ('S'):
- if (negative)
- uO.S_flag = FALSE, negative = 0;
- else
- uO.S_flag = TRUE;
- break;
-#endif /* VMS */
- case ('t'):
- if (negative)
- uO.tflag = FALSE, negative = 0;
- else
- uO.tflag = TRUE;
- break;
-#ifdef TIMESTAMP
- case ('T'):
- if (negative)
- uO.T_flag = FALSE, negative = 0;
- else
- uO.T_flag = TRUE;
- break;
-#endif
- case ('u'): /* update (extract only new and newer files) */
- if (negative)
- uO.uflag = FALSE, negative = 0;
- else
- uO.uflag = TRUE;
- break;
-#ifdef UNICODE_SUPPORT
- case ('U'): /* escape UTF-8, or disable UTF-8 support */
- if (negative) {
- uO.U_flag = MAX(uO.U_flag-negative,0);
- negative = 0;
- } else
- uO.U_flag++;
- break;
-#else /* !UNICODE_SUPPORT */
-#ifndef CMS_MVS
- case ('U'): /* obsolete; to be removed in version 6.0 */
- if (negative)
- uO.L_flag = TRUE, negative = 0;
- else
- uO.L_flag = FALSE;
- break;
-#endif /* !CMS_MVS */
-#endif /* ?UNICODE_SUPPORT */
-#ifndef SFX
- case ('v'): /* verbose */
- if (negative) {
- uO.vflag = MAX(uO.vflag-negative,0);
- negative = 0;
- } else if (uO.vflag)
- ++uO.vflag;
- else
- uO.vflag = 2;
- break;
-#endif /* !SFX */
-#ifndef CMS_MVS
- case ('V'): /* Version (retain VMS/DEC-20 file versions) */
- if (negative)
- uO.V_flag = FALSE, negative = 0;
- else
- uO.V_flag = TRUE;
- break;
-#endif /* !CMS_MVS */
-#ifdef WILD_STOP_AT_DIR
- case ('W'): /* Wildcard interpretation (stop at '/'?) */
- if (negative)
- uO.W_flag = FALSE, negative = 0;
- else
- uO.W_flag = TRUE;
- break;
-#endif /* WILD_STOP_AT_DIR */
- case ('x'): /* extract: default */
-#ifdef SFX
- /* when 'x' is the only option in this argument, and the
- * next arg is not an option, assume this initiates an
- * exclusion list (-x xlist): terminate option-scanning
- * and leave uz_opts with argv still pointing to "-x";
- * the xlist is processed later
- */
- if (s - argv[0] == 2 && *s == '\0' &&
- argc > 1 && argv[1][0] != '-') {
- /* break out of nested loops without "++argv;--argc" */
- goto opts_done;
+ next_in_files->next = next_file;
+ next_file->name = value;
+ next_file->next = NULL;
+ next_in_files = next_file;
}
-#endif /* SFX */
- break;
-#if (defined(RESTORE_UIDGID) || defined(RESTORE_ACL))
- case ('X'): /* restore owner/protection info (need privs?) */
- if (negative) {
- uO.X_flag = MAX(uO.X_flag-negative,0);
- negative = 0;
- } else
- ++uO.X_flag;
- break;
-#endif /* RESTORE_UIDGID || RESTORE_ACL */
-#ifdef VMS
- case ('Y'): /* Treat ".nnn" as ";nnn" version. */
- if (negative)
- uO.Y_flag = FALSE, negative = 0;
- else
- uO.Y_flag = TRUE;
- break;
-#endif /* VMS */
- case ('z'): /* display only the archive comment */
- if (negative) {
- uO.zflag = MAX(uO.zflag-negative,0);
- negative = 0;
- } else
- ++uO.zflag;
- break;
-#ifndef SFX
- case ('Z'): /* should have been first option (ZipInfo) */
- Info(slide, 0x401, ((char *)slide, LoadFarString(Zfirst)));
- error = TRUE;
- break;
-#endif /* !SFX */
-#ifdef VMS
- case ('2'): /* Force ODS2-compliant names. */
- if (negative)
- uO.ods2_flag = FALSE, negative = 0;
- else
- uO.ods2_flag = TRUE;
- break;
-#endif /* VMS */
-#ifdef DOS_H68_OS2_W32
- case ('$'):
- if (negative) {
- uO.volflag = MAX(uO.volflag-negative,0);
- negative = 0;
- } else
- ++uO.volflag;
- break;
-#endif /* DOS_H68_OS2_W32 */
-#if (!defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM))
- case (':'): /* allow "parent dir" path components */
- if (negative) {
- uO.ddotflag = MAX(uO.ddotflag-negative,0);
- negative = 0;
- } else
- ++uO.ddotflag;
- break;
-#endif /* !RISCOS && !CMS_MVS && !TANDEM */
-#ifdef UNIX
- case ('^'): /* allow control chars in filenames */
- if (negative) {
- uO.cflxflag = MAX(uO.cflxflag-negative,0);
- negative = 0;
- } else
- ++uO.cflxflag;
- break;
-#endif /* UNIX */
- default:
- error = TRUE;
- break;
-
- } /* end switch */
- } /* end while (not end of argument string) */
- } /* end while (not done with switches) */
+ in_files_count++;
+ }
+ value = NULL; /* In use. Don't free it. */
+ break;
+ default:
+ uzo_err = TRUE;
+ break;
+
+ } /* end switch */
+
+ FREE_NON_NULL( value); /* Free it now, if it's not in use. */
+
+ } /* while get_option() */
+
+
+ /* convert files and xfiles lists to arrays */
+
+ /* convert files list to array */
+ if (in_files_count) {
+ if ((G.pfnames = (char **) izu_malloc(
+ (in_files_count + 1) * sizeof(char *))
+ ) == NULL) {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArgsList)));
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ file_count = 0;
+ for (next_file = in_files; next_file;) {
+ G.pfnames[file_count] = next_file->name;
+ in_files = next_file;
+ next_file = next_file->next;
+ izu_free(in_files);
+ file_count++;
+ }
+ G.pfnames[file_count] = NULL;
+ G.filespecs = in_files_count;
+ }
+
+ /* convert xfiles list to array */
+ if (in_xfiles_count) {
+ if ((G.pxnames = (char **) izu_malloc(
+ (in_xfiles_count + 1) * sizeof(char *))
+ ) == NULL) {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArgsList)));
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ file_count = 0;
+ for (next_file = in_xfiles; next_file;) {
+ G.pxnames[file_count] = next_file->name;
+ in_xfiles = next_file;
+ next_file = next_file->next;
+ izu_free(in_xfiles);
+ file_count++;
+ }
+ G.pxnames[file_count] = NULL;
+ G.xfilespecs = in_xfiles_count;
+ }
+
+ /* For speed, set process_all_files flag if no include or exclude list. */
+ G.process_all_files = (in_files_count == 0) && (in_xfiles_count == 0);
+
+ /* get_option() could have changed the arg count, so re-evaluate it. */
+ argc = arg_count(__G__ args);
+
/*---------------------------------------------------------------------------
Check for nonsensical combinations of options.
---------------------------------------------------------------------------*/
-#ifdef SFX
+ if ((uO.cflag && (uO.tflag || uO.uflag)) ||
+ (uO.tflag && uO.uflag) || (uO.fflag && uO.overwrite_none))
+ {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(InvalidOptionsMsg)));
+ uzo_err = TRUE;
+ }
+ if (uO.aflag > 2)
+ uO.aflag = 2;
+# ifdef VMS
+ if (uO.bflag > 2)
+ uO.bflag = 2;
+ /* Clear -S flag when converting text files. */
+ if (uO.aflag <= 0)
+ uO.S_flag = 0;
+# endif /* def VMS */
+ if (uO.overwrite_all && uO.overwrite_none) {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(IgnoreOOptionMsg)));
+ uO.overwrite_all = FALSE;
+ }
+# ifdef MORE
+ if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func. useless */
+ G.M_flag = 0;
+# endif /* def MORE */
+
+# ifdef SFX
+# ifdef DIAG_SFX
+ if ((showhelp == 0) || uzo_err)
+# else /* def DIAG_SFX */
+ if (uzo_err)
+# endif /* def DIAG_SFX [else] */
+# else /* def SFX */
+ if ((showhelp == 0) && ((G.wildzipfn == NULL) || uzo_err))
+# endif /* def SFX [else] */
+ {
+# if defined( SFX) && defined( DIAG_SFX)
+ int argc_orig;
+
+ argc_orig = argc;
+# endif /* defined( SFX) && defined( DIAG_SFX) */
+
+ /* tell caller to exit */
+ if (argc <= 2)
+ argc = -1;
+
+ *pargc = argc;
+ *pargv = args;
+
+ /* 2012-07-27 SMS.
+ * Allow (only) "-v" report in SFX, if DIAG_SFX is defined.
+ */
+# if !defined( SFX) || defined( DIAG_SFX)
+ if (uO.vflag >= 2 && argc == -1) { /* "unzip -v" */
+ show_version_info(__G);
+ return PK_OK;
+ }
+# ifndef SFX
+ if (!G.noargs && !uzo_err)
+ uzo_err = TRUE; /* had options (not -h or -v) but no zipfile */
+# endif /* ndef SFX */
+# if defined( SFX) && !defined( DIAG_SFX)
+ return USAGE(uzo_err);
+# endif /* defined( SFX) && !defined( DIAG_SFX) */
+# endif /* !defined( SFX) || defined( DIAG_SFX) */
+
+# if defined( SFX) && defined( DIAG_SFX)
+ argc = argc_orig;
+# endif /* defined( SFX) && defined( DIAG_SFX) */
+ }
+
+#if 0 /* Duplicate below. */
+# ifdef SFX
+ /* print our banner unless we're being fairly quiet */
+ if (uO.qflag < 2)
+ Info(slide, (uzo_err ? 1 : 0),
+ ((char *)slide, LoadFarString(UnzipSFXBanner),
+ UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
+ LoadFarStringSmall(VersionDate)));
+# ifdef BETA
+ /* always print the beta warning: no unauthorized distribution!! */
+ Info(slide, (uzo_err ? 1 : 0),
+ ((char *)slide, LoadFarString(BetaVersion), "\n", "SFX"));
+# endif /* def BETA */
+# endif /* def SFX */
+#endif /* 0 Duplicate below. */
+
+ if (uO.cflag || uO.tflag || uO.vflag || uO.zflag
+# ifdef TIMESTAMP
+ || uO.T_flag
+# endif /* def TIMESTAMP */
+ )
+ G.extract_flag = FALSE;
+ else
+ G.extract_flag = TRUE;
+
+# if 0
+# ifdef SFX
opts_done: /* yes, very ugly...but only used by UnZipSFX with -x xlist */
-#endif
+# endif /* def SFX */
+# endif /* 0 */
if (showhelp > 0) { /* just print help message and quit */
*pargc = -1;
-#ifndef SFX
+# ifndef SFX
if (showhelp == 2) {
help_extended(__G);
return PK_OK;
} else
-#endif /* !SFX */
+# endif /* ndef SFX */
{
return USAGE(PK_OK);
}
+ } else if (showhelp == -1) {
+ *pargc = -1;
+ show_license(__G);
+ return PK_OK;
+# ifndef SFX
+ } else if (showhelp == -2) {
+ /* show available options */
+ *pargc = -1;
+ show_options(__G);
+ return PK_OK;
+ } else if (showhelp == -3) {
+ /* show command line args */
+ *pargc = -1;
+ show_commandline( args);
+ return PK_OK;
+# endif /* ndef SFX */
}
if ((uO.cflag && (uO.tflag || uO.uflag)) ||
(uO.tflag && uO.uflag) || (uO.fflag && uO.overwrite_none))
{
Info(slide, 0x401, ((char *)slide, LoadFarString(InvalidOptionsMsg)));
- error = TRUE;
+ uzo_err = TRUE;
}
if (uO.aflag > 2)
uO.aflag = 2;
-#ifdef VMS
+# ifdef VMS
if (uO.bflag > 2)
uO.bflag = 2;
- /* Clear -s flag when converting text files. */
+ /* Clear -S flag when converting text files. */
if (uO.aflag <= 0)
uO.S_flag = 0;
-#endif /* VMS */
+# endif /* def VMS */
if (uO.overwrite_all && uO.overwrite_none) {
Info(slide, 0x401, ((char *)slide, LoadFarString(IgnoreOOptionMsg)));
uO.overwrite_all = FALSE;
}
-#ifdef MORE
+# ifdef MORE
if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func. useless */
G.M_flag = 0;
-#endif
+# endif /* def MORE */
-#ifdef SFX
- if (error)
-#else
- if ((argc-- == 0) || error)
-#endif
+# if defined( SFX) && !defined( DIAG_SFX)
+ if (uzo_err)
+# else /* defined( SFX) && !defined( DIAG_SFX) */
+ if ((argc-- == 0) || uzo_err)
+# endif /* defined( SFX) && !defined( DIAG_SFX) [else] */
{
*pargc = argc;
- *pargv = argv;
-#ifndef SFX
+ *pargv = args;
+# ifndef SFX
if (uO.vflag >= 2 && argc == -1) { /* "unzip -v" */
show_version_info(__G);
return PK_OK;
}
- if (!G.noargs && !error)
- error = TRUE; /* had options (not -h or -v) but no zipfile */
-#endif /* !SFX */
- return USAGE(error);
+ if (!G.noargs && !uzo_err)
+ uzo_err = TRUE; /* had options (not -h or -v) but no zipfile */
+# endif /* ndef SFX */
+ return (uzo_err ? PK_PARAM : PK_COOL);
}
-#ifdef SFX
+# ifdef SFX
+/* # if defined( SFX) && !defined( DIAG_SFX) */
/* print our banner unless we're being fairly quiet */
if (uO.qflag < 2)
- Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner),
- UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
- LoadFarStringSmall(VersionDate)));
-#ifdef BETA
+ Info(slide, (uzo_err ? 1 : 0),
+ ((char *)slide, LoadFarString(UnzipSFXBanner),
+ UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
+ LoadFarStringSmall(VersionDate)));
+# ifdef BETA
/* always print the beta warning: no unauthorized distribution!! */
- Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n",
- "SFX"));
-#endif
-#endif /* SFX */
+ Info(slide, (uzo_err ? 1 : 0),
+ ((char *)slide, LoadFarString(BetaVersion), "\n", "SFX"));
+# endif /* def BETA */
+# endif /* def SFX */
if (uO.cflag || uO.tflag || uO.vflag || uO.zflag
-#ifdef TIMESTAMP
+# ifdef TIMESTAMP
|| uO.T_flag
-#endif
+# endif /* def TIMESTAMP */
)
G.extract_flag = FALSE;
else
G.extract_flag = TRUE;
+ /* Show process ID. */
+# if !defined( VMS) && defined( ENABLE_USER_PROGRESS)
+ if (show_pid)
+ {
+ fprintf( stderr, "PID = %d \n", getpid());
+ }
+# endif /* !defined( VMS) && defined( ENABLE_USER_PROGRESS) */
+
*pargc = argc;
- *pargv = argv;
+ *pargv = args;
return PK_OK;
} /* end function uz_opts() */
+# if !defined( SFX) || defined( DIAG_SFX)
+# ifndef _WIN32_WCE /* Win CE does not support environment variables */
+
+/*
+ * show_env(): Display option environment variables.
+ */
+
+static void show_env_heading( __G__ heading)
+ __GDEF
+ int *heading;
+{
+ /* Display the heading once. */
+ if (*heading == 0)
+ {
+ *heading = 1;
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptions)));
+ }
+} /* show_env_heading() */
+
+# ifndef VMSCLI
+static /* Used in vms/cmdline.c, so not static in VMS CLI. */
+# endif /* ndef VMSCLI */
+void show_env( __G__ non_null_only)
+ __GDEF
+ int non_null_only;
+{
+ int heading = 0;
+ char *envptr;
+
+ envptr = getenv(LoadFarStringSmall(EnvUnZip));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvUnZip),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+ envptr = getenv(LoadFarStringSmall(EnvUnZip2));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvUnZip2),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+ envptr = getenv(LoadFarStringSmall(EnvZipInfo));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvZipInfo),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+ envptr = getenv(LoadFarStringSmall(EnvZipInfo2));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvZipInfo2),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+# ifndef __RSXNT__
+# ifdef __EMX__
+ envptr = getenv(LoadFarStringSmall(EnvEMX));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvEMX),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+ envptr = getenv(LoadFarStringSmall(EnvEMXOPT));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvEMXOPT),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+# endif /* __EMX__ */
+# if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2)))
+ envptr = getenv(LoadFarStringSmall(EnvGO32));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvGO32),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+ envptr = getenv(LoadFarStringSmall(EnvGO32TMP));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvGO32TMP),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+# endif /* __GO32__ && !(__DJGPP__ >= 2) */
+# endif /* !__RSXNT__ */
+# ifdef RISCOS
+ envptr = getenv(LoadFarStringSmall(EnvUnZipExts));
+ if ((non_null_only == 0) || (envptr != (char *)NULL))
+ {
+ show_env_heading( __G__ &heading);
+ Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
+ LoadFarStringSmall(EnvUnZipExts),
+ (envptr == (char *)NULL || *envptr == 0)?
+ LoadFarStringSmall2(None) : envptr));
+ }
+# endif /* RISCOS */
+
+} /* show_env() */
+
+# endif /* ndef _WIN32_WCE */
+# endif /* !defined( SFX) || defined( DIAG_SFX) */
+
+
/********************/
/* Function usage() */
/********************/
-#ifdef SFX
+# ifdef SFX
# ifdef VMS
-# define LOCAL "X.\n\
-(Must quote upper-case options, like \"-V\", unless SET PROC/PARSE=EXTEND.)"
+# define LOCAL "X"
# endif
# ifdef UNIX
# define LOCAL "X"
# endif
# ifndef NO_TIMESTAMP
-# ifdef MORE
+# ifdef MORE
# define SFXOPT1 "DM"
-# else
+# else
# define SFXOPT1 "D"
-# endif
+# endif
# else
-# ifdef MORE
+# ifdef MORE
# define SFXOPT1 "M"
-# else
+# else
# define SFXOPT1 ""
-# endif
+# endif
# endif
-int usage(__G__ error) /* return PK-type error code */
+/* SFX Usage guide. */
+
+int usage(__G__ u_err) /* return PK-type error code */
__GDEF
- int error;
+ int u_err;
{
- Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner),
+ int flag = (u_err? 1 : 0);
+
+ Info(slide, flag, ((char *)slide, LoadFarString(UnzipSFXBanner),
UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
LoadFarStringSmall(VersionDate)));
- Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXOpts),
+ Info(slide, flag, ((char *)slide, LoadFarString(UnzipSFXOpts),
SFXOPT1, LOCAL));
-#ifdef BETA
- Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n",
- "SFX"));
-#endif
+# ifdef VMS
+ Info(slide, flag, ((char *)slide, LoadFarString(UnzipSFXOptsV)));
+# endif /* def VMS */
+ Info(slide, flag, ((char *)slide, LoadFarString(UnzipSFXOpts2)));
+# ifdef BETA
+ Info(slide, flag, ((char *)slide, LoadFarString(BetaVersion), "\n",
+ "SFX"));
+# endif
- if (error)
+ if (u_err)
return PK_PARAM;
else
- return PK_COOL; /* just wanted usage screen: no error */
+ return PK_COOL; /* No error, but wanted usage guide. */
} /* end function usage() */
+# else /* def SFX */
-
-
-
-#else /* !SFX */
# ifdef VMS
# define QUOT '\"'
# define QUOTS "\""
-# else
+# else /* def VMS */
# define QUOT ' '
# define QUOTS ""
-# endif
+# endif /* def VMS [else] */
-int usage(__G__ error) /* return PK-type error code */
+/* Normal (Non-SFX) Usage guide. */
+
+int usage(__G__ u_err) /* return PK-type error code */
__GDEF
- int error;
+ int u_err;
{
- int flag = (error? 1 : 0);
-
+ int flag = (u_err? 1 : 0);
/*---------------------------------------------------------------------------
Print either ZipInfo usage or UnZip usage, depending on incantation.
if (uO.zipinfo_mode) {
-#ifndef NO_ZIPINFO
+# ifndef NO_ZIPINFO
Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine1),
ZI_MAJORVER, ZI_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine2)));
Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine3),
LoadFarStringSmall(ZipInfoUsageLine4)));
-#ifdef VMS
+# ifdef VMS
Info(slide, flag, ((char *)slide, "\n\
You must quote non-lowercase options and filespecs, unless SET PROC/PARSE=EXT.\
\n"));
-#endif
+# endif
-#endif /* !NO_ZIPINFO */
+# endif /* !NO_ZIPINFO */
} else { /* UnZip mode */
Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine1),
UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
LoadFarStringSmall(VersionDate)));
-#ifdef BETA
+# ifdef BETA
Info(slide, flag, ((char *)slide, LoadFarString(BetaVersion), "", ""));
-#endif
+# endif
Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine2),
ZIPINFO_MODE_OPTION, LoadFarStringSmall(ZipInfoMode)));
-#ifdef VMS
- if (!error) /* maybe no command-line tail found; show extra help */
+
+# ifdef VMS
+ if (!u_err) /* maybe no command-line tail found; show extra help */
Info(slide, flag, ((char *)slide, LoadFarString(VMSusageLine2b)));
-#endif
+# endif
Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine3),
LoadFarStringSmall(local1)));
} /* end if (uO.zipinfo_mode) */
- if (error)
+ if (u_err)
+ {
+ show_env( __G__ 1); /* Show env vars, if option error. */
return PK_PARAM;
+ }
else
- return PK_COOL; /* just wanted usage screen: no error */
+ return PK_COOL; /* No error, but wanted usage guide. */
} /* end function usage() */
-#endif /* ?SFX */
+# endif /* def SFX [else] */
+/* Print license to stdout. */
+static void show_license(__G)
+ __GDEF
+{
+ extent i; /* counter for license array */
+
+ /* license array */
+ static ZCONST char *text[] = {
+ "Copyright (c) 1990-2014 Info-ZIP. All rights reserved.",
+ "",
+ "This is version 2009-Jan-02 of the Info-ZIP license.",
+ "",
+ "For the purposes of this copyright and license, \"Info-ZIP\" is defined as",
+ "the following set of individuals:",
+ "",
+ " Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,",
+ " Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth,",
+ " Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,",
+ " David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,",
+ " Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,",
+ " Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda,",
+ " Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren,",
+ " Rich Wales, Mike White",
+ "",
+ "This software is provided \"as is,\" without warranty of any kind, express",
+ "or implied. In no event shall Info-ZIP or its contributors be held liable",
+ "for any direct, indirect, incidental, special or consequential damages",
+ "arising out of the use of or inability to use this software.",
+ "",
+ "Permission is granted to anyone to use this software for any purpose,",
+ "including commercial applications, and to alter it and redistribute it",
+ "freely, subject to the above disclaimer and the following restrictions:",
+ "",
+ " 1. Redistributions of source code (in whole or in part) must retain",
+ " the above copyright notice, definition, disclaimer, and this list",
+ " of conditions.",
+ "",
+ " 2. Redistributions in binary form (compiled executables and libraries)",
+ " must reproduce the above copyright notice, definition, disclaimer,",
+ " and this list of conditions in documentation and/or other materials",
+ " provided with the distribution. Additional documentation is not needed",
+ " for executables where a command line license option provides these and",
+ " a note regarding this option is in the executable's startup banner. The",
+ " sole exception to this condition is redistribution of a standard",
+ " UnZipSFX binary (including SFXWiz) as part of a self-extracting archive;",
+ " that is permitted without inclusion of this license, as long as the",
+ " normal SFX banner has not been removed from the binary or disabled.",
+ "",
+ " 3. Altered versions--including, but not limited to, ports to new operating",
+ " systems, existing ports with new graphical interfaces, versions with",
+ " modified or added functionality, and dynamic, shared, or static library",
+ " versions not from Info-ZIP--must be plainly marked as such and must not",
+ " be misrepresented as being the original source or, if binaries,",
+ " compiled from the original source. Such altered versions also must not",
+ " be misrepresented as being Info-ZIP releases--including, but not",
+ " limited to, labeling of the altered versions with the names \"Info-ZIP\"",
+ " (or any variation thereof, including, but not limited to, different",
+ " capitalizations), \"Pocket UnZip,\" \"WiZ\" or \"MacZip\" without the",
+ " explicit permission of Info-ZIP. Such altered versions are further",
+ " prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP",
+ " e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP",
+ " will provide support for the altered versions.",
+ "",
+ " 4. Info-ZIP retains the right to use the names \"Info-ZIP,\" \"Zip,\" \"UnZip,\"",
+ " \"UnZipSFX,\" \"WiZ,\" \"Pocket UnZip,\" \"Pocket Zip,\" and \"MacZip\" for its",
+ " own source and binary releases.",
+ ""
+ };
+
+ for (i = 0; i < sizeof(text)/sizeof(char *); i++)
+ {
+ Info(slide, 0, ((char *)slide, "%s\n", text[i]));
+ }
+} /* end function show_license() */
-#ifndef SFX
+# ifndef SFX
/* Print extended help to stdout. */
static void help_extended(__G)
"",
"Extended Help for UnZip",
"",
- "See the UnZip Manual for more detailed help",
+ "See the UnZip Manual for more detailed information.",
"",
"",
"UnZip lists and extracts files in zip archives. The default action is to",
- "extract zipfile entries to the current directory, creating directories as",
+ "extract archive members to the current directory, creating directories as",
"needed. With appropriate options, UnZip lists the contents of archives",
"instead.",
"",
- "Basic unzip command line:",
- " unzip [-Z] options archive[.zip] [file ...] [-x xfile ...] [-d exdir]",
+ "Basic UnZip command line:",
+ " unzip [-Z] [options] archive[.zip] [file ...] [-x xfile ...]",
"",
"Some examples:",
- " unzip -l foo.zip - list files in short format in archive foo.zip",
+ " unzip -l foo.zip List files in short format in archive foo.zip.",
"",
- " unzip -t foo - test the files in archive foo",
+ " unzip -t foo Test the files in archive foo.",
"",
- " unzip -Z foo - list files using more detailed zipinfo format",
+ " unzip -Z foo List files using more detailed ZipInfo format.",
"",
- " unzip foo - unzip the contents of foo in current dir",
+ " unzip foo Unzip the contents of foo in current dir.",
"",
- " unzip -a foo - unzip foo and convert text files to local OS",
+ " unzip -a foo Unzip foo and convert text files to local OS.",
"",
- "If unzip is run in zipinfo mode, a more detailed list of archive contents",
- "is provided. The -Z option sets zipinfo mode and changes the available",
+ "If UnZip is run in ZipInfo mode, a more detailed list of archive contents",
+ "is provided. The -Z option sets ZipInfo mode and changes the available",
"options.",
"",
- "Basic zipinfo command line:",
- " zipinfo options archive[.zip] [file ...] [-x xfile ...]",
- " unzip -Z options archive[.zip] [file ...] [-x xfile ...]",
+ "Basic ZipInfo command line:",
+ " zipinfo [options] archive[.zip] [file ...] [-x xfile ...]",
+ " unzip -Z [options] archive[.zip] [file ...] [-x xfile ...]",
"",
- "Below, Mac OS refers to Mac OS before Mac OS X. Mac OS X is a Unix based",
- "port and is referred to as Unix Apple.",
+ "Below, MacOS refers to Mac OS before Mac OS X. Mac OS X is a Unix-based",
+ "port and is referred to as MacOSX.",
"",
+ "UnZip 6.10 uses a new command parser which supports long options. Short",
+ "options begin with a single dash (-h), while long options start with two",
+ "(--help). Long options can be abbreviated until uniqueness is lost.",
"",
- "unzip options:",
- " -Z Switch to zipinfo mode. Must be first option.",
+ "-------------------------------------------------------------------------",
+ "WARNING:",
+ "Option negation now uses a TRAILING dash. So -B turns on backup and -B-",
+ "turns it off. For long options, --backup turns on backup and --backup-",
+ "turns it off. Options later in command line override those earlier.",
+ "\"unzip --options\" will show all options and which can be negated.",
+ "-------------------------------------------------------------------------",
+ "",
+ "UnZip now allows most options to appear anywhere in the command line.",
+ "An exception is \"-x file_list\", which still must be last unless list is",
+ "terminated by \"@\" argument as in \"-x f1 f2 f3 @ -B\".",
+ "",
+ "",
+ "UnZip options:",
+ " -Z Switch to ZipInfo mode. Must be the first option.",
" -hh Display extended help.",
" -A [OS/2, Unix DLL] Print extended help for DLL.",
- " -c Extract files to stdout/screen. As -p but include names. Also,",
- " -a allowed and EBCDIC conversions done if needed.",
- " -f Freshen by extracting only if older file on disk.",
+ " -c Extract files to stdout/screen. Like -p, but include names. Also,",
+ " -a is allowed, and ASCII-EBCDIC conversions are done if needed.",
+ " -f Freshen by extracting only if an older file is on disk.",
" -l List files using short form.",
- " -p Extract files to pipe (stdout). Only file data is output and all",
- " files extracted in binary mode (as stored).",
+ " -p Extract files to pipe (stdout). Only file data are put out, and all",
+ " files are extracted as archived (without conversions).",
" -t Test archive files.",
" -T Set timestamp on archive(s) to that of newest file. Similar to",
- " zip -o but faster.",
- " -u Update existing older files on disk as -f and extract new files.",
- " -v Use verbose list format. If given alone as unzip -v show version",
- " information. Also can be added to other list commands for more",
- " verbose output.",
- " -z Display only archive comment.",
+ " zip -o, but faster.",
+ " -u Update existing older files on disk as -f, and extract new files.",
+ " -v Use verbose list format (with -l). Alone (unzip -v), show version",
+ " and build option information. Also can be added to other list",
+ " commands for more verbose output.",
+ " -z Display only the archive comment.",
"",
- "unzip modifiers:",
+ "UnZip modifiers:",
" -a Convert text files to local OS format. Convert line ends, EOF",
" marker, and from or to EBCDIC character set as needed.",
- " -b Treat all files as binary. [Tandem] Force filecode 180 ('C').",
- " [VMS] Autoconvert binary files. -bb forces convert of all files.",
" -B [UNIXBACKUP compile option enabled] Save a backup copy of each",
" overwritten file in foo~ or foo~99999 format.",
+ " -b Treat all files as binary. [Tandem] Force filecode 180 ('C').",
+ " [VMS] Autoconvert binary files. -bb forces convert of all files.",
" -C Use case-insensitive matching.",
- " -D Skip restoration of timestamps for extracted directories. On VMS this",
- " is on by default and -D essentially becames -DD.",
- " -DD Skip restoration of timestamps for all entries.",
- " -E [MacOS (not Unix Apple)] Display contents of MacOS extra field during",
+ " -D Skip restoration of timestamps on all files and directories.",
+ " -D- Restore timestamps on directories as well as on files.",
+ " DEFAULT IS NOW to restore timestamps on files, but not directories.",
+ " -E [MacOS (not MacOSX)] Display contents of MacOS extra field during",
" restore.",
" -F [Acorn] Suppress removal of NFS filetype extension. [Non-Acorn if",
" ACORN_FTYPE_NFS] Translate filetype and append to name.",
+ " -I [Unix, with ICONV_MAPPING] ISO code page to use.",
" -i [MacOS] Ignore filenames in MacOS extra field. Instead, use name in",
" standard header.",
- " -j Junk paths and deposit all files in extraction directory.",
- " -J [BeOS] Junk file attributes. [MacOS] Ignore MacOS specific info.",
+ " -J [BeOS] Junk file attributes.",
+ " [MacOS] Ignore MacOS specific info.",
+ " [MacOSX] No special AppleDouble file handling.",
+ " -Je [MacOSX] Ignore AppleDouble extended attributes.",
+ " -Jf [MacOSX] Ignore AppleDouble Finder info.",
+ " -Jq [MacOSX] Ignore AppleDouble quarantine (an extended attribute).",
+ " -Jr [MacOSX] Ignore AppleDouble resource fork.",
+ " -j[=N] Junk paths. Strip all (or top N) directories from extracted files.",
+ " --jar Treat archive(s) as Java JAR (UTF-8 names).",
" -K [AtheOS, BeOS, Unix] Restore SUID/SGID/Tacky file attributes.",
- " -L Convert to lowercase any names from uppercase only file system.",
+ " -k [AtheOS, BeOS, Unix, VMS] Ignore umask (VMS: default protection)",
+ " when restoring permissions/protections.",
+ " -k- Ignore archive permissions/protections. Use umask (VMS: dflt prot).",
+ " Default: Apply umask (VMS: dflt prot) to archive perms/prots.",
+ " -ka [VMS] Restore (VMS) ACL.",
+ " -L Convert to lowercase any names from uppercase-only file system.",
" -LL Convert all files to lowercase.",
" -M Pipe all output through internal pager similar to Unix more(1).",
- " -n Never overwrite existing files. Skip extracting that file, no prompt.",
" -N [Amiga] Extract file comments as Amiga filenotes.",
+ " -n Never overwrite existing files. Skip extracting that file, no prompt.",
+ " -O [Unix, with ICONV_MAPPING] OEM code page to use. If -O is not used,",
+ " UnZip tries to set automatically the OEM code page, based on",
+ " the current environment language setting.",
" -o Overwrite existing files without prompting. Useful with -f. Use with",
" care.",
- " -P p Use password p to decrypt files. THIS IS INSECURE! Some OS show",
+ " -P pw Use password pw to decrypt files. THIS IS INSECURE! Some OS show",
" command line to other users.",
" -q Perform operations quietly. The more q (as in -qq) the quieter.",
- " -s [OS/2, NT, MS-DOS] Convert spaces in filenames to underscores.",
" -S [VMS] Convert text files (-a, -aa) into Stream_LF format.",
+ " -s Convert spaces in filenames to underscores.",
" -U [UNICODE enabled] Show non-local characters as #Uxxxx or #Lxxxxxx ASCII",
" text escapes where x is hex digit. [Old] -U used to leave names",
" uppercase if created on MS-DOS, VMS, etc. See -L.",
" -W [Only if WILD_STOP_AT_DIR] Modify pattern matching so ? and * do not",
" match directory separator /, but ** does. Allows matching at specific",
" directory levels.",
- " -X [VMS, Unix, OS/2, NT, Tandem] Restore UICs and ACL entries under VMS,",
- " or UIDs/GIDs under Unix, or ACLs under certain network-enabled",
- " versions of OS/2, or security ACLs under Windows NT. Can require",
- " user privileges.",
+ " -X [Unix, VMS, OS/2, NT, Tandem] Restore UID/GID on Unix, UIC on VMS,",
+ " ACL on certain network-enabled versions of OS/2, or security ACL",
+ " on Windows NT. Can require user privileges.",
" -XX [NT] Extract NT security ACLs after trying to enable additional",
" system privileges.",
" -Y [VMS] Treat archived name endings of .nnn as VMS version numbers.",
" Default is to exploit destination file system, preserving cases and",
" extended name characters on ODS5 and applying ODS2 filtering on ODS2.",
"",
+ " --commandline Show the processed command line and exit.",
"",
"Wildcards:",
- " Internally unzip supports the following wildcards:",
+ " Internally UnZip supports the following wildcards:",
" ? (or %% or #, depending on OS) matches any single character",
" * matches any number of characters, including zero",
" [list] matches char in list (regex), can do range [ac-f], all but [!bf]",
" If port supports [], must escape [ as [[]",
- " For shells that expand wildcards, escape (\\* or \"*\") so unzip can recurse.",
+ " For shells that expand wildcards, escape (\\* or \"*\") so UnZip can recurse.",
"",
"Include and Exclude:",
" -i pattern pattern ... include files that match a pattern",
" unzip archive -x pattern pattern ...",
"",
"Multi-part (split) archives (archives created as a set of split files):",
- " Currently split archives are not readable by unzip. A workaround is",
+ " Currently split archives are not readable by UnZip. A workaround is",
" to use zip to convert the split archive to a single-file archive and",
- " use unzip on that. See the manual page for Zip 3.0 or later.",
+ " use UnZip on that. See the manual page for Zip 3.0 or later.",
+ " Split support should be added to UnZip 6.10 before release.",
"",
- "Streaming (piping into unzip):",
- " Currently unzip does not support streaming. The funzip utility can be",
+ "Streaming (piping into UnZip):",
+ " Currently UnZip does not support streaming. The FUnZip utility can be",
" used to process the first entry in a stream.",
" cat archive | funzip",
"",
" This can be modified using -q for quieter operation, and -qq for even",
" quieter operation.",
"",
- "Unicode:",
- " If compiled with Unicode support, unzip automatically handles archives",
- " with Unicode entries. Currently Unicode on Win32 systems is limited.",
- " Characters not in the current character set are shown as ASCII escapes",
- " in the form #Uxxxx where the Unicode character number fits in 16 bits,",
- " or #Lxxxxxx where it doesn't, where x is the ASCII character for a hex",
- " digit.",
+ "Unicode and character set conversions:",
+ " If compiled with Unicode support, UnZip automatically handles archives",
+ " with Unicode entries. On ports where UTF-8 is not the native character",
+ " set, characters not in current encoding are shown as ASCII escapes in",
+ " form #Uxxxx or #Lxxxxxx where x is ASCII character for hex digit.",
+ " Though modern UNIX consoles support full UTF-8, some older console",
+ " displays may be limited to a specific code page. Either way full UTF-8",
+ " paths are generally restored on extraction where OS supports. Use -U",
+ " to force use of escapes in extracted names. Use -UU to totally ignore",
+ " Unicode. Unicode comments are only supported currently if UTF-8 is the",
+ " native character set. Full comment support is expected shortly.",
+ "",
+ " On Unix, with ICONV_MAPPING defined at build time, options -I and -O are",
+ " used to specify the ISO and OEM code pages used for name conversions.",
+ " By default, UnZip will try to select a code page based on the user's",
+ " environment (language settings). -I and -O will override this.",
"",
"",
- "zipinfo options (these are used in zipinfo mode (unzip -Z ...)):",
+ "ZipInfo options (these are used in ZipInfo mode (unzip -Z ...)):",
" -1 List names only, one per line. No headers/trailers. Good for scripts.",
- " -2 List names only as -1, but include headers, trailers, and comments.",
+ " -2 List names only as -1, but allow headers, trailers, and comments.",
" -s List archive entries in short Unix ls -l format. Default list format.",
- " -m List in long Unix ls -l format. As -s, but includes compression %.",
- " -l List in long Unix ls -l format. As -m, but compression in bytes.",
+ " -m List in long Unix ls -l format. Like -s, but includes compression %.",
+ " -l List in long Unix ls -l format. Like -m, but compression in bytes.",
" -v List zipfile information in verbose, multi-page format.",
" -h List header line. Includes archive name, actual size, total files.",
" -M Pipe all output through internal pager similar to Unix more(1) command.",
" not in current character set as text #Uxxxx and #Lxxxxxx escapes",
" representing the Unicode character number of the character in hex.",
" -UU [UNICODE] Disable use of any UTF-8 path information.",
- " -z Include archive comment if any in listing.",
- "",
+ " -W [Only if WILD_STOP_AT_DIR] Modify pattern matching so ? and * do not",
+ " match directory separator /, but ** does. Allows matching at specific",
+ " directory levels.",
+ " -z Include archive comment if any in listing.",
+ "",
"",
- "funzip stream extractor:",
- " funzip extracts the first member in an archive to stdout. Typically",
+ "FUnZip stream extractor:",
+ " FUnZip extracts the first member in an archive to stdout. Typically",
" used to unzip the first member of a stream or pipe. If a file argument",
" is given, read from that file instead of stdin.",
"",
- "funzip command line:",
+ "FUnZip command line:",
" funzip [-password] [input[.zip|.gz]]",
"",
"",
- "unzipsfx self extractor:",
- " Self-extracting archives made with unzipsfx are no more (or less)",
- " portable across different operating systems than unzip executables.",
- " In general, a self-extracting archive made on a particular Unix system,",
- " for example, will only self-extract under the same flavor of Unix.",
- " Regular unzip may still be used to extract embedded archive however.",
+ "UnZipSFX self extractor:",
+ " UnZipSFX is a special UnZip program which can be attached to a normal",
+ " Zip archive, forming a self-extracting archive. On a system which is",
+ " compatible with the UnZipSFX executable used, the resulting",
+ " UnZipSFX+archive bundle can be executed to extract the contents of the",
+ " archive in the bundle, without using a separate UnZip program.",
+ " (A separate, normal UnZip program on any system can also be used to",
+ " extract files from a self-extracting archive, ignoring the UnZipSFX",
+ " program in the SFX bundle.)",
"",
- "unzipsfx command line:",
- " <unzipsfx+archive_filename> [-options] [file(s) ... [-x xfile(s) ...]]",
+ "UnZipSFX command line:",
+ " <unzipsfx+archive_filename> [options] [file ...] [-x xfile ...]",
"",
- "unzipsfx options:",
- " -c, -p - Output to pipe. (See above for unzip.)",
- " -f, -u - Freshen and Update, as for unzip.",
- " -t - Test embedded archive. (Can be used to list contents.)",
- " -z - Print archive comment. (See unzip above.)",
+ "UnZipSFX options:",
+ " -c, -p Output to stdout/pipe. (See UnZip, above.)",
+ " -f, -u Freshen and Update, as for UnZip. (See UnZip, above.)",
+ " -t Test embedded archive. (Can be used to list contents.)",
+ " -z Print archive comment. (See UnZip, above.)",
"",
- "unzipsfx modifiers:",
- " Most unzip modifiers are supported. These include",
- " -a - Convert text files.",
- " -n - Never overwrite.",
- " -o - Overwrite without prompting.",
- " -q - Quiet operation.",
- " -C - Match names case-insensitively.",
- " -j - Junk paths.",
- " -V - Keep version numbers.",
- " -s - Convert spaces to underscores.",
- " -$ - Restore volume label.",
+ "UnZipSFX modifiers:",
+ " Most UnZip modifiers are supported. These include",
+ " -a Convert text files.",
+ " -n Never overwrite.",
+ " -o Overwrite without prompting.",
+ " -q Quiet operation.",
+ " -C Match names case-insensitively.",
+ " -j[=N] Junk paths. Strip all (or top N) directories from extracted files.",
+ " -V Retain VMS file version numbers (like: \";123\").",
+ " -s Convert spaces to underscores.",
+ " -$ Restore volume label.",
"",
- "If unzipsfx compiled with SFX_EXDIR defined, -d option also available:",
- " -d exd - Extract to directory exd.",
- "By default, all files extracted to current directory. This option",
+ "If UnZipSFX is built with SFX_EXDIR defined, the -d option also available:",
+ " -d exd Extract to directory exd.",
+ "By default, all files are extracted to the current directory. This option",
"forces extraction to specified directory.",
"",
"See unzipsfx manual page for more information.",
} /* end function help_extended() */
+/* Print available options. */
+static void show_options(__G)
+ __GDEF
+{
+ extent i;
+ int lolen;
+ char optiontext[200];
+ char gr[4];
+ char sh[7];
+ char lo[80];
+ char val_type[5];
+ char neg[2];
+
+#if 0
+ struct option_struct {
+ int option_group; /* either UZO for UnZip or ZIO for ZipInfo syntax */
+ char Far *shortopt; /* pointer to short option string */
+ char Far *longopt; /* pointer to long option string */
+ int value_type; /* from above */
+ int negatable; /* from above */
+ unsigned long option_ID; /* value returned by get_option when this option
+ is found */
+ char Far *name; /* optional string for option returned on some
+ errors */
+#endif /* 0 */
+
+ sprintf(optiontext, "%s\n\n%s\n%s",
+ "Available options on this system",
+ "UNZ = UnZip option, INF = ZipInfo option",
+ "n = Negatable");
+ Info(slide, 0, ((char *)slide, "%s\n\n", optiontext));
+
+ sprintf(optiontext, "grp sh long val n description");
+ Info(slide, 0, ((char *)slide, "%s\n", optiontext));
+
+ for (i = 0; options[i].option_ID != 0; i++)
+ {
+ if (options[i].option_group == UZO)
+ strcpy(gr, "UNZ");
+ else if (options[i].option_group == ZIO)
+ strcpy(gr, "INF");
+ else
+ strcpy(gr, "? ");
+
+ strcpy(sh, options[i].shortopt);
+ strcat(sh, " ");
+ sh[2] = '\0';
+
+ strcpy(lo, options[i].longopt);
+ lolen = strlen(lo);
+ strcat(lo, " ");
+ if (lolen < 15)
+ lolen = 15;
+ lo[lolen] = '\0';
+
+ switch (options[i].value_type) {
+ case o_NO_VALUE:
+ strcpy(val_type, "none"); break;
+ case o_REQUIRED_VALUE:
+ strcpy(val_type, "requ"); break;
+ case o_OPTIONAL_VALUE:
+ strcpy(val_type, "optn"); break;
+ case o_VALUE_LIST:
+ strcpy(val_type, "list"); break;
+ case o_ONE_CHAR_VALUE:
+ strcpy(val_type, "char"); break;
+ case o_NUMBER_VALUE:
+ strcpy(val_type, "numb"); break;
+ case o_OPT_EQ_VALUE:
+ strcpy(val_type, "=val"); break;
+ default:
+ strcpy(val_type, "? ");
+ }
+ if (options[i].negatable == 0)
+ strcpy(neg, "n");
+ else if (options[i].negatable == 1)
+ strcpy(neg, "y");
+ else
+ strcpy(neg, "?");
-#ifndef _WIN32_WCE /* Win CE does not support environment variables */
-#if (!defined(MODERN) || defined(NO_STDLIB_H))
+ sprintf(optiontext, "%s %s %s %s %s %s", gr, sh, lo, val_type,
+ neg, options[i].name);
+ Info(slide, 0, ((char *)slide, "%s\n", optiontext));
+ }
+} /* end function show_options() */
+
+/* Print processed command line. */
+void show_commandline( args)
+ char *args[];
+{
+# define MAX_CARG_LEN (WSIZE>>2)
+
+ extent i;
+ char argtext[MAX_CARG_LEN + 1];
+ GETGLOBALS();
+
+ Info(slide, 0, ((char *)slide, "%s\n\n", "Processed command line:"));
+
+ for (i = 0; args[i]; i++)
+ {
+ if (strlen(args[i]) > MAX_CARG_LEN - 6) {
+ /* If arg too big, truncate it and add ... to end.
+ We are just displaying the args and exiting. */
+ args[i][MAX_CARG_LEN - 6] = '\0';
+ strcat(args[i], " ...");
+ }
+ sprintf(argtext, "\"%s\"", args[i]);
+ Info(slide, 0, ((char *)slide, "%s ", argtext));
+ }
+ Info(slide, 0, ((char *)slide, "%s", "\n"));
+} /* end function show_commandline() */
+
+
+# ifndef _WIN32_WCE /* Win CE does not support environment variables */
+# if (!defined(MODERN) || defined(NO_STDLIB_H))
/* Declare getenv() to be sure (might be missing in some environments) */
extern char *getenv();
-#endif
-#endif
+# endif
+# endif
+# endif /* ndef SFX */
+
+# if !defined( SFX) || defined( DIAG_SFX)
/********************************/
/* Function show_version_info() */
Info(slide, 0, ((char *)slide, "%d\n",
(UZ_MAJORVER*100 + UZ_MINORVER*10 + UZ_PATCHLEVEL)));
else {
-#ifndef _WIN32_WCE /* Win CE does not support environment variables */
- char *envptr;
-#endif
int numopts = 0;
+# ifndef SFX
Info(slide, 0, ((char *)slide, LoadFarString(UnzipUsageLine1v),
UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
LoadFarStringSmall(VersionDate)));
Info(slide, 0, ((char *)slide,
LoadFarString(UnzipUsageLine2v)));
version(__G);
+# endif /* ndef SFX */
+
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptions)));
-#ifdef ACORN_FTYPE_NFS
+# ifdef ACORN_FTYPE_NFS
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(AcornFtypeNFS)));
++numopts;
-#endif
-#ifdef ASM_CRC
+# endif
+# ifdef APPLE_NFRSRC_MSG
+ Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
+ LoadFarStringSmall(AppleNFRSRC)));
+ ++numopts;
+# endif /* def APPLE_NFRSRC */
+# ifdef APPLE_XATTR
+ Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
+ LoadFarStringSmall(AppleXATTR)));
+ ++numopts;
+# endif /* def APPLE_XATTR */
+# ifdef ASM_CRC
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(AsmCRC)));
++numopts;
-#endif
-#ifdef ASM_INFLATECODES
+# endif
+# ifdef ASM_INFLATECODES
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(AsmInflateCodes)));
++numopts;
-#endif
-#ifdef CHECK_VERSIONS
+# endif
+# ifdef CHECK_VERSIONS
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Check_Versions)));
++numopts;
-#endif
-#ifdef COPYRIGHT_CLEAN
+# endif
+# ifdef COPYRIGHT_CLEAN
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Copyright_Clean)));
++numopts;
-#endif
-#ifdef DEBUG
+# endif
+# ifdef DEBUG
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(UDebug)));
++numopts;
-#endif
-#ifdef DEBUG_TIME
+# endif
+# ifdef DEBUG_TIME
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(DebugTime)));
++numopts;
-#endif
-#ifdef DLL
+# endif
+# ifdef DLL
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Dll)));
++numopts;
-#endif
-#ifdef DOSWILD
+# endif
+# ifdef DOSWILD
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(DosWild)));
++numopts;
-#endif
-#ifdef LZW_CLEAN
+# endif
+# ifdef ICONV_MAPPING
+ Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
+ LoadFarStringSmall(Iconv)));
+ ++numopts;
+# endif /* def ICONV_MAPPING */
+# ifdef IZ_HAVE_UXUIDGID
+ Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
+ LoadFarStringSmall(ux_Uid_Gid)));
+ ++numopts;
+# endif
+# ifdef LZW_CLEAN
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(LZW_Clean)));
++numopts;
-#endif
-#ifndef MORE
+# endif
+# ifndef MORE
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(No_More)));
++numopts;
-#endif
-#ifdef NO_ZIPINFO
+# endif
+# ifdef NO_ZIPINFO
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(No_ZipInfo)));
++numopts;
-#endif
-#ifdef NTSD_EAS
+# endif
+# ifdef NTSD_EAS
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(NTSDExtAttrib)));
++numopts;
-#endif
-#if defined(WIN32) && defined(NO_W32TIMES_IZFIX)
+# endif
+# if defined(WIN32) && defined(NO_W32TIMES_IZFIX)
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(W32NoIZTimeFix)));
++numopts;
-#endif
-#ifdef OLD_THEOS_EXTRA
+# endif
+# ifdef OLD_THEOS_EXTRA
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(OldTheosExtra)));
++numopts;
-#endif
-#ifdef OS2_EAS
+# endif
+# ifdef OS2_EAS
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(OS2ExtAttrib)));
++numopts;
-#endif
-#ifdef QLZIP
+# endif
+# ifdef QLZIP
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(SMSExFldOnUnix)));
++numopts;
-#endif
-#ifdef REENTRANT
+# endif
+# ifdef REENTRANT
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Reentrant)));
++numopts;
-#endif
-#ifdef REGARGS
+# endif
+# ifdef REGARGS
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(RegArgs)));
++numopts;
-#endif
-#ifdef RETURN_CODES
+# endif
+# ifdef RETURN_CODES
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Return_Codes)));
++numopts;
-#endif
-#ifdef SET_DIR_ATTRIB
+# endif
+# ifdef SET_DIR_ATTRIB
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(SetDirAttrib)));
++numopts;
-#endif
-#ifdef SYMLINKS
+# endif
+# ifdef SYMLINKS
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(SymLinkSupport)));
++numopts;
-#endif
-#ifdef TIMESTAMP
+# endif
+# ifdef TIMESTAMP
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(TimeStamp)));
++numopts;
-#endif
-#ifdef UNIXBACKUP
+# endif
+# ifdef UNIXBACKUP
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(UnixBackup)));
++numopts;
-#endif
-#ifdef USE_EF_UT_TIME
+# endif
+# ifdef USE_EF_UT_TIME
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Use_EF_UT_time)));
++numopts;
-#endif
-#ifndef COPYRIGHT_CLEAN
+# endif
+# ifndef COPYRIGHT_CLEAN
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Use_Smith_Code)));
++numopts;
-#endif
-#ifndef LZW_CLEAN
+# endif
+# ifndef LZW_CLEAN
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
- LoadFarStringSmall(Use_Unshrink)));
+ LoadFarStringSmall(Unshrink_Sup)));
++numopts;
-#endif
-#ifdef USE_DEFLATE64
+# endif
+# ifdef DEFLATE64_SUPPORT
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
- LoadFarStringSmall(Use_Deflate64)));
+ LoadFarStringSmall(Deflate64_Sup)));
++numopts;
-#endif
-#ifdef UNICODE_SUPPORT
-# ifdef UTF8_MAYBE_NATIVE
- sprintf((char *)(slide+256), LoadFarStringSmall(Use_Unicode),
+# endif /* def DEFLATE64_SUPPORT */
+# ifdef UNICODE_SUPPORT
+# ifdef UTF8_MAYBE_NATIVE
+ sprintf((char *)(slide+256), LoadFarStringSmall(Unicode_Sup),
LoadFarStringSmall2(G.native_is_utf8 ? SysChUTF8 : SysChOther));
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
(char *)(slide+256)));
-# else
+# else
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
- LoadFarStringSmall(Use_Unicode)));
-# endif
+ LoadFarStringSmall(Unicode_Sup)));
+# endif
+ ++numopts;
+# endif
+# ifdef WIN32_WIDE
+ Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
+ LoadFarStringSmall(Win32_Wide_Sup)));
++numopts;
-#endif
-#ifdef _MBCS
+# endif
+# ifdef _MBCS
sprintf((char *)(slide+256), LoadFarStringSmall(Have_MBCS_Support),
(unsigned int)MB_CUR_MAX);
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
(char *)(slide+256)));
++numopts;
-#endif
-#ifdef MULT_VOLUME
+# endif
+# ifdef MULT_VOLUME
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
- LoadFarStringSmall(Use_MultiVol)));
+ LoadFarStringSmall(MultiVol_Sup)));
++numopts;
-#endif
-#ifdef LARGE_FILE_SUPPORT
+# endif
+# ifdef LARGE_FILE_SUPPORT
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
- LoadFarStringSmall(Use_LFS)));
+ LoadFarStringSmall(LFS_Sup)));
++numopts;
-#endif
-#ifdef ZIP64_SUPPORT
+# endif
+# ifdef ZIP64_SUPPORT
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
- LoadFarStringSmall(Use_Zip64)));
+ LoadFarStringSmall(Zip64_Sup)));
++numopts;
-#endif
-#if (defined(__DJGPP__) && (__DJGPP__ >= 2))
-# ifdef USE_DJGPP_ENV
+# endif
+# if (defined(__DJGPP__) && (__DJGPP__ >= 2))
+# ifdef USE_DJGPP_ENV
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Use_DJGPP_Env)));
++numopts;
-# endif
-# ifdef USE_DJGPP_GLOB
+# endif
+# ifdef USE_DJGPP_GLOB
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Use_DJGPP_Glob)));
++numopts;
-# endif
-#endif /* __DJGPP__ && (__DJGPP__ >= 2) */
-#ifdef USE_VFAT
+# endif
+# endif /* __DJGPP__ && (__DJGPP__ >= 2) */
+# ifdef USE_VFAT
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(Use_VFAT_support)));
++numopts;
-#endif
-#ifdef USE_ZLIB
+# endif
+# ifdef USE_ZLIB
sprintf((char *)(slide+256), LoadFarStringSmall(UseZlib),
ZLIB_VERSION, zlibVersion());
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
(char *)(slide+256)));
++numopts;
-#endif
-#ifdef USE_BZIP2
- sprintf((char *)(slide+256), LoadFarStringSmall(UseBZip2),
+# endif
+# ifdef BZIP2_SUPPORT
+ sprintf((char *)(slide+256), LoadFarStringSmall(BZip2_Sup),
BZ2_bzlibVersion());
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
(char *)(slide+256)));
++numopts;
-#endif
-#ifdef VMS_TEXT_CONV
+# endif /* def BZIP2_SUPPORT */
+# ifdef LZMA_SUPPORT
+ sprintf((char *)(slide+256), LoadFarStringSmall(LZMA_Sup),
+ MY_VERSION);
+ Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
+ (char *)(slide+256)));
+ ++numopts;
+# endif /* def LZMA_SUPPORT */
+# ifdef PPMD_SUPPORT
+ sprintf((char *)(slide+256), LoadFarStringSmall(PPMD_Sup),
+ MY_VERSION);
+ Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
+ (char *)(slide+256)));
+ ++numopts;
+# endif /* def PPMD_SUPPORT */
+# ifdef VMS_TEXT_CONV
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(VmsTextConv)));
++numopts;
-#endif
-#ifdef VMSCLI
+# endif
+# ifdef VMSCLI
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(VmsCLI)));
++numopts;
-#endif
-#ifdef VMSWILD
+# endif
+# ifdef VMSWILD
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(VmsWild)));
++numopts;
-#endif
-#ifdef WILD_STOP_AT_DIR
+# endif
+# ifdef WILD_STOP_AT_DIR
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(WildStopAtDir)));
++numopts;
-#endif
-#if CRYPT
-# ifdef PASSWD_FROM_STDIN
+# endif
+# ifdef IZ_CRYPT_ANY
+# ifdef PASSWD_FROM_STDIN
Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat),
LoadFarStringSmall(PasswdStdin)));
-# endif
+ ++numopts;
+# endif /* def IZ_CRYPT_ANY */
+# ifdef IZ_CRYPT_TRAD
Info(slide, 0, ((char *)slide, LoadFarString(Decryption),
- CR_MAJORVER, CR_MINORVER, CR_BETA_VER,
- LoadFarStringSmall(CryptDate)));
+ CR_MAJORVER, CR_MINORVER, CR_BETA_VER));
+ ++numopts;
+# endif /* def IZ_CRYPT_TRAD */
+# ifdef IZ_CRYPT_AES_WG
+ Info(slide, 0, ((char *)slide, LoadFarStringSmall(AesWgDecryption),
+ IZ_AES_WG_MAJORVER, IZ_AES_WG_MINORVER, IZ_AES_WG_BETA_VER));
++numopts;
-#endif /* CRYPT */
+# endif /* def IZ_CRYPT_AES_WG */
+# endif /* def IZ_CRYPT_ANY */
if (numopts == 0)
Info(slide, 0, ((char *)slide,
LoadFarString(CompileOptFormat),
LoadFarStringSmall(None)));
-#ifndef _WIN32_WCE /* Win CE does not support environment variables */
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptions)));
- envptr = getenv(LoadFarStringSmall(EnvUnZip));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvUnZip),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
- envptr = getenv(LoadFarStringSmall(EnvUnZip2));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvUnZip2),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
- envptr = getenv(LoadFarStringSmall(EnvZipInfo));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvZipInfo),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
- envptr = getenv(LoadFarStringSmall(EnvZipInfo2));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvZipInfo2),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
-#ifndef __RSXNT__
-#ifdef __EMX__
- envptr = getenv(LoadFarStringSmall(EnvEMX));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvEMX),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
- envptr = getenv(LoadFarStringSmall(EnvEMXOPT));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvEMXOPT),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
-#endif /* __EMX__ */
-#if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2)))
- envptr = getenv(LoadFarStringSmall(EnvGO32));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvGO32),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
- envptr = getenv(LoadFarStringSmall(EnvGO32TMP));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvGO32TMP),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
-#endif /* __GO32__ && !(__DJGPP__ >= 2) */
-#endif /* !__RSXNT__ */
-#ifdef RISCOS
- envptr = getenv(LoadFarStringSmall(EnvUnZipExts));
- Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat),
- LoadFarStringSmall(EnvUnZipExts),
- (envptr == (char *)NULL || *envptr == 0)?
- LoadFarStringSmall2(None) : envptr));
-#endif /* RISCOS */
-#endif /* !_WIN32_WCE */
+# ifdef IZ_CRYPT_TRAD
+ Info(slide, 0, ((char *)slide,
+ LoadFarString(TraditionalEncryptionNotice1)));
+ Info(slide, 0, ((char *)slide,
+ LoadFarString(TraditionalEncryptionNotice2)));
+# endif /* def IZ_CRYPT_TRAD */
+
+# ifdef IZ_CRYPT_AES_WG
+ Info(slide, 0, ((char *)slide,
+ LoadFarString(AesWgEncryptionNotice1)));
+ Info(slide, 0, ((char *)slide,
+ LoadFarString(AesWgEncryptionNotice2)));
+# endif /* def IZ_CRYPT_AES_WG */
+
+# ifndef _WIN32_WCE /* Win CE does not support environment variables */
+ show_env( __G__ 0);
+# endif /* !_WIN32_WCE */
}
} /* end function show_version() */
-#endif /* !SFX */
-#endif /* !WINDLL */
+# endif /* !defined( SFX) || defined( DIAG_SFX) */
+#endif /* ndef WINDLL_OLD */
+
+
+
+
+
+
+/*---------------------------------------------------------------
+ * Long option support
+ * 8/23/2003
+ * Updated 3/1/2008 to support UnZip
+ *
+ * Defines function get_option() to get and process the command
+ * line options and arguments from argv[]. The caller calls
+ * get_option() in a loop to get either one option and possible
+ * value or a non-option argument each loop.
+ *
+ * This version has been modified to work with UnZip and ZipInfo.
+ * the major changes are removing the error returns, instead
+ * passing back error codes for errors, and supporting separate
+ * groups of options for UnZip and ZipInfo and selecting the option
+ * group by an argument.
+ *
+ * This version does not include argument file support and can
+ * work directly on argv. The argument file code complicates things and
+ * it seemed best to leave it out for now. If argument file support
+ * (reading in command line arguments stored in a file and inserting into
+ * command line where @filename is found) is added later the arguments
+ * can change and a freeable copy of argv will be needed and can be
+ * created using copy_args in the left out code.
+ *
+ * Supports short and long options as defined in the array options[]
+ * in zip.c, multiple short options in an argument (like -jlv), long
+ * option abbreviation (like --te for --temp-file if --te unique),
+ * short and long option values (like -b filename or --temp-file filename
+ * or --temp-file=filename), optional and required values, option negation
+ * by trailing - (like -S- to not include hidden and system files in MSDOS),
+ * value lists (like -x a b c), argument permuting (returning all options
+ * and values before any non-option arguments), and argument files (where
+ * any non-option non-value argument in form @path gets substituted with
+ * the white space separated arguments in the text file at path). In this
+ * version argument file support has been removed to simplify development
+ * but may be added later.
+ *
+ * E. Gordon
+ */
+
+
+/* message output - char casts are needed to handle constants */
+#define oERR(err, message) Info(slide, 0x401, ((char *)slide, (char *)message))
+#define oWARN(message) Info(slide, 0x401, ((char *)slide, (char *)message))
+
+
+
+/* Although the below provides some support for multibyte characters
+ the proper thing to do may be to use wide characters and support
+ Unicode. May get to it soon. Wide support would likely require
+ the ability to convert the command line to wide strings, which most
+ modern OS should support now. EG
+ */
+
+/* For now stay with multi-byte characters. May support wide characters
+ in Zip 3.1 and UnZip 6.10.
+ */
+
+/* multibyte character set support
+ Multibyte characters use typically two or more sequential bytes
+ to represent additional characters than can fit in a single byte
+ character set. The code used here is based on the ANSI mblen function. */
+#define MB_CLEN(ptr) CLEN(ptr)
+#define MB_NEXTCHAR(ptr) PREINCSTR(ptr)
+
+
+/* constants */
+
+/* function get_args_from_arg_file() can return this in depth parameter */
+#define ARG_FILE_ERR -1
+
+/* Symbolic values for optchar. */
+#define SKIP_VALUE_ARG -1
+#define SKIP_VALUE_ARG2 -2 /* 2012-03-08 SMS. */
+#define THIS_ARG_DONE -3
+#define START_VALUE_LIST -4
+#define IN_VALUE_LIST -5
+#define NON_OPTION_ARG -6
+#define STOP_VALUE_LIST -7
+#define READ_REST_ARGS_VERBATIM -8 /* 7/25/04 EG */
+
+
+/* global veriables */
+
+int enable_permute = 1; /* yes - return options first */
+/* 7/25/04 EG */
+int doubledash_ends_options = 1; /* when -- what follows are not options */
+
+/* buffer for error messages (this sizing is a guess but must hold 2 paths) */
+#define OPTIONERR_BUF_SIZE (80+ 2* PATH_MAX)
+char optionerrbuf[OPTIONERR_BUF_SIZE + 1];
+
+/* error messages */
+static ZCONST char Far op_not_neg_err[] =
+ "option %s not negatable\n";
+static ZCONST char Far op_req_val_err[] =
+ "option %s requires a value\n";
+static ZCONST char Far op_no_allow_val_err[] =
+ "option %s does not allow a value\n";
+static ZCONST char Far sh_op_not_sup_err[] =
+ "short option '%c' not supported\n";
+static ZCONST char Far oco_req_val_err[] =
+ "option %s requires one character value\n";
+static ZCONST char Far oco_no_mbc_err[] =
+ "option %s does not support multibyte values\n";
+static ZCONST char Far num_req_val_err[] =
+ "option %s requires number value\n";
+static ZCONST char Far long_op_ambig_err[] =
+ "long option '%s' ambiguous\n";
+static ZCONST char Far long_op_not_sup_err[] =
+ "long option '%s' not supported\n";
+
+static ZCONST char Far no_arg_files_err[] = "argument files not enabled\n";
+
+
+/* below removed as only used for processing argument files */
+
+/* get_nextarg */
+/* get_args_from_string */
+/* get_args_from_arg_file */
+
+
+/* copy error, option name, and option description if any to buf */
+static int optionerr(options, buf, err, optind, islong)
+ struct option_struct *options;
+ char *buf;
+ ZCONST char Far *err;
+ int optind;
+ int islong;
+{
+ char optname[50];
+
+ if (options[optind].name && options[optind].name[0] != '\0') {
+ sprintf(optname, "'%s' (%s)",
+ LoadFarStringSmall2(islong ? options[optind].longopt
+ : options[optind].shortopt),
+ LoadFarStringSmall(options[optind].name));
+ } else {
+ sprintf(optname, "'%s'",
+ LoadFarStringSmall2(islong ? options[optind].longopt
+ : options[optind].shortopt));
+ }
+ sprintf(buf, LoadFarStringSmall(err), optname);
+ return 0;
+}
+
+
+/* copy_args
+ *
+ * Copy arguments in args, allocating storage with malloc.
+ * Copies until a NULL argument is found or until max_args args
+ * including args[0] are copied. Set max_args to 0 to copy
+ * until NULL. Always terminates returned args[] with NULL arg.
+ *
+ * Any argument in the returned args can be freed with free(). Any
+ * freed argument should be replaced with either another string
+ * allocated with malloc or by NULL if last argument so that free_args
+ * will properly work.
+ */
+char **copy_args(__G__ args, max_args)
+ __GDEF
+ char **args;
+ int max_args;
+{
+ int j;
+ char **new_args;
+
+ if (args == NULL) {
+ return NULL;
+ }
+
+ /* Count non-NULL args. Stop at max_args, if not zero. */
+ for (j = 0; args[ j] && (max_args == 0 || j < max_args); j++);
+ max_args = j;
+
+ if ((new_args = (char **) izu_malloc(
+ (max_args + 1) * sizeof(char *))) == NULL)
+ {
+ oWARN("memory - ca.1");
+ return NULL;
+ }
+
+ /* Transfer (non-NULL) original args[] to new_args[]. */
+ for (j = 0; j < max_args; j++)
+ {
+ if ((new_args[ j] = izu_malloc( strlen( args[ j])+ 1)) == NULL)
+ {
+ free_args( new_args);
+ oWARN("memory - ca.2");
+ return NULL;
+ }
+ strcpy( new_args[ j], args[ j]);
+ }
+
+ /* NULL_terminate new_args[]. */
+ new_args[ max_args] = NULL;
+
+ return new_args;
+}
+
+
+/* count args - count args in argv like array */
+int arg_count(__G__ args)
+ __GDEF
+ char **args;
+{
+ int i;
+
+ if (args == NULL) {
+ return 0;
+ }
+
+ for (i = 0; args[i]; i++) {
+ }
+ return i;
+}
+
+
+/* free args - free args created with one of these functions */
+int free_args( args)
+ char **args;
+{
+ int i;
+
+ if (args == NULL) {
+ return 0;
+ }
+
+ for (i = 0; args[i]; i++) {
+ izu_free(args[i]);
+ }
+ izu_free(args);
+ return i;
+}
+
+
+/* insert_arg
+ *
+ * Insert the argument arg into the array *pargs before argument at_arg.
+ * If at_arg = -1 then append to end.
+ * Return the new count of arguments (argc).
+ *
+ * If free_args is true, this function frees the old args array
+ * (but not the component strings). DO NOT set free_args on original
+ * argv but only on args allocated with malloc.
+ */
+
+int insert_arg(__G__ pargs, arg, at_arg, free_args)
+ __GDEF
+ char ***pargs;
+ ZCONST char *arg;
+ int at_arg;
+ int free_args;
+{
+ char *newarg = NULL;
+ char **args;
+ char **newargs = NULL;
+ int argnum;
+ int newargnum;
+ int argcnt;
+ int newargcnt;
+
+ if (pargs == NULL) {
+ return 0;
+ }
+ args = *pargs;
+
+ /* count args */
+ if (args == NULL) {
+ argcnt = 0;
+ } else {
+ for (argcnt = 0; args[argcnt]; argcnt++) ;
+ }
+ if (arg == NULL) {
+ /* done */
+ return argcnt;
+ }
+ if (at_arg == -1) {
+ at_arg = argcnt;
+ }
+ newargcnt = argcnt + 1;
+
+ /* get storage for new args */
+ if ((newargs = (char **) izu_malloc(
+ (newargcnt + 1) * sizeof(char *))) == NULL)
+ {
+ oWARN("memory - ia.1");
+ return 0;
+ }
+
+ /* copy argument pointers from args to position at_arg, copy the new arg,
+ then copy the rest of the args */
+ argnum = 0;
+ newargnum = 0;
+ if (args) {
+ for (; args[argnum] && argnum < at_arg; argnum++) {
+ newargs[newargnum++] = args[argnum];
+ }
+ }
+ /* copy new arg */
+ if ((newarg = (char *) izu_malloc(strlen(arg) + 1)) == NULL) {
+ oWARN("memory - ia.2");
+ return 0;
+ }
+ strcpy(newarg, arg);
+
+ newargs[newargnum++] = newarg;
+ if (args) {
+ for ( ; args[argnum]; argnum++) {
+ newargs[newargnum++] = args[argnum];
+ }
+ }
+ newargs[newargnum] = NULL;
+
+ /* free old args array but not component strings - this assumes that
+ * args was allocated with malloc as copy_args does. DO NOT DO THIS
+ * on the original argv.
+ */
+ if (free_args)
+ izu_free(args);
+
+ *pargs = newargs;
+
+ return newargnum;
+}
+
+/* ------------------------------------- */
+
+/* get_shortopt
+ *
+ * Get next short option from arg. The state is stored in argnum, optchar, and
+ * option_num so no static storage is used. Returns the option_ID.
+ *
+ * parameters:
+ * option_group - either UZO for UnZip options or ZIO for ZipInfo options
+ * args - argv array of arguments
+ * argnum - index of current arg in args
+ * optchar - pointer to index of next char to process. Can be 0 or
+ * const defined at top of this file like THIS_ARG_DONE
+ * negated - on return pointer to int set to 1 if option negated
+ * or 0 otherwise
+ * value - on return pointer to string set to value of option if any
+ * or NULL if none. If value is returned then the caller
+ * should free() it when not needed anymore.
+ * option_num - pointer to index in options[] of returned option or
+ * o_NO_OPTION_MATCH if none. Do not change as used by
+ * value lists.
+ * depth - recursion depth (0 at top level, 1 or more in arg files)
+ */
+static unsigned long get_shortopt(__G__ option_group, args, argnum, optchar,
+ negated, value, option_num, depth)
+ __GDEF
+ int option_group;
+ ZCONST char **args;
+ int argnum;
+ int *optchar;
+ int *negated;
+ char **value;
+ int *option_num;
+ int depth;
+{
+ ZCONST char *shortopt;
+ int clen;
+ ZCONST char *nextchar;
+ ZCONST char *s;
+ ZCONST char *start;
+ int op;
+ ZCONST char *arg;
+ int match = -1;
+
+
+ /* get arg */
+ arg = args[argnum];
+ /* current char in arg */
+ nextchar = arg + (*optchar);
+ clen = MB_CLEN(nextchar);
+ /* next char in arg */
+ (*optchar) += clen;
+ /* get first char of short option */
+ shortopt = arg + (*optchar);
+ /* no value */
+ *value = NULL;
+
+ if (*shortopt == '\0') {
+ /* no more options in arg */
+ *optchar = 0;
+ *option_num = o_NO_OPTION_MATCH;
+ return 0;
+ }
+
+ /* look for match in options */
+ clen = MB_CLEN(shortopt);
+ for (op = 0; options[op].option_ID; op++) {
+ /* Only look at options in this option group */
+ if (options[op].option_group == option_group) {
+ s = options[op].shortopt;
+ if (s && s[0] == shortopt[0]) {
+ if (s[1] == '\0' && clen == 1) {
+ /* single char match */
+ match = op;
+ } else {
+ /* 2 wide short opt. Could support more chars but should use long opts instead */
+ if (s[1] == shortopt[1]) {
+ /* match 2 char short opt or 2 byte char */
+ match = op;
+ if (clen == 1) (*optchar)++;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (match > -1) {
+ /* match */
+ clen = MB_CLEN(shortopt);
+ nextchar = arg + (*optchar) + clen;
+ /* check for trailing dash negating option */
+ if (*nextchar == '-') {
+ /* negated */
+ if (options[match].negatable == o_NOT_NEGATABLE) {
+ if (options[match].value_type == o_NO_VALUE) {
+ optionerr(options, optionerrbuf, op_not_neg_err, match, 0);
+ if (depth > 0) {
+ /* unwind */
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ } else {
+ *negated = 1;
+ /* set up to skip negating dash */
+ (*optchar) += clen;
+ clen = 1;
+ }
+ }
+
+ /* value */
+ clen = MB_CLEN(arg + (*optchar));
+ /* optional value, one char value, and number value must follow option */
+ if (options[match].value_type == o_ONE_CHAR_VALUE) {
+ /* one char value */
+ if (arg[(*optchar) + clen]) {
+ /* has value */
+ if (MB_CLEN(arg + (*optchar) + clen) > 1) {
+ /* multibyte value not allowed for now */
+ optionerr(options, optionerrbuf, oco_no_mbc_err, match, 0);
+ if (depth > 0) {
+ /* unwind */
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ if ((*value = (char *) izu_malloc(2)) == NULL) {
+ oWARN("memory - gso.1");
+ return o_BAD_ERR;
+ }
+ (*value)[0] = *(arg + (*optchar) + clen);
+ (*value)[1] = '\0';
+ *optchar += clen;
+ clen = 1;
+ } else {
+ /* one char values require a value */
+ optionerr(options, optionerrbuf, oco_req_val_err, match, 0);
+ if (depth > 0) {
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ } else if (options[match].value_type == o_NUMBER_VALUE) {
+ /* read chars until end of number */
+ start = arg + (*optchar) + clen;
+ if (*start == '+' || *start == '-') {
+ start++;
+ }
+ s = start;
+ for (; isdigit(*s); MB_NEXTCHAR(s)) ;
+ if (s == start) {
+ /* no digits */
+ optionerr(options, optionerrbuf, num_req_val_err, match, 0);
+ if (depth > 0) {
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ start = arg + (*optchar) + clen;
+ if ((*value = (char *) izu_malloc((int)(s - start) + 1)) == NULL) {
+ oWARN("memory - gso.2");
+ return o_BAD_ERR;
+ }
+ *optchar += (int)(s - start);
+ strncpy(*value, start, (int)(s - start));
+ (*value)[(int)(s - start)] = '\0';
+ clen = MB_CLEN(s);
+ } else if (options[match].value_type == o_OPTIONAL_VALUE) {
+ /* optional value */
+ /* This seemed inconsistent so now if no value attached to argument look
+ to the next argument if that argument is not an option for option
+ value - 11/12/04 EG */
+ if (arg[(*optchar) + clen]) {
+ /* has value */
+ /* add support for optional = - 2/6/05 EG */
+ if (arg[(*optchar) + clen] == '=') {
+ /* skip = */
+ clen++;
+ }
+ if (arg[(*optchar) + clen]) {
+ if ((*value = (char *)izu_malloc(
+ strlen(arg + (*optchar) + clen) + 1)) == NULL) {
+ oWARN("memory - gso.3");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, arg + (*optchar) + clen);
+ }
+ *optchar = THIS_ARG_DONE;
+ } else if (args[argnum + 1] && args[argnum + 1][0] != '-') {
+ /* use next arg for value */
+ if ((*value = (char *)izu_malloc(
+ strlen(args[argnum + 1]) + 1)) == NULL) {
+ oWARN("memory - gso.4");
+ return o_BAD_ERR;
+ }
+ /* using next arg as value */
+ strcpy(*value, args[argnum + 1]);
+ *optchar = SKIP_VALUE_ARG;
+ }
+ } else if (options[match].value_type == o_OPT_EQ_VALUE) {
+ /* Optional value, but "=" required with detached value. */
+ int have_eq = 0;
+
+ if (arg[(*optchar) + clen]) {
+ /* "-optXXXX". May have attached value. */
+ if (arg[(*optchar) + clen] == '=') {
+ /* Skip '=' (but remember it). */
+ clen++;
+ have_eq = 1;
+ }
+ if (arg[(*optchar) + clen]) {
+ /* "-opt{=|X}XXX". Have more chars. Attached value? */
+ if (have_eq) {
+ /* "-opt=value". Have attached value. */
+ if ((*value = (char *)izu_malloc(
+ strlen(arg + (*optchar) + clen) + 1)) == NULL) {
+ oERR(ZE_MEM, "gso.5");
+ }
+ strcpy(*value, arg + (*optchar) + clen);
+ *optchar = THIS_ARG_DONE;
+ }
+ /* else
+ * "-opt{^=}XXX". Have more chars, but no attached value.
+ * Should be more short options.
+ */
+ }
+ else if (have_eq && args[argnum + 1] && args[argnum + 1][0] != '-') {
+ /* "-opt= value". Have detached value. */
+ if ((*value = (char *)izu_malloc(
+ strlen(args[argnum + 2])+ 1)) == NULL) {
+ oWARN("memory - gso.6");
+ return o_BAD_ERR;
+ }
+ /* Set value. Skip value arg. */
+ strcpy(*value, args[argnum + 1]);
+ *optchar = SKIP_VALUE_ARG;
+ } else {
+ /* "-opt[=] -opt". No "=" or no (non-option) value specified. */
+ *optchar = THIS_ARG_DONE;
+ }
+ } else if (args[argnum + 1] && (strcmp( args[argnum + 1], "=") == 0)) {
+ /* "-opt = ". Loose "=" token. Look for detached value. */
+ if (args[argnum + 2] && args[argnum + 2][0] != '-') {
+ /* "-opt = value". Have detached value. */
+ if ((*value = (char *)izu_malloc(
+ strlen(args[argnum + 2])+ 1)) == NULL) {
+ oWARN("memory - gso.7");
+ return o_BAD_ERR;
+ }
+ /* Set value. Skip "=" and value args. */
+ strcpy(*value, args[argnum + 2]);
+ *optchar = SKIP_VALUE_ARG2;
+ } else {
+ /* "-opt =", but no (non-option) value. Skip "=" arg. */
+ *optchar = SKIP_VALUE_ARG;
+ }
+ } else if (args[argnum + 1] && args[argnum + 1][0] == '=') {
+ /* "-opt =[XXXX]". Have detached "=value". Skip '='. */
+ if ((*value = (char *)izu_malloc(strlen(args[argnum + 1]))) == NULL)
+ {
+ oWARN("memory - gso.8");
+ return o_BAD_ERR;
+ }
+ /* Using next arg (less '=') as value. */
+ strcpy(*value, args[argnum + 1]+ 1);
+ *optchar = SKIP_VALUE_ARG;
+ } else {
+ /* No "=", therefore no value. */
+ *optchar = THIS_ARG_DONE;
+ }
+ } else if (options[match].value_type == o_REQUIRED_VALUE ||
+ options[match].value_type == o_VALUE_LIST) {
+ /* see if follows option */
+ if (arg[(*optchar) + clen]) {
+ /* has value following option as -ovalue */
+ /* add support for optional = - 6/5/05 EG */
+ if (arg[(*optchar) + clen] == '=') {
+ /* skip = */
+ clen++;
+ }
+ if ((*value = (char *)izu_malloc(strlen(arg + (*optchar) + clen) + 1))
+ == NULL) {
+ oWARN("memory - gso.9");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, arg + (*optchar) + clen);
+ *optchar = THIS_ARG_DONE;
+ } else {
+ /* use next arg for value */
+ if (args[argnum + 1]) {
+ if ((*value = (char *)izu_malloc(strlen(args[argnum + 1]) + 1))
+ == NULL) {
+ oWARN("memory - gso.10");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, args[argnum + 1]);
+ if (options[match].value_type == o_VALUE_LIST) {
+ *optchar = START_VALUE_LIST;
+ } else {
+ *optchar = SKIP_VALUE_ARG;
+ }
+ } else {
+ /* no value found */
+ optionerr(options, optionerrbuf, op_req_val_err, match, 0);
+ if (depth > 0) {
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ }
+ }
+
+ *option_num = match;
+ return options[match].option_ID;
+ }
+ sprintf(optionerrbuf, LoadFarStringSmall(sh_op_not_sup_err), *shortopt);
+ if (depth > 0) {
+ /* unwind */
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+}
+
+
+/* get_longopt
+ *
+ * Get the long option in args array at argnum.
+ * Parameters same as for get_shortopt.
+ */
+
+static unsigned long get_longopt(__G__ option_group, args, argnum, optchar,
+ negated, value, option_num, depth)
+ __GDEF
+ int option_group;
+ ZCONST char **args;
+ int argnum;
+ int *optchar;
+ int *negated;
+ char **value;
+ int *option_num;
+ int depth;
+{
+ char *longopt;
+ char *lastchr;
+ char *valuestart;
+ int op;
+ char *arg;
+ int match = -1;
+ *value = NULL;
+
+ if (args == NULL) {
+ *option_num = o_NO_OPTION_MATCH;
+ return 0;
+ }
+ if (args[argnum] == NULL) {
+ *option_num = o_NO_OPTION_MATCH;
+ return 0;
+ }
+ /* copy arg so can chop end if value */
+ if ((arg = (char *)izu_malloc(strlen(args[argnum]) + 1)) == NULL) {
+ oWARN("memory - glo-.1");
+ return o_BAD_ERR;
+ }
+ strcpy(arg, args[argnum]);
+
+ /* get option */
+ longopt = arg + 2;
+ /* no value */
+ *value = NULL;
+
+ /* find = */
+ for (lastchr = longopt, valuestart = longopt;
+ *valuestart && *valuestart != '=';
+ lastchr = valuestart, MB_NEXTCHAR(valuestart)) ;
+ if (*valuestart) {
+ /* found =value */
+ *valuestart = '\0';
+ valuestart++;
+ } else {
+ valuestart = NULL;
+ }
+
+ if (*lastchr == '-') {
+ /* option negated */
+ *negated = 1;
+ *lastchr = '\0';
+ } else {
+ *negated = 0;
+ }
+
+ /* look for long option match */
+ for (op = 0; options[op].option_ID; op++) {
+ /* Only look at options in the option group */
+ if (options[op].option_group == option_group) {
+ if (options[op].longopt &&
+ strcmp(LoadFarStringSmall(options[op].longopt), longopt) == 0) {
+ /* exact match */
+ match = op;
+ break;
+ }
+ if (options[op].longopt &&
+ strncmp(LoadFarStringSmall(options[op].longopt),
+ longopt, strlen(longopt)) == 0) {
+ if (match > -1) {
+ sprintf(optionerrbuf, LoadFarStringSmall(long_op_ambig_err),
+ longopt);
+ izu_free(arg);
+ if (depth > 0) {
+ /* unwind */
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ match = op;
+ }
+ }
+ }
+
+ if (match == -1) {
+ sprintf(optionerrbuf, LoadFarStringSmall(long_op_not_sup_err), longopt);
+ izu_free(arg);
+ if (depth > 0) {
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+
+ /* one long option an arg */
+ *optchar = THIS_ARG_DONE;
+
+ /* if negated then see if allowed */
+ if (*negated && options[match].negatable == o_NOT_NEGATABLE) {
+ optionerr(options, optionerrbuf, op_not_neg_err, match, 1);
+ izu_free(arg);
+ if (depth > 0) {
+ /* unwind */
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ /* get value */
+ if (options[match].value_type == o_OPT_EQ_VALUE) {
+ /* Optional value, but "=" required with detached value. */
+ if (valuestart == NULL) {
+ /* "--opt ="? */
+ if (args[ argnum+ 1] != NULL) {
+ /* Next arg exists. */
+ if (*args[ argnum+ 1] == '=') {
+ /* Next arg is "=" or "=val". */
+ if (*(args[ ++argnum]+ 1) == '\0') {
+ /* No attached value. Use next arg, if any. */
+ if (args[ argnum+ 1] != NULL) {
+ valuestart = (char *)args[ ++argnum];
+ *optchar = SKIP_VALUE_ARG2;
+ }
+ } else {
+ /* "=val". */
+ valuestart = (char *)args[ argnum]+ 1;
+ *optchar = SKIP_VALUE_ARG;
+ }
+ }
+ }
+ } else if (*valuestart == '\0') {
+ /* "--opt= val"? */
+ if (args[ argnum+ 1] != NULL) {
+ valuestart = (char *)args[ ++argnum];
+ *optchar = SKIP_VALUE_ARG;
+ }
+ }
+ if (valuestart) {
+ /* A value was specified somehow. Save it. */
+ if ((*value = (char *)izu_malloc(strlen(valuestart) + 1)) == NULL) {
+ izu_free(arg);
+ oWARN("memory - glo.2");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, valuestart);
+ }
+ } else if (options[match].value_type == o_OPTIONAL_VALUE) {
+ /* optional value in form option=value */
+ if (valuestart) {
+ /* option=value */
+ if ((*value = (char *)izu_malloc(strlen(valuestart) + 1)) == NULL) {
+ izu_free(arg);
+ oWARN("memory - glo.3");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, valuestart);
+ }
+ } else if (options[match].value_type == o_REQUIRED_VALUE ||
+ options[match].value_type == o_NUMBER_VALUE ||
+ options[match].value_type == o_ONE_CHAR_VALUE ||
+ options[match].value_type == o_VALUE_LIST) {
+ /* handle long option one char and number value as required value */
+ if (valuestart) {
+ /* option=value */
+ if ((*value = (char *)izu_malloc(strlen(valuestart) + 1)) == NULL) {
+ izu_free(arg);
+ oWARN("memory - glo.4");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, valuestart);
+ } else {
+ /* use next arg */
+ if (args[argnum + 1]) {
+ if ((*value = (char *)izu_malloc(
+ strlen(args[argnum + 1]) + 1)) == NULL) {
+ izu_free(arg);
+ oWARN("memory - glo.5");
+ return o_BAD_ERR;
+ }
+ /* using next arg as value */
+ strcpy(*value, args[argnum + 1]);
+ if (options[match].value_type == o_VALUE_LIST) {
+ *optchar = START_VALUE_LIST;
+ } else {
+ *optchar = SKIP_VALUE_ARG;
+ }
+ } else {
+ /* no value found */
+ optionerr(options, optionerrbuf, op_req_val_err, match, 1);
+ izu_free(arg);
+ if (depth > 0) {
+ /* unwind */
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ }
+ } else if (options[match].value_type == o_NO_VALUE) {
+ /* this option does not accept a value */
+ if (valuestart) {
+ /* --option=value */
+ optionerr(options, optionerrbuf, op_no_allow_val_err, match, 1);
+ izu_free(arg);
+ if (depth > 0) {
+ oWARN(optionerrbuf);
+ return o_ARG_FILE_ERR;
+ } else {
+ oWARN(optionerrbuf);
+ return o_BAD_ERR;
+ }
+ }
+ }
+ izu_free(arg);
+
+ *option_num = match;
+ return options[match].option_ID;
+}
+
+
+
+/* get_option
+ *
+ * Main interface for user. Use this function to get options, values and
+ * non-option arguments from a command line provided in argv form.
+ *
+ * To use get_option() first define valid options by setting
+ * the global variable options[] to an array of option_struct. Also
+ * either change defaults below or make variables global and set elsewhere.
+ * Zip uses below defaults.
+ *
+ * Call get_option() to get an option (like -b or --temp-file) and any
+ * value for that option (like filename for -b) or a non-option argument
+ * (like archive name) each call. If *value* is not NULL after calling
+ * get_option() it is a returned value and the caller should either store
+ * the char pointer or free() it before calling get_option() again to avoid
+ * leaking memory. If a non-option non-value argument is returned get_option()
+ * returns o_NON_OPTION_ARG and value is set to the entire argument.
+ * When there are no more arguments get_option() returns 0.
+ *
+ * The parameters argnum (after set to 0 on initial call),
+ * optchar, first_nonopt_arg, option_num, and depth (after initial
+ * call) are set and maintained by get_option() and should not be
+ * changed. The parameters argc, negated, and value are outputs and
+ * can be used by the calling program. get_option() returns either the
+ * option_ID for the current option, a special value defined in
+ * zip.h, or 0 when no more arguments.
+ *
+ * The value returned by get_option() is the ID value in the options
+ * table. This value can be duplicated in the table if different
+ * options are really the same option. The index into the options[]
+ * table is given by option_num, though the ID should be used as
+ * option numbers change when the table is changed. The ID must
+ * not be 0 for any option as this ends the table. If get_option()
+ * finds an option not in the table it calls oERR to post an
+ * error and exit. Errors also result if the option requires a
+ * value that is missing, a value is present but the option does
+ * not take one, and an option is negated but is not
+ * negatable. Non-option arguments return o_NON_OPTION_ARG
+ * with the entire argument in value.
+ *
+ * For Zip and UnZip, permuting is on and all options and their values
+ * are returned before any non-option arguments like archive name.
+ *
+ * The arguments "-" alone and "--" alone return as non-option arguments.
+ * Note that "-" should not be used as part of a short option
+ * entry in the table but can be used in the middle of long
+ * options such as in the long option "a-long-option". Now "--" alone
+ * stops option processing, returning any arguments following "--" as
+ * non-option arguments instead of options.
+ *
+ * Argument file support is removed from this version. It may be added later.
+ *
+ * After each call:
+ * argc is set to the current size of args[] but should not change
+ * with argument file support removed,
+ * argnum is the index of the current arg,
+ * value is either the value of the returned option or non-option
+ * argument or NULL if option with no value,
+ * negated is set if the option was negated by a trailing dash (-)
+ * option_num is set to either the index in options[] for the option or
+ * o_NO_OPTION_MATCH if no match.
+ * Negation is checked before the value is read if the option is negatable so
+ * that the - is not included in the value. If the option is not negatable
+ * but takes a value then the - will start the value. If permuting then
+ * argnum and first_nonopt_arg are unreliable and should not be used.
+ *
+ * Command line is read from left to right. As get_option() finds non-option
+ * arguments (arguments not starting with - and that are not values to options)
+ * it moves later options and values in front of the non-option arguments.
+ * This permuting is turned off by setting enable_permute to 0. Then
+ * get_option() will return options and non-option arguments in the order
+ * found. Currently permuting is only done after an argument is completely
+ * processed so that any value can be moved with options they go with. All
+ * state information is stored in the parameters argnum, optchar,
+ * first_nonopt_arg and option_num. You should not change these after the
+ * first call to get_option(). If you need to back up to a previous arg then
+ * set argnum to that arg (remembering that args may have been permuted) and
+ * set optchar = 0 and first_nonopt_arg to the first non-option argument if
+ * permuting. After all arguments are returned the next call to get_option()
+ * returns 0. The caller can then call free_args(args) if appropriate.
+ *
+ * get_option() accepts arguments in the following forms:
+ * short options
+ * of 1 and 2 characters, e.g. a, b, cc, d, and ba, after a single
+ * leading -, as in -abccdba. In this example if 'b' is followed by 'a'
+ * it matches short option 'ba' else it is interpreted as short option
+ * b followed by another option. The character - is not legal as a
+ * short option or as part of a 2 character short option.
+ *
+ * If a short option has a value it immediately follows the option or
+ * if that option is the end of the arg then the next arg is used as
+ * the value. So if short option e has a value, it can be given as
+ * -evalue
+ * or
+ * -e value
+ * and now
+ * -e=value
+ * but now that = is optional a leading = is stripped for the first.
+ * This change allows optional short option values to be defaulted as
+ * -e=
+ * Either optional or required values can be specified. Optional values
+ * now use both forms as ignoring the later got confusing. Any
+ * non-value short options can preceed a valued short option as in
+ * -abevalue
+ * Some value types (one_char and number) allow options after the value
+ * so if oc is an option that takes a character and n takes a number
+ * then
+ * -abocVccn42evalue
+ * returns value V for oc and value 42 for n. All values are strings
+ * so programs may have to convert the "42" to a number. See long
+ * options below for how value lists are handled.
+ *
+ * Any short option can be negated by following it with -. Any - is
+ * handled and skipped over before any value is read unless the option
+ * is not negatable but takes a value and then - starts the value.
+ *
+ * If the value for an optional value is just =, then treated as no
+ * value.
+ *
+ * long options
+ * of arbitrary length are assumed if an arg starts with -- but is not
+ * exactly --. Long options are given one per arg and can be abbreviated
+ * if the abbreviation uniquely matches one of the long options.
+ * Exact matches always match before partial matches. If ambiguous an
+ * error is generated.
+ *
+ * Values are specified either in the form
+ * --longoption=value
+ * or can be the following arg if the value is required as in
+ * --longoption value
+ * Optional values to long options must be in the first form.
+ *
+ * Value lists are specified by o_VALUE_LIST and consist of an option
+ * that takes a value followed by one or more value arguments.
+ * The two forms are
+ * --option=value
+ * or
+ * -ovalue
+ * for a single value or
+ * --option value1 value2 value3 ... --option2
+ * or
+ * -o value1 value2 value3 ...
+ * for a list of values. The list ends at the next option, the
+ * end of the command line, or at a single "@" argument.
+ * Each value is treated as if it was preceeded by the option, so
+ * --option1 val1 val2
+ * with option1 value_type set to o_VALUE_LIST is the same as
+ * --option1=val1 --option1=val2
+ *
+ * Long options can be negated by following the option with - as in
+ * --longoption-
+ * Long options with values can also be negated if this makes sense for
+ * the caller as:
+ * --longoption-=value
+ * If = is not followed by anything it is treated as no value.
+ *
+ * @path
+ * Argument files support removed from this version. It may be added
+ * back later.
+ *
+ * non-option argument
+ * is any argument not given above. If enable_permute is 1 then
+ * these are returned after all options, otherwise all options and
+ * args are returned in order. Returns option ID o_NON_OPTION_ARG
+ * and sets value to the argument.
+ *
+ *
+ * Arguments to get_option:
+ * int option_group - either UZO for UnZip or ZIO for ZipInfo
+ * char ***pargs - pointer to arg array in the argv form
+ * int *argc - returns the current argc for args incl. args[0]
+ * int *argnum - the index of the current argument (caller
+ * should set = 0 on first call and not change
+ * after that)
+ * int *optchar - index of next short opt in arg or special
+ * int *first_nonopt_arg - used by get_option to permute args
+ * int *negated - option was negated (had trailing -)
+ * char *value - value of option if any (free when done with it)
+ * or NULL
+ * int *option_num - the index in options of the last option returned
+ * (can be o_NO_OPTION_MATCH)
+ * int recursion_depth - current depth of recursion
+ * (always set to 0 by caller)
+ * (always 0 with argument files support removed)
+ *
+ * Caller should only read the returned option ID and the value, negated,
+ * and option_num (if required) parameters after each call.
+ *
+ * Ed Gordon
+ * 8/24/2003 (last updated 3/1/2008 EG)
+ *
+ */
+
+unsigned long get_option(__G__ option_group, pargs, argc, argnum, optchar, value,
+ negated, first_nonopt_arg, option_num, recursion_depth)
+ __GDEF
+ int option_group;
+ char ***pargs;
+ int *argc;
+ int *argnum;
+ int *optchar;
+ char **value;
+ int *negated;
+ int *first_nonopt_arg;
+ int *option_num;
+ int recursion_depth;
+{
+ char **args;
+ unsigned long option_ID;
+
+ int argcnt;
+ int first_nonoption_arg;
+ char *arg = NULL;
+ int h;
+ int optc;
+ int argn;
+ int j;
+ int v;
+ int read_rest_args_verbatim = 0; /* 7/25/04 - ignore options and arg files for rest args */
+
+ /* caller should free value or assign it to another
+ variable before calling get_option again. */
+ *value = NULL;
+
+ /* if args is NULL then done */
+ if (pargs == NULL) {
+ *argc = 0;
+ return 0;
+ }
+ args = *pargs;
+ if (args == NULL) {
+ *argc = 0;
+ return 0;
+ }
+
+ /* count args */
+ for (argcnt = 0; args[argcnt]; argcnt++) ;
+
+ /* if no provided args then nothing to do */
+ if (argcnt < 1 || (recursion_depth == 0 && argcnt < 2)) {
+ *argc = argcnt;
+ /* return 0 to note that no args are left */
+ return 0;
+ }
+
+ *negated = 0;
+ first_nonoption_arg = *first_nonopt_arg;
+ argn = *argnum;
+ optc = *optchar;
+
+ if (optc == READ_REST_ARGS_VERBATIM) {
+ read_rest_args_verbatim = 1;
+ }
+
+ if (argn == -1 || (recursion_depth == 0 && argn == 0)) {
+ /* first call */
+ /* if depth = 0 then args[0] is argv[0] so skip */
+ *option_num = o_NO_OPTION_MATCH;
+ optc = THIS_ARG_DONE;
+ first_nonoption_arg = -1;
+ }
+
+ /* if option_num is set then restore last option_ID in case continuing
+ value list */
+ option_ID = 0;
+ if (*option_num != o_NO_OPTION_MATCH) {
+ option_ID = options[*option_num].option_ID;
+ }
+
+ /* get next option if any */
+ for (;;) {
+ if (read_rest_args_verbatim) {
+ /* rest of args after "--" are non-option args if doubledash_ends_options
+ set */
+ argn++;
+ if (argn > argcnt || args[argn] == NULL) {
+ /* done */
+ option_ID = 0;
+ break;
+ }
+ arg = args[argn];
+ if ((*value = (char *)izu_malloc(strlen(arg) + 1)) == NULL) {
+ oWARN("memory - go.1");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, arg);
+ *option_num = o_NO_OPTION_MATCH;
+ option_ID = o_NON_OPTION_ARG;
+ break;
+
+ /* permute non-option args after option args so options are returned
+ first */
+ } else if (enable_permute) {
+ if (optc == SKIP_VALUE_ARG || optc == SKIP_VALUE_ARG2 ||
+ optc == THIS_ARG_DONE ||
+ optc == START_VALUE_LIST || optc == IN_VALUE_LIST ||
+ optc == STOP_VALUE_LIST) {
+ /* moved to new arg */
+ if (first_nonoption_arg > -1 && args[first_nonoption_arg]) {
+ /* do the permuting - move non-options after this option */
+ /* if option and value separate args or starting list skip option */
+ if (optc == SKIP_VALUE_ARG2) {
+ v = 2;
+ } else if (optc == SKIP_VALUE_ARG || optc == START_VALUE_LIST) {
+ v = 1;
+ } else {
+ v = 0;
+ }
+ for (h = first_nonoption_arg; h < argn; h++) {
+ arg = args[first_nonoption_arg];
+ for (j = first_nonoption_arg; j < argn + v; j++) {
+ args[j] = args[j + 1];
+ }
+ args[j] = arg;
+ }
+ first_nonoption_arg += 1 + v;
+ }
+ }
+ } else if (optc == NON_OPTION_ARG) {
+ /* if not permuting then already returned arg */
+ optc = THIS_ARG_DONE;
+ }
+
+ /* value lists */
+ if (optc == STOP_VALUE_LIST) {
+ optc = THIS_ARG_DONE;
+ }
+
+ if (optc == START_VALUE_LIST || optc == IN_VALUE_LIST) {
+ if (optc == START_VALUE_LIST) {
+ /* already returned first value */
+ argn++;
+ optc = IN_VALUE_LIST;
+ }
+ argn++;
+ arg = args[argn];
+ /* if end of args and still in list and there are non-option args then
+ terminate list */
+ if (arg == NULL && (optc == START_VALUE_LIST || optc == IN_VALUE_LIST)
+ && first_nonoption_arg > -1) {
+ /* terminate value list with @ */
+ /* this is only needed for argument files */
+ /* but is also good for show command line so command lines with lists
+ can always be read back in */
+ argcnt = insert_arg(__G__ &args, "@", first_nonoption_arg, 1);
+ argn++;
+ if (first_nonoption_arg > -1) {
+ first_nonoption_arg++;
+ }
+ }
+
+ arg = args[argn];
+ if (arg && arg[0] == '@' && arg[1] == '\0') {
+ /* inserted arguments terminator */
+ optc = STOP_VALUE_LIST;
+ continue;
+ } else if (arg && arg[0] != '-') { /* not option */
+ /* - and -- are not allowed in value lists unless escaped */
+ /* another value in value list */
+ if ((*value = (char *)izu_malloc(strlen(args[argn]) + 1)) == NULL) {
+ oWARN("memory - go.2");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, args[argn]);
+ break;
+
+ } else {
+ argn--;
+ optc = THIS_ARG_DONE;
+ }
+ }
+
+ /* move to next arg */
+ if (optc == SKIP_VALUE_ARG2) {
+ argn += 3;
+ optc = 0;
+ } else if (optc == SKIP_VALUE_ARG) {
+ argn += 2;
+ optc = 0;
+ } else if (optc == THIS_ARG_DONE) {
+ argn++;
+ optc = 0;
+ }
+ if (argn > argcnt) {
+ break;
+ }
+ if (args[argn] == NULL) {
+ /* done unless permuting and non-option args */
+ if (first_nonoption_arg > -1 && args[first_nonoption_arg]) {
+ /* return non-option arguments at end */
+ if (optc == NON_OPTION_ARG) {
+ first_nonoption_arg++;
+ }
+ /* after first pass args are permuted but skipped over non-option
+ args */
+ /* swap so argn points to first non-option arg */
+ j = argn;
+ argn = first_nonoption_arg;
+ first_nonoption_arg = j;
+ }
+ if (argn > argcnt || args[argn] == NULL) {
+ /* done */
+ option_ID = 0;
+ break;
+ }
+ }
+
+ /* after swap first_nonoption_arg points to end which is NULL */
+ if (first_nonoption_arg > -1 && (args[first_nonoption_arg] == NULL)) {
+ /* only non-option args left */
+ if (optc == NON_OPTION_ARG) {
+ argn++;
+ }
+ if (argn > argcnt || args[argn] == NULL) {
+ /* done */
+ option_ID = 0;
+ break;
+ }
+ if ((*value = (char *)izu_malloc(strlen(args[argn]) + 1)) == NULL) {
+ oWARN("memory - go.3");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, args[argn]);
+ optc = NON_OPTION_ARG;
+ option_ID = o_NON_OPTION_ARG;
+ break;
+ }
+
+ arg = args[argn];
+
+ /* is it an option */
+ if (arg[0] == '-') {
+ /* option */
+ if (arg[1] == '\0') {
+ /* arg = - */
+ /* treat like non-option arg */
+ *option_num = o_NO_OPTION_MATCH;
+ if (enable_permute) {
+ /* permute args to move all non-option args to end */
+ if (first_nonoption_arg < 0) {
+ first_nonoption_arg = argn;
+ }
+ argn++;
+ } else {
+ /* not permute args so return non-option args when found */
+ if ((*value = (char *)izu_malloc(strlen(arg) + 1)) == NULL) {
+ oWARN("memory - go.4");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, arg);
+ optc = NON_OPTION_ARG;
+ option_ID = o_NON_OPTION_ARG;
+ break;
+ }
+
+ } else if (arg[1] == '-') {
+ /* long option */
+ if (arg[2] == '\0') {
+ /* arg = -- */
+ if (doubledash_ends_options) {
+ /* Now -- stops permuting and forces the rest of
+ the command line to be read verbatim - 7/25/04 EG */
+
+ /* never permute args after -- and return as non-option args */
+ if (first_nonoption_arg < 1) {
+ /* -- is first non-option argument - 8/7/04 EG */
+ argn--;
+ } else {
+ /* go back to start of non-option args - 8/7/04 EG */
+ argn = first_nonoption_arg - 1;
+ }
+
+ /* disable permuting and treat remaining arguments as not
+ options */
+ read_rest_args_verbatim = 1;
+ optc = READ_REST_ARGS_VERBATIM;
+
+ } else {
+ /* treat like non-option arg */
+ *option_num = o_NO_OPTION_MATCH;
+ if (enable_permute) {
+ /* permute args to move all non-option args to end */
+ if (first_nonoption_arg < 0) {
+ first_nonoption_arg = argn;
+ }
+ argn++;
+ } else {
+ /* not permute args so return non-option args when found */
+ if ((*value = (char *)izu_malloc(strlen(arg) + 1)) == NULL) {
+ oWARN("memory - go.5");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, arg);
+ optc = NON_OPTION_ARG;
+ option_ID = o_NON_OPTION_ARG;
+ break;
+ }
+ }
+
+ } else {
+ option_ID = get_longopt(__G__ option_group, (ZCONST char **)args, argn,
+ &optc, negated,
+ value, option_num, recursion_depth);
+ if (option_ID == o_BAD_ERR) {
+ return o_BAD_ERR;
+ } else if (option_ID == o_ARG_FILE_ERR) {
+ /* unwind as only get this if recursion_depth > 0 */
+ return option_ID;
+ }
+ break;
+ }
+
+ } else {
+ /* short option */
+ option_ID = get_shortopt(__G__ option_group, (ZCONST char **)args, argn,
+ &optc, negated,
+ value, option_num, recursion_depth);
+
+ if (option_ID == o_BAD_ERR) {
+ return o_BAD_ERR;
+ } else if (option_ID == o_ARG_FILE_ERR) {
+ /* unwind as only get this if recursion_depth > 0 */
+ return option_ID;
+ }
+
+ if (optc == 0) {
+ /* if optc = 0 then ran out of short opts this arg */
+ optc = THIS_ARG_DONE;
+ } else {
+ break;
+ }
+ }
+
+#if 0
+ /* argument file code left out
+ so for now let filenames start with @
+ */
+
+ } else if (allow_arg_files && arg[0] == '@') {
+ /* arg file */
+ oERR(PK_PARMS, no_arg_files_err);
+#endif /* 0 */
+
+ } else {
+ /* non-option */
+ if (enable_permute) {
+ /* permute args to move all non-option args to end */
+ if (first_nonoption_arg < 0) {
+ first_nonoption_arg = argn;
+ }
+ argn++;
+ } else {
+ /* no permute args so return non-option args when found */
+ if ((*value = (char *)izu_malloc(strlen(arg) + 1)) == NULL) {
+ oWARN("memory - go.6");
+ return o_BAD_ERR;
+ }
+ strcpy(*value, arg);
+ *option_num = o_NO_OPTION_MATCH;
+ optc = NON_OPTION_ARG;
+ option_ID = o_NON_OPTION_ARG;
+ break;
+ }
+
+ }
+ }
+
+ *pargs = args;
+ *argc = argcnt;
+ *first_nonopt_arg = first_nonoption_arg;
+ *argnum = argn;
+ *optchar = optc;
+
+ return option_ID;
+}
+
+
+/* Ctrl/T (VMS) AST or SIGUSR1 handler for user-triggered progress
+ * message.
+ * UNIX: arg = signal number.
+ * VMS: arg = Out-of-band character mask.
+ */
+#ifdef ENABLE_USER_PROGRESS
+
+# ifndef VMS
+# include <limits.h>
+# include <time.h>
+# include <sys/times.h>
+# include <sys/utsname.h>
+# include <unistd.h>
+# endif /* ndef VMS */
+
+USER_PROGRESS_CLASS void user_progress( arg)
+int arg;
+{
+ /* VMS Ctrl/T automatically puts out a line like:
+ * ALP::_FTA24: 07:59:43 ZIP CPU=00:00:59.08 PF=2320 IO=52406 MEM=333
+ * (host::tty local_time program cpu_time page_faults I/O_ops phys_mem)
+ * We do something vaguely similar on non-VMS systems.
+ */
+# ifdef VMS
+
+ GETGLOBALS();
+
+# else /* def VMS */
+
+# ifdef CLK_TCK
+# define clk_tck CLK_TCK
+# else /* def CLK_TCK */
+ long clk_tck;
+# endif /* def CLK_TCK [else] */
+# define U_P_NODENAME_LEN 32
+
+ static int not_first = 0; /* First time flag. */
+ static char u_p_nodename[ U_P_NODENAME_LEN+ 1]; /* "host::tty". */
+ static char u_p_prog_name[] = "unzip"; /* Program name. */
+
+ struct utsname u_p_utsname;
+ struct tm u_p_loc_tm;
+ struct tms u_p_tms;
+ char *cp;
+ char *tty_name;
+ time_t u_p_time;
+ float stime_f;
+ float utime_f;
+
+ GETGLOBALS();
+
+ /* On the first time through, get the host name and tty name, and form
+ * the "host::tty" string (in u_p_nodename) for the intro line.
+ */
+ if (not_first == 0)
+ {
+ not_first = 1;
+ /* Host name. (Trim off any domain info. (Needed on Tru64.)) */
+ uname( &u_p_utsname);
+ if (u_p_utsname.nodename == NULL)
+ {
+ *u_p_nodename = '\0';
+ }
+ else
+ {
+ strncpy( u_p_nodename, u_p_utsname.nodename, (U_P_NODENAME_LEN- 8));
+ u_p_nodename[ 24] = '\0';
+ cp = strchr( u_p_nodename, '.');
+ if (cp != NULL)
+ *cp = '\0';
+ }
+
+ /* Terminal name. (Trim off any leading "/dev/"). */
+ tty_name = ttyname( 0);
+ if (tty_name != NULL)
+ {
+ cp = strstr( tty_name, "/dev/");
+ if (cp != NULL)
+ tty_name += 5;
+
+ strcat( u_p_nodename, "::");
+ strncat( u_p_nodename, tty_name,
+ (U_P_NODENAME_LEN- strlen( u_p_nodename)));
+ }
+ }
+
+ /* Local time. (Use reentrant localtime_r().) */
+ u_p_time = time( NULL);
+ localtime_r( &u_p_time, &u_p_loc_tm);
+
+ /* CPU time. */
+ times( &u_p_tms);
+# ifndef CLK_TCK
+ clk_tck = sysconf( _SC_CLK_TCK);
+# endif /* ndef CLK_TCK */
+ utime_f = ((float)u_p_tms.tms_utime)/ clk_tck;
+ stime_f = ((float)u_p_tms.tms_stime)/ clk_tck;
+
+ /* Put out intro line. */
+ fprintf( stderr, "%s %02d:%02d:%02d %s CPU=%.2f\n",
+ u_p_nodename,
+ u_p_loc_tm.tm_hour, u_p_loc_tm.tm_min, u_p_loc_tm.tm_sec,
+ u_p_prog_name,
+ (stime_f+ utime_f));
+
+# endif /* def VMS [else] */
+
+ if (G.zipfn != NULL)
+ {
+ fprintf( stderr, " Archive: %s\n", G.zipfn);
+ }
+
+ if (G.filename != NULL)
+ { /* Repeat the extraction message (to the extent possible). */
+ fprintf( stderr, ExtractMsg,
+ ((G.extract_msg_str == NULL) ? "????" : G.extract_msg_str),
+ FnFilter1( G.filename), "", "");
+ }
+
+# ifndef VMS
+ /* Re-establish this SIGUSR1 handler.
+ * (On VMS, the Ctrl/T handler persists.)
+ */
+ signal( SIGUSR1, user_progress);
+# endif /* ndef VMS */
+}
+
+#endif /* def ENABLE_USER_PROGRESS */
+
+
+#ifdef MEMDIAG
+# include "memdiag.c"
+#endif /* def MEMDIAG */
+
unzip.h (new)
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
This header file contains the public macros and typedefs required by
both the UnZip sources and by any application using the UnZip API. If
a copy at http://www.info-zip.org/pub/infozip/license.html.
-Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+Copyright (c) 1990-2012 Info-ZIP. All rights reserved.
For the purposes of this copyright and license, "Info-ZIP" is defined as
the following set of individuals:
---------------------------------------------------------------------------*/
#ifndef __unzip_h /* prevent multiple inclusions */
-#define __unzip_h
+# define __unzip_h
/*---------------------------------------------------------------------------
Predefined, machine-specific macros.
---------------------------------------------------------------------------*/
-#ifdef __GO32__ /* MS-DOS extender: NOT Unix */
+# ifdef __GO32__ /* MS-DOS extender: NOT Unix */
# ifdef unix
-# undef unix
+# undef unix
# endif
# ifdef _unix
-# undef _unix
+# undef _unix
# endif
# ifdef __unix
-# undef __unix
+# undef __unix
# endif
# ifdef __unix__
-# undef __unix__
+# undef __unix__
# endif
-#endif
+# endif
-#if ((defined(__convex__) || defined(__convexc__)) && !defined(CONVEX))
+# if ((defined(__convex__) || defined(__convexc__)) && !defined(CONVEX))
# define CONVEX
-#endif
+# endif
-#if (defined(unix) || defined(_unix) || defined(__unix) || defined(__unix__))
+# if (defined(unix) || defined(_unix) || defined(__unix) || defined(__unix__))
# ifndef UNIX
-# define UNIX
+# define UNIX
# endif
-#endif /* unix || _unix || __unix || __unix__ */
-#if (defined(M_XENIX) || defined(COHERENT) || defined(__hpux))
+# endif /* unix || _unix || __unix || __unix__ */
+# if (defined(M_XENIX) || defined(COHERENT) || defined(__hpux))
# ifndef UNIX
-# define UNIX
+# define UNIX
# endif
-#endif /* M_XENIX || COHERENT || __hpux */
-#if (defined(__NetBSD__) || defined(__FreeBSD__))
+# endif /* M_XENIX || COHERENT || __hpux */
+# if (defined(__NetBSD__) || defined(__FreeBSD__))
# ifndef UNIX
-# define UNIX
+# define UNIX
# endif
-#endif /* __NetBSD__ || __FreeBSD__ */
-#if (defined(CONVEX) || defined(MINIX) || defined(_AIX) || defined(__QNX__))
+# endif /* __NetBSD__ || __FreeBSD__ */
+# if (defined(CONVEX) || defined(MINIX) || defined(_AIX) || defined(__QNX__))
# ifndef UNIX
-# define UNIX
+# define UNIX
# endif
-#endif /* CONVEX || MINIX || _AIX || __QNX__ */
+# endif /* CONVEX || MINIX || _AIX || __QNX__ */
-#if (defined(VM_CMS) || defined(MVS))
+# if (defined(VM_CMS) || defined(MVS))
# define CMS_MVS
-#endif
+# endif
-#if (defined(__OS2__) && !defined(OS2))
+# if (defined(__OS2__) && !defined(OS2))
# define OS2
-#endif
+# endif
-#if (defined(__TANDEM) && !defined(TANDEM))
+# if (defined(__TANDEM) && !defined(TANDEM))
# define TANDEM
-#endif
+# endif
-#if (defined(__VMS) && !defined(VMS))
+# if (defined(__VMS) && !defined(VMS))
# define VMS
-#endif
+# endif
-#if ((defined(__WIN32__) || defined(_WIN32)) && !defined(WIN32))
+# if ((defined(__WIN32__) || defined(_WIN32)) && !defined(WIN32))
# define WIN32
-#endif
-#if ((defined(__WINNT__) || defined(__WINNT)) && !defined(WIN32))
+# endif
+# if ((defined(__WINNT__) || defined(__WINNT)) && !defined(WIN32))
# define WIN32
-#endif
+# endif
-#if defined(_WIN32_WCE)
+# if defined(_WIN32_WCE)
# ifndef WIN32 /* WinCE is treated as a variant of the Win32 API */
-# define WIN32
+# define WIN32
# endif
# ifndef UNICODE /* WinCE requires UNICODE wide character support */
-# define UNICODE
+# define UNICODE
# endif
-#endif
+# endif
-#ifdef __COMPILER_KCC__
+# ifdef __COMPILER_KCC__
# include <c-env.h>
# ifdef SYS_T20
-# define TOPS20
+# define TOPS20
# endif
-#endif /* __COMPILER_KCC__ */
+# endif /* __COMPILER_KCC__ */
/* Borland C does not define __TURBOC__ if compiling for a 32-bit platform */
-#ifdef __BORLANDC__
+# ifdef __BORLANDC__
# ifndef __TURBOC__
-# define __TURBOC__
+# define __TURBOC__
# endif
# if (!defined(__MSDOS__) && !defined(OS2) && !defined(WIN32))
-# define __MSDOS__
+# define __MSDOS__
# endif
-#endif
+# endif
/* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */
-#ifdef __POWERC
+# ifdef __POWERC
# define __TURBOC__
# define MSDOS
-#endif /* __POWERC */
+# endif /* __POWERC */
-#if (defined(__MSDOS__) && !defined(MSDOS)) /* just to make sure */
+# if (defined(__MSDOS__) && !defined(MSDOS)) /* just to make sure */
# define MSDOS
-#endif
+# endif
-/* RSXNTDJ (at least up to v1.3) compiles for WIN32 (RSXNT) using a derivate
+/* RSXNTDJ (at least up to v1.3) compiles for WIN32 (RSXNT) using a derivative
of the EMX environment, but defines MSDOS and __GO32__. ARG !!! */
-#if (defined(MSDOS) && defined(WIN32))
+# if (defined(MSDOS) && defined(WIN32))
# undef MSDOS /* WIN32 is >>>not<<< MSDOS */
-#endif
-#if (defined(__GO32__) && defined(__EMX__) && defined(__RSXNT__))
+# endif
+# if (defined(__GO32__) && defined(__EMX__) && defined(__RSXNT__))
# undef __GO32__
-#endif
+# endif
-#if (defined(linux) && !defined(LINUX))
+# if (defined(linux) && !defined(LINUX))
# define LINUX
-#endif
+# endif
-#ifdef __riscos
+# ifdef __riscos
# define RISCOS
-#endif
+# endif
-#if (defined(THINK_C) || defined(MPW))
+# if (defined(THINK_C) || defined(MPW))
# define MACOS
-#endif
-#if (defined(__MWERKS__) && defined(macintosh))
+# endif
+# if (defined(__MWERKS__) && defined(macintosh))
# define MACOS
-#endif
+# endif
/* use prototypes and ANSI libraries if __STDC__, or MS-DOS, or OS/2, or Win32,
* or IBM C Set/2, or Borland C, or Watcom C, or GNU gcc (emx or Cygwin),
* or Macintosh, or Sequent, or Atari, or IBM RS/6000, or Silicon Graphics,
* or Convex?, or AtheOS, or BeOS.
*/
-#if (defined(__STDC__) || defined(MSDOS) || defined(OS2) || defined(WIN32))
+# if (defined(__STDC__) || defined(MSDOS) || defined(OS2) || defined(WIN32))
# ifndef PROTO
-# define PROTO
+# define PROTO
# endif
# ifndef MODERN
-# define MODERN
+# define MODERN
# endif
-#endif
-#if (defined(__IBMC__) || defined(__BORLANDC__) || defined(__WATCOMC__))
+# endif
+# if (defined(__IBMC__) || defined(__BORLANDC__) || defined(__WATCOMC__))
# ifndef PROTO
-# define PROTO
+# define PROTO
# endif
# ifndef MODERN
-# define MODERN
+# define MODERN
# endif
-#endif
-#if (defined(__EMX__) || defined(__CYGWIN__))
+# endif
+# if (defined(__EMX__) || defined(__CYGWIN__))
# ifndef PROTO
-# define PROTO
+# define PROTO
# endif
# ifndef MODERN
-# define MODERN
+# define MODERN
# endif
-#endif
-#if (defined(MACOS) || defined(ATARI_ST) || defined(RISCOS) || defined(THEOS))
+# endif
+# if (defined(MACOS) || defined(ATARI_ST) || defined(RISCOS) || defined(THEOS))
# ifndef PROTO
-# define PROTO
+# define PROTO
# endif
# ifndef MODERN
-# define MODERN
+# define MODERN
# endif
-#endif
+# endif
/* Sequent running Dynix/ptx: non-modern compiler */
-#if (defined(_AIX) || defined(sgi) || (defined(_SEQUENT_) && !defined(PTX)))
+# if (defined(_AIX) || defined(sgi) || (defined(_SEQUENT_) && !defined(PTX)))
# ifndef PROTO
-# define PROTO
+# define PROTO
# endif
# ifndef MODERN
-# define MODERN
+# define MODERN
# endif
-#endif
-#if (defined(CMS_MVS) || defined(__ATHEOS__) || defined(__BEOS__))
+# endif
+# if (defined(CMS_MVS) || defined(__ATHEOS__) || defined(__BEOS__))
/* || defined(CONVEX) ? */
# ifndef PROTO
-# define PROTO
+# define PROTO
# endif
# ifndef MODERN
-# define MODERN
+# define MODERN
# endif
-#endif
+# endif
/* Bundled C compiler on HP-UX needs this. Others shouldn't care. */
-#if (defined(__hpux))
+# if (defined(__hpux))
# ifndef MODERN
-# define MODERN
+# define MODERN
# endif
-#endif
+# endif
/* turn off prototypes if requested */
-#if (defined(NOPROTO) && defined(PROTO))
+# if (defined(NOPROTO) && defined(PROTO))
# undef PROTO
-#endif
+# endif
-/* used to remove arguments in function prototypes for non-ANSI C */
-#ifdef PROTO
+/* Function prototype control. (See also globals.h.) */
+# ifdef PROTO
# define OF(a) a
-#else
+# define OFT(a) a
+# else
# define OF(a) ()
-#endif
+# define OFT(a)
+# endif
/* enable the "const" keyword only if MODERN and if not otherwise instructed */
-#ifdef MODERN
+# ifdef MODERN
# if (!defined(ZCONST) && (defined(USE_CONST) || !defined(NO_CONST)))
-# define ZCONST const
+# define ZCONST const
# endif
-#endif
+# endif
-#ifndef ZCONST
+# ifndef ZCONST
# define ZCONST
-#endif
+# endif
/* Tell Microsoft Visual C++ 2005 (and newer) to leave us alone
* and let us use standard C functions the way we're supposed to.
* header include. They are located here, because for WINDLL the
* first system header includes follow just below.)
*/
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
-# ifndef _CRT_SECURE_NO_WARNINGS
+# ifdef _MSC_VER
+# if _MSC_VER >= 1400
+# ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
-# endif
-# ifndef _CRT_NONSTDC_NO_WARNINGS
+# endif
+# ifndef _CRT_NONSTDC_NO_WARNINGS
# define _CRT_NONSTDC_NO_WARNINGS
-# endif
-# if defined(POCKET_UNZIP) && !defined(_CRT_NON_CONFORMING_SWPRINTFS)
+# endif
+# if defined(POCKET_UNZIP) && !defined(_CRT_NON_CONFORMING_SWPRINTFS)
# define _CRT_NON_CONFORMING_SWPRINTFS
+# endif
+# endif
+ /* Memory allocation debug. Map malloc() onto malloc_dbg().
+ * Look for _CrtSetDbgFlag in unzip.c:MAIN().
+ */
+# if defined(_DEBUG) && !defined( NO_IZ_DEBUG_ALLOC)
+# define _CRTDBG_MAP_ALLOC
+# include "crtdbg.h"
# endif
-#endif
+# endif /* def _MSC_VER */
-/* NO_UNIXBACKUP overrides UNIXBACKUP */
-#if defined(NO_UNIXBACKUP) && defined(UNIXBACKUP)
-# undef UNIXBACKUP
-#endif
+/* Enable UNIXBACKUP (-B) option as default on specific systems, to
+ * allow backing up files that would be overwritten.
+ * NO_UNIXBACKUP overrides UNIXBACKUP
+ */
+# if (!defined( NO_UNIXBACKUP) && !defined( UNIXBACKUP))
+# if defined( UNIX) || defined( OS2) || defined( WIN32)
+# define UNIXBACKUP
+# endif
+# endif
/*---------------------------------------------------------------------------
Grab system-specific public include headers.
---------------------------------------------------------------------------*/
-#ifdef POCKET_UNZIP /* WinCE port */
+# ifdef POCKET_UNZIP /* WinCE port */
# include "wince/punzip.h" /* must appear before windows.h */
-#endif
+# endif
-#ifdef WINDLL
+# ifdef WINDLL
/* for UnZip, the "basic" part of the win32 api is sufficient */
# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# define IZ_HASDEFINED_WIN32LEAN
+# define WIN32_LEAN_AND_MEAN
+# define IZ_HASDEFINED_WIN32LEAN
# endif
# include <windows.h>
# include "windll/structs.h"
# ifdef IZ_HASDEFINED_WIN32LEAN
-# undef WIN32_LEAN_AND_MEAN
-# undef IZ_HASDEFINED_WIN32LEAN
+# undef WIN32_LEAN_AND_MEAN
+# undef IZ_HASDEFINED_WIN32LEAN
# endif
-#endif
+# endif /* def WINDLL */
+
/*---------------------------------------------------------------------------
Grab system-dependent definition of EXPENTRY for prototypes below.
---------------------------------------------------------------------------*/
#if 0
-#if (defined(OS2) && !defined(FUNZIP))
+# if (defined(OS2) && !defined(FUNZIP))
# ifdef UNZIP_INTERNAL
-# define INCL_NOPM
-# define INCL_DOSNLS
-# define INCL_DOSPROCESS
-# define INCL_DOSDEVICES
-# define INCL_DOSDEVIOCTL
-# define INCL_DOSERRORS
-# define INCL_DOSMISC
-# ifdef OS2DLL
-# define INCL_REXXSAA
-# include <rexxsaa.h>
-# endif
+# define INCL_NOPM
+# define INCL_DOSNLS
+# define INCL_DOSPROCESS
+# define INCL_DOSDEVICES
+# define INCL_DOSDEVIOCTL
+# define INCL_DOSERRORS
+# define INCL_DOSMISC
+# ifdef OS2DLL
+# define INCL_REXXSAA
+# include <rexxsaa.h>
+# endif
# endif /* UNZIP_INTERNAL */
# include <os2.h>
# define UZ_EXP EXPENTRY
-#endif /* OS2 && !FUNZIP */
+# endif /* OS2 && !FUNZIP */
#endif /* 0 */
-#if (defined(OS2) && !defined(FUNZIP))
+# if (defined(OS2) && !defined(FUNZIP))
# if (defined(__IBMC__) || defined(__WATCOMC__))
-# define UZ_EXP _System /* compiler keyword */
+# define UZ_EXP _System /* compiler keyword */
# else
-# define UZ_EXP
+# define UZ_EXP
# endif
-#endif /* OS2 && !FUNZIP */
+# endif /* OS2 && !FUNZIP */
-#if (defined(WINDLL) || defined(USE_UNZIP_LIB))
+# if (defined(WINDLL) || defined(USE_UNZIP_LIB))
# ifndef EXPENTRY
-# define UZ_EXP WINAPI
+# define UZ_EXP WINAPI
# else
-# define UZ_EXP EXPENTRY
+# define UZ_EXP EXPENTRY
# endif
-#endif
+# endif
-#ifndef UZ_EXP
+# ifndef UZ_EXP
# define UZ_EXP
-#endif
+# endif
-#ifdef __cplusplus
+# ifdef __cplusplus
extern "C" {
-#endif
+# endif
/*---------------------------------------------------------------------------
Public typedefs.
---------------------------------------------------------------------------*/
-#ifndef _IZ_TYPES_DEFINED
-#ifdef MODERN
- typedef void zvoid;
-#else /* !MODERN */
-# ifndef AOS_VS /* mostly modern? */
-# ifndef VAXC /* not fully modern, but has knows 'void' */
-# define void int
+# ifndef _IZ_TYPES_DEFINED
+# ifdef MODERN
+typedef void zvoid;
+# else /* def MODERN */
+# ifndef AOS_VS /* mostly modern? */
+# ifndef VAXC /* not fully modern, but has knows 'void' */
+# define void int
# endif /* !VAXC */
-# endif /* !AOS_VS */
- typedef char zvoid;
-#endif /* ?MODERN */
+# endif /* !AOS_VS */
+typedef char zvoid;
+# endif /* def MODERN [else] */
typedef unsigned char uch; /* code assumes unsigned bytes; these type- */
typedef unsigned short ush; /* defs replace byte/UWORD/ULONG (which are */
typedef unsigned long ulg; /* predefined on some systems) & match zip */
-#define _IZ_TYPES_DEFINED
-#endif /* !_IZ_TYPES_DEFINED */
+# define _IZ_TYPES_DEFINED
+# endif /* !_IZ_TYPES_DEFINED */
/* InputFn is not yet used and is likely to change: */
-#ifdef PROTO
- typedef int (UZ_EXP MsgFn) (zvoid *pG, uch *buf, ulg size, int flag);
- typedef int (UZ_EXP InputFn) (zvoid *pG, uch *buf, int *size, int flag);
- typedef void (UZ_EXP PauseFn) (zvoid *pG, ZCONST char *prompt, int flag);
- typedef int (UZ_EXP PasswdFn) (zvoid *pG, int *rcnt, char *pwbuf,
+# ifdef PROTO
+typedef int (UZ_EXP MsgFn) (zvoid *pG, uch *buf, ulg size, int flag);
+typedef int (UZ_EXP InputFn) (zvoid *pG, uch *buf, int *size, int flag);
+typedef void (UZ_EXP PauseFn) (zvoid *pG, ZCONST char *prompt, int flag);
+typedef int (UZ_EXP PasswdFn) (zvoid *pG, int *rcnt, char *pwbuf,
int size, ZCONST char *zfn,
ZCONST char *efn);
- typedef int (UZ_EXP StatCBFn) (zvoid *pG, int fnflag, ZCONST char *zfn,
+ typedef int (UZ_EXP StatCBFn) (zvoid *pG, int fnflag, ZCONST char *zfn,
ZCONST char *efn, ZCONST zvoid *details);
- typedef void (UZ_EXP UsrIniFn) (void);
-#else /* !PROTO */
- typedef int (UZ_EXP MsgFn) ();
- typedef int (UZ_EXP InputFn) ();
- typedef void (UZ_EXP PauseFn) ();
- typedef int (UZ_EXP PasswdFn) ();
- typedef int (UZ_EXP StatCBFn) ();
- typedef void (UZ_EXP UsrIniFn) ();
-#endif /* ?PROTO */
+typedef void (UZ_EXP UsrIniFn) (void);
+#else /* def PROTO */
+typedef int (UZ_EXP MsgFn) ();
+typedef int (UZ_EXP InputFn) ();
+typedef void (UZ_EXP PauseFn) ();
+typedef int (UZ_EXP PasswdFn) ();
+typedef int (UZ_EXP StatCBFn) ();
+typedef void (UZ_EXP UsrIniFn) ();
+#endif /* def PROTO [else] */
typedef struct _UzpBuffer { /* rxstr */
ulg strlength; /* length of string */
/* the collection of general UnZip option flags and option arguments */
typedef struct _UzpOpts {
-#ifndef FUNZIP
- char *exdir; /* pointer to extraction root directory (-d option) */
- char *pwdarg; /* pointer to command-line password (-P option) */
- int zipinfo_mode; /* behave like ZipInfo or like normal UnZip? */
- int aflag; /* -a: do ASCII-EBCDIC and/or end-of-line translation */
-#ifdef VMS
- int bflag; /* -b: force fixed record format for binary files */
-#endif
-#ifdef TANDEM
- int bflag; /* -b: create text files in 'C' format (180)*/
-#endif
-#if defined(UNIX) || defined(OS2) || defined(WIN32)
- int B_flag; /* -B: back up existing files by renaming to *~##### */
-#else
-#ifdef UNIXBACKUP
- int B_flag; /* -B: back up existing files by renaming to *~##### */
-#endif
-#endif
- int cflag; /* -c: output to stdout */
- int C_flag; /* -C: match filenames case-insensitively */
- int D_flag; /* -D: don't restore directory (-DD: any) timestamps */
-#ifdef MACOS
- int E_flag; /* -E: [MacOS] show Mac extra field during restoring */
-#endif
- int fflag; /* -f: "freshen" (extract only newer files) */
-#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
+# ifndef FUNZIP
+ int aflag; /* -a: ASCII-EBCDIC and/or end-of-line translation. */
+# ifdef VMS
+ int bflag; /* -b: Force fixed record format for binary files. */
+# endif /* def VMS */
+# ifdef TANDEM
+ int bflag; /* -b: Create text files in 'C' format (180). */
+# endif /* def TANDEM */
+# ifdef UNIXBACKUP
+ int B_flag; /* -B: Back up existing files, renaming to *~#####. */
+# endif /* def UNIXBACKUP */
+ int cflag; /* -c: Output to stdout. */
+ int C_flag; /* -C: Match filenames case-insensitively. */
+ int D_flag; /* -D: Don't restore directory (-DD: any) timestamps. */
+ char *exdir; /* -d: Extraction destination (root) directory. */
+#ifndef SFX
+ int auto_exdir; /* -da: Automatic extraction destination (root) dir. */
+#endif /* ndef SFX */
+# ifdef MACOS
+ int E_flag; /* -E: Show Mac extra field during restoring. */
+# endif /* def MACOS */
+ int fflag; /* -f: "Freshen" (extract only newer files). */
+# if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
int acorn_nfs_ext; /* -F: RISC OS types & NFS filetype extensions */
-#endif
- int hflag; /* -h: header line (zipinfo) */
-#ifdef MACOS
- int i_flag; /* -i: [MacOS] ignore filenames stored in Mac e.f. */
-#endif
+# endif
+ int hflag; /* -h: Header line (ZipInfo). */
+# ifdef MACOS
+ int i_flag; /* -i: Ignore filenames stored in Mac extra field. */
+# endif /* def MACOS */
#ifdef RISCOS
- int scanimage; /* -I: scan image files */
-#endif
- int jflag; /* -j: junk pathnames (unzip) */
-#if (defined(__ATHEOS__) || defined(__BEOS__) || defined(MACOS))
- int J_flag; /* -J: ignore AtheOS/BeOS/MacOS e. f. info (unzip) */
-#endif
-#if (defined(__ATHEOS__) || defined(__BEOS__) || defined(UNIX))
- int K_flag; /* -K: keep setuid/setgid/tacky permissions */
-#endif
- int lflag; /* -12slmv: listing format (zipinfo) */
- int L_flag; /* -L: convert filenames from some OSes to lowercase */
- int overwrite_none; /* -n: never overwrite files (no prompting) */
-#ifdef AMIGA
- int N_flag; /* -N: restore comments as AmigaDOS filenotes */
-#endif
- int overwrite_all; /* -o: OK to overwrite files without prompting */
-#endif /* !FUNZIP */
- int qflag; /* -q: produce a lot less output */
-#ifdef TANDEM
- int rflag; /* -r: remove file extensions */
-#endif
-#ifndef FUNZIP
-#if (defined(MSDOS) || defined(FLEXOS) || defined(OS2) || defined(WIN32))
- int sflag; /* -s: convert spaces in filenames to underscores */
-#endif
-#if (defined(NLM))
- int sflag; /* -s: convert spaces in filenames to underscores */
-#endif
-#ifdef VMS
- int S_flag; /* -S: use Stream_LF for text files (-a[a]) */
-#endif
-#if (defined(MSDOS) || defined(__human68k__) || defined(OS2) || defined(WIN32))
- int volflag; /* -$: extract volume labels */
-#endif
- int tflag; /* -t: test (unzip) or totals line (zipinfo) */
- int T_flag; /* -T: timestamps (unzip) or dec. time fmt (zipinfo) */
- int uflag; /* -u: "update" (extract only newer/brand-new files) */
-#if defined(UNIX) || defined(VMS) || defined(WIN32)
- int U_flag; /* -U: escape non-ASCII, -UU No Unicode paths */
-#endif
- int vflag; /* -v: (verbosely) list directory */
- int V_flag; /* -V: don't strip VMS version numbers */
- int W_flag; /* -W: wildcard '*' won't match '/' dir separator */
-#if (defined (__ATHEOS__) || defined(__BEOS__) || defined(UNIX))
- int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */
-#else
-#if (defined(TANDEM) || defined(THEOS))
- int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */
-#else
-#if (defined(OS2) || defined(VMS) || defined(WIN32))
- int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */
-#endif
-#endif
-#endif
-#ifdef VMS
- int Y_flag; /* -Y: treat ".nnn" as ";nnn" version */
-#endif
- int zflag; /* -z: display the zipfile comment (only, for unzip) */
-#ifdef VMS
- int ods2_flag; /* -2: force names to conform to ODS2 */
-#endif
-#if (!defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM))
- int ddotflag; /* -:: don't skip over "../" path elements */
-#endif
-#ifdef UNIX
- int cflxflag; /* -^: allow control chars in extracted filenames */
-#endif
-#endif /* !FUNZIP */
+ int scanimage; /* -I: Scan image files. */
+#endif /* def RISCOS */
+ int jflag; /* -j: Junk pathnames. */
+/*
+ * VAX C V3.1-051 loves "\" in #define, but hates it in #if.
+ * HP C V7.3-009 dislikes "defined" in macro in #if (%CC-I-EXPANDEDDEFINED).
+ * It seems safest to avoid any continuation lines in either.
+ */
+# if defined(__ATHEOS__) || defined(__BEOS__) || defined(__HAIKU__)
+# define J_FLAG 1
+# else
+# if defined(MACOS) || (defined( UNIX) && defined( __APPLE__))
+# define J_FLAG 1
+# endif
+# endif
+# ifdef J_FLAG
+ int J_flag; /* -J: Ignore AtheOS/BeOS/MacOS extra field. info. */
+# endif
+# if defined( UNIX) && defined( __APPLE__)
+ int Je_flag; /* -Je: Ignore (all) extended attributes. */
+ int Jf_flag; /* -Jf: Ignore Finder info. */
+ int Jq_flag; /* -Jq: Ignore quarantine ("com.apple.quarantine") */
+ int Jr_flag; /* -Jr: Ignore Resource fork. */
+# endif /* defined( UNIX) && defined( __APPLE__) */
+ int java_cafe; /* --jar: Java CAFE extra block assumed/detected. */
+# if (defined(__ATHEOS__) || defined(__BEOS__) || defined(UNIX))
+ int K_flag; /* -K: Keep setuid/setgid/tacky permissions. */
+# endif
+# if !defined( NO_KFLAG) && !defined( KFLAG)
+# if defined( __ATHEOS__) || defined( __BEOS__) || defined( UNIX)
+# define KFLAG
+# else
+# if defined( VMS)
+# define KFLAG
+# endif
+# endif
+# endif /* !defined( NO_KFLAG) && !defined( KFLAG) */
+# ifdef KFLAG
+ int kflag; /* -k: Owner+group restoration control. */
+# endif
+# ifdef VMS
+ int ka_flag; /* -ka: VMS ACL restoration control. */
+# endif
+ int lflag; /* -12slmv: Listing format (ZipInfo) */
+ int L_flag; /* -L: Convert filenames (some OS's) to lowercase. */
+ int member_counts; /* -mc: Show separate dir/file/link member counts. */
+ int overwrite_none; /* -n: Never overwrite files (no prompting). */
+# ifdef AMIGA
+ int N_flag; /* -N: Restore comments as AmigaDOS filenotes. */
+# endif
+ int overwrite_all; /* -o: OK to overwrite files without prompting. */
+# endif /* !FUNZIP */
+ char *pwdarg; /* -P: Command-line password. */
+ int qflag; /* -q: Quiet. Produce much less output. */
+# ifdef TANDEM
+ int rflag; /* -r: Remove file extensions. */
+# endif
+# ifndef FUNZIP
+ int sflag; /* -s: Convert spaces in filenames to underscores. */
+# ifdef VMS
+ int S_flag; /* -S: Use Stream_LF for text files (-a[a]). */
+# endif /* def VMS */
+# if (defined(MSDOS) || defined(__human68k__) || defined(OS2) || defined(WIN32))
+# define VOLFLAG
+# else
+# if defined( VMS)
+# define VOLFLAG
+# endif /* def VMS */
+# endif
+# ifdef VOLFLAG
+ int volflag; /* -$: Extract volume labels. */
+# endif /* def VOLFLAG */
+ int tflag; /* -t: Test (UnZip) or totals line (ZipInfo). */
+ int T_flag; /* -T: timestamps (UnZip) or dec. time fmt (ZipInfo). */
+ int uflag; /* -u: "Update": Extract only newer/brand-new files). */
+# if defined(UNIX) || defined(VMS) || defined(WIN32)
+ int U_flag; /* -U: Escape non-ASCII, -UU No Unicode paths. */
+# endif
+ int vflag; /* -v: Verbose/version. (ZipInfo: Verbose listing.) */
+ int V_flag; /* -V: Retain VMS version numbers. */
+ int W_flag; /* -W: Wildcard '*' won't match '/' dir separator. */
+# if (defined (__ATHEOS__) || defined(__BEOS__) || defined(UNIX))
+ int X_flag; /* -X: Restore owner/protection or UID/GID. */
+# else
+# if (defined(TANDEM) || defined(THEOS))
+ int X_flag; /* -X: Restore owner/protection or UID/GID or ACLs. */
+# else
+# if (defined(OS2) || defined(VMS) || defined(WIN32))
+ int X_flag; /* -X: restore owner/protection or UID/GID. */
+# endif
+# endif
+# endif
+# ifdef VMS
+ int Y_flag; /* -Y: Treat ".nnn" as ";nnn" version. */
+# endif
+ int zflag; /* -z: Display the zipfile comment (only, for UnZip). */
+ int zipinfo_mode; /* -Z: ZipInfo mode (instead of normal UnZip). */
+# ifdef VMS
+ int ods2_flag; /* -2: Force names to conform to ODS2. */
+# endif
+# if (!defined(RISCOS) && !defined(CMS_MVS) && !defined(TANDEM))
+ int ddotflag; /* -:: Don't skip over "../" path elements */
+# endif
+# ifdef UNIX
+ int cflxflag; /* -^: Allow control chars in extracted filenames. */
+# endif
+# endif /* ndef FUNZIP */
} UzpOpts;
/* intended to be a private struct: */
typedef struct _ver {
- uch major; /* e.g., integer 5 */
- uch minor; /* e.g., 2 */
+ uch vmajor; /* e.g., integer 5 */
+ uch vminor; /* e.g., 2 */
uch patchlevel; /* e.g., 0 */
uch not_used;
} _version_type;
} Uzp_cdir_Rec;
-#define UZPINIT_LEN sizeof(UzpInit)
-#define UZPVER_LEN sizeof(UzpVer)
-#define cbList(func) int (* UZ_EXP func)(char *filename, Uzp_cdir_Rec *crec)
+# define UZPINIT_LEN sizeof(UzpInit)
+# define UZPVER_LEN sizeof(UzpVer)
+# define cbList(func) int (* UZ_EXP func)(char *filename, Uzp_cdir_Rec *crec)
/*---------------------------------------------------------------------------
Return (and exit) values of the public UnZip API functions.
---------------------------------------------------------------------------*/
-/* external return codes */
-#define PK_OK 0 /* no error */
-#define PK_COOL 0 /* no error */
-#define PK_WARN 1 /* warning error */
-#define PK_ERR 2 /* error in zipfile */
-#define PK_BADERR 3 /* severe error in zipfile */
-#define PK_MEM 4 /* insufficient memory (during initialization) */
-#define PK_MEM2 5 /* insufficient memory (password failure) */
-#define PK_MEM3 6 /* insufficient memory (file decompression) */
-#define PK_MEM4 7 /* insufficient memory (memory decompression) */
-#define PK_MEM5 8 /* insufficient memory (not yet used) */
-#define PK_NOZIP 9 /* zipfile not found */
-#define PK_PARAM 10 /* bad or illegal parameters specified */
-#define PK_FIND 11 /* no files found */
-#define PK_DISK 50 /* disk full */
-#define PK_EOF 51 /* unexpected EOF */
-
-#define IZ_CTRLC 80 /* user hit ^C to terminate */
-#define IZ_UNSUP 81 /* no files found: all unsup. compr/encrypt. */
-#define IZ_BADPWD 82 /* no files found: all had bad password */
-#define IZ_ERRBF 83 /* big-file archive, small-file program */
+/* External return codes */
+# define PK_OK 0 /* no error */
+# define PK_COOL 0 /* no error */
+# define PK_WARN 1 /* warning error */
+# define PK_ERR 2 /* error in zipfile */
+# define PK_BADERR 3 /* severe error in zipfile */
+# define PK_MEM 4 /* insufficient memory (during initialization) */
+# define PK_MEM2 5 /* insufficient memory (password failure) */
+# define PK_MEM3 6 /* insufficient memory (file decompression) */
+# define PK_MEM4 7 /* insufficient memory (memory decompression) */
+# define PK_MEM5 8 /* insufficient memory (not yet used) */
+# define PK_NOZIP 9 /* zipfile not found */
+# define PK_PARAM 10 /* bad or illegal parameters specified */
+# define PK_FIND 11 /* no files found */
+# define PK_COMPERR 19 /* error in compilation options */
+# define PK_DISK 50 /* disk full */
+# define PK_EOF 51 /* unexpected EOF */
+
+# define IZ_CTRLC 80 /* user hit ^C to terminate */
+# define IZ_UNSUP 81 /* no files found: all unsup. compr/encrypt. */
+# define IZ_BADPWD 82 /* no files found: all had bad password */
+# define IZ_ERRBF 83 /* big-file archive, small-file program */
+# define IZ_BADDEST 84 /* Bad automatic destination directory. */
/* return codes of password fetches (negative = user abort; positive = error) */
-#define IZ_PW_ENTERED 0 /* got some password string; use/try it */
-#define IZ_PW_CANCEL -1 /* no password available (for this entry) */
-#define IZ_PW_CANCELALL -2 /* no password, skip any further pwd. request */
-#define IZ_PW_ERROR 5 /* = PK_MEM2 : failure (no mem, no tty, ...) */
+# define IZ_PW_ENTERED 0 /* got some password string; use/try it */
+# define IZ_PW_CANCEL -1 /* no password available (for this entry) */
+# define IZ_PW_CANCELALL -2 /* no password, skip any further pwd. request */
+# define IZ_PW_ERROR 5 /* = PK_MEM2 : failure (no mem, no tty, ...) */
/* flag values for status callback function */
-#define UZ_ST_START_EXTRACT 1 /* no details */
-#define UZ_ST_IN_PROGRESS 2 /* no details */
-#define UZ_ST_FINISH_MEMBER 3 /* 'details': extracted size */
+# define UZ_ST_START_EXTRACT 1 /* no details */
+# define UZ_ST_IN_PROGRESS 2 /* no details */
+# define UZ_ST_FINISH_MEMBER 3 /* 'details': extracted size */
/* return values of status callback function */
-#define UZ_ST_CONTINUE 0
-#define UZ_ST_BREAK 1
+# define UZ_ST_CONTINUE 0
+# define UZ_ST_BREAK 1
/*---------------------------------------------------------------------------
Prototypes for public UnZip API (DLL) functions.
---------------------------------------------------------------------------*/
-#define UzpMatch match
+# define UzpMatch match
int UZ_EXP UzpMain OF((int argc, char **argv));
int UZ_EXP UzpAltMain OF((int argc, char **argv, UzpInit *init));
+int UZ_EXP UzpMainI OF((int argc, char **argv, UzpCB *init));
ZCONST UzpVer * UZ_EXP UzpVersion OF((void));
+char *UzpFeatures OF((void));
void UZ_EXP UzpFreeMemBuffer OF((UzpBuffer *retstr));
-#ifndef WINDLL
+# ifndef WINDLL
int UZ_EXP UzpUnzipToMemory OF((char *zip, char *file, UzpOpts *optflgs,
UzpCB *UsrFunc, UzpBuffer *retstr));
int UZ_EXP UzpGrep OF((char *archive, char *file,
char *pattern, int cmd, int SkipBin,
UzpCB *UsrFunc));
-#endif
-#ifdef OS2
+# endif /* ndef WINDLL */
+# ifdef OS2
int UZ_EXP UzpFileTree OF((char *name, cbList(callBack),
char *cpInclude[], char *cpExclude[]));
-#endif
+# endif /* def OS2 */
unsigned UZ_EXP UzpVersion2 OF((UzpVer2 *version));
int UZ_EXP UzpValidate OF((char *archive, int AllCodes));
+void show_commandline OF((char *args[]));
-/* default I/O functions (can be swapped out via UzpAltMain() entry point): */
+
+/* Default I/O functions (can be swapped out via UzpAltMain() entry point): */
int UZ_EXP UzpMessagePrnt OF((zvoid *pG, uch *buf, ulg size, int flag));
int UZ_EXP UzpMessageNull OF((zvoid *pG, uch *buf, ulg size, int flag));
int size, ZCONST char *zfn,
ZCONST char *efn));
-#ifdef __cplusplus
+# ifdef VMS
+int vms_status OF((int err)); /* vms.c */
+void decc_init OF((void)); /* vms.c */
+# endif
+
+/* General purpose flag: UTF-8 member path and comment. */
+# ifndef UTF8_BIT /* Avoid conflict with Zip:zip.h. */
+# define UTF8_BIT (1<<11)
+# endif /* ndef UTF8_BIT */
+
+# ifdef __cplusplus
}
-#endif
+# endif
/*---------------------------------------------------------------------------
Remaining private stuff for UnZip compilation.
---------------------------------------------------------------------------*/
-#ifdef UNZIP_INTERNAL
+# ifdef UNZIP_INTERNAL
# include "unzpriv.h"
-#endif
-
+# endif
#endif /* !__unzip_h */
+
+++ /dev/null
-UNZIP(1L) UNZIP(1L)
-
-NAME
- unzip - list, test and extract compressed files in a ZIP archive
-
-SYNOPSIS
- unzip [-Z] [-cflptTuvz[abjnoqsCDKLMUVWX$/:^]] file[.zip] [file(s) ...]
- [-x xfile(s) ...] [-d exdir]
-
-DESCRIPTION
- unzip will list, test, or extract files from a ZIP archive, commonly
- found on MS-DOS systems. The default behavior (with no options) is to
- extract into the current directory (and subdirectories below it) all
- files from the specified ZIP archive. A companion program, zip(1L),
- creates ZIP archives; both programs are compatible with archives cre-
- ated by PKWARE's PKZIP and PKUNZIP for MS-DOS, but in many cases the
- program options or default behaviors differ.
-
-ARGUMENTS
- file[.zip]
- Path of the ZIP archive(s). If the file specification is a
- wildcard, each matching file is processed in an order determined
- by the operating system (or file system). Only the filename can
- be a wildcard; the path itself cannot. Wildcard expressions are
- similar to those supported in commonly used Unix shells (sh,
- ksh, csh) and may contain:
-
- * matches a sequence of 0 or more characters
-
- ? matches exactly 1 character
-
- [...] matches any single character found inside the brackets;
- ranges are 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 except the characters inside the
- brackets is considered a match). To specify a verbatim
- left bracket, the three-character sequence ``[[]'' has to
- be used.
-
- (Be sure to quote any character that might otherwise be inter-
- preted or modified by the operating system, particularly under
- Unix and VMS.) If no matches are found, the specification is
- assumed to be a literal filename; and if that also fails, the
- suffix .zip is appended. Note that self-extracting ZIP files
- are supported, as with any other ZIP archive; just specify the
- .exe suffix (if any) explicitly.
-
- [file(s)]
- An optional list of archive members to be processed, separated
- by spaces. (VMS versions compiled with VMSCLI defined must
- delimit files with commas instead. See -v in OPTIONS below.)
- Regular expressions (wildcards) may be used to match multiple
- members; see above. Again, be sure to quote expressions that
- would otherwise be expanded or modified by the operating system.
-
- [-x xfile(s)]
- An optional list of archive members to be excluded from process-
- ing. Since wildcard characters normally match (`/') directory
- separators (for exceptions see the option -W), this option may
- be used to exclude any files that are in subdirectories. For
- example, ``unzip foo *.[ch] -x */*'' would extract all C source
- files in the main directory, but none in any subdirectories.
- Without the -x option, all C source files in all directories
- within the zipfile would be extracted.
-
- [-d exdir]
- An optional directory to which to extract files. By default,
- all files and subdirectories are recreated in the current direc-
- tory; the -d option allows extraction in an arbitrary directory
- (always assuming one has permission to write to the directory).
- This option need not appear at the end of the command line; it
- is also accepted before the zipfile specification (with the nor-
- mal options), immediately after the zipfile specification, or
- between the file(s) and the -x option. The option and directory
- may be concatenated without any white space between them, but
- note that this may cause normal shell behavior to be suppressed.
- In particular, ``-d ~'' (tilde) is expanded by Unix C shells
- into the name of the user's home directory, but ``-d~'' is
- treated as a literal subdirectory ``~'' of the current direc-
- tory.
-
-OPTIONS
- Note that, in order to support obsolescent hardware, unzip's usage
- screen is limited to 22 or 23 lines and should therefore be considered
- only a reminder of the basic unzip syntax rather than an exhaustive
- list of all possible flags. The exhaustive list follows:
-
- -Z zipinfo(1L) mode. If the first option on the command line is
- -Z, the remaining options are taken to be zipinfo(1L) options.
- See the appropriate manual page for a description of these
- options.
-
- -A [OS/2, Unix DLL] print extended help for the DLL's programming
- interface (API).
-
- -c extract files to stdout/screen (``CRT''). This option is simi-
- lar to the -p option except that the name of each file is
- printed as it is extracted, the -a option is allowed, and ASCII-
- EBCDIC conversion is automatically performed if appropriate.
- This option is not listed in the unzip usage screen.
-
- -f freshen existing files, i.e., extract only those files that
- already exist on disk and that are newer than the disk copies.
- By default unzip queries before overwriting, but the -o option
- may be used to suppress the queries. Note that under many oper-
- ating systems, the TZ (timezone) environment variable must be
- set correctly in order for -f and -u to work properly (under
- Unix the variable is usually set automatically). The reasons
- for this are somewhat subtle but have to do with the differences
- between DOS-format file times (always local time) and Unix-for-
- mat times (always in GMT/UTC) and the necessity to compare the
- two. A typical TZ value is ``PST8PDT'' (US Pacific time with
- automatic adjustment for Daylight Savings Time or ``summer
- time'').
-
- -l list archive files (short format). The names, uncompressed file
- sizes and modification dates and times of the specified files
- are printed, along with totals for all files specified. If
- UnZip was compiled with OS2_EAS defined, the -l option also
- lists columns for the sizes of stored OS/2 extended attributes
- (EAs) and OS/2 access control lists (ACLs). In addition, the
- zipfile comment and individual file comments (if any) are dis-
- played. If a file was archived from a single-case file system
- (for example, the old MS-DOS FAT file system) and the -L option
- was given, the filename is converted to lowercase and is pre-
- fixed with a caret (^).
-
- -p extract files to pipe (stdout). Nothing but the file data is
- sent to stdout, and the files are always extracted in binary
- format, just as they are stored (no conversions).
-
- -t test archive files. This option extracts each specified file in
- memory and compares the CRC (cyclic redundancy check, an
- enhanced checksum) of the expanded file with the original file's
- stored CRC value.
-
- -T [most OSes] set the timestamp on the archive(s) to that of the
- newest file in each one. This corresponds to zip's -go option
- except that it can be used on wildcard zipfiles (e.g., ``unzip
- -T \*.zip'') and is much faster.
-
- -u update existing files and create new ones if needed. This
- option performs the same function as the -f option, extracting
- (with query) files that are newer than those with the same name
- on disk, and in addition it extracts those files that do not
- already exist on disk. See -f above for information on setting
- the timezone properly.
-
- -v list archive files (verbose format) or show diagnostic version
- info. This option has evolved and now behaves as both an option
- and a modifier. As an option it has two purposes: when a zip-
- file is specified with no other options, -v lists archive files
- verbosely, adding to the basic -l info the compression method,
- compressed size, compression ratio and 32-bit CRC. In contrast
- to most of the competing utilities, unzip removes the 12 addi-
- tional header bytes of encrypted entries from the compressed
- size numbers. Therefore, compressed size and compression ratio
- figures are independent of the entry's encryption status and
- show the correct compression performance. (The complete size of
- the encrypted compressed data stream for zipfile entries is
- reported by the more verbose zipinfo(1L) reports, see the sepa-
- rate manual.) When no zipfile is specified (that is, the com-
- plete command is simply ``unzip -v''), a diagnostic screen is
- printed. In addition to the normal header with release date and
- version, unzip lists the home Info-ZIP ftp site and where to
- find a list of other ftp and non-ftp sites; the target operating
- system for which it was compiled, as well as (possibly) the
- hardware on which it was compiled, the compiler and version
- used, and the compilation date; any special compilation options
- that might affect the program's operation (see also DECRYPTION
- below); and any options stored in environment variables that
- might do the same (see ENVIRONMENT OPTIONS below). As a modi-
- fier it works in conjunction with other options (e.g., -t) to
- produce more verbose or debugging output; this is not yet fully
- implemented but will be in future releases.
-
- -z display only the archive comment.
-
-MODIFIERS
- -a convert text files. Ordinarily all files are extracted exactly
- as they are stored (as ``binary'' files). The -a option causes
- files identified by zip as text files (those with the `t' label
- in zipinfo listings, rather than `b') to be automatically
- extracted as such, converting line endings, end-of-file charac-
- ters and the character set itself as necessary. (For example,
- Unix files use line feeds (LFs) for end-of-line (EOL) and have
- no end-of-file (EOF) marker; Macintoshes use carriage returns
- (CRs) for EOLs; and most PC operating systems use CR+LF for EOLs
- and control-Z for EOF. In addition, IBM mainframes and the
- Michigan Terminal System use EBCDIC rather than the more common
- ASCII character set, and NT supports Unicode.) Note that zip's
- identification of text files is by no means perfect; some
- ``text'' files may actually be binary and vice versa. unzip
- therefore prints ``[text]'' or ``[binary]'' as a visual check
- for each file it extracts when using the -a option. The -aa
- option forces all files to be extracted as text, regardless of
- the supposed file type. On VMS, see also -S.
-
- -b [general] treat all files as binary (no text conversions). This
- is a shortcut for ---a.
-
- -b [Tandem] force the creation files with filecode type 180 ('C')
- when extracting Zip entries marked as "text". (On Tandem, -a is
- enabled by default, see above).
-
- -b [VMS] auto-convert binary files (see -a above) to fixed-length,
- 512-byte record format. Doubling the option (-bb) forces all
- files to be extracted in this format. When extracting to stan-
- dard output (-c or -p option in effect), the default conversion
- of text record delimiters is disabled for binary (-b) resp. all
- (-bb) files.
-
- -B [when compiled with UNIXBACKUP defined] save a backup copy of
- each overwritten file. The backup file is gets the name of the
- target file with a tilde and optionally a unique sequence number
- (up to 5 digits) appended. The sequence number is applied when-
- ever another file with the original name plus tilde already
- exists. When used together with the "overwrite all" option -o,
- numbered backup files are never created. In this case, all
- backup files are named as the original file with an appended
- tilde, existing backup files are deleted without notice. This
- feature works similarly to the default behavior of emacs(1) in
- many locations.
-
- Example: the old copy of ``foo'' is renamed to ``foo~''.
-
- Warning: Users should be aware that the -B option does not pre-
- vent loss of existing data under all circumstances. For exam-
- ple, when unzip is run in overwrite-all mode, an existing
- ``foo~'' file is deleted before unzip attempts to rename ``foo''
- to ``foo~''. When this rename attempt fails (because of a file
- locks, insufficient privileges, or ...), the extraction of
- ``foo~'' gets cancelled, but the old backup file is already
- lost. A similar scenario takes place when the sequence number
- range for numbered backup files gets exhausted (99999, or 65535
- for 16-bit systems). In this case, the backup file with the
- maximum sequence number is deleted and replaced by the new
- backup version without notice.
-
- -C use case-insensitive matching for the selection of archive
- entries from the command-line list of extract selection pat-
- terns. unzip's philosophy is ``you get what you ask for'' (this
- is also responsible for the -L/-U change; see the relevant
- options below). Because some file systems are fully case-sensi-
- tive (notably those under the Unix operating system) and because
- both ZIP archives and unzip itself are portable across plat-
- forms, unzip's default behavior is to match both wildcard and
- literal filenames case-sensitively. That is, specifying ``make-
- file'' on the command line will only match ``makefile'' in the
- archive, not ``Makefile'' or ``MAKEFILE'' (and similarly for
- wildcard specifications). Since this does not correspond to the
- behavior of many other operating/file systems (for example, OS/2
- HPFS, which preserves mixed case but is not sensitive to it),
- the -C option may be used to force all filename matches to be
- case-insensitive. In the example above, all three files would
- then match ``makefile'' (or ``make*'', or similar). The -C
- option affects file specs in both the normal file list and the
- excluded-file list (xlist).
-
- Please note that the -C option does neither affect the search
- for the zipfile(s) nor the matching of archive entries to exist-
- ing files on the extraction path. On a case-sensitive file sys-
- tem, unzip will never try to overwrite a file ``FOO'' when
- extracting an entry ``foo''!
-
- -D skip restoration of timestamps for extracted items. Normally,
- unzip tries to restore all meta-information for extracted items
- that are supplied in the Zip archive (and do not require privi-
- leges or impose a security risk). By specifying -D, unzip is
- told to suppress restoration of timestamps for directories
- explicitly created from Zip archive entries. This option only
- applies to ports that support setting timestamps for directories
- (currently ATheOS, BeOS, MacOS, OS/2, Unix, VMS, Win32, for
- other unzip ports, -D has no effect). The duplicated option -DD
- forces suppression of timestamp restoration for all extracted
- entries (files and directories). This option results in setting
- the timestamps for all extracted entries to the current time.
-
- On VMS, the default setting for this option is -D for consis-
- tency with the behaviour of BACKUP: file timestamps are
- restored, timestamps of extracted directories are left at the
- current time. To enable restoration of directory timestamps,
- the negated option --D should be specified. On VMS, the option
- -D disables timestamp restoration for all extracted Zip archive
- items. (Here, a single -D on the command line combines with the
- default -D to do what an explicit -DD does on other systems.)
-
- -E [MacOS only] display contents of MacOS extra field during
- restore operation.
-
- -F [Acorn only] suppress removal of NFS filetype extension from
- stored filenames.
-
- -F [non-Acorn systems supporting long filenames with embedded com-
- mas, and only if compiled with ACORN_FTYPE_NFS defined] trans-
- late filetype information from ACORN RISC OS extra field blocks
- into a NFS filetype extension and append it to the names of the
- extracted files. (When the stored filename appears to already
- have an appended NFS filetype extension, it is replaced by the
- info from the extra field.)
-
- -i [MacOS only] ignore filenames stored in MacOS extra fields.
- Instead, the most compatible filename stored in the generic part
- of the entry's header is used.
-
- -j junk paths. The archive's directory structure is not recreated;
- all files are deposited in the extraction directory (by default,
- the current one).
-
- -J [BeOS only] junk file attributes. The file's BeOS file
- attributes are not restored, just the file's data.
-
- -J [MacOS only] ignore MacOS extra fields. All Macintosh specific
- info is skipped. Data-fork and resource-fork are restored as
- separate files.
-
- -K [AtheOS, BeOS, Unix only] retain SUID/SGID/Tacky file
- attributes. Without this flag, these attribute bits are cleared
- for security reasons.
-
- -L convert to lowercase any filename originating on an uppercase-
- only operating system or file system. (This was unzip's default
- behavior in releases prior to 5.11; the new default behavior is
- identical to the old behavior with the -U option, which is now
- obsolete and will be removed in a future release.) Depending on
- the archiver, files archived under single-case file systems
- (VMS, old MS-DOS FAT, etc.) may be stored as all-uppercase
- names; this can be ugly or inconvenient when extracting to a
- case-preserving file system such as OS/2 HPFS or a case-sensi-
- tive one such as under Unix. By default unzip lists and
- extracts such filenames exactly as they're stored (excepting
- truncation, conversion of unsupported characters, etc.); this
- option causes the names of all files from certain systems to be
- converted to lowercase. The -LL option forces conversion of
- every filename to lowercase, regardless of the originating file
- system.
-
- -M pipe all output through an internal pager similar to the Unix
- more(1) command. At the end of a screenful of output, unzip
- pauses with a ``--More--'' prompt; the next screenful may be
- viewed by pressing the Enter (Return) key or the space bar.
- unzip can be terminated by pressing the ``q'' key and, on some
- systems, the Enter/Return key. Unlike Unix more(1), there is no
- forward-searching or editing capability. Also, unzip doesn't
- notice if long lines wrap at the edge of the screen, effectively
- resulting in the printing of two or more lines and the likeli-
- hood that some text will scroll off the top of the screen before
- being viewed. On some systems the number of available lines on
- the screen is not detected, in which case unzip assumes the
- height is 24 lines.
-
- -n never overwrite existing files. If a file already exists, skip
- the extraction of that file without prompting. By default unzip
- queries before extracting any file that already exists; the user
- may choose to overwrite only the current file, overwrite all
- files, skip extraction of the current file, skip extraction of
- all existing files, or rename the current file.
-
- -N [Amiga] extract file comments as Amiga filenotes. File comments
- are created with the -c option of zip(1L), or with the -N option
- of the Amiga port of zip(1L), which stores filenotes as com-
- ments.
-
- -o overwrite existing files without prompting. This is a dangerous
- option, so use it with care. (It is often used with -f, how-
- ever, and is the only way to overwrite directory EAs under
- OS/2.)
-
- -P password
- use password to decrypt encrypted zipfile entries (if any).
- THIS IS INSECURE! Many multi-user operating systems provide
- ways for any user to see the current command line of any other
- user; even on stand-alone systems there is always the threat of
- over-the-shoulder peeking. Storing the plaintext password as
- part of a command line in an automated script is even worse.
- Whenever possible, use the non-echoing, interactive prompt to
- enter passwords. (And where security is truly important, use
- strong encryption such as Pretty Good Privacy instead of the
- relatively weak encryption provided by standard zipfile utili-
- ties.)
-
- -q perform operations quietly (-qq = even quieter). Ordinarily
- unzip prints the names of the files it's extracting or testing,
- the extraction methods, any file or zipfile comments that may be
- stored in the archive, and possibly a summary when finished with
- each archive. The -q[q] options suppress the printing of some
- or all of these messages.
-
- -s [OS/2, NT, MS-DOS] convert spaces in filenames to underscores.
- Since all PC operating systems allow spaces in filenames, unzip
- by default extracts filenames with spaces intact (e.g.,
- ``EA DATA. SF''). This can be awkward, however, since MS-DOS in
- particular does not gracefully support spaces in filenames.
- Conversion of spaces to underscores can eliminate the awkward-
- ness in some cases.
-
- -S [VMS] convert text files (-a, -aa) into Stream_LF record format,
- instead of the text-file default, variable-length record format.
- (Stream_LF is the default record format of VMS unzip. It is
- applied unless conversion (-a, -aa and/or -b, -bb) is requested
- or a VMS-specific entry is processed.)
-
- -U [UNICODE_SUPPORT only] modify or disable UTF-8 handling. When
- UNICODE_SUPPORT is available, the option -U forces unzip to
- escape all non-ASCII characters from UTF-8 coded filenames as
- ``#Uxxxx'' (for UCS-2 characters, or ``#Lxxxxxx'' for unicode
- codepoints needing 3 octets). This option is mainly provided
- for debugging purpose when the fairly new UTF-8 support is sus-
- pected to mangle up extracted filenames.
-
- The option -UU allows to entirely disable the recognition of
- UTF-8 encoded filenames. The handling of filename codings
- within unzip falls back to the behaviour of previous versions.
-
- [old, obsolete usage] leave filenames uppercase if created under
- MS-DOS, VMS, etc. See -L above.
-
- -V retain (VMS) file version numbers. VMS files can be stored with
- a version number, in the format file.ext;##. By default the
- ``;##'' version numbers are stripped, but this option allows
- them to be retained. (On file systems that limit filenames to
- particularly short lengths, the version numbers may be truncated
- or stripped regardless of this option.)
-
- -W [only when WILD_STOP_AT_DIR compile-time option enabled] modi-
- fies the pattern matching routine so that both `?' (single-char
- wildcard) and `*' (multi-char wildcard) do not match the direc-
- tory separator character `/'. (The two-character sequence
- ``**'' acts as a multi-char wildcard that includes the directory
- separator in its matched characters.) Examples:
-
- "*.c" matches "foo.c" but not "mydir/foo.c"
- "**.c" matches both "foo.c" and "mydir/foo.c"
- "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
- "??*/*" matches "ab/foo" and "abc/foo"
- but not "a/foo" or "a/b/foo"
-
- This modified behaviour is equivalent to the pattern matching
- style used by the shells of some of UnZip's supported target OSs
- (one example is Acorn RISC OS). This option may not be avail-
- able on systems where the Zip archive's internal directory sepa-
- rator character `/' is allowed as regular character in native
- operating system filenames. (Currently, UnZip uses the same
- pattern matching rules for both wildcard zipfile specifications
- and zip entry selection patterns in most ports. For systems
- allowing `/' as regular filename character, the -W option would
- not work as expected on a wildcard zipfile specification.)
-
- -X [VMS, Unix, OS/2, NT, Tandem] restore owner/protection info
- (UICs and ACL entries) under VMS, or user and group info
- (UID/GID) under Unix, or access control lists (ACLs) under cer-
- tain network-enabled versions of OS/2 (Warp Server with IBM LAN
- Server/Requester 3.0 to 5.0; Warp Connect with IBM Peer 1.0), or
- security ACLs under Windows NT. In most cases this will require
- special system privileges, and doubling the option (-XX) under
- NT instructs unzip to use privileges for extraction; but under
- Unix, for example, a user who belongs to several groups can
- restore files owned by any of those groups, as long as the user
- IDs match his or her own. Note that ordinary file attributes
- are always restored--this option applies only to optional, extra
- ownership info available on some operating systems. [NT's
- access control lists do not appear to be especially compatible
- with OS/2's, so no attempt is made at cross-platform portability
- of access privileges. It is not clear under what conditions
- this would ever be useful anyway.]
-
- -Y [VMS] treat archived file name endings of ``.nnn'' (where
- ``nnn'' is a decimal number) as if they were VMS version num-
- bers (``;nnn''). (The default is to treat them as file types.)
- Example:
- "a.b.3" -> "a.b;3".
-
- -$ [MS-DOS, OS/2, NT] restore the volume label if the extraction
- medium is removable (e.g., a diskette). Doubling the option
- (-$$) allows fixed media (hard disks) to be labelled as well.
- By default, volume labels are ignored.
-
- -/ extensions
- [Acorn only] overrides the extension list supplied by Unzip$Ext
- environment variable. During extraction, filename extensions
- that match one of the items in this extension list are swapped
- in front of the base name of the extracted file.
-
- -: [all but Acorn, VM/CMS, MVS, Tandem] allows to extract archive
- members into locations outside of the current `` extraction root
- folder''. For security reasons, unzip normally removes ``parent
- dir'' path components (``../'') from the names of extracted
- file. This safety feature (new for version 5.50) prevents unzip
- from accidentally writing files to ``sensitive'' areas outside
- the active extraction folder tree head. The -: option lets
- unzip switch back to its previous, more liberal behaviour, to
- allow exact extraction of (older) archives that used ``../''
- components to create multiple directory trees at the level of
- the current extraction folder. This option does not enable
- writing explicitly to the root directory (``/''). To achieve
- this, it is necessary to set the extraction target folder to
- root (e.g. -d / ). However, when the -: option is specified, it
- is still possible to implicitly write to the root directory by
- specifying enough ``../'' path components within the zip
- archive. Use this option with extreme caution.
-
- -^ [Unix only] allow control characters in names of extracted ZIP
- archive entries. On Unix, a file name may contain any (8-bit)
- character code with the two exception '/' (directory delimiter)
- and NUL (0x00, the C string termination indicator), unless the
- specific file system has more restrictive conventions. Gener-
- ally, this allows to embed ASCII control characters (or even
- sophisticated control sequences) in file names, at least on
- 'native' Unix file systems. However, it may be highly suspi-
- cious to make use of this Unix "feature". Embedded control
- characters in file names might have nasty side effects when dis-
- played on screen by some listing code without sufficient filter-
- ing. And, for ordinary users, it may be difficult to handle
- such file names (e.g. when trying to specify it for open, copy,
- move, or delete operations). Therefore, unzip applies a filter
- by default that removes potentially dangerous control characters
- from the extracted file names. The -^ option allows to override
- this filter in the rare case that embedded filename control
- characters are to be intentionally restored.
-
- -2 [VMS] force unconditionally conversion of file names to
- ODS2-compatible names. The default is to exploit the destina-
- tion file system, preserving case and extended file name charac-
- ters on an ODS5 destination file system; and applying the
- ODS2-compatibility file name filtering on an ODS2 destination
- file system.
-
-ENVIRONMENT OPTIONS
- unzip's default behavior may be modified via options placed in an envi-
- ronment variable. This can be done with any option, but it is probably
- most useful with the -a, -L, -C, -q, -o, or -n modifiers: make unzip
- auto-convert text files by default, make it convert filenames from
- uppercase systems to lowercase, make it match names case-insensitively,
- make it quieter, or make it always overwrite or never overwrite files
- as it extracts them. For example, to make unzip act as quietly as pos-
- sible, only reporting errors, one would use one of the following com-
- mands:
-
- Unix Bourne shell:
- UNZIP=-qq; export UNZIP
-
- Unix C shell:
- setenv UNZIP -qq
-
- OS/2 or MS-DOS:
- set UNZIP=-qq
-
- VMS (quotes for lowercase):
- define UNZIP_OPTS "-qq"
-
- Environment options are, in effect, considered to be just like any
- other command-line options, except that they are effectively the first
- options on the command line. To override an environment option, one
- may use the ``minus operator'' to remove it. For instance, to override
- one of the quiet-flags in the example above, use the command
-
- unzip --q[other options] zipfile
-
- The first hyphen is the normal switch character, and the second is a
- minus sign, acting on the q option. Thus the effect here is to cancel
- one quantum of quietness. To cancel both quiet flags, two (or more)
- minuses may be used:
-
- unzip -t--q zipfile
- unzip ---qt zipfile
-
- (the two are equivalent). This may seem awkward or confusing, but it
- is reasonably intuitive: just ignore the first hyphen and go from
- there. It is also consistent with the behavior of Unix nice(1).
-
- As suggested by the examples above, the default variable names are
- UNZIP_OPTS for VMS (where the symbol used to install unzip as a foreign
- command would otherwise be confused with the environment variable), and
- UNZIP for all other operating systems. For compatibility with zip(1L),
- UNZIPOPT is also accepted (don't ask). If both UNZIP and UNZIPOPT are
- defined, however, UNZIP takes precedence. unzip's diagnostic option
- (-v with no zipfile name) can be used to check the values of all four
- possible unzip and zipinfo environment variables.
-
- The timezone variable (TZ) should be set according to the local time-
- zone in order for the -f and -u to operate correctly. See the descrip-
- tion of -f above for details. This variable may also be necessary to
- get timestamps of extracted files to be set correctly. The WIN32
- (Win9x/ME/NT4/2K/XP/2K3) port of unzip gets the timezone configuration
- from the registry, assuming it is correctly set in the Control Panel.
- The TZ variable is ignored for this port.
-
-DECRYPTION
- Encrypted archives are fully supported by Info-ZIP software, but due to
- United States export restrictions, de-/encryption support might be dis-
- abled in your compiled binary. However, since spring 2000, US export
- restrictions have been liberated, and our source archives do now
- include full crypt code. In case you need binary distributions with
- crypt support enabled, see the file ``WHERE'' in any Info-ZIP source or
- binary distribution for locations both inside and outside the US.
-
- Some compiled versions of unzip may not support decryption. To check a
- version for crypt support, either attempt to test or extract an
- encrypted archive, or else check unzip's diagnostic screen (see the -v
- option above) for ``[decryption]'' as one of the special compilation
- options.
-
- As noted above, the -P option may be used to supply a password on the
- command line, but at a cost in security. The preferred decryption
- method is simply to extract normally; if a zipfile member is encrypted,
- unzip will prompt for the password without echoing what is typed.
- unzip continues to use the same password as long as it appears to be
- valid, by testing a 12-byte header on each file. The correct password
- will always check out against the header, but there is a 1-in-256
- chance that an incorrect password will as well. (This is a security
- feature of the PKWARE zipfile format; it helps prevent brute-force
- attacks that might otherwise gain a large speed advantage by testing
- only the header.) In the case that an incorrect password is given but
- it passes the header test anyway, either an incorrect CRC will be gen-
- erated for the extracted data or else unzip will fail during the
- extraction because the ``decrypted'' bytes do not constitute a valid
- compressed data stream.
-
- If the first password fails the header check on some file, unzip will
- prompt for another password, and so on until all files are extracted.
- If a password is not known, entering a null password (that is, just a
- carriage return or ``Enter'') is taken as a signal to skip all further
- prompting. Only unencrypted files in the archive(s) will thereafter be
- extracted. (In fact, that's not quite true; older versions of zip(1L)
- and zipcloak(1L) allowed null passwords, so unzip checks each encrypted
- file to see if the null password works. This may result in ``false
- positives'' and extraction errors, as noted above.)
-
- Archives encrypted with 8-bit passwords (for example, passwords with
- accented European characters) may not be portable across systems and/or
- other archivers. This problem stems from the use of multiple encoding
- methods for such characters, including Latin-1 (ISO 8859-1) and OEM
- code page 850. DOS PKZIP 2.04g uses the OEM code page; Windows PKZIP
- 2.50 uses Latin-1 (and is therefore incompatible with DOS PKZIP); Info-
- ZIP uses the OEM code page on DOS, OS/2 and Win3.x ports but ISO coding
- (Latin-1 etc.) everywhere else; and Nico Mak's WinZip 6.x does not
- allow 8-bit passwords at all. UnZip 5.3 (or newer) attempts to use the
- default character set first (e.g., Latin-1), followed by the alternate
- one (e.g., OEM code page) to test passwords. On EBCDIC systems, if
- both of these fail, EBCDIC encoding will be tested as a last resort.
- (EBCDIC is not tested on non-EBCDIC systems, because there are no known
- archivers that encrypt using EBCDIC encoding.) ISO character encodings
- other than Latin-1 are not supported. The new addition of (partially)
- Unicode (resp. UTF-8) support in UnZip 6.0 has not yet been adapted to
- the encryption password handling in unzip. On systems that use UTF-8
- as native character encoding, unzip simply tries decryption with the
- native UTF-8 encoded password; the built-in attempts to check the pass-
- word in translated encoding have not yet been adapted for UTF-8 support
- and will consequently fail.
-
-EXAMPLES
- To use unzip to extract all members of the archive letters.zip into the
- current directory and subdirectories below it, creating any subdirecto-
- ries as necessary:
-
- unzip letters
-
- To extract all members of letters.zip into the current directory only:
-
- unzip -j letters
-
- To test letters.zip, printing only a summary message indicating whether
- the archive is OK or not:
-
- unzip -tq letters
-
- To test all zipfiles in the current directory, printing only the sum-
- maries:
-
- unzip -tq \*.zip
-
- (The backslash before the asterisk is only required if the shell
- expands wildcards, as in Unix; double quotes could have been used
- instead, as in the source examples below.) To extract to standard out-
- put all members of letters.zip whose names end in .tex, auto-converting
- to the local end-of-line convention and piping the output into more(1):
-
- unzip -ca letters \*.tex | more
-
- To extract the binary file paper1.dvi to standard output and pipe it to
- a printing program:
-
- unzip -p articles paper1.dvi | dvips
-
- To extract all FORTRAN and C source files--*.f, *.c, *.h, and Make-
- file--into the /tmp directory:
-
- unzip source.zip "*.[fch]" Makefile -d /tmp
-
- (the double quotes are necessary only in Unix and only if globbing is
- turned on). To extract all FORTRAN and C source files, regardless of
- case (e.g., both *.c and *.C, and any makefile, Makefile, MAKEFILE or
- similar):
-
- unzip -C source.zip "*.[fch]" makefile -d /tmp
-
- To extract any such files but convert any uppercase MS-DOS or VMS names
- to lowercase and convert the line-endings of all of the files to the
- local standard (without respect to any files that might be marked
- ``binary''):
-
- unzip -aaCL source.zip "*.[fch]" makefile -d /tmp
-
- To extract only newer versions of the files already in the current
- directory, without querying (NOTE: be careful of unzipping in one
- timezone a zipfile created in another--ZIP archives other than those
- created by Zip 2.1 or later contain no timezone information, and a
- ``newer'' file from an eastern timezone may, in fact, be older):
-
- unzip -fo sources
-
- To extract newer versions of the files already in the current directory
- and to create any files not already there (same caveat as previous
- example):
-
- unzip -uo sources
-
- To display a diagnostic screen showing which unzip and zipinfo options
- are stored in environment variables, whether decryption support was
- compiled in, the compiler with which unzip was compiled, etc.:
-
- unzip -v
-
- In the last five examples, assume that UNZIP or UNZIP_OPTS is set to
- -q. To do a singly quiet listing:
-
- unzip -l file.zip
-
- To do a doubly quiet listing:
-
- unzip -ql file.zip
-
- (Note that the ``.zip'' is generally not necessary.) To do a standard
- listing:
-
- unzip --ql file.zip
- or
- unzip -l-q file.zip
- or
- unzip -l--q file.zip
- (Extra minuses in options don't hurt.)
-
-TIPS
- The current maintainer, being a lazy sort, finds it very useful to
- define a pair of aliases: tt for ``unzip -tq'' and ii for ``unzip -Z''
- (or ``zipinfo''). One may then simply type ``tt zipfile'' to test an
- archive, something that is worth making a habit of doing. With luck
- unzip will report ``No errors detected in compressed data of zip-
- file.zip,'' after which one may breathe a sigh of relief.
-
- The maintainer also finds it useful to set the UNZIP environment vari-
- able to ``-aL'' and is tempted to add ``-C'' as well. His ZIPINFO
- variable is set to ``-z''.
-
-DIAGNOSTICS
- The exit status (or error level) approximates the exit codes defined by
- PKWARE and takes on the following values, except under VMS:
-
- 0 normal; no errors or warnings detected.
-
- 1 one or more warning errors were encountered, but process-
- ing completed successfully anyway. This includes zip-
- files where one or more files was skipped due to unsup-
- ported compression method or encryption with an unknown
- password.
-
- 2 a generic error in the zipfile format was detected. Pro-
- cessing may have completed successfully anyway; some bro-
- ken zipfiles created by other archivers have simple work-
- arounds.
-
- 3 a severe error in the zipfile format was detected. Pro-
- cessing probably failed immediately.
-
- 4 unzip was unable to allocate memory for one or more
- buffers during program initialization.
-
- 5 unzip was unable to allocate memory or unable to obtain a
- tty to read the decryption password(s).
-
- 6 unzip was unable to allocate memory during decompression
- to disk.
-
- 7 unzip was unable to allocate memory during in-memory
- decompression.
-
- 8 [currently not used]
-
- 9 the specified zipfiles were not found.
-
- 10 invalid options were specified on the command line.
-
- 11 no matching files were found.
-
- 50 the disk is (or was) full during extraction.
-
- 51 the end of the ZIP archive was encountered prematurely.
-
- 80 the user aborted unzip prematurely with control-C (or
- similar)
-
- 81 testing or extraction of one or more files failed due to
- unsupported compression methods or unsupported decryp-
- tion.
-
- 82 no files were found due to bad decryption password(s).
- (If even one file is successfully processed, however, the
- exit status is 1.)
-
- VMS interprets standard Unix (or PC) return values as other, scarier-
- looking things, so unzip instead maps them into VMS-style status codes.
- The current mapping is as follows: 1 (success) for normal exit,
- 0x7fff0001 for warning errors, and (0x7fff000? + 16*nor-
- mal_unzip_exit_status) for all other errors, where the `?' is 2 (error)
- for unzip values 2, 9-11 and 80-82, and 4 (fatal error) for the remain-
- ing ones (3-8, 50, 51). In addition, there is a compilation option to
- expand upon this behavior: defining RETURN_CODES results in a human-
- readable explanation of what the error status means.
-
-BUGS
- Multi-part archives are not yet supported, except in conjunction with
- zip. (All parts must be concatenated together in order, and then ``zip
- -F'' (for zip 2.x) or ``zip -FF'' (for zip 3.x) must be performed on
- the concatenated archive in order to ``fix'' it. Also, zip 3.0 and
- later can combine multi-part (split) archives into a combined single-
- file archive using ``zip -s- inarchive -O outarchive''. See the zip 3
- manual page for more information.) This will definitely be corrected
- in the next major release.
-
- Archives read from standard input are not yet supported, except with
- funzip (and then only the first member of the archive can be
- extracted).
-
- Archives encrypted with 8-bit passwords (e.g., passwords with accented
- European characters) may not be portable across systems and/or other
- archivers. See the discussion in DECRYPTION above.
-
- unzip's -M (``more'') option tries to take into account automatic wrap-
- ping of long lines. However, the code may fail to detect the correct
- wrapping locations. First, TAB characters (and similar control
- sequences) are not taken into account, they are handled as ordinary
- printable characters. Second, depending on the actual system / OS
- port, unzip may not detect the true screen geometry but rather rely on
- "commonly used" default dimensions. The correct handling of tabs would
- require the implementation of a query for the actual tabulator setup on
- the output console.
-
- Dates, times and permissions of stored directories are not restored
- except under Unix. (On Windows NT and successors, timestamps are now
- restored.)
-
- [MS-DOS] When extracting or testing files from an archive on a defec-
- tive floppy diskette, if the ``Fail'' option is chosen from DOS's
- ``Abort, Retry, Fail?'' message, older versions of unzip may hang the
- system, requiring a reboot. This problem appears to be fixed, but con-
- trol-C (or control-Break) can still be used to terminate unzip.
-
- Under DEC Ultrix, unzip would sometimes fail on long zipfiles (bad CRC,
- not always reproducible). This was apparently due either to a hardware
- bug (cache memory) or an operating system bug (improper handling of
- page faults?). Since Ultrix has been abandoned in favor of Digital
- Unix (OSF/1), this may not be an issue anymore.
-
- [Unix] Unix special files such as FIFO buffers (named pipes), block
- devices and character devices are not restored even if they are somehow
- represented in the zipfile, nor are hard-linked files relinked. Basi-
- cally the only file types restored by unzip are regular files, directo-
- ries and symbolic (soft) links.
-
- [OS/2] Extended attributes for existing directories are only updated if
- the -o (``overwrite all'') option is given. This is a limitation of
- the operating system; because directories only have a creation time
- associated with them, unzip has no way to determine whether the stored
- attributes are newer or older than those on disk. In practice this may
- mean a two-pass approach is required: first unpack the archive nor-
- mally (with or without freshening/updating existing files), then
- overwrite just the directory entries (e.g., ``unzip -o foo */'').
-
- [VMS] When extracting to another directory, only the [.foo] syntax is
- accepted for the -d option; the simple Unix foo syntax is silently
- ignored (as is the less common VMS foo.dir syntax).
-
- [VMS] When the file being extracted already exists, unzip's query only
- allows skipping, overwriting or renaming; there should additionally be
- a choice for creating a new version of the file. In fact, the ``over-
- write'' choice does create a new version; the old version is not over-
- written or deleted.
-
-SEE ALSO
- funzip(1L), zip(1L), zipcloak(1L), zipgrep(1L), zipinfo(1L), zip-
- note(1L), zipsplit(1L)
-
-URL
- The Info-ZIP home page is currently at
- http://www.info-zip.org/pub/infozip/
- or
- ftp://ftp.info-zip.org/pub/infozip/ .
-
-AUTHORS
- The primary Info-ZIP authors (current semi-active members of the Zip-
- Bugs workgroup) are: Ed Gordon (Zip, general maintenance, shared code,
- Zip64, Win32, Unix, Unicode); Christian Spieler (UnZip maintenance
- coordination, VMS, MS-DOS, Win32, shared code, general Zip and UnZip
- integration and optimization); Onno van der Linden (Zip); Mike White
- (Win32, Windows GUI, Windows DLLs); Kai Uwe Rommel (OS/2, Win32);
- Steven M. Schweda (VMS, Unix, support of new features); Paul Kienitz
- (Amiga, Win32, Unicode); Chris Herborth (BeOS, QNX, Atari); Jonathan
- Hudson (SMS/QDOS); Sergio Monesi (Acorn RISC OS); Harald Denker (Atari,
- MVS); John Bush (Solaris, Amiga); Hunter Goatley (VMS, Info-ZIP Site
- maintenance); Steve Salisbury (Win32); Steve Miller (Windows CE GUI),
- Johnny Lee (MS-DOS, Win32, Zip64); and Dave Smith (Tandem NSK).
-
- The following people were former members of the Info-ZIP development
- group and provided major contributions to key parts of the current
- code: Greg ``Cave Newt'' Roelofs (UnZip, unshrink decompression); Jean-
- loup Gailly (deflate compression); Mark Adler (inflate decompression,
- fUnZip).
-
- The author of the original unzip code upon which Info-ZIP's was based
- is Samuel H. Smith; Carl Mascott did the first Unix port; and David P.
- Kirschbaum organized and led Info-ZIP in its early days with Keith
- Petersen hosting the original mailing list at WSMR-SimTel20. The full
- list of contributors to UnZip has grown quite large; please refer to
- the CONTRIBS file in the UnZip source distribution for a relatively
- complete version.
-
-VERSIONS
- v1.2 15 Mar 89 Samuel H. Smith
- v2.0 9 Sep 89 Samuel H. Smith
- v2.x fall 1989 many Usenet contributors
- v3.0 1 May 90 Info-ZIP (DPK, consolidator)
- v3.1 15 Aug 90 Info-ZIP (DPK, consolidator)
- v4.0 1 Dec 90 Info-ZIP (GRR, maintainer)
- v4.1 12 May 91 Info-ZIP
- v4.2 20 Mar 92 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.0 21 Aug 92 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.01 15 Jan 93 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.1 7 Feb 94 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.11 2 Aug 94 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.12 28 Aug 94 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.2 30 Apr 96 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.3 22 Apr 97 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.31 31 May 97 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.32 3 Nov 97 Info-ZIP (Zip-Bugs subgroup, GRR)
- v5.4 28 Nov 98 Info-ZIP (Zip-Bugs subgroup, SPC)
- v5.41 16 Apr 00 Info-ZIP (Zip-Bugs subgroup, SPC)
- v5.42 14 Jan 01 Info-ZIP (Zip-Bugs subgroup, SPC)
- v5.5 17 Feb 02 Info-ZIP (Zip-Bugs subgroup, SPC)
- v5.51 22 May 04 Info-ZIP (Zip-Bugs subgroup, SPC)
- v5.52 28 Feb 05 Info-ZIP (Zip-Bugs subgroup, SPC)
- v6.0 20 Apr 09 Info-ZIP (Zip-Bugs subgroup, SPC)
-
-Info-ZIP 20 April 2009 (v6.0) UNZIP(1L)
--- /dev/null
+UnZip 6.10a
+
+We have posted UnZip Beta 6.10a, August 23rd 2010. This is a beta
+release and considerable additional work is planned before UnZip 6.10 is
+released. See the file History.610 for development details of what's in
+this beta.
+
+As always, send in your feature suggestions and bug reports as they may
+influence development of UnZip 6.10.
+
+Quick list of major changes in UnZip 6.10a:
+
+- Ported new Zip command parser that supports long options, such as
+ --license.
+- As result of new parser, option negation now uses trailing "-" instead
+ of leading "-". So -B turns on the new UNIX backup option and -B-
+ turns it off. Negation also works on long options, such as --backup-
+ to turn the backup option off. Also, multiple levels of negation
+ (such as ----q in UnZip 6.00) are currently no longer supported.
+- New option --options lists all available options.
+- New option --commandline shows the input command line as processed,
+ and exits.
+- New --license option lists the license. This allows distribution of
+ UnZip 6.10 without additional documentation.
+- Minor updates to zipgrep.
+- Preliminary support for AppleDouble storage of resource information on
+ Macintosh (Mac OS X).
+- Added new "VMS symlinks are working" check.
+- Additional system information reported using -v option.
+- Additional control of UID/GID and SGID restore.
+- VMS verbose report and update of VMS notes.
+- VMS return code updates.
+- File name checks now use wide character checks to find non-printing
+ characters to display as '?'. This should fix a bug where '?' was
+ being displayed for parts of multi-byte characters.
+- File INSTALL with installation procedures updated.
+- Add ZipInfo -C option.
+- Replace VMS /[NO]CASE_INSENSITIVE with /CASE_MATCH.
+- Fix compile problems when using ZLIB with funzip.
+- Fix problems using SFX and ZLIB or BZIP2.
+
+As always, see the UnZip manual page, the extended help in UnZip
+("unzip -hh"), and any relevant OS-specific documentation for details on
+what UnZip has and how to use all features.
+
+Enjoy!
--- /dev/null
+UnZip 6.10b
+
+Announcement for UnZip Beta 6.10b, December 10th 2010. This is a beta
+release and considerable additional work is planned before UnZip 6.10 is
+released. See the file History.610 for development details of what's in
+this beta.
+
+As always, send in your feature suggestions and bug reports as they may
+influence development of UnZip 6.10.
+
+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.
+ 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
+ compiler define. Suggestions welcome on how to improve this limited
+ character translation support.
+- Various cleanup of VMS and Unicode code.
+- Better handling of the PKWare verification bit.
+- Fix bug in DLL code that prevented compiling.
+- Minor updates to the VB6 example code showing use of the DLL.
+- Implement Acorn port changes based on patch provided by J.L. that
+ updates the port to use current compilers, increases allowed file path
+ lengths to 1024 characters, adds directory attributes support, and
+ updates documentation.
+
+As always, see the UnZip manual page, the extended help in UnZip
+("unzip -hh"), and any relevant OS-specific documentation for details on
+what UnZip has and how to use all features.
+
+Enjoy!
--- /dev/null
+UnZip 6.10c
+
+Announcement for UnZip Beta 6.10c, >>25 Feb 2014. This is a beta
+release. Changes may be made before UnZip 6.10 is released. See the
+file History.610 for development details of changes in this beta
+release.
+
+Complaints and suggestions regarding this beta release can help to
+improve the next full release.
+
+Quick list of major changes in UnZip 6.10c (See INSTALL and README for
+details):
+
+- New command-line parser (like that in Zip 3.0) allows long ("--xxx")
+ and two-character short ("-yy") options. Options are now negated by a
+ trailing hyphen. See extended help and manual for details.
+- Optional support for WinZip-compatible AES encryption (compression
+ method 99).
+- Optional support for LZMA (method 14) and PPMd (method 98)
+ compression.
+- Behavior change: Now, by default, date-time information is restored on
+ extracted files only, not on created directories. See option
+ -D/--dir-timestamps.
+- Behavior change: Now, by default, permission/protection information is
+ restored on Unix(-like) and VMS systems, but limited by the user's
+ Unix umask or VMS default protection. See option
+ -k/--keep-permissions, below.
+- Behavior change: ZipInfo report format changes (minor).
+- Behavior change: Now, on Unix(-like) and VMS systems,
+ -X/--restore-owner (/RESTORE = OWNER) controls only restoration of
+ Unix UID/GID or VMS UIC.
+- Behavior change: Apparent VMS version numbers (";ddd", where "ddd" is
+ a decimal number) are now stripped by default only on files which were
+ archived on a VMS system. A Unix file named, for example, "fred;123"
+ 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.
+ 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
+ top-level directory.
+- Extended -j/--junk-dirs option accepts an optional value, the number
+ of directory levels to discard.
+- New --jar option may help with poorly formed Java "jar" archives.
+- New -k/--keep-permissions option controls how permissions are restored
+ on Unix and VMS systems. The default behavior has changed to apply
+ Unix umask or VMS default protection to the archive permissions. With
+ -k, the archive permissions are restored, ignoring the Unix umask or
+ VMS default protection (the old default behavior). With -k-, the
+ archive permissions are ignored, and the Unix umask or VMS default
+ protection determines the permissions.
+- New -ka/--keep-acl option controls ACL restoration on VMS. Now
+ -X/--restore-owner controls restoration of only ownership (UIC),
+ independent of ACLs.
+- New --license option shows the software license.
+- -s/--space-to-uscore should now work on most system types.
+- Revised documentation ("man", VMS help, ...).
+- fUnZip should support Zip64 (large-file) format extensions, and it
+ should skip directories at the beginning of an archive, instead of
+ doing nothing when the first archive member is not a file.
+- zipgrep should accept (up to four) long-form options (--option) to
+ help GNU grep users.
+- Optional support on Unix and VMS for an UnZip object library,
+ providing a callable UnZip interface for a user-written program.
+- New user-triggered progress messages on Unix (SIGUSR1) and VMS
+ (Ctrl/T).
+- New C macro ICONV_MAPPING replaces the recently added
+ USE_ICONV_MAPPING.
+- Revised Unix builders now use "CC=gcc" with target "generic", instead
+ of old target "generic_gcc".
+- Support for AppleDouble storage of attribute/resource information on
+ Mac OS X systems, with options to control restoration of extended
+ attributes.
+- VMS CLI changes: New /CASE_MATCH is gone. Old /[NO]CASE_INSENSITIVE
+ is back, but deprecated, replaced by /MATCH=CASE={BLIND|SENSITIVE}.
+ When built with WILD_STOP_AT_DIR defined, /MATCH=[NO]WILD_MATCH_SLASH
+ (-W) controls how wildcards match "/" separators in archive member
+ names. /JUNK_DIRS (-j) now accepts an optional value, the number of
+ directory levels to discard. New /LICENSE (--license) option. New
+ /NAMES=[NO]DOWNCASE replaces old, deprecated /[NO]LOWERCASE and
+ /[NO]UPPERCASE. New /NAMES=ODS2 replaces old, deprecated /ODS2. New
+ /NAMES=[NO]SPACES (-s) controls conversion of " " to "_" on ODS5
+ destination. New /EXISTING={NEW_VERSION|OVERWRITE|NOEXTRACT} option
+ replaces old, deprecated /[NO]OVERWRITE. New /[NO]DECIMAL_TIME
+ replaces old, deprecated /[NO]TIMES. New /RESTORE = ACL
+ (-ka/--keep-acl) option controls whether ACLs are restored. New
+ /RESTORE = OWNER (-X/--restore-owner) option controls whether UICs are
+ restored. New /RESTORE = [NO]PROTECTION = {LIMITED|ORIGINAL}
+ (-k/--keep-permissions) option controls whether/how permissions are
+ restored. With LIMITED (the default), the default protection is
+ applied to the archive permissions. With ORIGINAL, the default
+ protection is ignored, and the archive permissions are used. (This is
+ the old default behavior.) With NOPROTECTION, archive permissions are
+ ignored, and the default protection is used. New
+ /[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.
+ 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
+ example code in unzipstb.c.
+
+As always, see the UnZip manual page, the extended help in UnZip
+("unzip -hh"), and any relevant OS-specific documentation for details on
+UnZip features, limitations, and usage.
+++ /dev/null
-UNZIPSFX(1L) UNZIPSFX(1L)
-
-NAME
- unzipsfx - self-extracting stub for prepending to ZIP archives
-
-SYNOPSIS
- <name of unzipsfx+archive combo> [-cfptuz[ajnoqsCLV$]] [file(s) ...
- [-x xfile(s) ...]]
-
-DESCRIPTION
- unzipsfx is a modified version of unzip(1L) designed to be prepended to
- existing ZIP archives in order to form self-extracting archives.
- Instead of taking its first non-flag argument to be the zipfile(s) to
- be extracted, unzipsfx seeks itself under the name by which it was
- invoked and tests or extracts the contents of the appended archive.
- Because the executable stub adds bulk to the archive (the whole purpose
- of which is to be as small as possible), a number of the less-vital
- capabilities in regular unzip have been removed. Among these are the
- usage (or help) screen, the listing and diagnostic functions (-l and
- -v), the ability to decompress older compression formats (the
- ``reduce,'' ``shrink'' and ``implode'' methods). The ability to
- extract to a directory other than the current one can be selected as a
- compile-time option, which is now enabled by default since UnZipSFX
- version 5.5. Similarly, decryption is supported as a compile-time
- option but should be avoided unless the attached archive contains
- encrypted files. Starting with release 5.5, another compile-time option
- adds a simple ``run command after extraction'' feature. This feature
- is currently incompatible with the ``extract to different directory''
- feature and remains disabled by default.
-
- Note that self-extracting archives made with unzipsfx are no more (or
- less) portable across different operating systems than is the unzip
- executable itself. In general a self-extracting archive made on a par-
- ticular Unix system, for example, will only self-extract under the same
- flavor of Unix. Regular unzip may still be used to extract the embed-
- ded archive as with any normal zipfile, although it will generate a
- harmless warning about extra bytes at the beginning of the zipfile.
- Despite this, however, the self-extracting archive is technically not a
- valid ZIP archive, and PKUNZIP may be unable to test or extract it.
- This limitation is due to the simplistic manner in which the archive is
- created; the internal directory structure is not updated to reflect the
- extra bytes prepended to the original zipfile.
-
-ARGUMENTS
- [file(s)]
- An optional list of archive members to be processed. Regular
- expressions (wildcards) similar to those in Unix egrep(1) may be
- used to match multiple members. These wildcards may contain:
-
- * matches a sequence of 0 or more characters
-
- ? matches exactly 1 character
-
- [...] matches any single character found inside the brackets;
- ranges are 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 except the characters inside the
- brackets is considered a match).
-
- (Be sure to quote any character that might otherwise be inter-
- preted or modified by the operating system, particularly under
- Unix and VMS.)
-
- [-x xfile(s)]
- An optional list of archive members to be excluded from process-
- ing. Since wildcard characters match directory separators
- (`/'), this option may be used to exclude any files that are in
- subdirectories. For example, ``foosfx *.[ch] -x */*'' would
- extract all C source files in the main directory, but none in
- any subdirectories. Without the -x option, all C source files
- in all directories within the zipfile would be extracted.
-
- If unzipsfx is compiled with SFX_EXDIR defined, the following option is
- also enabled:
-
- [-d exdir]
- An optional directory to which to extract files. By default,
- all files and subdirectories are recreated in the current direc-
- tory; the -d option allows extraction in an arbitrary directory
- (always assuming one has permission to write to the directory).
- The option and directory may be concatenated without any white
- space between them, but note that this may cause normal shell
- behavior to be suppressed. In particular, ``-d ~'' (tilde) is
- expanded by Unix C shells into the name of the user's home
- directory, but ``-d~'' is treated as a literal subdirectory
- ``~'' of the current directory.
-
-OPTIONS
- unzipsfx supports the following unzip(1L) options: -c and -p (extract
- to standard output/screen), -f and -u (freshen and update existing
- files upon extraction), -t (test archive) and -z (print archive com-
- ment). All normal listing options (-l, -v and -Z) have been removed,
- but the testing option (-t) may be used as a ``poor man's'' listing.
- Alternatively, those creating self-extracting archives may wish to
- include a short listing in the zipfile comment.
-
- See unzip(1L) for a more complete description of these options.
-
-MODIFIERS
- unzipsfx currently supports all unzip(1L) modifiers: -a (convert text
- files), -n (never overwrite), -o (overwrite without prompting), -q
- (operate quietly), -C (match names case-insensitively), -L (convert
- uppercase-OS names to lowercase), -j (junk paths) and -V (retain ver-
- sion numbers); plus the following operating-system specific options:
- -X (restore VMS owner/protection info), -s (convert spaces in filenames
- to underscores [DOS, OS/2, NT]) and -$ (restore volume label [DOS,
- OS/2, NT, Amiga]).
-
- (Support for regular ASCII text-conversion may be removed in future
- versions, since it is simple enough for the archive's creator to ensure
- that text files have the appropriate format for the local OS. EBCDIC
- conversion will of course continue to be supported since the zipfile
- format implies ASCII storage of text files.)
-
- See unzip(1L) for a more complete description of these modifiers.
-
-ENVIRONMENT OPTIONS
- unzipsfx uses the same environment variables as unzip(1L) does,
- although this is likely to be an issue only for the person creating and
- testing the self-extracting archive. See unzip(1L) for details.
-
-DECRYPTION
- Decryption is supported exactly as in unzip(1L); that is, interactively
- with a non-echoing prompt for the password(s). See unzip(1L) for
- details. Once again, note that if the archive has no encrypted files
- there is no reason to use a version of unzipsfx with decryption sup-
- port; that only adds to the size of the archive.
-
-AUTORUN COMMAND
- When unzipsfx was compiled with CHEAP_SFX_AUTORUN defined, a simple
- ``command autorun'' feature is supported. You may enter a command into
- the Zip archive comment, using the following format:
-
- $AUTORUN$>[command line string]
-
- When unzipsfx recognizes the ``$AUTORUN$>'' token at the beginning of
- the Zip archive comment, the remainder of the first line of the comment
- (until the first newline character) is passed as a shell command to the
- operating system using the C rtl ``system'' function. Before executing
- the command, unzipsfx displays the command on the console and prompts
- the user for confirmation. When the user has switched off prompting by
- specifying the -q option, autorun commands are never executed.
-
- In case the archive comment contains additional lines of text, the
- remainder of the archive comment following the first line is displayed
- normally, unless quiet operation was requested by supplying a -q
- option.
-
-EXAMPLES
- To create a self-extracting archive letters from a regular zipfile let-
- ters.zip and change the new archive's permissions to be world-exe-
- cutable under Unix:
-
- cat unzipsfx letters.zip > letters
- chmod 755 letters
- zip -A letters
-
- To create the same archive under MS-DOS, OS/2 or NT (note the use of
- the /b [binary] option to the copy command):
-
- copy /b unzipsfx.exe+letters.zip letters.exe
- zip -A letters.exe
-
- Under VMS:
-
- copy unzipsfx.exe,letters.zip letters.exe
- letters == "$currentdisk:[currentdir]letters.exe"
- zip -A letters.exe
-
- (The VMS append command may also be used. The second command installs
- the new program as a ``foreign command'' capable of taking arguments.
- The third line assumes that Zip is already installed as a foreign com-
- mand.) Under AmigaDOS:
-
- MakeSFX letters letters.zip UnZipSFX
-
- (MakeSFX is included with the UnZip source distribution and with Amiga
- binary distributions. ``zip -A'' doesn't work on Amiga self-extracting
- archives.) To test (or list) the newly created self-extracting
- archive:
-
- letters -t
-
- To test letters quietly, printing only a summary message indicating
- whether the archive is OK or not:
-
- letters -tqq
-
- To extract the complete contents into the current directory, recreating
- all files and subdirectories as necessary:
-
- letters
-
- To extract all *.txt files (in Unix quote the `*'):
-
- letters *.txt
-
- To extract everything except the *.txt files:
-
- letters -x *.txt
-
- To extract only the README file to standard output (the screen):
-
- letters -c README
-
- To print only the zipfile comment:
-
- letters -z
-
-LIMITATIONS
- The principle and fundamental limitation of unzipsfx is that it is not
- portable across architectures or operating systems, and therefore nei-
- ther are the resulting archives. For some architectures there is lim-
- ited portability, however (e.g., between some flavors of Intel-based
- Unix).
-
- Another problem with the current implementation is that any archive
- with ``junk'' prepended to the beginning technically is no longer a
- zipfile (unless zip(1) is used to adjust the zipfile offsets appropri-
- ately, as noted above). unzip(1) takes note of the prepended bytes and
- ignores them since some file-transfer protocols, notably MacBinary, are
- also known to prepend junk. But PKWARE's archiver suite may not be
- able to deal with the modified archive unless its offsets have been
- adjusted.
-
- unzipsfx has no knowledge of the user's PATH, so in general an archive
- must either be in the current directory when it is invoked, or else a
- full or relative path must be given. If a user attempts to extract the
- archive from a directory in the PATH other than the current one,
- unzipsfx will print a warning to the effect, ``can't find myself.''
- This is always true under Unix and may be true in some cases under MS-
- DOS, depending on the compiler used (Microsoft C fully qualifies the
- program name, but other compilers may not). Under OS/2 and NT there
- are operating-system calls available that provide the full path name,
- so the archive may be invoked from anywhere in the user's path. The
- situation is not known for AmigaDOS, Atari TOS, MacOS, etc.
-
- As noted above, a number of the normal unzip(1L) functions have been
- removed in order to make unzipsfx smaller: usage and diagnostic info,
- listing functions and extraction to other directories. Also, only
- stored and deflated files are supported. The latter limitation is
- mainly relevant to those who create SFX archives, however.
-
- VMS users must know how to set up self-extracting archives as foreign
- commands in order to use any of unzipsfx's options. This is not neces-
- sary for simple extraction, but the command to do so then becomes,
- e.g., ``run letters'' (to continue the examples given above).
-
- unzipsfx on the Amiga requires the use of a special program, MakeSFX,
- in order to create working self-extracting archives; simple concatena-
- tion does not work. (For technically oriented users, the attached
- archive is defined as a ``debug hunk.'') There may be compatibility
- problems between the ROM levels of older Amigas and newer ones.
-
- All current bugs in unzip(1L) exist in unzipsfx as well.
-
-DIAGNOSTICS
- unzipsfx's exit status (error level) is identical to that of unzip(1L);
- see the corresponding man page.
-
-SEE ALSO
- funzip(1L), unzip(1L), zip(1L), zipcloak(1L), zipgrep(1L), zipinfo(1L),
- zipnote(1L), zipsplit(1L)
-
-URL
- The Info-ZIP home page is currently at
- http://www.info-zip.org/pub/infozip/
- or
- ftp://ftp.info-zip.org/pub/infozip/ .
-
-AUTHORS
- Greg Roelofs was responsible for the basic modifications to UnZip nec-
- essary to create UnZipSFX. See unzip(1L) for the current list of Zip-
- Bugs authors, or the file CONTRIBS in the UnZip source distribution for
- the full list of Info-ZIP contributors.
-
-Info-ZIP 20 April 2009 (v6.0) UNZIPSFX(1L)
+++ /dev/null
-/*
- Copyright (c) 1990-2009 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.
- If, for some reason, all these files are missing, the Info-ZIP license
- also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
-*/
-/*---------------------------------------------------------------------------
-
- unzipstb.c
-
- Simple stub function for UnZip DLL (or shared library, whatever); does
- exactly the same thing as normal UnZip, except for additional printf()s
- of various version numbers, solely as a demonstration of what can/should
- be checked when using the DLL. (If major version numbers ever differ,
- assume program is incompatible with DLL--especially if DLL version is
- older. This is not likely to be a problem with *this* simple program,
- but most user programs will be much more complex.)
-
- ---------------------------------------------------------------------------*/
-
-#include <stdio.h>
-#include "unzip.h"
-#if defined(MODERN) && !defined(NO_STDDEF_H)
-# include <stddef.h>
-#endif
-#include "unzvers.h"
-
-int main(int argc, char *argv[])
-{
- static ZCONST UzpVer *pVersion; /* no pervert jokes, please... */
-
- pVersion = UzpVersion();
-
- printf("UnZip stub: checking version numbers (DLL is dated %s)\n",
- pVersion->date);
- printf(" UnZip versions: expecting %u.%u%u, using %u.%u%u%s\n",
- UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, pVersion->unzip.major,
- pVersion->unzip.minor, pVersion->unzip.patchlevel, pVersion->betalevel);
- printf(" ZipInfo versions: expecting %u.%u%u, using %u.%u%u\n",
- ZI_MAJORVER, ZI_MINORVER, UZ_PATCHLEVEL, pVersion->zipinfo.major,
- pVersion->zipinfo.minor, pVersion->zipinfo.patchlevel);
-
-/*
- D2_M*VER and os2dll.* are obsolete, though retained for compatibility:
-
- printf(" OS2 DLL versions: expecting %u.%u%u, using %u.%u%u\n",
- D2_MAJORVER, D2_MINORVER, D2_PATCHLEVEL, pVersion->os2dll.major,
- pVersion->os2dll.minor, pVersion->os2dll.patchlevel);
- */
-
- if (pVersion->flag & 2)
- printf(" using zlib version %s\n", pVersion->zlib_version);
-
- /* This example code only uses the dll calls UzpVersion() and
- * UzpMain(). The APIs for these two calls have maintained backward
- * compatibility since at least the UnZip release 5.3 !
- */
-# define UZDLL_MINVERS_MAJOR 5
-# define UZDLL_MINVERS_MINOR 3
-# define UZDLL_MINVERS_PATCHLEVEL 0
- /* This UnZip DLL stub requires a DLL version of at least: */
- if ( (pVersion->unzip.major < UZDLL_MINVERS_MAJOR) ||
- ((pVersion->unzip.major == UZDLL_MINVERS_MAJOR) &&
- ((pVersion->unzip.minor < UZDLL_MINVERS_MINOR) ||
- ((pVersion->unzip.minor == UZDLL_MINVERS_MINOR) &&
- (pVersion->unzip.patchlevel < UZDLL_MINVERS_PATCHLEVEL)
- )
- )
- ) )
- {
- printf(" aborting because of too old UnZip DLL version!\n");
- return -1;
- }
-
- /* In case the offsetof() macro is not supported by some C compiler
- environment, it might be replaced by something like:
- ((extent)(void *)&(((UzpVer *)0)->dllapimin))
- */
- if (pVersion->structlen >=
-#if defined(MODERN) && !defined(NO_STDDEF_H)
- ( offsetof(UzpVer, dllapimin)
-#else
- ((unsigned)&(((UzpVer *)0)->dllapimin))
-#endif
- + sizeof(_version_type) ))
- {
-#ifdef OS2DLL
-# define UZ_API_COMP_MAJOR UZ_OS2API_COMP_MAJOR
-# define UZ_API_COMP_MINOR UZ_OS2API_COMP_MINOR
-# define UZ_API_COMP_REVIS UZ_OS2API_COMP_REVIS
-#else /* !OS2DLL */
-#ifdef WINDLL
-# define UZ_API_COMP_MAJOR UZ_WINAPI_COMP_MAJOR
-# define UZ_API_COMP_MINOR UZ_WINAPI_COMP_MINOR
-# define UZ_API_COMP_REVIS UZ_WINAPI_COMP_REVIS
-#else /* !WINDLL */
-# define UZ_API_COMP_MAJOR UZ_GENAPI_COMP_MAJOR
-# define UZ_API_COMP_MINOR UZ_GENAPI_COMP_MINOR
-# define UZ_API_COMP_REVIS UZ_GENAPI_COMP_REVIS
-#endif /* ?WINDLL */
-#endif /* ?OS2DLL */
- printf(
- " UnZip API version: can handle <= %u.%u%u, DLL supplies %u.%u%u\n",
- UZ_API_COMP_MAJOR, UZ_API_COMP_MINOR, UZ_API_COMP_REVIS,
- pVersion->dllapimin.major, pVersion->dllapimin.minor,
- pVersion->dllapimin.patchlevel);
- if ( (pVersion->dllapimin.major > UZ_API_COMP_MAJOR) ||
- ((pVersion->dllapimin.major == UZ_API_COMP_MAJOR) &&
- ((pVersion->dllapimin.minor > UZ_API_COMP_MINOR) ||
- ((pVersion->dllapimin.minor == UZ_API_COMP_MINOR) &&
- (pVersion->dllapimin.patchlevel > UZ_API_COMP_REVIS)
- )
- )
- ) )
- {
- printf(" aborting because of unsupported dll api version!\n");
- return -1;
- }
- }
- printf("\n");
-
- /* call the actual UnZip routine (string-arguments version) */
- return UzpMain(argc, argv);
-}
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
---------------------------------------------------------------------------*/
+/* It has been proposed to replace unzpriv.h by zip-like tailor.h and tree of
+ PORT/osdep.h headers.
+ - This is a result of the effort to synchronize/rationalize the build
+ systems (such as unix/Makefile and unix/configure).
+ - This will ensure that customization is as close as possible between Zip
+ and UnZip.
+ - This in turn will make it much easier to safely share code between the
+ Zip and UnZip source trees.
+ This might get done in the next beta. */
#ifndef __unzpriv_h /* prevent multiple inclusions */
#define __unzpriv_h
# ifdef SFX /* fUnZip is NOT the sfx stub! */
# undef SFX
# endif
-# ifdef USE_BZIP2 /* fUnZip does not support bzip2 decompression */
-# undef USE_BZIP2
-# endif
+# ifdef BZIP2_SUPPORT /* fUnZip does not support bzip2 decompression */
+# undef BZIP2_SUPPORT
+# endif /* def BZIP2_SUPPORT */
#endif
#if (defined(USE_ZLIB) && !defined(HAVE_ZL_INFLAT64) && !defined(NO_DEFLATE64))
#ifdef NO_DEFLATE64
/* disable support for Deflate64(tm) */
-# ifdef USE_DEFLATE64
-# undef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
+# undef DEFLATE64_SUPPORT
# endif
#else
/* enable Deflate64(tm) support unless compiling for SFX stub */
-# if (!defined(USE_DEFLATE64) && !defined(SFX))
-# define USE_DEFLATE64
+# if (!defined(DEFLATE64_SUPPORT) && !defined(SFX))
+# define DEFLATE64_SUPPORT
# endif
#endif
-/* disable bzip2 support for SFX stub, unless explicitly requested */
-#if (defined(SFX) && !defined(BZIP2_SFX) && defined(USE_BZIP2))
-# undef USE_BZIP2
+/* Enable Deflate support, unless SFX and explicitly disabled. */
+#if !(defined( SFX) && defined( NO_DEFLATE_SFX))
+# define DEFLATE_SUPPORT
+#endif
+
+/* Disable AES_WG support for SFX stub, unless explicitly requested. */
+#if (defined(SFX) && !defined(CRYPT_AES_WG_SFX) && defined(CRYPT_AES_WG))
+# undef CRYPT_AES_WG
+#endif
+
+/* Encryption rules.
+ *
+ * User-specified macros:
+ * CRYPT_AES_WG, CRYPT_AES_WG_SFX, CRYPT_TRAD_SFX, NO_CRYPT, NO_CRYPT_TRAD.
+ *
+ * Macros used in code: IZ_CRYPT_AES_WG, IZ_CRYPT_ANY, IZ_CRYPT_TRAD.
+ *
+ * By default, in normal UnZip, enable Traditional, disable AES_WG.
+ * NO_CRYPT disables all.
+ * NO_CRYPT_TRAD disables Traditional.
+ * CRYPT_TRAD_SFX (and not NO_CRYPT_TRAD) enables Traditional in UnZipSFX.
+ * CRYPT_AES_WG enables AES_WG in normal UnZip.
+ * CRYPT_AES_WG_SFX (and CRYPT_AES_WG) enables AES_WG in UnZipSFX.
+ */
+
+# ifdef NO_CRYPT
+ /* Disable all encryption. */
+# undef IZ_CRYPT_AES_WG
+# undef IZ_CRYPT_TRAD
+# else /* def NO_CRYPT */
+ /* Enable some kind of encryption. */
+# ifdef NO_CRYPT_TRAD
+ /* Disable Traditional encryption. */
+# undef IZ_CRYPT_TRAD
+# else /* def NO_CRYPT_TRAD */
+ /* Enable Traditional encryption? */
+# ifdef SFX
+# ifdef CRYPT_TRAD_SFX
+ /* UnZipSFX, and user requested Traditional encryption in UnZipSFX. */
+# define IZ_CRYPT_TRAD 1
+# endif /* def CRYPT_TRAD_SFX */
+# else /* def CRYPT_TRAD_SFX */
+ /* Normal UnZip, so default to Traditional encryption. */
+# define IZ_CRYPT_TRAD 1
+# endif /* def CRYPT_TRAD_SFX [else] */
+# endif /* def NO_CRYPT_TRAD [else] */
+# ifdef CRYPT_AES_WG
+ /* User requested AES_WG encryption. */
+# define IZ_CRYPT_AES_WG 1
+# if defined( SFX) && !defined( CRYPT_AES_WG_SFX)
+ /* UnZipSFX, and user did not request AES_WG encryption in UnZipSFX. */
+# undef IZ_CRYPT_AES_WG
+# endif /* defined( SFX) && !defined( CRYPT_AES_WG_SFX) */
+# endif /* def CRYPT_AES_WG */
+# endif /* def NO_CRYPT [else] */
+
+/* Disable bzip2 support for SFX stub, unless explicitly requested. */
+#if (defined(SFX) && !defined(BZIP2_SFX) && defined(BZIP2_SUPPORT))
+# undef BZIP2_SUPPORT
+#endif
+
+/* Disable LZMA support for SFX stub, unless explicitly requested. */
+#if (defined(SFX) && !defined(LZMA_SFX) && defined(LZMA_SUPPORT))
+# undef LZMA_SUPPORT
+#endif
+
+/* Disable PPMd support for SFX stub, unless explicitly requested. */
+#if (defined(SFX) && !defined(PPMD_SFX) && defined(PPMD_SUPPORT))
+# undef PPMD_SUPPORT
#endif
#if (defined(NO_VMS_TEXT_CONV) || defined(VMS))
# endif
#endif
-/* Enable -B option per default on specific systems, to allow backing up
- * files that would be overwritten.
- * (This list of systems must be kept in sync with the list of systems
- * that add the B_flag to the UzpOpts structure, see unzip.h.)
- */
-#if (!defined(NO_UNIXBACKUP) && !defined(UNIXBACKUP))
-# if defined(UNIX) || defined(OS2) || defined(WIN32)
-# define UNIXBACKUP
-# endif
-#endif
-
#if (defined(DLL) && !defined(REENTRANT))
# define REENTRANT
#endif
# endif
#endif
+/* UNICODE */
+#ifdef NO_UNICODE_SUPPORT
+/* NO_UNICODE_SUPPORT override disables Unicode support
+ * (Useful for environments like MS Visual Studio.)
+ */
+# ifdef UNICODE_SUPPORT
+# undef UNICODE_SUPPORT
+# endif
+#endif
+
+/* This needs fixing, but currently assume that we don't have full
+ Unicode support unless UNICODE_WCHAR is set.
+
+ What we should do is define three possibilities:
+ UNICODE_WCHAR = we have the wide character support we need for Unicode.
+ If unix/configure found the port is missing something,
+ the port needs to provide it and turn Unicode back on.
+ Check for HAVE_TOWUPPER and so on.
+ UNICODE_ICONV = we can use iconv for Unicode conversions. All processing
+ will be done using 8-bit characters.
+ UNICODE_NATIVE = we don't need to do any conversions. This flag is needed,
+ though, so we know to set the UTF-8 bit. It also means
+ we somehow have verified the character set as UTF-8.
+ However, note that if the port has no way to convert
+ from UTF-8, the code page must be UTF-8 to see paths in
+ an existing archive.
+
+ I can't see any reason more than one of these should be set in any
+ particular build, so there probably should be some priority order for these
+ set up. For instance, if UTF-8 is native, then paths coming in are already
+ UTF-8 and the UTF-8 paths in existing archives should be readable, so no
+ conversion code may be needed, just the code to detect if UNICODE_NATIVE
+ really applies.
+
+ This might get done in the next beta. */
+
+#ifdef UNICODE_SUPPORT
+# if !(defined(UNICODE_WCHAR))
+/* UNZIP had the following test (now synced to ZIP):
+ * # if !(defined(UTF8_MAYBE_NATIVE) || defined(UNICODE_WCHAR))
+ */
+# undef UNICODE_SUPPORT
+# endif
+#endif
+
/* bad or (occasionally?) missing stddef.h: */
#if (defined(M_XENIX) || defined(DNIX))
# define NO_STDDEF_H
#if (defined(ultrix) || defined(__ultrix) || defined(bsd4_2))
# if (!defined(BSD) && !defined(SYSV))
-# define BSD
+# define BSD 1
# endif
#endif /* ultrix || __ultrix || bsd4_2 */
#if (defined(sun) || defined(pyr) || defined(CONVEX))
# if (!defined(BSD) && !defined(SYSV))
-# define BSD
+# define BSD 1
# endif
#endif /* sun || pyr || CONVEX */
#endif
/*---------------------------------------------------------------------------
- BeOS section:
+ BeOS/Haiku section:
---------------------------------------------------------------------------*/
-#ifdef __BEOS__
+#if defined( __BEOS__) || defined( __HAIKU__)
# include "beos/beocfg.h"
#endif
# define _MBCS
# endif
# if (defined(_MBCS) && defined(NO_MBCS))
- /* disable MBCS support when explicitely requested */
+ /* disable MBCS support when explicitly requested */
# undef _MBCS
# endif
# include <time.h>
# ifndef INT_16BIT
# define INT_16BIT /* report "int" size is 16-bit to inflate setup */
# endif
-# ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
/* Following required for 64k WSIZE of Deflate64 support */
# define MED_MEM /* else OUTBUFSIZ is 64K and fails in do_string */
# define INBUFSIZ 8192 /* but larger buffer for real OSes */
# define Z_STAT_DEFINED
#endif
-#ifndef MINIX /* Minix needs it after all the other includes (?) */
-# include <stdio.h>
+#ifdef MINIX
+# include <unistd.h> /* For _POSIX_VERSION. */
+#else
+# include <stdio.h> /* Minix needs it after all the other includes (?) */
#endif
#include <ctype.h> /* skip for VMS, to use tolower() function? */
typedef unsigned int extent;
#endif /* ?MODERN */
+#ifdef NEED_LABS
+ long int labs();
+#endif /* def NEED_LABS */
+#ifdef NEED_STRERROR
+ char *strerror();
+#endif /* def NEED_STRERROR */
+
+
+#ifdef MEMDIAG
+void izu_free( void *ptr);
+void *izu_malloc( size_t siz);
+void *izu_realloc( void *ptr, size_t siz);
+void izu_md_check( void);
+#else /* def MEMDIAG */
+# define izu_free free
+# define izu_malloc malloc
+# define izu_realloc realloc
+#endif /* def MEMDIAG [else] */
+#define izc_free izu_free
+#define izc_malloc izu_malloc
+#define izc_realloc izu_realloc
/*************/
/* Defines */
/*************/
-#define UNZIP_BZ2VERS 46
+/* Version-Needed-to-Extract values by feature. */
+#define UNZIP_LZMA_VERS 63 /* 6.3 for LZMA, PPMd, ... */
+#define UNZIP_BZIP2_VERS 46 /* 4.6 for bzip2. */
+#define UNZIP_ZIP64_VERS 45 /* 4.5 for ZIP64. */
+
+#ifdef LZMA_SUPPORT
+# ifndef UNZIP_VERSION
+# define UNZIP_VERSION UNZIP_LZMA_VERS
+# endif
+#endif /* def LZMA_SUPPORT */
+#ifdef BZIP2_SUPPORT
+# ifndef UNZIP_VERSION
+# define UNZIP_VERSION UNZIP_BZIP2_VERS
+# endif /* def BZIP2_SUPPORT */
+#endif
#ifdef ZIP64_SUPPORT
-# ifdef USE_BZIP2
-# define UNZIP_VERSION UNZIP_BZ2VERS
-# else
-# define UNZIP_VERSION 45
+# ifndef UNZIP_VERSION
+# define UNZIP_VERSION UNZIP_ZIP64_VERS
# endif
-#else
-#ifdef USE_DEFLATE64
-# define UNZIP_VERSION 21 /* compatible with PKUNZIP 4.0 */
-#else
-# define UNZIP_VERSION 20 /* compatible with PKUNZIP 2.0 */
#endif
+#ifdef DEFLATE64_SUPPORT
+# ifndef UNZIP_VERSION
+# define UNZIP_VERSION 21 /* compatible with PKUNZIP 4.0 */
+# endif
#endif
+#ifndef UNZIP_VERSION
+# define UNZIP_VERSION 20 /* compatible with PKUNZIP 2.0 */
+#endif
+
#define VMS_UNZIP_VERSION 42 /* if OS-needed-to-extract is VMS: can do */
#if (defined(MSDOS) || defined(OS2))
#define MSG_NO_DLL2(f) (f & 0x0400) /* bit 10: 1 = skip if OS/2 DLL */
#define MSG_NO_NDLL(f) (f & 0x0800) /* bit 11: 1 = skip if WIN32 DLL */
#define MSG_NO_WDLL(f) (f & 0x1000) /* bit 12: 1 = skip if Windows DLL */
+#define MSG_STDOUT(f) (f & 0x2000) /* bit 13: 1 = stdout, for sure */
#if (defined(MORE) && !defined(SCREENLINES))
# ifdef DOS_FLX_NLM_OS2_W32
# endif
#endif
+/* 2013-02-02 SMS.
+ * Define I_O_ERROR_QUERY to restore an interactive I/O error query in
+ * fileio.c:disk_error(). OS-specific code may define STDIN_ISATTY if
+ * isatty( fileno( stdin)) is not suitable. Without I_O_ERROR_QUERY
+ * (now the default condition), fileio.c:disk_error() does not attempt
+ * to query the user.
+ */
+#ifdef I_O_ERROR_QUERY
+# ifndef STDIN_ISATTY
+# define STDIN_ISATTY isatty( fileno( stdin))
+# endif /* ndef STDIN_ISATTY */
+#endif /* def I_O_ERROR_QUERY */
+
#if (defined(__16BIT__) || defined(MED_MEM) || defined(SMALL_MEM))
# define DIR_BLKSIZ 64 /* number of directory entries per block
* (should fit in 4096 bytes, usually) */
#endif
#ifndef WSIZE
-# ifdef USE_DEFLATE64
+# ifdef DEFLATE64_SUPPORT
# define WSIZE 65536L /* window size--must be a power of two, and */
# else /* at least 64K for PKZip's deflate64 method */
# define WSIZE 0x8000 /* window size--must be a power of two, and */
# endif
#endif
-#if (defined(INT_16BIT) && (defined(USE_DEFLATE64) || lenEOL > 1))
+#if (defined(INT_16BIT) && (defined(DEFLATE64_SUPPORT) || lenEOL > 1))
/* For environments using 16-bit integers OUTBUFSIZ must be limited to
* less than 64k (do_string() uses "unsigned" in calculations involving
* OUTBUFSIZ). This is achieved by defining MED_MEM when WSIZE = 64k (aka
# undef TIMESTAMP
#endif
+/* For SFX, disable Reduce and Shrink compression methods. */
+#ifdef SFX
+# ifndef COPYRIGHT_CLEAN
+# define COPYRIGHT_CLEAN /* Disable Reduce. */
+# endif
+# ifndef LZW_CLEAN
+# define LZW_CLEAN /* Disable Shrink. */
+# endif
+#endif
+
#if (!defined(COPYRIGHT_CLEAN) && !defined(USE_SMITH_CODE))
# define COPYRIGHT_CLEAN
#endif
-/* The LZW patent is expired worldwide since 2004-Jul-07, so USE_UNSHRINK
- * is now enabled by default. See unshrink.c.
+/* The LZW patent is expired worldwide since 2004-Jul-07, so
+ * UNSHRINK_SUPPORT is now enabled by default. See unshrink.c.
*/
-#if (!defined(LZW_CLEAN) && !defined(USE_UNSHRINK))
-# define USE_UNSHRINK
+#if (!defined(LZW_CLEAN) && !defined(UNSHRINK_SUPPORT))
+# define UNSHRINK_SUPPORT
#endif
#ifndef O_BINARY
#endif
/* 2008-07-22 SMS.
- * Unfortunately, on VMS, <limits.h> exists, and is included by <stdlib.h>
- * (so it's pretty much unavoidable), and it defines PATH_MAX to a fixed
- * short value (256, correct only for older systems without ODS-5 support),
- * rather than one based on the real RMS NAM[L] situation. So, we
- * artificially undefine it here, to allow our better-defined _MAX_PATH
- * (see vms/vmscfg.h) to be used.
+ * 2012-12-31 SMS.
+ * Unfortunately, on VMS, <limits.h> exists, and might be included by
+ * <stdlib.h>, even if "vms/vmscfg.h" didn't bring it in (so it's pretty
+ * much unavoidable), and it defines PATH_MAX to a fixed short value
+ * (256, correct only for older systems without ODS-5 support), rather
+ * than one based on the real RMS NAM[L] situation. So, we artificially
+ * undefine it here, to allow our better-defined _MAX_PATH (see
+ * vms/vmscfg.h) to be used.
*/
#ifdef VMS
# undef PATH_MAX
*/
#define FILNAMSIZ PATH_MAX
-#ifdef UNICODE_SUPPORT
-# if !(defined(UTF8_MAYBE_NATIVE) || defined(UNICODE_WCHAR))
-# undef UNICODE_SUPPORT
-# endif
-#endif
+
+/* DBCS support for Info-ZIP's zip (mainly for japanese (-: )
+ * by Yoshioka Tsuneo (QWF00133@nifty.ne.jp,tsuneo-y@is.aist-nara.ac.jp)
+ * This code is public domain! Date: 1998/12/20
+ */
+
/* 2007-09-18 SMS.
* Include <locale.h> here if it will be needed later for Unicode.
* Otherwise, SETLOCALE may be defined here, and then defined again
* (differently) when <locale.h> is read later.
*/
#ifdef UNICODE_SUPPORT
+# include <stdlib.h>
# ifdef UNICODE_WCHAR
-# if !(defined(_WIN32_WCE) || defined(POCKET_UNZIP))
+/* wchar support may be in any of these three headers */
+# ifdef HAVE_CTYPE_H
+# include <ctype.h>
+# endif
+# ifdef HAVE_WCHAR_H
# include <wchar.h>
# endif
+# ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+# endif
+# endif /* def UNICODE_WCHAR */
+
+# ifdef HAVE_LANGINFO_H
+# include <langinfo.h>
# endif
+
# ifndef _MBCS /* no need to include <locale.h> twice, see below */
+# ifdef HAVE_LOCALE_H
# include <locale.h>
+# endif
# ifndef SETLOCALE
# define SETLOCALE(category, locale) setlocale(category, locale)
# endif
# endif
#endif /* UNICODE_SUPPORT */
-/* DBCS support for Info-ZIP (mainly for japanese (-: )
- * by Yoshioka Tsuneo (QWF00133@nifty.ne.jp,tsuneo-y@is.aist-nara.ac.jp)
- */
#ifdef _MBCS
-# include <locale.h>
- /* Multi Byte Character Set */
+ /* Multi Byte Character Set support
+ - This section supports a number of mbcs-related functions which
+ will use the OS-provided version (if found by a unix/configure
+ test, or equivalent) or will use a generic minimally-functional
+ version provided as a fileio.c function.
+ - All references to this function UnZip code are via the FUNCTION
+ name.
+ - If unix/configure finds the OS-provided function, it will define
+ a macro in the form FUNCTION=function.
+ - If not defined:
+ - A replacement is defined below pointing to the generic version.
+ - The prototype for the generic function will be defined (below).
+ - A NEED_FUNCTION macro will also be defined, to enable compile
+ of the fileio.c code to implement the generic function.
+ */
+
+# include <stdlib.h>
+# ifdef HAVE_LOCALE_H
+# include <locale.h>
+# endif
+# ifdef HAVE_MBSTR_H
+# include <mbstr.h>
+# endif
+
# define ___MBS_TMP_DEF char *___tmp_ptr;
# define ___TMP_PTR ___tmp_ptr
+
# ifndef CLEN
# define NEED_UZMBCLEN
# define CLEN(ptr) (int)uzmbclen((ZCONST unsigned char *)(ptr))
+ /* Zip defines as
+# define CLEN(ptr) mblen((ZCONST char *)ptr, MB_CUR_MAX)
+ */
# endif
+
# ifndef PREINCSTR
# define PREINCSTR(ptr) (ptr += CLEN(ptr))
# endif
+
# define POSTINCSTR(ptr) (___TMP_PTR=(char *)(ptr), PREINCSTR(ptr),___TMP_PTR)
char *plastchar OF((ZCONST char *ptr, extent len));
# define lastchar(ptr, len) ((int)(unsigned)*plastchar(ptr, len))
+ /* Zip defines as
+# define POSTINCSTR(ptr) (___tmp_ptr=(char *)ptr,ptr += CLEN(ptr),___tmp_ptr)
+ int lastchar OF((ZCONST char *ptr));
+ */
+
# ifndef MBSCHR
# define NEED_UZMBSCHR
# define MBSCHR(str,c) (char *)uzmbschr((ZCONST unsigned char *)(str), c)
# endif
+
# ifndef MBSRCHR
# define NEED_UZMBSRCHR
# define MBSRCHR(str,c) (char *)uzmbsrchr((ZCONST unsigned char *)(str), c)
# endif
+
# ifndef SETLOCALE
# define SETLOCALE(category, locale) setlocale(category, locale)
# endif
+
#else /* !_MBCS */
+ /* Multi Byte Character Set support is not available */
# define ___MBS_TMP_DEF
# define ___TMP_PTR
# define CLEN(ptr) 1
# define SETLOCALE(category, locale)
# endif
#endif /* ?_MBCS */
+
#define INCSTR(ptr) PREINCSTR(ptr)
# define IS_VOLID(m) ((m) & 0x08)
#endif
+
+/*--------------------------------------------------------------------
+ Long option support
+ 23 August 2003
+ Originally from Zip 3.0
+ Updated for UnZip 1 March 2008
+ See unzip.c
+ --------------------------------------------------------------------*/
+
+/* The below is for use in the caller-provided options table */
+
+/* option groups */
+#define UZO 1 /* UnZip option */
+#define ZIO 2 /* ZipInfo option */
+
+
+/* value_type - value is always returned as a string. */
+#define o_NO_VALUE 0 /* this option does not take a value */
+#define o_REQUIRED_VALUE 1 /* this option requires a value */
+#define o_OPTIONAL_VALUE 2 /* value is optional (see get_option() for details) */
+#define o_VALUE_LIST 3 /* this option takes a list of values */
+#define o_ONE_CHAR_VALUE 4 /* next char is value (does not end short opt string) */
+#define o_NUMBER_VALUE 5 /* value is integer (does not end short opt string) */
+#define o_OPT_EQ_VALUE 6 /* value optional, but "=" required for one. */
+
+/* negatable - a dash following the option (but before any value) sets negated. */
+#define o_NOT_NEGATABLE 0 /* trailing '-' to negate either starts value or generates error */
+#define o_NEGATABLE 1 /* trailing '-' sets negated to TRUE */
+
+
+/* option_num can be this when option not in options table */
+#define o_NO_OPTION_MATCH -1
+
+/* special values returned by get_option - do not use these as option IDs */
+#define o_NON_OPTION_ARG ((unsigned long) 0xFFFF) /* returned for non-option
+ args */
+#define o_ARG_FILE_ERR ((unsigned long) 0xFFFE) /* internal recursion
+ return (user never sees) */
+#define o_BAD_ERR ((unsigned long) 0xFFFD) /* bad error */
+
+/* Most option IDs are set to the shortopt char. For multichar short
+ * options, ID is set to an arbitrary unused constant (defined below).
+ */
+#define o_da 0x101 /* -da: Automatic destination directory. */
+#define o_hh 0x102 /* -hh: Extended help. */
+/* Mac-OS-X-specific: */
+#define o_Je 0x103 /* -Je: Ignore (all) extended attributes. */
+#define o_Jf 0x104 /* -Jf: Ignore Finder info. */
+#define o_Jq 0x105 /* -Jq: Ignore quarantine ("com.apple.quarantine"). */
+#define o_Jr 0x106 /* -Jr: Ignore Resource fork. */
+/* End Mac-OS-X-specific. */
+#define o_ja 0x107 /* --jar. */
+#define o_ka 0x108 /* -ka: Restore (VMS) ACL. */
+#define o_LI 0x109 /* --license: Show license text. */
+#define o_mc 0x10a /* -mc: Show separate dir/file/link member counts. */
+#define o_sc 0x10b /* -sc: Show command line (and exit). */
+#define o_si 0x10c /* -si: Show process ID. */
+#define o_so 0x10d /* -so: Show options. */
+#define o_ve 0x10e /* -version: Show program version/option info. */
+
+/* options array is set in unzip.c */
+struct option_struct {
+ int option_group; /* either UZO for UnZip or ZIO for ZipInfo syntax */
+ char Far *shortopt; /* pointer to short option string */
+ char Far *longopt; /* pointer to long option string */
+ int value_type; /* from above */
+ int negatable; /* from above */
+ unsigned long option_ID; /* value returned by get_option when this option
+ is found */
+ char Far *name; /* optional string for option returned on some
+ errors */
+};
+
+/* structure used to create -x and include file lists */
+struct file_list {
+ char *name;
+ struct file_list *next;
+};
+
+
+/*--------------------------------------------------------------------
+ End of Long option support
+ --------------------------------------------------------------------*/
+
+
/***********************************/
/* LARGE_FILE_SUPPORT */
/***********************************/
/* 64-bit stat functions */
# define zstat _stati64
# define zfstat _fstati64
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+# define zstatw _wstati64
+# endif
/* 64-bit lseek */
# define zlseek _lseeki64
/* 64-bit fopen */
# define zfopen fopen
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+# define zfopenw _wfopen
+# endif
# define zfdopen fdopen
# endif /* _MSC_VER || __MINGW__ || __LCC__ */
#define FZOFFT_LEN 24 /* Number of characters/chamber. */
+/* User-triggered (Ctrl/T, SIGUSR1) progress. (Expects localtime_r().)
+ * ("include <signal.h>" must follow large-file decision.)
+ */
+#if defined( NO_LOCALTIME_R) && !defined( NO_USER_PROGRESS)
+# define NO_USER_PROGRESS
+#endif
+
+#ifndef NO_USER_PROGRESS
+# ifndef VMS
+# include <signal.h>
+# endif /* ndef VMS */
+# if defined(VMS) || defined(SIGUSR1)
+# if !defined(MACOS) && !defined(WINDLL)
+# define ENABLE_USER_PROGRESS
+# endif /* !defined(MACOS) && !defined(WINDLL) */
+# endif /* defined(VMS) || defined(SIGUSR1) */
+#endif /* ndef NO_USER_PROGRESS */
+
+/* "api.h" wants <setjmp.h>, which must follow large-file determination,
+ * which is done above.
+ */
+#if defined( DLL) && !defined( WINDLL)
+# include "api.h"
+#endif /* ndef WINDLL */
+
#ifdef SHORT_SYMS /* Mark Williams C, ...? */
# define extract_or_test_files xtr_or_tst_files
# define extract_or_test_member xtr_or_tst_member
# define CHECK_AUTORUN_Q 8 /* copy command, skip remainder */
#endif
+/* Replacement name (default) for null/empty archive member name. */
+#ifndef NULL_NAME_REPL
+# define NULL_NAME_REPL "-"
+#endif
+
#define DOES_NOT_EXIST -1 /* return values for check_for_newer() */
#define EXISTS_AND_OLDER 0
#define EXISTS_AND_NEWER 1
#define MAC_OSX_ 19 /* Mac OS/X (Darwin) */
#define ATHEOS_ 30 /* AtheOS */
#define NUM_HOSTS 31 /* index of last system + 1 */
-/* don't forget to update zipinfo.c appropiately if NUM_HOSTS changes! */
+/* Be sure to update zipinfo.c appropriately if NUM_HOSTS changes! */
#define STORED 0 /* compression methods */
#define SHRUNK 1
#define LZMAED 14
#define IBMTERSED 18
#define IBMLZ77ED 19
+#define JPEGED 96
#define WAVPACKED 97
#define PPMDED 98
-#define NUM_METHODS 17 /* number of known method IDs */
-/* don't forget to update list.c (list_files()), extract.c and zipinfo.c
- * appropriately if NUM_METHODS changes */
+#define AESENCRED 99
+#define NUM_METHODS 19 /* Number of known method IDs. */
+/* Be sure to update list.c (list_files()), extract.c, and zipinfo.c
+ * appropriately if NUM_METHODS changes. */
/* (the PK-class error codes are public and have been moved into unzip.h) */
Extra-field block ID values and offset info.
---------------------------------------------------------------------------*/
/* extra-field ID values, all little-endian: */
-#define EF_PKSZ64 0x0001 /* PKWARE's 64-bit filesize extensions */
-#define EF_AV 0x0007 /* PKWARE's authenticity verification */
-#define EF_EFS 0x0008 /* PKWARE's extended language encoding */
+#define EF_PKSZ64 0x0001 /* PKWARE 64-bit filesize extensions */
+#define EF_AV 0x0007 /* PKWARE authenticity verification */
+#define EF_EFS 0x0008 /* PKWARE extended language encoding */
#define EF_OS2 0x0009 /* OS/2 extended attributes */
-#define EF_PKW32 0x000a /* PKWARE's Win95/98/WinNT filetimes */
-#define EF_PKVMS 0x000c /* PKWARE's VMS */
-#define EF_PKUNIX 0x000d /* PKWARE's Unix */
-#define EF_PKFORK 0x000e /* PKWARE's future stream/fork descriptors */
-#define EF_PKPATCH 0x000f /* PKWARE's patch descriptor */
-#define EF_PKPKCS7 0x0014 /* PKWARE's PKCS#7 store for X.509 Certs */
-#define EF_PKFX509 0x0015 /* PKWARE's file X.509 Cert&Signature ID */
-#define EF_PKCX509 0x0016 /* PKWARE's central dir X.509 Cert ID */
-#define EF_PKENCRHD 0x0017 /* PKWARE's Strong Encryption header */
-#define EF_PKRMCTL 0x0018 /* PKWARE's Record Management Controls*/
-#define EF_PKLSTCS7 0x0019 /* PKWARE's PKCS#7 Encr. Recipient Cert List */
-#define EF_PKIBM 0x0065 /* PKWARE's IBM S/390 & AS/400 attributes */
-#define EF_PKIBM2 0x0066 /* PKWARE's IBM S/390 & AS/400 compr. attribs */
-#define EF_IZVMS 0x4d49 /* Info-ZIP's VMS ("IM") */
-#define EF_IZUNIX 0x5855 /* Info-ZIP's first Unix[1] ("UX") */
-#define EF_IZUNIX2 0x7855 /* Info-ZIP's second Unix[2] ("Ux") */
-#define EF_IZUNIX3 0x7875 /* Info-ZIP's newest Unix[3] ("ux") */
+#define EF_PKW32 0x000a /* PKWARE Win95/98/WinNT filetimes */
+#define EF_PKVMS 0x000c /* PKWARE VMS */
+#define EF_PKUNIX 0x000d /* PKWARE Unix */
+#define EF_PKFORK 0x000e /* PKWARE future stream/fork descriptors */
+#define EF_PKPATCH 0x000f /* PKWARE patch descriptor */
+#define EF_PKPKCS7 0x0014 /* PKWARE PKCS#7 store for X.509 Certs */
+#define EF_PKFX509 0x0015 /* PKWARE file X.509 Cert&Signature ID */
+#define EF_PKCX509 0x0016 /* PKWARE central dir X.509 Cert ID */
+#define EF_PKENCRHD 0x0017 /* PKWARE Strong Encryption header */
+#define EF_PKRMCTL 0x0018 /* PKWARE Record Management Controls*/
+#define EF_PKLSTCS7 0x0019 /* PKWARE PKCS#7 Encr. Recipient Cert List */
+#define EF_PKIBM 0x0065 /* PKWARE IBM S/390, AS/400 attrs ("e\000") */
+#define EF_PKIBM2 0x0066 /* PKWARE IBM S/390, AS/400 cmp. ats ("f\000") */
+#define EF_JLMAC 0x07c8 /* Johnny Lee old Macintosh (= 1992) */
+#define EF_ZIPIT 0x2605 /* Thomas Brown Macintosh (ZipIt) */
+#define EF_ZIPIT2 0x2705 /* T. Brown Mac (ZipIt) v 1.3.8 and newer ? */
+#define EF_MAC3 0x334d /* Info-ZIP new Macintosh (= "M3") */
+#define EF_TANDEM 0x4154 /* Tandem NSK ("TA") */
+#define EF_SPARK 0x4341 /* David Pilling Acorn/SparkFS ("AC") */
+#define EF_NTSD 0x4453 /* NT security descriptor ("SD") */
+#define EF_VMCMS 0x4704 /* Info-ZIP VM/CMS ("\004G") */
+#define EF_MVS 0x470f /* Info-ZIP MVS ("\017G") */
+#define EF_THEOSO 0x4854 /* Old Theos port ("TH") */
+#define EF_MD5 0x4b46 /* Fred Kantor MD5 ("FK") */
+#define EF_ACL 0x4c41 /* (OS/2) access control list ("AL") */
+#define EF_IZVMS 0x4d49 /* Info-ZIP VMS ("IM") */
+#define EF_SMARTZIP 0x4d63 /* Mac SmartZip by Marco Bambini ("cM") */
+#define EF_AOSVS 0x5356 /* AOS/VS ("VS") */
#define EF_TIME 0x5455 /* universal timestamp ("UT") */
-#define EF_UNIPATH 0x7075 /* Info-ZIP Unicode Path ("up") */
+#define EF_IZUNIX 0x5855 /* Info-ZIP first Unix[1] ("UX") */
#define EF_UNICOMNT 0x6375 /* Info-ZIP Unicode Comment ("uc") */
-#define EF_MAC3 0x334d /* Info-ZIP's new Macintosh (= "M3") */
-#define EF_JLMAC 0x07c8 /* Johnny Lee's old Macintosh (= 1992) */
-#define EF_ZIPIT 0x2605 /* Thomas Brown's Macintosh (ZipIt) */
-#define EF_ZIPIT2 0x2705 /* T. Brown's Mac (ZipIt) v 1.3.8 and newer ? */
-#define EF_SMARTZIP 0x4d63 /* Mac SmartZip by Marco Bambini */
-#define EF_VMCMS 0x4704 /* Info-ZIP's VM/CMS ("\004G") */
-#define EF_MVS 0x470f /* Info-ZIP's MVS ("\017G") */
-#define EF_ACL 0x4c41 /* (OS/2) access control list ("AL") */
-#define EF_NTSD 0x4453 /* NT security descriptor ("SD") */
-#define EF_ATHEOS 0x7441 /* AtheOS ("At") */
#define EF_BEOS 0x6542 /* BeOS ("Be") */
+#define EF_THEOS 0x6854 /* Jean-Michel Dubois Theos "Th" */
+#define EF_LHDREXTN 0x6c65 /* Local header extension ("el") */
+#define EF_UNIPATH 0x7075 /* Info-ZIP Unicode Path ("up") */
+#define EF_ASIUNIX 0x756e /* ASi Unix ("nu") */
+#define EF_IZUNIX2 0x7855 /* Info-ZIP second Unix[2] ("Ux") */
+#define EF_IZUNIX3 0x7875 /* Info-ZIP newest Unix[3] ("ux") */
+#define EF_ATHEOS 0x7441 /* AtheOS ("At") */
+#define EF_AES_WG 0x9901 /* AES (WinZip/Gladman) encryption ("c^!") */
+#define EF_JAVA 0xcafe /* Java */
#define EF_QDOS 0xfb4a /* SMS/QDOS ("J\373") */
-#define EF_AOSVS 0x5356 /* AOS/VS ("VS") */
-#define EF_SPARK 0x4341 /* David Pilling's Acorn/SparkFS ("AC") */
-#define EF_TANDEM 0x4154 /* Tandem NSK ("TA") */
-#define EF_THEOS 0x6854 /* Jean-Michel Dubois' Theos "Th" */
-#define EF_THEOSO 0x4854 /* old Theos port */
-#define EF_MD5 0x4b46 /* Fred Kantor's MD5 ("FK") */
-#define EF_ASIUNIX 0x756e /* ASi's Unix ("nu") */
+
+#define EB_AES_VERS 0 /* AES encryption version. */
+#define EB_AES_VEND 2 /* AES encryption vendor. */
+#define EB_AES_MODE 4 /* AES encryption mode. */
+#define EB_AES_MTHD 5 /* AES encryption real compression method. */
+#define EB_AES_HLEN 7 /* AES encryption extra block size. */
#define EB_HEADSIZE 4 /* length of extra field block header */
#define EB_ID 0 /* offset of block ID in header */
#ifdef ZIP64_SUPPORT
# ifndef Z_UINT8_DEFINED
-# if (defined(__GNUC__) || defined(__hpux) || defined(__SUNPRO_C))
+# if defined( __GNUC__) || defined( __hpux) || defined( sgi) /* (Group 1) */
+# define IZ_USE_LONG_LONG_64 1
+# else /* (Host-type group 1) */
+# if defined( __SUNPRO_C) /* (Group 2) */
+# define IZ_USE_LONG_LONG_64 1
+# endif /* (Host-type group 2) */
+# endif /* (Host-type group 1) [else] */
+# ifdef IZ_USE_LONG_LONG_64
typedef unsigned long long z_uint8;
-# else
+# else /* def IZ_USE_LONG_LONG_64 */
typedef unsigned __int64 z_uint8;
-# endif
-# define Z_UINT8_DEFINED
-# endif
-#endif
+# endif /* def IZ_USE_LONG_LONG_64 */
+# define Z_UINT8_DEFINED
+# endif /* ndef Z_UINT8_DEFINED */
+#endif /* def ZIP64_SUPPORT */
+
#ifndef Z_UINT4_DEFINED
-# if (defined(MODERN) && !defined(NO_LIMITS_H))
-# if (defined(UINT_MAX) && (UINT_MAX == 0xffffffffUL))
+# if defined(MODERN) && !defined(NO_LIMITS_H)
+# if defined(UINT_MAX) && (UINT_MAX == 0xffffffffUL)
typedef unsigned int z_uint4;
-# define Z_UINT4_DEFINED
-# else
-# if (defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL))
+# define Z_UINT4_DEFINED
+# else /* defined(UINT_MAX) && (UINT_MAX == 0xffffffffUL) */
+# if defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL)
typedef unsigned long z_uint4;
# define Z_UINT4_DEFINED
-# else
-# if (defined(USHRT_MAX) && (USHRT_MAX == 0xffffffffUL))
+# else /* defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL) */
+# if defined(USHRT_MAX) && (USHRT_MAX == 0xffffffffUL)
typedef unsigned short z_uint4;
-# define Z_UINT4_DEFINED
-# endif
-# endif
-# endif
+# define Z_UINT4_DEFINED
+# endif /* defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL) [else] */
+# endif /* defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL) [else] */
+# endif /* defined(UINT_MAX) && (UINT_MAX == 0xffffffffUL) [else] */
# endif /* MODERN && !NO_LIMITS_H */
-#endif /* !Z_UINT4_DEFINED */
+#endif /* ndef Z_UINT4_DEFINED */
+
#ifndef Z_UINT4_DEFINED
typedef ulg z_uint4;
# define Z_UINT4_DEFINED
typedef z_uint4 zuvl_t; /* multivolume numbers */
# define MASK_ZUCN64 (~(zucn_t)0)
/* In case we ever get to support an environment where z_uint8 may be WIDER
- than 64 bit wide, we will have to apply a construct similar to
- #define MASK_ZUCN64 (~(zucn_t)0 & (zucn_t)0xffffffffffffffffULL)
- for the 64-bit mask.
+ * than 64 bit wide, we will have to apply a construct similar to
+ * #define MASK_ZUCN64 (~(zucn_t)0 & (zucn_t)0xffffffffffffffffULL)
+ * for the 64-bit mask.
*/
#else
typedef ulg zusz_t; /* zipentry sizes & offsets */
#define MASK_ZUCN16 ((zucn_t)0xFFFF)
#ifdef NO_UID_GID
-# ifdef UID_USHORT
+# ifdef UID_USHORT
typedef unsigned short uid_t; /* TI SysV.3 */
typedef unsigned short gid_t;
-# else
+# else
typedef unsigned int uid_t; /* SCO Xenix */
typedef unsigned int gid_t;
-# endif
+# endif
#endif
#if (defined(GOT_UTIMBUF) || defined(sgi) || defined(ATARI))
char *fn; /* filename of directory */
char buf[1]; /* start of system-specific internal data */
} direntry;
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ typedef struct direntryw { /* head of system-specific struct holding */
+ struct direntryw *next; /* defered directory attributes info */
+ wchar_t *fnw; /* filename of directory */
+ wchar_t buf[1]; /* start of system-specific internal data */
+ } direntryw;
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
#endif /* SET_DIR_ATTRIB */
#ifdef SYMLINKS
- typedef struct slinkentry { /* info for deferred symlink creation */
- struct slinkentry *next; /* pointer to next entry in chain */
- extent targetlen; /* length of target filespec */
- extent attriblen; /* length of system-specific attrib data */
- char *target; /* pointer to target filespec */
- char *fname; /* pointer to name of link */
- char buf[1]; /* data/name/link buffer */
+ typedef struct slinkentry { /* Info for deferred symlink creation. */
+ struct slinkentry *next; /* Pointer to next entry in chain. */
+ extent targetlen; /* Length of target (filespec) (no NUL). */
+ extent attriblen; /* Length of system-specific attrib data. */
+ int is_dir; /* 1 if link is directory, 0 if not. */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ unsigned int wide; /* fname is really wchar_t. */
+# endif
+ char *target; /* Pointer to target (filespec). */
+ char *fname; /* Pointer to name of link. */
+ char buf[1]; /* Data/name/link buffer.
+ * #ifdef SET_SYMLINK_ATTRIBS
+ * unsigned int file_attr \
+ * if (have_uidgid_flg) } attriblen
+ * UID/GID (opt) /
+ * #endif
+ * target text (with NUL)
+ * alignment byte for wide fname (optional)
+ * fname (with NUL)
+ */
} slinkentry;
#endif /* SYMLINKS */
#ifndef SFX
char Far *cfilname; /* central header version of filename */
#endif
+#ifdef IZ_CRYPT_AES_WG
+ ush cmpr_mthd_aes;
+ ush cmpr_vers_aes;
+ char cmpr_mode_aes;
+#endif /* def IZ_CRYPT_AES_WG */
} min_info;
typedef struct VMStimbuf {
#ifndef WINDLL
int MAIN OF((int argc, char **argv));
+#endif /* ndef WINDLL */
int unzip OF((__GPRO__ int argc, char **argv));
int uz_opts OF((__GPRO__ int *pargc, char ***pargv));
int usage OF((__GPRO__ int error));
-#endif /* !WINDLL */
+
+/* Command-line option function prototypes. */
+
+/* get_option() - Get the next option from args. */
+unsigned long get_option OF((__GPRO__ int option_group,
+ char ***pargs, int *argc, int *argnum,
+ int *optchar,
+ char **value, int *negated, int *first_nonopt_arg,
+ int *option_num, int recursion_depth));
+
+/* copy_args() - Copy an args array, allocating space as needed. */
+char **copy_args OF((__GPRO__ char **args, int max_args));
+
+/* arg_count() - Count args in argv like array. */
+int arg_count OF((__GPRO__ char **args));
+
+/* free_args - Free args created with one of these functions. */
+int free_args OF((char **args));
+
+/* insert_arg() - Copy an arg into args. */
+int insert_arg OF((__GPRO__ char ***args, ZCONST char *arg, int insert_at,
+ int free_args));
+
+/* show_env() = Display option environment variables. */
+#ifdef VMSCLI
+void show_env OF(( __GPRO__ int non_null_only));
+#endif /* def VMSCLI */
/*---------------------------------------------------------------------------
Functions in process.c (main driver routines):
int process_cdir_file_hdr OF((__GPRO));
int process_local_file_hdr OF((__GPRO));
int getZip64Data OF((__GPRO__ ZCONST uch *ef_buf,
- unsigned ef_len));
+ long ef_len));
#ifdef UNICODE_SUPPORT
int getUnicodeData OF((__GPRO__ ZCONST uch *ef_buf,
- unsigned ef_len));
+ long ef_len));
#endif
-unsigned ef_scan_for_izux OF((ZCONST uch *ef_buf, unsigned ef_len,
+unsigned ef_scan_for_izux OF((ZCONST uch *ef_buf, long ef_len,
int ef_is_c, ulg dos_mdatetime,
iztimes *z_utim, ulg *z_uidgid));
+#ifdef IZ_CRYPT_AES_WG
+int ef_scan_for_aes OF((ZCONST uch *ef_buf, long ef_len,
+ ush *vers, ush *vend,
+ char *mode, ush *mthd));
+#endif /* def IZ_CRYPT_AES_WG */
+
#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
- zvoid *getRISCOSexfield OF((ZCONST uch *ef_buf, unsigned ef_len));
+ zvoid *getRISCOSexfield OF((ZCONST uch *ef_buf, long ef_len));
#endif
#ifndef SFX
---------------------------------------------------------------------------*/
#ifndef NO_ZIPINFO
-#ifndef WINDLL
- int zi_opts OF((__GPRO__ int *pargc, char ***pargv));
-#endif
+int zi_opts OF((__GPRO__ int *pargc, char ***pargv));
void zi_end_central OF((__GPRO));
-int zipinfo OF((__GPRO));
+int zipinform OF((__GPRO));
/* static int zi_long OF((__GPRO__ zusz_t *pEndprev)); */
/* static int zi_short OF((__GPRO)); */
/* static char *zi_time OF((__GPRO__ ZCONST ulg *datetimez,
Functions in fileio.c:
---------------------------------------------------------------------------*/
+
int open_input_file OF((__GPRO));
int open_outfile OF((__GPRO)); /* also vms.c */
void undefer_input OF((__GPRO));
#else
int flush OF((__GPRO__ uch *buf, ulg size, int unshrink));
#endif
+int fgets_ans OF((__GPRO));
/* static int disk_error OF((__GPRO)); */
void handler OF((int signal));
time_t dos_to_unix_time OF((ulg dos_datetime));
int check_for_newer OF((__GPRO__ char *filename)); /* os2,vmcms,vms */
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+int check_for_newerw OF((__GPRO__ wchar_t *filenamew)); /* os2,vmcms,vms */
+#endif
int do_string OF((__GPRO__ unsigned int length, int option));
+char *name_only OF((char *path));
ush makeword OF((ZCONST uch *b));
ulg makelong OF((ZCONST uch *sig));
zusz_t makeint64 OF((ZCONST uch *sig));
char *fLoadFarString OF((__GPRO__ const char Far *sz));
char *fLoadFarStringSmall OF((__GPRO__ const char Far *sz));
char *fLoadFarStringSmall2 OF((__GPRO__ const char Far *sz));
- #ifndef zfstrcpy
+# ifndef zfstrcpy
char Far * Far zfstrcpy OF((char Far *s1, const char Far *s2));
- #endif
- #if (!defined(SFX) && !defined(zfstrcmp))
+# endif
+# if (!defined(SFX) && !defined(zfstrcmp))
int Far zfstrcmp OF((const char Far *s1, const char Far *s2));
- #endif
+# endif
#endif
---------------------------------------------------------------------------*/
int extract_or_test_files OF((__GPRO));
-/* static int store_info OF((void)); */
-/* static int extract_or_test_member OF((__GPRO)); */
-/* static int TestExtraField OF((__GPRO__ uch *ef, unsigned ef_len)); */
-/* static int test_OS2 OF((__GPRO__ uch *eb, unsigned eb_size)); */
-/* static int test_NT OF((__GPRO__ uch *eb, unsigned eb_size)); */
#ifndef SFX
unsigned find_compr_idx OF((unsigned compr_methodnum));
#endif
char *fnfilter OF((ZCONST char *raw, uch *space,
extent size));
+# if defined( UNICODE_SUPPORT) && defined( _MBCS)
+wchar_t *fnfilterw OF((ZCONST wchar_t *src, wchar_t *dst,
+ extent siz));
+#endif
+
/*---------------------------------------------------------------------------
Decompression functions:
---------------------------------------------------------------------------*/
/* static void partial_clear OF((__GPRO)); * unshrink.c */
#endif /* !LZW_CLEAN */
#endif /* !SFX && !FUNZIP */
-#ifdef USE_BZIP2
- int UZbunzip2 OF((__GPRO)); /* extract.c */
+#ifdef BZIP2_SUPPORT
void bz_internal_error OF((int bzerrcode)); /* ubz2err.c */
-#endif
+#endif /* def BZIP2_SUPPORT */
/*---------------------------------------------------------------------------
Internal API functions (only included in DLL versions):
int finish_REXX_redirect OF((__GPRO)); /* rexxapi.c */
#endif
#ifdef API_DOC
- void APIhelp OF((__GPRO__ int argc, char **argv));
-#endif /* apihelp.c */
+ void APIhelp OF((__GPRO__ char *fname)); /* apihelp.c */
+#endif
#endif /* DLL */
/*---------------------------------------------------------------------------
#endif
/*---------------------------------------------------------------------------
+ Unix-only functions:
+ ---------------------------------------------------------------------------*/
+
+#ifdef UNIX
+# ifdef ICONV_MAPPING
+ /* ISO/OEM (iconv) character conversion function prototypes. */
+ void charset_to_intern( char *, char *);
+ void init_conversion_charsets OF(( __GPRO));
+# endif /* def ICONV_MAPPING */
+#endif /* def UNIX */
+
+/*---------------------------------------------------------------------------
VMS-only functions:
---------------------------------------------------------------------------*/
/* int open_outfile OF((__GPRO)); * (see fileio.c) vms.c */
/* int flush OF((__GPRO__ uch *rawbuf, unsigned size,
int final_flag)); * (see fileio.c) vms.c */
+ int get_rms_fileprot OF((void)); /* vms.c */
char *vms_msg_text OF((void)); /* vms.c */
-#ifdef RETURN_CODES
+# ifdef RETURN_CODES
void return_VMS OF((__GPRO__ int zip_error)); /* vms.c */
-#else
+# else /* def RETURN_CODES */
void return_VMS OF((int zip_error)); /* vms.c */
-#endif
-#ifdef VMSCLI
- ulg vms_unzip_cmdline OF((int *, char ***)); /* cmdline.c */
+# endif /* def RETURN_CODES [else] */
+# ifdef VMSCLI
+ unsigned vms_unzip_cmdline OF((int *, char ***)); /* cmdline.c */
int VMSCLI_usage OF((__GPRO__ int error)); /* cmdline.c */
-#endif
-#endif
+# endif /* def VMSCLI */
+# ifdef ENABLE_USER_PROGRESS
+ int establish_ctrl_t OF((void ctrl_t_ast())); /* vms.c */
+# endif /* def ENABLE_USER_PROGRESS */
+#endif /* def VMS */
/*---------------------------------------------------------------------------
WIN32-only functions:
int IsWinNT OF((void)); /* win32.c */
#ifdef NTSD_EAS
void process_defer_NT OF((__GPRO)); /* win32.c */
- int test_NTSD OF((__GPRO__ uch *eb, unsigned eb_size,
+ int test_NTSD OF((__GPRO__ uch *eb, long eb_size,
uch *eb_ucptr, ulg eb_ucsize)); /* win32.c */
# define TEST_NTSD test_NTSD
#endif
#ifdef W32_STAT_BANDAID
int zstat_win32 OF((__W32STAT_GLOBALS__
const char *path, z_stat *buf)); /* win32.c */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ int zstat_win32w OF((__W32STAT_GLOBALS__
+ const wchar_t *pathw, z_stat *buf)); /* win32.c */
+# endif
#endif
#endif
/*---------------------------------------------------------------------------
+ Mac-OS-X-only functions:
+ ---------------------------------------------------------------------------*/
+
+#if defined( UNIX) && defined( __APPLE__)
+ int revert_apl_dbl_path( char *path, char *ad_name);
+ int vol_attr_ok( const char *path);
+#endif /* defined( UNIX) && defined( __APPLE__) */
+
+/*---------------------------------------------------------------------------
Miscellaneous/shared functions:
---------------------------------------------------------------------------*/
int match OF((ZCONST char *s, ZCONST char *p,
int ic __WDLPRO)); /* match.c */
int iswild OF((ZCONST char *p)); /* match.c */
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+int iswildw OF((ZCONST wchar_t *pw)); /* match.c */
+#endif
/* declarations of public CRC-32 functions have been moved into crc32.h
(free_crc_table(), get_crc_table(), crc32()) crc32.c */
int dateformat OF((void)); /* local */
char dateseparator OF((void)); /* local */
-#ifndef WINDLL
- void version OF((__GPRO)); /* local */
-#endif
+void version OF((__GPRO)); /* local */
int mapattr OF((__GPRO)); /* local */
int mapname OF((__GPRO__ int renamed)); /* local */
int checkdir OF((__GPRO__ char *pathcomp, int flag)); /* local */
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ int mapnamew OF((__GPRO__ int renamed)); /* local */
+ int checkdirw OF((__GPRO__ wchar_t *pathcomp, int flag)); /* local */
+#endif
char *do_wild OF((__GPRO__ ZCONST char *wildzipfn)); /* local */
char *GetLoadPath OF((__GPRO)); /* local */
#if (defined(MORE) && (defined(ATH_BEO_UNX) || defined(QDOS) || defined(VMS)))
#ifdef SET_DIR_ATTRIB
int defer_dir_attribs OF((__GPRO__ direntry **pd)); /* local */
int set_direc_attribs OF((__GPRO__ direntry *d)); /* local */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ int defer_dir_attribsw OF((__GPRO__ direntryw **pd)); /* local */
+ int set_direc_attribsw OF((__GPRO__ direntryw *d)); /* local */
+# endif
#endif
#ifdef TIMESTAMP
# ifdef WIN32
/* Macros */
/************/
-#ifndef MAX
-# define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
+#define IZ_MAX( a, b) ((a) > (b) ? (a) : (b))
+#define IZ_MIN( a, b) ((a) < (b) ? (a) : (b))
#ifdef DEBUG
# if (defined(THEOS) && defined(NO_BOGUS_SPC))
# else
# define Trace(x) fprintf x
# endif
+# define Tracing 1
#else
# define Trace(x)
#endif
#define FnFilter2(fname) \
fnfilter((fname), slide + (extent)((WSIZE>>1) + (WSIZE>>2)),\
(extent)(WSIZE>>2))
+#define FnFilterW1( fname) \
+ fnfilterw( (fname), (wchar_t *)(slide + (extent)(WSIZE>> 1)), \
+ (extent)((WSIZE>> 2)/ sizeof( wchar_t)))
#ifndef FUNZIP /* used only in inflate.c */
# define MESSAGE(str,len,flag) (*G.message)((zvoid *)&G,(str),(len),(flag))
#ifdef SYMLINKS
/* This macro defines the Zip "made by" hosts that are considered
to support storing symbolic link entries. */
-# define SYMLINK_HOST(hn) ((hn) == UNIX_ || (hn) == ATARI_ || \
- (hn) == ATHEOS_ || (hn) == BEOS_ || (hn) == VMS_)
+# define SYMLINK_HOST(hn) ( (hn) == UNIX_ || (hn) == ATARI_ || \
+ (hn) == ATHEOS_ || (hn) == BEOS_ || (hn) == VMS_ || \
+ (hn) == FS_FAT_ )
#endif
#ifndef TEST_NTSD /* "NTSD valid?" checking function */
!(((islochdr) || (isuxatt)) && \
((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
(hostnum) == FS_HPFS_ || \
- ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \
+ ((hostnum) == FS_NTFS_ && (hostver) >= 50)) { \
_OEM_INTERN((string)); \
} else { \
_ISO_INTERN((string)); \
/**********************/
extern ZCONST unsigned near mask_bits[17];
- extern ZCONST char *fnames[2];
#ifdef EBCDIC
extern ZCONST uch ebcdic[];
extern ZCONST char Far FilenameNotMatched[];
extern ZCONST char Far ExclFilenameNotMatched[];
extern ZCONST char Far ReportMsg[];
+ extern ZCONST char Far ExtractMsg[];
#ifndef SFX
extern ZCONST char Far Zipnfo[];
extern ZCONST char Far CompiledWith[];
#endif /* !SFX */
-
+/* Defined in extract.c, used in os2/os2.c. */
+extern ZCONST char Far TruncEAs[];
+/* Defined in extract.c, used in win32/win32.c. */
+extern ZCONST char Far TruncNTSD[];
/***********************************/
/* Global (shared?) RTL variables */
/* convert UTF-8 string to wide string */
zwchar *utf8_to_wide_string OF((ZCONST char *utf8_string));
+ char *wchar_to_local_string OF((wchar_t *, int));
+
+ zwchar *wchar_to_wide_string OF((wchar_t *));
+
/* convert wide string to multi-byte string */
char *wide_to_local_string OF((ZCONST zwchar *wide_string, int escape_all));
# define utf8_to_escaped_string(utf8_string) \
utf8_to_local_string(utf8_string, TRUE)
+ wchar_t *wide_to_wchar_string(zwchar *wide_string);
+
+ zwchar *wchar_to_wide_string(wchar_t *wchar_string);
+
+ /* convert local to wide string */
+ zwchar *local_to_wide_string OF ((ZCONST char *local_string));
+
# if 0 /* currently unused */
/* convert escape string to wide character */
unsigned long escape_string_to_wide OF((ZCONST char *escape_string));
/* convert local to UTF-8 */
char *local_to_utf8_string OF ((ZCONST char *local_string));
- /* convert local to wide string */
- zwchar *local_to_wide_string OF ((ZCONST char *local_string));
-
/* convert wide string to UTF-8 */
char *wide_to_utf8_string OF((ZCONST zwchar *wide_string));
# endif /* unused */
#endif /* !__unzpriv_h */
+
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*
- unzvers.h (for UnZip) by Info-ZIP.
+ * unzvers.h (for UnZip) by Info-ZIP.
*/
-#ifndef __unzvers_h /* don't include more than once */
-#define __unzvers_h
+#ifndef __UNZVERS_H
+# define __UNZVERS_H
-#ifdef BETA
-# undef BETA /* undefine BETA for public releases */
-#endif
+/*
+# ifdef BETA
+# undef BETA
+# endif
+*/
+
+# ifndef BETA
+# define BETA /* Undefine BETA for public releases. */
+# endif
-#ifdef BETA
-# define UZ_BETALEVEL "h03 BETA"
-# define UZ_VERSION_DATE "17 Apr 09" /* internal beta version */
-#else
+# ifdef BETA
+# define UZ_BETALEVEL "c10 BETA"
+# define UZ_VERSION_DATE "18 Aug 2014" /* Internal beta version. */
+# else
# define UZ_BETALEVEL ""
-# define UZ_VERSION_DATE "20 April 2009" /* official release version */
+# define UZ_VERSION_DATE "?? ??? 2014" /* Official release version. */
# define RELEASE
-#endif
+# endif
-#define UZ_MAJORVER 6 /* UnZip */
-#define UZ_MINORVER 0
+# define UZ_MAJORVER 6 /* UnZip */
+# define UZ_MINORVER 1
-#define ZI_MAJORVER 3 /* ZipInfo */
-#define ZI_MINORVER 0
+# define ZI_MAJORVER 3 /* ZipInfo */
+# define ZI_MINORVER 1
-#define UZ_PATCHLEVEL 0
+# define UZ_PATCHLEVEL 0
-#define UZ_VER_STRING "6.0" /* keep in sync with Version numbers! */
+# define UZ_VER_STRING "6.10" /* Keep in sync with Version numbers! */
-#ifndef IZ_COMPANY_NAME /* might be already defined... */
+# ifndef IZ_COMPANY_NAME
# define IZ_COMPANY_NAME "Info-ZIP"
-#endif
+# endif
/* these are obsolete but remain for backward compatibility: */
-#if (defined(OS2) || defined(__OS2__))
+# if (defined(OS2) || defined(__OS2__))
# define D2_MAJORVER UZ_MAJORVER /* DLL for OS/2 */
# define D2_MINORVER UZ_MINORVER
# define D2_PATCHLEVEL UZ_PATCHLEVEL
-#endif
+# endif
-#define DW_MAJORVER UZ_MAJORVER /* DLL for MS Windows */
-#define DW_MINORVER UZ_MINORVER
-#define DW_PATCHLEVEL UZ_PATCHLEVEL
+# define DW_MAJORVER UZ_MAJORVER /* DLL for MS Windows */
+# define DW_MINORVER UZ_MINORVER
+# define DW_PATCHLEVEL UZ_PATCHLEVEL
-#define WIN_VERSION_DATE UZ_VERSION_DATE
+# define WIN_VERSION_DATE UZ_VERSION_DATE
-#define UNZ_DLL_VERSION UZ_VER_STRING
+# define UNZ_DLL_VERSION UZ_VER_STRING
/* The following version constants specify the UnZip version that introduced
* the most recent incompatible change (means: change that breaks backward
* be synchronized with the current UnZip version numbers.
*/
/* generic DLL API minimum compatible version*/
-#define UZ_GENAPI_COMP_MAJOR 6
-#define UZ_GENAPI_COMP_MINOR 0
-#define UZ_GENAPI_COMP_REVIS 0
+# define UZ_GENAPI_COMP_MAJOR 6
+# define UZ_GENAPI_COMP_MINOR 1
+# define UZ_GENAPI_COMP_REVIS 0
/* os2dll API minimum compatible version*/
-#define UZ_OS2API_COMP_MAJOR 6
-#define UZ_OS2API_COMP_MINOR 0
-#define UZ_OS2API_COMP_REVIS 0
+# define UZ_OS2API_COMP_MAJOR 6
+# define UZ_OS2API_COMP_MINOR 1
+# define UZ_OS2API_COMP_REVIS 0
/* windll API minimum compatible version*/
-#define UZ_WINAPI_COMP_MAJOR 6
-#define UZ_WINAPI_COMP_MINOR 0
-#define UZ_WINAPI_COMP_REVIS 0
+# define UZ_WINAPI_COMP_MAJOR 6
+# define UZ_WINAPI_COMP_MINOR 1
+# define UZ_WINAPI_COMP_REVIS 0
-#endif /* !__unzvers_h */
+#endif /* ndef __UNZVERS_H */
-Contents of the "vms" sub-archive for UnZip 6.00 and later:
+ Contents of the UnZip 6.10 Source Archive "vms" directory
+ ---------------------------------------------------------
- Contents this file
- INSTALL.VMS VMS-specific build and install instructions
- NOTES.TXT description of new features in VMS Zip 3.0 and UnZip 6.0
- README general VMS info about using UnZip and zipfiles
- UNZIP_MSG.MSG messages source for VMS built-in error message facility
- unzip_def.rnh UnZip default help page, RUNOFF format
- unzip_cli.help UnZip VMSCLI help page, TPU format
- unzipsfx.hlp UnZipSFX pre-formatted help page
- cvthelp.tpu TPU macro file to convert .help file to RUNOFF format
- cmdline.c VMS-style command-line-interface code (if VMSCLI defined)
- unz_cli.cld more VMS-command-line stuff (if VMSCLI defined)
- vms.c VMS file manipulation code
- vms.h VMS header file for UnZip
- vmscfg.h VMS-specific configuration settings
- vmsdefs.h VMS system declarations (missing C compiler support)
- build_unzip.com command file to build or (re-)link UnZip
- descrip.mms MMK/MMS makefile for UnZip/ZipInfo and UnZipSFX
- descrip_deps.mms MMK/MMS include file providing source dependencies
- descrip_mkdeps.mms MMK/MMS makefile for regenerating descrip_deps.mms
- descrip_src.mms MMK/MMS include file, provides environment setup
- collect_deps.com command file used in source dependencies creation
- mod_deps.com command file used in source dependencies creation
- unzip.opt options file used for linking unzip
- unzipsfx.opt options file used for linking unzipsfx
- makesfx.com command file to create self-extracting archives
- unixio_gcc.h unixio.h system header replacement for gcc
- unixlib_gcc.h unixlib.h system header replacement for gcc
- bzlib.h VMS wrapper header file for the bzip2 library definitions
- find_bzip2_lib.com command procedure to set up environment for bzip2 support
- infback9.h VMS wrapper header file for zlib inflate64 definitions
- zlib.h VMS wrapper header file for zlib library definitions
+build_unzip.com DCL script to build UnZip (and friends)
+bzlib.h VMS wrapper header file for the bzip2 library definitions
+cmdline.c VMS-style command-line-interface code (if VMSCLI defined)
+collect_deps.com DCL script used in source dependencies creation
+Contents This file
+cppcld.com DCL script to use CC /PREPROCESS_ONLY on .CLD file
+cvthelp.tpu TPU command file to convert .help file to RUNOFF format
+descrip.mms MMK/MMS description with UnZip/ZipInfo and UnZipSFX
+descrip_deps.mms MMK/MMS include file for source dependencies
+descrip_mkdeps.mms MMK/MMS description for generating descrip_deps.mms
+descrip_src.mms MMK/MMS include file with common matter
+find_bzip2_lib.com DCL script to locate bzip2 and zlib libraries
+hlp_lib_next.com DCL script to find next HLP$LIBRARY[_*] logical
+infback9.h VMS wrapper header file for zlib inflate64 definitions
+INSTALL_VMS.txt VMS-specific build and install instructions
+makesfx.com DCL script to create a self-extracting archive
+memory.h Replacement for <memory.h>, where missing.
+mod_dep.com DCL script used in source dependencies creation
+NOTES.TXT VMS-specific usage notes
+optgen.com DCL script used to create module-ID link option files
+stream_lf.fdl FDL file used to create Stream_LF files.
+test_unzip.com DCL script to run basic UnZip tests
+unixio_gcc.h unixio.h system header replacement for gcc
+unixlib_gcc.h unixlib.h system header replacement for gcc
+unzipsfx.hlp UnZipSFX pre-formatted help page
+unzip_cli.help UnZip VMS-style command line help page (TPU source)
+UNZIP_DEF.RNH UnZip Unix-style command line help page (RUNOFF source)
+UNZIP_MSG.MSG Message utility source file
+unz_cli.cld Command definition file for UnZip and ZipInfo
+vms.c VMS-specific C source
+vms.h VMS-specific C header file
+vmscfg.h VMS-specific C header file for inclusion in unzpriv.h
+vmsdefs.h VMS system declarations (missing C compiler support)
+zlib.h VMS wrapper header file for zlib library definitions
-MAKE/VMS is no longer supported since MMK (MMS clone by Matt Madison/MadGoat
-Enterprises, compatible with descrip.mms) is both free and becoming quite
-popular. MMK is available by anonymous ftp from ftp.spc.edu/ftp.wku.edu and
-by mailserver at lists.wku.edu. Check VMS newsgroups for announcements and
-exact location.
-
-Detailed compilation and installation instructions can be found in the
-INSTALL.VMS file in this directory.
--- /dev/null
+#
+# UnZip for VMS - MMS (or MMK) Source Dependency File.
+#
+
+# This description file is included by other description files. It is
+# not intended to be used alone. Verify proper inclusion.
+
+.IFDEF INCL_DESCRIP_DEPS
+.ELSE
+$$$$ THIS DESCRIPTION FILE IS NOT INTENDED TO BE USED THIS WAY.
+.ENDIF
+
+[.$(DEST)]API.OBJ : []API.C
+[.$(DEST)]APIHELP_L.OBJ : []APIHELP.C
+[.$(DEST)]APIHELP_L.OBJ : []UNZIP.H
+[.$(DEST)]APIHELP_L.OBJ : []UNZPRIV.H
+[.$(DEST)]APIHELP_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]APIHELP_L.OBJ : []API.H
+[.$(DEST)]APIHELP_L.OBJ : []GLOBALS.H
+[.$(DEST)]APIHELP_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]APIHELP_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]APIHELP_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]APIHELP_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]APIHELP_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]APIHELP_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]APIHELP_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]APIHELP_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]APIHELP_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]APIHELP_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]APIHELP_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]APIHELP_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]APIHELP_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]APIHELP_L.OBJ : []UNZVERS.H
+[.$(DEST)]API_L.OBJ : []API.C
+[.$(DEST)]API_L.OBJ : []UNZIP.H
+[.$(DEST)]API_L.OBJ : []UNZPRIV.H
+[.$(DEST)]API_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]API_L.OBJ : []API.H
+[.$(DEST)]API_L.OBJ : []GLOBALS.H
+[.$(DEST)]API_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]API_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]API_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]API_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]API_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]API_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]API_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]API_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]API_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]API_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]API_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]API_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]API_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]API_L.OBJ : []UNZVERS.H
+[.$(DEST)]API_L.OBJ : []CRYPT.H
+[.$(DEST)]CRC32.OBJ : []CRC32.C
+[.$(DEST)]CRC32.OBJ : []ZIP.H
+[.$(DEST)]CRC32.OBJ : []UNZIP.H
+[.$(DEST)]CRC32.OBJ : []UNZPRIV.H
+[.$(DEST)]CRC32.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]CRC32.OBJ : []GLOBALS.H
+[.$(DEST)]CRC32.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]CRC32.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]CRC32.OBJ : [.AES_WG]AES.H
+[.$(DEST)]CRC32.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]CRC32.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]CRC32.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]CRC32.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRC32.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]CRC32.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRC32.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]CRC32.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]CRC32.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRC32.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]CRC32.OBJ : []CRC32.H
+[.$(DEST)]CRC32_.OBJ : []CRC32.C
+[.$(DEST)]CRC32_.OBJ : []ZIP.H
+[.$(DEST)]CRC32_.OBJ : []UNZIP.H
+[.$(DEST)]CRC32_.OBJ : []UNZPRIV.H
+[.$(DEST)]CRC32_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]CRC32_.OBJ : []GLOBALS.H
+[.$(DEST)]CRC32_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]CRC32_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]CRC32_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]CRC32_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]CRC32_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]CRC32_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]CRC32_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRC32_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]CRC32_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRC32_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]CRC32_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]CRC32_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRC32_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]CRC32_.OBJ : []CRC32.H
+[.$(DEST)]CRYPT.OBJ : []CRYPT.C
+[.$(DEST)]CRYPT.OBJ : []ZIP.H
+[.$(DEST)]CRYPT.OBJ : []UNZIP.H
+[.$(DEST)]CRYPT.OBJ : []UNZPRIV.H
+[.$(DEST)]CRYPT.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]CRYPT.OBJ : []GLOBALS.H
+[.$(DEST)]CRYPT.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]CRYPT.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]CRYPT.OBJ : [.AES_WG]AES.H
+[.$(DEST)]CRYPT.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]CRYPT.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]CRYPT.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]CRYPT.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]CRYPT.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]CRYPT.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]CRYPT.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]CRYPT.OBJ : []CRYPT.H
+[.$(DEST)]CRYPT.OBJ : []TTYIO.H
+[.$(DEST)]CRYPT.OBJ : []CRC32.H
+[.$(DEST)]CRYPT_.OBJ : []CRYPT.C
+[.$(DEST)]CRYPT_.OBJ : []ZIP.H
+[.$(DEST)]CRYPT_.OBJ : []UNZIP.H
+[.$(DEST)]CRYPT_.OBJ : []UNZPRIV.H
+[.$(DEST)]CRYPT_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]CRYPT_.OBJ : []GLOBALS.H
+[.$(DEST)]CRYPT_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]CRYPT_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]CRYPT_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]CRYPT_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]CRYPT_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]CRYPT_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]CRYPT_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]CRYPT_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]CRYPT_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]CRYPT_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]CRYPT_.OBJ : []CRYPT.H
+[.$(DEST)]CRYPT_.OBJ : []TTYIO.H
+[.$(DEST)]CRYPT_.OBJ : []CRC32.H
+[.$(DEST)]CRYPT_L.OBJ : []CRYPT.C
+[.$(DEST)]CRYPT_L.OBJ : []ZIP.H
+[.$(DEST)]CRYPT_L.OBJ : []UNZIP.H
+[.$(DEST)]CRYPT_L.OBJ : []UNZPRIV.H
+[.$(DEST)]CRYPT_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]CRYPT_L.OBJ : []API.H
+[.$(DEST)]CRYPT_L.OBJ : []GLOBALS.H
+[.$(DEST)]CRYPT_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]CRYPT_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]CRYPT_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]CRYPT_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]CRYPT_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]CRYPT_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]CRYPT_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]CRYPT_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]CRYPT_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]CRYPT_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]CRYPT_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]CRYPT_L.OBJ : []CRYPT.H
+[.$(DEST)]CRYPT_L.OBJ : []TTYIO.H
+[.$(DEST)]CRYPT_L.OBJ : []CRC32.H
+[.$(DEST)]ENVARGS.OBJ : []ENVARGS.C
+[.$(DEST)]ENVARGS.OBJ : []UNZIP.H
+[.$(DEST)]ENVARGS.OBJ : []UNZPRIV.H
+[.$(DEST)]ENVARGS.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]ENVARGS.OBJ : []GLOBALS.H
+[.$(DEST)]ENVARGS.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]ENVARGS.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]ENVARGS.OBJ : [.AES_WG]AES.H
+[.$(DEST)]ENVARGS.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]ENVARGS.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]ENVARGS.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]ENVARGS.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]ENVARGS.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]ENVARGS.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]ENVARGS.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]ENVARGS.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]ENVARGS.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]ENVARGS.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]EXPLODE.OBJ : []EXPLODE.C
+[.$(DEST)]EXPLODE.OBJ : []UNZIP.H
+[.$(DEST)]EXPLODE.OBJ : []UNZPRIV.H
+[.$(DEST)]EXPLODE.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]EXPLODE.OBJ : []GLOBALS.H
+[.$(DEST)]EXPLODE.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]EXPLODE.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]EXPLODE.OBJ : [.AES_WG]AES.H
+[.$(DEST)]EXPLODE.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]EXPLODE.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]EXPLODE.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]EXPLODE.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXPLODE.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]EXPLODE.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXPLODE.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]EXPLODE.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]EXPLODE.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXPLODE.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]EXPLODE_L.OBJ : []EXPLODE.C
+[.$(DEST)]EXPLODE_L.OBJ : []UNZIP.H
+[.$(DEST)]EXPLODE_L.OBJ : []UNZPRIV.H
+[.$(DEST)]EXPLODE_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]EXPLODE_L.OBJ : []API.H
+[.$(DEST)]EXPLODE_L.OBJ : []GLOBALS.H
+[.$(DEST)]EXPLODE_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]EXPLODE_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]EXPLODE_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]EXPLODE_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]EXPLODE_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]EXPLODE_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]EXPLODE_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXPLODE_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]EXPLODE_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXPLODE_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]EXPLODE_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]EXPLODE_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXPLODE_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]EXTRACT.OBJ : []EXTRACT.C
+[.$(DEST)]EXTRACT.OBJ : []UNZIP.H
+[.$(DEST)]EXTRACT.OBJ : []UNZPRIV.H
+[.$(DEST)]EXTRACT.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]EXTRACT.OBJ : []GLOBALS.H
+[.$(DEST)]EXTRACT.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]EXTRACT.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]EXTRACT.OBJ : [.AES_WG]AES.H
+[.$(DEST)]EXTRACT.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]EXTRACT.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]EXTRACT.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]EXTRACT.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]EXTRACT.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]EXTRACT.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]EXTRACT.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]EXTRACT.OBJ : []CRC32.H
+[.$(DEST)]EXTRACT.OBJ : []CRYPT.H
+[.$(DEST)]EXTRACT_.OBJ : []EXTRACT.C
+[.$(DEST)]EXTRACT_.OBJ : []UNZIP.H
+[.$(DEST)]EXTRACT_.OBJ : []UNZPRIV.H
+[.$(DEST)]EXTRACT_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]EXTRACT_.OBJ : []GLOBALS.H
+[.$(DEST)]EXTRACT_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]EXTRACT_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]EXTRACT_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]EXTRACT_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]EXTRACT_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]EXTRACT_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]EXTRACT_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]EXTRACT_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]EXTRACT_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]EXTRACT_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]EXTRACT_.OBJ : []CRC32.H
+[.$(DEST)]EXTRACT_.OBJ : []CRYPT.H
+[.$(DEST)]EXTRACT_L.OBJ : []EXTRACT.C
+[.$(DEST)]EXTRACT_L.OBJ : []UNZIP.H
+[.$(DEST)]EXTRACT_L.OBJ : []UNZPRIV.H
+[.$(DEST)]EXTRACT_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]EXTRACT_L.OBJ : []API.H
+[.$(DEST)]EXTRACT_L.OBJ : []GLOBALS.H
+[.$(DEST)]EXTRACT_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]EXTRACT_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]EXTRACT_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]EXTRACT_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]EXTRACT_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]EXTRACT_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]EXTRACT_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]EXTRACT_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]EXTRACT_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]EXTRACT_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]EXTRACT_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]EXTRACT_L.OBJ : []CRC32.H
+[.$(DEST)]EXTRACT_L.OBJ : []CRYPT.H
+[.$(DEST)]FILEIO.OBJ : []FILEIO.C
+[.$(DEST)]FILEIO.OBJ : []UNZIP.H
+[.$(DEST)]FILEIO.OBJ : []UNZPRIV.H
+[.$(DEST)]FILEIO.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]FILEIO.OBJ : []GLOBALS.H
+[.$(DEST)]FILEIO.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]FILEIO.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]FILEIO.OBJ : [.AES_WG]AES.H
+[.$(DEST)]FILEIO.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]FILEIO.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]FILEIO.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]FILEIO.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]FILEIO.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]FILEIO.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]FILEIO.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]FILEIO.OBJ : []CRC32.H
+[.$(DEST)]FILEIO.OBJ : []CRYPT.H
+[.$(DEST)]FILEIO.OBJ : []TTYIO.H
+[.$(DEST)]FILEIO.OBJ : []EBCDIC.H
+[.$(DEST)]FILEIO_.OBJ : []FILEIO.C
+[.$(DEST)]FILEIO_.OBJ : []UNZIP.H
+[.$(DEST)]FILEIO_.OBJ : []UNZPRIV.H
+[.$(DEST)]FILEIO_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]FILEIO_.OBJ : []GLOBALS.H
+[.$(DEST)]FILEIO_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]FILEIO_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]FILEIO_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]FILEIO_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]FILEIO_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]FILEIO_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]FILEIO_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]FILEIO_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]FILEIO_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]FILEIO_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]FILEIO_.OBJ : []CRC32.H
+[.$(DEST)]FILEIO_.OBJ : []CRYPT.H
+[.$(DEST)]FILEIO_.OBJ : []TTYIO.H
+[.$(DEST)]FILEIO_.OBJ : []EBCDIC.H
+[.$(DEST)]FILEIO_L.OBJ : []FILEIO.C
+[.$(DEST)]FILEIO_L.OBJ : []UNZIP.H
+[.$(DEST)]FILEIO_L.OBJ : []UNZPRIV.H
+[.$(DEST)]FILEIO_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]FILEIO_L.OBJ : []API.H
+[.$(DEST)]FILEIO_L.OBJ : []GLOBALS.H
+[.$(DEST)]FILEIO_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]FILEIO_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]FILEIO_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]FILEIO_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]FILEIO_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]FILEIO_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]FILEIO_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]FILEIO_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]FILEIO_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]FILEIO_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]FILEIO_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]FILEIO_L.OBJ : []CRC32.H
+[.$(DEST)]FILEIO_L.OBJ : []CRYPT.H
+[.$(DEST)]FILEIO_L.OBJ : []TTYIO.H
+[.$(DEST)]FILEIO_L.OBJ : []EBCDIC.H
+[.$(DEST)]GLOBALS.OBJ : []GLOBALS.C
+[.$(DEST)]GLOBALS.OBJ : []UNZIP.H
+[.$(DEST)]GLOBALS.OBJ : []UNZPRIV.H
+[.$(DEST)]GLOBALS.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]GLOBALS.OBJ : []GLOBALS.H
+[.$(DEST)]GLOBALS.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]GLOBALS.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]GLOBALS.OBJ : [.AES_WG]AES.H
+[.$(DEST)]GLOBALS.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]GLOBALS.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]GLOBALS.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]GLOBALS.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]GLOBALS.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]GLOBALS.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]GLOBALS.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]GLOBALS_.OBJ : []GLOBALS.C
+[.$(DEST)]GLOBALS_.OBJ : []UNZIP.H
+[.$(DEST)]GLOBALS_.OBJ : []UNZPRIV.H
+[.$(DEST)]GLOBALS_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]GLOBALS_.OBJ : []GLOBALS.H
+[.$(DEST)]GLOBALS_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]GLOBALS_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]GLOBALS_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]GLOBALS_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]GLOBALS_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]GLOBALS_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]GLOBALS_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]GLOBALS_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]GLOBALS_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]GLOBALS_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]GLOBALS_L.OBJ : []GLOBALS.C
+[.$(DEST)]GLOBALS_L.OBJ : []UNZIP.H
+[.$(DEST)]GLOBALS_L.OBJ : []UNZPRIV.H
+[.$(DEST)]GLOBALS_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]GLOBALS_L.OBJ : []API.H
+[.$(DEST)]GLOBALS_L.OBJ : []GLOBALS.H
+[.$(DEST)]GLOBALS_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]GLOBALS_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]GLOBALS_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]GLOBALS_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]GLOBALS_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]GLOBALS_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]GLOBALS_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]GLOBALS_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]GLOBALS_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]GLOBALS_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]GLOBALS_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]INFLATE.OBJ : []INFLATE.C
+[.$(DEST)]INFLATE.OBJ : []INFLATE.H
+[.$(DEST)]INFLATE.OBJ : []UNZIP.H
+[.$(DEST)]INFLATE.OBJ : []UNZPRIV.H
+[.$(DEST)]INFLATE.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]INFLATE.OBJ : []GLOBALS.H
+[.$(DEST)]INFLATE.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]INFLATE.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]INFLATE.OBJ : [.AES_WG]AES.H
+[.$(DEST)]INFLATE.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]INFLATE.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]INFLATE.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]INFLATE.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]INFLATE.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]INFLATE.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]INFLATE.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]INFLATE_.OBJ : []INFLATE.C
+[.$(DEST)]INFLATE_.OBJ : []INFLATE.H
+[.$(DEST)]INFLATE_.OBJ : []UNZIP.H
+[.$(DEST)]INFLATE_.OBJ : []UNZPRIV.H
+[.$(DEST)]INFLATE_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]INFLATE_.OBJ : []GLOBALS.H
+[.$(DEST)]INFLATE_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]INFLATE_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]INFLATE_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]INFLATE_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]INFLATE_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]INFLATE_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]INFLATE_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]INFLATE_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]INFLATE_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]INFLATE_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]INFLATE_L.OBJ : []INFLATE.C
+[.$(DEST)]INFLATE_L.OBJ : []INFLATE.H
+[.$(DEST)]INFLATE_L.OBJ : []UNZIP.H
+[.$(DEST)]INFLATE_L.OBJ : []UNZPRIV.H
+[.$(DEST)]INFLATE_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]INFLATE_L.OBJ : []API.H
+[.$(DEST)]INFLATE_L.OBJ : []GLOBALS.H
+[.$(DEST)]INFLATE_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]INFLATE_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]INFLATE_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]INFLATE_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]INFLATE_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]INFLATE_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]INFLATE_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]INFLATE_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]INFLATE_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]INFLATE_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]INFLATE_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]LIST.OBJ : []LIST.C
+[.$(DEST)]LIST.OBJ : []UNZIP.H
+[.$(DEST)]LIST.OBJ : []UNZPRIV.H
+[.$(DEST)]LIST.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]LIST.OBJ : []GLOBALS.H
+[.$(DEST)]LIST.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]LIST.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]LIST.OBJ : [.AES_WG]AES.H
+[.$(DEST)]LIST.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]LIST.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]LIST.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]LIST.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]LIST.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]LIST.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]LIST.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]LIST.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]LIST.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]LIST.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]LIST_L.OBJ : []LIST.C
+[.$(DEST)]LIST_L.OBJ : []UNZIP.H
+[.$(DEST)]LIST_L.OBJ : []UNZPRIV.H
+[.$(DEST)]LIST_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]LIST_L.OBJ : []API.H
+[.$(DEST)]LIST_L.OBJ : []GLOBALS.H
+[.$(DEST)]LIST_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]LIST_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]LIST_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]LIST_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]LIST_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]LIST_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]LIST_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]LIST_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]LIST_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]LIST_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]LIST_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]LIST_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]LIST_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]MATCH.OBJ : []MATCH.C
+[.$(DEST)]MATCH.OBJ : []UNZIP.H
+[.$(DEST)]MATCH.OBJ : []UNZPRIV.H
+[.$(DEST)]MATCH.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]MATCH.OBJ : []GLOBALS.H
+[.$(DEST)]MATCH.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]MATCH.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]MATCH.OBJ : [.AES_WG]AES.H
+[.$(DEST)]MATCH.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]MATCH.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]MATCH.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]MATCH.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]MATCH.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]MATCH.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]MATCH.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]MATCH.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]MATCH.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]MATCH.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]MATCH_.OBJ : []MATCH.C
+[.$(DEST)]MATCH_.OBJ : []UNZIP.H
+[.$(DEST)]MATCH_.OBJ : []UNZPRIV.H
+[.$(DEST)]MATCH_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]MATCH_.OBJ : []GLOBALS.H
+[.$(DEST)]MATCH_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]MATCH_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]MATCH_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]MATCH_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]MATCH_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]MATCH_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]MATCH_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]MATCH_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]MATCH_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]MATCH_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]MATCH_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]MATCH_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]MATCH_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]PROCESS.OBJ : []PROCESS.C
+[.$(DEST)]PROCESS.OBJ : []UNZIP.H
+[.$(DEST)]PROCESS.OBJ : []UNZPRIV.H
+[.$(DEST)]PROCESS.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]PROCESS.OBJ : []GLOBALS.H
+[.$(DEST)]PROCESS.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]PROCESS.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]PROCESS.OBJ : [.AES_WG]AES.H
+[.$(DEST)]PROCESS.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]PROCESS.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]PROCESS.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]PROCESS.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]PROCESS.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]PROCESS.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]PROCESS.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]PROCESS.OBJ : []CRC32.H
+[.$(DEST)]PROCESS_.OBJ : []PROCESS.C
+[.$(DEST)]PROCESS_.OBJ : []UNZIP.H
+[.$(DEST)]PROCESS_.OBJ : []UNZPRIV.H
+[.$(DEST)]PROCESS_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]PROCESS_.OBJ : []GLOBALS.H
+[.$(DEST)]PROCESS_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]PROCESS_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]PROCESS_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]PROCESS_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]PROCESS_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]PROCESS_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]PROCESS_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]PROCESS_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]PROCESS_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]PROCESS_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]PROCESS_.OBJ : []CRC32.H
+[.$(DEST)]PROCESS_L.OBJ : []PROCESS.C
+[.$(DEST)]PROCESS_L.OBJ : []UNZIP.H
+[.$(DEST)]PROCESS_L.OBJ : []UNZPRIV.H
+[.$(DEST)]PROCESS_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]PROCESS_L.OBJ : []API.H
+[.$(DEST)]PROCESS_L.OBJ : []GLOBALS.H
+[.$(DEST)]PROCESS_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]PROCESS_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]PROCESS_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]PROCESS_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]PROCESS_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]PROCESS_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]PROCESS_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]PROCESS_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]PROCESS_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]PROCESS_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]PROCESS_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]TTYIO.OBJ : []TTYIO.C
+[.$(DEST)]TTYIO.OBJ : []ZIP.H
+[.$(DEST)]TTYIO.OBJ : []UNZIP.H
+[.$(DEST)]TTYIO.OBJ : []UNZPRIV.H
+[.$(DEST)]TTYIO.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]TTYIO.OBJ : []GLOBALS.H
+[.$(DEST)]TTYIO.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]TTYIO.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]TTYIO.OBJ : [.AES_WG]AES.H
+[.$(DEST)]TTYIO.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]TTYIO.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]TTYIO.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]TTYIO.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]TTYIO.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]TTYIO.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]TTYIO.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]TTYIO.OBJ : []CRYPT.H
+[.$(DEST)]TTYIO.OBJ : []TTYIO.H
+[.$(DEST)]TTYIO_.OBJ : []TTYIO.C
+[.$(DEST)]TTYIO_.OBJ : []ZIP.H
+[.$(DEST)]TTYIO_.OBJ : []UNZIP.H
+[.$(DEST)]TTYIO_.OBJ : []UNZPRIV.H
+[.$(DEST)]TTYIO_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]TTYIO_.OBJ : []GLOBALS.H
+[.$(DEST)]TTYIO_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]TTYIO_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]TTYIO_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]TTYIO_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]TTYIO_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]TTYIO_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]TTYIO_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]TTYIO_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]TTYIO_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]TTYIO_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]TTYIO_.OBJ : []CRYPT.H
+[.$(DEST)]TTYIO_.OBJ : []TTYIO.H
+[.$(DEST)]TTYIO_L.OBJ : []TTYIO.C
+[.$(DEST)]TTYIO_L.OBJ : []ZIP.H
+[.$(DEST)]TTYIO_L.OBJ : []UNZIP.H
+[.$(DEST)]TTYIO_L.OBJ : []UNZPRIV.H
+[.$(DEST)]TTYIO_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]TTYIO_L.OBJ : []API.H
+[.$(DEST)]TTYIO_L.OBJ : []GLOBALS.H
+[.$(DEST)]TTYIO_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]TTYIO_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]TTYIO_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]TTYIO_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]TTYIO_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]TTYIO_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]TTYIO_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]TTYIO_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]TTYIO_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]TTYIO_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]TTYIO_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]TTYIO_L.OBJ : []CRYPT.H
+[.$(DEST)]TTYIO_L.OBJ : []TTYIO.H
+[.$(DEST)]UBZ2ERR.OBJ : []UBZ2ERR.C
+[.$(DEST)]UBZ2ERR.OBJ : []UNZIP.H
+[.$(DEST)]UBZ2ERR.OBJ : []UNZPRIV.H
+[.$(DEST)]UBZ2ERR.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UBZ2ERR.OBJ : []GLOBALS.H
+[.$(DEST)]UBZ2ERR.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UBZ2ERR.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UBZ2ERR.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UBZ2ERR.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UBZ2ERR.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UBZ2ERR.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UBZ2ERR.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UBZ2ERR.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UBZ2ERR.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UBZ2ERR.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UBZ2ERR_.OBJ : []UBZ2ERR.C
+[.$(DEST)]UBZ2ERR_.OBJ : []UNZIP.H
+[.$(DEST)]UBZ2ERR_.OBJ : []UNZPRIV.H
+[.$(DEST)]UBZ2ERR_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UBZ2ERR_.OBJ : []GLOBALS.H
+[.$(DEST)]UBZ2ERR_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UBZ2ERR_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UBZ2ERR_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UBZ2ERR_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UBZ2ERR_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UBZ2ERR_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UBZ2ERR_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UBZ2ERR_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UBZ2ERR_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UBZ2ERR_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UBZ2ERR_L.OBJ : []UBZ2ERR.C
+[.$(DEST)]UBZ2ERR_L.OBJ : []UNZIP.H
+[.$(DEST)]UBZ2ERR_L.OBJ : []UNZPRIV.H
+[.$(DEST)]UBZ2ERR_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UBZ2ERR_L.OBJ : []API.H
+[.$(DEST)]UBZ2ERR_L.OBJ : []GLOBALS.H
+[.$(DEST)]UBZ2ERR_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UBZ2ERR_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UBZ2ERR_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UBZ2ERR_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UBZ2ERR_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UBZ2ERR_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UBZ2ERR_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UBZ2ERR_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UBZ2ERR_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UBZ2ERR_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UBZ2ERR_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNREDUCE.OBJ : []UNREDUCE.C
+[.$(DEST)]UNREDUCE.OBJ : []UNZIP.H
+[.$(DEST)]UNREDUCE.OBJ : []UNZPRIV.H
+[.$(DEST)]UNREDUCE.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UNREDUCE.OBJ : []GLOBALS.H
+[.$(DEST)]UNREDUCE.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UNREDUCE.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UNREDUCE.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UNREDUCE.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UNREDUCE.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UNREDUCE.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UNREDUCE.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNREDUCE.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UNREDUCE.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNREDUCE.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UNREDUCE.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UNREDUCE.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNREDUCE.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNSHRINK.OBJ : []UNSHRINK.C
+[.$(DEST)]UNSHRINK.OBJ : []UNZIP.H
+[.$(DEST)]UNSHRINK.OBJ : []UNZPRIV.H
+[.$(DEST)]UNSHRINK.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UNSHRINK.OBJ : []GLOBALS.H
+[.$(DEST)]UNSHRINK.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UNSHRINK.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UNSHRINK.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UNSHRINK.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UNSHRINK.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UNSHRINK.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UNSHRINK.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNSHRINK.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UNSHRINK.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNSHRINK.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UNSHRINK.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UNSHRINK.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNSHRINK.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNSHRINK_L.OBJ : []UNSHRINK.C
+[.$(DEST)]UNSHRINK_L.OBJ : []UNZIP.H
+[.$(DEST)]UNSHRINK_L.OBJ : []UNZPRIV.H
+[.$(DEST)]UNSHRINK_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UNSHRINK_L.OBJ : []API.H
+[.$(DEST)]UNSHRINK_L.OBJ : []GLOBALS.H
+[.$(DEST)]UNSHRINK_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UNSHRINK_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UNSHRINK_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UNSHRINK_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UNSHRINK_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UNSHRINK_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UNSHRINK_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNSHRINK_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UNSHRINK_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNSHRINK_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UNSHRINK_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UNSHRINK_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNSHRINK_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIP.OBJ : []UNZIP.C
+[.$(DEST)]UNZIP.OBJ : []UNZIP.H
+[.$(DEST)]UNZIP.OBJ : []UNZPRIV.H
+[.$(DEST)]UNZIP.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UNZIP.OBJ : []GLOBALS.H
+[.$(DEST)]UNZIP.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIP.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UNZIP.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UNZIP.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UNZIP.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UNZIP.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UNZIP.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UNZIP.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UNZIP.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UNZIP.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIP.OBJ : []CRYPT.H
+[.$(DEST)]UNZIP.OBJ : []UNZVERS.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIP.OBJ : [.AES_WG]AESOPT.H
+[.$(DEST)]UNZIP.OBJ : [.AES_WG]BRG_ENDIAN.H
+[.$(DEST)]UNZIP.OBJ : [.AES_WG]IZ_AES_WG.H
+.ENDIF # AES_WG
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP.OBJ : [.SZIP]SZVERSION.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIP.OBJ : []CONSTS.H
+[.$(DEST)]UNZIP.OBJ : []MEMDIAG.C
+[.$(DEST)]UNZIPSFX.OBJ : []UNZIP.C
+[.$(DEST)]UNZIPSFX.OBJ : []UNZIP.H
+[.$(DEST)]UNZIPSFX.OBJ : []UNZPRIV.H
+[.$(DEST)]UNZIPSFX.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UNZIPSFX.OBJ : []GLOBALS.H
+[.$(DEST)]UNZIPSFX.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIPSFX.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UNZIPSFX.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UNZIPSFX.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UNZIPSFX.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UNZIPSFX.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UNZIPSFX.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIPSFX.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UNZIPSFX.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIPSFX.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UNZIPSFX.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UNZIPSFX.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIPSFX.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIPSFX.OBJ : []CRYPT.H
+[.$(DEST)]UNZIPSFX.OBJ : []UNZVERS.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIPSFX.OBJ : [.AES_WG]AESOPT.H
+[.$(DEST)]UNZIPSFX.OBJ : [.AES_WG]BRG_ENDIAN.H
+[.$(DEST)]UNZIPSFX.OBJ : [.AES_WG]IZ_AES_WG.H
+.ENDIF # AES_WG
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIPSFX.OBJ : [.SZIP]SZVERSION.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIPSFX.OBJ : []CONSTS.H
+[.$(DEST)]UNZIPSFX.OBJ : []MEMDIAG.C
+[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZIP.C
+[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZIP.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZPRIV.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : []GLOBALS.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIPSFX_CLI.OBJ : []CRYPT.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZVERS.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.AES_WG]AESOPT.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.AES_WG]BRG_ENDIAN.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.AES_WG]IZ_AES_WG.H
+.ENDIF # AES_WG
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIPSFX_CLI.OBJ : [.SZIP]SZVERSION.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIPSFX_CLI.OBJ : []CONSTS.H
+[.$(DEST)]UNZIPSFX_CLI.OBJ : []MEMDIAG.C
+[.$(DEST)]UNZIP_CLI.OBJ : []UNZIP.C
+[.$(DEST)]UNZIP_CLI.OBJ : []UNZIP.H
+[.$(DEST)]UNZIP_CLI.OBJ : []UNZPRIV.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UNZIP_CLI.OBJ : []GLOBALS.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIP_CLI.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UNZIP_CLI.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP_CLI.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UNZIP_CLI.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP_CLI.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UNZIP_CLI.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP_CLI.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIP_CLI.OBJ : []CRYPT.H
+[.$(DEST)]UNZIP_CLI.OBJ : []UNZVERS.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIP_CLI.OBJ : [.AES_WG]AESOPT.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.AES_WG]BRG_ENDIAN.H
+[.$(DEST)]UNZIP_CLI.OBJ : [.AES_WG]IZ_AES_WG.H
+.ENDIF # AES_WG
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP_CLI.OBJ : [.SZIP]SZVERSION.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIP_CLI.OBJ : []CONSTS.H
+[.$(DEST)]UNZIP_CLI.OBJ : []MEMDIAG.C
+[.$(DEST)]UNZIP_L.OBJ : []UNZIP.C
+[.$(DEST)]UNZIP_L.OBJ : []UNZIP.H
+[.$(DEST)]UNZIP_L.OBJ : []UNZPRIV.H
+[.$(DEST)]UNZIP_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]UNZIP_L.OBJ : []API.H
+[.$(DEST)]UNZIP_L.OBJ : []GLOBALS.H
+[.$(DEST)]UNZIP_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIP_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]UNZIP_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]UNZIP_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]UNZIP_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]UNZIP_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]UNZIP_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]UNZIP_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]UNZIP_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]UNZIP_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIP_L.OBJ : []CRYPT.H
+[.$(DEST)]UNZIP_L.OBJ : []UNZVERS.H
+.IFDEF AES_WG
+[.$(DEST)]UNZIP_L.OBJ : [.AES_WG]AESOPT.H
+[.$(DEST)]UNZIP_L.OBJ : [.AES_WG]BRG_ENDIAN.H
+[.$(DEST)]UNZIP_L.OBJ : [.AES_WG]IZ_AES_WG.H
+.ENDIF # AES_WG
+.IFDEF LZMA_PPMD
+[.$(DEST)]UNZIP_L.OBJ : [.SZIP]SZVERSION.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]UNZIP_L.OBJ : []CONSTS.H
+[.$(DEST)]UNZIP_L.OBJ : []MEMDIAG.C
+[.$(DEST)]ZIPINFO.OBJ : []ZIPINFO.C
+[.$(DEST)]ZIPINFO.OBJ : []UNZIP.H
+[.$(DEST)]ZIPINFO.OBJ : []UNZPRIV.H
+[.$(DEST)]ZIPINFO.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]ZIPINFO.OBJ : []GLOBALS.H
+[.$(DEST)]ZIPINFO.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]ZIPINFO.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]ZIPINFO.OBJ : [.AES_WG]AES.H
+[.$(DEST)]ZIPINFO.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]ZIPINFO.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]ZIPINFO.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]ZIPINFO.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]ZIPINFO.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]ZIPINFO.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]ZIPINFO.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]ZIPINFO_C.OBJ : []ZIPINFO.C
+[.$(DEST)]ZIPINFO_C.OBJ : []UNZIP.H
+[.$(DEST)]ZIPINFO_C.OBJ : []UNZPRIV.H
+[.$(DEST)]ZIPINFO_C.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]ZIPINFO_C.OBJ : []GLOBALS.H
+[.$(DEST)]ZIPINFO_C.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]ZIPINFO_C.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]ZIPINFO_C.OBJ : [.AES_WG]AES.H
+[.$(DEST)]ZIPINFO_C.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]ZIPINFO_C.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]ZIPINFO_C.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]ZIPINFO_C.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO_C.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]ZIPINFO_C.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO_C.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]ZIPINFO_C.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]ZIPINFO_C.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO_C.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]ZIPINFO_L.OBJ : []ZIPINFO.C
+[.$(DEST)]ZIPINFO_L.OBJ : []UNZIP.H
+[.$(DEST)]ZIPINFO_L.OBJ : []UNZPRIV.H
+[.$(DEST)]ZIPINFO_L.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]ZIPINFO_L.OBJ : []API.H
+[.$(DEST)]ZIPINFO_L.OBJ : []GLOBALS.H
+[.$(DEST)]ZIPINFO_L.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]ZIPINFO_L.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]ZIPINFO_L.OBJ : [.AES_WG]AES.H
+[.$(DEST)]ZIPINFO_L.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]ZIPINFO_L.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]ZIPINFO_L.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]ZIPINFO_L.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]ZIPINFO_L.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO_L.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]ZIPINFO_L.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]ZIPINFO_L.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]ZIPINFO_L.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+.IFDEF AES_WG
+[.$(DEST)]AESCRYPT.OBJ : [.AES_WG]AESCRYPT.C
+[.$(DEST)]AESCRYPT.OBJ : [.AES_WG]AESOPT.H
+[.$(DEST)]AESCRYPT.OBJ : [.AES_WG]AES.H
+[.$(DEST)]AESCRYPT.OBJ : [.AES_WG]BRG_ENDIAN.H
+.ENDIF # AES_WG
+.IFDEF AES_WG
+[.$(DEST)]AESKEY.OBJ : [.AES_WG]AESKEY.C
+[.$(DEST)]AESKEY.OBJ : [.AES_WG]AESOPT.H
+[.$(DEST)]AESKEY.OBJ : [.AES_WG]AES.H
+[.$(DEST)]AESKEY.OBJ : [.AES_WG]BRG_ENDIAN.H
+.ENDIF # AES_WG
+.IFDEF AES_WG
+[.$(DEST)]AESTAB.OBJ : [.AES_WG]AESTAB.C
+[.$(DEST)]AESTAB.OBJ : [.AES_WG]AESOPT.H
+[.$(DEST)]AESTAB.OBJ : [.AES_WG]AES.H
+[.$(DEST)]AESTAB.OBJ : [.AES_WG]BRG_ENDIAN.H
+.ENDIF # AES_WG
+.IFDEF AES_WG
+[.$(DEST)]FILEENC.OBJ : [.AES_WG]FILEENC.C
+[.$(DEST)]FILEENC.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]FILEENC.OBJ : [.AES_WG]AES.H
+[.$(DEST)]FILEENC.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]FILEENC.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]FILEENC.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+.IFDEF AES_WG
+[.$(DEST)]HMAC.OBJ : [.AES_WG]HMAC.C
+[.$(DEST)]HMAC.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]HMAC.OBJ : [.AES_WG]SHA1.H
+.ENDIF # AES_WG
+.IFDEF AES_WG
+[.$(DEST)]PRNG.OBJ : [.AES_WG]PRNG.C
+[.$(DEST)]PRNG.OBJ : [.AES_WG]PRNG.H
+[.$(DEST)]PRNG.OBJ : [.AES_WG]SHA1.H
+.ENDIF # AES_WG
+.IFDEF AES_WG
+[.$(DEST)]PWD2KEY.OBJ : [.AES_WG]PWD2KEY.C
+[.$(DEST)]PWD2KEY.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]PWD2KEY.OBJ : [.AES_WG]SHA1.H
+.ENDIF # AES_WG
+.IFDEF AES_WG
+[.$(DEST)]SHA1.OBJ : [.AES_WG]SHA1.C
+[.$(DEST)]SHA1.OBJ : [.AES_WG]BRG_ENDIAN.H
+[.$(DEST)]SHA1.OBJ : [.AES_WG]SHA1.H
+.ENDIF # AES_WG
+.IFDEF LZMA
+[.$(DEST)]LZFIND.OBJ : [.SZIP]LZFIND.C
+[.$(DEST)]LZFIND.OBJ : [.SZIP]LZFIND.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]LZFIND.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]LZFIND.OBJ : [.SZIP]LZHASH.H
+.ENDIF # LZMA
+.IFDEF LZMA
+[.$(DEST)]LZMADEC.OBJ : [.SZIP]LZMADEC.C
+[.$(DEST)]LZMADEC.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]LZMADEC.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]PPMD8.OBJ : [.SZIP]PPMD8.C
+[.$(DEST)]PPMD8.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]PPMD8.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]PPMD8.OBJ : [.SZIP]TYPES.H
+[.$(DEST)]PPMD8.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]PPMD8DEC.OBJ : [.SZIP]PPMD8DEC.C
+[.$(DEST)]PPMD8DEC.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]PPMD8DEC.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]PPMD8DEC.OBJ : [.SZIP]TYPES.H
+[.$(DEST)]PPMD8DEC.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]CMDLINE.OBJ : [.VMS]CMDLINE.C
+[.$(DEST)]CMDLINE.OBJ : []UNZIP.H
+[.$(DEST)]CMDLINE.OBJ : []UNZPRIV.H
+[.$(DEST)]CMDLINE.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]CMDLINE.OBJ : []GLOBALS.H
+[.$(DEST)]CMDLINE.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]CMDLINE.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]CMDLINE.OBJ : [.AES_WG]AES.H
+[.$(DEST)]CMDLINE.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]CMDLINE.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]CMDLINE.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]CMDLINE.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]CMDLINE.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]CMDLINE.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]CMDLINE.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]CMDLINE.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]CMDLINE.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]CMDLINE.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]CMDLINE.OBJ : []UNZVERS.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMS.C
+[.$(DEST)]VMS.OBJ : []UNZIP.H
+[.$(DEST)]VMS.OBJ : []UNZPRIV.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]VMS.OBJ : []GLOBALS.H
+[.$(DEST)]VMS.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]VMS.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]VMS.OBJ : [.AES_WG]AES.H
+[.$(DEST)]VMS.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]VMS.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]VMS.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]VMS.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]VMS.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]VMS.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]VMS.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]VMS.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]VMS.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]VMS.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]VMS.OBJ : []CRC32.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMS.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMSDEFS.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMS.C
+[.$(DEST)]VMS_.OBJ : []UNZIP.H
+[.$(DEST)]VMS_.OBJ : []UNZPRIV.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMSCFG.H
+[.$(DEST)]VMS_.OBJ : []GLOBALS.H
+[.$(DEST)]VMS_.OBJ : [.VMS]ZLIB.H
+.IFDEF AES_WG
+[.$(DEST)]VMS_.OBJ : [.AES_WG]FILEENC.H
+[.$(DEST)]VMS_.OBJ : [.AES_WG]AES.H
+[.$(DEST)]VMS_.OBJ : [.AES_WG]HMAC.H
+[.$(DEST)]VMS_.OBJ : [.AES_WG]SHA1.H
+[.$(DEST)]VMS_.OBJ : [.AES_WG]PWD2KEY.H
+.ENDIF # AES_WG
+[.$(DEST)]VMS_.OBJ : [.VMS]BZLIB.H
+.IFDEF LZMA_PPMD
+[.$(DEST)]VMS_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF LZMA
+[.$(DEST)]VMS_.OBJ : [.SZIP]LZMADEC.H
+.ENDIF # LZMA
+.IFDEF LZMA_PPMD
+[.$(DEST)]VMS_.OBJ : [.SZIP]TYPES.H
+.ENDIF # LZMA_PPMD
+.IFDEF PPMD
+[.$(DEST)]VMS_.OBJ : [.SZIP]PPMD8.H
+[.$(DEST)]VMS_.OBJ : [.SZIP]PPMD.H
+.ENDIF # PPMD
+.IFDEF LZMA_PPMD
+[.$(DEST)]VMS_.OBJ : [.SZIP]CPUARCH.H
+.ENDIF # LZMA_PPMD
+[.$(DEST)]VMS_.OBJ : []CRC32.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMS.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMSDEFS.H
+++ /dev/null
-
- VMS (OpenVMS):
-
- On VMS, two build methods are provided: a command procedure, and
- description files for MMS or MMK. Both methods must be run from
- the main directory, not the [.VMS] subdirectory.
-
- A simple build using the command procedure looks like this:
- @ [.VMS]BUILD_UNZIP.COM
-
- A simple build using MMS or MMK looks like this:
- MMS /DESCRIP = [.VMS]DESCRIP.MMS ! Or, with MMK, ...
- MMK /DESCRIP = [.VMS]DESCRIP.MMS
-
- Various options for each build method are explained in comments in
- the main builder file, either BUILD_UNZIP.COM or DESCRIP.MMS.
-
- Here are some more complex build examples:
-
- o Build with the large-file option enabled (non-VAX only):
-
- @ [.VMS]BUILD_UNZIP LARGE
- or:
- MMS /DESC = [.VMS] /MACRO = LARGE=1
-
- o Re-link the executables (small-file and large-file):
-
- @ [.VMS]BUILD_UNZIP LINK
- @ [.VMS]BUILD_UNZIP LARGE LINK
- or
- MMK /DESC = [.VMS] CLEAN_EXE ! Deletes existing executables.
- MMK /DESC = [.VMS] ! Builds new executables.
- MMK /DESC = [.VMS] /MACRO = LARGE=1 CLEAN_EXE
- MMK /DESC = [.VMS] /MACRO = LARGE=1
-
- o Build a large-file product from scratch, for debug, getting
- compiler listings and link maps:
-
- MMS /DESC = [.VMS] CLEAN
- MMS /DESC = [.VMS] /MACRO = (DBG=1, LARGE=1. LIST=1)
-
- On VAX, the builders attempt to cope with the various available C
- compilers, DEC/Compaq/HP C, VAX C, or GNU C. If DEC/Compaq/HP C is
- not available or not desired, comments in the relevant builder file
- explain the command-line options used to select a different
- compiler.
-
- By default, Zip uses (and UnZip supports) the "deflate" compression
- method. To add support for the optional "bzip2" compression method,
- first obtain and build the bzip2 software (http://www.bzip.org/ or,
- for a more VMS-friendly kit, http://antinode.info/dec/sw/bzip2.html).
- Then, define the macro IZ_BZIP2 on the BUILD_UNZIP.COM or MMS/MMK
- command line to specify the directory where the bzip2 files may be
- found. For example:
-
- @ [.VMS]BUILD_UNZIP LARGE -
- IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_4B_VMS]
- or:
- MMS /DESC = [.VMS] /MACRO = (LARGE=1, -
- IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_4B_VMS])
-
- Note that historically, UnZip has been built with the default
- compiler option, /NAMES = UPPERCASE, while bzip2 is normally built
- with /NAMES = AS_IS, to avoid name collisions. With modern
- compilers, the "#pragma names" directives in [.VMS]BZLIB.H will
- handle these differences without user intervention. An old
- compiler (for example, DEC C V4.0-000) will emit complaints
- %CC-I-UNKNOWNPRAGMA, and will mishandle the bzip2 library function
- names, which will cause the link to fail. To solve this problem,
- either build the bzip2 BZ_NO_STDIO object library with /NAMES =
- UPPERCASE, or else build UnZip with /NAMES = AS_IS. For example:
-
- @ [.VMS]BUILD_UNZIP LARGE "CCOPTS=/NAMES=AS_IS" -
- IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_4B_VMS]
- or:
- MMS /DESC = [.VMS] /MACRO = (LARGE=1, "CCOPTS=/NAMES=AS_IS", -
- IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_4B_VMS])
-
- System-architecture-specific files (like objects and executables)
- are placed in separate directories, such as [.ALPHA], [.IA64], or
- [.VAX]. Large-file products get their own directories, [.ALPHAL]
- or [.IA64L]. On VAX, VAX C products are placed in [.VAXV], GNU C
- products in [.VAXG]. Each product builder announces what the
- destination directory will be when it is run.
-
- Common files, such as the help libraries (UNZIP.HLP for the default
- UNIX-like command-line interface, UNZIP_CLI.HLP for the VMS-like
- command-line interface), are placed in the main directory. With a
- mixed-architecture VMS cluster, the same main directory on a shared
- disk may may be used by all system types. (Using the NOHELP option
- with BUILD_UNZIP.COM can keep it from making the same help files
- repeatedly.) Building the help files is detailed below.
-
- Completing installation:
-
- To complete the installation, the executables may be left in place,
- or moved (or copied) to a convenient place. While other methods
- (like DCL$PATH) exist, most users define symbols to make the UnZip
- executables available as foreign commands. These symbol definitions
- may be placed in a user's SYS$LOGIN:LOGIN.COM, or in a more central
- location, like SYS$MANAGER:SYLOGIN.COM. Typical symbol definitions
- might look like these:
-
- UNZIP :== $ dev:[dir]UNZIP.EXE ! UNIX-like command line.
- or:
- UNZIP :== $ dev:[dir]UNZIP_CLI.EXE ! VMS-like command line.
-
- On a non-VAX system, different symbols could be defined for the
- small-file and large-file programs. For example:
-
- UNZIPS :== $ dev:[dir.ALPHA]UNZIP.EXE ! UNZIPS = small-file UnZip.
- UNZIP*L :== $ dev:[dir.ALPHAL]UNZIP.EXE !UNZIP[L] = large-file UnZip.
-
- The builders create help text files, UNZIP.HLP and UNZIP_CLI.HLP.
- These may be incorporated into an existing help library, or a separate
- UnZip help library may be created using commands like these, using
- either UNZIP.HLP (as shown) or UNZIP_CLI.HLP:
-
- LIBRARY /HELP dev:[dir]existing_library.HLB UNZIP.HLP
-
- LIBRARY /CREATE /HELP UNZIP.HLB UNZIP.HLP
-
- UnZip help may then be accessed from a separate UnZip help library
- using a command like:
-
- HELP /LIBRARY = device:[directory]UNZIP.HLB
-
- For greater ease, the user (or system manager) may define a
- HLP$LIBRARY logical name to allow the HELP utility to find the UnZip
- help library automatically. See HELP HELP /USERLIBRARY for more
- details. The command procedure HLP_LIB_NEXT.COM may be used to
- determine the next available HLP$LIBRARY logical name, and could be
- adapted to define a HLP$LIBRARY logical name for a UnZip help library.
-
- The builders also create VMS message files, UNZIP_MSG.EXE, in the
- destination directory with the program executables. A user may
- gain DCL access to the UnZip error messages using a command like:
-
- SET MESSAGE device:[directory]UNZIP_MSG.EXE
-
- For system-wide access, the system manager may move or copy this
- file to SYS$MESSAGE, although this could cause some confusion if
- multiple versions of UnZip are used on the system, and their error
- message source files differ.
-
--- /dev/null
+ UnZip Installation Supplement for VMS (OpenVMS)
+ -----------------------------------------------
+
+ UnZip version 6.10. Revised: 2013-10-13.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Source Kits
+ -----------
+
+ UnZip source kits are distributed as Zip archives and tar+gzip kits.
+A Zip archive is usually the more convenient form for a VMS user. If an
+UnZip program is not already available on the target system, pre-built
+UnZip programs may be found in many freeware collections, and on the
+Info-ZIP server:
+
+ ftp://ftp.info-zip.org/pub/infozip/vms/
+
+ To unpack the UnZip source kit, choose a suitable working directory,
+and UnZip the UnZip kit there. For example:
+
+ SET DEFAULT dev:[dir.unzip] ! Some convenient directory.
+ UNZIP unzip61.zip ! Unpack the UnZip source kit.
+
+If the UnZip kit is elsewhere, specify its actual location:
+
+ UNZIP dn_ld_dev:[dn_ld_dir]unzip61.zip
+
+ On old VMS versions (before VMS V6.0), it may be helpful to specify
+"-b" (/BINARY) when unpacking the source kit. For details, see "Test",
+below. For example:
+
+ UNZIP -b unzip61.zip ! Unpack the UnZip source kit.
+
+ Some optional UnZip features may require additional source kits.
+
+ o Bzip2 Compression
+
+ By default, UnZip can use the Deflate compression method. To add
+ support for the optional "bzip2" compression method, obtain and
+ build the bzip2 software ("http://www.bzip.org/" or, for a more
+ VMS-friendly kit, "http://antinode.info/dec/sw/bzip2.html"). The
+ build instructions below explain how to use the appropriate bzip2
+ header files and object library to build UnZip with bzip2 support.
+
+ o Encryption
+
+ This UnZip release includes the Traditional encryption code
+ ("CRYPT") previously supplied in the separate package zcrypt29.zip,
+ but you still can decide whether to activate the CRYPT code or not.
+ CRYPT is enabled by default, but you may disable it by specifying
+ the C macro "NO_CRYPT" in the LOCAL_UNZIP symbol/macro (explained
+ below). See README_CR.txt for more on CRYPT.
+
+ This UnZip release offers optional support for Advanced Encryption
+ Standard (AES) encryption, which is a stronger encryption method
+ than Traditional Zip encryption. A separate IZ_AES_WG source kit
+ is required to enable this AES encryption option. See
+ README_AES_WG.txt for more on the optional AES encryption. The
+ IZ_AES_WG source kit must be unpacked in the UnZip source
+ directory, where it creates a [.aes_wg] subdirectory. File and
+ path names may vary, but commands like the following should extract
+ the IZ_AES_WG source kit in the right place:
+
+ SET DEFAULT [.unzip61] ! The main UnZip source dir.
+ UNZIP [-]iz_aes_wg.zip ! Unpack the IZ_AES_WG kit.
+
+ The IZ_AES_WG code may be too modern for VAX C.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Build
+ -----
+
+ On VMS, two build methods are provided: a DCL command procedure, and
+description files for MMS or MMK. Both methods must be run from the
+main source directory, not the [.VMS] subdirectory.
+
+ A simple build using the command procedure looks like this:
+ @ [.VMS]BUILD_UNZIP.COM
+
+ A simple build using MMS or MMK looks like this:
+ MMS /DESCRIP = [.VMS]DESCRIP.MMS ! Or, with MMK, ...
+ MMK /DESCRIP = [.VMS]DESCRIP.MMS
+
+ Various options for each build method are explained in comments in
+each main builder file, either [.VMS]BUILD_UNZIP.COM or
+[.VMS]DESCRIP.MMS.
+
+ On VAX, the builders attempt to cope with the various available C
+compilers, DEC/Compaq/HP C, VAX C, or GNU C. If DEC/Compaq/HP C is not
+available or not desired, comments in each main builder file explain the
+command-line options used to select a different compiler.
+
+ Note that on non-VAX systems with VMS V7.2 or later (and with a
+ sufficiently new C compiler), UnZip 6.0 (and later) can support
+ files (both data files and Zip archives) larger than 2GB. For the
+ greatest compatibility with previous UnZip versions, by default,
+ the builders create old-style, small-file programs. The user must
+ specify the appropriate builder command-line option to create
+ large-file-capable programs.
+
+ Here are some more complex build examples:
+
+ o Build with the large-file option enabled (non-VAX only):
+
+ @ [.VMS]BUILD_UNZIP LARGE
+ or:
+ MMS /DESC = [.VMS] /MACRO = LARGE=1
+
+ o Re-link the executables (small-file and large-file):
+
+ @ [.VMS]BUILD_UNZIP NOCOMPILE
+ @ [.VMS]BUILD_UNZIP LARGE NOCOMPILE
+ or
+ MMK /DESC = [.VMS] CLEAN_EXE ! Delete existing executables.
+ MMK /DESC = [.VMS] ! Build new executables.
+ MMK /DESC = [.VMS] /MACRO = LARGE=1 CLEAN_EXE
+ MMK /DESC = [.VMS] /MACRO = LARGE=1
+
+ o Build a large-file product from scratch, for debug, getting
+ compiler listings and link maps:
+
+ MMS /DESC = [.VMS] CLEAN
+ MMS /DESC = [.VMS] /MACRO = (DBG=1, LARGE=1. LIST=1)
+
+ o Bzip2 Compression
+
+ We assume that bzip2 has been built according to its own
+ instructions. To build UnZip with bzip2 support, define the macro
+ IZ_BZIP2 on the BUILD_UNZIP.COM or MMS/MMK command line to specify
+ the directory where the bzip2 files may be found. For example:
+
+ @ [.VMS]BUILD_UNZIP LARGE -
+ IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_6A_VMS]
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1, -
+ IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_6A_VMS])
+
+ Note that historically, UnZip has been built with the default
+ compiler option, /NAMES = UPPERCASE, while bzip2 is normally built
+ with /NAMES = AS_IS, to avoid name collisions. With modern
+ compilers, the "#pragma names" directives in [.VMS]BZLIB.H will
+ handle these differences without user intervention. An old
+ compiler (for example, DEC C V4.0-000) will emit complaints
+ %CC-I-UNKNOWNPRAGMA, and will mishandle the bzip2 library function
+ names, which will cause the link to fail. To solve this problem,
+ either build the bzip2 BZ_NO_STDIO object library with /NAMES =
+ UPPERCASE, or else build UnZip with /NAMES = AS_IS. For example:
+
+ @ [.VMS]BUILD_UNZIP LARGE "CCOPTS=/NAMES=AS_IS" -
+ IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_6A_VMS]
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1, "CCOPTS=/NAMES=AS_IS", -
+ IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_6A_VMS])
+
+ The %CC-I-UNKNOWNPRAGMA complaints are still emitted, but the link
+ (and the program) should work.
+
+ o Other Optional Compression Methods (LZMA, PPMd)
+
+ LZMA and PPMd compression (new in UnZip version 6.10) are not
+ enabled by default, but the required source code is included in
+ the UnZip source kit. To enable LZMA and/or PPMd compression, add
+ the appropriate option to the builder command line. For example:
+
+ @ [.VMS]BUILD_UNZIP LARGE LZMA PPMD
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1, LZMA=1, PPMD=1)
+
+ o Encryption
+
+ By default, Traditional Zip encryption is enabled. To disable it,
+ the C macro NO_CRYPT must be defined at build time. This can be
+ done by adding NO_CRYPT to the LOCAL_UNZIP symbol/macro. For
+ example:
+
+ LOCAL_UNZIP == "NO_CRYPT"
+ @ [.VMS]BUILD_UNZIP LARGE
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1, "LOCAL_UNZIP=NO_CRYPT")
+
+ By default, AES encryption is not enabled. To enable it, first
+ download and unpack the separate IZ_AES_WG source kit, as
+ explained above. With the IZ_AES_WG source kit unpacked into its
+ [.aes_wg] subdirectory, add the appropriate AES_WG option to the
+ builder command line. For example:
+
+ @ [.VMS]BUILD_UNZIP LARGE AES_WG
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1, AES_WG=1)
+
+
+ By default, system-architecture-specific files (like objects and
+executables) are placed in separate subdirectories, such as [.ALPHA],
+[.IA64], or [.VAX]. Large-file products get their own subdirectories,
+[.ALPHAL] or [.IA64L]. On VAX, VAX C products are placed in [.VAXV],
+GNU C products in [.VAXG]. If desired, the user may specify some other
+subdirectory, using the PROD symbol/macro. For example, to build
+large-file programs in a [.ALPHA_LARGE] subdirectory:
+
+ @ [.VMS]BUILD_UNZIP LARGE PROD=ALPHA_LARGE
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1, PROD=ALPHA_LARGE)
+
+This option makes it easier to build multiple UnZip variants with
+different options using the same source tree.
+
+ Each product builder announces what the destination directory will be
+when it is run.
+
+ Common files, such as the help libraries (UNZIP.HLP for the default
+UNIX-like command-line interface, UNZIP_CLI.HLP for the VMS-like
+command-line interface), are placed in the main directory. With a
+mixed-architecture VMS cluster, the same main directory on a shared disk
+may be used by all system types. (Using the NOHELP option with
+BUILD_UNZIP.COM can keep it from making the same help files repeatedly.)
+Building the help files is detailed below.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Test
+ ----
+
+ After a successful build, an "unzip -v" or "UNZIP_CLI /VERBOSE"
+report can be generated using the builders:
+
+ @ [.VMS]BUILD_UNZIP LARGE DASHV
+ @ [.VMS]BUILD_UNZIP LARGE SLASHV
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1) DASHV
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1) SLASHV
+
+ A set of basic UnZip tests can be run using the builders:
+
+ @ [.VMS]BUILD_UNZIP LARGE TEST
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1) TEST
+
+ Specify "LARGE" or not, the same as when building the programs. (On
+VAX, also specify same the compiler option: VAXC, ...) Other normal
+build options are allowed, but not required. The builders use a DCL
+procedure, [.vms]test_unzip.com, to do this job. This procedure may be
+run directly, but it needs to be told where to find the program
+executables, so it's normally easier to use one of the builders to run
+it, because they know where the executables are stored. (Which is why
+those options which affect the destination directory are required for
+TEST.)
+
+ If PPMd compression was enabled, then a separate PPMd test can be run
+similarly:
+
+ @ [.VMS]BUILD_UNZIP LARGE TEST_PPMD
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1) TEST_PPMD
+
+ The test procedure leaves its results files in place (for inspection,
+as desired). To clean up after running the tests, use the CLEAN_TEST
+target in the MMS/MMK builder, or do the job manually:
+
+ MMS /DESC = [.VMS] CLEAN_TEST
+ or:
+ DELETE [.TEST_DIR_*...]*.*;* ! Repeat as needed.
+ DELETE TEST_DIR_*.DIR;*
+
+ Note: For its self-extracting archive (SFX) tests, the test procedure
+may try to use SET FILE /ATTRIBUTES to adjust the attributes of the
+UnZip SFX executable to match those of the test archive in the UnZip
+kit, which, by default, has rfm:stmlf. Thus, these tests may fail
+("%DCL-W-IVQUAL, unrecognized qualifier - check validity, spelling, and
+placement \ATTRIBUTES\", ...) on systems where this command is not
+available (that is, on VMS versions before V6.0). While this kind of
+attribute adjustment may be required for the test archive (which was
+created on a non-VMS system), it should not be needed when creating a
+self-extracting archive from an archive which is created on a VMS
+system, where the archive file attributes should be more convenient
+(rfm:fix, mrs=512).
+
+ Alternatively, the source archive (or just the test archives:
+"testmake*.zip") could be extracted from the source kit using the "-b"
+(/BINARY) UnZip option, which should give the test archives the desired
+attributes.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Install
+ -------
+
+ To complete the installation, the executables may be left in place,
+or moved (or copied) to a convenient place. While other methods (like
+DCL$PATH) exist, it is usual to define symbols to make the UnZip
+executables available as foreign commands. These symbol definitions may
+be placed in a user's SYS$LOGIN:LOGIN.COM, or in a more central
+location, like SYS$MANAGER:SYLOGIN.COM. Typical symbol definitions
+might look like these:
+
+ UNZIP :== $ dev:[dir]UNZIP.EXE ! UNIX-like command line.
+or:
+ UNZIP :== $ dev:[dir]UNZIP_CLI.EXE ! VMS-like command line.
+
+On a non-VAX system, different symbols could be defined for the
+small-file and large-file programs. For example:
+
+ UNZIPS :== $ dev:[dir.ALPHA]UNZIP.EXE ! UNZIPS = small-file UnZip.
+ UNZIP*L :== $ dev:[dir.ALPHAL]UNZIP.EXE ! UNZIP[L] =large-file UnZip.
+
+
+ The builders create help library source files, UNZIP.HLP and
+UNZIP_CLI.HLP. These may be incorporated into an existing help library,
+or a separate UnZip help library may be created using commands like
+these, using either UNZIP.HLP (as shown) or UNZIP_CLI.HLP:
+
+ $ LIBRARY /HELP dev:[dir]existing_library.HLB UNZIP.HLP
+
+ $ LIBRARY /CREATE /HELP UNZIP.HLB UNZIP.HLP
+
+UnZip help may then be accessed from a separate UnZip help library using
+a command like:
+
+ $ HELP /LIBRARY = device:[directory]UNZIP.HLB
+
+ For greater ease, the user (or system manager) may define a
+HLP$LIBRARY logical name to allow the HELP utility to find the UnZip help
+library automatically. See HELP HELP /USERLIBRARY for more details.
+The command procedure [.vms]hlp_lib_next.com may be used to determine
+the next available HLP$LIBRARY logical name, and could be adapted to
+define a HLP$LIBRARY logical name for an UnZip help library.
+
+ The builders also create VMS message files, UNZIP_MSG.EXE, in the
+destination directory with the program executables. A user may gain DCL
+access to the UnZip error messages using a command like:
+
+ $ SET MESSAGE device:[directory]UNZIP_MSG.EXE
+
+For system-wide access, the system manager may move or copy this file to
+SYS$MESSAGE, although this could cause some confusion if multiple
+versions of UnZip are used on the system, and their error message source
+files differ.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Self-Extracting Archives
+ ------------------------
+
+ The UnZip kit includes a DCL procedure, [.vms]makesfx.com, which is
+intended to help make a self-extracting archive from a normal Zip
+archive. Comments in the procedure explain its use. It uses a DCL
+symbol, "UNZIPSFX", to locate the appropriate UNZIPSFX.EXE (or
+UNZIPSFX_CLI.EXE) program to use. Note that, unlike the DCL symbols for
+the normal UnZip or Zip programs, this is not a foreign command symbol,
+and does not include the "$" prefix. For example:
+
+ UNZIPSFX == "dev:[dir]UNZIPSFX.EXE"
+
+ The user must define "UNZIPSFX" to point to an UNZIPSFX.EXE program
+which is appropriate for the destination architecture, which may differ
+from the architecture of the system where the self-extracting archive is
+being created. For example, on an Alpha system, one might create a
+self-extracting archive for use on an IA64 system:
+
+ ZIP new_archive.zip [...]
+ UNZIPSFX == "utility_root:[ia64l]unzipsfx.exe"
+ @ utility:MAKESFX.COM new_archive
+
+ In some cases, the COPY command in makesfx.com may have trouble
+("%COPY-W-INCOMPAT, [...] incompatible attributes") if the UNZIPSFX.EXE
+program and the Zip archive have different record formats. SET FILE
+/ATTRIBUTES should be able to adjust the record format of one file or
+the other to make them compatible.
+
+ By default, the UNZIPSFX.EXE and UNZIPSFX_CLI.EXE programs include
+support for only the default Deflate compression method, and for no
+form of encryption. Other, optional compression and/or encryption
+methods may be enabled in the SFX programs at build time, and support
+for Deflate may be disabled. See the comments in the main builder files
+and the generic INSTALL document for details.
+
+ Building an optimal UnZipSFX executable is more complicated when
+optional compression methods will be used (or when the standard method,
+Deflate, will not be used). Ideally, UnZipSFX should be built with only
+the required compression methods enabled, but the list of required
+compression methods is determined when an archive is created, while the
+list of available methods is determined when UnZipSFX is built. As
+always, when creating a self-extracting archive, the resulting
+program+archive should be tested (on the target system). Options like
+"-q -t" should be helpful for this.
+
- VMS Notes for Info-ZIP Zip 3.0 and UnZip 6.0
+ VMS Notes for Info-ZIP Zip 3.x and UnZip 6.x
============================================
This document describes some VMS-specific behavior and implementation
details of the Info-ZIP Zip and UnZip programs.
- Last modified: 2009-03-02.
+ Last modified: 2013-07-03.
Command-line Case
File Name Case (ODS5)
---------------------
- In general, Zip 3.0 and UnZip 6.0 should handle file name case (and
-extended file names) in reasonable ways on ODS5 disks.
+ In general, Zip 3.x and UnZip 6.x should handle file name case (and
+extended file names) in reasonable ways on ODS5 volumes.
Zip offers a variety of "-C" (/PRESERVE_CASE) options to control how
case is handled when adding files to an archive. The default settings
("-C2-", /PRESERVE_CASE = NOODS2, down-case ODS2 file names; "-C5",
/PRESERVE_CASE = ODS5, preserve case of ODS5 file names) should be
-consistent with previous Zip versions for files on ODS2 disks, and
-reasonable for files on ODS5 disks.
+consistent with previous Zip versions for files on ODS2 volumes, and
+reasonable for files on ODS5 volumes.
UnZip should preserve case when it extracts to an ODS5 destination
-disk (unless "-2" (/ODS2) is specified). (Note that previous UnZip
+volume (unless "-2" (/ODS2) is specified). (Note that previous UnZip
versions, including version 5.52, did not properly preserve case for
directories, which were always up-cased.)
The Zip and UnZip builders should work properly on ODS2 and ODS5
-disks, with old (pre-ODS5) and new (case-conscious) versions of MMS (or
-MMK). All testing was done with SET PROCESS /CASE_LOOKUP = BLIND.
+volumes, with old (pre-ODS5) and new (case-conscious) versions of MMS
+(or MMK). All testing was done with SET PROCESS /CASE_LOOKUP = BLIND.
Various problems may be expected with /CASE_LOOKUP = SENSITIVE.
For consistency, the builders should always create product files
(.OBJ, .EXE, .HLB, and so on) with upper-case names, whether the build
-is done on an ODS2 or ODS5 disk. Note, however, that in a world with
-both ODS2 and ODS5 disks, and old and new Zip and UnZip versions, it's
+is done on an ODS2 or ODS5 volume. Note, however, that in a world with
+both ODS2 and ODS5 volumes, and old and new Zip and UnZip versions, it's
possible to encounter lower-case product file names. For example, a VMS
-binary kit could be created on an ODS2 disk, and a Zip archive created
+binary kit could be created on an ODS2 volume, and a Zip archive created
from that (using Zip 2.x, or Zip 3.x with default settings). Such a Zip
archive would contain down-cased names for those product files, and
those lower-case names would then normally be preserved when UnZip was
system.
It might help matters if _all_ VMS binary kits were produced on ODS5
-disks, and packaged using (case-preserving) Zip version 3.x, but this
+volumes, and packaged using (case-preserving) Zip version 3.x, but this
would certainly be different from the way things have been done before,
and maintaining control over this process is essentially impossible.
Symbolic Links (ODS5)
---------------------
- VMS V8.3 offers support for symbolic links (symlinks) on ODS5 disks.
-In previous Zip and UnZip versions, the generic code for 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 >= 70301000, so
-this includes VMS V7.3-1 and up, and thus symlink-capable Zip and UnZip
-programs may be built on systems which do not themselves offer symlink
-support. (Various run-time failures may be expected if symlinks are
-encountered on pre-V8.3 systems, either in a file system or in a Zip
-archive.)
+ 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.
+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 >=
+70301000, so this includes VMS V7.3-1 and up, and thus symlink-capable
+Zip and UnZip programs may be built on systems which do not themselves
+offer symlink support. (Various run-time failures may be expected if
+symlinks are encountered on pre-V8.3 systems, either in a file system or
+in a Zip archive. Due to bugs in VMS, some symlink-related features may
+not always work on pre-V8.4 systems.)
Symlink support can be disabled at build-time, if desired, by
defining the C macro NO_SYMLINKS. (See comments in the builder
SYMLINK_SUPPORT (Zip) or SYMLINKS (UnZip) in its list of "special
compilation options" if the program was built with symlink support.
+ A problem has been observed on VMS Alpha V8.3 and IA64 V8.3-1H1 when
+Zip tries to follow a symlink with a space in its link text while
+preserving VMS file attributes. For example (Alpha V8.3), with this
+symlink: abc.slnk;1 -> Symlink text (where the file "Symlink^_text."
+exists):
+
+ALP $ type abc.slnk ! This works, but Zip may fail:
+Symlink file line 1
+Symlink file line 2
+
+ALP $ zip -V fail.zip abc.slnk ! With "-V", without "-y".
+ adding: abc.slnk
+
+ vms_open(): $qiow access sts = %x00000910.
+ zip warning: could not open for reading: abc.slnk
+ no such file
+
+zip warning: Not all files were readable
+ files/entries read: 0 (0 bytes) skipped: 1 (0 bytes)
+zip warning: zip file empty
+
+ VMS V8.4 (Alpha or IA64) seems to solve this problem.
+
File I/O Performance
--------------------
Users who find other parameter sets more beneficial, or who find
particular problems with this set are welcome to comment.
- In this version, as in previous versions, when UnZip expands a -V
-archive, it allocates the entire extent of a data file before writing
-any of its data. In some previous versions, this could cause the
-destination disk to be locked for a considerable time (minutes), if
-highwater marking was enabled on that disk. Now, the FAB SQO
-("sequential access only") flag (or equivalent) is set, which prevents
-this troublesome disk locking.
+ In this version, as in previous versions, when UnZip expands an
+archive with VMS attributes (made using Zip's "-V" or /VMS option), it
+allocates the entire extent of a data file before writing any of its
+data. In some previous versions, this could cause the destination
+volume to be locked for a considerable time (minutes), if highwater
+marking was enabled on that volume. Now, the FAB SQO ("sequential
+access only") flag (or equivalent) is set, which prevents this
+troublesome volume locking.
- In some previous versions, when UnZip expanded a non-V archive, it
-did no pre-allocation, and used the default extension quantity. This
-could slow file creation significantly for large files. Now, space for
-extracted files is pre-allocated, and the same SQO ("sequential access
-only") flag is set, as with a -V archive.
+ In some previous versions, when UnZip expanded an archive without VMS
+attributes, it did no pre-allocation, and used the default extension
+quantity. This could slow file creation significantly for large files.
+Now, space for extracted files is pre-allocated, and the same SQO
+("sequential access only") flag is set, as with an archive with VMS
+attributes.
- Changes to the "-V" (/VMS) Option
- ---------------------------------
+ Changes to Zip's "-V" (/VMS) Option
+ -----------------------------------
- The intent of the "-V" (/VMS) option was to store VMS file attributes
-in a Zip archive, allowing UnZip to extract an exact copy of a file on a
-VMS system, including all its VMS attributes.
+ The intent of Zip's "-V" (/VMS) option was to store VMS file
+attributes in a Zip archive, allowing UnZip to extract an exact copy of
+a file on a VMS system, including all its VMS attributes.
In Zip before version 2.31, using the "-V" (/VMS) option created an
archive which usually contained data from beyond the EOF (End-of-File)
files (that is, those with no valid data beyond EOF) should also be
restored correctly.
- With the new "-VV" (/VMS = ALL) option, the archive includes all
+ With Zip's new "-VV" (/VMS = ALL) option, the archive includes all
allocated blocks for the file (including those beyond EOF). When
extracted on a VMS system, the original file should be reproduced with
-as much fidelity as possible, but on a non-VMS system, most files will
-be seen as corrupt because of the data from beyond EOF.
+as much fidelity as possible, but on a non-VMS system, files with a
+proper EOF marker will probably be seen as corrupt because of the data
+from beyond EOF.
+
+ Note that if an archive member includes VMS attributes, then UnZip
+will use those attributes when extracting that member. No special UnZip
+option is needed for this (and none will stop it). UnZip has a "-V"
+option, but it is not related to these VMS file attributes.
Changes to Program Exit Status Values
-------------------------------------
- Zip and UnZip exit with 32-bit VMS status values which are formed
-from their internal OS-independent status values. In previous program
-versions, this was done by converting the internal success code (0) into
-%x00000001 (SS$_NORMAL), and converting the other internal warning and
-error codes using an artificial control/facility code, 0x7FFF (which
-includes some reserved bits), and a severity value which was determined
-according to rules specified in the VMS-specific exit function.
-Curiously, the internal status codes were left-shifted by 4 bits instead
-of 3, so all the resulting VMS message codes (bits 13:3) were even.
+ In a normal DCL environment, Zip and UnZip exit with 32-bit VMS
+status values which are formed from their internal OS-independent status
+values. In previous program versions, this was done by converting the
+internal success code (0) into %x00000001 (SS$_NORMAL), and converting
+the other internal warning and error codes using an artificial
+control/facility code, 0x7FFF (which includes some reserved bits), and a
+severity value which was determined according to rules specified in the
+VMS-specific exit function. Curiously, the internal status codes were
+left-shifted by 4 bits instead of 3, so all the resulting VMS message
+codes (bits 13:3) were even.
Zip and UnZip now have facility names and codes assigned by HP
(UnZip: IZ_UNZIP, 1954; Zip: IZ_ZIP, 1955). Now, by default, the
message files.
+ Program Exit Status Values in the GNV Environment
+ -------------------------------------------------
+
+ Beginning with Zip version 3.1 and UnZip version 6.1, on VMS V7.0 and
+newer (__CRTL_VER >= 70000000), Zip and UnZip can also exit with simple,
+UNIX-like status codes when used in a GNV "bash" shell environment.
+This is done if the environment variable "SHELL" is set (and its value
+is not "DCL"). This feature may be disabled at build time by defining
+the C macro "NO_POSIX_EXIT". (See comments in the builder regarding
+LOCAL_UNZIP or LOCAL_ZIP, as appropriate.)
+
+ Note that the "SHELL" variable is set when the Zip or UnZip program
+is run by the GNV "bash" shell in its usual UNIX-like way, not when it's
+run using either an explicit "dcl" command or the DCL fallback scheme
+(which is used when "bash" can't find a program in its usual way). For
+example:
+
+ DCL:
+
+alp $ mcr utility_root:[source.zip.unzip610c08a_l.alphal]unzip -t fred.zip
+unzip: cannot find fred.zip (ALP$DKC0:[SMS]fred.zip;).
+alp $ write sys$output $status
+%X17A28092 ["%IZ_UNZIP-E-NOZIP, Zipfile not found"]
+
+ bash:
+
+alp$ /utility_root/source/zip/unzip610c08a_l/alphal/unzip -t fred.zip
+unzip: cannot find fred.zip (ALP$DKC0:[SMS]fred.zip;).
+alp$ echo $?
+9 [9 = PK_NOZIP. See "unzip.h".]
+
+ bash (using DCL fallback):
+
+alp$ type unzipx
+type: unzipx: not found
+alp$ dcl show symbol unzipx
+ UNZIPX == "$ utility_root:[source.zip.unzip610c08a_l.alphal]unzip.exe"
+alp$ unzipx -t fred.zip
+unzip: cannot find fred.zip (ALP$DKC0:[SMS]fred.zip;).
+alp$ echo $?
+2 [Generic bash+DCL failure code.]
+
+ The DCL fallback feature in "bash" can be disabled by defining an
+environment variable, so:
+
+alp$ export GNV_DISABLE_DCL_FALLBACK=1
+alp$ unzipx -t fred.zip
+BASH.EXE: unzipx: command not found
+
+ The raw status codes are defined in "unzip.h" (UnZip) and "ziperr.h"
+(Zip), and should be listed in each program's Unix "man" and VMS HELP
+documentation.
+
+
VMS File Attribute Schemes
--------------------------
+++ /dev/null
-VMS README for UnZip 5.3 and later, 25 February 1997
-----------------------------------------------------
-
-Notes about using UnZip and zipfiles under VMS (see INSTALL for instructions
-on compiling):
-
- - Install UnZip as foreign symbol by adding this to login.com:
- $ unzip == "$disk:[dir]unzip.exe"
- $ zipinfo == "$disk:[dir]unzip.exe ""-Z"""
- where "disk" and "dir" are location of UnZip executable; the "$" before
- the disk name is important. Some people, including the author, prefer
- a short alias such as "ii" instead of "zipinfo"; edit to taste. (All of
- the quotes around the -Z are necessary, but don't ask us to explain it...)
-
- - Optionally install UnZipSFX for use with the MAKESFX.COM command file:
- $ unzipsfx :== disk:[dir]unzipsfx.exe
- Thereafter an archive "foo.zip" may be converted to "foo.exe" simply by
- typing "@makesfx foo" (assuming MAKESFX.COM is in the current directory).
- Note that there is *no* leading "$" in this case.
-
- - After proper installation, the default version of UnZip is invoked just
- as in Unix or MS-DOS: "unzip -opts archive files". The hyphen ('-') is
- the switch character, not the slash ('/') as in native VMS commands. An
- alternative is available if VMSCLI is defined during compilation; this
- version does provide a native VMS-style command interface (e.g., /ZIPINFO
- instead of -Z). Both versions accept the command "unzip -v", which can
- be used to check whether VMSCLI was defined or not; but an even simpler
- method is to type "unzip" and look at the help screen. Note that options
- placed in an environment variable (UNZIP_OPTS) must be of the short, hy-
- phenated form regardless of how UnZip was compiled.
-
- - The VMS C runtime library translates all command-line text to lowercase
- unless it is quoted, making some options and/or filenames not work as
- intended. For example:
- unzip -V zipfile vms/README;*
- is translated to
- unzip -v zipfile vms/readme;*
- which may not match the contents of the zipfile and definitely won't
- extract the file with its version number as intended. This can be
- avoided by use of the -C option (/CASE_INSENSITIVE) or by enclosing
- the uppercase stuff in quotes:
- unzip "-V" zipfile "vms/README;*"
- Note that quoting the whole line probably won't work, since it would
- be interpreted as a single argument by the C library.
-
- - Wildcards that refer to files internal to the archive behave like Unix
- wildcards, not VMS ones (assuming UnZip was not compiled with VMSWILD
- defined). This is both a matter of consistency (see above) and power--
- full Unix regular expressions are supported, so that one can specify
- "all .c and .h files that start with a, b, c or d and do not have a 2
- before the dot" as "[a-d]*[^2].[ch]". Of course, "*.[ch]" is a much more
- common wildcard specification, but the power is there if you need it.
- Note that "*" matches zipfile directory separators ('/'), too. If UnZip
- *was* compiled with VMSWILD defined (do "unzip -v" to check), the single-
- character wildcard is "%" rather than "?", and character sets (ranges)
- are delimited with () instead of [] (for example, "*.(ch)").
-
- - Wildcards that refer to zipfiles (i.e., external VMS files) behave like
- normal VMS wildcards regardless of whether VMSWILD was defined or not.
- Ranges are not supported. Thus "unzip *font-%.zip" is about as much as
- one can do for specifying wildcard zipfiles.
-
- - Created files get whatever permissions were stored in the archive (mapped
- to VMS and/or masked with your default permissions, depending on the
- originating operating system), but created directories additionally in-
- herit the (possibly more restrictive) permissions of the parent directory.
- And obviously things won't work if you don't have permission to write to
- the extraction directory.
-
- - When transferring files, particularly via Kermit, pay attention to the
- settings! In particular, zipfiles must be transferred in some binary
- mode, which is NOT Kermit's default mode, and this mode must usually be
- set on BOTH sides of the transfer (e.g., both VAX and PC). See the notes
- below for details.
-
-
-
-
-From Info-ZIP Digest (Wed, 6 Nov 1991), Volume 91, Issue 290:
-
- Date: Tue, 5 Nov 91 15:31 CDT
- From: Hugh Schmidt <HUGH@macc.wisc.edu>
-
- ****************************************************
- *** VMS ZIP and PKZIP compatibility using KERMIT ***
- ****************************************************
-
- Many use Procomm's kermit to transfer zipped files between PC and VMS
- VAX. The following VMS kermit settings make VMS Zip/UnZip compatible
- with PC Zip/UnZip or PKZIP/PKUNZIP:
- VMS kermit Procomm kermit
- ------------------- --------------------
- Uploading PC zipfile to VMS: set file type fixed set file type binary
- Downloading VMS zipfile to PC: set file type block set file type binary
-
- "Block I/O lets you bypass the VMS RMS record-processing capabilities
- entirely", (Guide to VMS file applications, Section 8.5). The kermit
- guys must have known this!
--- /dev/null
+.!
+.! File: UNZIP_DEF.RNH
+.!
+.! Author: Hunter Goatley
+.!
+.! Date: October 23, 1991
+.!
+.!----------------------------------------------------------------------
+.! Copyright (c) 1991-2013 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. If,
+.! for some reason, all these files are missing, the Info-ZIP license
+.! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+.!----------------------------------------------------------------------
+.!
+.! Description:
+.!
+.! RUNOFF source file for VMS on-line help for portable UnZip.
+.! Adapted from UNZIP.MAN (now UNZIP.TXT).
+.!
+.! To build: $ REN UNZIP_DEF.RNH UNZIP.RNH
+.! $ RUNOFF UNZIP.RNH
+.! $ LIBR/HELP/INSERT libr UNZIP
+.!
+.! Modification history:
+.!
+.! 01-001 Hunter Goatley 23-OCT-1991 09:21
+.! Genesis.
+.! 01-002 Cave Newt 16-MAR-1992 22:37
+.! Updated for UnZip 4.2.
+.! 01-003 Igor Mandrichenko 23-MAY-1992 22:14
+.! Added -X option to command syntax.
+.! 01-004 Cave Newt 24-MAY-1992 13:30
+.! Added UNZIP_OPTS environment variable help.
+.! 01-005 Igor Mandrichenko 14-DEC-1993 18:55
+.! Modified for UnZip V5.1
+.! 01-006 Cave Newt 21-DEC-1993 12:38
+.! Added -x option and cleaned up.
+.! 01-007 Cave Newt 14-JUL-1994 09:45
+.! Added -Z, -C and -L options, removed -U, minor clean-up.
+.! 01-008 Cave Newt 28-JUL-1994 08:57
+.! Removed semi-colons from comments.
+.! 02-001 Christian Spieler 09-DEC-1995 02:25
+.! Modified for UnZip 5.2.
+.! 02-002 Christian Spieler 06-FEB-1996 02:25
+.! Added -h "help" option.
+.! 02-003 Christian Spieler 04-MAR-1997 20:25
+.! Added -P "command line password" option.
+.! 02-004 Christian Spieler 26-JUL-1997 00:05
+.! Added Exit_Codes subtopic, explaining UnZip's VMS return codes.
+.! 02-005 Christian Spieler 28-APR-2000 03:22
+.! Changed references to plaintext UnZip documentation file
+.! into "UNZIP.TXT".
+.! 02-006 Christian Spieler 15-APR-2001 22:29
+.! Added description for extended functionality of -b option.
+.! 02-007 Christian Spieler 10-DEC-2001 13:58
+.! Added description for new -: traverse dirs option.
+.! 02-008 Christian Spieler 29-JAN-2005 01:50
+.! Added description for the -T "set archive timestamp" option.
+.! 02-009 Christian Spieler 04-MAR-2007 14:37
+.! Added description for the -S "Stream-LF text files" option;
+.! updated the documentation of the VMS exit codes.
+.! 02-010 S. Schweda, C. Spieler 28-Dec-2007 21:28
+.! Added description for the -D "timestamp restoration" option.
+.! 03-001 S. Schweda 16-Oct-2012
+.! General update for version 6.10c09. Still imperfect.
+.!
+.noflags
+.lm2 .rm70
+.indent -2
+1 UnZip
+.sk
+UnZip lists, tests, or extracts files from a ZIP archive (an archive
+format commonly used on many different systems). The default behavior
+(with no options) is to extract into the current directory (and
+subdirectories below it) all files from the specified ZIP archive. A
+companion program, Zip, creates ZIP archives.
+.sk
+Info-ZIP UnZip and Zip were intended to be compatible with archives
+created by PKWARE's PKZIP and PKUNZIP programs (originally for MS-DOS),
+but in many cases the program options or default behaviors
+differ. Nowadays, many other programs are available which work with ZIP
+archives.
+.sk
+This help file describes the Unix-style command-line edition of
+UnZip. A VMS CLI edition is also available, with a separate help file.
+.sk
+Format
+.sk
+.literal
+ unzip [ unzip_options ] [ file[.zip] ] [ member ... ]
+ unzip -Z [ zipinfo_options ] [ file[.zip] ] [ member ... ]
+.end literal
+.sk
+Note: Beginning with UnZip version 6.10, the old command-line parser has
+been replaced by one like the one used in Zip. One significant change
+is that option negation now uses a TRAILING hyphen ("-"), so, for
+example, -B- negates the -B option. This change was made because a
+double hyphen ("--") now introduces a long option.
+.sk
+To display the basic built-in help, use the command:
+.br
+.literal
+ unzip -h
+.end literal
+.sk
+To display the extended built-in help, use the command:
+.br
+.literal
+ unzip -hh
+.end literal
+.sk
+The built-in help may be more current than this help file, especially
+between full product releases.
+.sk
+To list all available options for a particular UnZip program, use the
+command:
+.br
+.literal
+ unzip --show-options
+.end literal
+.sk
+This report will not include any options which are available only on
+other system types, or options which must be enabled at build-time but
+were not enabled in the particular UnZip program being used.
+.!----------------------------------------------------------------------
+.indent -2
+2 Command_Parameters
+.sk;.indent -2
+file[.zip]
+.sk
+File path/name of a ZIP archive. A wildcard name may be used to specify
+multiple ZIP archives to be processed in one command. On VMS systems,
+any of the standard wildcards for a directory/file specification may be
+used: "...", "*", or "%" (or, since VMS V7.2, "?"). The default archive
+file specification is ".ZIP".
+.sk
+Note that a ".zip" or ".ZIP" file type on an archive is merely a
+convention, not a requirement. For example, a self-extracting ZIP
+archive named "fred" or "fred.exe" could be processed as if it were an
+ordinary archive; just specify the actual file name with its actual name
+ending (if any), whatever that may be.
+.sk;.indent -2
+member ...
+.sk
+An optional list of archive members to be processed, separated by
+spaces. If no member list is specified, then all archive members are
+processed. Unix-like ("globbing") wildcard patterns may be used to
+match multiple members:
+.sk
+.literal
+ * Matches a sequence of 0 or more characters.
+ ? Matches exactly 1 character.
+ [...] Matches any single character found inside the brackets.
+ Ranges are specified by a beginning character, a hyphen, and
+ an ending character. If an exclamation point ("!") or a
+ caret ("^") follows the left bracket, then the range of
+ characters within the brackets is complemented. That is,
+ anything except the characters inside the brackets is
+ considered a match. To specify a literal left bracket, use
+ the three-character sequence "[[]".
+.end literal
+.!----------------------------------------------------------------------
+.indent -2
+2 Options_Primary_Mode
+.br
+Options in this group specify the primary mode of operation of
+UnZip. Only one of these primary mode options may be specified.
+.sk
+Note that uppercase options (like -T) must be specified in quotes
+(unless SET PROCESS/PARSE_STYLE=EXTENDED is set). For example:
+.sk
+.literal
+ unzip "-VX" -a zipfile
+.end literal;
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -c
+.br;.indent -2
+-c
+.br;.indent -2
+--to-stdout
+.sk
+Primary Mode. Extract files to stdout/screen. This option is similar
+to the -p option except that the name of each file is displayed as it is
+extracted, and the -a option is allowed, which can provide automatic
+ASCII-EBCDIC conversion, where appropriate.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -f
+.br;.indent -2
+-f
+.br;.indent -2
+--freshen
+.sk
+Primary Mode. Freshen existing files. That is, extract only those
+files that already exist on disk and that are newer than the disk
+copies. By default UnZip queries before overwriting, but the -o option
+may be used to suppress the queries.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -h
+.br;.indent -2
+-h
+.br;.indent -2
+--help
+.sk
+Primary Mode. Display brief (roughly 24 lines) usage instructions. See
+also -hh.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -hh
+.br;.indent -2
+-hh
+.br;.indent -2
+--long-help
+.sk
+Primary Mode. Display extended help (more complete usage
+instructions). See also -h.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -l
+.br;.indent -2
+-l
+.br;.indent -2
+--list
+.sk
+Primary Mode. List archive members. By default, a brief format is
+used, which includes the following items: member name, uncompressed
+file size ("Length"), and modification date-time of the member. A
+summary is included at the end of the report, showing total size and
+count for all the members in the report. Specifying a member list
+limits the report to those members.
+.sk
+Adding -v (--verbose) to an "unzip -l" command line adds the following
+items to the report: compression method, compressed size ("Size"),
+compression ratio, and 32-bit CRC.
+.sk
+In contrast to some other programs, UnZip does not include the
+12-byte encryption header in the compressed size values for a
+Traditionally encrypted member. Therefore, compressed size and
+compression ratio figures are independent of the member's encryption
+status and show the correct compression performance. (The complete size
+of the encrypted compressed data stream for archive members is reported
+by the more verbose ZipInfo reports. See ZipInfo.
+.sk
+If UnZip was built with OS2_EAS enabled, then the -l report also
+includes the sizes of stored OS/2 extended attributes (EAs) and OS/2
+access control lists (ACLs). In addition, the archive comment and
+individual member comments (if any) are displayed.
+.sk
+If a file was archived from a single-case file system (for example, the
+old MS-DOS FAT file system) and the -L option was given, the
+filename is converted to lowercase and is shown prefixed with a caret
+(^).
+.sk
+Note: If only -v (--verbose) is specified with an archive name, then
+UnZip acts as if "-l -v" were specified, and a detailed listing is
+generated.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 --license
+.sk
+Primary Mode. Display the Info-ZIP license.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -p
+.br;.indent -2
+-p
+.br;.indent -2
+--pipe-to-stdout
+.sk
+Primary Mode. Extract files to stdout (pipe). Only the actual file
+data for the members are sent to stdout (no file names, or other
+information, as would be displayed with -c, and the files are always
+extracted in binary format, just as they are stored (no conversions).
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -T
+.br;.indent -2
+-T
+.br;.indent -2
+--timestamp-new
+.sk
+Primary Mode. Set the timestamp on the archive(s) to that of the newest
+file in each one. This corresponds to Zip's -go option, except that it
+can be used on wildcard archives (for example, "unzip -T *.zip"), and is
+much faster.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -t
+.br;.indent -2
+-t
+.br;.indent -2
+--test
+.sk
+Primary Mode. Test archive members. Testing means that each archive
+member is extracted in memory (expanding and decrypting, as needed), but
+not written to a file. The resulting CRC (cyclic redundancy check, an
+enhanced checksum) of the extracted data is then compared with the
+original file's stored CRC value, and an error message is emitted if a
+CRC mismatch is detected.
+.sk
+Adding -v to -t adds some diagnostic information to the report for
+archive members with LZMA or PPMd compression.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -u
+.br;.indent -2
+-u
+.br;.indent -2
+--update
+.sk
+Primary mode. Update existing files and create new ones if
+needed. This mode performs the same function as the Freshen (-f) mode,
+extracting (with query) files that are newer than those with the same
+name on disk, but it also extracts those files that do not already exist
+on disk.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -v
+.br;.indent -2
+-v
+.br;.indent -2
+--verbose
+.sk
+Primary mode (when alone) or option. When used as a primary mode
+(alone), and no archive is specified, an "unzip -v" command generates a
+report showing the program version, build options, and relevant
+envrironment variables.
+.sk
+When used with some other primary mode option, -v can make output more
+verbose (detailed).
+.sk
+If no other primary mode is specified, and an archive is specified, then
+UnZip acts as if "-l -v" were specified, and a detailed listing is
+generated. See -l.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -z
+.br;.indent -2
+-z
+.br;.indent -2
+--zipfile-comment
+.sk
+Primary mode. Display only the archive comment.
+.!----------------------------------------------------------------------
+.indent -2
+2 Options_Ordinary
+.br
+Options in this group modify the operation of UnZip.
+.sk
+Note that uppercase options (like -V) must be specified in quotes
+(unless SET PROC/PARSE=EXTEND is set). For example:
+.sk;.literal
+ unzip "-VX" -a zipfile
+.end literal;.sk
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -2
+.br;.indent -2
+-2
+.br;.indent -2
+--force-ods2
+.sk
+[VMS] Convert extracted file names to ODS2-compatible names, even on an
+ODS5 file system. By default, if the destination file system is ODS5,
+case is preserved, and extended file name characters are caret-escaped
+as needed, while if the destination file system is ODS2, invalid
+characters are replaced by underscores.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -A
+.br;.indent -2
+-A
+.br;.indent -2
+--api-help
+.sk
+[OS/2, Unix DLL] Print extended help for the DLL's application
+programming interface (API).
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -a
+.br;.indent -2
+-a
+.br;.indent -2
+--ascii
+.sk
+Convert text files. Ordinarily, all files are extracted exactly as they
+are stored, byte-for-byte. With -a, line endings in a text
+file are adjusted to the local standard as the file is extracted. When
+appropriate, ASCII<-->EBCDIC conversion is also done.
+.sk
+Zip (or a similar archiving program) identifies files as "binary"
+or "text" when they are archived. (A short-format ZipInfo report
+denotes a binary file with a "b", and a text file with a "t".)
+Zip's identification of text files may not be perfect, so UnZip prints
+"[binary]" or "[text]" as a visual check for each file it extracts with
+-a. The -aa option forces all files to be extracted (and converted) as
+text, regardless of the supposed file type.
+.sk
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip -V"), files are always created with their original record
+formats. For archives without VMS attribute information (not made with
+"zip -V"), all files are normally created with Stream_LF record
+format. With -a, text files are normally created with variable-length
+record format, but adding -S gives them Stream_LF record format. With
+-aa, all files are treated as text files. See also -b and -S.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -B
+.br;.indent -2
+-B
+.br;.indent -2
+--backup
+.sk
+[when built with UNIXBACKUP enabled] Save a backup copy of each
+overwritten file. The backup file gets the name of the target file with
+a tilde and optionally a unique sequence number (up to 5 digits)
+appended. The sequence number is appended whenever another file with
+the original name plus tilde already exists. When used together with
+the "overwrite all" option, -o, numbered backup files are never
+created. In this case, all backup files are named as the original file
+with an appended tilde, and existing backup files are deleted without
+notice. This feature works similarly to the default behavior of
+emacs(1) in many locations.
+.sk
+Example: the old copy of "foo" is renamed to "foo~".
+.sk
+Warning: Users should be aware that the -B option does not prevent loss
+of existing data under all circumstances. For example, when UnZip is
+run in overwrite-all mode, an existing "foo~" file is deleted before
+UnZip attempts to rename "foo" to "foo~". When this rename attempt
+fails (because of a file lock, insufficient privileges, or any other
+reason), the extraction of "foo~" gets cancelled, but the old
+backup file is already lost. A similar scenario takes place when the
+sequence number range for numbered backup files gets exhausted (99999,
+or 65535 for 16-bit systems). In this case, the backup file with the
+maximum sequence number is deleted and replaced by the new backup
+version without notice.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -b
+.br;.indent -2
+-b
+.br;.indent -2
+--binary
+.sk
+[Tandem, VMS] Selects the file record format used when extracting binary
+files. -b may conflict or interact with -a in different ways on
+different system types. -b is ignored on systems other than Tandem and
+VMS.
+.sk
+Zip (or a similar archiving program) identifies files as "binary" or
+"text" when they are archived. (A short-format ZipInfo report denotes a
+binary file with a "b", and a text file with a "t".)
+.! Zip's
+.! identification of text files may not be perfect, so UnZip prints
+.! "[binary]" or "[text]" as a visual check for each file it extracts with
+.! -b. The -bb option forces all files to be extracted (and converted) as
+.! binary, regardless of the supposed file type.
+.sk
+[Tandem] Force the creation files with filecode type 180 ('C') when
+extracting archive members marked as "text". (On Tandem, -a is
+enabled by default, see above).
+.sk
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip -V"), files are always created with their original record
+formats. For archives without VMS attribute information (not made with
+"zip -V"), files are normally created with Stream_LF record
+format. With -b, binary files are created with fixed-length, 512-byte
+record format. With -bb, all files are created with fixed-length,
+512-byte record format. When extracting to standard output (-c or -p
+option in effect), the default conversion of text record delimiters is
+disabled for binary files (with -b), or for all files (with -bb).
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -C
+.br;.indent -2
+-c
+.br;.indent -2
+.literal
+--ignore-case ([CMS, MVS] --CMS-MVS-lower)
+.end literal
+.sk
+Use case-insensitive name matching for names in the member list and
+the -x excluded-member list on the command line. By default,
+case-sensitive matching is done. For example, specifying
+"makefile" on the command line will match only "makefile" in
+the archive, not "Makefile" or "MAKEFILE". On many systems, the local
+file system is case-insensitive, so case-insensitive name matching would
+be more natural. With -C, "makefile" would match
+"makefile", "Makefile", or "MAKEFILE".
+.sk
+-C does not affect the search for the ZIP archive file(s), nor
+the matching of archive members to existing files on the extraction
+path. So, on a case-sensitive file system, UnZip will never try
+to overwrite a file "FOO" when extracting a member named "foo"!
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -c
+.br;.indent -2
+-c
+.br;.indent -2
+--to-stdout
+.sk
+Primary Mode. Extract files to stdout/screen. For details, see
+Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -D
+.br;.indent -2
+-D
+.br;.indent -2
+--dir-timestamps
+.sk
+Control timestamps on extracted files and directories. By default,
+UnZip restores timestamps for extracted files, but not for directories
+it creates. Specifying -D tells UnZip not to restore any
+timestamps. Specifying -D- tells UnZip to restore timestamps for
+directories as well as other items. -D- works only on systems that
+support setting timestamps for directories (currently ATheOS, BeOS,
+MacOS, OS/2, Unix, VMS, Win32). On other systems, -D- has no effect.
+.sk
+[Non-VMS] Timestamp restoration behavior changed between UnZip versions
+6.00 and 6.10. The following table shows the effects of various -D
+options for both versions.
+.sk
+.literal
+ UnZip version |
+ 6.00 | 6.10 | Restore timestamps on:
+ -----------+-----------+------------------------
+ -DD | -D | Nothing.
+ -D | (default) | Files, not directories.
+ (default) | -D- | Files and directories.
+.end literal
+.sk
+[VMS] The old behavior on VMS was the same as the new behavior on all
+systems. (The old negated --D option is now -D-, because of changes to
+the command-line parser.)
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -d
+.br;.indent -2
+-d dest_dir
+.br;.indent -2
+--extract-dir dest_dir
+.sk
+Specifies a destination directory for extracted files. By default,
+files are extracted (and subdirectories created) in the current
+directory. With "-d dest_dir", extraction is done into the
+specified directory, instead. See also -da.
+.sk
+The option and directory may be concatenated without any white space
+between them, but this may cause normal shell behavior to be
+suppressed. For example, "-d ~" (tilde) is expanded by Unix shells into
+the name of the user's home directory, but "-d~" is treated as a literal
+"~" subdirectory of the current directory.
+.sk
+[VMS] On VMS, only a VMS-style device:[directory] specification is
+permitted.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -d
+.br;.indent -2
+-da[=reuse]
+.br;.indent -2
+--auto-extract-dir[=reuse]
+.sk
+Specifies a destination directory for extracted files which is derived
+from the base name of the archive. By default, files are extracted
+(and subdirectories created) in the current default directory. With
+-da, UnZip automatically derives a subdirectory name from the archive
+name, creates that subdirectory, and extracts files into that
+subdirectory.
+.sk
+For example, with -da, extraction of "fred.zip" is done into
+subdirectory "[.fred]" instead of into the current directory. (On
+non-VMS, systems, subdirectory "fred".)
+.sk
+For greater safety, by default, UnZip will refuse to extract into an
+automatic extraction directory which already exists. Specifying the
+optional keyword "reuse" will allow an existing directory to be used.
+.sk
+If -da is specified as a default option in an environment variable, it
+can be overridden by either a negated -da- option or an explicit "-d
+dest_dir" option. See also -d.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -f
+.br;.indent -2
+-f
+.br;.indent -2
+--freshen
+.sk
+Primary Mode. Freshen existing files. For details, see
+Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -h
+.br;.indent -2
+-h
+.br;.indent -2
+--help
+.sk
+Primary Mode. Display brief (roughly 24 lines) usage instructions. For
+details, see Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -hh
+.br;.indent -2
+-hh
+.br;.indent -2
+--long-help
+.sk
+Primary Mode. Display complete usage instructions. For details, see
+Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -i
+.br;.indent -2
+-i
+.br;.indent -2
+--no-mac-ef-names
+.sk
+[MacOS (pre-OS-X)] Ignore filenames stored in MacOS extra
+fields. Instead, the most compatible filename stored in the generic
+part of the member's header is used.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -J
+.br;.indent -2
+-J
+.br;.indent -2
+--junk-attrs
+.sk
+[BeOS] Junk file attributes. The file's BeOS file attributes are not
+restored, only the file's data.
+.sk
+[MacOS] Ignore MacOS extra fields. All Macintosh-specific info is
+skipped. AppleDouble files are restored as separate files.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -j
+.br;.indent -2
+-j[=depth]
+.br;.indent -2
+--junk-dirs[=depth]
+.sk
+Junk directories on extracted files. With -j, all directory information
+is stripped from an archive member name, so all files are extracted into
+the destination directory. (See also -d.)
+.sk
+If a depth ("=depth", where "depth" is a positive integer) is specified,
+then that number of directory levels will be stripped from an archive
+member name. For example, an archive member like "a/b/c/d/ee.txt" would
+normally be extracted as "[.a.b.c.d]ee.txt". With -j, it would be
+extracted as "ee.txt". With -j=2, the first two directory levels would
+be stripped, so it would be extracted as "[.c.d]ee.txt".
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 --jar
+.sk
+Treat archive(s) as Java JAR. Over-simplification in Java JAR archives
+can cause UnZip to transform UTF-8 file names according to
+inappropriate (MS-DOS) rules, yielding corrupt names on extracted files
+(typically those with ASCII codes 128-255). Archives containing a Java
+"CAFE" extra field should be detected automatically, and handled
+correctly, but not all JAR archives include that extra
+field. Specifying --jar tells UnZip to expect UTF-8 file names,
+regardless of whether the archive contains a "CAFE" extra field.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -K
+.br;.indent -2
+-K
+.br;.indent -2
+--keep-s-attrs
+.sk
+[AtheOS, BeOS, Unix] Retain SUID/SGID/Tacky permission bits. By
+default, these permission bits are cleared, for security reasons.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -k
+.br;.indent -2
+--keep-permissions
+.sk
+[AtheOS, BeOS, Unix, VMS] Control how archived permissions or
+protections are restored on extracted files and directories.
+.sk
+By default, archived permissions are restored with some limitations. On
+AtheOS, BeOS, and Unix, the current umask value is applied (to the
+normal user/group/other permissions). On VMS, the current default
+protection is applied to the UIC-based (SOGW) protections.
+.sk
+With -k, the archived permissions are restored without regard to the
+Unix umask or VMS default protection. (This was the default behavior in
+UnZip versions before 6.10.)
+.sk
+With -k-, the archived permissions are ignored, so only the Unix umask
+or VMS default protection is effective. (On VMS, directories are always
+created without any Delete access.)
+.sk
+On AtheOS, BeOS, and Unix, the SUID/SGID/Tacky permission bits are
+controlled by the -K/--keep-s-attrs option, regardless of the
+-k/--keep-permissions setting.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -ka
+.br;.indent -2
+--keep-acl
+[VMS] Restore ACLs on extracted files and directories.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -L
+.br;.indent -2
+-L
+.br;.indent -2
+--lowercase-names
+.sk
+Convert to lowercase any filename originating on an uppercase-only
+operating system or file system. (This was UnZip's default behavior in
+versions before 5.11. The current default behavior is the same as the
+old behavior with the -U option. -U is now used for another purpose.)
+.sk
+Depending on the archiver, files archived from single-case file systems
+(old MS-DOS FAT, VMS ODS2, and so on) may be stored as all-uppercase
+names; this can be ugly or inconvenient when extracting to a
+case-preserving file system such as OS/2 HPFS or a case-sensitive one
+such as on Unix. By default UnZip lists and extracts such filenames
+exactly as they're stored (excepting truncation, conversion of
+unsupported characters, an so on). With -L, the names of all files from
+certain systems will be converted to lowercase. With -LL, all file names
+will be down-cased, regardless of the originating file system.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -l
+.br;.indent -2
+-l
+.br;.indent -2
+--list
+.sk
+Primary Mode. List archive members. For details, see
+Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -M
+.br;.indent -2
+-M ([CMS,MVS] Or: " -m )
+.br;.indent -2
+--more
+.sk
+Pipe all output through an internal pager similar to the Unix more(1)
+command. At the end of a screenful of output, UnZip pauses with a
+"--More--" prompt; the next screenful may be viewed by pressing the
+Enter (Return) key or the space bar. UnZip can be terminated by
+pressing the "q" key and, on some systems, the Enter/Return key. Unlike
+Unix more(1), there is no forward-searching or editing
+capability. Also, UnZip doesn't notice if long lines wrap at the edge
+of the screen, effectively resulting in the printing of two or more
+lines and the likelihood that some text will scroll off the top of the
+screen before being viewed. If the actual number of lines on the screen
+can not be determined, 24 lines will be assumed.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -mc
+.br;.indent -2
+-mc
+.br;.indent -2
+--member-counts
+.sk
+Control inclusion of separate member counts for directories, files, and
+links, after the totals summary at the end of the report. By default,
+they are included. Use "-mc-" or "--member-counts-" to suppress them.
+See also -t.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -N
+.br;.indent -2
+-N
+.br;.indent -2
+--comment-to-note
+.sk
+[Amiga] Extract member comments as Amiga filenotes. Member comments are
+created with the -c option of Zip, or with the -N option of the Amiga
+port of Zip, which stores filenotes as comments.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -n
+.br;.indent -2
+-n
+.br;.indent -2
+--never-overwrite
+.sk
+When extracting, never overwrite existing files. If a file already
+exists, skip the extraction of that file without asking. See also
+-o (--overwrite).
+.sk
+By default, UnZip queries the user before extracting any file that
+already exists. The user may choose to overwrite only the current file,
+overwrite all files, skip extraction of the current file, skip
+extraction of all existing files, or rename the current file (choose a
+new name for the extracted file).
+.sk
+[VMS] On VMS, the usual query choices are to create a new version of an
+existing file, to skip extraction, or to rename the current file. In
+the case where an archive member name includes a version number, and -V
+("retain VMS file version numbers") is in effect, then an additional
+query choice is offered: to overwrite the existing file.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -O
+.br;.indent -2
+-O
+.br;.indent -2
+--oem-char-set char_set
+.sk
+[Unix] Select OEM character set char_set.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -o
+.br;.indent -2
+-o
+.br;.indent -2
+--overwrite
+.sk
+Always overwrite existing files without prompting. This is a dangerous
+option, so use it with care. (It is often used with -f, however, and is
+the only way to overwrite directory EAs on OS/2.)
+.sk
+By default, UnZip queries the user before extracting any file that
+already exists.
+.sk
+[Non-VMS] On non-VMS systems, the user may choose to overwrite only the
+current file, overwrite all files, skip extraction of the current file,
+skip extraction of all existing files, or rename the current file
+(choose a new name for the extracted file).
+.sk
+[VMS] On VMS, the usual query choices are to create a new version of an
+existing file, to skip extraction, or to rename the current file. In
+the case where an archive member name includes a version number, and -V
+("retain VMS file version numbers") is in effect, then an additional
+query choice is offered: to overwrite the existing file. In this case,
+-o selects the "new version" choice, and -oo (or "-o -o") selects the
+"overwrite" choice.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -P
+.br;.indent -2
+-P password
+.br;.indent -2
+--password password
+.sk
+Use "password" to decrypt encrypted archive members (if any). THIS IS
+INSECURE! Many multi-user operating systems provide ways for any user
+to see the current command line of any other user. Even on stand-alone
+systems, there is always the threat of over-the-shoulder
+peeking. Storing the plaintext password as part of a command line in an
+automated script can be even less secure, Whenever possible, use the
+non-echoing, interactive prompt to enter passwords. Where security is
+truly important, use a strong encryption method, such as AES, instead of
+the relatively weak encryption provided by Traditional ZIP
+encryption. Or, use an external encryption program, such as GnuPG,
+before archiving the file. (Note that Zip will probably not be able to
+do significant compression on a file which has already been encrypted.)
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -p
+.br;.indent -2
+-p
+.br;.indent -2
+--pipe-to-stdout
+.sk
+Primary Mode. Extract files to stdout (pipe). For details, see
+Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -q
+.br;.indent -2
+-q
+.br;.indent -2
+--quiet
+.sk
+Perform operations quietly. (-qq: even more quietly). By default,
+UnZip prints the names of the files it's extracting or testing, the
+extraction methods, any member or archive comments that may be stored in
+the archive, and possibly a summary when finished with each
+archive. The -q[q] options suppress the printing of some or all of
+these messages.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -r
+.br;.indent -2
+-r
+.br;.indent -2
+--remove-exts
+.sk
+[Tandem] Remove file extensions.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -S
+.br;.indent -2
+-S
+.br;.indent -2
+--streamlf
+.sk
+[VMS] Use Stream_LF record format when converting extracted text files
+(-a, -aa), instead of the text-file default, variable-length record
+format.
+.sk
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip -V"), files are always created with their original record
+formats. For archives without VMS attribute information (not made with
+"zip -V"), all files are normally created with Stream_LF record
+format. With -a, text files are normally created with variable-length
+record format, but adding -S gives them Stream_LF record format. With
+-aa, all files are treated as text files. See also -a and -b.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -s
+.br;.indent -2
+-s
+.br;.indent -2
+--space-to-uscore
+.sk
+[OS/2, NT, MS-DOS] Convert spaces in filenames to underscores. Because
+all these operating systems allow spaces in filenames, UnZip
+normally extracts filenames with spaces intact (for example,
+"EA DATA. SF"). Working with such file names can be awkward,
+however, so -s can be used to replace spaces with underscores.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -sc
+.br;.indent -2
+-sc
+.br;.indent -2
+--show-command
+.sk
+Show processed command line (options, arguments), and then exit.
+.sk
+Strictly speaking this is a primary-mode option, but it's intended for
+use in program development, not in normal use.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -si
+.br;.indent -2
+-si
+.br;.indent -2
+--show-pid
+.sk
+[Non-VMS] Show the UnZip program's process ID (pid) before
+performing any other work. This value can then be used in a
+"kill -USR1 pid" command to trigger a user-triggered progress report.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -so
+.br;.indent -2
+-so
+.br;.indent -2
+--show-options
+.sk
+Display all valid program options, then exit.
+.sk
+Strictly speaking this is a primary-mode option, but it's intended for
+use in program development, not in normal use.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -T
+.br;.indent -2
+-T
+.br;.indent -2
+--timestamp-new
+.sk
+Primary Mode. Set the timestamp on the archive(s) to that of the newest
+file in each one. For details, see Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -t
+.br;.indent -2
+-t
+.br;.indent -2
+--test
+.sk
+Primary Mode. Test archive members. For details, see
+Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -U
+.br;.indent -2
+-U
+.br;.indent -2
+--unicode
+.sk
+[UNICODE_SUPPORT] Control UTF-8 handling. When UNICODE_SUPPORT is
+available, -U forces UnZip to escape all non-ASCII characters from UTF-8
+coded filenames as "#Uxxxx' (for UCS-2 characters, or "#Lxxxxxx" for
+Unicode codepoints needing 3 octets). This option is mainly provided
+for debugging purpose when the fairly new UTF-8 support is suspected to
+mangle up extracted filenames.
+.sk
+-UU disables the recognition of UTF-8 encoded filenames. The handling
+of filename codings within UnZip falls back to the behavior of previous
+versions.
+.sk
+[old, obsolete usage] Leave filenames uppercase if created on MS-DOS,
+VMS, and so on. See -L.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -u
+.br;.indent -2
+-u
+.br;.indent -2
+--update
+.sk
+Primary mode. Update existing files and create new ones if needed. For
+details, see Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -V
+.br;.indent -2
+-V
+.br;.indent -2
+--keep-versions
+.sk
+[Non-CMS-MVS] Retain VMS file version numbers. VMS files can be stored
+with a version number, in the format "file.type;##", where "##" is a
+decimal number. By default the ";##" version numbers are stripped, but
+this option allows them to be retained. (On file systems that limit
+filenames to particularly short lengths, the version numbers may be
+truncated or stripped regardless of this option.)
+.sk
+[Non-VMS] Note that before UnZip version 6.10, on a non-VMS system, a
+file with a name like "fred;123" would, by default, be extracted as
+"fred", even if the file did not originate on a VMS system (so that
+";123" was probably not really a VMS version number). Beginning with
+UnZip version 6.10, the default behavior is to strip VMS version numbers
+only from files which were archived on a VMS system. To restore the old
+behavior, and always strip apparent VMS version numbers, explicitly
+negate the option: "-V-".
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -v
+.br;.indent -2
+-v
+.br;.indent -2
+--verbose
+.sk
+When used with some primary mode option, -v can make output more
+verbose. See also Primary Mode options, and -l in particular.
+.sk
+Note: If only -v (--verbose) is specified with an archive name, then
+UnZip acts as if "-l -v" were specified, and a detailed listing is
+generated.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -W
+.br;.indent -2
+-W
+.br;.indent -2
+--wild-no-span
+.sk
+[WILD_STOP_AT_DIR] (Valid when the program was built with the C macro
+WILD_STOP_AT_DIR defined.) By default, the wildcard characters "?"
+(single-character wildcard) and "*" (multi-character wildcard) match any
+character in a member path/name. "-W" modifies the
+pattern-matching behavior for archive members so that both "?"
+(single-character wildcard) and "*" (multi-character wildcard) do not
+match the directory separator character "/". (The two-character
+sequence "**" acts as a multi-character wildcard that includes the
+directory separator in its matched characters.) For example, with
+"-W":
+.sk
+.literal
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "**.c" matches both "foo.c" and "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+.end literal
+.sk
+This modified behavior is equivalent to the pattern matching style used
+by the shells of some of UnZip's supported target OSs (one example
+is Acorn RISC OS). This option may not be available on systems where
+the Zip archive's internal directory separator character "/" is allowed
+as regular character in native operating system filenames.
+.sk
+[non-VMS] Currently, UnZip uses the same pattern matching rules for both
+wildcard archive file name specifications and archive member selection
+patterns on most system types. For systems allowing "/" as regular
+filename character, the -W option would not work as expected on a
+wildcard file name specification.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -X
+.br;.indent -2
+-X
+.br;.indent -2
+--restore-info
+.sk
+[VMS, Unix, OS/2, NT, Tandem] Restore owner/protection info (UICs and
+ACL entries on VMS, or user and group info (UID/GID) on Unix, or
+access control lists (ACLs) on certain network-enabled versions of
+OS/2 (Warp Server with IBM LAN Server/Requester 3.0 to 5.0; Warp Connect
+with IBM Peer 1.0), or security ACLs on Windows NT.) In most cases
+this will require special system privileges, and doubling the option
+(-XX) on NT instructs UnZip to use privileges for
+extraction; but on Unix, for example, a user who belongs to several
+groups can restore files owned by any of those groups, so long as the
+user IDs match the user's own. Note that ordinary file attributes are
+always restored. This option applies only to optional, extra ownership
+info available on some operating systems. (NT's access control lists do
+not appear to be especially compatible with OS/2's, so no attempt is
+made at cross-platform portability of access privileges. It is not
+clear under which conditions this would ever be useful anyway.)
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -x
+.br;.indent -2
+-x member ...
+.br;.indent -2
+--exclude member ...
+.sk
+An optional list of archive members to be excluded from
+processing. Because wildcard characters normally match "/" directory
+separators (for exceptions see the option -W), this option may be used
+to exclude any files that are in subdirectories. For example, "unzip
+foo *.[ch] -x */*" would extract all C source files (*.c, *.h) in the
+main directory, but none in any subdirectories. Without the -x option,
+all C source files in all directories within the archive would be
+extracted.
+.sk
+When the program sees -x (--exclude) on a command line, it stops
+scanning for options, and treats every succeeding item as an archive
+member name. To avoid confusion between member names and command
+options, it's simplest to specify -x (--exclude) and its member list as
+the last 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). That is, the following two commands are
+equivalent:
+.sk
+.literal
+ unzip fred.zip -b -x file1 file2 file3
+ unzip fred.zip -x file1 file2 file3 @ -b
+.end literal
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -Y
+.br;.indent -2
+-Y
+.br;.indent -2
+--dot-version
+.sk
+[VMS] Treat archive member name endings of ".nnn" (where "nnn" is a
+decimal number) as if they were VMS version numbers (";nnn"). (The
+default is to treat them as file types.) For example:
+.sk
+.literal
+ "a.b.3" -> "a.b;3"
+.end literal
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -Z
+.br;.indent -2
+-Z
+.br;.indent -2
+--zipinfo-mode
+.sk
+ZipInfo mode. If the first option on the command line is
+-Z, then the program runs in ZipInfo mode, which is used to display
+information about an archive and its members. Remaining
+options are interpreted as ZipInfo options. See ZipInfo_mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -z
+.br;.indent -2
+-z
+.br;.indent -2
+--zipfile-comment
+.sk
+Primary mode. Display only the archive comment. For details, see
+Options_Primary_Mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -$
+.br;.indent -2
+-$
+.br;.indent -2
+--volume-labels
+.sk
+[MS-DOS, OS/2, NT] Restore the volume label if the extraction medium is
+removable (for example, a diskette). Doubling the option (-$$)
+allows fixed media (hard disks) to be labeled as well. By default,
+volume labels are ignored.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -/
+.br;.indent -2
+-/
+.br;.indent -2
+--extensions
+.sk
+[Acorn] Overrides the extension list supplied by the Unzip$Ext
+environment variable. During extraction, filename extensions that match
+one of the items in this extension list are swapped in front of the base
+name of the extracted file.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -:
+.br;.indent -2
+-:
+.br;.indent -2
+--do-double-dots
+.sk
+[all but Acorn, VM/CMS, MVS, Tandem] Allows UnZip to extract
+archive members into locations outside of the current extraction
+destination directory (and its subdirectories).
+.sk
+For security reasons, UnZip normally removes "parent directory"
+path components ("../") from the path names of archive members as they
+are extracted. This safety feature (new for version 5.50) prevents
+UnZip from accidentally writing files to directories outside
+the current destination directory tree. The -: option sets UnZip back
+to its previous, more liberal behavior, allowing exact extraction of
+archives that use "../" path components to create multiple directory
+trees at or above the level of the destination directory.
+.sk
+This option does not enable writing explicitly to the root
+directory ("/"). To achieve this, it is necessary to set the extraction
+target folder to "/" (by using an option like "-d /"). However,
+when the -: option is specified, it is still possible implicitly
+to write to the root directory if member paths specifying enough "../"
+path components.
+.sk
+Use this option with extreme caution.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+3 -^
+.br;.indent -2
+-^
+.br;.indent -2
+--control-in-name
+.sk
+[Unix] Allow control characters in file names of extracted ZIP archive
+members. On Unix, a file name may contain any (8-bit) character code
+with the two exceptions of "/" (the directory delimiter) and NUL (0x00,
+the C string-termination character), unless the specific file system has
+more restrictive conventions. Generally, this allows embedding ASCII
+control characters or escape sequences in file names. However, this
+feature allows the use of malicious file names which can cause various
+kinds of bad trouble when displayed on a user's
+terminal/emulator. (Even a file name with unprintable but otherwise
+harmless characters can cause problems for users.)
+.sk
+For these reasons, by default, UnZip applies a filter that removes
+potentially dangerous control characters from the extracted file
+names. The -^ option overrides this filter in the rare case that
+embedded filename dangerous control characters are to be intentionally
+restored.
+.!----------------------------------------------------------------------
+.indent -2
+2 Environment_Options
+.br
+UnZip's default behavior may be modified by placing command-line options
+in an environment variable. This can be done with any option, but it is
+probably most useful options like -a (auto-convert text files), -L
+(downcase file names from systems with all uppercase file names), -C
+(use case-insensitive name matching), -q (quiet), -o (always overwrite),
+or -n (never overwrite).
+.sk
+For UnZip, the environment variable name on VMS is UNZIP_OPTS
+(non-VMS: UNZIP). The name on VMS is different to avoid conflict with
+a foreign-command DCL symbol, UNZIP. For compatibility with Zip, if
+UNZIP_OPTS is not defined, then UnZip will use UNZIPOPT the same
+way.
+.sk
+For ZipInfo ("unzip -Z"), the environment variable name on VMS is
+ZIPINFO_OPTS (non-VMS: ZIPINFO). For compatibility with Zip,
+if ZIPINFO_OPTS is not defined, then ZipInfo will use ZIPINFOOPT the
+same way.
+.sk
+For example, to make UnZip act as quietly as possible, only
+reporting errors, one could use commands like the following:
+.sk
+.literal
+Unix Bourne (or similar) shell:
+ UNZIP='-q -q'; export UNZIP
+.end literal
+.sk
+.literal
+Unix C shell:
+ setenv UNZIP '-q -q'
+.end literal
+.sk
+.literal
+OS/2 or MS-DOS:
+ set UNZIP="-q -q"
+.end literal
+.sk
+.literal
+VMS (with quotation to preserve lower case in DCL):
+ define UNZIP_OPTS "-q -q" ! Logical name, or
+ UNZIP_OPTS = "-q -q" ! DCL symbol. (Either works.)
+.end literal
+.sk
+Environment options are treated the same as any other command-line
+options, except that they are effectively the first options on the
+command line. To override an environment option, one may use an
+explicit option to cancel or override it. For example, to override one
+of the "quiet" flags in the example above, use a command like:
+.sk
+.literal
+ unzip -q- [other options] archive.zip
+.end literal
+.sk
+The leading hyphen is the normal option character, and the trailing one
+negates the option, canceling one level of quietness. To cancel
+multiple "quiet" flags, use multiple -q- options:
+.sk
+.literal
+ unzip -t -q- -q- archive
+ unzip -q- -q- -t archive
+.end literal
+.sk
+Note that multiple one-character options like "-q" and "-q" can be
+combined into a single "-qq", but it's generally clearer to keep each
+instance of each option separate. Similarly, negated one-character
+options can be combined, as with "-q-q-", but "-q- -q-" is
+generally clearer.
+.sk
+The examples show short (one-character) options, but long ("--")
+options are also allowed.
+.!----------------------------------------------------------------------
+.indent -2
+2 Encryption_Decryption
+.br
+Zip and UnZip have long supported a relatively weak encryption method,
+which we call Traditional ZIP encryption. The source code for
+Traditional encryption is included in the source kits, and support for
+Traditional encryption is enabled by default. (Build-time C macro:
+CRYPT_TRAD.)
+.sk
+Beginning with UnZip version 6.10 and Zip version 3.1,
+these programs also offer a stronger, Advanced Encryption Standard (AES)
+encryption method, which we call AES WinZip/Gladman (AES_WG)
+encryption. (The encryption code was supplied by Brian Gladman, and the
+archive format is intended to be compatible with that used by the
+WinZip program. WinZip is a registered trademark of WinZip
+International LLC.) The source code for AES_WG encryption is
+distributed in a separate kit (for export control reasons), and support
+for AES_WG encryption must be enabled explicitly at build
+time. (Build-time C macro: CRYPT_AES_WG.) See the INSTALL file in the
+source kit for details on how to enable AES_WG encryption (or how to
+disable Traditional encryption).
+.sk
+For details on the WinZip AES scheme, see:
+.br
+.indent 4
+http://www.winzip.com/aes_info.htm
+.sk
+For information on the separate AES_WG source kit, see:
+.br
+.indent 4
+ftp://ftp.info-zip.org/pub/infozip/crypt/
+.br
+.indent 4
+ftp://ftp.info-zip.org/pub/infozip/crypt/README_AES_WG.txt
+.sk
+Normally, encryption passwords are supplied by the user interactively
+when requested by the program. See the -P option for a (less secure)
+method of specifying a password on the command line.
+.sk
+With Traditional encryption, when decrypting, a password will be checked
+against header data, and used if it appears to be correct. The correct
+password will always check out against the header data, but there is a
+1-in-256 chance that an incorrect password will as well. (This is a
+security feature of the PKWARE archive format; it helps prevent
+brute-force attacks that might otherwise gain a large speed advantage by
+testing only the header.) In the case that an incorrect password is
+given but it passes the header test anyway, either an incorrect CRC will
+be generated for the extracted data or else UnZip will fail during
+the extraction because the "decrypted" bytes do not constitute a valid
+compressed data stream.
+.sk
+If the first password fails the header check on some file, UnZip
+will prompt for another password, and so on until all files are
+extracted. If a password is not known, entering a null password (that
+is, just a carriage return or "Enter") is taken as a signal to skip all
+further prompting. Only unencrypted files in the archive(s) will
+thereafter be extracted. (The situation is actually a little more
+complicated. Some old versions of Zip and ZipCloak allowed
+null passwords, so UnZip checks each encrypted file to see if the
+null password works. This may result in "false positives" and
+extraction errors, as noted above.)
+.sk
+Archives encrypted with 8-bit-character passwords (for example,
+passwords with accented European characters) may not be portable across
+systems or to other archivers. This problem stems from the use of
+multiple encoding methods for such characters, including Latin-1 (ISO
+8859-1) and OEM code page 850. DOS PKZIP 2.04g uses the OEM code
+page; Windows PKZIP 2.50 uses Latin-1 (and is therefore
+incompatible with DOS PKZIP; Info-ZIP uses the OEM code page on
+DOS, OS/2 and Win3.x ports but ISO coding (Latin-1 etc.) everywhere
+else; and Nico Mak's WinZip 6.x does not allow 8-bit-character
+passwords at all. UnZip 5.3 (or newer) attempts to use the
+default character set first (e.g., Latin-1), followed by the alternate
+one (e.g., OEM code page) to test passwords. On EBCDIC systems, if both
+of these fail, EBCDIC encoding will be tested as a last resort. (EBCDIC
+is not tested on non-EBCDIC systems, because there are no known
+archivers that encrypt using EBCDIC encoding.) ISO character encodings
+other than Latin-1 are not supported. The new addition of (partial)
+Unicode (UTF-8) support in UnZip 6.0 has not yet been adapted to
+the encryption password handling in UnZip. On systems that use
+UTF-8 as native character encoding, UnZip simply tries decryption
+with the native UTF-8 encoded password; the built-in attempts to check
+the password in translated encoding have not yet been adapted for UTF-8
+support and will consequently fail.
+.!----------------------------------------------------------------------
+.indent -2
+2 Examples
+.br
+To use UnZip to extract all members of the archive letters.zip into the
+current directory and subdirectories below it, creating any
+subdirectories as necessary:
+.sk
+.literal
+ unzip letters
+.end literal
+.sk
+To extract all members of letters.zip into the current directory only:
+.sk
+.literal
+ unzip -j letters
+.end literal
+.sk
+To test letters.zip, printing only a summary message indicating
+whether the archive is OK or not:
+.sk
+.literal
+ unzip -t -q letters
+.end literal
+.sk
+To test all ".zip" archives in the current directory, printing
+only the summaries:
+.sk
+.literal
+ unzip -t -q *.zip
+.end literal
+.sk
+(On a Unix system, the wildcard archive name would typically need to be
+quoted to keep a a Unix shell from expanding ("globbing") it. This is
+not necessary on VMS.)
+.sk
+The following command extracts to standard output all members of
+letters.zip whose names end in ".tex", auto-converting to the
+local end-of-line convention, in Stream_LF record format, and piping the
+output into TYPE /PAGE:
+.sk
+.literal
+ pipe unzip -c -a -S letters *.tex | type /page sys$input
+.end literal
+.sk
+To extract from source.zip all Fortran and C source files (*.f,
+*.c, *.h) and Makefile into the SYS$SCRATCH directory:
+.sk
+.literal
+ unzip source.zip *.[fch] Makefile -d sys$scratch
+.end literal
+.sk
+To extract all FORTRAN and C source files, regardless of case (for
+example, both *.c and *.C, and any makefile, Makefile, MAKEFILE or
+similar):
+.sk
+.literal
+ unzip -C source.zip *.[fch] makefile -d sys$scratch
+.end literal
+.sk
+The following command extracts only newer versions of the files already
+in the current directory, without querying. (Note: Be careful of
+extracting in one timezone an archive created in another. ZIP archives
+created by Zip versions before 2.1 contain no timezone
+information, and a "newer" file from an eastern timezone may, in fact,
+be older):
+.sk
+.literal
+ unzip -f -o sources
+.end literal
+.sk
+To extract newer versions of the files already in the current directory
+and to create any files not already there (same caveat as previous
+example):
+.sk
+.literal
+ unzip -u -o sources
+.end literal
+.sk
+To display a configuration report showing the program version, the OS
+and compiler used to build it, a list of optional features enabled at
+build time, and the values of all the relevant environment variables:
+.sk
+.literal
+ unzip -v
+.end literal
+.sk
+In the last five examples, assume that UNZIP_OPTS is set to -q. To do a
+(singly) quiet listing:
+.sk
+.literal
+ unzip -l file.zip
+.end literal
+.sk
+To do a doubly quiet listing:
+.sk
+.literal
+ unzip -l -q file.zip
+.end literal
+.sk
+(Note that the ".zip" is generally not necessary.) To do a standard
+listing:
+.sk
+.literal
+ unzip -l -q- file.zip
+.end literal
+.sk
+or:
+.sk
+.literal
+ unzip -lq- file.zip
+.end literal
+.sk
+or:
+.sk
+.literal
+ unzip -q-l file.zip
+.end literal
+.sk
+.!----------------------------------------------------------------------
+.indent -2
+2 Exit_Status
+.br
+UnZip's exit status approximates the exit codes defined by
+PKWARE. On VMS, UnZip's UNIX-style exit values are translated into
+VMS-style status codes with facility code 1954 = %x7A2, and with the
+inhibit-message (%x10000000) and facility-specific (%x00008000) bits
+set:
+.sk
+.literal
+ %x17A28001 normal exit
+ %x17A28000 + 16*UnZip_error_code warnings
+ %x17A28002 + 16*UnZip_error_code normal errors
+ %x17A28004 + 16*UnZip_error_code fatal errors
+.end literal
+.sk
+Note that multiplying the UNIX-style UnZip error code by 16 places it
+conveniently in the hexadecimal representation of the VMS exit code,
+"__" in %x17A28__s, where "s" is the severity code. For example, a
+missing archive might cause UnZip error code 9, which would be
+transformed into the VMS exit status %X17A28092.
+.sk
+The UnZip VMS exit codes include severity values which approximate those
+defined by PKWARE, as shown in the following table:
+.literal
+
+ VMS UnZip
+ severity err code Error description
+ ----------+----------+----------------------------------------------
+ Success 0 Normal. No errors or warnings detected.
+ Warning 1 One or more warnings were encountered, but
+ processing completed successfully. This
+ includes archives where one or more (but not
+ all) files were skipped because of an
+ unsupported compression or encryption method,
+ or a bad encryption password.
+ Error 2 Error in the archive format. Processing may
+ or may not have completed successfully.
+ Fatal 3 Severe error in the archive format.
+ Processing probably failed immediately.
+ Fatal 4 Memory allocation failed in program
+ initialization.
+ Fatal 5 Memory allocation or terminal I/O failed in
+ password processing.
+ Fatal 6 Memory allocation failed while decompressing
+ to disk.
+ Fatal 7 Memory allocation failed while decompressing
+ in memory.
+ Fatal 8 Memory allocation failed. (Currently not
+ used.)
+ Error 9 Specified archive files were not found.
+ Error 10 Invalid command-line options or parameters.
+ Error 11 No matching files were found.
+ Fatal 50 Disk (file system) filled during extraction.
+ Fatal 51 Unexpected end-of-file while reading the
+ archive.
+ Error 80 User interrupt (Ctrl/C).
+ Error 81 No files were processed, because of
+ unsupported compression or encryption
+ methods.
+ Error 82 No files were processed, because of bad
+ encryption password(s).
+ Fatal 83 Large-file archive could not be processed by
+ this small-file program.
+.end literal
+.!----------------------------------------------------------------------
+.indent -2
+2 Bugs
+.br
+Multi-part archives are not yet supported, except in conjunction with
+Zip. (All parts must be concatenated together in order, and then
+"zip -F" (for Zip 2.x) or "zip -FF" (for Zip 3.x) must be
+performed on the concatenated archive in order to "fix" it. Also,
+zip 3.0 and later can combine multi-part (split) archives into a
+combined single-file archive using "zip -s- inarchive -O
+outarchive". See the zip manual page for more information.) This may
+be corrected in the next major release.
+.sk
+Archives read from standard input are not yet supported, except with
+UnZip (and then only the first member of the archive can be extracted).
+.sk
+Archives encrypted with 8-bit-character passwords (such as passwords
+with accented European characters) may not be portable across systems
+and/or other archivers. See also Encryption_Decryption.
+.sk
+UnZip's -M ("--more") option tries to take into account
+automatic wrapping of long lines. However, the code may fail to detect
+the correct wrapping locations. First, TAB characters (and similar
+control sequences) are not taken into account, they are handled as
+ordinary printable characters. Second, depending on the actual system
+type, UnZip may not detect the true terminal/emulator geometry,
+but instead may rely on "commonly used" default dimensions. The correct
+handling of tabs would require the implementation of a query for the
+actual tab setup on the output terminal/emulator.
+.sk
+[Unix] Unix special files such as FIFO buffers (named pipes), block
+devices and character devices are not restored even if they are somehow
+represented in the archive, nor are hard-linked files
+relinked. Basically, the only file types restored by UnZip are
+regular files, directories, and symbolic (soft) links.
+.sk
+[OS/2] Extended attributes for existing directories are only updated if
+the -o ("--overwrite") option is given. This is a limitation of the
+operating system; because directories only have a creation time
+associated with them, UnZip has no way to determine whether the stored
+attributes are newer or older than those on disk. In practice this may
+mean a two-pass approach is required: first unpack the archive normally
+(with or without freshening/updating existing files), then overwrite
+just the directory entries (for example, "unzip -o foo */").
+.sk
+Note that uppercase options (-C, -D, -L, -M, -P, -S, -T, -V, -X, -Y, and
+-Z) must be specified in quotes (unless SET PROC/PARSE=EXTEND is set).
+For example:
+.sk;.literal
+ unzip "-VX" -a zipfile
+.end literal;.sk
+When extracting to SYS$OUTPUT (-c or -p options) redirected to a file,
+you may want to override the default text file conversion by specifying
+the -b option. A single "-b" option switches to "binary piping" mode
+for Zip entries marked as non-text, only. To force "binary piping" mode
+even for Zip file entries marked as text, the "-bb" option should be
+used. (Please note that a later "-a" cancels any -b option, see below.)
+.sk
+The output conversion options -b and -a may be combined to perform
+binary conversions on binary files and text conversion on text
+files. But note: For compatibility with implementation on other
+systems, -b cancels any -a option; to get the intended result, -a must
+be specified AFTER -b. And, in combination, "text" recognition takes
+precedence; this means that -bba (-bb -a) has the same effect as -ba (-b
+-a), and -aa overrides binary conversion for ALL files.
+.sk
+The conversion option -S is only effective when used together with
+-a or -aa. When specified, "text" files are written in Stream_LF record
+format instead of the VMS default of Variable-Length record
+format. (When no conversion options are specified, all non-VMS entries
+are always written as Stream_LF files.)
+.sk
+Please note that using the "-P<password>" option is higly insecure, the
+plaintext password may be seen by others. For this reason (and because of
+lack of space), the "-P<password>" option is not advertised on UnZip's
+online help screen.
+.!----------------------------------------------------------------------
+.indent -2
+2 URL
+.br
+The Info-ZIP main Web page is:
+.br
+.indent 4
+http://www.info-zip.org/
+.sk
+FTP access is available, too:
+.br
+.indent 4
+ftp://ftp.info-zip.org/pub/infozip/
+.!======================================================================
+.indent -2
+2 ZipInfo_mode
+.br
+If the first option on the UnZip command line is "-Z", then the program
+runs in ZipInfo mode. Remaining options are interpreted as ZipInfo
+options.
+.sk
+ZipInfo reports detailed information about a ZIP archive and its
+members. This information may include file access permissions,
+compression method, encryption method, version and operating system (or
+file system) of the archive-creating program, and so on. The default
+behavior (with no options) is to show a single-line entry for each
+member in the archive, with a header and a trailer providing summary
+information for the entire archive. The format is a cross between Unix
+"ls -l" and "unzip -lv" output. See Detailed_Description. ZipInfo is
+the same program as UnZip. (On Unix, "zipinfo" may be a
+link to "unzip". On VMS, "zipinfo" is normally a DCL symbol defined as
+"''unzip' -Z".) However, ZipInfo support may have been disabled when
+UnZip was built.
+.sk
+Format
+.sk
+.indent 4
+zipinfo [ zipinfo_options ] [ file[.zip] ] [ member ... ]
+.br
+.indent 4
+unzip -Z [ zipinfo_options ] [ file[.zip] ] [ member ... ]
+.!----------------------------------------------------------------------
+.indent -2
+3 Command_Parameters
+.sk;.indent -2
+file[.zip]
+.sk
+File path/name of a ZIP archive. A wildcard name may be used to specify
+multiple ZIP archives to be processed in one command. On VMS systems,
+any of the standard wildcards for a directory/file specification may be
+used: "...", "*", or "%" (or, since VMS V7.2, "?"). The default archive
+file specification is "[]*.ZIP".
+.sk
+Note that a ".zip" or ".ZIP" file type on an archive is merely a
+convention, not a requirement. For example, a self-extracting ZIP
+archive named "fred" or "fred.exe" could be processed as if it were an
+ordinary archive; just specify the actual file name with its actual name
+ending (if any), whatever that may be.
+.sk;.indent -2
+member ...
+.sk
+An optional list of archive members to be processed, separated by
+spaces. Unix-like ("globbing") wildcard patterns may be used to match
+multiple members:
+.sk
+.literal
+ * Matches a sequence of 0 or more characters.
+ ? Matches exactly 1 character.
+ [...] Matches any single character found inside the brackets.
+ Ranges are specified by a beginning character, a hyphen, and
+ an ending character. If an exclamation point ("!") or a
+ caret ("^") follows the left bracket, then the range of
+ characters within the brackets is complemented. That is,
+ anything except the characters inside the brackets is
+ considered a match. To specify a literal left bracket, use
+ the three-character sequence "[[]".
+.end literal
+.!----------------------------------------------------------------------
+.indent -2
+3 Options_Primary_Format
+.br
+Options in this group (-1, -2, -l, -m, -s, -v) specify the primary
+report format of ZipInfo. Only one of these primary format options may
+be specified.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -1
+.br;.indent -2
+-1
+.br;.indent -2
+--names-only
+.sk
+Primary Format. Show member names only, one per line. This option
+excludes all others, and the report does not include headers, trailers,
+or archive comments. This format may be useful with Unix shell (or
+other) scripts.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -2
+.br;.indent -2
+-2
+.br;.indent -2
+--names-mostly
+.sk
+Primary Format. Show member names only, one per line (as with "-1"),
+but allow headers (-h), trailers (-t), and archive comments (-z), if
+requested explicitly.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -l
+.br;.indent -2
+-l
+.br;.indent -2
+--long-list
+.sk
+Primary Format. Show member info in long Unix "ls -l" format. Like the
+-m format, except that the compressed size (in bytes) is printed instead
+of the compression ratio.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -m
+.br;.indent -2
+-m
+.br;.indent -2
+--medium-list
+.sk
+Primary Format. Show member info in medium-length Unix "ls -l"
+format. Like the -s format, except that the compression factor,
+expressed as a percentage, is also included.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -s
+.br;.indent -2
+-s
+.br;.indent -2
+--short-list
+.sk
+Primary Format. Show member info in short Unix "ls -l" format. This is
+the default behavior, unless -h or -t is specified.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -v
+.br;.indent -2
+-v
+.br;.indent -2
+--verbose
+.sk
+Primary Format. The verbose report is very detailed, and mostly
+self-explanatory, but it does assume some familiarity with the ZIP
+archive format. It also includes the archive comment, if any. Extra
+fields in the central directory are broken dowm into subfields, with
+brief descriptions of recognized subfields (or abbreviated dumps of
+unrecognized subfields).
+.!----------------------------------------------------------------------
+.indent -2
+3 Options_Ordinary
+.br
+Options in this group modify the operation or report format of ZipInfo.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -C
+.br;.indent -2
+-C
+.br;.indent -2
+.literal
+--ignore-case ([CMS, MVS] --CMS-MVS-lower)
+.end literal
+.sk
+Use case-insensitive name matching for names in the member list and
+the -x excluded-member list on the command line. By default,
+case-sensitive matching is done. For example, specifying
+"makefile" on the command line will match only "makefile" in
+the archive, not "Makefile" or "MAKEFILE". On many systems, the local
+file system is case-insensitive, so case-insensitive name matching would
+be more natural. With -C, "makefile" would match
+"makefile", "Makefile", or "MAKEFILE".
+.sk
+/CASE_MATCH does not affect the search for the ZIP archive file(s).
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -h
+.br;.indent -2
+-h
+.br;.indent -2
+--header
+.sk
+Include a header in the report, showing the archive name, the archive
+size (in bytes), and the number of members in the archive.
+.sk
+For the Unix-format reports (options -l, -m, -s), the header is included
+by default, if no archive members are specified. If -h is specified
+alone, that is, without one of the Unix-format options, and without a
+member list, then only the header lines will be put out.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -M
+.br;.indent -2
+-M ([CMS,MVS] Or: -m)
+.br;.indent -2
+--more
+.sk
+Pipe all output through an internal pager similar to the Unix
+more(1) command. At the end of a screenful of output,
+Zipinfo pauses with a "--More--" prompt; the next screenful
+may be viewed by pressing the Enter (Return) key or the space
+bar. ZipInfo can be terminated by pressing the "q" key, or, on
+some systems, the Enter/Return key. Unlike Unix more(1), there is
+no forward-searching or editing capability. Also, ZipInfo doesn't
+notice if long lines wrap at the edge of the screen, effectively
+resulting in the printing of two or more lines and the likelihood that
+some text will scroll off the top of the screen before being viewed. If
+the actual number of lines on the screen can not be determined, 24 lines
+will be assumed.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -T
+.br;.indent -2
+-T
+.br;.indent -2
+--decimal-time
+.sk
+Show the file date-times in a sortable, all-numeric, "YYYYMMDD.hhmmss"
+format. The default date format is an alpha-numeric
+"YY-Mmm-DD hh:mm". For example ("-s", "-s -T"):
+.sk
+.literal
+-rw-a-- 3.1 fat 211916 tx defX 10-Jun-18 00:27 zip31c/zip.c
+-rw-a-- 3.1 fat 211916 tx defX 20100618.002703 zip31c/zip.c
+.end literal
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -t
+.br;.indent -2
+-t
+.br;.indent -2
+--totals
+.sk
+Include a totals summary at the end of the report, showing the number of
+members in the report, the sum of their uncompressed sizes, the sum of
+their compressed sizes, and the compression factor as a percentage.
+.sk
+For the Unix-format reports (options -l, -m, -s), the totals summary is
+included by default, if no archive members are specified. If -t is
+specified alone, that is, without one of the Unix-format options, and
+without a member list, then only the totals summary trailer lines will
+be put out.
+.sk
+The total "bytes compressed" reported includes only the actual data, not
+the ZIP archive meta-data, so the size of the archive will always be
+greater than this value.
+.sk
+See also -mc.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -U
+.br;.indent -2
+-U
+.br;.indent -2
+--unicode
+.sk
+[UNICODE_SUPPORT] Control UTF-8 handling. When UNICODE_SUPPORT is
+available, -U forces ZipInfo to escape all non-ASCII
+characters from UTF-8 coded filenames as "#Uxxxx" (for UCS-2 characters,
+or "#Lxxxxxx" for Unicode codepoints needing 3 octets). This option is
+mainly provided for debugging purpose when the fairly new UTF-8 support
+is suspected of damaging extracted filenames.
+.sk
+-UU disables the recognition of UTF-8 encoded filenames. The
+handling of filename codings within ZipInfo falls back to the
+behavior of pre-Unicode versions.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -W
+.br;.indent -2
+-W
+.br;.indent -2
+--wild-no-span
+.sk
+[WILD_STOP_AT_DIR] (Valid when the program was built with the C macro
+WILD_STOP_AT_DIR defined.) By default, the wildcard characters "?"
+(single-character wildcard) and "*" (multi-character wildcard) match any
+character in a member path/name. "-W" modifies the
+pattern-matching behavior for archive members so that both "?"
+(single-character wildcard) and "*" (multi-character wildcard) do not
+match the directory separator character "/". (The two-character
+sequence "**" acts as a multi-character wildcard that includes the
+directory separator in its matched characters.) For example, with
+"-W":
+.sk
+.literal
+ "*.c" matches "foo.c" but not "mydir/foo.c"
+ "**.c" matches both "foo.c" and "mydir/foo.c"
+ "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+ "??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+.end literal
+.sk
+This modified behavior is equivalent to the pattern matching style used
+by the shells of some of UnZip's supported target OSs (one example
+is Acorn RISC OS). This option may not be available on systems where
+the Zip archive's internal directory separator character "/" is allowed
+as regular character in native operating system filenames. (Currently,
+UnZip uses the same pattern matching rules for both wildcard
+archive file name specifications and archive member selection patterns
+on most system types. For systems allowing "/" as regular filename
+character, the -W option would not work as expected on a wildcard file
+name specification.)
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -x
+.br;.indent -2
+-x member ...
+.br;.indent -2
+--exclude member ...
+.sk
+An optional list of archive members to be excluded from
+processing. Because wildcard characters normally match "/" directory
+separators (for exceptions see the option -W), this option may be used
+to exclude any files that are in subdirectories. For example, "unzip
+foo *.[ch] -x */*" would extract all C source files (*.c, *.h) in the
+main directory, but none in any subdirectories. Without the -x option,
+all C source files in all directories within the archive would be
+extracted.
+.sk
+When the program sees -x (--exclude) on a command line, it stops
+scanning for options, and treats every succeeding item as an archive
+member name. To avoid confusion between member names and command
+options, it's simplest to specify -x (--exclude) and its member list as
+the last 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). That is, the following two commands are
+equivalent:
+.sk
+.literal
+ zipinfo fred.zip -2 -t -x file1 file2 file3
+ zipinfo fred.zip -x file1 file2 file3 @ -2 -t
+.end literal
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.indent -2
+4 -z
+.br;.indent -2
+-z
+.br;.indent -2
+--zipfile-comment
+.sk
+Include the archive comments (if any) in the report.
+.!----------------------------------------------------------------------
+.indent -2
+3 Detailed_Description
+.br
+ZipInfo has three basic report formats, providing different degrees of
+detail in the information about the members of an archive: a simple list
+of names (-1, -2), a Unix ls-style listing (-l, -m, -s), and a very
+detailed analysis (-v). Some of the information, such as file sizes, is
+easy to interpret. Some of the information involves fairly obscure
+details of ZIP archive structure. ZIP archive structure is documented
+in the PKWARE Inc. APPNOTE.TXT:
+.br
+http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+.sk
+The table below shows some typical -l report entries:
+.sk
+.literal
+Perm/Prot Zver Ofs UncSize At CmpSize Cmth ModDate Mtime Name
+----------+----+---+-------+--+-------+----+---------------+----------
+-rw-a-- 3.1 fat 211916 tx 53467 defX 10-Jun-18 00:27 zip3/zip.c
+-rwxr-x--- 3.1 unx 709 Tx 311 aesw 11-Aug-21 22:20 endian.c
+RWED,RE, 3.1 vms 6656 bx 2295 defN 07-Aug-15 14:12 it/T.EXE;8
+.end literal
+.sk
+Field 1 (Perm/Prot) shows the file permission/protection attributes,
+formatted according to the original operating system or file system
+where the archive was created.
+.sk
+Field 2 (Zver) shows the (approximate) version of the Zip program which
+created the archive.
+.sk
+Field 3 (Ofs) shows the original operating system where the archive was
+created, or the file system on which the member file was stored.
+.sk
+Field 4 (UncSize) shows the original, uncompressed file size.
+.sk
+Field 5 (At) shows some archive member attributes, as detailed in the
+tables below. The first character indicates whether a file was binary
+or text, and whether it was encrypted. The second character indicates
+the presence of a data descriptor and/or an extra field in the member
+data.
+.sk
+.literal
+ | File Type Extra Field |
+ First char | binary text yes no | Second char
+--------------+-------+----- ------+-----+--------------------
+Encrypted no | b t x - | no Data Descriptor
+ yes | B T X l | yes
+.end literal
+.sk
+A Data Descriptor holds CRC and size data at an alternate place in the
+archive (after processed member data instead of before), and is
+normally used when the archiving program can't seek in the output
+archive data/file. An Extra Field can hold a wide variety of data,
+including 64-bit file sizes, many kinds of OS-specific attribute data,
+UTC times, and so on.
+.sk
+Field 6 (CmpSize) shows the compressed file size. With -m, this
+field shows the compression fraction as a percentage. With -s
+(the default), this field is omitted. This compressed size value
+(unlike the one in an "unzip -l" report) includes all the
+overhead resulting from Traditional encryption.
+.sk
+Field 7 (Cmth) shows the compression method used. Note that AES_WG
+encryption is treated as a compression method here. Not all of the
+methods shown in the table below are supported. (Some are obsolete.)
+.sk
+.literal
+ Num Abbr Name, description
+----+----+------------------------------------------------------------
+ 0 stor Store (no compression)
+ 1 shrk Shrink
+ 2 re:1 Reduce (factor 1)
+ 3 re:2 Reduce (factor 2)
+ 4 re:3 Reduce (factor 3)
+ 5 re:4 Reduce (factor 4)
+ 6 i#:# Implode (dictonary_size:Shannon-Fano_trees)
+ 7 tokn Tokenize
+ 8 def# Deflate (N: normal, X: maximum, F: fast, S: super-fast)
+ 9 d64# Deflate64 (N: normal, X: maximum, F: fast, S: super-fast)
+ 10 dcli PKWARE Data Compression Library Imploding - IBM TERSE (old)
+ 12 bzp2 bzip2
+ 14 lzma LZMA
+ 18 ters IBM TERSE (new)
+ 19 lz77 IBM LZ77 z Architecture (PFS)
+ 96 jpeg JPEG
+ 97 wavp WavPack
+ 98 ppmd PPMd version I, Rev 1
+ 99 aesw AES_WG encryption
+.end literal
+.sk
+Fields 8 and 9 (ModDate, Mtime) show the file modification date-time
+(MS-DOS format, local time).
+.sk
+Field 10 (Name) shows the file path/name.
+.!----------------------------------------------------------------------
+.indent -2
+3 Environment_Options
+.br
+ZipInfo's default behavior may be modified by placing command-line
+options in an environment variable. This can be done with any option,
+but it is probably most useful options like -T (decimal time format) or
+one of the non-default Unix format options: -l, -m.
+.sk
+For ZipInfo ("unzip -Z"), the environment variable name on VMS is
+ZIPINFO_OPTS (non-VMS: ZIPINFO). For compatibility with Zip, if
+ZIPINFO_OPTS is not defined, then ZipInfo will use ZIPINFOOPT the same
+way.
+.sk
+For example, to make the default format the long Unix format instead of
+the short Unix format, one could use commands like the following:
+.sk
+.literal
+Unix Bourne (or similar) shell:
+ ZIPINFO='-l'; export UNZIP
+.end literal
+.sk
+.literal
+Unix C shell:
+ setenv ZIPINFO '-l'
+.end literal
+.sk
+.literal
+OS/2 or MS-DOS:
+ set ZIPINFO="-l"
+.end literal
+.sk
+.literal
+VMS (with quotation to preserve lower case in DCL):
+ define ZIPINFO_OPTS "-l" ! Logical name, or
+ ZIPINFO_OPTS = "-l" ! DCL symbol. (Either works.)
+.end literal
+.sk
+Environment options are treated the same as any other command-line
+options, except that they are effectively the first options on the
+command line. To override an environment option, one may use an
+explicit option to cancel or override it. For example, to disable the
+totals trailer line by default, one could use commands like the
+following:
+.sk
+.literal
+Unix Bourne (or similar) shell:
+ ZIPINFO='-t-'; export ZIPINFO
+.end literal
+.sk
+.literal
+Unix C shell:
+ setenv ZIPINFO '-t-'
+.end literal
+.sk
+.literal
+VMS (with quotation to preserve lower case in DCL):
+ define ZIPINFO_OPTS "-t-" ! Logical name, or
+ ZIPINFO_OPTS = "-t-" ! DCL symbol. (Either works.)
+.end literal
+.sk
+The examples show short (one-character) options, but long ("--")
+options are also allowed.
+.!----------------------------------------------------------------------
+.indent -2
+3 Examples
+.br
+To get a basic, short-format listing of the complete contents of a ZIP
+archive zip31c.zip, with both header and totals lines, use only the
+archive name as an argument to zipinfo:
+.sk
+.literal
+ zipinfo zip31c.zip
+ zipinfo zip31c
+.end literal
+.sk
+To produce a basic, long-format listing (not verbose), including header
+and totals lines, use -l:
+.sk
+.literal
+ zipinfo -l zip31c.zip
+.end literal
+.sk
+To list the complete contents of the archive without header and totals
+lines, either negate the -h and -t options or else specify the contents
+explicitly:
+.sk
+.literal
+ zipinfo -h- -t- zip31c.zip
+ zipinfo zip31c.zip *
+.end literal
+.sk
+(On a Unix system, the wildcard member name would typically need to be
+quoted to keep a a Unix shell from expanding ("globbing") it. This is
+not necessary on VMS.)
+.sk
+To list information on a single archive member, in medium format,
+specify the member name explicitly:
+.sk
+.literal
+ zipinfo -m unzip60.zip */unshrink.c
+.end literal
+.sk
+When any member name is specified, the header and totals trailer are, by
+default, not included in the report, but explicitly specifying -h and/or
+-t will restore them. For example:
+.sk
+.literal
+ zipinfo -m -t unzip610b.zip *.[ch] */Make*
+.end literal
+.sk
+On a Unix system, one could use the -T option along with an
+external sorting program (and another filter like "head" or
+"tail") to get a listing of the least or most recently modified
+files in the archive:
+.sk
+.literal
+ zipinfo -l -T -h- -t- zip31c.zip | sort -k 8 | head -12
+ zipinfo -l -T -h- -t- zip31c.zip | sort -r -k 8 | head -12
+.end literal
+.sk
+The "sort" option "-k 8" tells it to sort on field 8, which is the
+date-time field in a long- or medium-format (-l, -m) ZipInfo
+report. (Use "-k 7" for the short (-s) format.) The -r option reverses
+the default smallest-to-largest sort order.
+.!----------------------------------------------------------------------
+.indent -2
+3 Bugs
+.br
+As with UnZip, ZipInfo's -M ("--more") option is overly
+simplistic in its handling of screen output. As noted above, it fails
+to detect the wrapping of long lines and may thereby cause lines at the
+top of the screen to be scrolled off before being read. ZipInfo
+should detect and treat each occurrence of line-wrap as one additional
+line printed. This requires knowledge of the screen's width as well as
+its height. In addition, ZipInfo should detect the true screen
+geometry on all systems.
+.sk
+The interactions among the various listing format, header, and trailer
+options (-h, -l, -m, -s, -t) are unnecessarily complex and should be
+simplified, despite the potential disruption to current users.
+.!----------------------------------------------------------------------
+.indent -2
+3 URL
+.br
+The Info-ZIP main Web page is:
+.br
+.indent 4
+http://www.info-zip.org/
+.sk
+FTP access is available, too:
+.br
+.indent 4
+ftp://ftp.info-zip.org/pub/infozip/
+.!----------------------------------------------------------------------
+.!======================================================================
+! UNZIP_MSG.MSG
+!
! VMS Error Message Source File for UnZip
!
+!----------------------------------------------------------------------
+! Copyright (c) 2007-2013 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. If,
+! for some reason, all these files are missing, the Info-ZIP license
+! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+!----------------------------------------------------------------------
+!
! Because the facility code was formally assigned by HP, the .FACILITY
! directive below specifies /SYSTEM. Because the messages are, in
! general, specific to UnZip, this file is not compiled with /SHARED.
.TITLE Info-ZIP UnZip Error Messages
.FACILITY IZ_UNZIP, 1954 /SYSTEM
-.IDENT 'V6.0-000'
+.IDENT 'V6.1-000'
! PK_
.BASE 0
.BASE 6
BADERR /SEVERE <Error in zipfile>
.BASE 8
-MEM /SEVERE <insufficient memory (init)>
+MEM /SEVERE <Insufficient memory (init)>
.BASE 10
-MEM2 /SEVERE <insufficient memory (password)>
+MEM2 /SEVERE <Insufficient memory (password)>
.BASE 12
-MEM3 /SEVERE <insufficient memory (file expand)>
+MEM3 /SEVERE <Insufficient memory (file expand)>
.BASE 14
-MEM4 /SEVERE <insufficient memory (memory expand)>
+MEM4 /SEVERE <Insufficient memory (memory expand)>
.BASE 16
-MEM5 /SEVERE <insufficient memory (???)>
+MEM5 /SEVERE <Insufficient memory (???)>
.BASE 18
-NOZIP /ERROR <zipfile not found>
+NOZIP /ERROR <Zipfile not found>
.BASE 20
PARAM /ERROR <Invalid parameters specified on command line>
.BASE 22
FIND /ERROR <No files found to extract or view>
+.BASE 38
+COMPERR /SEVERE <Error in compilation options>
+
.BASE 100
DISK /SEVERE <I/O error - disk full, ...>
.BASE 102
$!
$! Build procedure for VMS versions of UnZip/ZipInfo and UnZipSFX.
$!
-$! Last revised: 2009-03-01 SMS.
+$! Last revised: 2013-11-29 SMS.
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 2004-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
$!
$! Command arguments:
-$! - suppress help file processing: "NOHELP"
-$! - suppress message file processing: "NOMSG"
-$! - select link-only: "LINK"
-$! - select compiler environment: "VAXC", "DECC", "GNUC"
-$! - select BZIP2 support: "USEBZ2"
+$! - Suppress C compilation (re-link): "NOCOMPILE"
+$! - Suppress linking executables: "NOLINK"
+$! - Suppress help file processing: "NOHELP"
+$! - Suppress message file processing: "NOMSG"
+$! - Define DCL symbols: "SYMBOLS" (Was default before UnZip 6.1.)
+$! - Select compiler environment: "VAXC", "DECC", "GNUC"
+$! - Select AES_WG encryption support: "AES_WG"
+$! By default, the SFX programs are built without AES_WG support.
+$! Add "CRYPT_AES_WG_SFX=1" to the LOCAL_UNZIP C macros to enable
+$! it. (See LOCAL_UNZIP, below.)
+$! - Select BZIP2 support: "USEBZ2"
$! This option is a shortcut for "IZ_BZIP2=SYS$DISK:[.bzip2]", and
$! runs the DCL build procedure there,
-$! - select BZIP2 support: "IZ_BZIP2=dev:[dir]", where "dev:[dir]"
+$! - Select BZIP2 support: "IZ_BZIP2=dev:[dir]", where "dev:[dir]"
$! (or a suitable logical name) tells where to find "bzlib.h".
$! The BZIP2 object library (LIBBZ2_NS.OLB) is expected to be in
$! a "[.dest]" directory under that one ("dev:[dir.ALPHAL]", for
$! By default, the SFX programs are built without BZIP2 support.
$! Add "BZIP2_SFX=1" to the LOCAL_UNZIP C macros to enable it.
$! (See LOCAL_UNZIP, below.)
-$! - use ZLIB compression library: "IZ_ZLIB=dev:[dir]", where
+$! - Select LZMA compression support: "LZMA"
+$! By default, the SFX programs are built without LZMA support.
+$! Add "LZMA_SFX=1" to the LOCAL_UNZIP C macros to enable it.
+$! (See LOCAL_UNZIP, below.)
+$! - Select PPMd compression support: "PPMD"
+$! By default, the SFX programs are built without PPMd support.
+$! Add "PPMD_SFX=1" to the LOCAL_UNZIP C macros to enable it.
+$! (See LOCAL_UNZIP, below.)
+$! - Use ZLIB compression library: "IZ_ZLIB=dev:[dir]", where
$! "dev:[dir]" (or a suitable logical name) tells where to find
$! "zlib.h". The ZLIB object library (LIBZ.OLB) is expected to be
$! in a "[.dest]" directory under that one ("dev:[dir.ALPHAL]",
$! for example), or in that directory itself.
-$! - select large-file support: "LARGE"
-$! - select compiler listings: "LIST" Note that the whole argument
+$! - Select large-file support: "LARGE"
+$! - Select compiler listings: "LIST" Note that the whole argument
$! is added to the compiler command, so more elaborate options
$! like "LIST/SHOW=ALL" (quoted or space-free) may be specified.
-$! - supply additional compiler options: "CCOPTS=xxx" Allows the
+$! Default is "/NOLIST", but if the user specifies a LIST option,
+$! then only the user-specified qualifier(s) will be included.
+$! - Supply additional compiler options: "CCOPTS=xxx" Allows the
$! user to add compiler command options like /ARCHITECTURE or
$! /[NO]OPTIMIZE. For example, CCOPTS=/ARCH=HOST/OPTI=TUNE=HOST
$! or CCOPTS=/DEBUG/NOOPTI. These options must be quoted or
$! space-free.
-$! - supply additional linker options: "LINKOPTS=xxx" Allows the
+$! - Supply additional linker options: "LINKOPTS=xxx" Allows the
$! user to add linker command options like /DEBUG or /MAP. For
$! example: LINKOPTS=/DEBUG or LINKOPTS=/MAP/CROSS. These options
$! must be quoted or space-free. Default is
-$! LINKOPTS=/NOTRACEBACK, but if the user specifies a LINKOPTS
-$! string, /NOTRACEBACK will not be included unless specified by
-$! the user.
-$! - select installation of CLI interface version of UnZip:
+$! LINKOPTS="/NOMAP /NOTRACEBACK", but if the user specifies a
+$! LINKOPTS string, then only the user-specified qualifier(s) will
+$! be included.
+$! - Select installation of CLI interface version of UnZip:
$! "VMSCLI" or "CLI"
-$! - force installation of UNIX interface version of UnZip
+$! - Force installation of UNIX interface version of UnZip
$! (override LOCAL_UNZIP environment): "NOVMSCLI" or "NOCLI"
+$! - Build a callable-UnZip library, LIBIZUNZIP.OLB: "LIBUNZIP"
+$! - Choose a destination directory for architecture-specific
+$! product files (.EXE, .OBJ,.OLB, and so on): "PROD=subdir", to
+$! use "[.subdir]". The default is a name automatically generated
+$! using rules defined below.
+$! - Run basic UnZip tests: "TEST", "TEST_PPMD"
+$! - Show version/feature reports: "DASHV", "SLASHV"
+$! - Create help output text files: "HELP_TEXT"
$!
$! To specify additional options, define the symbol LOCAL_UNZIP
$! as a comma-separated list of the C macros to be defined, and
$! INSTALL file for other options (for example, CHECK_VERSIONS).
$!
$! If you edit this procedure to set LOCAL_UNZIP here, be sure to
-$! use only one "=", to avoid affecting other procedures.
-$!
-$! Note: This command procedure always generates both the "default"
-$! UnZip having the UNIX style command interface and the "VMSCLI"
-$! UnZip having the CLI compatible command interface. There is no
+$! use only one "=", to avoid affecting other procedures. For
+$! example:
+$! $ LOCAL_UNZIP = "BZIP2_SFX"
+$!
+$! Note that on a Unix system, LOCAL_UNZIP contains compiler
+$! options, such as "-g" or "-DCRYPT_AES_WG_SFX", but on a VMS
+$! system, LOCAL_UNZIP contains only C macros, such as
+$! "CRYPT_AES_WG_SFX", and CCOPTS is used for any other kinds of
+$! compiler options, such as "/ARCHITECTURE". Unix compilers accept
+$! multiple "-D" options, but VMS compilers consider only the last
+$! /DEFINE qualifier, so the C macros must be handled differently
+$! from other compiler options on VMS. Thus, when using the generic
+$! installation instructions as a guide for controlling various
+$! optional features, some adjustment may be needed to adapt them to
+$! a VMS build environment.
+$!
+$! This command procedure always generates both the "default" UnZip
+$! program with the UNIX style command interface and the "VMSCLI"
+$! UnZip program with the VMS CLI command interface. There is no
$! need to add "VMSCLI" to the LOCAL_UNZIP symbol. (The only effect
-$! of "VMSCLI" now is the selection of the CLI style UnZip
+$! of "VMSCLI" now is the selection of the VMS CLI style UnZip
$! executable in the foreign command definition.)
$!
$!
$ unzx_cli = "UNZIP_CLI"
$ unzsfx_unx = "UNZIPSFX"
$ unzsfx_cli = "UNZIPSFX_CLI"
+$ lib_libunzip_name = "LIBIZUNZIP.OLB"
+$ lib_unzip_name = "UNZIP.OLB"
+$ lib_unzipcli_name = "UNZIPCLI.OLB"
+$ lib_unzipsfx_name = "UNZIPSFX.OLB"
+$ lib_unzipsfxcli_name = "UNZSFXCLI.OLB"
$!
+$ AES_WG = ""
$ CCOPTS = ""
+$ DASHV = 0
$ IZ_BZIP2 = ""
$ BUILD_BZIP2 = 0
$ IZ_ZLIB = ""
-$ LINKOPTS = "/notraceback"
-$ LINK_ONLY = 0
+$ LINKOPTS = "/nomap /notraceback"
$ LISTING = " /nolist"
$ LARGE_FILE = 0
+$ LIBUNZIP = 0
+$ LZMA = 0
+$ MAKE_EXE = 1
$ MAKE_HELP = 1
+$ MAKE_HELP_TEXT = 0
$ MAKE_MSG = 1
+$ MAKE_OBJ = 1
+$ MAKE_SYM = 0
$ MAY_USE_DECC = 1
$ MAY_USE_GNUC = 0
+$ PPMD = 0
+$ PROD = ""
+$ SLASHV = 0
+$ TEST = 0
+$ TEST_PPMD = 0
$!
$! Process command line parameters requesting optional features.
$!
$ curr_arg = f$edit( 'current_arg_name', "UPCASE")
$ if (curr_arg .eqs. "") then goto argloop_out
$!
+$ if (f$extract( 0, 6, curr_arg) .eqs. "AES_WG")
+$ then
+$ AES_WG = 1
+$ goto argloop_end
+$ endif
+$!
$ if (f$extract( 0, 5, curr_arg) .eqs. "CCOPT")
$ then
$ opts = f$edit( curr_arg, "COLLAPSE")
$ goto argloop_end
$ endif
$!
+$ if (f$extract( 0, 5, curr_arg) .eqs. "DASHV")
+$ then
+$ DASHV = 1
+$ goto argloop_end
+$ endif
+$!
$ if (f$extract( 0, 7, curr_arg) .eqs. "IZ_BZIP")
$ then
$ opts = f$edit( curr_arg, "COLLAPSE")
$ goto argloop_end
$ endif
$!
+$ if (f$extract( 0, 9, curr_arg) .eqs. "HELP_TEXT")
+$ then
+$ MAKE_HELP_TEXT = 1
+$ goto argloop_end
+$ endif
+$!
$ if (f$extract( 0, 7, curr_arg) .eqs. "IZ_ZLIB")
$ then
$ opts = f$edit( curr_arg, "COLLAPSE")
$ goto argloop_end
$ endif
$!
-$! Note: LINK test must follow LINKOPTS test.
+$ if (f$extract( 0, 4, curr_arg) .eqs. "LIST")
+$ then
+$ LISTING = "/''curr_arg'" ! But see below for mods.
+$ goto argloop_end
+$ endif
$!
-$ if (f$extract( 0, 4, curr_arg) .eqs. "LINK")
+$ if (f$extract( 0, 8, curr_arg) .eqs. "LIBUNZIP")
$ then
-$ LINK_ONLY = 1
+$ LIBUNZIP = 1
$ goto argloop_end
$ endif
$!
-$ if (f$extract( 0, 4, curr_arg) .eqs. "LIST")
+$ if (f$extract( 0, 4, curr_arg) .eqs. "LZMA")
$ then
-$ LISTING = "/''curr_arg'" ! But see below for mods.
+$ LZMA = 1
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "NOCOMPILE")
+$ then
+$ MAKE_OBJ = 0
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "NOLINK")
+$ then
+$ MAKE_EXE = 0
$ goto argloop_end
$ endif
$!
$ goto argloop_end
$ endif
$!
+$ if (f$extract( 0, 4, curr_arg) .eqs. "PPMD")
+$ then
+$ PPMD = 1
+$ goto argloop_end
+$ endif
+$!
+$ if (f$extract( 0, 4, curr_arg) .eqs. "PROD")
+$ then
+$ opts = f$edit( curr_arg, "COLLAPSE")
+$ eq = f$locate( "=", opts)
+$ PROD = f$extract( (eq+ 1), 1000, opts)
+$ goto argloop_end
+$ endif
+$!
+$ if (f$extract( 0, 6, curr_arg) .eqs. "SLASHV")
+$ then
+$ SLASHV = 1
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "SYMBOLS")
+$ then
+$ MAKE_SYM = 1
+$ goto argloop_end
+$ endif
+$!
$ if (curr_arg .eqs. "VAXC")
$ then
$ MAY_USE_DECC = 0
$ goto argloop_end
$ endif
$!
+$ if (curr_arg .eqs. "TEST")
+$ then
+$ TEST = 1
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "TEST_PPMD")
+$ then
+$ TEST_PPMD = 1
+$ goto argloop_end
+$ endif
+$!
$ say "Unrecognized command-line option: ''curr_arg'"
$ goto error
$!
$ endif
$ endif
$!
-$ dest = arch
+$ destl = ""
+$ destm = arch
$ cmpl = "DEC/Compaq/HP C"
$ opts = ""
+$ vaxc = 0
$ if (arch .nes. "VAX")
$ then
$ HAVE_DECC_VAX = 0
$ if ((.not. HAVE_VAXC_VAX .and. MAY_HAVE_GNUC) .or. MAY_USE_GNUC)
$ then
$ cc = "gcc"
-$ dest = "''dest'G"
+$ destm = "''destm'G"
$ cmpl = "GNU C"
$ opts = "GNU_CC:[000000]GCCLIB.OLB /LIBRARY,"
$ else
$ else
$ cc = "cc"
$ endif
-$ dest = "''dest'V"
+$ destm = "''destm'V"
$ cmpl = "VAX C"
+$ vaxc = 1
$ endif
-$ opts = "''opts' SYS$DISK:[.''dest']VAXCSHR.OPT /OPTIONS,"
+$ opts = "''opts' SYS$DISK:[.''destm']VAXCSHR.OPT /OPTIONS,"
$ endif
$ endif
$!
$ if (IZ_BZIP2 .nes. "")
$ then
-$ defs = "USE_BZIP2, ''defs'"
+$ defs = "BZIP2_SUPPORT, ''defs'"
$ endif
$!
-$! Reveal the plan. If compiling, set some compiler options.
+$! Set AES_WG-related data.
+$!
+$ if (AES_WG .ne. 0)
+$ then
+$ defs = defs+ ", CRYPT_AES_WG"
+$ endif
+$!
+$! Set LZMA-related data.
+$!
+$ if (LZMA .ne. 0)
+$ then
+$ defs = defs+ ", LZMA_SUPPORT"
+$ if (arch .eqs. "VAX")
+$ then
+$ defs = defs+ ", _SZ_NO_INT_64"
+$ endif
+$ endif
$!
-$ if (LINK_ONLY)
+$! Set PPMD-related data.
+$!
+$ if (PPMD .ne. 0)
$ then
-$ say "Linking on ''arch' for ''cmpl'."
+$ defs = defs+ ", PPMD_SUPPORT"
+$ if (arch .eqs. "VAX")
+$ then
+$ if (vaxc .ne. 0)
+$ then
+$ defs = defs+ ", NO_SIGNED_CHAR"
+$ endif
+$ if (LZMA .eq. 0)
+$ then
+$ defs = defs+ ", _SZ_NO_INT_64"
+$ endif
+$ endif
+$ endif
+$!
+$! Change the destination directory, if the large-file option is enabled.
+$!
+$ destb = destm
+$ if (LARGE_FILE .ne. 0)
+$ then
+$ destl = "L"
+$ endif
+$!
+$ dest_std = destm+ destl
+$ if (PROD .eqs. "")
+$ then
+$ dest = dest_std
$ else
+$ dest = PROD
+$ endif
+$!
+$ lib_libunzip = "SYS$DISK:[.''dest']''lib_libunzip_name'"
+$ lib_unzip = "SYS$DISK:[.''dest']''lib_unzip_name'"
+$ lib_unzipcli = "SYS$DISK:[.''dest']''lib_unzipcli_name'"
+$ lib_unzipsfx = "SYS$DISK:[.''dest']''lib_unzipsfx_name'"
+$ lib_unzipsfxcli = "SYS$DISK:[.''dest']''lib_unzipsfxcli_name'"
+$ libunzip_opt = "[.''dest']LIB_IZUNZIP.OPT"
+$!
+$! If DASHV was requested, then run "unzip -v" (and exit).
+$!
+$ if (dashv)
+$ then
+$ mcr [.'dest']unzip -v
+$ goto error
+$ endif
+$!
+$! If SLASHV was requested, then run "unzip_cli /verbose" (and exit).
+$!
+$ if (slashv)
+$ then
+$ mcr [.'dest']unzip_cli /verbose
+$ goto error
+$ endif
+$!
+$! If TEST was requested, then run the basic tests (and exit).
+$!
+$ if (test)
+$ then
+$ @ [.vms]test_unzip.com "" [.'dest']
+$ goto error
+$ endif
+$!
+$! If TEST_PPMD was requested, then run the PPMd tests (and exit).
+$!
+$ if (test_ppmd)
+$ then
+$ @ [.vms]test_unzip.com "" [.'dest'] NOSFX
+$ goto error
+$ endif
+$!
+$! Reveal the plan. If compiling, set some compiler options.
+$!
+$ if (MAKE_OBJ)
+$ then
$ say "Compiling on ''arch' using ''cmpl'."
$!
$ DEF_UNX = "/define = (''defs')"
$ DEF_CLI = "/define = (''defs', VMSCLI)"
$ DEF_SXUNX = "/define = (''defs', SFX)"
$ DEF_SXCLI = "/define = (''defs', VMSCLI, SFX)"
+$ DEF_LIBUNZIP = "/define = (''defs', DLL)
+$ else
+$ if (MAKE_EXE .or. MAKE_MSG)
+$ then
+$ say "Linking on ''arch' for ''cmpl'."
+$ endif
$ endif
$!
$! Search directory for BZIP2.
$ if (BUILD_BZIP2)
$ then
$! Our own BZIP2 directory.
-$ seek_bz = dest
+$ seek_bz = destb
$ else
$! User-specified BZIP2 directory.
$ seek_bz = arch
$!
$ seek_zl = arch
$!
-$! Change the destination directory, if the large-file option is enabled.
-$!
-$ if (LARGE_FILE .ne. 0)
-$ then
-$ dest = "''dest'L"
-$ endif
-$!
$! If BZIP2 support was selected, find the header file and object
$! library. Complain if things fail.
$!
-$ cc_incl = "[]"
+$ cc_incl = "[], [.VMS]"
$ lib_bzip2_opts = ""
$ if (IZ_BZIP2 .nes. "")
$ then
$ bz2_olb = "LIBBZ2_NS.OLB"
-$ if (.not. LINK_ONLY)
+$ if (MAKE_OBJ .or. MAKE_EXE)
$ then
$ define incl_bzip2 'IZ_BZIP2'
$ if (BUILD_BZIP2 .and. (IZ_BZIP2 .eqs. "SYS$DISK:[.BZIP2]"))
$ endif
$ endif
$!
-$ @ [.VMS]FIND_BZIP2_LIB.COM 'IZ_BZIP2' 'seek_bz' 'bz2_olb' lib_bzip2
-$ if (f$trnlnm( "lib_bzip2") .eqs. "")
+$ if (MAKE_EXE)
$ then
-$ say "Can't find BZIP2 object library. Can't link."
-$ goto error
-$ else
-$ lib_bzip2_opts = "lib_bzip2:''bz2_olb' /library,"
-$ cc_incl = cc_incl+ ", [.VMS]"
+$ @ [.VMS]FIND_BZIP2_LIB.COM 'IZ_BZIP2' 'seek_bz' 'bz2_olb' lib_bzip2
+$ if (f$trnlnm( "lib_bzip2") .eqs. "")
+$ then
+$ say "Can't find BZIP2 object library. Can't link."
+$ goto error
+$ else
+$ lib_bzip2_opts = "LIB_BZIP2:''bz2_olb' /library,"
+$ endif
$ endif
$ endif
$!
$ say "Can't find ZLIB object library. Can't link."
$ goto error
$ else
-$ lib_zlib_opts = "lib_zlib:''zlib_olb' /library, "
-$ if (f$locate( "[.VMS]", cc_incl) .ge. f$length( cc_incl))
-$ then
-$ cc_incl = cc_incl+ ", [.VMS]"
-$ endif
+$ lib_zlib_opts = "LIB_ZLIB:''zlib_olb' /library, "
$ @ [.VMS]FIND_BZIP2_LIB.COM 'IZ_ZLIB' -
contrib.infback9 infback9.h'zlib_olb' incl_zlib_contrib_infback9
$ endif
$!
$! If [.'dest'] does not exist, either complain (link-only) or make it.
$!
-$ if (f$search( "''dest'.dir;1") .eqs. "")
+$ if (f$search( "''dest'.DIR;1") .eqs. "")
$ then
-$ if (LINK_ONLY)
+$ if (MAKE_OBJ)
$ then
-$ say "Can't find directory ""[.''dest']"". Can't link."
-$ goto error
-$ else
$ create /directory [.'dest']
+$ else
+$ if (MAKE_EXE .or. MAKE_MSG)
+$ then
+$ say "Can't find directory ""[.''dest']"". Can't link."
+$ goto error
+$ endif
$ endif
$ endif
$!
-$ if (.not. LINK_ONLY)
+$ if (MAKE_OBJ)
$ then
$!
$! Arrange to get arch-specific list file placement, if listing, and if
$!
$! Show interesting facts.
$!
+$ say ""
$ say " architecture = ''arch' (destination = [.''dest'])"
+$!
+$ if (MAKE_OBJ)
+$ then
+$ say " cc = ''cc'"
+$ endif
+$!
+$ if (MAKE_EXE)
+$ then
+$ say " link = ''link'"
+$ endif
+$!
+$ if (.not. MAKE_HELP)
+$ then
+$ say " Not making new help files."
+$ endif
+$!
+$ if (.not. MAKE_MSG)
+$ then
+$ say " Not making new message files."
+$ endif
+$!
$ if (IZ_BZIP2 .nes. "")
$ then
-$ if (.not. LINK_ONLY)
+$ if (MAKE_EXE)
$ then
$ say " BZIP2 include dir: ''f$trnlnm( "incl_bzip2")'"
$ endif
$ endif
$ if (IZ_ZLIB .nes. "")
$ then
-$ if (.not. LINK_ONLY)
+$ if (MAKE_EXE)
$ then
$ say " ZLIB include dir: ''f$trnlnm( "incl_zlib")'"
$ endif
$ say " ZLIB library dir: ''f$trnlnm( "lib_zlib")'"
$ endif
-$ if (.not. LINK_ONLY)
-$ then
-$ say " cc = ''cc'"
-$ endif
-$ say " link = ''link'"
-$ if (.not. MAKE_HELP)
-$ then
-$ say " Not making new help files."
-$ endif
-$ if (.not. MAKE_MSG)
-$ then
-$ say " Not making new message files."
-$ endif
$ say ""
$!
$ tmp = f$verify( 1) ! Turn echo on to see what's happening.
$!
$!------------------------------- UnZip section ------------------------------
$!
-$ if (.not. LINK_ONLY)
+$!
+$ if (MAKE_HELP)
$ then
$!
-$! Process the help file, if desired.
+$! Process the Unix-style help file.
$!
-$ if (MAKE_HELP)
-$ then
-$ runoff /out = UNZIP.HLP [.VMS]UNZIP_DEF.RNH
-$ endif
+$ runoff /out = UNZIP.HLP [.VMS]UNZIP_DEF.RNH
$!
-$! Process the message file, if desired.
+$ endif
$!
-$ if (MAKE_MSG)
-$ then
-$ message /object = [.'dest']UNZIP_MSG.OBJ /nosymbols -
- [.VMS]UNZIP_MSG.MSG
-$ link /shareable = [.'dest']UNZIP_MSG.EXE [.'dest']UNZIP_MSG.OBJ
-$ endif
+$ if (MAKE_HELP .and. MAKE_HELP_TEXT)
+$ then
+$!
+$! Make the Unix-style help output text file.
+$!
+$ help_temp_name = "help_temp_"+ f$getjpi( 0, "PID")
+$ if (f$search( help_temp_name+ ".HLB") .nes. "") then -
+ delete 'help_temp_name'.HLB;*
+$ library /create /help 'help_temp_name'.HLB UNZIP.HLP
+$ help /library = sys$disk:[]'help_temp_name'.HLB -
+ /output = 'help_temp_name'.OUT unzip...
+$ delete 'help_temp_name'.HLB;*
+$ create /fdl = [.VMS]STREAM_LF.FDL UNZIP.HTX
+$ open /append help_temp UNZIP.HTX
+$ copy 'help_temp_name'.OUT help_temp
+$ close help_temp
+$ delete 'help_temp_name'.OUT;*
+$!
+$ endif
+$!
+$ if (MAKE_MSG)
+$ then
+$!
+$! Process the message file.
+$!
+$ message /object = [.'dest']UNZIP_MSG.OBJ /nosymbols -
+ [.VMS]UNZIP_MSG.MSG
+$ link /shareable = [.'dest']UNZIP_MSG.EXE [.'dest']UNZIP_MSG.OBJ
$!
-$! Compile the sources.
+$ endif
+$!
+$ if (MAKE_OBJ)
+$ then
+$!
+$! Compile the primary sources.
$!
$ cc 'DEF_UNX' /object = [.'dest']UNZIP.OBJ UNZIP.C
$ cc 'DEF_UNX' /object = [.'dest']CRC32.OBJ CRC32.C
$ cc 'DEF_UNX' /object = [.'dest']ZIPINFO.OBJ ZIPINFO.C
$ cc 'DEF_UNX' /object = [.'dest']VMS.OBJ [.VMS]VMS.C
$!
-$! Create the object library.
+$ if (LIBUNZIP .ne. 0)
+$ then
$!
-$ if (f$search( "[.''dest']UNZIP.OLB") .eqs. "") then -
- libr /object /create [.'dest']UNZIP.OLB
+$! Compile the callable object library sources, DLL/REENTRANT-sensitive.
+$!
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']API_L.OBJ API.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']APIHELP_L.OBJ APIHELP.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']CRYPT_L.OBJ CRYPT.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']EXPLODE_L.OBJ EXPLODE.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']EXTRACT_L.OBJ EXTRACT.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']FILEIO_L.OBJ FILEIO.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']GLOBALS_L.OBJ GLOBALS.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']INFLATE_L.OBJ INFLATE.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']LIST_L.OBJ LIST.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']PROCESS_L.OBJ PROCESS.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']TTYIO_L.OBJ TTYIO.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']UBZ2ERR_L.OBJ UBZ2ERR.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']UNSHRINK_L.OBJ UNSHRINK.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']UNZIP_L.OBJ UNZIP.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']ZIPINFO_L.OBJ ZIPINFO.C
+$ cc 'DEF_LIBUNZIP' /object = [.'dest']VMS_L.OBJ [.VMS]VMS.C
+$ endif
+$!
+$ if (AES_WG .ne. 0)
+$ then
+$ cc 'DEF_UNX' /object = [.'dest']AESCRYPT.OBJ [.AES_WG]AESCRYPT.C
+$ cc 'DEF_UNX' /object = [.'dest']AESKEY.OBJ [.AES_WG]AESKEY.C
+$ cc 'DEF_UNX' /object = [.'dest']AESTAB.OBJ [.AES_WG]AESTAB.C
+$ cc 'DEF_UNX' /object = [.'dest']FILEENC.OBJ [.AES_WG]FILEENC.C
+$ cc 'DEF_UNX' /object = [.'dest']HMAC.OBJ [.AES_WG]HMAC.C
+$ cc 'DEF_UNX' /object = [.'dest']PRNG.OBJ [.AES_WG]PRNG.C
+$ cc 'DEF_UNX' /object = [.'dest']PWD2KEY.OBJ [.AES_WG]PWD2KEY.C
+$ cc 'DEF_UNX' /object = [.'dest']SHA1.OBJ [.AES_WG]SHA1.C
+$ endif
$!
-$ libr /object /replace [.'dest']UNZIP.OLB -
+$ if (LZMA .ne. 0)
+$ then
+$ cc 'DEF_UNX' /object = [.'dest']LZFIND.OBJ [.SZIP]LZFIND.C
+$ cc 'DEF_UNX' /object = [.'dest']LZMADEC.OBJ [.SZIP]LZMADEC.C
+$ endif
+$!
+$ if (PPMD .ne. 0)
+$ then
+$ cc 'DEF_UNX' /object = [.'dest']PPMD8.OBJ [.SZIP]PPMD8.C
+$ cc 'DEF_UNX' /object = [.'dest']PPMD8DEC.OBJ [.SZIP]PPMD8DEC.C
+$ endif
+$!
+$ if (LIBUNZIP .ne. 0)
+$ then
+$!
+$! Create the callable library link options file.
+$!
+$ def_dev_dir_orig = f$environment( "default")
+$ set default [.'dest']
+$ def_dev_dir = f$environment( "default")
+$ set default 'def_dev_dir_orig'
+$ create /fdl = [.VMS]STREAM_LF.FDL 'libunzip_opt'
+$ open /append opt_file_lib 'libunzip_opt'
+$ write opt_file_lib "! DEFINE LIB_IZUNZIP ''def_dev_dir'"
+$ if (IZ_BZIP2 .nes. "")
+$ then
+$ write opt_file_lib "! DEFINE LIB_BZIP2 ''f$trnlnm( "lib_bzip2")'"
+$ endif
+$ if (IZ_ZLIB .nes. "")
+$ then
+$ write opt_file_lib "! DEFINE LIB_ZLIB ''f$trnlnm( "lib_zlib")'"
+$ endif
+$ write opt_file_lib "LIB_IZUNZIP:''lib_unzip_name' /library"
+$ if (IZ_BZIP2 .nes. "")
+$ then
+$ write opt_file_lib "''lib_bzip2_opts'" - ", " - ","
+$ endif
+$ write opt_file_lib "LIB_IZUNZIP:''lib_unzip_name' /library"
+$ if (IZ_ZLIB .nes. "")
+$ then
+$ write opt_file_lib "''libunzip_opt'" - ", " - ","
+$ endif
+$ close opt_file_lib
+$!
+$ endif
+$!
+$ endif
+$!
+$ if (MAKE_EXE)
+$ then
+$!
+$! Create the primary object library.
+$!
+$ if (f$search( lib_unzip) .eqs. "") then -
+ libr /object /create 'lib_unzip'
+$!
+$ libr /object /replace 'lib_unzip' -
[.'dest']CRC32.OBJ, -
[.'dest']CRYPT.OBJ, -
[.'dest']ENVARGS.OBJ, -
[.'dest']ZIPINFO.OBJ, -
[.'dest']VMS.OBJ
$!
+$ if (AES_WG .ne. 0)
+$ then
+$ libr /object /replace 'lib_unzip' -
+ [.'dest']AESCRYPT.OBJ, -
+ [.'dest']AESKEY.OBJ, -
+ [.'dest']AESTAB.OBJ, -
+ [.'dest']FILEENC.OBJ, -
+ [.'dest']HMAC.OBJ, -
+ [.'dest']PRNG.OBJ, -
+ [.'dest']PWD2KEY.OBJ, -
+ [.'dest']SHA1.OBJ
+$ endif
+$!
+$ if (LZMA .ne. 0)
+$ then
+$ libr /object /replace 'lib_unzip' -
+ [.'dest']LZFIND.OBJ, -
+ [.'dest']LZMADEC.OBJ
+$ endif
+$!
+$ if (PPMD .ne. 0)
+$ then
+$ libr /object /replace 'lib_unzip' -
+ [.'dest']PPMD8.OBJ, -
+ [.'dest']PPMD8DEC.OBJ
+$ endif
+$!
+$! Create the callable UnZip object library and link options file.
+$!
+$ if (LIBUNZIP .ne. 0)
+$ then
+$!
+$ if (f$search( lib_libunzip) .eqs. "") then -
+ libr /object /create 'lib_libunzip'
+$!
+$! Modules sensitive to DLL/REENTRANT.
+$!
+$ libr /object /replace 'lib_libunzip' -
+ [.'dest']API_L.OBJ, -
+ [.'dest']APIHELP_L.OBJ, -
+ [.'dest']CRYPT_L.OBJ, -
+ [.'dest']EXPLODE_L.OBJ, -
+ [.'dest']EXTRACT_L.OBJ, -
+ [.'dest']FILEIO_L.OBJ, -
+ [.'dest']GLOBALS_L.OBJ, -
+ [.'dest']INFLATE_L.OBJ, -
+ [.'dest']LIST_L.OBJ, -
+ [.'dest']PROCESS_L.OBJ, -
+ [.'dest']TTYIO_L.OBJ, -
+ [.'dest']UBZ2ERR_L.OBJ, -
+ [.'dest']UNSHRINK_L.OBJ, -
+ [.'dest']ZIPINFO_L.OBJ, -
+ [.'dest']VMS_L.OBJ
+$!
+$! Modules insensitive to DLL/REENTRANT.
+$!
+$ libr /object /replace 'lib_libunzip' -
+ [.'dest']CRC32.OBJ, -
+ [.'dest']ENVARGS.OBJ, -
+ [.'dest']MATCH.OBJ, -
+ [.'dest']UNREDUCE.OBJ
+$!
+$ if (AES_WG .ne. 0)
+$ then
+$ libr /object /replace 'lib_libunzip' -
+ [.'dest']AESCRYPT.OBJ, -
+ [.'dest']AESKEY.OBJ, -
+ [.'dest']AESTAB.OBJ, -
+ [.'dest']FILEENC.OBJ, -
+ [.'dest']HMAC.OBJ, -
+ [.'dest']PRNG.OBJ, -
+ [.'dest']PWD2KEY.OBJ, -
+ [.'dest']SHA1.OBJ
+$ endif
+$!
+$ if (LZMA .ne. 0)
+$ then
+$ libr /object /replace 'lib_libunzip' -
+ [.'dest']LZFIND.OBJ, -
+ [.'dest']LZMADEC.OBJ
+$ endif
+$!
+$ if (PPMD .ne. 0)
+$ then
+$ libr /object /replace 'lib_libunzip' -
+ [.'dest']PPMD8.OBJ, -
+ [.'dest']PPMD8DEC.OBJ
+$ endif
+$!
+$ endif
+$!
$ endif
$!
+$ if (MAKE_EXE)
+$ then
+$!
+$! Create the module ID options file.
+$!
+$ optgen_verify = f$verify( 0)
+$ @ [.vms]optgen.com UnZip iz_unzip_versn
+$ open /write opt_file_ln SYS$DISK:[.'dest']UNZIP.OPT
+$ write opt_file_ln "Ident = ""UnZip ''f$trnlnm( "iz_unzip_versn")'"""
+$ close opt_file_ln
+$ deassign iz_unzip_versn
+$ tmp = f$verify( optgen_verify)
+$!
$! Link the executable.
$!
-$ link /executable = [.'dest']'unzx_unx'.EXE -
- SYS$DISK:[.'dest']UNZIP.OBJ, -
- SYS$DISK:[.'dest']UNZIP.OLB /library, -
- 'lib_bzip2_opts' -
- SYS$DISK:[.'dest']UNZIP.OLB /library, -
- 'lib_zlib_opts' -
- 'opts' -
- SYS$DISK:[.VMS]UNZIP.OPT /options
+$ link /executable = [.'dest']'unzx_unx'.EXE -
+ SYS$DISK:[.'dest']UNZIP.OBJ, -
+ 'lib_unzip' /library, -
+ 'lib_bzip2_opts' -
+ 'lib_unzip' /library, -
+ 'lib_zlib_opts' -
+ 'opts' -
+ SYS$DISK:[.'dest']UNZIP.OPT /options
+$!
+$ endif
$!
$!----------------------- UnZip (CLI interface) section ----------------------
$!
-$ if (.not. LINK_ONLY)
+$! Process the CLI help file, if desired.
+$!
+$ if (MAKE_HELP)
$ then
+$ set default [.VMS]
+$ edit /tpu /nosection /nodisplay /command = CVTHELP.TPU -
+ UNZIP_CLI.HELP
+$ set default [-]
+$ runoff /output = UNZIP_CLI.HLP [.VMS]UNZIP_CLI.RNH
+$ endif
$!
-$! Process the CLI help file, if desired.
+$! Make the CLI help output text file, if desired.
$!
-$ if (MAKE_HELP)
-$ then
-$ set default [.VMS]
-$ edit /tpu /nosection /nodisplay /command = CVTHELP.TPU -
- UNZIP_CLI.HELP
-$ set default [-]
-$ runoff /output = UNZIP_CLI.HLP [.VMS]UNZIP_CLI.RNH
-$ endif
+$ if (MAKE_HELP .and. MAKE_HELP_TEXT)
+$ then
+$ help_temp_name = "help_temp_"+ f$getjpi( 0, "PID")
+$ if (f$search( help_temp_name+ ".HLB") .nes. "") then -
+ delete 'help_temp_name'.HLB;*
+$ library /create /help 'help_temp_name'.HLB UNZIP_CLI.HLP
+$ help /library = sys$disk:[]'help_temp_name'.HLB -
+ /output = 'help_temp_name'.OUT unzip...
+$ delete 'help_temp_name'.HLB;*
+$ create /fdl = [.VMS]STREAM_LF.FDL UNZIP_CLI.HTX
+$ open /append help_temp UNZIP_CLI.HTX
+$ copy 'help_temp_name'.OUT help_temp
+$ close help_temp
+$ delete 'help_temp_name'.OUT;*
+$ endif
+$!
+$ if (MAKE_OBJ)
+$ then
$!
$! Compile the CLI sources.
$!
$ cc 'DEF_CLI' /object = [.'dest']UNZIPCLI.OBJ UNZIP.C
+$ cc 'DEF_CLI' /object = [.'dest']ZIPINFO_C.OBJ ZIPINFO.C
$ cc 'DEF_CLI' /object = [.'dest']CMDLINE.OBJ -
[.VMS]CMDLINE.C
$!
$! Create the command definition object file.
$!
-$ set command /object = [.'dest']UNZ_CLI.OBJ [.VMS]UNZ_CLI.CLD
+$ cppcld_verify = f$verify( 0)
+$ @ [.vms]cppcld.com "''cc'" [.VMS]UNZ_CLI.CLD -
+ [.'dest']UNZ_CLI.CLD "''defs'"
+$ tmp = f$verify( cppcld_verify)
+$ set command /object = [.'dest']UNZ_CLI.OBJ [.'dest']UNZ_CLI.CLD
+$!
+$ endif
+$!
+$ if (MAKE_EXE)
+$ then
$!
$! Create the CLI object library.
$!
-$ if (f$search( "[.''dest']UNZIPCLI.OLB") .eqs. "") then -
- libr /object /create [.'dest']UNZIPCLI.OLB
+$ if (f$search( lib_unzipcli) .eqs. "") then -
+ libr /object /create 'lib_unzipcli'
$!
-$ libr /object /replace [.'dest']UNZIPCLI.OLB -
+$ libr /object /replace 'lib_unzipcli' -
[.'dest']CMDLINE.OBJ, -
+ [.'dest']ZIPINFO_C.OBJ, -
[.'dest']UNZ_CLI.OBJ
$!
$ endif
$!
+$ if (MAKE_EXE)
+$ then
+$!
$! Link the CLI executable.
$!
-$ link /executable = [.'dest']'unzx_cli'.EXE -
- SYS$DISK:[.'dest']UNZIPCLI.OBJ, -
- SYS$DISK:[.'dest']UNZIPCLI.OLB /library, -
- SYS$DISK:[.'dest']UNZIP.OLB /library, -
- 'lib_bzip2_opts' -
- SYS$DISK:[.'dest']UNZIP.OLB /library, -
- 'lib_zlib_opts' -
- 'opts' -
- SYS$DISK:[.VMS]UNZIP.OPT /options
+$ link /executable = [.'dest']'unzx_cli'.EXE -
+ SYS$DISK:[.'dest']UNZIPCLI.OBJ, -
+ 'lib_unzipcli' /library, -
+ 'lib_unzip' /library, -
+ 'lib_bzip2_opts' -
+ 'lib_unzip' /library, -
+ 'lib_zlib_opts' -
+ 'opts' -
+ SYS$DISK:[.'dest']UNZIP.OPT /options
+$!
+$ endif
$!
$!-------------------------- UnZipSFX section --------------------------------
$!
-$ if (.not. LINK_ONLY)
+$ if (MAKE_OBJ)
$ then
$!
$! Compile the variant SFX sources.
$ cc 'DEF_SXUNX' /object = [.'dest']UBZ2ERR_.OBJ UBZ2ERR.C
$ cc 'DEF_SXUNX' /object = [.'dest']VMS_.OBJ [.VMS]VMS.C
$!
+$ endif
+$!
+$ if (MAKE_EXE)
+$ then
+$!
$! Create the SFX object library.
$!
-$ if (f$search( "[.''dest']UNZIPSFX.OLB") .eqs. "") then -
- libr /object /create [.'dest']UNZIPSFX.OLB
+$ if (f$search( lib_unzipsfx) .eqs. "") then -
+ libr /object /create 'lib_unzipsfx'
$!
-$ libr /object /replace [.'dest']UNZIPSFX.OLB -
+$ libr /object /replace 'lib_unzipsfx' -
[.'dest']CRC32_.OBJ, -
[.'dest']CRYPT_.OBJ, -
[.'dest']EXTRACT_.OBJ, -
[.'dest']UBZ2ERR_.OBJ, -
[.'dest']VMS_.OBJ
$!
+$ if (AES_WG .ne. 0)
+$ then
+$ libr /object /replace 'lib_unzipsfx' -
+ [.'dest']AESCRYPT.OBJ, -
+ [.'dest']AESKEY.OBJ, -
+ [.'dest']AESTAB.OBJ, -
+ [.'dest']FILEENC.OBJ, -
+ [.'dest']HMAC.OBJ, -
+ [.'dest']PRNG.OBJ, -
+ [.'dest']PWD2KEY.OBJ, -
+ [.'dest']SHA1.OBJ
+$ endif
+$!
+$ if (LZMA .ne. 0)
+$ then
+$ libr /object /replace 'lib_unzipsfx' -
+ [.'dest']LZFIND.OBJ, -
+ [.'dest']LZMADEC.OBJ
+$ endif
+$!
+$ if (PPMD .ne. 0)
+$ then
+$ libr /object /replace 'lib_unzipsfx' -
+ [.'dest']PPMD8.OBJ, -
+ [.'dest']PPMD8DEC.OBJ
+$ endif
+$!
$ endif
$!
+$ if (MAKE_EXE)
+$ then
+$!
+$! Create the program ID options file.
+$!
+$ optgen_verify = f$verify( 0)
+$ @ [.vms]optgen.com UnZip iz_unzip_versn
+$ open /write opt_file_ln SYS$DISK:[.'dest']UNZIPSFX.OPT
+$ write opt_file_ln "Ident = ""UnZipSFX ''f$trnlnm( "iz_unzip_versn")'"""
+$ close opt_file_ln
+$ deassign iz_unzip_versn
+$ tmp = f$verify( optgen_verify)
+$!
$! Link the SFX executable.
$!
-$ link /executable = [.'dest']'unzsfx_unx'.EXE -
- SYS$DISK:[.'dest']UNZIPSFX.OBJ, -
- SYS$DISK:[.'dest']UNZIPSFX.OLB /library, -
- 'lib_bzip2_opts' -
- SYS$DISK:[.'dest']UNZIPSFX.OLB /library, -
- 'lib_zlib_opts' -
- 'opts' -
- SYS$DISK:[.VMS]UNZIPSFX.OPT /options
+$ link /executable = [.'dest']'unzsfx_unx'.EXE -
+ SYS$DISK:[.'dest']UNZIPSFX.OBJ, -
+ 'lib_unzipsfx' /library, -
+ 'lib_bzip2_opts' -
+ 'lib_unzipsfx' /library, -
+ 'lib_zlib_opts' -
+ 'opts' -
+ SYS$DISK:[.'dest']UNZIPSFX.OPT /options
+$!
+$ endif
$!
$!--------------------- UnZipSFX (CLI interface) section ---------------------
$!
-$ if (.not. LINK_ONLY)
+$ if (MAKE_OBJ)
$ then
$!
$! Compile the SFX CLI sources.
$ cc 'DEF_SXCLI' /object = [.'dest']CMDLINE_.OBJ -
[.VMS]CMDLINE.C
$!
+$ endif
+$!
+$ if (MAKE_EXE)
+$ then
+$!
$! Create the SFX CLI object library.
$!
-$ if (f$search( "[.''dest']UNZSXCLI.OLB") .eqs. "") then -
- libr /object /create [.'dest']UNZSXCLI.OLB
+$ if (f$search( lib_unzipsfxcli) .eqs. "") then -
+ libr /object /create 'lib_unzipsfxcli'
$!
-$ libr /object /replace [.'dest']UNZSXCLI.OLB -
+$ libr /object /replace 'lib_unzipsfxcli' -
[.'dest']CMDLINE_.OBJ, -
[.'dest']UNZ_CLI.OBJ
$!
$ endif
$!
+$ if (MAKE_EXE)
+$ then
+$!
$! Link the SFX CLI executable.
$!
-$ link /executable = [.'dest']'unzsfx_cli'.EXE -
- SYS$DISK:[.'dest']UNZSXCLI.OBJ, -
- SYS$DISK:[.'dest']UNZSXCLI.OLB /library, -
- SYS$DISK:[.'dest']UNZIPSFX.OLB /library, -
- 'lib_bzip2_opts' -
- SYS$DISK:[.'dest']UNZIPSFX.OLB /library, -
- 'lib_zlib_opts' -
- 'opts' -
- SYS$DISK:[.VMS]UNZIPSFX.OPT /options
+$ link /executable = [.'dest']'unzsfx_cli'.EXE -
+ SYS$DISK:[.'dest']UNZSXCLI.OBJ, -
+ 'lib_unzipsfxcli' /library, -
+ 'lib_unzipsfx' /library, -
+ 'lib_bzip2_opts' -
+ 'lib_unzipsfx' /library, -
+ 'lib_zlib_opts' -
+ 'opts' -
+ SYS$DISK:[.'dest']UNZIPSFX.OPT /options
+$!
+$ endif
$!
$!----------------------------- Symbols section ------------------------------
$!
-$ there = here- "]"+ ".''dest']"
+$ if (MAKE_SYM)
+$ then
$!
-$! Define the foreign command symbols. Similar commands may be useful
-$! in SYS$MANAGER:SYLOGIN.COM and/or users' LOGIN.COM.
+$ there = here- "]"+ ".''dest']"
$!
-$ unzip == "$''there'''unzexec'.EXE"
-$ zipinfo == "$''there'''unzexec'.EXE ""-Z"""
+$! Define the foreign command symbols. Similar commands may be useful
+$! in SYS$MANAGER:SYLOGIN.COM and/or users' LOGIN.COM.
+$!
+$ unzip == "$''there'''unzexec'.EXE"
+$ zipinfo == "$''there'''unzexec'.EXE ""-Z"""
+$!
+$ endif
$!
$! Deassign the temporary process logical names, restore the original
$! default directory, and restore the DCL verify status.
$!
$ error:
$!
+$ if (f$trnlnm( "iz_unzip_versn", "LNM$PROCESS_TABLE") .nes. "")
+$ then
+$ deassign iz_unzip_versn
+$ endif
+$!
$ if (IZ_BZIP2 .nes. "")
$ then
$ if (f$trnlnm( "incl_bzip2", "LNM$PROCESS_TABLE") .nes. "")
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2007-Mar-04 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
+
+/* Stand-alone test procedure:
+ *
+ * cc /define = TEST=1 /include = [] /object = [.vms] [.vms]cmdline.c
+ * set command /object = [.vms]unz_cli.obj [.vms]unz_cli.cld
+ * link /executable = [] [.vms]cmdline.obj, [.vms]unz_cli.obj
+ * EXEC*UTE == "$ SYS$DISK:[]'"
+ * exec cmdline [ /qualifiers ...] [parameters ...]
+ */
+
+
/* 2004-12-13 SMS.
* Disabled the module name macro to accommodate old GNU C which didn't
* obey the directive, and thus confused MMS/MMK where the object
*/
#if 0
#define module_name VMS_UNZIP_CMDLINE
-#define module_ident "02-013"
+#define module_ident "02-015"
#endif /* 0 */
/*
**
** Modified by:
**
+** 02-017 S. Schweda 06-Oct-2012 17:00
+** Added /DECIMAL_TIME, /[NO]JAR, /JUNK_DIRS=n,
+** /MATCH (replacing /CASE_MATCH). Restored and deprecated
+** /[NO]CASE_INSENSITIVE. Changed /NAMES = [NO]LOWERCASE
+** to /NAMES = [NO]DOWNCASE. Added Zip-like
+** /VERBOSE={NORMAL|MORE}, deprecating /BRIEF and /FULL.
+**
+** 02-016 S. Schweda 11-Aug-2011 17:00
+** Added /NAMES = [ [NO]LOWERCASE | [NO]ODS2 | [NO]SPACES ].
+**
+** 02-015 S. Schweda 31-Jul-2010 22:00
+** Rewrote option conversion code to use a separate argv[]
+** member for each option, eliminating combined short
+** options. Changed /ZIPINFO /COMMENT to use "-z" instead
+** of (incorrect) "-c". Removed traces of /EXTRACT. Added
+** /VERBOSE = COMMAND. Replaced /[NO]CASE_INSENSITIVE with
+** /CASE_MATCH. Added (and used) macros DESCRIPTOR_D and
+** ADD_ARG.
+**
+** 02-014 E. Gordon 08-Jul-2010 16:41
+** Modified to work with get_options() and new command table.
** 02-013 S. Schweda, C. Spieler 29-Dec-2007 03:34
** Extended /RESTORE qualifier to support timestamp restoration
** options.
**
*/
-/* Stand-alone test procedure:
- *
- * cc /define = TEST=1 [.vms]cmdline.c /include = [] /object = [.vms]
- * set command /object = [.vms]unz_cli.obj [.vms]unz_cli.cld
- * link /executable = [] [.vms]cmdline.obj, [.vms]unz_cli.obj
- * EXEC*UTE == "$SYS$DISK:[]'"
- * exec cmdline [ /qualifiers ...] [parameters ...]
- */
-
\f
/* 2004-12-13 SMS.
#endif
/*
-** "Macro" to initialize a dynamic string descriptor.
-*/
-#define init_dyndesc(dsc) {\
- dsc.dsc$w_length = 0;\
- dsc.dsc$b_dtype = DSC$K_DTYPE_T;\
- dsc.dsc$b_class = DSC$K_CLASS_D;\
- dsc.dsc$a_pointer = NULL;}
+ * DESCRIPTOR_D macro. Like $DESCRIPTOR, but with:
+ * dsc$descriptor_s -> dsc$descriptor_d
+ * DSC$K_CLASS_S -> DSC$K_CLASS_D
+ * string -> (NULL)
+ */
+#define DESCRIPTOR_D( name) struct dsc$descriptor_d name = \
+ { 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, NULL }
/*
-** Memory allocation step for argv string buffer.
-*/
+ * Memory allocation block size for argv string buffer.
+ */
#define ARGBSIZE_UNIT 256
/*
-** Memory reallocation macro for argv string buffer.
-*/
-#define CHECK_BUFFER_ALLOCATION(buf, reserved, requested) { \
+ * Memory reallocation macro for argv string buffer.
+ */
+#define CHECK_BUFFER_ALLOCATION( buf, reserved, requested) { \
if ((requested) > (reserved)) { \
char *save_buf = (buf); \
(reserved) += ARGBSIZE_UNIT; \
- if (((buf) = (char *) realloc((buf), (reserved))) == NULL) { \
- if (save_buf != NULL) free(save_buf); \
- return (SS$_INSFMEM); \
+ if (((buf) = (char *) realloc( (buf), (reserved))) == NULL) { \
+ if (save_buf != NULL) free( save_buf); \
+ return SS$_INSFMEM; \
} \
} \
}
/*
+ * Macro to add an argument to argv string buffer.
+ */
+#define ADD_ARG( opt) \
+ x = cmdl_len; \
+ cmdl_len += strlen( opt)+ 1; \
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len) \
+ strcpy( &the_cmd_line[ x], opt);
+
+
+/*
** Define descriptors for all of the CLI parameters and qualifiers.
*/
#if 0
$DESCRIPTOR(cli_text, "TEXT"); /* -a[a] */
$DESCRIPTOR(cli_text_auto, "TEXT.AUTO"); /* -a */
$DESCRIPTOR(cli_text_all, "TEXT.ALL"); /* -aa */
-$DESCRIPTOR(cli_text_none, "TEXT.NONE"); /* ---a */
+$DESCRIPTOR(cli_text_none, "TEXT.NONE"); /* -a- */
$DESCRIPTOR(cli_text_stmlf, "TEXT.STMLF"); /* -S */
$DESCRIPTOR(cli_binary, "BINARY"); /* -b[b] */
$DESCRIPTOR(cli_binary_auto, "BINARY.AUTO"); /* -b */
$DESCRIPTOR(cli_binary_all, "BINARY.ALL"); /* -bb */
-$DESCRIPTOR(cli_binary_none, "BINARY.NONE"); /* ---b */
-$DESCRIPTOR(cli_case_insensitive,"CASE_INSENSITIVE"); /* -C */
+$DESCRIPTOR(cli_binary_none, "BINARY.NONE"); /* -b- */
+$DESCRIPTOR(cli_case_insensitive, "CASE_INSENSITIVE"); /* -C */
+$DESCRIPTOR(cli_match, "MATCH"); /* -C, -W */
+$DESCRIPTOR(cli_match_case, "MATCH.CASE"); /* -C[-] */
+$DESCRIPTOR(cli_match_case_blind, "MATCH.CASE.BLIND"); /* -C */
+$DESCRIPTOR(cli_match_case_sens, "MATCH.CASE.SENSITIVE"); /* -C- */
+#ifdef WILD_STOP_AT_DIR
+$DESCRIPTOR(cli_match_wild, "MATCH.WILD_MATCH_SLASH"); /* -W[-] */
+#endif /* def WILD_STOP_AT_DIR */
$DESCRIPTOR(cli_screen, "SCREEN"); /* -c */
$DESCRIPTOR(cli_directory, "DIRECTORY"); /* -d */
+$DESCRIPTOR(cli_auto_dir, "AUTO_DIRECTORY"); /* -da */
+$DESCRIPTOR(cli_auto_dir_reuse, "AUTO_DIRECTORY.REUSE"); /* -da=reuse */
$DESCRIPTOR(cli_freshen, "FRESHEN"); /* -f */
$DESCRIPTOR(cli_help, "HELP"); /* -h */
-$DESCRIPTOR(cli_junk, "JUNK"); /* -j */
+$DESCRIPTOR(cli_help_normal, "HELP.NORMAL"); /* -h */
+$DESCRIPTOR(cli_help_extended, "HELP.EXTENDED"); /* -hh */
+$DESCRIPTOR(cli_jar, "JAR"); /* --jar */
+$DESCRIPTOR(cli_junk_dirs, "JUNK_DIRS"); /* -j */
$DESCRIPTOR(cli_lowercase, "LOWERCASE"); /* -L */
+$DESCRIPTOR(cli_license, "LICENSE"); /* --license */
$DESCRIPTOR(cli_list, "LIST"); /* -l */
$DESCRIPTOR(cli_brief, "BRIEF"); /* -l */
+$DESCRIPTOR(cli_page, "PAGE"); /* -M , -ZM */
$DESCRIPTOR(cli_full, "FULL"); /* -v */
$DESCRIPTOR(cli_full_diags, "FULL.DIAGNOSTICS"); /* -vv */
$DESCRIPTOR(cli_existing, "EXISTING"); /* -o, -oo, -n */
$DESCRIPTOR(cli_test, "TEST"); /* -t */
$DESCRIPTOR(cli_pipe, "PIPE"); /* -p */
$DESCRIPTOR(cli_password, "PASSWORD"); /* -P */
+$DESCRIPTOR(cli_names_down, "NAMES.DOWNCASE"); /* -L, -LL */
+$DESCRIPTOR(cli_names_down_all, "NAMES.DOWNCASE.ALL"); /* -LL */
+$DESCRIPTOR(cli_names_nodown, "NAMES.NODOWNCASE"); /* -L-L- */
+$DESCRIPTOR(cli_names_ods2, "NAMES.ODS2"); /* -2 */
+$DESCRIPTOR(cli_names_spaces, "NAMES.SPACES"); /* -s */
$DESCRIPTOR(cli_timestamp, "TIMESTAMP"); /* -T */
$DESCRIPTOR(cli_uppercase, "UPPERCASE"); /* -U */
$DESCRIPTOR(cli_update, "UPDATE"); /* -u */
$DESCRIPTOR(cli_version, "VERSION"); /* -V */
-$DESCRIPTOR(cli_restore, "RESTORE"); /* -X */
-$DESCRIPTOR(cli_restore_own, "RESTORE.OWNER_PROT"); /* -X */
+$DESCRIPTOR(cli_restore, "RESTORE"); /* -k, -ka, -X */
+$DESCRIPTOR(cli_restore_acl, "RESTORE.ACL"); /* -ka */
+$DESCRIPTOR(cli_restore_own, "RESTORE.OWNER"); /* -X- */
+$DESCRIPTOR(cli_restore_prot, "RESTORE.PROTECTION"); /* -k, -k- */
+$DESCRIPTOR(cli_restore_prot_lim, "RESTORE.PROTECTION.LIMITED"); /* -kk -k */
+$DESCRIPTOR(cli_restore_prot_orig, "RESTORE.PROTECTION.ORIGINAL"); /* -k */
$DESCRIPTOR(cli_restore_date, "RESTORE.DATE"); /* -DD */
-$DESCRIPTOR(cli_restore_date_all, "RESTORE.DATE.ALL"); /* --D */
+$DESCRIPTOR(cli_restore_date_all, "RESTORE.DATE.ALL"); /* -D- */
$DESCRIPTOR(cli_restore_date_files, "RESTORE.DATE.FILES"); /* -D */
$DESCRIPTOR(cli_dot_version, "DOT_VERSION"); /* -Y */
-$DESCRIPTOR(cli_comment, "COMMENT"); /* -z */
+$DESCRIPTOR(cli_comment, "COMMENT"); /* -z, -Zz */
$DESCRIPTOR(cli_exclude, "EXCLUDE"); /* -x */
$DESCRIPTOR(cli_ods2, "ODS2"); /* -2 */
$DESCRIPTOR(cli_traverse, "TRAVERSE_DIRS"); /* -: */
-$DESCRIPTOR(cli_information, "ZIPINFO"); /* -Z */
-$DESCRIPTOR(cli_short, "SHORT"); /* -Zs */
+$DESCRIPTOR(cli_zipinfo, "ZIPINFO"); /* -Z */
+$DESCRIPTOR(cli_header, "HEADER"); /* -Z -h */
+$DESCRIPTOR(cli_long, "LONG"); /* -Z =l */
$DESCRIPTOR(cli_medium, "MEDIUM"); /* -Zm */
-$DESCRIPTOR(cli_long, "LONG"); /* -Zl */
-$DESCRIPTOR(cli_verbose, "VERBOSE"); /* -Zv */
-$DESCRIPTOR(cli_header, "HEADER"); /* -Zh */
-$DESCRIPTOR(cli_totals, "TOTALS"); /* -Zt */
-$DESCRIPTOR(cli_times, "TIMES"); /* -ZT */
-$DESCRIPTOR(cli_one_line, "ONE_LINE"); /* -Z2 */
-
-$DESCRIPTOR(cli_page, "PAGE"); /* -M , -ZM */
+$DESCRIPTOR(cli_member_counts, "MEMBER_COUNTS"); /* -Z -mc */
+$DESCRIPTOR(cli_one_line, "ONE_LINE"); /* -Z -2 */
+$DESCRIPTOR(cli_short, "SHORT"); /* -Z -s */
+$DESCRIPTOR(cli_decimal_time, "DECIMAL_TIME"); /* -Z -T */
+$DESCRIPTOR(cli_times, "TIMES"); /* -Z -T */
+$DESCRIPTOR(cli_totals, "TOTALS"); /* -Z -t */
+$DESCRIPTOR(cli_noverbose, "NOVERBOSE"); /* -v-, -Z -v- */
+$DESCRIPTOR(cli_verbose, "VERBOSE"); /* -v, -Z -v */
+$DESCRIPTOR(cli_verbose_normal, "VERBOSE.NORMAL"); /* -v, -Z -v */
+$DESCRIPTOR(cli_verbose_more, "VERBOSE.MORE"); /* -vv, -Z -vv */
+$DESCRIPTOR(cli_verbose_command, "VERBOSE.COMMAND"); /* (none) */
$DESCRIPTOR(cli_yyz, "YYZ_UNZIP");
$DESCRIPTOR(unzip_command, "unzip ");
static int show_VMSCLI_usage;
+static int verbose_command = 0;
#ifndef vms_unzip_cld
# define vms_unzip_cld VMS_UNZIP_CLD
globalref void *vms_unzip_cld;
#endif
-/* extern unsigned long LIB$GET_INPUT(void), LIB$SIG_TO_RET(void); */
+/* extern unsigned int LIB$GET_INPUT(void), LIB$SIG_TO_RET(void); */
+/*
+ * Old systems may lack <cli$routines.h>, so we provide the important
+ * stuff.
+ */
#ifndef cli$dcl_parse
# define cli$dcl_parse CLI$DCL_PARSE
#endif
#ifndef cli$get_value
# define cli$get_value CLI$GET_VALUE
#endif
-extern unsigned long cli$dcl_parse ();
-extern unsigned long cli$present ();
-extern unsigned long cli$get_value ();
-
-unsigned long vms_unzip_cmdline (int *, char ***);
-static unsigned long get_list (struct dsc$descriptor_s *,
- struct dsc$descriptor_d *, int,
- char **, unsigned long *, unsigned long *);
-static unsigned long check_cli (struct dsc$descriptor_s *);
-
-\f
-#ifdef TEST
-int
-main(int argc, char **argv)
-{
- return (vms_unzip_cmdline(&argc, &argv));
-}
-#endif /* TEST */
+extern unsigned int cli$dcl_parse();
+extern unsigned int cli$present();
+extern unsigned int cli$get_value();
+
+static unsigned int get_list( struct dsc$descriptor_s *,
+ struct dsc$descriptor_d *,
+ int,
+ char **,
+ unsigned int *,
+ unsigned int *);
+static unsigned int check_cli( struct dsc$descriptor_s *);
\f
-unsigned long
+unsigned int
vms_unzip_cmdline (int *argc_p, char ***argv_p)
{
/*
**
** Function:
**
-** Parse the DCL command line and create a fake argv array to be
-** handed off to Zip.
+** Parse the DCL command line and create a replacement argv array
+** to be passed to UnZip.
**
** NOTE: the argv[] is built as we go, so all the parameters are
** checked in the appropriate order!!
** SS$_INSFMEM - A malloc() or realloc() failed
** SS$_ABORT - Bad time value
**
+** Modified to work with the get_option() command line parser. 08 July 2010
+**
*/
- register unsigned long status;
- char options[256];
- char *the_cmd_line; /* buffer for argv strings */
- unsigned long cmdl_size; /* allocated size of buffer */
- unsigned long cmdl_len; /* used size of buffer */
+ char *opt;
char *ptr;
- int x, len, zipinfo, exclude_list;
- int restore_date;
-
- int new_argc;
- char **new_argv;
-
- struct dsc$descriptor_d work_str;
- struct dsc$descriptor_d foreign_cmdline;
- struct dsc$descriptor_d output_directory;
- struct dsc$descriptor_d password_arg;
-
- init_dyndesc(work_str);
- init_dyndesc(foreign_cmdline);
- init_dyndesc(output_directory);
- init_dyndesc(password_arg);
+ char *the_cmd_line; /* buffer for argv strings */
+ unsigned int cmdl_size; /* allocated size of buffer */
+ unsigned int cmdl_len; /* used size of buffer */
+ unsigned int status;
+ int exclude_list;
+ int x;
+ int zipinfo;
+
+ int new_argc; /* Arg count for new arg vector. */
+ char **new_argv; /* New arg vector. */
+
+ DESCRIPTOR_D( work_str);
+ DESCRIPTOR_D( foreign_cmdline);
+ DESCRIPTOR_D( output_directory); /* Arg for /DIRECTORY = dir_name. */
+ DESCRIPTOR_D( junk_dirs_arg); /* Arg for /JUNK_DIRS = level. */
+ DESCRIPTOR_D( password_arg); /* Arg for /PASSWORD = passwd. */
/*
** See if the program was invoked by the CLI (SET COMMAND) or by
(*(foreign_cmdline.dsc$a_pointer) == '"') &&
(*(foreign_cmdline.dsc$a_pointer + 1) == '-'))) {
show_VMSCLI_usage = FALSE;
- return (SS$_NORMAL);
+ return SS$_NORMAL;
}
-
str$concat(&work_str, &unzip_command, &foreign_cmdline);
status = cli$dcl_parse(&work_str, &vms_unzip_cld, lib$get_input,
lib$get_input, 0);
- if (!(status & 1)) return (status);
+ if (!(status & 1)) return status;
}
/*
- ** There's always going to be a new_argv[] because of the image name.
- */
+ * There will always be a new_argv[] because of the image name.
+ */
if ((the_cmd_line = (char *) malloc(cmdl_size = ARGBSIZE_UNIT)) == NULL)
- return (SS$_INSFMEM);
+ return SS$_INSFMEM;
+
+#define UNZIP_COMMAND_NAME "unzip"
- strcpy(the_cmd_line, "unzip");
- cmdl_len = sizeof("unzip");
+ strcpy( the_cmd_line, UNZIP_COMMAND_NAME);
+ cmdl_len = sizeof( UNZIP_COMMAND_NAME);
/*
- ** First, check to see if any of the regular options were specified.
- */
+ * UnZip or ZipInfo?
+ */
+ zipinfo = 0;
+ status = cli$present( &cli_zipinfo);
+ if (status & 1)
+ {
+ /* ZipInfo ("unzip -Z"). */
+ zipinfo = 1;
+ /* Put out "-Z" option first. */
+#define IPT__Z "-Z" /* "-Z" ZipInfo. */
+ ADD_ARG( IPT__Z);
+ }
+ else
+ {
+ /* UnZip (normal). */
+ /* Process special qualifiers (those with deferred or no
+ * new-command-line activity).
+ */
+
+ /*
+ * Extract destination directory (-d).
+ */
+ status = cli$present( &cli_directory);
+ if (status == CLI$_PRESENT)
+ {
+ /* /DIRECTORY = destination_dir */
+ status = cli$get_value( &cli_directory, &output_directory);
+ }
+
+ /*
+ * Decryption password from command line.
+ */
+ status = cli$present( &cli_password);
+ if (status == CLI$_PRESENT)
+ {
+ /* /PASSWORD = passwd */
+ status = cli$get_value( &cli_password, &password_arg);
+ }
+ } /* ZipInfo [else] */
+
+ /* Process options common to UnZip and ZipInfo. */
- options[0] = '-';
- ptr = &options[1]; /* Point to temporary buffer */
+ /* Process special qualifiers (those with deferred or no
+ * new-command-line activity).
+ */
/*
- ** Is it ZipInfo??
+ ** Check existence of a list of files to exclude, fetch is done later.
*/
- zipinfo = 0;
- status = cli$present(&cli_information);
- if (status & 1) {
+ status = cli$present(&cli_exclude);
+ exclude_list = ((status & 1) != 0);
- zipinfo = 1;
+ /*
+ * Verbose command-line translation.
+ */
+ status = cli$present( &cli_verbose_command);
+ if (status & 1)
+ {
+ /* /VERBOSE = COMMAND */
+ verbose_command = 1;
+ }
- *ptr++ = 'Z';
-
- if (cli$present(&cli_one_line) & 1)
- *ptr++ = '2';
- if (cli$present(&cli_short) & 1)
- *ptr++ = 's';
- if (cli$present(&cli_medium) & 1)
- *ptr++ = 'm';
- if (cli$present(&cli_long) & 1)
- *ptr++ = 'l';
- if (cli$present(&cli_verbose) & 1)
- *ptr++ = 'v';
- if (cli$present(&cli_header) & 1)
- *ptr++ = 'h';
- if (cli$present(&cli_comment) & 1)
- *ptr++ = 'c';
- if (cli$present(&cli_totals) & 1)
- *ptr++ = 't';
- if (cli$present(&cli_times) & 1)
- *ptr++ = 'T';
+ /*
+ * Member name matching:
+ * Case-sensitivity (-C), and
+ * Wildcards match directory slash (-W-).
+ */
+#define OPT__C "-C" /* "-C" Case-blind matching. */
+#define OPT__CN "-C-" /* "" Case-sensitive matching (default). */
+#define OPT__W "-W" /* "-W" Wildcards stop at dir slash. */
+#define OPT__WN "-W-" /* "" Wildcards match dir slash (dflt). */
+
+ status = cli$present( &cli_match_case);
+ if (status & 1)
+ {
+ status = cli$present( &cli_match_case_blind);
+ if (status & 1)
+ {
+ /* /MATCH = CASE = BLIND */
+ opt = OPT__C;
+ }
+ else
+ {
+ /* /MATCH = CASE = SENSITIVE */
+ opt = OPT__CN;
+ }
+ ADD_ARG( opt);
+ }
+
+ /* Deprecated.
+ * Filename matching case-sensitivity (-C)
+ * Clear any existing "-C" option with "-C-", then add
+ * the desired "C" value.
+ */
+ status = cli$present( &cli_case_insensitive);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOCASE_INSENSITIVE */
+ opt = OPT__CN;
+ }
+ else
+ {
+ /* /CASE_INSENSITIVE */
+ opt = OPT__C;
+ }
+ ADD_ARG( opt);
}
- else {
-#if 0
- /*
- ** Extract files?
- */
- status = cli$present(&cli_extract);
+#ifdef WILD_STOP_AT_DIR
+ status = cli$present( &cli_match_wild);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'x';
-#endif
+ {
+ /* /MATCH = NOWILD_MATCH_SLASH */
+ opt = OPT__W;
+ }
+ else
+ {
+ /* /MATCH = WILD_MATCH_SLASH */
+ opt = OPT__WN;
+ }
+ ADD_ARG( opt);
+ }
+#endif /* def WILD_STOP_AT_DIR */
+
+ /*
+ * Use built-in ("more") pager for all screen output.
+ * Clear any existing "-M" option with "-M-", then add
+ * the desired "M" value.
+ */
+#define OPT__M "-M-M" /* "-M" Use built-in "more" pager. */
+#define OPT__MN "-M-" /* "" Use no built-in pager (default). */
+
+ status = cli$present( &cli_page);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOPAGE */
+ opt = OPT__MN;
+ }
+ else
+ {
+ /* /PAGE */
+ opt = OPT__M;
+ }
+ ADD_ARG( opt);
+ }
+
+ /*
+ * Display (only) the archive comment.
+ * Clear any existing "-z" option with "-z-", then add
+ * the desired "z" value.
+ */
+#define OPT_Z "-z-z" /* "-z" Display the comment (only). */
+#define OPT_ZN "-z-" /* "" Don't display the comment (only). */
+
+ status = cli$present( &cli_comment);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOCOMMENT */
+ opt = OPT_ZN;
+ }
+ else
+ {
+ /* /COMMENT */
+ opt = OPT_Z;
+ }
+ ADD_ARG( opt);
+ }
+
+ if (zipinfo == 0)
+ {
+ /* UnZip (normal) options. */
/*
- ** Write binary files in VMS binary (fixed-length, 512-byte records,
- ** record attributes: none) format
- ** (auto-convert, or force to convert all files)
- */
- status = cli$present(&cli_binary);
- if (status != CLI$_ABSENT) {
- *ptr++ = '-';
- *ptr++ = '-';
- *ptr++ = 'b';
- if ((status & 1) &&
- !((status = cli$present(&cli_binary_none)) & 1)) {
- *ptr++ = 'b';
- if ((status = cli$present(&cli_binary_all)) & 1)
- *ptr++ = 'b';
+ * Convert files as text (CR LF -> LF, etc.)
+ * Clear any existing "-a[a]" options with "-a-a-", then add
+ * the desired "a" and/or "S" value(s).
+ */
+#define OPT_A "-a-a-a" /* "-a" auto-convert text files. */
+#define OPT_AA "-a-a-aa" /* "-aa" convert all files as text. */
+#define OPT_AN "-a-a-" /* "" convert no files as text. */
+
+#define OPT__S "-S" /* "-S" Use Stream_LF for text files. */
+
+ status = cli$present( &cli_text);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOTEXT */
+ opt = OPT_AN;
+ }
+ else
+ {
+ /* /TEXT */
+ status = cli$present( &cli_text_none);
+ if (status & 1)
+ {
+ /* /TEXT = NONE */
+ opt = OPT_AN;
+ }
+ else
+ {
+ status = cli$present( &cli_text_all);
+ if (status & 1)
+ {
+ /* /TEXT = ALL */
+ opt = OPT_AA;
+ }
+ else
+ {
+ /* /TEXT or /TEXT = AUTO */
+ opt = OPT_A;
+ }
+ }
+ }
+ ADD_ARG( opt);
+
+ status = cli$present( &cli_text_stmlf);
+ if (status & 1)
+ {
+ /* /TEXT = STMLF */
+ ADD_ARG( OPT__S);
}
}
/*
- ** Convert files as text (CR LF -> LF, etc.)
- ** (auto-convert, or force to convert all files)
- */
- status = cli$present(&cli_text);
- if (status != CLI$_ABSENT) {
- *ptr++ = '-';
- *ptr++ = '-';
- *ptr++ = 'a';
- if ((status & 1) &&
- !((status = cli$present(&cli_text_none)) & 1)) {
- *ptr++ = 'a';
- if ((status = cli$present(&cli_text_all)) & 1)
- *ptr++ = 'a';
- if ((status = cli$present(&cli_text_stmlf)) & 1)
- *ptr++ = 'S';
+ * Write binary files in VMS binary (fixed-length, 512-byte
+ * records, record attributes: none) format.
+ * Clear any existing "-b[b]" options with "-b-b-", then add
+ * the desired "b" value.
+ */
+#define OPT_B "-b-b-b" /* "-b" Fixed-512 for binary files. */
+#define OPT_BB "-b-b-bb" /* "-bb" Fixed-512 for all files. */
+#define OPT_BN "-b-b-" /* "" Fixed-512 for no files. */
+
+ status = cli$present( &cli_binary);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOBINARY */
+ opt = OPT_BN;
}
+ else
+ {
+ /* /BINARY */
+ status = cli$present( &cli_binary_none);
+ if (status & 1)
+ {
+ /* /BINARY = NONE */
+ opt = OPT_BN;
+ }
+ else
+ {
+ status = cli$present( &cli_binary_all);
+ if (status & 1)
+ {
+ /* /BINARY = ALL */
+ opt = OPT_BB;
+ }
+ else
+ {
+ /* /BINARY or /BINARY = AUTO */
+ opt = OPT_B;
+ }
+ }
+ }
+ ADD_ARG( opt);
}
/*
- ** Extract files to screen?
- */
- status = cli$present(&cli_screen);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'c';
+ * Extract files to screen/stdout.
+ * Clear any existing "-c" option with "-c-", then add
+ * the desired "c" value.
+ */
+#define OPT_C "-c-c" /* "-c" Extract to screen/stdout. */
+#define OPT_CN "-c-" /* "" Extract to files (default). */
+
+ status = cli$present( &cli_screen);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOSCREEN */
+ opt = OPT_CN;
+ }
+ else
+ {
+ /* /SCREEN */
+ opt = OPT_C;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Re-create directory structure? (default)
- */
- status = cli$present(&cli_directory);
- if (status == CLI$_PRESENT) {
- status = cli$get_value(&cli_directory, &output_directory);
+ * Restore file/directory date-times.
+ * Clear any existing "-D[D]" options with "-D-D-", then add
+ * the desired "D" value. Note that on VMS, D_flag=1 ("-D") is
+ * the default.
+ */
+#define OPT__D "-D-D-DD" /* "-D" Restore no date-times. */
+#define OPT__DD "-D-D-D" /* "" Restore only file date-times. */
+#define OPT__DN "-D-D-" /* "-D-" Restore file and dir date-times. */
+
+ status = cli$present( &cli_restore_date);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /RESTORE = NODATE */
+ opt = OPT__D;
+ }
+ else
+ {
+ /* /RESTORE = DATE */
+ status = cli$present(&cli_restore_date_all);
+ if (status & 1)
+ {
+ /* /RESTORE = (DATE = ALL) */
+ opt = OPT__DN;
+ }
+ else
+ {
+ /* /RESTORE = (DATE = FILES) */
+ opt = OPT__DD;
+ }
+ }
+ ADD_ARG( opt);
+ }
+
+ /* Automatic destination directory.
+ * Add the desired "-da[-]" value.
+ */
+#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. */
+
+ status = cli$present( &cli_auto_dir);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOAUTO_DIRECTORY */
+ opt = OPT_DAN;
+ }
+ else
+ {
+ status = cli$present( &cli_auto_dir_reuse);
+ if (status & 1)
+ {
+ /* /AUTO_DIRECTORY=REUSE */
+ opt = OPT_DAR;
+ }
+ else
+ {
+ /* /AUTO_DIRECTORY */
+ opt = OPT_DA;
+ }
+ }
+ ADD_ARG( opt);
+ }
+
+ /* Freshen existing files, create none.
+ * Clear any existing "-f" option with "-f-", then add
+ * the desired "f" value.
+ */
+#define OPT_F "-f-f" /* "-f" Freshen existing files, create none. */
+#define OPT_FN "-f-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_freshen);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOFRESHEN */
+ opt = OPT_FN;
+ }
+ else
+ {
+ /* /FRESHEN */
+ opt = OPT_F;
+ }
+ ADD_ARG( opt);
}
/*
- ** Restore directory date-times.
- */
- restore_date = 0;
- status = cli$present(&cli_restore_date);
- if (status != CLI$_ABSENT) {
- /* Emit "----D" to reset the timestamp restore state "D_flag"
- ** consistently to 0 (independent of optional environment
- ** option settings).
- */
- *ptr++ = '-';
- *ptr++ = '-';
- *ptr++ = '-';
- *ptr++ = 'D';
- if (status == CLI$_NEGATED) {
- /* /RESTORE=NODATE */
- restore_date = 2;
- } else {
- status = cli$present(&cli_restore_date_all);
- if (status == CLI$_PRESENT) {
- /* /RESTORE=(DATE=ALL) */
- restore_date = 0;
- } else {
- /* /RESTORE=(DATE=FILES) (default) */
- restore_date = 1;
+ * Help.
+ * "-h" is not negatable, so simply put out the the desired "h" value.
+ */
+#define OPT_H "-h" /* "-h" Normal help. */
+#define OPT_HH "-hh" /* "-hh" Extended help. */
+
+ status = cli$present( &cli_help);
+ if (status & 1)
+ {
+ status = cli$present( &cli_help_extended);
+ if (status & 1)
+ {
+ /* /HELP = EXTENDED */
+ opt = OPT_HH;
+ }
+ else
+ {
+ /* /HELP = NORMAL */
+ opt = OPT_H;
+ }
+ ADD_ARG( opt);
+ }
+
+ /*
+ * Junk stored directory names when extracting.
+ * Specify an explict "-j=N" value to override any existing "j"
+ * value.
+ */
+#define J0 "0" /* "-j=0" Junk no directory names (default). */
+#define JM1 "-1" /* "-j=-1" Junk all directory names. */
+#define OPT_JE "-j=" /* "-j=N" Junk "N" directory names. */
+
+ status = cli$present( &cli_junk_dirs);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ char *jdp;
+ int jdl;
+
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOJUNK_DIRS */
+ jdp = J0;
+ jdl = sizeof( J0)- 1;
+ }
+ else
+ {
+ /* /JUNK_DIRS */
+ status = cli$get_value( &cli_junk_dirs, &junk_dirs_arg);
+ if (junk_dirs_arg.dsc$w_length == 0)
+ {
+ /* If no value was specified, use "-1" (all). */
+ jdp = JM1;
+ jdl = sizeof( JM1)- 1;
+ }
+ else
+ {
+ jdp = junk_dirs_arg.dsc$a_pointer;
+ jdl = junk_dirs_arg.dsc$w_length;
}
}
- /* Emit the required number of (positive) "D" characters. */
- while (restore_date > 0) {
- *ptr++ = 'D';
- restore_date--;
+ x = cmdl_len;
+ cmdl_len += sizeof( OPT_JE)+ jdl;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_JE);
+ strncpy( &the_cmd_line[ x+ sizeof( OPT_JE)- 1], jdp, jdl);
+ the_cmd_line[ cmdl_len- 1] = '\0';
+ }
+
+ /*
+ * Process archive as Java JAR.
+ */
+#define OPT_JAR "--jar" /* "--jar" Process as Java JAR. */
+#define OPT_JARN "--jar-" /* "--jar-" Process normally. */
+
+ status = cli$present( &cli_jar);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOJAR */
+ opt = OPT_JARN;
}
+ else
+ {
+ /* /JAR */
+ opt = OPT_JAR;
+ }
+ ADD_ARG( opt);
}
/*
- ** Freshen existing files, create none
- */
- status = cli$present(&cli_freshen);
+ * Restore protection info.
+ * Clear any existing "-k" option with "-k-k-k", then add
+ * the desired "k" value.
+ */
+#define OPT_K "-k-k-k" /* "" Restore (limited) perms (dflt). */
+#define OPT_KK "-k-k-kk" /* "-k" Restore archive permissions. */
+#define OPT_KN "-k-k-" /* "-k-" Restore no permissions. */
+
+ opt = NULL;
+ status = cli$present( &cli_restore_prot);
if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'f';
+ {
+ /* /RESTORE = NOPROTECTION */
+ opt = OPT_KN;
+ }
+ else
+ {
+ status = cli$present( &cli_restore_prot_lim);
+ if (status & 1)
+ {
+ /* /RESTORE = PROTECTION = LIMITED */
+ opt = OPT_K;
+ }
+ status = cli$present( &cli_restore_prot_orig);
+ if (status & 1)
+ {
+ /* /RESTORE = PROTECTION = ORIGINAL */
+ opt = OPT_KK;
+ }
+ }
+ if (opt != NULL)
+ {
+ ADD_ARG( opt);
+ }
/*
- ** Show the help.
- */
- status = cli$present(&cli_help);
+ * Restore ACL.
+ */
+#define OPT_KA "-ka" /* "-ka" Restore ACL. */
+#define OPT_KAN "-ka-" /* "-ka-" Restore no ACL. */
+
+ opt = NULL;
+ status = cli$present( &cli_restore_acl);
if (status & 1)
- *ptr++ = 'h';
+ {
+ /* /RESTORE = ACL */
+ opt = OPT_KA;
+ }
+ else if (status == CLI$_NEGATED)
+ {
+ /* /RESTORE = NOACL */
+ opt = OPT_KAN;
+ }
+ if (opt != NULL)
+ {
+ ADD_ARG( opt);
+ }
/*
- ** Junk stored directory names on unzip
- */
- status = cli$present(&cli_junk);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'j';
+ * List archive contents (/BRIEF (default) or /FULL).
+ * Clear any existing "-l" option with "-l-", then add
+ * the desired "l" value.
+ */
+#define OPT_L "-l-l" /* "-l" List archive contents. */
+#define OPT_LV "-l-lv" /* "-lv" List archive contents /FULL. */
+#define OPT_LVV "-l-lvv" /* "-lvv" List archive contents /FULL=DIAG. */
+#define OPT_LN "-l-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_list);
+ if (status & 1)
+ {
+ opt = OPT_L;
+ if (cli$present( &cli_full) & 1)
+ {
+ opt = OPT_LV;
+ if (cli$present( &cli_full_diags) & 1)
+ {
+ opt = OPT_LVV;
+ }
+ }
+ ADD_ARG( opt);
+ }
/*
- ** List contents (/BRIEF (default) or /FULL)
- */
- status = cli$present(&cli_list);
- if (status & 1) {
- if (cli$present(&cli_full) & 1) {
- *ptr++ = 'v';
- if (cli$present(&cli_full_diags) & 1)
- *ptr++ = 'v';
- } else
- *ptr++ = 'l';
+ * Show license text.
+ */
+#define OPT_LI "--license" /* "--license Show license text. */
+
+ status = cli$present( &cli_license);
+ if (status & 1)
+ {
+ ADD_ARG( OPT_LI);
}
/*
- ** Existing files: new version, overwrite, no extract?
- */
- status = cli$present(&cli_exist_newver);
- if (status == CLI$_PRESENT) {
- *ptr++ = 'o';
+ * Deprecated. Use /NAMES = [NO]DOWNCASE.
+ * Make (some) names lowercase.
+ * Clear any existing "-L" option with "-L-L-", then add
+ * the desired "L" value.
+ */
+#define OPT__L "-L-L-L" /* "-L" Downcase (some) names. */
+#define OPT__LL "-L-L-LL" /* "-LL" Downcase all names. */
+#define OPT__LN "-L-L-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_lowercase);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOLOWERCASE */
+ opt = OPT__LN;
+ }
+ else
+ {
+ /* /LOWERCASE */
+ opt = OPT__L;
+ }
+ ADD_ARG( opt);
}
- status = cli$present(&cli_exist_over);
- if (status == CLI$_PRESENT) {
- *ptr++ = 'o';
- *ptr++ = 'o';
+
+ /*
+ * Deprecated. Use /NAMES = [NO]DOWNCASE.
+ * Uppercase (don't convert to lower case).
+ * Clear any existing "-L" option with "-L-L-", then add
+ * the desired "L" value.
+ */
+ status = cli$present( &cli_uppercase);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOUPPERCASE */
+ opt = OPT__L;
+ }
+ else
+ {
+ /* /UPPERCASE */
+ opt = OPT__LN;
+ }
+ ADD_ARG( opt);
}
- status = cli$present(&cli_exist_noext);
- if (status == CLI$_PRESENT) {
- *ptr++ = 'n';
+
+ /*
+ * Existing files: new version, overwrite, no extract?
+ * Clear any existing "-n" or "-o" option with "-n-o-o-", then
+ * add the desired "-n"/"-o[o]" value.
+ */
+#define OPT_N "-n-o-o-n" /* "-n" Never overwrite (NOEXTRACT). */
+#define OPT_O "-n-o-o-o" /* "-o" Create new version (NEW_VERSION). */
+#define OPT_OO "-n-o-o-oo" /* "-oo" Overwrite (OVERWRITE). */
+#define OPT_ON "-n-o-o-" /* "" Normal inquiry (default). */
+
+ status = cli$present( &cli_existing);
+ if (status & 1)
+ {
+ status = cli$present( &cli_exist_newver);
+ if (status == CLI$_PRESENT)
+ {
+ opt = OPT_O;
+ }
+ else
+ {
+ status = cli$present( &cli_exist_over);
+ if (status == CLI$_PRESENT)
+ {
+ opt = OPT_OO;
+ }
+ else
+ {
+ status = cli$present( &cli_exist_noext);
+ if (status == CLI$_PRESENT)
+ {
+ opt = OPT_N;
+ }
+ }
+ }
+ ADD_ARG( opt);
}
/*
- ** Overwrite files (deprecated) ?
- */
- status = cli$present(&cli_overwrite);
- if (status == CLI$_NEGATED)
- *ptr++ = 'n';
- else if (status != CLI$_ABSENT)
- *ptr++ = 'o';
+ * Overwrite files (deprecated).
+ * Clear any existing "-n" or "-o" option with "-n-o-o-", then
+ * add the desired "-n"/"-o[o]" value.
+ */
+ status = cli$present( &cli_overwrite);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOOVERWRITE */
+ opt = OPT_N;
+ }
+ else
+ {
+ /* /OVERWRITE */
+ opt = OPT_O;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Decryption password from command line?
- */
- status = cli$present(&cli_password);
- if (status == CLI$_PRESENT) {
- status = cli$get_value(&cli_password, &password_arg);
+ * Transform names.
+ * Convert names to ODS2 restrictions.
+ * Convert spaces in names to underscores.
+ * Clear any existing "-2"/"-s" option with "-2-"/"-s-", then
+ * add the desired "2"/"s" value.
+ */
+#define OPT_2 "-2-2" /* "-2" Convert names to ODS2. */
+#define OPT_2N "-2-" /* "" Normal extract (default). */
+#define OPT_S "-s-s" /* "-s" Convert spaces. */
+#define OPT_SN "-s-" /* "" Preserve spaces (default). */
+
+ status = cli$present( &cli_names_nodown);
+ if (status & 1)
+ {
+ /* /NAMES = NODOWNCASE */
+ ADD_ARG( OPT__LN);
+ }
+ else
+ {
+ status = cli$present( &cli_names_down);
+ if (status & 1)
+ {
+ status = cli$present( &cli_names_down_all);
+ if (status & 1)
+ {
+ /* /NAMES = DOWNCASE = ALL */
+ opt = OPT__LL;
+ }
+ else
+ {
+ /* /NAMES = DOWNCASE = SOME */
+ opt = OPT__L;
+ }
+ ADD_ARG( opt);
+ }
+ }
+
+ status = cli$present( &cli_names_ods2);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NAMES = NOODS2 */
+ opt = OPT_2N;
+ }
+ else
+ {
+ /* /NAMES = ODS2 */
+ opt = OPT_2;
+ }
+ ADD_ARG( opt);
+ }
+
+ status = cli$present( &cli_names_spaces);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NAMES = NOSPACES */
+ opt = OPT_S;
+ }
+ else
+ {
+ /* /NAMES = SPACES */
+ opt = OPT_SN;
+ }
+ ADD_ARG( opt);
}
/*
- ** Pipe files to SYS$OUTPUT with no informationals?
- */
- status = cli$present(&cli_pipe);
- if (status != CLI$_ABSENT)
- *ptr++ = 'p';
+ * Force conversion of extracted file names to ODS2 conventions.
+ * Clear any existing "-2" option with "-2-", then add
+ * the desired "2" value.
+ */
+
+ status = cli$present( &cli_ods2);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOODS2 */
+ opt = OPT_2N;
+ }
+ else
+ {
+ /* /ODS2 */
+ opt = OPT_2;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Quiet
- */
- status = cli$present(&cli_quiet);
- if (status & 1) {
- *ptr++ = 'q';
- if ((status = cli$present(&cli_super_quiet)) & 1)
- *ptr++ = 'q';
+ * Pipe files to SYS$OUTPUT (stdout) with no informationals.
+ * Clear any existing "-p" option with "-p-", then add
+ * the desired "p" value.
+ */
+#define OPT_P "-p-p" /* "-p" Pipe files to stdout. */
+#define OPT_PN "-p-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_pipe);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /PIPE */
+ opt = OPT_P;
+ }
+ else
+ {
+ /* /NOPIPE */
+ opt = OPT_P;
+ }
+ ADD_ARG( opt);
}
/*
- ** Test archive integrity
- */
- status = cli$present(&cli_test);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 't';
+ * Quiet.
+ * Clear any existing "-q" option with "-q-q-", then add
+ * the desired "q" value.
+ */
+#define OPT_Q "-q-q-q-q-q" /* "-q" Quiet (NORMAL). */
+#define OPT_QQ "-q-q-q-q-qq" /* "-qq" Quiet (SUPER). */
+#define OPT_QN "-q-q-q-q-" /* "" Normal noisiness (default). */
+
+ status = cli$present( &cli_quiet);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOQUIET */
+ opt = OPT_QN;
+ }
+ else
+ {
+ status = cli$present( &cli_super_quiet);
+ if (status & 1)
+ {
+ /* /QUIET = SUPER */
+ opt = OPT_QQ;
+ }
+ else
+ {
+ /* /QUIET = NORMAL */
+ opt = OPT_Q;
+ }
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Set archive timestamp according to its newest file.
- */
- status = cli$present(&cli_timestamp);
+ * Test archive integrity.
+ * Clear any existing "-t" option with "-t-", then add
+ * the desired "t" value.
+ */
+#define OPT_T "-t-t" /* "-t" Test archive integrity. */
+#define OPT_TN "-t-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_test);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOTEST */
+ opt = OPT_TN;
+ }
+ else
+ {
+ /* /TEST */
+ opt = OPT_T;
+ }
+ ADD_ARG( opt);
+ }
+
+ /*
+ * Set archive timestamp according to its newest file.
+ * Clear any existing "-T" option with "-T-", then add
+ * the desired "T" value.
+ */
+#define OPT__T "-T-T" /* "-T" Set archive timestamp. */
+#define OPT__TN "-T-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_timestamp);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOTIMESTAMP */
+ opt = OPT__TN;
+ }
+ else
+ {
+ /* /TIMESTAMP */
+ opt = OPT__T;
+ }
+ ADD_ARG( opt);
+ }
+
+ /*
+ * Update (extract only new and newer files).
+ * Clear any existing "-u" option with "-u-", then add
+ * the desired "u" value.
+ */
+#define OPT_U "-u-u" /* "-u" Update (extract new and newer). */
+#define OPT_UN "-u-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_update);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOUPDATE */
+ opt = OPT_UN;
+ }
+ else
+ {
+ /* /UPDATE */
+ opt = OPT_U;
+ }
+ ADD_ARG( opt);
+ }
+
+ /*
+ * Verbose/version ("-v" report).
+ * Clear any existing "-v" options with "-v-v-", then add
+ * the desired "v" value.
+ */
+#define OPT_V "-v-v-v" /* "-v" Verbose (normal). */
+#define OPT_VV "-v-v-vv" /* "-vv" Verbose (more). */
+#define OPT_VN "-v-v-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_noverbose);
if (status & 1)
- *ptr++ = 'T';
+ {
+ /* /NOVERBOSE */
+ ADD_ARG( OPT_VN);
+ }
+
+ status = cli$present( &cli_verbose_normal);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOVERBOSE (?) */
+ opt = OPT_VN;
+ }
+ else
+ {
+ /* /VERBOSE = NORMAL */
+ opt = OPT_V;
+ }
+ ADD_ARG( opt);
+ }
+
+ status = cli$present( &cli_verbose_more);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOVERBOSE (?) */
+ opt = OPT_VN;
+ }
+ else
+ {
+ /* /VERBOSE = MORE */
+ opt = OPT_VV;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Extract "foo.ext.###" as "foo.ext;###" (treat .### as version number)
- */
- status = cli$present(&cli_dot_version);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'Y';
+ * Version (retain VMS/DEC-20 file versions).
+ * Clear any existing "-V" option with "-V-", then add
+ * the desired "V" value.
+ */
+#define OPT__V "-V-V" /* "-V" Extract files with versions. */
+#define OPT__VN "-V-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_version);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOVERSION */
+ opt = OPT__VN;
+ }
+ else
+ {
+ /* /VERSION */
+ opt = OPT__V;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Force conversion of extracted file names to old ODS2 conventions
- */
- status = cli$present(&cli_ods2);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = '2';
+ * Restore owner (UIC) info.
+ */
+#define OPT__X "-X" /* "-X" Restore owner (UIC). */
+#define OPT__XN "-X-" /* "-X-" Restore no owner (UIC). */
+
+ opt = NULL;
+ status = cli$present( &cli_restore_own);
+ if (status & 1)
+ {
+ /* /RESTORE = OWNER*/
+ opt = OPT__X;
+ }
+ else if (status == CLI$_NEGATED)
+ {
+ /* /RESTORE = NOOWNER*/
+ opt = OPT__XN;
+ }
+ if (opt != NULL)
+ {
+ ADD_ARG( opt);
+ }
/*
- ** Traverse directories (don't skip "../" path components)
- */
- status = cli$present(&cli_traverse);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = ':';
+ * Treat trailing ".###" as version number.
+ * (Extract "name.type.###" as "nane.type;###".)
+ * Clear any existing "-Y" option with "-Y-", then add
+ * the desired "Y" value.
+ */
+#define OPT__Y "-Y-Y" /* "-Y" Treat ".###" as version number. */
+#define OPT__YN "-Y-" /* "" Normal extract (default). */
+
+ status = cli$present( &cli_dot_version);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NODOT_VERSION */
+ opt = OPT__YN;
+ }
+ else
+ {
+ /* /DOT_VERSION */
+ opt = OPT__Y;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Make (some) names lowercase
- */
- status = cli$present(&cli_lowercase);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'L';
+ * Traverse directories (don't skip "../" path components).
+ * Clear any existing "-:" option with "-:-", then add
+ * the desired ":" value.
+ */
+#define OPT_COL "-:-:" /* "-:" Follow "../" path components. */
+#define OPT_COLN "-:-" /* "" Ignore "../" components. (default). */
+
+ status = cli$present( &cli_traverse);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOTRAVERSE_DIRS */
+ opt = OPT_COLN;
+ }
+ else
+ {
+ /* /TRAVERSE_DIRS */
+ opt = OPT_COL;
+ }
+ ADD_ARG( opt);
+ }
+ }
+ else /* if (zipinfo == 0) */
+ {
+ /* ZipInfo options. */
/*
- ** Uppercase (don't convert to lower)
- */
- status = cli$present(&cli_uppercase);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'U';
+ * Show only file names, one per line (but allow /HEADER (-h),
+ * /TOTALS (-t), or /COMMENT (-z)).
+ * Clear any existing "-2" option with "-2-", then add
+ * the desired "2" value.
+ */
+#define IPT_2 "-2-2" /* "-2" Names-only format. */
+#define IPT_2N "-2-" /* "" Normal format (default). */
+
+ status = cli$present( &cli_one_line);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOONE_LINE */
+ opt = IPT_2N;
+ }
+ else
+ {
+ /* /ONE_LINE */
+ opt = IPT_2;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Update (extract only new and newer files)
- */
- status = cli$present(&cli_update);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'u';
+ * Put out header line.
+ * Clear any existing "-h" option with "-h-", then add
+ * the desired "h" value.
+ */
+#define IPT_H "-h-h" /* "-h" Put out header line. */
+#define IPT_HN "-h-" /* "" Omit header line (default). */
+
+ status = cli$present( &cli_header);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOHEADER */
+ opt = IPT_HN;
+ }
+ else
+ {
+ /* /HEADER */
+ opt = IPT_H;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Version (retain VMS/DEC-20 file versions)
- */
- status = cli$present(&cli_version);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'V';
+ * Long UNIX "ls -l" format.
+ * Clear any existing "-l" option with "-l-", then add
+ * the desired "l" value.
+ */
+#define IPT_L "-l-l" /* "-l" Long UNIX "ls -l" format. */
+#define IPT_LN "-l-" /* "" Normal format (default). */
+
+ status = cli$present( &cli_long);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOLONG */
+ opt = IPT_LN;
+ }
+ else
+ {
+ /* /LONG */
+ opt = IPT_L;
+ }
+ ADD_ARG( opt);
+ }
/*
- ** Restore owner/protection info
- */
- status = cli$present(&cli_restore_own);
- if (status != CLI$_ABSENT) {
- if (status == CLI$_NEGATED) {
- *ptr++ = '-';
- } else if ((status = cli$present(&cli_restore))
- == CLI$_NEGATED) {
- *ptr++ = '-';
+ * Medium UNIX "ls -l" format.
+ * Clear any existing "-m" option with "-m-", then add
+ * the desired "m" value.
+ */
+#define IPT_M "-m-m" /* "-m" Medium UNIX "ls -l" format. */
+#define IPT_MN "-m-" /* "" Normal format (default). */
+
+ status = cli$present( &cli_medium);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOMEDIUM */
+ opt = IPT_MN;
+ }
+ else
+ {
+ /* /MEDIUM */
+ opt = IPT_M;
}
- *ptr++ = 'X';
+ ADD_ARG( opt);
}
/*
- ** Display only the archive comment
- */
- status = cli$present(&cli_comment);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'z';
+ * Short UNIX "ls -l" format (default).
+ * Clear any existing "-s" option with "-s-", then add
+ * the desired "s" value.
+ */
+#define IPT_S "-s-s" /* "-s" Short UNIX "ls -l" format (deflt). */
+#define IPT_SN "-s-" /* "" Normal format (default). */
+
+ status = cli$present( &cli_short);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOSHORT */
+ opt = IPT_SN;
+ }
+ else
+ {
+ /* /SHORT */
+ opt = IPT_S;
+ }
+ ADD_ARG( opt);
+ }
- } /* ZipInfo check way up there.... */
+ /*
+ * Put out member counts, directories/files/links.
+ */
+#define IPT_MC "-mc" /* "-mc" Put out member counts (default). */
+#define IPT_MCN "-mc-" /* "-mc-" Omit member counts. */
+
+ status = cli$present( &cli_member_counts);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOMEMBER_COUNTS */
+ opt = IPT_MCN;
+ }
+ else
+ {
+ /* /MEMBER_COUNTS */
+ opt = IPT_MC;
+ }
+ ADD_ARG( opt);
+ }
- /* The following options are common to both UnZip and ZipInfo mode. */
+ /*
+ * Put out totals summary.
+ * Clear any existing "-t" option with "-t-", then add
+ * the desired "t" value.
+ */
+#define IPT_T "-t-t" /* "-t" Put out totals summary. */
+#define IPT_TN "-t-" /* "" Omit totals summary (default). */
+
+ status = cli$present( &cli_totals);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOTOTALS */
+ opt = IPT_TN;
+ }
+ else
+ {
+ /* /TOTALS */
+ opt = IPT_T;
+ }
+ ADD_ARG( opt);
+ }
- /*
- ** Match filenames case-insensitively (-C)
- */
- status = cli$present(&cli_case_insensitive);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'C';
+ /*
+ * Put out date-times as sortable decimal values.
+ * Clear any existing "-T" option with "-T-", then add
+ * the desired "T" value.
+ */
+#define IPT__T "-T-T" /* "-T" Put out sortable date-times. */
+#define IPT__TN "-T-" /* "" Put out normal date-times (deflt). */
+
+ status = cli$present( &cli_decimal_time);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NODECIMAL_TIME */
+ opt = IPT__TN;
+ }
+ else
+ {
+ /* /DECIMAL_TIME */
+ opt = IPT__T;
+ }
+ ADD_ARG( opt);
+ }
- /*
- ** Use builtin pager for all screen output
- */
- status = cli$present(&cli_page);
- if (status == CLI$_NEGATED)
- *ptr++ = '-';
- if (status != CLI$_ABSENT)
- *ptr++ = 'M';
+ status = cli$present( &cli_times);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOTIMES (deprecated) */
+ opt = IPT__TN;
+ }
+ else
+ {
+ /* /TIMES (deprecated) */
+ opt = IPT__T;
+ }
+ ADD_ARG( opt);
+ }
- /*
- ** Check existence of a list of files to exclude, fetch is done later.
- */
- status = cli$present(&cli_exclude);
- exclude_list = ((status & 1) != 0);
+ /*
+ * Verbose, multi-page format.
+ * Clear any existing "-v" option with "-v-", then add
+ * the desired "v" value.
+ */
+#define IPT_V "-v-v" /* "-v" Verbose, multi-page format. */
+#define IPT_VN "-v-" /* "" Normal format (default). */
+
+ status = cli$present( &cli_noverbose);
+ if (status & 1)
+ {
+ /* /NOVERBOSE */
+ ADD_ARG( IPT_VN);
+ }
- /*
- ** If the user didn't give any DCL qualifier, assume he wants the
- ** Un*x interface.
- if ( (ptr == &options[1]) &&
- (output_directory.dsc$w_length == 0) &&
- (password_arg.dsc$w_length == 0) &&
- (!exclude_list) ) {
- free(the_cmd_line);
- return (SS$_NORMAL);
- }
- */
+ status = cli$present( &cli_verbose_normal);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ if (status == CLI$_NEGATED)
+ {
+ /* /NOVERBOSE (?) */
+ opt = IPT_VN;
+ }
+ else
+ {
+ /* /VERBOSE */
+ opt = IPT_V;
+ }
+ ADD_ARG( opt);
+ }
- /*
- ** Now copy the final options string to the_cmd_line.
- */
- len = ptr - &options[0];
- if (len > 1) {
- options[len] = '\0';
- x = cmdl_len;
- cmdl_len += len + 1;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], options);
- }
+ } /* if (zipinfo == 0) [else] */
/*
** If specified, add the decryption password argument.
strncpy(&the_cmd_line[x], work_str.dsc$a_pointer,
work_str.dsc$w_length);
the_cmd_line[cmdl_len-1] = '\0';
-
}
/*
- ** Get the output directory, for UnZip.
+ ** Get the output directory (-d), for UnZip.
**/
if (output_directory.dsc$w_length != 0) {
x = cmdl_len;
if (status & 1) {
status = get_list(&cli_infile, &foreign_cmdline, '\0',
&the_cmd_line, &cmdl_size, &cmdl_len);
- if (!(status & 1)) return (status);
+ if (!(status & 1)) return status;
}
/*
status = get_list(&cli_exclude, &foreign_cmdline, '\0',
&the_cmd_line, &cmdl_size, &cmdl_len);
- if (!(status & 1)) return (status);
+ if (!(status & 1)) return status;
}
/*
** release unused space.
*/
if ((the_cmd_line = (char *) realloc(the_cmd_line, cmdl_len)) == NULL)
- return (SS$_INSFMEM);
+ return SS$_INSFMEM;
/*
** Now that we've built our new UNIX-like command line, count the
** is supposed to be NULL, so allocate enough for new_argc+1.
*/
if ((new_argv = (char **) calloc(new_argc+1, sizeof(char *))) == NULL)
- return (SS$_INSFMEM);
+ return SS$_INSFMEM;
/*
** For each option, store the address in new_argv[] and convert the
}
new_argv[new_argc] = NULL;
-#if defined(TEST) || defined(DEBUG)
- printf("new_argc = %d\n", new_argc);
- for (x = 0; x < new_argc; x++)
- printf("new_argv[%d] = %s\n", x, new_argv[x]);
-#endif /* TEST || DEBUG */
+ /* Show the complete UNIX command line, if requested. */
+ if (verbose_command != 0)
+ {
+ printf( " UNIX command line args (argc = %d):\n", new_argc);
+ for (x = 0; x < new_argc; x++)
+ printf( "%s\n", new_argv[ x]);
+ printf( "\n");
+ }
/*
** All finished. Return the new argc and argv[] addresses to Zip.
*argc_p = new_argc;
*argv_p = new_argv;
- return (SS$_NORMAL);
+ return SS$_NORMAL;
}
\f
-static unsigned long
+static unsigned int
get_list (struct dsc$descriptor_s *qual, struct dsc$descriptor_d *rawtail,
- int delim, char **p_str, unsigned long *p_size, unsigned long *p_end)
+ int delim, char **p_str, unsigned int *p_size, unsigned int *p_end)
{
/*
** Routine: get_list
**
*/
- register unsigned long status;
- struct dsc$descriptor_d work_str;
-
- init_dyndesc(work_str);
+ unsigned int status;
+ DESCRIPTOR_D( work_str);
status = cli$present(qual);
if (status & 1) {
- unsigned long len, old_len;
- long ind, sind;
+ unsigned int len;
+ unsigned int old_len;
+ int ind;
+ int sind;
int keep_case;
char *src, *dst; int x;
if (*p_str == NULL) {
*p_size = ARGBSIZE_UNIT;
if ((*p_str = (char *) malloc(*p_size)) == NULL)
- return (SS$_INSFMEM);
+ return SS$_INSFMEM;
len = 0;
} else {
len = *p_end;
}
*p_end = len;
}
-
- return (SS$_NORMAL);
-
+ return SS$_NORMAL;
}
\f
-static unsigned long
+static unsigned int
check_cli (struct dsc$descriptor_s *qual)
{
/*
**
*/
lib$establish(lib$sig_to_ret); /* Establish condition handler */
- return (cli$present(qual)); /* Just see if something was given */
+ return cli$present(qual); /* Just see if something was given */
}
\f
#ifndef TEST
-#ifdef SFX
-
-#ifdef SFX_EXDIR
-# define SFXOPT_EXDIR "\n and /DIRECTORY=exdir-spec"
-#else
-# define SFXOPT_EXDIR ""
-#endif
-
-#ifdef MORE
-# define SFXOPT1 "/PAGE, "
-#else
-# define SFXOPT1 ""
-#endif
int VMSCLI_usage(__GPRO__ int error) /* returns PK-type error code */
{
+# ifdef SFX
+
+ /* UnZipSFX Usage Guide. */
+
extern ZCONST char UnzipSFXBanner[];
-#ifdef BETA
+# ifdef BETA
extern ZCONST char BetaVersion[];
-#endif
+# endif
int flag;
if (!show_VMSCLI_usage)
flag = (error? 1 : 0);
Info(slide, flag, ((char *)slide, UnzipSFXBanner,
- UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL, UZ_VERSION_DATE));
+ UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL, UZ_VERSION_DATE));
+
+ Info(slide, flag, ((char *)slide, "\
+\n\
+Usage: MCR %s -\n\
+ [/unzip_qualifiers] [member [,...]]\n\
+", G.zipfn));
+
+/* 2012-12-28 SMS.
+ * See same-date note below. ("/DIRECTORY=dir, ")
+ */
+# ifdef SFX_EXDIR
+ Info(slide, flag, ((char *)slide, "\
+\n\
+Primary mode SFX qualifiers:\n\
+ /COMMENT, /FRESHEN, /LICENSE, /PIPE, /SCREEN, /TEST, /UPDATE\n\
+General SFX qualifiers:\n\
+ /[NO]BINARY[=ALL|AUTO|NONE], /DIRECTORY=dir, /DOT_VERSION,\n\
+ /EXCLUDE=(member [,...]), /EXISTING={NEW_VERSION|OVERWRITE|NOEXTRACT},\n\
+"
+));
+# else /* def SFX_EXDIR */
Info(slide, flag, ((char *)slide, "\
-Valid main options are /TEST, /FRESHEN, /UPDATE, /PIPE, /SCREEN, /COMMENT%s.\n",
- SFXOPT_EXDIR));
+\n\
+Primary mode SFX qualifiers:\n\
+ /COMMENT, /FRESHEN, /LICENSE, /PIPE, /SCREEN, /TEST, /UPDATE\n\
+General SFX qualifiers:\n\
+ /[NO]BINARY[=ALL|AUTO|NONE], /DOT_VERSION,\n\
+ /EXCLUDE=(member [,...]), /EXISTING={NEW_VERSION|OVERWRITE|NOEXTRACT},\n\
+"
+));
+# endif /* def SFX_EXDIR [else] */
+
+ Info(slide, flag, ((char *)slide,
+# ifdef WILD_STOP_AT_DIR
+"\
+ /JAR, /MATCH=(CASE={BLIND|SENSITIVE}, [NO]WILD_MATCH_SLASH),\n\
+%s\n",
+# else /* def WILD_STOP_AT_DIR */
+"\
+ /JAR, /MATCH=(CASE={BLIND|SENSITIVE}),\n\
+%s\n",
+# endif /* def WILD_STOP_AT_DIR [else] */
+"\
+ /[NO]JUNK_DIRS[=level], /NAMES=[[NO]DOWNCASE]|[[NO]ODS2]|[NO]SPACES],\n\
+"));
+
+/* 2012-12-28 SMS.
+ * See same-date note below.
+ */
+# ifdef MORE
Info(slide, flag, ((char *)slide, "\
-Modifying options are /TEXT, /BINARY, /JUNK, /EXISTING, /QUIET,\n\
- /CASE_INSENSITIVE, /LOWERCASE, %s/VERSION, /RESTORE.\n",
- SFXOPT1));
-#ifdef BETA
+ /[NO]PAGE, /PASSWORD=passwd, /QUIET[=SUPER],\n\
+ /RESTORE=([NO]ACL, [NO]DATE=[ALL|FILES], [NO]OWNER,\n\
+ [NO]PROTECTION=[LIMITED|ORIGINAL]),\n\
+ /[NO]TEXT[=([ALL|AUTO|NONE], STMLF)], /[NO]TRAVERSE_DIRS, /VERSION\n\
+\n\
+Quote member names if /MATCH=CASE=SENSITIVE (default). For details, see\n\
+UnZip documentation. For more options, use an external (full-featured)\n\
+UnZip program instead of this built-in (limited) UnZipSFX self-extractor.\n\
+"
+));
+# else /* def MORE */
+ Info(slide, flag, ((char *)slide, "\
+ %s/PASSWORD=passwd, /QUIET[=SUPER],\n\
+ /RESTORE=([NO]ACL, [NO]DATE=[ALL|FILES], [NO]OWNER,\n\
+ [NO]PROTECTION=[LIMITED|ORIGINAL]),\n\
+ /[NO]TEXT[=([ALL|AUTO|NONE], STMLF)], /[NO]TRAVERSE_DIRS, /VERSION\n\
+\n\
+Quote member names if /MATCH=CASE=SENSITIVE (default). For details, see\n\
+UnZip documentation. For more options, use an external (full-featured)\n\
+UnZip program instead of this built-in (limited) UnZipSFX self-extractor.\n\
+"
+));
+# endif /* def MORE [else] */
+
+# ifdef BETA
Info(slide, flag, ((char *)slide, BetaVersion, "\n", "SFX"));
-#endif
+# endif
if (error)
return PK_PARAM;
else
return PK_COOL; /* just wanted usage screen: no error */
-} /* end function VMSCLI_usage() */
-
+# else /* def SFX */
-#else /* !SFX */
+ /* Normal UnZip or ZipInfo Usage Guide. */
-int VMSCLI_usage(__GPRO__ int error) /* returns PK-type error code */
-{
extern ZCONST char UnzipUsageLine1[];
-#ifdef BETA
+# ifdef BETA
extern ZCONST char BetaVersion[];
-#endif
+# endif
int flag;
if (!show_VMSCLI_usage)
flag = (error? 1 : 0);
-
/*---------------------------------------------------------------------------
Print either ZipInfo usage or UnZip usage, depending on incantation.
---------------------------------------------------------------------------*/
if (uO.zipinfo_mode) {
-#ifndef NO_ZIPINFO
+# ifndef NO_ZIPINFO
+
+ /* ZipInfo Usage guide. */
Info(slide, flag, ((char *)slide, "\
-ZipInfo %d.%d%d%s %s, by Newtware and the fine folks at Info-ZIP.\n\n\
-List name, date/time, attribute, size, compression method, etc., about files\n\
-in list (excluding those in xlist) contained in the specified .zip archive(s).\
-\n\"file[.zip]\" may be a wildcard name containing * or %% (e.g., \"*font-%%\
-.zip\").\n", ZI_MAJORVER, ZI_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
- UZ_VERSION_DATE));
+ZipInfo %d.%d%d%s %s, by Newtware and the fine folks at Info-ZIP.\n\n",
+ ZI_MAJORVER, ZI_MINORVER,
+ UZ_PATCHLEVEL, UZ_BETALEVEL, UZ_VERSION_DATE));
Info(slide, flag, ((char *)slide, "\
- usage: zipinfo file[.zip] [list] [/EXCL=(xlist)] [/DIR=exdir] /options\n\
- or: unzip /ZIPINFO file[.zip] [list] [/EXCL=(xlist)] [/DIR=exdir] /options\
-\n\nmain\
- listing-format options: /SHORT short \"ls -l\" format (def.)\n\
- /ONE_LINE just filenames, one/line /MEDIUM medium Unix \"ls -l\" format\n\
- /VERBOSE verbose, multi-page format /LONG long Unix \"ls -l\" format\n\
+Usage: ZIPINFO [/zipinfo_qualifiers] [file[.zip]] [member [,...]]\n\
+ or: UNZIP /ZIPINFO [/zipinfo_qualifiers] [file[.zip]] [member [,...]]\n\
+\n\
+ Report archive (\"file.zip\") and member properties (name, date-time,\n\
+ compression and/or encryption method, and so on).\n\
+\n\
+Primary listing-format qualifiers:\n\
+ /LONG long Unix \"ls -l\" format /ONE_LINE filenames only, one/line\n\
+ /MEDIUM medium Unix \"ls -l\" format /SHORT short \"ls -l\" format (default.)\n\
+ /VERBOSE verbose, very detailed format\n\n\
"));
Info(slide, flag, ((char *)slide, "\
-miscellaneous options:\n \
-/HEADER print header line /TOTALS totals for listed files or for all\n\
- /COMMENT print zipfile comment /TIMES times in sortable decimal format\n\
- /[NO]CASE_INSENSITIVE match filenames case-insensitively\n\
- /[NO]PAGE page output through built-in \"more\"\n\
- /EXCLUDE=(file-spec1,etc.) exclude file-specs from listing\n"));
+General qualifiers:\n\
+ /COMMENT include archive comment /DECIMAL_TIME sortable dec'l time format\n\
+ /EXCLUDE=(member [,...]) exclude members from listing\n\
+ /HEADER include header /PAGE page output through built-in \"more\"\n\
+%s\
+%s",
+# ifdef WILD_STOP_AT_DIR
+ "\
+ /MATCH=(CASE={BLIND|SENSITIVE}, [NO]WILD_MATCH_SLASH) member name matching\n\
+",
+# else /* def WILD_STOP_AT_DIR */
+ "\
+ /MATCH=(CASE={BLIND|SENSITIVE}) member name matching\n\
+",
+# endif /* def WILD_STOP_AT_DIR [else] */
+ "\
+ /TOTALS include totals trailer for listed files\n\
+"));
Info(slide, flag, ((char *)slide, "\n\
-Type unzip \"-Z\" for Unix style flags\n\
-Remember that non-lowercase filespecs must be\
- quoted in VMS (e.g., \"Makefile\").\n"));
+Type 'unzip \"-Z\"' for Unix-style usage guide.\n\
+Quote member names if /MATCH=CASE=SENSITIVE (default).\n\
+"));
-#endif /* !NO_ZIPINFO */
+# endif /* ndef NO_ZIPINFO */
} else { /* UnZip mode */
+ /* Normal UnZip Usage Guide. */
+
Info(slide, flag, ((char *)slide, UnzipUsageLine1,
UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
UZ_VERSION_DATE));
-#ifdef BETA
+# ifdef BETA
Info(slide, flag, ((char *)slide, BetaVersion, "", ""));
-#endif
+# endif
Info(slide, flag, ((char *)slide, "\
-Usage: unzip file[.zip] [list] [/EXCL=(xlist)] [/DIR=exdir] /options /modifiers\
-\n Default action is to extract files in list, except those in xlist, to exdir\
-;\n file[.zip] may be a wildcard. %s\n\n",
-#ifdef NO_ZIPINFO
- "(ZipInfo mode is disabled in this version.)"
-#else
- "Type \"unzip /ZIPINFO\" for ZipInfo-mode usage."
-#endif
- ));
+Usage: UNZIP [/unzip_qualifiers] [file[.zip]] [member [,...]]\n\
+ Default action is to extract specified (or all) members from file.zip\n\
+%s\n",
+# ifdef NO_ZIPINFO
+ " (ZipInfo mode is disabled in this version.)"
+# else
+ " Do \"UNZIP /ZIPINFO\" for ZipInfo-mode usage."
+# endif
+));
Info(slide, flag, ((char *)slide, "\
-Major options include (type unzip -h for Unix style flags):\n\
- /[NO]TEST, /LIST, /[NO]SCREEN, /PIPE, /[NO]FRESHEN, /[NO]UPDATE,\n\
- /[NO]COMMENT, /DIRECTORY=directory-spec, /EXCLUDE=(file-spec1,etc.)\n\n\
-Modifiers include:\n\
- /BRIEF, /FULL, /[NO]TEXT[=NONE|AUTO|ALL], /[NO]BINARY[=NONE|AUTO|ALL],\n\
- /EXISTING={NEW_VERSION|OVERWRITE|NOEXTRACT}, /[NO]JUNK, /QUIET,\n\
- /QUIET[=SUPER], /[NO]PAGE, /[NO]CASE_INSENSITIVE, /[NO]LOWERCASE,\n\
- /[NO]VERSION, /RESTORE[=([NO]OWNER_PROT[,NODATE|DATE={ALL|FILES}])]\n\n"));
+Primary mode qualifiers (Do \"unzip -h\" for Unix-style options):\n\
+ /COMMENT, /FRESHEN, /HELP[=EXTENDED], /LICENSE, /LIST, /PIPE, /SCREEN,\n\
+ /TEST, /TIMESTAMP, /UPDATE, /VERBOSE\n\
+General qualifiers:\n\
+ /[NO]AUTO_DIRECTORY, /[NO]BINARY[=ALL|AUTO|NONE], /DIRECTORY=dir,\n\
+ /DOT_VERSION, /[NO]BINARY[=ALL|AUTO|NONE], /DIRECTORY=dir, /DOT_VERSION,\n\
+ /EXCLUDE=(member [,...]), /EXISTING={NEW_VERSION|OVERWRITE|NOEXTRACT},\n\
+"));
+
+ Info(slide, flag, ((char *)slide,
+# ifdef WILD_STOP_AT_DIR
+ "\
+ /JAR, /MATCH=(CASE={BLIND|SENSITIVE}, [NO]WILD_MATCH_SLASH),\n\
+%s\n",
+# else /* def WILD_STOP_AT_DIR */
+ "\
+ /JAR, /MATCH=(CASE={BLIND|SENSITIVE}),\n\
+%s",
+# endif /* def WILD_STOP_AT_DIR [else] */
+ "\
+ /[NO]JUNK_DIRS[=level], /NAMES=[[NO]DOWNCASE]|[[NO]ODS2]|[NO]SPACES],\n\
+"));
+
+/* 2012-12-28 SMS.
+ * Had attempted to use a "%s" for "/[NO]PAGE, " (or ""), conditional on
+ * MORE, to combine the following into one statement, but DEC C
+ * V4.0-000 was confused by the #ifdef within the argument list for
+ * Info(), which is already a macro (unzpriv.h), causing a (spurious)
+ * %CC-E-BADIFDEF.
+ */
+# ifdef MORE
+ Info(slide, flag, ((char *)slide, "\
+ /[NO]PAGE, /PASSWORD=passwd, /QUIET[=SUPER],\n\
+ /RESTORE=([NO]ACL, [NO]DATE=[ALL|FILES], [NO]OWNER,\n\
+ [NO]PROTECTION=[LIMITED|ORIGINAL]),\n\
+ /[NO]TEXT[=([ALL|AUTO|NONE], STMLF)], /[NO]TRAVERSE_DIRS, /VERBOSE, /VERSION\n\
+"));
+# else /* def MORE */
+ Info(slide, flag, ((char *)slide, "\
+ /PASSWORD=passwd, /QUIET[=SUPER],\n\
+ /RESTORE=([NO]ACL, [NO]DATE=[ALL|FILES], [NO]OWNER,\n\
+ [NO]PROTECTION=[LIMITED|ORIGINAL]),\n\
+ /[NO]TEXT[=([ALL|AUTO|NONE], STMLF)], /[NO]TRAVERSE_DIRS, /VERBOSE, /VERSION\n\
+"));
+# endif /* def MORE [else] */
Info(slide, flag, ((char *)slide, "\
Examples (see unzip.txt or \"HELP UNZIP\" for more info):\n\
- unzip edit1 /EXCL=joe.jou /CASE_INSENSITIVE => Extract all files except\
+ unzip edit1 /EXCL=joe.jou /MATCH = CASE=BLIND => Extract all files except\
\n\
joe.jou (or JOE.JOU, or any combination of case) from zipfile edit1.zip.\
\n \
unzip zip201 \"Makefile.VMS\" vms/*.[ch] => extract VMS Makefile and\
\n\
- *.c and *.h files; must quote uppercase names if /CASE_INSENS not used.\
+ *.c and *.h files. Quote member names if /MATCH=CASE=SENS (default).\
\n\
unzip foo /DIR=tmp:[.test] /JUNK /TEXT /EXIS=NEW => extract all files to\
\n\
} /* end if (zipinfo_mode) */
if (error)
+ {
+ show_env( __G__ 1);
return PK_PARAM;
+ }
else
return PK_COOL; /* just wanted usage screen: no error */
+# endif /* def SFX [else] */
+
} /* end function VMSCLI_usage() */
-#endif /* ?SFX */
-#endif /* !TEST */
+#endif /* ndef TEST */
+
+\f
+#ifdef TEST
+int
+main( int argc, char **argv)
+{
+ return vms_unzip_cmdline( &argc, &argv);
+}
+#endif /* def TEST */
+
-$! 1 December 2006. SMS.
+$! COLLECT_DEPS.COM
$!
-$! Info-ZIP VMS accessory procedure.
+$! Info-ZIP VMS procedure to collect MMS/MMK dependencies.
+$!
+$! Last revised: 2013-11-29
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 2004-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
$!
$! For the product named by P1,
-$! collect all source file dependencies specified by P3,
-$! and add P4 prefix.
-$! Convert absolute dependencies to relative from one level above P5.
$! P2 = output file specification.
+$! Collect all source file dependencies specified by P3,
+$! and add P4 prefix to the object file.
+$! Convert absolute dependencies to relative from one level above P5.
+$! P6 = slash-delimited search vector for added .IFDEF conditions.
+$! P7 = slash-delimited macro vector for added .IFDEF conditions.
$!
$! MMS /EXTENDED_SYNTAX can't easily pass a macro invocation for P4, so
$! we remove any internal spaces which might have been added to prevent
$!
$ incl_macro = "INCL_"+ f$parse( p2, , , "NAME", "SYNTAX_ONLY")
$ write deps_out "#"
-$ write deps_out "# ''p1' for VMS - MMS (or MMK) Source Dependency File."
+$ write deps_out "# ''p1' - MMS (or MMK) Source Dependency File."
$ write deps_out "#"
$ write deps_out ""
$ write deps_out -
$ if (file .eqs. "") then goto loop_main_end
$!
$ open /read /error = end_subs deps_in 'file'
+$ cond = ""
$ loop_subs_top:
$ read /error = loop_subs_end deps_in line
$ line_reduced = f$edit( line, "COMPRESS, TRIM, UPCASE")
$ back = f$extract( (colon+ 3+ f$length( dev_dir_lose)), -
1000, line_reduced)
$ line = front+ "["+ back
+$!
+$! Add .IFDEF conditions according to P6+P7.
+$!
+$ elt = 0
+$ cond_new = ""
+$ loop_elt_top:
+$ elt_str = f$element( elt, "/", p6)
+$ if (elt_str .eqs. "/") then goto loop_elt_end
+$ if (f$locate( elt_str, line) .lt. f$length( line))
+$ then
+$! Found search target.
+$ cond_new = f$element( elt, "/", p7)
+$ goto loop_elt_end
+$ endif
+$ elt = elt+ 1
+$ goto loop_elt_top
+$ loop_elt_end:
+$!
+$ if (cond_new .nes. "")
+$ then
+$ if (cond_new .nes. cond)
+$ then
+$ if (cond .nes. "")
+$ then
+$ write deps_out ".ENDIF # ''cond'"
+$ cond = ""
+$ endif
+$ write deps_out ".IFDEF ''cond_new'"
+$ cond = cond_new
+$ endif
+$ else
+$ if (cond .nes. "")
+$ then
+$ write deps_out ".ENDIF # ''cond'"
+$ cond = ""
+$ endif
+$ endif
+$!
+$ write deps_out "''prefix'"+ "''line'"
$ endif
-$ write deps_out "''prefix'"+ "''line'"
$ goto loop_subs_top
-$!
$ loop_subs_end:
+$!
+$ if (cond .nes. "")
+$ then
+$ write deps_out ".ENDIF # ''cond'"
+$ endif
+$!
$ close deps_in
$!
$ goto loop_main_top
-$!
$ loop_main_end:
+$!
$ close deps_out
$!
$ end_main:
--- /dev/null
+$! CPPCLD.COM
+$!
+$! Info-ZIP VMS procedure to use a C preprocessor on a .CLD file.
+$!
+$! Last revised: 2013-11-29 SMS.
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 2012-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
+$!
+$! P1 = CC command
+$! P2 = Command definition input file (".CLD") with CPP directives.
+$! P3 = Command definition output file.
+$! P4 = Comma-separated list of C macros.
+$!
+$!
+$ cpp = f$edit( p1, "trim")
+$ if (cpp .eqs. "")
+$ then
+$ cpp = "cc"
+$ endif
+$!
+$! C preprocessing.
+$!
+$ 'cpp' /preprocess_only = 'p3' 'p2' /define = ('p4') /undefine = (VMS)
+$!
+$! Strip out the added file indentification line.
+$!
+$ line_nr = 0
+$ open /read /error = error_r in_file 'p3'
+$ create /fdl = sys$input 'p3'
+RECORD
+ Carriage_Control carriage_return
+ Format stream_lf
+$!
+$ open /append /error = error_w out_file 'p3'
+$ loop_top:
+$ read /error = error_c in_file line
+$ if ((line_nr .ne. 0) .or. (f$extract( 0, 1, line) .nes. "#"))
+$ then
+$ write /error = error_c out_file line
+$ endif
+$ line_nr = 1
+$ goto loop_top
+$!
+$ error_c:
+$ close out_file
+$ error_w:
+$ close in_file
+$ error_r:
+$!
! TITLE CVTHELP.TPU
-! IDENT 01-001
+! IDENT 01-003
!
!++
-! Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
+! Copyright (c) 1990-2013 Info-ZIP. All rights reserved.
!
-! See the accompanying file LICENSE, version 2000-Apr-09 or later
-! (the contents of which are also included in zip.h) for terms of use.
-! If, for some reason, all these files are missing, the Info-ZIP license
-! also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+! 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. If,
+! for some reason, all these files are missing, the Info-ZIP license
+! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
!
!++
!
!
! Modified by:
!
+! 01-003 Steven Schweda 29-NOV-2013
+! Updated copyright, license.
+!
+! 01-002 Steven Schweda 1-OCT-2012 23:53
+! Added <LITERALW> and <WLARETIL> for wide literals
+! (too wide for indentation).
+!
! 01-001 Hunter Goatley 7-FEB-2001 15:40
! Added <NEXT> for qualifier separators.
!
hg$substitute_comment(current_buffer,"<INIT>",".noflags;.lm3;.rm70");
hg$substitute_comment(current_buffer,"<LITERAL>",".lm+4;.literal");
hg$substitute_comment(current_buffer,"<LARETIL>",".end literal;.lm-4");
+ hg$substitute_comment(current_buffer,"<LITERALW>",".literal");
+ hg$substitute_comment(current_buffer,"<WLARETIL>",".end literal");
hg$substitute_comment(current_buffer,"<DOT1LIST>",'.list 1,"o"');
hg$substitute_comment(current_buffer,"<DOT0LIST>",'.list 0,"o"');
hg$substitute_comment(current_buffer,"<ENTRY>",".le");
-# 1 March 2009. SMS.
+# DESCRIP.MMS
#
-# UnZip 6.0 for VMS - MMS (or MMK) Description File.
+# UnZip 6.1 for VMS - MMS (or MMK) Description File.
+#
+# Last revised: 2013-11-29
+#
+#----------------------------------------------------------------------
+# Copyright (c) 2001-2013 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. If,
+# for some reason, all these files are missing, the Info-ZIP license
+# may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#----------------------------------------------------------------------
#
# Usage:
#
#
# Optional macros:
#
-# USEBZ2=1 Build with optional BZIP2 support. This macro
-# is a shortcut for IZ_BZIP2=SYS$DISK:[.BZIP2].
-# Additionally, it forces invokation of the UnZip-supplied
-# bzip2 make script provided in [.bzip2]descrbz2.mms.
-# This results in a "single-command" build of UnZip with
-# bzip2 support directly from the sources.
+# AES_WG=1 Enable AES_WG encryption support. By default, the
+# SFX programs are built without AES_WG support. Add
+# "CRYPT_AES_WG_SFX=1" to the LOCAL_UNZIP C macros to
+# enable it. (See LOCAL_UNZIP, below.)
+#
+# CCOPTS=xxx Compile with CC options xxx. For example:
+# CCOPTS=/ARCH=HOST
+#
+# DBG=1 Compile /DEBUG /NOOPTIMIZE. Link /DEBUG /TRACEBACK.
+# TRC=1 Default is /NOTRACEBACK, but TRC=1 enables link with
+# /TRACEBACK without compiling for debug.
#
# IZ_BZIP2=dev:[dir] Build with optional BZIP2 support. The value
# of the MMS macro, ("dev:[dir]", or a suitable
# BZIP2 object library (LIBBZ2_NS.OLB) is expected to
# be in a "[.dest]" directory under that one
# ("dev:[dir.ALPHAL]", for example), or in that
-# directory itself.
+# directory itself. See also USEBZ2=1, below.)
# By default, the SFX programs are built without BZIP2
# support. Add "BZIP2_SFX=1" to the LOCAL_UNZIP C
# macros to enable it. (See LOCAL_UNZIP, below.)
# ("dev:[dir.ALPHAL]", for example), or in that
# directory itself.
#
-# CCOPTS=xxx Compile with CC options xxx. For example:
-# CCOPTS=/ARCH=HOST
-#
-# DBG=1 Compile with /DEBUG /NOOPTIMIZE.
-# Link with /DEBUG /TRACEBACK.
-# (Default is /NOTRACEBACK.)
-#
# LARGE=1 Enable large-file (>2GB) support. Non-VAX only.
#
+# LIBUNZIP=1 Build LIBIZUNZIP.OLB as a callable UnZip library.
+#
# LINKOPTS=xxx Link with LINK options xxx. For example:
# LINKOPTS=/NOINFO
#
# LIST=1 Compile with /LIST /SHOW = (ALL, NOMESSAGES).
# Link with /MAP /CROSS_REFERENCE /FULL.
#
+# "LOCAL_UNZIP= c_macro_1=value1 [, c_macro_2=value2 [...]]"
+# Compile with these additional C macros defined. For
+# example:
+# "LOCAL_UNZIP=NO_EXCEPT_SIGNALS=1, NO_SYMLINKS=1"
+#
+# LZMA=1 Enable LZMA compression support. By default, the
+# SFX programs are built without LZMA support. Add
+# "LZMA_SFX=1" to the LOCAL_UNZIP C macros to enable
+# it. (See LOCAL_UNZIP, above.)
+#
# NOSHARE=1 Link /NOSYSSHR (not using shareable images).
# NOSHARE=OLDVAX Link /NOSYSSHR on VAX for:
# DEC C with VMS before V7.3.
# VAX C without DEC C RTL (DEC C not installed).
#
-# "LOCAL_UNZIP= c_macro_1=value1 [, c_macro_2=value2 [...]]"
-# Compile with these additional C macros defined.
+# PPMD=1 Enable PPMd compression support. By default, the
+# SFX programs are built without PPMd support. Add
+# "PPMD_SFX=1" to the LOCAL_UNZIP C macros to enable
+# it. (See LOCAL_UNZIP, above.)
+#
+# PROD=subdir Use [.subdir] as the destination for
+# architecture-specific product files (.EXE, .OBJ,
+# .OLB, and so on). The default is a name
+# automatically generated using rules defined in
+# [.VMS]DESCRIP_SRC.MMS. Note that using this option
+# carelessly can confound the CLEAN* targets.
+#
+# USEBZ2=1 Build with optional BZIP2 support. This macro
+# is a shortcut for IZ_BZIP2=SYS$DISK:[.BZIP2].
+# Additionally, it causes invocation of the
+# UnZip-supplied bzip2 builder, [.bzip2]descrbz2.mms,
+# which should lead to a bzip2-enabled build of UnZip
+# directly from the sources.
#
# VAX-specific optional macros:
#
# CLEAN_EXE deletes only the architecture-specific executables.
# Handy if all you wish to do is re-link the executables.
#
+# CLEAN_OLB deletes only the architecture-specific object libraries.
+#
+# CLEAN_TEST deletes all test directories.
+#
+# DASHV generates an "unzip -v" report.
+#
+# HELP generates HELP library source files (.HLP).
+#
+# HELP_TEXT generates HELP output text files (.HTX).
+#
+# SLASHV generates an "unzip_cli /verbose" report.
+#
+# TEST runs a brief test.
+#
+# TEST_PPMD runs a brief PPMd test.
+#
# Example commands:
#
# To build the conventional small-file product using the DEC/Compaq/HP C
# MMS /DESCRIP = [.VMS] CLEAN
# MMS /DESCRIP = [.VMS] /MACRO = (DBG=1, LIST=1)
#
+#
+# Note that on a Unix system, LOCAL_UNZIP contains compiler
+# options, such as "-g" or "-DCRYPT_AES_WG_SFX", but on a VMS
+# system, LOCAL_UNZIP contains only C macros, such as
+# "CRYPT_AES_WG_SFX", and CCOPTS is used for any other kinds of
+# compiler options, such as "/ARCHITECTURE". Unix compilers accept
+# multiple "-D" options, but VMS compilers consider only the last
+# /DEFINE qualifier, so the C macros must be handled differently
+# from other compiler options on VMS. Thus, when using the generic
+# installation instructions as a guide for controlling various
+# optional features, some adjustment may be needed to adapt them to
+# a VMS build environment.
+#
########################################################################
+# Explicit suffix list. (Added .HTX before .HLB.)
+
+.SUFFIXES
+.SUFFIXES : .EXE .OLB .HTX .HLB .OBJ .C .CLD .MSG .HLP .RNH
+
# Include primary product description file.
INCL_DESCRIP_SRC = 1
# Object library names.
-LIB_UNZIP = SYS$DISK:[.$(DEST)]UNZIP.OLB
-LIB_UNZIP_CLI = SYS$DISK:[.$(DEST)]UNZIPCLI.OLB
-LIB_UNZIPSFX = SYS$DISK:[.$(DEST)]UNZIPSFX.OLB
-LIB_UNZIPSFX_CLI = SYS$DISK:[.$(DEST)]UNZSFXCLI.OLB
+LIB_UNZIP_NAME = UNZIP.OLB
+LIB_UNZIP_CLI_NAME = UNZIPCLI.OLB
+LIB_UNZIPSFX_NAME = UNZIPSFX.OLB
+LIB_UNZIPSFX_CLI_NAME = UNZSFXCLI.OLB
+.IFDEF LIBUNZIP # LIBUNZIP
+LIB_LIBUNZIP_NAME = LIBIZUNZIP.OLB
+.ENDIF # LIBUNZIP
-# Help file names.
+LIB_UNZIP = SYS$DISK:[.$(DEST)]$(LIB_UNZIP_NAME)
+LIB_UNZIP_CLI = SYS$DISK:[.$(DEST)]$(LIB_UNZIP_CLI_NAME)
+LIB_UNZIPSFX = SYS$DISK:[.$(DEST)]$(LIB_UNZIPSFX_NAME)
+LIB_UNZIPSFX_CLI = SYS$DISK:[.$(DEST)]$(LIB_UNZIPSFX_CLI_NAME)
+.IFDEF LIBUNZIP # LIBUNZIP
+LIB_LIBUNZIP = SYS$DISK:[.$(DEST)]$(LIB_LIBUNZIP_NAME)
+.ENDIF # LIBUNZIP
+
+# Help library source file names.
UNZIP_HELP = UNZIP.HLP UNZIP_CLI.HLP
+# Help output text file names.
+
+UNZIP_HELP_TEXT = UNZIP.HTX UNZIP_CLI.HTX
+
# Message file names.
UNZIP_MSG_MSG = [.VMS]UNZIP_MSG.MSG
UNZIP_MSG_EXE = [.$(DEST)]UNZIP_MSG.EXE
UNZIP_MSG_OBJ = [.$(DEST)]UNZIP_MSG.OBJ
+# Library link options file.
+
+.IFDEF LIBUNZIP # LIBUNZIP
+LIBUNZIP_OPT = [.$(DEST)]LIB_IZUNZIP.OPT
+.ENDIF # LIBUNZIP
# TARGETS.
# and help files.
ALL : $(UNZIP) $(UNZIP_CLI) $(UNZIPSFX) $(UNZIPSFX_CLI) $(UNZIP_HELP) \
- $(UNZIP_MSG_EXE)
+ $(UNZIP_MSG_EXE) $(LIB_LIBUNZIP) $(LIBUNZIP_OPT)
@ write sys$output "Done."
# CLEAN target. Delete the [.$(DEST)] directory and everything in it.
delete $(DEST).dir;*
# CLEAN_ALL target. Delete:
-# The [.$(DEST)] directories and everything in them.
+# The [.$(DEST)] directory and everything in it (CLEAN),
+# The standard [.$(DEST)] directories and everything in them,
# All help-related derived files,
-# All individual C dependency files.
+# All individual C dependency files,
+# All test_dir_* directories.
# Also mention:
# Comprehensive dependency file.
#
-CLEAN_ALL :
+CLEAN_ALL : CLEAN
if (f$search( "[.ALPHA*]*.*") .nes. "") then -
delete [.ALPHA*]*.*;*
if (f$search( "ALPHA*.dir", 1) .nes. "") then -
set protection = w:d VAX*.dir;*
if (f$search( "VAX*.dir", 2) .nes. "") then -
delete VAX*.dir;*
+ if (f$search( "help_temp_*.*") .nes. "") then -
+ delete help_temp_*.*;*
if (f$search( "[.VMS]UNZIP_CLI.RNH") .nes. "") then -
delete [.VMS]UNZIP_CLI.RNH;*
if (f$search( "UNZIP_CLI.HLP") .nes. "") then -
delete UNZIP_CLI.HLP;*
+ if (f$search( "UNZIP_CLI.HTX") .nes. "") then -
+ delete UNZIP_CLI.HTX;*
if (f$search( "UNZIP.HLP") .nes. "") then -
delete UNZIP.HLP;*
+ if (f$search( "UNZIP.HTX") .nes. "") then -
+ delete UNZIP.HTX;*
+ if (f$search( "test_dir_*.dir;*") .nes. "") then -
+ set protection = w:d [.test_dir_*...]*.*;*
+ if (f$search( "test_dir_*.dir;*") .nes. "") then -
+ set protection = w:d test_dir_*.dir;*
+ if (f$search( "[.test_dir_*.*]*.*") .nes. "") then -
+ delete [.test_dir_*.*]*.*;*
+ if (f$search( "[.test_dir_*]*.*") .nes. "") then -
+ delete [.test_dir_*]*.*;*
+ if (f$search( "test_dir_*.dir;*") .nes. "") then -
+ delete test_dir_*.dir;*
if (f$search( "*.MMSD") .nes. "") then -
delete *.MMSD;*
if (f$search( "[.VMS]*.MMSD") .nes. "") then -
"distribution kit.) See [.VMS]DESCRIP_MKDEPS.MMS for instructions on"
@ write sys$output -
"generating [.VMS]DESCRIP_DEPS.MMS."
- @ write sys$output ""
+ @ write sys$output ""
# CLEAN_EXE target. Delete the executables in [.$(DEST)].
CLEAN_EXE :
- if (f$search( "[.$(DEST)]*.EXE") .nes. "") then -
+ if (f$search( "[.$(DEST)]*.EXE") .nes. "") then -
delete [.$(DEST)]*.EXE;*
+# CLEAN_OLB target. Delete the object libraries in [.$(DEST)].
+
+CLEAN_OLB :
+ if (f$search( "[.$(DEST)]*.OLB") .nes. "") then -
+ delete [.$(DEST)]*.OLB;*
+
+# CLEAN_TEST target. Delete the test directories, [.test_dir_*...].
+
+CLEAN_TEST :
+ if (f$search( "test_dir_*.dir;*") .nes. "") then -
+ set protection = w:d [.test_dir_*...]*.*;*
+ if (f$search( "test_dir_*.dir;*") .nes. "") then -
+ set protection = w:d test_dir_*.dir;*
+ if (f$search( "[.test_dir_*.*]*.*") .nes. "") then -
+ delete [.test_dir_*.*]*.*;*
+ if (f$search( "[.test_dir_*]*.*") .nes. "") then -
+ delete [.test_dir_*]*.*;*
+ if (f$search( "test_dir_*.dir;*") .nes. "") then -
+ delete test_dir_*.dir;*
+
+# DASHV target. Generate an "unzip -v" report.
+
+DASHV :
+ mcr [.$(DEST)]unzip -v
+
+# HELP target. Generate the HELP library source files.
+
+HELP : $(UNZIP_HELP)
+ @ write sys$output "Done."
+
+# HELP_TEXT target. Generate the HELP output text files.
+
+HELP_TEXT : $(UNZIP_HELP_TEXT)
+ @ write sys$output "Done."
+
+# SLASHV target. Generate an "unzip_cli /verbose" report.
+
+SLASHV :
+ mcr [.$(DEST)]unzip_cli /verbose
+
+# TEST target. Runs a test procedure.
+
+TEST :
+ @[.vms]test_unzip.com testmake.zip [.$(DEST)]
+
+# TEST_PPMD target. Runs a PPMdtest procedure.
+
+TEST_PPMD :
+ @[.vms]test_unzip.com testmake_ppmd.zip [.$(DEST)] NOSFX
+
# Object library module dependencies.
$(LIB_UNZIPSFX_CLI) : $(LIB_UNZIPSFX_CLI)($(MODS_OBJS_LIB_UNZIPSFX_CLI))
@ write sys$output "$(MMS$TARGET) updated."
+.IFDEF LIBUNZIP # LIBUNZIP
+$(LIB_LIBUNZIP) : $(LIB_LIBUNZIP)($(MODS_OBJS_LIB_LIBUNZIP))
+ @ write sys$output "$(MMS$TARGET) updated."
+.ENDIF # LIBUNZIP
# Module ID options files.
-OPT_ID = SYS$DISK:[.VMS]UNZIP.OPT
-OPT_ID_SFX = SYS$DISK:[.VMS]UNZIPSFX.OPT
+OPT_ID = SYS$DISK:[.$(DEST)]UNZIP.OPT
+OPT_ID_SFX = SYS$DISK:[.$(DEST)]UNZIPSFX.OPT
# Default C compile rule.
.C.OBJ :
- $(CC) $(CFLAGS) $(CDEFS_UNX) $(MMS$SOURCE)
-
+ $(CC) $(CFLAGS) $(CDEFS_UNX) $(MMS$SOURCE)
# Normal sources in [.VMS].
[.$(DEST)]UNZIPCLI.OBJ : UNZIP.C
$(CC) $(CFLAGS) $(CDEFS_CLI) $(MMS$SOURCE)
-[.$(DEST)]UNZ_CLI.OBJ : [.VMS]UNZ_CLI.CLD
+[.$(DEST)]UNZ_CLI.OBJ : [.$(DEST)]UNZ_CLI.CLD
+
+[.$(DEST)]UNZ_CLI.CLD : [.VMS]UNZ_CLI.CLD
+ @[.vms]cppcld.com "$(CC) $(CFLAGS_ARCH)" -
+ $(MMS$SOURCE) $(MMS$TARGET) "$(CDEFS)"
+
+[.$(DEST)]ZIPINFO_C.OBJ : ZIPINFO.C
+ $(CC) $(CFLAGS) $(CDEFS_CLI) $(MMS$SOURCE)
# SFX variant sources.
[.$(DEST)]UNZSFXCLI.OBJ : UNZIP.C
$(CC) $(CFLAGS) $(CDEFS_SFX_CLI) $(MMS$SOURCE)
+# LIBUNZIP variant sources in [].
+
+[.$(DEST)]API_L.OBJ : API.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]APIHELP_L.OBJ : APIHELP.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]CRYPT_L.OBJ : CRYPT.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]EXPLODE_L.OBJ : EXPLODE.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]EXTRACT_L.OBJ : EXTRACT.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]FILEIO_L.OBJ : FILEIO.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]GLOBALS_L.OBJ : GLOBALS.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]INFLATE_L.OBJ : INFLATE.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]LIST_L.OBJ : LIST.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]PROCESS_L.OBJ : PROCESS.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]TTYIO_L.OBJ : TTYIO.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]UNSHRINK_L.OBJ : UNSHRINK.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]UBZ2ERR_L.OBJ : UBZ2ERR.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]UNZIP_L.OBJ : UNZIP.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+[.$(DEST)]ZIPINFO_L.OBJ : ZIPINFO.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
+# LIBUNZIP variant sources in [.VMS].
+
+[.$(DEST)]VMS_L.OBJ : [.VMS]VMS.C
+ $(CC) $(CFLAGS) $(CDEFS_LIBUNZIP) $(MMS$SOURCE)
+
# VAX C LINK options file.
.IFDEF OPT_FILE
$(OPT_FILE) :
- open /write opt_file_ln $(OPT_FILE)
+ open /write opt_file_ln $(OPT_FILE)
write opt_file_ln "SYS$SHARE:VAXCRTL.EXE /SHARE"
close opt_file_ln
.ENDIF
+# Module ID options files.
+
+$(OPT_ID) :
+ @[.vms]optgen.com UnZip iz_unzip_versn
+ open /write opt_file_ln $(OPT_ID)
+ write opt_file_ln "Ident = ""UnZip ''f$trnlnm( "iz_unzip_versn")'"""
+ close opt_file_ln
+
+$(OPT_ID_SFX) :
+ @[.vms]optgen.com UnZip iz_unzip_versn
+ open /write opt_file_ln $(OPT_ID_SFX)
+ write opt_file_ln "Ident = ""UnZipSFX ''f$trnlnm( "iz_unzip_versn")'"""
+ close opt_file_ln
+
# Local BZIP2 object library.
$(LIB_BZ2_LOCAL) :
$(NOSHARE_OPTS)
-# Help files.
+# Help library source files.
UNZIP.HLP : [.VMS]UNZIP_DEF.RNH
runoff /output = $(MMS$TARGET) $(MMS$SOURCE)
edit /tpu /nosection /nodisplay /command = [.VMS]CVTHELP.TPU -
$(MMS$SOURCE)
rename UNZIP_CLI.RNH [.VMS]
- purge /nolog /keep = 1 [.VMS]UNZIP_CLI.RNH
+ purge /nolog /keep = 1 [.VMS]UNZIP_CLI.RNH
runoff /output = $(MMS$TARGET) [.VMS]UNZIP_CLI.RNH
+# Help output text files.
+
+.HLP.HTX :
+ help_temp_name = "help_temp_"+ f$getjpi( 0, "PID")
+ if (f$search( help_temp_name+ ".HLB") .nes. "") then -
+ delete 'help_temp_name'.HLB;*
+ library /create /help 'help_temp_name'.HLB $(MMS$SOURCE)
+ help /library = sys$disk:[]'help_temp_name'.HLB -
+ /output = 'help_temp_name'.OUT unzip...
+ delete 'help_temp_name'.HLB;*
+ create /fdl = [.VMS]STREAM_LF.FDL $(MMS$TARGET)
+ open /append help_temp $(MMS$TARGET)
+ copy 'help_temp_name'.OUT help_temp
+ close help_temp
+ delete 'help_temp_name'.OUT;*
+
+UNZIP.HTX : UNZIP.HLP [.VMS]STREAM_LF.FDL
+
+UNZIP_CLI.HTX : UNZIP_CLI.HLP [.VMS]STREAM_LF.FDL
+
# Message file.
$(UNZIP_MSG_EXE) : $(UNZIP_MSG_OBJ)
- link /shareable = $(MMS$TARGET) $(UNZIP_MSG_OBJ)
+ link /shareable = $(MMS$TARGET) $(UNZIP_MSG_OBJ)
$(UNZIP_MSG_OBJ) : $(UNZIP_MSG_MSG)
- message /object = $(MMS$TARGET) /nosymbols $(UNZIP_MSG_MSG)
+ message /object = $(MMS$TARGET) /nosymbols $(UNZIP_MSG_MSG)
+
+# Library link options file.
+
+.IFDEF LIBUNZIP # LIBUNZIP
+$(LIBUNZIP_OPT) : [.VMS]STREAM_LF.FDL
+ def_dev_dir_orig = f$environment( "default")
+ set default [.$(DEST)]
+ def_dev_dir = f$environment( "default")
+ set default 'def_dev_dir_orig'
+ create /fdl = [.VMS]STREAM_LF.FDL $(MMS$TARGET)
+ open /append opt_file_lib $(MMS$TARGET)
+ write opt_file_lib "! DEFINE LIB_IZUNZIP ''def_dev_dir'"
+ if ("$(LIB_BZIP2_OPTS)" .nes. "") then -
+ write opt_file_lib "! DEFINE LIB_BZIP2 ''f$trnlnm( "lib_bzip2")'"
+ if ("$(LIB_ZLIB_OPTS)" .nes. "") then -
+ write opt_file_lib "! DEFINE LIB_ZLIB ''f$trnlnm( "lib_zlib")'"
+ write opt_file_lib "LIB_IZUNZIP:$(LIB_LIBUNZIP_NAME) /library"
+ if ("$(LIB_BZIP2_OPTS)" .nes. "") then -
+ write opt_file_lib "$(LIB_BZIP2_OPTS)" - ","
+ write opt_file_lib "LIB_IZUNZIP:$(LIB_LIBUNZIP_NAME) /library"
+ if ("$(LIB_ZLIB_OPTS)" .nes. "") then -
+ write opt_file_lib "$(LIB_ZLIB_OPTS)" - ","
+ close opt_file_lib
+.ENDIF # LIBUNZIP
# Include generated source dependencies.
+++ /dev/null
-#
-# UnZip for VMS - MMS (or MMK) Source Dependency File.
-#
-
-# This description file is included by other description files. It is
-# not intended to be used alone. Verify proper inclusion.
-
-.IFDEF INCL_DESCRIP_DEPS
-.ELSE
-$$$$ THIS DESCRIPTION FILE IS NOT INTENDED TO BE USED THIS WAY.
-.ENDIF
-
-[.$(DEST)]CRC32.OBJ : []CRC32.C
-[.$(DEST)]CRC32.OBJ : []ZIP.H
-[.$(DEST)]CRC32.OBJ : []UNZIP.H
-[.$(DEST)]CRC32.OBJ : []UNZPRIV.H
-[.$(DEST)]CRC32.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]CRC32.OBJ : []GLOBALS.H
-[.$(DEST)]CRC32.OBJ : []CRC32.H
-[.$(DEST)]CRC32_.OBJ : []CRC32.C
-[.$(DEST)]CRC32_.OBJ : []ZIP.H
-[.$(DEST)]CRC32_.OBJ : []UNZIP.H
-[.$(DEST)]CRC32_.OBJ : []UNZPRIV.H
-[.$(DEST)]CRC32_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]CRC32_.OBJ : []GLOBALS.H
-[.$(DEST)]CRC32_.OBJ : []CRC32.H
-[.$(DEST)]CRYPT.OBJ : []CRYPT.C
-[.$(DEST)]CRYPT.OBJ : []ZIP.H
-[.$(DEST)]CRYPT.OBJ : []UNZIP.H
-[.$(DEST)]CRYPT.OBJ : []UNZPRIV.H
-[.$(DEST)]CRYPT.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]CRYPT.OBJ : []GLOBALS.H
-[.$(DEST)]CRYPT.OBJ : []CRYPT.H
-[.$(DEST)]CRYPT.OBJ : []TTYIO.H
-[.$(DEST)]CRYPT.OBJ : []CRC32.H
-[.$(DEST)]CRYPT_.OBJ : []CRYPT.C
-[.$(DEST)]CRYPT_.OBJ : []ZIP.H
-[.$(DEST)]CRYPT_.OBJ : []UNZIP.H
-[.$(DEST)]CRYPT_.OBJ : []UNZPRIV.H
-[.$(DEST)]CRYPT_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]CRYPT_.OBJ : []GLOBALS.H
-[.$(DEST)]CRYPT_.OBJ : []CRYPT.H
-[.$(DEST)]CRYPT_.OBJ : []TTYIO.H
-[.$(DEST)]CRYPT_.OBJ : []CRC32.H
-[.$(DEST)]ENVARGS.OBJ : []ENVARGS.C
-[.$(DEST)]ENVARGS.OBJ : []UNZIP.H
-[.$(DEST)]ENVARGS.OBJ : []UNZPRIV.H
-[.$(DEST)]ENVARGS.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]ENVARGS.OBJ : []GLOBALS.H
-[.$(DEST)]EXPLODE.OBJ : []EXPLODE.C
-[.$(DEST)]EXPLODE.OBJ : []UNZIP.H
-[.$(DEST)]EXPLODE.OBJ : []UNZPRIV.H
-[.$(DEST)]EXPLODE.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]EXPLODE.OBJ : []GLOBALS.H
-[.$(DEST)]EXTRACT.OBJ : []EXTRACT.C
-[.$(DEST)]EXTRACT.OBJ : []UNZIP.H
-[.$(DEST)]EXTRACT.OBJ : []UNZPRIV.H
-[.$(DEST)]EXTRACT.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]EXTRACT.OBJ : []GLOBALS.H
-[.$(DEST)]EXTRACT.OBJ : []CRC32.H
-[.$(DEST)]EXTRACT.OBJ : []ZIP.H
-[.$(DEST)]EXTRACT.OBJ : []CRYPT.H
-[.$(DEST)]EXTRACT_.OBJ : []EXTRACT.C
-[.$(DEST)]EXTRACT_.OBJ : []UNZIP.H
-[.$(DEST)]EXTRACT_.OBJ : []UNZPRIV.H
-[.$(DEST)]EXTRACT_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]EXTRACT_.OBJ : []GLOBALS.H
-[.$(DEST)]EXTRACT_.OBJ : []CRC32.H
-[.$(DEST)]EXTRACT_.OBJ : []ZIP.H
-[.$(DEST)]EXTRACT_.OBJ : []CRYPT.H
-[.$(DEST)]FILEIO.OBJ : []FILEIO.C
-[.$(DEST)]FILEIO.OBJ : []UNZIP.H
-[.$(DEST)]FILEIO.OBJ : []UNZPRIV.H
-[.$(DEST)]FILEIO.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]FILEIO.OBJ : []GLOBALS.H
-[.$(DEST)]FILEIO.OBJ : []CRC32.H
-[.$(DEST)]FILEIO.OBJ : []ZIP.H
-[.$(DEST)]FILEIO.OBJ : []CRYPT.H
-[.$(DEST)]FILEIO.OBJ : []TTYIO.H
-[.$(DEST)]FILEIO.OBJ : []EBCDIC.H
-[.$(DEST)]FILEIO_.OBJ : []FILEIO.C
-[.$(DEST)]FILEIO_.OBJ : []UNZIP.H
-[.$(DEST)]FILEIO_.OBJ : []UNZPRIV.H
-[.$(DEST)]FILEIO_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]FILEIO_.OBJ : []GLOBALS.H
-[.$(DEST)]FILEIO_.OBJ : []CRC32.H
-[.$(DEST)]FILEIO_.OBJ : []ZIP.H
-[.$(DEST)]FILEIO_.OBJ : []CRYPT.H
-[.$(DEST)]FILEIO_.OBJ : []TTYIO.H
-[.$(DEST)]FILEIO_.OBJ : []EBCDIC.H
-[.$(DEST)]GLOBALS.OBJ : []GLOBALS.C
-[.$(DEST)]GLOBALS.OBJ : []UNZIP.H
-[.$(DEST)]GLOBALS.OBJ : []UNZPRIV.H
-[.$(DEST)]GLOBALS.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]GLOBALS.OBJ : []GLOBALS.H
-[.$(DEST)]GLOBALS_.OBJ : []GLOBALS.C
-[.$(DEST)]GLOBALS_.OBJ : []UNZIP.H
-[.$(DEST)]GLOBALS_.OBJ : []UNZPRIV.H
-[.$(DEST)]GLOBALS_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]GLOBALS_.OBJ : []GLOBALS.H
-[.$(DEST)]INFLATE.OBJ : []INFLATE.C
-[.$(DEST)]INFLATE.OBJ : []INFLATE.H
-[.$(DEST)]INFLATE.OBJ : []UNZIP.H
-[.$(DEST)]INFLATE.OBJ : []UNZPRIV.H
-[.$(DEST)]INFLATE.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]INFLATE.OBJ : []GLOBALS.H
-[.$(DEST)]INFLATE_.OBJ : []INFLATE.C
-[.$(DEST)]INFLATE_.OBJ : []INFLATE.H
-[.$(DEST)]INFLATE_.OBJ : []UNZIP.H
-[.$(DEST)]INFLATE_.OBJ : []UNZPRIV.H
-[.$(DEST)]INFLATE_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]INFLATE_.OBJ : []GLOBALS.H
-[.$(DEST)]LIST.OBJ : []LIST.C
-[.$(DEST)]LIST.OBJ : []UNZIP.H
-[.$(DEST)]LIST.OBJ : []UNZPRIV.H
-[.$(DEST)]LIST.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]LIST.OBJ : []GLOBALS.H
-[.$(DEST)]MATCH.OBJ : []MATCH.C
-[.$(DEST)]MATCH.OBJ : []UNZIP.H
-[.$(DEST)]MATCH.OBJ : []UNZPRIV.H
-[.$(DEST)]MATCH.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]MATCH.OBJ : []GLOBALS.H
-[.$(DEST)]MATCH_.OBJ : []MATCH.C
-[.$(DEST)]MATCH_.OBJ : []UNZIP.H
-[.$(DEST)]MATCH_.OBJ : []UNZPRIV.H
-[.$(DEST)]MATCH_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]MATCH_.OBJ : []GLOBALS.H
-[.$(DEST)]PROCESS.OBJ : []PROCESS.C
-[.$(DEST)]PROCESS.OBJ : []UNZIP.H
-[.$(DEST)]PROCESS.OBJ : []UNZPRIV.H
-[.$(DEST)]PROCESS.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]PROCESS.OBJ : []GLOBALS.H
-[.$(DEST)]PROCESS.OBJ : []CRC32.H
-[.$(DEST)]PROCESS.OBJ : []ZIP.H
-[.$(DEST)]PROCESS_.OBJ : []PROCESS.C
-[.$(DEST)]PROCESS_.OBJ : []UNZIP.H
-[.$(DEST)]PROCESS_.OBJ : []UNZPRIV.H
-[.$(DEST)]PROCESS_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]PROCESS_.OBJ : []GLOBALS.H
-[.$(DEST)]PROCESS_.OBJ : []CRC32.H
-[.$(DEST)]PROCESS_.OBJ : []ZIP.H
-[.$(DEST)]TTYIO.OBJ : []TTYIO.C
-[.$(DEST)]TTYIO.OBJ : []ZIP.H
-[.$(DEST)]TTYIO.OBJ : []UNZIP.H
-[.$(DEST)]TTYIO.OBJ : []UNZPRIV.H
-[.$(DEST)]TTYIO.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]TTYIO.OBJ : []GLOBALS.H
-[.$(DEST)]TTYIO.OBJ : []CRYPT.H
-[.$(DEST)]TTYIO.OBJ : []TTYIO.H
-[.$(DEST)]TTYIO_.OBJ : []TTYIO.C
-[.$(DEST)]TTYIO_.OBJ : []ZIP.H
-[.$(DEST)]TTYIO_.OBJ : []UNZIP.H
-[.$(DEST)]TTYIO_.OBJ : []UNZPRIV.H
-[.$(DEST)]TTYIO_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]TTYIO_.OBJ : []GLOBALS.H
-[.$(DEST)]TTYIO_.OBJ : []CRYPT.H
-[.$(DEST)]TTYIO_.OBJ : []TTYIO.H
-[.$(DEST)]UBZ2ERR.OBJ : []UBZ2ERR.C
-[.$(DEST)]UBZ2ERR.OBJ : []UNZIP.H
-[.$(DEST)]UBZ2ERR.OBJ : []UNZPRIV.H
-[.$(DEST)]UBZ2ERR.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]UBZ2ERR.OBJ : []GLOBALS.H
-[.$(DEST)]UBZ2ERR_.OBJ : []UBZ2ERR.C
-[.$(DEST)]UBZ2ERR_.OBJ : []UNZIP.H
-[.$(DEST)]UBZ2ERR_.OBJ : []UNZPRIV.H
-[.$(DEST)]UBZ2ERR_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]UBZ2ERR_.OBJ : []GLOBALS.H
-[.$(DEST)]UNREDUCE.OBJ : []UNREDUCE.C
-[.$(DEST)]UNREDUCE.OBJ : []UNZIP.H
-[.$(DEST)]UNREDUCE.OBJ : []UNZPRIV.H
-[.$(DEST)]UNREDUCE.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]UNREDUCE.OBJ : []GLOBALS.H
-[.$(DEST)]UNSHRINK.OBJ : []UNSHRINK.C
-[.$(DEST)]UNSHRINK.OBJ : []UNZIP.H
-[.$(DEST)]UNSHRINK.OBJ : []UNZPRIV.H
-[.$(DEST)]UNSHRINK.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]UNSHRINK.OBJ : []GLOBALS.H
-[.$(DEST)]UNZIP.OBJ : []UNZIP.C
-[.$(DEST)]UNZIP.OBJ : []UNZIP.H
-[.$(DEST)]UNZIP.OBJ : []UNZPRIV.H
-[.$(DEST)]UNZIP.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]UNZIP.OBJ : []GLOBALS.H
-[.$(DEST)]UNZIP.OBJ : []CRYPT.H
-[.$(DEST)]UNZIP.OBJ : []UNZVERS.H
-[.$(DEST)]UNZIP.OBJ : []CONSTS.H
-[.$(DEST)]UNZIPSFX.OBJ : []UNZIP.C
-[.$(DEST)]UNZIPSFX.OBJ : []UNZIP.H
-[.$(DEST)]UNZIPSFX.OBJ : []UNZPRIV.H
-[.$(DEST)]UNZIPSFX.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]UNZIPSFX.OBJ : []GLOBALS.H
-[.$(DEST)]UNZIPSFX.OBJ : []CRYPT.H
-[.$(DEST)]UNZIPSFX.OBJ : []UNZVERS.H
-[.$(DEST)]UNZIPSFX.OBJ : []CONSTS.H
-[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZIP.C
-[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZIP.H
-[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZPRIV.H
-[.$(DEST)]UNZIPSFX_CLI.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]UNZIPSFX_CLI.OBJ : []GLOBALS.H
-[.$(DEST)]UNZIPSFX_CLI.OBJ : []CRYPT.H
-[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZVERS.H
-[.$(DEST)]UNZIPSFX_CLI.OBJ : []CONSTS.H
-[.$(DEST)]UNZIP_CLI.OBJ : []UNZIP.C
-[.$(DEST)]UNZIP_CLI.OBJ : []UNZIP.H
-[.$(DEST)]UNZIP_CLI.OBJ : []UNZPRIV.H
-[.$(DEST)]UNZIP_CLI.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]UNZIP_CLI.OBJ : []GLOBALS.H
-[.$(DEST)]UNZIP_CLI.OBJ : []CRYPT.H
-[.$(DEST)]UNZIP_CLI.OBJ : []UNZVERS.H
-[.$(DEST)]UNZIP_CLI.OBJ : []CONSTS.H
-[.$(DEST)]ZIPINFO.OBJ : []ZIPINFO.C
-[.$(DEST)]ZIPINFO.OBJ : []UNZIP.H
-[.$(DEST)]ZIPINFO.OBJ : []UNZPRIV.H
-[.$(DEST)]ZIPINFO.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]ZIPINFO.OBJ : []GLOBALS.H
-[.$(DEST)]CMDLINE.OBJ : [.VMS]CMDLINE.C
-[.$(DEST)]CMDLINE.OBJ : []UNZIP.H
-[.$(DEST)]CMDLINE.OBJ : []UNZPRIV.H
-[.$(DEST)]CMDLINE.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]CMDLINE.OBJ : []GLOBALS.H
-[.$(DEST)]CMDLINE.OBJ : []UNZVERS.H
-[.$(DEST)]VMS.OBJ : [.VMS]VMS.C
-[.$(DEST)]VMS.OBJ : []UNZIP.H
-[.$(DEST)]VMS.OBJ : []UNZPRIV.H
-[.$(DEST)]VMS.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]VMS.OBJ : []GLOBALS.H
-[.$(DEST)]VMS.OBJ : []CRC32.H
-[.$(DEST)]VMS.OBJ : []ZIP.H
-[.$(DEST)]VMS.OBJ : []UNZIP.H
-[.$(DEST)]VMS.OBJ : [.VMS]VMS.H
-[.$(DEST)]VMS.OBJ : [.VMS]VMSDEFS.H
-[.$(DEST)]VMS_.OBJ : [.VMS]VMS.C
-[.$(DEST)]VMS_.OBJ : []UNZIP.H
-[.$(DEST)]VMS_.OBJ : []UNZPRIV.H
-[.$(DEST)]VMS_.OBJ : [.VMS]VMSCFG.H
-[.$(DEST)]VMS_.OBJ : []GLOBALS.H
-[.$(DEST)]VMS_.OBJ : []CRC32.H
-[.$(DEST)]VMS_.OBJ : []ZIP.H
-[.$(DEST)]VMS_.OBJ : []UNZIP.H
-[.$(DEST)]VMS_.OBJ : [.VMS]VMS.H
-[.$(DEST)]VMS_.OBJ : [.VMS]VMSDEFS.H
-# 1 February 2008. SMS.
+# DESCRIP_MKDEPS.MMS
#
-# UnZip 6.0 for VMS - MMS Dependency Description File.
+# UnZip 6.1 for VMS - MMS Dependency Description File.
+#
+# Last revised: 2013-11-29
+#
+#----------------------------------------------------------------------
+# Copyright (c) 2004-2013 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. If,
+# for some reason, all these files are missing, the Info-ZIP license
+# may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#----------------------------------------------------------------------
#
# MMS /EXTENDED_SYNTAX description file to generate a C source
# dependencies file. Unsightly errors result when /EXTENDED_SYNTAX
# is not specified. Typical usage:
#
-# $ MMS /EXTEND /DESCRIP = [.VMS]DESCRIP_MKDEPS.MMS /SKIP
+# $ L_U = "CRYPT_AES_WG_SFX, BZIP2_SFX, USE_OWN_CRCTAB,"+ -
+# " LZMA_SFX, PPMD_SFX, API_DOC, MEMDIAG"
+# $ MMS /EXTEND /DESCRIP = [.VMS]DESCRIP_MKDEPS.MMS /SKIP -
+# /MACRO = (AES_WG=1, IZ_BZIP2=iz_bzip2, IZ_ZLIB=iz_zlib, -
+# LZMA=1, PPMD=1, LIBUNZIP=1, "LOCAL_UNZIP=''L_U'")
+#
+# If the IZ_AES_WG encryption source kit has not been installed, then
+# the macros AES_WG and CRYPT_AES_WG_SFX should not be defined.
#
# Note that this description file must be used from the main
# distribution directory, not from the [.VMS] subdirectory.
# Required command procedures.
-COMS = [.VMS]MOD_DEP.COM [.VMS]COLLECT_DEPS.COM
+COLLECT_DEPS = [.VMS]COLLECT_DEPS.COM
+MOD_DEP = [.VMS]MOD_DEP.COM
+
+COMS = $(COLLECT_DEPS) $(MOD_DEP)
# Include the source file lists (among other data).
" To retain the .MMSD files, specify ""/MACRO = NOSKIP=1""."
@ exit %x00000004
.ENDIF
- $(CC) $(CFLAGS_INCL) $(MMS$SOURCE) /NOLIST /NOOBJECT -
+ $(CC) $(CFLAGS_INCL) $(CDEFS_UNX) $(MMS$SOURCE) /NOLIST /NOOBJECT -
/MMS_DEPENDENCIES = (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
# List of MMS dependency files.
MODS_LIB_UNZIP_V = $(FILTER-OUT *], \
$(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_UNZIP_V)))
+MODS_LIB_UNZIP_AES = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] [.AES_WG]*, $(MODS_OBJS_LIB_UNZIP_AES)))
+
+MODS_LIB_UNZIP_LZMA = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] [.SZIP]*, $(MODS_OBJS_LIB_UNZIP_LZMA)))
+
+MODS_LIB_UNZIP_PPMD = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] [.SZIP]*, $(MODS_OBJS_LIB_UNZIP_PPMD)))
+
+MODS_LIB_UNZIPCLI_N = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] *, $(MODS_OBJS_LIB_UNZIPCLI_C_N)))
+
MODS_LIB_UNZIPCLI_V = $(FILTER-OUT *], \
$(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_UNZIPCLI_C_V)))
MODS_LIB_UNZIPSFX_V = $(FILTER-OUT *], \
$(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_UNZIPSFX_V)))
+MODS_LIB_LIBUNZIP_NL = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] *, $(MODS_OBJS_LIB_LIBUNZIP_NL)))
+
+MODS_LIB_LIBUNZIP_V = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_LIBUNZIP_V)))
+
MODS_UNZIP = $(FILTER-OUT *], \
$(PATSUBST *]*.EXE, *] *, $(UNZIP)))
DEPS = $(FOREACH NAME, \
$(MODS_LIB_UNZIP_N) $(MODS_LIB_UNZIP_V) \
- $(MODS_LIB_UNZIPCLI_V) \
+ $(MODS_LIB_UNZIP_AES) \
+ $(MODS_LIB_UNZIP_LZMA) \
+ $(MODS_LIB_UNZIP_PPMD) \
+ $(MODS_LIB_UNZIPCLI_N) $(MODS_LIB_UNZIPCLI_V) \
$(MODS_LIB_UNZIPSFX_N) $(MODS_LIB_UNZIPSFX_V) \
$(MODS_UNZIP) $(MODS_UNZIP_CLI) \
- $(MODS_UNZIPSFX) $(MODS_UNZIPSFX_CLI), \
+ $(MODS_UNZIPSFX) $(MODS_UNZIPSFX_CLI) \
+ $(MODS_LIB_LIBUNZIP_NL), \
$(NAME).mmsd)
# Default target is the comprehensive dependency list.
# Note that the space in P4, which prevents immediate macro
# expansion, is removed by COLLECT_DEPS.COM.
#
- @[.VMS]COLLECT_DEPS.COM "UnZip" -
- "$(MMS$TARGET)" "[...]*.mmsd" "[.$ (DEST)]" $(MMSDESCRIPTION_FILE)
- @ write sys$output -
+ @$(COLLECT_DEPS) "UnZip for VMS" "$(MMS$TARGET)" -
+ "[...]*.MMSD" "[.$ (DEST)]" $(MMSDESCRIPTION_FILE) -
+ "[.AES_WG/[.SZIP]C/[.SZIP]P/[.SZIP]S/[.SZIP]T/[.SZIP" -
+ "AES_WG/LZMA_PPMD/PPMD/LZMA_PPMD/LZMA_PPMD/LZMA"
+ @ write sys$output -
"Created a new dependency file: $(MMS$TARGET)"
.IF DELETE_MMSD
@ write sys$output -
"Deleting intermediate .MMSD files..."
- delete /log *.MMSD;*, [.VMS]*.MMSD;*
+ if (f$search( "*.MMSD") .nes. "") then -
+ delete /log *.MMSD;*
+ if (f$search( "[.aes_wg]*.MMSD") .nes. "") then -
+ delete /log [.aes_wg]*.MMSD;*
+ if (f$search( "[.szip]*.MMSD") .nes. "") then -
+ delete /log [.szip]*.MMSD;*
+ if (f$search( "[.VMS]*.MMSD") .nes. "") then -
+ delete /log [.VMS]*.MMSD;*
.ELSE
@ write sys$output -
"Purging intermediate .MMSD files..."
- purge /log *.MMSD, [.VMS]*.MMSD
+ if (f$search( "*.MMSD;-1") .nes. "") then -
+ purge /log *.MMSD
+ if (f$search( "[.aes_wg]*.MMSD;-1") .nes. "") then -
+ purge /log [.aes_wg]*.MMSD
+ if (f$search( "[.szip]*.MMSD;-1") .nes. "") then -
+ purge /log [.szip]*.MMSD
+ if (f$search( "[.VMS]*.MMSD;-1") .nes. "") then -
+ purge /log [.VMS]*.MMSD
.ENDIF
# CLEAN target. Delete the individual C dependency files.
CLEAN :
if (f$search( "*.MMSD") .nes. "") then -
- delete /log *.MMSD;*
+ delete /log *.MMSD;*
+ if (f$search( "[.aes_wg]*.MMSD") .nes. "") then -
+ delete /log [.aes_wg]*.MMSD;*
+ if (f$search( "[.szip]*.MMSD") .nes. "") then -
+ delete /log [.szip]*.MMSD;*
if (f$search( "[.VMS]*.MMSD") .nes. "") then -
- delete /log [.VMS]*.MMSD;*
+ delete /log [.VMS]*.MMSD;*
# CLEAN_ALL target. Delete:
# The individual C dependency files.
CLEAN_ALL :
if (f$search( "*.MMSD") .nes. "") then -
- delete /log *.MMSD;*
+ delete /log *.MMSD;*
+ if (f$search( "[.aes_wg]*.MMSD") .nes. "") then -
+ delete /log [.aes_wg]*.MMSD;*
+ if (f$search( "[.szip]*.MMSD") .nes. "") then -
+ delete /log [.szip]*.MMSD;*
if (f$search( "[.VMS]*.MMSD") .nes. "") then -
- delete /log [.VMS]*.MMSD;*
+ delete /log [.VMS]*.MMSD;*
if (f$search( "[.VMS]DESCRIP_DEPS.MMS") .nes. "") then -
- delete /log [.VMS]DESCRIP_DEPS.MMS;*
+ delete /log [.VMS]DESCRIP_DEPS.MMS;*
# Explicit dependencies and rules for utility variant modules.
#
# the /SKIP warning code in each rule here.
CRC32_.MMSD : CRC32.C CRC32.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
CRYPT_.MMSD : CRYPT.C CRYPT.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
EXTRACT_.MMSD : EXTRACT.C EXTRACT.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
FILEIO_.MMSD : FILEIO.C FILEIO.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
GLOBALS_.MMSD : GLOBALS.C GLOBALS.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
INFLATE_.MMSD : INFLATE.C INFLATE.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
MATCH_.MMSD : MATCH.C MATCH.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
PROCESS_.MMSD : PROCESS.C PROCESS.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
TTYIO_.MMSD : TTYIO.C TTYIO.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
UBZ2ERR_.MMSD : UBZ2ERR.C UBZ2ERR.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
[.VMS]VMS_.MMSD : [.VMS]VMS.C [.VMS]VMS.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
UNZIP_CLI.MMSD : UNZIP.C UNZIP.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
UNZIPSFX.MMSD : UNZIP.C UNZIP.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_SFX) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_SFX) $(CDEFS_SFX) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
UNZIPSFX_CLI.MMSD : UNZIP.C UNZIP.MMSD
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CFLAGS_SFX) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CFLAGS_SFX) $(CDEFS_SFX_CLI) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+ZIPINFO_C.MMSD : ZIPINFO.C ZIPINFO.MMSD
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
# Special case. No normal (non-CLI) version.
" To retain the .MMSD files, specify ""/MACRO = NOSKIP=1""."
@ exit %x00000004
.ENDIF
- $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(MMS$SOURCE) -
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CDEFS_CLI) $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+# UnZip library modules.
+
+APIHELP_L.MMSD : APIHELP.C
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+API_L.MMSD : API.C API.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+CRYPT_L.MMSD : CRYPT.C CRYPT.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+EXPLODE_L.MMSD : EXPLODE.C EXPLODE.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+EXTRACT_L.MMSD : EXTRACT.C EXTRACT.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+FILEIO_L.MMSD : FILEIO.C FILEIO.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+GLOBALS_L.MMSD : GLOBALS.C GLOBALS.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+INFLATE_L.MMSD : INFLATE.C INFLATE.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+LIST_L.MMSD : LIST.C LIST.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+PROCESS_L.MMSD : PROCESS.C PROCESS.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+TTYIO_L.MMSD : TTYIO.C TTYIO.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+UBZ2ERR_L.MMSD : UBZ2ERR.C UBZ2ERR.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+UNSHRINK_L.MMSD : UNSHRINK.C UNSHRINK.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+UNZIP_L.MMSD : UNZIP.C UNZIP.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+[.VMS]VMS_L.MMSD : [.VMS]VMS.C [.VMS]VMS.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
+ /NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
+ (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+
+ZIPINFO_L.MMSD : ZIPINFO.C ZIPINFO.MMSD
+ $(CC) $(CFLAGS_INCL) $(CDEFS_LIBUNZIP) -
+ $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
- @[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
+ @$(MOD_DEP) $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
-# 1 March 2009. SMS.
+# DESCRIP_SRC.MMS
#
-# UnZip 6.0 for VMS - MMS (or MMK) Source Description File.
+# UnZip 6.1 for VMS - MMS (or MMK) Source Description File.
#
+# Last revised: 2013-11-29
+#
+#----------------------------------------------------------------------
+# Copyright (c) 2004-2013 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. If,
+# for some reason, all these files are missing, the Info-ZIP license
+# may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#----------------------------------------------------------------------
# This description file is included by other description files. It is
# not intended to be used alone. Verify proper inclusion.
.ENDIF # __VAX__
.ENDIF # LARGE
-DEST = $(DESTM)$(DESTL)
+DEST_STD = $(DESTM)$(DESTL)
+.IFDEF PROD # PROD
+DEST = $(PROD)
+.ELSE # PROD
+DEST = $(DEST_STD)
+.ENDIF # PROD
SEEK_BZ = $(DESTM)
# Library module name suffix for XXX_.OBJ with GNU C.
.IFDEF GNUC # GNUC
GCC_ = _
+GCC_C = _C
+GCC_L = _L
.ELSE # GNUC
GCC_ =
+GCC_C =
+GCC_L =
.ENDIF # GNUC
# Check for option problems.
.ENDIF # VAX_MULTI_CMPL
.ENDIF # UNK_DEST
+# AES_WG options.
+
+.IFDEF AES_WG # AES_WG
+CDEFS_AES = , CRYPT_AES_WG
+.ENDIF # AES_WG
+
# BZIP2 options.
.IFDEF IZ_BZIP2 # IZ_BZIP2
-CDEFS_BZ = , USE_BZIP2
+CDEFS_BZ = , BZIP2_SUPPORT
CFLAGS_INCL = /include = ([], [.VMS])
-LIB_BZIP2_OPTS = lib_bzip2:$(BZ2_OLB) /library,
+LIB_BZIP2_OPTS = LIB_BZIP2:$(BZ2_OLB) /library,
.ENDIF # IZ_BZIP2
+# LZMA options.
+
+.IFDEF LZMA # LZMA
+LZMA_PPMD = 1
+.IFDEF __VAX__ # __VAX__
+CDEFS_LZMA = , LZMA_SUPPORT, _SZ_NO_INT_64
+.ELSE # __VAX__
+CDEFS_LZMA = , LZMA_SUPPORT
+.ENDIF # __VAX__
+.IFDEF CFLAGS_INCL # CFLAGS_INCL
+.ELSE # CFLAGS_INCL
+CFLAGS_INCL = /include = ([], [.VMS])
+.ENDIF # CFLAGS_INCL
+.ENDIF # LZMA
+
+# PPMd options.
+
+.IFDEF PPMD # PPMD
+.IFDEF LZMA # LZMA
+.IFDEF __VAX__ # __VAX__
+.IFDEF VAXC_OR_FORCE_VAXC # VAXC_OR_FORCE_VAXC
+CDEFS_PPMD = , PPMD_SUPPORT, NO_SIGNED_CHAR
+.ELSE # VAXC_OR_FORCE_VAXC
+CDEFS_PPMD = , PPMD_SUPPORT
+.ENDIF # VAXC_OR_FORCE_VAXC
+.ELSE # __VAX__
+CDEFS_PPMD = , PPMD_SUPPORT
+.ENDIF # __VAX__
+.ELSE # LZMA
+LZMA_PPMD = 1
+.IFDEF __VAX__ # __VAX__
+.IFDEF VAXC_OR_FORCE_VAXC # VAXC_OR_FORCE_VAXC
+CDEFS_PPMD = , PPMD_SUPPORT, NO_SIGNED_CHAR, _SZ_NO_INT_64
+.ELSE # VAXC_OR_FORCE_VAXC
+CDEFS_PPMD = , PPMD_SUPPORT, _SZ_NO_INT_64
+.ENDIF # VAXC_OR_FORCE_VAXC
+.ELSE # __VAX__
+CDEFS_PPMD = , PPMD_SUPPORT
+.ENDIF # __VAX__
+.ENDIF # LZMA
+.IFDEF CFLAGS_INCL # CFLAGS_INCL
+.ELSE # CFLAGS_INCL
+CFLAGS_INCL = /include = ([], [.VMS])
+.ENDIF # CFLAGS_INCL
+.ENDIF # PPMD
+
# ZLIB options.
.IFDEF IZ_ZLIB # IZ_ZLIB
CFLAGS_INCL = /include = ([], [.VMS])
.ENDIF # CFLAGS_INCL
LIB_ZLIB_OPTS = LIB_ZLIB:LIBZ.OLB /library,
-.ELSE # IZ_ZLIB
-.IFDEF CFLAGS_INCL # CFLAGS_INCL
-.ELSE # CFLAGS_INCL
-CFLAGS_INCL = /include = []
-.ENDIF # CFLAGS_INCL
.ENDIF # IZ_ZLIB
-# DBG options.
+.IFDEF CFLAGS_INCL # CFLAGS_INCL
+.ELSE # CFLAGS_INCL
+CFLAGS_INCL = /include = []
+.ENDIF # CFLAGS_INCL
+
+
+# DBG, TRC options.
.IFDEF DBG # DBG
CFLAGS_DBG = /debug /nooptimize
LINKFLAGS_DBG = /debug /traceback
.ELSE # DBG
CFLAGS_DBG =
+.IFDEF TRC # TRC
+LINKFLAGS_DBG = /traceback
+.ELSE # TRC
LINKFLAGS_DBG = /notraceback
+.ENDIF # TRC
.ENDIF # DBG
# Large-file options.
C_LOCAL_UNZIP = , $(LOCAL_UNZIP)
.ENDIF
-CDEFS = VMS $(CDEFS_BZ) $(CDEFS_LARGE) $(CDEFS_ZL) $(C_LOCAL_UNZIP)
+CDEFS = VMS $(CDEFS_AES) $(CDEFS_BZ) $(CDEFS_LARGE) $(CDEFS_LZMA) \
+ $(CDEFS_PPMD) $(CDEFS_ZL) $(C_LOCAL_UNZIP)
CDEFS_UNX = /define = ($(CDEFS))
CDEFS_SFX_CLI = /define = ($(CDEFS), SFX, VMSCLI)
+CDEFS_LIBUNZIP = /define = ($(CDEFS), DLL)
+
# Other C compiler options.
.IFDEF DECC # DECC
.ENDIF # DECC
LINKFLAGS_LIST = /map = $*.MAP /cross_reference /full
.ELSE # LIST
-CFLAGS_LIST =
-LINKFLAGS_LIST =
+CFLAGS_LIST = /nolist
+LINKFLAGS_LIST = /nomap
.ENDIF # LIST
# Common CFLAGS and LINKFLAGS.
MODS_OBJS_LIB_UNZIP_V = \
VMS=[.$(DEST)]VMS.OBJ
-MODS_OBJS_LIB_UNZIP = $(MODS_OBJS_LIB_UNZIP_N) $(MODS_OBJS_LIB_UNZIP_V)
+# Primary object library, [.AES_WG].
+
+.IFDEF AES_WG # AES_WG
+MODS_OBJS_LIB_UNZIP_AES = \
+ AESCRYPT=[.$(DEST)]AESCRYPT.OBJ \
+ AESKEY=[.$(DEST)]AESKEY.OBJ \
+ AESTAB=[.$(DEST)]AESTAB.OBJ \
+ FILEENC=[.$(DEST)]FILEENC.OBJ \
+ HMAC=[.$(DEST)]HMAC.OBJ \
+ PRNG=[.$(DEST)]PRNG.OBJ \
+ PWD2KEY=[.$(DEST)]PWD2KEY.OBJ \
+ SHA1=[.$(DEST)]SHA1.OBJ
+.ENDIF # AES_WG
+
+# Primary object library, [.SZIP], LZMA.
+
+.IFDEF LZMA # LZMA
+MODS_OBJS_LIB_UNZIP_LZMA = \
+ LZFIND=[.$(DEST)]LZFIND.OBJ \
+ LZMADEC=[.$(DEST)]LZMADEC.OBJ
+.ENDIF # LZMA
+
+# Primary object library, [.SZIP], PPMd.
+
+.IFDEF PPMD # PPMD
+MODS_OBJS_LIB_UNZIP_PPMD = \
+ PPMD8=[.$(DEST)]PPMD8.OBJ \
+ PPMD8DEC=[.$(DEST)]PPMD8DEC.OBJ
+.ENDIF # PPMD
+
+MODS_OBJS_LIB_UNZIP = $(MODS_OBJS_LIB_UNZIP_N) $(MODS_OBJS_LIB_UNZIP_V) \
+ $(MODS_OBJS_LIB_UNZIP_AES) $(MODS_OBJS_LIB_UNZIP_LZMA) \
+ $(MODS_OBJS_LIB_UNZIP_PPMD)
+
+# CLI object library, [].
+
+MODS_OBJS_LIB_UNZIPCLI_C_N = \
+ ZIPINFO$(GCC_C)=[.$(DEST)]ZIPINFO_C.OBJ
# CLI object library, [.VMS].
VMS_UNZIP_CLD=[.$(DEST)]UNZ_CLI.OBJ
MODS_OBJS_LIB_UNZIP_CLI = \
+ $(MODS_OBJS_LIB_UNZIPCLI_C_N) \
$(MODS_OBJS_LIB_UNZIPCLI_C_V) \
$(MODS_OBJS_LIB_UNZIPCLI_CLD_V)
-# SFX object library, [].
+# SFX object library, [].
MODS_OBJS_LIB_UNZIPSFX_N = \
CRC32$(GCC_)=[.$(DEST)]CRC32_.OBJ \
TTYIO$(GCC_)=[.$(DEST)]TTYIO_.OBJ \
UBZ2ERR$(GCC_)=[.$(DEST)]UBZ2ERR_.OBJ
-# SFX object library, [.VMS].
+# SFX object library, [.VMS].
MODS_OBJS_LIB_UNZIPSFX_V = \
VMS$(GCC_)=[.$(DEST)]VMS_.OBJ
+# SFX object library, [.AES_WG].
+
+.IFDEF AES_WG # AES_WG
+MODS_OBJS_LIB_UNZIPSFX_AES = \
+ AESCRYPT=[.$(DEST)]AESCRYPT.OBJ \
+ AESKEY=[.$(DEST)]AESKEY.OBJ \
+ AESTAB=[.$(DEST)]AESTAB.OBJ \
+ FILEENC=[.$(DEST)]FILEENC.OBJ \
+ HMAC=[.$(DEST)]HMAC.OBJ \
+ PRNG=[.$(DEST)]PRNG.OBJ \
+ PWD2KEY=[.$(DEST)]PWD2KEY.OBJ \
+ SHA1=[.$(DEST)]SHA1.OBJ
+.ENDIF # AES_WG
+
+# Primary object library, [.SZIP], LZMA.
+
+.IFDEF LZMA # LZMA
+MODS_OBJS_LIB_UNZIPSFX_LZMA = \
+ LZFIND=[.$(DEST)]LZFIND.OBJ \
+ LZMADEC=[.$(DEST)]LZMADEC.OBJ
+.ENDIF # LZMA
+
+# Primary object library, [.SZIP], PPMd.
+
+.IFDEF PPMD # PPMD
+MODS_OBJS_LIB_UNZIPSFX_PPMD = \
+ PPMD8=[.$(DEST)]PPMD8.OBJ \
+ PPMD8DEC=[.$(DEST)]PPMD8DEC.OBJ
+.ENDIF # PPMD
+
MODS_OBJS_LIB_UNZIPSFX = \
$(MODS_OBJS_LIB_UNZIPSFX_N) \
- $(MODS_OBJS_LIB_UNZIPSFX_V)
+ $(MODS_OBJS_LIB_UNZIPSFX_V) \
+ $(MODS_OBJS_LIB_UNZIPSFX_AES) \
+ $(MODS_OBJS_LIB_UNZIPSFX_LZMA) \
+ $(MODS_OBJS_LIB_UNZIPSFX_PPMD)
# SFX object library, [.VMS] (no []).
VMS_UNZIP_CLD=[.$(DEST)]UNZ_CLI.OBJ
MODS_OBJS_LIB_UNZIPSFX_CLI = \
+ $(MODS_OBJS_LIB_UNZIPSFX_CLI_C) \
$(MODS_OBJS_LIB_UNZIPSFX_CLI_C_V) \
$(MODS_OBJS_LIB_UNZIPSFX_CLI_CLD_V)
+# LIBUNZIP object library.
+
+.IFDEF LIBUNZIP # LIBUNZIP
+
+# Modules sensitive to DLL/REENTRANT.
+
+MODS_OBJS_LIB_LIBUNZIP_NL = \
+ API$(GCC_L)=[.$(DEST)]API_L.OBJ \
+ APIHELP$(GCC_L)=[.$(DEST)]APIHELP_L.OBJ \
+ CRYPT$(GCC_L)=[.$(DEST)]CRYPT_L.OBJ \
+ EXPLODE$(GCC_L)=[.$(DEST)]EXPLODE_L.OBJ \
+ EXTRACT$(GCC_L)=[.$(DEST)]EXTRACT_L.OBJ \
+ FILEIO$(GCC_L)=[.$(DEST)]FILEIO_L.OBJ \
+ GLOBALS$(GCC_L)=[.$(DEST)]GLOBALS_L.OBJ \
+ INFLATE$(GCC_L)=[.$(DEST)]INFLATE_L.OBJ \
+ LIST$(GCC_L)=[.$(DEST)]LIST_L.OBJ \
+ PROCESS$(GCC_L)=[.$(DEST)]PROCESS_L.OBJ \
+ TTYIO$(GCC_L)=[.$(DEST)]TTYIO_L.OBJ \
+ UBZ2ERR$(GCC_L)=[.$(DEST)]UBZ2ERR_L.OBJ \
+ UNSHRINK$(GCC_L)=[.$(DEST)]UNSHRINK_L.OBJ \
+ UNZIP$(GCC_L)=[.$(DEST)]UNZIP_L.OBJ \
+ ZIPINFO$(GCC_L)=[.$(DEST)]ZIPINFO_L.OBJ
+
+MODS_OBJS_LIB_LIBUNZIP_V = \
+ VMS$(GCC_)=[.$(DEST)]VMS_L.OBJ
+
+# Modules insensitive to DLL/REENTRANT.
+
+MODS_OBJS_LIB_LIBUNZIP_N = \
+ CRC32=[.$(DEST)]CRC32.OBJ \
+ ENVARGS=[.$(DEST)]ENVARGS.OBJ \
+ MATCH=[.$(DEST)]MATCH.OBJ \
+ UNREDUCE=[.$(DEST)]UNREDUCE.OBJ
+
+MODS_OBJS_LIB_LIBUNZIP_A = $(MODS_OBJS_LIB_UNZIP_AES)
+MODS_OBJS_LIB_LIBUNZIP_L = $(MODS_OBJS_LIB_UNZIP_LZMA)
+MODS_OBJS_LIB_LIBUNZIP_P = $(MODS_OBJS_LIB_UNZIP_PPMD)
+
+MODS_OBJS_LIB_LIBUNZIP = \
+ $(MODS_OBJS_LIB_LIBUNZIP_NL) \
+ $(MODS_OBJS_LIB_LIBUNZIP_V) \
+ $(MODS_OBJS_LIB_LIBUNZIP_N) \
+ $(MODS_OBJS_LIB_LIBUNZIP_A) \
+ $(MODS_OBJS_LIB_LIBUNZIP_L) \
+ $(MODS_OBJS_LIB_LIBUNZIP_P)
+.ENDIF # LIBUNZIP
+
# Executables.
UNZIP = [.$(DEST)]UNZIP.EXE
-$! 28 December 2006. SMS.
+$! FIND_BZIP2_LIB.COM
$!
-$! Info-ZIP VMS accessory procedure.
+$! Info-ZIP VMS procedure to locate an object library.
+$!
+$! Last revised: 2013-11-29
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 2004-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
$!
$! Find the BZIP2 object library under P1, starting in the [.'P2']
$! destination directory. (We assume, initially, that the BZIP2
-$! 21 November 2004. SMS.
+$! HLP_LIB_NEXT.COM
$!
-$! HLP_LIB_NEXT.COM
+$! Info-ZIP VMS procedure to find the next available HLP$LIBRARY[_*]
+$! logical name.
$!
-$! Find the next available HLP$LIBRARY[_*] logical name.
+$! Last revised: 2013-11-29
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 2004-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
$!
$ base = "HLP$LIBRARY"
-$ candidate = base$ i = 0
+$ candidate = base
+$ i = 0
$!
$ loop_top:
$ if (i .gt. 0) then candidate = base+ "_"+ f$string( i)
+$! MAKESFX.COM
$!
-$! MAKESFX.COM: command-procedure to create self-extracting ZIP archives
-$! usage: @MAKESFX foo (foo.zip -> foo.exe)
+$! Create a self-extracting ZIP archive.
+$!
+$! Last revised: 2013-11-29
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 1994-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
+$!
+$! usage: @MAKESFX foo (foo.zip -> foo.exe)
$!
$! Change history:
$!
--- /dev/null
+/* 2011-04-21 SMS.
+ * VMS-specific <memory.h> for AES encryption code.
+ * This should be equivalent to the DEC C <memory.h> which is supplied
+ * on newer systems, but which may be missing on older systems.
+ */
+#ifndef _MEMORY_H
+#define _MEMORY_H 1
+
+#include <string.h>
+
+#endif /* ndef _MEMORY_H */
-$! 3 March 2005. SMS.
+$! MOD_DEP.COM
$!
-$! Info-ZIP VMS accessory procedure.
+$! Info-ZIP VMS procedure to modify MMS/MMK dependencies.
+$!
+$! Last revised: 2013-11-29 SMS.
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 2004-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
$!
$! Modify a dependencies file (P1), changing the object file name to
$! P2.
--- /dev/null
+$! OPTGEN.COM
+$!
+$! Info-ZIP VMS procedure to extract a program version from a C
+$! header file.
+$!
+$! Last revised: 2013-11-29 SMS.
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 2011-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
+$!
+$! Find the UnZip or Zip (P1 = product name) program version.
+$!
+$! Set the P2 logical name to the version string.
+$! P3 and P4 may be used for qualifiers on the DEFINE command.
+$!
+$ file_version = ""
+$ version = ""
+$ file_temp_name = f$parse( -
+ f$environment( "PROCEDURE"), , , "NAME", "SYNTAX_ONLY")
+$ file_temp_name = file_temp_name+ "_"+ f$getjpi( 0, "PID")+ ".dat"
+$!
+$ p10 = f$extract( 0, 1, f$edit( p1, "TRIM, UPCASE"))
+$ if (p10 .eqs. "U")
+$ then
+$ file_version = "unzvers.h"
+$ search_string = """#"", ""define"", ""UZ_VER_STRING"", """""""""
+$ else
+$ if (p10 .eqs. "Z")
+$ then
+$ file_version = "revision.h"
+$ search_string = """#"", ""define"", ""VERSION"", """""""""
+$ endif
+$ endif
+$!
+$ if (file_version .nes. "")
+$ then
+$ search /match = and /output = 'file_temp_name' -
+ 'file_version' 'search_string'
+$ endif
+$!
+$ line = ""
+$ open /read /error = open_fail file_temp 'file_temp_name'
+$ read file_temp line
+$ close file_temp
+$ delete 'file_temp_name';*
+$!
+$ open_fail:
+$!
+$ if (line .nes. "")
+$ then
+$!
+$ version = f$element( 1, """", line)
+$ version = f$element( 0, " ", version)
+$!
+$! Truncate version string at first alpha. ("3.1d13" -> "3.1".)
+$!
+$ ch = 0
+$ loop_truncate:
+$ if (f$locate( f$edit( f$extract( ch, 1, version), "UPCASE"), -
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ") .lt. 26) then goto loop_truncate_end
+$ ch = ch+ 1
+$ goto loop_truncate
+$ loop_truncate_end:
+$!
+$ version = f$extract( 0, ch, version)
+$ if (p2 .eqs. "")
+$ then
+$ write sys$output version
+$ else
+$ define 'p3' 'p2' 'version' 'p4'
+$ endif
+$ endif
+$!
--- /dev/null
+RECORD
+ Carriage_Control carriage_return
+ Format stream_lf
--- /dev/null
+$! TEST_UNZIP.COM
+$!
+$! Info-ZIP UnZip (basic) test DCL script.
+$!
+$! Last revised: 2013-11-29 SMS.
+$!
+$!----------------------------------------------------------------------
+$! Copyright (c) 2011-2013 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. If,
+$! for some reason, all these files are missing, the Info-ZIP license
+$! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+$!----------------------------------------------------------------------
+$!
+$! P1 = test archive name. Default: testmake.zip
+$! P2 = program directory. Default: "" (current directory)
+$! P3 = non-null to skip SFX tests.
+$!
+$! 2013-11-29 SMS. Copyright, documentation, license.
+$! 2013-06-03 SMS. Added exit status value.
+$! 2012-12-16 SMS. Added "-mc-" to UnZip "-Z" command to suppress
+$! member counts by dir/file/link, because not all
+$! systems have links, which changes the report.
+$! 2012-02-24 SMS. Added P3 check for PPMd test.
+$! Added lrl and mrs attributes to set on SFX EXE.
+$! Added exit status tests.
+$! 2011-06-10 SMS. New.
+$!
+$ test_archive = f$edit( p1, "trim")
+$ if (test_archive .eqs. "")
+$ then
+$ test_archive = "testmake.zip"
+$ endif
+$!
+$ pass = 0
+$ fail = 0
+$ exit_status = %x100002A4 ! SS$_BUGCHECK (message suppressed).
+$ echo = "write sys$output"
+$!
+$! Clean environment.
+$!
+$ vars = "UNZIP_OPTS, UNZIPOPT, ZIPINFO_OPTS, ZIPINFOOPT"
+$!
+$ elt = 0
+$ loop_var_top:
+$ var = f$element( elt, ",", vars)
+$ if (var .eqs. ",") then goto loop_var_bot
+$ var = f$edit( var, "trim")
+$ if (f$trnlnm( var) .nes. "")
+$ then
+$ echo ">>> Warning: Defining process logical name ''var'. Was:"
+$ show logical 'var'
+$ define /process 'var' " "
+$ endif
+$ elt = elt+ 1
+$ goto loop_var_top
+$ loop_var_bot:
+$!
+$! Check for existence of expected programs. Define appropriate symbols.
+$!
+$ if (p3 .eqs. "")
+$ then
+$ program_list = "unzip, unzipsfx, unzip_cli, unzipsfx_cli"
+$ else
+$ program_list = "unzip, unzip_cli"
+$ endif
+$!
+$ elt = 0
+$ loop_program_top:
+$ program = f$element( elt, ",", program_list)
+$ if (program .eqs. ",") then goto loop_program_bot
+$ program = f$edit( program, "trim")
+$ exe = p2+ program+ ".exe"
+$ prog = f$search( exe)
+$ if (prog .nes. "")
+$ then
+$ echo ">>> Found executable: ''program'"
+$ if (f$locate( "sfx", f$edit( program, "lowercase")) .lt. -
+ f$length( program))
+$ then
+$ 'program' = prog
+$ else
+$ 'program' = "$ ''prog'"
+$ endif
+$ else
+$ echo ">>> CAN'T FIND EXECUTABLE: ''program'"
+$ echo ">>> (''exe')"
+$ 'program' = ""
+$ endif
+$ elt = elt+ 1
+$ goto loop_program_top
+$ loop_program_bot:
+$!
+$! Check for existence of test archive.
+$!
+$ if (f$search( test_archive) .nes. "")
+$ then
+$ echo ">>> Found test archive: ''test_archive'"
+$ else
+$ echo ">>> CAN'T FIND TEST ARCHIVE: ''test_archive'"
+$ endif
+$!
+$! Error/exit handler.
+$!
+$ pwd = f$environment( "default")
+$ on control_y then goto clean_up
+$ on error then goto clean_up
+$ goto post_handler
+$!
+$ clean_up:
+$ if (f$trnlnm( "unzip_z_in", "LNM$PROCESS") .nes. "")
+$ then
+$ close unzip_z_in
+$ endif
+$ if (f$trnlnm( "unzip_z_out", "LNM$PROCESS") .nes. "")
+$ then
+$ close unzip_z_out
+$ endif
+$ set default 'pwd'
+$ exit 'exit_status'
+$!
+$ post_handler:
+$!
+$! Create, clean out, and move into a temporary test directory.
+$!
+$ tmp_dir = "test_dir_"+ f$getjpi( 0, "pid")
+$ if (f$search( "''tmp_dir'.DIR;1") .eqs. "")
+$ then
+$ create /directory [.'tmp_dir']
+$ else
+$ if (f$search( "[.''tmp_dir'...]*.*;*") .nes. "")
+$ then
+$ set protection = w:d [.'tmp_dir'...]*.*;*
+$ endif
+$ if (f$search( "[.''tmp_dir'.*]*.*;*") .nes. "")
+$ then
+$ delete [.'tmp_dir'.*]*.*;*
+$ endif
+$ if (f$search( "[.''tmp_dir']*.*;*") .nes. "")
+$ then
+$ delete [.'tmp_dir']*.*;*
+$ endif
+$ endif
+$!
+$ set default [.'tmp_dir']
+$!
+$! Expected test archive member names.
+$!
+$ member_1 = "notes"
+$ member_2 = "testmake.zipinfo"
+$!
+$! Run tests using UNIX-style command line.
+$!
+$ echo ""
+$ echo ">>> UNIX-style command line tests..."
+$ cli = 0
+$ gosub run_tests
+$!
+$! Clean out working directory. Repeat tests for CLI programs.
+$!
+$ if (f$search( "[...]*.*;*") .nes. "")
+$ then
+$ set protection = w:d [...]*.*;*
+$ endif
+$ if (f$search( "[.*]*.*;*") .nes. "")
+$ then
+$ delete [.*]*.*;*
+$ endif
+$ if (f$search( "[]*.*;*") .nes. "")
+$ then
+$ delete []*.*;*
+$ endif
+$!
+$! Run tests using VMS-style command line.
+$!
+$ echo ""
+$ echo ">>> VMS-style command line tests..."
+$ cli = 1
+$ gosub run_tests
+$!
+$!
+$! Expected results.
+$!
+fail_expected = 0
+$ if (p3 .eqs. "")
+$ then
+$ pass_expected = 12
+$ else
+$ pass_expected = 10
+$ endif
+$!
+$! Result summary.
+$!
+$ echo ""
+$ echo ">>> Test Results: Pass: ''pass', Fail: ''fail'"
+$ if ((pass .ne. pass_expected) .or. (fail .ne. fail_expected))
+$ then
+$ echo ">>> ### Expected: Pass: ''pass_expected', Fail: ''fail_expected'"
+$ else
+$ exit_status = 1 ! SS$_NORMAL
+$ endif
+$ echo ""
+$!
+$ goto clean_up
+$!
+$!
+$! Subroutine to run tests.
+$!
+$ run_tests:
+$!
+$! Test simple UnZip extraction.
+$!
+$ echo ""
+$ echo ">>> UnZip extraction test..."
+$!
+$ on error then continue
+$ if (cli)
+$ then
+$ unzip_cli /text = stmlf [-]'test_archive' "''member_1'"
+$ status = $status
+$ else
+$ unzip "-S" [-]'test_archive' 'member_1'
+$ status = $status
+$ endif
+$ on error then goto clean_up
+$!
+$ if (status)
+$ then
+$ if ((f$search( member_1) .nes. "") .and. (f$search( member_2) .eqs. ""))
+$ then
+$ echo ">>> Pass."
+$ pass = pass+ 1
+$ else
+$ echo ">>> Fail: Can't find (only) expected extracted file: ''member_1'"
+$ show default
+$ dire /date /prot /size
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo ">>> Fail: UnZip exit status = ''status'"
+$ fail = fail+ 1
+$ endif
+$!
+$! Test UnZip extraction with "-x" (/exclude) option.
+$!
+$ echo ""
+$ if (cli)
+$ then
+$ opt = "/exclude"
+$ else
+$ opt = "-x"
+$ endif
+$ echo ">>> UnZip ""''opt'"" extraction test..."
+$!
+$ on error then continue
+$ if (cli)
+$ then
+$ unzip_cli /text = stmlf /existing = new_version [-]'test_archive' -
+ /exclude = "''member_1'"
+$ status = $status
+$ else
+$ unzip "-So" [-]'test_archive' -x "''member_1'"
+$ status = $status
+$ endif
+$ on error then goto clean_up
+$!
+$ if (status)
+$ then
+$ if (f$search( member_2) .nes. "")
+$ then
+$ echo ">>> Pass."
+$ pass = pass+ 1
+$ else
+$ echo ">>> Fail: Can't find expected extracted file: ''member_2'"
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo ">>> Fail: UnZip exit status = ''status'"
+$ fail = fail+ 1
+$ endif
+$!
+$! Test UnZip extraction with "-d dest_dir" option.
+$!
+$ echo ""
+$ if (cli)
+$ then
+$ opt = "/directory = [.dest_dir]"
+$ else
+$ opt = "-d [.dest_dir]"
+$ endif
+$ echo ">>> UnZip ""''opt'"" extraction test..."
+$!
+$ on error then continue
+$ if (cli)
+$ then
+$ unzip_cli /text = stmlf /existing = new_vers /direct = [.dest_dir] -
+ [-]'test_archive' "''member_1'"
+$ status = $status
+$ else
+$ unzip "-So" [-]'test_archive' -d [.dest_dir] "''member_1'"
+$ status = $status
+$ endif
+$ on error then goto clean_up
+$!
+$ if (status)
+$ then
+$ if (f$search( member_1) .nes. "")
+$ then
+$ if (f$search( "[.dest_dir]''member_1'") .nes. "")
+$ then
+$ differences 'member_1' [.dest_dir]'member_1'
+$ if ($status .eq. %X006C8009)
+$ then
+$ echo ">>> Pass."
+$ pass = pass+ 1
+$ else
+$ echo ">>> Fail: Extracted file contents mismatch."
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo -
+ ">>> Fail: Can't find expected extracted file: [.dest_dir]''member_1'"
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo -
+ ">>> Fail: The UnZip ""-d"" test relies on success in the UnZip ""-x"" test."
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo ">>> Fail: UnZip exit status = ''status'"
+$ fail = fail+ 1
+$ endif
+$!
+$! Test UnZip extraction with "-o" option.
+$!
+$ echo ""
+$ if (cli)
+$ then
+$ opt = "/existing = new_version"
+$ else
+$ opt = "-o"
+$ endif
+$ echo ">>> UnZip ""''opt'"" extraction test..."
+$!
+$ on error then continue
+$ if (cli)
+$ then
+$ unzip_cli /text = stmlf /existing = new_vers [-]'test_archive' -
+ "''member_1'"
+$ status = $status
+$ else
+$ unzip "-So" [-]'test_archive' "''member_1'"
+$ status = $status
+$ endif
+$ on error then goto clean_up
+$!
+$ if (status)
+$ then
+$ if (f$search( member_1) .nes. "")
+$ then
+$ echo ">>> Pass."
+$ pass = pass+ 1
+$ else
+$ echo ">>> Fail: Can't find expected extracted file: ''member_1'"
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo ">>> Fail: UnZip exit status = ''status'"
+$ fail = fail+ 1
+$ endif
+$!
+$! Test ZipInfo ("unzip -Z").
+$!
+$ echo ""
+$ if (cli)
+$ then
+$ opt = "/zipinfo"
+$ opt2 = "/nomember_counts"
+$ else
+$ opt = "-Z"
+$ opt2 = "-mc-"
+$ endif
+$ echo ">>> ZipInfo (""unzip ''opt'"") test..."
+$!
+$ if (f$search( member_2) .nes. "")
+$ then
+$! Arrange for a reliable archive name in the report.
+$ pwd_ct = pwd- "]"+ ".]"
+$ define /user_mode /translation_attributes = concealed -
+ test_dir 'pwd_ct'
+$ define /user_mode sys$output testmake.unzip-Z
+$!
+$ on error then continue
+$ if (cli)
+$ then
+$ unzip_cli 'opt' 'opt2' test_dir:[000000]'test_archive'
+$ status = $status
+$ else
+$ unzip "''opt'" "''opt2'" test_dir:[000000]'test_archive'
+$ status = $status
+$ endif
+$ on error then goto clean_up
+$!
+$ if (status)
+$ then
+$! Simplify the full VMS archive name in the report heading.
+$ open /read /error = error_r unzip_z_in testmake.unzip-Z
+$ open /write /error = error_w unzip_z_out testmake.unzip-Z2
+$ line_nr = 0
+$ loop_read_top:
+$ read /error = error_c unzip_z_in line
+$ if (line_nr .eq. 0)
+$ then
+$ line_nr = 1
+$ if (f$element( 0, " ", line) .eqs. "Archive:")
+$ then
+$ archv = f$element( 1, " ", -
+ f$edit( line, "compress, trim"))
+$ archv = f$parse( archv, , , "name", "syntax_only")+ -
+ f$parse( archv, , , "type", "syntax_only")
+$ archv = f$edit( archv, "lowercase")
+$ loc_archv = f$locate( "test_dir", -
+ f$edit( line,"lowercase"))
+$ line = f$extract( 0, loc_archv, line)+ archv
+$ endif
+$ endif
+$ write /error = error_c unzip_z_out line
+$ goto loop_read_top
+$ error_c:
+$ close unzip_z_out
+$ error_w:
+$ close unzip_z_in
+$ error_r:
+$!
+$ differences testmake.unzip-Z2 'member_2'
+$ if ($status .eq. %X006C8009)
+$ then
+$ echo ">>> Pass."
+$ pass = pass+ 1
+$ else
+$ echo ">>> Fail: ZipInfo output mismatch."
+$ type sys$input
+
+>>> ### ZipInfo output does not match the expected output.
+>>> ### (If the only difference is in the date-time values, then this may
+>>> ### be caused by a time-zone difference, which may not be important.)
+
+$ eod
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo ">>> Fail: UnZip exit status = ''status'"
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo ">>> Fail: The ZipInfo test relies on success in the UnZip test."
+$ fail = fail+ 1
+$ endif
+$!
+$! Test UnZipSFX.
+$!
+$ if (p3 .eqs. "")
+$ then
+$ echo ""
+$ echo ">>> UnZipSFX test..."
+$!
+$ if (f$search( "[.dest_dir]''member_1'") .nes. "")
+$ then
+$ delete 'member_1';*, 'member_2';*
+$! Adjust attributes of ".exe" for compatibilty with stored test archive.
+$ set noon
+$ if (cli)
+$ then
+$ copy 'unzipsfx_cli' sys$disk:[]unzipsfx.exe
+$ else
+$ copy 'unzipsfx' sys$disk:[]unzipsfx.exe
+$ endif
+$ rfm_exe = f$file_attributes( "unzipsfx.exe", "rfm")
+$ rfm_arc = f$file_attributes( "[-]''test_archive'", "rfm")
+$ if ((rfm_arc .eqs. "STMLF") .and. (rfm_exe .nes. rfm_arc))
+$ then
+$ set file /attributes = (rfm:stmlf, mrs:0, lrl:32767) unzipsfx.exe
+$ endif
+$ copy unzipsfx.exe, [-]'test_archive' []test_sfx.exe
+$ set protection = o:re test_sfx.exe
+$!
+$ if (cli)
+$ then
+$ mcr sys$disk:[]test_sfx /text = stmlf "''member_1'"
+$ status = $status
+$ else
+$ mcr sys$disk:[]test_sfx -b "''member_1'"
+$ status = $status
+$ endif
+$!
+$ on control_y then goto clean_up
+$ on error then goto clean_up
+$!
+$ if (status)
+$ then
+$ if (f$search( member_1) .nes. "")
+$ then
+$ differences 'member_1' [.dest_dir]'member_1'
+$ if ($status .eq. %X006C8009)
+$ then
+$ echo ">>> Pass."
+$ pass = pass+ 1
+$ else
+$ echo ">>> Fail: Extracted file contents mismatch."
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo -
+ ">>> Fail: Can't find expected extracted file: [.dest_dir]''member_1'"
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo ">>> Fail: UnZip exit status = ''status'"
+$ fail = fail+ 1
+$ endif
+$ else
+$ echo -
+ ">>> Fail: The UnZipSFX test relies on success in the UnZip ""-d"" test."
+$ fail = fail+ 1
+$ endif
+$ endif
+$!
+$ return
+$!
Module VMS_UNZIP_CLD
- Ident "03-003"
+ Ident "03-006"
+
+!-----------------------------------------------------------------------
+! Copyright (c) 2001-2014 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. If,
+! for some reason, all these files are missing, the Info-ZIP license
+! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+!-----------------------------------------------------------------------
Define Verb UNZIP
Parameter P1, Label=ZIPFILE, Prompt="Zip file"
Parameter P2, Label=INFILE, VALUE(LIST), Prompt="Files to UnZip"
+ Qualifier AUTO_DIRECTORY, VALUE(TYPE=AUTO_DIR_KEYWORDS),
+ Negatable
Qualifier BINARY, VALUE(TYPE=CONVBIN_KEYWORDS), Negatable
- Qualifier TEXT, VALUE(TYPE=CONVTXT_KEYWORDS, LIST), Negatable
+ Qualifier TEXT, VALUE(TYPE=CONVTEXT_KEYWORDS, LIST), Negatable
Qualifier SCREEN, Negatable
- Qualifier DIRECTORY, VALUE(REQUIRED,TYPE=$FILE), Nonnegatable
+ Qualifier DIRECTORY, VALUE(REQUIRED,TYPE=$FILE), NonNegatable
Qualifier FRESHEN, Negatable
- Qualifier HELP, Nonnegatable
- Qualifier JUNK, Negatable
- Qualifier LIST, Nonnegatable
- Qualifier BRIEF, Nonnegatable, Default
- Qualifier FULL, VALUE(TYPE=FULL_MODIFIER), Nonnegatable
+ Qualifier HELP, NonNegatable, VALUE(TYPE=HELP_OPTS)
+ Qualifier JAR, Negatable
+ Qualifier JUNK_DIRS, Negatable, VALUE(TYPE=$NUMBER)
+ Qualifier LIST, NonNegatable
+ Qualifier LICENSE, NonNegatable
+ Qualifier BRIEF, NonNegatable, DEFAULT
+ Qualifier FULL, VALUE(TYPE=FULL_MODIFIER), NonNegatable
Qualifier EXISTING, VALUE(REQUIRED, TYPE=EXISTING_KEYWORDS),
- Nonnegatable
+ NonNegatable
+ Qualifier NAMES, VALUE(REQUIRED, TYPE=NAMES_KEYWORDS),
+ NonNegatable
Qualifier OVERWRITE, Negatable
- Qualifier QUIET, VALUE(TYPE=QUIET_MODIFIER), Nonnegatable
+ Qualifier QUIET, VALUE(TYPE=QUIET_MODIFIER), NonNegatable
Qualifier TEST, Negatable
- Qualifier PIPE, Nonnegatable
- Qualifier PASSWORD, VALUE(REQUIRED), Nonnegatable
- Qualifier TIMESTAMP, Nonnegatable
+ Qualifier PIPE, NonNegatable
+ Qualifier PASSWORD, VALUE(REQUIRED), NonNegatable
+ Qualifier TIMESTAMP, NonNegatable
Qualifier TRAVERSE_DIRS, Negatable
Qualifier UPPERCASE, Negatable
Qualifier UPDATE, Negatable
+ Qualifier VERBOSE, NonNegatable, VALUE(TYPE=VERBOSE_OPTS, LIST)
+ Qualifier NOVERBOSE, NonNegatable
Qualifier VERSION, Negatable
Qualifier RESTORE, VALUE(TYPE=RESTORE_KEYWORDS, LIST), Negatable
Qualifier COMMENT, Negatable
- Qualifier EXCLUDE, VALUE(LIST), Nonnegatable
+ Qualifier EXCLUDE, VALUE(LIST), NonNegatable
Qualifier CASE_INSENSITIVE, Negatable
+#if 0
+ Qualifier CASE_MATCH, VALUE(TYPE=CASE_OPTS)
+#endif /* 0 */
+ Qualifier MATCH, VALUE(REQUIRED, TYPE=MATCH_OPTS, LIST)
Qualifier LOWERCASE, Negatable
Qualifier PAGE, Negatable
Qualifier DOT_VERSION, Negatable
Qualifier ODS2, Negatable
- Qualifier YYZ_UNZIP, NonNegatable, Default
+ Qualifier YYZ_UNZIP, NonNegatable, DEFAULT
Qualifier ZIPINFO, Syntax=INFORMATION, NonNegatable
+
+ DisAllow AUTO_DIRECTORY and DIRECTORY
+ DisAllow AUTO_DIRECTORY.REUSE and (neg AUTO_DIRECTORY)
DisAllow BRIEF and FULL
DisAllow DIRECTORY and SCREEN
DisAllow BINARY and TEXT.ALL
DisAllow BINARY.ALL and TEXT
+ DisAllow CASE_INSENSITIVE and MATCH.CASE.SENSITIVE
+ DisAllow (neg CASE_INSENSITIVE) and MATCH.CASE.BLIND
+ DisAllow LOWERCASE and UPPERCASE
+ DisAllow (neg LOWERCASE) and (neg UPPERCASE)
DisAllow (OVERWRITE or (neg OVERWRITE)) and EXISTING
+ DisAllow LOWERCASE and (NAMES.NODOWNCASE)
+ DisAllow (neg LOWERCASE) and NAMES.DOWNCASE
+ DisAllow UPPERCASE and NAMES.DOWNCASE
+ DisAllow (neg UPPERCASE) and NAMES.DOWNCASE
+ DisAllow NAMES.DOWNCASE and NAMES.NODOWNCASE
+ DisAllow MATCH and ((neg MATCH.CASE) and (neg
+ MATCH.WILD_MATCH_SLASH))
+ DisAllow ODS2 and (neg NAMES.ODS2)
+ DisAllow (neg ODS2) and NAMES.ODS2
DisAllow (neg RESTORE) and RESTORE.DATE
DisAllow (neg RESTORE) and (neg RESTORE.DATE)
- DisAllow (neg RESTORE) and RESTORE.OWNER_PROT
- DisAllow (neg RESTORE) and (neg RESTORE.OWNER_PROT)
DisAllow (neg RESTORE.DATE) and RESTORE.DATE.ALL
DisAllow (neg RESTORE.DATE) and RESTORE.DATE.FILES
+ DisAllow (neg RESTORE) and RESTORE.ACL
+ DisAllow (neg RESTORE) and RESTORE.OWNER
+ DisAllow (neg RESTORE) and RESTORE.PROTECTION
+ DisAllow (neg RESTORE) and (neg RESTORE.ACL)
+ DisAllow (neg RESTORE) and (neg RESTORE.OWNER)
+ DisAllow (neg RESTORE) and (neg RESTORE.PROTECTION)
+ DisAllow (neg RESTORE.PROTECTION) and RESTORE.PROTECTION.LIMITED
+ DisAllow (neg RESTORE.PROTECTION) and RESTORE.PROTECTION.ORIGINAL
+ DisAllow RESTORE.PROTECTION.LIMITED and
+ RESTORE.PROTECTION.ORIGINAL
DisAllow TEXT.ALL and TEXT.AUTO
DisAllow TEXT.AUTO and TEXT.NONE
DisAllow TEXT.NONE and TEXT.ALL
DisAllow TEXT.NONE and TEXT.STMLF
DisAllow (neg TEXT) and TEXT.STMLF
+ DisAllow NOVERBOSE and (VERBOSE.NORMAL or VERBOSE.MORE)
+ DisAllow VERBOSE.MORE and VERBOSE.NORMAL
DisAllow ZIPINFO and HELP
+Define Type AUTO_DIR_KEYWORDS
+ Keyword REUSE
+
Define Type CONVBIN_KEYWORDS
Keyword AUTO, DEFAULT
Keyword ALL
Keyword NONE
-Define Type CONVTXT_KEYWORDS
+Define Type CONVTEXT_KEYWORDS
Keyword AUTO, DEFAULT
Keyword ALL
Keyword NONE
Keyword STMLF
+Define Type CASE_OPTS
+ Keyword SENSITIVE, DEFAULT
+ Keyword BLIND
+
+Define Type DOWNCASE_OPTS
+ Keyword SOME, DEFAULT
+ Keyword ALL
+
Define Type EXISTING_KEYWORDS
Keyword NEW_VERSION
Keyword OVERWRITE
Keyword NOEXTRACT
+Define Type HELP_OPTS
+ Keyword NORMAL, DEFAULT
+ Keyword EXTENDED
+
+Define Type MATCH_OPTS
+ Keyword CASE, VALUE(REQUIRED, TYPE=CASE_OPTS)
+ Keyword WILD_MATCH_SLASH, Negatable
+
+Define Type NAMES_KEYWORDS
+ Keyword DOWNCASE, VALUE(TYPE=DOWNCASE_OPTS), NonNegatable
+ Keyword NODOWNCASE, NonNegatable
+ Keyword ODS2, Negatable
+ Keyword SPACES, Negatable
+
Define Type RESTORE_KEYWORDS
- Keyword DATE, VALUE(TYPE=RESTOREDATE_KEYS, Required),
- Negatable
- Keyword OWNER_PROT, Default, Negatable
+ Keyword DATE, VALUE(REQUIRED, TYPE=RESTOREDATE_KEYS),
+ Negatable
+ Keyword ACL, Negatable
+ Keyword OWNER, Negatable
+ Keyword PROTECTION, VALUE(TYPE=RESTOREPROT_KEYS), Negatable
Define Type RESTOREDATE_KEYS
- Keyword FILES, DEFAULT
+ Keyword FILES, DEFAULT
Keyword ALL
+Define Type RESTOREPROT_KEYS
+ Keyword LIMITED, DEFAULT, NonNegatable
+ Keyword ORIGINAL, NonNegatable
+
Define Type QUIET_MODIFIER
Keyword SUPER
Define Type FULL_MODIFIER
Keyword DIAGNOSTICS
+Define Type VERBOSE_OPTS
+ Keyword NORMAL, DEFAULT
+ Keyword MORE
+ Keyword COMMAND
+
Define Syntax INFORMATION
Parameter P1, Label=ZIPFILE, Prompt="Zip file"
Parameter P2, Label=INFILE, VALUE(LIST), Prompt="Files to display"
- Qualifier ZIPINFO, NonNegatable, Default
- Qualifier ONE_LINE, Nonnegatable
- Qualifier SHORT, Nonnegatable
- Qualifier MEDIUM, Nonnegatable
- Qualifier LONG, Nonnegatable
- Qualifier VERBOSE, Nonnegatable
- Qualifier HEADER, Nonnegatable
- Qualifier COMMENT, Nonnegatable
- Qualifier TOTALS, Nonnegatable
- Qualifier TIMES, Nonnegatable
- Qualifier EXCLUDE, VALUE(LIST), Nonnegatable
+
+ Qualifier ZIPINFO, NonNegatable, DEFAULT
+ Qualifier LONG, Negatable
+ Qualifier MEDIUM, Negatable
+ Qualifier ONE_LINE, Negatable
+ Qualifier SHORT, Negatable
+ Qualifier VERBOSE, NonNegatable, VALUE(TYPE=VERBOSE_OPTS, LIST)
+ Qualifier NOVERBOSE, NonNegatable
Qualifier CASE_INSENSITIVE, Negatable
+#if 0
+ Qualifier CASE_MATCH, VALUE(TYPE=CASE_OPTS)
+#endif /* 0 */
+ Qualifier COMMENT, Negatable
+ Qualifier DECIMAL_TIME, Negatable
+ Qualifier EXCLUDE, VALUE(LIST), NonNegatable
+ Qualifier HEADER, Negatable
+ Qualifier MATCH, VALUE(REQUIRED, TYPE=MATCH_OPTS, LIST)
+ Qualifier MEMBER_COUNTS, Negatable
Qualifier PAGE, Negatable
+ Qualifier TIMES, Negatable
+ Qualifier TOTALS, Negatable
+
+ DisAllow DECIMAL_TIME and (neg TIMES)
+ DisAllow (neg DECIMAL_TIME) and TIMES
+ DisAllow NOVERBOSE and VERBOSE.NORMAL
+ DisAllow ONE_LINE and SHORT
+ DisAllow ONE_LINE and MEDIUM
+ DisAllow ONE_LINE and LONG
+ DisAllow SHORT and MEDIUM
+ DisAllow SHORT and LONG
+ DisAllow MEDIUM and LONG
+++ /dev/null
-Ident = "UnZip 6.0"
.!
.! Date: 12 Jul 94 (orig. UNZIP.RNH, 23 Oct 91)
.!
+.!----------------------------------------------------------------------
+.! Copyright (c) 1991-2013 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. If,
+.! for some reason, all these files are missing, the Info-ZIP license
+.! may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+.!----------------------------------------------------------------------
+.!
.! Description:
.!
.! TPU-processable source file to produce VMS on-line help for
.! Added documentation of extended /RESTORE=(...) qualifier.
.! 03-003 S. Schweda, C. Spieler 13-Sep-2008 20:00
.! Added /EXISTING qualifier.
+.! 03-004 S. Schweda 30-JUL-2010 22:00
+.! Added /CASE_MATCH qualifier, replacing
+.! /[NO]CASE_INSENSITIVE (with something less confusing,
+.! and more like existing DCL).
+.! 03-005 S. Schweda 06-AUG-2011 15:00
+.! Added /LICENSE qualifier.
+.! 03-006 S. Schweda 11-AUG-2011 20:00
+.! Added /NAMES qualifier.
+.! 03-007 S. Schweda 14-OCT-2011 20:00
+.! Restored but deprecated /[NO]CASE_INSENSITIVE. Changed
+.! /CASE_MATCH to /MATCH = CASE, Added /MATCH =
+.! [NO]WILD_MATCH_SLASH) for "-W". Restored but deprecated
+.! /BRIEF and /FULL. Added Zip-like /VERBOSE=MORE as the
+.! replacement.
.!
<INIT>
<MAIN>
UNZIP
-UnZip is used to extract files compressed and packaged by Zip (see HELP ZIP
-for information on ZIP).
-
-For a brief help on Zip and Unzip, run each without specifying any
-parameters on the command line (or apply the /HELP qualifier).
-To get a brief help sceen about the alternate UNIX style command interface,
-run each with the -h option applied.
+UnZip lists, tests, or extracts files from a ZIP archive (an archive
+format commonly used on many different systems). The default behavior
+(with no options) is to extract into the current directory (and
+subdirectories below it) all files from the specified ZIP archive. A
+companion program, Zip, creates ZIP archives.
+
+Info-ZIP UnZip and Zip were intended to be compatible with archives
+created by PKWARE's PKZIP and PKUNZIP programs (originally for MS-DOS),
+but in many cases the program options or default behaviors
+differ. Nowadays, many other programs are available which work with ZIP
+archives.
+
+This help file describes the VMS CLI edition of UnZip. A Unix-style
+command-line edition is also available, with a separate help file.
+
+The VMS CLI edition of UnZip adds a command-line translator to the
+normal UnZip program. This translator transforms a set of VMS-style
+qualifiers and parameters into an equivalent set of Unix-style options
+and parameters, and then passes those transformed arguments to UnZip's
+standard Unix-style command-line processor. The documentation often
+shows the related Unix-style options in parentheses after a VMS-style
+qualifier. For example: /HELP (-h, -hh).
+
+Format:
+<FORMAT>
+UNZIP [/unzip_qualifiers] [file[.zip]] [member [,...]]
+<FORMAT>
+UNZIP /ZIPINFO [/zipinfo_qualifiers] [file[.zip]] [member [,...]]
+<FORMAT>
+ZIPINFO [/zipinfo_qualifiers] [file[.zip]] [member [,...]]
-UNZIP will list, test, or extract from a ZIP archive. ZIP archives are commonly
-found on MS-DOS systems; a VMS version of ZIP can also be found here.
+To display the basic built-in help, use the command:
+<FORMAT>
+ UNZIP /HELP
-Archive member extraction is implied by the absence of the /SCREEN (-c),
-/PIPE (-p), /TEST (-t), /TIMESTAMP (-T), /LIST (-l, -v) or /COMMENT (-z)
-qualifiers (options).
-All archive members are processed unless a filespec is provided to
-specify a subset of the archive members.
+To display the extended built-in help, use the command:
<FORMAT>
-UNZIP zipfile [file[,...]] [/qualifiers]
+ UNZIP /HELP=EXTENDED
+The built-in help may be more current than this help file, especially
+between full product releases.
+
+The VMS CLI edition of the program can also provide built-in help on the
+Unix-style command-line edition; just use the "-h" or "-hh" options.
.!\f
<TOPIC>
-Parameters
+Command_Parameters
<PARAMETER>
-zipfile
+file[.zip]
<PTEXT>
-File specification for the ZIP archive(s) with optional wildcards. UnZip will
-perform actions specified for every zipfile matching the specification.
-The default file specification is SYS$DISK:[].ZIP.
-
-Note that self-extracting ZIP files are supported; just specify the .EXE
-suffix yourself.
+File path/name of a ZIP archive. A wildcard name may be used to specify
+multiple ZIP archives to be processed in one command. On VMS systems,
+any of the standard wildcards for a directory/file specification may be
+used: "...", "*", or "%" (or, since VMS V7.2, "?"). The default archive
+file specification is ".ZIP".
+
+Note that a ".zip" or ".ZIP" file type on an archive is merely a
+convention, not a requirement. For example, a self-extracting ZIP
+archive named "fred" or "fred.exe" could be processed as if it were an
+ordinary archive; just specify the actual file name with its actual name
+ending (if any), whatever that may be.
<TXETP>
<PARAMETER>
-file
+member [,...]
<PTEXT>
-An optional comma-separated list of archive members to be processed;
-if no list is given, all archive members are processed. Expressions
-may be used to match multiple members. Expressions should be enclosed
-in double-quotes to prevent interpretation by DCL. Multiple filenames
-should be separated by blanks. Each file specification is similar to
-a Unix egrep expression and may contain:
-
-<LITERAL>
-|* matches a sequence of 0 or more characters
-|? matches exactly 1 character
-|[...] matches any single character found inside the brackets;
-| ranges are specified by a beginning character, a hyphen,
-| and an ending character. If a '!' or '^' immediately
-| follows the left bracket, then any character not in the
-| given range is matched.
-| Hint: To specify a verbatim left bracket '[', the
-| three-character sequence "[[]" has to be used.
+An optional list of archive members to be processed, separated by
+commas. If no member list is specified, then all archive members are
+processed. Unix-like ("globbing") wildcard patterns may be used to
+match multiple members:
+
+<LITERAL>
+|* Matches a sequence of 0 or more characters.
+|? Matches exactly 1 character.
+|[...] Matches any single character found inside the brackets.
+| Ranges are specified by a beginning character, a hyphen,
+| and an ending character. If an exclamation point ("!")
+| or a caret ("^") follows the left bracket, then the
+| range of characters within the brackets is complemented.
+| That is, anything except the characters inside the
+| brackets is considered a match. To specify a literal
+| left bracket, use the three-character sequence "[[]".
<LARETIL>
<TXETP>
+.!----------------------------------------------------------------------
+<TOPIC>
+Qualifiers_Primary_mode
+<NEXT>
+Qualifiers in this group specify the primary mode of operation of
+UnZip. Only one of these primary mode qualifiers may be specified.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/COMMENT (-z)
+<NEXT>
+Primary mode. Display only the archive comment.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/FRESHEN (-f)
+<NEXT>
+Primary Mode. Freshen existing files. That is, extract only those
+files that already exist on disk and that are newer than the disk
+copies. By default UnZip queries before overwriting, but the /EXISTING
+(-o) option may be used to suppress the queries.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/HELP (-h, -hh)
+<NEXT>
+/HELP [=NORMAL]
+<NEXT>
+/HELP=EXTENDED
+
+Primary Mode. Display brief (roughly 24 lines) usage instructions
+(NORMAL, the default), or EXTENDED help (more complete usage
+instructions).
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/LICENSE (--license)
+<NEXT>
+Primary Mode. Display the Info-ZIP license.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/LIST (-l)
+<NEXT>
+Primary Mode. List archive members. By default, a brief format is
+used, which includes the following items: member name, uncompressed
+file size ("Length"), and modification date-time of the member. A
+summary is included at the end of the report, showing total size and
+count for all the members in the report. Specifying a member list
+limits the report to those members.
+
+Adding /VERBOSE to an "UNZIP /LIST" command line adds the following
+items to the report: compression method, compressed size ("Size"),
+compression ratio, and 32-bit CRC.
+
+In contrast to some other programs, UnZip does not include the
+12-byte encryption header in the compressed size values for a
+Traditionally encrypted member. Therefore, compressed size and
+compression ratio figures are independent of the member's encryption
+status and show the correct compression performance. (The complete size
+of the encrypted compressed data stream for archive members is reported
+by the more verbose ZipInfo reports. See ZipInfo.
+
+If UnZip was built with OS2_EAS enabled, then the /LIST report also
+includes the sizes of stored OS/2 extended attributes (EAs) and OS/2
+access control lists (ACLs). In addition, the archive comment and
+individual member comments (if any) are displayed.
+
+If a file was archived from a single-case file system (for example, the
+old MS-DOS FAT file system) and the /NAMES=DOWNCASE option was given,
+the filename is converted to lowercase and is shown prefixed with a
+caret (^).
+
+Note: If only /VERBOSE is specified with an archive name, then
+UnZip acts as if "/LIST /VERBOSE" were specified, and a detailed listing
+is generated.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/PIPE (-p)
+<NEXT>
+Primary Mode. Extract files to stdout (pipe). Only the actual file
+data for the members are sent to stdout (no file names, or other
+information, as would be displayed with /SCREEN (-c), and the files are
+always extracted in binary format, just as they are stored (no
+conversions). See also /SCREEN.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/SCREEN (-c)
+<NEXT>
+Primary Mode. Extract files to stdout/screen. This option is similar
+to the /PIPE (-p) option except that the name of each file is displayed
+as it is extracted, and the /TEXT (-a) option is allowed, which can
+provide automatic ASCII-EBCDIC conversion, where appropriate. See also
+/PIPE.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/TEST (-t)
+<NEXT>
+Primary Mode. Test archive members. Testing means that each archive
+member is extracted in memory (expanding and decrypting, as needed), but
+not written to a file. The resulting CRC (cyclic redundancy check, an
+enhanced checksum) of the extracted data is then compared with the
+original file's stored CRC value, and an error message is emitted if a
+CRC mismatch is detected.
+
+Adding /VERBOSE (-v) to /TEST adds some diagnostic information to the
+report for archive members with LZMA or PPMd compression.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/TIMESTAMP (-T)
+<NEXT>
+Primary Mode. Set the timestamp on the archive(s) to that of the newest
+file in each one. This corresponds to Zip's /APPEND /LATEST (-go)
+option, except that it can be used on wildcard archives (for example,
+"unzip -T *.zip"), and is much faster.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/UPDATE (-u)
+<NEXT>
+Primary mode. Update existing files and create new ones if
+needed. This mode performs the same function as the Freshen (/FRESHEN,
+-f) mode, extracting (with query) files that are newer than those with
+the same name on disk, but it also extracts those files that do not
+already exist on disk.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/VERBOSE (-v)
+<NEXT>
+
+Primary mode (when alone) or option. When used as a primary mode
+(alone), and no archive is specified, an "UNZIP /VERBOSE" command
+generates a report showing the program version, build options, and
+relevant envrironment variables.
-<QUALIFIERS>
-<QUALIFIER>
-/ZIPINFO
+When used with some other primary mode option, /VERBOSE can make output
+more verbose (detailed).
-/ZIPINFO
+If no other primary mode is specified, and an archive is specified, then
+UnZip acts as if "/LIST /VERBOSE" were specified, and a detailed listing
+is generated. See Qualifiers_Primary_mode, particularly /LIST.
+.!----------------------------------------------------------------------
+<TOPIC>
+Qualifiers_Ordinary
+<NEXT>
+Qualifiers in this group modify the operation of UnZip.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/AUTO_DIRECTORY (-da)
+<NEXT>
+/NOAUTO_DIRECTORY (default)
+<NEXT>
+/AUTO_DIRECTORY[=REUSE]
+
+Specifies a destination directory for extracted files which is derived
+from the base name of the archive. By default, files are extracted
+(and subdirectories created) in the current default directory. With
+/AUTO_DIRECTORY, UnZip automatically derives a subdirectory
+name from the archive name, creates that subdirectory, and extracts
+files into that subdirectory.
+
+For example, with /AUTO_DIRECTORY, extraction of "fred.zip" is done into
+subdirectory "[.fred]" instead of into the current directory. (On
+non-VMS systems, subdirectory "fred".)
+
+Using this option can help to avoid cluttering the current directory
+with files extracted from an archive whose structure does not include a
+top-level directory.
+
+If -da is specified as a default option in an environment
+variable, it can be overridden by either a /NOAUTO_DIRECTORY qualifier
+or an explicit /DIRECTORY=dest_dir qualifier. See also /DIRECTORY.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/BINARY (-b, -bb)
+<NEXT>
+/BINARY[=keyword]
+<NEXT>
+<LITERALW>
+/NOBINARY (Default.)
+<WLARETIL>
-Displays information about the Zip archive and the files contained therein.
-This function used to be provided by a separate ZipInfo program.
+Selects the file record format used when extracting binary files.
-The following qualifiers may be specified with /ZIPINFO:
+The optional keywords are:
<LITERAL>
-| /SHORT Short UNIX "ls -l" format (default)
-| /MEDIUM Medium UNIX "ls -l" format
-| /LONG Long UNIX "ls -l" format
-| /VERBOSE Verbose, multi-page format
-| /ONE_LINE Filenames only, one per line
-| /HEADER Print header lines
-| /TOTALS Print totals for files
-| /TIMES Print file times in sortable decimal format
-| /[NO]CASE_INSENSITIVE Match filenames case-insensitively
-| /[NO]PAGE Page screen output through built-in "more"
+|ALL Extract all files with fixed-length, 512-byte record
+| format. (-bb)
+|AUTO Extract binary files with fixed-length, 512-byte
+| record format. (Default value keyword: "/BINARY" is
+| equivalent to "/BINARY=AUTO".) (-b)
+|NONE Same as /NOBINARY. Extract binary files with
+| Stream_LF record format. (Default condition.)
<LARETIL>
-<QUALIFIER>
-/BINARY
-/BINARY[=KEYWORD]
+Zip (or a similar archiving program) identifies files as "binary"
+or "text" when they are archived. (A short-format ZipInfo report
+denotes a binary file with a "b", and a text file with a "t".)
+.! Zip's
+.! identification of text files may not be perfect, so UnZip prints
+.! "[binary]" or "[text]" as a visual check for each file it extracts with
+.! /BINARY. /BINARY=ALL forces all files to be extracted (and converted)
+.! as binary, regardless of the supposed file type.
+
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip -V", "ZIP /VMS"), files are always created with their original
+record formats. For archives without VMS attribute information (not
+made with "zip -V", "ZIP /VMS"), files are normally created with
+Stream_LF record format. With /BINARY[=AUTO], binary files are created
+with fixed-length, 512-byte record format. With /BINARY=ALL, all files
+are created with fixed-length, 512-byte record format. When extracting
+to standard output (/PIPE or /SCREEN in effect), the default conversion
+of text record delimiters is disabled for binary files (with
+/BINARY[=AUTO]), or for all files (with /BINARY=ALL).
+
+/BINARY may conflict or interact with /TEXT. A combination of
+/BINARY[=AUTO] and /TEXT[=AUTO] is allowed. (See /TEXT.)
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/BRIEF
+<NEXT>
+Deprecated. Ignored. A no-op place-holder, originally intended as an
+opposite of /FULL (also deprecated). See Qualifiers_Primary_mode,
+particularly /LIST and /VERBOSE.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/CASE_INSENSITIVE (-C)
+<NEXT>
+/CASE_INSENSITIVE
+<NEXT>
+/NOCASE_INSENSITIVE (default)
+
+Deprecated. Use /MATCH=CASE.
+
+With /CASE_INSENSITIVE, match member names case-blindly.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/DIRECTORY (-d)
+<NEXT>
+/DIRECTORY=dest_dir
+
+Specifies a destination directory for extracted files. By default,
+files are extracted (and subdirectories created) in the current default
+directory. With "/DIRECTORY=dest_dir", extraction is done into the
+specified directory, instead.
+
+[VMS] On VMS, only a VMS-style device:[directory] specification is
+permitted.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/DOT_VERSION (-Y)
<NEXT>
-/NOBINARY (default)
+[VMS] Treat archive member name endings of ".nnn" (where "nnn" is a
+decimal number) as if they were VMS version numbers (";nnn"). (The
+default is to treat them as file types.) For example:
-Selects conversion to VMS "standard" binary file format for
-extracted files, which is "fixed length 512 byte records,
-no record attributes". When extracting to SYS$OUTPUT (/SCREEN
-or /PIPE qualifier), this qualifier deactivates the default
-"text data" conversion, instead.
-The optional keywords recognized are:
<LITERAL>
-| AUTO Automatically extracts files marked as "binary" (rather
-| than "text") in standard VMS binary file format. (default)
-| ALL Extracts all files in standard VMS binary file format.
-| NONE Same as /NOBINARY.
+|"a.b.3" -> "a.b;3"
<LARETIL>
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/EXCLUDE (-x)
+<NEXT>
+/EXCLUDE=(member [,...])
-Note that a combination of /BINARY[=AUTO] and /TEXT[=AUTO] is allowed.
-(see /TEXT qualifier)
-<QUALIFIER>
-/BRIEF
+An optional list of archive members to be excluded from
+processing. Because wildcard characters normally match "/" directory
+separators (for exceptions see /MATCH=[NO]WILD_MATCH_SLASH (-W)), this
+option may be used to exclude any files that are in subdirectories. For
+example,
+<LITERAL>
+|UNZIP foo *.[ch] /EXCLUDE = */*
+<LARETIL>
+would extract all C source files (*.c, *.h) in the main directory, but
+none in any subdirectories. Without the /EXCLUDE option, all C source
+files in all directories within the archive would be extracted.
+
+Note that archive members are specified using the Unix-style names which
+are used in ZIP archives, not VMS-style names.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/EXISTING (-n, -o)
+<NEXT>
+/EXISTING[=keyword]
+<NEXT>
-/BRIEF (default)
+Specifies the action when extracting files, and a file already exists.
-When used with /LIST, specifies that a brief listing of the archive's
-contents is to be displayed. A brief listing shows the length, date,
-time, and file name for the files in the archive.
-<QUALIFIER>
-/CASE_INSENSITIVE
+The optional keywords are:
-/CASE_INSENSITIVE
-<NEXT>
-/NOCASE_INSENSITIVE (default)
-
-Match filenames case-insensitively. (Good default option under VMS.)
-<QUALIFIER>
-/COMMENT
+<LITERAL>
+|NEW_VERSION Create a new version of an existing file. (-o)
+|OVERWRITE Overwrite an existing file. (-oo)
+|NOEXTRACT Do not extract. Leave an existing file intact. (-n)
+<LARETIL>
-/COMMENT
+By default, UnZip queries the user before extracting any file that
+already exists.
+
+[Non-VMS] On non-VMS systems, the user may choose to overwrite only the
+current file, overwrite all files, skip extraction of the current file,
+skip extraction of all existing files, or rename the current file
+(choose a new name for the extracted file).
+
+[VMS] On VMS, the usual query choices are to create a new version of an
+existing file, to skip extraction, or to rename the current file. In
+the case where an archive member name includes a version number, and
+/VERSION (-V, "retain VMS file version numbers") is in effect, then an
+additional query choice is offered: to overwrite the existing file.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/FULL (-v)
<NEXT>
-/NOCOMMENT
+/FULL
+<NEXT>
+/FULL=DIAGNOSTICS
+
+Deprecated. Adds detail to a /LIST report. See
+Qualifiers_Primary_mode, particularly /LIST and /VERBOSE, and
+Qualifiers_Ordinary, particularly /VERBOSE.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/JAR (--jar)
+<NEXT>
+Treat archive(s) as Java JAR. Over-simplification in Java JAR archives
+can cause UnZip to transform UTF-8 file names according to
+inappropriate (MS-DOS) rules, yielding corrupt names on extracted files
+(typically those with ASCII codes 128-255). Archives containing a Java
+"CAFE" extra field should be detected automatically, and handled
+correctly, but not all JAR archives include that extra
+field. Specifying /JAR tells UnZip to expect UTF-8 file names,
+regardless of whether the archive contains a "CAFE" extra field.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/JUNK_DIRS (-j)
+<LITERALW>
+/NOJUNK_DIRS (Default.)
+<WLARETIL>
+/JUNK_DIRS[=depth]
+
+Junk directories on extracted files. With /JUNK_DIRS, all directory
+information is stripped from an archive member name, so all files are
+extracted into the destination directory. (See also /DIRECTORY.)
+
+If a depth ("=depth", where "depth" is a positive integer) is specified,
+then that number of directory levels will be stripped from an archive
+member name. For example, an archive member like "a/b/c/d/ee.txt" would
+normally be extracted as "[.a.b.c.d]ee.txt". With /JUNK_DIRS, it would
+be extracted as "ee.txt". With /JUNK_DIRS=2, the first two directory
+levels would be stripped, so it would be extracted as "[.c.d]ee.txt".
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/LOWERCASE (-L)
+<NEXT>
+/[NO]LOWERCASE
-Display the archive comment.
-<QUALIFIER>
-/DIRECTORY
+Deprecated. Use /NAMES=[NO]DOWNCASE.
-/DIRECTORY=directory-spec
+/LOWERCASE: Convert to lowercase any filename originating on an
+uppercase-only operating system or file system.
-Specifies the output directory where all the extracted files are to be
-placed.
-<QUALIFIER>
-/DOT_VERSION
+/NOLOWERCASE: Do not convert to lowercase any filename originating on an
+uppercase-only operating system or file system.
-/DOT_VERSION
+See also /UPPERCASE, which is also deprecated.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/MATCH (-C, -W)
<NEXT>
-/NODOT_VERSION (default)
+/MATCH=(keyword, ...)
-Causes UnZip to treat archived file name endings of ".nnn" (where "nnn"
-is a decimal number) as if they were VMS version numbers (";nnn"). (The
-default is to treat them as file types.) Example: "a.b.3" -> "a.b;3".
-<QUALIFIER>
-/EXCLUDE
+Specifies name-matching behavior for names in the member list and
+the /EXCLUDE excluded-member list on the command line.
+
+The optional keywords and values are:
+
+<LITERAL>
+|CASE=BLIND Name matching is case-insensitive. (-C)
+|CASE=SENSITIVE Name matching is case-sensitive. (Default.)
+<LARETIL>
-/EXCLUDE=(file[,...])
+By default, case-sensitive matching is done. For example, specifying
+"makefile" on the command line will match only "makefile" in
+the archive, not "Makefile" or "MAKEFILE". On many systems, the local
+file system is case-insensitive, so case-insensitive name matching would
+be more natural. With /MATCH=CASE=BLIND, "makefile" would match
+"makefile", "Makefile", or "MAKEFILE".
-A comma-separated list of files to exclude when extracting files.
-If multiple files are specified, the list should be included in
-parentheses.
-<QUALIFIER>
-/EXISTING
+/MATCH does not affect the search for the ZIP archive file(s), nor the
+matching of archive members to existing files on the extraction
+path. So, on a case-sensitive file system, UnZip will never try to
+overwrite a file "FOO" when extracting a member named "foo"!
-/EXISTING = keyword
+[WILD_STOP_AT_DIR] If the C macro WILD_STOP_AT_DIR is defined at build
+time, then an additional keyword is allowed:
-Valid keywords (exactly one must be specified) are:
<LITERAL>
-| NEW_VERSION Create a new version of an existing file.
-| OVERWRITE Overwrite the same version of an existing file.
-| (But only if the archive member name includes a
-| version number.)
-| NOEXTRACT Do not extract. An existing file is not affected.
+|NOWILD_MATCH_SLASH Wildcards stop at directory slash. (-W)
+|WILD_MATCH_SLASH Wildcards match directory slash. (Default.)
<LARETIL>
-When UnZip would extract an archive member, but the destination file
-already exists, UnZip will, by default, ask the user what to do.
-/EXISTING lets the user specify on the command line what to do in this
-situation, eliminating the interactive question(s).
+By default, the wildcard characters "?" (single-character wildcard) and
+"*" (multi-character wildcard) match any character in a member
+path/name. /MATCH=NOWILD_MATCH_SLASH (-W) modifies the pattern-matching
+behavior for archive members so that both "?" (single-character
+wildcard) and "*" (multi-character wildcard) do not match the directory
+separator character "/". (The two-character sequence "**" acts as a
+multi-character wildcard that includes the directory separator in its
+matched characters.) For example, with /MATCH=NOWILD_MATCH_SLASH:
-NOEXTRACT will always stop UnZip from extracting an archive member if
-the destination file already exists.
+<LITERAL>
+"*.c" matches "foo.c" but not "mydir/foo.c"
+"**.c" matches both "foo.c" and "mydir/foo.c"
+"*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+"??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+<LARETIL>
-If an archive member name does not include a VMS version number, or if
-UnZip is run with /NOVERSION (the default, causing it to ignore version
-numbers), then either NEW_VERSION or OVERWRITE will cause UnZip to
-create a new version of the existing file.
+This modified behavior is equivalent to the pattern matching style used
+by the shells of some of \fIUnZip\fP's supported target OSs (one example
+is Acorn RISC OS). This option may not be available on systems where
+the Zip archive's internal directory separator character "/" is allowed
+as regular character in native operating system filenames.
+
+[non-VMS] (Currently, UnZip uses the same pattern matching rules for
+both wildcard archive file name specifications and archive member
+selection patterns on most system types. For systems allowing "/" as
+regular filename character, the -W option would not work as expected on
+a wildcard file name specification.)
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/NAMES (-2, -L, -s)
+<NEXT>
+/NAMES
+<NEXT>
+/NAMES=(keyword, ...)
-If an archive member name does include a VMS version number, and if
-UnZip is run with /VERSION, then NEW_VERSION will cause UnZip to create
-a new version of the existing file, and OVERWRITE will cause UnZip to
-overwrite the existing file which has the version specified by the
-archive member name.
-<QUALIFIER>
-/FRESHEN
+Selects name transformations during extraction. The keywords are:
-/FRESHEN
+<LITERAL>
+DOWNCASE Convert filenames from all-uppercase operating
+ systems to lowercase. (-L)
+DOWNCASE=ALL Convert all filenames to lowercase. (-LL)
+ODS2 Restrict names to ODS2 conventions, regardless
+ of the destination file system. (Invalid
+ character -> "_".) (-2)
+[NO]SPACES SPACES: Permit space characters in (ODS5) names.
+ (Default condition.)
+ NOSPACES: Change spaces to underscores. (-s)
+<LARETIL>
+
+The default is to use ODS5-compatible file names (including spaces) when
+the destination file system is ODS5, and to convert the names to
+ODS2-compatible names when the destination file system is ODS2.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/OVERWRITE (-n, -o)
<NEXT>
-/NOFRESHEN
+/[NO]OVERWRITE
-Freshen existing files; replace if newer. Does not cause any new files to
-be created.
-<QUALIFIER>
-/FULL
+Deprecated. Use /EXISTING.
-/FULL
+/OVERWRITE is equivalent to /EXISTING=NEW_VERSION.
+<NEXT>
+/NOOVERWRITE is equivalent to /EXISTING=NOEXTRACT.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/PAGE (-M)
+<NEXT>
+Pipe all output through an internal pager similar to the Unix more(1)
+command. At the end of a screenful of output, UnZip pauses with a
+"--More--" prompt; the next screenful may be viewed by pressing the
+Enter (Return) key or the space bar. UnZip can be terminated by
+pressing the "Q" key and, on some systems, the Enter/Return key. Unlike
+Unix more(1), there is no forward-searching or editing
+capability. Also, UnZip doesn't notice if long lines wrap at the edge
+of the screen, effectively resulting in the printing of two or more
+lines and the likelihood that some text will scroll off the top of the
+screen before being viewed. If the actual number of lines on the screen
+can not be determined, 24 lines will be assumed.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/PASSWORD (-P)
+<NEXT>
+/PASSWORD=password
+
+Use "password" to decrypt encrypted archive members (if any). THIS IS
+INSECURE! Many multi-user operating systems provide ways for any user
+to see the current command line of any other user. Even on stand-alone
+systems, there is always the threat of over-the-shoulder
+peeking. Storing the plaintext password as part of a command line in an
+automated script can be even less secure, Whenever possible, use the
+non-echoing, interactive prompt to enter passwords. Where security is
+truly important, use a strong encryption method, such as AES, instead of
+the relatively weak encryption provided by Traditional ZIP
+encryption. Or, use an external encryption program, such as GnuPG,
+before archiving the file. (Note that Zip will probably not be able to
+do significant compression on a file which has already been encrypted.)
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/QUIET (-q, -qq)
+<NEXT>
+/QUIET[=SUPER]
-When used with /LIST, specifies that a full listing of the archive's
-contents is to be displayed. A full listing shows the length,
-compression method, compressed size, compression ratio, date,
-time, CRC value, and file name for the files in the archive.
-<QUALIFIER>
-/HELP
+Perform operations quietly. (/QUIET=SUPER: even more quietly).
-/HELP
+By default, UnZip prints the names of the files it's extracting or
+testing, the extraction methods, any member or archive comments that may
+be stored in the archive, and possibly a summary when finished with each
+archive. The /QUIET[=SUPER] options suppress the printing of some or
+all of these messages.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/RESTORE (-D, -k, -ka, -X)
+<NEXT>
+/RESTORE[=(keyword, ...)]
-Displays a one-page brief help screen and exits quietly.
-<QUALIFIER>
-/JUNK
+Selects restoration options for some meta-data. The optional keywords
+are:
-/JUNK
-<NEXT>
-/NOJUNK (default)
+<LITERAL>
+|ACL Restore file ACL settings. (-ka)
+|OWNER Restore file owner/UIC settings. (-X)
+|PROTECTION = LIMITED Restore file UIC-based (SOGW) protection
+| settings, respecting the current default
+| protection. (Default.)
+|PROTECTION = ORIGINAL Restore file UIC-based (SOGW) protection
+| settings, ignoring the current default
+| protection. (-k)
+|NOPROTECTION Do not restore file UIC-based (SOGW) protection settings.
+| The current default protection is used. (-k-)
+|NODATE Do not restore any timestamps.
+|DATE=ALL Restore timestamps for all extracted entries,
+| files and directories.
+|DATE=FILES Restore timestamps for extracted files. (Default.)
+<LARETIL>
-Junk the stored paths (don't recreated the archive's directory
-structure.
-<QUALIFIER>
-/LIST
+By default, on VMS, UnZip restores the original date-time attributes for
+files, but not for directories. This agrees with the behavior of VMS
+BACKUP (and UnZip versions before 5.52 where the capability to restore
+directory timestamps was added).
-/LIST
+For compatibility with UnZip versions before 6.0 (5.53), the following
+deprecated short forms are still accepted:
-List the contents of the archive. /BRIEF and /FULL can be used to
-specify the amount of information displayed. The default is /BRIEF.
-<QUALIFIER>
-/LOWERCASE
+<LITERAL>
+|Deprecated form: Modern form:
+|/RESTORE /RESTORE=PROTECTION
+|/NORESTORE /RESTORE=NOPROTECTION
+<LARETIL>
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/TEXT (-a, -aa, -S)
+<NEXT>
-/LOWERCASE
+/TEXT[=(keyword, ...)]
<NEXT>
-/NOLOWERCASE (default)
+<LITERALW>
+/NOTEXT (Default.)
+<WLARETIL>
-Convert filenames from all-uppercase operating systems to lowercase. This
-option has no effect under VMS.
-<QUALIFIER>
-/ODS2
+The optional keywords are:
-/ODS2
+<LITERAL>
+|ALL Extract all files with variable-length record format.
+| Adjust line endings to local standard, and convert
+| EBCDIC to ASCII, as needed. (-aa)
+|AUTO Extract text files with variable-length record format.
+| Adjust line endings to local standard, and convert
+| EBCDIC to ASCII, as needed. (Default value keyword:
+| "/TEXT" is equivalent to "/TEXT=AUTO".) (-a)
+|NONE Same as /NOTEXT. Extract text files with Stream_LF
+| record format without conversions. (Default
+| condition.)
+|STMLF Use Stream_LF record format for text files (instead of
+| variable-length record format) when ALL or AUTO is in
+| effect. Adjust line endings to local standard, and
+| convert EBCDIC to ASCII, as needed. (-S)
+<LARETIL>
+
+Selects the file record format, character encoding, and line-ending type
+used when extracting text files.
+
+Zip (or a similar archiving program) identifies files as "binary"
+or "text" when they are archived. (A short-format ZipInfo report
+denotes a binary file with a "b", and a text file with a "t".)
+Zip's identification of text files may not be perfect, so UnZip prints
+"[binary]" or "[text]" as a visual check for each file it extracts with
+/TEXT. /TEXT=ALL forces all files to be extracted (and converted) as
+text, regardless of the supposed file type.
+
+[VMS] On VMS, for archives with VMS attribute information (made with
+"zip -V", "ZIP /VMS"), files are always created with their original
+record formats. For archives without VMS attribute information (not made
+with "zip -V", "ZIP /VMS"), all files are normally created with
+Stream_LF record format. With /TEXT[=AUTO], text files are normally
+created with variable-length record format, but adding STMLF gives them
+Stream_LF record format. Additionally, line endings (CR, LF, CR+LF,
+...) are adjusted to the local standard, and EBCDIC is converted to
+ASCII. With /TEXT=ALL, all files are treated as text files, and
+processed as described above.
+
+See also /BINARY.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/TRAVERSE_DIRS (-:)
+<LITERALW>
+/[NO]TRAVERSE_DIRS (Default: /NOTRAVERSE_DIRS.)
+<WLARETIL>
+
+Allows UnZip to extract archive members into locations outside of the
+current extraction destination directory (and its subdirectories).
+
+For security reasons, UnZip normally removes "parent directory"
+path components ("../") from the path names of archive members as they
+are extracted. This safety feature (new for version 5.50) prevents
+UnZip from accidentally writing files to directories outside
+the current destination directory tree. /TRAVERSE_DIRS sets
+UnZip back to its previous, more liberal behavior, allowing
+exact extraction of archives that use "../" path components to create
+multiple directory trees at or above the level of the destination
+directory.
+
+Use this option with extreme caution.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/UPPERCASE (-L)
<NEXT>
-/NOODS2 (default)
+/[NO]UPPERCASE
-Causes UnZip to convert archived file names to ODS2-compatible file
-names (substituting "_" for any invalid characters), regardless of the
-type of the destination file system.
+Deprecated. Use /NAMES=[NO]DOWNCASE.
-The default is to use ODS5-compatible file names when the destination
-file system is ODS5, and to convert the names to ODS2-compatible names
-when the destination file system is ODS2.
+/UPPERCASE: Do not convert to lowercase any filename originating on
+an uppercase-only operating system or file system.
-Beginning in UnZip 6.0, ODS2-compatible names are explicitly set to
-upper case.
-<QUALIFIER>
-/OVERWRITE
+/NOUPPERCASE: Convert to lowercase any filename originating on an
+uppercase-only operating system or file system.
-/OVERWRITE
+See also /LOWERCASE, which is also deprecated.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/VERBOSE (-v)
<NEXT>
-/NOOVERWRITE
-
-See /EXISTING.
+/VERBOSE[=(keyword, ...)]
-/OVERWRITE is equivalent to /EXISTING = NEW_VERSION.
-<NEXT>
-/NOOVERWRITE is equivalent to /EXISTING = NOEXTRACT.
-<QUALIFIER>
-/PAGE
+The optional keywords are:
-/PAGE
-<NEXT>
-/NOPAGE
+<LITERAL>
+|NORMAL Make a report more detailed/verbose. (Default value
+| keyword: "/VERBOSE" is equivalent to
+| "/VERBOSE=NORMAL".) (-v)
+|MORE Enable special developer I/O diagnostics. See below.
+| (-vv)
+|COMMAND Enable special developer CLI diagnostics. See below.
+<LARETIL>
-Feed all screen output through the built-in "more" pager.
-<QUALIFIER>
-/PASSWORD
+MORE and NORMAL may not be specified together. (MORE implies NORMAL.)
-/PASSWORD=decryption-password
+When used with some primary mode options, /VERBOSE can make output more
+detailed/verbose. See also Qualifiers_Primary_mode, particularly /LIST.
-Specifies a decryption password and prevents UnZip from prompting for
-a password in case the specified decryption key was wrong. The supplied
-string must be enclosed in double-quotes whenever it contains lowercase
-or special characters.
-<QUALIFIER>
-/PIPE
+If no other primary mode is specified, and an archive is specified, then
+UnZip acts as if "/LIST /VERBOSE" were specified, and a detailed listing
+is generated. See Qualifiers_Primary_mode, particularly /LIST and
+/VERBOSE.
-/PIPE
+/VERBOSE=MORE ("-vv") enables some VMS-specific I/O diagnostic messages,
+and is intended for use in program development, not in normal use.
-Extract files to SYS$OUTPUT with no informational messages.
-<QUALIFIER>
-/QUIET
+/VERBOSE=COMMAND causes UnZip to show the translated Unix-style
+command-line argument vector before processing it, and is intended for
+use in program development, not in normal use. /VERBOSE=COMMAND has no
+Unix-style equivalent.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/VERSION (-V)
+<NEXT>
+[Non-CMS-MVS] Retain VMS file version numbers. VMS files can be stored
+with a version number, in the format "file.type;##", where "##" is a
+decimal number. By default the ";##" version numbers are stripped, but
+this option allows them to be retained. (On file systems that limit
+filenames to particularly short lengths, the version numbers may be
+truncated or stripped regardless of this option.)
+
+[Non-VMS] Note that before UnZip version 6.10, on a non-VMS system, a
+file with a name like "fred;123" would, by default, be extracted as
+"fred", even if the file did not originate on a VMS system (so that
+";123" was probably not really a VMS version number). Beginning with
+UnZip version 6.10, the default behavior is to strip VMS version numbers
+only from files which were archived on a VMS system. To restore the old
+behavior, and always strip apparent VMS version numbers, explicitly
+negate the option: "-V-".
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/ZIPINFO (-Z)
+<NEXT>
+ZipInfo mode. With /ZIPINFO, the program runs in ZipInfo mode, which is
+used to display information about an archive and its members. Remaining
+options are interpreted as ZipInfo options. If used, /ZIPINFO must be
+the first qualifier on the command line. See ZipInfo_mode.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.!----------------------------------------------------------------------
+<TOPIC>
+Environment_Options
+<NEXT>
+UnZip's default behavior may be modified by placing Unix-style
+command-line options in an environment variable. (The VMS CLI
+translator acts only on the command line itself, not on the
+environment variables.) This can be done with any option, but it is
+probably most useful options like -a (/TEXT, auto-convert text files),
+-L (/NAMES, downcase file names from systems with all uppercase file
+names), -C (/MATCH=CASE=BLIND, use case-insensitive name matching), -q
+(/QUIET, quiet), -o (/EXISTING, always overwrite), or -n (/EXISTING,
+never overwrite).
+
+For UnZip, the environment variable name on VMS is UNZIP_OPTS
+(non-VMS: UNZIP). The name on VMS is different to avoid conflict with
+a foreign-command DCL symbol, UNZIP. For compatibility with Zip, if
+UNZIP_OPTS is not defined, then UnZip will use UNZIPOPT the same way.
+
+For ZipInfo ("UNZIP /ZIPINFO"), the environment variable name on VMS is
+ZIPINFO_OPTS (non-VMS: ZIPINFO). For compatibility with Zip, if
+ZIPINFO_OPTS is not defined, then ZipInfo will use ZIPINFOOPT the same
+way.
+<NEXT>
+For example, to make UnZip act as quietly as possible, only reporting
+errors, one could use commands like the following (with quotation to
+preserve lower case in DCL):
-/QUIET[=SUPER]
+<LITERAL>
+define UNZIP_OPTS "-q -q" ! Logical name, or
+UNZIP_OPTS = "-q -q" ! DCL symbol. (Either works.)
+<LARETIL>
-Perform operations quietly. The keyword SUPER can be specified to make
-operations even more quiet.
-<QUALIFIER>
-/RESTORE
+Environment options are treated the same as any other Unix-style
+command-line options, except that they are effectively the first options
+on the command line. Generally, the VMS CLI translator will override an
+environment option if an explicit corresponding VMS-style qualifier is
+specified.
-/RESTORE[=(KEYWORD, ...)]
+The examples show short (one-character) options, but long ("--")
+options are also allowed.
+.!----------------------------------------------------------------------
+<TOPIC>
+Encryption_Decryption
+<NEXT>
+Zip and UnZip have long supported a relatively weak encryption method,
+which we call Traditional ZIP encryption. The source code for
+Traditional encryption is included in the source kits, and support for
+Traditional encryption is enabled by default. (Build-time C macro:
+CRYPT_TRAD.)
+
+Beginning with UnZip version 6.10 and Zip version 3.1,
+these programs also offer a stronger, Advanced Encryption Standard (AES)
+encryption method, which we call AES WinZip/Gladman (AES_WG)
+encryption. (The encryption code was supplied by Brian Gladman, and the
+archive format is intended to be compatible with that used by the
+WinZip program. WinZip is a registered trademark of WinZip
+International LLC.) The source code for AES_WG encryption is
+distributed in a separate kit (for export control reasons), and support
+for AES_WG encryption must be enabled explicitly at build
+time. (Build-time C macro: CRYPT_AES_WG.) See the INSTALL file in the
+source kit for details on how to enable AES_WG encryption (or how to
+disable Traditional encryption).
+
+For details on the WinZip AES scheme, see:
+<LITERAL>
+http://www.winzip.com/aes_info.htm
+<LARETIL>
-Selects restoration options for some meta-data.
-The optional keywords recognized are:
+For information on the separate AES_WG source kit, see:
<LITERAL>
-| OWNER_PROT Restore file owner and ACL protection settings.
-| NOOWNER_PROT Do not restore file owner and ACL protection settings.
-| NODATE Do not restore any timestamps.
-| DATE=ALL Restore timestamps for all extracted entries, files
-| and directories.
-| DATE=FILES Restore timestamps for extracted files. (default)
+ftp://ftp.info-zip.org/pub/infozip/crypt/
+ftp://ftp.info-zip.org/pub/infozip/crypt/README_AES_WG.txt
<LARETIL>
-By default, VMS UnZip restores the original date-time attributes for files,
-but not for directories. This agrees with the behavior of VMS BACKUP
-(and UnZip versions before 5.52 where the capability to restore directory
-timestamps was added).
+Normally, encryption passwords are supplied by the user interactively
+when requested by the program. See /PASSWORD for a (less secure)
+method of specifying a password on the command line.
+
+With Traditional encryption, when decrypting, a password will be checked
+against header data, and used if it appears to be correct. The correct
+password will always check out against the header data, but there is a
+1-in-256 chance that an incorrect password will as well. (This is a
+security feature of the PKWARE archive format; it helps prevent
+brute-force attacks that might otherwise gain a large speed advantage by
+testing only the header.) In the case that an incorrect password is
+given but it passes the header test anyway, either an incorrect CRC will
+be generated for the extracted data or else UnZip will fail during
+the extraction because the "decrypted" bytes do not constitute a valid
+compressed data stream.
+
+If the first password fails the header check on some file, UnZip
+will prompt for another password, and so on until all files are
+extracted. If a password is not known, entering a null password (that
+is, just a carriage return or "Enter") is taken as a signal to skip all
+further prompting. Only unencrypted files in the archive(s) will
+thereafter be extracted. (The situation is actually a little more
+complicated. Some old versions of Zip and ZipCloak allowed
+null passwords, so UnZip checks each encrypted file to see if the
+null password works. This may result in "false positives" and
+extraction errors, as noted above.)
+
+Archives encrypted with 8-bit-character passwords (for example,
+passwords with accented European characters) may not be portable across
+systems or to other archivers. This problem stems from the use of
+multiple encoding methods for such characters, including Latin-1 (ISO
+8859-1) and OEM code page 850. DOS PKZIP 2.04g uses the OEM code
+page; Windows PKZIP 2.50 uses Latin-1 (and is therefore
+incompatible with DOS PKZIP; Info-ZIP uses the OEM code page on
+DOS, OS/2 and Win3.x ports but ISO coding (Latin-1 etc.) everywhere
+else; and Nico Mak's WinZip 6.x does not allow 8-bit-character
+passwords at all. UnZip 5.3 (or newer) attempts to use the
+default character set first (e.g., Latin-1), followed by the alternate
+one (e.g., OEM code page) to test passwords. On EBCDIC systems, if both
+of these fail, EBCDIC encoding will be tested as a last resort. (EBCDIC
+is not tested on non-EBCDIC systems, because there are no known
+archivers that encrypt using EBCDIC encoding.) ISO character encodings
+other than Latin-1 are not supported. The new addition of (partial)
+Unicode (UTF-8) support in UnZip 6.0 has not yet been adapted to
+the encryption password handling in UnZip. On systems that use
+UTF-8 as native character encoding, UnZip simply tries decryption
+with the native UTF-8 encoded password; the built-in attempts to check
+the password in translated encoding have not yet been adapted for UTF-8
+support and will consequently fail.
+.!----------------------------------------------------------------------
+<TOPIC>
+Examples
+<NEXT>
+To use UnZip to extract all members of the archive letters.zip into the
+current directory and subdirectories below it, creating any
+subdirectories as necessary:
-For compatibility with UnZip versions before 6.0 (5.53), the following
-obsolete short forms are still accepted:
<LITERAL>
-| Obsolete form: Modern form:
-| /RESTORE /RESTORE = OWNER_PROT
-| /NORESTORE /RESTORE = NOOWNER_PROT
+unzip letters
<LARETIL>
-<QUALIFIER>
-/SCREEN
-/SCREEN
-<NEXT>
-/NOSCREEN
+To extract all members of letters.zip into the current directory only:
-Extracts matching files to SYS$OUTPUT (the terminal).
-<QUALIFIER>
-/TEST
+<LITERAL>
+unzip /junk_dirs letters
+<LARETIL>
-/TEST
-<NEXT>
-/NOTEST
+To test letters.zip, printing only a summary message indicating
+whether the archive is OK or not:
-Test archive files.
-<QUALIFIER>
-/TEXT
+<LITERAL>
+unzip /test /quiet letters
+<LARETIL>
-/TEXT[=(KEYWORD, ...)]
-<NEXT>
-/NOTEXT (default)
+To test all ".zip" archives in the current directory, printing
+only the summaries:
-Selects conversion to VMS standard text file format.
-The optional keywords recognized are:
<LITERAL>
-| AUTO Automatically extracts files marked as "text" (rather
-| than "binary") in standard VMS text file format. (default)
-| ALL Extracts all files in standard VMS text file format.
-| NONE Same as /NOTEXT.
-| STMLF Use Stream_LF record format for text files (instead of the
-| default variable-length record format).
+unzip /test /quiet *.zip
<LARETIL>
-A similar functionality is available for binary files, see qualifier /BINARY.
-<QUALIFIER>
-/TIMESTAMP
+(On a Unix system, the wildcard member name would typically need to be
+quoted to keep a a Unix shell from expanding ("globbing") it. This is
+not necessary on VMS. However, a name with a slash ("/") character,
+such as "*/zip*.*", must be quoted. Otherwise, DCL may interpret the
+slash as introducing a qualifier, causing unexpected behavior or an
+"%CLI-W-IVQUAL, unrecognized qualifier" error.)
-/TIMESTAMP
+The following command extracts to standard output all members of
+letters.zip whose names end in ".tex", auto-converting to the
+local end-of-line convention, in Stream_LF record format, and piping the
+output into TYPE /PAGE:
-Sets the timestamp of an archive to that of its newest file. This qualifier
-corresponds to zip's /APPEND/LATEST (-go) option, but can be applied to
-wildcard zipfile specifications (e.g. "*.zip") and is much faster.
-<QUALIFIER>
-/TRAVERSE_DIRS
+<LITERAL>
+pipe unzip /screen /text=(auto, stmlf) letters *.tex | \
+ type /page sys$input
+<LARETIL>
-/TRAVERSE_DIRS
-<NEXT>
-/NOTRAVERSE_DIRS (default)
+To extract from source.zip all Fortran and C source files (*.f,
+*.c, *.h) and Makefile into the SYS$SCRATCH directory:
-Allows to extract archive members into locations outside of the currently
-active "extraction root dir". For security reasons, UnZip normally
-removes "parent dir" path components ("../") from the names of extracted
-files. This feature (new for UnZip 5.50) prevents UnZip from accidentally
-writing files to "sensitive" areas outside the directory tree below the
-specified "extraction root". By specifying the /TRAVERSE_DIRS option,
-this security feature can be switched off. This allows users to extract
-(older) archives that made use of "../" to create multiple directory
-trees at the level of the current extraction folder.
-<QUALIFIER>
-/UPDATE
+<LITERAL>
+unzip source.zip *.[fch] Makefile /directory = sys$scratch
+<LARETIL>
-/UPDATE
-<NEXT>
-/NOUPDATE
+To extract all FORTRAN and C source files, regardless of case (for
+example, both *.c and *.C, and any makefile, Makefile, MAKEFILE or
+similar):
-Update existing files; create new ones if needed.
-<QUALIFIER>
-/VERSION
+<LITERAL>
+unzip -C source.zip *.[fch] makefile /directory = sys$scratch
+<LARETIL>
-/VERSION
-<NEXT>
-/NOVERSION (default)
+The following command extracts only newer versions of the files already
+in the current directory, without querying. (Note: Be careful of
+extracting in one timezone an archive created in another. ZIP archives
+created by Zip versions before 2.1 contain no timezone
+information, and a "newer" file from an eastern timezone may, in fact,
+be older):
-Retain VMS file version numbers.
+<LITERAL>
+unzip /freshen /existing=new_version sources
+<LARETIL>
-<TOPIC>
-Authors
+To extract newer versions of the files already in the current directory
+and to create any files not already there (same caveat as previous
+example):
-Info-ZIP; currently maintained by Christian Spieler. VMS support maintained
-by Igor Mandrichenko, Steven M. Schweda, Christian Spieler and Hunter Goatley.
-Originally based on a program by Samuel H. Smith.
+<LITERAL>
+unzip /update /existing=new_version sources
+<LARETIL>
-VMS on-line help ported from UNZIP.TXT by Hunter Goatley.
+To display a configuration report showing the program version, the OS
+and compiler used to build it, a list of optional features enabled at
+build time, and the values of all the relevant environment variables:
+<LITERAL>
+unzip /verbose
+<LARETIL>
+.!----------------------------------------------------------------------
<TOPIC>
Exit_Status
+<NEXT>
+UnZip's exit status approximates the exit codes defined by
+PKWARE. On VMS, UnZip's UNIX-style exit values are translated into
+VMS-style status codes with facility code 1954 = %x7A2, and with the
+inhibit-message (%x10000000) and facility-specific (%x00008000) bits
+set:
-On VMS, UnZip's UNIX-style exit values are mapped into VMS-style status
-codes with facility code 1954 = %x7A2, and with the inhibit-message
-(%x10000000) and facility-specific (%x00008000) bits set:
<LITERAL>
-| %x17A28001 normal exit
-| %x17A28000 + 16*UnZip_error_code warnings
-| %x17A28002 + 16*UnZip_error_code normal errors
-| %x17A28004 + 16*UnZip_error_code fatal errors
+%x17A28001 normal exit
+%x17A28000 + 16*UnZip_error_code warnings
+%x17A28002 + 16*UnZip_error_code normal errors
+%x17A28004 + 16*UnZip_error_code fatal errors
<LARETIL>
Note that multiplying the UNIX-style UnZip error code by 16 places it
The UnZip VMS exit codes include severity values which approximate those
defined by PKWARE, as shown in the following table:
+
+<LITERALW>
+ VMS UnZip
+ severity err code Error description
+----------+----------+----------------------------------------------
+ Success 0 Normal. No errors or warnings detected.
+ Warning 1 One or more warnings were encountered, but
+ processing completed successfully. This
+ includes archives where one or more (but not
+ all) files were skipped because of an
+ unsupported compression or encryption method,
+ or a bad encryption password.
+ Error 2 Error in the archive format. Processing may
+ or may not have completed successfully.
+ Fatal 3 Severe error in the archive format.
+ Processing probably failed immediately.
+ Fatal 4 Memory allocation failed in program
+ initialization.
+ Fatal 5 Memory allocation or terminal I/O failed in
+ password processing.
+ Fatal 6 Memory allocation failed while decompressing
+ to disk.
+ Fatal 7 Memory allocation failed while decompressing
+ in memory.
+ Fatal 8 Memory allocation failed. (Currently not
+ used.)
+ Error 9 Specified archive files were not found.
+ Error 10 Invalid command-line options or parameters.
+ Error 11 No matching files were found.
+ Fatal 50 Disk (file system) filled during extraction.
+ Fatal 51 Unexpected end-of-file while reading the
+ archive.
+ Error 80 User interrupt (Ctrl/C).
+ Error 81 No files were processed, because of
+ unsupported compression or encryption
+ methods.
+ Error 82 No files were processed, because of bad
+ encryption password(s).
+ Fatal 83 Large-file archive could not be processed by
+ this small-file program.
+<WLARETIL>
+.!----------------------------------------------------------------------
+<TOPIC>
+Bugs
+<NEXT>
+Multi-part archives are not yet supported, except in conjunction with
+Zip. (All parts must be concatenated together in order, and then
+"zip -F" (for Zip 2.x) or "zip -FF" (for Zip 3.x) must be
+performed on the concatenated archive in order to "fix" it. Also,
+zip 3.0 and later can combine multi-part (split) archives into a
+combined single-file archive using "zip -s- inarchive -O
+outarchive". See the zip manual page for more information.) This may
+be corrected in the next major release.
+
+Archives read from standard input are not yet supported, except with
+UnZip (and then only the first member of the archive can be extracted).
+
+Archives encrypted with 8-bit-character passwords (such as passwords
+with accented European characters) may not be portable across systems
+and/or other archivers. See also Encryption_Decryption.
+
+UnZip's -M ("--more") option tries to take into account
+automatic wrapping of long lines. However, the code may fail to detect
+the correct wrapping locations. First, TAB characters (and similar
+control sequences) are not taken into account, they are handled as
+ordinary printable characters. Second, depending on the actual system
+type, UnZip may not detect the true terminal/emulator geometry,
+but instead may rely on "commonly used" default dimensions. The correct
+handling of tabs would require the implementation of a query for the
+actual tab setup on the output terminal/emulator.
+
+[Unix] Unix special files such as FIFO buffers (named pipes), block
+devices and character devices are not restored even if they are somehow
+represented in the archive, nor are hard-linked files
+relinked. Basically, the only file types restored by UnZip are
+regular files, directories, and symbolic (soft) links.
+
+[OS/2] Extended attributes for existing directories are only updated if
+the -o ("--overwrite") option is given. This is a limitation of the
+operating system; because directories only have a creation time
+associated with them, UnZip has no way to determine whether the stored
+attributes are newer or older than those on disk. In practice this may
+mean a two-pass approach is required: first unpack the archive normally
+(with or without freshening/updating existing files), then overwrite
+just the directory entries (for example, "unzip -o foo */").
+.!----------------------------------------------------------------------
+<TOPIC>
+URL
+<NEXT>
+The Info-ZIP main Web page is:
<LITERAL>
-| VMS UnZip err
-| severity code Error description
-| ----------+---------+----------------------------------------------
-| Success 0 Normal. No errors or warnings detected.
-| Warning 1 One or more warnings were encountered, but
-| processing completed successfully anyway.
-| This includes archives where one or more
-| (but not all) files were skipped because of
-| unsupported compress or encrypt methods, or
-| bad passwords.
-| Error 2 Error in the archive format. Processing may
-| have completed successfully anyway. Some
-| defects in archives (made by other programs)
-| can be repaired transparently.
-| Fatal 3 Severe error in the archive format. Process-
-| ing probably failed immediately.
-| Fatal 4 Memory allocation failed in program initial-
-| ization.
-| Fatal 5 Memory allocation failed in password pro-
-| cessing.
-| Fatal 6 Memory allocation failed while decompressing
-| to disk.
-| Fatal 7 Memory allocation failed while decompressing
-| in memory.
-| Fatal 8 Memory allocation failed (reserved for
-| future use).
-| Error 9 Specified archive files were not found.
-| Error 10 Invalid command-line options or parameters.
-| Error 11 No files matched selection criteria.
-| Fatal 50 Disk full.
-| Fatal 51 Unexpected end-of-file while reading the
-| archive.
-| Error 80 User interrupt (Ctrl/C).
-| Error 81 No files were processed, because of unsup-
-| ported compress or encrypt methods.
-| Error 82 No files were processed, because of bad
-| password(s).
-| Fatal 83 Large-file archive could not be processed by
-| this small-file program.
+http://www.info-zip.org/
<LARETIL>
+FTP access is available, too:
+<LITERAL>
+ftp://ftp.info-zip.org/pub/infozip/
+<LARETIL>
+.!----------------------------------------------------------------------
+.!======================================================================
<TOPIC>
-UNIX_Options
-
-The default action of UnZip is to extract all zipfile entries. The following
-options and modifiers can be provided:
-
-<LITERAL>
-| -Z ZipInfo mode
-| -c extract files to SYS$OUTPUT (terminal)
-| -f freshen existing files (replace if newer); create none
-| -h show brief help screen and exit quietly
-| -l list archive files (short format)
-| -p extract files to SYS$OUTPUT; no informational messages
-| -t test archive files
-| -T set zipfile timestamps to that of each archive's newest entry
-| -u update existing files; create new ones if needed
-| -v list archive files (verbose format)
-| -z display only the archive comment
-|
-|MODIFIERS
-| -a extract text files in standard VMS text file format
-| -aa extract all files as text
-| -b auto-extract only binary files in fixed 512-byte record format
-| -bb extract all files as binary in fixed 512-byte record format
-| -j junk paths (don't recreate archive's directory structure)
-| -n never overwrite or make a new version of an existing file
-| -o always make a new version (-oo: overwrite orig) existing file
-| -q perform operations quietly (-qq => even quieter)
-| -C match filenames case-insensitively
-| -D do not restore any timestamps (--D restore them even for dirs)
-| -L convert filenames to lowercase if created under DOS, VMS, etc.
-| -M feed screen output through built-in "more" pager
-| -P<password> supply decryption password on the cmd line (insecure!)
-| -S use Stream_LF record format to extract text files (with -a[a])
-| -V retain (VMS) file version numbers
-| -X restore owner/ACL protection info (may require privileges)
-| -Y treat ".nnn" suffix as version number ("a.b.3" -> "a.b;3")
-| -: allow "../" path components to traverse across top extract dir
-| -2 force creation of ODS2-compatible file names
-<LARETIL>
-
-Note that uppercase options such as -C, -D, -L, -M, -P, -S, -T, -V, -X, -Y,
-and -Z must be specified in quotes (unless SET PROC/PARSE=EXTEND is set).
-For example:
-
-<LITERAL>
-| $ unzip "-VX" -a zipfile
+ZipInfo_mode
+<NEXT>
+When /ZIPINFO is specified, the program runs in ZipInfo mode. Remaining
+options are interpreted as ZipInfo options. If used, /ZIPINFO must be
+the first qualifier on the command line.
+
+ZipInfo reports detailed information about a ZIP archive and its
+members. This information may include file access permissions,
+compression method, encryption method, version and operating system (or
+file system) of the archive-creating program, and so on. The default
+behavior (with no options) is to show a single-line entry for each
+member in the archive, with a header and a trailer providing summary
+information for the entire archive. The format is a cross between Unix
+"ls -l" and "UNZIP /LIST /VERBOSE" output. See
+Detailed_Description. ZipInfo is the same program as UnZip. (On Unix,
+"zipinfo" may be a link to "unzip". On VMS, "ZIPINFO" is normally a DCL
+symbol defined as "''UNZIP' /ZIPINFO".) However, ZipInfo support may
+have been disabled when UnZip was built.
+
+Format:
+<FORMAT>
+ZIPINFO [/zipinfo_options] [file[.zip]] [member [,...]]
+<FORMAT>
+UNZIP /ZIPINFO [/zipinfo_options] [file[.zip]] [member [,...]]
+.!----------------------------------------------------------------------
+<SUBTOPIC>
+Command_Parameters
+<NEXT>
+<PARAMETER>
+file[.zip]
+
+<PTEXT>
+File path/name of a ZIP archive. A wildcard name may be used to specify
+multiple ZIP archives to be processed in one command. On VMS systems,
+any of the standard wildcards for a directory/file specification may be
+used: "...", "*", or "%" (or, since VMS V7.2, "?"). The default archive
+file specification is ".ZIP".
+
+Note that a ".zip" or ".ZIP" file type on an archive is merely a
+convention, not a requirement. For example, a self-extracting ZIP
+archive named "fred" or "fred.exe" could be processed as if it were an
+ordinary archive; just specify the actual file name with its actual name
+ending (if any), whatever that may be.
+<TXETP>
+
+<PARAMETER>
+member [,...]
+
+<PTEXT>
+An optional list of archive members to be processed, separated by
+commas. If no member list is specified, then all archive members are
+processed. Unix-like ("globbing") wildcard patterns may be used to
+match multiple members:
+
+<LITERAL>
+|* Matches a sequence of 0 or more characters.
+|? Matches exactly 1 character.
+|[...] Matches any single character found inside the
+| brackets. Ranges are specified by a beginning
+| character, a hyphen, and an ending character. If an
+| exclamation point ("!") or a caret ("^") follows the
+| left bracket, then the range of characters within
+| the brackets is complemented. That is, anything
+| except the characters inside the brackets is
+| considered a match. To specify a literal left
+| bracket, use the three-character sequence "[[]".
+<LARETIL>
+<TXETP>
+.!----------------------------------------------------------------------
+<SUBTOPIC>
+Qualifiers_Primary_Format
+<NEXT>
+Qualifiers in this group specify the primary report format of
+ZipInfo. Only one of these primary format qualifiers may be specified.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/LONG (-l)
+<NEXT>
+Primary Format. Show member info in long Unix "ls -l" format. Like the
+/MEDIUM format, except that the compressed size (in bytes) is printed
+instead of the compression ratio.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/ONE_LINE (-2)
+<NEXT>
+Primary Format. Show member names only, one per line. Other report
+elements are allowed, if requested explicitly using /HEADER, /TOTALS,
+and/or /COMMENT.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/MEDIUM (-m)
+<NEXT>
+Primary Format. Show member info in medium-length Unix "ls -l" format.
+Like the /SHORT format, except that the compression factor, expressed as
+a percentage, is also included.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/SHORT (-s)
+<NEXT>
+Primary Format. Show member info in short Unix "ls -l" format. This is
+the default behavior, unless /HEADER or /TOTALS is specified.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/VERBOSE (-v)
+<NEXT>
+Primary Format. The ZipInfo /VERBOSE report is very detailed, and
+mostly self-explanatory, but it does assume some familiarity with the
+ZIP archive format. It also includes the archive comment, if
+any. Extra fields in the central directory are broken down into
+subfields, with brief interpretations of recognized subfields (or
+abbreviated dumps of unrecognized subfields).
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.!----------------------------------------------------------------------
+<SUBTOPIC>
+Qualifiers_Ordinary
+<NEXT>
+Qualifiers in this group modify the operation or report format of
+ZipInfo.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/COMMENT (-z)
+<NEXT>
+Include the archive comments (if any) in the report.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/DECIMAL_TIME (-T)
+<NEXT>
+Show the file date-times in a sortable, all-numeric, "YYYYMMDD.hhmmss"
+format. The default date format is an alpha-numeric
+"YY-Mmm-DD hh:mm". For example ("/SHORT", "/SHORT /DECIMAL_TIME"):
+
+<LITERALW>
+-rw-a-- 3.1 fat 211916 tx defX 10-Jun-18 00:27 zip31c/zip.c
+-rw-a-- 3.1 fat 211916 tx defX 20100618.002703 zip31c/zip.c
+<WLARETIL>
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/EXCLUDE (-x)
+<NEXT>
+/EXCLUDE=(member [,...])
+<NEXT>
+An optional list of archive members to be excluded from
+processing. Because wildcard characters normally match "/" directory
+separators (for exceptions see /WILD_SPAN (-W)), this option may be used
+to exclude any files that are in subdirectories. For example,
+<LITERAL>
+UNZIP foo *.[ch] /EXCLUDE = */*
<LARETIL>
+would extract all C source files (*.c, *.h) in the main directory, but
+none in any subdirectories. Without the /EXCLUDE option, all C source
+files in all directories within the archive would be extracted.
+
+Note that archive members are specified using the Unix-style names which
+are used in ZIP archives, not VMS-style names.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/HEADER (-h)
+<NEXT>
+Include a header in the report, showing the archive name, the archive
+size (in bytes), and the number of members in the archive.
+
+For the Unix-format reports (options /LONG, /MEDIUM, /SHORT), the header
+is included by default, if no archive members are specified. If /HEADER
+is specified alone, that is, without one of the Unix-format options, and
+without a member list, then only the header lines will be put out.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+/MATCH (-C, -W)
+<NEXT>
+/MATCH=(keyword, ...)
-<TOPIC>
-UNZIP_OPTS_Default
+Specifies name-matching behavior for names in the member list and
+the /EXCLUDE excluded-member list on the command line.
+
+The optional keywords and values are:
+
+<LITERAL>
+|CASE=BLIND Name matching is case-insensitive. (-C)
+|CASE=SENSITIVE Name matching is case-sensitive. (Default.)
+<LARETIL>
+
+By default, case-sensitive matching is done. For example, specifying
+"makefile" on the command line will match only "makefile" in
+the archive, not "Makefile" or "MAKEFILE". On many systems, the local
+file system is case-insensitive, so case-insensitive name matching would
+be more natural. With /MATCH=CASE=BLIND, "makefile" would match
+"makefile", "Makefile", or "MAKEFILE".
+
+/MATCH does not affect the search for the ZIP archive file(s), nor the
+matching of archive members to existing files on the extraction
+path. So, on a case-sensitive file system, UnZip will never try to
+overwrite a file "FOO" when extracting a member named "foo"!
+
+[WILD_STOP_AT_DIR] If the C macro WILD_STOP_AT_DIR is defined at build
+time, then an additional keyword is allowed:
+
+<LITERAL>
+|NOWILD_MATCH_SLASH Wildcards stop at directory slash. (-W)
+|WILD_MATCH_SLASH Wildcards match directory slash. (Default.)
+<LARETIL>
+
+By default, the wildcard characters "?" (single-character wildcard) and
+"*" (multi-character wildcard) match any character in a member
+path/name. /MATCH=NOWILD_MATCH_SLASH (-W) modifies the pattern-matching
+behavior for archive members so that both "?" (single-character
+wildcard) and "*" (multi-character wildcard) do not match the directory
+separator character "/". (The two-character sequence "**" acts as a
+multi-character wildcard that includes the directory separator in its
+matched characters.) For example, with /MATCH=NOWILD_MATCH_SLASH:
+<LITERAL>
+"*.c" matches "foo.c" but not "mydir/foo.c"
+"**.c" matches both "foo.c" and "mydir/foo.c"
+"*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
+"??*/*" matches "ab/foo" and "abc/foo"
+ but not "a/foo" or "a/b/foo"
+<LARETIL>
+
+This modified behavior is equivalent to the pattern matching style used
+by the shells of some of \fIUnZip\fP's supported target OSs (one example
+is Acorn RISC OS). This option may not be available on systems where
+the Zip archive's internal directory separator character "/" is allowed
+as regular character in native operating system filenames.
+
+[non-VMS] (Currently, UnZip uses the same pattern matching rules for
+both wildcard archive file name specifications and archive member
+selection patterns on most system types. For systems allowing "/" as
+regular filename character, the -W option would not work as expected on
+a wildcard file name specification.)
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/MEMBER_COUNTS (default) (-mc)
+<NEXT>
+/NOMEMBER_COUNTS
+<NEXT>
+Control inclusion of separate member counts for directories, files, and
+(if symlinks are supported) links, after the totals summary at the end
+of the report. By default, they are included. Use /NOMEMBER_COUNTS" to
+suppress them. See also /TOTALS.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/PAGE (-M)
+<NEXT>
+Pipe all output through an internal pager similar to the Unix more(1)
+command. At the end of a screenful of output, UnZip pauses with a
+"--More--" prompt; the next screenful may be viewed by pressing the
+Enter (Return) key or the space bar. UnZip can be terminated by
+pressing the "Q" key and, on some systems, the Enter/Return key. Unlike
+Unix more(1), there is no forward-searching or editing
+capability. Also, UnZip doesn't notice if long lines wrap at the edge
+of the screen, effectively resulting in the printing of two or more
+lines and the likelihood that some text will scroll off the top of the
+screen before being viewed. If the actual number of lines on the screen
+can not be determined, 24 lines will be assumed.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBSUBTOPIC>
+/TOTALS (-t)
+<NEXT>
+Include a totals summary at the end of the report, showing the number of
+members in the report, the sum of their uncompressed sizes, the sum of
+their compressed sizes, and the compression factor as a percentage.
+
+For the Unix-format reports (/LONG, /MEDIUM, /SHORT), the totals summary
+is included by default, if no archive members are specified. If /TOTALS
+is specified alone, that is, without one of the Unix-format options, and
+without a member list, then only the totals summary trailer lines will
+be put out.
+
+The total "bytes compressed" reported includes only the actual data, not
+the ZIP archive meta-data, so the size of the archive will always be
+greater than this value.
+
+See also /MEMBER_COUNTS.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+Detailed_Description
+<NEXT>
+ZipInfo has three basic report formats, providing different degrees of
+detail in the information about the members of an archive: a simple list
+of names (/ONE_LINE (-1, -2)), a Unix ls-style listing (/LONG (-l),
+/MEDIUM (-m), /SHORT (-s)), and a very detailed analysis (/VERBOSE
+(-v)). Some of the information, such as file sizes, is easy to
+interpret. Some of the information involves fairly obscure details of
+ZIP archive structure. ZIP archive structure is documented in the
+PKWARE Inc. APPNOTE.TXT:
+<LITERAL>
+http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+<LARETIL>
+
+The table below shows some typical /LONG report entries:
+
+<LITERALW>
+Perm/Prot Zver Ofs UncSize At CmpSize Cmth ModDate Mtime Name
+----------+----+---+-------+--+-------+----+---------------+----------
+-rw-a-- 3.1 fat 211916 tx 53467 defX 10-Jun-18 00:27 zip3/zip.c
+-rwxr-x--- 3.1 unx 709 Tx 311 aesw 11-Aug-21 22:20 endian.c
+RWED,RE, 3.1 vms 6656 bx 2295 defN 07-Aug-15 14:12 it/T.EXE;8
+<WLARETIL>
+
+Field 1 (Perm/Prot) shows the file permission/protection attributes,
+formatted according to the original operating system or file system
+where the archive was created.
+
+Field 2 (Zver) shows the (approximate) version of the Zip program which
+created the archive.
+
+Field 3 (Ofs) shows the original operating system where the archive was
+created, or the file system on which the member file was stored.
+
+Field 4 (UncSize) shows the original, uncompressed file size.
+
+Field 5 (At) shows some archive member attributes, as detailed in the
+tables below. The first character indicates whether a file was binary
+or text, and whether it was encrypted. The second character indicates
+the presence of a data descriptor and/or an extra field in the member
+data.
+
+<LITERALW>
+ | File Type Extra Field |
+ First char | binary text yes no | Second char
+--------------+-------+----- ------+-----+--------------------
+Encrypted no | b t x - | no Data Descriptor
+ yes | B T X l | yes
+<WLARETIL>
+
+A Data Descriptor holds CRC and size data at an alternate place in the
+archive (after processed member data instead of before), and is
+normally used when the archiving program can't seek in the output
+archive data/file. An Extra Field can hold a wide variety of data,
+including 64-bit file sizes, many kinds of OS-specific attribute data,
+UTC times, and so on.
+
+Field 6 (CmpSize) shows the compressed file size. With /MEDIUM, this
+field shows the compression fraction as a percentage. With /SHORT
+(the default), this field is omitted. This compressed size value
+(unlike the one in an "UNZIP /LIST" report) includes all the
+overhead resulting from Traditional encryption.
+
+Field 7 (Cmth) shows the compression method used. Note that AES_WG
+encryption is treated as a compression method here. Not all of the
+methods shown in the table below are supported. (Some are obsolete.)
+
+<LITERALW>
+ Num Abbr Name, description
+----+----+------------------------------------------------------------
+ 0 stor Store (no compression)
+ 1 shrk Shrink
+ 2 re:1 Reduce (factor 1)
+ 3 re:2 Reduce (factor 2)
+ 4 re:3 Reduce (factor 3)
+ 5 re:4 Reduce (factor 4)
+ 6 i#:# Implode (dictonary_size:Shannon-Fano_trees)
+ 7 tokn Tokenize
+ 8 def# Deflate (N: normal, X: maximum, F: fast, S: super-fast)
+ 9 d64# Deflate64 (N: normal, X: maximum, F: fast, S: super-fast)
+ 10 dcli PKWARE Data Compression Library Imploding - IBM TERSE (old)
+ 12 bzp2 bzip2
+ 14 lzma LZMA
+ 18 ters IBM TERSE (new)
+ 19 lz77 IBM LZ77 z Architecture (PFS)
+ 96 jpeg JPEG
+ 97 wavp WavPack
+ 98 ppmd PPMd version I, Rev 1
+ 99 aesw AES_WG encryption
+<WLARETIL>
+
+Fields 8 and 9 (ModDate, Mtime) show the file modification date-time
+(MS-DOS format, local time).
+
+Field 10 (Name) shows the file path/name.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+Environment_Options
+<NEXT>
+ZipInfo's default behavior may be modified by placing Unix-style
+command-line options in an environment variable. (The VMS CLI
+translator acts only on the command line itself, not on the
+environment variables.) This can be done with any option, but it is
+probably most useful options like -T (/DECIMAL_TIME, decimal time
+format) or one of the non-default Unix format options: -l (/LONG), -m
+(/MEDIUM).
+
+For ZipInfo ("UNZIP /ZIPINFO", ZIPINFO), the environment variable name
+on VMS is ZIPINFO_OPTS (non-VMS: ZIPINFO). For compatibility with Zip,
+if ZIPINFO (ZIPINFO_OPTS on VMS) is not defined, then ZipInfo will use
+ZIPINFOOPT the same way.
+
+For example, to make the default format the long Unix format instead of
+the short Unix format, one could use commands like the following (with
+quotation to preserve lower case in DCL):
+
+<LITERAL>
+define ZIPINFO_OPTS "-l" ! Logical name, or
+ZIPINFO_OPTS = "-l" ! DCL symbol. (Either works.)
+<LARETIL>
+
+Environment options are treated the same as any other Unix-style
+command-line options, except that they are effectively the first options
+on the command line. Generally, the VMS CLI translator will override
+an environment option if an explicit corresponding VMS-style qualifier
+is specified.
+
+The examples show short (one-character) options, but long ("--")
+options are also allowed.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+Examples
+<NEXT>
+To get a basic, short-format listing of the complete contents of a ZIP
+archive zip31c.zip, with both header and totals lines, use only the
+archive name as an argument to zipinfo:
+
+<LITERAL>
+zipinfo zip31c.zip
+zipinfo zip31c
+<LARETIL>
-UnZip allows to modify its default behaviour by specifying (UNIX style)
-option defaults via the UNZIP_OPTS logical name.
-For example, the following will cause UnZip to match filenames without regard
-to case, restore owner/protection information and perform all operations at
-quiet-level 1 by default:
+To produce a basic, long-format listing (not verbose), including header
+and totals lines, use /LONG:
<LITERAL>
-| $ define UNZIP_OPTS "-qCX"
+zipinfo /long zip31c.zip
<LARETIL>
-Note that the quotation marks here are required to preserve lowercase options
-(opposite of the command-line behavior). To negate a default option on the
-command line, add one or more minus signs before the option letter, in
-addition to the leading switch character `-':
+To list the complete contents of the archive without header and totals
+lines, either negate the /HEADER and /TOTALS qualifiers or else specify
+the contents explicitly:
<LITERAL>
-| $ unzip --ql zipfile
+zipinfo /noheader /nototals zip31c.zip
+zipinfo zip31c.zip *
<LARETIL>
-or
+(On a Unix system, the wildcard member name would typically need to be
+quoted to keep a a Unix shell from expanding ("globbing") it. This is
+not necessary on VMS. However, a name with a slash ("/") character,
+such as "*/zip*.*", must be quoted. Otherwise, DCL may interpret the
+slash as introducing a qualifier, causing unexpected behavior or an
+"%CLI-W-IVQUAL, unrecognized qualifier" error.)
+
+To list information on a single archive member, in medium format,
+specify the member name explicitly:
<LITERAL>
-| $ unzip -l-q zipfile
+zipinfo /medium unzip60.zip */unshrink.c
<LARETIL>
-At present it is not possible to decrement an option below zero--that is,
-more than a few minuses have no effect.
+On a VMS system, one could use /DECIMAL_TIME along with an external
+sorting program to get a listing of files in the archive in date-time
+order:
-UNZIP_OPTS may be defined as a symbol rather than a logical, but if both
-are defined, the logical is used.
+<LITERAL>
+pipe zipinfo /decimal_time /long /noheader /nototals zip31c.zip | -
+ sort sys$input sys$output /key = (position:47, size:15, descend)
+<LARETIL>
+
+For a /LONG (-l) format report, the date-time field should begin at
+position 47; for /MEDIUM (-m), 42; for /SHORT (-s), 38. HELP SORT
+[/KEY] should lead to an explanation of the various SORT options.
+(Unlike Unix, VMS does not include a useful "head" or "tail" program.)
+
+On a Unix system, one could use the -T option along with an
+external sorting program (and another filter like "head" or
+"tail") to get a listing of the least or most recently modified
+files in the archive:
+
+<LITERAL>
+zipinfo -l -T -h- -t- zip31c.zip | sort -k 8 | head -12
+zipinfo -l -T -h- -t- zip31c.zip | sort -r -k 8 | head -12
+<LARETIL>
+
+The "sort" option "-k 8" tells it to sort on field 8, which is the
+date-time field in a long- or medium-format (-l, -m) ZipInfo
+report. (Use "-k 7" for the short (-s) format.) The -r option reverses
+the default smallest-to-largest sort order.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+Bugs
+<NEXT>
+As with UnZip, ZipInfo's /PAGE (-M) option is overly
+simplistic in its handling of screen output. As noted above, it fails
+to detect the wrapping of long lines and may thereby cause lines at the
+top of the screen to be scrolled off before being read. ZipInfo
+should detect and treat each occurrence of line-wrap as one additional
+line printed. This requires knowledge of the screen's width as well as
+its height. In addition, ZipInfo should detect the true screen
+geometry on all systems.
+
+The interactions among the various listing format, header, and trailer
+options (/HEADER, /LONG, /MEDIUM, /SHORT, /TOTALS) are unnecessarily
+complex and should be simplified, despite the potential disruption to
+current users.
+.!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+<SUBTOPIC>
+URL
+<NEXT>
+The Info-ZIP main Web page is:
+<LITERAL>
+http://www.info-zip.org/
+<LARETIL>
+
+FTP access is available, too:
+<LITERAL>
+ftp://ftp.info-zip.org/pub/infozip/
+<LARETIL>
+.!----------------------------------------------------------------------
+.!======================================================================
+++ /dev/null
-.!
-.! File: UNZIP_DEF.RNH
-.!
-.! Author: Hunter Goatley
-.!
-.! Date: October 23, 1991
-.!
-.! Description:
-.!
-.! RUNOFF source file for VMS on-line help for portable UnZip.
-.! Adapted from UNZIP.MAN (now UNZIP.TXT).
-.!
-.! To build: $ REN UNZIP_DEF.RNH UNZIP.RNH
-.! $ RUNOFF UNZIP.RNH
-.! $ LIBR/HELP/INSERT libr UNZIP
-.!
-.! Modification history:
-.!
-.! 01-001 Hunter Goatley 23-OCT-1991 09:21
-.! Genesis.
-.! 01-002 Cave Newt 16-MAR-1992 22:37
-.! Updated for UnZip 4.2.
-.! 01-003 Igor Mandrichenko 23-MAY-1992 22:14
-.! Added -X option to command syntax.
-.! 01-004 Cave Newt 24-MAY-1992 13:30
-.! Added UNZIP_OPTS environment variable help.
-.! 01-005 Igor Mandrichenko 14-DEC-1993 18:55
-.! Modified for UnZip V5.1
-.! 01-006 Cave Newt 21-DEC-1993 12:38
-.! Added -x option and cleaned up.
-.! 01-007 Cave Newt 14-JUL-1994 09:45
-.! Added -Z, -C and -L options, removed -U, minor clean-up.
-.! 01-008 Cave Newt 28-JUL-1994 08:57
-.! Removed semi-colons from comments.
-.! 02-001 Christian Spieler 09-DEC-1995 02:25
-.! Modified for UnZip 5.2.
-.! 02-002 Christian Spieler 06-FEB-1996 02:25
-.! Added -h "help" option.
-.! 02-003 Christian Spieler 04-MAR-1997 20:25
-.! Added -P "command line password" option.
-.! 02-004 Christian Spieler 26-JUL-1997 00:05
-.! Added Exit_Codes subtopic, explaining UnZip's VMS return codes.
-.! 02-005 Christian Spieler 28-APR-2000 03:22
-.! Changed references to plaintext UnZip documentation file
-.! into "UNZIP.TXT".
-.! 02-006 Christian Spieler 15-APR-2001 22:29
-.! Added description for extended functionality of -b option.
-.! 02-007 Christian Spieler 10-DEC-2001 13:58
-.! Added description for new -: traverse dirs option.
-.! 02-008 Christian Spieler 29-JAN-2005 01:50
-.! Added description for the -T "set archive timestamp" option.
-.! 02-009 Christian Spieler 04-MAR-2007 14:37
-.! Added description for the -S "Stream-LF text files" option;
-.! updated the documentation of the VMS exit codes.
-.! 02-010 S. Schweda, C. Spieler 28-Dec-2007 21:28
-.! Added description for the -D "timestamp restoration" option.
-.!
-.noflags
-.lm4 .rm72
-.indent -4
-1 UNZIP
-.br
-UnZip is used to extract files compressed and packaged by Zip (see HELP ZIP
-for information on ZIP).
-.sk
-For a brief help on Zip and Unzip, run each without specifying any
-parameters on the command line, or specify the -h flag (but not in UnZip's
-Zipinfo mode).
-.sk
-UNZIP will list, test, or extract from a ZIP archive. ZIP archives are commonly
-found on MS-DOS systems; a VMS version of ZIP can also be found here.
-.sk
-Archive member extraction is implied by the absence of the -c, -p, -t, -l, -v or
--z options. All archive members are processed unless a filespec is provided to
-specify a subset of the archive members.
-Format:
-.sk;.lm+1;.literal
-UNZIP [-cfhlptTuvxz[ajnoqCDLMSVXY:2]] file[.zip] [list] [-x xlist] [-d out_dir]
-.end literal;.lm-1
-.!------------------------------------------------------------------------------
-.indent -4
-2 Parameters
-.sk;.indent -4
-file[.zip]
-.sk
-File specification for the ZIP archive(s) with optional wildcards. UnZip will
-perform actions specified for every zipfile matching the specification.
-Default file specification is SYS$DISK:[].ZIP.
-Note that self-extracting ZIP files are supported; just specify the .EXE
-suffix yourself.
-.sk;.indent -4
-[list]
-.sk
-An optional list of archive members to be processed; if no list is given, all
-archive members are processed. Expressions may be
-used to match multiple members. Expressions should be enclosed in double-quotes
-to prevent interpretation by DCL. Multiple filenames should be separated by
-blanks. Each file specification is similar to a Unix egrep expression and may
-contain:
-.sk
-.literal
- * matches a sequence of 0 or more characters
- ? matches exactly 1 character
- [...] matches any single character found inside the brackets;
- ranges are specified by a beginning character, a hyphen,
- and an ending character. If a '!' or '^' immediately
- follows the left bracket, then any character not in the
- given range is matched.
- Hint: To specify a verbatim left bracket '[', the
- three-character sequence "[[]" has to be used.
-.end literal
-.sk
-.sk;.indent -4
-[-x xlist]
-.sk
-An optional list of archive members to be excluded from processing. The xlist
-overrides any files included in the normal list.
-.sk;.indent -4
-[-d out_dir]
-.sk
-Optional directory specification to be used as target root directory
-for files to be extracted. Directory should be specified in "[.foo]"
-format rather than "foo.dir" or "foo/" format.
-.!------------------------------------------------------------------------------
-.indent -4
-2 Options
-.br
-The default action of UnZip is to extract all zipfile entries. The following
-options and modifiers can be provided:
-.sk;.literal
- -Z ZipInfo mode
- -c extract files to SYS$OUTPUT (terminal)
- -f freshen existing files (replace if newer); create none
- -h show brief help screen and exit quietly
- -l list archive files (short format)
- -p extract files to SYS$OUTPUT; no informational messages
- -t test archive files
- -T set zipfile timestamps to that of each archive's newest entry
- -u update existing files; create new ones if needed
- -v list archive files (verbose format)
- -z display only the archive comment
-.end literal;.sk;.literal
- MODIFIERS
- -a extract text files in standard VMS text file format
- -aa extract all files as text
- -b auto-extract only binary files in fixed 512-byte record format
- -bb extract all files as binary in fixed 512-byte record format
- -j junk paths (don't recreate archive's directory structure)
- -n never overwrite or make a new version of an existing file
- -o always make a new version (-oo: overwrite orig) existing file
- -q perform operations quietly (-qq => even quieter)
- -C match filenames case-insensitively
- -D do not restore any timestamps (--D restore them even for dirs)
- -L convert filenames to lowercase if created under DOS, VMS, etc.
- -M feed screen output through built-in "more" pager
- -P<password> supply decryption password on the cmd line (insecure!)
- -S use Stream_LF record format to extract text files (with -a[a])
- -V retain (VMS) file version numbers
- -X restore owner/ACL protection info (may require privileges)
- -Y treat ".nnn" suffix as version number ("a.b.3" -> "a.b;3")
- -: allow "../" path components to traverse across top extract dir
- -2 force creation of ODS2-compatible file names
-.end literal;.sk
-Note that uppercase options (-C, -D, -L, -M, -P, -S, -T, -V, -X, -Y, and
--Z) must be specified in quotes (unless SET PROC/PARSE=EXTEND is set).
-For example:
-.sk;.literal
- unzip "-VX" -a zipfile
-.end literal;.sk
-When extracting to SYS$OUTPUT (-c or -p options) redirected to a file,
-you may want to override the default text file conversion by specifying
-the -b option. A single "-b" option switches to "binary piping" mode
-for Zip entries marked as non-text, only. To force "binary piping" mode
-even for Zip file entries marked as text, the "-bb" option should be used.
-(Please note that a later "-a" cancels any -b option, see below.)
-.sk
-The output conversion options -b and -a may be combined to perform
-binary conversions on binary files and text conversion on text files.
-But note: For compatibility with implementation on other systems, -b cancels
-any -a option; to get the intended result, -a must be specified AFTER -b.
-And, in combination, "text" recognition takes precedence; this means
-that -bba (-bb -a) has the same effect as -ba (-b -a), and -aa overrides
-binary conversion for ALL files.
-.sk
-The conversion option -S is only effective when used together with
--a or -aa. When specified, "text" files are written in Stream-LF record
-format instead of the VMS default of Variable-Length record format.
-(When no conversion options are specified, all non-VMS entries are always
-written as Stream-LF files.)
-.sk
-Please note that using the "-P<password>" option is higly insecure, the
-plaintext password may be seen by others. For this reason (and because of
-lack of space), the "-P<password>" option is not advertised on UnZip's
-online help screen.
-.!------------------------------------------------------------------------------
-.indent -4
-2 Exit_Status
-.br
-On VMS, UnZip's UNIX-style exit values are mapped into VMS-style status
-codes with facility code 1954 = %x7A2, and with the inhibit-message
-(%x10000000) and facility-specific (%x00008000) bits set:
-.sk
-.literal
- %x17A28001 normal exit
- %x17A28000 + 16*UnZip_error_code warnings
- %x17A28002 + 16*UnZip_error_code normal errors
- %x17A28004 + 16*UnZip_error_code fatal errors
-.end literal
-.sk
-Note that multiplying the UNIX-style UnZip error code by 16 places it
-conveniently in the hexadecimal representation of the VMS exit code,
-"__" in %x17A28__s, where "s" is the severity code. For example, a
-missing archive might cause UnZip error code 9, which would be
-transformed into the VMS exit status %X17A28092.
-.sk
-The UnZip VMS exit codes include severity values which approximate those
-defined by PKWARE, as shown in the following table:
-.literal
-
- VMS UnZip err
- severity code Error description
- ----------+---------+----------------------------------------------
- Success 0 Normal. No errors or warnings detected.
- Warning 1 One or more warnings were encountered, but
- processing completed successfully anyway.
- This includes archives where one or more
- (but not all) files were skipped because of
- unsupported compress or encrypt methods, or
- bad passwords.
- Error 2 Error in the archive format. Processing may
- have completed successfully anyway. Some
- defects in archives (made by other programs)
- can be repaired transparently.
- Fatal 3 Severe error in the archive format. Process-
- ing probably failed immediately.
- Fatal 4 Memory allocation failed in program initial-
- ization.
- Fatal 5 Memory allocation failed in password pro-
- cessing.
- Fatal 6 Memory allocation failed while decompressing
- to disk.
- Fatal 7 Memory allocation failed while decompressing
- in memory.
- Fatal 8 Memory allocation failed (reserved for
- future use).
- Error 9 Specified archive files were not found.
- Error 10 Invalid command-line options or parameters.
- Error 11 No files matched selection criteria.
- Fatal 50 Disk full.
- Fatal 51 Unexpected end-of-file while reading the
- archive.
- Error 80 User interrupt (Ctrl/C).
- Error 81 No files were processed, because of unsup-
- ported compress or encrypt methods.
- Error 82 No files were processed, because of bad
- password(s).
- Fatal 83 Large-file archive could not be processed by
- this small-file program.
-.end literal
-.!------------------------------------------------------------------------------
-.indent -4
-2 Logical_Names
-.br
-UnZip allows to modify its default behaviour by specifying option defaults
-via the UNZIP_OPTS logical name.
-For example, the following will cause UnZip to restore owner/protection
-information and perform all operations at quiet-level 1 by default:
-.sk;.literal
- define UNZIP_OPTS "-qX"
-.end literal;.sk
-Note that the quotation marks here are required to preserve lowercase options
-(opposite of the command-line behavior).
-To negate a default option on the command line, add one or more minus
-signs before the option letter, in addition to the leading switch character
-`-':
-.sk;.literal
- unzip --ql zipfile
-.end literal
-or
-.literal
- unzip -l-q zipfile
-.end literal;.sk
-At present it is not possible to decrement an option below zero--that is,
-more than a few minuses have no effect.
-.sk
-UNZIP_OPTS may be defined as a symbol rather than a logical name, but if
-both are defined, the logical name takes precedence.
-.!-----------------------------------------------------------------------------
-.indent -4
-2 Authors
-.br
-Info-ZIP; currently maintained by Christian Spieler. VMS support maintained
-by Christian Spieler and Hunter Goatley. Originally based on a program
-by Samuel H. Smith.
-.sk
-VMS on-line help ported from UNZIP.TXT by Hunter Goatley.
1 UNZIPSFX
- unzipsfx - self-extracting stub for prepending to ZIP
+ UnZipSFX - self-extracting stub for prepending to ZIP
archives
- <name of unzipsfx+archive combo> [-cfptuz[ajnoqsCLV$]]
+ <combined_UnZipSFX+Zip_archive_name> [-cfptuz[ajnoqsCLV$]]
[file(s) ...] [-x xfile(s) ...]
- unzipsfx is a modified version of unzip designed to be
- prepended to existing ZIP archives in order to form self-
- extracting archives. Instead of taking its first non-flag
- argument to be the zipfile(s) to be extracted, unzipsfx
- seeks itself under the name by which it was invoked and
+ UnZipSFX is a modified version of UnZip, designed to be
+ prepended to existing ZIP archives, in order to form self-
+ extracting archives. Instead of taking its first non-option
+ argument to be the zipfile(s) to be extracted, UnZipSFX
+ seeks itself under the name by which it was invoked, and
tests or extracts the contents of the appended archive.
Because the executable stub adds bulk to the archive (the
whole purpose of which is to be as small as possible), a
number of the regular version's less-vital capabilities have
been removed. Among these are the usage (or help) screen,
- the listing and diagnostic functions (-l and -v), the abil-
- ity to decompress older compression formats (the ``reduce,''
- ``shrink'' and ``implode'' methods), and the ability to
- extract to a directory other than the current one. Decryp-
- tion is supported as a compile-time option but should be
- avoided unless the attached archive contains encrypted
- files.
-
- Note that self-extracting archives made with unzipsfx are no
+ the listing and diagnostic functions (-l and -v), and the
+ ability to decompress older compression formats (the
+ "reduce", "shrink", and "implode" methods). The ability to
+ extract to a directory other than the current one can be
+ selected as a compile-time option, which is now enabled by
+ default since UnZipSFX version 5.5. Similarly, decryption
+ is supported as a compile-time option. but should be avoided
+ unless the attached archive contains encrypted files.
+
+ On VMS, there are two forms of UnZipSFX. UNZIPSFX.EXE uses
+ a UNIX-style command-line interface. UNZIPSFX_CLI.EXE uses
+ a DCL-style command-line interface. Most of the description
+ here refers to the UNIX-style interface. See the subtopic
+ VMS-Style_Options for details on the DCL-style interface.
+
+ Note that self-extracting archives made with UnZipSFX are no
more (or less) portable across different operating systems
- than is the unzip executable itself. In general a self-
+ than is the UnZip executable itself. In general a self-
extracting archive made on a particular Unix system, for
example, will only self-extract under the same flavor of
- Unix. Regular unzip may still be used to extract the embed-
- ded archive as with any normal zipfile, although it will
+ Unix. Regular UnZip may still be used to extract the embed-
+ ded archive as with any normal zipfile, although it may
generate a harmless warning about extra bytes at the begin-
ning of the zipfile.
-
-
[file(s)]
An optional list of archive members to be processed.
An optional list of archive members to be excluded from
processing. Since wildcard characters match directory
- separators (`/'), this option may be used to exclude
+ separators ("/"), this option may be used to exclude
any files which are in subdirectories. For example,
- ``unzip foo *.[ch] -x */*'' would extract all C source
- files in the main directory, but none in any subdirec-
- tories. Without the -x option, all C source files in
- all directories within the zipfile would be extracted.
+ "mcr sys$disk:[]foosfx *.[ch] -x */*" would extract all
+ C source files in the main directory, but none in any
+ subdirectories. Without the -x option, all C source
+ files in all directories within the zipfile would be
+ extracted.
+
+ If UnZipSFX is compiled with SFX_EXDIR defined, then the
+ following option is also enabled:
+
+[-d exdir]
+ An optional directory to which to extract files. By
+ default, all files and subdirectories are recreated in
+ the current directory; the -d option allows extraction
+ into an arbitrary directory (always assuming one has
+ permission to write to the directory). The option and
+ directory may be concatenated without any white space
+ between them.
+
+2 VMS-Style_Options
+
+ UnZipSFX_CLI supports the following UnZip options: /SCREEN
+ (-c or -p, extract to standard output/terminal), /FRESHEN
+ (-f) or /UPDATE (-u) (existing files upon extraction), /TEST
+ (-t, test archive), and /COMMENT (-z, show archive comment).
+ All normal listing options, /LIST (-l, -v) and /ZIPINFO (-Z)
+ have been removed, but /TEST (-t) may be used as a "poor
+ man's" listing. Alternatively, the creator of the self-
+ extracting archives may wish to include a short listing in
+ the zipfile comment.
+
+ See the normal UnZip_CLI help for a more complete descrip-
+ tion of these options.
+
+ MODIFIERS
-2 Options
+ UnZipSFX_CLI currently supports all UnZip_CLI modifiers:
+ /CASE_MATCH -C match names case-[in]senstively
+ /JUNK -j junk paths
+ /NAMES =
+ [NO]LOWERCASE -L downcase names from all-uppercase OS
+ [NO]ODS2 -2 ODS2 restrictions (invalid -> "_")
+ [NO]SPACES -s convert spaces in names to underscores
+ /OVERWRITE -n|-o control overwriting of existing files
+ /QUIET -q operate quietly
+ /RESTORE -X control restoration of owner/ACL protection
+ /TEXT -a convert text files
+ /VERSION -V retain version numbers
- unzipsfx supports the following unzip options: -c and
- -p (extract to standard output/screen), -f and -u (freshen
+ (Support for regular ASCII text-conversion may be removed in
+ future versions, since it is simple enough for the archive's
+ creator to ensure that text files have the appropriate for-
+ mat for the local OS. EBCDIC conversion will of course con-
+ tinue to be supported since the zipfile format implies ASCII
+ storage of text files.)
+
+ See the normal UnZip_CLI help for a more complete descrip-
+ tion of these modifiers.
+
+2 UNIX-Style_Options
+
+ UnZipSFX supports the following UnZip options: -c and -p
+ (extract to standard output/terminal), -f and -u (freshen
and update existing files upon extraction), -t (test
archive) and -z (print archive comment). All normal listing
options (-l, -v and -Z) have been removed, but the testing
- option (-t) may be used as a ``poor man's'' listing. Alter-
+ option (-t) may be used as a "poor man's" listing. Alter-
natively, those creating self-extracting archives may wish
to include a short listing in the zipfile comment.
- See unzip for a more complete description of these
- options.
+ See the normal UnZip help for a more complete description of
+ these options.
MODIFIERS
- unzipsfx currently supports all unzip modifiers: -a
- (convert text files), -n (never overwrite), -o (overwrite
- without prompting), -q (operate quietly), -C (match names
- case-insenstively), -L (convert uppercase-OS names to lower-
- case), -j (junk paths) and -V (retain version numbers); plus
- the following operating-system specific options: -X
- (restore VMS owner/protection info), -s (convert spaces in
- filenames to underscores [DOS, OS/2, NT]) and -$ (restore
- volume label [DOS, OS/2, NT, Amiga]).
+ UnZipSFX currently supports all UnZip modifiers: -a (convert
+ text files), -n (never overwrite), -o (overwrite without
+ prompting), -q (operate quietly), -C (match names case-
+ insenstively), -L (convert uppercase-OS names to lowercase),
+ -j (junk paths), -s (convert spaces in filenames to under-
+ scores), and -V (retain version numbers); plus the following
+ operating-system-specific options: -X (restore VMS owner/ACL
+ protection info), and -$ (restore volume label [DOS, OS/2,
+ NT, Amiga]).
(Support for regular ASCII text-conversion may be removed in
future versions, since it is simple enough for the archive's
tinue to be supported since the zipfile format implies ASCII
storage of text files.)
- See unzip for a more complete description of these
- modifiers.
+ See the normal UnZip help for a more complete description of
+ these modifiers.
2 Environment_options
- unzipsfx uses the same environment variables as unzip
- does, although this is likely to be an issue only for the
- person creating and testing the self-extracting archive.
- See unzip for details.
+ UnZipSFX uses the same environment variables as normal
+ UnZip does, although this is likely to be of interest only
+ for the person creating and testing the self-extracting
+ archive. See the normal UnZip help for details.
2 Decryption
- Decryption is supported exactly as in unzip; that is,
+ Decryption is supported exactly as in normal UnZip; that is,
interactively with a non-echoing prompt for the password(s).
- See unzip for details. Once again, note that if the
- archive has no encrypted files there is no reason to use a
- version of unzipsfx with decryption support; that only adds
- to the size of the archive.
+ See the normal UnZip help for details. Once again, note
+ that if the archive has no encrypted files, there is no
+ reason to use a version of UnZipSFX with encryption support;
+ that only adds to the size of the archive.
+
+2 AUTORUN COMMAND
+
+ If UnZipSFX was compiled with CHEAP_SFX_AUTORUN defined, a
+ simple "command autorun" feature is supported. You may
+ include a command in the Zip archive comment, using the
+ following format:
+
+ $AUTORUN$>[command line string]
+
+ When UnZipSFX recognizes the "$AUTORUN$>" token at the
+ beginning of the Zip archive comment, the remainder of the
+ first line of the comment (until the first newline char-
+ acter) is passed as a shell command to the operating system
+ using the C RTL system() function. Before executing the
+ command, UnZipSFX displays the command at the user's
+ terminal, and prompts for confirmation. When the user has
+ switched off prompting by specifying the -q option, autorun
+ commands are not executed.
+
+ If the archive comment contains additional lines of text,
+ the remainder of the archive comment following the first
+ line is displayed normally, unless quiet operation was
+ requested by a -q option.
2 Examples
- To create a self-extracting archive letters from a regular
- zipfile letters.zip and change the new archive's permissions
- to be world-executable under Unix:
+ To create a self-extracting archive "letters.exe" from a
+ regular zipfile "letters.zip":
+
+ copy unzipsfx.exe, letters.zip letters.exe
+ zip "-A" letters.exe
- cat unzipsfx letters.zip > letters
- chmod 755 letters
+ The "zip -A" step is required to adjust the data in the
+ self-extracting archive to compensate for the extra space
+ occupied by the UnZipSFX executable. Without this adjust-
+ ment, UnZipSFX may emit a warning message when it is run,
+ and some other file extraction programs may reject the self-
+ extracting archive.
- To create the same archive under MS-DOS, OS/2 or NT (note
- the use of the /b [binary] option to the copy command):
+ The UnZip source kit also includes a DCL procedure to do
+ this, [.vms]makesfx.com. Comments in the file explain how
+ to use it. For this example:
- copy /b unzipsfx.exe+letters.zip letters.exe
+ @ makesfx.com letters
- Under VMS:
+ To extract the complete contents into the current directory,
+ recreating all files and subdirectories as necessary, one
+ could run the self-extracting archive with no options. On a
+ VMS system, one can simply use the RUN command. For
+ example:
- copy unzipsfx.exe,letters.zip letters.exe
- letters == "$currentdisk:[currentdir]letters.exe"
+ run letters
- (The VMS append command may also be used. The second com-
- mand installs the new program as a ``foreign command'' capa-
- ble of taking arguments.) To test (or list) the newly
- created self-extracting archive:
+ To run a self-extracting archive with options, one could
+ define a DCL foreign-command symbol, and then use that. For
+ example, To test (or list) the newly created self-extracting
+ archive:
+ letters = "$ sys$disk:[]letters"
letters -t
- To test letters quietly, printing only a summary message
- indicating whether the archive is OK or not:
+ or one could use the MCR command in one step:
- letters -tq
+ mcr sys$disk:[]letters -t
- To extract the complete contents into the current directory,
- recreating all files and subdirectories as necessary:
+ By default, MCR looks in SYS$SYSTEM, so a full device and
+ directory specification is normally required to override
+ that default. "sys$disk:[]" specifies the current default
+ device and directory, but any other complete spec may be
+ used, as appropriate.
+
+ In the examples below, the MCR method is shown. UNIX-style
+ and VMS-style options are shown. (UNZIPSFX_CLI.EXE can
+ handle either style. UNZIPSFX.EXE can handle only the UNIX
+ style.)
+
+ To test "letters.exe" quietly, printing only a summary
+ message indicating whether the archive is OK or not:
+
+ mcr sys$disk:[]letters -tqq
+
+ mcr sys$disk:[]letters /test /quiet = super
+
+ To extract all *.txt files:
+
+ mcr sys$disk:[]letters *.txt
- letters
+ To extract everything except the *.txt files:
+
+ mcr sys$disk:[]letters -x *.txt
+
+ mcr sys$disk:[]letters /exclude = "*.txt"
To extract only the README file to standard output (the
- screen):
+ user's terminal):
- letters -c README
+ mcr sys$disk:[]letters -c README
+
+ mcr sys$disk:[]letters /screen README
To print only the zipfile comment:
- letters -z
+ mcr sys$disk:[]letters -z
+
+ mcr sys$disk:[]letters /comment
2 Limitations
- The principle and fundamental limitation of unzipsfx is that
+ The principle and fundamental limitation of UnZipSFX is that
it is not portable across architectures or operating sys-
tems, and therefore neither are the resulting archives. For
some architectures there is limited portability, however
(e.g., between some flavors of Intel-based Unix).
- unzipsfx has no knowledge of the user's PATH, so in general
- an archive must either be in the current directory when it
- is invoked, or else a full or relative path must be given.
- If a user attempts to extract the archive from a directory
- in the PATH other than the current one, unzipsfx will print
- a warning to the effect, ``can't find myself.'' This is
- always true under Unix and may be true in some cases under
- MS-DOS, depending on the compiler used (Microsoft C fully
- qualifies the program name, but other compilers may not).
- Under OS/2 and NT there are operating-system calls available
- which provide the full path name, so the archive may be
- invoked from anywhere in the user's path. The situation is
- not known for Atari TOS, MacOS, etc.
-
- As noted above, a number of the normal unzip functions
- have been removed in order to make unzipsfx smaller: usage
- and diagnostic info, listing functions and extraction to
- other directories. Also, only stored and deflated files are
- supported. The latter limitation is mainly relevant to
- those who create SFX archives, however.
-
- VMS users must know how to set up self-extracting archives
- as foreign commands in order to use any of unzipsfx's
- options. This is not necessary for simple extraction, but
- the command to do so then becomes, e.g., ``run letters'' (to
- continue the examples given above).
-
- unzipsfx is not supported on the Amiga because of the way
- the loader works; the entire archive contents would be
- loaded into memory by default. It may be possible to work
- around this by defining the attached archive to be a ``debug
- hunk,'' but compatibility problems between the ROM levels of
- older Amigas and newer ones are likely to cause problems
- regardless.
-
- All current bugs in unzip exist in unzipsfx as well.
+ As noted above, a number of the normal UnZip functions have
+ been removed in order to make UnZipSFX smaller: usage and
+ diagnostic info, and listing functions, and possibly ex-
+ traction to other directories. Also, only stored and
+ deflated files are supported by default. This last limit-
+ ation is mainly relevant to those who create SFX archives,
+ however.
+
+ All current bugs in UnZip are probably in UnZipSFX as well.
2 Diagnostics
- unzipsfx's exit status (error level) is identical to that of
- unzip; see the corresponding help entry.
+ UnZipSFX's exit status (error level) is identical to that of
+ UnZip; see the corresponding help entry.
2 See_also
- funzip, unzip, zip, zipcloak, zipgrep,
- zipinfo, zipnote, zipsplit
+ Formatted UnZip "man" pages in the source kit:
+ unzip.txt, zipinfo.txt
+
+ Related Zip programs:
+ zip, zip_cli, zipcloak, zipnote, zipsplit
+
+ The main Info-ZIP Web page is currently at:
+ http://www.info-zip.org/
+ or
+ ftp://ftp.info-zip.org/pub/infozip/
2 Authors
Greg Roelofs was responsible for the basic modifications to
- UnZip necessary to create UnZipSFX. See unzip for the
- current list of zip-bugs authors, or the file CONTRIBS in
- the UnZip source distribution for the full list of Info-ZIP
- contributors.
+ UnZip necessary to create UnZipSFX. See the normal unzip
+ help for the current list of Info-ZIP team members.
+
+++ /dev/null
-Ident = "UnZipSFX 6.0"
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
return_VMS
screensize()
screenlinewrap()
+ strncasecmp()
version()
+ establish_ctrl_t()
+ acc_cb()
+ decc_init()
+ get_rms_defaults()
+ get_rms_fileprot()
+ name_only()
---------------------------------------------------------------------------*/
-#ifdef VMS /* VMS only! */
-
#define UNZIP_INTERNAL
#include "unzip.h"
#include "vmsdefs.h"
#ifdef MORE
-# include <ttdef.h>
+# include <ttdef.h>
#endif
#include <unixlib.h>
+#include <clidef.h>
+#ifndef CLI$M_TRUSTED
+# define CLI$M_TRUSTED 0 /* Old VMS versions may lack this one. */
+#endif /* ndef CLI$M_TRUSTED */
+#include <dcdef.h>
#include <dvidef.h>
#include <ssdef.h>
#include <stsdef.h>
+#ifdef ENABLE_USER_PROGRESS
+# include <prdef.h>
+/* Last-ditch attempt to get PR$C_PS_USER defined. */
+# ifndef PR$C_PS_USER
+# define PR$C_PS_USER 3
+# endif /* ndef PR$C_PS_USER */
+#endif /* def ENABLE_USER_PROGRESS */
+
/* Workaround for broken header files of older DECC distributions
* that are incompatible with the /NAMES=AS_IS qualifier. */
-#define lib$getdvi LIB$GETDVI
-#define lib$getsyi LIB$GETSYI
-#define lib$sys_getmsg LIB$SYS_GETMSG
+#define lib$getdvi LIB$GETDVI
+#define lib$getsyi LIB$GETSYI
+#define lib$spawn LIB$SPAWN
+#define lib$sys_getmsg LIB$SYS_GETMSG
#include <lib$routines.h>
#ifndef EEXIST
-# include <errno.h> /* For mkdir() status codes */
+# include <errno.h> /* For mkdir() status codes */
#endif
/* On VAX, define Goofy VAX Type-Cast to obviate /standard = vaxc.
(GNU C may define vax but not __VAX.)
*/
#ifdef vax
-# define __VAX 1
+# define __VAX 1
#endif
#ifdef __VAX
-# define GVTC (unsigned int)
+# define GVTC (unsigned int)
#else
-# define GVTC
+# define GVTC
#endif
/* With GNU C, some FAB bits may be declared only as masks, not as
* structure bits.
*/
#ifdef __GNUC__
-# define OLD_FABDEF 1
+# define OLD_FABDEF 1
#endif
#define ASYNCH_QIO /* Use asynchronous PK-style QIO writes */
unsigned xlen; /* G.lrec.extra_field_length */
char buf[1]; /* data buffer (extra_field, fn) */
} vmsdirattr;
-#define VmsAtt(d) ((vmsdirattr *)d) /* typecast shortcut */
+# define VmsAtt(d) ((vmsdirattr *)d) /* typecast shortcut */
#endif /* SET_DIR_ATTRIB */
/*
* Local static storage
*/
-static struct FAB fileblk; /* File Access Block */
-static struct XABDAT dattim; /* date-time XAB */
-static struct XABRDT rdt; /* revision date-time XAB */
-static struct RAB rab; /* Record Access Block */
-static struct NAM_STRUCT nam; /* name block */
+static struct FAB fileblk; /* File Access Block */
+static struct XABDAT dattim; /* date-time XAB */
+static struct XABRDT rdt; /* revision date-time XAB */
+static struct RAB rab; /* Record Access Block */
+static struct NAMX_STRUCT nam; /* name block */
static struct FAB *outfab = NULL;
static struct RAB *outrab = NULL;
static int replace_code_all = -1; /* All-file response for replace(). */
+static ush defprot; /* RMS default protection. */
+static ush sysdef; /* System. */
+static ush owndef; /* Owner. */
+static ush grpdef; /* Group. */
+static ush wlddef; /* World. */
+
static uch rfm;
static uch locbuf[BUFSALLOC]; /* Space for 2 buffers of BUFS512 */
#ifdef SYMLINKS
static int _read_link_rms(__GPRO__ int byte_count, char *link_text_buf);
-#endif /* SYMLINKS */
+#endif /* def SYMLINKS */
static void init_buf_ring(void);
static void set_default_datetime_XABs(__GPRO);
};
+/* Map UNIX rwx to VMS rwed. (UNIX w bit is mapped to VMS wd bits.) */
+
+static ulg unix_to_vms[ 8] =
+{ /* no access */
+ XAB$M_NOREAD | XAB$M_NOWRITE | XAB$M_NODEL | XAB$M_NOEXE, /* --- */
+ XAB$M_NOREAD | XAB$M_NOWRITE | XAB$M_NODEL, /* --x */
+ XAB$M_NOREAD | XAB$M_NOEXE, /* -w- */
+ XAB$M_NOREAD, /* -wx */
+ XAB$M_NOWRITE | XAB$M_NODEL | XAB$M_NOEXE, /* r-- */
+ XAB$M_NOWRITE | XAB$M_NODEL, /* r-x */
+ XAB$M_NOEXE, /* rw- */
+ 0 /* rwx */
+}; /* full access */
+
+
/* 2004-11-23 SMS.
*
* get_rms_defaults().
* initial allocation should always be set according to the known file
* size, and no extension should be needed.
*/
-
#define RMS_DEQ_DEFAULT 16384 /* About 1/4 the max (65535 blocks). */
#define RMS_MBC_DEFAULT 127 /* The max, */
#define RMS_MBF_DEFAULT 2 /* Enough to enable rah and wbh. */
short itm_cod;
void *buf;
int *ret_len;
-} jpi_item_t;
+} xxx_item_t;
/* Durable storage */
static int rms_defaults_known = 0;
-/* JPI item buffers. */
+/* GETJPI item buffers. */
static unsigned short rms_ext;
static char rms_mbc;
static unsigned char rms_mbf;
* They keep compilers with old header files quiet, though.
*/
#ifndef JPI$_RMS_EXTEND_SIZE
-# define JPI$_RMS_EXTEND_SIZE 542
+# define JPI$_RMS_EXTEND_SIZE 542
#endif /* ndef JPI$_RMS_EXTEND_SIZE */
#ifndef JPI$_RMS_DFMBC
-# define JPI$_RMS_DFMBC 535
+# define JPI$_RMS_DFMBC 535
#endif /* ndef JPI$_RMS_DFMBC */
#ifndef JPI$_RMS_DFMBFSDK
-# define JPI$_RMS_DFMBFSDK 536
+# define JPI$_RMS_DFMBFSDK 536
#endif /* ndef JPI$_RMS_DFMBFSDK */
/* GETJPI item descriptor set. */
struct
{
- jpi_item_t rms_ext_itm;
- jpi_item_t rms_mbc_itm;
- jpi_item_t rms_mbf_itm;
+ xxx_item_t rms_ext_itm;
+ xxx_item_t rms_mbc_itm;
+ xxx_item_t rms_mbf_itm;
int term;
} jpi_itm_lst =
{ { 2, JPI$_RMS_EXTEND_SIZE, &rms_ext, &rms_ext_len },
0
};
-static int get_rms_defaults()
+static int get_rms_defaults(__GPRO)
{
int sts;
}
+/* 2013-05-03 SMS.
+ *
+ * get_rms_fileprot().
+ *
+ * Get user-specified value from (DCL) SET PROTECTION /DEFAULT.
+ * Derive individual subsets for mapattr().
+ *
+ * In the best of all possible worlds, we could use $GETJPI with
+ * JPI$_RMS_FILEPROT, but that's too modern, so we extract and adapt old
+ * code from mapattr() (below), which uses (the only recently
+ * documented) $SETDFPROT(). For extremely lame/obsolete systems (older
+ * than VMS V5.4, at worst), where $SETDFPROT() in not available, define
+ * LACK_SETDFPROT.
+ */
+
+#ifndef LACK_SETDFPROT
+/* Declare sys$setdfprot(), in case system header files omit it. */
+extern int sys$setdfprot();
+#endif /* ndef LACK_SETDFPROT */
+
+int get_rms_fileprot( void)
+{
+#ifdef LACK_SETDFPROT
+# define sts 0;
+#else /* def LACK_SETDFPROT */
+ int sts;
+
+ sts = sys$setdfprot( 0, &defprot);
+ if ((sts & STS$M_SEVERITY) == STS$K_SUCCESS)
+ {
+ /* V: Start bit. S: Size (bits). */
+ 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;
+ wlddef = defprot& ((1<< XAB$S_WLD)- 1)<< XAB$V_WLD;
+ }
+ else
+#endif /* ndef LACK_SETDFPROT [else] */
+ {
+ umask( defprot = umask( 0)); /* Get UNIX umask permissions. */
+ defprot = ~defprot; /* VMS prot complements UNIX perm. */
+ wlddef = unix_to_vms[ defprot & 07] << XAB$V_WLD;
+ grpdef = unix_to_vms[ (defprot>> 3) & 07] << XAB$V_GRP;
+ owndef = unix_to_vms[ (defprot>> 6) & 07] << XAB$V_OWN;
+ sysdef = owndef>> (XAB$V_OWN- XAB$V_SYS);
+ defprot = sysdef| owndef| grpdef| wlddef;
+ }
+ return sts;
+}
+
+
int check_format(__G)
__GDEF
{
nam = cc$rms_naml; /* Initialize NAML. */
fab.fab$l_naml = &nam; /* Point FAB to NAML. */
- fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
-
#endif /* NAML$C_MAXRSS */
+ NAMX_DNA_FNA_SET( fab)
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = G.zipfn;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(G.zipfn);
|| (x) == FAB$C_STM )
/* VMS extra field types */
-#define VAT_NONE 0
-#define VAT_IZ 1 /* old Info-ZIP format */
-#define VAT_PK 2 /* PKWARE format */
+#define VAT_NONE 0
+#define VAT_IZ 1 /* old Info-ZIP format */
+#define VAT_PK 2 /* PKWARE format */
/*
* open_outfile() assignments:
/* Get process RMS_DEFAULT values, if not already done. */
if (rms_defaults_known == 0)
{
- get_rms_defaults();
+ get_rms_defaults(__G);
}
switch (find_vms_attrs(__G__ (uO.D_flag <= 1)))
struct tm *t;
if (G.extra_field &&
-#ifdef IZ_CHECK_TZ
+# ifdef IZ_CHECK_TZ
G.tz_is_valid &&
-#endif
+# endif
(ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
G.lrec.last_mod_dos_datetime, &z_utime, NULL)
& EB_UT_FL_MTIME))
text_output = (G.pInfo->textmode
#ifdef SYMLINKS
&& !G.symlnk
-#endif
+#endif /* def SYMLINKS */
) ||
(uO.cflag &&
(!uO.bflag || (!(uO.bflag - 1) && G.pInfo->textfile)));
bin_fixed = !text_output &&
#ifdef SYMLINKS
!G.symlnk &&
-#endif
+#endif /* def SYMLINKS */
(uO.bflag != 0) && ((uO.bflag != 1) || !G.pInfo->textfile);
rfm = FAB$C_STMLF; /* Default, stream-LF format from VMS or UNIX */
#ifdef NAML$C_MAXRSS
- nam = CC_RMS_NAM; /* Initialize NAML. */
- fileblk.FAB_NAM = &nam; /* Point FAB to NAML. */
-
- fileblk.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fileblk.fab$l_fna = (char *) -1; /* Using NAML for file name. */
+ nam = CC_RMS_NAMX; /* Initialize NAML. */
+ fileblk.FAB_NAMX = &nam; /* Point FAB to NAML. */
#endif /* NAML$C_MAXRSS */
+ NAMX_DNA_FNA_SET( fileblk)
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNS = strlen(G.filename);
fileblk.fab$l_xab = (void *) &dattim;
}
-/* 2005-02-14 SMS. What does this mean? ----vvvvvvvvvvvvvvvvvvvvvvvvvvv */
- fileblk.fab$w_ifi = 0; /* Clear IFI. It may be nonzero after ZIP */
+ /* Zip-archived FAB data may include a non-zero IFI, which must
+ * be cleared here.
+ */
+ fileblk.fab$w_ifi = 0;
fileblk.fab$b_fac = FAB$M_BRO | FAB$M_PUT; /* {block|record} output */
#ifdef SYMLINKS
if (G.symlnk)
/* Symlink file is read back to retrieve the link text. */
fileblk.fab$b_fac |= FAB$M_GET;
-#endif
+#endif /* def SYMLINKS */
/* 2004-11-23 SMS.
* If RMS_DEFAULT values have been determined, and have not been
if (ERR(ierr))
{
- char buf[NAM_MAXRSS + 128]; /* Name length + message length. */
+ char buf[NAMX_MAXRSS + 128]; /* Name length + message length. */
sprintf(buf, "[ Cannot create ($create) output file %s ]\n",
G.filename);
#ifdef NAML$C_MAXRSS
- nam = CC_RMS_NAM; /* Initialize NAML. */
- outfab->FAB_NAM = &nam; /* Point FAB to NAML. */
-
- outfab->fab$l_dna = (char *) -1; /* Using NAML for default name. */
- outfab->fab$l_fna = (char *) -1; /* Using NAML for file name. */
+ nam = CC_RMS_NAMX; /* Initialize NAML. */
+ outfab->FAB_NAMX = &nam; /* Point FAB to NAML. */
#endif /* NAML$C_MAXRSS */
+ NAMX_DNA_FNA_SET( *outfab)
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNS = strlen(G.filename);
}
}
}
-/* 2005-02-14 SMS. What does this mean? ----vvvvvvvvvvvvvvvvvvvvvvvvvvv */
- outfab->fab$w_ifi = 0; /* Clear IFI. It may be nonzero after ZIP */
+
+ /* Zip-archived FAB data may include a non-zero IFI, which must
+ * be cleared here.
+ */
+ outfab->fab$w_ifi = 0;
outfab->fab$b_fac = FAB$M_BIO | FAB$M_PUT; /* block-mode output */
#ifdef SYMLINKS
/* 2007-02-28 SMS.
outfab->fab$b_fac |= FAB$M_GET;
}
}
-#endif /* SYMLINKS */
+#endif /* def SYMLINKS */
/* 2004-11-23 SMS.
* Set the "sequential access only" flag, as otherwise, on a
if (ERR(ierr))
{
- char buf[NAM_MAXRSS + 128]; /* Name length + message length. */
+ char buf[NAMX_MAXRSS + 128]; /* Name length + message length. */
sprintf(buf, "[ Cannot create ($create) output file %s ]\n",
G.filename);
ierr = sys$extend(outfab);
if (ERR(ierr))
{
- char buf[NAM_MAXRSS + 128]; /* Name length + msg length. */
+ char buf[NAMX_MAXRSS + 128]; /* Name length + msg length. */
sprintf(buf, "[ Cannot allocate space for %s ]\n", G.filename);
vms_msg(__G__ buf, ierr);
/* IOSB for QIO[W] read and write operations. */
#if defined(__DECC) || defined(__DECCXX)
-#pragma __member_alignment __save
-#pragma __nomember_alignment
+# pragma __member_alignment __save
+# pragma __nomember_alignment
#endif /* __DECC || __DECCXX */
static struct
{
unsigned short dummy;
} pka_io_iosb;
#if defined(__DECC) || defined(__DECCXX)
-#pragma __member_alignment __restore
+# pragma __member_alignment __restore
#endif /* __DECC || __DECCXX */
/* IOSB for QIO[W] miscellaneous ACP operations. */
{ sizeof(pka_fib), DSC$K_DTYPE_Z, DSC$K_CLASS_S, (void *) &pka_fib };
static struct dsc$descriptor_s pka_devdsc =
-{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &nam.NAM_DVI[1] };
+{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &nam.NAMX_DVI[1] };
static struct dsc$descriptor_s pka_fnam =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
/* Expanded and resultant name storage. */
-static char exp_nam[NAM_MAXRSS];
-static char res_nam[NAM_MAXRSS];
+static char exp_nam[NAMX_MAXRSS];
+static char res_nam[NAMX_MAXRSS];
/* Special ODS5-QIO-compatible name storage. */
#ifdef NAML$C_MAXRSS
else /* !(uO.cflag) : redirect output */
{
fileblk = cc$rms_fab; /* Initialize FAB. */
- nam = CC_RMS_NAM; /* Initialize NAM[L]. */
- fileblk.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ fileblk.FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
#ifdef NAML$C_MAXRSS
- fileblk.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fileblk.fab$l_fna = (char *) -1; /* Using NAML for file name. */
-
/* Special ODS5-QIO-compatible name storage. */
nam.naml$l_filesys_name = sys_nam;
nam.naml$l_filesys_name_alloc = sizeof(sys_nam);
#endif /* NAML$C_MAXRSS */
/* VMS-format file name, derived from archive. */
+ NAMX_DNA_FNA_SET( fileblk)
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNS = strlen(G.filename);
/* Expanded and resultant name storage. */
- nam.NAM_ESA = exp_nam;
- nam.NAM_ESS = sizeof(exp_nam);
- nam.NAM_RSA = res_nam;
- nam.NAM_RSS = sizeof(res_nam);
+ nam.NAMX_ESA = exp_nam;
+ nam.NAMX_ESS = sizeof(exp_nam);
+ nam.NAMX_RSA = res_nam;
+ nam.NAMX_RSS = sizeof(res_nam);
if ( ERR(status = sys$parse(&fileblk)) )
{
return OPENOUT_FAILED;
}
- pka_devdsc.dsc$w_length = (unsigned short)nam.NAM_DVI[0];
+ pka_devdsc.dsc$w_length = (unsigned short)nam.NAMX_DVI[0];
if ( ERR(status = sys$assign(&pka_devdsc, &pka_devchn, 0, 0)) )
{
here.)
*/
- pka_fnam.dsc$a_pointer = nam.NAM_L_NAME;
+ pka_fnam.dsc$a_pointer = nam.NAMX_L_NAME;
pka_fnam.dsc$w_length =
- nam.NAM_B_NAME + nam.NAM_B_TYPE + nam.NAM_B_VER;
+ nam.NAMX_B_NAME + nam.NAMX_B_TYPE + nam.NAMX_B_VER;
-#if 0
- pka_fnam.dsc$w_length = nam.NAM_B_NAME + nam.NAM_B_TYPE;
- if ( uO.V_flag /* keep versions */ )
- pka_fnam.dsc$w_length += nam.NAM_B_VER;
-#endif /* 0 */
+# if 0
+ pka_fnam.dsc$w_length = nam.NAMX_B_NAME + nam.NAMX_B_TYPE;
+ if ((uO.V_flag > 0) /* keep versions */ )
+ pka_fnam.dsc$w_length += nam.NAMX_B_VER;
+# endif /* 0 */
#endif /* ?NAML$C_MAXRSS */
*/
for (i = 0; i < 3; i++)
{
- pka_fib.FIB$W_DID[i] = nam.NAM_DID[i];
+ pka_fib.FIB$W_DID[i] = nam.NAMX_DID[i];
pka_fib.FIB$W_FID[i] = 0;
}
if ( pka_uchar & FCH$M_CONTIGB )
pka_fib.FIB$W_EXCTL |= FIB$M_ALCONB;
-#define SWAPW(x) ( (((x)>>16)&0xFFFF) + ((x)<<16) )
+#define SWAPW(x) ( (((x)>>16)&0xFFFF) + ((x)<<16) )
pka_fib.fib$l_exsz = SWAPW(pka_rattr.fat$l_hiblk);
if ( ERR(status) )
{
- char buf[NAM_MAXRSS + 128]; /* Name length + message length. */
+ char buf[NAMX_MAXRSS + 128]; /* Name length + message length. */
sprintf(buf, "[ Cannot create (QIO) output file %s ]\n",
G.filename);
static int replace_rms_newversion(__GPRO)
{
int ierr;
- struct NAM_STRUCT nam;
+ struct NAMX_STRUCT nam;
- nam = CC_RMS_NAM; /* Initialize local NAM[L] block. */
- outfab->FAB_NAM = &nam; /* Point FAB to local NAM[L]. */
+ nam = CC_RMS_NAMX; /* Initialize local NAM[L] block. */
+ outfab->FAB_NAMX = &nam; /* Point FAB to local NAM[L]. */
/* Arrange to store the resultant file spec (with new version), so
* that we can extract the actual file version from it, for later
* use in the "extracting:/inflating:/..." message (G.filename).
*/
- nam.NAM_RSA = res_nam;
- nam.NAM_RSS = sizeof(res_nam);
-
-#ifdef NAML$C_MAXRSS
-
- outfab->fab$l_dna = (char *) -1; /* Using NAML for default name. */
- outfab->fab$l_fna = (char *) -1; /* Using NAML for file name. */
-
-#endif /* NAML$C_MAXRSS */
+ nam.NAMX_RSA = res_nam;
+ nam.NAMX_RSS = sizeof(res_nam);
+ NAMX_DNA_FNA_SET( *outfab)
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNS = strlen(G.filename);
/* Create the new-version file. */
ierr = sys$create(outfab);
- if (nam.NAM_RSL > 0)
+ if (nam.NAMX_RSL > 0)
{
/* File spec version pointers.
* Versions must exist, so a simple right-to-left search for ";"
char *semi_col_res;
/* NUL-terminate the (complete) resultant file spec. */
- res_nam[nam.NAM_RSL] = '\0';
+ res_nam[nam.NAMX_RSL] = '\0';
/* Find the versions (";") in the original and resultant file specs. */
semi_col_orig = strrchr(G.filename, ';');
*/
static int replace(__GPRO)
{
- char answ[10];
int replace_code;
if (replace_code_all >= 0)
FnFilter1(G.filename)));
fflush(stderr);
- if (fgets(answ, sizeof(answ), stdin) == (char *)NULL)
+ if (fgets_ans( __G) < 0)
{
Info(slide, 1, ((char *)slide, AssumeNo));
/* Handle the NULL answer as "N",
/* Strip off a trailing newline, to avoid corrupt
* complaints when displaying the answer.
*/
- if (answ[strlen(answ) - 1] == '\n')
- answ[strlen(answ) - 1] = '\0';
+ if (G.answerbuf[ strlen( G.answerbuf)- 1] == '\n')
+ G.answerbuf[ strlen( G.answerbuf)- 1] = '\0';
/* Extra newline to avoid having the extracting:/inflating:/...:
* message overwritten by the next query.
Info(slide, 1, ((char *)slide, "\n"));
/* Interpret response. Store upper-case answer for future use. */
- switch (answ[0])
+ switch (G.answerbuf[ 0])
{
case 'N':
replace_code_all = REPL_NO_EXTRACT;
break;
default:
/* Invalid response. Try again. */
- Info(slide, 1, ((char *)slide, InvalidResponse, answ));
+ Info(slide, 1, ((char *)slide, InvalidResponse,
+ G.answerbuf));
}
} while (replace_code < 0);
}
*
* The return value is a VAT_* value, according to the type of extra
* field attribute data found.
+ *
+ * 2013-05-13 SMS.
+ * Added detection of PK file protection (ATR$C_FPRO) block, with
+ * optional (-k) filtering using the user's default protections.
+ * Removed some redundant "&" operators.
*/
static int find_vms_attrs(__GPRO__ int set_date_time)
{
while (len > 0)
{
hdr = (struct EB_header *)scan;
- if (EQL_W(&hdr->tag, IZ_SIGNATURE))
+ if (EQL_W( &hdr->tag, IZ_SIGNATURE))
{
/*
* Info-ZIP-style extra block decoding.
switch(fld->tag)
{
case ATR$C_UCHAR:
- pka_uchar = L(&fld->value);
+ pka_uchar = L( fld->value);
break;
case ATR$C_RECATTR:
- pka_rattr = *(struct fatdef *)(&fld->value);
+ pka_rattr = *(struct fatdef *)(fld->value);
break;
case ATR$C_UIC:
+ skip = (uO.X_flag <= 0);
+ break;
case ATR$C_ADDACLENT:
- skip = !uO.X_flag;
+ skip = (uO.ka_flag <= 0);
+ break;
+#ifdef KFLAG
+ case ATR$C_FPRO:
+ if (uO.kflag == 0)
+ {
+ /* Apply RMS default protections. */
+ W( fld->value) |= defprot;
+ }
break;
+#endif /* def KFLAG */
case ATR$C_CREDATE:
case ATR$C_REVDATE:
case ATR$C_EXPDATE:
if (bufcnt_even > curbuf->bufcnt)
curbuf->buf[curbuf->bufcnt] = '\0';
- return WriteQIO(curbuf->buf, bufcnt_even);
+ return WriteQIO(__G__ curbuf->buf, bufcnt_even);
}
else
{
/*
* Routine _flush_stream breaks decompressed stream into records
* depending on format of the stream (fab->rfm, G.pInfo->textmode, etc.)
- * and puts out these records. It also handles CR LF sequences.
- * Should be used when extracting *text* files.
+ * and puts out these records. It also adjusts line-end (CR, LF)
+ * sequences. Should be used when extracting *text* files.
*/
#define VT 0x0B
|| ( f == FAB$C_STM && (c==CR || c==LF || c==FF || c==VT) ) \
)
#else
-# define RECORD_END(c, f) ((c) == LF || (c) == (CR))
+# define RECORD_END(c, f) ((c) == LF || (c) == (CR))
#endif
static unsigned find_eol(p, n, l)
/*
- * Find first CR, LF, CR/LF or LF/CR in string 'p' of length 'n'.
- * Return offset of the sequence found or 'n' if not found.
- * If found, return in '*l' length of the sequence (1 or 2) or
- * zero if sequence end not seen, i.e. CR or LF is last char
- * in the buffer.
+ * Find the first CR, LF, CR+LF or LF+CR in string "p" of length "n".
+ * Return the offset of the sequence found, or "n" if not found.
+ * If found, set "*l" to the length of the sequence (1 or 2). If not
+ * found, set "*l" to zero. Note that at the end of a data block, a
+ * 1-character line ending (like, say, LF) will be treated as
+ * incomplete, until a later second line-ending character (or any
+ * non-line-ending character) is reached. A side effect of this scheme
+ * is that at the end of a data stream with a one-character line ending
+ * (like, say, LF), the return value will be zero (because no second
+ * line-ending character can possibly be found).
*/
ZCONST uch *p;
unsigned n;
#define PRINT_SPEC(c) ( (c)==FF || (c)==VT )
-
static int _flush_stream(__G__ rawbuf, size, final_flag)
__GDEF
uch *rawbuf;
return WriteRecord(__G__ locbuf, recsize);
}
-
if ( loccnt > 0 )
{
/* Find end of record partially saved in locbuf */
{
if ( eol_off >= size )
{
- end = size;
- complete = 0;
- }
- else if ( eol_len == 0 )
- {
- got_eol = rawbuf[eol_off];
+ /* 2012-09-19 SMS.
+ * 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.
+ */
end = size;
complete = 0;
}
else
{
- memcpy(locptr, rawbuf, eol_off);
- recsize = loccnt + eol_off;
- locptr += eol_off;
- loccnt += eol_off;
- end = eol_off + eol_len;
- complete = 1;
+ /* 2011-02-07 SMS.
+ * Previously, the following memcpy() was not being
+ * done in the "eol_len == 0" case, causing loss of
+ * data at the end of a last line with a 1-character
+ * line ending, like LF, when doing "unzip -a".
+ */
+ if ( eol_len == 0 )
+ {
+ /* Last char in buffer might be 1-char line end. */
+ got_eol = rawbuf[eol_off];
+ complete = 0;
+ }
+ else
+ {
+ /* Found certain 1- or 2-char line end. */
+ complete = 1;
+ }
}
+ /* Append available data to the data in locbuf. */
+ memcpy(locptr, rawbuf, eol_off);
+ recsize = loccnt + eol_off;
+ locptr += eol_off;
+ loccnt += eol_off;
+ end = eol_off + eol_len;
}
}
for (start = end; start < size && end < size; )
{
- unsigned eol_off, eol_len;
+ unsigned eol_len;
got_eol = 0;
continue;
/* Find record end */
- end = start+(eol_off = find_eol(rawbuf+start, size-start, &eol_len));
+ end = start+ find_eol( (rawbuf+ start), (size- start), &eol_len);
if ( end >= size )
continue;
if (uO.cflag)
{
- (void)(*G.message)((zvoid *)&G, buf, len, 0);
+ (void)(*G.message)((zvoid *)&G, buf, len, 0x2000);
}
else
{
if (uO.cflag)
{
- (void)(*G.message)((zvoid *)&G, rec, len, 0);
- (void)(*G.message)((zvoid *)&G, (uch *) ("\n"), 1, 0);
+ (void)(*G.message)((zvoid *)&G, rec, len, 0x2000);
+ (void)(*G.message)((zvoid *)&G, (uch *) ("\n"), 1, 0x2000);
}
else
{
#ifdef SYMLINKS
/* Read symlink text from a still-open rms file. */
-static int _read_link_rms(int byte_count, char *link_text_buf)
+static int _read_link_rms(__GPRO__ int byte_count, char *link_text_buf)
{
/* Use RMS to read the link text into the user's buffer.
* Rewind, then read byte count = byte_count.
return sts;
}
-#endif /* SYMLINKS */
+#endif /* def SYMLINKS */
else
{
/* Read the link text. */
- status = _read_link_rms(ucsize, link_target);
+ status = _read_link_rms(__G__ ucsize, link_target);
if (ERR(status))
{
strcpy(slnk_entry->fname, G.filename);
/* Read the link text using the appropriate method. */
- status = _read_link_rms(ucsize, slnk_entry->target);
+ status = _read_link_rms(__G__ ucsize, slnk_entry->target);
if (ERR(status))
{
}
}
}
-#endif /* SYMLINKS */
+#endif /* def SYMLINKS */
/* Link XABRDT, XABDAT, and (optionally) XABPRO. */
if (xabrdt != NULL)
outfab->fab$l_xab = (void *)xabdat;
}
- if (xabpro != NULL)
- {
- if ( !uO.X_flag )
- xabpro->xab$l_uic = 0; /* Use default (user's) uic */
- xabpro->xab$l_nxt = outfab->fab$l_xab;
- outfab->fab$l_xab = (void *) xabpro;
- }
- else
+#ifdef KFLAG
+ if ( uO.kflag >= 0 )
{
- pro = cc$rms_xabpro;
- pro.xab$w_pro = G.pInfo->file_attr;
- pro.xab$l_nxt = outfab->fab$l_xab;
- outfab->fab$l_xab = (void *) &pro;
+#endif /* def KFLAG */
+ if (xabpro != NULL)
+ {
+ if ( uO.X_flag <= 0 )
+ xabpro->xab$l_uic = 0; /* Use default (user's) UIC. */
+ xabpro->xab$l_nxt = outfab->fab$l_xab;
+ outfab->fab$l_xab = (void *) xabpro;
+ }
+ else
+ {
+ pro = cc$rms_xabpro;
+ pro.xab$w_pro = G.pInfo->file_attr;
+ pro.xab$l_nxt = outfab->fab$l_xab;
+ outfab->fab$l_xab = (void *) &pro;
+ }
+
+#ifdef KFLAG
+ if (uO.kflag == 0)
+ {
+ /* Apply RMS default protections. */
+ ((struct XABPRO *)(outfab->fab$l_xab))->xab$w_pro |= defprot;
+ }
}
+#endif /* def KFLAG */
status = sys$wait(outrab);
if (ERR(status))
}
}
-#endif /* SYMLINKS */
+#endif /* def SYMLINKS */
status = sys$qiow(0, pka_devchn, IO$_DEACCESS, &pka_acp_iosb,
0, 0,
* larger than the source) is returned in the user's buffer.
*/
-#define DIR_TYPE_VER ".DIR;1"
+# define DIR_TYPE_VER ".DIR;1"
static char *vms_path_fixdown(ZCONST char *dir_spec, char *dir_file)
{
int type;
ush attr;
struct XABPRO pro;
- char dir_name[NAM_MAXRSS + 1];
- char warnmsg[NAM_MAXRSS + 128]; /* Name length + message length. */
+ char dir_name[NAMX_MAXRSS + 1];
+ char warnmsg[NAMX_MAXRSS + 128]; /* Name length + message length. */
int retcode = PK_OK;
/* Re-append the closing ']' character which has been stripped in
pka_atr[pka_idx].atr$l_addr = GVTC &xabdat->xab$q_cdt;
++pka_idx;
}
- if (xabpro != NULL)
+
+ if ( uO.X_flag >= 0 )
{
- if ( uO.X_flag ) {
- pka_atr[pka_idx].atr$w_size = 4;
- pka_atr[pka_idx].atr$w_type = ATR$C_UIC;
- pka_atr[pka_idx].atr$l_addr = GVTC &xabpro->xab$l_uic;
- ++pka_idx;
+ if (xabpro != NULL)
+ {
+ if ( uO.X_flag > 0 ) {
+ pka_atr[pka_idx].atr$w_size = 4;
+ pka_atr[pka_idx].atr$w_type = ATR$C_UIC;
+ pka_atr[pka_idx].atr$l_addr = GVTC &xabpro->xab$l_uic;
+ ++pka_idx;
+ }
+ attr = xabpro->xab$w_pro;
}
- attr = xabpro->xab$w_pro;
- }
- else
- {
- /* Revoke directory Delete permission for all. */
- attr = VmsAtt(d)->perms
- | (((1<< XAB$V_NODEL)<< XAB$V_SYS)|
- ((1<< XAB$V_NODEL)<< XAB$V_OWN)|
- ((1<< XAB$V_NODEL)<< XAB$V_GRP)|
- ((1<< XAB$V_NODEL)<< XAB$V_WLD));
+ else
+ {
+ /* Revoke directory Delete permission for all. */
+ attr = VmsAtt(d)->perms
+ | (((1<< XAB$V_NODEL)<< XAB$V_SYS)|
+ ((1<< XAB$V_NODEL)<< XAB$V_OWN)|
+ ((1<< XAB$V_NODEL)<< XAB$V_GRP)|
+ ((1<< XAB$V_NODEL)<< XAB$V_WLD));
+ }
+#ifdef KFLAG
+ if (uO.kflag == 0)
+ {
+ /* Apply RMS default protections. */
+ attr |= defprot;
+ }
+#endif /* def KFLAG */
+ pka_atr[pka_idx].atr$w_size = 2;
+ pka_atr[pka_idx].atr$w_type = ATR$C_FPRO;
+ pka_atr[pka_idx].atr$l_addr = GVTC &attr;
+ ++pka_idx;
}
- pka_atr[pka_idx].atr$w_size = 2;
- pka_atr[pka_idx].atr$w_type = ATR$C_FPRO;
- pka_atr[pka_idx].atr$l_addr = GVTC &attr;
- ++pka_idx;
}
}
else
*/
pka_idx = 0;
- /* Get the (already converted) non-VMS permissions. */
- attr = VmsAtt(d)->perms; /* Use right-sized prot storage. */
-
- /* Revoke directory Delete permission for all. */
- attr |= (((1<< XAB$V_NODEL)<< XAB$V_SYS)|
- ((1<< XAB$V_NODEL)<< XAB$V_OWN)|
- ((1<< XAB$V_NODEL)<< XAB$V_GRP)|
- ((1<< XAB$V_NODEL)<< XAB$V_WLD));
+#ifdef KFLAG
+ if ( uO.kflag >= 0 )
+#endif /* def KFLAG */
+ {
+ /* Get the (already converted) non-VMS permissions. */
+ attr = VmsAtt(d)->perms; /* Use right-sized prot storage. */
+#ifdef KFLAG
+ if (uO.kflag == 0)
+ {
+ /* Apply RMS default protections. */
+ attr |= defprot;
+ }
+#endif /* def KFLAG */
+ /* Revoke directory Delete permission for all. */
+ attr |= (((1<< XAB$V_NODEL)<< XAB$V_SYS)|
+ ((1<< XAB$V_NODEL)<< XAB$V_OWN)|
+ ((1<< XAB$V_NODEL)<< XAB$V_GRP)|
+ ((1<< XAB$V_NODEL)<< XAB$V_WLD));
- pka_atr[pka_idx].atr$w_size = 2;
- pka_atr[pka_idx].atr$w_type = ATR$C_FPRO;
- pka_atr[pka_idx].atr$l_addr = GVTC &attr;
- ++pka_idx;
+ pka_atr[pka_idx].atr$w_size = 2;
+ pka_atr[pka_idx].atr$w_type = ATR$C_FPRO;
+ pka_atr[pka_idx].atr$l_addr = GVTC &attr;
+ ++pka_idx;
+ }
- /* Restore directory date-time if user requests it (-D). */
+ /* Restore directory date-time if user requests it (-D-). */
if (uO.D_flag <= 0)
{
/* Set the directory date-time from the non-VMS data.
pka_atr[pka_idx].atr$l_addr = 0; /* NULL when DECC VAX gets fixed. */
}
- nam = CC_RMS_NAM; /* Initialize NAM[L]. */
- outfab->FAB_NAM = &nam; /* Point FAB to NAM[L]. */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ outfab->FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
/* Point the FAB-NAM[L] to the VMS-format directory file name. */
-#ifdef NAML$C_MAXRSS
-
- outfab->fab$l_dna = (char *) -1; /* Using NAML for default name. */
- outfab->fab$l_fna = (char *) -1; /* Using NAML for file name. */
+# ifdef NAML$C_MAXRSS
/* Special ODS5-QIO-compatible name storage. */
nam.naml$l_filesys_name = sys_nam;
nam.naml$l_filesys_name_alloc = sizeof(sys_nam);
-#endif /* NAML$C_MAXRSS */
+# endif /* NAML$C_MAXRSS */
+ NAMX_DNA_FNA_SET( *outfab)
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNA = dir_name;
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNS = strlen(dir_name);
/* Expanded and resultant name storage. */
- nam.NAM_ESA = exp_nam;
- nam.NAM_ESS = sizeof(exp_nam);
- nam.NAM_RSA = res_nam;
- nam.NAM_RSS = sizeof(res_nam);
+ nam.NAMX_ESA = exp_nam;
+ nam.NAMX_ESS = sizeof(exp_nam);
+ nam.NAMX_RSA = res_nam;
+ nam.NAMX_RSS = sizeof(res_nam);
status = sys$parse(outfab);
if ( ERR(status) )
}
/* Set the length in the device name descriptor. */
- pka_devdsc.dsc$w_length = (unsigned short) nam.NAM_DVI[0];
+ pka_devdsc.dsc$w_length = (unsigned short) nam.NAMX_DVI[0];
/* Open a channel to the disk device. */
status = sys$assign(&pka_devdsc, &pka_devchn, 0, 0);
*/
for (i = 0; i < 3; i++)
{
- pka_fib.FIB$W_DID[i] = nam.NAM_DID[i];
+ pka_fib.FIB$W_DID[i] = nam.NAMX_DID[i];
pka_fib.FIB$W_FID[i] = 0;
}
-#ifdef NAML$C_MAXRSS
+# ifdef NAML$C_MAXRSS
/* Enable fancy name characters. Note that "fancy" here does
not include Unicode, for which there's no support elsewhere.
pka_fnam.dsc$a_pointer = nam.naml$l_filesys_name;
pka_fnam.dsc$w_length = nam.naml$l_filesys_name_size;
-#else /* !NAML$C_MAXRSS */
+# else /* !NAML$C_MAXRSS */
/* ODS2-only: Use the whole name. */
- pka_fnam.dsc$a_pointer = nam.NAM_L_NAME;
- pka_fnam.dsc$w_length = nam.NAM_B_NAME + nam.NAM_B_TYPE + nam.NAM_B_VER;
+ pka_fnam.dsc$a_pointer = nam.NAMX_L_NAME;
+ pka_fnam.dsc$w_length = nam.NAMX_B_NAME + nam.NAMX_B_TYPE + nam.NAMX_B_VER;
-#endif /* ?NAML$C_MAXRSS */
+# endif /* ?NAML$C_MAXRSS */
/* 2007-07-13 SMS.
* Our freshly created directory can easily contain fewer files than
static time_t mkgmtime(tm)
struct tm *tm;
{
- time_t m_time;
int yr, mo, dy, hh, mm, ss;
- unsigned days;
yr = tm->tm_year - 70;
mo = tm->tm_mon;
int i;
static long int Cdate[2], Rdate[2], Edate[2], Bdate[2];
static short int revisions;
-#if defined(__DECC) || defined(__DECCXX)
-#pragma __member_alignment __save
-#pragma __nomember_alignment
-#endif /* __DECC || __DECCXX */
+# if defined(__DECC) || defined(__DECCXX)
+# pragma __member_alignment __save
+# pragma __nomember_alignment
+# endif /* __DECC || __DECCXX */
static union {
unsigned short int value;
struct {
unsigned world : 4;
} bits;
} prot;
-#if defined(__DECC) || defined(__DECCXX)
-#pragma __member_alignment __restore
-#endif /* __DECC || __DECCXX */
+# if defined(__DECC) || defined(__DECCXX)
+# pragma __member_alignment __restore
+# endif /* __DECC || __DECCXX */
static unsigned long uic;
static struct fjndef jnl;
{0, 0, 0}
};
- fileblk = cc$rms_fab; /* Initialize FAB. */
- nam = CC_RMS_NAM; /* Initialize NAM[L]. */
- fileblk.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
+ GETGLOBALS(); /* Get "G" stuff (for REENTRANT). */
-#ifdef NAML$C_MAXRSS
+ fileblk = cc$rms_fab; /* Initialize FAB. */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ fileblk.FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
- fileblk.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fileblk.fab$l_fna = (char *) -1; /* Using NAML for file name. */
+# ifdef NAML$C_MAXRSS
/* Special ODS5-QIO-compatible name storage. */
nam.naml$l_filesys_name = sys_nam;
nam.naml$l_filesys_name_alloc = sizeof(sys_nam);
-#endif /* NAML$C_MAXRSS */
+# endif /* NAML$C_MAXRSS */
+ NAMX_DNA_FNA_SET( fileblk)
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNA = (char *)fname;
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNS = strlen(fname);
- nam.NAM_ESA = exp_nam;
- nam.NAM_ESS = sizeof(exp_nam);
- nam.NAM_RSA = res_nam;
- nam.NAM_RSS = sizeof(res_nam);
+ nam.NAMX_ESA = exp_nam;
+ nam.NAMX_ESS = sizeof(exp_nam);
+ nam.NAMX_RSA = res_nam;
+ nam.NAMX_RSS = sizeof(res_nam);
if ( ERR(status = sys$parse(&fileblk)) )
{
return -1;
}
- pka_devdsc.dsc$w_length = (unsigned short)nam.NAM_DVI[0];
+ pka_devdsc.dsc$w_length = (unsigned short)nam.NAMX_DVI[0];
if ( ERR(status = sys$assign(&pka_devdsc, &pka_devchn, 0, 0)) )
{
}
/* Load the descriptor with the appropriate name data: */
-#ifdef NAML$C_MAXRSS
+# ifdef NAML$C_MAXRSS
/* Enable fancy name characters. Note that "fancy" here does
not include Unicode, for which there's no support elsewhere.
pka_fnam.dsc$a_pointer = nam.naml$l_filesys_name;
pka_fnam.dsc$w_length = nam.naml$l_filesys_name_size;
-#else /* !NAML$C_MAXRSS */
+# else /* !NAML$C_MAXRSS */
/* Extract only the name.type;version. */
- pka_fnam.dsc$a_pointer = nam.NAM_L_NAME;
- pka_fnam.dsc$w_length = nam.NAM_B_NAME + nam.NAM_B_TYPE + nam.NAM_B_VER;
+ pka_fnam.dsc$a_pointer = nam.NAMX_L_NAME;
+ pka_fnam.dsc$w_length = nam.NAMX_B_NAME + nam.NAMX_B_TYPE + nam.NAMX_B_VER;
-#endif /* ?NAML$C_MAXRSS */
+# endif /* ?NAML$C_MAXRSS */
/* Move the directory ID from the NAM[L] to the FIB.
Clear the FID in the FIB, as we're using the name.
*/
for (i = 0; i < 3; i++)
{
- pka_fib.FIB$W_DID[i] = nam.NAM_DID[i];
+ pka_fib.FIB$W_DID[i] = nam.NAMX_DID[i];
pka_fib.FIB$W_FID[i] = 0;
}
*/
for (i = 0; i < 3; i++)
{
- pka_fib.FIB$W_DID[i] = nam.NAM_DID[i];
+ pka_fib.FIB$W_DID[i] = nam.NAMX_DID[i];
pka_fib.FIB$W_FID[i] = 0;
}
#ifdef DEBUG
-#if 0 /* currently not used anywhere ! */
+# if 0 /* currently not used anywhere ! */
void dump_rms_block(p)
unsigned char *p;
{
}
}
-#endif /* never */
-#endif /* DEBUG */
+# endif /* 0 */
+#endif /* def DEBUG */
{
int status;
- static char filenam[NAM_MAXRSS + 1];
- static char efn[NAM_MAXRSS];
- static char last_wild[NAM_MAXRSS + 1];
+ static char filenam[NAMX_MAXRSS + 1];
+ static char efn[NAMX_MAXRSS];
+ static char last_wild[NAMX_MAXRSS + 1];
static struct FAB fab;
- static struct NAM_STRUCT nam;
+ static struct NAMX_STRUCT nam;
static int first_call = 1;
- static ZCONST char deflt[] = "[]*.ZIP";
+ static ZCONST char deflt[] = ".ZIP";
if ( first_call || strcmp(wld, last_wild) )
{ /* (Re)Initialize everything */
strcpy( last_wild, wld );
fab = cc$rms_fab; /* Initialize FAB. */
- nam = CC_RMS_NAM; /* Initialize NAM[L]. */
- fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
-
-#ifdef NAML$C_MAXRSS
-
- fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
-
-#endif /* NAML$C_MAXRSS */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ fab.FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
+ NAMX_DNA_FNA_SET( fab)
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = (char *) deflt;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = sizeof(deflt) - 1;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = last_wild;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(last_wild);
- nam.NAM_ESA = efn;
- nam.NAM_ESS = sizeof(efn)-1;
- nam.NAM_RSA = filenam;
- nam.NAM_RSS = sizeof(filenam)-1;
+ nam.NAMX_ESA = efn;
+ nam.NAMX_ESS = sizeof(efn)-1;
+ nam.NAMX_RSA = filenam;
+ nam.NAMX_RSS = sizeof(filenam)-1;
first_call = 0;
* Parse the file spec. If sys$parse() fails, save the VMS
* error message for later use, and return an empty string.
*/
- nam.NAM_NOP = NAM_M_SYNCHK; /* Syntax-only analysis. */
+ nam.NAMX_NOP = NAMX_M_SYNCHK; /* Syntax-only analysis. */
if ( !OK(status = sys$parse(&fab)) )
{
vms_msg_fetch(status);
* sys$search() will work properly. Regardless of parse error,
* leave filenam[] as-was.
*/
- nam.NAM_NOP = 0; /* Normal analysis. */
+ nam.NAMX_NOP = 0; /* Normal analysis. */
if ( OK(status = sys$parse(&fab)) )
{
status = sys$search(&fab);
return (char *)NULL;
}
}
- filenam[nam.NAM_RSL] = '\0'; /* Add the NUL terminator. */
+ filenam[nam.NAMX_RSL] = '\0'; /* Add the NUL terminator. */
return filenam;
} /* end function do_wild() */
-static ulg unix_to_vms[8]={ /* Map from UNIX rwx to VMS rwed */
- /* Note that unix w bit is mapped to VMS wd bits */
- /* no access */
- XAB$M_NOREAD | XAB$M_NOWRITE | XAB$M_NODEL | XAB$M_NOEXE, /* --- */
- XAB$M_NOREAD | XAB$M_NOWRITE | XAB$M_NODEL, /* --x */
- XAB$M_NOREAD | XAB$M_NOEXE, /* -w- */
- XAB$M_NOREAD, /* -wx */
- XAB$M_NOWRITE | XAB$M_NODEL | XAB$M_NOEXE, /* r-- */
- XAB$M_NOWRITE | XAB$M_NODEL, /* r-x */
- XAB$M_NOEXE, /* rw- */
- 0 /* rwx */
- /* full access */
-};
-
-#define SETDFPROT /* We are using undocumented VMS System Service */
- /* SYS$SETDFPROT here. If your version of VMS does */
- /* not have that service, undef SETDFPROT. */
- /* IM: Maybe it's better to put this to Makefile */
- /* and DESCRIP.MMS */
-#ifdef SETDFPROT
-extern int sys$setdfprot();
-#endif
+/* 2013-05-03 SMS.
+ * Moved SETDFPROT code out of mapattr(), and into (new)
+ * get_rms_fileprot(), which is always called from the main program.
+ */
int mapattr(__G)
__GDEF
{
ulg tmp = G.crec.external_file_attributes;
ulg theprot;
- static ulg defprot = (ulg)-1L,
- sysdef, owndef, grpdef, wlddef; /* Default protection fields */
+ unsigned uxattr;
/* IM: The only field of XABPRO we need to set here is */
/* file protection, so we need not to change type */
/* of G.pInfo->file_attr. WORD is quite enough. */
- if ( defprot == (ulg)-1L )
- {
- /*
- * First time here -- Get user default settings
- */
-
-#ifdef SETDFPROT /* Undef this if linker cat't resolve SYS$SETDFPROT */
- defprot = (ulg)0L;
- if ( !ERR(sys$setdfprot(0, &defprot)) )
- {
- sysdef = defprot & ( (1L<<XAB$S_SYS)-1 ) << XAB$V_SYS;
- owndef = defprot & ( (1L<<XAB$S_OWN)-1 ) << XAB$V_OWN;
- grpdef = defprot & ( (1L<<XAB$S_GRP)-1 ) << XAB$V_GRP;
- wlddef = defprot & ( (1L<<XAB$S_WLD)-1 ) << XAB$V_WLD;
- }
- else
-#endif /* SETDFPROT */
- {
- umask(defprot = umask(0));
- defprot = ~defprot;
- wlddef = unix_to_vms[defprot & 07] << XAB$V_WLD;
- grpdef = unix_to_vms[(defprot>>3) & 07] << XAB$V_GRP;
- owndef = unix_to_vms[(defprot>>6) & 07] << XAB$V_OWN;
- sysdef = owndef >> (XAB$V_OWN - XAB$V_SYS);
- defprot = sysdef | owndef | grpdef | wlddef;
- }
- }
-
switch (G.pInfo->hostnum) {
case AMIGA_:
tmp = (unsigned)(tmp>>16 & 0x0f); /* Amiga RWED bits */
case TANDEM_:
{
int r = FALSE;
- unsigned uxattr = (unsigned)(tmp >> 16); /* drwxrwxrwx */
+ uxattr = (unsigned)(tmp >> 16); /* drwxrwxrwx */
if (uxattr == 0 && G.extra_field) {
/* Some (non-Info-ZIP) implementations of Zip for Unix and
*/
G.pInfo->symlink = S_ISLNK(uxattr) &&
SYMLINK_HOST(G.pInfo->hostnum);
-#endif
+#endif /* def SYMLINKS */
theprot = (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);
/* all remaining cases: expand MSDOS read-only bit into write perms */
case FS_FAT_:
+#if 0
+ /* this is handled generically now */
+ /* 2010-11-27 SMS.
+ * But uxattr needs to be set for these cases. The
+ * 2010-09-22 code set it only conditionally, which was
+ * wrong, but disabling the whole thing leaves uxattr always
+ * unset, causing bad G.pInfo->symlink values (and who knows
+ * what else?). So, that "uxattr =" assignment below must
+ * still exist. It's just unconditional here, now. Code in
+ * process.c:process_cdir_file_hdr() clears any undesirable
+ * bits in G.crec.external_file_attributes ("tmp") before we
+ * see them ("handled generically now").
+ */
+
+ /* PKWARE's PKZip for Unix marks entries as FS_FAT_, but stores the
+ * Unix attributes in the upper 16 bits of the external attributes
+ * field, just like Info-ZIP's Zip for Unix. We try to use that
+ * value, after a check for consistency with the MSDOS attribute
+ * bits (see below).
+ */
+ /* 2010-09-22 SMS. User complaints suggest that we can't
+ * trust these external attribute bits to be UNIX-like
+ * attribute bits if bit 2 of the _internal_ attributes is
+ * set. For safety, trust nothing with any bits other than
+ * 0 or 1 set in the internal attributes.
+ */
+ if ((G.crec.internal_file_attributes & 0xfc) == 0) {
+ uxattr = (unsigned)(tmp >> 16);
+ }
+#endif /* 0 */
+ /* fall through! */
case FS_HPFS_:
case FS_NTFS_:
case MAC_:
case TOPS20_:
default:
+ uxattr = (unsigned)(tmp >> 16); /* drwxrwxrwx (?) */
+
+ /* Ensure that DOS subdir bit is set when the entry's name ends
+ * in a '/'. Some third-party Zip programs fail to set the subdir
+ * bit for directory entries.
+ */
+ if ((tmp & 0x10) == 0) {
+ extent fnlen = strlen(G.filename);
+ if (fnlen > 0 && G.filename[fnlen-1] == '/')
+ tmp |= 0x10;
+ }
+ tmp = !(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!
+ */
+#ifdef SYMLINKS
+ /* Entries "made by FS_FAT_" could have been zipped on a
+ * system that supports POSIX-style symbolic links.
+ */
+ G.pInfo->symlink = S_ISLNK(uxattr) &&
+ (G.pInfo->hostnum == FS_FAT_);
+#endif /* def SYMLINKS */
+ }
theprot = defprot;
if ( tmp & 1 ) /* Test read-only bit */
{ /* Bit is set -- set bits in all fields */
#define PATH_DEFAULT "SYS$DISK:[]"
-/* dest_struct_level()
-
- Returns file system structure level for argument, negative on
- error.
-*/
+static char *dest_dev = NULL;
+static int dest_dev_len = -1;
+static char dest_dev_e_name[ NAMX_MAXRSS + 1];
-int dest_struct_level(char *path)
-{
- int acp_code;
-#ifdef DVI$C_ACP_F11V5
-
- /* Should know about ODS5 file system. Do actual check.
- (This should be non-VAX with __CRTL_VER >= 70200000.)
- */
+/* dest_dev_name()
+ *
+ * Stores device name of path argument at dest_dev (in
+ * dest_dev_e_name), with length dest_dev_len.
+ */
+int dest_dev_name( char *path)
+{
int sts;
struct FAB fab;
- struct NAM_STRUCT nam;
- char e_name[NAM_MAXRSS + 1];
-
- struct dsc$descriptor_s dev_descr =
- { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 };
+ struct NAMX_STRUCT nam;
fab = cc$rms_fab; /* Initialize FAB. */
- nam = CC_RMS_NAM; /* Initialize NAM[L]. */
- fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
-
-#ifdef NAML$C_MAXRSS
-
- fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
-
-#endif /* NAML$C_MAXRSS */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ fab.FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
+ NAMX_DNA_FNA_SET( fab)
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = PATH_DEFAULT;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = strlen(PATH_DEFAULT);
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = path;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(path);
- nam.NAM_ESA = e_name;
- nam.NAM_ESS = sizeof(e_name) - 1;
+ nam.NAMX_ESA = dest_dev_e_name;
+ nam.NAMX_ESS = sizeof( dest_dev_e_name)- 1;
- nam.NAM_NOP = NAM_M_SYNCHK; /* Syntax-only analysis. */
- sts = sys$parse(&fab);
+ nam.NAMX_NOP = NAMX_M_SYNCHK; /* Syntax-only analysis. */
+ sts = sys$parse( &fab);
if ((sts & STS$M_SUCCESS) == STS$K_SUCCESS)
{
+ /* Save destination device name pointer, length. */
+ dest_dev = nam.NAMX_L_DEV;
+ dest_dev_len = nam.NAMX_B_DEV;
+ }
+ return sts;
+}
+
+
+/* dest_struct_level()
+ *
+ * Returns file system structure level for argument, negative on
+ * error.
+ */
+
+int dest_struct_level( char *path)
+{
+#ifdef DVI$C_ACP_F11V5
+
+ /* Should know about ODS5 file system. Do actual check.
+ * (This should be non-VAX with __CRTL_VER >= 70200000.)
+ */
+
+ int acp_code = -1;
+ int sts;
+
+ 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.
+ * Otherwise (NULL), use what's already in dest_dev.
+ */
+ if (path != NULL)
+ {
+ /* Set dest_dev and dest_dev_len from the argument. */
+ sts = dest_dev_name( path);
+ }
+ if (dest_dev_len > 0)
+ {
/* Load resultant device name into device descriptor. */
- dev_descr.dsc$a_pointer = nam.NAM_L_DEV;
- dev_descr.dsc$w_length = nam.NAM_B_DEV;
+ dev_descr.dsc$a_pointer = dest_dev;
+ dev_descr.dsc$w_length = dest_dev_len;
/* Get filesystem type code.
- (Text results for this item code have been unreliable.)
- */
+ *(Text results for this item code have been unreliable.)
+ */
sts = lib$getdvi(&((int) DVI$_ACPTYPE),
0,
&dev_descr,
acp_code = -2;
}
}
- else
- {
- acp_code = -1;
- }
-#else /* !DVI$C_ACP_F11V5 */
+#else /* def DVI$C_ACP_F11V5 */
/* Too old for ODS5 file system. Return level 2. */
acp_code = DVI$C_ACP_F11V2;
-#endif /* ?DVI$C_ACP_F11V5 */
+#endif /* def DVI$C_ACP_F11V5 [else] */
return acp_code;
}
/* 2005-02-12 SMS.
- Note that these name conversion functions do no length checking.
- Buffer overflows are possible.
+ * Note that these name conversion functions do no length checking.
+ * Buffer overflows are possible.
+ *
+ * 2012-08-08 SMS.
+ * Added "-s" (uO.sflag) processing.
*/
static void adj_dir_name_ods2(char *dest, char *src, int src_len)
}
-static void adj_dir_name_ods5(char *dest, char *src, int src_len)
+static void adj_dir_name_ods5(__GPRO__ char *dest, char *src, int src_len)
{
/* The source string (src) typically extends beyond the directory
segment of interest, hence the confining src_len argument.
for (src_last = src + src_len; src < src_last; src++)
{
prop = char_prop[uchr = *src]; /* Get source char, props. */
- prop = char_prop[uchr]; /* Get source char props. */
- if ((prop & (32+8+4)) != 0) /* Escape 1-char, including */
+ if (uO.sflag && (prop & 8) != 0)
+ { /* With "-s", simply */
+ uchr = '_'; /* replace SP with "_". */
+ }
+ else if ((prop & (32+ 8+ 4)) != 0) /* Escape 1-char, including */
{ /* SP and dot. */
*dest++ = '^'; /* Insert caret. */
if ((prop & 8) != 0) /* Replace SP with "_". */
}
-static void adj_file_name_ods2(char *dest, char *src)
+static void adj_file_name_ods2(__GPRO__ char *dest, char *src)
{
unsigned char uchr;
unsigned char prop;
char *endp;
char *versionp;
char *last_dot;
+ int version_digit = 0;
endp = src + strlen(src); /* Pointer to the NUL-terminator of src. */
/* Starting at the end, find the last non-decimal-digit. */
versionp = endp;
- while ((--versionp >= src) && isdigit(*versionp));
+ while ((--versionp >= src) && isdigit(*versionp)) version_digit = 1;
- /* Left-most non-digit of a valid version is ";" (or perhaps "."). */
- if ((*versionp != ';') && ((uO.Y_flag == 0) || (*versionp != '.')))
+ /* Left-most non-digit of a valid version is ";" (or perhaps ".").
+ * Valid version must have at least one digit. ("name;" is a funny
+ * name, not a name with a version.)
+ */
+ if ((version_digit == 0) ||
+ ((*versionp != ';') && ((uO.Y_flag == 0) || (*versionp != '.'))))
{
/* No valid version. The last dot is the last dot. */
versionp = endp;
}
else
{ /* Some kind of valid version. */
- if (!uO.V_flag) /* Not -V, so cut off version. */
+ if (uO.V_flag <= 0) /* Not -V, so cut off version. */
{
*versionp = '\0';
}
}
-static void adj_file_name_ods5(char *dest, char *src)
+static void adj_file_name_ods5(__GPRO__ char *dest, char *src)
{
unsigned char uchr;
unsigned char prop;
char *endp;
char *versionp;
char *last_dot;
+ int version_digit = 0;
endp = src + strlen(src); /* Pointer to the NUL-terminator of src. */
/* Starting at the end, find the last non-decimal-digit. */
versionp = endp;
- while ((--versionp >= src) && isdigit(*versionp));
+ while ((--versionp >= src) && isdigit(*versionp)) version_digit = 1;
- /* Left-most non-digit of a valid version is ";" (or perhaps "."). */
- if ((*versionp != ';') && ((uO.Y_flag == 0) || (*versionp != '.')))
+ /* Left-most non-digit of a valid version is ";" (or perhaps ".").
+ * Valid version must have at least one digit. ("name;" is a funny
+ * name, not a name with a version.)
+ */
+ if ((version_digit == 0) ||
+ ((*versionp != ';') && ((uO.Y_flag == 0) || (*versionp != '.'))))
{
/* No valid version. The last dot is the last dot. */
versionp = endp;
}
else
{ /* Some kind of valid version. */
- if (!uO.V_flag) /* Not -V, so cut off version. */
+ if (uO.V_flag <= 0) /* Not -V, so cut off version. */
{
*versionp = '\0';
}
{
/* Note that "src" has been incremented, affecting "src <=". */
prop = char_prop[uchr]; /* Get source char props. */
- if ((prop & (32+8)) != 0) /* Escape 1-char, including */
+ if (uO.sflag && (prop & 8) != 0)
+ { /* With "-s", simply */
+ uchr = '_'; /* replace SP with "_". */
+ }
+ else if ((prop & (32+ 8)) != 0) /* Escape 1-char, including */
{ /* SP (but not dot). */
if (src <= versionp) /* No escapes for version. */
{
-# define FN_MASK 7
-# define USE_DEFAULT (FN_MASK+1)
+#define FN_MASK 7
+#define USE_DEFAULT (FN_MASK+1)
/*
* Checkdir function codes:
int renamed;
{
char pathcomp[FILNAMSIZ]; /* Path-component buffer. */
+#ifdef SYMLINKS
+ char pathcopy[FILNAMSIZ]; /* Copy of path we can alter. */
+#endif /* def SYMLINKS */
+
char *last_slash; /* Last slash in path. */
char *next_slash; /* Next slash in path. */
int dir_len; /* Length of a directory segment. */
int killed_ddot = FALSE; /* Set when skipping "../" pathcomp. */
int error = MPN_OK;
+ /* 2012-05-02 SMS.
+ * Formerly, if a null member name was supplied, then we'd end up
+ * below, returning MPN_INF_SKIP, which meant that we'd silently
+ * skip the null-name entry. With any luck, someone else will fix a
+ * null name before mapname() gets called. If we do get here with a
+ * null name, then we'll (now) treat it as an error (as in
+ * unix/unix.c).
+ */
+ if (*G.filename == '\0')
+ {
+ Info( slide, 1, ((char *)slide,
+ "mapname: conversion of \"%s\" failed\n",
+ FnFilter1(G.filename)));
+ return (error & ~MPN_MASK) | MPN_ERR_SKIP;
+ }
+
if ( renamed )
{
if ( !(error = checkdir(__G__ pathcomp, APPEND_NAME | USE_DEFAULT)) )
---------------------------------------------------------------------------*/
if (G.pInfo->vollabel)
- return MPN_VOL_LABEL; /* can't set disk volume labels on VMS */
+ {
+ /* Volume label. */
+ int dev_all; /* Device is allocated. */
+ int sts; /* System service status. */
+
+ struct dsc$descriptor_s dev_descr = /* Device name descriptor. */
+ { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 };
+
+ error = MPN_VOL_LABEL; /* Assume some problem. */
+ if (uO.volflag > 0)
+ {
+ /* Setting volume label. Get the destination device name,
+ * if not already known (-d).
+ */
+ if (dest_dev_len < 0)
+ {
+ sts = dest_dev_name( PATH_DEFAULT);
+ }
+
+ if (dest_dev_len > 0)
+ {
+ /* Load resultant device name into device name descriptor. */
+ dev_descr.dsc$a_pointer = dest_dev;
+ dev_descr.dsc$w_length = dest_dev_len;
+
+ /* Get interesting device properties (allocated?). */
+ sts = lib$getdvi( &((int)DVI$_ALL), /* Item code. */
+ 0, /* Channel. */
+ &dev_descr, /* Device name. */
+ &dev_all, /* Result buffer (int). */
+ 0, /* Result string. */
+ 0); /* Result string len. */
+
+ if ((sts& STS$M_SEVERITY) == STS$K_SUCCESS)
+ {
+ if (dev_all == 0)
+ {
+ Info( slide, 1, ((char *)slide,
+ "Can not set volume label. Device not allocated: %.*s\n",
+ dest_dev_len, dest_dev));
+ error = MPN_ERR_SKIP;
+ }
+ else
+ {
+ /* Sadly, the only known way to set a volume
+ * label is a DCL command:
+ * SET VOLUME /LABEL = "xxx"
+ */
+ char cmd[ 256];
+ struct dsc$descriptor_s cmd_descr =
+ { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
+
+ /* NOCLISYM avoids user redefinition of SET.
+ * Not NOLOGNAM, in case the user uses logical
+ * names in file specs. KEYPAD and CONTROL
+ * should matter little. TRUSTED allows use in
+ * a captive account environment.
+ */
+ unsigned int spawn_flags = (CLI$M_NOCLISYM |
+ CLI$M_NOKEYPAD |
+ CLI$M_NOCONTROL |
+ CLI$M_TRUSTED);
+ unsigned int sts2;
+ $DESCRIPTOR( nl_descr, "NL:");
+
+ /* Form the command. */
+ sprintf( cmd, "SET VOLUME /LABEL = \"%s\" %.*s",
+ G.filename, dest_dev_len, dest_dev);
+ cmd_descr.dsc$a_pointer = cmd;
+ cmd_descr.dsc$w_length = strlen( cmd);
+
+ /* Execute the command. */
+ sts = lib$spawn(
+ &cmd_descr, /* Command. */
+ &nl_descr, /* SYS$INPUT. */
+ 0, /* nl_descr,? */ /* SYS$OUTPUT. */
+ &spawn_flags, /* Flags. */
+ 0, /* Process name. */
+ 0, /* Process ID. */
+ &sts2, /* Command status. */
+ 0, /* Event flag. */
+ 0, /* AST address. */
+ 0, /* AST parameter. */
+ 0, /* Prompt string. */
+ 0, /* CLI file spec. */
+ 0); /* Command table. */
+
+ if ((sts& STS$M_SEVERITY) == STS$K_SUCCESS)
+ {
+ /* Initial success. Look at IOSB status. */
+ sts = sts2;
+ }
+
+ if ((sts& STS$M_SEVERITY) == STS$K_SUCCESS)
+ {
+ /* Success. */
+ error = MPN_INF_SKIP;
+ if (QCOND2)
+ {
+ Info( slide, 0, ((char *)slide,
+ " labeled %.*s %-22s\n",
+ dest_dev_len, dest_dev,
+ FnFilter1(G.filename)));
+ }
+ }
+ else
+ {
+ /* Failure. */
+ error = MPN_ERR_SKIP;
+ Info( slide, 1, ((char *)slide,
+ "Error setting volume label. Device: %.*s\n%s\n",
+ dest_dev_len, dest_dev,
+ strerror( EVMSERR, sts)));
+ }
+ }
+ }
+ }
+ }
+ return error;
+ }
/* can create path as long as not just freshening, or if user told us */
G.create_dirs = !uO.fflag;
When pointer exceeds last_slash, then directory segments are
done, and only the name (with version?) remains.
*/
-
*pathcomp = '\0'; /* Initialize translation buffer. */
- last_slash = strrchr(G.filename, '/'); /* Find last slash. */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
- if (uO.jflag) /* If junking directories, */
- cp = last_slash; /* start at (will be after) the last slash. */
+#ifdef SYMLINKS
+ /* If a symlink with a trailing "/", then use a copy without the "/". */
+ if (G.pInfo->symlink)
+ {
+ size_t lenm1;
- if (cp == NULL) /* If no '/', or keeping directories, */
- cp = G.filename; /* start at the front of the pathname. */
- else /* Else, with directories to junk, */
- ++cp; /* start after the last slash. */
+ lenm1 = strlen( cp)- 1;
+ if (cp[ lenm1] == '/')
+ {
+ strncpy( pathcopy, cp, lenm1);
+ pathcopy[ lenm1] = '\0';
+ cp = pathcopy;
+ }
+ }
+#endif /* def SYMLINKS */
+
+ last_slash = strrchr( cp, '/'); /* Find last slash. */
/* Loop through the directory segments. */
while (cp < last_slash)
}
else /* Make directory name ODS5-compliant. */
{
- adj_dir_name_ods5(pathcomp, cp, dir_len);
+ adj_dir_name_ods5(__G__ pathcomp, cp, dir_len);
}
if (((error = checkdir(__G__ pathcomp, APPEND_DIR))
& MPN_MASK) > MPN_INF_TRUNC)
}
/* If there is one, adjust the name.type;version segment. */
- if (strlen(cp) == 0)
+ if (*cp == '\0')
{
/* Directory only, no file name. Create the directory, as needed.
Report directory creation to user.
checkdir(__G__ "", APPEND_NAME); /* create directory, if not found */
checkdir(__G__ G.filename, GETPATH);
if (created_dir) {
- if (QCOND2) {
- Info(slide, 0, ((char *)slide, " creating: %s\n",
- FnFilter1(G.filename)));
+ if (QCOND2)
+ {
+ Info( slide, 0, ((char *)slide, ExtractMsg, "creat",
+ FnFilter1( G.filename), "", "\n"));
+#ifdef ENABLE_USER_PROGRESS
+ G.extract_msg_str = "creat";
+#endif /* def ENABLE_USER_PROGRESS */
}
/* set dir time (note trailing '/') */
return (error & ~MPN_MASK) | MPN_CREATED_DIR;
/* Process the file name. */
if (ods2_names) /* Make file name ODS2-compliant. */
{
- adj_file_name_ods2(pathcomp, cp);
+ adj_file_name_ods2(__G__ pathcomp, cp);
}
else /* Make file name ODS5-compliant. */
{
- adj_file_name_ods5(pathcomp, cp);
+ adj_file_name_ods5(__G__ pathcomp, cp);
}
checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */
static int mkdir_failed=0;
int status;
struct FAB fab;
- struct NAM_STRUCT nam;
+ struct NAMX_STRUCT nam;
/************
of the user-specified destination directory. Previously, various
values behaved badly, without complaint, e.g. "-d sys$scratch".
*/
- char *root_dest;
/* If the root path has already been set, return immediately. */
if (rootlen > 0)
return MPN_OK;
/* Initialization. */
- root_dest = PATH_DEFAULT; /* Default destination for ODSx sensing. */
root_has_dir = 0; /* Root includes a directory. */
fab = cc$rms_fab; /* Initialize FAB. */
- nam = CC_RMS_NAM; /* Initialize NAM[L]. */
- fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
-
-#ifdef NAML$C_MAXRSS
-
- fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
-
-#endif /* NAML$C_MAXRSS */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ fab.FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
+
+ NAMX_DNA_FNA_SET( fab)
+
+ /* 2012-07-17 SMS.
+ * Changed the ("-d") root directory test to avoid silently
+ * accepting (and then ignoring) directory-less directory
+ * specifications, like "." and "..". The old code used
+ * pathcomp as the file spec, and PATH_DEFAULT as the default
+ * spec. Now we use TEST_NAME as the file spec, and pathcomp as
+ * the default spec. It's still not fool-proof, but it may be
+ * better. The "(includes file name)" error message now shows
+ * the user-specified name, instead of the expanded name.
+ */
+#define TEST_NAME "UNLIKELY.UNLIKELY;99999"
/* Specified file spec. */
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = pathcomp;
- FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(pathcomp);
+ FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen( pathcomp);
/* Default file spec. */
- FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = PATH_DEFAULT;
- FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = strlen(PATH_DEFAULT);
+ FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = TEST_NAME;
+ FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = strlen( TEST_NAME);
/* Expanded file spec. */
- nam.NAM_ESA = pathbuf;
- nam.NAM_ESS = NAM_MAXRSS;
+ nam.NAMX_ESA = pathbuf;
+ nam.NAMX_ESS = NAMX_MAXRSS;
status = sys$parse(&fab);
}
/* Should be only a device:[directory], so name+type+version
- should have length 2 (".;").
- */
- if (nam.NAM_B_NAME + nam.NAM_B_TYPE + nam.NAM_B_VER > 2)
+ * should match TEST_NAME.
+ */
+ if ((nam.NAMX_B_NAME + nam.NAMX_B_TYPE + nam.NAMX_B_VER !=
+ strlen( TEST_NAME)) ||
+ (strcasecmp( nam.NAMX_L_NAME, TEST_NAME) != 0))
{
Info(slide, 1, ((char *)slide,
"Invalid destination directory (includes file name): %s\n",
- FnFilter1(nam.NAM_ESA)));
+ FnFilter1( pathcomp)));
return MPN_ERR_SKIP;
}
/* Truncate at name, leaving only "dev:[dir]". */
- *nam.NAM_L_NAME = '\0';
- rootlen = nam.NAM_L_NAME - nam.NAM_ESA;
+ *nam.NAMX_L_NAME = '\0';
+ rootlen = nam.NAMX_L_NAME - nam.NAMX_ESA;
/* Remove any trailing dots in directory. */
- if ((nam.NAM_ESA[rootlen-1] == ']') &&
- (nam.NAM_ESA[rootlen-2] != '^'))
+ if ((nam.NAMX_ESA[rootlen-1] == ']') &&
+ (nam.NAMX_ESA[rootlen-2] != '^'))
{
root_has_dir = 1;
rootlen -= 2;
- while ((nam.NAM_ESA[rootlen] == '.') &&
- (nam.NAM_ESA[rootlen-1] != '^'))
+ while ((nam.NAMX_ESA[rootlen] == '.') &&
+ (nam.NAMX_ESA[rootlen-1] != '^'))
{
rootlen--;
}
- nam.NAM_ESA[++rootlen] = ']';
- nam.NAM_ESA[++rootlen] = '\0';
+ nam.NAMX_ESA[++rootlen] = ']';
+ nam.NAMX_ESA[++rootlen] = '\0';
}
- devlen = nam.NAM_L_DIR - nam.NAM_ESA;
+ devlen = nam.NAMX_L_DIR - nam.NAMX_ESA;
/* If directory not found, then create it. */
if (status == RMS$_DNF)
{
- if (status = mkdir(nam.NAM_ESA, 0))
+ if (status = mkdir(nam.NAMX_ESA, 0))
{
Info(slide, 1, ((char *)slide,
"Can not create destination directory: %s\n",
- FnFilter1(nam.NAM_ESA)));
+ FnFilter1(nam.NAMX_ESA)));
/* path didn't exist, tried to create, and failed. */
return MPN_ERR_SKIP;
}
/* Save the (valid) device:[directory] spec. */
- strcpy(pathbuf, nam.NAM_ESA);
- root_dest = pathbuf;
+ strcpy(pathbuf, nam.NAMX_ESA);
/* At this point, the true destination is known. If the user
- supplied an invalid destination directory, the default
- directory will be used. (This may be pointless, but should
- be safe.)
- */
+ * supplied an invalid destination directory, the default
+ * directory will be used. (This may be pointless, but should
+ * be safe.)
+ *
+ * Save the destination device name for use in setting the
+ * volume label or for determining the file system type.
+ */
+ dest_dev = dest_dev_e_name;
+ strncpy( dest_dev, nam.NAMX_L_DEV, nam.NAMX_B_DEV);
+ dest_dev_len = nam.NAMX_B_DEV;
- /* If not yet known, determine the destination (root_dest) file
- system type (ODS2 or ODS5).
- */
+ /* If not yet known, determine the destination file system type,
+ * ODS2 or ODS5, real or user-specified (ODS2).
+ */
if (ods2_names < 0)
{
/* If user doesn't force ODS2, set flag according to dest. */
if (uO.ods2_flag == 0)
{
- ods2_names = (dest_struct_level(root_dest) <= DVI$C_ACP_F11V2);
+ ods2_names = (dest_struct_level( NULL) <= DVI$C_ACP_F11V2);
}
else
{
/* Set various pointers and lengths. */
devptr = pathbuf;
- dirptr = pathbuf + (nam.NAM_L_DIR - nam.NAM_ESA);
+ dirptr = pathbuf + (nam.NAMX_L_DIR - nam.NAMX_ESA);
rootend = pathbuf + rootlen;
*(end = rootend) = '\0';
root_dirlen = dirlen = rootlen - devlen;
if ( function == INIT )
{
- if ( strlen(G.filename) + rootlen + 13 > NAM_MAXRSS )
+ if ( strlen(G.filename) + rootlen + 13 > NAMX_MAXRSS )
return MPN_ERR_TOOLONG;
if ( rootlen == 0 ) /* No root given, reset everything. */
*end++ = '.';
}
- else if ( cmplen + (end-pathptr) > NAM_MAXRSS )
+ else if ( cmplen + (end-pathptr) > NAMX_MAXRSS )
return MPN_ERR_TOOLONG;
else
{ /* Expand renamed filename using collected path, return
* at pathcomp */
fab = cc$rms_fab; /* Initialize FAB. */
- nam = CC_RMS_NAM; /* Initialize NAM[L]. */
- fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
-
-#ifdef NAML$C_MAXRSS
-
- fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
-
-#endif /* NAML$C_MAXRSS */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ fab.FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
+ NAMX_DNA_FNA_SET( fab)
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = pathptr;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = end - pathptr;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(G.filename);
- nam.NAM_ESA = pathcomp; /* (Great design. ---v. SMS.) */
- nam.NAM_ESS = NAM_MAXRSS; /* Assume large enough. */
+ nam.NAMX_ESA = pathcomp; /* (Great design. ---v. SMS.) */
+ nam.NAMX_ESS = NAMX_MAXRSS; /* Assume large enough. */
if (!OK(status = sys$parse(&fab)) && status == RMS$_DNF )
/* Directory not found: */
char *dirend;
int mkdir_failed;
- dirend = (char*)nam.NAM_L_DIR + nam.NAM_B_DIR;
+ dirend = (char*)nam.NAMX_L_DIR + nam.NAMX_B_DIR;
save = *dirend;
*dirend = '\0';
- if ( (mkdir_failed = mkdir(nam.NAM_L_DEV, 0)) &&
+ if ( (mkdir_failed = mkdir(nam.NAMX_L_DEV, 0)) &&
errno == EEXIST )
mkdir_failed = 0;
*dirend = save;
return 3;
created_dir = TRUE;
} /* if (sys$parse... */
- pathcomp[nam.NAM_ESL] = '\0';
+ pathcomp[nam.NAMX_ESL] = '\0';
return MPN_OK;
} /* if (USE_DEFAULT) */
else
mkdir_failed = 1; /* Mine for GETPATH */
}
}
- if ( strlen(pathcomp) + (end-pathbuf) > 255 )
+ if ( strlen(pathcomp) + (end-pathbuf) > NAMX_MAXRSS )
return MPN_INF_TRUNC;
strcpy(end, pathcomp);
end += strlen(pathcomp);
struct FAB fab;
struct XABDAT xdat;
#ifdef NAML$C_MAXRSS
- struct NAM_STRUCT nam;
+ struct NAMX_STRUCT nam;
#endif
/* 2008-07-12 SMS.
#ifdef NAML$C_MAXRSS
- nam = CC_RMS_NAM; /* Initialize NAM[L]. */
- fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
-
- fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
- fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ fab.FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
#endif /* NAML$C_MAXRSS */
+ NAMX_DNA_FNA_SET( fab)
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = filenam;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(filenam);
#ifdef USE_EF_UT_TIME
if (G.extra_field &&
-#ifdef IZ_CHECK_TZ
+# ifdef IZ_CHECK_TZ
G.tz_is_valid &&
-#endif
+# endif
(ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
G.lrec.last_mod_dos_datetime, &z_utime, NULL)
& EB_UT_FL_MTIME))
+/* name_only()
+ *
+ * Extracts the name component from a VMS-style path specification.
+ * Returns pointer to allocated storage; NULL, if error.
+ */
+char *name_only( path)
+ char *path;
+{
+ char *result = NULL;
+ int sts;
+
+ struct FAB fab;
+ struct NAMX_STRUCT nam;
+ char e_name[ NAMX_MAXRSS + 1];
+
+ fab = cc$rms_fab; /* Initialize FAB. */
+ nam = CC_RMS_NAMX; /* Initialize NAM[L]. */
+ fab.FAB_NAMX = &nam; /* Point FAB to NAM[L]. */
+
+ NAMX_DNA_FNA_SET( fab)
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNA = PATH_DEFAULT;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNS = strlen( PATH_DEFAULT);
+
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = path;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen( path);
+
+ nam.NAMX_ESA = e_name;
+ nam.NAMX_ESS = sizeof( e_name)- 1;
+
+ nam.NAMX_NOP = NAMX_M_SYNCHK; /* Syntax-only analysis. */
+ sts = sys$parse( &fab);
+
+ if ((sts & STS$M_SUCCESS) == STS$K_SUCCESS)
+ {
+ /* Allocate storage, save name component. */
+ result = izu_malloc( nam.NAMX_B_NAME+ 1);
+ if (result != NULL)
+ {
+ strncpy( result, nam.NAMX_L_NAME, nam.NAMX_B_NAME);
+ result[ nam.NAMX_B_NAME] = '\0';
+ }
+ }
+ return result;
+}
+
+
+
+/*
+ * 2007-01-29 SMS.
+ *
+ * VMS Status Code Summary (See STSDEF.H for details.)
+ *
+ * Bits: 31:28 27:16 15:3 2 1 0
+ * Field: Control Facility Message Severity
+ * -----
+ * 0 0 0 0 Warning
+ * 0 0 1 1 Success
+ * 0 1 0 2 Error
+ * 0 1 1 3 Information
+ * 1 0 0 4 Severe (fatal) error
+ *
+ * In the Control field, bits 31:29 are reserved. Bit 28 inhibits
+ * printing the message. In the Facility field, bit 27 means
+ * customer-defined (not HP-assigned, like us). In the Message field,
+ * bit 15 means facility-specific (which our messages are).
+ *
+ * Note that the C library translates exit(0) to a $STATUS value of 1 =
+ * SS$_NORMAL. (This way, exit is silent and has a $SEVERITY of
+ * "success").
+ *
+ * UnZip versions before 6.00 used a generic ("chosen (by
+ * experimentation)") Control+Facility code of 0x7FFF, which included
+ * some reserved control bits, the inhibit-printing bit, and the
+ * customer-defined bit.
+ *
+ * HP has now assigned official Facility names and corresponding
+ * Facility codes for the Info-ZIP products:
+ *
+ * Facility Name Facility Code
+ * IZ_UNZIP 1954 = 0x7A2
+ * IZ_ZIP 1955 = 0x7A3
+ *
+ * Now, unless the CTL_FAC_IZ_UZP macro is defined at build-time, we
+ * will use the official Facility code.
+ */
+
+/* Official HP-assigned Info-ZIP UnZip Facility code. */
+#define FAC_IZ_UZP 1954 /* 0x7A2 */
+
+#ifndef CTL_FAC_IZ_UZP
+ /*
+ * Default is inhibit-printing with the official Facility code.
+ */
+# define CTL_FAC_IZ_UZP ((0x1 << 12) | FAC_IZ_UZP)
+# define MSG_FAC_SPEC 0x8000 /* Facility-specific code. */
+#else /* ndef CTL_FAC_IZ_UZP */
+ /* Use the user-supplied Control+Facility code for err or warn. */
+# ifndef MSG_FAC_SPEC /* Old default is not Facility-specific. */
+# define MSG_FAC_SPEC 0x0 /* Facility-specific code. Or 0x8000. */
+# endif /* ndef MSG_FAC_SPEC */
+#endif /* ndef CTL_FAC_IZ_UZP [else] */
+#define VMS_UZ_FAC_BITS ((CTL_FAC_IZ_UZP << 16) | MSG_FAC_SPEC)
+
+
+/* Translate a PK_xxx code to the corresponding VMS status value. */
+
+int vms_status( int err)
+{
+ int sts;
+ int severity;
+
+ severity = (err == PK_OK) ? STS$K_SUCCESS : /* success */
+ (err == PK_WARN) ? STS$K_WARNING : /* warning */
+ ((err == PK_ERR) || /* error */
+ ((err >= PK_NOZIP) && (err <= PK_FIND)) || /* ... */
+ ((err >= IZ_CTRLC) && (err <= IZ_BADPWD)) || /* ... */
+ (err == IZ_BADDEST)) ? STS$K_ERROR : /* ... */
+ STS$K_SEVERE; /* fatal */
+
+ /* 2013-06-13 SMS.
+ * Normal behavior is to return SS$_NORMAL for success (PK_OK), or a
+ * status value with an official Facility code for any other result.
+ * Define OK_USE_FAC to return a success code with a Facility code
+ * (instead of SS$_NORMAL).
+ *
+ * Raw status codes are effectively multiplied by two ("<< 4"
+ * instead of "<< 3"), which makes them easier to read in a
+ * hexadecimal representation of the VMS status value. For example,
+ * PK_PARAM = 10 (0x0a) -> %x17A280A2.
+ * ^^
+ *
+ * UnZip versions before 6.00 (before an official Facility code was
+ * 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.)
+ */
+
+#ifdef OK_USE_FAC
+
+ /* Always return a status code comprising Control, Facility,
+ * Message, and Severity.
+ */
+ sts = VMS_UZ_FAC_BITS | /* Facility (+?) */
+ (err << 4) | /* Message code */
+ severity; /* Severity */
+
+#else /* def OK_USE_FAC */
+
+ /* Return simple SS$_NORMAL for ZE_OK. Otherwise, return a status
+ * code comprising Control, Facility, Message, and Severity.
+ */
+ sts = (err == PK_OK) ? SS$_NORMAL : /* Success */
+ (VMS_UZ_FAC_BITS | /* Facility (+?) */
+ (err << 4) | /* Message code */
+ severity); /* Severity */
+
+#endif /* def OK_USE_FAC [else] */
+
+ return sts;
+} /* end function vms_status() */
+
+
+/* Exit with an intelligent status/severity code. */
+
+/* Declare __posix_exit() if <stdlib.h> won't, and we use it. */
+
+#if __CRTL_VER >= 70000000 && !defined(_POSIX_EXIT)
+# if !defined( NO_POSIX_EXIT)
+void __posix_exit (int __status);
+# endif /* !defined( NO_POSIX_EXIT) */
+#endif /* __CRTL_VER >= 70000000 && !defined(_POSIX_EXIT) */
+
+
#ifdef RETURN_CODES
void return_VMS(__G__ err)
__GDEF
#endif
int err;
{
- int severity;
+
+#if !defined( NO_POSIX_EXIT) && (__CRTL_VER >= 70000000)
+ char *sh_ptr;
+#endif /* !defined( NO_POSIX_EXIT) && (__CRTL_VER >= 70000000) */
#ifdef RETURN_CODES
/*---------------------------------------------------------------------------
VMS misinterprets return codes as rather obnoxious system errors ("access
violation," for example).
---------------------------------------------------------------------------*/
+/* 2012-06-10 SMS.
+ * Of course, we normally translate these simple codes to VMS-like
+ * codes, which work with the supplied error message file, so the
+ * utility of this option is unclear. Also, it doesn't affect the
+ * actual exit status code, it only adds the extra message display.
+ * (And Zip has no such extra message display.)
+ */
switch (err) {
case PK_COOL:
"\n[return-code %d: bad decryption password for all files]\n",
err));
break;
-#ifdef DO_SAFECHECK_2GB
+# ifdef DO_SAFECHECK_2GB
case IZ_ERRBF:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: big-file archive, small-file program]\n",
err));
break;
-#endif /* DO_SAFECHECK_2GB */
+# endif /* DO_SAFECHECK_2GB */
+ case IZ_BADDEST:
+ Info(slide, 1, ((char *)slide,
+ "\n\
+[return-code %d: Error creating auto destination dir (already exists?)]\n",
+ err));
+ break;
default:
Info(slide, 1, ((char *)slide,
- "\n[return-code %d: unknown return-code (screw-up)]\n", err));
+ "\n\
+[return-code %d: unknown return-code (Please report problem.)]\n", err));
break;
}
#endif /* RETURN_CODES */
-/*---------------------------------------------------------------------------
- * Return an intelligent status/severity level:
- *
- * 2007-01-29 SMS.
- *
- * VMS Status Code Summary (See STSDEF.H for details.)
- *
- * Bits: 31:28 27:16 15:3 2 1 0
- * Field: Control Facility Message Severity
- * -----
- * 0 0 0 0 Warning
- * 0 0 1 1 Success
- * 0 1 0 2 Error
- * 0 1 1 3 Information
- * 1 0 0 4 Severe (fatal) error
- *
- * In the Control field, bits 31:29 are reserved. Bit 28 inhibits
- * printing the message. In the Facility field, bit 27 means
- * customer-defined (not HP-assigned, like us). In the Message field,
- * bit 15 means facility-specific (which our messages are).
- *
- * Note that the C library translates exit(0) to a $STATUS value of 1
- * (i.e., exit is both silent and has a $SEVERITY of "success").
- *
- * Previous versions of Info-ZIP programs used a generic ("chosen (by
- * experimentation)") Control+Facility code of 0x7FFF, which included
- * some reserved control bits, the inhibit-printing bit, and the
- * customer-defined bit.
- *
- * HP has now assigned official Facility names and corresponding
- * Facility codes for the Info-ZIP products:
- *
- * Facility Name Facility Code
- * IZ_UNZIP 1954 = 0x7A2
- * IZ_ZIP 1955 = 0x7A3
- *
- * Now, unless the CTL_FAC_IZ_UZP macro is defined at build-time, we
- * will use the official Facility code.
- *
- ---------------------------------------------------------------------------*/
+#if !defined( NO_POSIX_EXIT) && (__CRTL_VER >= 70000000)
-/* Official HP-assigned Info-ZIP UnZip Facility code. */
-#define FAC_IZ_UZP 1954 /* 0x7A2 */
+ /* If the environment variable "SHELL" is defined, and not defined
+ * as "DCL" (by GNV "bash", for example), then use __posix_exit() to
+ * exit with the raw, UNIX-like status code.
+ */
+ sh_ptr = getenv( "SHELL");
+ if ((sh_ptr != NULL) && strcasecmp( sh_ptr, "DCL"))
+ {
+ __posix_exit( err);
+ }
+ else
-#ifndef CTL_FAC_IZ_UZP
- /*
- * Default is inhibit-printing with the official Facility code.
- */
-# define CTL_FAC_IZ_UZP ((0x1 << 12) | FAC_IZ_UZP)
-# define MSG_FAC_SPEC 0x8000 /* Facility-specific code. */
-#else /* CTL_FAC_IZ_UZP */
- /* Use the user-supplied Control+Facility code for err or warn. */
-# ifndef MSG_FAC_SPEC /* Old default is not Facility-specific. */
-# define MSG_FAC_SPEC 0x0 /* Facility-specific code. Or 0x8000. */
-# endif /* !MSG_FAC_SPEC */
-#endif /* ?CTL_FAC_IZ_ZIP */
-#define VMS_UZ_FAC_BITS ((CTL_FAC_IZ_UZP << 16) | MSG_FAC_SPEC)
-
- severity = (err == PK_WARN) ? 0 : /* warn */
- (err == PK_ERR || /* error */
- (err >= PK_NOZIP && err <= PK_FIND) || /* ... */
- (err >= IZ_CTRLC && err <= IZ_BADPWD)) ? 2 : /* ... */
- 4; /* fatal */
-
- exit( /* $SEVERITY: */
- (err == PK_COOL) ? SS$_NORMAL : /* success */
- (VMS_UZ_FAC_BITS | (err << 4) | severity) /* warning, error, fatal */
- );
+#endif /* #if !defined( NO_POSIX_EXIT) && (__CRTL_VER >= 70000000) */
+ {
+ exit( vms_status( err));
+ }
} /* end function return_VMS() */
* GRR, 15 Aug 91 / SPC, 07 Aug 1995, 14 Nov 1999
*/
-#ifndef OUTDEVICE_NAME
-#define OUTDEVICE_NAME "SYS$OUTPUT"
-#endif
+# ifndef OUTDEVICE_NAME
+# define OUTDEVICE_NAME "SYS$OUTPUT"
+# endif
static ZCONST struct dsc$descriptor_s OutDevDesc =
{(sizeof(OUTDEVICE_NAME) - 1), DSC$K_DTYPE_T, DSC$K_CLASS_S,
__GDEF
{
int len;
-#ifdef VMS_VERSION
+# ifdef VMS_VERSION
char *chrp1;
char *chrp2;
char buf[40];
char vms_vers[16];
int ver_maj;
-#endif
-#ifdef __DECC_VER
+# endif
+# ifndef __GNUC__
+# ifdef __DECC_VER
char buf2[40];
int vtyp;
-#endif
+# endif /* def __DECC_VER */
+# endif /* ndef __GNUC__ */
-#ifdef VMS_VERSION
+# ifdef VMS_VERSION
/* Truncate the version string at the first (trailing) space. */
strncpy(vms_vers, VMS_VERSION, sizeof(vms_vers));
vms_vers[sizeof(vms_vers)-1] = '\0';
for (chrp2 = &vms_vers[1];
chrp2 < chrp1;
ver_maj = ver_maj * 10 + *(chrp2++) - '0');
-#endif /* VMS_VERSION */
+# endif /* VMS_VERSION */
/* DEC C in ANSI mode does not like "#ifdef MACRO" inside another
macro when MACRO is equated to a value (by "#define MACRO 1"). */
len = sprintf((char *)slide, LoadFarString(CompiledWith),
-#ifdef __GNUC__
+# ifdef __GNUC__
"gcc ", __VERSION__,
-#else
+# else /* def __GNUC__ */
# if defined(DECC) || defined(__DECC) || defined (__DECC__)
"DEC C",
-# ifdef __DECC_VER
+# ifdef __DECC_VER
(sprintf(buf2, " %c%d.%d-%03d",
((vtyp = (__DECC_VER / 10000) % 10) == 6 ? 'T' :
(vtyp == 8 ? 'S' : 'V')),
__DECC_VER / 10000000,
(__DECC_VER % 10000000) / 100000, __DECC_VER % 1000), buf2),
-# else
+# else /* def __DECC_VER */
"",
-# endif
-# else
-# ifdef VAXC
+# endif /* def __DECC_VER [else] */
+# else /* defined(DECC) || defined(__DECC) || defined (__DECC__) */
+# ifdef VAXC
"VAX C", "",
-# else
+# else /* def VAXC */
"unknown compiler", "",
-# endif
-# endif
-#endif
+# endif /* def VAXC [else] */
+# endif /* defined(DECC) || defined(__DECC) || defined (__DECC__) [else] */
+# endif /* def __GNUC__ [else] */
-#ifdef VMS_VERSION
+# ifdef VMS_VERSION
# if defined(__alpha)
"OpenVMS",
(sprintf(buf, " (%s Alpha)", vms_vers), buf),
(ver_maj >= 6) ? "OpenVMS" : "VMS",
(sprintf(buf, " (%s VAX)", vms_vers), buf),
# endif
-#else
+# else /* def VMS_VERSION */
"VMS",
"",
-#endif /* ?VMS_VERSION */
+# endif /* def VMS_VERSION [else] */
-#ifdef __DATE__
+# ifdef __DATE__
" on ", __DATE__
-#else
+# else
"", ""
-#endif
+# endif
);
(*G.message)((zvoid *)&G, slide, (ulg)len, 0);
#endif /* !SFX */
+/* 2012-09-05 SMS.
+ * Copied from Zip [.vms]vmszip.c. Prototype in [.vms]vmscfg.h.)
+ *
+ * 2004-09-25 SMS.
+ * str[n]casecmp() replacement for old C RTL.
+ * Assumes a prehistorically incompetent toupper().
+ */
+#ifndef HAVE_STRCASECMP
+
+int strncasecmp( char *s1, char *s2, size_t n)
+{
+ /* Initialization prepares for n == 0. */
+ char c1 = '\0';
+ char c2 = '\0';
+
+ while (n-- > 0)
+ {
+ /* Set c1 and c2. Convert lower-case characters to upper-case. */
+ if (islower( c1 = *s1))
+ c1 = toupper( c1);
+
+ if (islower( c2 = *s2))
+ c2 = toupper( c2);
+
+ /* Quit at inequality or NUL. */
+ if ((c1 != c2) || (c1 == '\0'))
+ break;
+
+ s1++;
+ s2++;
+ }
+return ((unsigned int) c1- (unsigned int) c2);
+}
+
+#endif /* ndef HAVE_STRCASECMP */
+
+
+#ifdef ENABLE_USER_PROGRESS
+
+/* 2011-12-05 SMS.
+ *
+ * establish_ctrl_t().
+ *
+ * Establish Ctrl/T handler, if SYS$COMMAND is a terminal.
+ */
+
+int establish_ctrl_t( void ctrl_t_ast())
+{
+ int status;
+ short iosb[ 4];
+
+ int access_mode = PR$C_PS_USER;
+ int dev_class;
+
+/*
+ * Mask bits for Ctrl/x characters.
+ * Z Y X W V U T S R Q P O N M L K J I H G F E D C B A sp
+ * 1A 19 18 17 16 15 14 13 12 11 10 F E D C B A 9 8 7 6 5 4 3 2 1 0
+ * -------- ----------- ----------- ------- ------- ------- --------
+ * 0 1 0 0 0 0 0
+ */
+ struct
+ {
+ int mask_size;
+ unsigned int mask;
+ } char_mask = { 0, 0x00100000 }; /* Ctrl/T. */
+
+ $DESCRIPTOR( term_name_descr, "SYS$COMMAND");
+ short term_chan;
+
+ status = sys$assign( &term_name_descr, &term_chan, 0, 0);
+ if ((status& STS$M_SEVERITY) != STS$K_SUCCESS)
+ {
+ fprintf( stderr, " establish_ctrl_t(): $ASSIGN sts = %%x%08x .\n",
+ status);
+ return status;
+ }
+
+ status = lib$getdvi( &((int)DVI$_DEVCLASS), /* Item code. */
+ &term_chan, /* Channel. */
+ 0, /* Device name. */
+ &dev_class, /* Result buffer (int). */
+ 0, /* Result string. */
+ 0); /* Result string len. */
+
+ if ((status& STS$M_SEVERITY) != STS$K_SUCCESS)
+ {
+ fprintf( stderr, " establish_ctrl_t(): $GETDVI sts = %%x%08x .\n",
+ status);
+ sys$dassgn( term_chan);
+ return status;
+ }
+
+ if (dev_class != DC$_TERM)
+ {
+ /* SYS$COMMAND is not a terminal. (Batch job, for example.)
+ * Harmless, but we can't establish a Ctrl/T handler for it.
+ */
+ sys$dassgn( term_chan);
+ vaxc$errno = ENOTTY;
+ return EVMSERR;
+ }
+
+#define FUN_AST_ENA (IO$_SETMODE| IO$M_OUTBAND)
+
+ status = sys$qiow( 0, /* Event flag. */
+ term_chan, /* Channel. */
+ FUN_AST_ENA, /* Function code. */
+ &iosb, /* IOSB. */
+ 0, /* AST address. */
+ 0, /* AST parameter. */
+ ctrl_t_ast, /* P1 = OOB AST addr. */
+ &char_mask, /* P2 = Char mask. */
+ &access_mode, /* P3 = Access mode. */
+ 0, /* P4. */
+ 0, /* P5. */
+ 0); /* P6. */
+
+ if ((status& STS$M_SEVERITY) != STS$K_SUCCESS)
+ {
+ fprintf( stderr, " establish_ctrl_t(): $QIOW sts = %%x%08x .\n",
+ status);
+ sys$dassgn( term_chan);
+ }
+
+ /* If successful, then don't deassign the channel. */
+ return status;
+}
+
+#endif /* def ENABLE_USER_PROGRESS */
+
#ifdef __DECC
* taken of the caller-ID value, but options could be set differently
* for read versus write access. (I assume that specifying fab$w_deq,
* for example, for a read-only file has no ill effects.)
+ *
+ * 2010-10-07 SMS.
+ * Note that "#ifndef REENTRANT" conditionality here allows compilation
+ * with REENTRANT defined, but does not ensure proper functionality.
*/
/* Global storage. */
int acc_cb(int *id_arg, struct FAB *fab, struct RAB *rab)
{
- int sts;
-
+# ifndef REENTRANT
/* Get process RMS_DEFAULT values, if not already done. */
if (rms_defaults_known == 0)
{
get_rms_defaults();
}
+# endif /* ndef REENTRANT */
/* If RMS_DEFAULT (and adjusted active) values are available, then set
* the FAB/RAB parameters. If RMS_DEFAULT values are not available,
rab-> rab$v_wbh = 1;
}
+# ifndef REENTRANT
if (DIAG_FLAG)
{
fprintf(stderr,
"Open callback. ID = %d, deq = %6d, mbc = %3d, mbf = %3d.\n",
*id_arg, fab-> fab$w_deq, rab-> rab$b_mbc, rab-> rab$b_mbf);
}
+# endif /* ndef REENTRANT */
}
/* Declare success. */
}
-
/*
* 2004-09-19 SMS.
*
*----------------------------------------------------------------------
*/
-#ifdef __CRTL_VER
-#if !defined(__VAX) && (__CRTL_VER >= 70301000)
+# if !defined( DLL) || defined( USE_UNZIP_LIB$INITIALIZE)
-#include <unixlib.h>
+# ifdef __CRTL_VER
+# if !defined(__VAX) && (__CRTL_VER >= 70301000)
+
+# include <unixlib.h>
/*--------------------------------------------------------------------*/
/* LIB$INITIALIZE initialization function. */
-static void decc_init(void)
+void decc_init(void)
{
int feat_index;
int feat_value;
/* Get "decc_init()" into a valid, loaded LIB$INITIALIZE PSECT. */
-#pragma nostandard
+# pragma nostandard
/* Establish the LIB$INITIALIZE PSECT, with proper alignment and
attributes.
/* Fake reference to ensure loading the LIB$INITIALIZE PSECT. */
-#pragma extern_model save
+# pragma extern_model save
/* The declaration for LIB$INITIALIZE() is missing in the VMS system header
files. Addionally, the lowercase name "lib$initialize" is defined as a
macro, so that this system routine can be reference in code using the
similar way to allow using lowercase names within the C code, whereas the
"externally" visible names in the created object files are uppercase.)
*/
-#ifndef lib$initialize
-# define lib$initialize LIB$INITIALIZE
-#endif
+# ifndef lib$initialize
+# define lib$initialize LIB$INITIALIZE
+# endif
int lib$initialize(void);
-#pragma extern_model strict_refdef
+# pragma extern_model strict_refdef
int dmy_lib$initialize = (int)lib$initialize;
-#pragma extern_model restore
+# pragma extern_model restore
-#pragma standard
+# pragma standard
-#endif /* !defined(__VAX) && (__CRTL_VER >= 70301000) */
-#endif /* __CRTL_VER */
+# endif /* !defined(__VAX) && (__CRTL_VER >= 70301000) */
+# endif /* __CRTL_VER */
+# endif /* !defined( DLL) || defined( USE_UNZIP_LIB$INITIALIZE) */
#endif /* __DECC */
-
-#endif /* VMS */
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2013 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.
#ifdef NAML$C_MAXRSS /* NAML is available (ODS5 support...) */
-# ifndef NAM_MAXRSS /* May have been defined before. */
-# define NAM_MAXRSS NAML$C_MAXRSS
+# ifndef NAMX_MAXRSS /* May have been defined before. */
+# define NAMX_MAXRSS NAML$C_MAXRSS
# endif
-# define NAM_STRUCT NAML
+# define NAMX_STRUCT NAML
# define FAB_OR_NAML(fab, nam) (nam)
# define FAB_OR_NAML_DNA naml$l_long_defname
# define FAB_OR_NAML_FNA naml$l_long_filename
# define FAB_OR_NAML_FNS naml$l_long_filename_size
-# define CC_RMS_NAM cc$rms_naml
-# define FAB_NAM fab$l_naml
-
-# define NAM_ESA naml$l_long_expand
-# define NAM_ESL naml$l_long_expand_size
-# define NAM_ESS naml$l_long_expand_alloc
-# define NAM_RSA naml$l_long_result
-# define NAM_RSL naml$l_long_result_size
-# define NAM_RSS naml$l_long_result_alloc
-# define NAM_DID naml$w_did
-# define NAM_DVI naml$t_dvi
-# define NAM_FID naml$w_fid
-# define NAM_FNB naml$l_fnb
-# define NAM_NOP naml$b_nop
-# define NAM_M_SYNCHK NAML$M_SYNCHK
-# define NAM_B_DEV naml$l_long_dev_size
-# define NAM_L_DEV naml$l_long_dev
-# define NAM_B_DIR naml$l_long_dir_size
-# define NAM_L_DIR naml$l_long_dir
-# define NAM_B_NAME naml$l_long_name_size
-# define NAM_L_NAME naml$l_long_name
-# define NAM_B_TYPE naml$l_long_type_size
-# define NAM_L_TYPE naml$l_long_type
-# define NAM_B_VER naml$l_long_ver_size
-# define NAM_L_VER naml$l_long_ver
+# define CC_RMS_NAMX cc$rms_naml
+# define FAB_NAMX fab$l_naml
+
+# define NAMX_ESA naml$l_long_expand
+# define NAMX_ESL naml$l_long_expand_size
+# define NAMX_ESS naml$l_long_expand_alloc
+# define NAMX_RSA naml$l_long_result
+# define NAMX_RSL naml$l_long_result_size
+# define NAMX_RSS naml$l_long_result_alloc
+# define NAMX_DID naml$w_did
+# define NAMX_DVI naml$t_dvi
+# define NAMX_FID naml$w_fid
+# define NAMX_FNB naml$l_fnb
+# define NAMX_NOP naml$b_nop
+# define NAMX_M_SYNCHK NAML$M_SYNCHK
+# define NAMX_B_DEV naml$l_long_dev_size
+# define NAMX_L_DEV naml$l_long_dev
+# define NAMX_B_DIR naml$l_long_dir_size
+# define NAMX_L_DIR naml$l_long_dir
+# define NAMX_B_NAME naml$l_long_name_size
+# define NAMX_L_NAME naml$l_long_name
+# define NAMX_B_TYPE naml$l_long_type_size
+# define NAMX_L_TYPE naml$l_long_type
+# define NAMX_B_VER naml$l_long_ver_size
+# define NAMX_L_VER naml$l_long_ver
+# define NAMX_DNA_FNA_SET( fab) (fab).fab$l_dna = (char *) -1; \
+ (fab).fab$l_fna = (char *) -1;
#else /* !NAML$C_MAXRSS */ /* NAML is not available. Use NAM. */
-# ifndef NAM_MAXRSS /* May have been defined before. */
-# define NAM_MAXRSS NAM$C_MAXRSS
+# ifndef NAMX_MAXRSS /* May have been defined before. */
+# define NAMX_MAXRSS NAM$C_MAXRSS
# endif
-# define NAM_STRUCT NAM
+# define NAMX_STRUCT NAM
# define FAB_OR_NAML(fab, nam) (fab)
# define FAB_OR_NAML_DNA fab$l_dna
# define FAB_OR_NAML_FNA fab$l_fna
# define FAB_OR_NAML_FNS fab$b_fns
-# define CC_RMS_NAM cc$rms_nam
-# define FAB_NAM fab$l_nam
-# define NAM_ESA nam$l_esa
-# define NAM_ESL nam$b_esl
-# define NAM_ESS nam$b_ess
-# define NAM_RSA nam$l_rsa
-# define NAM_RSL nam$b_rsl
-# define NAM_RSS nam$b_rss
-# define NAM_DID nam$w_did
-# define NAM_DVI nam$t_dvi
-# define NAM_FID nam$w_fid
-# define NAM_FNB nam$l_fnb
-# define NAM_NOP nam$b_nop
-# define NAM_M_SYNCHK NAM$M_SYNCHK
-# define NAM_B_DEV nam$b_dev
-# define NAM_L_DEV nam$l_dev
-# define NAM_B_DIR nam$b_dir
-# define NAM_L_DIR nam$l_dir
-# define NAM_B_NAME nam$b_name
-# define NAM_L_NAME nam$l_name
-# define NAM_B_TYPE nam$b_type
-# define NAM_L_TYPE nam$l_type
-# define NAM_B_VER nam$b_ver
-# define NAM_L_VER nam$l_ver
+# define CC_RMS_NAMX cc$rms_nam
+# define FAB_NAMX fab$l_nam
+# define NAMX_ESA nam$l_esa
+# define NAMX_ESL nam$b_esl
+# define NAMX_ESS nam$b_ess
+# define NAMX_RSA nam$l_rsa
+# define NAMX_RSL nam$b_rsl
+# define NAMX_RSS nam$b_rss
+# define NAMX_DID nam$w_did
+# define NAMX_DVI nam$t_dvi
+# define NAMX_FID nam$w_fid
+# define NAMX_FNB nam$l_fnb
+# define NAMX_NOP nam$b_nop
+# define NAMX_M_SYNCHK NAM$M_SYNCHK
+# define NAMX_B_DEV nam$b_dev
+# define NAMX_L_DEV nam$l_dev
+# define NAMX_B_DIR nam$b_dir
+# define NAMX_L_DIR nam$l_dir
+# define NAMX_B_NAME nam$b_name
+# define NAMX_L_NAME nam$l_name
+# define NAMX_B_TYPE nam$b_type
+# define NAMX_L_TYPE nam$l_type
+# define NAMX_B_VER nam$b_ver
+# define NAMX_L_VER nam$l_ver
+# define NAMX_DNA_FNA_SET( fab)
#endif /* ?NAML$C_MAXRSS */
#ifndef __vmscfg_h /* Prevent (unlikely) multiple inclusions. */
#define __vmscfg_h
-/* Workaround for broken header files of older DECC distributions
- * that are incompatible with the /NAMES=AS_IS qualifier. */
-#define cma$tis_errno_get_addr CMA$TIS_ERRNO_GET_ADDR
+/* 2011-12-26 SMS.
+ * Added the whole cma$tis_* set instead of only cma$tis_errno_get_addr.
+ * (Needed cma$tis_vmserrno_get_addr for the user-triggered progress
+ * messages.)
+ *
+ * Workaround for broken header files of older DECC distributions
+ * that are incompatible with the /NAMES=AS_IS qualifier.
+ */
+#define cma$tis_errno_get_addr CMA$TIS_ERRNO_GET_ADDR
+#define cma$tis_vmserrno_get_addr CMA$TIS_VMSERRNO_GET_ADDR
+#define cma$tis_errno_set_value CMA$TIS_ERRNO_SET_VALUE
+#define cma$tis_vmserrno_set_value CMA$TIS_VMSERRNO_SET_VALUE
+
+#define sys$assign SYS$ASSIGN
+#define sys$dassgn SYS$DASSGN
+#define sys$qiow SYS$QIOW
/* LARGE FILE SUPPORT - 10/6/04 EG */
/* This needs to be set before the includes so they set the right sizes */
# include <unistd.h>
#endif
-# include <types.h> /* GRR: experimenting... */
-# include <stat.h>
-# include <time.h> /* the usual non-BSD time functions */
-# include <file.h> /* same things as fcntl.h has */
-# include <unixio.h>
-# include <rms.h>
+#include <limits.h> /* UINT_MAX */
+#include <types.h> /* GRR: experimenting... */
+#include <stat.h>
+#include <time.h> /* the usual non-BSD time functions */
+#include <file.h> /* same things as fcntl.h has */
+#include <unixio.h>
+#include <rms.h>
+
+/* 2012-09-05 SMS.
+ * Judge availability of str[n]casecmp() in C RTL.
+ * (Note: This must follow a "#include <decc$types.h>" in something to
+ * ensure that __CRTL_VER is as defined as it will ever be. DEC C on
+ * VAX may not define it itself.)
+ */
+#if __CRTL_VER >= 70000000
+# define HAVE_STRCASECMP
+#endif /* __CRTL_VER >= 70000000 */
+
+#ifdef HAVE_STRCASECMP
+# include <strings.h> /* str[n]casecmp() */
+#else /* def HAVE_STRCASECMP */
+# define strcasecmp( s1, s2) strncasecmp( s1, s2, UINT_MAX)
+extern int strncasecmp( char *, char *, size_t);
+#endif /* def HAVE_STRCASECMP [else] */
/* Define maximum path length according to NAM[L] member size. */
-# ifndef NAM_MAXRSS
+# ifndef NAMX_MAXRSS
# ifdef NAML$C_MAXRSS
-# define NAM_MAXRSS NAML$C_MAXRSS
+# define NAMX_MAXRSS NAML$C_MAXRSS
# else
-# define NAM_MAXRSS NAM$C_MAXRSS
+# define NAMX_MAXRSS NAM$C_MAXRSS
# endif
# endif
-# define _MAX_PATH (NAM_MAXRSS+1) /* to define FILNAMSIZ below */
+# define _MAX_PATH (NAMX_MAXRSS+1) /* to define FILNAMSIZ below */
-# ifdef RETURN_CODES /* VMS interprets standard PK return codes incorrectly */
-# define RETURN(ret) return_VMS(__G__ (ret)) /* verbose version */
-# define EXIT(ret) return_VMS(__G__ (ret))
-# else
-# define RETURN return_VMS /* quiet version */
-# define EXIT return_VMS
-# endif
+# ifdef DLL
+ /* Return the normal (raw) PK status code. */
+# define RETURN return
+# define EXIT return
+# else /* def DLL */
+ /* Do the desired VMS-specific status code and exit processing. */
+# ifdef RETURN_CODES
+ /* Display error message before exiting. */
+# define RETURN(ret) return_VMS(__G__ (ret))
+# define EXIT(ret) return_VMS(__G__ (ret))
+# else
+ /* Exit without extra error message. */
+# define RETURN return_VMS
+# define EXIT return_VMS
+# endif
+# endif /* def DLL [else] */
# ifdef VMSCLI
# define USAGE(ret) VMSCLI_usage(__G__ (ret))
# endif
typedef struct stat z_stat;
#define Z_STAT_DEFINED
+#if defined( UNICODE_SUPPORT) && defined( UNICODE_WCHAR)
+# define HAVE_CTYPE_H
+# define HAVE_LOCALE_H
+# define HAVE_WCHAR_H
+# define HAVE_WCTYPE_H
+#endif /* defined( UNICODE_SUPPORT) && defined( UNICODE_WCHAR) */
#ifdef __DECC
+++ /dev/null
-diff -ru2 unz60d10/extract.c unz60d10_w32w/extract.c
---- unz60d10/extract.c Thu Dec 27 21:41:40 2007
-+++ unz60d10_w32w/extract.c Mon Feb 11 02:22:00 2008
-@@ -87,4 +87,11 @@
- static int store_info OF((__GPRO));
- #ifdef SET_DIR_ATTRIB
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static int extract_or_test_entrylistw OF((__GPRO__ unsigned numchunk,
-+ ulg *pfilnum, ulg *pnum_bad_pwd, zoff_t *pold_extra_bytes,
-+ unsigned *pnum_dirs,
-+ direntryw **pdirlistw,
-+ int error_in_archive));
-+# endif
- static int extract_or_test_entrylist OF((__GPRO__ unsigned numchunk,
- ulg *pfilnum, ulg *pnum_bad_pwd, zoff_t *pold_extra_bytes,
-@@ -112,4 +119,7 @@
- #endif
- #ifdef SET_DIR_ATTRIB
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ static int Cdecl dircompw OF((ZCONST zvoid *a, ZCONST zvoid *b));
-+# endif
- static int Cdecl dircomp OF((ZCONST zvoid *a, ZCONST zvoid *b));
- #endif
-@@ -336,4 +346,7 @@
- #ifdef SET_DIR_ATTRIB
- unsigned num_dirs=0;
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ direntryw *dirlistw=(direntryw *)NULL, **sorted_dirlistw=(direntryw **)NULL;
-+#endif
- direntry *dirlist=(direntry *)NULL, **sorted_dirlist=(direntry **)NULL;
- #endif
-@@ -356,8 +369,25 @@
- if (uO.exdir != (char *)NULL && G.extract_flag) {
- G.create_dirs = !uO.fflag;
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ if (G.has_win32_wide) {
-+ wchar_t *exdirw = local_to_wchar_string(uO.exdir);
-+ if ((error = checkdirw(exdirw, ROOT)) > MPN_INF_SKIP) {
-+ /* out of memory, or file in way */
-+ free(exdirw);
-+ return (error == MPN_NOMEM ? PK_MEM : PK_ERR);
-+ }
-+ free(exdirw);
-+ } else {
-+ if ((error = checkdir(__G__ uO.exdir, ROOT)) > MPN_INF_SKIP) {
-+ /* out of memory, or file in way */
-+ return (error == MPN_NOMEM ? PK_MEM : PK_ERR);
-+ }
-+ }
-+# else /* ! (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
- if ((error = checkdir(__G__ uO.exdir, ROOT)) > MPN_INF_SKIP) {
- /* out of memory, or file in way */
- return (error == MPN_NOMEM ? PK_MEM : PK_ERR);
- }
-+# endif /* ! (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
- }
- #endif /* !SFX || SFX_EXDIR */
-@@ -570,5 +600,18 @@
- -----------------------------------------------------------------------*/
-
-- error = extract_or_test_entrylist(__G__ j,
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ if (G.has_win32_wide)
-+ {
-+ error = extract_or_test_entrylistw(__G__ j,
-+ &filnum, &num_bad_pwd, &old_extra_bytes,
-+# ifdef SET_DIR_ATTRIB
-+ &num_dirs, &dirlistw,
-+# endif
-+ error_in_archive);
-+ }
-+ else
-+#endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-+ {
-+ error = extract_or_test_entrylist(__G__ j,
- &filnum, &num_bad_pwd, &old_extra_bytes,
- #ifdef SET_DIR_ATTRIB
-@@ -576,4 +619,5 @@
- #endif
- error_in_archive);
-+ }
- if (error != PK_COOL) {
- if (error > error_in_archive)
-@@ -643,4 +687,55 @@
- #ifdef SET_DIR_ATTRIB
- if (num_dirs > 0) {
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ if (G.has_win32_wide) {
-+ sorted_dirlistw = (direntryw **)malloc(num_dirs*sizeof(direntryw *));
-+ if (sorted_dirlistw == (direntryw **)NULL) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(DirlistSortNoMem)));
-+ while (dirlistw != (direntryw *)NULL) {
-+ direntryw *dw = dirlistw;
-+
-+ dirlistw = dirlistw->next;
-+ free(dw);
-+ }
-+ } else {
-+ ulg ndirs_fail = 0;
-+
-+ if (num_dirs == 1)
-+ sorted_dirlistw[0] = dirlistw;
-+ else {
-+ for (i = 0; i < num_dirs; ++i) {
-+ sorted_dirlistw[i] = dirlistw;
-+ dirlistw = dirlistw->next;
-+ }
-+ qsort((char *)sorted_dirlistw, num_dirs, sizeof(direntryw *),
-+ dircompw);
-+ }
-+
-+ Trace((stderr, "setting directory times/perms/attributes\n"));
-+ for (i = 0; i < num_dirs; ++i) {
-+ direntryw *dw = sorted_dirlistw[i];
-+
-+ Trace((stderr, "dir = %s\n", dw->fn));
-+ if ((error = set_direc_attribsw(__G__ dw)) != PK_OK) {
-+ ndirs_fail++;
-+ Info(slide, 0x201, ((char *)slide,
-+ LoadFarString(DirlistSetAttrFailed), dw->fnw));
-+ if (!error_in_archive)
-+ error_in_archive = error;
-+ }
-+ free(dw);
-+ }
-+ free(sorted_dirlistw);
-+ if (!uO.tflag && QCOND2) {
-+ if (ndirs_fail > 0)
-+ Info(slide, 0, ((char *)slide,
-+ LoadFarString(DirlistFailAttrSum), ndirs_fail));
-+ }
-+ }
-+ }
-+ else
-+# endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-+ {
- sorted_dirlist = (direntry **)malloc(num_dirs*sizeof(direntry *));
- if (sorted_dirlist == (direntry **)NULL) {
-@@ -688,4 +783,5 @@
- }
- }
-+ }
- }
- #endif /* SET_DIR_ATTRIB */
-@@ -821,190 +917,731 @@
- #endif
-
--#ifdef USE_WAVP
--# define UNKN_WAVP (G.crec.compression_method!=WAVPACKED)
--#else
--# define UNKN_WAVP TRUE /* WavPack unknown */
-+#ifdef USE_WAVP
-+# define UNKN_WAVP (G.crec.compression_method!=WAVPACKED)
-+#else
-+# define UNKN_WAVP TRUE /* WavPack unknown */
-+#endif
-+
-+#ifdef USE_PPMD
-+# define UNKN_PPMD (G.crec.compression_method!=PPMDED)
-+#else
-+# define UNKN_PPMD TRUE /* PPMd unknown */
-+#endif
-+
-+#ifdef SFX
-+# ifdef USE_DEFLATE64
-+# define UNKN_COMPR \
-+ (G.crec.compression_method!=STORED && G.crec.compression_method<DEFLATED \
-+ && G.crec.compression_method>ENHDEFLATED \
-+ && UNKN_BZ2 && UNKN_LZMA && UNKN_WAVP && UNKN_PPMD)
-+# else
-+# define UNKN_COMPR \
-+ (G.crec.compression_method!=STORED && G.crec.compression_method!=DEFLATED\
-+ && UNKN_BZ2 && UNKN_LZMA && UNKN_WAVP && UNKN_PPMD)
-+# endif
-+#else
-+# ifdef COPYRIGHT_CLEAN /* no reduced files */
-+# define UNKN_RED (G.crec.compression_method >= REDUCED1 && \
-+ G.crec.compression_method <= REDUCED4)
-+# else
-+# define UNKN_RED FALSE /* reducing not unknown */
-+# endif
-+# ifdef LZW_CLEAN /* no shrunk files */
-+# define UNKN_SHR (G.crec.compression_method == SHRUNK)
-+# else
-+# define UNKN_SHR FALSE /* unshrinking not unknown */
-+# endif
-+# ifdef USE_DEFLATE64
-+# define UNKN_COMPR (UNKN_RED || UNKN_SHR || \
-+ G.crec.compression_method==TOKENIZED || \
-+ (G.crec.compression_method>ENHDEFLATED && UNKN_BZ2 && UNKN_LZMA \
-+ && UNKN_WAVP && UNKN_PPMD))
-+# else
-+# define UNKN_COMPR (UNKN_RED || UNKN_SHR || \
-+ G.crec.compression_method==TOKENIZED || \
-+ (G.crec.compression_method>DEFLATED && UNKN_BZ2 && UNKN_LZMA \
-+ && UNKN_WAVP && UNKN_PPMD))
-+# endif
-+#endif
-+
-+#if (defined(USE_BZIP2) && (UNZIP_VERSION < UNZIP_BZ2VERS))
-+ int unzvers_support = (UNKN_BZ2 ? UNZIP_VERSION : UNZIP_BZ2VERS);
-+# define UNZVERS_SUPPORT unzvers_support
-+#else
-+# define UNZVERS_SUPPORT UNZIP_VERSION
-+#endif
-+
-+/*---------------------------------------------------------------------------
-+ Check central directory info for version/compatibility requirements.
-+ ---------------------------------------------------------------------------*/
-+
-+ G.pInfo->encrypted = G.crec.general_purpose_bit_flag & 1; /* bit field */
-+ G.pInfo->ExtLocHdr = (G.crec.general_purpose_bit_flag & 8) == 8; /* bit */
-+ G.pInfo->textfile = G.crec.internal_file_attributes & 1; /* bit field */
-+ G.pInfo->crc = G.crec.crc32;
-+ G.pInfo->compr_size = G.crec.csize;
-+ G.pInfo->uncompr_size = G.crec.ucsize;
-+
-+ switch (uO.aflag) {
-+ case 0:
-+ G.pInfo->textmode = FALSE; /* bit field */
-+ break;
-+ case 1:
-+ G.pInfo->textmode = G.pInfo->textfile; /* auto-convert mode */
-+ break;
-+ default: /* case 2: */
-+ G.pInfo->textmode = TRUE;
-+ break;
-+ }
-+
-+ 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),
-+ FnFilter1(G.filename), "VMS",
-+ G.crec.version_needed_to_extract[0] / 10,
-+ G.crec.version_needed_to_extract[0] % 10,
-+ VMS_UNZIP_VERSION / 10, VMS_UNZIP_VERSION % 10));
-+ return 0;
-+ }
-+#ifndef VMS /* won't be able to use extra field, but still have data */
-+ else if (!uO.tflag && !IS_OVERWRT_ALL) { /* if -o, extract anyway */
-+ Info(slide, 0x481, ((char *)slide, LoadFarString(VMSFormatQuery),
-+ FnFilter1(G.filename)));
-+ fgets(G.answerbuf, 9, stdin);
-+ if ((*G.answerbuf != 'y') && (*G.answerbuf != 'Y'))
-+ return 0;
-+ }
-+#endif /* !VMS */
-+ /* usual file type: don't need VMS to extract */
-+ } else if (G.crec.version_needed_to_extract[0] > UNZVERS_SUPPORT) {
-+ 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));
-+ return 0;
-+ }
-+
-+ if (UNKN_COMPR) {
-+ if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) {
-+#ifndef SFX
-+ unsigned cmpridx;
-+
-+ if ((cmpridx = find_compr_idx(G.crec.compression_method))
-+ < 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));
-+ }
-+ return 0;
-+ }
-+#if (!CRYPT)
-+ if (G.pInfo->encrypted) {
-+ if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)))
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(SkipEncrypted),
-+ FnFilter1(G.filename)));
-+ return 0;
-+ }
-+#endif /* !CRYPT */
-+
-+#ifndef SFX
-+ /* store a copy of the central header filename for later comparison */
-+ if ((G.pInfo->cfilname = zfmalloc(strlen(G.filename) + 1)) == NULL) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(WarnNoMemCFName),
-+ FnFilter1(G.filename)));
-+ } else
-+ zfstrcpy(G.pInfo->cfilname, G.filename);
-+#endif /* !SFX */
-+
-+ /* map whatever file attributes we have into the local format */
-+ mapattr(__G); /* GRR: worry about return value later */
-+
-+ G.pInfo->diskstart = G.crec.disk_number_start;
-+ G.pInfo->offset = (zoff_t)G.crec.relative_offset_local_header;
-+ return 1;
-+
-+} /* end function store_info() */
-+
-+
-+
-+
-+
-+#ifndef SFX
-+/*******************************/
-+/* Function find_compr_idx() */
-+/*******************************/
-+
-+unsigned find_compr_idx(compr_methodnum)
-+ unsigned compr_methodnum;
-+{
-+ unsigned i;
-+
-+ for (i = 0; i < NUM_METHODS; i++) {
-+ if (ComprIDs[i] == compr_methodnum) break;
-+ }
-+ return i;
-+}
-+#endif /* !SFX */
-+
-+
-+
-+
-+
-+/******************************************/
-+/* Function extract_or_test_entrylist() */
-+/******************************************/
-+
-+static int extract_or_test_entrylist(__G__ numchunk,
-+ pfilnum, pnum_bad_pwd, pold_extra_bytes,
-+#ifdef SET_DIR_ATTRIB
-+ pnum_dirs, pdirlist,
-+#endif
-+ error_in_archive) /* return PK-type error code */
-+ __GDEF
-+ unsigned numchunk;
-+ ulg *pfilnum;
-+ ulg *pnum_bad_pwd;
-+ zoff_t *pold_extra_bytes;
-+#ifdef SET_DIR_ATTRIB
-+ unsigned *pnum_dirs;
-+ direntry **pdirlist;
-+#endif
-+ int error_in_archive;
-+{
-+ unsigned i;
-+ int renamed, query;
-+ int skip_entry;
-+ zoff_t bufstart, inbuf_offset, request;
-+ int error, errcode;
-+
-+/* possible values for local skip_entry flag: */
-+#define SKIP_NO 0 /* do not skip this entry */
-+#define SKIP_Y_EXISTING 1 /* skip this entry, do not overwrite file */
-+#define SKIP_Y_NONEXIST 2 /* skip this entry, do not create new file */
-+
-+ /*-----------------------------------------------------------------------
-+ Second loop: process files in current block, extracting or testing
-+ each one.
-+ -----------------------------------------------------------------------*/
-+
-+ for (i = 0; i < numchunk; ++i) {
-+ (*pfilnum)++; /* *pfilnum = i + blknum*DIR_BLKSIZ + 1; */
-+ G.pInfo = &G.info[i];
-+#ifdef NOVELL_BUG_FAILSAFE
-+ G.dne = FALSE; /* assume file exists until stat() says otherwise */
-+#endif
-+
-+ /* if the target position is not within the current input buffer
-+ * (either haven't yet read far enough, or (maybe) skipping back-
-+ * ward), skip to the target position and reset readbuf(). */
-+
-+ /* seek_zipf(__G__ pInfo->offset); */
-+ request = G.pInfo->offset + G.extra_bytes;
-+ inbuf_offset = request % INBUFSIZ;
-+ bufstart = request - inbuf_offset;
-+
-+ Trace((stderr, "\ndebug: request = %ld, inbuf_offset = %ld\n",
-+ (long)request, (long)inbuf_offset));
-+ Trace((stderr,
-+ "debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n",
-+ (long)bufstart, (long)G.cur_zipfile_bufstart));
-+ if (request < 0) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarStringSmall(SeekMsg),
-+ G.zipfn, LoadFarString(ReportMsg)));
-+ error_in_archive = PK_ERR;
-+ if (*pfilnum == 1 && G.extra_bytes != 0L) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(AttemptRecompensate)));
-+ *pold_extra_bytes = G.extra_bytes;
-+ G.extra_bytes = 0L;
-+ request = G.pInfo->offset; /* could also check if != 0 */
-+ inbuf_offset = request % INBUFSIZ;
-+ bufstart = request - inbuf_offset;
-+ Trace((stderr, "debug: request = %ld, inbuf_offset = %ld\n",
-+ (long)request, (long)inbuf_offset));
-+ Trace((stderr,
-+ "debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n",
-+ (long)bufstart, (long)G.cur_zipfile_bufstart));
-+ /* try again */
-+ if (request < 0) {
-+ Trace((stderr,
-+ "debug: recompensated request still < 0\n"));
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarStringSmall(SeekMsg),
-+ G.zipfn, LoadFarString(ReportMsg)));
-+ error_in_archive = PK_BADERR;
-+ continue;
-+ }
-+ } else {
-+ error_in_archive = PK_BADERR;
-+ continue; /* this one hosed; try next */
-+ }
-+ }
-+
-+ if (bufstart != G.cur_zipfile_bufstart) {
-+ Trace((stderr, "debug: bufstart != cur_zipfile_bufstart\n"));
-+#ifdef USE_STRM_INPUT
-+ zfseeko(G.zipfd, bufstart, SEEK_SET);
-+ G.cur_zipfile_bufstart = zftello(G.zipfd);
-+#else /* !USE_STRM_INPUT */
-+ G.cur_zipfile_bufstart =
-+ zlseek(G.zipfd, bufstart, SEEK_SET);
-+#endif /* ?USE_STRM_INPUT */
-+ if ((G.incnt = read(G.zipfd, (char *)G.inbuf, INBUFSIZ)) <= 0)
-+ {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg),
-+ *pfilnum, "lseek", (long)bufstart));
-+ error_in_archive = PK_BADERR;
-+ continue; /* can still do next file */
-+ }
-+ G.inptr = G.inbuf + (int)inbuf_offset;
-+ G.incnt -= (int)inbuf_offset;
-+ } else {
-+ G.incnt += (int)(G.inptr-G.inbuf) - (int)inbuf_offset;
-+ G.inptr = G.inbuf + (int)inbuf_offset;
-+ }
-+
-+ /* should be in proper position now, so check for sig */
-+ if (readbuf(__G__ G.sig, 4) == 0) { /* bad offset */
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg),
-+ *pfilnum, "EOF", (long)request));
-+ error_in_archive = PK_BADERR;
-+ continue; /* but can still try next one */
-+ }
-+ if (strncmp(G.sig, local_hdr_sig, 4)) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg),
-+ *pfilnum, LoadFarStringSmall(LocalHdrSig), (long)request));
-+ /*
-+ GRRDUMP(G.sig, 4)
-+ GRRDUMP(local_hdr_sig, 4)
-+ */
-+ error_in_archive = PK_ERR;
-+ if ((*pfilnum == 1 && G.extra_bytes != 0L) ||
-+ (G.extra_bytes == 0L && *pold_extra_bytes != 0L)) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(AttemptRecompensate)));
-+ if (G.extra_bytes) {
-+ *pold_extra_bytes = G.extra_bytes;
-+ G.extra_bytes = 0L;
-+ } else
-+ G.extra_bytes = *pold_extra_bytes; /* third attempt */
-+ if (((error = seek_zipf(__G__ G.pInfo->offset)) != PK_OK) ||
-+ (readbuf(__G__ G.sig, 4) == 0)) { /* bad offset */
-+ if (error != PK_BADERR)
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(OffsetMsg), *pfilnum, "EOF",
-+ (long)request));
-+ error_in_archive = PK_BADERR;
-+ continue; /* but can still try next one */
-+ }
-+ if (strncmp(G.sig, local_hdr_sig, 4)) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(OffsetMsg), *pfilnum,
-+ LoadFarStringSmall(LocalHdrSig), (long)request));
-+ error_in_archive = PK_BADERR;
-+ continue;
-+ }
-+ } else
-+ continue; /* this one hosed; try next */
-+ }
-+ if ((error = process_local_file_hdr(__G)) != PK_COOL) {
-+ Info(slide, 0x421, ((char *)slide, LoadFarString(BadLocalHdr),
-+ *pfilnum));
-+ 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 > error_in_archive)
-+ error_in_archive = error;
-+ if (error > PK_WARN) {
-+ Info(slide, 0x401, ((char *)slide, LoadFarString(FilNamMsg),
-+ FnFilter1(G.filename), "local"));
-+ continue; /* go on to next one */
-+ }
-+ }
-+ if (G.extra_field != (uch *)NULL) {
-+ free(G.extra_field);
-+ G.extra_field = (uch *)NULL;
-+ }
-+ if ((error =
-+ do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != 0)
-+ {
-+ if (error > error_in_archive)
-+ error_in_archive = error;
-+ if (error > PK_WARN) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(ExtFieldMsg),
-+ FnFilter1(G.filename), "local"));
-+ continue; /* go on */
-+ }
-+ }
-+#ifndef SFX
-+ /* Filename consistency checks must come after reading in the local
-+ * extra field, so that a UTF-8 entry name e.f. block has already
-+ * been processed.
-+ */
-+ if (G.pInfo->cfilname != (char Far *)NULL) {
-+ if (zfstrcmp(G.pInfo->cfilname, G.filename) != 0) {
-+# ifdef SMALL_MEM
-+ char *temp_cfilnam = slide + (7 * (WSIZE>>3));
-+
-+ zfstrcpy((char Far *)temp_cfilnam, G.pInfo->cfilname);
-+# define cFile_PrintBuf temp_cfilnam
-+# else
-+# define cFile_PrintBuf G.pInfo->cfilname
-+# endif
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarStringSmall2(LvsCFNamMsg),
-+ FnFilter2(cFile_PrintBuf), FnFilter1(G.filename)));
-+# undef cFile_PrintBuf
-+ zfstrcpy(G.filename, G.pInfo->cfilname);
-+ if (error_in_archive < PK_WARN)
-+ error_in_archive = PK_WARN;
-+ }
-+ zffree(G.pInfo->cfilname);
-+ G.pInfo->cfilname = (char Far *)NULL;
-+ }
-+#endif /* !SFX */
-+ /* Size consistency checks must come after reading in the local extra
-+ * field, so that any Zip64 extension local e.f. block has already
-+ * been processed.
-+ */
-+ if (G.lrec.compression_method == STORED) {
-+ zusz_t csiz_decrypted = G.lrec.csize;
-+
-+ if (G.pInfo->encrypted)
-+ csiz_decrypted -= 12;
-+ if (G.lrec.ucsize != csiz_decrypted) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarStringSmall2(WrnStorUCSizCSizDiff),
-+ FnFilter1(G.filename),
-+ FmZofft(G.lrec.ucsize, NULL, "u"),
-+ FmZofft(csiz_decrypted, NULL, "u")));
-+ G.lrec.ucsize = csiz_decrypted;
-+ if (error_in_archive < PK_WARN)
-+ error_in_archive = PK_WARN;
-+ }
-+ }
-+
-+#if CRYPT
-+ if (G.pInfo->encrypted &&
-+ (error = decrypt(__G__ uO.pwdarg)) != PK_COOL) {
-+ if (error == PK_WARN) {
-+ if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)))
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(SkipIncorrectPasswd),
-+ FnFilter1(G.filename)));
-+ ++(*pnum_bad_pwd);
-+ } else { /* (error > PK_WARN) */
-+ if (error > error_in_archive)
-+ error_in_archive = error;
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(SkipCannotGetPasswd),
-+ FnFilter1(G.filename)));
-+ }
-+ continue; /* go on to next file */
-+ }
-+#endif /* CRYPT */
-+
-+ /*
-+ * just about to extract file: if extracting to disk, check if
-+ * already exists, and if so, take appropriate action according to
-+ * fflag/uflag/overwrite_all/etc. (we couldn't do this in upper
-+ * loop because we don't store the possibly renamed filename[] in
-+ * info[])
-+ */
-+#ifdef DLL
-+ if (!uO.tflag && !uO.cflag && !G.redirect_data)
-+#else
-+ if (!uO.tflag && !uO.cflag)
-+#endif
-+ {
-+ renamed = FALSE; /* user hasn't renamed output file yet */
-+
-+startover:
-+ query = FALSE;
-+ skip_entry = SKIP_NO;
-+ /* for files from DOS FAT, check for use of backslash instead
-+ * of slash as directory separator (bug in some zipper(s); so
-+ * far, not a problem in HPFS, NTFS or VFAT systems)
-+ */
-+#ifndef SFX
-+ if (G.pInfo->hostnum == FS_FAT_ && !MBSCHR(G.filename, '/')) {
-+ char *p=G.filename;
-+
-+ if (*p) do {
-+ if (*p == '\\') {
-+ if (!G.reported_backslash) {
-+ Info(slide, 0x21, ((char *)slide,
-+ LoadFarString(BackslashPathSep), G.zipfn));
-+ G.reported_backslash = TRUE;
-+ if (!error_in_archive)
-+ error_in_archive = PK_WARN;
-+ }
-+ *p = '/';
-+ }
-+ } while (*PREINCSTR(p));
-+ }
-+#endif /* !SFX */
-+
-+ if (!renamed) {
-+ /* remove absolute path specs */
-+ if (G.filename[0] == '/') {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(AbsolutePathWarning),
-+ FnFilter1(G.filename)));
-+ if (!error_in_archive)
-+ error_in_archive = PK_WARN;
-+ do {
-+ char *p = G.filename + 1;
-+ do {
-+ *(p-1) = *p;
-+ } while (*p++ != '\0');
-+ } while (G.filename[0] == '/');
-+ }
-+ }
-+
-+ /* mapname can create dirs if not freshening or if renamed */
-+ error = mapname(__G__ renamed);
-+ if ((errcode = error & ~MPN_MASK) != PK_OK &&
-+ error_in_archive < errcode)
-+ error_in_archive = errcode;
-+ if ((errcode = error & MPN_MASK) > MPN_INF_TRUNC) {
-+ if (errcode == MPN_CREATED_DIR) {
-+#ifdef SET_DIR_ATTRIB
-+ direntry *d_entry;
-+
-+ error = defer_dir_attribs(__G__ &d_entry);
-+ if (d_entry == (direntry *)NULL) {
-+ /* There may be no dir_attribs info available, or
-+ * we have encountered a mem allocation error.
-+ * In case of an error, report it and set program
-+ * error state to warning level.
-+ */
-+ if (error) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(DirlistEntryNoMem)));
-+ if (!error_in_archive)
-+ error_in_archive = PK_WARN;
-+ }
-+ } else {
-+ d_entry->next = (*pdirlist);
-+ (*pdirlist) = d_entry;
-+ ++(*pnum_dirs);
-+ }
-+#endif /* SET_DIR_ATTRIB */
-+ } else if (errcode == MPN_VOL_LABEL) {
-+#ifdef DOS_OS2_W32
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(SkipVolumeLabel),
-+ FnFilter1(G.filename),
-+ uO.volflag? "hard disk " : ""));
-+#else
-+ Info(slide, 1, ((char *)slide,
-+ LoadFarString(SkipVolumeLabel),
-+ FnFilter1(G.filename), ""));
-+#endif
-+ } else if (errcode > MPN_INF_SKIP &&
-+ error_in_archive < PK_ERR)
-+ error_in_archive = PK_ERR;
-+ Trace((stderr, "mapname(%s) returns error code = %d\n",
-+ FnFilter1(G.filename), error));
-+ continue; /* go on to next file */
-+ }
-+
-+#ifdef QDOS
-+ QFilename(__G__ G.filename);
-+#endif
-+ switch (check_for_newer(__G__ G.filename)) {
-+ case DOES_NOT_EXIST:
-+#ifdef NOVELL_BUG_FAILSAFE
-+ G.dne = TRUE; /* stat() says file DOES NOT EXIST */
-+#endif
-+ /* freshen (no new files): skip unless just renamed */
-+ if (uO.fflag && !renamed)
-+ skip_entry = SKIP_Y_NONEXIST;
-+ break;
-+ case EXISTS_AND_OLDER:
-+#ifdef UNIXBACKUP
-+ if (!uO.B_flag)
-+#endif
-+ {
-+ if (IS_OVERWRT_NONE)
-+ /* never overwrite: skip file */
-+ skip_entry = SKIP_Y_EXISTING;
-+ else if (!IS_OVERWRT_ALL)
-+ query = TRUE;
-+ }
-+ break;
-+ case EXISTS_AND_NEWER: /* (or equal) */
-+#ifdef UNIXBACKUP
-+ if ((!uO.B_flag && IS_OVERWRT_NONE) ||
-+#else
-+ if (IS_OVERWRT_NONE ||
-+#endif
-+ (uO.uflag && !renamed)) {
-+ /* skip if update/freshen & orig name */
-+ skip_entry = SKIP_Y_EXISTING;
-+ } else {
-+#ifdef UNIXBACKUP
-+ if (!IS_OVERWRT_ALL && !uO.B_flag)
-+#else
-+ if (!IS_OVERWRT_ALL)
-+#endif
-+ query = TRUE;
-+ }
-+ break;
-+ }
-+ if (query) {
-+#ifdef WINDLL
-+ switch (G.lpUserFunctions->replace != NULL ?
-+ (*G.lpUserFunctions->replace)(G.filename) :
-+ IDM_REPLACE_NONE) {
-+ case IDM_REPLACE_RENAME:
-+ _ISO_INTERN(G.filename);
-+ renamed = TRUE;
-+ goto startover;
-+ case IDM_REPLACE_ALL:
-+ G.overwrite_mode = OVERWRT_ALWAYS;
-+ /* FALL THROUGH, extract */
-+ case IDM_REPLACE_YES:
-+ break;
-+ case IDM_REPLACE_NONE:
-+ G.overwrite_mode = OVERWRT_NEVER;
-+ /* FALL THROUGH, skip */
-+ case IDM_REPLACE_NO:
-+ skip_entry = SKIP_Y_EXISTING;
-+ break;
-+ }
-+#else /* !WINDLL */
-+ extent fnlen;
-+reprompt:
-+ Info(slide, 0x81, ((char *)slide,
-+ LoadFarString(ReplaceQuery),
-+ FnFilter1(G.filename)));
-+ if (fgets(G.answerbuf, 9, stdin) == (char *)NULL) {
-+ Info(slide, 1, ((char *)slide,
-+ LoadFarString(AssumeNone)));
-+ *G.answerbuf = 'N';
-+ if (!error_in_archive)
-+ error_in_archive = 1; /* not extracted: warning */
-+ }
-+ switch (*G.answerbuf) {
-+ case 'r':
-+ case 'R':
-+ do {
-+ Info(slide, 0x81, ((char *)slide,
-+ LoadFarString(NewNameQuery)));
-+ fgets(G.filename, FILNAMSIZ, stdin);
-+ /* usually get \n here: better check for it */
-+ fnlen = strlen(G.filename);
-+ if (lastchar(G.filename, fnlen) == '\n')
-+ G.filename[--fnlen] = '\0';
-+ } while (fnlen == 0);
-+#ifdef WIN32 /* WIN32 fgets( ... , stdin) returns OEM coded strings */
-+ _OEM_INTERN(G.filename);
-+#endif
-+ renamed = TRUE;
-+ goto startover; /* sorry for a goto */
-+ case 'A': /* dangerous option: force caps */
-+ G.overwrite_mode = OVERWRT_ALWAYS;
-+ /* FALL THROUGH, extract */
-+ case 'y':
-+ case 'Y':
-+ break;
-+ case 'N':
-+ G.overwrite_mode = OVERWRT_NEVER;
-+ /* FALL THROUGH, skip */
-+ case 'n':
-+ /* skip file */
-+ skip_entry = SKIP_Y_EXISTING;
-+ break;
-+ case '\n':
-+ case '\r':
-+ /* Improve echo of '\n' and/or '\r'
-+ (sizeof(G.answerbuf) == 10 (see globals.h), so
-+ there is enough space for the provided text...) */
-+ strcpy(G.answerbuf, "{ENTER}");
-+ /* fall through ... */
-+ default:
-+ Info(slide, 1, ((char *)slide,
-+ LoadFarString(InvalidResponse), *G.answerbuf));
-+ goto reprompt; /* yet another goto? */
-+ } /* end switch (*answerbuf) */
-+#endif /* ?WINDLL */
-+ } /* end if (query) */
-+ if (skip_entry != SKIP_NO) {
-+#ifdef WINDLL
-+ if (skip_entry == SKIP_Y_EXISTING) {
-+ /* report skipping of an existing entry */
-+ Info(slide, 0, ((char *)slide,
-+ ((IS_OVERWRT_NONE || !uO.uflag || renamed) ?
-+ "Target file exists.\nSkipping %s\n" :
-+ "Target file newer.\nSkipping %s\n"),
-+ FnFilter1(G.filename)));
-+ }
-+#endif /* WINDLL */
-+ continue;
-+ }
-+ } /* end if (extracting to disk) */
-+
-+#ifdef DLL
-+ if ((G.statreportcb != NULL) &&
-+ (*G.statreportcb)(__G__ UZ_ST_START_EXTRACT, G.zipfn,
-+ G.filename, NULL)) {
-+ return IZ_CTRLC; /* cancel operation by user request */
-+ }
- #endif
--
--#ifdef USE_PPMD
--# define UNKN_PPMD (G.crec.compression_method!=PPMDED)
--#else
--# define UNKN_PPMD TRUE /* PPMd unknown */
-+#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */
-+ UserStop();
- #endif
--
--#ifdef SFX
--# ifdef USE_DEFLATE64
--# define UNKN_COMPR \
-- (G.crec.compression_method!=STORED && G.crec.compression_method<DEFLATED \
-- && G.crec.compression_method>ENHDEFLATED \
-- && UNKN_BZ2 && UNKN_LZMA && UNKN_WAVP && UNKN_PPMD)
--# else
--# define UNKN_COMPR \
-- (G.crec.compression_method!=STORED && G.crec.compression_method!=DEFLATED\
-- && UNKN_BZ2 && UNKN_LZMA && UNKN_WAVP && UNKN_PPMD)
--# endif
--#else
--# ifdef COPYRIGHT_CLEAN /* no reduced files */
--# define UNKN_RED (G.crec.compression_method >= REDUCED1 && \
-- G.crec.compression_method <= REDUCED4)
--# else
--# define UNKN_RED FALSE /* reducing not unknown */
--# endif
--# ifdef LZW_CLEAN /* no shrunk files */
--# define UNKN_SHR (G.crec.compression_method == SHRUNK)
--# else
--# define UNKN_SHR FALSE /* unshrinking not unknown */
--# endif
--# ifdef USE_DEFLATE64
--# define UNKN_COMPR (UNKN_RED || UNKN_SHR || \
-- G.crec.compression_method==TOKENIZED || \
-- (G.crec.compression_method>ENHDEFLATED && UNKN_BZ2 && UNKN_LZMA \
-- && UNKN_WAVP && UNKN_PPMD))
--# else
--# define UNKN_COMPR (UNKN_RED || UNKN_SHR || \
-- G.crec.compression_method==TOKENIZED || \
-- (G.crec.compression_method>DEFLATED && UNKN_BZ2 && UNKN_LZMA \
-- && UNKN_WAVP && UNKN_PPMD))
--# endif
-+#ifdef AMIGA
-+ G.filenote_slot = i;
- #endif
--
--#if (defined(USE_BZIP2) && (UNZIP_VERSION < UNZIP_BZ2VERS))
-- int unzvers_support = (UNKN_BZ2 ? UNZIP_VERSION : UNZIP_BZ2VERS);
--# define UNZVERS_SUPPORT unzvers_support
-+ G.disk_full = 0;
-+ if ((error = extract_or_test_member(__G)) != PK_COOL) {
-+ if (error > error_in_archive)
-+ error_in_archive = error; /* ...and keep going */
-+#ifdef DLL
-+ if (G.disk_full > 1 || error_in_archive == IZ_CTRLC) {
- #else
--# define UNZVERS_SUPPORT UNZIP_VERSION
-+ if (G.disk_full > 1) {
- #endif
--
--/*---------------------------------------------------------------------------
-- Check central directory info for version/compatibility requirements.
-- ---------------------------------------------------------------------------*/
--
-- G.pInfo->encrypted = G.crec.general_purpose_bit_flag & 1; /* bit field */
-- G.pInfo->ExtLocHdr = (G.crec.general_purpose_bit_flag & 8) == 8; /* bit */
-- G.pInfo->textfile = G.crec.internal_file_attributes & 1; /* bit field */
-- G.pInfo->crc = G.crec.crc32;
-- G.pInfo->compr_size = G.crec.csize;
-- G.pInfo->uncompr_size = G.crec.ucsize;
--
-- switch (uO.aflag) {
-- case 0:
-- G.pInfo->textmode = FALSE; /* bit field */
-- break;
-- case 1:
-- G.pInfo->textmode = G.pInfo->textfile; /* auto-convert mode */
-- break;
-- default: /* case 2: */
-- G.pInfo->textmode = TRUE;
-- break;
-- }
--
-- 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),
-- FnFilter1(G.filename), "VMS",
-- G.crec.version_needed_to_extract[0] / 10,
-- G.crec.version_needed_to_extract[0] % 10,
-- VMS_UNZIP_VERSION / 10, VMS_UNZIP_VERSION % 10));
-- return 0;
-+ return error_in_archive; /* (unless disk full) */
-+ }
- }
--#ifndef VMS /* won't be able to use extra field, but still have data */
-- else if (!uO.tflag && !IS_OVERWRT_ALL) { /* if -o, extract anyway */
-- Info(slide, 0x481, ((char *)slide, LoadFarString(VMSFormatQuery),
-- FnFilter1(G.filename)));
-- fgets(G.answerbuf, 9, stdin);
-- if ((*G.answerbuf != 'y') && (*G.answerbuf != 'Y'))
-- return 0;
-+#ifdef DLL
-+ if ((G.statreportcb != NULL) &&
-+ (*G.statreportcb)(__G__ UZ_ST_FINISH_MEMBER, G.zipfn,
-+ G.filename, (zvoid *)&G.lrec.ucsize)) {
-+ return IZ_CTRLC; /* cancel operation by user request */
- }
--#endif /* !VMS */
-- /* usual file type: don't need VMS to extract */
-- } else if (G.crec.version_needed_to_extract[0] > UNZVERS_SUPPORT) {
-- 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));
-- return 0;
-- }
--
-- if (UNKN_COMPR) {
-- if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) {
--#ifndef SFX
-- unsigned cmpridx;
--
-- if ((cmpridx = find_compr_idx(G.crec.compression_method))
-- < 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));
-- }
-- return 0;
-- }
--#if (!CRYPT)
-- if (G.pInfo->encrypted) {
-- if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)))
-- Info(slide, 0x401, ((char *)slide, LoadFarString(SkipEncrypted),
-- FnFilter1(G.filename)));
-- return 0;
-- }
--#endif /* !CRYPT */
--
--#ifndef SFX
-- /* store a copy of the central header filename for later comparison */
-- if ((G.pInfo->cfilname = zfmalloc(strlen(G.filename) + 1)) == NULL) {
-- Info(slide, 0x401, ((char *)slide, LoadFarString(WarnNoMemCFName),
-- FnFilter1(G.filename)));
-- } else
-- zfstrcpy(G.pInfo->cfilname, G.filename);
--#endif /* !SFX */
--
-- /* map whatever file attributes we have into the local format */
-- mapattr(__G); /* GRR: worry about return value later */
--
-- G.pInfo->diskstart = G.crec.disk_number_start;
-- G.pInfo->offset = (zoff_t)G.crec.relative_offset_local_header;
-- return 1;
--
--} /* end function store_info() */
--
--
--
--
--
--#ifndef SFX
--/*******************************/
--/* Function find_compr_idx() */
--/*******************************/
--
--unsigned find_compr_idx(compr_methodnum)
-- unsigned compr_methodnum;
--{
-- unsigned i;
--
-- for (i = 0; i < NUM_METHODS; i++) {
-- if (ComprIDs[i] == compr_methodnum) break;
-- }
-- return i;
--}
--#endif /* !SFX */
-+#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */
-+ UserStop();
-+#endif
-+ } /* end for-loop (i: files in current block) */
-
-+ return error_in_archive;
-
-+} /* end function extract_or_test_entrylist() */
-
-
-
--/******************************************/
--/* Function extract_or_test_entrylist() */
--/******************************************/
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-
--static int extract_or_test_entrylist(__G__ numchunk,
-+static int extract_or_test_entrylistw(__G__ numchunk,
- pfilnum, pnum_bad_pwd, pold_extra_bytes,
- #ifdef SET_DIR_ATTRIB
-- pnum_dirs, pdirlist,
-+ pnum_dirs, pdirlistw,
- #endif
- error_in_archive) /* return PK-type error code */
-@@ -1016,5 +1653,5 @@
- #ifdef SET_DIR_ATTRIB
- unsigned *pnum_dirs;
-- direntry **pdirlist;
-+ direntryw **pdirlistw;
- #endif
- int error_in_archive;
-@@ -1190,8 +1827,4 @@
- }
- #ifndef SFX
-- /* Filename consistency checks must come after reading in the local
-- * extra field, so that a UTF-8 entry name e.f. block has already
-- * been processed.
-- */
- if (G.pInfo->cfilname != (char Far *)NULL) {
- if (zfstrcmp(G.pInfo->cfilname, G.filename) != 0) {
-@@ -1316,5 +1949,8 @@
-
- /* mapname can create dirs if not freshening or if renamed */
-- error = mapname(__G__ renamed);
-+ if (G.has_win32_wide)
-+ error = mapnamew(__G__ renamed);
-+ else
-+ error = mapname(__G__ renamed);
- if ((errcode = error & ~MPN_MASK) != PK_OK &&
- error_in_archive < errcode)
-@@ -1323,24 +1959,24 @@
- if (errcode == MPN_CREATED_DIR) {
- #ifdef SET_DIR_ATTRIB
-- direntry *d_entry;
-+ direntryw *d_entryw;
-
-- error = defer_dir_attribs(__G__ &d_entry);
-- if (d_entry == (direntry *)NULL) {
-- /* There may be no dir_attribs info available, or
-- * we have encountered a mem allocation error.
-- * In case of an error, report it and set program
-- * error state to warning level.
-- */
-- if (error) {
-- Info(slide, 0x401, ((char *)slide,
-- LoadFarString(DirlistEntryNoMem)));
-- if (!error_in_archive)
-- error_in_archive = PK_WARN;
-- }
-- } else {
-- d_entry->next = (*pdirlist);
-- (*pdirlist) = d_entry;
-- ++(*pnum_dirs);
-- }
-+ error = defer_dir_attribsw(__G__ &d_entryw);
-+ if (d_entryw == (direntryw *)NULL) {
-+ /* There may be no dir_attribs info available, or
-+ * we have encountered a mem allocation error.
-+ * In case of an error, report it and set program
-+ * error state to warning level.
-+ */
-+ if (error) {
-+ Info(slide, 0x401, ((char *)slide,
-+ LoadFarString(DirlistEntryNoMem)));
-+ if (!error_in_archive)
-+ error_in_archive = PK_WARN;
-+ }
-+ } else {
-+ d_entryw->next = (*pdirlistw);
-+ (*pdirlistw) = d_entryw;
-+ ++(*pnum_dirs);
-+ }
- #endif /* SET_DIR_ATTRIB */
- } else if (errcode == MPN_VOL_LABEL) {
-@@ -1366,5 +2002,5 @@
- QFilename(__G__ G.filename);
- #endif
-- switch (check_for_newer(__G__ G.filename)) {
-+ switch (check_for_newerw(__G__ G.unipath_widefilename)) {
- case DOES_NOT_EXIST:
- #ifdef NOVELL_BUG_FAILSAFE
-@@ -1538,5 +2174,7 @@
- return error_in_archive;
-
--} /* end function extract_or_test_entrylist() */
-+} /* end function extract_or_test_entrylistw() */
-+
-+#endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-
-
-@@ -2565,4 +3203,14 @@
- /* return namecmp((*(direntry **)b)->fn, (*(direntry **)a)->fn); */
- }
-+
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static int Cdecl dircompw(a, b) /* used by qsort(); swiped from Zip */
-+ ZCONST zvoid *a, *b;
-+{
-+ /* order is significant: this sorts in reverse order (deepest first) */
-+ return wcscmp((*(direntryw **)b)->fnw, (*(direntryw **)a)->fnw);
-+ /* return namecmp((*(direntry **)b)->fn, (*(direntry **)a)->fn); */
-+}
-+# endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-
- #endif /* SET_DIR_ATTRIB */
-diff -ru2 unz60d10/fileio.c unz60d10_w32w/fileio.c
---- unz60d10/fileio.c Sun Jan 27 16:39:14 2008
-+++ unz60d10_w32w/fileio.c Mon Feb 11 01:09:22 2008
-@@ -294,5 +294,12 @@
- zlstat(G.filename, &G.statbuf) == 0)
- #else
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ if ((G.has_win32_wide
-+ ? SSTATW(G.unipath_widefilename, &G.statbuf)
-+ : SSTAT(G.filename, &G.statbuf)
-+ ) == 0)
-+#else
- if (SSTAT(G.filename, &G.statbuf) == 0)
-+#endif
- #endif /* ?SYMLINKS */
- {
-@@ -378,5 +385,13 @@
- chmod(G.filename, 0);
- #endif /* NLM */
-- if (unlink(G.filename) != 0) {
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ if ((G.has_win32_wide
-+ ? _wunlink(G.unipath_widefilename)
-+ : unlink(G.filename)
-+ ) != 0)
-+#else
-+ if (unlink(G.filename) != 0)
-+#endif
-+ {
- Info(slide, 0x401, ((char *)slide,
- LoadFarString(CannotDeleteOldFile), FnFilter1(G.filename)));
-@@ -456,5 +471,12 @@
- G.outfile = zfopen(G.filename, FOPWR);
- #else
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ G.outfile = (G.has_win32_wide
-+ ? zfopenw(G.unipath_widefilename, L"wb")
-+ : zfopen(G.filename, FOPW)
-+ );
-+#else /* (UNICODE_SUPPORT && WIN32_WIDE) */
- G.outfile = zfopen(G.filename, FOPW);
-+#endif /* ?(UNICODE_SUPPORT && WIN32_WIDE) */
- #endif
- #if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
-@@ -1984,4 +2006,115 @@
- } /* end function check_for_newer() */
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+int check_for_newerw(__G__ filenamew) /* return 1 if existing file is newer */
-+ __GDEF /* or equal; 0 if older; -1 if doesn't */
-+ wchar_t *filenamew; /* exist yet */
-+{
-+ time_t existing, archive;
-+#ifdef USE_EF_UT_TIME
-+ iztimes z_utime;
-+#endif
-+#ifdef AOS_VS
-+ long dyy, dmm, ddd, dhh, dmin, dss;
-+
-+
-+ dyy = (lrec.last_mod_dos_datetime >> 25) + 1980;
-+ dmm = (lrec.last_mod_dos_datetime >> 21) & 0x0f;
-+ ddd = (lrec.last_mod_dos_datetime >> 16) & 0x1f;
-+ dhh = (lrec.last_mod_dos_datetime >> 11) & 0x1f;
-+ dmin = (lrec.last_mod_dos_datetime >> 5) & 0x3f;
-+ dss = (lrec.last_mod_dos_datetime & 0x1f) * 2;
-+
-+ /* under AOS/VS, file times can only be set at creation time,
-+ * with the info in a special DG format. Make sure we can create
-+ * it here - we delete it later & re-create it, whether or not
-+ * it exists now.
-+ */
-+ if (!zvs_create(filenamew, (((ulg)dgdate(dmm, ddd, dyy)) << 16) |
-+ (dhh*1800L + dmin*30L + dss/2L), -1L, -1L, (char *) -1, -1, -1, -1))
-+ return DOES_NOT_EXIST;
-+#endif /* AOS_VS */
-+
-+ Trace((stderr, "check_for_newer: doing stat(%s)\n", FnFilter1(filename)));
-+ if (SSTATW(filenamew, &G.statbuf)) {
-+ Trace((stderr,
-+ "check_for_newer: stat(%s) returns %d: file does not exist\n",
-+ FnFilter1(filename), SSTAT(filename, &G.statbuf)));
-+#ifdef SYMLINKS
-+ Trace((stderr, "check_for_newer: doing lstat(%s)\n",
-+ FnFilter1(filename)));
-+ /* GRR OPTION: could instead do this test ONLY if G.symlnk is true */
-+ if (zlstat(filename, &G.statbuf) == 0) {
-+ Trace((stderr,
-+ "check_for_newer: lstat(%s) returns 0: symlink does exist\n",
-+ FnFilter1(filename)));
-+ if (QCOND2 && !IS_OVERWRT_ALL)
-+ Info(slide, 0, ((char *)slide, LoadFarString(FileIsSymLink),
-+ FnFilter1(filename), " with no real file"));
-+ return EXISTS_AND_OLDER; /* symlink dates are meaningless */
-+ }
-+#endif /* SYMLINKS */
-+ return DOES_NOT_EXIST;
-+ }
-+ Trace((stderr, "check_for_newer: stat(%s) returns 0: file exists\n",
-+ FnFilter1(filename)));
-+
-+#ifdef SYMLINKS
-+ /* GRR OPTION: could instead do this test ONLY if G.symlnk is true */
-+ if (zlstat(filename, &G.statbuf) == 0 && S_ISLNK(G.statbuf.st_mode)) {
-+ Trace((stderr, "check_for_newer: %s is a symbolic link\n",
-+ FnFilter1(filename)));
-+ if (QCOND2 && !IS_OVERWRT_ALL)
-+ Info(slide, 0, ((char *)slide, LoadFarString(FileIsSymLink),
-+ FnFilter1(filename), ""));
-+ return EXISTS_AND_OLDER; /* symlink dates are meaningless */
-+ }
-+#endif /* SYMLINKS */
-+
-+ NATIVE_TO_TIMET(G.statbuf.st_mtime) /* NOP unless MSC 7.0 or Macintosh */
-+
-+#ifdef USE_EF_UT_TIME
-+ /* The `Unix extra field mtime' should be used for comparison with the
-+ * time stamp of the existing file >>>ONLY<<< when the EF info is also
-+ * used to set the modification time of the extracted file.
-+ */
-+ if (G.extra_field &&
-+#ifdef IZ_CHECK_TZ
-+ G.tz_is_valid &&
-+#endif
-+ (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
-+ G.lrec.last_mod_dos_datetime, &z_utime, NULL)
-+ & EB_UT_FL_MTIME))
-+ {
-+ TTrace((stderr, "check_for_newer: using Unix extra field mtime\n"));
-+ existing = G.statbuf.st_mtime;
-+ archive = z_utime.mtime;
-+ } else {
-+ /* round up existing filetime to nearest 2 seconds for comparison,
-+ * but saturate in case of arithmetic overflow
-+ */
-+ existing = ((G.statbuf.st_mtime & 1) &&
-+ (G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ?
-+ G.statbuf.st_mtime + 1 : G.statbuf.st_mtime;
-+ archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
-+ }
-+#else /* !USE_EF_UT_TIME */
-+ /* round up existing filetime to nearest 2 seconds for comparison,
-+ * but saturate in case of arithmetic overflow
-+ */
-+ existing = ((G.statbuf.st_mtime & 1) &&
-+ (G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ?
-+ G.statbuf.st_mtime + 1 : G.statbuf.st_mtime;
-+ archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
-+#endif /* ?USE_EF_UT_TIME */
-+
-+ TTrace((stderr, "check_for_newer: existing %lu, archive %lu, e-a %ld\n",
-+ (ulg)existing, (ulg)archive, (long)(existing-archive)));
-+
-+ return (existing >= archive);
-+
-+} /* end function check_for_newerw() */
-+#endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-+
- #endif /* !VMS && !OS2 && !CMS_MVS */
-
-@@ -2319,4 +2452,23 @@
- free(fn);
- }
-+# ifdef WIN32_WIDE
-+ G.unipath_widefilename = NULL;
-+ if (G.has_win32_wide) {
-+ if (G.unipath_filename)
-+ /* Get wide path from UTF-8 */
-+ G.unipath_widefilename = utf8_to_wchar_string(G.unipath_filename);
-+ else
-+ G.unipath_widefilename = utf8_to_wchar_string(G.filename);
-+
-+ if (G.pInfo->lcflag) /* replace with lowercase filename */
-+ wcslwr(G.unipath_widefilename);
-+
-+ if (G.pInfo->vollabel && length > 8 && G.unipath_widefilename[8] == '.') {
-+ wchar_t *p = G.unipath_widefilename+8;
-+ while (*p++)
-+ p[-1] = *p; /* disk label, and 8th char is dot: remove dot */
-+ }
-+ }
-+# endif /* WIN32_WIDE */
- }
- #endif /* UNICODE_SUPPORT */
-diff -ru2 unz60d10/globals.h unz60d10_w32w/globals.h
---- unz60d10/globals.h Sun Jan 27 16:31:56 2008
-+++ unz60d10_w32w/globals.h Mon Feb 11 01:09:22 2008
-@@ -302,4 +302,8 @@
- ulg unipath_checksum; /* Unicode field checksum */
- char *unipath_filename; /* UTF-8 path */
-+# ifdef WIN32_WIDE
-+ wchar_t *unipath_widefilename; /* wide character filename */
-+ int has_win32_wide; /* true if Win32 W calls work */
-+# endif
- char *unipath_escapedfilename;
- #endif /* UNICODE_SUPPORT */
-diff -ru2 unz60d10/match.c unz60d10_w32w/match.c
---- unz60d10/match.c Sun Aug 14 20:00:36 2005
-+++ unz60d10_w32w/match.c Sun Jan 6 18:19:46 2008
-@@ -1,4 +1,4 @@
- /*
-- Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
-+ Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
-
- See the accompanying file LICENSE, version 2000-Apr-09 or later
-@@ -407,5 +407,18 @@
- } /* end function iswild() */
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+int iswildw(pw) /* originally only used for stat()-bug workaround in */
-+ ZCONST wchar_t *pw; /* VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */
-+{ /* now used in process_zipfiles() as well */
-+ for (; *pw; pw++)
-+ if (*pw == '\\' && *(pw+1))
-+ ++pw;
-+ else if (*pw == '?' || *pw == '*' || *pw == '[')
-+ return TRUE;
-+
-+ return FALSE;
-
-+} /* end function iswildw() */
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-
-
-diff -ru2 unz60d10/process.c unz60d10_w32w/process.c
---- unz60d10/process.c Sun Feb 3 00:03:34 2008
-+++ unz60d10_w32w/process.c Mon Feb 11 01:09:22 2008
-@@ -43,4 +43,7 @@
- # include "crc32.h"
- #endif
-+#ifdef UNICODE_SUPPORT
-+# include <wchar.h>
-+#endif /* def UNICODE_SUPPORT */
-
- static int do_seekable OF((__GPRO__ int lastchance));
-@@ -552,5 +555,12 @@
-
- inflate_free(__G);
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ if (G.has_win32_wide)
-+ checkdirw(__G__ (wchar_t *)NULL, END);
-+ else
-+ checkdir(__G__ (char *)NULL, END);
-+#else
- checkdir(__G__ (char *)NULL, END);
-+#endif
-
- #ifdef DYNALLOC_CRCTAB
-@@ -1507,26 +1517,4 @@
- */
-
-- /* This is an internal comment. Remove before the next public beta.
--
-- Below check does not catch when an entry requires Zip64, as
-- when the uncompressed size is larger than 4 GB, but the
-- standard fields in ecrec (called EOCDR in the Zip source)
-- are sufficient, as when the file compresses under the Zip64
-- limit. In such cases ecrec64 (called Zip64 EOCDR in Zip)
-- will exist to flag the archive as Zip64, even though none
-- of the ecrec values are set to the FFFF or FFFFFFFF flag
-- values.
--
-- if(check_ecrec_zip64(__G)){
-- need_zip64 = TRUE;
-- }
--
-- In fact, this check is not needed, as ecrec64 will ALWAYS
-- exist for a proper Zip64 archive, as the Version Needed To Extract
-- field is required to be set to 4.5 or higher.
--
-- End of internal comment.
-- */
--
- /* The ecrec64 will ALWAYS exist for a proper Zip64 archive, as
- the Version Needed To Extract field is required to be set to
-@@ -1954,7 +1942,4 @@
- G.unipath_filename[ULen] = '\0';
- }
--# if 0
-- G.unipath_escapedfilename = utf8_to_escaped_string(G.unipath_filename);
--# endif
- }
-
-@@ -2324,4 +2309,37 @@
- return w;
- }
-+
-+char *wchar_to_local_string(wchar_string, escape_all)
-+ wchar_t *wchar_string;
-+ int escape_all;
-+{
-+ zwchar *wide_string = wchar_to_wide_string(wchar_string);
-+ char *local_string = wide_to_local_string(wide_string, escape_all);
-+
-+ free(wide_string);
-+
-+ return local_string;
-+}
-+
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+zwchar *wchar_to_wide_string(wchar_string)
-+ wchar_t *wchar_string;
-+{
-+ int i;
-+ int wchar_len;
-+ zwchar *wide_string;
-+
-+ wchar_len = wcslen(wchar_string);
-+
-+ if ((wide_string = malloc((wchar_len + 1) * sizeof(zwchar))) == NULL) {
-+ return NULL;
-+ }
-+ for (i = 0; i <= wchar_len; i++) {
-+ wide_string[i] = wchar_string[i];
-+ }
-+
-+ return wide_string;
-+}
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-
- char *utf8_to_escaped_string(utf8_string, escape_all)
-diff -ru2 unz60d10/unzpriv.h unz60d10_w32w/unzpriv.h
---- unz60d10/unzpriv.h Sun Feb 3 15:50:52 2008
-+++ unz60d10_w32w/unzpriv.h Mon Feb 11 02:05:46 2008
-@@ -1318,4 +1318,7 @@
- # define zstat _stati64
- # define zfstat _fstati64
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+# define zstatw _wstati64
-+# endif
-
- /* 64-bit lseek */
-@@ -1332,4 +1335,7 @@
- /* 64-bit fopen */
- # define zfopen fopen
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+# define zfopenw _wfopen
-+# endif
- # define zfdopen fdopen
-
-@@ -1904,4 +1910,11 @@
- char buf[1]; /* start of system-specific internal data */
- } direntry;
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ typedef struct direntryw { /* head of system-specific struct holding */
-+ struct direntryw *next; /* defered directory attributes info */
-+ wchar_t *fnw; /* filename of directory */
-+ wchar_t buf[1]; /* start of system-specific internal data */
-+ } direntryw;
-+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
- #endif /* SET_DIR_ATTRIB */
-
-@@ -2225,4 +2238,7 @@
- time_t dos_to_unix_time OF((ulg dos_datetime));
- int check_for_newer OF((__GPRO__ char *filename)); /* os2,vmcms,vms */
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+int check_for_newerw OF((__GPRO__ wchar_t *filenamew)); /* os2,vmcms,vms */
-+#endif
- int do_string OF((__GPRO__ unsigned int length, int option));
- ush makeword OF((ZCONST uch *b));
-@@ -2468,4 +2484,8 @@
- int zstat_win32 OF((__W32STAT_GLOBALS__
- const char *path, z_stat *buf)); /* win32.c */
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ int zstat_win32w OF((__W32STAT_GLOBALS__
-+ const wchar_t *pathw, z_stat *buf)); /* win32.c */
-+# endif
- #endif
- #endif
-@@ -2485,4 +2505,7 @@
- int ic __WDLPRO)); /* match.c */
- int iswild OF((ZCONST char *p)); /* match.c */
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+int iswildw OF((ZCONST wchar_t *pw)); /* match.c */
-+#endif
-
- /* declarations of public CRC-32 functions have been moved into crc32.h
-@@ -2497,4 +2520,8 @@
- int mapname OF((__GPRO__ int renamed)); /* local */
- int checkdir OF((__GPRO__ char *pathcomp, int flag)); /* local */
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ int mapnamew OF((__GPRO__ int renamed)); /* local */
-+ int checkdirw OF((__GPRO__ wchar_t *pathcomp, int flag)); /* local */
-+#endif
- char *do_wild OF((__GPRO__ ZCONST char *wildzipfn)); /* local */
- char *GetLoadPath OF((__GPRO)); /* local */
-@@ -2517,4 +2544,8 @@
- int defer_dir_attribs OF((__GPRO__ direntry **pd)); /* local */
- int set_direc_attribs OF((__GPRO__ direntry *d)); /* local */
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ int defer_dir_attribsw OF((__GPRO__ direntryw **pd)); /* local */
-+ int set_direc_attribsw OF((__GPRO__ direntryw *d)); /* local */
-+# endif
- #endif
- #ifdef TIMESTAMP
-@@ -2980,4 +3011,8 @@
- /* convert UTF-8 string to wide string */
- zwchar *utf8_to_wide_string OF((char *));
-+
-+ char *wchar_to_local_string OF((wchar_t *, int));
-+
-+ zwchar *wchar_to_wide_string OF((wchar_t *));
-
- /* convert wide string to multi-byte string */
-diff -ru2 unz60d10/win32/nt.c unz60d10_w32w/win32/nt.c
---- unz60d10/win32/nt.c Tue Dec 25 12:34:50 2007
-+++ unz60d10_w32w/win32/nt.c Mon Feb 11 02:09:20 2008
-@@ -1,6 +1,6 @@
- /*
-- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
-+ Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
-
-- See the accompanying file LICENSE, version 2000-Apr-09 or later
-+ See the accompanying file LICENSE, version 2007-Mar-04 or later
- (the contents of which are also included in unzip.h) for terms of use.
- If, for some reason, all these files are missing, the Info-ZIP license
-@@ -63,5 +63,10 @@
-
- static BOOL Initialize(VOID);
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static VOID GetRemotePrivilegesSet(wchar_t *FileName,
-+ PDWORD dwRemotePrivileges);
-+#else
- static VOID GetRemotePrivilegesSet(CHAR *FileName, PDWORD dwRemotePrivileges);
-+#endif
- static VOID InitLocalPrivileges(VOID);
-
-@@ -191,5 +196,10 @@
- }
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static VOID GetRemotePrivilegesSet(wchar_t *FileName,
-+ PDWORD dwRemotePrivileges)
-+#else
- static VOID GetRemotePrivilegesSet(char *FileName, PDWORD dwRemotePrivileges)
-+#endif
- {
- HANDLE hFile;
-@@ -199,5 +209,9 @@
- /* see if we have the SeRestorePrivilege */
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ hFile = CreateFileW(
-+#else
- hFile = CreateFileA(
-+#endif
- FileName,
- ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER | READ_CONTROL,
-@@ -236,5 +250,9 @@
- /* note we don't need this if we have SeRestorePrivilege */
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ hFile = CreateFileW(
-+#else
- hFile = CreateFileA(
-+#endif
- FileName,
- ACCESS_SYSTEM_SECURITY,
-@@ -255,10 +273,19 @@
-
- BOOL GetVolumeCaps(
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ wchar_t *rootpath, /* filepath, or NULL */
-+ wchar_t *name, /* filename associated with rootpath */
-+#else
- char *rootpath, /* filepath, or NULL */
- char *name, /* filename associated with rootpath */
-+#endif
- PVOLUMECAPS VolumeCaps /* result structure describing capabilities */
- )
- {
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ wchar_t TempRootPath[MAX_PATH + 1];
-+#else
- char TempRootPath[MAX_PATH + 1];
-+#endif
- DWORD cchTempRootPath = 0;
- BOOL bSuccess = TRUE; /* assume success until told otherwise */
-@@ -273,5 +300,9 @@
- DWORD i;
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ cchTempRootPath = lstrlenW(rootpath);
-+#else
- cchTempRootPath = lstrlenA(rootpath);
-+#endif
- if(cchTempRootPath > MAX_PATH) return FALSE;
-
-@@ -345,5 +376,9 @@
-
- if(!g_VolumeCaps.bValid ||
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ lstrcmpiW(g_VolumeCaps.RootPath, TempRootPath) != 0)
-+#else
- lstrcmpiA(g_VolumeCaps.RootPath, TempRootPath) != 0)
-+#endif
- {
-
-@@ -357,5 +392,9 @@
- LeaveCriticalSection( &VolumeCapsLock );
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ bSuccess = GetVolumeInformationW(
-+#else
- bSuccess = GetVolumeInformationA(
-+#endif
- (TempRootPath[0] == '\0') ? NULL : TempRootPath,
- NULL, 0,
-@@ -371,5 +410,9 @@
- VolumeCaps->bUsePrivileges)
- {
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ if(GetDriveTypeW( (TempRootPath[0] == '\0') ? NULL : TempRootPath )
-+#else
- if(GetDriveTypeA( (TempRootPath[0] == '\0') ? NULL : TempRootPath )
-+#endif
- == DRIVE_REMOTE)
- {
-@@ -388,5 +431,9 @@
- if(bSuccess) {
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ lstrcpynW(g_VolumeCaps.RootPath, TempRootPath, cchTempRootPath+1);
-+#else
- lstrcpynA(g_VolumeCaps.RootPath, TempRootPath, cchTempRootPath+1);
-+#endif
- g_VolumeCaps.dwFileSystemFlags = dwFileSystemFlags;
- g_VolumeCaps.bRemote = bRemote;
-@@ -413,5 +460,9 @@
-
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+BOOL SecuritySet(wchar_t *resource, PVOLUMECAPS VolumeCaps, uch *securitydata)
-+#else
- BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata)
-+#endif
- {
- HANDLE hFile;
-@@ -491,5 +542,9 @@
- dwFlags |= FILE_FLAG_BACKUP_SEMANTICS;
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ hFile = CreateFileW(
-+#else
- hFile = CreateFileA(
-+#endif
- resource,
- dwDesiredAccess,
-diff -ru2 unz60d10/win32/nt.h unz60d10_w32w/win32/nt.h
---- unz60d10/win32/nt.h Mon Jan 24 02:46:38 2005
-+++ unz60d10_w32w/win32/nt.h Mon Feb 11 02:07:20 2008
-@@ -1,4 +1,4 @@
- /*
-- Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
-+ Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
-
- See the accompanying file LICENSE, version 2000-Apr-09 or later
-@@ -24,9 +24,18 @@
- DWORD dwRemotePrivileges; /* relevant only on remote volumes */
- DWORD dwFileAttributes;
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ wchar_t RootPath[MAX_PATH+1]; /* path to network / filesystem */
-+#else
- char RootPath[MAX_PATH+1]; /* path to network / filesystem */
-+#endif
- } VOLUMECAPS, *PVOLUMECAPS, *LPVOLUMECAPS;
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+BOOL SecuritySet(wchar_t *resource, PVOLUMECAPS VolumeCaps, uch *securitydata);
-+BOOL GetVolumeCaps(wchar_t *rootpath, wchar_t *name, PVOLUMECAPS VolumeCaps);
-+#else
- BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata);
- BOOL GetVolumeCaps(char *rootpath, char *name, PVOLUMECAPS VolumeCaps);
-+#endif
- BOOL ValidateSecurity(uch *securitydata);
-
-diff -ru2 unz60d10/win32/vc6/funzip.dsp unz60d10_w32w/win32/vc6/funzip.dsp
---- unz60d10/win32/vc6/funzip.dsp Mon Feb 11 02:55:18 2008
-+++ unz60d10_w32w/win32/vc6/funzip.dsp Mon Feb 11 02:55:38 2008
-@@ -45,5 +45,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /FD /c
--# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "FUNZIP" /D "_CONSOLE" /D "_MBCS" /FD /c
-+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "FUNZIP" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c
- # ADD BASE RSC /l 0x409 /d "NDEBUG"
- # ADD RSC /l 0x409 /d "NDEBUG"
-@@ -69,5 +69,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /FD /GZ /c
--# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "FUNZIP" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "FUNZIP" /D "_CONSOLE" /D "_MBCS" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /FD /GZ /c
- # ADD BASE RSC /l 0x409 /d "_DEBUG"
- # ADD RSC /l 0x409 /d "_DEBUG"
-@@ -93,5 +93,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "FUNZIP" /FD /c
--# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "FUNZIP" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /c
-+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "FUNZIP" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c
- # ADD BASE RSC /l 0x409 /d "NDEBUG"
- # ADD RSC /l 0x409 /d "NDEBUG"
-@@ -117,5 +117,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "FUNZIP" /FD /GZ /c
--# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "FUNZIP" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "FUNZIP" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /GZ /c
- # ADD BASE RSC /l 0x409 /d "_DEBUG"
- # ADD RSC /l 0x409 /d "_DEBUG"
-diff -ru2 unz60d10/win32/vc6/unzip.dsp unz60d10_w32w/win32/vc6/unzip.dsp
---- unz60d10/win32/vc6/unzip.dsp Sat Mar 24 19:51:24 2007
-+++ unz60d10_w32w/win32/vc6/unzip.dsp Mon Feb 11 02:52:48 2008
-@@ -45,5 +45,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c
--# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
-+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c
- # ADD BASE RSC /l 0x409 /d "NDEBUG"
- # ADD RSC /l 0x409 /d "NDEBUG"
-@@ -69,5 +69,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c
--# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /FR /FD /GZ /c
- # ADD BASE RSC /l 0x409 /d "_DEBUG"
- # ADD RSC /l 0x409 /d "_DEBUG"
-@@ -93,5 +93,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c
--# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /c
-+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c
- # ADD BASE RSC /l 0x409 /d "NDEBUG"
- # ADD RSC /l 0x409 /d "NDEBUG"
-@@ -118,5 +118,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c
--# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /GZ /c
- # ADD BASE RSC /l 0x409 /d "_DEBUG"
- # ADD RSC /l 0x409 /d "_DEBUG"
-diff -ru2 unz60d10/win32/vc6/unzipbz2.dsp unz60d10_w32w/win32/vc6/unzipbz2.dsp
---- unz60d10/win32/vc6/unzipbz2.dsp Sun Jan 6 19:14:44 2008
-+++ unz60d10_w32w/win32/vc6/unzipbz2.dsp Mon Feb 11 02:52:48 2008
-@@ -45,5 +45,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c
--# ADD CPP /nologo /W3 /GX /O2 /I "../../bzip2" /D "NDEBUG" /D "WIN32" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /FD /c
-+# ADD CPP /nologo /W3 /GX /O2 /I "../../bzip2" /D "NDEBUG" /D "WIN32" /D "USE_BZIP2" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c
- # ADD BASE RSC /l 0x409 /d "NDEBUG"
- # ADD RSC /l 0x409 /d "NDEBUG"
-@@ -69,5 +69,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c
--# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../bzip2" /D "_DEBUG" /D "WIN32" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../bzip2" /D "_DEBUG" /D "WIN32" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /FD /GZ /c
- # ADD BASE RSC /l 0x409 /d "_DEBUG"
- # ADD RSC /l 0x409 /d "_DEBUG"
-@@ -93,5 +93,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c
--# ADD CPP /nologo /W3 /GX /O2 /I "../../bzip2" /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /FD /c
-+# ADD CPP /nologo /W3 /GX /O2 /I "../../bzip2" /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "USE_BZIP2" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c
- # ADD BASE RSC /l 0x409 /d "NDEBUG"
- # ADD RSC /l 0x409 /d "NDEBUG"
-@@ -118,5 +118,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c
--# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../bzip2" /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../bzip2" /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "USE_BZIP2" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /GZ /c
- # ADD BASE RSC /l 0x409 /d "_DEBUG"
- # ADD RSC /l 0x409 /d "_DEBUG"
-diff -ru2 unz60d10/win32/vc6/unzipsfx.dsp unz60d10_w32w/win32/vc6/unzipsfx.dsp
---- unz60d10/win32/vc6/unzipsfx.dsp Sun Jan 6 19:13:46 2008
-+++ unz60d10_w32w/win32/vc6/unzipsfx.dsp Mon Feb 11 02:52:48 2008
-@@ -45,5 +45,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /FD /c
--# ADD CPP /nologo /W3 /GX /O1 /D "WIN32" /D "SFX" /D "_CONSOLE" /D "_MBCS" /FD /c
-+# ADD CPP /nologo /W3 /GX /O1 /D "WIN32" /D "SFX" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c
- # ADD BASE RSC /l 0x409 /d "NDEBUG"
- # ADD RSC /l 0x409 /d "NDEBUG"
-@@ -69,5 +69,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /FD /GZ /c
--# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "SFX" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "SFX" /D "_CONSOLE" /D "_MBCS" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /FD /GZ /c
- # ADD BASE RSC /l 0x409 /d "_DEBUG"
- # ADD RSC /l 0x409 /d "_DEBUG"
-@@ -93,5 +93,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "SFX" /FD /c
--# ADD CPP /nologo /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "SFX" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /c
-+# ADD CPP /nologo /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "SFX" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c
- # ADD BASE RSC /l 0x409 /d "NDEBUG"
- # ADD RSC /l 0x409 /d "NDEBUG"
-@@ -117,5 +117,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "SFX" /FD /GZ /c
--# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "SFX" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "SFX" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /GZ /c
- # ADD BASE RSC /l 0x409 /d "_DEBUG"
- # ADD RSC /l 0x409 /d "_DEBUG"
-diff -ru2 unz60d10/win32/w32cfg.h unz60d10_w32w/win32/w32cfg.h
---- unz60d10/win32/w32cfg.h Thu Oct 4 02:05:42 2007
-+++ unz60d10_w32w/win32/w32cfg.h Tue Jan 1 18:34:48 2008
-@@ -271,15 +271,38 @@
- #define STR_TO_ISO
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ wchar_t *utf8_to_wchar_string OF((char *));
-+ wchar_t *local_to_wchar_string OF((char *));
-+ int has_win32_wide();
-+#endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-+
- /* Static variables that we have to add to Uz_Globs: */
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
- #define SYSTEM_SPECIFIC_GLOBALS \
- int created_dir, renamed_fullpath, fnlen;\
- unsigned nLabelDrive;\
- char lastRootPath[4];\
-+ wchar_t lastRootPathw[4];\
- int lastVolOldFAT, lastVolLocTim;\
- char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\
-+ wchar_t *rootpathw, *buildpathHPFSw, *buildpathFATw, *endHPFSw, *endFATw;\
- ZCONST char *wildname;\
-+ ZCONST wchar_t *wildnamew;\
- char *dirname, matchname[FILNAMSIZ];\
-+ wchar_t *dirnamew, matchnamew[FILNAMSIZ];\
- int rootlen, have_dirname, dirnamelen, notfirstcall;\
- zvoid *wild_dir;
-+#else /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-+#define SYSTEM_SPECIFIC_GLOBALS \
-+ int created_dir, renamed_fullpath, fnlen;\
-+ unsigned nLabelDrive;\
-+ char lastRootPath[4];\
-+ int lastVolOldFAT, lastVolLocTim;\
-+ char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\
-+ ZCONST char *wildname;\
-+ char *dirname, matchname[FILNAMSIZ];\
-+ int rootlen, have_dirname, dirnamelen, notfirstcall;\
-+ zvoid *wild_dir;
-+#endif /* ?(defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-
- /* created_dir, renamed_fullpath, fnlen, and nLabelDrive are used by */
-@@ -342,4 +365,13 @@
- # define SSTAT(path, pbuf) zstat_win32(__W32STAT_G__ path, pbuf)
- #endif
-+
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+# ifdef WILD_STAT_BUG
-+# define SSTATW(pathw, pbuf) (iswildw(pathw) || zstat_win32w(__W32STAT_G__ pathw, pbuf))
-+# else
-+# define SSTATW(pathw, pbuf) zstat_win32w(__W32STAT_G__ pathw, pbuf)
-+# endif
-+#endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-+
-
- #ifdef __WATCOMC__
-diff -ru2 unz60d10/win32/win32.c unz60d10_w32w/win32/win32.c
---- unz60d10/win32/win32.c Tue Jan 1 21:26:22 2008
-+++ unz60d10_w32w/win32/win32.c Tue Jan 1 21:26:24 2008
-@@ -75,4 +75,12 @@
- #endif
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+# if (defined(__EMX__) || defined(__CYGWIN__))
-+# define MKDIRW(pathw,mode) _wmkdir(pathw,mode)
-+# else
-+# define MKDIRW(pathw,mode) _wmkdir(pathw)
-+# endif
-+#endif
-+
- #ifdef HAVE_WORKING_DIRENT_H
- # undef HAVE_WORKING_DIRENT_H
-@@ -124,4 +132,22 @@
- } NTdirattr;
- #define NtAtt(d) ((NTdirattr *)d) /* typecast shortcut */
-+
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ typedef struct NTdirattrw { /* struct for holding unix style directory */
-+ struct NTdirattrw *next; /* info until can be sorted and set at end */
-+ wchar_t *fnw; /* filename of directory */
-+ FILETIME Modft; /* File time type defined in NT, `last modified' time */
-+ FILETIME Accft; /* NT file time type, `last access' time */
-+ FILETIME Creft; /* NT file time type, `file creation' time */
-+ int gotTime;
-+ unsigned perms; /* same as min_info.file_attr */
-+# ifdef NTSD_EAS
-+ unsigned SDlen; /* length of SD data in buf */
-+# endif
-+ wchar_t buf[1]; /* buffer stub for directory SD and name */
-+ } NTdirattrw;
-+# define NtAttw(dw) ((NTdirattrw *)dw) /* typecast shortcut */
-+# endif
-+
- #endif /* SET_DIR_ATTRIB */
-
-@@ -129,10 +155,15 @@
- /* Function prototypes */
- #ifdef NTSD_EAS
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ static int SetSD(__GPRO__ wchar_t *path, unsigned fperms,
-+ uch *eb_ptr, unsigned eb_len);
-+# else
- static int SetSD(__GPRO__ char *path, unsigned fperms,
- uch *eb_ptr, unsigned eb_len);
-+# endif
- static int FindSDExtraField(__GPRO__
- uch *ef_ptr, unsigned ef_len,
- uch **p_ebSD_ptr, unsigned *p_ebSD_len);
--#endif
-+#endif /* NTSD_EAS */
-
- #ifndef NO_W32TIMES_IZFIX
-@@ -147,13 +178,27 @@
- #endif
- static int FStampIsLocTime(__GPRO__ const char *path);
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ static int FStampIsLocTimeW(__GPRO__ const wchar_t *pathw);
-+#endif
-
-
- static int getNTfiletime (__GPRO__ FILETIME *pModFT, FILETIME *pAccFT,
- FILETIME *pCreFT);
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static int getNTfiletimeW (__GPRO__ FILETIME *pModFT, FILETIME *pAccFT,
-+ FILETIME *pCreFT);
-+#endif
- static int isfloppy (int nDrive);
- static int NTQueryVolInfo (__GPRO__ const char *name);
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ static int NTQueryVolInfoW (__GPRO__ const wchar_t *namew);
-+#endif
- static int IsVolumeOldFAT (__GPRO__ const char *name);
- static void maskDOSdevice (__GPRO__ char *pathcomp);
- static void map2fat (char *pathcomp, char **pEndFAT);
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ static void maskDOSdevicew (__GPRO__ wchar_t *pathcompw);
-+ static void map2fatw (wchar_t *pathcompw, wchar_t **pEndFATw);
-+#endif
-
-
-@@ -309,7 +354,13 @@
- /**********************/
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static int SetSD(__G__ path, fperms, eb_ptr, eb_len)
-+ __GDEF
-+ wchar_t *path;
-+#else
- static int SetSD(__G__ path, fperms, eb_ptr, eb_len)
- __GDEF
- char *path;
-+#endif
- unsigned fperms;
- uch *eb_ptr;
-@@ -918,4 +969,12 @@
-
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static int FStampIsLocTimeW(__GPRO__ const wchar_t *pathw)
-+{
-+ return (NTQueryVolInfoW(__G__ pathw) ? G.lastVolLocTim : FALSE);
-+}
-+#endif
-+
-+
-
- #ifndef NO_W32TIMES_IZFIX
-@@ -991,4 +1050,63 @@
-
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ static int getNTfiletimeW(__G__ pModFT, pAccFT, pCreFT)
-+ __GDEF
-+ FILETIME *pModFT;
-+ FILETIME *pAccFT;
-+ FILETIME *pCreFT;
-+ {
-+# ifdef USE_EF_UT_TIME
-+ unsigned eb_izux_flg;
-+ iztimes z_utime; /* struct for Unix-style actime & modtime, + creatime */
-+# endif
-+ int fs_uses_loctime = FStampIsLocTimeW(__G__ G.unipath_widefilename);
-+
-+ /* Copy and/or convert time and date variables, if necessary;
-+ * return a flag indicating which time stamps are available. */
-+# ifdef USE_EF_UT_TIME
-+ if (G.extra_field &&
-+# ifdef IZ_CHECK_TZ
-+ G.tz_is_valid &&
-+# endif
-+ ((eb_izux_flg = ef_scan_for_izux(G.extra_field,
-+ G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime,
-+ &z_utime, NULL)) & EB_UT_FL_MTIME))
-+ {
-+ TTrace((stderr, "getNTfiletime: Unix e.f. modif. time = %lu\n",
-+ z_utime.mtime));
-+ UTIME_2_IZFILETIME(z_utime.mtime, pModFT)
-+ if (eb_izux_flg & EB_UT_FL_ATIME) {
-+ UTIME_2_IZFILETIME(z_utime.atime, pAccFT)
-+ }
-+ if (eb_izux_flg & EB_UT_FL_CTIME) {
-+ UTIME_2_IZFILETIME(z_utime.ctime, pCreFT)
-+ }
-+ return (int)eb_izux_flg;
-+ }
-+# endif /* USE_EF_UT_TIME */
-+# ifndef NO_W32TIMES_IZFIX
-+ if (!fs_uses_loctime) {
-+ time_t ux_modtime;
-+
-+ ux_modtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
-+ utime2NtfsFileTime(ux_modtime, pModFT);
-+ } else
-+#endif /* NO_W32TIMES_IZFIX */
-+ {
-+ FILETIME lft;
-+
-+ DosDateTimeToFileTime((WORD)(G.lrec.last_mod_dos_datetime >> 16),
-+ (WORD)(G.lrec.last_mod_dos_datetime & 0xFFFFL),
-+ &lft);
-+ LocalFileTimeToFileTime(&lft, pModFT);
-+ }
-+ *pAccFT = *pModFT;
-+ return (EB_UT_FL_MTIME | EB_UT_FL_ATIME);
-+
-+ } /* end function getNTfiletime() */
-+#endif /* (UNICODE_SUPPORT && WIN32_WIDE) */
-+
-+
-
-
-@@ -1059,66 +1177,72 @@
- unsigned ebSDlen;
- #endif
-+
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ if (!G.has_win32_wide) {
-+#endif
- #ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
-- char *ansi_name = (char *)alloca(strlen(G.filename) + 1);
-+ char *ansi_name = (char *)alloca(strlen(G.filename) + 1);
-
-- INTERN_TO_ISO(G.filename, ansi_name);
--# define Ansi_Fname ansi_name
-+ INTERN_TO_ISO(G.filename, ansi_name);
-+# define Ansi_Fname ansi_name
- #else
--# define Ansi_Fname G.filename
-+# define Ansi_Fname G.filename
- #endif
-
- #ifndef __RSXNT__
-- if (IsWinNT()) {
-+# if !(defined(UNICODE_SUPPORT) && defined(WIN32_WIDE))
-+ if (IsWinNT()) {
- /* Truncate the file to the current position.
- * This is needed to remove excess allocation in case the
- * extraction has failed or stopped prematurely. */
- SetEndOfFile((HANDLE)_get_osfhandle(fileno(G.outfile)));
-- }
-+ }
-+# endif /* !(defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
- #endif
-
-- /* Close the file and then re-open it using the Win32
-- * CreateFile call, so that the file can be created
-- * with GENERIC_WRITE access, otherwise the SetFileTime
-- * call will fail. */
-- fclose(G.outfile);
--
-- /* don't set the time stamp and attributes on standard output */
-- if (uO.cflag)
-- return;
--
-- /* skip restoring time stamps on user's request */
-- if (uO.D_flag <= 1) {
-- gotTime = getNTfiletime(__G__ &Modft, &Accft, &Creft);
--
-- /* open a handle to the file before processing extra fields;
-- we do this in case new security on file prevents us from updating
-- time stamps */
-- hFile = CreateFileA(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
-- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-- } else {
-- gotTime = 0;
-- }
--
-- /* sfield@microsoft.com: set attributes before time in case we decide to
-- support other filetime members later. This also allows us to apply
-- attributes before the security is changed, which may prevent this
-- from succeeding otherwise. Also, since most files don't have
-- any interesting attributes, only change them if something other than
-- FILE_ATTRIBUTE_ARCHIVE appears in the attributes. This works well
-- as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the
-- file anyway, when it's created new. */
-- if ((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) {
-- if (!SetFileAttributesA(Ansi_Fname, G.pInfo->file_attr & 0x7F))
-- Info(slide, 1, ((char *)slide,
-- "\nwarning (%d): could not set file attributes\n",
-- (int)GetLastError()));
-- }
-+ /* Close the file and then re-open it using the Win32
-+ * CreateFile call, so that the file can be created
-+ * with GENERIC_WRITE access, otherwise the SetFileTime
-+ * call will fail. */
-+ fclose(G.outfile);
-+
-+ /* don't set the time stamp and attributes on standard output */
-+ if (uO.cflag)
-+ return;
-+
-+ gotTime = getNTfiletime(__G__ &Modft, &Accft, &Creft);
-+
-+ /* open a handle to the file before processing extra fields;
-+ we do this in case new security on file prevents us from updating
-+ time stamps */
-+ hFile = CreateFileA(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
-+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-+
-+ /* sfield@microsoft.com: set attributes before time in case we decide to
-+ support other filetime members later. This also allows us to apply
-+ attributes before the security is changed, which may prevent this
-+ from succeeding otherwise. Also, since most files don't have
-+ any interesting attributes, only change them if something other than
-+ FILE_ATTRIBUTE_ARCHIVE appears in the attributes. This works well
-+ as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the
-+ file anyway, when it's created new. */
-+ if((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) {
-+ if (!SetFileAttributesA(Ansi_Fname, G.pInfo->file_attr & 0x7F))
-+ Info(slide, 1, ((char *)slide,
-+ "\nwarning (%d): could not set file attributes\n",
-+ (int)GetLastError()));
-+ }
-
- #ifdef NTSD_EAS
-- /* set NTFS SD extra fields */
-- if (G.extra_field && /* zipfile extra field may have extended attribs */
-- FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
-- &ebSDptr, &ebSDlen))
-- {
-+ /* set NTFS SD extra fields */
-+ if (G.extra_field && /* zipfile extra field may have extended attribs */
-+ FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
-+ &ebSDptr, &ebSDlen))
-+ {
-+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ /* no win32_wide implies "no NT SD support", so FindSDExtraField
-+ * will never return "success".
-+ */
-+# else /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
- int err = SetSD(__G__ Ansi_Fname, G.pInfo->file_attr,
- ebSDptr, ebSDlen);
-@@ -1131,9 +1255,10 @@
- ebSDlen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), uO.qflag? "\n":""));
- }
-- }
-+# endif /* ? (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
-+ }
- #endif /* NTSD_EAS */
-
-- /* skip restoring time stamps on user's request */
-- if (uO.D_flag <= 1) {
-+ /* skip restoring time stamps on user's request */
-+ if (uO.D_flag <= 1) {
- if ( hFile == INVALID_HANDLE_VALUE )
- Info(slide, 1, ((char *)slide,
-@@ -1152,10 +1277,101 @@
- CloseHandle(hFile);
- }
-- }
-+ }
-
-- return;
-+ return;
-
- #undef Ansi_Fname
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ } else {
-+ /* wide version */
-+
-+#ifndef __RSXNT__
-+ if (IsWinNT()) {
-+ /* Truncate the file to the current position.
-+ * This is needed to remove excess allocation in case the
-+ * extraction has failed or stopped prematurely. */
-+ SetEndOfFile((HANDLE)_get_osfhandle(fileno(G.outfile)));
-+ }
-+#endif
-+
-+ /* Close the file and then re-open it using the Win32
-+ * CreateFile call, so that the file can be created
-+ * with GENERIC_WRITE access, otherwise the SetFileTime
-+ * call will fail. */
-+ fclose(G.outfile);
-+
-+ /* don't set the time stamp and attributes on standard output */
-+ if (uO.cflag)
-+ return;
-+
-+ gotTime = getNTfiletimeW(__G__ &Modft, &Accft, &Creft);
-+
-+ /* open a handle to the file before processing extra fields;
-+ we do this in case new security on file prevents us from updating
-+ time stamps */
-+ hFile = CreateFileW(G.unipath_widefilename,
-+ GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
-+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-+
-+ /* sfield@microsoft.com: set attributes before time in case we decide to
-+ support other filetime members later. This also allows us to apply
-+ attributes before the security is changed, which may prevent this
-+ from succeeding otherwise. Also, since most files don't have
-+ any interesting attributes, only change them if something other than
-+ FILE_ATTRIBUTE_ARCHIVE appears in the attributes. This works well
-+ as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the
-+ file anyway, when it's created new. */
-+ if((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) {
-+ if (!SetFileAttributesW(G.unipath_widefilename, G.pInfo->file_attr & 0x7F))
-+ Info(slide, 1, ((char *)slide,
-+ "\nwarning (%d): could not set file attributes\n",
-+ (int)GetLastError()));
-+ }
-+
-+#ifdef NTSD_EAS
-+ /* set NTFS SD extra fields */
-+ if (G.extra_field && /* zipfile extra field may have extended attribs */
-+ FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
-+ &ebSDptr, &ebSDlen))
-+ {
-+ int err = SetSD(__G__ G.unipath_widefilename, G.pInfo->file_attr,
-+ ebSDptr, ebSDlen);
-+
-+ if (err == IZ_EF_TRUNC) {
-+ if (uO.qflag)
-+ Info(slide, 1, ((char *)slide, "%-22s ",
-+ FnFilter1(G.filename)));
-+ Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD),
-+ ebSDlen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), uO.qflag? "\n":""));
-+ }
-+ }
-+#endif /* NTSD_EAS */
-+
-+ /* skip restoring time stamps on user's request */
-+ if (uO.D_flag <= 1) {
-+ if ( hFile == INVALID_HANDLE_VALUE )
-+ Info(slide, 1, ((char *)slide,
-+ "\nCreateFile() error %d when trying set file time\n",
-+ (int)GetLastError()));
-+ else {
-+ if (gotTime) {
-+ FILETIME *pModft = (gotTime & EB_UT_FL_MTIME) ? &Modft : NULL;
-+ FILETIME *pAccft = (gotTime & EB_UT_FL_ATIME) ? &Accft : NULL;
-+ FILETIME *pCreft = (gotTime & EB_UT_FL_CTIME) ? &Creft : NULL;
-+
-+ if (!SetFileTime(hFile, pCreft, pAccft, pModft))
-+ Info(slide, 0, ((char *)slide,
-+ "\nSetFileTime failed: %d\n", (int)GetLastError()));
-+ }
-+ CloseHandle(hFile);
-+ }
-+ }
-+
-+ return;
-+
-+ }
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-+
- } /* end function close_outfile() */
-
-@@ -1225,8 +1441,76 @@
-
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+int defer_dir_attribsw(__G__ pdw)
-+ __GDEF
-+ direntryw **pdw;
-+{
-+ NTdirattrw *d_entryw;
-+#ifdef NTSD_EAS
-+ uch *ebSDptr;
-+ unsigned ebSDlen;
-+#endif
-+
-+ /* Win9x does not support setting directory time stamps. */
-+ if (!IsWinNT()) {
-+ *pdw = (direntryw *)NULL;
-+ return PK_OK;
-+ }
-+
-+#ifdef NTSD_EAS
-+ /* set extended attributes from extra fields */
-+ if (G.extra_field && /* zipfile e.f. may have extended attribs */
-+ FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
-+ &ebSDptr, &ebSDlen)) {
-+ /* ebSDlen contains the payload size of the e.f. block, but
-+ we store it including the e.b. header. */
-+ ebSDlen += EB_HEADSIZE;
-+ } else {
-+ /* no NTSD e.f. block -> no space needed to allocate */
-+ ebSDlen = 0;
-+ }
-+#endif /* NTSD_EAS */
-+
-+ d_entryw = (NTdirattrw *)malloc(sizeof(NTdirattrw)
-+#ifdef NTSD_EAS
-+ + ebSDlen
-+#endif
-+ + (wcslen(G.unipath_widefilename)
-+ * sizeof(wchar_t)));
-+ *pdw = (direntryw *)d_entryw;
-+ if (d_entryw == (NTdirattrw *)NULL) {
-+ return PK_MEM;
-+ }
-+#ifdef NTSD_EAS
-+ if (ebSDlen > 0)
-+ memcpy(d_entryw->buf, ebSDptr, ebSDlen);
-+ d_entryw->SDlen = ebSDlen;
-+ d_entryw->fnw = d_entryw->buf + ebSDlen;
-+#else
-+ d_entryw->fnw = d_entryw->buf;
-+#endif
-+
-+ wcscpy(d_entryw->fnw, G.unipath_widefilename);
-+
-+ d_entryw->perms = G.pInfo->file_attr;
-+
-+ d_entryw->gotTime = (uO.D_flag <= 0
-+ ? getNTfiletimeW(__G__ &(d_entryw->Modft),
-+ &(d_entryw->Accft),
-+ &(d_entryw->Creft))
-+ : 0);
-+ return PK_OK;
-+} /* end function defer_dir_attribsw() */
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-+
-+
- int set_direc_attribs(__G__ d)
- __GDEF
- direntry *d;
- {
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+ /* Win9x does not support setting directory time stamps. */
-+ return PK_OK;
-+#else /* ! (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
- int errval;
- HANDLE hFile = INVALID_HANDLE_VALUE; /* File handle defined in NT */
-@@ -1320,6 +1604,107 @@
-
- return errval;
-+#endif /* ? (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
- } /* end function set_direc_attribs() */
-
-+
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+int set_direc_attribsw(__G__ dw)
-+ __GDEF
-+ direntryw *dw;
-+{
-+ int errval;
-+ HANDLE hFile = INVALID_HANDLE_VALUE; /* File handle defined in NT */
-+
-+ /* Win9x does not support setting directory time stamps. */
-+ if (!IsWinNT())
-+ return PK_OK;
-+
-+ errval = PK_OK;
-+
-+ /* Skip restoring directory time stamps on user' request. */
-+ if (uO.D_flag <= 0) {
-+ /* Open a handle to the directory before processing extra fields;
-+ we do this in case new security on file prevents us from updating
-+ time stamps.
-+ Although the WIN32 documentation recommends to use GENERIC_WRITE
-+ access flag to create the handle for SetFileTime(), this is too
-+ demanding for directories with the "read-only" attribute bit set.
-+ So we use the more specific flag FILE_WRITE_ATTRIBUTES here to
-+ request the minimum required access rights. (This problem is a
-+ Windows bug that has been silently fixed in Windows XP SP2.) */
-+ hFile = CreateFileW(dw->fnw, FILE_WRITE_ATTRIBUTES,
-+ FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
-+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
-+ }
-+
-+#ifdef NTSD_EAS
-+ if (NtAtt(dw)->SDlen > 0) {
-+ int err;
-+
-+ if (QCOND2) {
-+ char *fn = wchar_to_local_string(dw->fnw, G.unicode_escape_all);
-+ Info(slide, 1, ((char *)slide, " set attrib: %-22s ",
-+ FnFilter1(fn)));
-+ free(fn);
-+ }
-+
-+ /* set NTFS SD extra fields */
-+ err = SetSD(__G__ dw->fnw, NtAtt(dw)->perms,
-+ NtAtt(dw)->buf, NtAtt(dw)->SDlen - EB_HEADSIZE);
-+ if (err == IZ_EF_TRUNC) {
-+ if (!QCOND2) {
-+ char *fn = wchar_to_local_string(dw->fnw, G.unicode_escape_all);
-+ Info(slide, 1, ((char *)slide, "%-22s ",
-+ FnFilter1(fn)));
-+ free(fn);
-+ }
-+ Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD),
-+ NtAtt(dw)->SDlen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), "\n"));
-+ } else if (QCOND2) {
-+ Info(slide, 0, ((char *)slide, "\n"));
-+ }
-+ if (errval < err)
-+ errval = err;
-+ }
-+#endif /* NTSD_EAS */
-+
-+ /* Skip restoring directory time stamps on user' request. */
-+ if (uO.D_flag <= 0) {
-+ if (hFile == INVALID_HANDLE_VALUE) {
-+ char *fn = wchar_to_local_string(dw->fnw, G.unicode_escape_all);
-+ Info(slide, 1, ((char *)slide,
-+ "warning: CreateFile() error %d (set file times for %s)\n",
-+ (int)GetLastError(), FnFilter1(fn)));
-+ free(fn);
-+ if (!errval)
-+ errval = PK_WARN;
-+ } else {
-+ if (NtAtt(dw)->gotTime) {
-+ FILETIME *pModft = (NtAtt(dw)->gotTime & EB_UT_FL_MTIME)
-+ ? &(NtAtt(dw)->Modft) : NULL;
-+ FILETIME *pAccft = (NtAtt(dw)->gotTime & EB_UT_FL_ATIME)
-+ ? &(NtAtt(dw)->Accft) : NULL;
-+ FILETIME *pCreft = (NtAtt(dw)->gotTime & EB_UT_FL_CTIME)
-+ ? &(NtAtt(dw)->Creft) : NULL;
-+
-+ if (!SetFileTime(hFile, pCreft, pAccft, pModft)) {
-+ char *fn = wchar_to_local_string(dw->fnw,
-+ G.unicode_escape_all);
-+ Info(slide, 0, ((char *)slide,
-+ "warning: SetFileTime() for %s error %d\n",
-+ FnFilter1(fn), (int)GetLastError()));
-+ free(fn);
-+ if (!errval)
-+ errval = PK_WARN;
-+ }
-+ }
-+ CloseHandle(hFile);
-+ }
-+ }
-+
-+ return errval;
-+} /* end function set_direc_attribsw() */
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-+
- #endif /* SET_DIR_ATTRIB */
-
-@@ -1419,5 +1804,5 @@
- #endif
-
-- if ((!strncmp(name, "//", 2) || !strncmp(name, "\\\\", 2)) &&
-+ if ((!strncmp(name, "//", 2) || !strncmp(name,"\\\\", 2)) &&
- (name[2] != '\0' && name[2] != '/' && name[2] != '\\')) {
- /* GetFullPathname() and GetVolumeInformation() do not work
-@@ -1467,4 +1852,63 @@
-
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static int NTQueryVolInfoW(__GPRO__ const wchar_t *namew)
-+{
-+ /* static char lastRootPath[4] = ""; */
-+ /* static int lastVolOldFAT; */
-+ /* static int lastVolLocTim; */
-+ wchar_t *tmp0w;
-+ wchar_t tmp1w[MAX_PATH], tmp2w[MAX_PATH];
-+ DWORD volSerNo, maxCompLen, fileSysFlags;
-+
-+ if ((!wcsncmp(namew, L"//", 2) || !wcsncmp(namew, L"\\\\", 2)) &&
-+ (namew[2] != '\0' && namew[2] != '/' && namew[2] != '\\')) {
-+ /* GetFullPathname() and GetVolumeInformation() do not work
-+ * on UNC names. For now, we return "error".
-+ * **FIXME**: check if UNC name is mapped to a drive letter
-+ * and use mapped drive for volume info query.
-+ */
-+ return FALSE;
-+ }
-+ if (iswalpha(namew[0]) && (namew[1] == ':'))
-+ tmp0w = (wchar_t *)namew;
-+ else
-+ {
-+ if (!GetFullPathNameW(namew, MAX_PATH, tmp1w, &tmp0w))
-+ return FALSE;
-+ tmp0w = &tmp1w[0];
-+ }
-+ if (wcsncmp(G.lastRootPathw, tmp0w, 2) != 0) {
-+ /* For speed, we skip repeated queries for the same device */
-+ wcsncpy(G.lastRootPathw, tmp0w, 2); /* Build the root path name, */
-+ G.lastRootPathw[2] = '/'; /* e.g. "A:/" */
-+ G.lastRootPathw[3] = '\0';
-+
-+ if (!GetVolumeInformationW(G.lastRootPathw,
-+ tmp1w, (DWORD)MAX_PATH,
-+ &volSerNo, &maxCompLen, &fileSysFlags,
-+ tmp2w, (DWORD)MAX_PATH)) {
-+ G.lastRootPathw[0] = '\0';
-+ return FALSE;
-+ }
-+
-+ /* LFNs are available if the component length is > 12 */
-+ G.lastVolOldFAT = (maxCompLen <= 12);
-+/* G.lastVolOldFAT = !strncmp(strupr(tmp2), "FAT", 3); old version */
-+
-+ /* Volumes in (V)FAT and (OS/2) HPFS format store file timestamps in
-+ * local time!
-+ */
-+ G.lastVolLocTim = !wcsncmp(_wcsupr(tmp2w), L"VFAT", 4) ||
-+ !wcsncmp(tmp2w, L"HPFS", 4) ||
-+ !wcsncmp(tmp2w, L"FAT", 3);
-+ }
-+
-+ return TRUE;
-+
-+} /* end function NTQueryVolInfoW() */
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-+
-+
-
-
-@@ -1478,4 +1922,11 @@
- }
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+static int IsVolumeOldFATw(__GPRO__ const wchar_t *namew)
-+{
-+ return (NTQueryVolInfoW(__G__ namew) ? G.lastVolOldFAT : FALSE);
-+}
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-+
-
-
-@@ -1931,13 +2382,253 @@
-
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-
-+/* Win32 wide version */
-
--/****************************/
--/* Function maskDOSdevice() */
--/****************************/
--
--static void maskDOSdevice(__G__ pathcomp)
-+int mapnamew(__G__ renamed)
- __GDEF
-- char *pathcomp;
-+ int renamed;
-+/*
-+ * returns:
-+ * MPN_OK - no problem detected
-+ * MPN_INF_TRUNC - caution (truncated filename)
-+ * MPN_INF_SKIP - info "skip entry" (dir doesn't exist)
-+ * MPN_ERR_SKIP - error -> skip entry
-+ * MPN_ERR_TOOLONG - error -> path is too long
-+ * MPN_NOMEM - error (memory allocation failed) -> skip entry
-+ * [also MPN_VOL_LABEL, MPN_CREATED_DIR]
-+ */
-+{
-+ wchar_t pathcompw[FILNAMSIZ]; /* path-component buffer */
-+ wchar_t *ppw, *cpw=NULL; /* character pointers */
-+ wchar_t *lastsemiw = NULL; /* pointer to last semi-colon in pathcomp */
-+ int killed_ddot = FALSE; /* is set when skipping "../" pathcomp */
-+ int error;
-+ register wchar_t workchw; /* hold the character being tested */
-+
-+
-+/*---------------------------------------------------------------------------
-+ Initialize various pointers and counters and stuff.
-+ ---------------------------------------------------------------------------*/
-+
-+ /* can create path as long as not just freshening, or if user told us */
-+ G.create_dirs = (!uO.fflag || renamed);
-+
-+ G.created_dir = FALSE; /* not yet */
-+ G.renamed_fullpath = FALSE;
-+ G.fnlen = wcslen(G.unipath_widefilename);
-+
-+ if (renamed) {
-+ cpw = G.unipath_widefilename; /* point to beginning of renamed name... */
-+ if (*cpw) do {
-+ if (*cpw == '\\') /* convert backslashes to forward */
-+ *cpw = '/';
-+ } while (*(++cpw));
-+ cpw = G.unipath_widefilename;
-+ /* use temporary rootpath if user gave full pathname */
-+ if (G.unipath_widefilename[0] == '/') {
-+ G.renamed_fullpath = TRUE;
-+ pathcompw[0] = '/'; /* copy the '/' and terminate */
-+ pathcompw[1] = '\0';
-+ ++cpw;
-+ } else if (iswalpha(G.unipath_widefilename[0]) && G.unipath_widefilename[1] == ':') {
-+ G.renamed_fullpath = TRUE;
-+ ppw = pathcompw;
-+ *ppw++ = *cpw++; /* copy the "d:" (+ '/', possibly) */
-+ *ppw++ = *cpw++;
-+ if (*cpw == '/')
-+ *ppw++ = *cpw++; /* otherwise add "./"? */
-+ *ppw = '\0';
-+ }
-+ }
-+
-+ /* pathcomp is ignored unless renamed_fullpath is TRUE: */
-+ if ((error = checkdirw(__G__ pathcompw, INIT)) != 0) /* init path buffer */
-+ return error; /* ...unless no mem or vol label on hard disk */
-+
-+ *pathcompw = '\0'; /* initialize translation buffer */
-+ ppw = pathcompw; /* point to translation buffer */
-+ if (!renamed) { /* cp already set if renamed */
-+ if (uO.jflag) /* junking directories */
-+ cpw = wcschr(G.unipath_widefilename, '/');
-+ if (cpw == NULL) /* no '/' or not junking dirs */
-+ cpw = G.unipath_widefilename; /* point to internal zipfile-member pathname */
-+ else
-+ ++cpw; /* point to start of last component of path */
-+ }
-+
-+/*---------------------------------------------------------------------------
-+ Begin main loop through characters in filename.
-+ ---------------------------------------------------------------------------*/
-+
-+ for (; (workchw = *cpw) != 0; cpw++) {
-+
-+ switch (workchw) {
-+ case '/': /* can assume -j flag not given */
-+ *ppw = '\0';
-+ maskDOSdevicew(__G__ pathcompw);
-+ if (wcscmp(pathcompw, L".") == 0) {
-+ /* don't botherw appending "./" to the path */
-+ *pathcompw = '\0';
-+ } else if (!uO.ddotflag && wcscmp(pathcompw, L"..") == 0) {
-+ /* "../" dir traversal detected, skip over it */
-+ *pathcompw = '\0';
-+ killed_ddot = TRUE; /* set "show message" flag */
-+ }
-+ /* when path component is not empty, append it now */
-+ if (*pathcompw != '\0' &&
-+ ((error = checkdirw(__G__ pathcompw, APPEND_DIR))
-+ & MPN_MASK) > MPN_INF_TRUNC)
-+ return error;
-+ ppw = pathcompw; /* reset conversion buffer for next piece */
-+ lastsemiw = (wchar_t *)NULL; /* leave direct. semi-colons alone */
-+ break;
-+
-+ case ':': /* drive spec not stored, so no colon allowed */
-+ case '\\': /* '\\' may come as normal filename char (not */
-+ case '<': /* dir sep char!) from unix-like file system */
-+ case '>': /* no redirection symbols allowed either */
-+ case '|': /* no pipe signs allowed */
-+ case '"': /* no double quotes allowed */
-+ case '?': /* no wildcards allowed */
-+ case '*':
-+ *ppw++ = '_'; /* these rules apply equally to FAT and NTFS */
-+ break;
-+ case ';': /* start of VMS version? */
-+ lastsemiw = ppw; /* remove VMS version later... */
-+ *ppw++ = ';'; /* but keep semicolon for now */
-+ break;
-+
-+
-+ case ' ': /* keep spaces unless specifically */
-+ /* NT cannot create filenames with spaces on FAT volumes */
-+ if (uO.sflag || IsVolumeOldFATw(__G__ G.unipath_widefilename))
-+ *ppw++ = '_';
-+ else
-+ *ppw++ = ' ';
-+ break;
-+
-+ default:
-+ /* allow European characters in filenames: */
-+ if (iswprint(workchw) || workchw >= 127)
-+ *ppw++ = workchw;
-+ } /* end switch */
-+
-+ } /* end while loop */
-+
-+ /* Show warning when stripping insecure "parent dir" path components */
-+ /* For now use standard path for output messages */
-+ if (killed_ddot && QCOND2) {
-+ Info(slide, 0, ((char *)slide,
-+ "warning: skipped \"../\" path component(s) in %s\n",
-+ FnFilter1(G.filename)));
-+ if (!(error & ~MPN_MASK))
-+ error = (error & MPN_MASK) | PK_WARN;
-+ }
-+
-+/*---------------------------------------------------------------------------
-+ Report if directory was created (and no file to create: filename ended
-+ in '/'), check name to be sure it exists, and combine path and name be-
-+ fore exiting.
-+ ---------------------------------------------------------------------------*/
-+
-+ if (G.unipath_widefilename[wcslen(G.unipath_widefilename) - 1] == '/') {
-+ checkdirw(__G__ G.unipath_widefilename, GETPATH);
-+ if (G.created_dir) {
-+ if (QCOND2) {
-+ Info(slide, 0, ((char *)slide, " creating: %-22s\n",
-+ FnFilter1(G.filename)));
-+ }
-+
-+ /* set file attributes:
-+ The default for newly created directories is "DIR attribute
-+ flags set", so there is no need to change attributes unless
-+ one of the DOS style attribute flags is set. The readonly
-+ attribute need not be masked, since it does not prevent
-+ modifications in the new directory. */
-+ if(G.pInfo->file_attr & (0x7F & ~FILE_ATTRIBUTE_DIRECTORY)) {
-+ if (!SetFileAttributesW(G.unipath_widefilename, G.pInfo->file_attr & 0x7F))
-+ Info(slide, 1, ((char *)slide,
-+ "\nwarning (%d): could not set file attributes for %s\n",
-+ (int)GetLastError(), FnFilter1(G.filename)));
-+ }
-+
-+ /* set dir time (note trailing '/') */
-+ return (error & ~MPN_MASK) | MPN_CREATED_DIR;
-+ } else if (IS_OVERWRT_ALL) {
-+ /* overwrite attributes of existing directory on user's request */
-+
-+ /* set file attributes: */
-+ if(G.pInfo->file_attr & (0x7F & ~FILE_ATTRIBUTE_DIRECTORY)) {
-+ if (!SetFileAttributesW(G.unipath_widefilename, G.pInfo->file_attr & 0x7F))
-+ Info(slide, 1, ((char *)slide,
-+ "\nwarning (%d): could not set file attributes for %s\n",
-+ (int)GetLastError(), FnFilter1(G.filename)));
-+ }
-+ }
-+ /* dir existed already; don't look for data to extract */
-+ return (error & ~MPN_MASK) | MPN_INF_SKIP;
-+ }
-+
-+ *ppw = '\0'; /* done with pathcomp: terminate it */
-+
-+ /* if not saving them, remove VMS version numbers (appended "###") */
-+ if (!uO.V_flag && lastsemiw) {
-+ ppw = lastsemiw + 1; /* semi-colon was kept: expect #'s after */
-+ while (iswdigit(*ppw))
-+ ++ppw;
-+ if (*ppw == '\0') /* only digits between ';' and end: nuke */
-+ *lastsemiw = '\0';
-+ }
-+
-+ maskDOSdevicew(__G__ pathcompw);
-+
-+ if (*pathcompw == '\0') {
-+ Info(slide, 1, ((char *)slide, "mapname: conversion of %s failed\n",
-+ FnFilter1(G.filename)));
-+ return (error & ~MPN_MASK) | MPN_ERR_SKIP;
-+ }
-+
-+ checkdirw(__G__ pathcompw, APPEND_NAME); /* returns 1 if truncated: care? */
-+ checkdirw(__G__ G.unipath_widefilename, GETPATH);
-+
-+ if (G.pInfo->vollabel) { /* set the volume label now */
-+ char drive[4];
-+ wchar_t drivew[4];
-+
-+ /* Build a drive string, e.g. "b:" */
-+ drive[0] = (char)('a' + G.nLabelDrive - 1);
-+ drivew[0] = (wchar_t)('a' + G.nLabelDrive - 1);
-+ wcscpy(drivew + 1, L":\\");
-+ if (QCOND2)
-+ Info(slide, 0, ((char *)slide, "labelling %s %-22s\n", drive,
-+ FnFilter1(G.filename)));
-+ if (!SetVolumeLabelW(drivew, G.unipath_widefilename)) {
-+ Info(slide, 1, ((char *)slide,
-+ "mapname: error setting volume label\n"));
-+ return (error & ~MPN_MASK) | MPN_ERR_SKIP;
-+ }
-+ /* success: skip the "extraction" quietly */
-+ return (error & ~MPN_MASK) | MPN_INF_SKIP;
-+ }
-+
-+ Trace((stderr, "mapname returns with filename = [%s] (error = %d)\n\n",
-+ FnFilter1(G.filename), error));
-+ return error;
-+
-+} /* end function mapnamew() */
-+
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-+
-+
-+
-+
-+/****************************/
-+/* Function maskDOSdevice() */
-+/****************************/
-+
-+static void maskDOSdevice(__G__ pathcomp)
-+ __GDEF
-+ char *pathcomp;
- {
- /*---------------------------------------------------------------------------
-@@ -1981,4 +2672,40 @@
-
-
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+
-+static void maskDOSdevicew(__G__ pathcompw)
-+ __GDEF
-+ wchar_t *pathcompw;
-+{
-+/*---------------------------------------------------------------------------
-+ Put an underscore in front of the file name if the file name is a
-+ DOS/WINDOWS device name like CON.*, AUX.*, PRN.*, etc. Trying to
-+ extract such a file would fail at best and wedge us at worst.
-+ ---------------------------------------------------------------------------*/
-+#if !defined(S_IFCHR) && defined(_S_IFCHR)
-+# define S_IFCHR _S_IFCHR
-+#endif
-+#if !defined(S_ISCHR)
-+# if defined(_S_ISCHR)
-+# define S_ISCHR(m) _S_ISCHR(m)
-+# elif defined(S_IFCHR)
-+# define S_ISCHR(m) ((m) & S_IFCHR)
-+# endif
-+#endif
-+
-+ if (zstatw(pathcompw, &G.statbuf) == 0 && S_ISCHR(G.statbuf.st_mode)) {
-+ extent i;
-+
-+ /* pathcomp contains a name of a DOS character device (builtin or
-+ * installed device driver).
-+ * Prepend a '_' to allow creation of the item in the file system.
-+ */
-+ for (i = wcslen(pathcompw) + 1; i > 0; --i)
-+ pathcompw[i] = pathcompw[i - 1];
-+ pathcompw[0] = '_';
-+ }
-+} /* end function maskDOSdevicew() */
-+
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-
-
-@@ -2080,19 +2807,511 @@
- *pEndFAT = pEnd; /* filename is fine; point at terminating zero */
-
-- if ((last_dot - pBegin) > 0 && last_dot[-1] == ' ')
-- last_dot[-1] = '_'; /* NO blank in front of '.'! */
-+ if ((last_dot - pBegin) > 0 && last_dot[-1] == ' ')
-+ last_dot[-1] = '_'; /* NO blank in front of '.'! */
-+ }
-+} /* end function map2fat() */
-+
-+
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+
-+static void map2fatw(pathcompw, pEndFATw)
-+ wchar_t *pathcompw, **pEndFATw;
-+{
-+ wchar_t *ppcw = pathcompw; /* variable pointer to pathcomp */
-+ wchar_t *pEndw = *pEndFATw; /* variable pointer to buildpathFAT */
-+ wchar_t *pBeginw = *pEndFATw; /* constant pointer to start of this comp. */
-+ wchar_t *last_dotw = NULL; /* last dot not converted to underscore */
-+ register wchar_t workchw; /* hold the character being tested */
-+
-+
-+ /* Only need check those characters which are legal in NTFS but not
-+ * in FAT: to get here, must already have passed through mapname.
-+ * Also must truncate path component to ensure 8.3 compliance.
-+ */
-+ while ((workchw = *ppcw++) != 0) {
-+ switch (workchw) {
-+ case '[':
-+ case ']':
-+ case '+':
-+ case ',':
-+ case ';':
-+ case '=':
-+ *pEndw++ = '_'; /* convert brackets to underscores */
-+ break;
-+
-+ case '.':
-+ if (pEndw == *pEndFATw) { /* nothing appended yet... */
-+ if (*ppcw == '\0') /* don't bother appending a */
-+ break; /* "./" component to the path */
-+ else if (*ppcw == '.' && ppcw[1] == '\0') { /* "../" */
-+ *pEndw++ = '.'; /* add first dot, */
-+ *pEndw++ = '.'; /* add second dot, and */
-+ ++ppcw; /* skip over to pathcomp's end */
-+ } else { /* FAT doesn't allow null filename */
-+ *pEndw++ = '_'; /* bodies, so map .exrc -> _exrc */
-+ } /* (_.exr would keep max 3 chars) */
-+ } else { /* found dot within path component */
-+ last_dotw = pEndw; /* point at last dot so far... */
-+ *pEndw++ = '_'; /* convert to underscore for now */
-+ }
-+ break;
-+
-+ default:
-+ *pEndw++ = workchw;
-+
-+ } /* end switch */
-+ } /* end while loop */
-+
-+ *pEndw = '\0'; /* terminate buildpathFAT */
-+
-+ /* NOTE: keep in mind that pEnd points to the end of the path
-+ * component, and *pEndFAT still points to the *beginning* of it...
-+ * Also note that the algorithm does not try to get too fancy:
-+ * if there are no dots already, the name either gets truncated
-+ * at 8 characters or the last underscore is converted to a dot
-+ * (only if more characters are saved that way). In no case is
-+ * a dot inserted between existing characters.
-+ */
-+ if (last_dotw == NULL) { /* no dots: check for underscores... */
-+ wchar_t *pluw = wcschr(pBeginw, '_'); /* pointer to last underscore */
-+
-+ if ((pluw != NULL) && /* found underscore: convert to dot? */
-+ (MIN(pluw - pBeginw, 8) + MIN(pEndw - pluw - 1, 3) > 8)) {
-+ last_dotw = pluw; /* be lazy: drop through to next if-blk */
-+ } else if ((pEndw - *pEndFATw) > 8) {
-+ /* no underscore; or converting underscore to dot would save less
-+ chars than leaving everything in the basename */
-+ *pEndFATw += 8; /* truncate at 8 chars */
-+ **pEndFATw = '\0';
-+ } else
-+ *pEndFATw = pEndw; /* whole thing fits into 8 chars or less */
-+ }
-+
-+ if (last_dotw != NULL) { /* one dot is OK: */
-+ *last_dotw = '.'; /* put it back in */
-+
-+ if ((last_dotw - pBeginw) > 8) {
-+ wchar_t *pw, *qw;
-+ int i;
-+
-+ pw = last_dotw;
-+ qw = last_dotw = pBeginw + 8;
-+ for (i = 0; (i < 4) && *pw; ++i) /* too many chars in basename: */
-+ *qw++ = *pw++; /* shift .ext left and trun- */
-+ *qw = '\0'; /* cate/terminate it */
-+ *pEndFATw = qw;
-+ } else if ((pEndw - last_dotw) > 4) { /* too many chars in extension */
-+ *pEndFATw = last_dotw + 4;
-+ **pEndFATw = '\0';
-+ } else
-+ *pEndFATw = pEndw; /* filename is fine; point at terminating zero */
-+
-+ if ((last_dotw - pBeginw) > 0 && last_dotw[-1] == ' ')
-+ last_dotw[-1] = '_'; /* NO blank in front of '.'! */
-+ }
-+} /* end function map2fatw() */
-+
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-+
-+
-+
-+/***********************/ /* Borrowed from os2.c for UnZip 5.1. */
-+/* Function checkdir() */ /* Difference: no EA stuff */
-+/***********************/ /* HPFS stuff works on NTFS too */
-+
-+int checkdir(__G__ pathcomp, flag)
-+ __GDEF
-+ char *pathcomp;
-+ int flag;
-+/*
-+ * returns:
-+ * MPN_OK - no problem detected
-+ * MPN_INF_TRUNC - (on APPEND_NAME) truncated filename
-+ * MPN_INF_SKIP - path doesn't exist, not allowed to create
-+ * MPN_ERR_SKIP - path doesn't exist, tried to create and failed; or path
-+ * exists and is not a directory, but is supposed to be
-+ * MPN_ERR_TOOLONG - path is too long
-+ * MPN_NOMEM - can't allocate memory for filename buffers
-+ */
-+{
-+ /* static int rootlen = 0; */ /* length of rootpath */
-+ /* static char *rootpath; */ /* user's "extract-to" directory */
-+ /* static char *buildpathHPFS; */ /* full path (so far) to extracted file, */
-+ /* static char *buildpathFAT; */ /* both HPFS/EA (main) and FAT versions */
-+ /* static char *endHPFS; */ /* corresponding pointers to end of */
-+ /* static char *endFAT; */ /* buildpath ('\0') */
-+
-+# define FN_MASK 7
-+# define FUNCTION (flag & FN_MASK)
-+
-+
-+
-+/*---------------------------------------------------------------------------
-+ APPEND_DIR: append the path component to the path being built and check
-+ for its existence. If doesn't exist and we are creating directories, do
-+ so for this one; else signal success or error as appropriate.
-+ ---------------------------------------------------------------------------*/
-+
-+ if (FUNCTION == APPEND_DIR) {
-+ char *p = pathcomp;
-+ int too_long = FALSE;
-+
-+ Trace((stderr, "appending dir segment [%s]\n", FnFilter1(pathcomp)));
-+ while ((*G.endHPFS = *p++) != '\0') /* copy to HPFS filename */
-+ ++G.endHPFS;
-+ if (!IsVolumeOldFAT(__G__ G.buildpathHPFS)) {
-+ p = pathcomp;
-+ while ((*G.endFAT = *p++) != '\0') /* copy to FAT filename, too */
-+ ++G.endFAT;
-+ } else
-+ map2fat(pathcomp, &G.endFAT); /* map into FAT fn, update endFAT */
-+
-+ /* GRR: could do better check, see if overrunning buffer as we go:
-+ * check endHPFS-buildpathHPFS after each append, set warning variable
-+ * if within 20 of FILNAMSIZ; then if var set, do careful check when
-+ * appending. Clear variable when begin new path. */
-+
-+ /* next check: need to append '/', at least one-char name, '\0' */
-+ if ((G.endHPFS-G.buildpathHPFS) > FILNAMSIZ-3)
-+ too_long = TRUE; /* check if extracting dir? */
-+#ifdef FIX_STAT_BUG
-+ /* Borland C++ 5.0 does not handle a call to stat() well if the
-+ * directory does not exist (it tends to crash in strange places.)
-+ * This is apparently a problem only when compiling for GUI rather
-+ * than console. The code below attempts to work around this problem.
-+ */
-+ if (access(G.buildpathFAT, 0) != 0) {
-+ if (!G.create_dirs) { /* told not to create (freshening) */
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ /* path doesn't exist: nothing to do */
-+ return MPN_INF_SKIP;
-+ }
-+ if (too_long) { /* GRR: should allow FAT extraction w/o EAs */
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir error: path too long: %s\n",
-+ FnFilter1(G.buildpathHPFS)));
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ /* no room for filenames: fatal */
-+ return MPN_ERR_TOOLONG;
-+ }
-+ if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir error: cannot create %s\n\
-+ unable to process %s.\n",
-+ FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ /* path didn't exist, tried to create, failed */
-+ return MPN_ERR_SKIP;
-+ }
-+ G.created_dir = TRUE;
-+ }
-+#endif /* FIX_STAT_BUG */
-+ if (SSTAT(G.buildpathFAT, &G.statbuf)) /* path doesn't exist */
-+ {
-+ if (!G.create_dirs) { /* told not to create (freshening) */
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ /* path doesn't exist: nothing to do */
-+ return MPN_INF_SKIP;
-+ }
-+ if (too_long) { /* GRR: should allow FAT extraction w/o EAs */
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir error: path too long: %s\n",
-+ FnFilter1(G.buildpathHPFS)));
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ /* no room for filenames: fatal */
-+ return MPN_ERR_TOOLONG;
-+ }
-+ if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir error: cannot create %s\n\
-+ unable to process %s.\n",
-+ FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ /* path didn't exist, tried to create, failed */
-+ return MPN_ERR_SKIP;
-+ }
-+ G.created_dir = TRUE;
-+ } else if (!S_ISDIR(G.statbuf.st_mode)) {
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir error: %s exists but is not directory\n \
-+ unable to process %s.\n",
-+ FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ /* path existed but wasn't dir */
-+ return MPN_ERR_SKIP;
-+ }
-+ if (too_long) {
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir error: path too long: %s\n",
-+ FnFilter1(G.buildpathHPFS)));
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ /* no room for filenames: fatal */
-+ return MPN_ERR_TOOLONG;
-+ }
-+ *G.endHPFS++ = '/';
-+ *G.endFAT++ = '/';
-+ *G.endHPFS = *G.endFAT = '\0';
-+ Trace((stderr, "buildpathHPFS now = [%s]\nbuildpathFAT now = [%s]\n",
-+ FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT)));
-+ return MPN_OK;
-+
-+ } /* end if (FUNCTION == APPEND_DIR) */
-+
-+/*---------------------------------------------------------------------------
-+ GETPATH: copy full FAT path to the string pointed at by pathcomp (want
-+ filename to reflect name used on disk, not EAs; if full path is HPFS,
-+ buildpathFAT and buildpathHPFS will be identical). Also free both paths.
-+ ---------------------------------------------------------------------------*/
-+
-+ if (FUNCTION == GETPATH) {
-+ Trace((stderr, "getting and freeing FAT path [%s]\n",
-+ FnFilter1(G.buildpathFAT)));
-+ Trace((stderr, "freeing HPFS path [%s]\n",
-+ FnFilter1(G.buildpathHPFS)));
-+ strcpy(pathcomp, G.buildpathFAT);
-+ free(G.buildpathFAT);
-+ free(G.buildpathHPFS);
-+ G.buildpathHPFS = G.buildpathFAT = G.endHPFS = G.endFAT = NULL;
-+ return MPN_OK;
-+ }
-+
-+/*---------------------------------------------------------------------------
-+ APPEND_NAME: assume the path component is the filename; append it and
-+ return without checking for existence.
-+ ---------------------------------------------------------------------------*/
-+
-+ if (FUNCTION == APPEND_NAME) {
-+ char *p = pathcomp;
-+ int error = MPN_OK;
-+
-+ Trace((stderr, "appending filename [%s]\n", FnFilter1(pathcomp)));
-+ /* The buildpathHPFS buffer has been allocated large enough to
-+ * hold the complete combined name, so there is no need to check
-+ * for OS filename size limit overflow within the copy loop.
-+ */
-+ while ((*G.endHPFS = *p++) != '\0') { /* copy to HPFS filename */
-+ ++G.endHPFS;
-+ }
-+ /* Now, check for OS filename size overflow. When detected, the
-+ * mapped HPFS name is truncated and a warning message is shown.
-+ */
-+ if ((G.endHPFS-G.buildpathHPFS) >= FILNAMSIZ) {
-+ G.buildpathHPFS[FILNAMSIZ-1] = '\0';
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir warning: path too long; truncating\n \
-+ %s\n -> %s\n",
-+ FnFilter1(G.filename), FnFilter2(G.buildpathHPFS)));
-+ error = MPN_INF_TRUNC; /* filename truncated */
-+ }
-+
-+ /* The buildpathFAT buffer has the same allocated size as the
-+ * buildpathHPFS buffer, so there is no need for an overflow check
-+ * within the following copy loop, either.
-+ */
-+ if (G.pInfo->vollabel || !IsVolumeOldFAT(__G__ G.buildpathHPFS)) {
-+ /* copy to FAT filename, too */
-+ p = pathcomp;
-+ while ((*G.endFAT = *p++) != '\0')
-+ ++G.endFAT;
-+ } else
-+ /* map into FAT fn, update endFAT */
-+ map2fat(pathcomp, &G.endFAT);
-+
-+ /* Check that the FAT path does not exceed the FILNAMSIZ limit, and
-+ * truncate when neccessary.
-+ * Note that truncation can only happen when the HPFS path (which is
-+ * never shorter than the FAT path) has been already truncated.
-+ * So, emission of the warning message and setting the error code
-+ * has already happened.
-+ */
-+ if ((G.endFAT-G.buildpathFAT) >= FILNAMSIZ)
-+ G.buildpathFAT[FILNAMSIZ-1] = '\0';
-+ Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n",
-+ FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT)));
-+
-+ return error; /* could check for existence, prompt for new name... */
-+
-+ } /* end if (FUNCTION == APPEND_NAME) */
-+
-+/*---------------------------------------------------------------------------
-+ INIT: allocate and initialize buffer space for the file currently being
-+ extracted. If file was renamed with an absolute path, don't prepend the
-+ extract-to path.
-+ ---------------------------------------------------------------------------*/
-+
-+ if (FUNCTION == INIT) {
-+ Trace((stderr, "initializing buildpathHPFS and buildpathFAT to "));
-+#ifdef ACORN_FTYPE_NFS
-+ if ((G.buildpathHPFS = (char *)malloc(G.fnlen+G.rootlen+
-+ (uO.acorn_nfs_ext ? 5 : 1)))
-+#else
-+ if ((G.buildpathHPFS = (char *)malloc(G.fnlen+G.rootlen+1))
-+#endif
-+ == NULL)
-+ return MPN_NOMEM;
-+#ifdef ACORN_FTYPE_NFS
-+ if ((G.buildpathFAT = (char *)malloc(G.fnlen+G.rootlen+
-+ (uO.acorn_nfs_ext ? 5 : 1)))
-+#else
-+ if ((G.buildpathFAT = (char *)malloc(G.fnlen+G.rootlen+1))
-+#endif
-+ == NULL) {
-+ free(G.buildpathHPFS);
-+ return MPN_NOMEM;
-+ }
-+ if (G.pInfo->vollabel) { /* use root or renamed path, but don't store */
-+/* GRR: for network drives, do strchr() and return IZ_VOL_LABEL if not [1] */
-+ if (G.renamed_fullpath && pathcomp[1] == ':')
-+ *G.buildpathHPFS = (char)ToLower(*pathcomp);
-+ else if (!G.renamed_fullpath && G.rootlen > 1 &&
-+ G.rootpath[1] == ':')
-+ *G.buildpathHPFS = (char)ToLower(*G.rootpath);
-+ else {
-+ char tmpN[MAX_PATH], *tmpP;
-+ if (GetFullPathNameA(".", MAX_PATH, tmpN, &tmpP) > MAX_PATH)
-+ { /* by definition of MAX_PATH we should never get here */
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir warning: current dir path too long\n"));
-+ return MPN_INF_TRUNC; /* can't get drive letter */
-+ }
-+ G.nLabelDrive = *tmpN - 'a' + 1;
-+ *G.buildpathHPFS = (char)(G.nLabelDrive - 1 + 'a');
-+ }
-+ G.nLabelDrive = *G.buildpathHPFS - 'a' + 1; /* save for mapname() */
-+ if (uO.volflag == 0 || *G.buildpathHPFS < 'a' /* no labels/bogus? */
-+ || (uO.volflag == 1 && !isfloppy(G.nLabelDrive))) { /* !fixed */
-+ free(G.buildpathHPFS);
-+ free(G.buildpathFAT);
-+ return MPN_VOL_LABEL; /* skipping with message */
-+ }
-+ *G.buildpathHPFS = '\0';
-+ } else if (G.renamed_fullpath) /* pathcomp = valid data */
-+ strcpy(G.buildpathHPFS, pathcomp);
-+ else if (G.rootlen > 0)
-+ strcpy(G.buildpathHPFS, G.rootpath);
-+ else
-+ *G.buildpathHPFS = '\0';
-+ G.endHPFS = G.buildpathHPFS;
-+ G.endFAT = G.buildpathFAT;
-+ while ((*G.endFAT = *G.endHPFS) != '\0') {
-+ ++G.endFAT;
-+ ++G.endHPFS;
-+ }
-+ Trace((stderr, "[%s]\n", FnFilter1(G.buildpathHPFS)));
-+ return MPN_OK;
-+ }
-+
-+/*---------------------------------------------------------------------------
-+ ROOT: if appropriate, store the path in rootpath and create it if neces-
-+ sary; else assume it's a zipfile member and return. This path segment
-+ gets used in extracting all members from every zipfile specified on the
-+ command line. Note that under OS/2 and MS-DOS, if a candidate extract-to
-+ directory specification includes a drive letter (leading "x:"), it is
-+ treated just as if it had a trailing '/'--that is, one directory level
-+ will be created if the path doesn't exist, unless this is otherwise pro-
-+ hibited (e.g., freshening).
-+ ---------------------------------------------------------------------------*/
-+
-+#if (!defined(SFX) || defined(SFX_EXDIR))
-+ if (FUNCTION == ROOT) {
-+ Trace((stderr, "initializing root path to [%s]\n",
-+ FnFilter1(pathcomp)));
-+ if (pathcomp == NULL) {
-+ G.rootlen = 0;
-+ return MPN_OK;
-+ }
-+ if (G.rootlen > 0) /* rootpath was already set, nothing to do */
-+ return MPN_OK;
-+ if ((G.rootlen = strlen(pathcomp)) > 0) {
-+ int had_trailing_pathsep=FALSE, has_drive=FALSE, add_dot=FALSE;
-+ char *tmproot;
-+
-+ if ((tmproot = (char *)malloc(G.rootlen+3)) == (char *)NULL) {
-+ G.rootlen = 0;
-+ return MPN_NOMEM;
-+ }
-+ strcpy(tmproot, pathcomp);
-+ if (isalpha((uch)tmproot[0]) && tmproot[1] == ':')
-+ has_drive = TRUE; /* drive designator */
-+ if (tmproot[G.rootlen-1] == '/' || tmproot[G.rootlen-1] == '\\') {
-+ tmproot[--G.rootlen] = '\0';
-+ had_trailing_pathsep = TRUE;
-+ }
-+ if (has_drive && (G.rootlen == 2)) {
-+ if (!had_trailing_pathsep) /* i.e., original wasn't "x:/" */
-+ add_dot = TRUE; /* relative path: add '.' before '/' */
-+ } else if (G.rootlen > 0) { /* need not check "x:." and "x:/" */
-+ if (SSTAT(tmproot, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode))
-+ {
-+ /* path does not exist */
-+ if (!G.create_dirs /* || iswild(tmproot) */ ) {
-+ free(tmproot);
-+ G.rootlen = 0;
-+ /* treat as stored file */
-+ return MPN_INF_SKIP;
-+ }
-+ /* create directory (could add loop here scanning tmproot
-+ * to create more than one level, but really necessary?) */
-+ if (MKDIR(tmproot, 0777) == -1) {
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir: cannot create extraction directory: %s\n",
-+ FnFilter1(tmproot)));
-+ free(tmproot);
-+ G.rootlen = 0;
-+ /* path didn't exist, tried to create, failed: */
-+ /* file exists, or need 2+ subdir levels */
-+ return MPN_ERR_SKIP;
-+ }
-+ }
-+ }
-+ if (add_dot) /* had just "x:", make "x:." */
-+ tmproot[G.rootlen++] = '.';
-+ tmproot[G.rootlen++] = '/';
-+ tmproot[G.rootlen] = '\0';
-+ if ((G.rootpath = (char *)realloc(tmproot, G.rootlen+1)) == NULL) {
-+ free(tmproot);
-+ G.rootlen = 0;
-+ return MPN_NOMEM;
-+ }
-+ Trace((stderr, "rootpath now = [%s]\n", FnFilter1(G.rootpath)));
-+ }
-+ return MPN_OK;
-+ }
-+#endif /* !SFX || SFX_EXDIR */
-+
-+/*---------------------------------------------------------------------------
-+ END: free rootpath, immediately prior to program exit.
-+ ---------------------------------------------------------------------------*/
-+
-+ if (FUNCTION == END) {
-+ Trace((stderr, "freeing rootpath\n"));
-+ if (G.rootlen > 0) {
-+ free(G.rootpath);
-+ G.rootlen = 0;
-+ }
-+ return MPN_OK;
- }
--} /* end function map2fat() */
-
-+ return MPN_INVALID; /* should never reach */
-+
-+} /* end function checkdir() */
-
-
-
--/***********************/ /* Borrowed from os2.c for UnZip 5.1. */
--/* Function checkdir() */ /* Difference: no EA stuff */
--/***********************/ /* HPFS stuff works on NTFS too */
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-
--int checkdir(__G__ pathcomp, flag)
-+/* WIN32 wide version */
-+
-+int checkdirw(__G__ pathcompw, flag)
- __GDEF
-- char *pathcomp;
-+ wchar_t *pathcompw;
- int flag;
- /*
-@@ -2126,16 +3345,20 @@
-
- if (FUNCTION == APPEND_DIR) {
-- char *p = pathcomp;
-+ wchar_t *pw = pathcompw;
- int too_long = FALSE;
--
-- Trace((stderr, "appending dir segment [%s]\n", FnFilter1(pathcomp)));
-- while ((*G.endHPFS = *p++) != '\0') /* copy to HPFS filename */
-- ++G.endHPFS;
-- if (!IsVolumeOldFAT(__G__ G.buildpathHPFS)) {
-- p = pathcomp;
-- while ((*G.endFAT = *p++) != '\0') /* copy to FAT filename, too */
-- ++G.endFAT;
-+ char *buildpathFAT = wchar_to_local_string(G.buildpathFATw, G.unicode_escape_all);
-+ char *buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
-+ /* Could use G.filename from the standard path, but may
-+ not work well on this port */
-+ char *fn = wchar_to_local_string(G.unipath_widefilename, G.unicode_escape_all);
-+
-+ while ((*G.endHPFSw = *pw++) != '\0') /* copy to HPFS filename */
-+ ++G.endHPFSw;
-+ if (!IsVolumeOldFATw(__G__ G.buildpathHPFSw)) {
-+ pw = pathcompw;
-+ while ((*G.endFATw = *pw++) != '\0') /* copy to FAT filename, too */
-+ ++G.endFATw;
- } else
-- map2fat(pathcomp, &G.endFAT); /* map into FAT fn, update endFAT */
-+ map2fatw(pathcompw, &G.endFATw); /* map into FAT fn, update endFAT */
-
- /* GRR: could do better check, see if overrunning buffer as we go:
-@@ -2145,5 +3368,5 @@
-
- /* next check: need to append '/', at least one-char name, '\0' */
-- if ((G.endHPFS-G.buildpathHPFS) > FILNAMSIZ-3)
-+ if ((G.endHPFSw-G.buildpathHPFSw) > FILNAMSIZ-3)
- too_long = TRUE; /* check if extracting dir? */
- #ifdef FIX_STAT_BUG
-@@ -2153,8 +3376,11 @@
- * than console. The code below attempts to work around this problem.
- */
-- if (access(G.buildpathFAT, 0) != 0) {
-+ if (_waccess(G.buildpathFATw, 0) != 0) {
- if (!G.create_dirs) { /* told not to create (freshening) */
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
- /* path doesn't exist: nothing to do */
- return MPN_INF_SKIP;
-@@ -2163,28 +3389,40 @@
- Info(slide, 1, ((char *)slide,
- "checkdir error: path too long: %s\n",
-- FnFilter1(G.buildpathHPFS)));
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-+ FnFilter1(fn)));
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
- /* no room for filenames: fatal */
- return MPN_ERR_TOOLONG;
- }
-- if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */
-- Info(slide, 1, ((char *)slide,
-- "checkdir error: cannot create %s\n\
-- unable to process %s.\n",
-- FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-- /* path didn't exist, tried to create, failed */
-- return MPN_ERR_SKIP;
-- }
-- G.created_dir = TRUE;
-+ {
-+ int i = MKDIRW(G.buildpathFATw, 0777);
-+ if (i == -1) { /* create the directory */
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir error: cannot create %s\n\
-+ unable to process %s.\n",
-+ FnFilter2(buildpathFAT), FnFilter1(fn)));
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
-+ /* path didn't exist, tried to create, failed */
-+ return MPN_ERR_SKIP;
-+ }
-+ G.created_dir = TRUE;
-+ }
- }
- #endif /* FIX_STAT_BUG */
-- if (SSTAT(G.buildpathFAT, &G.statbuf)) /* path doesn't exist */
-+ if (SSTATW(G.buildpathFATw, &G.statbuf)) /* path doesn't exist */
- {
- if (!G.create_dirs) { /* told not to create (freshening) */
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
- /* path doesn't exist: nothing to do */
- return MPN_INF_SKIP;
-@@ -2193,28 +3431,41 @@
- Info(slide, 1, ((char *)slide,
- "checkdir error: path too long: %s\n",
-- FnFilter1(G.buildpathHPFS)));
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-+ FnFilter1(buildpathHPFS)));
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
- /* no room for filenames: fatal */
- return MPN_ERR_TOOLONG;
- }
-- if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */
-- Info(slide, 1, ((char *)slide,
-- "checkdir error: cannot create %s\n\
-- unable to process %s.\n",
-- FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-- /* path didn't exist, tried to create, failed */
-- return MPN_ERR_SKIP;
-- }
-- G.created_dir = TRUE;
-+ {
-+ char *buildpathFAT = wchar_to_local_string(G.buildpathFATw, G.unicode_escape_all);
-+ int i = MKDIRW(G.buildpathFATw, 0777);
-+ if (i == -1) { /* create the directory */
-+ Info(slide, 1, ((char *)slide,
-+ "checkdir error: cannot create %s\n\
-+ unable to process %s.\n",
-+ FnFilter2(buildpathFAT), FnFilter1(fn)));
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
-+ /* path didn't exist, tried to create, failed */
-+ return MPN_ERR_SKIP;
-+ }
-+ G.created_dir = TRUE;
-+ }
- } else if (!S_ISDIR(G.statbuf.st_mode)) {
- Info(slide, 1, ((char *)slide,
- "checkdir error: %s exists but is not directory\n \
- unable to process %s.\n",
-- FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-+ FnFilter2(buildpathFAT), FnFilter1(fn)));
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
- /* path existed but wasn't dir */
- return MPN_ERR_SKIP;
-@@ -2223,15 +3474,23 @@
- Info(slide, 1, ((char *)slide,
- "checkdir error: path too long: %s\n",
-- FnFilter1(G.buildpathHPFS)));
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-+ FnFilter1(buildpathHPFS)));
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
- /* no room for filenames: fatal */
- return MPN_ERR_TOOLONG;
- }
-- *G.endHPFS++ = '/';
-- *G.endFAT++ = '/';
-- *G.endHPFS = *G.endFAT = '\0';
-+ *G.endHPFSw++ = '/';
-+ *G.endFATw++ = '/';
-+ *G.endHPFSw = *G.endFATw = '\0';
- Trace((stderr, "buildpathHPFS now = [%s]\nbuildpathFAT now = [%s]\n",
-- FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT)));
-+ FnFilter1(buildpathHPFS), FnFilter2(buildpathFAT)));
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ free(fn);
-+ //free(G.buildpathHPFSw);
-+ //free(G.buildpathFATw);
- return MPN_OK;
-
-@@ -2245,12 +3504,16 @@
-
- if (FUNCTION == GETPATH) {
-+ char *buildpathFAT = wchar_to_local_string(G.buildpathFATw, G.unicode_escape_all);
-+ char *buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
- Trace((stderr, "getting and freeing FAT path [%s]\n",
-- FnFilter1(G.buildpathFAT)));
-+ FnFilter1(buildpathFAT)));
- Trace((stderr, "freeing HPFS path [%s]\n",
-- FnFilter1(G.buildpathHPFS)));
-- strcpy(pathcomp, G.buildpathFAT);
-- free(G.buildpathFAT);
-- free(G.buildpathHPFS);
-- G.buildpathHPFS = G.buildpathFAT = G.endHPFS = G.endFAT = NULL;
-+ FnFilter1(buildpathHPFS)));
-+ wcscpy(pathcompw, G.buildpathFATw);
-+ free(buildpathFAT);
-+ free(buildpathHPFS);
-+ free(G.buildpathFATw);
-+ free(G.buildpathHPFSw);
-+ G.buildpathHPFSw = G.buildpathFATw = G.endHPFSw = G.endFATw = NULL;
- return MPN_OK;
- }
-@@ -2262,6 +3525,8 @@
-
- if (FUNCTION == APPEND_NAME) {
-- char *p = pathcomp;
-+ wchar_t *pw = pathcompw;
- int error = MPN_OK;
-+ char *pathcomp = wchar_to_local_string(pathcompw, G.unicode_escape_all);
-+ char *fn = wchar_to_local_string(G.unipath_widefilename, G.unicode_escape_all);
-
- Trace((stderr, "appending filename [%s]\n", FnFilter1(pathcomp)));
-@@ -2270,16 +3535,19 @@
- * for OS filename size limit overflow within the copy loop.
- */
-- while ((*G.endHPFS = *p++) != '\0') { /* copy to HPFS filename */
-- ++G.endHPFS;
-+ while ((*G.endHPFSw = *pw++) != '\0') { /* copy to HPFS filename */
-+ ++G.endHPFSw;
- }
- /* Now, check for OS filename size overflow. When detected, the
- * mapped HPFS name is truncated and a warning message is shown.
- */
-- if ((G.endHPFS-G.buildpathHPFS) >= FILNAMSIZ) {
-- G.buildpathHPFS[FILNAMSIZ-1] = '\0';
-+ if ((G.endHPFSw-G.buildpathHPFSw) >= FILNAMSIZ) {
-+ char *buildpathHPFS;
-+ G.buildpathHPFSw[FILNAMSIZ-1] = '\0';
-+ buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
- Info(slide, 1, ((char *)slide,
- "checkdir warning: path too long; truncating\n \
- %s\n -> %s\n",
-- FnFilter1(G.filename), FnFilter2(G.buildpathHPFS)));
-+ FnFilter1(fn), FnFilter2(buildpathHPFS)));
-+ free(buildpathHPFS);
- error = MPN_INF_TRUNC; /* filename truncated */
- }
-@@ -2289,12 +3557,12 @@
- * within the following copy loop, either.
- */
-- if (G.pInfo->vollabel || !IsVolumeOldFAT(__G__ G.buildpathHPFS)) {
-+ if (G.pInfo->vollabel || !IsVolumeOldFATw(__G__ G.buildpathHPFSw)) {
- /* copy to FAT filename, too */
-- p = pathcomp;
-- while ((*G.endFAT = *p++) != '\0')
-- ++G.endFAT;
-+ pw = pathcompw;
-+ while ((*G.endFATw = *pw++) != '\0')
-+ ++G.endFATw;
- } else
- /* map into FAT fn, update endFAT */
-- map2fat(pathcomp, &G.endFAT);
-+ map2fatw(pathcompw, &G.endFATw);
-
- /* Check that the FAT path does not exceed the FILNAMSIZ limit, and
-@@ -2305,8 +3573,16 @@
- * has already happened.
- */
-- if ((G.endFAT-G.buildpathFAT) >= FILNAMSIZ)
-- G.buildpathFAT[FILNAMSIZ-1] = '\0';
-- Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n",
-- FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT)));
-+ if ((G.endFATw-G.buildpathFATw) >= FILNAMSIZ)
-+ G.buildpathFATw[FILNAMSIZ-1] = '\0';
-+ {
-+ char *buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
-+ char *buildpathFAT = wchar_to_local_string(G.buildpathFATw,G.unicode_escape_all);
-+ Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n",
-+ FnFilter1(buildpathHPFS), FnFilter2(buildpathFAT)));
-+ free(buildpathHPFS);
-+ free(buildpathFAT);
-+ }
-+ free(fn);
-+ free(pathcomp);
-
- return error; /* could check for existence, prompt for new name... */
-@@ -2321,33 +3597,23 @@
-
- if (FUNCTION == INIT) {
-- Trace((stderr, "initializing buildpathHPFS and buildpathFAT to "));
--#ifdef ACORN_FTYPE_NFS
-- if ((G.buildpathHPFS = (char *)malloc(G.fnlen+G.rootlen+
-- (uO.acorn_nfs_ext ? 5 : 1)))
--#else
-- if ((G.buildpathHPFS = (char *)malloc(G.fnlen+G.rootlen+1))
--#endif
-+ Trace((stderr, "initializing buildpathHPFSw and buildpathFATw to "));
-+ if ((G.buildpathHPFSw = (wchar_t *)malloc((G.fnlen+G.rootlen+1) * sizeof(wchar_t)))
- == NULL)
- return MPN_NOMEM;
--#ifdef ACORN_FTYPE_NFS
-- if ((G.buildpathFAT = (char *)malloc(G.fnlen+G.rootlen+
-- (uO.acorn_nfs_ext ? 5 : 1)))
--#else
-- if ((G.buildpathFAT = (char *)malloc(G.fnlen+G.rootlen+1))
--#endif
-+ if ((G.buildpathFATw = (wchar_t *)malloc((G.fnlen+G.rootlen+1) * sizeof(wchar_t)))
- == NULL) {
-- free(G.buildpathHPFS);
-+ free(G.buildpathHPFSw);
- return MPN_NOMEM;
- }
- if (G.pInfo->vollabel) { /* use root or renamed path, but don't store */
- /* GRR: for network drives, do strchr() and return IZ_VOL_LABEL if not [1] */
-- if (G.renamed_fullpath && pathcomp[1] == ':')
-- *G.buildpathHPFS = (char)ToLower(*pathcomp);
-+ if (G.renamed_fullpath && pathcompw[1] == ':')
-+ *G.buildpathHPFSw = (wchar_t)towlower(*pathcompw);
- else if (!G.renamed_fullpath && G.rootlen > 1 &&
-- G.rootpath[1] == ':')
-- *G.buildpathHPFS = (char)ToLower(*G.rootpath);
-+ G.rootpathw[1] == ':')
-+ *G.buildpathHPFSw = (wchar_t)towlower(*G.rootpathw);
- else {
-- char tmpN[MAX_PATH], *tmpP;
-- if (GetFullPathNameA(".", MAX_PATH, tmpN, &tmpP) > MAX_PATH)
-+ wchar_t tmpNw[MAX_PATH], *tmpPw;
-+ if (GetFullPathNameW(L".", MAX_PATH, tmpNw, &tmpPw) > MAX_PATH)
- { /* by definition of MAX_PATH we should never get here */
- Info(slide, 1, ((char *)slide,
-@@ -2355,28 +3621,33 @@
- return MPN_INF_TRUNC; /* can't get drive letter */
- }
-- G.nLabelDrive = *tmpN - 'a' + 1;
-- *G.buildpathHPFS = (char)(G.nLabelDrive - 1 + 'a');
-+ G.nLabelDrive = (char)(*tmpNw - 'a' + 1);
-+ *G.buildpathHPFSw = (wchar_t)(G.nLabelDrive - 1 + 'a');
- }
-- G.nLabelDrive = *G.buildpathHPFS - 'a' + 1; /* save for mapname() */
-- if (uO.volflag == 0 || *G.buildpathHPFS < 'a' /* no labels/bogus? */
-+ G.nLabelDrive = (char)(*G.buildpathHPFSw - 'a' + 1); /* save for mapname() */
-+ if (uO.volflag == 0 || *G.buildpathHPFSw < 'a' /* no labels/bogus? */
- || (uO.volflag == 1 && !isfloppy(G.nLabelDrive))) { /* !fixed */
-- free(G.buildpathHPFS);
-- free(G.buildpathFAT);
-+ free(G.buildpathHPFSw);
-+ free(G.buildpathFATw);
- return MPN_VOL_LABEL; /* skipping with message */
- }
-- *G.buildpathHPFS = '\0';
-+ *G.buildpathHPFSw = '\0';
- } else if (G.renamed_fullpath) /* pathcomp = valid data */
-- strcpy(G.buildpathHPFS, pathcomp);
-+ wcscpy(G.buildpathHPFSw, pathcompw);
- else if (G.rootlen > 0)
-- strcpy(G.buildpathHPFS, G.rootpath);
-+ wcscpy(G.buildpathHPFSw, G.rootpathw);
- else
-- *G.buildpathHPFS = '\0';
-- G.endHPFS = G.buildpathHPFS;
-- G.endFAT = G.buildpathFAT;
-- while ((*G.endFAT = *G.endHPFS) != '\0') {
-- ++G.endFAT;
-- ++G.endHPFS;
-+ *G.buildpathHPFSw = '\0';
-+ G.endHPFSw = G.buildpathHPFSw;
-+ G.endFATw = G.buildpathFATw;
-+ while ((*G.endFATw = *G.endHPFSw) != '\0') {
-+ ++G.endFATw;
-+ ++G.endHPFSw;
- }
-- Trace((stderr, "[%s]\n", FnFilter1(G.buildpathHPFS)));
-+ {
-+ char *buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
-+ Trace((stderr, "[%s]\n", FnFilter1(buildpathHPFS)));
-+ free(buildpathHPFS);
-+ }
-+
- return MPN_OK;
- }
-@@ -2395,7 +3666,9 @@
- #if (!defined(SFX) || defined(SFX_EXDIR))
- if (FUNCTION == ROOT) {
-+ char *pathcomp = wchar_to_local_string(pathcompw, G.unicode_escape_all);
- Trace((stderr, "initializing root path to [%s]\n",
- FnFilter1(pathcomp)));
-- if (pathcomp == NULL) {
-+ free(pathcomp);
-+ if (pathcompw == NULL) {
- G.rootlen = 0;
- return MPN_OK;
-@@ -2403,17 +3676,17 @@
- if (G.rootlen > 0) /* rootpath was already set, nothing to do */
- return MPN_OK;
-- if ((G.rootlen = strlen(pathcomp)) > 0) {
-+ if ((G.rootlen = wcslen(pathcompw)) > 0) {
- int had_trailing_pathsep=FALSE, has_drive=FALSE, add_dot=FALSE;
-- char *tmproot;
-+ wchar_t *tmprootw;
-
-- if ((tmproot = (char *)malloc(G.rootlen+3)) == (char *)NULL) {
-+ if ((tmprootw = (wchar_t *)malloc((G.rootlen+3) * sizeof(wchar_t))) == (wchar_t *)NULL) {
- G.rootlen = 0;
- return MPN_NOMEM;
- }
-- strcpy(tmproot, pathcomp);
-- if (isalpha((uch)tmproot[0]) && tmproot[1] == ':')
-+ wcscpy(tmprootw, pathcompw);
-+ if (iswalpha(tmprootw[0]) && tmprootw[1] == ':')
- has_drive = TRUE; /* drive designator */
-- if (tmproot[G.rootlen-1] == '/' || tmproot[G.rootlen-1] == '\\') {
-- tmproot[--G.rootlen] = '\0';
-+ if (tmprootw[G.rootlen-1] == '/' || tmprootw[G.rootlen-1] == '\\') {
-+ tmprootw[--G.rootlen] = '\0';
- had_trailing_pathsep = TRUE;
- }
-@@ -2422,9 +3695,9 @@
- add_dot = TRUE; /* relative path: add '.' before '/' */
- } else if (G.rootlen > 0) { /* need not check "x:." and "x:/" */
-- if (SSTAT(tmproot, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode))
-+ if (SSTATW(tmprootw, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode))
- {
- /* path does not exist */
- if (!G.create_dirs /* || iswild(tmproot) */ ) {
-- free(tmproot);
-+ free(tmprootw);
- G.rootlen = 0;
- /* treat as stored file */
-@@ -2433,12 +3706,15 @@
- /* create directory (could add loop here scanning tmproot
- * to create more than one level, but really necessary?) */
-- if (MKDIR(tmproot, 0777) == -1) {
-+ if (MKDIRW(tmprootw, 0777) == -1) {
-+ char *tmproot = wchar_to_local_string(tmprootw, G.unicode_escape_all);
- Info(slide, 1, ((char *)slide,
- "checkdir: cannot create extraction directory: %s\n",
- FnFilter1(tmproot)));
- free(tmproot);
-+ free(tmprootw);
- G.rootlen = 0;
- /* path didn't exist, tried to create, failed: */
- /* file exists, or need 2+ subdir levels */
-+ free(pathcomp);
- return MPN_ERR_SKIP;
- }
-@@ -2446,13 +3722,17 @@
- }
- if (add_dot) /* had just "x:", make "x:." */
-- tmproot[G.rootlen++] = '.';
-- tmproot[G.rootlen++] = '/';
-- tmproot[G.rootlen] = '\0';
-- if ((G.rootpath = (char *)realloc(tmproot, G.rootlen+1)) == NULL) {
-- free(tmproot);
-+ tmprootw[G.rootlen++] = '.';
-+ tmprootw[G.rootlen++] = '/';
-+ tmprootw[G.rootlen] = '\0';
-+ if ((G.rootpathw = (wchar_t *)realloc(tmprootw, (G.rootlen+1) * sizeof(wchar_t))) == NULL) {
-+ free(tmprootw);
- G.rootlen = 0;
- return MPN_NOMEM;
- }
-- Trace((stderr, "rootpath now = [%s]\n", FnFilter1(G.rootpath)));
-+ {
-+ char *rootpath = wchar_to_local_string(G.rootpathw, G.unicode_escape_all);
-+ Trace((stderr, "rootpath now = [%s]\n", FnFilter1(rootpath)));
-+ free(rootpath);
-+ }
- }
- return MPN_OK;
-@@ -2467,5 +3747,5 @@
- Trace((stderr, "freeing rootpath\n"));
- if (G.rootlen > 0) {
-- free(G.rootpath);
-+ free(G.rootpathw);
- G.rootlen = 0;
- }
-@@ -2475,6 +3755,7 @@
- return MPN_INVALID; /* should never reach */
-
--} /* end function checkdir() */
-+} /* end function checkdirw() */
-
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-
-
-@@ -2809,4 +4090,99 @@
- }
-
-+
-+
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-+
-+int zstat_win32w(__W32STAT_GLOBALS__ const wchar_t *pathw, z_stat *buf)
-+{
-+ if (!zstatw(pathw, buf))
-+ {
-+ char *path = wchar_to_local_string((wchar_t *)pathw, G.unicode_escape_all);
-+ /* stat was successful, now redo the time-stamp fetches */
-+#ifndef NO_W32TIMES_IZFIX
-+ int fs_uses_loctime = FStampIsLocTimeW(__G__ pathw);
-+#endif
-+ HANDLE h;
-+ FILETIME Modft, Accft, Creft;
-+
-+ TTrace((stdout, "stat(%s) finds modtime %08lx\n", path, buf->st_mtime));
-+ h = CreateFileW(pathw, GENERIC_READ,
-+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
-+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-+ if (h != INVALID_HANDLE_VALUE) {
-+ BOOL ftOK = GetFileTime(h, &Creft, &Accft, &Modft);
-+ CloseHandle(h);
-+
-+ if (ftOK) {
-+ FTTrace((stdout, "GetFileTime returned Modft", 0, &Modft));
-+ FTTrace((stdout, "GetFileTime returned Creft", 0, &Creft));
-+#ifndef NO_W32TIMES_IZFIX
-+ if (!fs_uses_loctime) {
-+ /* On a filesystem that stores UTC timestamps, we refill
-+ * the time fields of the struct stat buffer by directly
-+ * using the UTC values as returned by the Win32
-+ * GetFileTime() API call.
-+ */
-+ NtfsFileTime2utime(&Modft, &(buf->st_mtime));
-+ if (Accft.dwLowDateTime != 0 || Accft.dwHighDateTime != 0)
-+ NtfsFileTime2utime(&Accft, &(buf->st_atime));
-+ else
-+ buf->st_atime = buf->st_mtime;
-+ if (Creft.dwLowDateTime != 0 || Creft.dwHighDateTime != 0)
-+ NtfsFileTime2utime(&Creft, &(buf->st_ctime));
-+ else
-+ buf->st_ctime = buf->st_mtime;
-+ TTrace((stdout,"NTFS, recalculated modtime %08lx\n",
-+ buf->st_mtime));
-+ } else
-+#endif /* NO_W32TIMES_IZFIX */
-+ {
-+ /* On VFAT and FAT-like filesystems, the FILETIME values
-+ * are converted back to the stable local time before
-+ * converting them to UTC unix time-stamps.
-+ */
-+ VFatFileTime2utime(&Modft, &(buf->st_mtime));
-+ if (Accft.dwLowDateTime != 0 || Accft.dwHighDateTime != 0)
-+ VFatFileTime2utime(&Accft, &(buf->st_atime));
-+ else
-+ buf->st_atime = buf->st_mtime;
-+ if (Creft.dwLowDateTime != 0 || Creft.dwHighDateTime != 0)
-+ VFatFileTime2utime(&Creft, &(buf->st_ctime));
-+ else
-+ buf->st_ctime = buf->st_mtime;
-+ TTrace((stdout, "VFAT, recalculated modtime %08lx\n",
-+ buf->st_mtime));
-+ }
-+ }
-+ }
-+ free(path);
-+
-+ return 0;
-+ }
-+#ifdef W32_STATROOT_FIX
-+ else
-+ {
-+ DWORD flags;
-+
-+ flags = GetFileAttributesW(pathw);
-+ if (flags != 0xFFFFFFFF && flags & FILE_ATTRIBUTE_DIRECTORY) {
-+ char *path = wchar_to_local_string((wchar_t *)pathw, G.unicode_escape_all);
-+ Trace((stderr, "\nstat(\"%s\",...) failed on existing directory\n",
-+ FnFilter1(path)));
-+ free(path);
-+ memset(buf, 0, sizeof(z_stat));
-+ buf->st_atime = buf->st_ctime = buf->st_mtime =
-+ dos_to_unix_time(DOSTIME_MINIMUM); /* 1-1-80 */
-+ buf->st_mode = S_IFDIR | S_IREAD |
-+ ((flags & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE);
-+ return 0;
-+ } /* assumes: stat() won't fail on non-dirs without good reason */
-+ }
-+#endif /* W32_STATROOT_FIX */
-+ return -1;
-+}
-+
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-+
- #endif /* W32_STAT_BANDAID */
-
-@@ -2939,6 +4315,5 @@
-
-
--#if 0
--#ifdef UNICODE_SUPPORT
-+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
- wchar_t *utf8_to_wchar_string(utf8_string)
- char *utf8_string; /* path to get utf-8 name for */
-@@ -3030,22 +4405,40 @@
- return qw;
- }
--#endif /* UNICODE_SUPPORT */
--#endif /* 0 */
-
-+int has_win32_wide()
-+{
-+ int is_win32_wide;
-
-+ /* test if we have wide function support */
-
--/* --------------------------------------------------- */
--/* Large File Support
-- *
-- * Initial functions by E. Gordon and R. Nausedat
-- * 9/10/2003
-- * Lifted from Zip 3b, win32.c and place here by Myles Bennett
-- * 7/6/2004
-- *
-- * These implement 64-bit file support for Windows. The
-- * defines and headers are in win32/w32cfg.h.
-- *
-- * Moved to win32i64.c by Mike White to avoid conflicts in
-- * same name functions in WiZ using UnZip and Zip libraries.
-- * 9/25/2003
-- */
-+ /* first guess: On "real" WinNT, the WIN32 wide API >>is<< supported. */
-+ is_win32_wide = IsWinNT();
-+
-+ if (!is_win32_wide)
-+ {
-+ /* On a non-WinNT environment (Win9x or Win32s), wide functions
-+ * might although supported when program is linked against the
-+ * Win9x Unicode support library.
-+ * => run a check whether a needed API function is supported.
-+ */
-+ DWORD r;
-+ /* get attributes for this directory */
-+ r = GetFileAttributesA(".");
-+
-+ /* r should be 16 = FILE_ATTRIBUTE_DIRECTORY */
-+ if (r == FILE_ATTRIBUTE_DIRECTORY) {
-+ /* now see if it works for the wide version */
-+ r = GetFileAttributesW(L".");
-+ /* if this fails then we probably don't have wide functions */
-+ if (r == 0xFFFFFFFF) {
-+ /* error is probably "This function is only valid in Win32 mode." */
-+ } else if (r == FILE_ATTRIBUTE_DIRECTORY) {
-+ /* worked, so assume we have wide support */
-+ is_win32_wide = TRUE;
-+ }
-+ }
-+ }
-+ return is_win32_wide;
-+}
-+
-+#endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-diff -ru2 unz60d10/windll/vc6/dll/unz32dll.dsp unz60d10_w32w/windll/vc6/dll/unz32dll.dsp
---- unz60d10/windll/vc6/dll/unz32dll.dsp Wed Dec 27 23:25:00 2006
-+++ unz60d10_w32w/windll/vc6/dll/unz32dll.dsp Mon Feb 11 02:38:32 2008
-@@ -46,5 +46,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
--# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /YX /FD /c
-+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /YX /FD /c
- # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
- # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-@@ -72,5 +72,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
--# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /YX /FD /c
-+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /YX /FD /c
- # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
- # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-@@ -98,5 +98,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
--# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c
-+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "ASM_CRC" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /YX /FD /c
- # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
- # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-@@ -124,5 +124,5 @@
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
--# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c
-+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "ASM_CRC" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /FR /YX /FD /c
- # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
- # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-Contents of the "win32" sub-archive for UnZip 6.0 and later:
+ Contents of the UnZip 6.10 Source Archive "win32" Directory
+ -----------------------------------------------------------
- Contents this file
- Makefile makefile for UnZip using MS Visual C++
- Makefile.bc makefile for UnZip using Borland C++
- Makefile.dj makefile for UnZip using djgpp v2.x with rsxntdj 1.31
- Makefile.emx makefile for UnZip using emx+gcc 0.9c with RSXNT 1.4 (+)
- Makefile.gcc makefile for UnZip using native Win32 gcc ports (Cygwin, MinGW)
- Makefile.lcc makefile for UnZip using free LCC-Win32 compiler
- Makefile.wat makefile for UnZip using Watcom C/C++
- crc_i386.asm 32-bit Intel-assembler version of CRC routine
- crc_i386.c ditto, for MS[V]C with no MASM only
- crc_lcc.asm ditto, adapted for LCC-Win32 assembler syntax
- nt.c WinNT-specific support routines (ACLs/security descriptors)
- nt.h WinNT-specific support header
- rsxntwin.h supplement header for RSXNT, fills holes in their <windows.h>
- w32cfg.h Win32-specific configuration, included by unzpriv.h
- win32.c Win32-specific support routines
- win32i64.c
- winapp.rc resource file for regular console-mode UnZip application
- vc6/ directory containing Visual C++ 6.0 project files
- funzip.dsp MSVC++ 6.0 project file for fUnZip command-line tool
- unzip.dsp MSVC++ 6.0 project file for UnZip command-line main program
- unzipsfx.dsp MSVC++ 6.0 project file for UnZipSFX console mode stub
- unzipbz2.dsp MSVC++ 6.0 project file for UnZip with bzip2 support
- bz2lib.dsp MSVC++ 6.0 project file for bz2lib (de)compression library
- unzip.dsw MSVC++ 6.0 workspace file for all UnZip command line tools
- vc8/ directory containing Visual C++ 2005 (8.0) project files
- funzip.vcproj MSVC++ 8.0 project file for fUnZip command-line tool
- unzip.vcproj MSVC++ 8.0 project file for UnZip command-line main program
- unzipsfx.vcproj MSVC++ 8.0 project file for UnZipSFX console mode stub
- unzipbz2.vcproj MSVC++ 8.0 project file for UnZip with bzip2 support
- bz2lib.vcproj MSVC++ 8.0 project file for bz2lib (de)compression library
- unzip.sln MSVC++ 8.0 workspace file for all UnZip command line tools
+Contents This file
+crc_i386.asm 32-bit Intel-assembler version of CRC routine
+crc_i386.c crc_i386.asm, adapted for MSVC with no MASM only
+crc_lcc.asm crc_i386.asm, adapted for LCC-Win32 assembler syntax
+Makefile "make" file for UnZip using MS Visual C++
+Makefile.bc "make" file for UnZip using Borland C++
+Makefile.dj "make" file for UnZip using djgpp v2.x with rsxntdj 1.31
+Makefile.emx "make" file for UnZip using emx+gcc 0.9c with RSXNT 1.4 (+)
+Makefile.gcc "make" file for UnZip using Win32 gcc ports (Cygwin, MinGW)
+Makefile.lcc "make" file for UnZip using free LCC-Win32 compiler
+Makefile.wat "make" file for UnZip using Watcom C/C++
+nt.c WinNT-specific support routines (ACLs/security descriptors)
+nt.h WinNT-specific support header
+rsxntwin.h Supplement for RSXNT (and its deficient <windows.h>)
+w32cfg.h Win32-specific configuration, included by unzpriv.h
+win32.c Win32-specific support routines
+win32i64.c Win32-specific large-file support routines
+winapp.rc Resource file for regular console-mode UnZip application
-crc_i386.c has been tested with MSVC and can be selected through the MSVC
-makefile. It is provided for those who may have MSVC but no assembler.
-Note that some C compilers on Pentium-class machines have 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.
+vc10\ Directory for Visual C++ 2010 (10.0) project files
+ unzip.sln Solution file for all UnZip command-line tools
+ funzip\ Directory for FUnZip project files
+ funzip.vcxproj
+ funzip.vcxproj.filters
+ libbz2\ Directory for bzip2 library project files
+ libbz2.vcxproj
+ libbz2.vcxproj.filters
+ unzip\ Directory for UnZip project files
+ unzip.vcxproj
+ unzip.vcxproj.filters
+ unzipsfx\ Directory for UnZipSFX project files
+ unzipsfx.vcxproj
+ unzipsfx.vcxproj.filters
+
+vc6\ Directory for Visual C++ 6.0 project files
+ funzip.dsp Project file for fUnZip command-line tool
+ unzip.dsp Project file for UnZip command-line main program
+ unzipsfx.dsp Project file for UnZipSFX console mode stub
+ unzipbz2.dsp Project file for UnZip with bzip2 support
+ bz2lib.dsp Project file for bz2lib bzip2 compression library
+ unzip.dsw Workspace file for all UnZip command-line tools
+
+vc8\ Directory for Visual C++ 2005 (8.0) project files
+ funzip.vcproj Project file for fUnZip command-line tool
+ unzip.vcproj Project file for UnZip command-line main program
+ unzipsfx.vcproj Project file for UnZipSFX console mode stub
+ unzipbz2.vcproj Project file for UnZip with bzip2 support
+ bz2lib.vcproj Project file for bz2lib bzip2 compression library
+ unzip.sln Solution file for all UnZip command-line tools
+
+ crc_i386.c has been tested with MSVC and can be selected through the
+MSVC makefile. It is provided for those who may have MSVC but no
+assembler. Note that some C compilers on Pentium-class machines have
+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.
+They may not have been updated for UnZip 6.10, 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
+work. See INSTALL for more information.
LOCAL_UNZIP = -DUSE_ZLIB $(LOCAL_UNZIP)
!endif
!ifdef USEBZ2
-LOCAL_UNZIP = -DUSE_BZIP2 $(LOCAL_UNZIP)
+LOCAL_UNZIP = -DBZIP2_SUPPORT $(LOCAL_UNZIP)
!endif
#CF_LOC = -nologo -J -D_MBCS $(CFVARS_ASM) -DREENTRANT
IZ_BZIP2 = bzip2
ifdef USEBZ2
INC_BZ2LIB = -I$(IZ_BZIP2)
-LOCFLAGS = $(INC_BZ2LIB) -DUSE_BZIP2
+LOCFLAGS = $(INC_BZ2LIB) -DBZIP2_SUPPORT
LD_BZ2LIB = -L$(IZ_BZIP2) -lbz2
LIBBZIP2 = $(IZ_BZIP2)/libbz2.a
else
IZ_BZIP2 = bzip2
!ifdef USEBZ2
-cvars = $+$(cvars)$- -DUSE_BZIP2 -I$(IZ_BZIP2)
+cvars = $+$(cvars)$- -DBZIP2_SUPPORT -I$(IZ_BZIP2)
BZIPLIB = $(IZ_BZIP2)/$(OBDIR)/bz2.lib
BZ2LNKLIB = lib {$(BZIPLIB)}
!else
/*
- Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
/* private prototypes */
static BOOL Initialize(VOID);
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static VOID GetRemotePrivilegesSet(wchar_t *FileName,
+ PDWORD dwRemotePrivileges);
+#else
static VOID GetRemotePrivilegesSet(CHAR *FileName, PDWORD dwRemotePrivileges);
+#endif
static VOID InitLocalPrivileges(VOID);
return TRUE;
}
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static VOID GetRemotePrivilegesSet(wchar_t *FileName,
+ PDWORD dwRemotePrivileges)
+#else
static VOID GetRemotePrivilegesSet(char *FileName, PDWORD dwRemotePrivileges)
+#endif
{
HANDLE hFile;
+/* 2013-07-08 SMS. See note below. */
+#ifdef RETRY_CREATEFILE
+ int cf_tries;
+#endif
*dwRemotePrivileges = 0;
/* see if we have the SeRestorePrivilege */
- hFile = CreateFileA(
- FileName,
- ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER | READ_CONTROL,
- FILE_SHARE_READ | FILE_SHARE_DELETE, /* no sd updating allowed here */
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS,
- NULL
+ /* 2013-07-08 SMS.
+ * Some anti-virus programs may temporarily lock a newly created
+ * file, causing transient failures of CreateFile[AW]() when
+ * setting date-time (win32/win32.c:close_outfile()). (We assume
+ * that the code here is similarly vulnerable.)
+ * We try up to IZ_CREATEFILE_TRY_COUNT times, at intervals of
+ * IZ_CREATEFILE_TRY_TIME_MS (millisecond). To disable the
+ * retries, define IZ_CREATEFILE_TRY_COUNT as zero. (win32/w32cfg.h).
+ * http://sourceforge.net/p/infozip/bugs/44/
+ * http://support.microsoft.com/kb/316609
+ *
+ * Perhaps the count or time interval should depend on the file
+ * size?
+ */
+#ifdef RETRY_CREATEFILE
+ for (cf_tries = IZ_CREATEFILE_TRY_COUNT; cf_tries > 0 ; cf_tries--)
+ {
+#endif /* def RETRY_CREATEFILE */
+
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ hFile = CreateFileW(
+#else
+ hFile = CreateFileA(
+#endif
+ FileName,
+ ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER | READ_CONTROL,
+ FILE_SHARE_READ | FILE_SHARE_DELETE, /* no sd updating allowed here */
+ NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS,
+ NULL
);
+#ifdef RETRY_CREATEFILE
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ if (GetLastError() != ERROR_SHARING_VIOLATION)
+ break; /* Not a sharing error. Get out now. Otherwise: */
+ Sleep( IZ_CREATEFILE_TRY_TIME_MS); /* Sleep, then retry. */
+ }
+ else
+ {
+ break; /* Not a sharing error. (Success?) Get out now. */
+ }
+ }
+#endif /* def RETRY_CREATEFILE */
+
if(hFile != INVALID_HANDLE_VALUE) {
/* no remote way to determine SeRestorePrivilege -- just try a
read/write to simulate it */
/* see if we have the SeSecurityPrivilege */
/* note we don't need this if we have SeRestorePrivilege */
- hFile = CreateFileA(
- FileName,
- ACCESS_SYSTEM_SECURITY,
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, /* max */
- NULL,
- OPEN_EXISTING,
- 0,
- NULL
+/* 2013-07-08 SMS. See note above. */
+#ifdef RETRY_CREATEFILE
+ for (cf_tries = IZ_CREATEFILE_TRY_COUNT; cf_tries > 0 ; cf_tries--)
+ {
+#endif /* def RETRY_CREATEFILE */
+
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ hFile = CreateFileW(
+#else
+ hFile = CreateFileA(
+#endif
+ FileName,
+ ACCESS_SYSTEM_SECURITY,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, /* max */
+ NULL,
+ OPEN_EXISTING,
+ 0,
+ NULL
);
+#ifdef RETRY_CREATEFILE
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ if (GetLastError() != ERROR_SHARING_VIOLATION)
+ break; /* Not a sharing error. Get out now. Otherwise: */
+ Sleep( IZ_CREATEFILE_TRY_TIME_MS); /* Sleep, then retry. */
+ }
+ else
+ {
+ break; /* Not a sharing error. (Success?) Get out now. */
+ }
+ }
+#endif /* def RETRY_CREATEFILE */
+
if(hFile != INVALID_HANDLE_VALUE) {
CloseHandle(hFile);
*dwRemotePrivileges |= OVERRIDE_SACL;
BOOL GetVolumeCaps(
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ wchar_t *rootpath, /* filepath, or NULL */
+ wchar_t *name, /* filename associated with rootpath */
+#else
char *rootpath, /* filepath, or NULL */
char *name, /* filename associated with rootpath */
+#endif
PVOLUMECAPS VolumeCaps /* result structure describing capabilities */
)
{
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ wchar_t TempRootPath[MAX_PATH + 1];
+#else
char TempRootPath[MAX_PATH + 1];
+#endif
DWORD cchTempRootPath = 0;
BOOL bSuccess = TRUE; /* assume success until told otherwise */
if(rootpath != NULL && rootpath[0] != '\0') {
DWORD i;
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ cchTempRootPath = lstrlenW(rootpath);
+#else
cchTempRootPath = lstrlenA(rootpath);
+#endif
if(cchTempRootPath > MAX_PATH) return FALSE;
/* copy input, converting forward slashes to back slashes as we go */
EnterCriticalSection( &VolumeCapsLock );
if(!g_VolumeCaps.bValid ||
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ lstrcmpiW(g_VolumeCaps.RootPath, TempRootPath) != 0)
+#else
lstrcmpiA(g_VolumeCaps.RootPath, TempRootPath) != 0)
+#endif
{
/* no match found, build up new entry */
/* release lock during expensive operations */
LeaveCriticalSection( &VolumeCapsLock );
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ bSuccess = GetVolumeInformationW(
+#else
bSuccess = GetVolumeInformationA(
+#endif
(TempRootPath[0] == '\0') ? NULL : TempRootPath,
NULL, 0,
NULL, NULL,
if(bSuccess && (dwFileSystemFlags & FS_PERSISTENT_ACLS) &&
VolumeCaps->bUsePrivileges)
{
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if(GetDriveTypeW( (TempRootPath[0] == '\0') ? NULL : TempRootPath )
+#else
if(GetDriveTypeA( (TempRootPath[0] == '\0') ? NULL : TempRootPath )
+#endif
== DRIVE_REMOTE)
{
bRemote = TRUE;
/* replace the existing data if successful */
if(bSuccess) {
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ lstrcpynW(g_VolumeCaps.RootPath, TempRootPath, cchTempRootPath+1);
+#else
lstrcpynA(g_VolumeCaps.RootPath, TempRootPath, cchTempRootPath+1);
+#endif
g_VolumeCaps.dwFileSystemFlags = dwFileSystemFlags;
g_VolumeCaps.bRemote = bRemote;
g_VolumeCaps.dwRemotePrivileges = dwRemotePrivileges;
}
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+BOOL SecuritySet(wchar_t *resource, PVOLUMECAPS VolumeCaps, uch *securitydata)
+#else
BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata)
+#endif
{
HANDLE hFile;
DWORD dwDesiredAccess = 0;
BOOL bSaclPrivilege = FALSE;
BOOL bSuccess;
+/* 2013-07-08 SMS. See note above. */
+#ifdef RETRY_CREATEFILE
+ int cf_tries;
+#endif
+
if(!bInitialized) if(!Initialize()) return FALSE;
/* defer directory processing */
if(bRestorePrivilege)
dwFlags |= FILE_FLAG_BACKUP_SEMANTICS;
+/* 2013-07-08 SMS. See note above. */
+#ifdef RETRY_CREATEFILE
+ for (cf_tries = IZ_CREATEFILE_TRY_COUNT; cf_tries > 0 ; cf_tries--)
+ {
+#endif /* def RETRY_CREATEFILE */
+
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ hFile = CreateFileW(
+#else
hFile = CreateFileA(
+#endif
resource,
dwDesiredAccess,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,/* max sharing */
NULL
);
+#ifdef RETRY_CREATEFILE
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ if (GetLastError() != ERROR_SHARING_VIOLATION)
+ break; /* Not a sharing error. Get out now. Otherwise: */
+ Sleep( IZ_CREATEFILE_TRY_TIME_MS); /* Sleep, then retry. */
+ }
+ }
+#endif /* def RETRY_CREATEFILE */
+
if(hFile == INVALID_HANDLE_VALUE)
return FALSE;
/*
- Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2010 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2000-Apr-09 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
BOOL bRemote; /* is volume remote? */
DWORD dwRemotePrivileges; /* relevant only on remote volumes */
DWORD dwFileAttributes;
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ wchar_t RootPath[MAX_PATH+1]; /* path to network / filesystem */
+#else
char RootPath[MAX_PATH+1]; /* path to network / filesystem */
+#endif
} VOLUMECAPS, *PVOLUMECAPS, *LPVOLUMECAPS;
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+BOOL SecuritySet(wchar_t *resource, PVOLUMECAPS VolumeCaps, uch *securitydata);
+BOOL GetVolumeCaps(wchar_t *rootpath, wchar_t *name, PVOLUMECAPS VolumeCaps);
+#else
BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata);
BOOL GetVolumeCaps(char *rootpath, char *name, PVOLUMECAPS VolumeCaps);
+#endif
BOOL ValidateSecurity(uch *securitydata);
#endif /* _NT_H */
--- /dev/null
+@echo off
+
+rem # UnZip test script (Windows command).
+rem #
+rem #-----------------------------------------------------------------------
+rem # Copyright (c) 2012-2013 Info-ZIP. All rights reserved.
+rem #
+rem # See the accompanying file LICENSE, version 2009-Jan-2 or later (the
+rem # contents of which are also included in zip.h) for terms of use. If,
+rem # for some reason, all these files are missing, the Info-ZIP license
+rem # may also be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+rem #-----------------------------------------------------------------------
+rem #
+rem # %1 = test archive name. Default: testmake.zip
+rem # %2 = program directory (relative). Default: .
+rem # %3 = non-null to skip funzip and SFX tests.
+rem #
+rem # 2013-06-12 SMS. New. Adapted from unix/test_unzip.sh
+rem #
+rem # Typical usage:
+rem # win32\test_unzip.cmd testmake.zip win32\vc10\Debug
+rem # win32\test_unzip.cmd testmake_ppmd.zip win32\vc10\Debug NOFUNSFX
+
+setlocal enabledelayedexpansion
+
+set t_a=testmake.zip
+set prd=.
+
+if "%1" == "" (
+ set test_archive=%t_a%
+) else (
+ if "%1" == """" (
+ set test_archive=%t_a%
+ ) else (
+ set test_archive=%1
+ )
+)
+
+if "%2" == "" (
+ set prod=%prd%
+) else (
+ if "%2" == """" (
+ set prod=%prd%
+ ) else (
+ set prod=%2
+ )
+)
+
+set /a pass=0
+set /a fail=0
+
+rem # Clean environment.
+
+set UNZIP=
+set UNZIPOPT=
+set ZIPINFO=
+set ZIPINFOOPT=
+
+rem # Check for existence of expected programs.
+
+if "%3" == "" (
+ set program_list=funzip unzip unzipsfx
+) else (
+ set program_list=unzip
+)
+
+for %%p in (%program_list%) do (
+ set prog=%%p
+ set prog_pth=!prod!\%%p.exe
+ if exist !prog_pth! (
+ echo ^>^>^> Found executable: !prog!
+ ) else (
+ echo ^>^>^> CAN'T FIND EXECUTABLE: !prog_pth!
+ )
+)
+
+if exist %test_archive% (
+ echo ^>^>^> Found test archive: %test_archive%
+) else (
+ echo ^>^>^> CAN'T FIND TEST ARCHIVE: %test_archive%
+)
+
+rem # Create and move into a temporary test directory.
+
+set dir_orig=%CD%
+set tmp_dir=test_dir_%RANDOM%
+mkdir %tmp_dir%
+cd %tmp_dir%
+
+rem # Expected test archive member names.
+
+set member_1=notes
+set member_2=testmake.zipinfo
+
+rem # Test simple UnZip extraction.
+
+echo.
+echo ^>^>^> UnZip extraction test...'
+
+..\%prod%\unzip -b ..\%test_archive% %member_1%
+set status=!ERRORLEVEL!
+
+if not !status! == 0 (
+ echo ^>^>^> Fail: UnZip exit status = !status!.
+ set /a fail=%fail% + 1
+) else (
+ set bad=0
+ if not exist %member_1% set bad=1
+ if exist %member_2% set bad=2
+ if !bad! == 0 (
+ echo ^>^>^> Pass.
+ set /a pass=%pass% + 1
+ ) else (
+ echo ^>^>^> Fail: Can't find ^(only^) expected extracted file: %member_1%
+ set /a fail=%fail% + 1
+ )
+)
+
+rem # Test UnZip extraction with "-x" option.
+rem # (Use "-a" to get proper local line endings for "-Z" test below.)
+
+echo.
+echo ^>^>^> UnZip "-x" extraction test...
+
+..\%prod%\unzip -ao ..\%test_archive% -x %member_1%
+set status=!ERRORLEVEL!
+
+if not !status! == 0 (
+ echo ^>^>^> Fail: UnZip exit status = !status!.
+ set /a fail=%fail% + 1
+) else (
+ set bad=0
+ if not exist %member_2% set bad=1
+ if !bad! == 0 (
+ echo ^>^>^> Pass.
+ set /a pass=%pass% + 1
+ ) else (
+ echo ^>^>^> Fail: Can't find expected extracted file: %member_2%
+ set /a fail=%fail% + 1
+ )
+)
+
+rem # Test UnZip extraction with "-d dest_dir" option.
+
+echo.
+echo ^>^>^> UnZip "-d dest_dir" extraction test...
+
+if exist %member_1% (
+
+ ..\%prod%\unzip -bo ..\%test_archive% -d dest_dir %member_1%
+ set status=!ERRORLEVEL!
+
+ if not !status! == 0 (
+ echo ^>^>^> Fail: UnZip exit status = !status!.
+ set /a fail=%fail% + 1
+ ) else (
+ if exist dest_dir\%member_1% (
+ echo N > no
+ comp /a /l %member_1% dest_dir\%member_1% < no > NUL 2>&1
+ set status=!ERRORLEVEL!
+ del /f no
+
+ if !status! == 0 (
+ echo ^>^>^> Pass.
+ set /a pass=%pass% + 1
+ ) else (
+ echo ^>^>^> Fail: Extracted file contents mismatch.
+ set /a fail=%fail% + 1
+ )
+ ) else (
+ echo ^>^>^> Fail: Can't find expected extracted file: dest_dir/%member_1%
+ set /a fail=%fail% + 1
+ )
+ )
+) else (
+ echo ^>^>^> Fail: The UnZip "-d" test relies on success in the UnZip "-x" test."
+ set /a fail=%fail% + 1
+)
+
+rem # Test UnZip extraction with "-o" option.
+
+echo.
+echo ^>^>^> UnZip "-o" extraction test...
+
+..\%prod%\unzip -bo ..\%test_archive% %member_1%
+set status=!ERRORLEVEL!
+
+if not !status! == 0 (
+ echo ^>^>^> Fail: UnZip exit status = !status!.
+ set /a fail=%fail% + 1
+) else (
+ if exist %member_1% (
+ echo ^>^>^> Pass.
+ set /a pass=%pass% + 1
+ ) else (
+ echo ^>^>^> Fail: Can't find expected extracted file: %member_1%
+ set /a fail=%fail% + 1
+ )
+)
+
+rem # Test ZipInfo ("unzip -Z").
+
+echo.
+echo ^>^>^> ZipInfo ("unzip -Z") test...
+
+if exist %member_2% (
+
+ cd ..
+ %prod%\unzip -Z -mc- %test_archive% > %tmp_dir%\testmake.unzip-Z
+ set status=!ERRORLEVEL!
+ cd %tmp_dir%
+
+ if not !status! == 0 (
+ echo ^>^>^> Fail: UnZip exit status = !status!.
+ set /a fail=%fail% + 1
+ ) else (
+ echo N > no
+ comp /a /l testmake.unzip-Z %member_2% < no > NUL 2>&1
+ set status=!ERRORLEVEL!
+ del /f no
+
+ if !status! == 0 (
+ echo ^>^>^> Pass.
+ set /a pass=%pass% + 1
+ ) else (
+ echo ^>^>^> Fail: ZipInfo output mismatch."
+
+echo ^>^>^> ### ZipInfo output does not match the expected output.
+echo ^>^>^> ### ^(If the only difference is in the date-time values, then this may
+echo ^>^>^> ### be caused by a time-zone difference, which may not be important.^)
+
+ set /a fail=%fail% + 1
+ )
+ )
+) else (
+ echo ^>^>^> Fail: The ZipInfo test relies on success in the UnZip test."
+ set /a fail=%fail% + 1
+)
+
+rem echo on
+
+rem # Test FunZip extraction.
+
+if "%3" == "" (
+ echo.
+ echo ^>^>^> FunZip extraction test...
+ echo ^>^>^> ^(Expect a "zipfile has more than one entry" warning.^)
+
+ if exist %member_1% (
+
+ ..\%prod%\funzip < ..\%test_archive% > dest_dir\%member_1%_fun
+ set status=!ERRORLEVEL!
+
+ if not !status! == 0 (
+ echo ^>^>^> Fail: FunZip exit status = !status!.
+ set /a fail=%fail% + 1
+ ) else (
+ if exist dest_dir\%member_1%_fun (
+ echo N > no
+ comp /a /l %member_1% dest_dir\%member_1%_fun < no > NUL 2>&1
+ set status=!ERRORLEVEL!
+ del /f no
+
+ if !status! == 0 (
+ echo ^>^>^> Pass.
+ set /a pass=%pass% + 1
+ ) else (
+ echo ^>^>^> Fail: Extracted file contents mismatch.
+ set /a fail=%fail% + 1
+ )
+
+ ) else (
+ echo ^>^>^> Fail: Can't find expected extracted file: dest_dir\%member_1%_fun
+ set /a fail=%fail% + 1
+ )
+ )
+ ) else (
+ echo ^>^>^> Fail: The FunZip test relies on success in the UnZip test.
+ set /a fail=%fail% + 1
+ )
+)
+
+
+rem # Test UnZipSFX.
+
+if "%3" == "" (
+ echo.
+ echo ^>^>^> UnZipSFX test...
+
+ if exist dest_dir\%member_1% (
+
+ if exist %member_1% del %member_1%
+ if exist %member_2% del %member_2%
+
+ copy /b ..\%prod%\unzipsfx.exe + ..\%test_archive% test_sfx.exe > NUL
+ .\test_sfx -b %member_1%
+ set status=!ERRORLEVEL!
+
+ if not !status! == 0 (
+ echo ^>^>^> Fail: UnZipSFX exit status = !status!.
+ set /a fail=%fail% + 1
+ ) else (
+ if exist %member_1% (
+ echo N > no
+ comp /a /l %member_1% dest_dir\%member_1% < no > NUL 2>&1
+ set status=!ERRORLEVEL!
+ del /f no
+
+ if !status! == 0 (
+ echo ^>^>^> Pass.
+ set /a pass=%pass% + 1
+ ) else (
+ echo ^>^>^> Fail: Extracted file contents mismatch."
+ set /a fail=%fail% + 1
+ )
+ ) else (
+ echo ^>^>^> Fail: Can't find expected extracted file: %member_1%
+ set /a fail=%fail% + 1
+ )
+ )
+ ) else (
+ echo ^>^>^> Fail: The UnZipSFX test relies on success in the UnZip "-d" test.
+ set /a fail=%fail% + 1
+ )
+)
+
+rem Expected results.
+
+set fail_expected=0
+if "%3" == "" (
+ set pass_expected=7
+) else (
+ set pass_expected=5
+)
+
+rem Result summary.
+
+echo.
+echo ^>^>^> Test Results: Pass: %pass%, Fail: %fail%
+set exit_status=0
+if not %pass% == %pass_expected% set exit_status=1
+if not %fail% == %fail_expected% set exit_status=1
+if not %exit_status% == 0 (
+ echo ^>^>^> ### Expected: Pass: %pass_expected%, Fail: %fail_expected%
+)
+echo.
+
+rem # Clean up.
+
+cd %dir_orig%
+if exist %tmp_dir% rmdir /q /s %tmp_dir%
+
+rem # Exit with an appropriate status value.
+
+exit /b %exit_status%
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EDCE1136-BD07-469D-B8E6-57A161C577D0}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>funzip</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <IncludePath>..\..\..\bzip2;$(IncludePath)</IncludePath>
+ <LibraryPath>$(SolutionDir)\$(Configuration);$(LibraryPath)</LibraryPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;FUNZIP;ASM_CRC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;FUNZIP;ASM_CRC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\crc32.h" />
+ <ClInclude Include="..\..\..\crypt.h" />
+ <ClInclude Include="..\..\..\globals.h" />
+ <ClInclude Include="..\..\..\inflate.h" />
+ <ClInclude Include="..\..\..\ttyio.h" />
+ <ClInclude Include="..\..\..\unzip.h" />
+ <ClInclude Include="..\..\..\unzpriv.h" />
+ <ClInclude Include="..\..\..\zip.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\crc32.c" />
+ <ClCompile Include="..\..\..\crypt.c" />
+ <ClCompile Include="..\..\..\funzip.c" />
+ <ClCompile Include="..\..\..\globals.c" />
+ <ClCompile Include="..\..\..\inflate.c" />
+ <ClCompile Include="..\..\..\ttyio.c" />
+ <ClCompile Include="..\..\..\wrap\crc_i386.c" />
+ <ClCompile Include="..\..\win32.c" />
+ <ClCompile Include="..\..\win32i64.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\crc32.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\crypt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\globals.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\inflate.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\ttyio.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzpriv.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\zip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\crc32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\crypt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\funzip.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\globals.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\inflate.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\ttyio.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\crc_i386.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\win32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\win32i64.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{645768EE-A938-492D-A6F5-F97964E2FAAD}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>libbz2</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\bzip2\bzlib.h" />
+ <ClInclude Include="..\..\..\bzip2\bzlib_private.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\bzip2\blocksort.c" />
+ <ClCompile Include="..\..\..\bzip2\bzlib.c" />
+ <ClCompile Include="..\..\..\bzip2\compress.c" />
+ <ClCompile Include="..\..\..\bzip2\crctable.c" />
+ <ClCompile Include="..\..\..\bzip2\decompress.c" />
+ <ClCompile Include="..\..\..\bzip2\huffman.c" />
+ <ClCompile Include="..\..\..\bzip2\randtable.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\bzip2\bzlib.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\bzip2\bzlib_private.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\bzip2\blocksort.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\bzlib.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\compress.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\crctable.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\decompress.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\huffman.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\randtable.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip.vcxproj", "{B55AC1E0-01E0-4BDC-9E68-BB8C450A79D7}"
+ ProjectSection(ProjectDependencies) = postProject
+ {645768EE-A938-492D-A6F5-F97964E2FAAD} = {645768EE-A938-492D-A6F5-F97964E2FAAD}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbz2", "libbz2\libbz2.vcxproj", "{645768EE-A938-492D-A6F5-F97964E2FAAD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzipsfx", "unzipsfx\unzipsfx.vcxproj", "{D0C91394-54C1-41A2-A9EC-0810FE2ACFAC}"
+ ProjectSection(ProjectDependencies) = postProject
+ {645768EE-A938-492D-A6F5-F97964E2FAAD} = {645768EE-A938-492D-A6F5-F97964E2FAAD}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "funzip", "funzip\funzip.vcxproj", "{EDCE1136-BD07-469D-B8E6-57A161C577D0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B55AC1E0-01E0-4BDC-9E68-BB8C450A79D7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B55AC1E0-01E0-4BDC-9E68-BB8C450A79D7}.Debug|Win32.Build.0 = Debug|Win32
+ {B55AC1E0-01E0-4BDC-9E68-BB8C450A79D7}.Release|Win32.ActiveCfg = Release|Win32
+ {B55AC1E0-01E0-4BDC-9E68-BB8C450A79D7}.Release|Win32.Build.0 = Release|Win32
+ {645768EE-A938-492D-A6F5-F97964E2FAAD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {645768EE-A938-492D-A6F5-F97964E2FAAD}.Debug|Win32.Build.0 = Debug|Win32
+ {645768EE-A938-492D-A6F5-F97964E2FAAD}.Release|Win32.ActiveCfg = Release|Win32
+ {645768EE-A938-492D-A6F5-F97964E2FAAD}.Release|Win32.Build.0 = Release|Win32
+ {D0C91394-54C1-41A2-A9EC-0810FE2ACFAC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D0C91394-54C1-41A2-A9EC-0810FE2ACFAC}.Debug|Win32.Build.0 = Debug|Win32
+ {D0C91394-54C1-41A2-A9EC-0810FE2ACFAC}.Release|Win32.ActiveCfg = Release|Win32
+ {D0C91394-54C1-41A2-A9EC-0810FE2ACFAC}.Release|Win32.Build.0 = Release|Win32
+ {EDCE1136-BD07-469D-B8E6-57A161C577D0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EDCE1136-BD07-469D-B8E6-57A161C577D0}.Debug|Win32.Build.0 = Debug|Win32
+ {EDCE1136-BD07-469D-B8E6-57A161C577D0}.Release|Win32.ActiveCfg = Release|Win32
+ {EDCE1136-BD07-469D-B8E6-57A161C577D0}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{B55AC1E0-01E0-4BDC-9E68-BB8C450A79D7}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>unzip</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <IncludePath>..\..\..\bzip2;$(IncludePath)</IncludePath>
+ <LibraryPath>$(SolutionDir)\$(Configuration);$(LibraryPath)</LibraryPath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <IncludePath>..\..\..\bzip2;$(IncludePath)</IncludePath>
+ <LibraryPath>$(SolutionDir)\$(Configuration);$(LibraryPath)</LibraryPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\aes_wg\aes.h" />
+ <ClInclude Include="..\..\..\aes_wg\aesopt.h" />
+ <ClInclude Include="..\..\..\aes_wg\brg_endian.h" />
+ <ClInclude Include="..\..\..\aes_wg\fileenc.h" />
+ <ClInclude Include="..\..\..\aes_wg\hmac.h" />
+ <ClInclude Include="..\..\..\aes_wg\iz_aes_wg.h" />
+ <ClInclude Include="..\..\..\aes_wg\prng.h" />
+ <ClInclude Include="..\..\..\aes_wg\pwd2key.h" />
+ <ClInclude Include="..\..\..\aes_wg\sha1.h" />
+ <ClInclude Include="..\..\..\bzip2\bzlib.h" />
+ <ClInclude Include="..\..\..\consts.h" />
+ <ClInclude Include="..\..\..\crc32.h" />
+ <ClInclude Include="..\..\..\crypt.h" />
+ <ClInclude Include="..\..\..\ebcdic.h" />
+ <ClInclude Include="..\..\..\globals.h" />
+ <ClInclude Include="..\..\..\inflate.h" />
+ <ClInclude Include="..\..\..\szip\CpuArch.h" />
+ <ClInclude Include="..\..\..\szip\LzFind.h" />
+ <ClInclude Include="..\..\..\szip\LzHash.h" />
+ <ClInclude Include="..\..\..\szip\LzmaDec.h" />
+ <ClInclude Include="..\..\..\szip\Ppmd.h" />
+ <ClInclude Include="..\..\..\szip\Ppmd8.h" />
+ <ClInclude Include="..\..\..\szip\SzVersion.h" />
+ <ClInclude Include="..\..\..\szip\Types.h" />
+ <ClInclude Include="..\..\..\ttyio.h" />
+ <ClInclude Include="..\..\..\unzip.h" />
+ <ClInclude Include="..\..\..\unzpriv.h" />
+ <ClInclude Include="..\..\..\unzvers.h" />
+ <ClInclude Include="..\..\..\zip.h" />
+ <ClInclude Include="..\..\nt.h" />
+ <ClInclude Include="..\..\rsxntwin.h" />
+ <ClInclude Include="..\..\w32cfg.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\crc32.c" />
+ <ClCompile Include="..\..\..\crypt.c" />
+ <ClCompile Include="..\..\..\envargs.c" />
+ <ClCompile Include="..\..\..\explode.c" />
+ <ClCompile Include="..\..\..\extract.c" />
+ <ClCompile Include="..\..\..\fileio.c" />
+ <ClCompile Include="..\..\..\globals.c" />
+ <ClCompile Include="..\..\..\inflate.c" />
+ <ClCompile Include="..\..\..\list.c" />
+ <ClCompile Include="..\..\..\match.c" />
+ <ClCompile Include="..\..\..\process.c" />
+ <ClCompile Include="..\..\..\ttyio.c" />
+ <ClCompile Include="..\..\..\ubz2err.c" />
+ <ClCompile Include="..\..\..\unreduce.c" />
+ <ClCompile Include="..\..\..\unshrink.c" />
+ <ClCompile Include="..\..\..\unzip.c" />
+ <ClCompile Include="..\..\..\wrap\aescrypt.c" />
+ <ClCompile Include="..\..\..\wrap\aeskey.c" />
+ <ClCompile Include="..\..\..\wrap\aestab.c" />
+ <ClCompile Include="..\..\..\wrap\crc_i386.c" />
+ <ClCompile Include="..\..\..\wrap\fileenc.c" />
+ <ClCompile Include="..\..\..\wrap\hmac.c" />
+ <ClCompile Include="..\..\..\wrap\LzFind.c" />
+ <ClCompile Include="..\..\..\wrap\LzmaDec.c" />
+ <ClCompile Include="..\..\..\wrap\Ppmd8.c" />
+ <ClCompile Include="..\..\..\wrap\Ppmd8Dec.c" />
+ <ClCompile Include="..\..\..\wrap\prng.c" />
+ <ClCompile Include="..\..\..\wrap\pwd2key.c" />
+ <ClCompile Include="..\..\..\wrap\sha1.c" />
+ <ClCompile Include="..\..\..\zipinfo.c" />
+ <ClCompile Include="..\..\nt.c" />
+ <ClCompile Include="..\..\win32.c" />
+ <ClCompile Include="..\..\win32i64.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\nt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\w32cfg.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\rsxntwin.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\aes.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\aesopt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\brg_endian.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\fileenc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\hmac.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\prng.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\pwd2key.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\sha1.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\CpuArch.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzFind.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzHash.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzmaDec.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Ppmd8.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Ppmd.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\SzVersion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Types.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\consts.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\crc32.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\crypt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\ebcdic.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\globals.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\inflate.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\ttyio.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\zip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\bzip2\bzlib.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzpriv.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzvers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\iz_aes_wg.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\crc32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\crypt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\envargs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\explode.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\extract.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\fileio.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\globals.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\inflate.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\list.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\match.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\process.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\ttyio.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\ubz2err.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unreduce.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unshrink.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unzip.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\zipinfo.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\nt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\win32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\win32i64.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\aescrypt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\aeskey.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\aestab.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\crc_i386.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\fileenc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\hmac.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\LzFind.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\LzmaDec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\Ppmd8.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\Ppmd8Dec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\prng.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\pwd2key.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\sha1.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{D0C91394-54C1-41A2-A9EC-0810FE2ACFAC}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>unzipsfx</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <IncludePath>..\..\..\bzip2;$(IncludePath)</IncludePath>
+ <LibraryPath>$(SolutionDir)$(Configuration);$(LibraryPath)</LibraryPath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;SFX;DIAG_SFX;ASM_CRC;x_BZIP2_SUPPORT;x_BZIP2_SFX;x_CHEAP_SFX_AUTORUN;x_CRYPT_AES_WG;x_CRYPT_AES_WG_SFX;x_CRYPT_TRAD_SFX;x_LZMA_SUPPORT;x_LZMA_SFX;x_PPMD_SUPPORT;x_PPMD_SFX;x_SYMLINKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;SFX;ASM_CRC;x_BZIP2_SUPPORT;x_BZIP2_SFX;x_CHEAP_SFX_AUTORUN;x_CRYPT_AES_WG;x_CRYPT_AES_WG_SFX;x_CRYPT_TRAD_SFX;x_LZMA_SUPPORT;x_LZMA_SFX;x_PPMD_SUPPORT;x_PPMD_SFX;x_SYMLINKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\aes_wg\aes.h" />
+ <ClInclude Include="..\..\..\aes_wg\aesopt.h" />
+ <ClInclude Include="..\..\..\aes_wg\brg_endian.h" />
+ <ClInclude Include="..\..\..\aes_wg\fileenc.h" />
+ <ClInclude Include="..\..\..\aes_wg\hmac.h" />
+ <ClInclude Include="..\..\..\aes_wg\prng.h" />
+ <ClInclude Include="..\..\..\aes_wg\pwd2key.h" />
+ <ClInclude Include="..\..\..\aes_wg\sha1.h" />
+ <ClInclude Include="..\..\..\bzip2\bzlib.h" />
+ <ClInclude Include="..\..\..\consts.h" />
+ <ClInclude Include="..\..\..\crc32.h" />
+ <ClInclude Include="..\..\..\crypt.h" />
+ <ClInclude Include="..\..\..\ebcdic.h" />
+ <ClInclude Include="..\..\..\globals.h" />
+ <ClInclude Include="..\..\..\inflate.h" />
+ <ClInclude Include="..\..\..\szip\CpuArch.h" />
+ <ClInclude Include="..\..\..\szip\LzFind.h" />
+ <ClInclude Include="..\..\..\szip\LzHash.h" />
+ <ClInclude Include="..\..\..\szip\LzmaDec.h" />
+ <ClInclude Include="..\..\..\szip\Ppmd.h" />
+ <ClInclude Include="..\..\..\szip\Ppmd8.h" />
+ <ClInclude Include="..\..\..\szip\SzVersion.h" />
+ <ClInclude Include="..\..\..\szip\Types.h" />
+ <ClInclude Include="..\..\..\ttyio.h" />
+ <ClInclude Include="..\..\..\unzip.h" />
+ <ClInclude Include="..\..\..\unzpriv.h" />
+ <ClInclude Include="..\..\..\unzvers.h" />
+ <ClInclude Include="..\..\..\zip.h" />
+ <ClInclude Include="..\..\nt.h" />
+ <ClInclude Include="..\..\rsxntwin.h" />
+ <ClInclude Include="..\..\w32cfg.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\crc32.c" />
+ <ClCompile Include="..\..\..\crypt.c" />
+ <ClCompile Include="..\..\..\envargs.c" />
+ <ClCompile Include="..\..\..\explode.c" />
+ <ClCompile Include="..\..\..\extract.c" />
+ <ClCompile Include="..\..\..\fileio.c" />
+ <ClCompile Include="..\..\..\globals.c" />
+ <ClCompile Include="..\..\..\inflate.c" />
+ <ClCompile Include="..\..\..\match.c" />
+ <ClCompile Include="..\..\..\process.c" />
+ <ClCompile Include="..\..\..\ttyio.c" />
+ <ClCompile Include="..\..\..\ubz2err.c" />
+ <ClCompile Include="..\..\..\unreduce.c" />
+ <ClCompile Include="..\..\..\unshrink.c" />
+ <ClCompile Include="..\..\..\unzip.c" />
+ <ClCompile Include="..\..\..\wrap\aescrypt.c" />
+ <ClCompile Include="..\..\..\wrap\aeskey.c" />
+ <ClCompile Include="..\..\..\wrap\aestab.c" />
+ <ClCompile Include="..\..\..\wrap\crc_i386.c" />
+ <ClCompile Include="..\..\..\wrap\fileenc.c" />
+ <ClCompile Include="..\..\..\wrap\hmac.c" />
+ <ClCompile Include="..\..\..\wrap\LzFind.c" />
+ <ClCompile Include="..\..\..\wrap\LzmaDec.c" />
+ <ClCompile Include="..\..\..\wrap\Ppmd8.c" />
+ <ClCompile Include="..\..\..\wrap\Ppmd8Dec.c" />
+ <ClCompile Include="..\..\..\wrap\prng.c" />
+ <ClCompile Include="..\..\..\wrap\pwd2key.c" />
+ <ClCompile Include="..\..\..\wrap\sha1.c" />
+ <ClCompile Include="..\..\nt.c" />
+ <ClCompile Include="..\..\win32.c" />
+ <ClCompile Include="..\..\win32i64.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\aes_wg\aes.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\zip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\aesopt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\brg_endian.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\bzip2\bzlib.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\consts.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\CpuArch.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\crc32.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\crypt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\ebcdic.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\fileenc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\globals.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\hmac.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\inflate.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzFind.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzHash.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzmaDec.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\nt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Ppmd.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Ppmd8.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\prng.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\pwd2key.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\rsxntwin.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\sha1.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\SzVersion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\ttyio.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Types.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzpriv.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzvers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\w32cfg.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\wrap\aescrypt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\win32i64.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\aeskey.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\aestab.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\crc32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\crc_i386.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\crypt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\envargs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\explode.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\extract.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\fileenc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\fileio.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\globals.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\hmac.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\inflate.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\LzFind.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\LzmaDec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\match.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\nt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\Ppmd8.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\Ppmd8Dec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\prng.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\process.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\pwd2key.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\sha1.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\ttyio.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\ubz2err.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unreduce.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unshrink.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unzip.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\win32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
-# Microsoft Developer Studio Project File - Name="bz2lib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** NICHT BEARBEITEN **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=bz2lib - Win32 Debug
-!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
-!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
-!MESSAGE
-!MESSAGE NMAKE /f "bz2lib.mak".
-!MESSAGE
-!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
-!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
-!MESSAGE
-!MESSAGE NMAKE /f "bz2lib.mak" CFG="bz2lib - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Für die Konfiguration stehen zur Auswahl:
-!MESSAGE
-!MESSAGE "bz2lib - Win32 Release" (basierend auf "Win32 (x86) Static Library")
-!MESSAGE "bz2lib - Win32 Debug" (basierend auf "Win32 (x86) Static Library")
-!MESSAGE "bz2lib - Win32 ASM Release" (basierend auf "Win32 (x86) Static Library")
-!MESSAGE "bz2lib - Win32 ASM Debug" (basierend auf "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "bz2lib - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "bz2lib__Win32_Release"
-# PROP BASE Intermediate_Dir "bz2lib__Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "bz2lib__Win32_Release"
-# PROP Intermediate_Dir "bz2lib__Win32_Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /Oy- /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"bz2lib__Win32_Release\bz2.lib"
-
-!ELSEIF "$(CFG)" == "bz2lib - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "bz2lib__Win32_Debug"
-# PROP BASE Intermediate_Dir "bz2lib__Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "bz2lib__Win32_Debug"
-# PROP Intermediate_Dir "bz2lib__Win32_Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"bz2lib__Win32_Debug\bz2.lib"
-
-!ELSEIF "$(CFG)" == "bz2lib - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "bz2lib___Win32_ASM_Release"
-# PROP BASE Intermediate_Dir "bz2lib___Win32_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "bz2lib__Win32_Release"
-# PROP Intermediate_Dir "bz2lib__Win32_Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /Oy- /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /W3 /GX /O2 /Oy- /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"bz2lib__Win32_Release\bz2.lib"
-# ADD LIB32 /nologo /out:"bz2lib__Win32_Release\bz2.lib"
-
-!ELSEIF "$(CFG)" == "bz2lib - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "bz2lib___Win32_ASM_Debug"
-# PROP BASE Intermediate_Dir "bz2lib___Win32_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "bz2lib__Win32_Debug"
-# PROP Intermediate_Dir "bz2lib__Win32_Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /GZ /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"bz2lib__Win32_Debug\bz2.lib"
-# ADD LIB32 /nologo /out:"bz2lib__Win32_Debug\bz2.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "bz2lib - Win32 Release"
-# Name "bz2lib - Win32 Debug"
-# Name "bz2lib - Win32 ASM Release"
-# Name "bz2lib - Win32 ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\bzip2\blocksort.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\bzip2\bzlib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\bzip2\compress.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\bzip2\crctable.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\bzip2\decompress.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\bzip2\huffman.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\bzip2\randtable.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\bzip2\bzlib.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\bzip2\bzlib_private.h
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="bz2lib" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
+\r
+CFG=bz2lib - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "bz2lib.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "bz2lib.mak" CFG="bz2lib - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "bz2lib - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "bz2lib - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "bz2lib - Win32 ASM Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "bz2lib - Win32 ASM Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "bz2lib - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "bz2lib__Win32_Release"\r
+# PROP BASE Intermediate_Dir "bz2lib__Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "bz2lib__Win32_Release"\r
+# PROP Intermediate_Dir "bz2lib__Win32_Release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /Oy- /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /c\r
+# SUBTRACT CPP /YX /Yc /Yu\r
+# ADD BASE RSC /l 0x407 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo /out:"bz2lib__Win32_Release\bz2.lib"\r
+\r
+!ELSEIF "$(CFG)" == "bz2lib - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "bz2lib__Win32_Debug"\r
+# PROP BASE Intermediate_Dir "bz2lib__Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "bz2lib__Win32_Debug"\r
+# PROP Intermediate_Dir "bz2lib__Win32_Debug"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_LIB" /D "BZ_NO_STDIO" /D "_DEBUG" /D "WIN32" /D "_MBCS" /FD /GZ /c\r
+# SUBTRACT CPP /YX /Yc /Yu\r
+# ADD BASE RSC /l 0x407 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo /out:"bz2lib__Win32_Debug\bz2.lib"\r
+\r
+!ELSEIF "$(CFG)" == "bz2lib - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "bz2lib___Win32_ASM_Release"\r
+# PROP BASE Intermediate_Dir "bz2lib___Win32_ASM_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "bz2lib__Win32_Release"\r
+# PROP Intermediate_Dir "bz2lib__Win32_Release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /Oy- /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /c\r
+# SUBTRACT BASE CPP /YX /Yc /Yu\r
+# ADD CPP /nologo /W3 /GX /O2 /Oy- /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /c\r
+# SUBTRACT CPP /YX /Yc /Yu\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo /out:"bz2lib__Win32_Release\bz2.lib"\r
+# ADD LIB32 /nologo /out:"bz2lib__Win32_Release\bz2.lib"\r
+\r
+!ELSEIF "$(CFG)" == "bz2lib - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "bz2lib___Win32_ASM_Debug"\r
+# PROP BASE Intermediate_Dir "bz2lib___Win32_ASM_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "bz2lib__Win32_Debug"\r
+# PROP Intermediate_Dir "bz2lib__Win32_Debug"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /GZ /c\r
+# SUBTRACT BASE CPP /YX /Yc /Yu\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "BZ_NO_STDIO" /FD /GZ /c\r
+# SUBTRACT CPP /YX /Yc /Yu\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo /out:"bz2lib__Win32_Debug\bz2.lib"\r
+# ADD LIB32 /nologo /out:"bz2lib__Win32_Debug\bz2.lib"\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "bz2lib - Win32 Release"\r
+# Name "bz2lib - Win32 Debug"\r
+# Name "bz2lib - Win32 ASM Release"\r
+# Name "bz2lib - Win32 ASM Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\blocksort.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\bzlib.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\compress.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\crctable.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\decompress.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\huffman.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\randtable.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\bzlib.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\bzip2\bzlib_private.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
-# Microsoft Developer Studio Project File - Name="funzip" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=funzip - Win32 ASM Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "funzip.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "funzip.mak" CFG="funzip - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "funzip - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "funzip - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "funzip - Win32 ASM Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "funzip - Win32 ASM Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "funzip - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "funzip___Win32_Release"
-# PROP BASE Intermediate_Dir "funzip___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "funzip___Win32_Release"
-# PROP Intermediate_Dir "funzip___Win32_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "FUNZIP" /D "_CONSOLE" /D "_MBCS" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "funzip - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "funzip___Win32_Debug"
-# PROP BASE Intermediate_Dir "funzip___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "funzip___Win32_Debug"
-# PROP Intermediate_Dir "funzip___Win32_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "FUNZIP" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "funzip - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "funzip___Win32_ASM_Release"
-# PROP BASE Intermediate_Dir "funzip___Win32_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "funzip___Win32_ASM_Release"
-# PROP Intermediate_Dir "funzip___Win32_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "FUNZIP" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "FUNZIP" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "funzip - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "funzip___Win32_ASM_Debug"
-# PROP BASE Intermediate_Dir "funzip___Win32_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "funzip___Win32_ASM_Debug"
-# PROP Intermediate_Dir "funzip___Win32_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "FUNZIP" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "FUNZIP" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "funzip - Win32 Release"
-# Name "funzip - Win32 Debug"
-# Name "funzip - Win32 ASM Release"
-# Name "funzip - Win32 ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\crc_i386.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\funzip.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\globals.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ttyio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\crc32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\nt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ttyio.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzip.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzpriv.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\w32cfg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zip.h
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="funzip" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=funzip - Win32 ASM Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "funzip.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "funzip.mak" CFG="funzip - Win32 ASM Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "funzip - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "funzip - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "funzip - Win32 ASM Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "funzip - Win32 ASM Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "funzip - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "funzip___Win32_Release"\r
+# PROP BASE Intermediate_Dir "funzip___Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "funzip___Win32_Release"\r
+# PROP Intermediate_Dir "funzip___Win32_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "FUNZIP" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "funzip - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "funzip___Win32_Debug"\r
+# PROP BASE Intermediate_Dir "funzip___Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "funzip___Win32_Debug"\r
+# PROP Intermediate_Dir "funzip___Win32_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "FUNZIP" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "funzip - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "funzip___Win32_ASM_Release"\r
+# PROP BASE Intermediate_Dir "funzip___Win32_ASM_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "funzip___Win32_ASM_Release"\r
+# PROP Intermediate_Dir "funzip___Win32_ASM_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "FUNZIP" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "FUNZIP" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "funzip - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "funzip___Win32_ASM_Debug"\r
+# PROP BASE Intermediate_Dir "funzip___Win32_ASM_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "funzip___Win32_ASM_Debug"\r
+# PROP Intermediate_Dir "funzip___Win32_ASM_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "FUNZIP" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "FUNZIP" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "funzip - Win32 Release"\r
+# Name "funzip - Win32 Debug"\r
+# Name "funzip - Win32 ASM Release"\r
+# Name "funzip - Win32 ASM Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\crc_i386.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\funzip.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\win32.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzip.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzpriv.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\w32cfg.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zip.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
-# Microsoft Developer Studio Project File - Name="unzip" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=unzip - Win32 ASM Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "unzip.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "unzip.mak" CFG="unzip - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "unzip - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzip - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzip - Win32 ASM Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzip - Win32 ASM Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "unzip - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "unzip__Win32_Release"
-# PROP BASE Intermediate_Dir "unzip__Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "unzip__Win32_Release"
-# PROP Intermediate_Dir "unzip__Win32_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "unzip - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "unzip__Win32_Debug"
-# PROP BASE Intermediate_Dir "unzip__Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "unzip__Win32_Debug"
-# PROP Intermediate_Dir "unzip__Win32_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "unzip - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "unzip__Win32_ASM_Release"
-# PROP BASE Intermediate_Dir "unzip__Win32_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "unzip__Win32_ASM_Release"
-# PROP Intermediate_Dir "unzip__Win32_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "unzip - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "unzip__Win32_ASM_Debug"
-# PROP BASE Intermediate_Dir "unzip__Win32_ASM_Debug"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "unzip__Win32_ASM_Debug"
-# PROP Intermediate_Dir "unzip__Win32_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "unzip - Win32 Release"
-# Name "unzip - Win32 Debug"
-# Name "unzip - Win32 ASM Release"
-# Name "unzip - Win32 ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\crc_i386.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\envargs.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\explode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\extract.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\fileio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\globals.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\list.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\match.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\nt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ttyio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ubz2err.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unreduce.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unshrink.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzip.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32i64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zipinfo.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\consts.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crc32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ebcdic.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\nt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ttyio.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzip.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzpriv.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzvers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\w32cfg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zip.h
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="unzip" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=unzip - Win32 lzma Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzip.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzip.mak" CFG="unzip - Win32 lzma Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "unzip - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzip - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzip - Win32 ASM Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzip - Win32 ASM Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzip - Win32 lzma Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzip - Win32 lzma Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "unzip - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzip__Win32_Release"\r
+# PROP BASE Intermediate_Dir "unzip__Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzip__Win32_Release"\r
+# PROP Intermediate_Dir "unzip__Win32_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FR /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "unzip - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzip__Win32_Debug"\r
+# PROP BASE Intermediate_Dir "unzip__Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzip__Win32_Debug"\r
+# PROP Intermediate_Dir "unzip__Win32_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /FR /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unzip - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzip__Win32_ASM_Release"\r
+# PROP BASE Intermediate_Dir "unzip__Win32_ASM_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzip__Win32_ASM_Release"\r
+# PROP Intermediate_Dir "unzip__Win32_ASM_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "unzip - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzip__Win32_ASM_Debug"\r
+# PROP BASE Intermediate_Dir "unzip__Win32_ASM_Debug"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzip__Win32_ASM_Debug"\r
+# PROP Intermediate_Dir "unzip__Win32_ASM_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FR /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unzip - Win32 lzma Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzip___Win32_lzma_Debug"\r
+# PROP BASE Intermediate_Dir "unzip___Win32_lzma_Debug"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzip___Win32_lzma_Debug"\r
+# PROP Intermediate_Dir "unzip___Win32_lzma_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /FR /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "USE_LZMA" /FR /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unzip - Win32 lzma Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzip___Win32_lzma_Release"\r
+# PROP BASE Intermediate_Dir "unzip___Win32_lzma_Release"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzip___Win32_lzma_Release"\r
+# PROP Intermediate_Dir "unzip___Win32_lzma_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FR /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /D "USE_LZMA" /FR /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "unzip - Win32 Release"\r
+# Name "unzip - Win32 Debug"\r
+# Name "unzip - Win32 ASM Release"\r
+# Name "unzip - Win32 ASM Debug"\r
+# Name "unzip - Win32 lzma Debug"\r
+# Name "unzip - Win32 lzma Release"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\Alloc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\crc_i386.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\envargs.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\explode.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\extract.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\fileio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\list.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzFind.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzmaDec.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\match.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\process.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\SzFile.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ubz2err.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unreduce.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unshrink.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzip.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\win32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\win32i64.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zipinfo.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\Alloc.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\consts.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ebcdic.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzFind.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzHash.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzmaDec.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes\sha1.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\SzFile.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\SzVersion.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\Types.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzip.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzpriv.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzvers.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\w32cfg.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zip.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "bz2lib"=".\bz2lib.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "funzip"=".\funzip.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "unzip"=".\unzip.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "unzipbz2"=".\unzipbz2.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name bz2lib
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "unzipsfx"=".\unzipsfx.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r
+\r
+###############################################################################\r
+\r
+Project: "bz2lib"=.\bz2lib.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "funzip"=.\funzip.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "unzip"=.\unzip.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "unzipaes"=.\unzipaes.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "unzipbz2"=.\unzipbz2.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+ Begin Project Dependency\r
+ Project_Dep_Name bz2lib\r
+ End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "unzipsfx"=.\unzipsfx.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
--- /dev/null
+# Microsoft Developer Studio Project File - Name="unzipaes" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=unzipaes - Win32 aeswg lzma Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzipaes.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzipaes.mak" CFG="unzipaes - Win32 aeswg lzma Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "unzipaes - Win32 ASM Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipaes - Win32 ASM Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipaes - Win32 aeswg Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipaes - Win32 aeswg lzma Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipaes - Win32 aeswg Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipaes - Win32 aeswg lzma Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "unzipaes - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzipaes__Win32_ASM_Release"\r
+# PROP BASE Intermediate_Dir "unzipaes__Win32_ASM_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzipaes__Win32_ASM_Release"\r
+# PROP Intermediate_Dir "unzipaes__Win32_ASM_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"unzip.exe"\r
+\r
+!ELSEIF "$(CFG)" == "unzipaes - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzipaes__Win32_ASM_Debug"\r
+# PROP BASE Intermediate_Dir "unzipaes__Win32_ASM_Debug"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzipaes__Win32_ASM_Debug"\r
+# PROP Intermediate_Dir "unzipaes__Win32_ASM_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FR /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"unzip.exe" /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unzipaes - Win32 aeswg Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzipaes___Win32_aeswg_Debug"\r
+# PROP BASE Intermediate_Dir "unzipaes___Win32_aeswg_Debug"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzipaes___Win32_aeswg_Debug"\r
+# PROP Intermediate_Dir "unzipaes___Win32_aeswg_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "CRYPT_AES_WG" /D "USE_LZMA" /FR /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "CRYPT_AES_WG" /FR /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"unzipaes___Win32_aeswg_Debug\unzip.exe" /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unzipaes - Win32 aeswg lzma Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzipaes___Win32_aeswg_lzma_Debug0"\r
+# PROP BASE Intermediate_Dir "unzipaes___Win32_aeswg_lzma_Debug0"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzipaes___Win32_aeswg_lzma_Debug"\r
+# PROP Intermediate_Dir "unzipaes___Win32_aeswg_lzma_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "CRYPT_AES_WG" /D "USE_LZMA" /FR /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "CRYPT_AES_WG" /D "USE_LZMA" /FR /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"unzipaes___Win32_aeswg_lzma_Debug\unzip.exe" /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unzipaes - Win32 aeswg Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzipaes___Win32_aeswg_Release"\r
+# PROP BASE Intermediate_Dir "unzipaes___Win32_aeswg_Release"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzipaes___Win32_aeswg_Release"\r
+# PROP Intermediate_Dir "unzipaes___Win32_aeswg_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FR /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /D "CRYPT_AES_WG" /FR /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"unzipaes___Win32_aeswg_Release\unzip.exe"\r
+\r
+!ELSEIF "$(CFG)" == "unzipaes - Win32 aeswg lzma Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzipaes___Win32_aeswg_lzma_Release"\r
+# PROP BASE Intermediate_Dir "unzipaes___Win32_aeswg_lzma_Release"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzipaes___Win32_aeswg_lzma_Release"\r
+# PROP Intermediate_Dir "unzipaes___Win32_aeswg_lzma_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /D "CRYPT_AES_WG" /FR /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /D "CRYPT_AES_WG" /D "USE_LZMA" /FR /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"unzipaes___Win32_aeswg_lzma_Release\unzip.exe"\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "unzipaes - Win32 ASM Release"\r
+# Name "unzipaes - Win32 ASM Debug"\r
+# Name "unzipaes - Win32 aeswg Debug"\r
+# Name "unzipaes - Win32 aeswg lzma Debug"\r
+# Name "unzipaes - Win32 aeswg Release"\r
+# Name "unzipaes - Win32 aeswg lzma Release"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes_wg\aescrypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes_wg\aeskey.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes_wg\aestab.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\Alloc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\crc_i386.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\envargs.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\explode.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\extract.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes_wg\fileenc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\fileio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes_wg\hmac.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\list.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzFind.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzmaDec.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\match.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes_wg\prng.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\process.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes_wg\pwd2key.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes_wg\sha1.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\SzFile.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ubz2err.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unreduce.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unshrink.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzip.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\win32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\win32i64.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zipinfo.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes\aes.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes\aesopt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\Alloc.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\consts.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ebcdic.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes\fileenc.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes\hmac.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzFind.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzHash.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\LzmaDec.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes\prng.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes\pwd2key.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\aes\sha1.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\SzFile.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\SzVersion.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\lzma\Types.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzipaes.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzpriv.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzvers.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\w32cfg.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zip.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
-# Microsoft Developer Studio Project File - Name="unzipbz2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=unzipbz2 - Win32 ASM Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "unzipbz2.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "unzipbz2.mak" CFG="unzipbz2 - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "unzipbz2 - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzipbz2 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzipbz2 - Win32 ASM Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzipbz2 - Win32 ASM Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "unzipbz2 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "unzipbz2__Win32_Release"
-# PROP BASE Intermediate_Dir "unzipbz2__Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "unzipbz2__Win32_Release"
-# PROP Intermediate_Dir "unzipbz2__Win32_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../bzip2" /D "NDEBUG" /D "WIN32" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"unzipbz2__Win32_Release/unzip.exe"
-
-!ELSEIF "$(CFG)" == "unzipbz2 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "unzipbz2__Win32_Debug"
-# PROP BASE Intermediate_Dir "unzipbz2__Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "unzipbz2__Win32_Debug"
-# PROP Intermediate_Dir "unzipbz2__Win32_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../bzip2" /D "_DEBUG" /D "WIN32" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"unzipbz2__Win32_Debug/unzip.exe" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "unzipbz2 - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "unzipbz2__Win32_ASM_Release"
-# PROP BASE Intermediate_Dir "unzipbz2__Win32_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "unzipbz2__Win32_ASM_Release"
-# PROP Intermediate_Dir "unzipbz2__Win32_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../bzip2" /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"unzipbz2__Win32_ASM_Release/unzip.exe"
-
-!ELSEIF "$(CFG)" == "unzipbz2 - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "unzipbz2__Win32_ASM_Debug"
-# PROP BASE Intermediate_Dir "unzipbz2__Win32_ASM_Debug"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "unzipbz2__Win32_ASM_Debug"
-# PROP Intermediate_Dir "unzipbz2__Win32_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../bzip2" /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "USE_BZIP2" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"unzipbz2__Win32_ASM_Debug/unzip.exe" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "unzipbz2 - Win32 Release"
-# Name "unzipbz2 - Win32 Debug"
-# Name "unzipbz2 - Win32 ASM Release"
-# Name "unzipbz2 - Win32 ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\crc_i386.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\envargs.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\explode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\extract.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\fileio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\globals.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\list.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\match.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\nt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ttyio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ubz2err.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unreduce.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unshrink.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzip.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32i64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zipinfo.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\consts.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crc32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ebcdic.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\nt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ttyio.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzip.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzpriv.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzvers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\w32cfg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zip.h
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="unzipbz2" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=unzipbz2 - Win32 ASM Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzipbz2.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzipbz2.mak" CFG="unzipbz2 - Win32 ASM Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "unzipbz2 - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipbz2 - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipbz2 - Win32 ASM Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipbz2 - Win32 ASM Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "unzipbz2 - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzipbz2__Win32_Release"\r
+# PROP BASE Intermediate_Dir "unzipbz2__Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzipbz2__Win32_Release"\r
+# PROP Intermediate_Dir "unzipbz2__Win32_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "../../bzip2" /D "NDEBUG" /D "WIN32" /D "USE_BZIP2" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"unzipbz2__Win32_Release/unzip.exe"\r
+\r
+!ELSEIF "$(CFG)" == "unzipbz2 - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzipbz2__Win32_Debug"\r
+# PROP BASE Intermediate_Dir "unzipbz2__Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzipbz2__Win32_Debug"\r
+# PROP Intermediate_Dir "unzipbz2__Win32_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../bzip2" /D "USE_BZIP2" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"unzipbz2__Win32_Debug/unzip.exe" /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unzipbz2 - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzipbz2__Win32_ASM_Release"\r
+# PROP BASE Intermediate_Dir "unzipbz2__Win32_ASM_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzipbz2__Win32_ASM_Release"\r
+# PROP Intermediate_Dir "unzipbz2__Win32_ASM_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "../../bzip2" /D "NDEBUG" /D "WIN32" /D "ASM_CRC" /D "USE_BZIP2" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"unzipbz2__Win32_ASM_Release/unzip.exe"\r
+\r
+!ELSEIF "$(CFG)" == "unzipbz2 - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzipbz2__Win32_ASM_Debug"\r
+# PROP BASE Intermediate_Dir "unzipbz2__Win32_ASM_Debug"\r
+# PROP BASE Ignore_Export_Lib 0\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzipbz2__Win32_ASM_Debug"\r
+# PROP Intermediate_Dir "unzipbz2__Win32_ASM_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../bzip2" /D "_DEBUG" /D "WIN32" /D "ASM_CRC" /D "USE_BZIP2" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"unzipbz2__Win32_ASM_Debug/unzip.exe" /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "unzipbz2 - Win32 Release"\r
+# Name "unzipbz2 - Win32 Debug"\r
+# Name "unzipbz2 - Win32 ASM Release"\r
+# Name "unzipbz2 - Win32 ASM Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\crc_i386.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\envargs.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\explode.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\extract.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\fileio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\list.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\match.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\process.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ubz2err.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unreduce.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unshrink.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzip.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\win32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\win32i64.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zipinfo.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\consts.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ebcdic.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzip.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzpriv.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzvers.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\w32cfg.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zip.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
-# Microsoft Developer Studio Project File - Name="unzipsfx" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=unzipsfx - Win32 ASM Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "unzipsfx.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "unzipsfx.mak" CFG="unzipsfx - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "unzipsfx - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzipsfx - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzipsfx - Win32 ASM Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "unzipsfx - Win32 ASM Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "unzipsfx - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "unzipsfx___Win32_Release"
-# PROP BASE Intermediate_Dir "unzipsfx___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "unzipsfx___Win32_Release"
-# PROP Intermediate_Dir "unzipsfx___Win32_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /FD /c
-# ADD CPP /nologo /W3 /GX /O1 /D "WIN32" /D "SFX" /D "_CONSOLE" /D "_MBCS" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "unzipsfx - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "unzipsfx___Win32_Debug"
-# PROP BASE Intermediate_Dir "unzipsfx___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "unzipsfx___Win32_Debug"
-# PROP Intermediate_Dir "unzipsfx___Win32_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "SFX" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "unzipsfx - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "unzipsfx___Win32_ASM_Release"
-# PROP BASE Intermediate_Dir "unzipsfx___Win32_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "unzipsfx___Win32_ASM_Release"
-# PROP Intermediate_Dir "unzipsfx___Win32_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "SFX" /FD /c
-# ADD CPP /nologo /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "SFX" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "unzipsfx - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "unzipsfx___Win32_ASM_Debug"
-# PROP BASE Intermediate_Dir "unzipsfx___Win32_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "unzipsfx___Win32_ASM_Debug"
-# PROP Intermediate_Dir "unzipsfx___Win32_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "SFX" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "SFX" /D "ASM_CRC" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "unzipsfx - Win32 Release"
-# Name "unzipsfx - Win32 Debug"
-# Name "unzipsfx - Win32 ASM Release"
-# Name "unzipsfx - Win32 ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\crc_i386.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\extract.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\fileio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\globals.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\match.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\nt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ttyio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ubz2err.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzip.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\consts.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crc32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ebcdic.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\nt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ttyio.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzip.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzpriv.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\unzvers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\w32cfg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zip.h
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="unzipsfx" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=unzipsfx - Win32 ASM Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzipsfx.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzipsfx.mak" CFG="unzipsfx - Win32 ASM Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "unzipsfx - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipsfx - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipsfx - Win32 ASM Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "unzipsfx - Win32 ASM Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "unzipsfx - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzipsfx___Win32_Release"\r
+# PROP BASE Intermediate_Dir "unzipsfx___Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzipsfx___Win32_Release"\r
+# PROP Intermediate_Dir "unzipsfx___Win32_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O1 /D "WIN32" /D "SFX" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "unzipsfx - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzipsfx___Win32_Debug"\r
+# PROP BASE Intermediate_Dir "unzipsfx___Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzipsfx___Win32_Debug"\r
+# PROP Intermediate_Dir "unzipsfx___Win32_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "SFX" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_DEBUG" /D "WIN32" /D "_MBCS" /FR /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unzipsfx - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "unzipsfx___Win32_ASM_Release"\r
+# PROP BASE Intermediate_Dir "unzipsfx___Win32_ASM_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "unzipsfx___Win32_ASM_Release"\r
+# PROP Intermediate_Dir "unzipsfx___Win32_ASM_Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "SFX" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "SFX" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /machine:I386\r
+\r
+!ELSEIF "$(CFG)" == "unzipsfx - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "unzipsfx___Win32_ASM_Debug"\r
+# PROP BASE Intermediate_Dir "unzipsfx___Win32_ASM_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "unzipsfx___Win32_ASM_Debug"\r
+# PROP Intermediate_Dir "unzipsfx___Win32_ASM_Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "SFX" /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "SFX" /D "ASM_CRC" /D "_CONSOLE" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /D "_MBCS" /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "unzipsfx - Win32 Release"\r
+# Name "unzipsfx - Win32 Debug"\r
+# Name "unzipsfx - Win32 ASM Release"\r
+# Name "unzipsfx - Win32 ASM Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\crc_i386.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\extract.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\fileio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\match.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\process.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ubz2err.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzip.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\win32.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\consts.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crc32.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\crypt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ebcdic.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\globals.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\inflate.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\nt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\ttyio.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzip.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzpriv.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\unzvers.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\w32cfg.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\zip.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- PreprocessorDefinitions="NDEBUG;WIN32;ASM_CRC;_CONSOLE"
+ PreprocessorDefinitions="NDEBUG;WIN32;ASM_CRC;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE"
+ PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- PreprocessorDefinitions="_DEBUG;WIN32;ASM_CRC;_CONSOLE"
+ PreprocessorDefinitions="_DEBUG;WIN32;ASM_CRC;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="funzip"
+ ProjectGUID="{3E45C352-FFE5-4C7B-96E3-BC359E56A19A}"
+ RootNamespace="funzip"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;ASM_CRC;FUNZIP"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;ASM_CRC;FUNZIP"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\crc32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\crc_i386.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\funzip.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32i64.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\crc32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzpriv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="libbz2"
+ ProjectGUID="{362A8B4F-4738-425A-89A4-EBBA112E2539}"
+ RootNamespace="libbz2"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\bzip2\blocksort.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\compress.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\crctable.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\decompress.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\huffman.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\randtable.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib_private.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip.vcproj", "{69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}"
+ ProjectSection(ProjectDependencies) = postProject
+ {362A8B4F-4738-425A-89A4-EBBA112E2539} = {362A8B4F-4738-425A-89A4-EBBA112E2539}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "funzip", "funzip\funzip.vcproj", "{3E45C352-FFE5-4C7B-96E3-BC359E56A19A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbz2", "libbz2\libbz2.vcproj", "{362A8B4F-4738-425A-89A4-EBBA112E2539}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzipsfx", "unzipsfx\unzipsfx.vcproj", "{82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}"
+ ProjectSection(ProjectDependencies) = postProject
+ {362A8B4F-4738-425A-89A4-EBBA112E2539} = {362A8B4F-4738-425A-89A4-EBBA112E2539}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}.Debug|Win32.Build.0 = Debug|Win32
+ {69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}.Release|Win32.ActiveCfg = Release|Win32
+ {69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}.Release|Win32.Build.0 = Release|Win32
+ {3E45C352-FFE5-4C7B-96E3-BC359E56A19A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3E45C352-FFE5-4C7B-96E3-BC359E56A19A}.Debug|Win32.Build.0 = Debug|Win32
+ {3E45C352-FFE5-4C7B-96E3-BC359E56A19A}.Release|Win32.ActiveCfg = Release|Win32
+ {3E45C352-FFE5-4C7B-96E3-BC359E56A19A}.Release|Win32.Build.0 = Release|Win32
+ {362A8B4F-4738-425A-89A4-EBBA112E2539}.Debug|Win32.ActiveCfg = Debug|Win32
+ {362A8B4F-4738-425A-89A4-EBBA112E2539}.Debug|Win32.Build.0 = Debug|Win32
+ {362A8B4F-4738-425A-89A4-EBBA112E2539}.Release|Win32.ActiveCfg = Release|Win32
+ {362A8B4F-4738-425A-89A4-EBBA112E2539}.Release|Win32.Build.0 = Release|Win32
+ {82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}.Debug|Win32.Build.0 = Debug|Win32
+ {82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}.Release|Win32.ActiveCfg = Release|Win32
+ {82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="unzip"
+ ProjectGUID="{69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}"
+ RootNamespace="unzip"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\bzip2"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(SolutionDir)\$(ConfigurationName)""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories="..\..\..\bzip2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\wrap\aescrypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aeskey.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aestab.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\crc_i386.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\envargs.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\explode.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\extract.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\fileenc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\fileio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\hmac.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\list.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzFind.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzmaDec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\match.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\nt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8Dec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\prng.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\process.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\pwd2key.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\sha1.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ubz2err.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unreduce.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unshrink.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32i64.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zipinfo.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\aes_wg\aes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\aesopt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\brg_endian.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\consts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\CpuArch.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ebcdic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\fileenc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\hmac.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\iz_aes_wg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzFind.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzHash.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzmaEnc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\nt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd8.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\prng.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\pwd2key.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\rsxntwin.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\sha1.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\SzVersion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzpriv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzvers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\w32cfg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="unzipsfx"
+ ProjectGUID="{82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}"
+ RootNamespace="unzipsfx"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\bzip2"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;SFX;DIAG_SFX;ASM_CRC;x_BZIP2_SUPPORT;x_BZIP2_SFX;x_CHEAP_SFX_AUTORUN;x_CRYPT_AES_WG;x_CRYPT_AES_WG_SFX;x_CRYPT_TRAD_SFX;x_LZMA_SUPPORT;x_LZMA_SFX;x_PPMD_SUPPORT;x_PPMD_SFX"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(SolutionDir)$(ConfigurationName)""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;SFX;ASM_CRC;x_BZIP2_SUPPORT;x_BZIP2_SFX;x_CHEAP_SFX_AUTORUN;x_CRYPT_AES_WG;x_CRYPT_AES_WG_SFX;x_CRYPT_TRAD_SFX;x_LZMA_SUPPORT;x_LZMA_SFX;x_PPMD_SUPPORT;x_PPMD_SFX"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\wrap\aescrypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aeskey.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aestab.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\crc_i386.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\envargs.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\explode.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\extract.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\fileenc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\fileio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\hmac.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzFind.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzmaDec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\match.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\nt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8Dec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\prng.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\process.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\pwd2key.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\sha1.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ubz2err.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unreduce.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unshrink.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32i64.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\aes_wg\aes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\aesopt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\brg_endian.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\consts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\CpuArch.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ebcdic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\fileenc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\hmac.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\iz_aes_wg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzFind.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzHash.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzmaEnc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\nt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd8.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\prng.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\pwd2key.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\rsxntwin.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\sha1.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\SzVersion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzpriv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzvers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\w32cfg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="funzip"
+ ProjectGUID="{3E45C352-FFE5-4C7B-96E3-BC359E56A19A}"
+ RootNamespace="funzip"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;ASM_CRC;FUNZIP"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;ASM_CRC;FUNZIP"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\crc32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\crc_i386.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\funzip.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32i64.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\crc32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzpriv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="libbz2"
+ ProjectGUID="{362A8B4F-4738-425A-89A4-EBBA112E2539}"
+ RootNamespace="libbz2"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\bzip2\blocksort.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\compress.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\crctable.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\decompress.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\huffman.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\randtable.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib_private.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip.vcproj", "{69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}"
+ ProjectSection(ProjectDependencies) = postProject
+ {362A8B4F-4738-425A-89A4-EBBA112E2539} = {362A8B4F-4738-425A-89A4-EBBA112E2539}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbz2", "libbz2\libbz2.vcproj", "{362A8B4F-4738-425A-89A4-EBBA112E2539}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzipsfx", "unzipsfx\unzipsfx.vcproj", "{82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}"
+ ProjectSection(ProjectDependencies) = postProject
+ {362A8B4F-4738-425A-89A4-EBBA112E2539} = {362A8B4F-4738-425A-89A4-EBBA112E2539}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "funzip", "funzip\funzip.vcproj", "{3E45C352-FFE5-4C7B-96E3-BC359E56A19A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}.Debug|Win32.Build.0 = Debug|Win32
+ {69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}.Release|Win32.ActiveCfg = Release|Win32
+ {69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}.Release|Win32.Build.0 = Release|Win32
+ {362A8B4F-4738-425A-89A4-EBBA112E2539}.Debug|Win32.ActiveCfg = Debug|Win32
+ {362A8B4F-4738-425A-89A4-EBBA112E2539}.Debug|Win32.Build.0 = Debug|Win32
+ {362A8B4F-4738-425A-89A4-EBBA112E2539}.Release|Win32.ActiveCfg = Release|Win32
+ {362A8B4F-4738-425A-89A4-EBBA112E2539}.Release|Win32.Build.0 = Release|Win32
+ {82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}.Debug|Win32.Build.0 = Debug|Win32
+ {82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}.Release|Win32.ActiveCfg = Release|Win32
+ {82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}.Release|Win32.Build.0 = Release|Win32
+ {3E45C352-FFE5-4C7B-96E3-BC359E56A19A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3E45C352-FFE5-4C7B-96E3-BC359E56A19A}.Debug|Win32.Build.0 = Debug|Win32
+ {3E45C352-FFE5-4C7B-96E3-BC359E56A19A}.Release|Win32.ActiveCfg = Release|Win32
+ {3E45C352-FFE5-4C7B-96E3-BC359E56A19A}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="unzip"
+ ProjectGUID="{69B450BF-447C-40BA-9EE2-2DA1E3FD4E7F}"
+ RootNamespace="unzip"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\bzip2"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(SolutionDir)\$(ConfigurationName)""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="..\..\..\bzip2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\wrap\aescrypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aeskey.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aestab.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\crc_i386.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\envargs.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\explode.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\extract.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\fileenc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\fileio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\hmac.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\list.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzFind.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzmaDec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\match.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\nt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8Dec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\prng.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\process.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\pwd2key.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\sha1.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ubz2err.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unreduce.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unshrink.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32i64.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zipinfo.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\aes_wg\aes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\aesopt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\brg_endian.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\consts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\CpuArch.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ebcdic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\fileenc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\hmac.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\iz_aes_wg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzFind.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzHash.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzmaEnc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\nt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd8.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\prng.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\pwd2key.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\rsxntwin.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\sha1.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\SzVersion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzpriv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzvers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\w32cfg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="unzipsfx"
+ ProjectGUID="{82DCF679-56F6-4FC7-8896-ACF1D28B6AA2}"
+ RootNamespace="unzipsfx"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\bzip2"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;SFX;DIAG_SFX;ASM_CRC;x_BZIP2_SUPPORT;x_BZIP2_SFX;x_CHEAP_SFX_AUTORUN;x_CRYPT_AES_WG;x_CRYPT_AES_WG_SFX;x_CRYPT_TRAD_SFX;x_LZMA_SUPPORT;x_LZMA_SFX;x_PPMD_SUPPORT;x_PPMD_SFX"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(SolutionDir)$(ConfigurationName)""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;SFX;ASM_CRC;x_BZIP2_SUPPORT;x_BZIP2_SFX;x_CHEAP_SFX_AUTORUN;x_CRYPT_AES_WG;x_CRYPT_AES_WG_SFX;x_CRYPT_TRAD_SFX;x_LZMA_SUPPORT;x_LZMA_SFX;x_PPMD_SUPPORT;x_PPMD_SFX"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\wrap\aescrypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aeskey.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aestab.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\crc_i386.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\envargs.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\explode.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\extract.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\fileenc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\fileio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\hmac.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzFind.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzmaDec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\match.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\nt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8Dec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\prng.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\process.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\pwd2key.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\sha1.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ubz2err.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unreduce.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unshrink.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32i64.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\aes_wg\aes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\aesopt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\brg_endian.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\consts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\CpuArch.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ebcdic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\fileenc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\hmac.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\iz_aes_wg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzFind.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzHash.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzmaEnc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\nt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd8.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\prng.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\pwd2key.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\rsxntwin.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\sha1.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\SzVersion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzpriv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzvers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\w32cfg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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
#if (defined(MSC) || defined(__WATCOMC__) || defined(__MINGW32__))
# include <sys/utime.h>
+# define HAVE_LOCALE_H 1 /* 2012-12-18 SMS. */
#else
# include <utime.h>
#endif
#if (defined(NTSD_EAS) && !defined(RESTORE_ACL))
# define RESTORE_ACL /* "restore ACLs" only needed when NTSD_EAS active */
#endif
+#ifdef NO_UNICODE_SUPPORT
+# ifdef UNICODE_SUPPORT
+# undef UNICODE_SUPPORT
+# endif
+#endif
#if (!defined(NO_UNICODE_SUPPORT) && !defined(UNICODE_SUPPORT))
-# define UNICODE_SUPPORT /* enable UTF-8 filename support by default */
+# define UNICODE_SUPPORT /* enable UTF-8 filename support by default */
+#endif
+#ifdef UNICODE_SUPPORT
+# ifndef WIN32_WIDE
+# define WIN32_WIDE
+# endif
#endif
#if (defined(UNICODE_SUPPORT) && !defined(UNICODE_WCHAR))
-# define UNICODE_WCHAR /* wchar_t is UTF-16 encoded on WIN32 */
+# define UNICODE_WCHAR /* wchar_t is UTF-16 encoded on WIN32 */
#endif
#ifdef UTF8_MAYBE_NATIVE
# undef UTF8_MAYBE_NATIVE /* UTF-8 cannot be system charset on WIN32 */
#endif
+/* Windows-only, wide-character, fopen() modes. See also unzpriv.h. */
+#if defined( UNICODE_SUPPORT) && defined( WIN32_WIDE)
+# define FOPR_W L"rb"
+# define FOPM_W L"r+b"
+# define FOPW_W L"wb"
+# define FOPWT_W L"wt"
+# define FOPWR_W L"w+b"
+#endif
+
/* The following compiler systems provide or use a runtime library with a
* locale-aware isprint() implementation. For these systems, the "enhanced"
* unprintable charcode detection in fnfilter() gets enabled.
#define STR_TO_OEM
#define STR_TO_ISO
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+# if defined( DYNAMIC_WIDE_NAME) || defined( SYMLINKS)
+ wchar_t *utf8_to_wchar_string_dyn OF((const char *));
+# endif /* defined( DYNAMIC_WIDE_NAME) || defined( SYMLINKS) */
+# ifdef DYNAMIC_WIDE_NAME
+# define utf8_to_wchar_string utf8_to_wchar_string_dyn
+# else /* def DYNAMIC_WIDE_NAME */
+# define utf8_to_wchar_string utf8_to_wchar_string_stat
+ void utf8_to_wchar_string_stat OF((wchar_t *, const char *));
+# endif /* def DYNAMIC_WIDE_NAME [else] */
+ wchar_t *local_to_wchar_string OF((char *));
+ int has_win32_wide();
+#endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
+
+/* 2013-07-08 SMS.
+ * Some anti-virus programs may temporarily lock a newly created
+ * file, causing transient failures of CreateFile[AW]() when
+ * setting date-time (win32/win32.c:close_outfile()).
+ * We try up to IZ_CREATEFILE_TRY_COUNT times, at intervals of
+ * IZ_CREATEFILE_TRY_TIME_MS (millisecond). To disable the
+ * retries, define IZ_CREATEFILE_TRY_COUNT as zero. (win32/w32cfg.h).
+ * http://sourceforge.net/p/infozip/bugs/44/
+ * http://support.microsoft.com/kb/316609
+ */
+#ifndef IZ_CREATEFILE_TRY_COUNT
+# define IZ_CREATEFILE_TRY_COUNT 8
+#endif
+#ifndef IZ_CREATEFILE_TRY_TIME_MS
+# define IZ_CREATEFILE_TRY_TIME_MS 125
+#endif
+#if defined( IZ_CREATEFILE_TRY_COUNT) && (IZ_CREATEFILE_TRY_COUNT > 1)
+# define RETRY_CREATEFILE 1
+#endif
+
/* Static variables that we have to add to Uz_Globs: */
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
#define SYSTEM_SPECIFIC_GLOBALS \
int created_dir, renamed_fullpath, fnlen;\
unsigned nLabelDrive;\
char lastRootPath[4];\
+ wchar_t lastRootPathw[4];\
int lastVolOldFAT, lastVolLocTim;\
char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\
+ wchar_t *rootpathw, *buildpathHPFSw, *buildpathFATw, *endHPFSw, *endFATw;\
ZCONST char *wildname;\
+ ZCONST wchar_t *wildnamew;\
char *dirname, matchname[FILNAMSIZ];\
+ wchar_t *dirnamew, matchnamew[FILNAMSIZ];\
int rootlen, have_dirname, dirnamelen, notfirstcall;\
zvoid *wild_dir;
+#else /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
+#define SYSTEM_SPECIFIC_GLOBALS \
+ int created_dir, renamed_fullpath, fnlen;\
+ unsigned nLabelDrive;\
+ char lastRootPath[4];\
+ int lastVolOldFAT, lastVolLocTim;\
+ char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\
+ ZCONST char *wildname;\
+ char *dirname, matchname[FILNAMSIZ];\
+ int rootlen, have_dirname, dirnamelen, notfirstcall;\
+ zvoid *wild_dir;
+#endif /* ?(defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
/* created_dir, renamed_fullpath, fnlen, and nLabelDrive are used by */
/* both mapname() and checkdir(). */
# define SSTAT(path, pbuf) zstat_win32(__W32STAT_G__ path, pbuf)
#endif
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+# ifdef WILD_STAT_BUG
+# define SSTATW(pathw, pbuf) (iswildw(pathw) || zstat_win32w(__W32STAT_G__ pathw, pbuf))
+# else
+# define SSTATW(pathw, pbuf) zstat_win32w(__W32STAT_G__ pathw, pbuf)
+# endif
+#endif /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
+
+
+#ifdef SYMLINKS
+# define lstat SSTAT
+# define lstatw SSTATW
+# ifndef S_ISLNK
+# ifndef S_IFLNK
+# define S_IFLNK 0120000
+# endif
+# define S_ISLNK(m) (((m)& S_IFMT) == S_IFLNK)
+# endif /* ndef S_ISLNK */
+
+int symlink( const char *target, const char *name, int is_dir);
+# ifdef UNICODE_SUPPORT
+int symlinkw( const char *target, const wchar_t *name, int is_dir);
+# endif /* def UNICODE_SUPPORT */
+#endif /* def SYMLINKS */
+
+
#ifdef __WATCOMC__
# ifdef __386__
# ifndef WATCOMC_386
/*
- Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2007-Mar-04 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
do_wild()
mapattr()
mapname()
+ mapnamew()
maskDOSdevice()
map2fat()
checkdir()
#ifndef FUNZIP /* most of this file is not used with fUnZip */
/* some non-MS runtime headers (e.g. lcc) may miss this definition */
-#ifndef FILE_WRITE_ATTRIBUTES
+# ifndef FILE_WRITE_ATTRIBUTES
# define FILE_WRITE_ATTRIBUTES 0x0100
-#endif
+# endif
-#if (defined(__EMX__) || defined(__CYGWIN__))
+# if (defined(__EMX__) || defined(__CYGWIN__))
# define MKDIR(path,mode) mkdir(path,mode)
-#else
+# else
# define MKDIR(path,mode) mkdir(path)
-#endif
+# endif
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+# if (defined(__EMX__) || defined(__CYGWIN__))
+# define MKDIRW(pathw,mode) _wmkdir(pathw,mode)
+# else
+# define MKDIRW(pathw,mode) _wmkdir(pathw)
+# endif
+# endif
-#ifdef HAVE_WORKING_DIRENT_H
+# ifdef HAVE_WORKING_DIRENT_H
# undef HAVE_WORKING_DIRENT_H
-#endif
+# endif
/* The emxrtl dirent support of (__GO32__ || __EMX__) converts to lowercase! */
-#if defined(__CYGWIN__)
+# if defined(__CYGWIN__)
# define HAVE_WORKING_DIRENT_H
-#endif
+# endif
-#ifndef SFX
+# ifndef SFX
# ifdef HAVE_WORKING_DIRENT_H
# include <dirent.h> /* use readdir() */
# define zdirent dirent
static struct zdirent *Readdir (zDIR *d);
static void Closedir (zDIR *d);
# endif /* ?HAVE_WORKING_DIRENT_H */
-#endif /* !SFX */
+# endif /* !SFX */
-#ifdef SET_DIR_ATTRIB
+# ifdef SET_DIR_ATTRIB
typedef struct NTdirattr { /* struct for holding unix style directory */
struct NTdirattr *next; /* info until can be sorted and set at end */
char *fn; /* filename of directory */
FILETIME Creft; /* NT file time type, `file creation' time */
int gotTime;
unsigned perms; /* same as min_info.file_attr */
-#ifdef NTSD_EAS
+# ifdef NTSD_EAS
unsigned SDlen; /* length of SD data in buf */
-#endif
+# endif
char buf[1]; /* buffer stub for directory SD and name */
} NTdirattr;
#define NtAtt(d) ((NTdirattr *)d) /* typecast shortcut */
-#endif /* SET_DIR_ATTRIB */
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ typedef struct NTdirattrw { /* struct for holding unix style directory */
+ struct NTdirattrw *next; /* info until can be sorted and set at end */
+ wchar_t *fnw; /* filename of directory */
+ FILETIME Modft; /* File time type defined in NT, `last modified' time */
+ FILETIME Accft; /* NT file time type, `last access' time */
+ FILETIME Creft; /* NT file time type, `file creation' time */
+ int gotTime;
+ unsigned perms; /* same as min_info.file_attr */
+# ifdef NTSD_EAS
+ unsigned SDlen; /* length of SD data in buf */
+# endif
+ wchar_t buf[1]; /* buffer stub for directory SD and name */
+ } NTdirattrw;
+# define NtAttw(dw) ((NTdirattrw *)dw) /* typecast shortcut */
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+# endif /* SET_DIR_ATTRIB */
/* Function prototypes */
-#ifdef NTSD_EAS
+# ifdef NTSD_EAS
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ static int SetSD(__GPRO__ wchar_t *path, unsigned fperms,
+ uch *eb_ptr, unsigned eb_len);
+# else
static int SetSD(__GPRO__ char *path, unsigned fperms,
uch *eb_ptr, unsigned eb_len);
+# endif
static int FindSDExtraField(__GPRO__
uch *ef_ptr, unsigned ef_len,
uch **p_ebSD_ptr, unsigned *p_ebSD_len);
-#endif
+# endif /* NTSD_EAS */
-#ifndef NO_W32TIMES_IZFIX
+# ifndef NO_W32TIMES_IZFIX
static void utime2NtfsFileTime(time_t ut, FILETIME *pft);
-#endif
+# endif
static void utime2VFatFileTime(time_t ut, FILETIME *pft, int clipDosMin);
-#if (defined(W32_STAT_BANDAID) && !defined(NO_W32TIMES_IZFIX))
+# if (defined(W32_STAT_BANDAID) && !defined(NO_W32TIMES_IZFIX))
static int NtfsFileTime2utime(const FILETIME *pft, time_t *ut);
-#endif
-#ifdef W32_STAT_BANDAID
+# endif
+# ifdef W32_STAT_BANDAID
static int VFatFileTime2utime(const FILETIME *pft, time_t *ut);
-#endif
+# endif
static int FStampIsLocTime(__GPRO__ const char *path);
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ static int FStampIsLocTimeW(__GPRO__ const wchar_t *pathw);
+# endif
static int getNTfiletime (__GPRO__ FILETIME *pModFT, FILETIME *pAccFT,
FILETIME *pCreFT);
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static int getNTfiletimeW (__GPRO__ FILETIME *pModFT, FILETIME *pAccFT,
+ FILETIME *pCreFT);
+# endif
static int isfloppy (int nDrive);
static int NTQueryVolInfo (__GPRO__ const char *name);
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ static int NTQueryVolInfoW (__GPRO__ const wchar_t *namew);
+# endif
static int IsVolumeOldFAT (__GPRO__ const char *name);
static void maskDOSdevice (__GPRO__ char *pathcomp);
static void map2fat (char *pathcomp, char **pEndFAT);
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ static void maskDOSdevicew (__GPRO__ wchar_t *pathcompw);
+ static void map2fatw (wchar_t *pathcompw, wchar_t **pEndFATw);
+# endif
-#if (defined(__MINGW32__) && !defined(USE_MINGW_GLOBBING))
+# if (defined(__MINGW32__) && !defined(USE_MINGW_GLOBBING))
int _CRT_glob = 0; /* suppress command line globbing by C RTL */
-#endif
+# endif
-#ifdef ACORN_FTYPE_NFS
+# ifdef ACORN_FTYPE_NFS
/* Acorn bits for NFS filetyping */
typedef struct {
uch ID[2];
uch attr[4];
} RO_extra_block;
-#endif /* ACORN_FTYPE_NFS */
+# endif /* ACORN_FTYPE_NFS */
/* static int created_dir; */ /* used by mapname(), checkdir() */
/* static int renamed_fullpath; */ /* ditto */
/* static int fnlen; */ /* ditto */
/* static unsigned nLabelDrive; */ /* ditto */
-extern char Far TruncNTSD[]; /* in extract.c */
-
-#ifdef SFX
+# ifdef SFX
/**************************/
/* Function GetLoadPath() */
char *GetLoadPath(__GPRO)
{
-#ifdef MSC
+# ifdef MSC
extern char *_pgmptr;
return _pgmptr;
-#else /* use generic API call */
+# else /* use generic API call */
GetModuleFileName(NULL, G.filename, FILNAMSIZ);
_ISO_INTERN(G.filename); /* translate to codepage of C rtl's stdio */
return G.filename;
-#endif
+# endif
} /* end function GetLoadPath() */
-#else /* !SFX */
+# else /* !SFX */
-#ifndef HAVE_WORKING_DIRENT_H
+# ifndef HAVE_WORKING_DIRENT_H
/**********************/ /* Borrowed from ZIP 2.0 sources */
/* Function Opendir() */ /* Difference: no special handling for */
/* Start searching for files in directory n */
- if ((d = (zDIR *)malloc(sizeof(zDIR))) == NULL ||
- (p = malloc(strlen(n) + 5)) == NULL)
+ if ((d = (zDIR *)izu_malloc(sizeof(zDIR))) == NULL ||
+ (p = izu_malloc(strlen(n) + 5)) == NULL)
{
if (d != (zDIR *)NULL)
- free((void *)d);
+ izu_free((void *)d);
return (zDIR *)NULL;
}
INTERN_TO_ISO(n, p);
strcpy(p+len, "/*");
if (INVALID_HANDLE_VALUE == (d->d_hFindFile = FindFirstFileA(p, &fd))) {
- free((zvoid *)d);
- free((zvoid *)p);
+ izu_free((zvoid *)d);
+ izu_free((zvoid *)p);
return NULL;
}
strcpy(d->d_name, fd.cFileName);
- free((zvoid *)p);
+ izu_free((zvoid *)p);
d->d_first = 1;
return d;
zDIR *d; /* directory stream to close */
{
FindClose(d->d_hFindFile);
- free(d);
+ izu_free(d);
}
-#endif /* !HAVE_WORKING_DIRENT_H */
-#endif /* ?SFX */
+# endif /* !HAVE_WORKING_DIRENT_H */
+# endif /* ?SFX */
-#ifdef NTSD_EAS
+# ifdef NTSD_EAS
/**********************/
/* Function SetSD() */ /* return almost-PK errors */
/**********************/
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static int SetSD(__G__ path, fperms, eb_ptr, eb_len)
+ __GDEF
+ wchar_t *path;
+# else
static int SetSD(__G__ path, fperms, eb_ptr, eb_len)
__GDEF
char *path;
+# endif
unsigned fperms;
uch *eb_ptr;
unsigned eb_len;
/* check target volume capabilities - just fall through
* and try if fail */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if (GetVolumeCaps(G.rootpathw, path, &VolumeCaps) &&
+ !(VolumeCaps.dwFileSystemFlags & FS_PERSISTENT_ACLS))
+ return PK_OK;
+# else
if (GetVolumeCaps(G.rootpath, path, &VolumeCaps) &&
!(VolumeCaps.dwFileSystemFlags & FS_PERSISTENT_ACLS))
return PK_OK;
+# endif
/* allocate storage for uncompressed data */
- security_data = (uch *)malloc((extent)ntsd_ucSize);
+ security_data = (uch *)izu_malloc((extent)ntsd_ucSize);
if (security_data == (uch *)NULL)
return PK_MEM4;
if (SecuritySet(path, &VolumeCaps, security_data)) {
error = PK_COOL;
if (!uO.tflag && QCOND2)
- Info(slide, 0, ((char *)slide, " (%ld bytes security)",
+ Info(slide, 0, ((char *)slide, " (%lu bytes security)",
ntsd_ucSize));
}
}
- free(security_data);
+ izu_free(security_data);
return error;
}
rc = TRUE;
break;
-#ifdef DEBUG
+# ifdef DEBUG
case EF_OS2:
case EF_AV:
case EF_PKVMS:
case EF_MD5:
case EF_ASIUNIX:
break; /* shut up for other known e.f. blocks */
-#endif /* DEBUG */
+# endif /* DEBUG */
default:
Trace((stderr,
-#ifndef SFX
+# ifndef SFX
/**************************/
/* Function test_NTSD() */ /* returns PK_WARN when NTSD data is invalid */
/**************************/
-#ifdef __BORLANDC__
+# ifdef __BORLANDC__
/* Turn off warning about not using all parameters for this function only */
-#pragma argsused
-#endif
+# pragma argsused
+# endif
int test_NTSD(__G__ eb, eb_size, eb_ucptr, eb_ucsize)
__GDEF
uch *eb;
- unsigned eb_size;
+ long eb_size;
uch *eb_ucptr;
ulg eb_ucsize;
{
return (ValidateSecurity(eb_ucptr) ? PK_OK : PK_WARN);
} /* end function test_NTSD() */
-#endif /* !SFX */
-#endif /* NTSD_EAS */
+# endif /* !SFX */
+# endif /* NTSD_EAS */
/* DEBUG_TIME insertion: */
-#ifdef DEBUG_TIME
+# ifdef DEBUG_TIME
static int show_NTFileTime(FILE *hdo, char *TTmsg, int isloc, FILETIME *pft);
static int show_NTFileTime(FILE *hdo, char *TTmsg, int isloc, FILETIME *pft)
return rval;
}
#define FTTrace(x) show_NTFileTime x
-#else
+# else
#define FTTrace(x)
-#endif /* DEBUG_TIME */
+# endif /* DEBUG_TIME */
/* end of DEBUG_TIME insertion */
-#ifndef IZ_USE_INT64
+# ifndef IZ_USE_INT64
# if (defined(__GNUC__) || defined(ULONG_LONG_MAX))
typedef long long LLONG64;
typedef unsigned long long ULLNG64;
typedef unsigned __int64 ULLNG64;
# define IZ_USE_INT64
# endif
-#endif
+# endif
/* scale factor and offset for conversion time_t -> FILETIME */
#define NT_QUANTA_PER_UNIX 10000000L
#define UTIME_1980_JAN_01_00_00 315532800L
-#ifndef NO_W32TIMES_IZFIX
+# ifndef NO_W32TIMES_IZFIX
/*********************************/
/* Function utime2NtfsFileTime() */ /* convert Unix time_t format into the */
/*********************************/ /* form used by SetFileTime() in NT/9x */
static void utime2NtfsFileTime(time_t ut, FILETIME *pft)
{
-#ifdef IZ_USE_INT64
+# ifdef IZ_USE_INT64
ULLNG64 NTtime;
/* NT_QUANTA_PER_UNIX is small enough so that "ut * NT_QUANTA_PER_UNIX"
pft->dwLowDateTime = (DWORD)NTtime;
pft->dwHighDateTime = (DWORD)(NTtime >> 32);
-#else /* !IZ_USE_INT64 (64-bit integer arithmetics may not be supported) */
+# else /* !IZ_USE_INT64 (64-bit integer arithmetics may not be supported) */
unsigned int b1, b2, carry = 0;
unsigned long r0, r1, r2, r3;
long r4; /* signed, to catch environments with signed time_t */
carry++;
pft->dwHighDateTime = r4 + (r2 >> 16) + (r3 >> 16)
+ UNIX_TIME_ZERO_HI + carry;
-#endif /* ?IZ_USE_INT64 */
+# endif /* ?IZ_USE_INT64 */
} /* end function utime2NtfsFileTime() */
-#endif /* !NO_W32TIMES_IZFIX */
+# endif /* !NO_W32TIMES_IZFIX */
/* The milliseconds field gets always initialized to 0. */
w32tm.wMilliseconds = 0;
-#ifdef __BORLANDC__ /* Borland C++ 5.x crashes when trying to reference tm */
+# ifdef __BORLANDC__ /* Borland C++ 5.x crashes when trying to reference tm */
if (utc < UTIME_1980_JAN_01_00_00)
utc = UTIME_1980_JAN_01_00_00;
-#endif
+# endif
ltm = localtime(&utc);
if (ltm == (struct tm *)NULL)
/* localtime() did not accept given utc time value; try to use
extern ZCONST ush ydays[]; /* defined in fileio.c */
-#if (defined(W32_STAT_BANDAID) && !defined(NO_W32TIMES_IZFIX))
+# if (defined(W32_STAT_BANDAID) && !defined(NO_W32TIMES_IZFIX))
/*********************************/
/* Function NtfsFileTime2utime() */
/*********************************/
static int NtfsFileTime2utime(const FILETIME *pft, time_t *ut)
{
-#ifdef IZ_USE_INT64
+# ifdef IZ_USE_INT64
ULLNG64 NTtime;
NTtime = ((ULLNG64)pft->dwLowDateTime +
((ULLNG64)pft->dwHighDateTime << 32));
-#ifndef TIME_T_TYPE_DOUBLE
+# ifndef TIME_T_TYPE_DOUBLE
/* underflow and overflow handling */
-#ifdef CHECK_UTIME_SIGNED_UNSIGNED
+# ifdef CHECK_UTIME_SIGNED_UNSIGNED
if ((time_t)0x80000000L < (time_t)0L)
{
if (NTtime < ((ULLNG64)UNIX_TIME_SMIN_LO +
}
}
else
-#endif /* CHECK_UTIME_SIGNED_UNSIGNED */
+# endif /* CHECK_UTIME_SIGNED_UNSIGNED */
{
if (NTtime < ((ULLNG64)UNIX_TIME_ZERO_LO +
((ULLNG64)UNIX_TIME_ZERO_HI << 32))) {
return FALSE;
}
}
-#endif /* !TIME_T_TYPE_DOUBLE */
+# endif /* !TIME_T_TYPE_DOUBLE */
NTtime -= ((ULLNG64)UNIX_TIME_ZERO_LO +
((ULLNG64)UNIX_TIME_ZERO_HI << 32));
*ut = (time_t)(NTtime / (unsigned long)NT_QUANTA_PER_UNIX);
return TRUE;
-#else /* !IZ_USE_INT64 (64-bit integer arithmetics may not be supported) */
+# else /* !IZ_USE_INT64 (64-bit integer arithmetics may not be supported) */
time_t days;
SYSTEMTIME w32tm;
-#ifndef TIME_T_TYPE_DOUBLE
+# ifndef TIME_T_TYPE_DOUBLE
/* underflow and overflow handling */
-#ifdef CHECK_UTIME_SIGNED_UNSIGNED
+# ifdef CHECK_UTIME_SIGNED_UNSIGNED
if ((time_t)0x80000000L < (time_t)0L)
{
if ((pft->dwHighDateTime < UNIX_TIME_SMIN_HI) ||
}
}
else
-#endif /* CHECK_UTIME_SIGNED_UNSIGNED */
+# endif /* CHECK_UTIME_SIGNED_UNSIGNED */
{
if ((pft->dwHighDateTime < UNIX_TIME_ZERO_HI) ||
((pft->dwHighDateTime == UNIX_TIME_ZERO_HI) &&
return FALSE;
}
}
-#endif /* !TIME_T_TYPE_DOUBLE */
+# endif /* !TIME_T_TYPE_DOUBLE */
FileTimeToSystemTime(pft, &w32tm);
*ut = (time_t)(86400L * days + 3600L * (time_t)w32tm.wHour +
(time_t)(60 * w32tm.wMinute + w32tm.wSecond));
return TRUE;
-#endif /* ?IZ_USE_INT64 */
+# endif /* ?IZ_USE_INT64 */
} /* end function NtfsFileTime2utime() */
-#endif /* W32_STAT_BANDAID && !NO_W32TIMES_IZFIX */
+# endif /* W32_STAT_BANDAID && !NO_W32TIMES_IZFIX */
-#ifdef W32_STAT_BANDAID
+# ifdef W32_STAT_BANDAID
/*********************************/
/* Function VFatFileTime2utime() */
/*********************************/
static int VFatFileTime2utime(const FILETIME *pft, time_t *ut)
{
FILETIME lft;
-#ifndef HAVE_MKTIME
+# ifndef HAVE_MKTIME
WORD wDOSDate, wDOSTime;
-#else
+# else
SYSTEMTIME w32tm;
struct tm ltm;
-#endif
+# endif
if (!FileTimeToLocalFileTime(pft, &lft)) {
/* if pft cannot be converted to local time, set ut to current time */
return FALSE;
}
FTTrace((stdout, "VFatFT2utime, feed for mktime()", 1, &lft));
-#ifndef HAVE_MKTIME
+# ifndef HAVE_MKTIME
/* This version of the FILETIME-to-UNIXTIME conversion function
* uses DOS-DATE-TIME format as intermediate stage. For modification
* and access times, this is no problem. But, the extra fine resolution
* a resolution of 2 seconds and are therefore even numbers.
*/
return (((*ut)&1) == (time_t)0);
-#else /* HAVE_MKTIME */
+# else /* HAVE_MKTIME */
FileTimeToSystemTime(&lft, &w32tm);
-#ifndef TIME_T_TYPE_DOUBLE
+# ifndef TIME_T_TYPE_DOUBLE
/* underflow and overflow handling */
/* TODO: The range checks are not accurate, the actual limits may
* be off by one daylight-saving-time shift (typically 1 hour),
* depending on the current state of "is_dst".
*/
-#ifdef CHECK_UTIME_SIGNED_UNSIGNED
+# ifdef CHECK_UTIME_SIGNED_UNSIGNED
if ((time_t)0x80000000L < (time_t)0L)
{
if ((pft->dwHighDateTime < UNIX_TIME_SMIN_HI) ||
}
}
else
-#endif /* CHECK_UTIME_SIGNED_UNSIGNED */
+# endif /* CHECK_UTIME_SIGNED_UNSIGNED */
{
if ((pft->dwHighDateTime < UNIX_TIME_ZERO_HI) ||
((pft->dwHighDateTime == UNIX_TIME_ZERO_HI) &&
return FALSE;
}
}
-#endif /* !TIME_T_TYPE_DOUBLE */
+# endif /* !TIME_T_TYPE_DOUBLE */
ltm.tm_year = w32tm.wYear - 1900;
ltm.tm_mon = w32tm.wMonth - 1;
ltm.tm_mday = w32tm.wDay;
* (The only known exception is creation time on VFAT partitions.)
*/
return (*ut != (time_t)-1L);
-#endif /* ?HAVE_MKTIME */
+# endif /* ?HAVE_MKTIME */
} /* end function VFatFileTime2utime() */
-#endif /* W32_STAT_BANDAID */
+# endif /* W32_STAT_BANDAID */
return (NTQueryVolInfo(__G__ path) ? G.lastVolLocTim : FALSE);
}
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static int FStampIsLocTimeW(__GPRO__ const wchar_t *pathw)
+{
+ return (NTQueryVolInfoW(__G__ pathw) ? G.lastVolLocTim : FALSE);
+}
+# endif
+
-#ifndef NO_W32TIMES_IZFIX
+
+# ifndef NO_W32TIMES_IZFIX
# define UTIME_2_IZFILETIME(ut, pft) \
if (fs_uses_loctime) {utime2VFatFileTime(ut, pft, TRUE);} \
else {utime2NtfsFileTime(ut, pft);}
-#else
+# else
# define UTIME_2_IZFILETIME(ut, pft) \
utime2VFatFileTime(ut, pft, fs_uses_loctime);
-#endif
+# endif
+
+
+
+
FILETIME *pAccFT;
FILETIME *pCreFT;
{
-#ifdef USE_EF_UT_TIME
+# ifdef USE_EF_UT_TIME
unsigned eb_izux_flg;
iztimes z_utime; /* struct for Unix-style actime & modtime, + creatime */
-#endif
+# endif
int fs_uses_loctime = FStampIsLocTime(__G__ G.filename);
/* Copy and/or convert time and date variables, if necessary;
* return a flag indicating which time stamps are available. */
-#ifdef USE_EF_UT_TIME
+# ifdef USE_EF_UT_TIME
if (G.extra_field &&
-#ifdef IZ_CHECK_TZ
+# ifdef IZ_CHECK_TZ
G.tz_is_valid &&
-#endif
+# endif
((eb_izux_flg = ef_scan_for_izux(G.extra_field,
G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime,
&z_utime, NULL)) & EB_UT_FL_MTIME))
}
return (int)eb_izux_flg;
}
-#endif /* USE_EF_UT_TIME */
-#ifndef NO_W32TIMES_IZFIX
+# endif /* USE_EF_UT_TIME */
+# ifndef NO_W32TIMES_IZFIX
if (!fs_uses_loctime) {
time_t ux_modtime;
ux_modtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
utime2NtfsFileTime(ux_modtime, pModFT);
} else
-#endif /* NO_W32TIMES_IZFIX */
+# endif /* NO_W32TIMES_IZFIX */
{
FILETIME lft;
} /* end function getNTfiletime() */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ static int getNTfiletimeW(__G__ pModFT, pAccFT, pCreFT)
+ __GDEF
+ FILETIME *pModFT;
+ FILETIME *pAccFT;
+ FILETIME *pCreFT;
+ {
+# ifdef USE_EF_UT_TIME
+ unsigned eb_izux_flg;
+ iztimes z_utime; /* struct for Unix-style actime & modtime, + creatime */
+# endif
+ int fs_uses_loctime = FStampIsLocTimeW(__G__ G.unipath_widefilename);
+
+ /* Copy and/or convert time and date variables, if necessary;
+ * return a flag indicating which time stamps are available. */
+# ifdef USE_EF_UT_TIME
+ if (G.extra_field &&
+# ifdef IZ_CHECK_TZ
+ G.tz_is_valid &&
+# endif
+ ((eb_izux_flg = ef_scan_for_izux(G.extra_field,
+ G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime,
+ &z_utime, NULL)) & EB_UT_FL_MTIME))
+ {
+ TTrace((stderr, "getNTfiletime: Unix e.f. modif. time = %lu\n",
+ z_utime.mtime));
+ UTIME_2_IZFILETIME(z_utime.mtime, pModFT)
+ if (eb_izux_flg & EB_UT_FL_ATIME) {
+ UTIME_2_IZFILETIME(z_utime.atime, pAccFT)
+ }
+ if (eb_izux_flg & EB_UT_FL_CTIME) {
+ UTIME_2_IZFILETIME(z_utime.ctime, pCreFT)
+ }
+ return (int)eb_izux_flg;
+ }
+# endif /* USE_EF_UT_TIME */
+# ifndef NO_W32TIMES_IZFIX
+ if (!fs_uses_loctime) {
+ time_t ux_modtime;
+
+ ux_modtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
+ utime2NtfsFileTime(ux_modtime, pModFT);
+ } else
+# endif /* NO_W32TIMES_IZFIX */
+ {
+ FILETIME lft;
+
+ DosDateTimeToFileTime((WORD)(G.lrec.last_mod_dos_datetime >> 16),
+ (WORD)(G.lrec.last_mod_dos_datetime & 0xFFFFL),
+ &lft);
+ LocalFileTimeToFileTime(&lft, pModFT);
+ }
+ *pAccFT = *pModFT;
+ return (EB_UT_FL_MTIME | EB_UT_FL_ATIME);
+
+ } /* end function getNTfiletime() */
+# endif /* (UNICODE_SUPPORT && WIN32_WIDE) */
+
+
/**************************/
int SetFileSize(FILE *file, zusz_t filesize)
{
-#ifdef __RSXNT__
+# ifdef __RSXNT__
/* RSXNT environment lacks a translation function from C file pointer
to Win32-API file handle. So, simply do nothing. */
return 0;
-#else /* !__RSXNT__ */
+# else /* !__RSXNT__ */
/* not yet verified, if that really creates an unfragmented file
rommel@ars.de
*/
HANDLE os_fh;
-#ifdef Z_UINT8_DEFINED
+# ifdef Z_UINT8_DEFINED
LARGE_INTEGER fsbuf;
-#endif
+# endif
/* Win9x supports FAT file system, only; presetting file size does
not help to prevent fragmentation. */
*/
os_fh = (HANDLE)_get_osfhandle(fileno(file));
/* move file pointer behind the last byte of the expected file size */
-#ifdef Z_UINT8_DEFINED
+# ifdef Z_UINT8_DEFINED
fsbuf.QuadPart = filesize;
if ((SetFilePointer(os_fh, fsbuf.LowPart, &fsbuf.HighPart, FILE_BEGIN)
== 0xFFFFFFFF) && GetLastError() != NO_ERROR)
-#else
+# else
if (SetFilePointer(os_fh, (ulg)filesize, 0, FILE_BEGIN) == 0xFFFFFFFF)
-#endif
+# endif
return -1;
/* extend/truncate file to the current position */
- if (SetEndOfFile(os_fh) == 0)
+ if (SetEndOfFile(os_fh) == 0) {
+ SetFilePointer(os_fh, 0, 0, FILE_BEGIN);
return -1;
+ }
/* move file position pointer back to the start of the file! */
return (SetFilePointer(os_fh, 0, 0, FILE_BEGIN) == 0xFFFFFFFF) ? -1 : 0;
-#endif /* ?__RSXNT__ */
+# endif /* ?__RSXNT__ */
} /* end function SetFileSize() */
FILETIME Creft; /* NT file time type, `file creation' time */
HANDLE hFile = INVALID_HANDLE_VALUE; /* File handle defined in NT */
int gotTime;
-#ifdef NTSD_EAS
+# ifdef NTSD_EAS
uch *ebSDptr;
unsigned ebSDlen;
-#endif
-#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
- char *ansi_name = (char *)alloca(strlen(G.filename) + 1);
+# endif
- INTERN_TO_ISO(G.filename, ansi_name);
-# define Ansi_Fname ansi_name
-#else
-# define Ansi_Fname G.filename
-#endif
+/* 2013-07-08 SMS. See note below. */
+# ifdef RETRY_CREATEFILE
+ int cf_tries;
+# endif
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ if (!G.has_win32_wide) {
+# endif
+# ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
+ char *ansi_name = (char *)alloca(strlen(G.filename) + 1);
+
+ INTERN_TO_ISO(G.filename, ansi_name);
+# define Ansi_Fname ansi_name
+# else
+# define Ansi_Fname G.filename
+# endif
+
+/*---------------------------------------------------------------------------
+ If symbolic links are supported, allocate storage for a symlink
+ control structure, put the uncompressed "data" and other required
+ info into it, and add the structure to the "deferred symlinks"
+ chain. Because we know it's a symbolic link, we shouldn't need to
+ worry about overflowing unsigned ints with unsigned longs.
+ ---------------------------------------------------------------------------*/
+
+# ifdef SYMLINKS
+ if (G.symlnk) {
+ extent ucsize = (extent)G.lrec.ucsize;
+# ifdef SET_SYMLINK_ATTRIBS
+ /* 2013-12-05 SMS.
+ * Note that z_uidgid is not (yet?) declared for WIN32, and must
+ * be an array/ponter for this usage to make sense. See
+ * unix/unix.c.
+ */
+ extent attribsize = sizeof(unsigned) +
+ (have_uidgid_flg ? sizeof( z_uidgid) : 0);
+# else
+ extent attribsize = 0;
+# endif
+ /* Size of the symlink entry is the sum of:
+ * struct size (includes 1 (buf[1]) for target text NUL),
+ * system specific attribute data size (might be 0),
+ * target text length (only -- NUL already counted, above),
+ * link name length + 1 (NUL).
+ */
+ extent slnk_entrysize = sizeof( slinkentry) + attribsize +
+ ucsize + strlen( G.filename) + 1;
+
+ slinkentry *slnk_entry;
+
+ if (slnk_entrysize < ucsize) {
+ Info(slide, 0x201, ((char *)slide,
+ "warning: symbolic link (%s) failed: mem alloc overflow\n",
+ FnFilter1(G.filename)));
+ fclose(G.outfile);
+ return;
+ }
+
+ if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
+ Info(slide, 0x201, ((char *)slide,
+ "warning: symbolic link (%s) failed: no mem\n",
+ FnFilter1(G.filename)));
+ fclose(G.outfile);
+ return;
+ }
+ slnk_entry->next = NULL;
+ slnk_entry->targetlen = ucsize;
+ slnk_entry->attriblen = attribsize;
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ slnk_entry->wide = 0;
+# endif
+# ifdef SET_SYMLINK_ATTRIBS
+ memcpy( slnk_entry->buf, &(G.pInfo->file_attr),
+ sizeof( G.pInfo->file_attr));
+ if (have_uidgid_flg)
+ memcpy( (slnk_entry->buf+ sizeof( unsigned)), z_uidgid,
+ sizeof( z_uidgid));
+# endif
+ slnk_entry->target = slnk_entry->buf + slnk_entry->attriblen;
+ slnk_entry->fname = slnk_entry->target + ucsize + 1;
+ strcpy(slnk_entry->fname, G.filename);
+
+ /* If symlink name ends in '/', then flag as directory. */
+ slnk_entry->is_dir = 0;
+ if (G.filename[ strlen( G.filename)- 1] == '/')
+ slnk_entry->is_dir = 1;
+
+ /* move back to the start of the file to re-read the "link data" */
+ rewind(G.outfile);
-#ifndef __RSXNT__
- if (IsWinNT()) {
+ if (fread(slnk_entry->target, 1, ucsize, G.outfile) != ucsize)
+ {
+ Info(slide, 0x201, ((char *)slide,
+ "warning: symbolic link (%s) failed\n",
+ FnFilter1(G.filename)));
+ free(slnk_entry);
+ fclose(G.outfile);
+ return;
+ }
+ slnk_entry->target[ucsize] = '\0';
+ if (QCOND2)
+ Info(slide, 0, ((char *)slide, "-> %s ",
+ FnFilter1(slnk_entry->target)));
+ /* add this symlink record to the list of deferred symlinks */
+ if (G.slink_last != NULL)
+ G.slink_last->next = slnk_entry;
+ else
+ G.slink_head = slnk_entry;
+ G.slink_last = slnk_entry;
+ fclose( G.outfile);
+ return;
+ }
+# endif /* def SYMLINKS */
+
+# ifndef __RSXNT__
+# if !(defined(UNICODE_SUPPORT) && defined(WIN32_WIDE))
+ if (IsWinNT()) {
/* Truncate the file to the current position.
* This is needed to remove excess allocation in case the
* extraction has failed or stopped prematurely. */
SetEndOfFile((HANDLE)_get_osfhandle(fileno(G.outfile)));
- }
-#endif
-
- /* Close the file and then re-open it using the Win32
- * CreateFile call, so that the file can be created
- * with GENERIC_WRITE access, otherwise the SetFileTime
- * call will fail. */
- fclose(G.outfile);
-
- /* don't set the time stamp and attributes on standard output */
- if (uO.cflag)
- return;
+ }
+# endif /* !(defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
+# endif
- /* skip restoring time stamps on user's request */
- if (uO.D_flag <= 1) {
- gotTime = getNTfiletime(__G__ &Modft, &Accft, &Creft);
+ /* Close the file and then re-open it using the Win32
+ * CreateFile call, so that the file can be created
+ * with GENERIC_WRITE access, otherwise the SetFileTime
+ * call will fail. */
+ fclose(G.outfile);
+
+ /* don't set the time stamp and attributes on standard output */
+ if (uO.cflag)
+ return;
+
+ gotTime = getNTfiletime(__G__ &Modft, &Accft, &Creft);
+
+ /* open a handle to the file before processing extra fields;
+ we do this in case new security on file prevents us from updating
+ time stamps */
+
+ /* 2013-07-08 SMS.
+ * Some anti-virus programs may temporarily lock a newly created
+ * file, causing transient failures of CreateFile[AW]() when
+ * setting date-time (win32/win32.c:close_outfile()).
+ * We try up to IZ_CREATEFILE_TRY_COUNT times, at intervals of
+ * IZ_CREATEFILE_TRY_TIME_MS (millisecond). To disable the
+ * retries, define IZ_CREATEFILE_TRY_COUNT as zero. (win32/w32cfg.h).
+ * http://sourceforge.net/p/infozip/bugs/44/
+ * http://support.microsoft.com/kb/316609
+ *
+ * Perhaps the count or time interval should depend on the file
+ * size?
+ */
+#ifdef RETRY_CREATEFILE
+ for (cf_tries = IZ_CREATEFILE_TRY_COUNT; cf_tries > 0 ; cf_tries--)
+ {
+#endif /* def RETRY_CREATEFILE */
+
+ hFile = CreateFileA( Ansi_Fname,
+ GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+#ifdef RETRY_CREATEFILE
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ if (GetLastError() != ERROR_SHARING_VIOLATION)
+ break; /* Not a sharing error. Get out now. Otherwise: */
+ Sleep( IZ_CREATEFILE_TRY_TIME_MS); /* Sleep, then retry. */
+ }
+ else
+ {
+ break; /* Not a sharing error. (Success?) Get out now. */
+ }
+ }
+#endif /* def RETRY_CREATEFILE */
+
+ /* sfield@microsoft.com: set attributes before time in case we decide to
+ support other filetime members later. This also allows us to apply
+ attributes before the security is changed, which may prevent this
+ from succeeding otherwise. Also, since most files don't have
+ any interesting attributes, only change them if something other than
+ FILE_ATTRIBUTE_ARCHIVE appears in the attributes. This works well
+ as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the
+ file anyway, when it's created new. */
+ if((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) {
+ if (!SetFileAttributesA(Ansi_Fname, G.pInfo->file_attr & 0x7F))
+ Info(slide, 1, ((char *)slide,
+ "\nwarning (%d): could not set file attributes (1)\n",
+ (int)GetLastError()));
+ }
- /* open a handle to the file before processing extra fields;
- we do this in case new security on file prevents us from updating
- time stamps */
- hFile = CreateFileA(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- } else {
- gotTime = 0;
- }
-
- /* sfield@microsoft.com: set attributes before time in case we decide to
- support other filetime members later. This also allows us to apply
- attributes before the security is changed, which may prevent this
- from succeeding otherwise. Also, since most files don't have
- any interesting attributes, only change them if something other than
- FILE_ATTRIBUTE_ARCHIVE appears in the attributes. This works well
- as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the
- file anyway, when it's created new. */
- if ((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) {
- if (!SetFileAttributesA(Ansi_Fname, G.pInfo->file_attr & 0x7F))
- Info(slide, 1, ((char *)slide,
- "\nwarning (%d): could not set file attributes\n",
- (int)GetLastError()));
- }
-#ifdef NTSD_EAS
- /* set NTFS SD extra fields */
- if (G.extra_field && /* zipfile extra field may have extended attribs */
- FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
- &ebSDptr, &ebSDlen))
- {
+# ifdef NTSD_EAS
+ /* set NTFS SD extra fields */
+ if (G.extra_field && /* zipfile extra field may have extended attribs */
+ FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
+ &ebSDptr, &ebSDlen))
+ {
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ /* no win32_wide implies "no NT SD support", so FindSDExtraField
+ * will never return "success".
+ */
+# else /* (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
int err = SetSD(__G__ Ansi_Fname, G.pInfo->file_attr,
ebSDptr, ebSDlen);
Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD),
ebSDlen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), uO.qflag? "\n":""));
}
- }
-#endif /* NTSD_EAS */
+# endif /* ? (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
+ }
+# endif /* NTSD_EAS */
- /* skip restoring time stamps on user's request */
- if (uO.D_flag <= 1) {
+ /* skip restoring time stamps on user's request */
+ if (uO.D_flag <= 1) {
if ( hFile == INVALID_HANDLE_VALUE )
Info(slide, 1, ((char *)slide,
- "\nCreateFile() error %d when trying set file time\n",
+ "\nCreateFile(1) error %d when trying to set file time\n",
(int)GetLastError()));
else {
if (gotTime) {
if (!SetFileTime(hFile, pCreft, pAccft, pModft))
Info(slide, 0, ((char *)slide,
- "\nSetFileTime failed: %d\n", (int)GetLastError()));
+ "\nSetFileTime(1) failed: %d\n", (int)GetLastError()));
}
CloseHandle(hFile);
}
#undef Ansi_Fname
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ } else {
+ /* wide version */
+
+/*---------------------------------------------------------------------------
+ If symbolic links are supported, allocate storage for a symlink
+ control structure, put the uncompressed "data" and other required
+ info into it, and add the structure to the "deferred symlinks"
+ chain. Because we know it's a symbolic link, we shouldn't need to
+ worry about overflowing unsigned ints with unsigned longs.
+ ---------------------------------------------------------------------------*/
+
+# ifdef SYMLINKS
+ if (G.symlnk) {
+ extent ucsize = (extent)G.lrec.ucsize;
+# ifdef SET_SYMLINK_ATTRIBS
+ extent attribsize = sizeof(unsigned) +
+ (have_uidgid_flg ? sizeof( z_uidgid) : 0);
+# else
+ extent attribsize = 0;
+# endif
+ /* Note: Hard-coded assumption that sizeof( wchar_t) = 2. */
+ int fname_aligner = (attribsize+ ucsize+ 1)& 1; /* Necessary? */
+
+ /* Size of the symlink entry is the sum of:
+ * struct size (includes 1 (buf[1]) for target text NUL),
+ * system specific attribute data size (might be 0),
+ * target text length (only -- NUL already counted, above),
+ * 1 (optional) to align wide link name,
+ * link name length + 1 (NUL).
+ */
+ extent slnk_entrysize = sizeof(slinkentry) + attribsize +
+ ucsize + fname_aligner +
+ sizeof( wchar_t)* (wcslen( G.unipath_widefilename)+ 1);
+
+ slinkentry *slnk_entry;
+
+ if (slnk_entrysize < ucsize) {
+ Info(slide, 0x201, ((char *)slide,
+ "warning: symbolic link (%s) failed: mem alloc overflow\n",
+ FnFilter1(G.filename)));
+ fclose(G.outfile);
+ return;
+ }
+
+ if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
+ Info(slide, 0x201, ((char *)slide,
+ "warning: symbolic link (%s) failed: no mem\n",
+ FnFilter1(G.filename)));
+ fclose(G.outfile);
+ return;
+ }
+ slnk_entry->next = NULL;
+ slnk_entry->targetlen = ucsize;
+ slnk_entry->attriblen = attribsize;
+ slnk_entry->wide = 1;
+# ifdef SET_SYMLINK_ATTRIBS
+ memcpy(slnk_entry->buf, &(G.pInfo->file_attr),
+ sizeof(unsigned));
+ if (have_uidgid_flg)
+ memcpy( (slnk_entry->buf + sizeof( unsigned)), z_uidgid,
+ sizeof( z_uidgid));
+# endif
+ slnk_entry->target = slnk_entry->buf + slnk_entry->attriblen;
+ slnk_entry->fname = slnk_entry->target + ucsize + 1 + fname_aligner;
+ wcscpy( (wchar_t *)slnk_entry->fname, G.unipath_widefilename);
+
+ slnk_entry->is_dir = 0;
+ if (G.filename[strlen(G.filename) - 1] == '/')
+ slnk_entry->is_dir = 1;
+
+ /* move back to the start of the file to re-read the "link data" */
+ rewind(G.outfile);
+
+ if (fread(slnk_entry->target, 1, ucsize, G.outfile) != ucsize)
+ {
+ Info(slide, 0x201, ((char *)slide,
+ "warning: symbolic link (%s) failed\n",
+ FnFilter1(G.filename)));
+ free(slnk_entry);
+ fclose(G.outfile);
+ return;
+ }
+ slnk_entry->target[ucsize] = '\0';
+ if (QCOND2)
+ Info(slide, 0, ((char *)slide, "-> %s ",
+ FnFilter1(slnk_entry->target)));
+ /* add this symlink record to the list of deferred symlinks */
+ if (G.slink_last != NULL)
+ G.slink_last->next = slnk_entry;
+ else
+ G.slink_head = slnk_entry;
+ G.slink_last = slnk_entry;
+ fclose( G.outfile);
+ return;
+ }
+# endif /* def SYMLINKS */
+
+# ifndef __RSXNT__
+ if (IsWinNT()) {
+ /* Truncate the file to the current position.
+ * This is needed to remove excess allocation in case the
+ * extraction has failed or stopped prematurely. */
+ SetEndOfFile((HANDLE)_get_osfhandle(fileno(G.outfile)));
+ }
+# endif
+
+ /* Close the file and then re-open it using the Win32
+ * CreateFile call, so that the file can be created
+ * with GENERIC_WRITE access, otherwise the SetFileTime
+ * call will fail. */
+ fclose(G.outfile);
+
+ /* don't set the time stamp and attributes on standard output */
+ if (uO.cflag)
+ return;
+
+ gotTime = getNTfiletimeW(__G__ &Modft, &Accft, &Creft);
+
+ /* open a handle to the file before processing extra fields;
+ we do this in case new security on file prevents us from updating
+ time stamps */
+
+ /* 2013-07-08 SMS. See note above. */
+#ifdef RETRY_CREATEFILE
+ for (cf_tries = IZ_CREATEFILE_TRY_COUNT; cf_tries > 0 ; cf_tries--)
+ {
+#endif /* def RETRY_CREATEFILE */
+
+ hFile = CreateFileW(G.unipath_widefilename,
+ GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+#ifdef RETRY_CREATEFILE
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ if (GetLastError() != ERROR_SHARING_VIOLATION)
+ break; /* Not a sharing error. Get out now. Otherwise: */
+ Sleep( IZ_CREATEFILE_TRY_TIME_MS); /* Sleep, then retry. */
+ }
+ else
+ {
+ break; /* Not a sharing error. (Success?) Get out now. */
+ }
+ }
+#endif /* def RETRY_CREATEFILE */
+
+ /* sfield@microsoft.com: set attributes before time in case we decide to
+ support other filetime members later. This also allows us to apply
+ attributes before the security is changed, which may prevent this
+ from succeeding otherwise. Also, since most files don't have
+ any interesting attributes, only change them if something other than
+ FILE_ATTRIBUTE_ARCHIVE appears in the attributes. This works well
+ as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the
+ file anyway, when it's created new. */
+ if((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) {
+ if (!SetFileAttributesW(G.unipath_widefilename, G.pInfo->file_attr & 0x7F))
+ Info(slide, 1, ((char *)slide,
+ "\nwarning (%d): could not set file attributes (2)\n",
+ (int)GetLastError()));
+ }
+
+# ifdef NTSD_EAS
+ /* set NTFS SD extra fields */
+ if (G.extra_field && /* zipfile extra field may have extended attribs */
+ FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
+ &ebSDptr, &ebSDlen))
+ {
+ int err = SetSD(__G__ G.unipath_widefilename, G.pInfo->file_attr,
+ ebSDptr, ebSDlen);
+
+ if (err == IZ_EF_TRUNC) {
+ if (uO.qflag)
+ Info(slide, 1, ((char *)slide, "%-22s ",
+ FnFilter1(G.filename)));
+ Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD),
+ ebSDlen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), uO.qflag? "\n":""));
+ }
+ }
+# endif /* NTSD_EAS */
+
+ /* skip restoring time stamps on user's request */
+ if (uO.D_flag <= 1) {
+ if ( hFile == INVALID_HANDLE_VALUE )
+ Info(slide, 1, ((char *)slide,
+ "\nCreateFile(2) error %d when trying to set file time\n",
+ (int)GetLastError()));
+ else {
+ if (gotTime) {
+ FILETIME *pModft = (gotTime & EB_UT_FL_MTIME) ? &Modft : NULL;
+ FILETIME *pAccft = (gotTime & EB_UT_FL_ATIME) ? &Accft : NULL;
+ FILETIME *pCreft = (gotTime & EB_UT_FL_CTIME) ? &Creft : NULL;
+
+ if (!SetFileTime(hFile, pCreft, pAccft, pModft))
+ Info(slide, 0, ((char *)slide,
+ "\nSetFileTime(2) failed: %d\n", (int)GetLastError()));
+ }
+ CloseHandle(hFile);
+ }
+ }
+
+ return;
+
+ }
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
} /* end function close_outfile() */
-#ifdef SET_DIR_ATTRIB
+# ifdef SET_DIR_ATTRIB
int defer_dir_attribs(__G__ pd)
__GDEF
direntry **pd;
{
NTdirattr *d_entry;
-#ifdef NTSD_EAS
+# ifdef NTSD_EAS
uch *ebSDptr;
unsigned ebSDlen;
-#endif
+# endif
/* Win9x does not support setting directory time stamps. */
if (!IsWinNT()) {
return PK_OK;
}
-#ifdef NTSD_EAS
+# ifdef NTSD_EAS
/* set extended attributes from extra fields */
if (G.extra_field && /* zipfile e.f. may have extended attribs */
FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
/* no NTSD e.f. block -> no space needed to allocate */
ebSDlen = 0;
}
-#endif /* NTSD_EAS */
+# endif /* NTSD_EAS */
- d_entry = (NTdirattr *)malloc(sizeof(NTdirattr)
-#ifdef NTSD_EAS
- + ebSDlen
-#endif
- + strlen(G.filename));
+# ifdef NTSD_EAS
+# define ASIZE1 sizeof(NTdirattr)+ ebSDlen+ strlen(G.filename)
+# else /* def NTSD_EAS */
+# define ASIZE1 sizeof(NTdirattr)+ strlen(G.filename)
+# endif /* def NTSD_EAS [else] */
+
+ d_entry = (NTdirattr *)izu_malloc(ASIZE1);
*pd = (direntry *)d_entry;
if (d_entry == (NTdirattr *)NULL) {
return PK_MEM;
}
-#ifdef NTSD_EAS
+# ifdef NTSD_EAS
if (ebSDlen > 0)
memcpy(d_entry->buf, ebSDptr, ebSDlen);
d_entry->SDlen = ebSDlen;
d_entry->fn = d_entry->buf + ebSDlen;
-#else
+# else
d_entry->fn = d_entry->buf;
-#endif
+# endif
strcpy(d_entry->fn, G.filename);
} /* end function defer_dir_attribs() */
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+int defer_dir_attribsw(__G__ pdw)
+ __GDEF
+ direntryw **pdw;
+{
+ NTdirattrw *d_entryw;
+# ifdef NTSD_EAS
+ uch *ebSDptr;
+ unsigned ebSDlen;
+# endif
+
+ /* Win9x does not support setting directory time stamps. */
+ if (!IsWinNT()) {
+ *pdw = (direntryw *)NULL;
+ return PK_OK;
+ }
+
+# ifdef NTSD_EAS
+ /* set extended attributes from extra fields */
+ if (G.extra_field && /* zipfile e.f. may have extended attribs */
+ FindSDExtraField(__G__ G.extra_field, G.lrec.extra_field_length,
+ &ebSDptr, &ebSDlen)) {
+ /* ebSDlen contains the payload size of the e.f. block, but
+ we store it including the e.b. header. */
+ ebSDlen += EB_HEADSIZE;
+ } else {
+ /* no NTSD e.f. block -> no space needed to allocate */
+ ebSDlen = 0;
+ }
+# endif /* NTSD_EAS */
+
+# ifdef NTSD_EAS
+# define ASIZE2 sizeof(NTdirattrw)+ ebSDlen+ \
+ (wcslen(G.unipath_widefilename)* sizeof(wchar_t))
+# else /* def NTSD_EAS */
+# define ASIZE2 sizeof(NTdirattrw)+ \
+ (wcslen(G.unipath_widefilename)* sizeof(wchar_t))
+# endif /* def NTSD_EAS [else] */
+
+ d_entryw = (NTdirattrw *)izu_malloc(ASIZE2);
+ *pdw = (direntryw *)d_entryw;
+ if (d_entryw == (NTdirattrw *)NULL) {
+ return PK_MEM;
+ }
+# ifdef NTSD_EAS
+ if (ebSDlen > 0)
+ memcpy(d_entryw->buf, ebSDptr, ebSDlen);
+ d_entryw->SDlen = ebSDlen;
+ d_entryw->fnw = d_entryw->buf + ebSDlen;
+# else
+ d_entryw->fnw = d_entryw->buf;
+# endif
+
+ wcscpy(d_entryw->fnw, G.unipath_widefilename);
+
+ d_entryw->perms = G.pInfo->file_attr;
+
+ d_entryw->gotTime = (uO.D_flag <= 0
+ ? getNTfiletimeW(__G__ &(d_entryw->Modft),
+ &(d_entryw->Accft),
+ &(d_entryw->Creft))
+ : 0);
+ return PK_OK;
+} /* end function defer_dir_attribsw() */
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+
+
+
int set_direc_attribs(__G__ d)
__GDEF
direntry *d;
{
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+ /* Win9x does not support setting directory time stamps. */
+ return PK_OK;
+# else /* ! (defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
int errval;
HANDLE hFile = INVALID_HANDLE_VALUE; /* File handle defined in NT */
-#ifdef __RSXNT__
+# ifdef __RSXNT__
char *ansi_name;
-#endif
+# endif
/* Win9x does not support setting directory time stamps. */
if (!IsWinNT())
return PK_OK;
errval = PK_OK;
-#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
+# ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
ansi_name = (char *)alloca(strlen(d->fn) + 1);
INTERN_TO_ISO(d->fn, ansi_name);
# define Ansi_Dirname ansi_name
-#else
+# else
# define Ansi_Dirname d->fn
-#endif
+# endif
/* Skip restoring directory time stamps on user' request. */
if (uO.D_flag <= 0) {
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
}
-#ifdef NTSD_EAS
+# ifdef NTSD_EAS
if (NtAtt(d)->SDlen > 0) {
int err;
if (errval < err)
errval = err;
}
-#endif /* NTSD_EAS */
+# endif /* NTSD_EAS */
/* Skip restoring directory time stamps on user' request. */
if (uO.D_flag <= 0) {
if (hFile == INVALID_HANDLE_VALUE) {
Info(slide, 1, ((char *)slide,
- "warning: CreateFile() error %d (set file times for %s)\n",
+ "warning: CreateFile(3) error %d (set file times for %s)\n",
(int)GetLastError(), FnFilter1(d->fn)));
if (!errval)
errval = PK_WARN;
if (!SetFileTime(hFile, pCreft, pAccft, pModft)) {
Info(slide, 0, ((char *)slide,
- "warning: SetFileTime() for %s error %d\n",
+ "warning: SetFileTime(3) for %s error %d\n",
FnFilter1(d->fn), (int)GetLastError()));
if (!errval)
errval = PK_WARN;
}
return errval;
-} /* end function set_direc_attribs() */
-
-#endif /* SET_DIR_ATTRIB */
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+} /* end function set_direc_attribs() */
-#ifdef TIMESTAMP
-/*************************/
-/* Function stamp_file() */
-/*************************/
-int stamp_file(__GPRO__ ZCONST char *fname, time_t modtime)
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+int set_direc_attribsw(__G__ dw)
+ __GDEF
+ direntryw *dw;
{
- FILETIME Modft; /* File time type defined in NT, `last modified' time */
- HANDLE hFile; /* File handle defined in NT */
- int errstat = 0; /* return status: 0 == "OK", -1 == "Failure" */
- int fs_uses_loctime = FStampIsLocTime(__G__ fname);
-#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
- char *ansi_name = (char *)alloca(strlen(fname) + 1);
+ int errval;
+ HANDLE hFile = INVALID_HANDLE_VALUE; /* File handle defined in NT */
- INTERN_TO_ISO(fname, ansi_name);
-# define Ansi_Fname ansi_name
-#else
-# define Ansi_Fname fname
-#endif
+ /* Win9x does not support setting directory time stamps. */
+ if (!IsWinNT())
+ return PK_OK;
+
+ errval = PK_OK;
+
+ /* Skip restoring directory time stamps on user' request. */
+ if (uO.D_flag <= 0) {
+ /* Open a handle to the directory before processing extra fields;
+ we do this in case new security on file prevents us from updating
+ time stamps.
+ Although the WIN32 documentation recommends to use GENERIC_WRITE
+ access flag to create the handle for SetFileTime(), this is too
+ demanding for directories with the "read-only" attribute bit set.
+ So we use the more specific flag FILE_WRITE_ATTRIBUTES here to
+ request the minimum required access rights. (This problem is a
+ Windows bug that has been silently fixed in Windows XP SP2.) */
+ hFile = CreateFileW(dw->fnw, FILE_WRITE_ATTRIBUTES,
+ FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ }
+
+# ifdef NTSD_EAS
+ if (NtAtt(dw)->SDlen > 0) {
+ int err;
+
+ if (QCOND2) {
+ char *fn = wchar_to_local_string(dw->fnw, G.unicode_escape_all);
+ Info(slide, 1, ((char *)slide, " set attrib: %-22s ",
+ FnFilter1(fn)));
+ izu_free(fn);
+ }
+
+ /* set NTFS SD extra fields */
+ err = SetSD(__G__ dw->fnw, NtAtt(dw)->perms,
+ NtAtt(dw)->buf, NtAtt(dw)->SDlen - EB_HEADSIZE);
+ if (err == IZ_EF_TRUNC) {
+ if (!QCOND2) {
+ char *fn = wchar_to_local_string(dw->fnw, G.unicode_escape_all);
+ Info(slide, 1, ((char *)slide, "%-22s ",
+ FnFilter1(fn)));
+ izu_free(fn);
+ }
+ Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD),
+ NtAtt(dw)->SDlen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), "\n"));
+ } else if (QCOND2) {
+ Info(slide, 0, ((char *)slide, "\n"));
+ }
+ if (errval < err)
+ errval = err;
+ }
+# endif /* NTSD_EAS */
+
+ /* Skip restoring directory time stamps on user' request. */
+ if (uO.D_flag <= 0) {
+ if (hFile == INVALID_HANDLE_VALUE) {
+ char *fn = wchar_to_local_string(dw->fnw, G.unicode_escape_all);
+ Info(slide, 1, ((char *)slide,
+ "warning: CreateFile(4) error %d (set file times for %s)\n",
+ (int)GetLastError(), FnFilter1(fn)));
+ izu_free(fn);
+ if (!errval)
+ errval = PK_WARN;
+ } else {
+ if (NtAtt(dw)->gotTime) {
+ FILETIME *pModft = (NtAtt(dw)->gotTime & EB_UT_FL_MTIME)
+ ? &(NtAtt(dw)->Modft) : NULL;
+ FILETIME *pAccft = (NtAtt(dw)->gotTime & EB_UT_FL_ATIME)
+ ? &(NtAtt(dw)->Accft) : NULL;
+ FILETIME *pCreft = (NtAtt(dw)->gotTime & EB_UT_FL_CTIME)
+ ? &(NtAtt(dw)->Creft) : NULL;
+
+ if (!SetFileTime(hFile, pCreft, pAccft, pModft)) {
+ char *fn = wchar_to_local_string(dw->fnw,
+ G.unicode_escape_all);
+ Info(slide, 0, ((char *)slide,
+ "warning: SetFileTime(4) for %s error %d\n",
+ FnFilter1(fn), (int)GetLastError()));
+ izu_free(fn);
+ if (!errval)
+ errval = PK_WARN;
+ }
+ }
+ CloseHandle(hFile);
+ }
+ }
+
+ return errval;
+} /* end function set_direc_attribsw() */
+
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+# endif /* SET_DIR_ATTRIB */
+
+
+
+# ifdef TIMESTAMP
+
+/*************************/
+/* Function stamp_file() */
+/*************************/
+
+int stamp_file(__GPRO__ ZCONST char *fname, time_t modtime)
+{
+ FILETIME Modft; /* File time type defined in NT, `last modified' time */
+ HANDLE hFile; /* File handle defined in NT */
+ int errstat = 0; /* return status: 0 == "OK", -1 == "Failure" */
+ int fs_uses_loctime = FStampIsLocTime(__G__ fname);
+
+/* 2013-07-08 SMS. See note above. */
+# ifdef RETRY_CREATEFILE
+ int cf_tries;
+# endif
+
+# ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
+ char *ansi_name = (char *)alloca(strlen(fname) + 1);
+
+ INTERN_TO_ISO(fname, ansi_name);
+# define Ansi_Fname ansi_name
+# else
+# define Ansi_Fname fname
+# endif
+
+ /* open a handle to the file to prepare setting the mod-time stamp */
+
+#ifdef RETRY_CREATEFILE
+ for (cf_tries = IZ_CREATEFILE_TRY_COUNT; cf_tries > 0 ; cf_tries--)
+ {
+#endif /* def RETRY_CREATEFILE */
+
+ hFile = CreateFileA( Ansi_Fname,
+ GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+#ifdef RETRY_CREATEFILE
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ if (GetLastError() != ERROR_SHARING_VIOLATION)
+ break; /* Not a sharing error. Get out now. Otherwise: */
+ Sleep( IZ_CREATEFILE_TRY_TIME_MS); /* Sleep, then retry. */
+ }
+ else
+ {
+ break; /* Not a sharing error. (Success?) Get out now. */
+ }
+ }
+#endif /* def RETRY_CREATEFILE */
- /* open a handle to the file to prepare setting the mod-time stamp */
- hFile = CreateFileA(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if ( hFile == INVALID_HANDLE_VALUE ) {
errstat = -1;
} else {
#undef Ansi_Fname
} /* end function stamp_file() */
-#endif /* TIMESTAMP */
+# endif /* TIMESTAMP */
char *tmp0;
char tmp1[MAX_PATH], tmp2[MAX_PATH];
DWORD volSerNo, maxCompLen, fileSysFlags;
-#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
+# ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
char *ansi_name = (char *)alloca(strlen(name) + 1);
INTERN_TO_ISO(name, ansi_name);
name = ansi_name;
-#endif
+# endif
if ((!strncmp(name, "//", 2) || !strncmp(name, "\\\\", 2)) &&
(name[2] != '\0' && name[2] != '/' && name[2] != '\\')) {
} /* end function NTQueryVolInfo() */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static int NTQueryVolInfoW(__GPRO__ const wchar_t *namew)
+{
+ /* static char lastRootPath[4] = ""; */
+ /* static int lastVolOldFAT; */
+ /* static int lastVolLocTim; */
+ wchar_t *tmp0w;
+ wchar_t tmp1w[MAX_PATH], tmp2w[MAX_PATH];
+ DWORD volSerNo, maxCompLen, fileSysFlags;
+
+ if ((!wcsncmp(namew, L"//", 2) || !wcsncmp(namew, L"\\\\", 2)) &&
+ (namew[2] != '\0' && namew[2] != '/' && namew[2] != '\\')) {
+ /* GetFullPathname() and GetVolumeInformation() do not work
+ * on UNC names. For now, we return "error".
+ * **FIXME**: check if UNC name is mapped to a drive letter
+ * and use mapped drive for volume info query.
+ */
+ return FALSE;
+ }
+ if (iswalpha(namew[0]) && (namew[1] == ':'))
+ tmp0w = (wchar_t *)namew;
+ else
+ {
+ if (!GetFullPathNameW(namew, MAX_PATH, tmp1w, &tmp0w))
+ return FALSE;
+ tmp0w = &tmp1w[0];
+ }
+ if (wcsncmp(G.lastRootPathw, tmp0w, 2) != 0) {
+ /* For speed, we skip repeated queries for the same device */
+ wcsncpy(G.lastRootPathw, tmp0w, 2); /* Build the root path name, */
+ G.lastRootPathw[2] = '/'; /* e.g. "A:/" */
+ G.lastRootPathw[3] = '\0';
+
+ if (!GetVolumeInformationW(G.lastRootPathw,
+ tmp1w, (DWORD)MAX_PATH,
+ &volSerNo, &maxCompLen, &fileSysFlags,
+ tmp2w, (DWORD)MAX_PATH)) {
+ G.lastRootPathw[0] = '\0';
+ return FALSE;
+ }
+
+ /* LFNs are available if the component length is > 12 */
+ G.lastVolOldFAT = (maxCompLen <= 12);
+/* G.lastVolOldFAT = !strncmp(strupr(tmp2), "FAT", 3); old version */
+
+ /* Volumes in (V)FAT and (OS/2) HPFS format store file timestamps in
+ * local time!
+ */
+ G.lastVolLocTim = !wcsncmp(_wcsupr(tmp2w), L"VFAT", 4) ||
+ !wcsncmp(tmp2w, L"HPFS", 4) ||
+ !wcsncmp(tmp2w, L"FAT", 3);
+ }
+
+ return TRUE;
+
+} /* end function NTQueryVolInfoW() */
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+
/*****************************/
return (NTQueryVolInfo(__G__ name) ? G.lastVolOldFAT : FALSE);
}
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+static int IsVolumeOldFATw(__GPRO__ const wchar_t *namew)
+{
+ return (NTQueryVolInfoW(__G__ namew) ? G.lastVolOldFAT : FALSE);
+}
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-#ifndef SFX
+
+# ifndef SFX
/************************/
/* Function do_wild() */ /* identical to OS/2 version */
return G.matchname;
}
- /* break the wildspec into a directory part and a wildcard filename */
+ /* Break the wildspec into a directory part and a wildcard filename. */
+ /* 2014-02-14 SMS. Added test for "\". */
if ((G.wildname = MBSRCHR(wildspec, '/')) == (ZCONST char *)NULL &&
- (G.wildname = MBSRCHR(wildspec, ':')) == (ZCONST char *)NULL) {
+ (G.wildname = MBSRCHR(wildspec, '\\')) == (ZCONST char *)NULL &&
+ (G.wildname = MBSRCHR(wildspec, ':')) == (ZCONST char *)NULL) {
G.dirname = ".";
G.dirnamelen = 1;
G.have_dirname = FALSE;
G.wildname = wildspec;
} else {
- ++G.wildname; /* point at character after '/' or ':' */
+ ++G.wildname; /* Point at char after last '/', '\', or ':'. */
G.dirnamelen = G.wildname - wildspec;
- if ((G.dirname = (char *)malloc(G.dirnamelen+1)) == NULL) {
+ if ((G.dirname = (char *)izu_malloc(G.dirnamelen+1)) == NULL) {
Info(slide, 1, ((char *)slide,
- "warning: cannot allocate wildcard buffers\n"));
+ "warning: cannot allocate wildcard buffers\n"));
strncpy(G.matchname, wildspec, FILNAMSIZ);
G.matchname[FILNAMSIZ-1] = '\0';
return G.matchname; /* but maybe filespec was not a wildcard */
if (G.wild_dir == NULL) {
G.notfirstcall = FALSE; /* reset for new wildspec */
if (G.have_dirname)
- free(G.dirname);
+ izu_free(G.dirname);
return (char *)NULL;
}
G.wild_dir = NULL;
G.notfirstcall = FALSE; /* reset for new wildspec */
if (G.have_dirname)
- free(G.dirname);
+ izu_free(G.dirname);
return (char *)NULL;
} /* end function do_wild() */
-#endif /* !SFX */
+# endif /* !SFX */
G.pInfo->file_attr = ((unsigned)G.crec.external_file_attributes |
(G.crec.external_file_attributes & FILE_ATTRIBUTE_DIRECTORY ?
0 : FILE_ATTRIBUTE_ARCHIVE)) & 0xff;
+
+# ifdef SYMLINKS
+ if (SYMLINK_HOST( G.pInfo->hostnum))
+ {
+ unsigned int uxattr;
+
+ uxattr = (G.crec.external_file_attributes >> 16); /* drwxrwxrwx */
+
+ G.pInfo->symlink = S_ISLNK( uxattr);
+ }
+# endif /* def SYMLINKS */
+
return 0;
} /* end function mapattr() */
*/
{
char pathcomp[FILNAMSIZ]; /* path-component buffer */
+# ifdef SYMLINKS
+ char pathcopy[FILNAMSIZ]; /* Copy of path we can alter. */
+# endif
char *pp, *cp=NULL; /* character pointers */
char *lastsemi = NULL; /* pointer to last semi-colon in pathcomp */
-#ifdef ACORN_FTYPE_NFS
+# ifdef ACORN_FTYPE_NFS
char *lastcomma=(char *)NULL; /* pointer to last comma in pathcomp */
RO_extra_block *ef_spark; /* pointer Acorn FTYPE ef block */
-#endif
+# endif
int killed_ddot = FALSE; /* is set when skipping "../" pathcomp */
int error;
register unsigned workch; /* hold the character being tested */
-
/*---------------------------------------------------------------------------
Initialize various pointers and counters and stuff.
---------------------------------------------------------------------------*/
G.fnlen = strlen(G.filename);
if (renamed) {
- cp = G.filename; /* point to beginning of renamed name... */
+ cp = G.filename; /* Point to start of renamed name. */
if (*cp) do {
- if (*cp == '\\') /* convert backslashes to forward */
+ if (*cp == '\\') /* Convert backslashes to slashes. */
*cp = '/';
} while (*PREINCSTR(cp));
cp = G.filename;
/* use temporary rootpath if user gave full pathname */
if (G.filename[0] == '/') {
G.renamed_fullpath = TRUE;
- pathcomp[0] = '/'; /* copy the '/' and terminate */
+ pathcomp[0] = '/'; /* Copy the '/', and NUL-terminate. */
pathcomp[1] = '\0';
++cp;
} else if (isalpha((uch)G.filename[0]) && G.filename[1] == ':') {
G.renamed_fullpath = TRUE;
pp = pathcomp;
- *pp++ = *cp++; /* copy the "d:" (+ '/', possibly) */
+ *pp++ = *cp++; /* Copy the "d:" (+ '/', possibly). */
*pp++ = *cp++;
if (*cp == '/')
- *pp++ = *cp++; /* otherwise add "./"? */
+ *pp++ = *cp++; /* Otherwise add "./"? */
*pp = '\0';
}
}
/* pathcomp is ignored unless renamed_fullpath is TRUE: */
- if ((error = checkdir(__G__ pathcomp, INIT)) != 0) /* init path buffer */
+ if ((error = checkdir(__G__ pathcomp, INIT)) != 0) /* init path buffer */
return error; /* ...unless no mem or vol label on hard disk */
*pathcomp = '\0'; /* initialize translation buffer */
pp = pathcomp; /* point to translation buffer */
if (!renamed) { /* cp already set if renamed */
- if (uO.jflag) /* junking directories */
- cp = (char *)MBSRCHR(G.filename, '/');
- if (cp == NULL) /* no '/' or not junking dirs */
- cp = G.filename; /* point to internal zipfile-member pathname */
- else
- ++cp; /* point to start of last component of path */
+ cp = G.jdir_filename; /* Start at beginning of non-junked path. */
+ }
+
+# ifdef SYMLINKS
+ /* If a symlink with a trailing "/", then use a copy without the "/". */
+ if (G.pInfo->symlink)
+ {
+ size_t lenm1;
+
+ lenm1 = strlen( cp)- 1;
+ if (cp[ lenm1] == '/')
+ {
+ strncpy( pathcopy, cp, lenm1);
+ pathcopy[ lenm1] = '\0';
+ cp = pathcopy;
+ }
}
+# endif /* def SYMLINKS */
/*---------------------------------------------------------------------------
Begin main loop through characters in filename.
for (; (workch = (uch)*cp) != 0; INCSTR(cp)) {
switch (workch) {
- case '/': /* can assume -j flag not given */
+ case '/': /* Can assume -j flag not given. */
*pp = '\0';
maskDOSdevice(__G__ pathcomp);
if (strcmp(pathcomp, ".") == 0) {
- /* don't bother appending "./" to the path */
+ /* Don't bother appending "./" to the path. */
*pathcomp = '\0';
} else if (!uO.ddotflag && strcmp(pathcomp, "..") == 0) {
- /* "../" dir traversal detected, skip over it */
+ /* "../" dir traversal detected. Skip over it. */
*pathcomp = '\0';
- killed_ddot = TRUE; /* set "show message" flag */
+ killed_ddot = TRUE; /* Set "show message" flag. */
}
- /* when path component is not empty, append it now */
+ /* When path component is not empty, append it now. */
if (*pathcomp != '\0' &&
((error = checkdir(__G__ pathcomp, APPEND_DIR))
& MPN_MASK) > MPN_INF_TRUNC)
return error;
- pp = pathcomp; /* reset conversion buffer for next piece */
- lastsemi = (char *)NULL; /* leave direct. semi-colons alone */
+ pp = pathcomp; /* Reset conversion buffer for next piece. */
+ lastsemi = (char *)NULL; /* Leave dir semi-colons alone. */
break;
case ':': /* drive spec not stored, so no colon allowed */
*pp++ = ';'; /* but keep semicolon for now */
break;
-#ifdef ACORN_FTYPE_NFS
+# ifdef ACORN_FTYPE_NFS
case ',': /* NFS filetype extension */
lastcomma = pp;
*pp++ = ','; /* keep for now; may need to remove */
break; /* later, if requested */
-#endif
+# endif
case ' ': /* keep spaces unless specifically */
/* NT cannot create filenames with spaces on FAT volumes */
default:
/* allow European characters in filenames: */
if (isprint(workch) || workch >= 127)
-#ifdef _MBCS
+# ifdef _MBCS
{
memcpy(pp, cp, CLEN(cp));
INCSTR(pp);
}
-#else
+# else
*pp++ = (char)workch;
-#endif
+# endif
} /* end switch */
} /* end while loop */
/* Show warning when stripping insecure "parent dir" path components */
if (killed_ddot && QCOND2) {
Info(slide, 0, ((char *)slide,
- "warning: skipped \"../\" path component(s) in %s\n",
+ "warning: skipped \"../\" path component(s) (1) in %s\n",
FnFilter1(G.filename)));
if (!(error & ~MPN_MASK))
error = (error & MPN_MASK) | PK_WARN;
fore exiting.
---------------------------------------------------------------------------*/
- if (lastchar(G.filename, G.fnlen) == '/') {
-#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
+ if ((lastchar(G.filename, G.fnlen) == '/')
+# ifdef SYMLINKS
+ /* Process a symlink as a file, even if it looks like a directory.
+ * (Which a Windows directory symlink might do.)
+ */
+ && !G.pInfo->symlink
+# endif /* def SYMLINKS */
+ )
+ {
+# ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
char *ansi_name = (char *)alloca(strlen(G.filename) + 1);
INTERN_TO_ISO(G.filename, ansi_name);
# define Ansi_Fname ansi_name
-#else
+# else
# define Ansi_Fname G.filename
-#endif
+# endif
checkdir(__G__ G.filename, GETPATH);
if (G.created_dir) {
if (QCOND2) {
if(G.pInfo->file_attr & (0x7F & ~FILE_ATTRIBUTE_DIRECTORY)) {
if (!SetFileAttributesA(Ansi_Fname, G.pInfo->file_attr & 0x7F))
Info(slide, 1, ((char *)slide,
- "\nwarning (%d): could not set file attributes for %s\n",
+ "\nwarning (%d): could not set file attributes (3) for %s\n",
(int)GetLastError(), FnFilter1(G.filename)));
}
if(G.pInfo->file_attr & (0x7F & ~FILE_ATTRIBUTE_DIRECTORY)) {
if (!SetFileAttributesA(Ansi_Fname, G.pInfo->file_attr & 0x7F))
Info(slide, 1, ((char *)slide,
- "\nwarning (%d): could not set file attributes for %s\n",
+ "\nwarning (%d): could not set file attributes (4) for %s\n",
(int)GetLastError(), FnFilter1(G.filename)));
}
}
*pp = '\0'; /* done with pathcomp: terminate it */
- /* if not saving them, remove VMS version numbers (appended "###") */
- if (!uO.V_flag && lastsemi) {
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemi &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
pp = lastsemi + 1; /* semi-colon was kept: expect #'s after */
- while (isdigit((uch)(*pp)))
- ++pp;
- if (*pp == '\0') /* only digits between ';' and end: nuke */
- *lastsemi = '\0';
+ if (*pp != '\0') { /* At least one digit is required. */
+ while (isdigit((uch)(*pp)))
+ ++pp;
+ if (*pp == '\0') /* only digits between ';' and end: nuke */
+ *lastsemi = '\0';
+ }
}
-#ifdef ACORN_FTYPE_NFS
+# ifdef ACORN_FTYPE_NFS
/* translate Acorn filetype information if asked to do so */
if (uO.acorn_nfs_ext &&
(ef_spark = (RO_extra_block *)
if ((ft & 1<<31)==0) ft=0x000FFD00;
sprintf(pathcomp+strlen(pathcomp), ",%03x", (int)(ft>>8) & 0xFFF);
}
-#endif /* ACORN_FTYPE_NFS */
+# endif /* ACORN_FTYPE_NFS */
maskDOSdevice(__G__ pathcomp);
if (*pathcomp == '\0') {
- Info(slide, 1, ((char *)slide, "mapname: conversion of %s failed\n",
+ Info(slide, 1, ((char *)slide, "mapname(1): conversion of %s failed\n",
FnFilter1(G.filename)));
return (error & ~MPN_MASK) | MPN_ERR_SKIP;
}
checkdir(__G__ G.filename, GETPATH);
if (G.pInfo->vollabel) { /* set the volume label now */
- char drive[4];
-#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
+ char drive[4] = "?:\\";
+# ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
char *ansi_name = (char *)alloca(strlen(G.filename) + 1);
INTERN_TO_ISO(G.filename, ansi_name);
# define Ansi_Fname ansi_name
-#else
+# else
# define Ansi_Fname G.filename
-#endif
+# endif
- /* Build a drive string, e.g. "b:" */
- drive[0] = (char)('a' + G.nLabelDrive - 1);
- strcpy(drive + 1, ":\\");
+ /* Insert the drive letter into the drive string. E.g. "b:\". */
+ drive[0] = (char)(('a'- 1)+ G.nLabelDrive);
if (QCOND2)
- Info(slide, 0, ((char *)slide, "labelling %s %-22s\n", drive,
+ Info(slide, 0, ((char *)slide, "labeling %s %-22s\n", drive,
FnFilter1(G.filename)));
if (!SetVolumeLabelA(drive, Ansi_Fname)) {
Info(slide, 1, ((char *)slide,
- "mapname: error setting volume label\n"));
+ "mapname(1): error setting volume label\n"));
return (error & ~MPN_MASK) | MPN_ERR_SKIP;
}
- /* success: skip the "extraction" quietly */
+ /* success: skip the "extraction" quietly */
return (error & ~MPN_MASK) | MPN_INF_SKIP;
#undef Ansi_Fname
}
-
Trace((stderr, "mapname returns with filename = [%s] (error = %d)\n\n",
FnFilter1(G.filename), error));
return error;
} /* end function mapname() */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
-/****************************/
-/* Function maskDOSdevice() */
-/****************************/
-
-static void maskDOSdevice(__G__ pathcomp)
+int mapnamew(__G__ renamed)
__GDEF
- char *pathcomp;
+ int renamed;
+/*
+ * returns:
+ * MPN_OK - no problem detected
+ * MPN_INF_TRUNC - caution (truncated filename)
+ * MPN_INF_SKIP - info "skip entry" (dir doesn't exist)
+ * MPN_ERR_SKIP - error -> skip entry
+ * MPN_ERR_TOOLONG - error -> path is too long
+ * MPN_NOMEM - error (memory allocation failed) -> skip entry
+ * [also MPN_VOL_LABEL, MPN_CREATED_DIR]
+ */
{
+ wchar_t pathcompw[FILNAMSIZ]; /* path-component buffer */
+# ifdef SYMLINKS
+ wchar_t pathcopy[FILNAMSIZ];
+# endif /* def SYMLINKS */
+ wchar_t *ppw, *cpw=NULL; /* character pointers */
+ wchar_t *lastsemiw = NULL; /* pointer to last semi-colon in pathcomp */
+ int killed_ddot = FALSE; /* is set when skipping "../" pathcomp */
+ int error;
+ register wchar_t workchw; /* hold the character being tested */
+
/*---------------------------------------------------------------------------
- Put an underscore in front of the file name if the file name is a
- DOS/WINDOWS device name like CON.*, AUX.*, PRN.*, etc. Trying to
- extract such a file would fail at best and wedge us at worst.
+ Initialize various pointers and counters and stuff.
---------------------------------------------------------------------------*/
-#if !defined(S_IFCHR) && defined(_S_IFCHR)
-# define S_IFCHR _S_IFCHR
-#endif
-#if !defined(S_ISCHR)
-# if defined(_S_ISCHR)
-# define S_ISCHR(m) _S_ISCHR(m)
-# elif defined(S_IFCHR)
-# define S_ISCHR(m) ((m) & S_IFCHR)
-# endif
-#endif
-#ifdef DEBUG
- if (zstat(pathcomp, &G.statbuf) == 0) {
- Trace((stderr,
- "maskDOSdevice() stat(\"%s\", buf) st_mode result: %X, %o\n",
- FnFilter1(pathcomp), G.statbuf.st_mode, G.statbuf.st_mode));
- } else {
- Trace((stderr, "maskDOSdevice() stat(\"%s\", buf) failed\n",
- FnFilter1(pathcomp)));
- }
-#endif
- if (zstat(pathcomp, &G.statbuf) == 0 && S_ISCHR(G.statbuf.st_mode)) {
- extent i;
+ /* can create path as long as not just freshening, or if user told us */
+ G.create_dirs = (!uO.fflag || renamed);
- /* pathcomp contains a name of a DOS character device (builtin or
- * installed device driver).
- * Prepend a '_' to allow creation of the item in the file system.
- */
- for (i = strlen(pathcomp) + 1; i > 0; --i)
- pathcomp[i] = pathcomp[i - 1];
- pathcomp[0] = '_';
- }
-} /* end function maskDOSdevice() */
+ G.created_dir = FALSE; /* not yet */
+ G.renamed_fullpath = FALSE;
+ G.fnlen = wcslen(G.unipath_widefilename);
+ if (renamed) {
+ cpw = G.unipath_widefilename; /* Point to start of renamed name. */
+ if (*cpw) do {
+ if (*cpw == '\\') /* Convert backslashes to slashes. */
+ *cpw = '/';
+ } while (*(++cpw));
+ cpw = G.unipath_widefilename;
+ /* use temporary rootpath if user gave full pathname */
+ if (G.unipath_widefilename[0] == '/') {
+ G.renamed_fullpath = TRUE;
+ pathcompw[0] = '/'; /* Copy the '/', and NUL-terminate. */
+ pathcompw[1] = '\0';
+ ++cpw;
+ } else if (iswalpha(G.unipath_widefilename[0]) && G.unipath_widefilename[1] == ':') {
+ G.renamed_fullpath = TRUE;
+ ppw = pathcompw;
+ *ppw++ = *cpw++; /* Copy the "d:" (+ '/', possibly). */
+ *ppw++ = *cpw++;
+ if (*cpw == '/')
+ *ppw++ = *cpw++; /* Otherwise add "./"? */
+ *ppw = '\0';
+ }
+ }
+ /* pathcomp is ignored unless renamed_fullpath is TRUE: */
+ if ((error = checkdirw(__G__ pathcompw, INIT)) != 0) /* init path buffer */
+ return error; /* ...unless no mem or vol label on hard disk */
+ *pathcompw = '\0'; /* initialize translation buffer */
+ ppw = pathcompw; /* point to translation buffer */
+ if (!renamed) { /* cp already set if renamed */
+ cpw = G.unipath_jdir_widefilename; /* Beginning of non-junked path. */
+ }
+# ifdef SYMLINKS
+ /* If a symlink with a trailing "/", then use a copy without the "/". */
+ if (G.pInfo->symlink)
+ {
+ size_t lenm1;
-/**********************/
-/* Function map2fat() */ /* Not quite identical to OS/2 version */
-/**********************/
+ lenm1 = wcslen( cpw)- 1;
+ if (cpw[ lenm1] == L'/')
+ {
+ wcsncpy( pathcopy, cpw, lenm1);
+ pathcopy[ lenm1] = L'\0';
+ cpw = pathcopy;
+ }
+ }
+# endif /* def SYMLINKS */
-static void map2fat(pathcomp, pEndFAT)
- char *pathcomp, **pEndFAT;
-{
- char *ppc = pathcomp; /* variable pointer to pathcomp */
- char *pEnd = *pEndFAT; /* variable pointer to buildpathFAT */
- char *pBegin = *pEndFAT; /* constant pointer to start of this comp. */
- char *last_dot = NULL; /* last dot not converted to underscore */
- register unsigned workch; /* hold the character being tested */
+/*---------------------------------------------------------------------------
+ Begin main loop through characters in filename.
+ ---------------------------------------------------------------------------*/
+ for (; (workchw = *cpw) != 0; cpw++) {
+
+ switch (workchw) {
+ case '/': /* Can assume -j flag not given. */
+ *ppw = '\0';
+ maskDOSdevicew(__G__ pathcompw);
+ if (wcscmp(pathcompw, L".") == 0) {
+ /* Don't bother appending "./" to the path. */
+ *pathcompw = '\0';
+ } else if (!uO.ddotflag && wcscmp(pathcompw, L"..") == 0) {
+ /* "../" dir traversal detected. Skip over it. */
+ *pathcompw = '\0';
+ killed_ddot = TRUE; /* Set "show message" flag. */
+ }
+ /* When path component is not empty, append it now. */
+ if (*pathcompw != '\0' &&
+ ((error = checkdirw(__G__ pathcompw, APPEND_DIR))
+ & MPN_MASK) > MPN_INF_TRUNC)
+ return error;
+ ppw = pathcompw; /* Reset conversion buffer for next piece. */
+ lastsemiw = (wchar_t *)NULL; /* Leave dir semi-colons alone. */
+ break;
- /* Only need check those characters which are legal in NTFS but not
- * in FAT: to get here, must already have passed through mapname.
- * Also must truncate path component to ensure 8.3 compliance.
- */
- while ((workch = (uch)*ppc++) != 0) {
- switch (workch) {
- case '[':
- case ']':
- case '+':
+ case ':': /* drive spec not stored, so no colon allowed */
+ case '\\': /* '\\' may come as normal filename char (not */
+ case '<': /* dir sep char!) from unix-like file system */
+ case '>': /* no redirection symbols allowed either */
+ case '|': /* no pipe signs allowed */
+ case '"': /* no double quotes allowed */
+ case '?': /* no wildcards allowed */
+ case '*':
+ *ppw++ = '_'; /* these rules apply equally to FAT and NTFS */
+ break;
+ case ';': /* start of VMS version? */
+ lastsemiw = ppw; /* remove VMS version later... */
+ *ppw++ = ';'; /* but keep semicolon for now */
+ break;
+
+
+ case ' ': /* keep spaces unless specifically */
+ /* NT cannot create filenames with spaces on FAT volumes */
+ if (uO.sflag || IsVolumeOldFATw(__G__ G.unipath_widefilename))
+ *ppw++ = '_';
+ else
+ *ppw++ = ' ';
+ break;
+
+ default:
+ /* allow European characters in filenames: */
+ if (iswprint(workchw) || workchw >= 127)
+ *ppw++ = workchw;
+ } /* end switch */
+
+ } /* end while loop */
+
+ /* Show warning when stripping insecure "parent dir" path components */
+ /* For now use standard path for output messages */
+ if (killed_ddot && QCOND2) {
+ Info(slide, 0, ((char *)slide,
+ "warning: skipped \"../\" path component(s) (2) in %s\n",
+ FnFilter1(G.filename)));
+ if (!(error & ~MPN_MASK))
+ error = (error & MPN_MASK) | PK_WARN;
+ }
+
+/*---------------------------------------------------------------------------
+ Report if directory was created (and no file to create: filename ended
+ in '/'), check name to be sure it exists, and combine path and name be-
+ fore exiting.
+ ---------------------------------------------------------------------------*/
+
+ if ((G.unipath_widefilename[wcslen(G.unipath_widefilename) - 1] == '/')
+# ifdef SYMLINKS
+ /* Process a symlink as a file, even if it looks like a directory.
+ * (Which a Windows directory symlink might do.)
+ */
+ && !G.pInfo->symlink
+# endif /* def SYMLINKS */
+ )
+ {
+ checkdirw(__G__ G.unipath_widefilename, GETPATH);
+ if (G.created_dir) {
+ if (QCOND2) {
+ Info(slide, 0, ((char *)slide, " creating: %-22s\n",
+ FnFilter1(G.filename)));
+ }
+
+ /* set file attributes:
+ The default for newly created directories is "DIR attribute
+ flags set", so there is no need to change attributes unless
+ one of the DOS style attribute flags is set. The readonly
+ attribute need not be masked, since it does not prevent
+ modifications in the new directory. */
+ if(G.pInfo->file_attr & (0x7F & ~FILE_ATTRIBUTE_DIRECTORY)) {
+ if (!SetFileAttributesW(G.unipath_widefilename, G.pInfo->file_attr & 0x7F))
+ Info(slide, 1, ((char *)slide,
+ "\nwarning (%d): could not set file attributes (5) for %s\n",
+ (int)GetLastError(), FnFilter1(G.filename)));
+ }
+
+ /* set dir time (note trailing '/') */
+ return (error & ~MPN_MASK) | MPN_CREATED_DIR;
+ } else if (IS_OVERWRT_ALL) {
+ /* overwrite attributes of existing directory on user's request */
+
+ /* set file attributes: */
+ if(G.pInfo->file_attr & (0x7F & ~FILE_ATTRIBUTE_DIRECTORY)) {
+ if (!SetFileAttributesW(G.unipath_widefilename, G.pInfo->file_attr & 0x7F))
+ Info(slide, 1, ((char *)slide,
+ "\nwarning (%d): could not set file attributes (6) for %s\n",
+ (int)GetLastError(), FnFilter1(G.filename)));
+ }
+ }
+ /* dir existed already; don't look for data to extract */
+ return (error & ~MPN_MASK) | MPN_INF_SKIP;
+ }
+
+ *ppw = '\0'; /* done with pathcomp: terminate it */
+
+ /* If not saving them, remove a VMS version number (ending: ";###"). */
+ if (lastsemiw &&
+ ((uO.V_flag < 0) || ((uO.V_flag == 0) && (G.pInfo->hostnum == VMS_)))) {
+ ppw = lastsemiw + 1; /* semi-colon was kept: expect #'s after */
+ if (*ppw != '\0') { /* At least one digit is required. */
+ while (iswdigit(*ppw))
+ ++ppw;
+ if (*ppw == '\0') /* only digits between ';' and end: nuke */
+ *lastsemiw = '\0';
+ }
+ }
+
+ maskDOSdevicew(__G__ pathcompw);
+
+ if (*pathcompw == '\0') {
+ Info(slide, 1, ((char *)slide, "mapname(2): conversion of %s failed\n",
+ FnFilter1(G.filename)));
+ return (error & ~MPN_MASK) | MPN_ERR_SKIP;
+ }
+
+ checkdirw(__G__ pathcompw, APPEND_NAME); /* returns 1 if truncated: care? */
+
+# ifdef DYNAMIC_WIDE_NAME
+ if ((unsigned int)(G.endFATw- G.buildpathFATw) >
+ wcslen( G.unipath_widefilename))
+ {
+ /* 2013-03-18 SMS.
+ * Need more storage for the constructed name.
+ * It might make more sense to allocate FILNAMSIZ* sizeof( wchar_t)
+ * in the first place, but utf8_to_wchar_string() allocates the
+ * exact size of the leaf name.
+ */
+ if ((G.unipath_widefilename = izu_realloc( G.unipath_widefilename,
+ ((G.endFATw- G.buildpathFATw+ 1)* sizeof( wchar_t)))) == NULL)
+ {
+ return MPN_NOMEM;
+ }
+ }
+# endif /* def DYNAMIC_WIDE_NAME */
+ /* Get the constructed name. */
+ checkdirw(__G__ G.unipath_widefilename, GETPATH);
+
+ if (G.pInfo->vollabel) { /* set the volume label now */
+ char drive[4] = "?:\\";
+ wchar_t drivew[4] = L"?:\\";
+
+ /* Insert the drive letter into the drive string. E.g. "b:\". */
+ drive[0] = (char)(('a'- 1)+ G.nLabelDrive);
+ drivew[0] = (wchar_t)(('a'- 1)+ G.nLabelDrive);
+ if (QCOND2)
+ Info(slide, 0, ((char *)slide, "labeling %s %-22s\n", drive,
+ FnFilter1(G.filename)));
+ if (!SetVolumeLabelW(drivew, G.unipath_widefilename)) {
+ Info(slide, 1, ((char *)slide,
+ "mapname(2): error setting volume label\n"));
+ return (error & ~MPN_MASK) | MPN_ERR_SKIP;
+ }
+ /* success: skip the "extraction" quietly */
+ return (error & ~MPN_MASK) | MPN_INF_SKIP;
+ }
+ Trace((stderr, "mapname returns with filename = [%s] (error = %d)\n\n",
+ FnFilter1(G.filename), error));
+ return error;
+
+} /* end function mapnamew() */
+
+
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+
+
+
+/****************************/
+/* Function maskDOSdevice() */
+/****************************/
+
+static void maskDOSdevice(__G__ pathcomp)
+ __GDEF
+ char *pathcomp;
+{
+/*---------------------------------------------------------------------------
+ Put an underscore in front of the file name if the file name is a
+ DOS/WINDOWS device name like CON.*, AUX.*, PRN.*, etc. Trying to
+ extract such a file would fail at best and wedge us at worst.
+ ---------------------------------------------------------------------------*/
+# if !defined(S_IFCHR) && defined(_S_IFCHR)
+# define S_IFCHR _S_IFCHR
+# endif
+# if !defined(S_ISCHR)
+# if defined(_S_ISCHR)
+# define S_ISCHR(m) _S_ISCHR(m)
+# elif defined(S_IFCHR)
+# define S_ISCHR(m) ((m) & S_IFCHR)
+# endif
+# endif
+
+# ifdef DEBUG
+ if (zstat(pathcomp, &G.statbuf) == 0) {
+ Trace((stderr,
+ "maskDOSdevice() stat(\"%s\", buf) st_mode result: %X, %o\n",
+ FnFilter1(pathcomp), G.statbuf.st_mode, G.statbuf.st_mode));
+ } else {
+ Trace((stderr, "maskDOSdevice() stat(\"%s\", buf) failed\n",
+ FnFilter1(pathcomp)));
+ }
+# endif
+ if (zstat(pathcomp, &G.statbuf) == 0 && S_ISCHR(G.statbuf.st_mode)) {
+ extent i;
+
+ /* pathcomp contains a name of a DOS character device (builtin or
+ * installed device driver).
+ * Prepend a '_' to allow creation of the item in the file system.
+ */
+ for (i = strlen(pathcomp) + 1; i > 0; --i)
+ pathcomp[i] = pathcomp[i - 1];
+ pathcomp[0] = '_';
+ }
+} /* end function maskDOSdevice() */
+
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+
+static void maskDOSdevicew(__G__ pathcompw)
+ __GDEF
+ wchar_t *pathcompw;
+{
+/*---------------------------------------------------------------------------
+ Put an underscore in front of the file name if the file name is a
+ DOS/WINDOWS device name like CON.*, AUX.*, PRN.*, etc. Trying to
+ extract such a file would fail at best and wedge us at worst.
+ ---------------------------------------------------------------------------*/
+# if !defined(S_IFCHR) && defined(_S_IFCHR)
+# define S_IFCHR _S_IFCHR
+# endif
+# if !defined(S_ISCHR)
+# if defined(_S_ISCHR)
+# define S_ISCHR(m) _S_ISCHR(m)
+# elif defined(S_IFCHR)
+# define S_ISCHR(m) ((m) & S_IFCHR)
+# endif
+# endif
+
+ if (zstatw(pathcompw, &G.statbuf) == 0 && S_ISCHR(G.statbuf.st_mode)) {
+ extent i;
+
+ /* pathcomp contains a name of a DOS character device (builtin or
+ * installed device driver).
+ * Prepend a '_' to allow creation of the item in the file system.
+ */
+ for (i = wcslen(pathcompw) + 1; i > 0; --i)
+ pathcompw[i] = pathcompw[i - 1];
+ pathcompw[0] = '_';
+ }
+} /* end function maskDOSdevicew() */
+
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+
+
+/**********************/
+/* Function map2fat() */ /* Not quite identical to OS/2 version */
+/**********************/
+
+static void map2fat(pathcomp, pEndFAT)
+ char *pathcomp, **pEndFAT;
+{
+ char *ppc = pathcomp; /* variable pointer to pathcomp */
+ char *pEnd = *pEndFAT; /* variable pointer to buildpathFAT */
+ char *pBegin = *pEndFAT; /* constant pointer to start of this comp. */
+ char *last_dot = NULL; /* last dot not converted to underscore */
+ register unsigned workch; /* hold the character being tested */
+
+
+ /* Only need check those characters which are legal in NTFS but not
+ * in FAT: to get here, must already have passed through mapname.
+ * Also must truncate path component to ensure 8.3 compliance.
+ */
+ while ((workch = (uch)*ppc++) != 0) {
+ switch (workch) {
+ case '[':
+ case ']':
+ case '+':
case ',':
case ';':
case '=':
char *plu = MBSRCHR(pBegin, '_'); /* pointer to last underscore */
if ((plu != NULL) && /* found underscore: convert to dot? */
- (MIN(plu - pBegin, 8) + MIN(pEnd - plu - 1, 3) > 8)) {
+ (IZ_MIN(plu - pBegin, 8) + IZ_MIN(pEnd - plu - 1, 3) > 8)) {
last_dot = plu; /* be lazy: drop through to next if-blk */
} else if ((pEnd - *pEndFAT) > 8) {
/* no underscore; or converting underscore to dot would save less
} /* end function map2fat() */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+
+static void map2fatw(pathcompw, pEndFATw)
+ wchar_t *pathcompw, **pEndFATw;
+{
+ wchar_t *ppcw = pathcompw; /* variable pointer to pathcomp */
+ wchar_t *pEndw = *pEndFATw; /* variable pointer to buildpathFAT */
+ wchar_t *pBeginw = *pEndFATw; /* constant pointer to start of this comp. */
+ wchar_t *last_dotw = NULL; /* last dot not converted to underscore */
+ register wchar_t workchw; /* hold the character being tested */
+
+
+ /* Only need check those characters which are legal in NTFS but not
+ * in FAT: to get here, must already have passed through mapname.
+ * Also must truncate path component to ensure 8.3 compliance.
+ */
+ while ((workchw = *ppcw++) != 0) {
+ switch (workchw) {
+ case '[':
+ case ']':
+ case '+':
+ case ',':
+ case ';':
+ case '=':
+ *pEndw++ = '_'; /* convert brackets to underscores */
+ break;
+
+ case '.':
+ if (pEndw == *pEndFATw) { /* nothing appended yet... */
+ if (*ppcw == '\0') /* don't bother appending a */
+ break; /* "./" component to the path */
+ else if (*ppcw == '.' && ppcw[1] == '\0') { /* "../" */
+ *pEndw++ = '.'; /* add first dot, */
+ *pEndw++ = '.'; /* add second dot, and */
+ ++ppcw; /* skip over to pathcomp's end */
+ } else { /* FAT doesn't allow null filename */
+ *pEndw++ = '_'; /* bodies, so map .exrc -> _exrc */
+ } /* (_.exr would keep max 3 chars) */
+ } else { /* found dot within path component */
+ last_dotw = pEndw; /* point at last dot so far... */
+ *pEndw++ = '_'; /* convert to underscore for now */
+ }
+ break;
+
+ default:
+ *pEndw++ = workchw;
+
+ } /* end switch */
+ } /* end while loop */
+
+ *pEndw = '\0'; /* terminate buildpathFAT */
+
+ /* NOTE: keep in mind that pEnd points to the end of the path
+ * component, and *pEndFAT still points to the *beginning* of it...
+ * Also note that the algorithm does not try to get too fancy:
+ * if there are no dots already, the name either gets truncated
+ * at 8 characters or the last underscore is converted to a dot
+ * (only if more characters are saved that way). In no case is
+ * a dot inserted between existing characters.
+ */
+ if (last_dotw == NULL) { /* no dots: check for underscores... */
+ wchar_t *pluw = wcschr(pBeginw, '_'); /* pointer to last underscore */
+
+ if ((pluw != NULL) && /* found underscore: convert to dot? */
+ (IZ_MIN(pluw - pBeginw, 8) + IZ_MIN(pEndw - pluw - 1, 3) > 8)) {
+ last_dotw = pluw; /* be lazy: drop through to next if-blk */
+ } else if ((pEndw - *pEndFATw) > 8) {
+ /* no underscore; or converting underscore to dot would save less
+ chars than leaving everything in the basename */
+ *pEndFATw += 8; /* truncate at 8 chars */
+ **pEndFATw = '\0';
+ } else
+ *pEndFATw = pEndw; /* whole thing fits into 8 chars or less */
+ }
+
+ if (last_dotw != NULL) { /* one dot is OK: */
+ *last_dotw = '.'; /* put it back in */
+
+ if ((last_dotw - pBeginw) > 8) {
+ wchar_t *pw, *qw;
+ int i;
+
+ pw = last_dotw;
+ qw = last_dotw = pBeginw + 8;
+ for (i = 0; (i < 4) && *pw; ++i) /* too many chars in basename: */
+ *qw++ = *pw++; /* shift .ext left and trun- */
+ *qw = '\0'; /* cate/terminate it */
+ *pEndFATw = qw;
+ } else if ((pEndw - last_dotw) > 4) { /* too many chars in extension */
+ *pEndFATw = last_dotw + 4;
+ **pEndFATw = '\0';
+ } else
+ *pEndFATw = pEndw; /* filename is fine; point at terminating zero */
+
+ if ((last_dotw - pBeginw) > 0 && last_dotw[-1] == ' ')
+ last_dotw[-1] = '_'; /* NO blank in front of '.'! */
+ }
+} /* end function map2fatw() */
+
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
/***********************/ /* Borrowed from os2.c for UnZip 5.1. */
/* next check: need to append '/', at least one-char name, '\0' */
if ((G.endHPFS-G.buildpathHPFS) > FILNAMSIZ-3)
too_long = TRUE; /* check if extracting dir? */
-#ifdef FIX_STAT_BUG
+# ifdef FIX_STAT_BUG
/* Borland C++ 5.0 does not handle a call to stat() well if the
* directory does not exist (it tends to crash in strange places.)
* This is apparently a problem only when compiling for GUI rather
*/
if (access(G.buildpathFAT, 0) != 0) {
if (!G.create_dirs) { /* told not to create (freshening) */
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
/* path doesn't exist: nothing to do */
return MPN_INF_SKIP;
}
if (too_long) { /* GRR: should allow FAT extraction w/o EAs */
Info(slide, 1, ((char *)slide,
- "checkdir error: path too long: %s\n",
+ "checkdir(1) error: path too long: %s\n",
FnFilter1(G.buildpathHPFS)));
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
/* no room for filenames: fatal */
return MPN_ERR_TOOLONG;
}
if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */
Info(slide, 1, ((char *)slide,
- "checkdir error: cannot create %s\n\
- %s\n\
- unable to process %s.\n",
- FnFilter2(G.buildpathFAT),
- strerror(errno),
- FnFilter1(G.filename)));
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
+ "checkdir(1) error: cannot create %s\n\
+ unable to process %s.\n",
+ FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
/* path didn't exist, tried to create, failed */
return MPN_ERR_SKIP;
}
G.created_dir = TRUE;
}
-#endif /* FIX_STAT_BUG */
+# endif /* FIX_STAT_BUG */
if (SSTAT(G.buildpathFAT, &G.statbuf)) /* path doesn't exist */
{
if (!G.create_dirs) { /* told not to create (freshening) */
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
- /* path doesn't exist: nothing to do */
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
+ /* path doesn't exist: nothing to do */
return MPN_INF_SKIP;
}
if (too_long) { /* GRR: should allow FAT extraction w/o EAs */
Info(slide, 1, ((char *)slide,
- "checkdir error: path too long: %s\n",
+ "checkdir(2) error: path too long: %s\n",
FnFilter1(G.buildpathHPFS)));
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
/* no room for filenames: fatal */
return MPN_ERR_TOOLONG;
}
if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */
Info(slide, 1, ((char *)slide,
- "checkdir error: cannot create %s\n\
- %s\n\
- unable to process %s.\n",
- FnFilter2(G.buildpathFAT),
- strerror(errno),
- FnFilter1(G.filename)));
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
+ "checkdir(2) error: cannot create %s\n\
+ unable to process %s.\n",
+ FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
/* path didn't exist, tried to create, failed */
return MPN_ERR_SKIP;
}
G.created_dir = TRUE;
} else if (!S_ISDIR(G.statbuf.st_mode)) {
Info(slide, 1, ((char *)slide,
- "checkdir error: %s exists but is not directory\n\
- unable to process %s.\n",
+ "checkdir(1) error: %s exists but is not directory\n\
+ unable to process %s.\n",
FnFilter2(G.buildpathFAT), FnFilter1(G.filename)));
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
/* path existed but wasn't dir */
return MPN_ERR_SKIP;
}
if (too_long) {
Info(slide, 1, ((char *)slide,
- "checkdir error: path too long: %s\n",
- FnFilter1(G.buildpathHPFS)));
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
+ "checkdir(3) error: path too long: %s\n",
+ FnFilter1(G.buildpathHPFS)));
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
/* no room for filenames: fatal */
return MPN_ERR_TOOLONG;
}
if (FUNCTION == GETPATH) {
Trace((stderr, "getting and freeing FAT path [%s]\n",
FnFilter1(G.buildpathFAT)));
+ strcpy(pathcomp, G.buildpathFAT);
+ izu_free(G.buildpathFAT);
Trace((stderr, "freeing HPFS path [%s]\n",
FnFilter1(G.buildpathHPFS)));
- strcpy(pathcomp, G.buildpathFAT);
- free(G.buildpathFAT);
- free(G.buildpathHPFS);
+ izu_free(G.buildpathHPFS);
G.buildpathHPFS = G.buildpathFAT = G.endHPFS = G.endFAT = NULL;
return MPN_OK;
}
if ((G.endHPFS-G.buildpathHPFS) >= FILNAMSIZ) {
G.buildpathHPFS[FILNAMSIZ-1] = '\0';
Info(slide, 1, ((char *)slide,
- "checkdir warning: path too long; truncating\n \
- %s\n -> %s\n",
+ "checkdir(1) warning: path too long; truncating\n\
+ %s\n\
+ -> %s\n",
FnFilter1(G.filename), FnFilter2(G.buildpathHPFS)));
error = MPN_INF_TRUNC; /* filename truncated */
}
++G.endFAT;
} else
/* map into FAT fn, update endFAT */
- map2fat(pathcomp, &G.endFAT);
+ map2fat(pathcomp, &G.endFAT);
+
+ /* Check that the FAT path does not exceed the FILNAMSIZ limit, and
+ * truncate when neccessary.
+ * Note that truncation can only happen when the HPFS path (which is
+ * never shorter than the FAT path) has been already truncated.
+ * So, emission of the warning message and setting the error code
+ * has already happened.
+ */
+ if ((G.endFAT-G.buildpathFAT) >= FILNAMSIZ)
+ G.buildpathFAT[FILNAMSIZ-1] = '\0';
+ Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n",
+ FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT)));
+
+ return error; /* could check for existence, prompt for new name... */
+
+ } /* end if (FUNCTION == APPEND_NAME) */
+
+/*---------------------------------------------------------------------------
+ INIT: allocate and initialize buffer space for the file currently being
+ extracted. If file was renamed with an absolute path, don't prepend the
+ extract-to path.
+ ---------------------------------------------------------------------------*/
+
+ if (FUNCTION == INIT) {
+ Trace((stderr, "initializing buildpathHPFS and buildpathFAT to "));
+# ifdef ACORN_FTYPE_NFS
+ if ((G.buildpathHPFS = (char *)izu_malloc(G.fnlen+G.rootlen+
+ (uO.acorn_nfs_ext ? 5 : 1)))
+# else
+ if ((G.buildpathHPFS = (char *)izu_malloc(G.fnlen+G.rootlen+1))
+# endif
+ == NULL)
+ return MPN_NOMEM;
+# ifdef ACORN_FTYPE_NFS
+ if ((G.buildpathFAT = (char *)izu_malloc(G.fnlen+G.rootlen+
+ (uO.acorn_nfs_ext ? 5 : 1)))
+# else
+ if ((G.buildpathFAT = (char *)izu_malloc(G.fnlen+G.rootlen+1))
+# endif
+ == NULL) {
+ izu_free(G.buildpathHPFS);
+ return MPN_NOMEM;
+ }
+ if (G.pInfo->vollabel) { /* use root or renamed path, but don't store */
+/* GRR: for network drives, do strchr() and return IZ_VOL_LABEL if not [1] */
+ if (G.renamed_fullpath && pathcomp[1] == ':')
+ *G.buildpathHPFS = (char)ToLower(*pathcomp);
+ else if (!G.renamed_fullpath && G.rootlen > 1 &&
+ G.rootpath[1] == ':')
+ *G.buildpathHPFS = (char)ToLower(*G.rootpath);
+ else {
+ char tmpN[MAX_PATH], *tmpP;
+ if (GetFullPathNameA(".", MAX_PATH, tmpN, &tmpP) > MAX_PATH)
+ { /* by definition of MAX_PATH we should never get here */
+ Info(slide, 1, ((char *)slide,
+ "checkdir(1) warning: current dir path too long\n"));
+ return MPN_INF_TRUNC; /* can't get drive letter */
+ }
+ G.nLabelDrive = *tmpN - 'a' + 1;
+ *G.buildpathHPFS = (char)(G.nLabelDrive - 1 + 'a');
+ }
+ G.nLabelDrive = *G.buildpathHPFS - 'a' + 1; /* save for mapname() */
+ if (uO.volflag == 0 || *G.buildpathHPFS < 'a' /* no labels/bogus? */
+ || (uO.volflag == 1 && !isfloppy(G.nLabelDrive))) { /* !fixed */
+ izu_free(G.buildpathHPFS);
+ izu_free(G.buildpathFAT);
+ return MPN_VOL_LABEL; /* skipping with message */
+ }
+ *G.buildpathHPFS = '\0';
+ } else if (G.renamed_fullpath) /* pathcomp = valid data */
+ strcpy(G.buildpathHPFS, pathcomp);
+ else if (G.rootlen > 0)
+ strcpy(G.buildpathHPFS, G.rootpath);
+ else
+ *G.buildpathHPFS = '\0';
+ G.endHPFS = G.buildpathHPFS;
+ G.endFAT = G.buildpathFAT;
+ while ((*G.endFAT = *G.endHPFS) != '\0') {
+ ++G.endFAT;
+ ++G.endHPFS;
+ }
+ Trace((stderr, "[%s]\n", FnFilter1(G.buildpathHPFS)));
+ return MPN_OK;
+ }
+
+/*---------------------------------------------------------------------------
+ ROOT: if appropriate, store the path in rootpath and create it if neces-
+ sary; else assume it's a zipfile member and return. This path segment
+ gets used in extracting all members from every zipfile specified on the
+ command line. Note that under OS/2 and MS-DOS, if a candidate extract-to
+ directory specification includes a drive letter (leading "x:"), it is
+ treated just as if it had a trailing '/'--that is, one directory level
+ will be created if the path doesn't exist, unless this is otherwise pro-
+ hibited (e.g., freshening).
+ ---------------------------------------------------------------------------*/
+
+# if (!defined(SFX) || defined(SFX_EXDIR))
+ if (FUNCTION == ROOT) {
+ Trace((stderr, "initializing root path to [%s]\n",
+ FnFilter1(pathcomp)));
+ if (pathcomp == NULL) {
+ G.rootlen = 0;
+ return MPN_OK;
+ }
+ if (G.rootlen > 0) /* rootpath was already set, nothing to do */
+ return MPN_OK;
+ if ((G.rootlen = strlen(pathcomp)) > 0) {
+ int had_trailing_pathsep=FALSE, has_drive=FALSE, add_dot=FALSE;
+ char *tmproot;
+
+ if ((tmproot = (char *)izu_malloc(G.rootlen+3)) == (char *)NULL) {
+ G.rootlen = 0;
+ return MPN_NOMEM;
+ }
+ strcpy(tmproot, pathcomp);
+ if (isalpha((uch)tmproot[0]) && tmproot[1] == ':')
+ has_drive = TRUE; /* drive designator */
+ if (tmproot[G.rootlen-1] == '/' || tmproot[G.rootlen-1] == '\\') {
+ tmproot[--G.rootlen] = '\0';
+ had_trailing_pathsep = TRUE;
+ }
+ if (has_drive && (G.rootlen == 2)) {
+ if (!had_trailing_pathsep) /* i.e., original wasn't "x:/" */
+ add_dot = TRUE; /* relative path: add '.' before '/' */
+ } else if (G.rootlen > 0) { /* need not check "x:." and "x:/" */
+ if (SSTAT(tmproot, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode))
+ {
+ /* path does not exist */
+ if (!G.create_dirs /* || iswild(tmproot) */ ) {
+ izu_free(tmproot);
+ G.rootlen = 0;
+ /* treat as stored file */
+ return MPN_INF_SKIP;
+ }
+ /* create directory (could add loop here scanning tmproot
+ * to create more than one level, but really necessary?) */
+ if (MKDIR(tmproot, 0777) == -1) {
+ Info(slide, 1, ((char *)slide,
+ "checkdir(1): cannot create extraction directory: %s\n",
+ FnFilter1(tmproot)));
+ izu_free(tmproot);
+ G.rootlen = 0;
+ /* path didn't exist, tried to create, failed: */
+ /* file exists, or need 2+ subdir levels */
+ return MPN_ERR_SKIP;
+ }
+ }
+ }
+ if (add_dot) /* had just "x:", make "x:." */
+ tmproot[G.rootlen++] = '.';
+ tmproot[G.rootlen++] = '/';
+ tmproot[G.rootlen] = '\0';
+ if ((G.rootpath = (char *)izu_realloc(
+ tmproot, G.rootlen+1)) == NULL) {
+ izu_free(tmproot);
+ G.rootlen = 0;
+ return MPN_NOMEM;
+ }
+ Trace((stderr, "rootpath now = [%s]\n", FnFilter1(G.rootpath)));
+ }
+ return MPN_OK;
+ }
+# endif /* !SFX || SFX_EXDIR */
+
+/*---------------------------------------------------------------------------
+ END: free rootpath, immediately prior to program exit.
+ ---------------------------------------------------------------------------*/
+
+ if (FUNCTION == END) {
+ Trace((stderr, "freeing rootpath\n"));
+ if (G.rootlen > 0) {
+ izu_free(G.rootpath);
+ G.rootlen = 0;
+ }
+ return MPN_OK;
+ }
+
+ return MPN_INVALID; /* should never reach */
+
+} /* end function checkdir() */
+
+
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+
+/* WIN32 wide version */
+
+int checkdirw(__G__ pathcompw, flag)
+ __GDEF
+ wchar_t *pathcompw;
+ int flag;
+/*
+ * returns:
+ * MPN_OK - no problem detected
+ * MPN_INF_TRUNC - (on APPEND_NAME) truncated filename
+ * MPN_INF_SKIP - path doesn't exist, not allowed to create
+ * MPN_ERR_SKIP - path doesn't exist, tried to create and failed; or path
+ * exists and is not a directory, but is supposed to be
+ * MPN_ERR_TOOLONG - path is too long
+ * MPN_NOMEM - can't allocate memory for filename buffers
+ */
+{
+ /* static int rootlen = 0; */ /* length of rootpath */
+ /* static char *rootpath; */ /* user's "extract-to" directory */
+ /* static char *buildpathHPFS; */ /* full path (so far) to extracted file, */
+ /* static char *buildpathFAT; */ /* both HPFS/EA (main) and FAT versions */
+ /* static char *endHPFS; */ /* corresponding pointers to end of */
+ /* static char *endFAT; */ /* buildpath ('\0') */
+
+# define FN_MASK 7
+# define FUNCTION (flag & FN_MASK)
+
+
+
+/*---------------------------------------------------------------------------
+ APPEND_DIR: append the path component to the path being built and check
+ for its existence. If doesn't exist and we are creating directories, do
+ so for this one; else signal success or error as appropriate.
+ ---------------------------------------------------------------------------*/
+
+ if (FUNCTION == APPEND_DIR) {
+ wchar_t *pw = pathcompw;
+ int too_long = FALSE;
+ char *buildpathFAT = wchar_to_local_string(G.buildpathFATw, G.unicode_escape_all);
+ char *buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
+ /* Could use G.filename from the standard path, but may
+ not work well on this port */
+ char *fn = wchar_to_local_string(G.unipath_widefilename, G.unicode_escape_all);
+
+ while ((*G.endHPFSw = *pw++) != '\0') /* copy to HPFS filename */
+ ++G.endHPFSw;
+ if (!IsVolumeOldFATw(__G__ G.buildpathHPFSw)) {
+ pw = pathcompw;
+ while ((*G.endFATw = *pw++) != '\0') /* copy to FAT filename, too */
+ ++G.endFATw;
+ } else
+ map2fatw(pathcompw, &G.endFATw); /* map into FAT fn, update endFAT */
+
+ /* GRR: could do better check, see if overrunning buffer as we go:
+ * check endHPFS-buildpathHPFS after each append, set warning variable
+ * if within 20 of FILNAMSIZ; then if var set, do careful check when
+ * appending. Clear variable when begin new path. */
+
+ /* next check: need to append '/', at least one-char name, '\0' */
+ if ((G.endHPFSw-G.buildpathHPFSw) > FILNAMSIZ-3)
+ too_long = TRUE; /* check if extracting dir? */
+# ifdef FIX_STAT_BUG
+ /* Borland C++ 5.0 does not handle a call to stat() well if the
+ * directory does not exist (it tends to crash in strange places.)
+ * This is apparently a problem only when compiling for GUI rather
+ * than console. The code below attempts to work around this problem.
+ */
+ if (_waccess(G.buildpathFATw, 0) != 0) {
+ if (!G.create_dirs) { /* told not to create (freshening) */
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
+ /* path doesn't exist: nothing to do */
+ return MPN_INF_SKIP;
+ }
+ if (too_long) { /* GRR: should allow FAT extraction w/o EAs */
+ Info(slide, 1, ((char *)slide,
+ "checkdir(4) error: path too long: %s\n",
+ FnFilter1(fn)));
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
+ /* no room for filenames: fatal */
+ return MPN_ERR_TOOLONG;
+ }
+ {
+ int i = MKDIRW(G.buildpathFATw, 0777);
+ if (i == -1) { /* create the directory */
+ Info(slide, 1, ((char *)slide,
+ "checkdir(3) error: cannot create %s\n\
+ unable to process %s.\n",
+ FnFilter2(buildpathFAT), FnFilter1(fn)));
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
+ /* path didn't exist, tried to create, failed */
+ return MPN_ERR_SKIP;
+ }
+ G.created_dir = TRUE;
+ }
+ }
+# endif /* FIX_STAT_BUG */
+ if (SSTATW(G.buildpathFATw, &G.statbuf)) /* path doesn't exist */
+ {
+ if (!G.create_dirs) { /* told not to create (freshening) */
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
+ /* path doesn't exist: nothing to do */
+ return MPN_INF_SKIP;
+ }
+ if (too_long) { /* GRR: should allow FAT extraction w/o EAs */
+ Info(slide, 1, ((char *)slide,
+ "checkdir(5) error: path too long: %s\n",
+ FnFilter1(buildpathHPFS)));
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
+ /* no room for filenames: fatal */
+ return MPN_ERR_TOOLONG;
+ }
+ {
+ char *buildpathFAT = wchar_to_local_string(G.buildpathFATw, G.unicode_escape_all);
+ int i = MKDIRW(G.buildpathFATw, 0777);
+ if (i == -1) { /* create the directory */
+ Info(slide, 1, ((char *)slide,
+ "checkdir(4) error: cannot create %s\n\
+ unable to process %s.\n",
+ FnFilter2(buildpathFAT), FnFilter1(fn)));
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
+ /* path didn't exist, tried to create, failed */
+ return MPN_ERR_SKIP;
+ }
+ G.created_dir = TRUE;
+ }
+ } else if (!S_ISDIR(G.statbuf.st_mode)) {
+ Info(slide, 1, ((char *)slide,
+ "checkdir(2) error: %s exists but is not directory\n\
+ unable to process %s.\n",
+ FnFilter2(buildpathFAT), FnFilter1(fn)));
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
+ /* path existed but wasn't dir */
+ return MPN_ERR_SKIP;
+ }
+ if (too_long) {
+ Info(slide, 1, ((char *)slide,
+ "checkdir(6) error: path too long: %s\n",
+ FnFilter1(buildpathHPFS)));
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
+ /* no room for filenames: fatal */
+ return MPN_ERR_TOOLONG;
+ }
+ *G.endHPFSw++ = '/';
+ *G.endFATw++ = '/';
+ *G.endHPFSw = *G.endFATw = '\0';
+ Trace((stderr, "buildpathHPFS now = [%s]\nbuildpathFAT now = [%s]\n",
+ FnFilter1(buildpathHPFS), FnFilter2(buildpathFAT)));
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ izu_free(fn);
+ //izu_free(G.buildpathHPFSw);
+ //izu_free(G.buildpathFATw);
+ return MPN_OK;
+
+ } /* end if (FUNCTION == APPEND_DIR) */
+
+/*---------------------------------------------------------------------------
+ GETPATH: copy full FAT path to the string pointed at by pathcomp (want
+ filename to reflect name used on disk, not EAs; if full path is HPFS,
+ buildpathFAT and buildpathHPFS will be identical). Free both local paths.
+ ---------------------------------------------------------------------------*/
+
+ if (FUNCTION == GETPATH) {
+# ifdef Tracing
+ char *buildpathFAT = wchar_to_local_string(G.buildpathFATw, G.unicode_escape_all);
+ char *buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
+ Trace((stderr, "getting and freeing FAT path [%s]\n",
+ FnFilter1(buildpathFAT)));
+ izu_free(buildpathFAT);
+# endif /* def Tracing */
+ wcscpy(pathcompw, G.buildpathFATw);
+ izu_free(G.buildpathFATw);
+# ifdef Tracing
+ Trace((stderr, "freeing HPFS path [%s]\n",
+ FnFilter1(buildpathHPFS)));
+ izu_free(buildpathHPFS);
+# endif /* def Tracing */
+ izu_free(G.buildpathHPFSw);
+ G.buildpathHPFSw = G.buildpathFATw = G.endHPFSw = G.endFATw = NULL;
+ return MPN_OK;
+ }
+
+/*---------------------------------------------------------------------------
+ APPEND_NAME: assume the path component is the filename; append it and
+ return without checking for existence.
+ ---------------------------------------------------------------------------*/
+
+ if (FUNCTION == APPEND_NAME) {
+ wchar_t *pw = pathcompw;
+ int error = MPN_OK;
+ char *fn = wchar_to_local_string(G.unipath_widefilename, G.unicode_escape_all);
+# ifdef Tracing
+ char *pathcomp = wchar_to_local_string(pathcompw, G.unicode_escape_all);
+ Trace((stderr, "appending filename [%s]\n", FnFilter1(pathcomp)));
+ izu_free( pathcomp);
+# endif /* def Tracing */
+ /* The buildpathHPFS buffer has been allocated large enough to
+ * hold the complete combined name, so there is no need to check
+ * for OS filename size limit overflow within the copy loop.
+ */
+ while ((*G.endHPFSw = *pw++) != '\0') { /* copy to HPFS filename */
+ ++G.endHPFSw;
+ }
+ /* Now, check for OS filename size overflow. When detected, the
+ * mapped HPFS name is truncated and a warning message is shown.
+ */
+ if ((G.endHPFSw-G.buildpathHPFSw) >= FILNAMSIZ) {
+ char *buildpathHPFS;
+ G.buildpathHPFSw[FILNAMSIZ-1] = '\0';
+ buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
+ Info(slide, 1, ((char *)slide,
+ "checkdir(2) warning: path too long; truncating\n\
+ %s\n\
+ -> %s\n",
+ FnFilter1(fn), FnFilter2(buildpathHPFS)));
+ izu_free(buildpathHPFS);
+ izu_free( fn);
+ error = MPN_INF_TRUNC; /* filename truncated */
+ }
+
+ /* The buildpathFAT buffer has the same allocated size as the
+ * buildpathHPFS buffer, so there is no need for an overflow check
+ * within the following copy loop, either.
+ */
+ if (G.pInfo->vollabel || !IsVolumeOldFATw(__G__ G.buildpathHPFSw)) {
+ /* copy to FAT filename, too */
+ pw = pathcompw;
+ while ((*G.endFATw = *pw++) != '\0')
+ ++G.endFATw;
+ } else
+ /* map into FAT fn, update endFAT */
+ map2fatw(pathcompw, &G.endFATw);
/* Check that the FAT path does not exceed the FILNAMSIZ limit, and
* truncate when neccessary.
* So, emission of the warning message and setting the error code
* has already happened.
*/
- if ((G.endFAT-G.buildpathFAT) >= FILNAMSIZ)
- G.buildpathFAT[FILNAMSIZ-1] = '\0';
- Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n",
- FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT)));
+ if ((G.endFATw-G.buildpathFATw) >= FILNAMSIZ)
+ G.buildpathFATw[FILNAMSIZ-1] = '\0';
+# ifdef Tracing
+ {
+ char *buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
+ char *buildpathFAT = wchar_to_local_string(G.buildpathFATw,G.unicode_escape_all);
+ Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n",
+ FnFilter1(buildpathHPFS), FnFilter2(buildpathFAT)));
+ izu_free(buildpathHPFS);
+ izu_free(buildpathFAT);
+ }
+# endif /* def Tracing */
+ izu_free(fn);
return error; /* could check for existence, prompt for new name... */
---------------------------------------------------------------------------*/
if (FUNCTION == INIT) {
- Trace((stderr, "initializing buildpathHPFS and buildpathFAT to "));
-#ifdef ACORN_FTYPE_NFS
- if ((G.buildpathHPFS = (char *)malloc(G.fnlen+G.rootlen+
- (uO.acorn_nfs_ext ? 5 : 1)))
-#else
- if ((G.buildpathHPFS = (char *)malloc(G.fnlen+G.rootlen+1))
-#endif
- == NULL)
+ Trace((stderr, "initializing buildpathHPFSw and buildpathFATw to "));
+ if ((G.buildpathHPFSw = (wchar_t *)izu_malloc(
+ (G.fnlen+G.rootlen+1) * sizeof(wchar_t))) == NULL)
return MPN_NOMEM;
-#ifdef ACORN_FTYPE_NFS
- if ((G.buildpathFAT = (char *)malloc(G.fnlen+G.rootlen+
- (uO.acorn_nfs_ext ? 5 : 1)))
-#else
- if ((G.buildpathFAT = (char *)malloc(G.fnlen+G.rootlen+1))
-#endif
- == NULL) {
- free(G.buildpathHPFS);
+ if ((G.buildpathFATw = (wchar_t *)izu_malloc(
+ (G.fnlen+G.rootlen+1) * sizeof(wchar_t))) == NULL) {
+ izu_free(G.buildpathHPFSw);
return MPN_NOMEM;
}
if (G.pInfo->vollabel) { /* use root or renamed path, but don't store */
/* GRR: for network drives, do strchr() and return IZ_VOL_LABEL if not [1] */
- if (G.renamed_fullpath && pathcomp[1] == ':')
- *G.buildpathHPFS = (char)ToLower(*pathcomp);
+ if (G.renamed_fullpath && pathcompw[1] == ':')
+ *G.buildpathHPFSw = (wchar_t)towlower(*pathcompw);
else if (!G.renamed_fullpath && G.rootlen > 1 &&
- G.rootpath[1] == ':')
- *G.buildpathHPFS = (char)ToLower(*G.rootpath);
+ G.rootpathw[1] == ':')
+ *G.buildpathHPFSw = (wchar_t)towlower(*G.rootpathw);
else {
- char tmpN[MAX_PATH], *tmpP;
- if (GetFullPathNameA(".", MAX_PATH, tmpN, &tmpP) > MAX_PATH)
+ wchar_t tmpNw[MAX_PATH], *tmpPw;
+ if (GetFullPathNameW(L".", MAX_PATH, tmpNw, &tmpPw) > MAX_PATH)
{ /* by definition of MAX_PATH we should never get here */
Info(slide, 1, ((char *)slide,
- "checkdir warning: current dir path too long\n"));
+ "checkdir(2) warning: current dir path too long\n"));
return MPN_INF_TRUNC; /* can't get drive letter */
}
- G.nLabelDrive = *tmpN - 'a' + 1;
- *G.buildpathHPFS = (char)(G.nLabelDrive - 1 + 'a');
+ G.nLabelDrive = (char)(*G.buildpathHPFSw - 'a' + 1); /* save for mapname() */
+ *G.buildpathHPFSw = (wchar_t)(G.nLabelDrive - 1 + 'a');
}
- G.nLabelDrive = *G.buildpathHPFS - 'a' + 1; /* save for mapname() */
- if (uO.volflag == 0 || *G.buildpathHPFS < 'a' /* no labels/bogus? */
+ if (uO.volflag == 0 || *G.buildpathHPFSw < 'a' /* no labels/bogus? */
|| (uO.volflag == 1 && !isfloppy(G.nLabelDrive))) { /* !fixed */
- free(G.buildpathHPFS);
- free(G.buildpathFAT);
+ izu_free(G.buildpathHPFSw);
+ izu_free(G.buildpathFATw);
return MPN_VOL_LABEL; /* skipping with message */
}
- *G.buildpathHPFS = '\0';
+ *G.buildpathHPFSw = '\0';
} else if (G.renamed_fullpath) /* pathcomp = valid data */
- strcpy(G.buildpathHPFS, pathcomp);
+ wcscpy(G.buildpathHPFSw, pathcompw);
else if (G.rootlen > 0)
- strcpy(G.buildpathHPFS, G.rootpath);
+ wcscpy(G.buildpathHPFSw, G.rootpathw);
else
- *G.buildpathHPFS = '\0';
- G.endHPFS = G.buildpathHPFS;
- G.endFAT = G.buildpathFAT;
- while ((*G.endFAT = *G.endHPFS) != '\0') {
- ++G.endFAT;
- ++G.endHPFS;
+ *G.buildpathHPFSw = '\0';
+ G.endHPFSw = G.buildpathHPFSw;
+ G.endFATw = G.buildpathFATw;
+ while ((*G.endFATw = *G.endHPFSw) != '\0') {
+ ++G.endFATw;
+ ++G.endHPFSw;
}
- Trace((stderr, "[%s]\n", FnFilter1(G.buildpathHPFS)));
+# ifdef Tracing
+ {
+ char *buildpathHPFS = wchar_to_local_string(G.buildpathHPFSw, G.unicode_escape_all);
+ Trace((stderr, "[%s]\n", FnFilter1(buildpathHPFS)));
+ izu_free(buildpathHPFS);
+ }
+# endif /* def Tracing */
+
return MPN_OK;
}
hibited (e.g., freshening).
---------------------------------------------------------------------------*/
-#if (!defined(SFX) || defined(SFX_EXDIR))
+# if (!defined(SFX) || defined(SFX_EXDIR))
if (FUNCTION == ROOT) {
+# ifdef Tracing
+ char *pathcomp = wchar_to_local_string(pathcompw, G.unicode_escape_all);
Trace((stderr, "initializing root path to [%s]\n",
FnFilter1(pathcomp)));
- if (pathcomp == NULL) {
+ izu_free(pathcomp);
+# endif /* def Tracing */
+ if (pathcompw == NULL) {
G.rootlen = 0;
return MPN_OK;
}
if (G.rootlen > 0) /* rootpath was already set, nothing to do */
return MPN_OK;
- if ((G.rootlen = strlen(pathcomp)) > 0) {
+ if ((G.rootlen = wcslen(pathcompw)) > 0) {
int had_trailing_pathsep=FALSE, has_drive=FALSE, add_dot=FALSE;
- char *tmproot;
+ wchar_t *tmprootw;
- if ((tmproot = (char *)malloc(G.rootlen+3)) == (char *)NULL) {
+ if ((tmprootw = (wchar_t *)izu_malloc(
+ (G.rootlen+3) * sizeof(wchar_t))) == (wchar_t *)NULL) {
G.rootlen = 0;
return MPN_NOMEM;
}
- strcpy(tmproot, pathcomp);
- if (isalpha((uch)tmproot[0]) && tmproot[1] == ':')
+ wcscpy(tmprootw, pathcompw);
+ if (iswalpha(tmprootw[0]) && tmprootw[1] == ':')
has_drive = TRUE; /* drive designator */
- if (tmproot[G.rootlen-1] == '/' || tmproot[G.rootlen-1] == '\\') {
- tmproot[--G.rootlen] = '\0';
+ if (tmprootw[G.rootlen-1] == '/' || tmprootw[G.rootlen-1] == '\\') {
+ tmprootw[--G.rootlen] = '\0';
had_trailing_pathsep = TRUE;
}
if (has_drive && (G.rootlen == 2)) {
if (!had_trailing_pathsep) /* i.e., original wasn't "x:/" */
add_dot = TRUE; /* relative path: add '.' before '/' */
} else if (G.rootlen > 0) { /* need not check "x:." and "x:/" */
- if (SSTAT(tmproot, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode))
+ if (SSTATW(tmprootw, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode))
{
/* path does not exist */
if (!G.create_dirs /* || iswild(tmproot) */ ) {
- free(tmproot);
+ izu_free(tmprootw);
G.rootlen = 0;
/* treat as stored file */
return MPN_INF_SKIP;
}
/* create directory (could add loop here scanning tmproot
* to create more than one level, but really necessary?) */
- if (MKDIR(tmproot, 0777) == -1) {
+ if (MKDIRW(tmprootw, 0777) == -1) {
+ char *tmproot = wchar_to_local_string(tmprootw, G.unicode_escape_all);
Info(slide, 1, ((char *)slide,
- "checkdir: cannot create extraction directory: %s\n",
+ "checkdir(2): cannot create extraction directory: %s\n",
FnFilter1(tmproot)));
- free(tmproot);
+ izu_free(tmproot);
+ izu_free(tmprootw);
G.rootlen = 0;
/* path didn't exist, tried to create, failed: */
/* file exists, or need 2+ subdir levels */
+ /* 2013-03-12 SMS.
+ * izu_free(pathcomp);
+ * Should be "izu_free(pathcompw);"???
+ */
return MPN_ERR_SKIP;
}
}
}
if (add_dot) /* had just "x:", make "x:." */
- tmproot[G.rootlen++] = '.';
- tmproot[G.rootlen++] = '/';
- tmproot[G.rootlen] = '\0';
- if ((G.rootpath = (char *)realloc(tmproot, G.rootlen+1)) == NULL) {
- free(tmproot);
+ tmprootw[G.rootlen++] = '.';
+ tmprootw[G.rootlen++] = '/';
+ tmprootw[G.rootlen] = '\0';
+ if ((G.rootpathw = (wchar_t *)izu_realloc(
+ tmprootw, (G.rootlen+1) * sizeof(wchar_t))) == NULL) {
+ izu_free(tmprootw);
G.rootlen = 0;
return MPN_NOMEM;
}
- Trace((stderr, "rootpath now = [%s]\n", FnFilter1(G.rootpath)));
+# ifdef Tracing
+ {
+ char *rootpath = wchar_to_local_string(G.rootpathw, G.unicode_escape_all);
+ Trace((stderr, "rootpath now = [%s]\n", FnFilter1(rootpath)));
+ izu_free(rootpath);
+ }
+# endif /* def Tracing */
}
return MPN_OK;
}
-#endif /* !SFX || SFX_EXDIR */
+# endif /* !SFX || SFX_EXDIR */
/*---------------------------------------------------------------------------
END: free rootpath, immediately prior to program exit.
if (FUNCTION == END) {
Trace((stderr, "freeing rootpath\n"));
if (G.rootlen > 0) {
- free(G.rootpath);
+ izu_free(G.rootpathw);
G.rootlen = 0;
}
return MPN_OK;
return MPN_INVALID; /* should never reach */
-} /* end function checkdir() */
+} /* end function checkdirw() */
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
-#ifndef SFX
+# ifndef SFX
/*************************/
/* Function dateformat() */
}
-#ifndef WINDLL
+# ifndef WINDLL_OLD
/************************/
/* Function version() */
__GDEF
{
int len;
-#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__DJGPP__))
+# if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__DJGPP__))
char buf[80];
-#if (defined(_MSC_VER) && (_MSC_VER > 900))
+# if (defined(_MSC_VER) && (_MSC_VER > 900))
char buf2[80];
-#endif
-#endif
+# endif
+# endif
len = sprintf((char *)slide, CompiledWith,
-#if defined(_MSC_VER) /* MSC == VC++, but what about SDK compiler? */
+# if defined(_MSC_VER) /* MSC == VC++, but what about SDK compiler? */
(sprintf(buf, "Microsoft C %d.%02d ", _MSC_VER/100, _MSC_VER%100), buf),
-# if (_MSC_VER == 800)
+# if (_MSC_VER == 800)
"(Visual C++ v1.1)",
-# elif (_MSC_VER == 850)
+# elif (_MSC_VER == 850)
"(Windows NT v3.5 SDK)",
-# elif (_MSC_VER == 900)
+# elif (_MSC_VER == 900)
"(Visual C++ v2.x)",
-# elif (_MSC_VER > 900)
+# elif (_MSC_VER > 900)
(sprintf(buf2, "(Visual C++ %d.%d)", _MSC_VER/100 - 6, _MSC_VER%100/10),
buf2),
-# else
+# else
"(bad version)",
-# endif
-#elif defined(__WATCOMC__)
-# if (__WATCOMC__ % 10 > 0)
+# endif
+# elif defined(__WATCOMC__)
+# if (__WATCOMC__ % 10 > 0)
(sprintf(buf, "Watcom C/C++ %d.%02d", __WATCOMC__ / 100,
__WATCOMC__ % 100), buf), "",
-# else
+# else
(sprintf(buf, "Watcom C/C++ %d.%d", __WATCOMC__ / 100,
(__WATCOMC__ % 100) / 10), buf), "",
-# endif
-#elif defined(__BORLANDC__)
+# endif
+# elif defined(__BORLANDC__)
"Borland C++",
-# if (__BORLANDC__ < 0x0200)
+# if (__BORLANDC__ < 0x0200)
" 1.0",
-# elif (__BORLANDC__ == 0x0200)
+# elif (__BORLANDC__ == 0x0200)
" 2.0",
-# elif (__BORLANDC__ == 0x0400)
+# elif (__BORLANDC__ == 0x0400)
" 3.0",
-# elif (__BORLANDC__ == 0x0410) /* __TURBOC__ = 0x0310 */
+# elif (__BORLANDC__ == 0x0410) /* __TURBOC__ = 0x0310 */
" 3.1",
-# elif (__BORLANDC__ == 0x0452) /* __TURBOC__ = 0x0320 */
+# elif (__BORLANDC__ == 0x0452) /* __TURBOC__ = 0x0320 */
" 4.0 or 4.02",
-# elif (__BORLANDC__ == 0x0460) /* __TURBOC__ = 0x0340 */
+# elif (__BORLANDC__ == 0x0460) /* __TURBOC__ = 0x0340 */
" 4.5",
-# elif (__BORLANDC__ == 0x0500) /* __TURBOC__ = 0x0340 */
+# elif (__BORLANDC__ == 0x0500) /* __TURBOC__ = 0x0340 */
" 5.0",
-# elif (__BORLANDC__ == 0x0520) /* __TURBOC__ = 0x0520 */
+# elif (__BORLANDC__ == 0x0520) /* __TURBOC__ = 0x0520 */
" 5.2 (C++ Builder 1.0)",
-# elif (__BORLANDC__ == 0x0530) /* __TURBOC__ = 0x0530 */
+# elif (__BORLANDC__ == 0x0530) /* __TURBOC__ = 0x0530 */
" 5.3 (C++ Builder 3.0)",
-# elif (__BORLANDC__ == 0x0540) /* __TURBOC__ = 0x0540 */
+# elif (__BORLANDC__ == 0x0540) /* __TURBOC__ = 0x0540 */
" 5.4 (C++ Builder 4.0)",
-# elif (__BORLANDC__ == 0x0550) /* __TURBOC__ = 0x0550 */
+# elif (__BORLANDC__ == 0x0550) /* __TURBOC__ = 0x0550 */
" 5.5 (C++ Builder 5.0)",
-# elif (__BORLANDC__ == 0x0551) /* __TURBOC__ = 0x0551 */
+# elif (__BORLANDC__ == 0x0551) /* __TURBOC__ = 0x0551 */
" 5.5.1 (C++ Builder 5.0.1)",
-# elif (__BORLANDC__ == 0x0560) /* __TURBOC__ = 0x0560 */
+# elif (__BORLANDC__ == 0x0560) /* __TURBOC__ = 0x0560 */
" 6.0 (C++ Builder 6.0)",
-# else
+# else
" later than 6.0",
-# endif
-#elif defined(__LCC__)
+# endif
+# elif defined(__LCC__)
"LCC-Win32", "",
-#elif defined(__GNUC__)
-# if defined(__RSXNT__)
-# if (defined(__DJGPP__) && !defined(__EMX__))
+# elif defined(__GNUC__)
+# if defined(__RSXNT__)
+# if (defined(__DJGPP__) && !defined(__EMX__))
(sprintf(buf, "rsxnt(djgpp v%d.%02d) / gcc ",
__DJGPP__, __DJGPP_MINOR__), buf),
-# elif defined(__DJGPP__)
+# elif defined(__DJGPP__)
(sprintf(buf, "rsxnt(emx+djgpp v%d.%02d) / gcc ",
__DJGPP__, __DJGPP_MINOR__), buf),
-# elif (defined(__GO32__) && !defined(__EMX__))
+# elif (defined(__GO32__) && !defined(__EMX__))
"rsxnt(djgpp v1.x) / gcc ",
-# elif defined(__GO32__)
+# elif defined(__GO32__)
"rsxnt(emx + djgpp v1.x) / gcc ",
-# elif defined(__EMX__)
+# elif defined(__EMX__)
"rsxnt(emx)+gcc ",
-# else
+# else
"rsxnt(unknown) / gcc ",
-# endif
-# elif defined(__CYGWIN__)
+# endif
+# elif defined(__CYGWIN__)
"cygnus win32 / gcc ",
-# elif defined(__MINGW32__)
+# elif defined(__MINGW32__)
"mingw32 / gcc ",
-# else
+# else
"gcc ",
-# endif
+# endif
__VERSION__,
-#else /* !_MSC_VER, !__WATCOMC__, !__BORLANDC__, !__LCC__, !__GNUC__ */
+# else /* !_MSC_VER, !__WATCOMC__, !__BORLANDC__, !__LCC__, !__GNUC__ */
"unknown compiler (SDK?)", "",
-#endif /* ?compilers */
+# endif /* ?compilers */
"\nWindows 9x / Windows NT/2K/XP/2K3", " (32-bit)",
-#ifdef __DATE__
+# ifdef __DATE__
" on ", __DATE__
-#else
+# else
"", ""
-#endif
+# endif
);
(*G.message)((zvoid *)&G, slide, (ulg)len, 0);
} /* end function version() */
-#endif /* !WINDLL */
-#endif /* !SFX */
+# endif /* ndef WINDLL_OLD */
+# endif /* !SFX */
-#ifdef MORE
+# ifdef MORE
int screensize(int *tt_rows, int *tt_cols)
{
return 0; /* signal success */
}
-#endif /* MORE */
+# endif /* MORE */
-#ifdef W32_STAT_BANDAID
+# ifdef W32_STAT_BANDAID
/* All currently known variants of WIN32 operating systems (Windows 95/98,
* WinNT 3.x, 4.0, 5.x) have a nasty bug in the OS kernel concerning
if (!zstat(path, buf))
{
/* stat was successful, now redo the time-stamp fetches */
-#ifndef NO_W32TIMES_IZFIX
+# ifndef NO_W32TIMES_IZFIX
int fs_uses_loctime = FStampIsLocTime(__G__ path);
-#endif
+# endif
HANDLE h;
FILETIME Modft, Accft, Creft;
-#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
+# ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
char *ansi_path = (char *)alloca(strlen(path) + 1);
INTERN_TO_ISO(path, ansi_path);
# define Ansi_Path ansi_path
-#else
+# else
# define Ansi_Path path
-#endif
+# endif
TTrace((stdout, "stat(%s) finds modtime %08lx\n", path, buf->st_mtime));
h = CreateFileA(Ansi_Path, GENERIC_READ,
if (ftOK) {
FTTrace((stdout, "GetFileTime returned Modft", 0, &Modft));
FTTrace((stdout, "GetFileTime returned Creft", 0, &Creft));
-#ifndef NO_W32TIMES_IZFIX
+# ifndef NO_W32TIMES_IZFIX
if (!fs_uses_loctime) {
/* On a filesystem that stores UTC timestamps, we refill
* the time fields of the struct stat buffer by directly
TTrace((stdout,"NTFS, recalculated modtime %08lx\n",
buf->st_mtime));
} else
-#endif /* NO_W32TIMES_IZFIX */
+# endif /* NO_W32TIMES_IZFIX */
{
/* On VFAT and FAT-like filesystems, the FILETIME values
* are converted back to the stable local time before
# undef Ansi_Path
return 0;
}
-#ifdef W32_STATROOT_FIX
+# ifdef W32_STATROOT_FIX
else
{
DWORD flags;
-#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
+# ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */
char *ansi_path = (char *)alloca(strlen(path) + 1);
INTERN_TO_ISO(path, ansi_path);
# define Ansi_Path ansi_path
-#else
+# else
# define Ansi_Path path
-#endif
+# endif
flags = GetFileAttributesA(Ansi_Path);
- if (flags != 0xFFFFFFFF && flags & FILE_ATTRIBUTE_DIRECTORY) {
+ if ((flags != INVALID_FILE_ATTRIBUTES) &&
+ (flags & FILE_ATTRIBUTE_DIRECTORY)) {
Trace((stderr, "\nstat(\"%s\",...) failed on existing directory\n",
FnFilter1(path)));
memset(buf, 0, sizeof(z_stat));
} /* assumes: stat() won't fail on non-dirs without good reason */
# undef Ansi_Path
}
-#endif /* W32_STATROOT_FIX */
+# endif /* W32_STATROOT_FIX */
+ return -1;
+}
+
+
+
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+
+int zstat_win32w(__W32STAT_GLOBALS__ const wchar_t *pathw, z_stat *buf)
+{
+ if (!zstatw(pathw, buf))
+ {
+ char *path = wchar_to_local_string((wchar_t *)pathw, G.unicode_escape_all);
+ /* stat was successful, now redo the time-stamp fetches */
+# ifndef NO_W32TIMES_IZFIX
+ int fs_uses_loctime = FStampIsLocTimeW(__G__ pathw);
+# endif
+ HANDLE h;
+ FILETIME Modft, Accft, Creft;
+
+ TTrace((stdout, "stat(%s) finds modtime %08lx\n", path, buf->st_mtime));
+ h = CreateFileW(pathw, GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h != INVALID_HANDLE_VALUE) {
+ BOOL ftOK = GetFileTime(h, &Creft, &Accft, &Modft);
+ CloseHandle(h);
+
+ if (ftOK) {
+ FTTrace((stdout, "GetFileTime returned Modft", 0, &Modft));
+ FTTrace((stdout, "GetFileTime returned Creft", 0, &Creft));
+# ifndef NO_W32TIMES_IZFIX
+ if (!fs_uses_loctime) {
+ /* On a filesystem that stores UTC timestamps, we refill
+ * the time fields of the struct stat buffer by directly
+ * using the UTC values as returned by the Win32
+ * GetFileTime() API call.
+ */
+ NtfsFileTime2utime(&Modft, &(buf->st_mtime));
+ if (Accft.dwLowDateTime != 0 || Accft.dwHighDateTime != 0)
+ NtfsFileTime2utime(&Accft, &(buf->st_atime));
+ else
+ buf->st_atime = buf->st_mtime;
+ if (Creft.dwLowDateTime != 0 || Creft.dwHighDateTime != 0)
+ NtfsFileTime2utime(&Creft, &(buf->st_ctime));
+ else
+ buf->st_ctime = buf->st_mtime;
+ TTrace((stdout,"NTFS, recalculated modtime %08lx\n",
+ buf->st_mtime));
+ } else
+# endif /* NO_W32TIMES_IZFIX */
+ {
+ /* On VFAT and FAT-like filesystems, the FILETIME values
+ * are converted back to the stable local time before
+ * converting them to UTC unix time-stamps.
+ */
+ VFatFileTime2utime(&Modft, &(buf->st_mtime));
+ if (Accft.dwLowDateTime != 0 || Accft.dwHighDateTime != 0)
+ VFatFileTime2utime(&Accft, &(buf->st_atime));
+ else
+ buf->st_atime = buf->st_mtime;
+ if (Creft.dwLowDateTime != 0 || Creft.dwHighDateTime != 0)
+ VFatFileTime2utime(&Creft, &(buf->st_ctime));
+ else
+ buf->st_ctime = buf->st_mtime;
+ TTrace((stdout, "VFAT, recalculated modtime %08lx\n",
+ buf->st_mtime));
+ }
+ }
+ }
+ izu_free(path);
+
+ return 0;
+ }
+# ifdef W32_STATROOT_FIX
+ else
+ {
+ DWORD flags;
+
+ flags = GetFileAttributesW(pathw);
+ if ((flags != INVALID_FILE_ATTRIBUTES) &&
+ (flags & FILE_ATTRIBUTE_DIRECTORY)) {
+# ifdef Tracing
+ char *path = wchar_to_local_string((wchar_t *)pathw, G.unicode_escape_all);
+ Trace((stderr, "\nstat(\"%s\",...) failed on existing directory\n",
+
+
+ FnFilter1(path)));
+ izu_free(path);
+# endif /* def Tracing */
+ memset(buf, 0, sizeof(z_stat));
+ buf->st_atime = buf->st_ctime = buf->st_mtime =
+ dos_to_unix_time(DOSTIME_MINIMUM); /* 1-1-80 */
+ buf->st_mode = S_IFDIR | S_IREAD |
+ ((flags & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE);
+ return 0;
+ } /* assumes: stat() won't fail on non-dirs without good reason */
+ }
+# endif /* W32_STATROOT_FIX */
return -1;
}
-#endif /* W32_STAT_BANDAID */
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+# endif /* W32_STAT_BANDAID */
-#ifdef W32_USE_IZ_TIMEZONE
+# ifdef W32_USE_IZ_TIMEZONE
#include "timezone.h"
#define SECSPERMIN 60
#define MINSPERHOUR 60
}
return FALSE;
}
-#endif /* W32_USE_IZ_TIMEZONE */
+# endif /* W32_USE_IZ_TIMEZONE */
#endif /* !FUNZIP */
int ret = -1;
DWORD odemode = ~(DWORD)0;
-# ifdef PASSWD_FROM_STDIN
+# ifdef PASSWD_FROM_STDIN
stin = GetStdHandle(STD_INPUT_HANDLE);
-# else
+# else
stin = CreateFileA("CONIN$", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (stin == INVALID_HANDLE_VALUE)
return -1;
-# endif
+# endif
if (GetConsoleMode(stin, &odemode))
SetConsoleMode(stin, ENABLE_PROCESSED_INPUT); /* raw except ^C noticed */
if (ReadFile(stin, &buf, 1, &rc, NULL) && rc == 1)
ret = buf[0];
if (odemode != ~(DWORD)0)
SetConsoleMode(stin, odemode);
-# ifndef PASSWD_FROM_STDIN
+# ifndef PASSWD_FROM_STDIN
CloseHandle(stin);
-# endif
+# endif
return ret;
}
#endif /* !WINDLL */
if (max_bytes < MB_CUR_MAX)
max_bytes = MB_CUR_MAX;
- if ((buffer = (char *)malloc(wsize * max_bytes + 1)) == NULL) {
+ if ((buffer = (char *)izu_malloc(wsize * max_bytes + 1)) == NULL) {
return NULL;
}
} else {
wc = (wchar_t)wide_string[i];
}
- /* Unter some vendor's C-RTL, the Wide-to-MultiByte conversion functions
+ /* Under some vendor's C-RTL, the Wide-to-MultiByte conversion functions
* (like wctomb() et. al.) do not use the same codepage as the other
* string arguments I/O functions (fopen, mkdir, rmdir etc.).
* Therefore, we have to fall back to the underlying Win32-API call to
/* use escape for wide character */
char *escape_string = wide_to_escape_string(wide_string[i]);
strcat(buffer, escape_string);
- free(escape_string);
+ izu_free(escape_string);
}
} else if (bytes_char > 0) {
/* multi-byte char */
/* use escape for wide character */
char *escape_string = wide_to_escape_string(wide_string[i]);
strcat(buffer, escape_string);
- free(escape_string);
+ izu_free(escape_string);
}
}
- if ((local_string = (char *)realloc(buffer, strlen(buffer) + 1)) == NULL) {
- free(buffer);
+ if ((local_string = (char *)izu_realloc(
+ buffer, strlen(buffer) + 1)) == NULL) {
+ izu_free(buffer);
return NULL;
}
}
-#if 0
-wchar_t *utf8_to_wchar_string(utf8_string)
- char *utf8_string; /* path to get utf-8 name for */
+wchar_t *local_to_wchar_string(local_string)
+ char *local_string; /* path of local name */
{
wchar_t *qw;
int ulen;
int ulenw;
- if (utf8_string == NULL)
+ if (local_string == NULL)
return NULL;
/* get length */
ulenw = MultiByteToWideChar(
- CP_UTF8, /* UTF-8 code page */
+ CP_ACP, /* ANSI code page */
0, /* flags for character-type options */
- utf8_string, /* string to convert */
+ local_string, /* string to convert */
-1, /* string length (-1 = NULL terminated) */
NULL, /* buffer */
0 ); /* buffer length (0 = return length) */
+
if (ulenw == 0) {
/* failed */
return NULL;
}
- ulenw++;
- /* get length in bytes */
- ulen = sizeof(wchar_t) * (ulenw + 1);
- if ((qw = (wchar_t *)malloc(ulen + 1)) == NULL) {
+ /* Allocate bytes for returned wide char count (which includes NUL). */
+ if ((qw = (wchar_t *)izu_malloc( ulenw* sizeof(wchar_t))) == NULL) {
return NULL;
}
/* convert multibyte to wide */
ulen = MultiByteToWideChar(
- CP_UTF8, /* UTF-8 code page */
+ CP_ACP, /* ANSI code page */
0, /* flags for character-type options */
- utf8_string, /* string to convert */
+ local_string, /* string to convert */
-1, /* string length (-1 = NULL terminated) */
qw, /* buffer */
ulenw); /* buffer length (0 = return length) */
if (ulen == 0) {
/* failed */
- free(qw);
+ izu_free(qw);
return NULL;
}
return qw;
}
-wchar_t *local_to_wchar_string(local_string)
- char *local_string; /* path of local name */
+# if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+# if defined( DYNAMIC_WIDE_NAME) || defined( SYMLINKS)
+wchar_t *utf8_to_wchar_string_dyn(utf8_string)
+ const char *utf8_string; /* path to get utf-8 name for */
{
wchar_t *qw;
int ulen;
int ulenw;
- if (local_string == NULL)
+ if (utf8_string == NULL)
return NULL;
- /* get length */
- ulenw = MultiByteToWideChar(
- CP_ACP, /* ANSI code page */
- 0, /* flags for character-type options */
- local_string, /* string to convert */
- -1, /* string length (-1 = NULL terminated) */
- NULL, /* buffer */
- 0 ); /* buffer length (0 = return length) */
- if (ulenw == 0) {
- /* failed */
- return NULL;
+ /* get length */
+ ulenw = MultiByteToWideChar(
+ CP_UTF8, /* UTF-8 code page */
+ 0, /* flags for character-type options */
+ utf8_string, /* string to convert */
+ -1, /* string length (-1 = NULL terminated) */
+ NULL, /* buffer */
+ 0); /* buffer length (0 = return length) */
+
+ if (ulenw == 0) {
+ /* failed */
+ return NULL;
+ }
+
+ /* Allocate bytes for returned wide char count (which includes NUL). */
+ if ((qw = (wchar_t *)izu_malloc( ulenw* sizeof(wchar_t))) == NULL) {
+ return NULL;
+ }
+
+ /* convert multibyte to wide */
+ ulen = MultiByteToWideChar(
+ CP_UTF8, /* UTF-8 code page */
+ 0, /* flags for character-type options */
+ utf8_string, /* string to convert */
+ -1, /* string length (-1 = NULL terminated) */
+ qw, /* buffer */
+ ulenw); /* buffer length (0 = return length) */
+
+ if (ulen == 0) {
+ /* failed */
+ izu_free(qw);
+ return NULL;
+ }
+
+ return qw;
+}
+# endif /* defined( DYNAMIC_WIDE_NAME) || defined( SYMLINKS) */
+
+# ifndef DYNAMIC_WIDE_NAME
+void utf8_to_wchar_string_stat( resultw, utf8_string)
+ wchar_t *resultw; /* User's result buffer. */
+ const char *utf8_string; /* path to get utf-8 name for */
+{
+ int ulen;
+
+ *resultw = L'\0'; /* Default to failure (null result). */
+
+ if (utf8_string == NULL)
+ return;
+
+ /* Convert multibyte to wide. */
+ ulen = MultiByteToWideChar(
+ CP_UTF8, /* UTF-8 code page. */
+ 0, /* Flags for character-type options. */
+ utf8_string, /* String to convert. */
+ -1, /* String length (-1 = NULL terminated). */
+ resultw, /* User's buffer. */
+ FILNAMSIZ); /* Buffer length (chars, incl. NUL). */
+
+ if (ulen == 0) {
+ /* failed */
+ *resultw = L'\0'; /* Unnecessessary? */
+ }
+
+ return;
+}
+# endif /* ndef DYNAMIC_WIDE_NAME */
+
+int has_win32_wide()
+{
+ int is_win32_wide;
+
+ /* test if we have wide function support */
+ /* first guess: On "real" WinNT, the WIN32 wide API >>is<< supported. */
+ is_win32_wide = IsWinNT();
+
+ if (!is_win32_wide)
+ {
+ /* On a non-WinNT environment (Win9x or Win32s), wide functions
+ * might be supported when program is linked against the
+ * Win9x Unicode support library.
+ * => run a check whether a needed API function is supported.
+ */
+ DWORD r;
+ /* get attributes for this directory */
+ r = GetFileAttributesA(".");
+
+ /* r should include 16 = FILE_ATTRIBUTE_DIRECTORY */
+ if ((r != INVALID_FILE_ATTRIBUTES) && (r & FILE_ATTRIBUTE_DIRECTORY)) {
+ /* now see if it works for the wide version */
+ r = GetFileAttributesW(L".");
+ /* if this fails then we probably don't have wide functions */
+ /* error is probably "This function is only valid in Win32 mode." */
+ if ((r != INVALID_FILE_ATTRIBUTES) && (r & FILE_ATTRIBUTE_DIRECTORY)) {
+ /* worked, so conclude we have wide support */
+ is_win32_wide = TRUE;
+ }
}
- ulenw++;
- /* get length in bytes */
- ulen = sizeof(wchar_t) * (ulenw + 1);
- if ((qw = (wchar_t *)malloc(ulen + 1)) == NULL) {
- return NULL;
+ }
+ return is_win32_wide;
+}
+
+# endif /* defined(UNICODE_SUPPORT) && defined(WIN32_WIDE) */
+
+#endif /* (defined(UNICODE_SUPPORT) && !defined(FUNZIP)) */
+
+
+/* Symbolic link (symlink) support. */
+
+#ifdef SYMLINKS
+
+/* symlink[w](): Create a symbolic link.
+ * Return zero, if success; non-zero, if failure.
+ */
+
+int symlink( const char *target, const char *name, int is_dir)
+{
+ int sts;
+
+ /* Flags arg (3) is SYMBOLIC_LINK_FLAG_DIRECTORY if the target is a
+ * directory.
+ */
+ if (CreateSymbolicLinkA( name, target,
+ (is_dir ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0)))
+ {
+ sts = 0;
+ }
+ else
+ {
+ sts = GetLastError();
+ }
+ return sts;
+}
+
+
+# ifdef UNICODE_SUPPORT
+
+int symlinkw( const char *target, const wchar_t *namew, int is_dir)
+{
+ int sts;
+ wchar_t *targetw;
+
+ /* Convert UTF-8 target to UTF-16. */
+ targetw = utf8_to_wchar_string_dyn( target);
+ if (targetw == NULL)
+ {
+ sts = -1;
+ }
+ else
+ {
+ /* Flags arg (3) is SYMBOLIC_LINK_FLAG_DIRECTORY if the target is a
+ * directory.
+ */
+ if (CreateSymbolicLinkW( namew, targetw,
+ (is_dir ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0)))
+ {
+ sts = 0;
}
- /* convert multibyte to wide */
- ulen = MultiByteToWideChar(
- CP_ACP, /* ANSI code page */
- 0, /* flags for character-type options */
- local_string, /* string to convert */
- -1, /* string length (-1 = NULL terminated) */
- qw, /* buffer */
- ulenw); /* buffer length (0 = return length) */
- if (ulen == 0) {
- /* failed */
- free(qw);
- return NULL;
+ else
+ {
+ sts = GetLastError();
}
-
- return qw;
+ free( targetw);
+ }
+ return sts;
}
-#endif /* 0 */
-#endif /* UNICODE_SUPPORT && !FUNZIP */
+# endif /* def UNICODE_SUPPORT */
+
+#endif /* def SYMLINKS */
/* --------------------------------------------------- */
/*
- Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2012 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.
// Read COPYING document before enabling this define.
#if 0
-#ifndef USE_UNSHRINK
-#define USE_UNSHRINK
+#ifndef UNSHRINK_SUPPORT
+#define UNSHRINK_SUPPORT
#endif
#endif
<hr>
<h3>About Pocket UnZip</h3>
-<p>Thank you for using Version 2.0 of Pocket UnZip for Windows
+<p>Thank you for using Version 1.1 of Pocket UnZip for Windows
CE.</p>
<p>Pocket UnZip was developed by Steve P. Miller. Although I'd
like to take full credit, I could not have done it without the
public decompression source code provided by the Info-ZIP group.
-Pocket UnZip uses version 6.0 of Info-ZIP's core decompression
+Pocket UnZip uses version 5.5 of Info-ZIP's core decompression
code. Many thanks go to Greg Roelofs and all the fine folks at
Info-ZIP.</p>
other applications (mostly Windows 95 / NT / CE), stop by my
personal web page at <strong>http://pobox.com/~stevemil/</strong>.</p>
-<p>Copyright © 1997-2009 Info-Zip. All Rights Reserved.</p>
+<p>Copyright © 1997-2005 Info-Zip. All Rights Reserved.</p>
</body>
</html>
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
- See the accompanying file LICENSE, version 2009-Jan-02 or later
+ 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.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
//***** User Modifiable Version Defines
//******************************************************************************
-#define VERSION_MAJOR 2
-#define VERSION_MINOR 0
+#define VERSION_MAJOR 1
+#define VERSION_MINOR 1
#define VERSION_PRIVATE 0
#define VERSION_PATCH UZ_PATCHLEVEL
-#define VERSION_STRING "2.0"
+#define VERSION_STRING "1.1"
// Set VER_FF_PRERELEASE to VS_FF_PRERELEASE for beta and 0 for release.
#ifdef BETA
#define VER_VERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PRIVATE,VERSION_PATCH
#define VER_COMPANY_STR VER_DEVELOPER_STR
-#define VER_COPYRIGHT_STR "Copyright \251 1997-2009 Info-ZIP. All Rights Reserved."
+#define VER_COPYRIGHT_STR "Copyright \251 1997-2006 Info-ZIP. All Rights Reserved."
#ifdef UNICODE
-Contents of the "windll" subdirectory for UnZip 6.0 and later:
+ Contents of the UnZip 6.10 Source Archive "windll" Directory
+ ------------------------------------------------------------
- Contents this file
- decs.h Exported function declarations.
- structs.h header file, used by both the DLL and by calling applications,
- defines the structures used in the DLL interface
- unziplib.def definition file for 32-bit UnZip library
- windll16.def definition file for 16-bit UnZip DLL
- windll32.def definition file for 32-bit UnZip DLL
- windllgcc.def definition file for 32-bit UnZip DLL, variant for GCC tools
- windll_lc.def definition file for 32-bit UnZip DLL, variant for LCC tools
- windll.c contains the entry point for the DLL, "fake" printing,
- sound, rename, replace and password functions
- windll.h header file for both 16- and 32-bit DLLs
- windll.rc resource file for both 16- and 32-bit DLLs
- windll.txt simplistic explanation of how to use DLL
- uzexampl.c a very simplistic example of how to load the DLL and make
- a call into it
- uzexampl.h header file for uzexampl.c
+Contents This file.
+decs.h Exported function declarations.
+structs.h Header file, used by both the DLL and by calling
+ applications. Defines the structures used in the
+ DLL interface.
+unziplib.def Definition file for 32-bit UnZip library.
+unzipstb.c A simple DLL example program using the command-line
+ (argc, argv[]) interface.
+uzexampl.c A simple DLL example program using the binary
+ structure (windll\structs.h:DCL) interface.
+uzexampl.h Header file for uzexampl.c.
+windll16.def Definition file for 16-bit UnZip DLL.
+windll32.def Definition file for 32-bit UnZip DLL.
+windllgcc.def Definition file for 32-bit UnZip DLL, for GCC tools.
+windll_lc.def Definition file for 32-bit UnZip DLL, for LCC tools.
+windll.c Contains the entry point for the DLL, "fake"
+ printing, sound, rename, replace and password
+ functions.
+windll.h Header file for both 16- and 32-bit DLLs.
+windll.rc Resource file for both 16- and 32-bit DLLs.
+windll.txt Simplistic explanation of how to use DLL.
- guisfx\ directory with GUI frontend for SFX stub
- dialog.h interface declarations to dialog definition
- sfxw.ico icon graphic (binary file!)
- sfxwiz.c main source module for SFX stub
- sfxwiz.dlg dialog window definitions
- sfxwiz.rc resourses for GUISFX stub
- sfxwiz16.mak makefile for 16-bit GUISFX stub (Borland C++ 4.52)
- unzsfx16.def linker definition file for 16-bit unzipsfx static library
+guisfx\ Directory with GUI frontend for SFX stub.
+ dialog.h Interface declarations to dialog definition.
+ sfxw.ico Icon graphic (binary file).
+ sfxwiz.c Main source module for SFX stub.
+ sfxwiz.dlg Dialog window definitions.
+ sfxwiz.rc Resourses for GUISFX stub.
+ sfxwiz16.mak "make" file for 16-bit GUISFX stub (Borland
+ C++ 4.52).
+ unzsfx16.def Linker definition file for 16-bit unzipsfx static
+ library.
- csharp\ example files for using the Visual C++ DLL with C# under the
- .NET framework 1.1
- vb\ example files for using the Visual C++ DLL with Visual Basic
+csharp\ Example files for using the Visual C++ DLL with C#
+ under the .NET framework 1.1.
+vb\ Example files for using the Visual C++ DLL with
+ Visual Basic.
- vc5\dll\ directory with DLL project for Visual C++ 5.0
- vc5\exampl\ directory with dll usage example project for Visual C++ 5.0
- vc5\lib\ directory with LIB project for Visual C++ 5.0
- vc5\sfx\ directory with SFX project files for Visual C++ 5.0
- SFXWiz32.dsp MS Visual C++ 5.0 project file for 32-bit GUISFX stub
- SFXWiz32.dsw MS Visual C++ 5.0 workspace file for 32-bit GUISFX stub
- unzsfx32.dsp MS Visual C++ 5.0 project for 32-bit sfxunzip static lib
- vc5\
- unzip32.dsw MS Visual C++ 5.0 workspace file for all windll projects
+vc10\ Directory for Visual C++ 2010 (10.0) project files.
+ unzip32_dll.sln Solution file for UnZip DLL and example program.
+ libbz2\ Directory for bzip2 library project files.
+ libbz2.vcxproj
+ libbz2.vcxproj.filters
+ unzip32_dll\ Directory for UnZip DLL project files.
+ unzip32_dll.vcxproj
+ unzip32_dll.vcxproj.filters
+ unzipstb\ Directory for UnZip DLL command-line (argc, argv[])
+ interface example program project files.
+ unzipstb.vcxproj
+ unzipstb.vcxproj.filters
+ uzexampl\ Directory for UnZip DLL binary structure
+ (windll\structs.h:DCL) interface example program
+ project files
+ uzexampl.vcxproj
+ uzexampl.vcxproj.filters
- vc6\dll\ directory with DLL project for Visual C++ 6.0
- vc6\exampl\ directory with dll usage example project for Visual C++ 6.0
- vc6\lib\ directory with LIB project for Visual C++ 6.0
- vc6\sfx\ directory with SFX project files for Visual C++ 6.0
- SFXWiz32.dsp MS Visual C++ 6.0 project file for 32-bit GUISFX stub
- SFXWiz32.dsw MS Visual C++ 6.0 workspace file for 32-bit GUISFX stub
- unzsfx32.dsp MS Visual C++ 6.0 project for 32-bit sfxunzip static lib
- vc6\
- unzip32.dsw MS Visual C++ 6.0 workspace file for all windll projects
+vc5\ Directory for Visual C++ 5.0 project files
+ unzip32.dsw MS Visual C++ 5.0 workspace file for all windll projects
+ dll\ Directory with DLL project for Visual C++ 5.0
+ exampl\ Directory with DLL usage example project for Visual C++ 5.0
+ lib\ Directory with LIB project for Visual C++ 5.0
+ sfx\ Directory with SFX project files for Visual C++ 5.0
+ SFXWiz32.dsp MS Visual C++ 5.0 project file for 32-bit GUISFX stub
+ SFXWiz32.dsw MS Visual C++ 5.0 workspace file for 32-bit GUISFX stub
+ unzsfx32.dsp MS Visual C++ 5.0 project for 32-bit sfxunzip static lib
- vc8\dll\ directory with DLL project for Visual C++ 2005 (VC++ 8.0)
- vc8\exampl\ directory with dll usage example project for Visual C++ 2005
- vc8\lib\ directory with LIB project for Visual C++ 2005 (VC++ 8.0)
- vc8\sfx\ directory with SFX project files for Visual Studio 8
- SFXWiz32.sln MS Visual C++ 2005 solution file for 32-bit GUISFX stub
- SFXWiz32.vcproj MS Visual C++ 2005 project file for 32-bit GUISFX stub
- unzsfx32.vcproj MS Visual C++ 2005 project for 32-bit sfxunzip static lib
- vc8\
- unzip32.sln MS Visual C++ 2005 solution file for all windll projects
+vc6\ Directory for Visual C++ 6.0 project files
+ unzip32.dsw MS Visual C++ 6.0 workspace file for all windll projects
+ dll\ Directory with DLL project for Visual C++ 6.0
+ exampl\ Directory with DLL usage example project for Visual C++ 6.0
+ lib\ Directory with LIB project for Visual C++ 6.0
+ sfx\ Directory with SFX project files for Visual C++ 6.0
+ SFXWiz32.dsp MS Visual C++ 6.0 project file for 32-bit GUISFX stub
+ SFXWiz32.dsw MS Visual C++ 6.0 workspace file for 32-bit GUISFX stub
+ unzsfx32.dsp MS Visual C++ 6.0 project for 32-bit sfxunzip static lib
+vc8\ Directory for Visual C++ 2005 (8.0) project files
+ unzip32.sln MS Visual C++ 2005 solution file for all windll projects
+ dll\ Directory with DLL project for Visual C++ 2005 (VC++ 8.0)
+ exampl\ Directory with DLL usage example project for Visual C++ 2005
+ lib\ Directory with LIB project for Visual C++ 2005 (VC++ 8.0)
+ sfx\ Directory with SFX project files for Visual Studio 8
+ SFXWiz32.sln MS Visual C++ 2005 solution file for 32-bit GUISFX stub
+ SFXWiz32.vcproj MS Visual C++ 2005 project file for 32-bit GUISFX stub
+ unzsfx32.vcproj MS Visual C++ 2005 project for 32-bit sfxunzip static lib
+
+
+ Old/Obsolete Notes:
The source file uzexampl.c contains a short example showing how to call the
Win32 UnZip DLL from C. This code should work with all C compiler environments
subdirectory of the Win32 command line port.
In the default setup, the UnZip DLL is linked against the shared C runtime
-dll. This configuration is most feasible for multi-module C/C++ based
+DLL. This configuration is most feasible for multi-module C/C++ based
programs. For usage with non-C projects (e.g. Visual Basic 5/6 or MS .NET
-managed code), a statically linked UnZip DLL might be more appropiate.
+managed code), a statically linked UnZip DLL might be more appropriate.
Both the Visual Studio projects and the MSC Makefile in the win32/ subdir
support statically linked builds through specific configurations (VC projects)
or a configuration switch (for details look into ../win32/Makefile).
The UnZip DLL and SFXWiz have been successfully built with Borland C++ 5.5.1
from the command line. However, we do not currently have the resources to
supply project files for the Borland IDE environment (C Builder 5.x - 6.x).
-For compilation with Borland C++, please use the appropiate targets supplied
+For compilation with Borland C++, please use the appropriate targets supplied
with the Borland Makefile in the Win32 subdirectory.
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
#define __unzip_structs_h
#ifndef Far
-# define Far far
+# define Far far
#endif
/* Porting definitions between Win 3.1x and Win32 */
#ifdef WIN32
-# define far
-# define _far
-# define __far
-# define near
-# define _near
-# define __near
-# ifndef FAR
-# define FAR
-# endif
+# define far
+# define _far
+# define __far
+# define near
+# define _near
+# define __near
+# ifndef FAR
+# define FAR
+# endif
#endif
#ifdef __cplusplus
* declarations in applications that reference both the Zip and the UnZip DLL.
*/
#ifndef DEFINED_ONCE
-#define DEFINED_ONCE
+# define DEFINED_ONCE
typedef int (WINAPI DLLPRNT) (LPSTR, unsigned long);
typedef int (WINAPI DLLPASSWORD) (LPSTR pwbuf, int bufsiz,
}
#endif
-/* return codes of the (DLLPASSWORD)() callback function */
+/* Return codes of the (DLLREPLACE)() callback function. */
#define IDM_REPLACE_NO 100
#define IDM_REPLACE_TEXT 101
#define IDM_REPLACE_YES 102
--- /dev/null
+/*
+ Copyright (c) 1990-2014 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+/*---------------------------------------------------------------------------
+
+ unzipstb.c
+
+ Example main program illustrating how to use the UnZip DLL.
+ This example acts like the normal UnZip program, but includes some
+ DLL version checking and additional diagnostic messages.
+
+ ---------------------------------------------------------------------------*/
+
+#include "unzip.h"
+#include "unzvers.h"
+
+#include <stdio.h>
+#if defined(MODERN) && !defined(NO_STDDEF_H)
+# include <stddef.h>
+#endif
+#include <io.h>
+
+
+/* Call-back functions. */
+
+/*
+ * MyUzpMsg(): Message output call-back function.
+ */
+
+int UZ_EXP MyUzpMsg( zvoid *pG, /* Ignore (globals pointer). */
+ uch *buf, /* Text buffer. */
+ ulg size, /* Text buffer size. */
+ int flag) /* Flag. */
+{
+ return write( fileno( stdout), buf, size);
+}
+
+
+#ifdef MY_PW
+# define UZP_PW MyUzpPassword
+/*
+ * MyUzpPassword(): Encryption password call-back function.
+ */
+
+int UZ_EXP MyUzpPassword( zvoid *pG, /* Ignore (globals pointer). */
+ int *rcnt, /* Retry count. */
+ char *pwbuf, /* Password buffer. */
+ int size, /* Password buffer size. */
+ ZCONST char *zfn, /* Archive name. */
+ ZCONST char *efn) /* Archive member name. */
+{
+ fprintf( stderr, "MyUP. size = %d, zfn: >%s<\n", size, zfn);
+ fprintf( stderr, "MyUP. efn: >%s<\n", efn);
+ fprintf( stderr, "MyUP. *rcnt = %d\n", *rcnt);
+ strncpy( pwbuf, "password", size);
+ return IZ_PW_ENTERED;
+}
+#else /* def MY_PW */
+# define UZP_PW NULL
+#endif /* def MY_PW [else] */
+
+
+/* Main program entry. */
+
+int main(int argc, char *argv[])
+{
+ static ZCONST UzpVer *pVersion; /* no pervert jokes, please... */
+
+ /* Populate the user-supplied call-back function structure. */
+ UzpCB user_functions =
+ { (sizeof user_functions), MyUzpMsg, NULL, NULL, UZP_PW, NULL };
+
+ pVersion = UzpVersion();
+
+ printf("UnZip DLL example: checking version numbers (DLL is dated %s)\n",
+ pVersion->date);
+ printf(" UnZip versions: expecting %u.%u%u, using %u.%u%u%s\n",
+ UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, pVersion->unzip.vmajor,
+ pVersion->unzip.vminor, pVersion->unzip.patchlevel, pVersion->betalevel);
+ printf(" ZipInfo versions: expecting %u.%u%u, using %u.%u%u\n",
+ ZI_MAJORVER, ZI_MINORVER, UZ_PATCHLEVEL, pVersion->zipinfo.vmajor,
+ pVersion->zipinfo.vminor, pVersion->zipinfo.patchlevel);
+
+/*
+ D2_M*VER and os2dll.* are obsolete, though retained for compatibility:
+
+ printf(" OS2 DLL versions: expecting %u.%u%u, using %u.%u%u\n",
+ D2_MAJORVER, D2_MINORVER, D2_PATCHLEVEL, pVersion->os2dll.vmajor,
+ pVersion->os2dll.vminor, pVersion->os2dll.patchlevel);
+ */
+
+ if (pVersion->flag & 2)
+ printf(" using zlib version %s\n", pVersion->zlib_version);
+
+ /* This example code only uses the dll calls UzpVersion() and
+ * UzpMain(). The APIs for these two calls have maintained backward
+ * compatibility since at least the UnZip release 5.3 !
+ */
+
+#define UZDLL_MINVERS_MAJOR 6
+#define UZDLL_MINVERS_MINOR 1
+#define UZDLL_MINVERS_PATCHLEVEL 0
+ /* This UnZip DLL stub requires a DLL version of at least: */
+ if ( (pVersion->unzip.vmajor < UZDLL_MINVERS_MAJOR) ||
+ ((pVersion->unzip.vmajor == UZDLL_MINVERS_MAJOR) &&
+ ((pVersion->unzip.vminor < UZDLL_MINVERS_MINOR) ||
+ ((pVersion->unzip.vminor == UZDLL_MINVERS_MINOR) &&
+ (pVersion->unzip.patchlevel < UZDLL_MINVERS_PATCHLEVEL)
+ )
+ )
+ ) )
+ {
+ printf(" aborting because of too old UnZip DLL version!\n");
+ return -1;
+ }
+
+ /* In case the offsetof() macro is not supported by some C compiler
+ environment, it might be replaced by something like:
+ ((extent)(void *)&(((UzpVer *)0)->dllapimin))
+ */
+ if (pVersion->structlen >=
+#if defined(MODERN) && !defined(NO_STDDEF_H)
+ ( offsetof(UzpVer, dllapimin)
+#else
+ ((unsigned)&(((UzpVer *)0)->dllapimin)
+#endif
+ + sizeof(_version_type) ))
+ {
+#ifdef OS2DLL
+# define UZ_API_COMP_MAJOR UZ_OS2API_COMP_MAJOR
+# define UZ_API_COMP_MINOR UZ_OS2API_COMP_MINOR
+# define UZ_API_COMP_REVIS UZ_OS2API_COMP_REVIS
+#else /* def OS2DLL */
+# ifdef WINDLL
+# define UZ_API_COMP_MAJOR UZ_WINAPI_COMP_MAJOR
+# define UZ_API_COMP_MINOR UZ_WINAPI_COMP_MINOR
+# define UZ_API_COMP_REVIS UZ_WINAPI_COMP_REVIS
+# else /* def WINDLL */
+# define UZ_API_COMP_MAJOR UZ_GENAPI_COMP_MAJOR
+# define UZ_API_COMP_MINOR UZ_GENAPI_COMP_MINOR
+# define UZ_API_COMP_REVIS UZ_GENAPI_COMP_REVIS
+# endif /* def WINDLL [else] */
+#endif /* def OS2DLL [else] */
+ printf(
+ " UnZip API version: can handle <= %u.%u%u, DLL supplies %u.%u%u\n",
+ UZ_API_COMP_MAJOR, UZ_API_COMP_MINOR, UZ_API_COMP_REVIS,
+ pVersion->dllapimin.vmajor, pVersion->dllapimin.vminor,
+ pVersion->dllapimin.patchlevel);
+ if ( (pVersion->dllapimin.vmajor > UZ_API_COMP_MAJOR) ||
+ ((pVersion->dllapimin.vmajor == UZ_API_COMP_MAJOR) &&
+ ((pVersion->dllapimin.vminor > UZ_API_COMP_MINOR) ||
+ ((pVersion->dllapimin.vminor == UZ_API_COMP_MINOR) &&
+ (pVersion->dllapimin.patchlevel > UZ_API_COMP_REVIS)
+ )
+ )
+ ) )
+ {
+ printf(" aborting because of unsupported dll api version!\n");
+ return -1;
+ }
+ }
+ printf("\n");
+
+ /* Call the UnZip entry point function, UzpMainI(), passing it an
+ * UnZip command expressed as an argument vector.
+ *
+ * This example emulates the normal UnZip program, so we pass the
+ * existing argument vector to the UnZip entry point. A real
+ * application program would probably form an argument vector with
+ * some application-generated command.
+ */
+ return UzpMainI( argc, argv, &user_functions);
+}
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
*/
#ifndef WIN32 /* this code is currently only tested for 32-bit console */
-# define WIN32
+# define WIN32
#endif
#if defined(__WIN32__) && !defined(WIN32)
-# define WIN32
+# define WIN32
#endif
-/* Tell Microsoft Visual C++ 2005 to leave us alone and
- * let us use standard C functions the way we're supposed to.
- */
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
-# ifndef _CRT_SECURE_NO_WARNINGS
-# define _CRT_SECURE_NO_WARNINGS
-# endif
-# ifndef _CRT_NONSTDC_NO_WARNINGS
-# define _CRT_NONSTDC_NO_WARNINGS
-# endif
-#endif
+#include "uzexampl.h"
+#include "unzvers.h"
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <string.h>
-#include "uzexampl.h"
-#include "../unzvers.h"
#ifdef WIN32
-# include <winver.h>
+# include <winver.h>
#else
-# include <ver.h>
+# include <ver.h>
#endif
#ifndef _MAX_PATH
-# define _MAX_PATH 260 /* max total file or directory name path */
+# define _MAX_PATH 260 /* max total file or directory name path */
#endif
#ifdef WIN32
-#define UNZ_DLL_NAME "UNZIP32.DLL\0"
+# define UNZ_DLL_NAME "UNZIP32.DLL\0"
#else
-#define UNZ_DLL_NAME "UNZIP16.DLL\0"
+# define UNZ_DLL_NAME "UNZIP16.DLL\0"
#endif
#define DLL_WARNING "Cannot find %s."\
static ZCONST UzpVer *lpUzVersInfo = NULL;
-/* Forward References */
-int WINAPI DisplayBuf(LPSTR, unsigned long);
-int WINAPI GetReplaceDlgRetVal(LPSTR, unsigned);
-int WINAPI password(LPSTR, int, LPCSTR, LPCSTR);
-
-ZCONST UzpVer * UZ_EXP UzpVersion OF((void));
_DLL_UZVER pUzpVersion;
_DLL_UNZIP pWiz_SingleEntryUnzip;
-static void FreeUpMemory(void);
+
+/* Call-back functions. */
+
+int WINAPI GetReplaceDlgRetVal(LPSTR filename, unsigned fnbufsiz)
+{
+/* This is where you will decide if you want to replace, rename etc existing
+ files.
+ */
+return 1;
+}
+
+
+/* Password entry routine - see password.c in the wiz directory for how
+ this is actually implemented in WiZ. If you have an encrypted file,
+ this will probably give you great pain.
+ */
+int WINAPI password(LPSTR p, int n, LPCSTR m, LPCSTR name)
+{
+return 1;
+}
+
+
+/* Dummy "print" routine that simply outputs what is sent from the dll */
+int WINAPI DisplayBuf(LPSTR buf, unsigned long size)
+{
+printf("%s", (char *)buf);
+return (int)(unsigned int) size;
+}
+
+
+static void FreeUpMemory(void)
+{
+if (hUF)
+ {
+ GlobalUnlock(hUF);
+ GlobalFree(hUF);
+ }
+if (hDCL)
+ {
+ GlobalUnlock(hDCL);
+ GlobalFree(hDCL);
+ }
+}
+
+
+/* Main program entry. */
int main(int argc, char **argv)
{
else
{
progname = argv[0];
- if (progname == NULL || *progname == '\0') progname = "example";
+ if (progname == NULL || *progname == '\0') progname = "uzexampl";
}
- printf("usage: %s <zipfile> [entry1 [entry2 [...]]] [-x xentry1 [...]]",
+ printf("usage: %s <zipfile> [entry1 [entry2 [...]]] [-x xentry1 [...]]\n",
progname);
return 0;
}
# define UZDLL_MINVERS_MINOR UZ_MINORVER
# define UZDLL_MINVERS_PATCHLEVEL UZ_PATCHLEVEL
/* This UnZip DLL stub requires a DLL version of at least: */
-if ( (lpUzVersInfo->unzip.major < UZDLL_MINVERS_MAJOR) ||
- ((lpUzVersInfo->unzip.major == UZDLL_MINVERS_MAJOR) &&
- ((lpUzVersInfo->unzip.minor < UZDLL_MINVERS_MINOR) ||
- ((lpUzVersInfo->unzip.minor == UZDLL_MINVERS_MINOR) &&
+if ( (lpUzVersInfo->unzip.vmajor < UZDLL_MINVERS_MAJOR) ||
+ ((lpUzVersInfo->unzip.vmajor == UZDLL_MINVERS_MAJOR) &&
+ ((lpUzVersInfo->unzip.vminor < UZDLL_MINVERS_MINOR) ||
+ ((lpUzVersInfo->unzip.vminor == UZDLL_MINVERS_MINOR) &&
(lpUzVersInfo->unzip.patchlevel < UZDLL_MINVERS_PATCHLEVEL)
)
)
{
char str[256];
wsprintf(str, "The version %u.%u%u of the loaded UnZip DLL is too old!",
- lpUzVersInfo->unzip.major, lpUzVersInfo->unzip.minor,
+ lpUzVersInfo->unzip.vmajor, lpUzVersInfo->unzip.vminor,
lpUzVersInfo->unzip.patchlevel);
printf("%s\n", str);
FreeLibrary(hUnzipDll);
if (lpUzVersInfo->structlen >=
(offsetof(UzpVer, dllapimin) + sizeof(_version_type)))
{
- if ( (lpUzVersInfo->dllapimin.major > UZ_WINAPI_COMP_MAJOR) ||
- ((lpUzVersInfo->dllapimin.major == UZ_WINAPI_COMP_MAJOR) &&
- ((lpUzVersInfo->dllapimin.minor > UZ_WINAPI_COMP_MINOR) ||
- ((lpUzVersInfo->dllapimin.minor == UZ_WINAPI_COMP_MINOR) &&
+ if ( (lpUzVersInfo->dllapimin.vmajor > UZ_WINAPI_COMP_MAJOR) ||
+ ((lpUzVersInfo->dllapimin.vmajor == UZ_WINAPI_COMP_MAJOR) &&
+ ((lpUzVersInfo->dllapimin.vminor > UZ_WINAPI_COMP_MINOR) ||
+ ((lpUzVersInfo->dllapimin.vminor == UZ_WINAPI_COMP_MINOR) &&
(lpUzVersInfo->dllapimin.patchlevel > UZ_WINAPI_COMP_REVIS)
)
)
{
char str[256];
wsprintf(str, "Found incompatible WinDLL API version %u.%u%u, aborting!",
- lpUzVersInfo->dllapimin.major, lpUzVersInfo->dllapimin.minor,
+ lpUzVersInfo->dllapimin.vmajor, lpUzVersInfo->dllapimin.vminor,
lpUzVersInfo->dllapimin.patchlevel);
printf("%s\n", str);
FreeLibrary(hUnzipDll);
If no more arguments are given, we extract ALL files.
In summary, the example program should be run like:
- example <archive.name> [files to include] [-x files to exclude]
+ uzexampl <archive.name> [files to include] [-x files to exclude]
("<...> denotes mandatory arguments, "[...]" optional arguments)
*/
x_opt = NULL;
return retcode;
}
-int WINAPI GetReplaceDlgRetVal(LPSTR filename, unsigned fnbufsiz)
-{
-/* This is where you will decide if you want to replace, rename etc existing
- files.
- */
-return 1;
-}
-
-static void FreeUpMemory(void)
-{
-if (hUF)
- {
- GlobalUnlock(hUF);
- GlobalFree(hUF);
- }
-if (hDCL)
- {
- GlobalUnlock(hDCL);
- GlobalFree(hDCL);
- }
-}
/* This is a very stripped down version of what is done in Wiz. Essentially
what this function is for is to do a listing of an archive contents. It
printf("%s\n", psLBEntry);
}
-
-/* Password entry routine - see password.c in the wiz directory for how
- this is actually implemented in WiZ. If you have an encrypted file,
- this will probably give you great pain.
- */
-int WINAPI password(LPSTR p, int n, LPCSTR m, LPCSTR name)
-{
-return 1;
-}
-
-/* Dummy "print" routine that simply outputs what is sent from the dll */
-int WINAPI DisplayBuf(LPSTR buf, unsigned long size)
-{
-printf("%s", (char *)buf);
-return (int)(unsigned int) size;
-}
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*
- Example header file
-
- Do not use this header file in the WiZ application, use WIZ.H
- instead.
-
-*/
+ * Example header file
+ *
+ * Do not use this header file in the WiZ application. Use WIZ.H instead.
+ */
#ifndef _UZEXAMPL_H
-#define _UZEXAMPL_H
+# define _UZEXAMPL_H
-#include <windows.h>
-#ifdef __RSXNT__
-# include "../win32/rsxntwin.h"
-#endif
-#include <assert.h> /* required for all Windows applications */
-#include <stdlib.h>
-#include <stdio.h>
-#include <commdlg.h>
-#ifndef __RSXNT__
+# include "unzip.h"
+
+# include <windows.h>
+# ifdef __RSXNT__
+# include "win32/rsxntwin.h"
+# endif
+# include <assert.h> /* required for all Windows applications */
+# include <stdlib.h>
+# include <stdio.h>
+# include <commdlg.h>
+# ifndef __RSXNT__
# include <dlgs.h>
-#endif
-#include <windowsx.h>
+# endif
+# include <windowsx.h>
-#include "../unzip.h"
-#include "../windll/structs.h"
-#include "../windll/decs.h"
+# include "windll/structs.h"
+# include "windll/decs.h"
-/* Defines */
+/* Typedefs */
typedef const UzpVer * (WINAPI * _DLL_UZVER)(void);
typedef int (WINAPI * _DLL_UNZIP)(int, char **, int, char **,
int WINAPI DisplayBuf(LPSTR, unsigned long);
/* Procedure Calls */
-#ifdef Z_UINT8_DEFINED
+# ifdef Z_UINT8_DEFINED
void WINAPI ReceiveDllMessage(z_uint8 ucsize, z_uint8 csize,
unsigned cfactor,
unsigned mo, unsigned dy, unsigned yr, unsigned hh, unsigned mm,
char c, LPCSTR filename, LPCSTR methbuf, unsigned long crc, char fCrypt);
-#else
+# else
void WINAPI ReceiveDllMessage(unsigned long ucsize, unsigned long csize,
unsigned cfactor,
unsigned mo, unsigned dy, unsigned yr, unsigned hh, unsigned mm,
char c, LPCSTR filename, LPCSTR methbuf, unsigned long crc, char fCrypt);
-#endif
+# endif
void WINAPI ReceiveDllMessage_NO_INT64(unsigned long ucsiz_l,
unsigned long ucsiz_h, unsigned long csiz_l, unsigned long csiz_h,
unsigned cfactor,
unsigned mo, unsigned dy, unsigned yr, unsigned hh, unsigned mm,
char c, LPCSTR filename, LPCSTR methbuf, unsigned long crc, char fCrypt);
-#endif /* _UZEXAMPL_H */
+
+#endif /* ndef _UZEXAMPL_H */
executable" is the path where the IDE program file "VB6.EXE" is stored,
NOT the storage directory of the VB project file (= result of the App.Path
property accessed from within the VB program).
+[Dropping unzip32.dll into the VB project directory (where this file is)
+also works when running from within the VB developent environment.]
The example code has been edited last with Visual Basic 6, but should be
compatible with VB 5. To maintain compatibility with VB5 after having modified
otherwise the example code can no longer be used on systems with old versions
of comdlg32.ocx.
+A small testfiles.zip archive is now included to allow immediate testing of
+the VB project.
+
When fetching the VB example code from the UnZip source distribution, one
has to make sure that the files are stored in the correct "DOS/Windows-native"
text format with "CR-LF" line endings. Visual Basic does not accept Unix style
project file (*.vbp). You may use unzip's -a option to convert the project
on extraction. If this is a full source distribution, see the Where file for
where to download the compiled unzip DLL for a specific platform which includes
-this example project in native format for that platform.
+this example project in native format for that platform. [This may not be
+needed with the latest distributions, which now use Windows line ends for
+the project files.]
For more information, see the comments within the VB source.
-Attribute VB_Name = "VBUnzBas"
-Option Explicit
-
-'-- Please Do Not Remove These Comment Lines!
-'----------------------------------------------------------------
-'-- Sample VB 5 / VB 6 code to drive unzip32.dll
-'-- Contributed to the Info-ZIP project by Mike Le Voi
-'--
-'-- Contact me at: mlevoi@modemss.brisnet.org.au
-'--
-'-- Visit my home page at: http://modemss.brisnet.org.au/~mlevoi
-'--
-'-- Use this code at your own risk. Nothing implied or warranted
-'-- to work on your machine :-)
-'----------------------------------------------------------------
-'--
-'-- This Source Code Is Freely Available From The Info-ZIP Project
-'-- Web Server At:
-'-- ftp://ftp.info-zip.org/pub/infozip/infozip.html
-'--
-'-- A Very Special Thanks To Mr. Mike Le Voi
-'-- And Mr. Mike White
-'-- And The Fine People Of The Info-ZIP Group
-'-- For Letting Me Use And Modify Their Original
-'-- Visual Basic 5.0 Code! Thank You Mike Le Voi.
-'-- For Your Hard Work In Helping Me Get This To Work!!!
-'---------------------------------------------------------------
-'--
-'-- Contributed To The Info-ZIP Project By Raymond L. King.
-'-- Modified June 21, 1998
-'-- By Raymond L. King
-'-- Custom Software Designers
-'--
-'-- Contact Me At: king@ntplx.net
-'-- ICQ 434355
-'-- Or Visit Our Home Page At: http://www.ntplx.net/~king
-'--
-'---------------------------------------------------------------
-'--
-'-- Modified August 17, 1998
-'-- by Christian Spieler
-'-- (implemented sort of a "real" user interface)
-'-- Modified May 11, 2003
-'-- by Christian Spieler
-'-- (use late binding for referencing the common dialog)
-'-- Modified February 01, 2008
-'-- by Christian Spieler
-'-- (adapted DLL interface changes, fixed UZDLLPass callback)
-'-- Modified December 08, 2008 to December 30, 2008
-'-- by Ed Gordon
-'-- Updated sample project for UnZip 6.0 unzip32.dll
-'-- (support UnZip 6.0 flags and structures)
-'-- Modified January 03, 2009
-'-- by Christian Spieler
-'-- (better solution for overwrite_all handling, use Double
-'-- instead of Currency to stay safe against number overflow,
-'-- corrected UZDLLServ_I32() calling interface,
-'-- removed code that is unsupported under VB5)
-'--
-'---------------------------------------------------------------
-
-'-- Expected Version data for the DLL compatibility check
-'
-' For consistency of the version checking algorithm, the version number
-' constants "UzDLL_MinVer" and "UzDLL_MaxAPI" have to fullfil the
-' condition "UzDLL_MinVer <= "UzDLL_MaxAPI".
-' Version data supplied by a specific UnZip DLL always obey the
-' relation "UzDLL Version" >= "UzDLL API".
-
-'Oldest UnZip DLL version that is supported by this program
-Private Const cUzDLL_MinVer_Major As Byte = 6
-Private Const cUzDLL_MinVer_Minor As Byte = 0
-Private Const cUzDLL_MinVer_Revis As Byte = 0
-
-'Last (newest) UnZip DLL API version that is known (and supported)
-'by this program
-Private Const cUzDLL_MaxAPI_Major As Byte = 6
-Private Const cUzDLL_MaxAPI_Minor As Byte = 0
-Private Const cUzDLL_MaxAPI_Revis As Byte = 0
-
-'Current structure version ID of the DCLIST structure layout
-Private Const cUz_DCLStructVer As Long = &H600
-
-'-- C Style argv
-Private Type UNZIPnames
- uzFiles(0 To 99) As String
-End Type
-
-'-- Callback Large "String"
-Private Type UNZIPCBChar
- ch(32800) As Byte
-End Type
-
-'-- Callback Small "String"
-Private Type UNZIPCBCh
- ch(256) As Byte
-End Type
-
-'-- UNZIP32.DLL DCL Structure
-Private Type DCLIST
- StructVersID As Long ' Currently version &H600 of this structure
- ExtractOnlyNewer As Long ' 1 = Extract Only Newer/New, Else 0
- SpaceToUnderscore As Long ' 1 = Convert Space To Underscore, Else 0
- PromptToOverwrite As Long ' 1 = Prompt To Overwrite Required, Else 0
- fQuiet As Long ' 2 = No Messages, 1 = Less, 0 = All
- ncflag As Long ' 1 = Write To Stdout, Else 0
- ntflag As Long ' 1 = Test Zip File, Else 0
- nvflag As Long ' 0 = Extract, 1 = List Zip Contents
- nfflag As Long ' 1 = Extract Only Newer Over Existing, Else 0
- nzflag As Long ' 1 = Display Zip File Comment, Else 0
- ndflag As Long ' 0 = Junk paths, 1 = safe path components only, 2 = all
- noflag As Long ' 1 = Overwrite Files, Else 0
- naflag As Long ' 1 = Convert CR To CRLF, Else 0
- nZIflag As Long ' 1 = Zip Info Verbose, Else 0
- B_flag As Long ' 1 = Backup existing files, Else 0
- C_flag As Long ' 1 = Case Insensitivity, 0 = Case Sensitivity
- D_flag As Long ' Timestamp restoration, 0 = All, 1 = Files, 2 = None
- U_flag As Long ' 0 = Unicode enabled, 1 = Escape chars, 2 = No Unicode
- fPrivilege As Long ' 1 = ACL, 2 = Privileges
- Zip As String ' The Zip Filename To Extract Files
- ExtractDir As String ' The Extraction Directory, NULL If Extracting To Current Dir
-End Type
-
-'-- UNZIP32.DLL Userfunctions Structure
-Private Type USERFUNCTION
- UZDLLPrnt As Long ' Pointer To Apps Print Function
- UZDLLSND As Long ' Pointer To Apps Sound Function
- UZDLLREPLACE As Long ' Pointer To Apps Replace Function
- UZDLLPASSWORD As Long ' Pointer To Apps Password Function
- ' 64-bit versions (VB6 does not support passing 64-bit values!)
- UZDLLMESSAGE As Long ' Pointer To Apps Message Function (Not Used!)
- UZDLLSERVICE As Long ' Pointer To Apps Service Function (Not Used!)
- ' 32-bit versions
- UZDLLMESSAGE_I32 As Long ' Pointer To Apps Message Function
- UZDLLSERVICE_I32 As Long ' Pointer To Apps Service Function
- ' All 64-bit values passed as low and high parts!
- TotalSizeComp_Lo As Long ' Total Size Of Zip Archive (low 32 bits)
- TotalSizeComp_Hi As Long ' Total Size Of Zip Archive (high 32 bits)
- TotalSize_Lo As Long ' Total Size Of All Files In Archive (low 32)
- TotalSize_Hi As Long ' Total Size Of All Files In Archive (high 32)
- NumMembers_Lo As Long ' Total Number Of All Files In The Archive (low 32)
- NumMembers_Hi As Long ' Total Number Of All Files In The Archive (high 32)
- CompFactor As Long ' Compression Factor
- cchComment As Integer ' Flag If Archive Has A Comment!
-End Type
-
-'-- UNZIP32.DLL Version Structure
-Private Type UZPVER2
- structlen As Long ' Length Of The Structure Being Passed
- flag As Long ' Bit 0: is_beta bit 1: uses_zlib
- beta As String * 10 ' e.g., "g BETA" or ""
- date As String * 20 ' e.g., "4 Sep 95" (beta) or "4 September 1995"
- zlib As String * 10 ' e.g., "1.0.5" or NULL
- unzip(1 To 4) As Byte ' Version Type Unzip
- zipinfo(1 To 4) As Byte ' Version Type Zip Info
- os2dll As Long ' Version Type OS2 DLL
- windll(1 To 4) As Byte ' Version Type Windows DLL
- dllapimin(1 To 4) As Byte ' Version Type DLL API minimum compatibility
-End Type
-
-'-- This assumes UNZIP32.DLL is somewhere on your execution path!
-'-- The term "execution path" means a search in the following locations,
-'-- in the listed sequence (for more details look up the documentation
-'-- of the LoadLibrary() Win32 API call):
-'-- 1) the directory from which the VB6 application was loaded,
-'-- 2) your current working directory in effect when the VB6 program
-'-- tries to access a first API call of UNZIP32.DLL,
-'-- 3) the Windows "SYSTEM32" (only NT/2K/XP...) and "SYSTEM" directories,
-'-- and the Windows directory,
-'-- 4) the folder list of your command path (e.g. check the environment
-'-- variable PATH as set in a console window started from scratch).
-'-- Normally, the Windows system directory is on your command path,
-'-- so installing the UNZIP32.DLL in the Windows System Directory
-'-- should always work.
-'--
-'-- WARNING:
-'-- When a VB6 program is run in the VB6 IDE, the "directory from which the
-'-- application was loaded" is the
-'-- ===>>> directory where VB6.EXE is stored (!!!),
-'-- not the storage directory of the VB project file
-'-- (the folder returned by "App.Path").
-'-- When a compiled VB6 program is run, the "application load directory"
-'-- is identical with the folder reported by "App.Path".
-'--
-Private Declare Function Wiz_SingleEntryUnzip Lib "unzip32.dll" _
- (ByVal ifnc As Long, ByRef ifnv As UNZIPnames, _
- ByVal xfnc As Long, ByRef xfnv As UNZIPnames, _
- dcll As DCLIST, Userf As USERFUNCTION) As Long
-
-Private Declare Function UzpVersion2 Lib "unzip32.dll" _
- (uzpv As UZPVER2) As Long
-
-'-- Private variable holding the API version id as reported by the
-'-- loaded UnZip DLL
-Private m_UzDllApiVers As Long
-
-'-- Private Variables For Structure Access
-Private UZDCL As DCLIST
-Private UZUSER As USERFUNCTION
-Private UZVER2 As UZPVER2
-
-'-- Public Variables For Setting The
-'-- UNZIP32.DLL DCLIST Structure
-'-- These Must Be Set Before The Actual Call To VBUnZip32
-Public uExtractOnlyNewer As Long ' 1 = Extract Only Newer/New, Else 0
-Public uSpaceUnderScore As Long ' 1 = Convert Space To Underscore, Else 0
-Public uPromptOverWrite As Long ' 1 = Prompt To Overwrite Required, Else 0
-Public uQuiet As Long ' 2 = No Messages, 1 = Less, 0 = All
-Public uWriteStdOut As Long ' 1 = Write To Stdout, Else 0
-Public uTestZip As Long ' 1 = Test Zip File, Else 0
-Public uExtractList As Long ' 0 = Extract, 1 = List Contents
-Public uFreshenExisting As Long ' 1 = Update Existing by Newer, Else 0
-Public uDisplayComment As Long ' 1 = Display Zip File Comment, Else 0
-Public uHonorDirectories As Long ' 1 = Honor Directories, Else 0
-Public uOverWriteFiles As Long ' 1 = Overwrite Files, Else 0
-Public uConvertCR_CRLF As Long ' 1 = Convert CR To CRLF, Else 0
-Public uVerbose As Long ' 1 = Zip Info Verbose
-Public uCaseSensitivity As Long ' 1 = Case Insensitivity, 0 = Case Sensitivity
-Public uPrivilege As Long ' 1 = ACL, 2 = Privileges, Else 0
-Public uZipFileName As String ' The Zip File Name
-Public uExtractDir As String ' Extraction Directory, Null If Current Directory
-
-'-- Public Program Variables
-Public uZipNumber As Long ' Zip File Number
-Public uNumberFiles As Long ' Number Of Files
-Public uNumberXFiles As Long ' Number Of Extracted Files
-Public uZipMessage As String ' For Zip Message
-Public uZipInfo As String ' For Zip Information
-Public uZipNames As UNZIPnames ' Names Of Files To Unzip
-Public uExcludeNames As UNZIPnames ' Names Of Zip Files To Exclude
-Public uVbSkip As Boolean ' For DLL Password Function
-
-'-- Puts A Function Pointer In A Structure
-'-- For Callbacks.
-Public Function FnPtr(ByVal lp As Long) As Long
-
- FnPtr = lp
-
-End Function
-
-'-- Callback For UNZIP32.DLL - Receive Message Function
-Public Sub UZReceiveDLLMessage_I32( _
- ByVal ucsize_lo As Long, _
- ByVal ucsize_hi As Long, _
- ByVal csiz_lo As Long, _
- ByVal csiz_hi As Long, _
- ByVal cfactor As Integer, _
- ByVal mo As Integer, _
- ByVal dy As Integer, _
- ByVal yr As Integer, _
- ByVal hh As Integer, _
- ByVal mm As Integer, _
- ByVal c As Byte, _
- ByRef fname As UNZIPCBCh, _
- ByRef meth As UNZIPCBCh, _
- ByVal crc As Long, _
- ByVal fCrypt As Byte)
-
- Dim s0 As String
- Dim xx As Long
- Dim cCh As Byte
- Dim strout As String * 80
- Dim ucsize As Double
- Dim csiz As Double
-
- '-- Always implement a runtime error handler in Callback Routines!
- On Error Resume Next
-
- '------------------------------------------------
- '-- This Is Where The Received Messages Are
- '-- Printed Out And Displayed.
- '-- You Can Modify Below!
- '------------------------------------------------
-
- strout = Space$(80)
-
- '-- For Zip Message Printing
- If uZipNumber = 0 Then
- Mid$(strout, 1, 50) = "Filename:"
- Mid$(strout, 53, 4) = "Size"
- Mid$(strout, 62, 4) = "Date"
- Mid$(strout, 71, 4) = "Time"
- uZipMessage = strout & vbNewLine
- strout = Space$(80)
- End If
-
- s0 = ""
-
- '-- Do Not Change This For Next!!!
- For xx = 0 To UBound(fname.ch)
- If fname.ch(xx) = 0 Then Exit For
- s0 = s0 & Chr$(fname.ch(xx))
- Next
-
- ucsize = CnvI64Struct2Dbl(ucsize_lo, ucsize_hi)
- csiz = CnvI64Struct2Dbl(csiz_lo, csiz_hi)
-
- '-- Assign Zip Information For Printing
- Mid$(strout, 1, 50) = Mid$(s0, 1, 50)
- Mid$(strout, 51, 9) = Right$(" " & CStr(ucsize), 9)
- Mid$(strout, 62, 3) = Right$("0" & Trim$(CStr(mo)), 2) & "/"
- Mid$(strout, 65, 3) = Right$("0" & Trim$(CStr(dy)), 2) & "/"
- Mid$(strout, 68, 2) = Right$("0" & Trim$(CStr(yr)), 2)
- Mid$(strout, 72, 3) = Right$(Str$(hh), 2) & ":"
- Mid$(strout, 75, 2) = Right$("0" & Trim$(CStr(mm)), 2)
-
- ' Mid$(strout, 77, 2) = Right$(" " & CStr(cfactor), 2)
- ' Mid$(strout, 80, 8) = Right$(" " & CStr(csiz), 8)
- ' s0 = ""
- ' For xx = 0 To 255
- ' If meth.ch(xx) = 0 Then Exit For
- ' s0 = s0 & Chr$(meth.ch(xx))
- ' Next xx
-
- '-- Do Not Modify Below!!!
- uZipMessage = uZipMessage & strout & vbNewLine
- uZipNumber = uZipNumber + 1
-
-End Sub
-
-'-- Callback For UNZIP32.DLL - Print Message Function
-Public Function UZDLLPrnt(ByRef fname As UNZIPCBChar, ByVal x As Long) As Long
-
- Dim s0 As String
- Dim xx As Long
- Dim cCh As Byte
-
- '-- Always implement a runtime error handler in Callback Routines!
- On Error Resume Next
-
- s0 = ""
-
- '-- Gets The UNZIP32.DLL Message For Displaying.
- For xx = 0 To x - 1
- cCh = fname.ch(xx)
- Select Case cCh
- Case 0
- Exit For
- Case 10
- s0 = s0 & vbNewLine ' Damn UNIX :-)
- Case 92 ' = Asc("\")
- s0 = s0 & "/"
- Case Else
- s0 = s0 & Chr$(cCh)
- End Select
- Next
-
- '-- Assign Zip Information
- uZipInfo = uZipInfo & s0
-
- UZDLLPrnt = 0
-
-End Function
-
-'-- Callback For UNZIP32.DLL - DLL Service Function
-Public Function UZDLLServ_I32(ByRef mname As UNZIPCBChar, _
- ByVal lUcSiz_Lo As Long, ByVal lUcSiz_Hi As Long) As Long
-
- Dim UcSiz As Double
- Dim s0 As String
- Dim xx As Long
-
- '-- Always implement a runtime error handler in Callback Routines!
- On Error Resume Next
-
- ' Parameters lUcSiz_Lo and lUcSiz_Hi contain the uncompressed size
- ' of the extracted archive entry.
- ' This information may be used for some kind of progress display...
- UcSiz = CnvI64Struct2Dbl(lUcSiz_Lo, lUcSiz_Hi)
-
- s0 = ""
- '-- Get Zip32.DLL Message For processing
- For xx = 0 To UBound(mname.ch)
- If mname.ch(xx) = 0 Then Exit For
- s0 = s0 & Chr$(mname.ch(xx))
- Next
- ' At this point, s0 contains the message passed from the DLL
- ' (like the current file being extracted)
- ' It is up to the developer to code something useful here :)
-
- UZDLLServ_I32 = 0 ' Setting this to 1 will abort the zip!
-
-End Function
-
-'-- Callback For UNZIP32.DLL - Password Function
-Public Function UZDLLPass(ByRef pwbuf As UNZIPCBCh, _
- ByVal bufsiz As Long, ByRef promptmsg As UNZIPCBCh, _
- ByRef entryname As UNZIPCBCh) As Long
-
- Dim prompt As String
- Dim xx As Long
- Dim szpassword As String
-
- '-- Always implement a runtime error handler in Callback Routines!
- On Error Resume Next
-
- UZDLLPass = -1 'IZ_PW_CANCEL
-
- If uVbSkip Then Exit Function
-
- '-- Get the Password prompt
- For xx = 0 To UBound(promptmsg.ch)
- If promptmsg.ch(xx) = 0 Then Exit For
- prompt = prompt & Chr$(promptmsg.ch(xx))
- Next
- If Len(prompt) = 0 Then
- prompt = "Please Enter The Password!"
- Else
- prompt = prompt & " "
- For xx = 0 To UBound(entryname.ch)
- If entryname.ch(xx) = 0 Then Exit For
- prompt = prompt & Chr$(entryname.ch(xx))
- Next
- End If
-
- '-- Get The Zip File Password
- Do
- szpassword = InputBox(prompt)
- If Len(szpassword) < bufsiz Then Exit Do
- ' -- Entered password exceeds UnZip's password buffer size
- If MsgBox("The supplied password exceeds the maximum password length " _
- & CStr(bufsiz - 1) & " supported by the UnZip DLL." _
- , vbExclamation + vbRetryCancel, "UnZip password too long") _
- = vbCancel Then
- szpassword = ""
- Exit Do
- End If
- Loop
-
- '-- No Password So Exit The Function
- If Len(szpassword) = 0 Then
- uVbSkip = True
- Exit Function
- End If
-
- '-- Zip File Password So Process It
- For xx = 0 To bufsiz - 1
- pwbuf.ch(xx) = 0
- Next
- '-- Password length has already been checked, so
- '-- it will fit into the communication buffer.
- For xx = 0 To Len(szpassword) - 1
- pwbuf.ch(xx) = Asc(Mid$(szpassword, xx + 1, 1))
- Next
-
- pwbuf.ch(xx) = 0 ' Put Null Terminator For C
-
- UZDLLPass = 0 ' IZ_PW_ENTERED
-
-End Function
-
-'-- Callback For UNZIP32.DLL - Report Function To Overwrite Files.
-'-- This Function Will Display A MsgBox Asking The User
-'-- If They Would Like To Overwrite The Files.
-Public Function UZDLLReplacePrmt(ByRef fname As UNZIPCBChar, _
- ByVal fnbufsiz As Long) As Long
-
- Dim s0 As String
- Dim xx As Long
- Dim cCh As Byte
- Dim bufmax As Long
-
- '-- Always implement a runtime error handler in Callback Routines!
- On Error Resume Next
-
- UZDLLReplacePrmt = 100 ' 100 = Do Not Overwrite - Keep Asking User
- s0 = ""
- bufmax = UBound(fname.ch)
- If bufmax >= fnbufsiz Then bufmax = fnbufsiz - 1
-
- For xx = 0 To bufmax
- cCh = fname.ch(xx)
- Select Case cCh
- Case 0
- Exit For
- Case 92 ' = Asc("\")
- s0 = s0 & "/"
- Case Else
- s0 = s0 & Chr$(cCh)
- End Select
- Next
-
- '-- This Is The MsgBox Code
- xx = MsgBox("Overwrite """ & s0 & """ ?", vbExclamation Or vbYesNoCancel, _
- "VBUnZip32 - File Already Exists!")
- Select Case xx
- Case vbYes
- UZDLLReplacePrmt = 102 ' 102 = Overwrite, 103 = Overwrite All
- Case vbCancel
- UZDLLReplacePrmt = 104 ' 104 = Overwrite None
- Case Else
- 'keep the default as set at function entry.
- End Select
-
-End Function
-
-'-- ASCIIZ To String Function
-Public Function szTrim(szString As String) As String
-
- Dim pos As Long
-
- pos = InStr(szString, vbNullChar)
-
- Select Case pos
- Case Is > 1
- szTrim = Trim$(Left$(szString, pos - 1))
- Case 1
- szTrim = ""
- Case Else
- szTrim = Trim$(szString)
- End Select
-
-End Function
-
-'-- convert a 64-bit int divided in two Int32 variables into
-'-- a single 64-bit floating-point value
-Private Function CnvI64Struct2Dbl(ByVal lInt64Lo As Long, lInt64Hi As Long) As Double
- If lInt64Lo < 0 Then
- CnvI64Struct2Dbl = 2# ^ 32 + CDbl(lInt64Lo)
- Else
- CnvI64Struct2Dbl = CDbl(lInt64Lo)
- End If
- CnvI64Struct2Dbl = CnvI64Struct2Dbl + (2# ^ 32) * CDbl(lInt64Hi)
-End Function
-
-'-- Concatenate a "structured" version number into a single integer value,
-'-- to facilitate version number comparisons
-'-- (In case the practically used NumMajor numbers will ever exceed 128, it
-'-- should be considered to use the number type "Double" to store the
-'-- concatenated number. "Double" can store signed integer numbers up to a
-'-- width of 52 bits without loss of precision.)
-Private Function ConcatVersNums(ByVal NumMajor As Byte, ByVal NumMinor As Byte _
- , ByVal NumRevis As Byte, ByVal NumBuild As Byte) As Long
- If (NumMajor And &H80) <> 0 Then
- ConcatVersNums = (NumMajor And &H7F) * (2 ^ 24) Or &H80000000
- Else
- ConcatVersNums = NumMajor * (2 ^ 24)
- End If
- ConcatVersNums = ConcatVersNums _
- + NumMinor * (2 ^ 16) _
- + NumRevis * (2 ^ 8) _
- + NumBuild
-End Function
-
-'-- Helper function to provide a printable version number string, using the
-'-- current formatting rule for version number display as implemented in UnZip.
-Private Function VersNumsToTxt(ByVal NumMajor As Byte, ByVal NumMinor As Byte _
- , ByVal NumRevis As Byte) As String
- VersNumsToTxt = CStr(NumMajor) & "." & Hex$(NumMinor)
- If NumRevis <> 0 Then VersNumsToTxt = VersNumsToTxt & Hex$(NumRevis)
-End Function
-
-'-- Helper function to convert a "concatenated" version id into a printable
-'-- version number string, using the current formatting rule for version number
-'-- display as implemented in UnZip.
-Private Function VersIDToTxt(ByVal VersionID As Long) As String
- Dim lNumTemp As Long
-
- lNumTemp = VersionID \ (2 ^ 24)
- If lNumTemp < 0 Then lNumTemp = 256 + lNumTemp
- VersIDToTxt = CStr(lNumTemp) & "." _
- & Hex$((VersionID And &HFF0000) \ &H10000)
- lNumTemp = (VersionID And &HFF00&) \ &H100
- If lNumTemp <> 0 Then VersIDToTxt = VersIDToTxt & Hex$(lNumTemp)
-End Function
-
-'-- Main UNZIP32.DLL UnZip32 Subroutine
-'-- (WARNING!) Do Not Change!
-Public Sub VBUnZip32()
-
- Dim retcode As Long
- Dim MsgStr As String
- Dim TotalSizeComp As Double
- Dim TotalSize As Double
- Dim NumMembers As Double
-
- '-- Set The UNZIP32.DLL Options
- '-- (WARNING!) Do Not Change
- UZDCL.StructVersID = cUz_DCLStructVer ' Current version of this structure
- UZDCL.ExtractOnlyNewer = uExtractOnlyNewer ' 1 = Extract Only Newer/New
- UZDCL.SpaceToUnderscore = uSpaceUnderScore ' 1 = Convert Space To Underscore
- UZDCL.PromptToOverwrite = uPromptOverWrite ' 1 = Prompt To Overwrite Required
- UZDCL.fQuiet = uQuiet ' 2 = No Messages 1 = Less 0 = All
- UZDCL.ncflag = uWriteStdOut ' 1 = Write To Stdout
- UZDCL.ntflag = uTestZip ' 1 = Test Zip File
- UZDCL.nvflag = uExtractList ' 0 = Extract 1 = List Contents
- UZDCL.nfflag = uFreshenExisting ' 1 = Update Existing by Newer
- UZDCL.nzflag = uDisplayComment ' 1 = Display Zip File Comment
- UZDCL.ndflag = uHonorDirectories ' 1 = Honour Directories
- UZDCL.noflag = uOverWriteFiles ' 1 = Overwrite Files
- UZDCL.naflag = uConvertCR_CRLF ' 1 = Convert CR To CRLF
- UZDCL.nZIflag = uVerbose ' 1 = Zip Info Verbose
- UZDCL.C_flag = uCaseSensitivity ' 1 = Case insensitivity, 0 = Case Sensitivity
- UZDCL.fPrivilege = uPrivilege ' 1 = ACL 2 = Priv
- UZDCL.Zip = uZipFileName ' ZIP Filename
- UZDCL.ExtractDir = uExtractDir ' Extraction Directory, NULL If Extracting
- ' To Current Directory
-
- '-- Set Callback Addresses
- '-- (WARNING!!!) Do Not Change
- UZUSER.UZDLLPrnt = FnPtr(AddressOf UZDLLPrnt)
- UZUSER.UZDLLSND = 0& '-- Not Supported
- UZUSER.UZDLLREPLACE = FnPtr(AddressOf UZDLLReplacePrmt)
- UZUSER.UZDLLPASSWORD = FnPtr(AddressOf UZDLLPass)
- UZUSER.UZDLLMESSAGE_I32 = FnPtr(AddressOf UZReceiveDLLMessage_I32)
- UZUSER.UZDLLSERVICE_I32 = FnPtr(AddressOf UZDLLServ_I32)
-
- '-- Set UNZIP32.DLL Version Space
- '-- (WARNING!!!) Do Not Change
- With UZVER2
- .structlen = Len(UZVER2)
- .beta = String$(10, vbNullChar)
- .date = String$(20, vbNullChar)
- .zlib = String$(10, vbNullChar)
- End With
-
- '-- Get Version
- retcode = UzpVersion2(UZVER2)
- If retcode <> 0 Then
- MsgBox "Incompatible DLL version discovered!" & vbNewLine _
- & "The UnZip DLL requires a version structure of length " _
- & CStr(retcode) & ", but the VB frontend expects the DLL to need " _
- & Len(UZVER2) & "bytes." & vbNewLine _
- & vbNewLine & "The program cannot continue." _
- , vbCritical + vbOKOnly, App.Title
- Exit Sub
- End If
-
- ' Check that the DLL version is sufficiently recent
- If (ConcatVersNums(UZVER2.unzip(1), UZVER2.unzip(2) _
- , UZVER2.unzip(3), UZVER2.unzip(4)) < _
- ConcatVersNums(cUzDLL_MinVer_Major, cUzDLL_MinVer_Minor _
- , cUzDLL_MinVer_Revis, 0)) Then
- ' The found UnZip DLL is too old!
- MsgBox "Incompatible old DLL version discovered!" & vbNewLine _
- & "This program requires an UnZip DLL version of at least " _
- & VersNumsToTxt(cUzDLL_MinVer_Major, cUzDLL_MinVer_Minor, cUzDLL_MinVer_Revis) _
- & ", but the version reported by the found DLL is only " _
- & VersNumsToTxt(UZVER2.unzip(1), UZVER2.unzip(2), UZVER2.unzip(3)) _
- & "." & vbNewLine _
- & vbNewLine & "The program cannot continue." _
- , vbCritical + vbOKOnly, App.Title
- Exit Sub
- End If
-
- ' Concatenate the DLL API version info into a single version id variable.
- ' This variable may be used later on to switch between different
- ' known variants of specific API calls or API structures.
- m_UzDllApiVers = ConcatVersNums(UZVER2.dllapimin(1), UZVER2.dllapimin(2) _
- , UZVER2.dllapimin(3), UZVER2.dllapimin(4))
- ' check that the DLL API version is not too new
- If (m_UzDllApiVers > _
- ConcatVersNums(cUzDLL_MaxAPI_Major, cUzDLL_MaxAPI_Minor _
- , cUzDLL_MaxAPI_Revis, 0)) Then
- ' The found UnZip DLL is too new!
- MsgBox "DLL version with incompatible API discovered!" & vbNewLine _
- & "This program can only handle UnZip DLL API versions up to " _
- & VersNumsToTxt(cUzDLL_MaxAPI_Major, cUzDLL_MaxAPI_Minor, cUzDLL_MaxAPI_Revis) _
- & ", but the found DLL reports a newer API version of " _
- & VersIDToTxt(m_UzDllApiVers) & "." & vbNewLine _
- & vbNewLine & "The program cannot continue." _
- , vbCritical + vbOKOnly, App.Title
- Exit Sub
- End If
-
- '--------------------------------------
- '-- You Can Change This For Displaying
- '-- The Version Information!
- '--------------------------------------
- MsgStr$ = "DLL Date: " & szTrim(UZVER2.date)
- MsgStr$ = MsgStr$ & vbNewLine$ & "Zip Info: " _
- & VersNumsToTxt(UZVER2.zipinfo(1), UZVER2.zipinfo(2), UZVER2.zipinfo(3))
- MsgStr$ = MsgStr$ & vbNewLine$ & "DLL Version: " _
- & VersNumsToTxt(UZVER2.windll(1), UZVER2.windll(2), UZVER2.windll(3))
- MsgStr$ = MsgStr$ & vbNewLine$ & "DLL API Compatibility: " _
- & VersIDToTxt(m_UzDllApiVers)
- MsgStr$ = MsgStr$ & vbNewLine$ & "--------------"
- '-- End Of Version Information.
-
- '-- Go UnZip The Files! (Do Not Change Below!!!)
- '-- This Is The Actual UnZip Routine
- retcode = Wiz_SingleEntryUnzip(uNumberFiles, uZipNames, uNumberXFiles, _
- uExcludeNames, UZDCL, UZUSER)
- '---------------------------------------------------------------
-
- '-- If There Is An Error Display A MsgBox!
- If retcode <> 0 Then _
- MsgBox "UnZip DLL call returned error code #" & CStr(retcode) _
- , vbExclamation, App.Title
-
- '-- Add up 64-bit values
- TotalSizeComp = CnvI64Struct2Dbl(UZUSER.TotalSizeComp_Lo, _
- UZUSER.TotalSizeComp_Hi)
- TotalSize = CnvI64Struct2Dbl(UZUSER.TotalSize_Lo, _
- UZUSER.TotalSize_Hi)
- NumMembers = CnvI64Struct2Dbl(UZUSER.NumMembers_Lo, _
- UZUSER.NumMembers_Hi)
-
- '-- You Can Change This As Needed!
- '-- For Compression Information
- MsgStr$ = MsgStr$ & vbNewLine & _
- "Only Shows If uExtractList = 1 List Contents"
- MsgStr$ = MsgStr$ & vbNewLine & "--------------"
- MsgStr$ = MsgStr$ & vbNewLine & "Comment : " & UZUSER.cchComment
- MsgStr$ = MsgStr$ & vbNewLine & "Total Size Comp : " _
- & Format$(TotalSizeComp, "#,0")
- MsgStr$ = MsgStr$ & vbNewLine & "Total Size : " _
- & Format$(TotalSize, "#,0")
- MsgStr$ = MsgStr$ & vbNewLine & "Compress Factor : %" & UZUSER.CompFactor
- MsgStr$ = MsgStr$ & vbNewLine & "Num Of Members : " & NumMembers
- MsgStr$ = MsgStr$ & vbNewLine & "--------------"
-
- VBUnzFrm.txtMsgOut.Text = VBUnzFrm.txtMsgOut.Text & MsgStr$ & vbNewLine
-End Sub
+Attribute VB_Name = "VBUnzBas"\r
+Option Explicit\r
+\r
+'-- Please Do Not Remove These Comment Lines!\r
+'----------------------------------------------------------------\r
+'-- Sample VB 5 / VB 6 code to drive unzip32.dll\r
+'-- Contributed to the Info-ZIP project by Mike Le Voi\r
+'--\r
+'-- Contact me at: mlevoi@modemss.brisnet.org.au\r
+'--\r
+'-- Visit my home page at: http://modemss.brisnet.org.au/~mlevoi\r
+'--\r
+'-- Use this code at your own risk. Nothing implied or warranted\r
+'-- to work on your machine :-)\r
+'----------------------------------------------------------------\r
+'--\r
+'-- This Source Code Is Freely Available From The Info-ZIP Project\r
+'-- Web Server At:\r
+'-- ftp://ftp.info-zip.org/pub/infozip/infozip.html\r
+'--\r
+'-- A Very Special Thanks To Mr. Mike Le Voi\r
+'-- And Mr. Mike White\r
+'-- And The Fine People Of The Info-ZIP Group\r
+'-- For Letting Me Use And Modify Their Original\r
+'-- Visual Basic 5.0 Code! Thank You Mike Le Voi.\r
+'-- For Your Hard Work In Helping Me Get This To Work!!!\r
+'---------------------------------------------------------------\r
+'--\r
+'-- Contributed To The Info-ZIP Project By Raymond L. King.\r
+'-- Modified June 21, 1998\r
+'-- By Raymond L. King\r
+'-- Custom Software Designers\r
+'--\r
+'-- Contact Me At: king@ntplx.net\r
+'-- ICQ 434355\r
+'-- Or Visit Our Home Page At: http://www.ntplx.net/~king\r
+'--\r
+'---------------------------------------------------------------\r
+'--\r
+'-- Modified August 17, 1998\r
+'-- by Christian Spieler\r
+'-- (implemented sort of a "real" user interface)\r
+'-- Modified May 11, 2003\r
+'-- by Christian Spieler\r
+'-- (use late binding for referencing the common dialog)\r
+'-- Modified February 01, 2008\r
+'-- by Christian Spieler\r
+'-- (adapted DLL interface changes, fixed UZDLLPass callback)\r
+'-- Modified December 08, 2008 to December 30, 2008\r
+'-- by Ed Gordon\r
+'-- Updated sample project for UnZip 6.0 unzip32.dll\r
+'-- (support UnZip 6.0 flags and structures)\r
+'-- Modified January 03, 2009\r
+'-- by Christian Spieler\r
+'-- (better solution for overwrite_all handling, use Double\r
+'-- instead of Currency to stay safe against number overflow,\r
+'-- corrected UZDLLServ_I32() calling interface,\r
+'-- removed code that is unsupported under VB5)\r
+'--\r
+'---------------------------------------------------------------\r
+\r
+'-- Expected Version data for the DLL compatibility check\r
+'\r
+' For consistency of the version checking algorithm, the version number\r
+' constants "UzDLL_MinVer" and "UzDLL_MaxAPI" have to fullfil the\r
+' condition "UzDLL_MinVer <= "UzDLL_MaxAPI".\r
+' Version data supplied by a specific UnZip DLL always obey the\r
+' relation "UzDLL Version" >= "UzDLL API".\r
+\r
+'Oldest UnZip DLL version that is supported by this program\r
+Private Const cUzDLL_MinVer_Major As Byte = 6\r
+Private Const cUzDLL_MinVer_Minor As Byte = 0\r
+Private Const cUzDLL_MinVer_Revis As Byte = 0\r
+\r
+'Last (newest) UnZip DLL API version that is known (and supported)\r
+'by this program\r
+Private Const cUzDLL_MaxAPI_Major As Byte = 6\r
+Private Const cUzDLL_MaxAPI_Minor As Byte = 0\r
+Private Const cUzDLL_MaxAPI_Revis As Byte = 0\r
+\r
+'Current structure version ID of the DCLIST structure layout\r
+Private Const cUz_DCLStructVer As Long = &H600\r
+\r
+'-- C Style argv\r
+Private Type UNZIPnames\r
+ uzFiles(0 To 99) As String\r
+End Type\r
+\r
+'-- Callback Large "String"\r
+Private Type UNZIPCBChar\r
+ ch(32800) As Byte\r
+End Type\r
+\r
+'-- Callback Small "String"\r
+Private Type UNZIPCBCh\r
+ ch(256) As Byte\r
+End Type\r
+\r
+'-- UNZIP32.DLL DCL Structure\r
+Private Type DCLIST\r
+ StructVersID As Long ' Currently version &H600 of this structure\r
+ ExtractOnlyNewer As Long ' 1 = Extract Only Newer/New, Else 0\r
+ SpaceToUnderscore As Long ' 1 = Convert Space To Underscore, Else 0\r
+ PromptToOverwrite As Long ' 1 = Prompt To Overwrite Required, Else 0\r
+ fQuiet As Long ' 2 = No Messages, 1 = Less, 0 = All\r
+ ncflag As Long ' 1 = Write To Stdout, Else 0\r
+ ntflag As Long ' 1 = Test Zip File, Else 0\r
+ nvflag As Long ' 0 = Extract, 1 = List Zip Contents\r
+ nfflag As Long ' 1 = Extract Only Newer Over Existing, Else 0\r
+ nzflag As Long ' 1 = Display Zip File Comment, Else 0\r
+ ndflag As Long ' 0 = Junk paths, 1 = safe path components only, 2 = all\r
+ noflag As Long ' 1 = Overwrite Files, Else 0\r
+ naflag As Long ' 1 = Convert CR To CRLF, Else 0\r
+ nZIflag As Long ' 1 = Zip Info Verbose, Else 0\r
+ B_flag As Long ' 1 = Backup existing files, Else 0\r
+ C_flag As Long ' 1 = Case Insensitivity, 0 = Case Sensitivity\r
+ D_flag As Long ' Timestamp restoration, 0 = All, 1 = Files, 2 = None\r
+ U_flag As Long ' 0 = Unicode enabled, 1 = Escape chars, 2 = No Unicode\r
+ fPrivilege As Long ' 1 = ACL, 2 = Privileges\r
+ Zip As String ' The Zip Filename To Extract Files\r
+ ExtractDir As String ' The Extraction Directory, NULL If Extracting To Current Dir\r
+End Type\r
+\r
+'-- UNZIP32.DLL Userfunctions Structure\r
+Private Type USERFUNCTION\r
+ UZDLLPrnt As Long ' Pointer To Apps Print Function\r
+ UZDLLSND As Long ' Pointer To Apps Sound Function\r
+ UZDLLREPLACE As Long ' Pointer To Apps Replace Function\r
+ UZDLLPASSWORD As Long ' Pointer To Apps Password Function\r
+ ' 64-bit versions (VB6 does not support passing 64-bit values!)\r
+ UZDLLMESSAGE As Long ' Pointer To Apps Message Function (Not Used!)\r
+ UZDLLSERVICE As Long ' Pointer To Apps Service Function (Not Used!)\r
+ ' 32-bit versions\r
+ UZDLLMESSAGE_I32 As Long ' Pointer To Apps Message Function\r
+ UZDLLSERVICE_I32 As Long ' Pointer To Apps Service Function\r
+ ' All 64-bit values passed as low and high parts!\r
+ TotalSizeComp_Lo As Long ' Total Size Of Zip Archive (low 32 bits)\r
+ TotalSizeComp_Hi As Long ' Total Size Of Zip Archive (high 32 bits)\r
+ TotalSize_Lo As Long ' Total Size Of All Files In Archive (low 32)\r
+ TotalSize_Hi As Long ' Total Size Of All Files In Archive (high 32)\r
+ NumMembers_Lo As Long ' Total Number Of All Files In The Archive (low 32)\r
+ NumMembers_Hi As Long ' Total Number Of All Files In The Archive (high 32)\r
+ CompFactor As Long ' Compression Factor\r
+ cchComment As Integer ' Flag If Archive Has A Comment!\r
+End Type\r
+\r
+'-- UNZIP32.DLL Version Structure\r
+Private Type UZPVER2\r
+ structlen As Long ' Length Of The Structure Being Passed\r
+ flag As Long ' Bit 0: is_beta bit 1: uses_zlib\r
+ beta As String * 10 ' e.g., "g BETA" or ""\r
+ date As String * 20 ' e.g., "4 Sep 95" (beta) or "4 September 1995"\r
+ zlib As String * 10 ' e.g., "1.0.5" or NULL\r
+ unzip(1 To 4) As Byte ' Version Type Unzip\r
+ zipinfo(1 To 4) As Byte ' Version Type Zip Info\r
+ os2dll As Long ' Version Type OS2 DLL\r
+ windll(1 To 4) As Byte ' Version Type Windows DLL\r
+ dllapimin(1 To 4) As Byte ' Version Type DLL API minimum compatibility\r
+End Type\r
+\r
+'-- This assumes UNZIP32.DLL is somewhere on your execution path!\r
+'-- The term "execution path" means a search in the following locations,\r
+'-- in the listed sequence (for more details look up the documentation\r
+'-- of the LoadLibrary() Win32 API call):\r
+'-- 1) the directory from which the VB6 application was loaded,\r
+'-- 2) your current working directory in effect when the VB6 program\r
+'-- tries to access a first API call of UNZIP32.DLL,\r
+'-- 3) the Windows "SYSTEM32" (only NT/2K/XP...) and "SYSTEM" directories,\r
+'-- and the Windows directory,\r
+'-- 4) the folder list of your command path (e.g. check the environment\r
+'-- variable PATH as set in a console window started from scratch).\r
+'-- Normally, the Windows system directory is on your command path,\r
+'-- so installing the UNZIP32.DLL in the Windows System Directory\r
+'-- should always work.\r
+'--\r
+'-- WARNING:\r
+'-- When a VB6 program is run in the VB6 IDE, the "directory from which the\r
+'-- application was loaded" is the\r
+'-- ===>>> directory where VB6.EXE is stored (!!!),\r
+'-- not the storage directory of the VB project file\r
+'-- (the folder returned by "App.Path").\r
+'-- When a compiled VB6 program is run, the "application load directory"\r
+'-- is identical with the folder reported by "App.Path".\r
+'--\r
+Private Declare Function Wiz_SingleEntryUnzip Lib "unzip32.dll" _\r
+ (ByVal ifnc As Long, ByRef ifnv As UNZIPnames, _\r
+ ByVal xfnc As Long, ByRef xfnv As UNZIPnames, _\r
+ dcll As DCLIST, Userf As USERFUNCTION) As Long\r
+\r
+Private Declare Function UzpVersion2 Lib "unzip32.dll" _\r
+ (uzpv As UZPVER2) As Long\r
+\r
+'-- Private variable holding the API version id as reported by the\r
+'-- loaded UnZip DLL\r
+Private m_UzDllApiVers As Long\r
+\r
+'-- Private Variables For Structure Access\r
+Private UZDCL As DCLIST\r
+Private UZUSER As USERFUNCTION\r
+Private UZVER2 As UZPVER2\r
+\r
+'-- Public Variables For Setting The\r
+'-- UNZIP32.DLL DCLIST Structure\r
+'-- These Must Be Set Before The Actual Call To VBUnZip32\r
+Public uExtractOnlyNewer As Long ' 1 = Extract Only Newer/New, Else 0\r
+Public uSpaceUnderScore As Long ' 1 = Convert Space To Underscore, Else 0\r
+Public uPromptOverWrite As Long ' 1 = Prompt To Overwrite Required, Else 0\r
+Public uQuiet As Long ' 2 = No Messages, 1 = Less, 0 = All\r
+Public uWriteStdOut As Long ' 1 = Write To Stdout, Else 0\r
+Public uTestZip As Long ' 1 = Test Zip File, Else 0\r
+Public uExtractList As Long ' 0 = Extract, 1 = List Contents\r
+Public uFreshenExisting As Long ' 1 = Update Existing by Newer, Else 0\r
+Public uDisplayComment As Long ' 1 = Display Zip File Comment, Else 0\r
+Public uHonorDirectories As Long ' 1 = Honor Directories, Else 0\r
+Public uOverWriteFiles As Long ' 1 = Overwrite Files, Else 0\r
+Public uConvertCR_CRLF As Long ' 1 = Convert CR To CRLF, Else 0\r
+Public uVerbose As Long ' 1 = Zip Info Verbose\r
+Public uCaseSensitivity As Long ' 1 = Case Insensitivity, 0 = Case Sensitivity\r
+Public uPrivilege As Long ' 1 = ACL, 2 = Privileges, Else 0\r
+Public uZipFileName As String ' The Zip File Name\r
+Public uExtractDir As String ' Extraction Directory, Null If Current Directory\r
+\r
+'-- Public Program Variables\r
+Public uZipNumber As Long ' Zip File Number\r
+Public uNumberFiles As Long ' Number Of Files\r
+Public uNumberXFiles As Long ' Number Of Extracted Files\r
+Public uZipMessage As String ' For Zip Message\r
+Public uZipInfo As String ' For Zip Information\r
+Public uZipNames As UNZIPnames ' Names Of Files To Unzip\r
+Public uExcludeNames As UNZIPnames ' Names Of Zip Files To Exclude\r
+Public uVbSkip As Boolean ' For DLL Password Function\r
+\r
+'-- Puts A Function Pointer In A Structure\r
+'-- For Callbacks.\r
+Public Function FnPtr(ByVal lp As Long) As Long\r
+\r
+ FnPtr = lp\r
+\r
+End Function\r
+\r
+'-- Callback For UNZIP32.DLL - Receive Message Function\r
+Public Sub UZReceiveDLLMessage_I32( _\r
+ ByVal ucsize_lo As Long, _\r
+ ByVal ucsize_hi As Long, _\r
+ ByVal csiz_lo As Long, _\r
+ ByVal csiz_hi As Long, _\r
+ ByVal cfactor As Integer, _\r
+ ByVal mo As Integer, _\r
+ ByVal dy As Integer, _\r
+ ByVal yr As Integer, _\r
+ ByVal hh As Integer, _\r
+ ByVal mm As Integer, _\r
+ ByVal c As Byte, _\r
+ ByRef fname As UNZIPCBCh, _\r
+ ByRef meth As UNZIPCBCh, _\r
+ ByVal crc As Long, _\r
+ ByVal fCrypt As Byte)\r
+\r
+ Dim s0 As String\r
+ Dim xx As Long\r
+ Dim cCh As Byte\r
+ Dim strout As String * 80\r
+ Dim ucsize As Double\r
+ Dim csiz As Double\r
+\r
+ '-- Always implement a runtime error handler in Callback Routines!\r
+ On Error Resume Next\r
+\r
+ '------------------------------------------------\r
+ '-- This Is Where The Received Messages Are\r
+ '-- Printed Out And Displayed.\r
+ '-- You Can Modify Below!\r
+ '------------------------------------------------\r
+\r
+ strout = Space$(80)\r
+\r
+ '-- For Zip Message Printing\r
+ If uZipNumber = 0 Then\r
+ Mid$(strout, 1, 50) = "Filename:"\r
+ Mid$(strout, 53, 4) = "Size"\r
+ Mid$(strout, 62, 4) = "Date"\r
+ Mid$(strout, 71, 4) = "Time"\r
+ uZipMessage = strout & vbNewLine\r
+ strout = Space$(80)\r
+ End If\r
+\r
+ s0 = ""\r
+\r
+ '-- Do Not Change This For Next!!!\r
+ For xx = 0 To UBound(fname.ch)\r
+ If fname.ch(xx) = 0 Then Exit For\r
+ s0 = s0 & Chr$(fname.ch(xx))\r
+ Next\r
+\r
+ ucsize = CnvI64Struct2Dbl(ucsize_lo, ucsize_hi)\r
+ csiz = CnvI64Struct2Dbl(csiz_lo, csiz_hi)\r
+\r
+ '-- Assign Zip Information For Printing\r
+ Mid$(strout, 1, 50) = Mid$(s0, 1, 50)\r
+ Mid$(strout, 51, 9) = Right$(" " & CStr(ucsize), 9)\r
+ Mid$(strout, 62, 3) = Right$("0" & Trim$(CStr(mo)), 2) & "/"\r
+ Mid$(strout, 65, 3) = Right$("0" & Trim$(CStr(dy)), 2) & "/"\r
+ Mid$(strout, 68, 2) = Right$("0" & Trim$(CStr(yr)), 2)\r
+ Mid$(strout, 72, 3) = Right$(Str$(hh), 2) & ":"\r
+ Mid$(strout, 75, 2) = Right$("0" & Trim$(CStr(mm)), 2)\r
+\r
+ ' Mid$(strout, 77, 2) = Right$(" " & CStr(cfactor), 2)\r
+ ' Mid$(strout, 80, 8) = Right$(" " & CStr(csiz), 8)\r
+ ' s0 = ""\r
+ ' For xx = 0 To 255\r
+ ' If meth.ch(xx) = 0 Then Exit For\r
+ ' s0 = s0 & Chr$(meth.ch(xx))\r
+ ' Next xx\r
+\r
+ '-- Do Not Modify Below!!!\r
+ uZipMessage = uZipMessage & strout & vbNewLine\r
+ uZipNumber = uZipNumber + 1\r
+\r
+End Sub\r
+\r
+'-- Callback For UNZIP32.DLL - Print Message Function\r
+Public Function UZDLLPrnt(ByRef fname As UNZIPCBChar, ByVal x As Long) As Long\r
+\r
+ Dim s0 As String\r
+ Dim xx As Long\r
+ Dim cCh As Byte\r
+\r
+ '-- Always implement a runtime error handler in Callback Routines!\r
+ On Error Resume Next\r
+\r
+ s0 = ""\r
+\r
+ '-- Gets The UNZIP32.DLL Message For Displaying.\r
+ For xx = 0 To x - 1\r
+ cCh = fname.ch(xx)\r
+ Select Case cCh\r
+ Case 0\r
+ Exit For\r
+ Case 10\r
+ s0 = s0 & vbNewLine ' Damn UNIX :-)\r
+ Case 92 ' = Asc("\")\r
+ s0 = s0 & "/"\r
+ Case Else\r
+ s0 = s0 & Chr$(cCh)\r
+ End Select\r
+ Next\r
+\r
+ '-- Assign Zip Information\r
+ uZipInfo = uZipInfo & s0\r
+\r
+ UZDLLPrnt = 0\r
+\r
+End Function\r
+\r
+'-- Callback For UNZIP32.DLL - DLL Service Function\r
+Public Function UZDLLServ_I32(ByRef mname As UNZIPCBChar, _\r
+ ByVal lUcSiz_Lo As Long, ByVal lUcSiz_Hi As Long) As Long\r
+\r
+ Dim UcSiz As Double\r
+ Dim s0 As String\r
+ Dim xx As Long\r
+\r
+ '-- Always implement a runtime error handler in Callback Routines!\r
+ On Error Resume Next\r
+\r
+ ' Parameters lUcSiz_Lo and lUcSiz_Hi contain the uncompressed size\r
+ ' of the extracted archive entry.\r
+ ' This information may be used for some kind of progress display...\r
+ UcSiz = CnvI64Struct2Dbl(lUcSiz_Lo, lUcSiz_Hi)\r
+\r
+ s0 = ""\r
+ '-- Get Zip32.DLL Message For processing\r
+ For xx = 0 To UBound(mname.ch)\r
+ If mname.ch(xx) = 0 Then Exit For\r
+ s0 = s0 & Chr$(mname.ch(xx))\r
+ Next\r
+ ' At this point, s0 contains the message passed from the DLL\r
+ ' (like the current file being extracted)\r
+ ' It is up to the developer to code something useful here :)\r
+\r
+ UZDLLServ_I32 = 0 ' Setting this to 1 will abort the zip!\r
+\r
+End Function\r
+\r
+'-- Callback For UNZIP32.DLL - Password Function\r
+Public Function UZDLLPass(ByRef pwbuf As UNZIPCBCh, _\r
+ ByVal bufsiz As Long, ByRef promptmsg As UNZIPCBCh, _\r
+ ByRef entryname As UNZIPCBCh) As Long\r
+\r
+ Dim prompt As String\r
+ Dim xx As Long\r
+ Dim szpassword As String\r
+\r
+ '-- Always implement a runtime error handler in Callback Routines!\r
+ On Error Resume Next\r
+\r
+ UZDLLPass = -1 'IZ_PW_CANCEL\r
+\r
+ If uVbSkip Then Exit Function\r
+\r
+ '-- Get the Password prompt\r
+ For xx = 0 To UBound(promptmsg.ch)\r
+ If promptmsg.ch(xx) = 0 Then Exit For\r
+ prompt = prompt & Chr$(promptmsg.ch(xx))\r
+ Next\r
+ If Len(prompt) = 0 Then\r
+ prompt = "Please Enter The Password!"\r
+ Else\r
+ prompt = prompt & " "\r
+ For xx = 0 To UBound(entryname.ch)\r
+ If entryname.ch(xx) = 0 Then Exit For\r
+ prompt = prompt & Chr$(entryname.ch(xx))\r
+ Next\r
+ End If\r
+\r
+ '-- Get The Zip File Password\r
+ Do\r
+ szpassword = InputBox(prompt)\r
+ If Len(szpassword) < bufsiz Then Exit Do\r
+ ' -- Entered password exceeds UnZip's password buffer size\r
+ If MsgBox("The supplied password exceeds the maximum password length " _\r
+ & CStr(bufsiz - 1) & " supported by the UnZip DLL." _\r
+ , vbExclamation + vbRetryCancel, "UnZip password too long") _\r
+ = vbCancel Then\r
+ szpassword = ""\r
+ Exit Do\r
+ End If\r
+ Loop\r
+\r
+ '-- No Password So Exit The Function\r
+ If Len(szpassword) = 0 Then\r
+ uVbSkip = True\r
+ Exit Function\r
+ End If\r
+\r
+ '-- Zip File Password So Process It\r
+ For xx = 0 To bufsiz - 1\r
+ pwbuf.ch(xx) = 0\r
+ Next\r
+ '-- Password length has already been checked, so\r
+ '-- it will fit into the communication buffer.\r
+ For xx = 0 To Len(szpassword) - 1\r
+ pwbuf.ch(xx) = Asc(Mid$(szpassword, xx + 1, 1))\r
+ Next\r
+\r
+ pwbuf.ch(xx) = 0 ' Put Null Terminator For C\r
+\r
+ UZDLLPass = 0 ' IZ_PW_ENTERED\r
+\r
+End Function\r
+\r
+'-- Callback For UNZIP32.DLL - Report Function To Overwrite Files.\r
+'-- This Function Will Display A MsgBox Asking The User\r
+'-- If They Would Like To Overwrite The Files.\r
+Public Function UZDLLReplacePrmt(ByRef fname As UNZIPCBChar, _\r
+ ByVal fnbufsiz As Long) As Long\r
+\r
+ Dim s0 As String\r
+ Dim xx As Long\r
+ Dim cCh As Byte\r
+ Dim bufmax As Long\r
+\r
+ '-- Always implement a runtime error handler in Callback Routines!\r
+ On Error Resume Next\r
+\r
+ UZDLLReplacePrmt = 100 ' 100 = Do Not Overwrite - Keep Asking User\r
+ s0 = ""\r
+ bufmax = UBound(fname.ch)\r
+ If bufmax >= fnbufsiz Then bufmax = fnbufsiz - 1\r
+\r
+ For xx = 0 To bufmax\r
+ cCh = fname.ch(xx)\r
+ Select Case cCh\r
+ Case 0\r
+ Exit For\r
+ Case 92 ' = Asc("\")\r
+ s0 = s0 & "/"\r
+ Case Else\r
+ s0 = s0 & Chr$(cCh)\r
+ End Select\r
+ Next\r
+\r
+ '-- This Is The MsgBox Code\r
+ xx = MsgBox("Overwrite """ & s0 & """ ?", vbExclamation Or vbYesNoCancel, _\r
+ "VBUnZip32 - File Already Exists!")\r
+ Select Case xx\r
+ Case vbYes\r
+ UZDLLReplacePrmt = 102 ' 102 = Overwrite, 103 = Overwrite All\r
+ Case vbCancel\r
+ UZDLLReplacePrmt = 104 ' 104 = Overwrite None\r
+ Case Else\r
+ 'keep the default as set at function entry.\r
+ End Select\r
+\r
+End Function\r
+\r
+'-- ASCIIZ To String Function\r
+Public Function szTrim(szString As String) As String\r
+\r
+ Dim pos As Long\r
+\r
+ pos = InStr(szString, vbNullChar)\r
+\r
+ Select Case pos\r
+ Case Is > 1\r
+ szTrim = Trim$(Left$(szString, pos - 1))\r
+ Case 1\r
+ szTrim = ""\r
+ Case Else\r
+ szTrim = Trim$(szString)\r
+ End Select\r
+\r
+End Function\r
+\r
+'-- convert a 64-bit int divided in two Int32 variables into\r
+'-- a single 64-bit floating-point value\r
+Private Function CnvI64Struct2Dbl(ByVal lInt64Lo As Long, lInt64Hi As Long) As Double\r
+ If lInt64Lo < 0 Then\r
+ CnvI64Struct2Dbl = 2# ^ 32 + CDbl(lInt64Lo)\r
+ Else\r
+ CnvI64Struct2Dbl = CDbl(lInt64Lo)\r
+ End If\r
+ CnvI64Struct2Dbl = CnvI64Struct2Dbl + (2# ^ 32) * CDbl(lInt64Hi)\r
+End Function\r
+\r
+'-- Concatenate a "structured" version number into a single integer value,\r
+'-- to facilitate version number comparisons\r
+'-- (In case the practically used NumMajor numbers will ever exceed 128, it\r
+'-- should be considered to use the number type "Double" to store the\r
+'-- concatenated number. "Double" can store signed integer numbers up to a\r
+'-- width of 52 bits without loss of precision.)\r
+Private Function ConcatVersNums(ByVal NumMajor As Byte, ByVal NumMinor As Byte _\r
+ , ByVal NumRevis As Byte, ByVal NumBuild As Byte) As Long\r
+ If (NumMajor And &H80) <> 0 Then\r
+ ConcatVersNums = (NumMajor And &H7F) * (2 ^ 24) Or &H80000000\r
+ Else\r
+ ConcatVersNums = NumMajor * (2 ^ 24)\r
+ End If\r
+ ConcatVersNums = ConcatVersNums _\r
+ + NumMinor * (2 ^ 16) _\r
+ + NumRevis * (2 ^ 8) _\r
+ + NumBuild\r
+End Function\r
+\r
+'-- Helper function to provide a printable version number string, using the\r
+'-- current formatting rule for version number display as implemented in UnZip.\r
+Private Function VersNumsToTxt(ByVal NumMajor As Byte, ByVal NumMinor As Byte _\r
+ , ByVal NumRevis As Byte) As String\r
+ VersNumsToTxt = CStr(NumMajor) & "." & Hex$(NumMinor)\r
+ If NumRevis <> 0 Then VersNumsToTxt = VersNumsToTxt & Hex$(NumRevis)\r
+End Function\r
+\r
+'-- Helper function to convert a "concatenated" version id into a printable\r
+'-- version number string, using the current formatting rule for version number\r
+'-- display as implemented in UnZip.\r
+Private Function VersIDToTxt(ByVal VersionID As Long) As String\r
+ Dim lNumTemp As Long\r
+\r
+ lNumTemp = VersionID \ (2 ^ 24)\r
+ If lNumTemp < 0 Then lNumTemp = 256 + lNumTemp\r
+ VersIDToTxt = CStr(lNumTemp) & "." _\r
+ & Hex$((VersionID And &HFF0000) \ &H10000)\r
+ lNumTemp = (VersionID And &HFF00&) \ &H100\r
+ If lNumTemp <> 0 Then VersIDToTxt = VersIDToTxt & Hex$(lNumTemp)\r
+End Function\r
+\r
+'-- Main UNZIP32.DLL UnZip32 Subroutine\r
+'-- (WARNING!) Do Not Change!\r
+Public Sub VBUnZip32()\r
+\r
+ Dim retcode As Long\r
+ Dim MsgStr As String\r
+ Dim TotalSizeComp As Double\r
+ Dim TotalSize As Double\r
+ Dim NumMembers As Double\r
+\r
+ '-- Set The UNZIP32.DLL Options\r
+ '-- (WARNING!) Do Not Change\r
+ UZDCL.StructVersID = cUz_DCLStructVer ' Current version of this structure\r
+ UZDCL.ExtractOnlyNewer = uExtractOnlyNewer ' 1 = Extract Only Newer/New\r
+ UZDCL.SpaceToUnderscore = uSpaceUnderScore ' 1 = Convert Space To Underscore\r
+ UZDCL.PromptToOverwrite = uPromptOverWrite ' 1 = Prompt To Overwrite Required\r
+ UZDCL.fQuiet = uQuiet ' 2 = No Messages 1 = Less 0 = All\r
+ UZDCL.ncflag = uWriteStdOut ' 1 = Write To Stdout\r
+ UZDCL.ntflag = uTestZip ' 1 = Test Zip File\r
+ UZDCL.nvflag = uExtractList ' 0 = Extract 1 = List Contents\r
+ UZDCL.nfflag = uFreshenExisting ' 1 = Update Existing by Newer\r
+ UZDCL.nzflag = uDisplayComment ' 1 = Display Zip File Comment\r
+ UZDCL.ndflag = uHonorDirectories ' 1 = Honour Directories\r
+ UZDCL.noflag = uOverWriteFiles ' 1 = Overwrite Files\r
+ UZDCL.naflag = uConvertCR_CRLF ' 1 = Convert CR To CRLF\r
+ UZDCL.nZIflag = uVerbose ' 1 = Zip Info Verbose\r
+ UZDCL.C_flag = uCaseSensitivity ' 1 = Case insensitivity, 0 = Case Sensitivity\r
+ UZDCL.fPrivilege = uPrivilege ' 1 = ACL 2 = Priv\r
+ UZDCL.Zip = uZipFileName ' ZIP Filename\r
+ UZDCL.ExtractDir = uExtractDir ' Extraction Directory, NULL If Extracting\r
+ ' To Current Directory\r
+\r
+ '-- Set Callback Addresses\r
+ '-- (WARNING!!!) Do Not Change\r
+ UZUSER.UZDLLPrnt = FnPtr(AddressOf UZDLLPrnt)\r
+ UZUSER.UZDLLSND = 0& '-- Not Supported\r
+ UZUSER.UZDLLREPLACE = FnPtr(AddressOf UZDLLReplacePrmt)\r
+ UZUSER.UZDLLPASSWORD = FnPtr(AddressOf UZDLLPass)\r
+ UZUSER.UZDLLMESSAGE_I32 = FnPtr(AddressOf UZReceiveDLLMessage_I32)\r
+ UZUSER.UZDLLSERVICE_I32 = FnPtr(AddressOf UZDLLServ_I32)\r
+\r
+ '-- Set UNZIP32.DLL Version Space\r
+ '-- (WARNING!!!) Do Not Change\r
+ With UZVER2\r
+ .structlen = Len(UZVER2)\r
+ .beta = String$(10, vbNullChar)\r
+ .date = String$(20, vbNullChar)\r
+ .zlib = String$(10, vbNullChar)\r
+ End With\r
+\r
+ '-- Get Version\r
+ retcode = UzpVersion2(UZVER2)\r
+ If retcode <> 0 Then\r
+ MsgBox "Incompatible DLL version discovered!" & vbNewLine _\r
+ & "The UnZip DLL requires a version structure of length " _\r
+ & CStr(retcode) & ", but the VB frontend expects the DLL to need " _\r
+ & Len(UZVER2) & "bytes." & vbNewLine _\r
+ & vbNewLine & "The program cannot continue." _\r
+ , vbCritical + vbOKOnly, App.Title\r
+ Exit Sub\r
+ End If\r
+\r
+ ' Check that the DLL version is sufficiently recent\r
+ If (ConcatVersNums(UZVER2.unzip(1), UZVER2.unzip(2) _\r
+ , UZVER2.unzip(3), UZVER2.unzip(4)) < _\r
+ ConcatVersNums(cUzDLL_MinVer_Major, cUzDLL_MinVer_Minor _\r
+ , cUzDLL_MinVer_Revis, 0)) Then\r
+ ' The found UnZip DLL is too old!\r
+ MsgBox "Incompatible old DLL version discovered!" & vbNewLine _\r
+ & "This program requires an UnZip DLL version of at least " _\r
+ & VersNumsToTxt(cUzDLL_MinVer_Major, cUzDLL_MinVer_Minor, cUzDLL_MinVer_Revis) _\r
+ & ", but the version reported by the found DLL is only " _\r
+ & VersNumsToTxt(UZVER2.unzip(1), UZVER2.unzip(2), UZVER2.unzip(3)) _\r
+ & "." & vbNewLine _\r
+ & vbNewLine & "The program cannot continue." _\r
+ , vbCritical + vbOKOnly, App.Title\r
+ Exit Sub\r
+ End If\r
+\r
+ ' Concatenate the DLL API version info into a single version id variable.\r
+ ' This variable may be used later on to switch between different\r
+ ' known variants of specific API calls or API structures.\r
+ m_UzDllApiVers = ConcatVersNums(UZVER2.dllapimin(1), UZVER2.dllapimin(2) _\r
+ , UZVER2.dllapimin(3), UZVER2.dllapimin(4))\r
+ ' check that the DLL API version is not too new\r
+ If (m_UzDllApiVers > _\r
+ ConcatVersNums(cUzDLL_MaxAPI_Major, cUzDLL_MaxAPI_Minor _\r
+ , cUzDLL_MaxAPI_Revis, 0)) Then\r
+ ' The found UnZip DLL is too new!\r
+ MsgBox "DLL version with incompatible API discovered!" & vbNewLine _\r
+ & "This program can only handle UnZip DLL API versions up to " _\r
+ & VersNumsToTxt(cUzDLL_MaxAPI_Major, cUzDLL_MaxAPI_Minor, cUzDLL_MaxAPI_Revis) _\r
+ & ", but the found DLL reports a newer API version of " _\r
+ & VersIDToTxt(m_UzDllApiVers) & "." & vbNewLine _\r
+ & vbNewLine & "The program cannot continue." _\r
+ , vbCritical + vbOKOnly, App.Title\r
+ Exit Sub\r
+ End If\r
+\r
+ '--------------------------------------\r
+ '-- You Can Change This For Displaying\r
+ '-- The Version Information!\r
+ '--------------------------------------\r
+ MsgStr$ = "DLL Date: " & szTrim(UZVER2.date)\r
+ MsgStr$ = MsgStr$ & vbTab$ & vbTab$ & "Zip Info: " _\r
+ & VersNumsToTxt(UZVER2.zipinfo(1), UZVER2.zipinfo(2), UZVER2.zipinfo(3))\r
+ MsgStr$ = MsgStr$ & vbNewLine$ & "DLL Version: " _\r
+ & VersNumsToTxt(UZVER2.windll(1), UZVER2.windll(2), UZVER2.windll(3))\r
+ MsgStr$ = MsgStr$ & vbTab$ & vbTab$ & "DLL API Compatibility: " _\r
+ & VersIDToTxt(m_UzDllApiVers)\r
+ MsgStr$ = MsgStr$ & vbNewLine$ & "--------------"\r
+ '-- End Of Version Information.\r
+\r
+ '-- Go UnZip The Files! (Do Not Change Below!!!)\r
+ '-- This Is The Actual UnZip Routine\r
+ retcode = Wiz_SingleEntryUnzip(uNumberFiles, uZipNames, uNumberXFiles, _\r
+ uExcludeNames, UZDCL, UZUSER)\r
+ '---------------------------------------------------------------\r
+\r
+ '-- If There Is An Error Display A MsgBox!\r
+ If retcode <> 0 Then _\r
+ MsgBox "UnZip DLL call returned error code #" & CStr(retcode) _\r
+ , vbExclamation, App.Title\r
+\r
+ '-- Add up 64-bit values\r
+ TotalSizeComp = CnvI64Struct2Dbl(UZUSER.TotalSizeComp_Lo, _\r
+ UZUSER.TotalSizeComp_Hi)\r
+ TotalSize = CnvI64Struct2Dbl(UZUSER.TotalSize_Lo, _\r
+ UZUSER.TotalSize_Hi)\r
+ NumMembers = CnvI64Struct2Dbl(UZUSER.NumMembers_Lo, _\r
+ UZUSER.NumMembers_Hi)\r
+\r
+ '-- You Can Change This As Needed!\r
+ '-- For Compression Information\r
+ If uExtractList = 1 Then\r
+ MsgStr$ = MsgStr$ & vbNewLine & _\r
+ "Listing files" 'Only Shows If uExtractList = 1 List Contents\r
+ Else\r
+ MsgStr$ = MsgStr$ & vbNewLine & _\r
+ "Extracting files"\r
+ End If\r
+ MsgStr$ = MsgStr$ & vbNewLine & "--------------"\r
+ MsgStr$ = MsgStr$ & vbNewLine & "Comment : " & UZUSER.cchComment\r
+ MsgStr$ = MsgStr$ & vbNewLine & "Total Size Comp : " _\r
+ & Format$(TotalSizeComp, "#,0")\r
+ MsgStr$ = MsgStr$ & vbNewLine & "Total Size : " _\r
+ & Format$(TotalSize, "#,0")\r
+ MsgStr$ = MsgStr$ & vbNewLine & "Compress Factor : %" & UZUSER.CompFactor\r
+ MsgStr$ = MsgStr$ & vbNewLine & "Num Of Members : " & NumMembers\r
+ MsgStr$ = MsgStr$ & vbNewLine & "--------------"\r
+\r
+ VBUnzFrm.txtMsgOut.Text = VBUnzFrm.txtMsgOut.Text & MsgStr$ & vbNewLine\r
+End Sub\r
-VERSION 5.00
-Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
-Begin VB.Form VBUnzFrm
- AutoRedraw = -1 'True
- Caption = "VBUnzFrm"
- ClientHeight = 4785
- ClientLeft = 780
- ClientTop = 525
- ClientWidth = 9375
- BeginProperty Font
- Name = "Fixedsys"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "VBUnzFrm"
- ScaleHeight = 4785
- ScaleWidth = 9375
- StartUpPosition = 1 'Fenstermitte
- Begin VB.CheckBox checkOverwriteAll
- Alignment = 1 'Rechts ausgerichtet
- Caption = "Overwrite all?"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 5
- Top = 1320
- Width = 4425
- End
- Begin VB.TextBox txtZipFName
- BeginProperty Font
- Name = "Courier New"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4440
- TabIndex = 1
- Top = 120
- Width = 4335
- End
- Begin VB.TextBox txtExtractRoot
- BeginProperty Font
- Name = "Courier New"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4440
- TabIndex = 4
- Top = 720
- Width = 4335
- End
- Begin VB.CommandButton cmdStartUnz
- Caption = "Start"
- Height = 495
- Left = 240
- TabIndex = 6
- Top = 1800
- Width = 3255
- End
- Begin VB.TextBox txtMsgOut
- BeginProperty Font
- Name = "Courier New"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2175
- Left = 240
- Locked = -1 'True
- MultiLine = -1 'True
- ScrollBars = 3 'Beides
- TabIndex = 8
- TabStop = 0 'False
- Top = 2520
- Width = 8895
- End
- Begin VB.CommandButton cmdQuitVBUnz
- Cancel = -1 'True
- Caption = "Quit"
- Height = 495
- Left = 6240
- TabIndex = 7
- Top = 1800
- Width = 2895
- End
- Begin VB.CommandButton cmdSearchZfile
- Caption = "..."
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 8760
- TabIndex = 2
- Top = 120
- Width = 375
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 4800
- Top = 1800
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin VB.Label Label1
- Caption = "Complete path-name of Zip-archive:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 0
- Top = 120
- Width = 3855
- End
- Begin VB.Label Label2
- Caption = "Extract archive into directory:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 3
- Top = 720
- Width = 3855
- End
-End
-Attribute VB_Name = "VBUnzFrm"
-Attribute VB_GlobalNameSpace = False
-Attribute VB_Creatable = False
-Attribute VB_PredeclaredId = True
-Attribute VB_Exposed = False
-Option Explicit
-
-'---------------------------------------------------
-'-- Please Do Not Remove These Comment Lines!
-'----------------------------------------------------------------
-'-- Sample VB 5 / VB 6 code to drive unzip32.dll
-'-- Contributed to the Info-ZIP project by Mike Le Voi
-'--
-'-- Contact me at: mlevoi@modemss.brisnet.org.au
-'--
-'-- Visit my home page at: http://modemss.brisnet.org.au/~mlevoi
-'--
-'-- Use this code at your own risk. Nothing implied or warranted
-'-- to work on your machine :-)
-'----------------------------------------------------------------
-'--
-'-- This Source Code Is Freely Available From The Info-ZIP Project
-'-- Web Server At:
-'-- ftp://ftp.info-zip.org/pub/infozip/infozip.html
-'--
-'-- A Very Special Thanks To Mr. Mike Le Voi
-'-- And Mr. Mike White
-'-- And The Fine People Of The Info-ZIP Group
-'-- For Letting Me Use And Modify Their Orginal
-'-- Visual Basic 5.0 Code! Thank You Mike Le Voi.
-'-- For Your Hard Work In Helping Me Get This To Work!!!
-'---------------------------------------------------------------
-'--
-'-- Contributed To The Info-ZIP Project By Raymond L. King.
-'-- Modified June 21, 1998
-'-- By Raymond L. King
-'-- Custom Software Designers
-'--
-'-- Contact Me At: king@ntplx.net
-'-- ICQ 434355
-'-- Or Visit Our Home Page At: http://www.ntplx.net/~king
-'--
-'---------------------------------------------------------------
-'--
-'-- Modified August 17, 1998
-'-- by Christian Spieler
-'-- (added sort of a "windows oriented" user interface)
-'-- Modified May 11, 2003
-'-- by Christian Spieler
-'-- (use late binding for referencing the common dialog)
-'-- Modified December 30, 2008
-'-- by Ed Gordon
-'-- (add Overwrite_All checkbox and resizing of txtMsgOut
-'-- output box)
-'-- Modified January 03, 2009
-'-- by Christian Spieler
-'-- (fixed tab navigation sequence, changed passing of
-'-- "overwrite-all" setting to use existing option flags,
-'-- cleared all msg buffer at start of every DLL call,
-'-- removed code that is not supported by VB5)
-'--
-'---------------------------------------------------------------
-
-Private mCommDlgCtrl As Object
-
-Private Sub cmdStartUnz_Click()
-
- Dim MsgTmp As String
-
- Cls
- txtMsgOut.Text = ""
-
- '-- Init Global Message Variables
- uZipInfo = ""
- uZipMessage = ""
- uZipNumber = 0 ' Holds The Number Of Zip Files
-
- '-- Select UNZIP32.DLL Options - Change As Required!
- ' 1 = Always Overwrite Files
- uOverWriteFiles = Me.checkOverwriteAll.Value
- ' 1 = Prompt To Overwrite
- uPromptOverWrite = IIf(uOverWriteFiles = 0, 1, 0)
- uDisplayComment = 0 ' 1 = Display comment ONLY!!!
- uHonorDirectories = 1 ' 1 = Honour Zip Directories
-
- '-- Select Filenames If Required
- '-- Or Just Select All Files
- uZipNames.uzFiles(0) = vbNullString
- uNumberFiles = 0
-
- '-- Select Filenames To Exclude From Processing
- ' Note UNIX convention!
- ' vbxnames.s(0) = "VBSYX/VBSYX.MID"
- ' vbxnames.s(1) = "VBSYX/VBSYX.SYX"
- ' numx = 2
-
- '-- Or Just Select All Files
- uExcludeNames.uzFiles(0) = vbNullString
- uNumberXFiles = 0
-
- '-- Change The Next 2 Lines As Required!
- '-- These Should Point To Your Directory
- uZipFileName = txtZipFName.Text
- uExtractDir = txtExtractRoot.Text
- If Len(uExtractDir) <> 0 Then
- uExtractList = 0 ' 0 = Extract if dir specified
- Else
- uExtractList = 1 ' 1 = List Contents Of Zip
- End If
-
- '-- Let's Go And Unzip Them!
- Call VBUnZip32
-
- '-- Tell The User What Happened
- If Len(uZipMessage) > 0 Then
- MsgTmp = uZipMessage
- uZipMessage = ""
- End If
-
- '-- Display Zip File Information.
- If Len(uZipInfo) > 0 Then
- MsgTmp = MsgTmp & vbNewLine & "uZipInfo is:" & vbNewLine & uZipInfo
- uZipInfo = ""
- End If
-
- '-- Display The Number Of Extracted Files!
- If uZipNumber > 0 Then
- MsgTmp = MsgTmp & vbNewLine & "Number Of Files: " & Str(uZipNumber)
- End If
-
- txtMsgOut.Text = txtMsgOut.Text & MsgTmp & vbNewLine
-
-
-End Sub
-
-
-Private Sub Form_Load()
-
- '-- To work around compatibility issues between different versions of
- '-- Visual Basic, we use a late bound untyped object variable to reference
- '-- the common dialog ActiveX-control object at runtime.
- On Error Resume Next
- Set mCommDlgCtrl = CommonDialog1
- On Error GoTo 0
- '-- Disable the "call openfile dialog" button, when the common dialog
- '-- object is not available
- cmdSearchZfile.Visible = Not (mCommDlgCtrl Is Nothing)
-
- txtZipFName.Text = vbNullString
- txtExtractRoot.Text = vbNullString
- Me.Show
-
-End Sub
-
-Private Sub Form_Resize()
- Dim Wid As Single
- Dim Hei As Single
-
- Wid = Me.Width - 600 ' 9495 - 8895
- If Wid < 2000 Then Wid = 2000
- txtMsgOut.Width = Wid
-
- Hei = Me.Height - 3120 ' 5295 - 2175
- If Hei < 1000 Then Hei = 1000
- txtMsgOut.Height = Hei
-
-End Sub
-
-Private Sub Form_Unload(Cancel As Integer)
- '-- remove runtime reference to common dialog control object
- Set mCommDlgCtrl = Nothing
-End Sub
-
-
-Private Sub cmdQuitVBUnz_Click()
- Unload Me
-End Sub
-
-
-Private Sub cmdSearchZfile_Click()
- If mCommDlgCtrl Is Nothing Then Exit Sub
- mCommDlgCtrl.CancelError = False
- mCommDlgCtrl.DialogTitle = "Open Zip-archive"
- '-- The following property is not supported in the first version(s)
- '-- of the common dialog controls. But this feature is of minor
- '-- relevance in our context, so we simply skip over the statement
- '-- in case of errors.
- On Error Resume Next
- mCommDlgCtrl.DefaultExt = ".zip"
- On Error GoTo err_deactivateControl
- '-- Initialize the file name with the current setting of the filename
- '-- text box.
- mCommDlgCtrl.FileName = txtZipFName.Text
- '-- Provide reasonable filter settings for selecting Zip archives.
- mCommDlgCtrl.Filter = "Zip archives (*.zip)|*.zip|All files (*.*)|*.*"
- mCommDlgCtrl.ShowOpen
- '-- In case the user closed the dialog via cancel, the FilenName
- '-- property contains its initial setting and no change occurs.
- txtZipFName.Text = mCommDlgCtrl.FileName
- Exit Sub
-
-err_deactivateControl:
- '-- Emit a warning message.
- MsgBox "Unexpected error #" & CStr(Err.Number) & " in call to ComDLG32" _
- & " FileOpen dialog:" & vbNewLine & Err.Description & vbNewLine _
- & vbNewLine & "The version of the COMDLG32.OCX control installed" _
- & " on your system seems to be too old. Please consider upgrading" _
- & " to a recent release of the Common Dialog ActiveX control." _
- & vbNewLine & "The ""Choose File from List"" dialog functionality" _
- & " has been disabled for this session.", _
- vbCritical + vbOKOnly, "FileOpen Dialog incompatible"
- '-- Deactivate the control and prevent further usage in this session.
- Set mCommDlgCtrl = Nothing
- cmdSearchZfile.Enabled = False
-End Sub
-
+VERSION 5.00\r
+Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"\r
+Begin VB.Form VBUnzFrm \r
+ AutoRedraw = -1 'True\r
+ Caption = "VBUnzFrm"\r
+ ClientHeight = 7275\r
+ ClientLeft = 780\r
+ ClientTop = 525\r
+ ClientWidth = 9375\r
+ BeginProperty Font \r
+ Name = "Fixedsys"\r
+ Size = 9\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ LinkTopic = "VBUnzFrm"\r
+ ScaleHeight = 7275\r
+ ScaleWidth = 9375\r
+ StartUpPosition = 1 'CenterOwner\r
+ Begin VB.CheckBox checkOverwriteAll \r
+ Alignment = 1 'Right Justify\r
+ Caption = "Overwrite all?"\r
+ BeginProperty Font \r
+ Name = "MS Sans Serif"\r
+ Size = 9.75\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ Height = 375\r
+ Left = 240\r
+ TabIndex = 5\r
+ Top = 1800\r
+ Width = 3585\r
+ End\r
+ Begin VB.TextBox txtZipFName \r
+ BeginProperty Font \r
+ Name = "Courier New"\r
+ Size = 9.75\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ Height = 375\r
+ Left = 3600\r
+ TabIndex = 1\r
+ Top = 120\r
+ Width = 5175\r
+ End\r
+ Begin VB.TextBox txtExtractRoot \r
+ BeginProperty Font \r
+ Name = "Courier New"\r
+ Size = 9.75\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ Height = 375\r
+ Left = 3600\r
+ TabIndex = 4\r
+ Top = 720\r
+ Width = 5175\r
+ End\r
+ Begin VB.CommandButton cmdStartUnz \r
+ Caption = "Start"\r
+ Height = 495\r
+ Left = 240\r
+ TabIndex = 6\r
+ Top = 2520\r
+ Width = 3255\r
+ End\r
+ Begin VB.TextBox txtMsgOut \r
+ BeginProperty Font \r
+ Name = "Courier New"\r
+ Size = 9\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ Height = 2535\r
+ Left = 240\r
+ Locked = -1 'True\r
+ MultiLine = -1 'True\r
+ ScrollBars = 3 'Both\r
+ TabIndex = 8\r
+ TabStop = 0 'False\r
+ Top = 3360\r
+ Width = 8895\r
+ End\r
+ Begin VB.CommandButton cmdQuitVBUnz \r
+ Cancel = -1 'True\r
+ Caption = "Quit"\r
+ Height = 495\r
+ Left = 6240\r
+ TabIndex = 7\r
+ Top = 2520\r
+ Width = 2895\r
+ End\r
+ Begin VB.CommandButton cmdSearchZfile \r
+ Caption = "..."\r
+ BeginProperty Font \r
+ Name = "MS Sans Serif"\r
+ Size = 8.25\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ Height = 375\r
+ Left = 8760\r
+ TabIndex = 2\r
+ Top = 120\r
+ Width = 375\r
+ End\r
+ Begin MSComDlg.CommonDialog CommonDialog1 \r
+ Left = 4800\r
+ Top = 1800\r
+ _ExtentX = 847\r
+ _ExtentY = 847\r
+ _Version = 393216\r
+ End\r
+ Begin VB.Label Label3 \r
+ Caption = "Leave ""Extract into directory"" empty to list files, provide a directory (such as ""."") to extract."\r
+ BeginProperty Font \r
+ Name = "MS Sans Serif"\r
+ Size = 9.75\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ Height = 255\r
+ Left = 240\r
+ TabIndex = 9\r
+ Top = 1320\r
+ Width = 8175\r
+ End\r
+ Begin VB.Label Label1 \r
+ Caption = "Complete path-name of Zip-archive:"\r
+ BeginProperty Font \r
+ Name = "MS Sans Serif"\r
+ Size = 9.75\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ Height = 255\r
+ Left = 240\r
+ TabIndex = 0\r
+ Top = 120\r
+ Width = 3255\r
+ End\r
+ Begin VB.Label Label2 \r
+ Caption = "Extract into directory:"\r
+ BeginProperty Font \r
+ Name = "MS Sans Serif"\r
+ Size = 9.75\r
+ Charset = 0\r
+ Weight = 400\r
+ Underline = 0 'False\r
+ Italic = 0 'False\r
+ Strikethrough = 0 'False\r
+ EndProperty\r
+ Height = 255\r
+ Left = 240\r
+ TabIndex = 3\r
+ Top = 720\r
+ Width = 2175\r
+ End\r
+End\r
+Attribute VB_Name = "VBUnzFrm"\r
+Attribute VB_GlobalNameSpace = False\r
+Attribute VB_Creatable = False\r
+Attribute VB_PredeclaredId = True\r
+Attribute VB_Exposed = False\r
+Option Explicit\r
+\r
+'---------------------------------------------------\r
+'-- Please Do Not Remove These Comment Lines!\r
+'----------------------------------------------------------------\r
+'-- Sample VB 5 / VB 6 code to drive unzip32.dll\r
+'-- Contributed to the Info-ZIP project by Mike Le Voi\r
+'--\r
+'-- Contact me at: mlevoi@modemss.brisnet.org.au\r
+'--\r
+'-- Visit my home page at: http://modemss.brisnet.org.au/~mlevoi\r
+'--\r
+'-- Use this code at your own risk. Nothing implied or warranted\r
+'-- to work on your machine :-)\r
+'----------------------------------------------------------------\r
+'--\r
+'-- This Source Code Is Freely Available From The Info-ZIP Project\r
+'-- Web Server At:\r
+'-- ftp://ftp.info-zip.org/pub/infozip/infozip.html\r
+'--\r
+'-- A Very Special Thanks To Mr. Mike Le Voi\r
+'-- And Mr. Mike White\r
+'-- And The Fine People Of The Info-ZIP Group\r
+'-- For Letting Me Use And Modify Their Orginal\r
+'-- Visual Basic 5.0 Code! Thank You Mike Le Voi.\r
+'-- For Your Hard Work In Helping Me Get This To Work!!!\r
+'---------------------------------------------------------------\r
+'--\r
+'-- Contributed To The Info-ZIP Project By Raymond L. King.\r
+'-- Modified June 21, 1998\r
+'-- By Raymond L. King\r
+'-- Custom Software Designers\r
+'--\r
+'-- Contact Me At: king@ntplx.net\r
+'-- ICQ 434355\r
+'-- Or Visit Our Home Page At: http://www.ntplx.net/~king\r
+'--\r
+'---------------------------------------------------------------\r
+'--\r
+'-- Modified August 17, 1998\r
+'-- by Christian Spieler\r
+'-- (added sort of a "windows oriented" user interface)\r
+'-- Modified May 11, 2003\r
+'-- by Christian Spieler\r
+'-- (use late binding for referencing the common dialog)\r
+'-- Modified December 30, 2008\r
+'-- by Ed Gordon\r
+'-- (add Overwrite_All checkbox and resizing of txtMsgOut\r
+'-- output box)\r
+'-- Modified January 03, 2009\r
+'-- by Christian Spieler\r
+'-- (fixed tab navigation sequence, changed passing of\r
+'-- "overwrite-all" setting to use existing option flags,\r
+'-- cleared all msg buffer at start of every DLL call,\r
+'-- removed code that is not supported by VB5)\r
+'--\r
+'---------------------------------------------------------------\r
+\r
+Private mCommDlgCtrl As Object\r
+\r
+Private Sub cmdStartUnz_Click()\r
+\r
+ Dim MsgTmp As String\r
+ \r
+ Cls\r
+ txtMsgOut.Text = ""\r
+ \r
+ '-- Init Global Message Variables\r
+ uZipInfo = ""\r
+ uZipMessage = ""\r
+ uZipNumber = 0 ' Holds The Number Of Zip Files\r
+ \r
+ '-- Select UNZIP32.DLL Options - Change As Required!\r
+ ' 1 = Always Overwrite Files\r
+ uOverWriteFiles = Me.checkOverwriteAll.Value\r
+ ' 1 = Prompt To Overwrite\r
+ uPromptOverWrite = IIf(uOverWriteFiles = 0, 1, 0)\r
+ uDisplayComment = 0 ' 1 = Display comment ONLY!!!\r
+ uHonorDirectories = 1 ' 1 = Honour Zip Directories\r
+ \r
+ '-- Select Filenames If Required\r
+ '-- Or Just Select All Files\r
+ uZipNames.uzFiles(0) = vbNullString\r
+ uNumberFiles = 0\r
+ \r
+ '-- Select Filenames To Exclude From Processing\r
+ ' Note UNIX convention!\r
+ ' vbxnames.s(0) = "VBSYX/VBSYX.MID"\r
+ ' vbxnames.s(1) = "VBSYX/VBSYX.SYX"\r
+ ' numx = 2\r
+ \r
+ '-- Or Just Select All Files\r
+ uExcludeNames.uzFiles(0) = vbNullString\r
+ uNumberXFiles = 0\r
+ \r
+ '-- Change The Next 2 Lines As Required!\r
+ '-- These Should Point To Your Directory\r
+ uZipFileName = txtZipFName.Text\r
+ uExtractDir = txtExtractRoot.Text\r
+ If Len(uExtractDir) <> 0 Then\r
+ uExtractList = 0 ' 0 = Extract if dir specified\r
+ Else\r
+ uExtractList = 1 ' 1 = List Contents Of Zip\r
+ End If\r
+ \r
+ '-- Let's Go And Unzip Them!\r
+ Call VBUnZip32\r
+ \r
+ '-- Tell The User What Happened\r
+ If Len(uZipMessage) > 0 Then\r
+ MsgTmp = uZipMessage\r
+ uZipMessage = ""\r
+ End If\r
+ \r
+ '-- Display Zip File Information.\r
+ If Len(uZipInfo) > 0 Then\r
+ MsgTmp = MsgTmp & vbNewLine & "uZipInfo is:" & vbNewLine & uZipInfo\r
+ uZipInfo = ""\r
+ End If\r
+ \r
+ '-- Display The Number Of Extracted Files!\r
+ If uZipNumber > 0 Then\r
+ MsgTmp = MsgTmp & vbNewLine & "Number Of Files: " & Str(uZipNumber)\r
+ End If\r
+ \r
+ txtMsgOut.Text = txtMsgOut.Text & MsgTmp & vbNewLine\r
+ \r
+ \r
+End Sub\r
+\r
+\r
+Private Sub Form_Load()\r
+ \r
+ '-- To work around compatibility issues between different versions of\r
+ '-- Visual Basic, we use a late bound untyped object variable to reference\r
+ '-- the common dialog ActiveX-control object at runtime.\r
+ On Error Resume Next\r
+ Set mCommDlgCtrl = CommonDialog1\r
+ On Error GoTo 0\r
+ '-- Disable the "call openfile dialog" button, when the common dialog\r
+ '-- object is not available\r
+ cmdSearchZfile.Visible = Not (mCommDlgCtrl Is Nothing)\r
+ \r
+ txtZipFName.Text = vbNullString\r
+ txtExtractRoot.Text = vbNullString\r
+ Me.Show\r
+ \r
+End Sub\r
+\r
+Private Sub Form_Resize()\r
+ Dim Wid As Single\r
+ Dim Hei As Single\r
+ \r
+ Wid = Me.Width - 600 ' 9495 - 8895\r
+ If Wid < 2000 Then Wid = 2000\r
+ txtMsgOut.Width = Wid\r
+ \r
+ Hei = Me.Height - 3985 ' 3120 ' 5295 - 2175\r
+ If Hei < 1000 Then Hei = 1000\r
+ txtMsgOut.Height = Hei\r
+End Sub\r
+\r
+Private Sub Form_Unload(Cancel As Integer)\r
+ '-- remove runtime reference to common dialog control object\r
+ Set mCommDlgCtrl = Nothing\r
+End Sub\r
+\r
+\r
+Private Sub cmdQuitVBUnz_Click()\r
+ Unload Me\r
+End Sub\r
+\r
+\r
+Private Sub cmdSearchZfile_Click()\r
+ If mCommDlgCtrl Is Nothing Then Exit Sub\r
+ mCommDlgCtrl.CancelError = False\r
+ mCommDlgCtrl.DialogTitle = "Open Zip-archive"\r
+ '-- The following property is not supported in the first version(s)\r
+ '-- of the common dialog controls. But this feature is of minor\r
+ '-- relevance in our context, so we simply skip over the statement\r
+ '-- in case of errors.\r
+ On Error Resume Next\r
+ mCommDlgCtrl.DefaultExt = ".zip"\r
+ On Error GoTo err_deactivateControl\r
+ '-- Initialize the file name with the current setting of the filename\r
+ '-- text box.\r
+ mCommDlgCtrl.FileName = txtZipFName.Text\r
+ '-- Provide reasonable filter settings for selecting Zip archives.\r
+ mCommDlgCtrl.Filter = "Zip archives (*.zip)|*.zip|All files (*.*)|*.*"\r
+ mCommDlgCtrl.ShowOpen\r
+ '-- In case the user closed the dialog via cancel, the FilenName\r
+ '-- property contains its initial setting and no change occurs.\r
+ txtZipFName.Text = mCommDlgCtrl.FileName\r
+ Exit Sub\r
+\r
+err_deactivateControl:\r
+ '-- Emit a warning message.\r
+ MsgBox "Unexpected error #" & CStr(Err.Number) & " in call to ComDLG32" _\r
+ & " FileOpen dialog:" & vbNewLine & Err.Description & vbNewLine _\r
+ & vbNewLine & "The version of the COMDLG32.OCX control installed" _\r
+ & " on your system seems to be too old. Please consider upgrading" _\r
+ & " to a recent release of the Common Dialog ActiveX control." _\r
+ & vbNewLine & "The ""Choose File from List"" dialog functionality" _\r
+ & " has been disabled for this session.", _\r
+ vbCritical + vbOKOnly, "FileOpen Dialog incompatible"\r
+ '-- Deactivate the control and prevent further usage in this session.\r
+ Set mCommDlgCtrl = Nothing\r
+ cmdSearchZfile.Enabled = False\r
+End Sub\r
-Type=Exe
-Form=vbunzip.frm
-Module=VBUnzBas; vbunzip.bas
-Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0; COMDLG32.OCX
-IconForm="VBUnzFrm"
-Startup="VBUnzFrm"
-HelpFile=""
-Title="VBUnZip"
-ExeName32="VBunzip.exe"
-Command32=""
-Name="VBUnzipProject"
-HelpContextID="0"
-CompatibleMode="0"
-MajorVer=1
-MinorVer=0
-RevisionVer=0
-AutoIncrementVer=0
-ServerSupportFiles=0
-VersionCompanyName="Info-ZIP"
-VersionLegalCopyright="(c) Info-ZIP 1998-2009"
-CompilationType=0
-OptimizationType=0
-FavorPentiumPro(tm)=0
-CodeViewDebugInfo=0
-NoAliasing=0
-BoundsCheck=0
-OverflowCheck=0
-FlPointCheck=0
-FDIVCheck=0
-UnroundedFP=0
-StartMode=0
-Unattended=0
-ThreadPerObject=0
-MaxNumberOfThreads=1
+Type=Exe\r
+Form=vbunzip.frm\r
+Module=VBUnzBas; vbunzip.bas\r
+Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX\r
+IconForm="VBUnzFrm"\r
+Startup="VBUnzFrm"\r
+HelpFile=""\r
+Title="VBUnZip"\r
+ExeName32="VBunzip.exe"\r
+Command32=""\r
+Name="VBUnzipProject"\r
+HelpContextID="0"\r
+CompatibleMode="0"\r
+MajorVer=1\r
+MinorVer=0\r
+RevisionVer=0\r
+AutoIncrementVer=0\r
+ServerSupportFiles=0\r
+VersionCompanyName="Info-ZIP"\r
+VersionLegalCopyright="(c) Info-ZIP 1998-2009"\r
+CompilationType=0\r
+OptimizationType=0\r
+FavorPentiumPro(tm)=0\r
+CodeViewDebugInfo=0\r
+NoAliasing=0\r
+BoundsCheck=0\r
+OverflowCheck=0\r
+FlPointCheck=0\r
+FDIVCheck=0\r
+UnroundedFP=0\r
+StartMode=0\r
+Unattended=0\r
+Retained=0\r
+ThreadPerObject=0\r
+MaxNumberOfThreads=1\r
+\r
+[MS Transaction Server]\r
+AutoRefresh=1\r
--- /dev/null
+VBUnzFrm = 80, 68, 982, 711, , 44, 58, 946, 701, C\r
+VBUnzBas = 78, 230, 980, 873, \r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{A78C1242-16DD-4F61-B2A4-0740165B414E}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>libbz2</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\bzip2\bzlib.h" />
+ <ClInclude Include="..\..\..\bzip2\bzlib_private.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\bzip2\blocksort.c" />
+ <ClCompile Include="..\..\..\bzip2\bzlib.c" />
+ <ClCompile Include="..\..\..\bzip2\compress.c" />
+ <ClCompile Include="..\..\..\bzip2\crctable.c" />
+ <ClCompile Include="..\..\..\bzip2\decompress.c" />
+ <ClCompile Include="..\..\..\bzip2\huffman.c" />
+ <ClCompile Include="..\..\..\bzip2\randtable.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\bzip2\bzlib.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\bzip2\bzlib_private.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\bzip2\blocksort.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\bzlib.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\compress.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\crctable.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\decompress.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\huffman.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\bzip2\randtable.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip32_dll", "unzip32_dll\unzip32_dll.vcxproj", "{24CEFBE3-3307-4F78-88CB-A625631CC333}"
+ ProjectSection(ProjectDependencies) = postProject
+ {A78C1242-16DD-4F61-B2A4-0740165B414E} = {A78C1242-16DD-4F61-B2A4-0740165B414E}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uzexampl", "uzexampl\uzexampl.vcxproj", "{BE884407-2908-4690-846D-60031B5D17FA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {A78C1242-16DD-4F61-B2A4-0740165B414E} = {A78C1242-16DD-4F61-B2A4-0740165B414E}
+ {24CEFBE3-3307-4F78-88CB-A625631CC333} = {24CEFBE3-3307-4F78-88CB-A625631CC333}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbz2", "libbz2\libbz2.vcxproj", "{A78C1242-16DD-4F61-B2A4-0740165B414E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzipstb", "unzipstb\unzipstb.vcxproj", "{FDD441BF-F3BC-4628-B383-CB974C40A055}"
+ ProjectSection(ProjectDependencies) = postProject
+ {24CEFBE3-3307-4F78-88CB-A625631CC333} = {24CEFBE3-3307-4F78-88CB-A625631CC333}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {24CEFBE3-3307-4F78-88CB-A625631CC333}.Debug|Win32.ActiveCfg = Debug|Win32
+ {24CEFBE3-3307-4F78-88CB-A625631CC333}.Debug|Win32.Build.0 = Debug|Win32
+ {24CEFBE3-3307-4F78-88CB-A625631CC333}.Release|Win32.ActiveCfg = Release|Win32
+ {24CEFBE3-3307-4F78-88CB-A625631CC333}.Release|Win32.Build.0 = Release|Win32
+ {BE884407-2908-4690-846D-60031B5D17FA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BE884407-2908-4690-846D-60031B5D17FA}.Debug|Win32.Build.0 = Debug|Win32
+ {BE884407-2908-4690-846D-60031B5D17FA}.Release|Win32.ActiveCfg = Release|Win32
+ {BE884407-2908-4690-846D-60031B5D17FA}.Release|Win32.Build.0 = Release|Win32
+ {A78C1242-16DD-4F61-B2A4-0740165B414E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A78C1242-16DD-4F61-B2A4-0740165B414E}.Debug|Win32.Build.0 = Debug|Win32
+ {A78C1242-16DD-4F61-B2A4-0740165B414E}.Release|Win32.ActiveCfg = Release|Win32
+ {A78C1242-16DD-4F61-B2A4-0740165B414E}.Release|Win32.Build.0 = Release|Win32
+ {FDD441BF-F3BC-4628-B383-CB974C40A055}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FDD441BF-F3BC-4628-B383-CB974C40A055}.Debug|Win32.Build.0 = Debug|Win32
+ {FDD441BF-F3BC-4628-B383-CB974C40A055}.Release|Win32.ActiveCfg = Release|Win32
+ {FDD441BF-F3BC-4628-B383-CB974C40A055}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{24CEFBE3-3307-4F78-88CB-A625631CC333}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>unz32dll</RootNamespace>
+ <ProjectName>unzip32_dll</ProjectName>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <IncludePath>..\..\..;..\..\..\bzip2;$(IncludePath)</IncludePath>
+ <LibraryPath>$(SolutionDir)\$(Configuration);$(LibraryPath)</LibraryPath>
+ <TargetName>unzip32</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <IncludePath>..\..\..;..\..\..\bzip2;$(IncludePath)</IncludePath>
+ <LibraryPath>$(SolutionDir)\$(Configuration);$(LibraryPath)</LibraryPath>
+ <TargetName>unzip32</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;DLL;WINDLL;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ModuleDefinitionFile>..\..\windll32.def</ModuleDefinitionFile>
+ </Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>
+ </PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL;WINDLL;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <ModuleDefinitionFile>..\..\windll32.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\api.c" />
+ <ClCompile Include="..\..\..\crc32.c" />
+ <ClCompile Include="..\..\..\crypt.c" />
+ <ClCompile Include="..\..\..\envargs.c" />
+ <ClCompile Include="..\..\..\explode.c" />
+ <ClCompile Include="..\..\..\extract.c" />
+ <ClCompile Include="..\..\..\fileio.c" />
+ <ClCompile Include="..\..\..\globals.c" />
+ <ClCompile Include="..\..\..\inflate.c" />
+ <ClCompile Include="..\..\..\list.c" />
+ <ClCompile Include="..\..\..\match.c" />
+ <ClCompile Include="..\..\..\process.c" />
+ <ClCompile Include="..\..\..\ubz2err.c" />
+ <ClCompile Include="..\..\..\unreduce.c" />
+ <ClCompile Include="..\..\..\unshrink.c" />
+ <ClCompile Include="..\..\..\unzip.c" />
+ <ClCompile Include="..\..\..\win32\nt.c" />
+ <ClCompile Include="..\..\..\win32\win32.c" />
+ <ClCompile Include="..\..\..\win32\win32i64.c" />
+ <ClCompile Include="..\..\..\wrap\aescrypt.c" />
+ <ClCompile Include="..\..\..\wrap\aeskey.c" />
+ <ClCompile Include="..\..\..\wrap\aestab.c" />
+ <ClCompile Include="..\..\..\wrap\crc_i386.c" />
+ <ClCompile Include="..\..\..\wrap\fileenc.c" />
+ <ClCompile Include="..\..\..\wrap\hmac.c" />
+ <ClCompile Include="..\..\..\wrap\LzFind.c" />
+ <ClCompile Include="..\..\..\wrap\LzmaDec.c" />
+ <ClCompile Include="..\..\..\wrap\Ppmd8.c" />
+ <ClCompile Include="..\..\..\wrap\Ppmd8Dec.c" />
+ <ClCompile Include="..\..\..\wrap\prng.c" />
+ <ClCompile Include="..\..\..\wrap\pwd2key.c" />
+ <ClCompile Include="..\..\..\wrap\sha1.c" />
+ <ClCompile Include="..\..\..\zipinfo.c" />
+ <ClCompile Include="..\..\windll.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="..\..\windll.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\windll32.def" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\aes_wg\aes.h" />
+ <ClInclude Include="..\..\..\aes_wg\aesopt.h" />
+ <ClInclude Include="..\..\..\aes_wg\brg_endian.h" />
+ <ClInclude Include="..\..\..\aes_wg\fileenc.h" />
+ <ClInclude Include="..\..\..\aes_wg\hmac.h" />
+ <ClInclude Include="..\..\..\aes_wg\iz_aes_wg.h" />
+ <ClInclude Include="..\..\..\aes_wg\prng.h" />
+ <ClInclude Include="..\..\..\aes_wg\pwd2key.h" />
+ <ClInclude Include="..\..\..\aes_wg\sha1.h" />
+ <ClInclude Include="..\..\..\api.h" />
+ <ClInclude Include="..\..\..\bzip2\bzlib.h" />
+ <ClInclude Include="..\..\..\consts.h" />
+ <ClInclude Include="..\..\..\crc32.h" />
+ <ClInclude Include="..\..\..\crypt.h" />
+ <ClInclude Include="..\..\..\ebcdic.h" />
+ <ClInclude Include="..\..\..\globals.h" />
+ <ClInclude Include="..\..\..\inflate.h" />
+ <ClInclude Include="..\..\..\szip\CpuArch.h" />
+ <ClInclude Include="..\..\..\szip\LzFind.h" />
+ <ClInclude Include="..\..\..\szip\LzHash.h" />
+ <ClInclude Include="..\..\..\szip\LzmaDec.h" />
+ <ClInclude Include="..\..\..\szip\Ppmd.h" />
+ <ClInclude Include="..\..\..\szip\Ppmd8.h" />
+ <ClInclude Include="..\..\..\szip\SzVersion.h" />
+ <ClInclude Include="..\..\..\szip\Types.h" />
+ <ClInclude Include="..\..\..\ttyio.h" />
+ <ClInclude Include="..\..\..\unzip.h" />
+ <ClInclude Include="..\..\..\unzpriv.h" />
+ <ClInclude Include="..\..\..\unzvers.h" />
+ <ClInclude Include="..\..\..\win32\nt.h" />
+ <ClInclude Include="..\..\..\win32\rsxntwin.h" />
+ <ClInclude Include="..\..\..\win32\w32cfg.h" />
+ <ClInclude Include="..\..\..\zip.h" />
+ <ClInclude Include="..\..\decs.h" />
+ <ClInclude Include="..\..\structs.h" />
+ <ClInclude Include="..\..\windll.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\api.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\crc32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\crypt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\aescrypt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\aeskey.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\aestab.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\crc_i386.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\fileenc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\hmac.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\LzFind.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\LzmaDec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\Ppmd8.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\Ppmd8Dec.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\prng.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\pwd2key.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\wrap\sha1.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\envargs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\explode.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\extract.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\fileio.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\globals.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\inflate.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\list.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\match.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\process.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\ubz2err.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unreduce.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unshrink.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\unzip.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\zipinfo.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\win32\nt.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\win32\win32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\win32\win32i64.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\windll.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\windll32.def">
+ <Filter>Resource Files</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\aes_wg\aes.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\aesopt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\brg_endian.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\fileenc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\hmac.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\iz_aes_wg.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\prng.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\pwd2key.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\sha1.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\bzip2\bzlib.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\api.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\consts.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\crc32.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\crypt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\ebcdic.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\globals.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\inflate.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\ttyio.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzFind.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzHash.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzmaDec.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Ppmd8.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Ppmd.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\SzVersion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Types.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\win32\nt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\win32\rsxntwin.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\win32\w32cfg.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\decs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\structs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\windll.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\CpuArch.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzpriv.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzvers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\zip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="..\..\windll.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\unzipstb.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\crypt.h" />
+ <ClInclude Include="..\..\..\unzip.h" />
+ <ClInclude Include="..\..\..\unzvers.h" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{FDD441BF-F3BC-4628-B383-CB974C40A055}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>unzipstb</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <IncludePath>..\..\..;$(IncludePath)</IncludePath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <IncludePath>..\..\..;$(IncludePath)</IncludePath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;DLL;WINDLL</PreprocessorDefinitions>
+ <PrecompiledHeaderFile>
+ </PrecompiledHeaderFile>
+ <PrecompiledHeaderOutputFile>
+ </PrecompiledHeaderOutputFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>unzip32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;DLL;WINDLL</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>unzip32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\unzipstb.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\unzip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzvers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\crypt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{BE884407-2908-4690-846D-60031B5D17FA}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>uzexampl</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <IncludePath>..\..\..;$(IncludePath)</IncludePath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <IncludePath>..\..\..;$(IncludePath)</IncludePath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\uzexampl.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\aes_wg\fileenc.h" />
+ <ClInclude Include="..\..\..\bzip2\bzlib.h" />
+ <ClInclude Include="..\..\..\globals.h" />
+ <ClInclude Include="..\..\..\szip\LzmaDec.h" />
+ <ClInclude Include="..\..\..\szip\Ppmd8.h" />
+ <ClInclude Include="..\..\..\szip\Types.h" />
+ <ClInclude Include="..\..\..\unzip.h" />
+ <ClInclude Include="..\..\..\unzpriv.h" />
+ <ClInclude Include="..\..\..\unzvers.h" />
+ <ClInclude Include="..\..\..\win32\w32cfg.h" />
+ <ClInclude Include="..\..\decs.h" />
+ <ClInclude Include="..\..\structs.h" />
+ <ClInclude Include="..\..\uzexampl.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\uzexampl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\uzexampl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzvers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzip.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\unzpriv.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\decs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\structs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\win32\w32cfg.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\globals.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\aes_wg\fileenc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\bzip2\bzlib.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Types.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\LzmaDec.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\szip\Ppmd8.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
-# Microsoft Developer Studio Project File - Name="unz32dll" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=unz32dll - Win32 ASM Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "unz32dll.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "unz32dll.mak" CFG="unz32dll - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "unz32dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "unz32dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "unz32dll - Win32 ASM Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "unz32dll - Win32 ASM Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "unz32dll - Win32 Static Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "unz32dll - Win32 Static Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "unz32dll - Win32 ASM Static Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "unz32dll - Win32 ASM Static Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "unz32dll - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release/app"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../Release/app/unzip32.dll"
-
-!ELSEIF "$(CFG)" == "unz32dll - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug/app"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../Debug/app/unzip32.dll" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "unz32dll - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release.ASM/app"
-# PROP Intermediate_Dir "Release.ASM"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../Release.ASM/app/unzip32.dll"
-
-!ELSEIF "$(CFG)" == "unz32dll - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug.ASM/app"
-# PROP Intermediate_Dir "Debug.ASM"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../Debug.ASM/app/unzip32.dll" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "unz32dll - Win32 Static Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "StatRelease"
-# PROP BASE Intermediate_Dir "StatRelease"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../StatRelease/app"
-# PROP Intermediate_Dir "StatRelease"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../StatRelease/app/unzip32.dll"
-
-!ELSEIF "$(CFG)" == "unz32dll - Win32 Static Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "StatDebug"
-# PROP BASE Intermediate_Dir "StatDebug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../StatDebug/app"
-# PROP Intermediate_Dir "StatDebug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../StatDebug/app/unzip32.dll" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "unz32dll - Win32 ASM Static Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "StatRelease"
-# PROP BASE Intermediate_Dir "StatRelease"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../StatRelease.ASM/app"
-# PROP Intermediate_Dir "StatRelease.ASM"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../StatRelease.ASM/app/unzip32.dll"
-
-!ELSEIF "$(CFG)" == "unz32dll - Win32 ASM Static Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "StatDebug"
-# PROP BASE Intermediate_Dir "StatDebug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../StatDebug.ASM/app"
-# PROP Intermediate_Dir "StatDebug.ASM"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../StatDebug.ASM/app/unzip32.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "unz32dll - Win32 Release"
-# Name "unz32dll - Win32 Debug"
-# Name "unz32dll - Win32 ASM Release"
-# Name "unz32dll - Win32 ASM Debug"
-# Name "unz32dll - Win32 Static Release"
-# Name "unz32dll - Win32 Static Debug"
-# Name "unz32dll - Win32 ASM Static Release"
-# Name "unz32dll - Win32 ASM Static Debug"
-# Begin Source File
-
-SOURCE=..\..\..\api.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\crc_i386.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\explode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\extract.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\fileio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\globals.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\inflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\list.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\match.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\nt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\ubz2err.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\unreduce.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\unshrink.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\win32i64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\windll\windll.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\windll\windll.rc
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\windll\windll32.def
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\zipinfo.c
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="unz32dll" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102\r
+\r
+CFG=unz32dll - Win32 ASM Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unz32dll.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unz32dll.mak" CFG="unz32dll - Win32 ASM Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "unz32dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "unz32dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "unz32dll - Win32 ASM Release" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "unz32dll - Win32 ASM Debug" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "unz32dll - Win32 Static Release" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "unz32dll - Win32 Static Debug" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "unz32dll - Win32 ASM Static Release" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "unz32dll - Win32 ASM Static Debug" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+MTL=midl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "unz32dll - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release/app"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../Release/app/unzip32.dll"\r
+\r
+!ELSEIF "$(CFG)" == "unz32dll - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug/app"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../Debug/app/unzip32.dll" /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unz32dll - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release.ASM/app"\r
+# PROP Intermediate_Dir "Release.ASM"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "ASM_CRC" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../Release.ASM/app/unzip32.dll"\r
+\r
+!ELSEIF "$(CFG)" == "unz32dll - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug.ASM/app"\r
+# PROP Intermediate_Dir "Debug.ASM"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "ASM_CRC" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "UNICODE_SUPPORT" /D "WIN32_WIDE" /FR /YX /FD /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../Debug.ASM/app/unzip32.dll" /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unz32dll - Win32 Static Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "StatRelease"\r
+# PROP BASE Intermediate_Dir "StatRelease"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../StatRelease/app"\r
+# PROP Intermediate_Dir "StatRelease"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../StatRelease/app/unzip32.dll"\r
+\r
+!ELSEIF "$(CFG)" == "unz32dll - Win32 Static Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "StatDebug"\r
+# PROP BASE Intermediate_Dir "StatDebug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../StatDebug/app"\r
+# PROP Intermediate_Dir "StatDebug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../StatDebug/app/unzip32.dll" /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "unz32dll - Win32 ASM Static Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "StatRelease"\r
+# PROP BASE Intermediate_Dir "StatRelease"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../StatRelease.ASM/app"\r
+# PROP Intermediate_Dir "StatRelease.ASM"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../StatRelease.ASM/app/unzip32.dll"\r
+\r
+!ELSEIF "$(CFG)" == "unz32dll - Win32 ASM Static Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "StatDebug"\r
+# PROP BASE Intermediate_Dir "StatDebug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../StatDebug.ASM/app"\r
+# PROP Intermediate_Dir "StatDebug.ASM"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "USE_EF_UT_TIME" /D "ASM_CRC" /FR /YX /FD /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../StatDebug.ASM/app/unzip32.dll" /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "unz32dll - Win32 Release"\r
+# Name "unz32dll - Win32 Debug"\r
+# Name "unz32dll - Win32 ASM Release"\r
+# Name "unz32dll - Win32 ASM Debug"\r
+# Name "unz32dll - Win32 Static Release"\r
+# Name "unz32dll - Win32 Static Debug"\r
+# Name "unz32dll - Win32 ASM Static Release"\r
+# Name "unz32dll - Win32 ASM Static Debug"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\api.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\crc32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\crc_i386.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\crypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\explode.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\extract.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\fileio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\globals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\inflate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\list.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\match.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\nt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\process.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\ubz2err.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\unreduce.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\unshrink.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\win32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\win32i64.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\windll.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\windll.rc\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\windll32.def\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\zipinfo.c\r
+# End Source File\r
+# End Target\r
+# End Project\r
-# Microsoft Developer Studio Project File - Name="c_dll_ex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=c_dll_ex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "c_dll_ex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "c_dll_ex.mak" CFG="c_dll_ex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "c_dll_ex - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "c_dll_ex - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "c_dll_ex - Win32 Static Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "c_dll_ex - Win32 Static Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "c_dll_ex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release/app"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /machine:I386 /out:"../Release/app/uzexampl.exe"
-
-!ELSEIF "$(CFG)" == "c_dll_ex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug/app"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /debug /machine:I386 /out:"../Debug/app/uzexampl.exe" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "c_dll_ex - Win32 Static Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "StatRelease"
-# PROP BASE Intermediate_Dir "StatRelease"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../StatRelease/app"
-# PROP Intermediate_Dir "StatRelease"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /machine:I386 /out:"../StatRelease/app/uzexampl.exe"
-
-!ELSEIF "$(CFG)" == "c_dll_ex - Win32 Static Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "StatDebug"
-# PROP BASE Intermediate_Dir "StatDebug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../StatDebug/app"
-# PROP Intermediate_Dir "StatDebug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /debug /machine:I386 /out:"../StatDebug/app/uzexampl.exe" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "c_dll_ex - Win32 Release"
-# Name "c_dll_ex - Win32 Debug"
-# Name "c_dll_ex - Win32 Static Release"
-# Name "c_dll_ex - Win32 Static Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\uzexampl.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\uzexampl.h
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="c_dll_ex" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=c_dll_ex - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "c_dll_ex.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "c_dll_ex.mak" CFG="c_dll_ex - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "c_dll_ex - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "c_dll_ex - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "c_dll_ex - Win32 Static Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "c_dll_ex - Win32 Static Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "c_dll_ex - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release/app"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /machine:I386 /out:"../Release/app/uzexampl.exe"\r
+\r
+!ELSEIF "$(CFG)" == "c_dll_ex - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug/app"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /debug /machine:I386 /out:"../Debug/app/uzexampl.exe" /pdbtype:sept\r
+\r
+!ELSEIF "$(CFG)" == "c_dll_ex - Win32 Static Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "StatRelease"\r
+# PROP BASE Intermediate_Dir "StatRelease"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../StatRelease/app"\r
+# PROP Intermediate_Dir "StatRelease"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /FD /c\r
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /machine:I386 /out:"../StatRelease/app/uzexampl.exe"\r
+\r
+!ELSEIF "$(CFG)" == "c_dll_ex - Win32 Static Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "StatDebug"\r
+# PROP BASE Intermediate_Dir "StatDebug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../StatDebug/app"\r
+# PROP Intermediate_Dir "StatDebug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /FD /GZ /c\r
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib version.lib /nologo /subsystem:console /debug /machine:I386 /out:"../StatDebug/app/uzexampl.exe" /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "c_dll_ex - Win32 Release"\r
+# Name "c_dll_ex - Win32 Debug"\r
+# Name "c_dll_ex - Win32 Static Release"\r
+# Name "c_dll_ex - Win32 Static Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\uzexampl.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\uzexampl.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
-# Microsoft Developer Studio Project File - Name="unz32lib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=unz32lib - Win32 ASM Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "unz32lib.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "unz32lib.mak" CFG="unz32lib - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "unz32lib - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "unz32lib - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE "unz32lib - Win32 ASM Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "unz32lib - Win32 ASM Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "unz32lib - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release/libs"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "USE_EF_UT_TIME" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../Release/libs/unzip32.lib"
-
-!ELSEIF "$(CFG)" == "unz32lib - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug/libs"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "USE_EF_UT_TIME" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../Debug/libs/unzip32.lib"
-
-!ELSEIF "$(CFG)" == "unz32lib - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release.ASM/libs"
-# PROP Intermediate_Dir "Release.ASM"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "USE_EF_UT_TIME" /D "ASM_CRC" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../Release.ASM/libs/unzip32.lib"
-
-!ELSEIF "$(CFG)" == "unz32lib - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug.ASM/libs"
-# PROP Intermediate_Dir "Debug.ASM"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "USE_EF_UT_TIME" /D "ASM_CRC" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../Debug.ASM/libs/unzip32.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "unz32lib - Win32 Release"
-# Name "unz32lib - Win32 Debug"
-# Name "unz32lib - Win32 ASM Release"
-# Name "unz32lib - Win32 ASM Debug"
-# Begin Source File
-
-SOURCE=..\..\..\api.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\crc_i386.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\explode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\extract.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\fileio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\globals.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\inflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\list.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\match.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\nt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\ubz2err.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\unreduce.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\unshrink.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\windll\unziplib.def
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\win32i64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\windll\windll.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\zipinfo.c
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="unz32lib" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
+\r
+CFG=unz32lib - Win32 ASM Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unz32lib.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unz32lib.mak" CFG="unz32lib - Win32 ASM Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "unz32lib - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "unz32lib - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "unz32lib - Win32 ASM Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "unz32lib - Win32 ASM Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "unz32lib - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release/libs"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "USE_EF_UT_TIME" /FD /c\r
+# SUBTRACT CPP /YX\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo /out:"../Release/libs/unzip32.lib"\r
+\r
+!ELSEIF "$(CFG)" == "unz32lib - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug/libs"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "USE_EF_UT_TIME" /FD /c\r
+# SUBTRACT CPP /YX\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo /out:"../Debug/libs/unzip32.lib"\r
+\r
+!ELSEIF "$(CFG)" == "unz32lib - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release.ASM/libs"\r
+# PROP Intermediate_Dir "Release.ASM"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "USE_EF_UT_TIME" /D "ASM_CRC" /FD /c\r
+# SUBTRACT CPP /YX\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo /out:"../Release.ASM/libs/unzip32.lib"\r
+\r
+!ELSEIF "$(CFG)" == "unz32lib - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug.ASM/libs"\r
+# PROP Intermediate_Dir "Debug.ASM"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "USE_EF_UT_TIME" /D "ASM_CRC" /FD /c\r
+# SUBTRACT CPP /YX\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo /out:"../Debug.ASM/libs/unzip32.lib"\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "unz32lib - Win32 Release"\r
+# Name "unz32lib - Win32 Debug"\r
+# Name "unz32lib - Win32 ASM Release"\r
+# Name "unz32lib - Win32 ASM Debug"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\api.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\crc32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\crc_i386.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\crypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\explode.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\extract.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\fileio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\globals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\inflate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\list.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\match.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\nt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\process.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\ubz2err.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\unreduce.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\unshrink.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\unziplib.def\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\win32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\win32i64.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\windll.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\zipinfo.c\r
+# End Source File\r
+# End Target\r
+# End Project\r
-# Microsoft Developer Studio Project File - Name="SFXWiz" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Application" 0x0101
-
-CFG=SFXWiz - Win32 ASM Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "SFXWiz32.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "SFXWiz32.mak" CFG="SFXWiz - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "SFXWiz - Win32 Release" (based on "Win32 (x86) Application")
-!MESSAGE "SFXWiz - Win32 Debug" (based on "Win32 (x86) Application")
-!MESSAGE "SFXWiz - Win32 ASM Release" (based on "Win32 (x86) Application")
-!MESSAGE "SFXWiz - Win32 ASM Debug" (based on "Win32 (x86) Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "SFXWiz - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /Gz /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /Gz /W3 /GX /O1 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "API" /D "DLL" /D "USE_UNZIP_LIB" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib unzsfx32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\Release"
-
-!ELSEIF "$(CFG)" == "SFXWiz - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /Gz /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /Gz /W3 /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "API" /D "DLL" /D "USE_UNZIP_LIB" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib unzsfx32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
-
-!ELSEIF "$(CFG)" == "SFXWiz - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release.ASM"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /Gz /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /Gz /W3 /GX /O1 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "API" /D "DLL" /D "USE_UNZIP_LIB" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib unzsfx32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\Release.ASM"
-
-!ELSEIF "$(CFG)" == "SFXWiz - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug.ASM"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /Gz /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /Gz /W3 /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "API" /D "DLL" /D "USE_UNZIP_LIB" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib unzsfx32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug.ASM"
-
-!ENDIF
-
-# Begin Target
-
-# Name "SFXWiz - Win32 Release"
-# Name "SFXWiz - Win32 Debug"
-# Name "SFXWiz - Win32 ASM Release"
-# Name "SFXWiz - Win32 ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\..\windll\guisfx\sfxwiz.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\windll\guisfx\sfxwiz.rc
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\..\windll\guisfx\dialog.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=..\..\..\windll\guisfx\sfxw.ico
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="SFXWiz" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Application" 0x0101\r
+\r
+CFG=SFXWiz - Win32 ASM Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "SFXWiz32.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "SFXWiz32.mak" CFG="SFXWiz - Win32 ASM Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "SFXWiz - Win32 Release" (based on "Win32 (x86) Application")\r
+!MESSAGE "SFXWiz - Win32 Debug" (based on "Win32 (x86) Application")\r
+!MESSAGE "SFXWiz - Win32 ASM Release" (based on "Win32 (x86) Application")\r
+!MESSAGE "SFXWiz - Win32 ASM Debug" (based on "Win32 (x86) Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+MTL=midl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "SFXWiz - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /Gz /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /Gz /W3 /GX /O1 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "API" /D "DLL" /D "USE_UNZIP_LIB" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib unzsfx32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\Release"\r
+\r
+!ELSEIF "$(CFG)" == "SFXWiz - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /Gz /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /Gz /W3 /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "API" /D "DLL" /D "USE_UNZIP_LIB" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib unzsfx32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"\r
+\r
+!ELSEIF "$(CFG)" == "SFXWiz - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release.ASM"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /Gz /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /Gz /W3 /GX /O1 /I "../../.." /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "API" /D "DLL" /D "USE_UNZIP_LIB" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib unzsfx32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\Release.ASM"\r
+\r
+!ELSEIF "$(CFG)" == "SFXWiz - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug.ASM"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /Gz /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /Gz /W3 /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "API" /D "DLL" /D "USE_UNZIP_LIB" /YX /FD /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib unzsfx32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug.ASM"\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "SFXWiz - Win32 Release"\r
+# Name "SFXWiz - Win32 Debug"\r
+# Name "SFXWiz - Win32 ASM Release"\r
+# Name "SFXWiz - Win32 ASM Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\guisfx\sfxwiz.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\guisfx\sfxwiz.rc\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\guisfx\dialog.h\r
+# End Source File\r
+# End Group\r
+# Begin Group "Resource Files"\r
+\r
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\guisfx\sfxw.ico\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
-
-###############################################################################
-
-Project: "SFXWiz"=.\SFXWiz32.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name unzsfx32
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "unzsfx32"=.\unzsfx32.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!\r
+\r
+###############################################################################\r
+\r
+Project: "SFXWiz"=.\SFXWiz32.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+ Begin Project Dependency\r
+ Project_Dep_Name unzsfx32\r
+ End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "unzsfx32"=.\unzsfx32.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
-# Microsoft Developer Studio Project File - Name="unzsfx32" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=unzsfx32 - Win32 ASM Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "unzsfx32.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "unzsfx32.mak" CFG="unzsfx32 - Win32 ASM Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "unzsfx32 - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "unzsfx32 - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE "unzsfx32 - Win32 ASM Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "unzsfx32 - Win32 ASM Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "unzsfx32 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /Gz /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /Gz /W3 /GX /O1 /I "../../.." /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "SFX" /D "USE_EF_UT_TIME" /YX /FD /c
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "unzsfx32 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "SFX" /D "USE_EF_UT_TIME" /YX /FD /c
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "unzsfx32 - Win32 ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Release.ASM"
-# PROP Intermediate_Dir "Release.ASM"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /Gz /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /Gz /W3 /GX /O1 /I "../../.." /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "SFX" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "unzsfx32 - Win32 ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Debug.ASM"
-# PROP Intermediate_Dir "Debug.ASM"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /YX /FD /c
-# ADD CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "SFX" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "unzsfx32 - Win32 Release"
-# Name "unzsfx32 - Win32 Debug"
-# Name "unzsfx32 - Win32 ASM Release"
-# Name "unzsfx32 - Win32 ASM Debug"
-# Begin Source File
-
-SOURCE=..\..\..\api.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\crc_i386.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\extract.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\fileio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\globals.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\inflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\match.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\nt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\ubz2err.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\win32\win32i64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\windll\windll.c
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="unzsfx32" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
+\r
+CFG=unzsfx32 - Win32 ASM Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzsfx32.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "unzsfx32.mak" CFG="unzsfx32 - Win32 ASM Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "unzsfx32 - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "unzsfx32 - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "unzsfx32 - Win32 ASM Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "unzsfx32 - Win32 ASM Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "unzsfx32 - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /Gz /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /Gz /W3 /GX /O1 /I "../../.." /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "SFX" /D "USE_EF_UT_TIME" /YX /FD /c\r
+# ADD BASE RSC /l 0x409\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF "$(CFG)" == "unzsfx32 - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "SFX" /D "USE_EF_UT_TIME" /YX /FD /c\r
+# ADD BASE RSC /l 0x409\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF "$(CFG)" == "unzsfx32 - Win32 ASM Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "../Release.ASM"\r
+# PROP Intermediate_Dir "Release.ASM"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /Gz /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /Gz /W3 /GX /O1 /I "../../.." /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "SFX" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c\r
+# ADD BASE RSC /l 0x409\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF "$(CFG)" == "unzsfx32 - Win32 ASM Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "../Debug.ASM"\r
+# PROP Intermediate_Dir "Debug.ASM"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /YX /FD /c\r
+# ADD CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "WINDLL" /D "DLL" /D "UNZIPLIB" /D "SFX" /D "USE_EF_UT_TIME" /D "ASM_CRC" /YX /FD /c\r
+# ADD BASE RSC /l 0x409\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "unzsfx32 - Win32 Release"\r
+# Name "unzsfx32 - Win32 Debug"\r
+# Name "unzsfx32 - Win32 ASM Release"\r
+# Name "unzsfx32 - Win32 ASM Debug"\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\api.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\crc32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\crc_i386.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\crypt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\extract.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\fileio.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\globals.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\inflate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\match.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\nt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\process.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\ubz2err.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\win32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\win32\win32i64.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\..\windll\windll.c\r
+# End Source File\r
+# End Target\r
+# End Project\r
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
-
-###############################################################################
-
-Project: "SFXWiz"=".\sfx\SFXWiz32.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name unzsfx32
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "c_dll_ex"=".\exampl\c_dll_ex.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name unz32dll
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "unz32dll"=".\dll\unz32dll.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "unz32lib"=".\lib\unz32lib.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "unzsfx32"=".\sfx\unzsfx32.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!\r
+\r
+###############################################################################\r
+\r
+Project: "SFXWiz"=".\sfx\SFXWiz32.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+ Begin Project Dependency\r
+ Project_Dep_Name unzsfx32\r
+ End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "c_dll_ex"=".\exampl\c_dll_ex.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+ Begin Project Dependency\r
+ Project_Dep_Name unz32dll\r
+ End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "unz32dll"=".\dll\unz32dll.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "unz32lib"=".\lib\unz32lib.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "unzsfx32"=".\sfx\unzsfx32.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="libbz2"
+ ProjectGUID="{4BF85175-8BBC-4EC6-BAB8-E30976B13E12}"
+ RootNamespace="libbz2"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BZ_NO_STDIO"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\bzip2\blocksort.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\compress.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\crctable.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\decompress.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\huffman.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\randtable.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib_private.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip32_dll", "unzip32_dll\unzip32_dll.vcproj", "{33CDCEDF-2655-4031-892D-93F653277971}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4BF85175-8BBC-4EC6-BAB8-E30976B13E12} = {4BF85175-8BBC-4EC6-BAB8-E30976B13E12}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbz2", "libbz2\libbz2.vcproj", "{4BF85175-8BBC-4EC6-BAB8-E30976B13E12}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uzexampl", "uzexampl\uzexampl.vcproj", "{96160398-33D6-4E55-8855-6E31326F2D96}"
+ ProjectSection(ProjectDependencies) = postProject
+ {33CDCEDF-2655-4031-892D-93F653277971} = {33CDCEDF-2655-4031-892D-93F653277971}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzipstb", "unzipstb\unzipstb.vcproj", "{C50C9F1F-67E7-4CF9-BFF9-CC5893C20C05}"
+ ProjectSection(ProjectDependencies) = postProject
+ {33CDCEDF-2655-4031-892D-93F653277971} = {33CDCEDF-2655-4031-892D-93F653277971}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {33CDCEDF-2655-4031-892D-93F653277971}.Debug|Win32.ActiveCfg = Debug|Win32
+ {33CDCEDF-2655-4031-892D-93F653277971}.Debug|Win32.Build.0 = Debug|Win32
+ {33CDCEDF-2655-4031-892D-93F653277971}.Release|Win32.ActiveCfg = Release|Win32
+ {33CDCEDF-2655-4031-892D-93F653277971}.Release|Win32.Build.0 = Release|Win32
+ {4BF85175-8BBC-4EC6-BAB8-E30976B13E12}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4BF85175-8BBC-4EC6-BAB8-E30976B13E12}.Debug|Win32.Build.0 = Debug|Win32
+ {4BF85175-8BBC-4EC6-BAB8-E30976B13E12}.Release|Win32.ActiveCfg = Release|Win32
+ {4BF85175-8BBC-4EC6-BAB8-E30976B13E12}.Release|Win32.Build.0 = Release|Win32
+ {96160398-33D6-4E55-8855-6E31326F2D96}.Debug|Win32.ActiveCfg = Debug|Win32
+ {96160398-33D6-4E55-8855-6E31326F2D96}.Debug|Win32.Build.0 = Debug|Win32
+ {96160398-33D6-4E55-8855-6E31326F2D96}.Release|Win32.ActiveCfg = Release|Win32
+ {96160398-33D6-4E55-8855-6E31326F2D96}.Release|Win32.Build.0 = Release|Win32
+ {C50C9F1F-67E7-4CF9-BFF9-CC5893C20C05}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C50C9F1F-67E7-4CF9-BFF9-CC5893C20C05}.Debug|Win32.Build.0 = Debug|Win32
+ {C50C9F1F-67E7-4CF9-BFF9-CC5893C20C05}.Release|Win32.ActiveCfg = Release|Win32
+ {C50C9F1F-67E7-4CF9-BFF9-CC5893C20C05}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="unzip32"
+ ProjectGUID="{33CDCEDF-2655-4031-892D-93F653277971}"
+ RootNamespace="unzip32_dll"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..;..\..\..\bzip2"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DLL;WINDLL;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS;$(NOINHERIT)"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\$(ProjectName).dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(SolutionDir)\$(ConfigurationName)""
+ ModuleDefinitionFile="..\..\windll32.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="..\..\..;..\..\..\bzip2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DLL;WINDLL;ASM_CRC;x_BZIP2_SUPPORT;x_CRYPT_AES_WG;LZMA_SUPPORT;PPMD_SUPPORT;x_SYMLINKS;$(NOINHERIT)"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\$(ProjectName).dll"
+ LinkIncremental="1"
+ ModuleDefinitionFile="..\..\windll32.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\wrap\aescrypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aeskey.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\aestab.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\api.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\crc_i386.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\envargs.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\explode.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\extract.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\fileenc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\fileio.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\hmac.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\list.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzFind.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\LzmaDec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\match.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\nt.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\Ppmd8Dec.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\prng.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\process.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\pwd2key.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\wrap\sha1.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ubz2err.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unreduce.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unshrink.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\win32i64.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\windll.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zipinfo.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\aes_wg\aes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\aesopt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\api.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\brg_endian.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\consts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\CpuArch.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crc32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\decs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ebcdic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\fileenc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\hmac.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\inflate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\iz_aes_wg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzFind.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzHash.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzmaDec.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\nt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd8.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\prng.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\pwd2key.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\rsxntwin.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\sha1.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\structs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\SzVersion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\ttyio.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzpriv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzvers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\w32cfg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\windll.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\zip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath="..\..\..\windll\windll.rc"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\windll\windll32.def"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="unzipstb"
+ ProjectGUID="{C50C9F1F-67E7-4CF9-BFF9-CC5893C20C05}"
+ RootNamespace="unzipstb"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;DLL;WINDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="unzip32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(OutDir)"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="..\..\.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;DLL;WINDLL"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="unzip32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(OutDir)"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\unzipstb.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\crypt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzvers.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="uzexampl"
+ ProjectGUID="{96160398-33D6-4E55-8855-6E31326F2D96}"
+ RootNamespace="uzexampl"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(NOINHERIT)"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Version.lib"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="..\..\.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(NOINHERIT)"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Version.lib"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\uzexampl.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\bzip2\bzlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\decs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\aes_wg\fileenc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\globals.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\LzmaDec.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Ppmd8.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\structs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\szip\Types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzpriv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\unzvers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\uzexampl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\win32\w32cfg.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
#define WIN32_LEAN_AND_MEAN
#define UNZIP_INTERNAL
-#include "../unzip.h"
-#include "../crypt.h"
-#include "../unzvers.h"
-#include "../windll/windll.h"
-#include "../windll/structs.h"
-#include "../consts.h"
+
+#include "unzip.h"
+#include "crypt.h"
+#include "unzvers.h"
+#include "windll.h"
+#include "structs.h"
+/* #include "consts.h" */
+
#include <malloc.h>
/* Added type casts to prevent potential "type mismatch" error messages. */
#ifdef REENTRANT
-# undef __G
-# undef __G__
-# define __G (Uz_Globs *)pG
-# define __G__ (Uz_Globs *)pG,
+# undef __G
+# define __G (Uz_Globs *)pG
+# undef __G__
+# define __G__ (Uz_Globs *)pG,
#endif
-HANDLE hwildZipFN;
HANDLE hInst; /* current instance */
HANDLE hDCL;
int fNoPrinting = 0;
#if 0 /* currently unused */
/* For displaying files extracted to the display window */
int DllDisplayPrint(zvoid *pG, uch *buf, ulg size, int flag);
-#endif /* never */
+#endif /* 0 */
/* Callback function for status report and/or user interception */
static int UZ_EXP Wiz_StatReportCB(zvoid *pG, int fnflag, ZCONST char *zfn,
#ifndef UNZIPLIB
/* DLL Entry Point */
-#ifdef __BORLANDC__
-#pragma argsused
-/* Borland seems to want DllEntryPoint instead of DllMain like MSVC */
-#define DllMain DllEntryPoint
-#endif
-#ifdef WIN32
+# ifdef __BORLANDC__
+# pragma argsused
+ /* Borland seems to want DllEntryPoint instead of DllMain like MSVC */
+# define DllMain DllEntryPoint
+# endif /* def __BORLANDC__ */
+# ifdef WIN32
BOOL WINAPI DllMain( HINSTANCE hInstance,
DWORD dwReason,
LPVOID plvReserved)
-#else
+# else /* def WIN32 */
int FAR PASCAL LibMain( HINSTANCE hInstance,
WORD wDataSegment,
WORD wHeapSize,
LPSTR lpszCmdLine )
-#endif
+# endif /* def WIN32 [else] */
{
-#ifndef WIN32
+# ifndef WIN32
/* The startup code for the DLL initializes the local heap(if there is one)
* with a call to LocalInit which locks the data segment.
*/
}
hInst = hInstance;
return 1; /* Indicate that the DLL was initialized successfully. */
-#else
+# else /* ndef WIN32 */
BOOL rc = TRUE;
switch( dwReason )
{
case DLL_PROCESS_ATTACH:
- // DLL is loaded. Do your initialization here.
- // If cannot init, set rc to FALSE.
+ /* DLL is loaded. Do your initialization here. */
+ /* If cannot init, set rc to FALSE. */
hInst = hInstance;
break;
case DLL_PROCESS_DETACH:
- // DLL is unloaded. Do your cleanup here.
+ /* DLL is unloaded. Do your cleanup here. */
break;
default:
break;
}
return rc;
-#endif
+# endif /* ndef WIN32 [else] */
}
-#ifdef __BORLANDC__
-#pragma argsused
-#endif
+# ifdef __BORLANDC__
+# pragma argsused
+# endif
int FAR PASCAL WEP ( int bSystemExit )
{
return 1;
}
-#endif /* !UNZIPLIB */
+#endif /* ndef UNZIPLIB */
static int UnzipAllocMemory(unsigned int i, char *cmd, char *str,
char ***pargVee, unsigned int *pargCee)
lstrcpy(str1, s);
lstrcat(str1, " @");
- str2 = strchr(str1, '\"'); // get first occurance of double quote
+ str2 = strchr(str1, '\"'); /* get first occurance of double quote */
while ((str3 = strchr(str1, '\t')) != NULL)
{
- str3[0] = ' '; // Change tabs into a single space
+ str3[0] = ' '; /* Change tabs into a single space */
}
/* Note that if a quoted string contains multiple adjacent spaces, they
*/
while ((str2 = strchr(str1, '\"')) != NULL)
{
- // Found an opening double quote; get the corresponding closing quote
+ /* Found an opening double quote; get the corresponding closing quote */
str3 = strchr(str2+1, '\"');
if (str3 == NULL)
{
free(str1);
- return PK_PARAM; /* Something is screwy with the
- string, bail out */
+ return PK_PARAM; /* Something is screwy with the
+ string, bail out */
}
- str3[0] = '\0'; // terminate str2 with a NULL
+ str3[0] = '\0'; /* terminate str2 with a NULL. */
size = _msize(*pargVee);
if ((*pargVee = (char **)realloc(*pargVee, size + sizeof(char *)))
fprintf(stdout, "Unable to allocate memory in unzip dll\n");
return PK_MEM;
}
- // argCee is incremented in UnzipAllocMemory
+ /* argCee is incremented in UnzipAllocMemory */
if (UnzipAllocMemory(i, str2+1, "Creating file list from string",
pargVee, pargCee) != PK_OK)
{
return PK_MEM;
}
i++;
- str3+=2; // Point past the whitespace character
- str2[0] = '\0'; // Terminate str1
+ str3+=2; /* Point past the whitespace character */
+ str2[0] = '\0'; /* Terminate str1 */
lstrcat(str1, str3);
- } // end while
+ } /* while quote */
/* points to first occurance of a space */
str2 = strchr(str1, ' ');
if (str1[0] == ' ')
{
str3 = &str1[1];
- lstrcpy(str1, str3); // Dump the leading space
+ lstrcpy(str1, str3); /* Dump the leading space */
}
return FALSE;
uO.qflag = lpDCL->fQuiet; /* Quiet flag */
+
+ /* 2013-03-22 SMS.
+ * 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.
+ */
+#if 0
G.pfnames = (char **)&fnames[0]; /* assign default file name vector */
G.pxnames = (char **)&fnames[1];
-
- uO.jflag = (lpDCL->ndflag == 0);
+#else /* 0 */
+ G.pfnames = NULL; /* Default file name list vector. */
+ G.pxnames = NULL; /* -x exclude_list. */
+#endif /* 0 [else] */
+
+ /* 2012-07-14 SMS.
+ * Not using extended "-j" capability, which needs more than a bit,
+ * but may work as before. Was:
+ * uO.jflag = (lpDCL->ndflag == 0);
+ */
+ uO.jflag = (lpDCL->ndflag == 0) ? -1 : 0;
uO.ddotflag = (lpDCL->ndflag >= 2);
uO.cflag = lpDCL->ncflag;
uO.tflag = lpDCL->ntflag;
if (pExDirRoot == NULL)
return FALSE;
ISO_TO_INTERN(lpDCL->lpszExtractDir, pExDirRoot);
-#else
+#else /* ndef CRTL_CP_IS_ISO */
# define pExDirRoot lpDCL->lpszExtractDir
-#endif
+#endif /* ndef CRTL_CP_IS_ISO [else] */
if (strlen(pExDirRoot) >= FILNAMSIZ)
{
/* The supplied extract root path exceed the filename size limit. */
}
/* G.wildzipfn needs to be initialized so that do_wild does not wind
- up clearing out the zip file name when it returns in process.c
-*/
+ * up clearing out the zip file name when it returns in process.c
+ *
+ * 2013-06-28 SMS.
+ * Removed locally allocated global hwildZipFN, in favor of using only
+ * (per-thread) G.wildzipfn, to solve a reentrancy problem reported
+ * (2011-09-15) by Alexandr Miloslavskiy. Accordingly, uses of
+ * GlobalLock() and GlobalUnlock() have been removed.
+ * (Is the GlobalAlloc() and GlobalFree() stuff used for 16-bit Windows
+ * compatibility?)
+ */
if (strlen(lpDCL->lpszZipFN) >= FILNAMSIZ)
/* length of supplied archive name exceed the system's filename limit */
return FALSE;
- hwildZipFN = GlobalAlloc(GPTR, FILNAMSIZ);
- if (hwildZipFN == (HGLOBAL) NULL)
+ G.wildzipfn = GlobalAlloc(GPTR, FILNAMSIZ);
+ if (G.wildzipfn == NULL)
return FALSE;
- G.wildzipfn = GlobalLock(hwildZipFN);
lstrcpy(G.wildzipfn, lpDCL->lpszZipFN);
_ISO_INTERN(G.wildzipfn);
static void FreeDllMem(__GPRO)
{
if (G.wildzipfn) {
- GlobalUnlock(hwildZipFN);
- G.wildzipfn = NULL;
+ G.wildzipfn = GlobalFree(G.wildzipfn);
}
- if (hwildZipFN)
- hwildZipFN = GlobalFree(hwildZipFN);
#ifndef CRTL_CP_IS_ISO
if (uO.exdir != NULL) {
#ifdef CRTL_CP_IS_ISO
G.pfnames = ifnv;
-#else /* !CRTL_CP_IS_ISO */
+#else /* def CRTL_CP_IS_ISO */
intern_ifv = (char **)malloc((ifnc+1)*sizeof(char **));
if (intern_ifv == (char **)NULL)
{
}
intern_ifv[ifnc] = (char *)NULL;
G.pfnames = intern_ifv;
-#endif /* ?CRTL_CP_IS_ISO */
+#endif /* def CRTL_CP_IS_ISO [else] */
}
if (xfnc > 0) {
free(intern_ifv[0]);
free(intern_ifv);
}
-#endif
+#endif /* ndef CRTL_CP_IS_ISO */
FreeDllMem(__G);
return PK_PARAM;
}
#ifdef CRTL_CP_IS_ISO
G.pxnames = xfnv;
-#else /* !CRTL_CP_IS_ISO */
+#else /* def CRTL_CP_IS_IS */
intern_xfv = (char **)malloc((xfnc+1)*sizeof(char **));
if (intern_xfv == (char **)NULL)
{
}
intern_xfv[xfnc] = (char *)NULL;
G.pxnames = intern_xfv;
-#endif /* ?CRTL_CP_IS_ISO */
+#endif /* def CRTL_CP_IS_IS [else] */
}
/*---------------------------------------------------------------------------
free(intern_ifv[0]);
free(intern_ifv);
}
-#endif
+#endif /* ndef CRTL_CP_IS_ISO */
FreeDllMem(__G);
return PK_BADERR;
}
free(intern_ifv[0]);
free(intern_ifv);
}
-#endif
+#endif /* ndef CRTL_CP_IS_ISO */
FreeDllMem(__G);
return retcode;
}
* Send messages to status window *
**********************************/
#ifdef __BORLANDC__
-#pragma argsused
+# pragma argsused
#endif
static int UZ_EXP DllMessagePrint(pG, buf, size, flag)
zvoid *pG; /* globals struct: always passed */
* Send files to display window *
********************************/
#ifdef __BORLANDC__
-#pragma argsused
+# pragma argsused
#endif
int DllDisplayPrint(pG, buf, size, flag)
zvoid *pG; /* globals struct: always passed */
? G.lpUserFunctions->print((LPSTR)buf, size)
: (int)size);
}
-#endif /* never */
+#endif /* 0 */
/**********************************
* Prompt for decryption password *
**********************************/
#ifdef __BORLANDC__
-#pragma argsused
+# pragma argsused
#endif
int UZ_EXP UzpPassword(pG, rcnt, pwbuf, size, zfn, efn)
zvoid *pG; /* globals struct: always passed */
ZCONST char *zfn; /* name of zip archiv */
ZCONST char *efn; /* name of archiv entry being processed */
{
-#if CRYPT
+#ifdef IZ_CRYPT_ANY
LPCSTR m;
if (*rcnt == 0) {
}
return (*G.lpUserFunctions->password)((LPSTR)pwbuf, size, m, (LPCSTR)efn);
-#else /* !CRYPT */
+#else /* def IZ_CRYPT_ANY */
return IZ_PW_ERROR; /* internal error, function should never get called */
-#endif /* ?CRYPT */
+#endif /* def IZ_CRYPT_ANY [else] */
} /* end function UzpPassword() */
/* Turn off all messages to the calling application */
/* Interface between WINDLL specific service callback functions and the
generic DLL's "status report & user interception" callback */
#ifdef __BORLANDC__
-#pragma argsused
+# pragma argsused
#endif
static int WINAPI Wiz_StatReportCB(zvoid *pG, int fnflag, ZCONST char *zfn,
ZCONST char *efn, ZCONST zvoid *details)
#ifndef SFX
-#ifndef __16BIT__
+# ifndef __16BIT__
int WINAPI Wiz_UnzipToMemory(LPSTR zip, LPSTR file,
LPUSERFUNCTIONS lpUserFunctions, UzpBuffer *retstr)
{
int r;
-#ifndef CRTL_CP_IS_ISO
+# ifndef CRTL_CP_IS_ISO
char *intern_zip, *intern_file;
-#endif
+# endif
CONSTRUCTGLOBALS();
-#ifndef CRTL_CP_IS_ISO
+# ifndef CRTL_CP_IS_ISO
intern_zip = (char *)malloc(strlen(zip)+1);
if (intern_zip == NULL) {
DESTROYGLOBALS();
ISO_TO_INTERN(file, intern_file);
# define zip intern_zip
# define file intern_file
-#endif
+# endif /* ndef CRTL_CP_IS_ISO */
if (!Wiz_Init((zvoid *)&G, lpUserFunctions)) {
DESTROYGLOBALS();
return PK_BADERR;
r = (unzipToMemory(__G__ zip, file, retstr) == PK_COOL);
DESTROYGLOBALS();
-#ifndef CRTL_CP_IS_ISO
-# undef file
-# undef zip
+# ifndef CRTL_CP_IS_ISO
+# undef file
+# undef zip
free(intern_file);
free(intern_zip);
-#endif
+# endif /* ndef CRTL_CP_IS_ISO */
if (!r && retstr->strlength) {
free(retstr->strptr);
retstr->strptr = NULL;
Wiz_NoPrinting(FALSE); /* Turn printing back on */
return retcode;
}
-#endif /* !__16BIT__ */
+# endif /* ndef __16BIT__ */
int WINAPI Wiz_Validate(LPSTR archive, int AllCodes)
{
return UzpValidate((char *)archive, AllCodes);
}
-
-#endif /* !SFX */
+#endif /* ndef SFX */
VALUE "FileDescription", "Info-ZIP's UnZip DLL for Win32\0"
VALUE "FileVersion", UZ_VER_STRING "\0"
VALUE "InternalName", "UnZip32\0"
- VALUE "LegalCopyright", "Info-ZIP 1996-2009\0"
+ VALUE "LegalCopyright", "Info-ZIP 1996-2014\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "UNZIP32.DLL\0"
VALUE "PrivateBuild", "\0"
Wiz_UnzipToMemory
Wiz_Grep
UzpFreeMemBuffer
-
+ UzpMainI
+ UzpFeatures
--- /dev/null
+ Contents of the UnZip 6.10 Source Archive "wrap" Directory
+ ----------------------------------------------------------
+
+aescrypt.c Wrapper for "aes_wg/aescrypt.c"
+aeskey.c Wrapper for "aes_wg/aeskey.c"
+aestab.c Wrapper for "aes_wg/aestab.c"
+Contents This file
+crc_i386.c Wrapper for "win32/crc_i386.c"
+fileenc.c Wrapper for "aes_wg/fileenc.c"
+hmac.c Wrapper for "aes_wg/hmac.c"
+LzFind.c Wrapper for "szip/LzFind.c"
+LzmaDec.c Wrapper for "szip/LzmaDec.c"
+LzmaEnc.c Wrapper for "szip/LzmaEnc.c"
+Ppmd8.c Wrapper for "szip/Ppmd8.c"
+Ppmd8Dec.c Wrapper for "szip/Ppmd8Dec.c"
+Ppmd8Enc.c Wrapper for "szip/Ppmd8Enc.c"
+prng.c Wrapper for "aes_wg/prng.c"
+pwd2key.c Wrapper for "aes_wg/pwd2key.c"
+sha1.c Wrapper for "aes_wg/sha1.c"
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "szip/LzFind.c".
+ */
+
+#ifdef LZMA_SUPPORT
+# include "../szip/LzFind.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "szip/LzmaDec.c".
+ */
+
+#ifdef LZMA_SUPPORT
+# include "../szip/LzmaDec.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "szip/LzmaEnc.c".
+ */
+
+#ifdef LZMA_SUPPORT
+# include "../szip/LzmaEnc.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "szip/Ppmd8.c".
+ */
+
+#ifdef PPMD_SUPPORT
+# include "../szip/Ppmd8.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "szip/Ppmd8Dec.c".
+ */
+
+#ifdef PPMD_SUPPORT
+# include "../szip/Ppmd8Dec.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "szip/Ppmd8Enc.c".
+ */
+
+#ifdef PPMD_SUPPORT
+# include "../szip/Ppmd8Enc.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "aes_wg/aescrypt.c".
+ */
+
+#ifdef CRYPT_AES_WG
+# include "../aes_wg/aescrypt.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "aes_wg/aeskey.c".
+ */
+
+#ifdef CRYPT_AES_WG
+# include "../aes_wg/aeskey.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "aes_wg/aestab.c".
+ */
+
+#ifdef CRYPT_AES_WG
+# include "../aes_wg/aestab.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "crc_i386.c".
+ */
+
+#ifdef ASM_CRC
+# include "../win32/crc_i386.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "aes_wg/fileenc.c".
+ */
+
+#ifdef CRYPT_AES_WG
+# include "../aes_wg/fileenc.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "aes_wg/hmac.c".
+ */
+
+#ifdef CRYPT_AES_WG
+# include "../aes_wg/hmac.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "aes_wg/prng.c".
+ */
+
+#ifdef CRYPT_AES_WG
+# include "../aes_wg/prng.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "aes_wg/pwd2key.c".
+ */
+
+#ifdef CRYPT_AES_WG
+# include "../aes_wg/pwd2key.c"
+#endif
--- /dev/null
+/*
+ Copyright (c) 2013 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+
+/*
+ * Wrapper for "aes_wg/sha1.c".
+ */
+
+#ifdef CRYPT_AES_WG
+# include "../aes_wg/sha1.c"
+#endif
/*
- Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
+ Copyright (c) 1990-2014 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.
Contains: zi_opts()
zi_end_central()
- zipinfo()
+ zipinform()
zi_long()
zi_short()
zi_time()
/* Strings used in zipinfo.c (ZipInfo half) */
/**********************************************/
+static ZCONST char indentStr[] = " ";
static ZCONST char nullStr[] = "";
-static ZCONST char PlurSufx[] = "s";
+static ZCONST char plurSufx[] = "s";
+/* ZipInfHeader1[] is actually LogInitline[], which is put out in
+ * process.c:do_seekable().
+ */
static ZCONST char Far ZipInfHeader2[] =
- "Zip file size: %s bytes, number of entries: %s\n";
+ "Archive size: %s bytes; Members: %s\n";
static ZCONST char Far EndCentDirRec[] = "\nEnd-of-central-directory record:\n";
static ZCONST char Far LineSeparators[] = "-------------------------------\n\n";
static ZCONST char Far ZipFSizeVerbose[] = "\
static ZCONST char Far MultiPartArchive3[] = "\
%s of the archive entries %s contained within this zipfile volume,\n\
out of a total of %s %s.\n\n";
+static ZCONST char Far NoMemArguments[] =
+ "envargs: cannot get memory for arguments";
static ZCONST char Far CentralDirEntry[] =
"\nCentral directory entry #%lu:\n---------------------------\n\n";
+#if 0
static ZCONST char Far ZipfileStats[] =
"%lu file%s, %s bytes uncompressed, %s bytes compressed: %s%d.%d%%\n";
-
+#endif /* 0 */
+static ZCONST char Far ZipfileStats2a[] =
+ "Members: %lu; Bytes uncompressed: %s, compressed: %s, %s%d.%d%%\n";
+#ifdef SYMLINKS
+static ZCONST char Far ZipfileStats2b[] =
+ "Directories: %lu, Files: %lu, Links: %lu\n";
+#else /* def SYMLINKS */
+static ZCONST char Far ZipfileStats2b[] =
+ "Directories: %lu, Files/links: %lu\n";
+#endif /* def SYMLINKS [else] */
/* zi_long() strings */
static ZCONST char Far OS_FAT[] = "MS-DOS, OS/2 or NT FAT";
static ZCONST char Far OS_Amiga[] = "Amiga";
static ZCONST char Far OS_BeOS[] = "BeOS";
static ZCONST char Far OS_Tandem[] = "Tandem NSK";
static ZCONST char Far OS_Theos[] = "Theos";
-static ZCONST char Far OS_MacDarwin[] = "Mac OS/X (Darwin)";
+static ZCONST char Far OS_MacDarwin[] = "Mac OS X (Darwin)";
#ifdef OLD_THEOS_EXTRA
static ZCONST char Far OS_TheosOld[] = "Theos (Old)";
#endif /* OLD_THEOS_EXTRA */
static ZCONST char Far MthdLZMA[] = "LZMA-ed";
static ZCONST char Far MthdTerse[] = "tersed (IBM)";
static ZCONST char Far MthdLZ77[] = "LZ77-compressed (IBM)";
+static ZCONST char Far MthdJPEG[] = "JPEG-ed";
static ZCONST char Far MthdWavPack[] = "WavPacked";
static ZCONST char Far MthdPPMd[] = "PPMd-ed";
+static ZCONST char Far MthdAES_WG[] = "AES_WG-ed";
static ZCONST char Far DeflNorm[] = "normal";
static ZCONST char Far DeflMax[] = "maximum";
" number of Shannon-Fano trees (implosion): %c\n";
static ZCONST char Far CompressSubtype[] =
" compression sub-type (deflation): %s\n";
+static ZCONST char Far GenPurpBitFlags[] =
+ " general-purpose bit flags: %04x\n";
static ZCONST char Far FileSecurity[] =
- " file security status: %sencrypted\n";
+ " file security status: %sencrypted%s\n";
static ZCONST char Far ExtendedLocalHdr[] =
- " extended local header: %s\n";
+ " extended local header: %s\n";
static ZCONST char Far FileModDate[] =
" file last modified on (DOS date/time): %s\n";
#ifdef USE_EF_UT_TIME
static ZCONST char Far FileDiskNum[] =
" disk number on which file begins: disk %lu\n";
static ZCONST char Far ApparentFileType[] =
- " apparent file type: %s\n";
+ " %sapparent file type (%02x hex): %s%s\n";
static ZCONST char Far VMSFileAttributes[] =
- " VMS file attributes (%06o octal): %s\n";
+ " %sVMS file attributes (%06o octal): %s\n";
static ZCONST char Far AmigaFileAttributes[] =
- " Amiga file attributes (%06o octal): %s\n";
+ " %sAmiga file attributes (%06o octal): %s\n";
static ZCONST char Far UnixFileAttributes[] =
- " Unix file attributes (%06o octal): %s\n";
+ " %sUnix file attributes (%06o octal): %s\n";
static ZCONST char Far NonMSDOSFileAttributes[] =
- " non-MSDOS external file attributes: %06lX hex\n";
+ " %snon-MSDOS external file attributes: %06X hex\n";
static ZCONST char Far MSDOSFileAttributes[] =
- " MS-DOS file attributes (%02X hex): none\n";
+ " %sMS-DOS file attributes (%02X hex): none\n";
static ZCONST char Far MSDOSFileAttributesRO[] =
- " MS-DOS file attributes (%02X hex): read-only\n";
+ " %sMS-DOS file attributes (%02X hex): read-only\n";
static ZCONST char Far MSDOSFileAttributesAlpha[] =
- " MS-DOS file attributes (%02X hex): %s%s%s%s%s%s%s%s\n";
+ " %sMS-DOS file attributes (%02X hex): %s%s%s%s%s%s%s%s\n";
static ZCONST char Far TheosFileAttributes[] =
- " Theos file attributes (%04X hex): %s\n";
+ " %sTheos file attributes (%04X hex): %s\n";
static ZCONST char Far TheosFTypLib[] = "Library ";
static ZCONST char Far TheosFTypDir[] = "Directory ";
static ZCONST char Far TheosFTypUkn[] = "??? ";
static ZCONST char Far ExtraFieldTrunc[] = "\n\
- error: EF data block (type 0x%04x) size %u exceeds remaining extra field\n\
- space %u; block length has been truncated.\n";
+ error: EF data block (type 0x%04x) size %ld exceeds remaining extra field\n\
+ space %ld; block length has been truncated.\n";
static ZCONST char Far ExtraFields[] = "\n\
The central-directory extra field contains:";
static ZCONST char Far ExtraFieldType[] = "\n\
- - A subfield with ID 0x%04x (%s) and %u data bytes";
+ - A subfield with ID 0x%04x (%s) and %ld data bytes";
static ZCONST char Far efPKSZ64[] = "PKWARE 64-bit sizes";
static ZCONST char Far efAV[] = "PKWARE AV";
static ZCONST char Far efOS2[] = "OS/2";
static ZCONST char Far efIZUnix2[] = "Unix UID/GID (16-bit)";
static ZCONST char Far efIZUnix3[] = "Unix UID/GID (any size)";
static ZCONST char Far efTime[] = "universal time";
-static ZCONST char Far efU8Path[] = "UTF8 path name";
-static ZCONST char Far efU8Commnt[] = "UTF8 entry comment";
+static ZCONST char Far efU8Path[] = "UTF-8 path name";
+static ZCONST char Far efU8Commnt[] = "UTF-8 entry comment";
static ZCONST char Far efJLMac[] = "old Info-ZIP Macintosh";
static ZCONST char Far efMac3[] = "new Info-ZIP Macintosh";
static ZCONST char Far efZipIt[] = "ZipIt Macintosh";
static ZCONST char Far efASiUnix[] = "ASi Unix";
static ZCONST char Far efTandem[] = "Tandem NSK";
static ZCONST char Far efTheos[] = "Theos";
+static ZCONST char Far efAES[] = "AES_WG encrypt";
+static ZCONST char Far efJavaCAFE[] = "Java CAFE";
+static ZCONST char Far efLHdrExtn[] = "Local Hdr Ext'n";
static ZCONST char Far efUnknown[] = "unknown";
static ZCONST char Far OS2EAs[] = ".\n\
static ZCONST char Far UTaccess[] = "access";
static ZCONST char Far UTcreation[] = "creation";
static ZCONST char Far U8PthCmnComplete[] = ".\n\
- The UTF8 data of the extra field (V%u, ASCII name CRC `%.8lx') are:\n ";
+ The UTF-8 data of the extra field (V%u, ASCII name CRC `%.8lx') are:\n ";
static ZCONST char Far U8PthCmnF24[] = ". The first\n\
- 24 UTF8 bytes in the extra field (V%u, ASCII name CRC `%.8lx') are:\n ";
+ 24 UTF-8 bytes in the extra field (V%u, ASCII name CRC `%.8lx') are:\n ";
static ZCONST char Far ZipItFname[] = ".\n\
The Mac long filename is %s";
static ZCONST char Far Mac3data[] = ".\n\
static ZCONST char Far First20[] = ". The first\n 20 are: ";
static ZCONST char Far ColonIndent[] = ":\n ";
static ZCONST char Far efFormat[] = " %02x";
+static ZCONST char Far efLHdrExtnBitMap[] = " Bit map:";
+static ZCONST char Far efLHdrExtnBitMapByte[] = " %02x";
+static ZCONST char Far efLHdrExtnBitMapEol[] = "\n";
+
+static ZCONST char Far AesExtraField[] = ".\n\
+ Vers: %s, Vend ID: %c%c, Mode: %s, Cmpr mthd: %s";
static ZCONST char Far lExtraFieldType[] = "\n\
There %s a local extra field with ID 0x%04x (%s) and\n\
static ZCONST char Far lngYMDHMSTimeError[] = "???? ??? ?? ??:??:??";
#endif
+static ZCONST char Far *method[NUM_METHODS] = {
+ MthdNone, MthdShrunk, MthdRedF1, MthdRedF2, MthdRedF3, MthdRedF4,
+ MthdImplode, MthdToken, MthdDeflate, MthdDeflat64, MthdDCLImplode,
+ MthdBZip2, MthdLZMA, MthdTerse, MthdLZ77, MthdJPEG, MthdWavPack,
+ MthdPPMd, MthdAES_WG
+};
+
+
+#ifndef WINDLL_OLD
+/* 2012-12-12 SMS.
+ * Free some storage, if it was allocated, and we care.
+ * (Use before a fatal error exit.)
+ */
+# ifdef REENTRANT
+# define FREE_NON_NULL( x) if ((x) != NULL) izu_free( x)
+# define UPDATE_PARGV *pargv = args
+# else
+# define FREE_NON_NULL( x)
+# define UPDATE_PARGV
+# endif
-#ifndef WINDLL
/************************/
/* Function zi_opts() */
char ***pargv;
__GDEF
{
- char **argv, *s;
- int argc, c, error=FALSE, negative=0;
+ int argc;
+ int error = FALSE;
+ int non_opt_argc;
+
+ /* Variant option processing.
+ * "2slmv" suffixes refer to "-2", "-s", "-m", -l", and/or "-v".
+ */
int hflag_slmv=TRUE, hflag_2=FALSE; /* diff options => diff defaults */
int tflag_slm=TRUE, tflag_2v=FALSE;
int explicit_h=FALSE, explicit_t=FALSE;
+ char **args;
+
+
+ /* used by get_option */
+ unsigned long option; /* option ID returned by get_option */
+ int argcnt = 0; /* current argcnt in args */
+ int argnum = 0; /* arg number */
+ int optchar = 0; /* option state */
+ char *value = NULL; /* non-option arg, option value or NULL */
+ int negative = 0; /* 1 = option negated */
+ int fna = 0; /* current first non-opt arg */
+ int optnum = 0; /* index in table */
+ int showhelp = 0; /* for --commandline */
+
+ /* since get_option() returns xfiles and files one at a time, store them in
+ linked lists until have them all */
+
+ int file_count;
+ struct file_list *next_file;
+
+ /* files to extract */
+ int in_files_count = 0;
+ struct file_list *in_files = NULL;
+ struct file_list *next_in_files = NULL;
+
+ /* files to exclude in -x list */
+ int in_xfiles_count = 0;
+ struct file_list *in_xfiles = NULL;
+ struct file_list *next_in_xfiles = NULL;
+
+ G.wildzipfn = NULL;
+
+ /* make copy of args that can use with insert_arg() used by get_option() */
+ args = copy_args( __G__ *pargv, 0);
+
+ /* 2013-01-17 SMS.
+ * Note that before any early exit, we must inform the caller of our
+ * new argv[], because he will want to izu_free() ours, not the
+ * original:
+ * UPDATE_PARGV; (*pargv = args;)
+ * return PK_xxx;
+ * In principle, this could be done here, and by anyone who changes
+ * "args", but that looked like more work.
+ */
+
+ /* Initialize lists */
+ G.filespecs = 0;
+ G.xfilespecs = 0;
#ifdef MACOS
uO.lflag = LFLAG; /* reset default on each call */
#endif
G.extract_flag = FALSE; /* zipinfo does not extract to disk */
- argc = *pargc;
- argv = *pargv;
- while (--argc > 0 && (*++argv)[0] == '-') {
- s = argv[0] + 1;
- while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */
- switch (c) {
- case '-':
- ++negative;
- break;
+ /*
+ -------------------------------------------
+ Process command line using get_option
+ -------------------------------------------
+
+ Each call to get_option() returns either a command
+ line option and possible value or a non-option argument.
+ Arguments are permuted so that all options (-r, -b temp)
+ are returned before non-option arguments (zipfile).
+ Returns 0 when nothing left to read.
+ */
+
+ /* set argnum = 0 on first call to init get_option */
+ argnum = 0;
+
+ /* get_option returns the option ID and updates parameters:
+ args - usually same as argv if no argument file support
+ argcnt - current argc for args
+ value - char* to value (free() when done with it) or NULL if no value
+ negated - option was negated with trailing -
+ */
+
+ /* 2012-12-12 SMS.
+ * get_option() may allocate storage for "value". If exiting early
+ * (typically because of an error condition), then use
+ * "FREE_NON_NULL( value)" to free this storage. (See comments
+ * above, where FREE_NON_NULL() is defined.) If saving "value"
+ * in some persistent location, then set "value = NULL" to prevent
+ * this storage from being free()'d. Otherwise, at the bottom of
+ * the "while" loop, this storage will be free()'d.
+ */
+
+ while ((option = get_option( __G__ ZIO, &args, &argcnt, &argnum,
+ &optchar, &value, &negative,
+ &fna, &optnum, 0)))
+ {
+ if(option == o_BAD_ERR) {
+ FREE_NON_NULL( value); /* Leaving early. Free it. */
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return(PK_PARAM);
+ }
+
+ switch (option)
+ {
case '1': /* shortest listing: JUST filenames */
if (negative)
- uO.lflag = -2, negative = 0;
+ uO.lflag = -2;
else
uO.lflag = 1;
break;
case '2': /* just filenames, plus headers if specified */
if (negative)
- uO.lflag = -2, negative = 0;
+ uO.lflag = -2;
else
uO.lflag = 2;
break;
#ifndef CMS_MVS
case ('C'): /* -C: match filenames case-insensitively */
if (negative)
- uO.C_flag = FALSE, negative = 0;
+ uO.C_flag = FALSE;
else
uO.C_flag = TRUE;
break;
#endif /* !CMS_MVS */
case 'h': /* header line */
if (negative)
- hflag_2 = hflag_slmv = FALSE, negative = 0;
+ hflag_2 = hflag_slmv = FALSE;
else {
hflag_2 = hflag_slmv = explicit_h = TRUE;
if (uO.lflag == -1)
uO.lflag = 0;
}
break;
+#if defined( UNICODE_SUPPORT) && defined( ICONV_MAPPING)
+# ifdef UNIX
+ case ('I'): /* -I: map ISO name to internal */
+ strncpy( G.iso_cp, value, sizeof( G.iso_cp));
+ break;
+# endif /* def UNIX */
+#endif /* defined( UNICODE_SUPPORT) && defined( ICONV_MAPPING) */
case 'l': /* longer form of "ls -l" type listing */
if (negative)
- uO.lflag = -2, negative = 0;
+ uO.lflag = -2;
else
uO.lflag = 5;
break;
case 'm': /* medium form of "ls -l" type listing */
if (negative)
- uO.lflag = -2, negative = 0;
+ uO.lflag = -2;
else
uO.lflag = 4;
break;
+ case (o_mc): /* show separate dir/file/link member counts */
+ if (negative)
+ uO.member_counts = -1;
+ else
+ uO.member_counts = 1;
+ break;
#ifdef MORE
case 'M': /* send output through built-in "more" */
if (negative)
- G.M_flag = FALSE, negative = 0;
+ G.M_flag = FALSE;
else
G.M_flag = TRUE;
break;
#endif
+# if defined( UNICODE_SUPPORT) && defined( ICONV_MAPPING)
+# ifdef UNIX
+ case ('O'): /* -O: map OEM name to internal */
+ strncpy( G.oem_cp, value, sizeof( G.oem_cp));
+ break;
+# endif /* def UNIX */
+#endif /* defined( UNICODE_SUPPORT) && defined( ICONV_MAPPING) */
case 's': /* default: shorter "ls -l" type listing */
if (negative)
- uO.lflag = -2, negative = 0;
+ uO.lflag = -2;
else
uO.lflag = 3;
break;
+#ifndef SFX
+ case (o_sc): /* show processed command line and exit */
+ *pargc = -1;
+ showhelp = -3;
+ break;
+#endif
case 't': /* totals line */
if (negative)
- tflag_2v = tflag_slm = FALSE, negative = 0;
+ tflag_2v = tflag_slm = FALSE;
else {
tflag_2v = tflag_slm = explicit_t = TRUE;
if (uO.lflag == -1)
break;
case ('T'): /* use (sortable) decimal time format */
if (negative)
- uO.T_flag = FALSE, negative = 0;
+ uO.T_flag = FALSE;
else
uO.T_flag = TRUE;
break;
#ifdef UNICODE_SUPPORT
case ('U'): /* escape UTF-8, or disable UTF-8 support */
- if (negative) {
- uO.U_flag = MAX(uO.U_flag-negative,0);
- negative = 0;
- } else
+ if (negative)
+ uO.U_flag = IZ_MAX(uO.U_flag - 1, 0);
+ else
uO.U_flag++;
break;
#endif /* UNICODE_SUPPORT */
case 'v': /* turbo-verbose listing */
if (negative)
- uO.lflag = -2, negative = 0;
+ uO.lflag = -2;
else
uO.lflag = 10;
break;
#ifdef WILD_STOP_AT_DIR
case ('W'): /* Wildcard interpretation (stop at '/'?) */
if (negative)
- uO.W_flag = FALSE, negative = 0;
+ uO.W_flag = FALSE;
else
uO.W_flag = TRUE;
break;
#endif /* WILD_STOP_AT_DIR */
+ case ('x'): /* Exclude. Add -x file to linked list. */
+ if (in_xfiles_count == 0) {
+ /* first entry */
+ if ((in_xfiles = (struct file_list *) izu_malloc(
+ sizeof(struct file_list))) == NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(NoMemArguments)));
+ /* Leaving early. Free it. */
+ FREE_NON_NULL( value);
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ in_xfiles->name = value;
+ in_xfiles->next = NULL;
+ next_in_xfiles = in_xfiles;
+ } else {
+ /* add next entry */
+ if ((next_file = (struct file_list *) izu_malloc(
+ sizeof(struct file_list))) == NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(NoMemArguments)));
+ /* Leaving early. Free it. */
+ FREE_NON_NULL( value);
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ next_in_xfiles->next = next_file;
+ next_file->name = value;
+ next_file->next = NULL;
+ next_in_xfiles = next_file;
+ }
+ in_xfiles_count++;
+ value = NULL; /* In use. Don't free it. */
case 'z': /* print zipfile comment */
if (negative)
- uO.zflag = negative = 0;
+ uO.zflag = 0;
else
uO.zflag = 1;
break;
case 'Z': /* ZipInfo mode: ignore */
break;
+ case o_NON_OPTION_ARG:
+ /* not an option */
+ /* no more options as permuting */
+
+
+ if (G.wildzipfn == NULL) {
+ /* first non-option argument is zip file */
+ G.wildzipfn = value;
+
+ } else {
+ /* add include file to list */
+ if (in_files_count == 0) {
+ /* first entry */
+ if ((next_file = (struct file_list *) izu_malloc(
+ sizeof(struct file_list))) == NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(NoMemArguments)));
+ /* Leaving early. Free it. */
+ FREE_NON_NULL( value);
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ next_file->name = value;
+ next_file->next = NULL;
+ in_files = next_file;
+ next_in_files = next_file;
+ } else {
+ /* add next entry */
+ if ((next_file = (struct file_list *) izu_malloc(
+ sizeof(struct file_list))) == NULL) {
+ Info(slide, 0x401, ((char *)slide,
+ LoadFarString(NoMemArguments)));
+ /* Leaving early. Free it. */
+ FREE_NON_NULL( value);
+ UPDATE_PARGV; /* See note 2013-01-17 SMS. */
+ return PK_MEM;
+ }
+ next_in_files->next = next_file;
+ next_file->name = value;
+ next_file->next = NULL;
+ next_in_files = next_file;
+ }
+ in_files_count++;
+ }
+ value = NULL; /* In use. Don't free it. */
+ break;
default:
error = TRUE;
break;
- }
- }
+ } /* switch */
+
+ FREE_NON_NULL( value); /* Free it now, if it's not in use. */
+
+ } /* get_option() */
+
+ if (showhelp == -3) {
+ show_commandline( args);
+ return PK_OK;
+ }
+
+ /* convert files and xfiles lists to arrays */
+
+ /* convert files list to array */
+ if (in_files_count) {
+ if ((G.pfnames = (char **) izu_malloc(
+ (in_files_count + 1) * sizeof(char *))) == NULL) {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArguments)));
+ return PK_MEM;
+ }
+ file_count = 0;
+ for (next_file = in_files; next_file;) {
+ G.pfnames[file_count] = next_file->name;
+ in_files = next_file;
+ next_file = next_file->next;
+ izu_free(in_files);
+ file_count++;
+ }
+ G.pfnames[file_count] = NULL;
+ G.filespecs = in_files_count;
+ }
+
+ /* convert xfiles list to array */
+ if (in_xfiles_count) {
+ if ((G.pxnames = (char **) izu_malloc(
+ (in_xfiles_count + 1) * sizeof(char *))) == NULL) {
+ Info(slide, 0x401, ((char *)slide, LoadFarString(NoMemArguments)));
+ return PK_MEM;
+ }
+ file_count = 0;
+ for (next_file = in_xfiles; next_file;) {
+ G.pxnames[file_count] = next_file->name;
+ in_xfiles = next_file;
+ next_file = next_file->next;
+ izu_free(in_xfiles);
+ file_count++;
+ }
+ G.pxnames[file_count] = NULL;
+ G.xfilespecs = in_xfiles_count;
}
- if ((argc-- == 0) || error) {
+
+ /* For speed, set process_all_files flag if no include or exclude list. */
+ G.process_all_files = (in_files_count == 0) && (in_xfiles_count == 0);
+
+ /* get_option() could have changed the arg count, so re-evaluate it. */
+ argc = arg_count(__G__ args);
+
+ if ((G.wildzipfn == NULL) || error) {
+ argc = -1; /* tell the caller to stop processing */
*pargc = argc;
- *pargv = argv;
+ *pargv = args;
return USAGE(error);
}
+ non_opt_argc = in_files_count+ in_xfiles_count;
+
#ifdef MORE
if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func useless */
G.M_flag = 0;
/* if no listing options given (or all negated), or if only -h/-t given
* with individual files specified, use default listing format */
- if ((uO.lflag < 0) || ((argc > 0) && (uO.lflag == 0)))
+ if ((uO.lflag < 0) || ((non_opt_argc > 0) && (uO.lflag == 0)))
uO.lflag = LFLAG;
/* set header and totals flags to default or specified values */
case 3:
case 4:
case 5:
- uO.hflag = ((argc > 0) && !explicit_h)? FALSE : hflag_slmv;
- uO.tflag = ((argc > 0) && !explicit_t)? FALSE : tflag_slm;
+ uO.hflag = ((non_opt_argc > 0) && !explicit_h)? FALSE : hflag_slmv;
+ uO.tflag = ((non_opt_argc > 0) && !explicit_t)? FALSE : tflag_slm;
break;
case 10:
uO.hflag = hflag_slmv;
break;
}
- *pargc = argc;
- *pargv = argv;
+ *pargc = argc- 1;
+ *pargv = args;
return 0;
} /* end function zi_opts() */
-#endif /* !WINDLL */
+#endif /* ndef WINDLL_OLD */
-/************************/
-/* Function zipinfo() */
-/************************/
+/**************************/
+/* Function zipinform() */
+/**************************/
-int zipinfo(__G) /* return PK-type error code */
+int zipinform(__G) /* return PK-type error code */
__GDEF
{
int do_this_file=FALSE, error, error_in_archive=PK_COOL;
int *fn_matched=NULL, *xn_matched=NULL;
- ulg j, members=0L;
+ ulg j;
+ ulg members = 0L;
+ ulg members_dir = 0L;
+#ifdef SYMLINKS
+ ulg members_link = 0L;
+#else /* def SYMLINKS */
+# define members_link 0L
+#endif /* def SYMLINKS [else] */
zusz_t tot_csize=0L, tot_ucsize=0L;
zusz_t endprev; /* buffers end of previous entry for zi_long()'s check
* of extra bytes */
---------------------------------------------------------------------------*/
if (G.filespecs > 0 &&
- (fn_matched=(int *)malloc(G.filespecs*sizeof(int))) != NULL)
+ (fn_matched=(int *)izu_malloc(G.filespecs*sizeof(int))) != NULL)
for (j = 0; j < G.filespecs; ++j)
fn_matched[j] = FALSE;
if (G.xfilespecs > 0 &&
- (xn_matched=(int *)malloc(G.xfilespecs*sizeof(int))) != NULL)
+ (xn_matched=(int *)izu_malloc(G.xfilespecs*sizeof(int))) != NULL)
for (j = 0; j < G.xfilespecs; ++j)
xn_matched[j] = FALSE;
EXTRA_FIELD)) != 0)
{
if (G.extra_field != NULL) {
- free(G.extra_field);
+ izu_free(G.extra_field);
G.extra_field = NULL;
}
error_in_archive = error;
tot_ucsize += G.crec.ucsize;
if (G.crec.general_purpose_bit_flag & 1)
tot_csize -= 12; /* don't count encryption header */
- ++members;
+
+ /* Count (all) members. */
+ members++;
+
+ /* Count directory members. */
+ if (G.filename[ strlen( G.filename)- 1] == '/')
+ members_dir++;
+
+#ifdef SYMLINKS
+ /* Count link members. */
+ if (S_ISLNK( (unsigned)(G.crec.external_file_attributes >>16)))
+ members_link++;
+#endif /* def SYMLINKS */
#ifdef DLL
if ((G.statreportcb != NULL) &&
sgn = "-";
cfactor = -cfactor;
}
+#if 0
Info(slide, 0, ((char *)slide, LoadFarString(ZipfileStats),
- members, (members==1L)? nullStr:PlurSufx,
+ members, (members==1L) ? nullStr : plurSufx,
FmZofft(tot_ucsize, NULL, "u"),
FmZofft(tot_csize, NULL, "u"),
sgn, cfactor/10, cfactor%10));
+#endif /* 0 */
+
+ Info(slide, 0, ((char *)slide, LoadFarString( ZipfileStats2a),
+ members,
+ FmZofft( tot_ucsize, NULL, "u"),
+ FmZofft( tot_csize, NULL, "u"),
+ sgn, cfactor/10, cfactor%10));
+
+ if (uO.member_counts >= 0)
+ {
+#ifdef SYMLINKS
+ Info(slide, 0, ((char *)slide, LoadFarString( ZipfileStats2b),
+ members_dir,
+ (members- members_dir- members_link)
+ , members_link));
+#else /* def SYMLINKS */
+ Info(slide, 0, ((char *)slide, LoadFarString( ZipfileStats2b),
+ members_dir,
+ (members- members_dir- members_link)));
+#endif /* def SYMLINKS [else] */
+ }
}
/*---------------------------------------------------------------------------
if (!fn_matched[j])
Info(slide, 0x401, ((char *)slide,
LoadFarString(FilenameNotMatched), G.pfnames[j]));
- free((zvoid *)fn_matched);
+ izu_free((zvoid *)fn_matched);
}
if (xn_matched) {
if (error_in_archive <= PK_WARN)
if (!xn_matched[j])
Info(slide, 0x401, ((char *)slide,
LoadFarString(ExclFilenameNotMatched), G.pxnames[j]));
- free((zvoid *)xn_matched);
+ izu_free((zvoid *)xn_matched);
}
return error_in_archive;
-} /* end function zipinfo() */
+} /* end function zipinform() */
+
+
+
+
+/*****************/
+/* cmpr_mthd() */
+/*****************/
+
+static ZCONST char *cmpr_mthd( methid)
+ unsigned methid;
+{
+ static char mthd[ 16];
+ ZCONST char *ret;
+ unsigned methnum;
+
+ methnum = find_compr_idx( methid);
+ if (methnum >= NUM_METHODS)
+ {
+ sprintf( (char *)(ret = mthd), LoadFarString( UnknownNo), methid);
+ }
+ else
+ {
+ ret = method[ methnum];
+ }
+ return ret;
+}
+
+
+static ZCONST char Far *os[NUM_HOSTS] = {
+ OS_FAT, OS_Amiga, OS_VMS, OS_Unix, OS_VMCMS, OS_AtariST, OS_HPFS,
+ OS_Macintosh, OS_ZSystem, OS_CPM, OS_TOPS20, OS_NTFS, OS_QDOS,
+ OS_Acorn, OS_VFAT, OS_MVS, OS_BeOS, OS_Tandem, OS_Theos, OS_MacDarwin,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ OS_AtheOS
+};
+
+
+/***********************/
+/* zi_vers_made_by() */
+/***********************/
+
+static void zi_vers_made_by( __G__ indent, hnum, hver)
+ __GDEF
+ int indent;
+ unsigned hnum;
+ unsigned hver;
+{
+ char unkn[16];
+ ZCONST char *varmsg_str;
+
+ if (hnum >= NUM_HOSTS) {
+ sprintf(unkn, LoadFarString(UnknownNo),
+ (int)G.crec.version_made_by[1]);
+ varmsg_str = unkn;
+ } else {
+ varmsg_str = LoadFarStringSmall(os[hnum]);
+#ifdef OLD_THEOS_EXTRA
+ if (hnum == FS_VFAT_ && hver == 20) {
+ /* entry made by old non-official THEOS port zip archive */
+ varmsg_str = LoadFarStringSmall(OS_TheosOld);
+ }
+#endif /* OLD_THEOS_EXTRA */
+ }
+ Info(slide, 0, ((char *)slide, LoadFarString(HostOS), varmsg_str));
+ Info(slide, 0, ((char *)slide, LoadFarString(EncodeSWVer), hver/10,
+ hver%10));
+}
+
+
+/***************************/
+/* zi_long_extern_attr() */
+/***************************/
+
+static void zi_long_extern_attr( __G__ indent, hnum, xatt)
+ __GDEF
+ int indent;
+ unsigned hnum;
+ unsigned xatt;
+{
+ unsigned xatth;
+ unsigned xattl;
+ char workspace[ 12], attribs[ 22];
+
+ xatth = (xatt >> 16) & 0xFFFF;
+ xattl = xatt & 0xFF;
+
+ if (hnum == VMS_) {
+ char *p=attribs, *q=attribs+1;
+ int i, j, k;
+
+ for (k = 0; k < 12; ++k)
+ workspace[k] = 0;
+ if (xatth & VMS_IRUSR)
+ workspace[0] = 'R';
+ if (xatth & VMS_IWUSR) {
+ workspace[1] = 'W';
+ workspace[3] = 'D';
+ }
+ if (xatth & VMS_IXUSR)
+ workspace[2] = 'E';
+ if (xatth & VMS_IRGRP)
+ workspace[4] = 'R';
+ if (xatth & VMS_IWGRP) {
+ workspace[5] = 'W';
+ workspace[7] = 'D';
+ }
+ if (xatth & VMS_IXGRP)
+ workspace[6] = 'E';
+ if (xatth & VMS_IROTH)
+ workspace[8] = 'R';
+ if (xatth & VMS_IWOTH) {
+ workspace[9] = 'W';
+ workspace[11] = 'D';
+ }
+ if (xatth & VMS_IXOTH)
+ workspace[10] = 'E';
+
+ *p++ = '(';
+ for (k = j = 0; j < 3; ++j) { /* loop over groups of permissions */
+ for (i = 0; i < 4; ++i, ++k) /* loop over perms within a group */
+ if (workspace[k])
+ *p++ = workspace[k];
+ *p++ = ','; /* group separator */
+ if (j == 0)
+ while ((*p++ = *q++) != ',')
+ ; /* system, owner perms are same */
+ }
+ *p-- = '\0';
+ *p = ')'; /* overwrite last comma */
+ Info(slide, 0, ((char *)slide, LoadFarString(VMSFileAttributes),
+ (indent ? indentStr : nullStr), xatth, attribs));
+
+ } else if (hnum == AMIGA_) {
+ switch (xatth & AMI_IFMT) {
+ case AMI_IFDIR: attribs[0] = 'd'; break;
+ case AMI_IFREG: attribs[0] = '-'; break;
+ default: attribs[0] = '?'; break;
+ }
+ attribs[1] = (xatth & AMI_IHIDDEN)? 'h' : '-';
+ attribs[2] = (xatth & AMI_ISCRIPT)? 's' : '-';
+ attribs[3] = (xatth & AMI_IPURE)? 'p' : '-';
+ attribs[4] = (xatth & AMI_IARCHIVE)? 'a' : '-';
+ attribs[5] = (xatth & AMI_IREAD)? 'r' : '-';
+ attribs[6] = (xatth & AMI_IWRITE)? 'w' : '-';
+ attribs[7] = (xatth & AMI_IEXECUTE)? 'e' : '-';
+ attribs[8] = (xatth & AMI_IDELETE)? 'd' : '-';
+ attribs[9] = 0; /* better dlm the string */
+ Info(slide, 0, ((char *)slide, LoadFarString(AmigaFileAttributes),
+ (indent ? indentStr : nullStr), xatth, attribs));
+ } else if (hnum == THEOS_) {
+ ZCONST char Far *fpFtyp;
+ switch (xatth & THS_IFMT) {
+ case THS_IFLIB: fpFtyp = TheosFTypLib; break;
+ case THS_IFDIR: fpFtyp = TheosFTypDir; break;
+ case THS_IFREG: fpFtyp = TheosFTypReg; break;
+ case THS_IFREL: fpFtyp = TheosFTypRel; break;
+ case THS_IFKEY: fpFtyp = TheosFTypKey; break;
+ case THS_IFIND: fpFtyp = TheosFTypInd; break;
+ case THS_IFR16: fpFtyp = TheosFTypR16; break;
+ case THS_IFP16: fpFtyp = TheosFTypP16; break;
+ case THS_IFP32: fpFtyp = TheosFTypP32; break;
+ default: fpFtyp = TheosFTypUkn; break;
+ }
+ strcpy(attribs, LoadFarStringSmall(fpFtyp));
+ attribs[12] = (xatth & THS_INHID) ? '.' : 'H';
+ attribs[13] = (xatth & THS_IMODF) ? '.' : 'M';
+ attribs[14] = (xatth & THS_IWOTH) ? '.' : 'W';
+ attribs[15] = (xatth & THS_IROTH) ? '.' : 'R';
+ attribs[16] = (xatth & THS_IEUSR) ? '.' : 'E';
+ attribs[17] = (xatth & THS_IXUSR) ? '.' : 'X';
+ attribs[18] = (xatth & THS_IWUSR) ? '.' : 'W';
+ attribs[19] = (xatth & THS_IRUSR) ? '.' : 'R';
+ attribs[20] = 0;
+ Info(slide, 0, ((char *)slide, LoadFarString(TheosFileAttributes),
+ (indent ? indentStr : nullStr), xatth, attribs));
+#ifdef OLD_THEOS_EXTRA
+ } else if (hnum == FS_VFAT_ && hostver == 20) {
+ /* process old non-official THEOS port zip archive */
+ ZCONST char Far *fpFtyp;
+
+ switch (xatth & _THS_IFMT) {
+ case _THS_IFLIB: fpFtyp = TheosFTypLib; break;
+ case _THS_IFDIR: fpFtyp = TheosFTypDir; break;
+ case _THS_IFREG: fpFtyp = TheosFTypReg; break;
+ case _THS_IODRC: fpFtyp = TheosFTypRel; break;
+ case _THS_IOKEY: fpFtyp = TheosFTypKey; break;
+ case _THS_IOIND: fpFtyp = TheosFTypInd; break;
+ case _THS_IOPRG: fpFtyp = TheosFTypR16; break;
+ case _THS_IO286: fpFtyp = TheosFTypP16; break;
+ case _THS_IO386: fpFtyp = TheosFTypP32; break;
+ default: fpFtyp = TheosFTypUkn; break;
+ }
+ strcpy(attribs, LoadFarStringSmall(fpFtyp));
+ attribs[12] = (xatth & _THS_HIDDN) ? 'H' : '.';
+ attribs[13] = (xatth & _THS_IXOTH) ? '.' : 'X';
+ attribs[14] = (xatth & _THS_IWOTH) ? '.' : 'W';
+ attribs[15] = (xatth & _THS_IROTH) ? '.' : 'R';
+ attribs[16] = (xatth & _THS_IEUSR) ? '.' : 'E';
+ attribs[17] = (xatth & _THS_IXUSR) ? '.' : 'X';
+ attribs[18] = (xatth & _THS_IWUSR) ? '.' : 'W';
+ attribs[19] = (xatth & _THS_IRUSR) ? '.' : 'R';
+ attribs[20] = 0;
+ Info(slide, 0, ((char *)slide, LoadFarString(TheosFileAttributes),
+ (indent ? indentStr : nullStr), xatth, attribs));
+#endif /* OLD_THEOS_EXTRA */
+
+ } else if ((hnum != FS_FAT_) && (hnum != FS_HPFS_) &&
+ (hnum != FS_NTFS_) && (hnum != FS_VFAT_) &&
+ (hnum != ACORN_) &&
+ (hnum != VM_CMS_) && (hnum != MVS_))
+ { /* assume Unix-like */
+ switch ((unsigned)(xatth & UNX_IFMT)) {
+ case (unsigned)UNX_IFDIR: attribs[0] = 'd'; break;
+ case (unsigned)UNX_IFREG: attribs[0] = '-'; break;
+ case (unsigned)UNX_IFLNK: attribs[0] = 'l'; break;
+ case (unsigned)UNX_IFBLK: attribs[0] = 'b'; break;
+ case (unsigned)UNX_IFCHR: attribs[0] = 'c'; break;
+ case (unsigned)UNX_IFIFO: attribs[0] = 'p'; break;
+ case (unsigned)UNX_IFSOCK: attribs[0] = 's'; break;
+ default: attribs[0] = '?'; break;
+ }
+ attribs[1] = (xatth & UNX_IRUSR)? 'r' : '-';
+ attribs[4] = (xatth & UNX_IRGRP)? 'r' : '-';
+ attribs[7] = (xatth & UNX_IROTH)? 'r' : '-';
+
+ attribs[2] = (xatth & UNX_IWUSR)? 'w' : '-';
+ attribs[5] = (xatth & UNX_IWGRP)? 'w' : '-';
+ attribs[8] = (xatth & UNX_IWOTH)? 'w' : '-';
+
+ if (xatth & UNX_IXUSR)
+ attribs[3] = (xatth & UNX_ISUID)? 's' : 'x';
+ else
+ attribs[3] = (xatth & UNX_ISUID)? 'S' : '-'; /* S = undefined */
+ if (xatth & UNX_IXGRP)
+ attribs[6] = (xatth & UNX_ISGID)? 's' : 'x'; /* == UNX_ENFMT */
+ else
+ attribs[6] = (xatth & UNX_ISGID)? 'l' : '-';
+ if (xatth & UNX_IXOTH)
+ attribs[9] = (xatth & UNX_ISVTX)? 't' : 'x'; /* "sticky bit" */
+ else
+ attribs[9] = (xatth & UNX_ISVTX)? 'T' : '-'; /* T = undefined */
+ attribs[10] = 0;
+
+ Info(slide, 0, ((char *)slide, LoadFarString(UnixFileAttributes),
+ (indent ? indentStr : nullStr), xatth, attribs));
+
+ } else {
+ Info(slide, 0, ((char *)slide, LoadFarString(NonMSDOSFileAttributes),
+ (indent ? indentStr : nullStr), (xatth >> 8)));
+
+ } /* endif (hnum: external attributes format) */
+
+ if (xattl == 0)
+ Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributes),
+ (indent ? indentStr : nullStr), xattl));
+ else if (xattl == 1)
+ Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributesRO),
+ (indent ? indentStr : nullStr), xattl));
+ else
+ Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributesAlpha),
+ (indent ? indentStr : nullStr),
+ xattl, ((xattl& 1) ? "rdo " : nullStr),
+ (xattl& 2)? "hid " : nullStr,
+ (xattl& 4)? "sys " : nullStr,
+ (xattl& 8)? "lab " : nullStr,
+ (xattl& 16)? "dir " : nullStr,
+ (xattl& 32)? "arc " : nullStr,
+ (xattl& 64)? "lnk " : nullStr,
+ (xattl& 128)? "exe" : nullStr));
+}
+
+
+/***************************/
+/* zi_long_intern_attr() */
+/***************************/
+
+static void zi_long_intern_attr( __G__ indent, iatt)
+ __GDEF
+ int indent;
+ unsigned iatt;
+{
+ Info(slide, 0, ((char *)slide, LoadFarString(ApparentFileType),
+ (indent ? indentStr : nullStr), iatt,
+ ((iatt & 1) ? "text" : (iatt & 2)? "ebcdic" : "binary"),
+ ((G.crec.internal_file_attributes & 0xfc)? "+" : nullStr)));
+}
/************************/
iztimes z_utime;
#endif
int error;
- unsigned hostnum, hostver, extnum, extver, methid, methnum, xattr;
- char workspace[12], attribs[22];
+ unsigned hostnum, hostver, extnum, extver, methid, methnum;
+ unsigned fc_len;
+ unsigned iattr;
+ unsigned xattr;
+ char d_t_buf[ 21];
ZCONST char *varmsg_str;
char unkn[16];
- static ZCONST char Far *os[NUM_HOSTS] = {
- OS_FAT, OS_Amiga, OS_VMS, OS_Unix, OS_VMCMS, OS_AtariST, OS_HPFS,
- OS_Macintosh, OS_ZSystem, OS_CPM, OS_TOPS20, OS_NTFS, OS_QDOS,
- OS_Acorn, OS_VFAT, OS_MVS, OS_BeOS, OS_Tandem, OS_Theos, OS_MacDarwin,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- OS_AtheOS
- };
- static ZCONST char Far *method[NUM_METHODS] = {
- MthdNone, MthdShrunk, MthdRedF1, MthdRedF2, MthdRedF3, MthdRedF4,
- MthdImplode, MthdToken, MthdDeflate, MthdDeflat64, MthdDCLImplode,
- MthdBZip2, MthdLZMA, MthdTerse, MthdLZ77, MthdWavPack, MthdPPMd
- };
static ZCONST char Far *dtypelng[4] = {
DeflNorm, DeflMax, DeflFast, DeflSFast
};
hostnum = (unsigned)(G.pInfo->hostnum);
hostver = (unsigned)(G.pInfo->hostver);
- extnum = (unsigned)MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS);
+ extnum = (unsigned)IZ_MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS);
extver = (unsigned)G.crec.version_needed_to_extract[0];
methid = (unsigned)G.crec.compression_method;
methnum = find_compr_idx(G.crec.compression_method);
FmZofft(G.crec.relative_offset_local_header, NULL, "u"),
FmZofft(G.crec.relative_offset_local_header, FZOFFT_HEX_DOT_WID, "X")));
- if (hostnum >= NUM_HOSTS) {
- sprintf(unkn, LoadFarString(UnknownNo),
- (int)G.crec.version_made_by[1]);
- varmsg_str = unkn;
- } else {
- varmsg_str = LoadFarStringSmall(os[hostnum]);
-#ifdef OLD_THEOS_EXTRA
- if (hostnum == FS_VFAT_ && hostver == 20) {
- /* entry made by old non-official THEOS port zip archive */
- varmsg_str = LoadFarStringSmall(OS_TheosOld);
- }
-#endif /* OLD_THEOS_EXTRA */
- }
- Info(slide, 0, ((char *)slide, LoadFarString(HostOS), varmsg_str));
- Info(slide, 0, ((char *)slide, LoadFarString(EncodeSWVer), hostver/10,
- hostver%10));
+ zi_vers_made_by( __G__ 0, hostnum, hostver);
if ((extnum >= NUM_HOSTS) || (os[extnum] == NULL)) {
sprintf(unkn, LoadFarString(UnknownNo),
LoadFarStringSmall(dtypelng[dnum])));
}
+ Info(slide, 0, ((char *)slide, LoadFarString( GenPurpBitFlags),
+ G.crec.general_purpose_bit_flag));
Info(slide, 0, ((char *)slide, LoadFarString(FileSecurity),
- (G.crec.general_purpose_bit_flag & 1) ? nullStr : "not "));
+ (G.crec.general_purpose_bit_flag & 0x0001) ? nullStr : "not ",
+ (G.crec.general_purpose_bit_flag & 0x0040) ? " (strong)": nullStr));
Info(slide, 0, ((char *)slide, LoadFarString(ExtendedLocalHdr),
(G.crec.general_purpose_bit_flag & 8) ? "yes" : "no"));
/* print upper 3 bits for amusement? */
- /* For printing of date & time, a "char d_t_buf[21]" is required.
- * To save stack space, we reuse the "char attribs[22]" buffer which
- * is not used yet.
- */
-# define d_t_buf attribs
-
zi_time(__G__ &G.crec.last_mod_dos_datetime, NULL, d_t_buf);
Info(slide, 0, ((char *)slide, LoadFarString(FileModDate), d_t_buf));
#ifdef USE_EF_UT_TIME
G.crec.file_comment_length));
Info(slide, 0, ((char *)slide, LoadFarString(FileDiskNum),
(ulg)(G.crec.disk_number_start + 1)));
- Info(slide, 0, ((char *)slide, LoadFarString(ApparentFileType),
- (G.crec.internal_file_attributes & 1)? "text"
- : (G.crec.internal_file_attributes & 2)? "ebcdic"
- : "binary")); /* changed to accept EBCDIC */
+
+ zi_long_intern_attr( __G__ 0, G.crec.internal_file_attributes);
+
#ifdef ATARI
printf(" external file attributes (hex): %.8lx\n",
G.crec.external_file_attributes);
#endif
- xattr = (unsigned)((G.crec.external_file_attributes >> 16) & 0xFFFF);
- if (hostnum == VMS_) {
- char *p=attribs, *q=attribs+1;
- int i, j, k;
-
- for (k = 0; k < 12; ++k)
- workspace[k] = 0;
- if (xattr & VMS_IRUSR)
- workspace[0] = 'R';
- if (xattr & VMS_IWUSR) {
- workspace[1] = 'W';
- workspace[3] = 'D';
- }
- if (xattr & VMS_IXUSR)
- workspace[2] = 'E';
- if (xattr & VMS_IRGRP)
- workspace[4] = 'R';
- if (xattr & VMS_IWGRP) {
- workspace[5] = 'W';
- workspace[7] = 'D';
- }
- if (xattr & VMS_IXGRP)
- workspace[6] = 'E';
- if (xattr & VMS_IROTH)
- workspace[8] = 'R';
- if (xattr & VMS_IWOTH) {
- workspace[9] = 'W';
- workspace[11] = 'D';
- }
- if (xattr & VMS_IXOTH)
- workspace[10] = 'E';
-
- *p++ = '(';
- for (k = j = 0; j < 3; ++j) { /* loop over groups of permissions */
- for (i = 0; i < 4; ++i, ++k) /* loop over perms within a group */
- if (workspace[k])
- *p++ = workspace[k];
- *p++ = ','; /* group separator */
- if (j == 0)
- while ((*p++ = *q++) != ',')
- ; /* system, owner perms are same */
- }
- *p-- = '\0';
- *p = ')'; /* overwrite last comma */
- Info(slide, 0, ((char *)slide, LoadFarString(VMSFileAttributes), xattr,
- attribs));
-
- } else if (hostnum == AMIGA_) {
- switch (xattr & AMI_IFMT) {
- case AMI_IFDIR: attribs[0] = 'd'; break;
- case AMI_IFREG: attribs[0] = '-'; break;
- default: attribs[0] = '?'; break;
- }
- attribs[1] = (xattr & AMI_IHIDDEN)? 'h' : '-';
- attribs[2] = (xattr & AMI_ISCRIPT)? 's' : '-';
- attribs[3] = (xattr & AMI_IPURE)? 'p' : '-';
- attribs[4] = (xattr & AMI_IARCHIVE)? 'a' : '-';
- attribs[5] = (xattr & AMI_IREAD)? 'r' : '-';
- attribs[6] = (xattr & AMI_IWRITE)? 'w' : '-';
- attribs[7] = (xattr & AMI_IEXECUTE)? 'e' : '-';
- attribs[8] = (xattr & AMI_IDELETE)? 'd' : '-';
- attribs[9] = 0; /* better dlm the string */
- Info(slide, 0, ((char *)slide, LoadFarString(AmigaFileAttributes),
- xattr, attribs));
-
- } else if (hostnum == THEOS_) {
- ZCONST char Far *fpFtyp;
-
- switch (xattr & THS_IFMT) {
- case THS_IFLIB: fpFtyp = TheosFTypLib; break;
- case THS_IFDIR: fpFtyp = TheosFTypDir; break;
- case THS_IFREG: fpFtyp = TheosFTypReg; break;
- case THS_IFREL: fpFtyp = TheosFTypRel; break;
- case THS_IFKEY: fpFtyp = TheosFTypKey; break;
- case THS_IFIND: fpFtyp = TheosFTypInd; break;
- case THS_IFR16: fpFtyp = TheosFTypR16; break;
- case THS_IFP16: fpFtyp = TheosFTypP16; break;
- case THS_IFP32: fpFtyp = TheosFTypP32; break;
- default: fpFtyp = TheosFTypUkn; break;
- }
- strcpy(attribs, LoadFarStringSmall(fpFtyp));
- attribs[12] = (xattr & THS_INHID) ? '.' : 'H';
- attribs[13] = (xattr & THS_IMODF) ? '.' : 'M';
- attribs[14] = (xattr & THS_IWOTH) ? '.' : 'W';
- attribs[15] = (xattr & THS_IROTH) ? '.' : 'R';
- attribs[16] = (xattr & THS_IEUSR) ? '.' : 'E';
- attribs[17] = (xattr & THS_IXUSR) ? '.' : 'X';
- attribs[18] = (xattr & THS_IWUSR) ? '.' : 'W';
- attribs[19] = (xattr & THS_IRUSR) ? '.' : 'R';
- attribs[20] = 0;
- Info(slide, 0, ((char *)slide, LoadFarString(TheosFileAttributes),
- xattr, attribs));
-
-#ifdef OLD_THEOS_EXTRA
- } else if (hostnum == FS_VFAT_ && hostver == 20) {
- /* process old non-official THEOS port zip archive */
- ZCONST char Far *fpFtyp;
-
- switch (xattr & _THS_IFMT) {
- case _THS_IFLIB: fpFtyp = TheosFTypLib; break;
- case _THS_IFDIR: fpFtyp = TheosFTypDir; break;
- case _THS_IFREG: fpFtyp = TheosFTypReg; break;
- case _THS_IODRC: fpFtyp = TheosFTypRel; break;
- case _THS_IOKEY: fpFtyp = TheosFTypKey; break;
- case _THS_IOIND: fpFtyp = TheosFTypInd; break;
- case _THS_IOPRG: fpFtyp = TheosFTypR16; break;
- case _THS_IO286: fpFtyp = TheosFTypP16; break;
- case _THS_IO386: fpFtyp = TheosFTypP32; break;
- default: fpFtyp = TheosFTypUkn; break;
- }
- strcpy(attribs, LoadFarStringSmall(fpFtyp));
- attribs[12] = (xattr & _THS_HIDDN) ? 'H' : '.';
- attribs[13] = (xattr & _THS_IXOTH) ? '.' : 'X';
- attribs[14] = (xattr & _THS_IWOTH) ? '.' : 'W';
- attribs[15] = (xattr & _THS_IROTH) ? '.' : 'R';
- attribs[16] = (xattr & _THS_IEUSR) ? '.' : 'E';
- attribs[17] = (xattr & _THS_IXUSR) ? '.' : 'X';
- attribs[18] = (xattr & _THS_IWUSR) ? '.' : 'W';
- attribs[19] = (xattr & _THS_IRUSR) ? '.' : 'R';
- attribs[20] = 0;
- Info(slide, 0, ((char *)slide, LoadFarString(TheosFileAttributes),
- xattr, attribs));
-#endif /* OLD_THEOS_EXTRA */
-
- } else if ((hostnum != FS_FAT_) && (hostnum != FS_HPFS_) &&
- (hostnum != FS_NTFS_) && (hostnum != FS_VFAT_) &&
- (hostnum != ACORN_) &&
- (hostnum != VM_CMS_) && (hostnum != MVS_))
- { /* assume Unix-like */
- switch ((unsigned)(xattr & UNX_IFMT)) {
- case (unsigned)UNX_IFDIR: attribs[0] = 'd'; break;
- case (unsigned)UNX_IFREG: attribs[0] = '-'; break;
- case (unsigned)UNX_IFLNK: attribs[0] = 'l'; break;
- case (unsigned)UNX_IFBLK: attribs[0] = 'b'; break;
- case (unsigned)UNX_IFCHR: attribs[0] = 'c'; break;
- case (unsigned)UNX_IFIFO: attribs[0] = 'p'; break;
- case (unsigned)UNX_IFSOCK: attribs[0] = 's'; break;
- default: attribs[0] = '?'; break;
- }
- attribs[1] = (xattr & UNX_IRUSR)? 'r' : '-';
- attribs[4] = (xattr & UNX_IRGRP)? 'r' : '-';
- attribs[7] = (xattr & UNX_IROTH)? 'r' : '-';
-
- attribs[2] = (xattr & UNX_IWUSR)? 'w' : '-';
- attribs[5] = (xattr & UNX_IWGRP)? 'w' : '-';
- attribs[8] = (xattr & UNX_IWOTH)? 'w' : '-';
-
- if (xattr & UNX_IXUSR)
- attribs[3] = (xattr & UNX_ISUID)? 's' : 'x';
- else
- attribs[3] = (xattr & UNX_ISUID)? 'S' : '-'; /* S = undefined */
- if (xattr & UNX_IXGRP)
- attribs[6] = (xattr & UNX_ISGID)? 's' : 'x'; /* == UNX_ENFMT */
- else
- attribs[6] = (xattr & UNX_ISGID)? 'l' : '-';
- if (xattr & UNX_IXOTH)
- attribs[9] = (xattr & UNX_ISVTX)? 't' : 'x'; /* "sticky bit" */
- else
- attribs[9] = (xattr & UNX_ISVTX)? 'T' : '-'; /* T = undefined */
- attribs[10] = 0;
-
- Info(slide, 0, ((char *)slide, LoadFarString(UnixFileAttributes), xattr,
- attribs));
-
- } else {
- Info(slide, 0, ((char *)slide, LoadFarString(NonMSDOSFileAttributes),
- G.crec.external_file_attributes >> 8));
-
- } /* endif (hostnum: external attributes format) */
-
- if ((xattr=(unsigned)(G.crec.external_file_attributes & 0xFF)) == 0)
- Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributes),
- xattr));
- else if (xattr == 1)
- Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributesRO),
- xattr));
- else
- Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributesAlpha),
- xattr, (xattr&1)? "rdo " : nullStr,
- (xattr&2)? "hid " : nullStr,
- (xattr&4)? "sys " : nullStr,
- (xattr&8)? "lab " : nullStr,
- (xattr&16)? "dir " : nullStr,
- (xattr&32)? "arc " : nullStr,
- (xattr&64)? "lnk " : nullStr,
- (xattr&128)? "exe" : nullStr));
+ zi_long_extern_attr( __G__ 0, hostnum, G.crec.external_file_attributes);
/*---------------------------------------------------------------------------
Analyze the extra field, if any, and print the file comment, if any (the
entry...
---------------------------------------------------------------------------*/
+/* 2012-11-25 SMS. (OUSPG report.)
+ * Changed eb_len and ef_len from unsigned to signed, to catch underflow
+ * of ef_len caused by corrupt/malicious data. (32-bit is adequate.
+ * Used "long" to accommodate any systems with 16-bit "int".)
+ * Renamed "eb_datalen" to "el_len" for consistency with other code.
+ */
+
if (G.crec.extra_field_length > 0) {
uch *ef_ptr = G.extra_field;
- ush ef_len = G.crec.extra_field_length;
- ush eb_id, eb_datalen;
+ long ef_len = G.crec.extra_field_length;
+ ush eb_id;
+ long eb_len;
ZCONST char Far *ef_fieldname;
if (error_in_archive > PK_WARN) /* fatal: can't continue */
while (ef_len >= EB_HEADSIZE) {
eb_id = makeword(&ef_ptr[EB_ID]);
- eb_datalen = makeword(&ef_ptr[EB_LEN]);
+ eb_len = makeword(&ef_ptr[EB_LEN]);
ef_ptr += EB_HEADSIZE;
ef_len -= EB_HEADSIZE;
- if (eb_datalen > (ush)ef_len) {
+ if (eb_len > (ush)ef_len) {
Info(slide, 0x421, ((char *)slide,
- LoadFarString(ExtraFieldTrunc), eb_id, eb_datalen, ef_len));
- eb_datalen = ef_len;
+ LoadFarString(ExtraFieldTrunc), eb_id, eb_len, ef_len));
+ eb_len = ef_len;
}
switch (eb_id) {
the local e.f. size, local Z64 e.f. block has no
offset; when only local offset present, the entire
local PKSZ64 block is missing. */
- *pEndprev -= (eb_datalen == 8 ? 12 : 8);
+ *pEndprev -= (eb_len == 8 ? 12 : 8);
}
break;
case EF_AV:
#endif
ef_fieldname = efTheos;
break;
+ case EF_AES_WG:
+ ef_fieldname = efAES;
+ break;
+ case EF_JAVA:
+ ef_fieldname = efJavaCAFE;
+ break;
+ case EF_LHDREXTN:
+ ef_fieldname = efLHdrExtn;
+ break;
default:
ef_fieldname = efUnknown;
break;
}
Info(slide, 0, ((char *)slide, LoadFarString(ExtraFieldType),
- eb_id, LoadFarStringSmall(ef_fieldname), eb_datalen));
+ eb_id, LoadFarStringSmall(ef_fieldname), eb_len));
/* additional, field-specific information: */
switch (eb_id) {
+ case EF_AES_WG:
+ {
+ char *aes_strngth_p; /* Strngth/key-size ptr. */
+ char aes_strngth_s[ 8]; /* Strngth/key-size buffer. */
+ char *vend_vers_p; /* Vendor version ptr. */
+ char vend_vers_s[ 8]; /* Vendor version buffer. */
+ ush vend_vers; /* Vendor version value. */
+
+ vend_vers = makeword( ef_ptr); /* Vendor version. */
+ if (vend_vers == 1)
+ vend_vers_p = "AE-1";
+ else if (vend_vers == 2)
+ vend_vers_p = "AE-2";
+ else
+ {
+ vend_vers_p = vend_vers_s;
+ sprintf( vend_vers_s, "0x%04x", vend_vers);
+ }
+
+ if (ef_ptr[ 4] == 1)
+ aes_strngth_p = "AES128";
+ else if (ef_ptr[ 4] == 2)
+ aes_strngth_p = "AES192";
+ else if (ef_ptr[ 4] == 3)
+ aes_strngth_p = "AES256";
+ else
+ {
+ aes_strngth_p = aes_strngth_s;
+ sprintf( aes_strngth_s, "0x%02x", ef_ptr[ 4]);
+ }
+
+ Info(slide, 0, ((char *)slide,
+ LoadFarString( AesExtraField),
+ vend_vers_p, /* Vendor versn. */
+ ef_ptr[ 2], ef_ptr[ 3], /* Vendor ID. */
+ aes_strngth_p, /* AES mode. */
+ cmpr_mthd( makeword( &ef_ptr[ 5])))); /* Cmpr mthd. */
+ break;
+ }
case EF_OS2:
case EF_ACL:
- if (eb_datalen >= EB_OS2_HLEN) {
+ if (eb_len >= EB_OS2_HLEN) {
if (eb_id == EF_OS2)
ef_fieldname = OS2EAs;
else
}
break;
case EF_NTSD:
- if (eb_datalen >= EB_NTSD_C_LEN) {
+ if (eb_len >= EB_NTSD_C_LEN) {
Info(slide, 0, ((char *)slide, LoadFarString(NTSDData),
makelong(ef_ptr)));
*pEndprev = 0L; /* no clue about csize of local */
}
break;
case EF_IZVMS:
- if (eb_datalen >= 8) {
+ if (eb_len >= 8) {
char *p, q[8];
unsigned compr = makeword(ef_ptr+EB_IZVMS_FLGS)
& EB_IZVMS_BCMASK;
p = "XABKEY"; break;
case 0x56534D56: /* "VMSV" */
p = "version";
- if (eb_datalen >= 16) {
+ if (eb_len >= 16) {
/* put termitation first, for A_TO_N() */
q[7] = '\0';
q[0] = ' ';
}
break;
case EF_TIME:
- if (eb_datalen > 0) {
+ if (eb_len > 0) {
char types[80];
int num = 0, len;
if (num > 0)
Info(slide, 0, ((char *)slide,
LoadFarString(UTdata), types,
- num == 1? nullStr : PlurSufx));
+ num == 1 ? nullStr : plurSufx));
}
break;
case EF_UNIPATH:
case EF_UNICOMNT:
- if (eb_datalen >= 5) {
+ if (eb_len >= 5) {
unsigned i, n;
ulg name_crc = makelong(ef_ptr+1);
- if (eb_datalen <= 29) {
+ if (eb_len <= 29) {
Info(slide, 0, ((char *)slide,
LoadFarString(U8PthCmnComplete),
(unsigned)ef_ptr[0], name_crc));
- n = eb_datalen;
+ n = eb_len;
} else {
Info(slide, 0, ((char *)slide,
LoadFarString(U8PthCmnF24),
}
break;
case EF_MAC3:
- if (eb_datalen >= EB_MAC3_HLEN) {
+ if (eb_len >= EB_MAC3_HLEN) {
ulg eb_uc = makelong(ef_ptr);
unsigned mac3_flgs = makeword(ef_ptr+EB_FLGS_OFFS);
unsigned eb_is_uc = mac3_flgs & EB_M3_FL_UNCMPR;
}
break;
case EF_ZIPIT2:
- if (eb_datalen >= 5 &&
+ if (eb_len >= 5 &&
makelong(ef_ptr) == 0x5449505A /* "ZPIT" */) {
- if (eb_datalen >= 12) {
+ if (eb_len >= 12) {
zi_showMacTypeCreator(__G__ &ef_ptr[4]);
}
} else {
}
break;
case EF_ZIPIT:
- if (eb_datalen >= 5 &&
+ if (eb_len >= 5 &&
makelong(ef_ptr) == 0x5449505A /* "ZPIT" */) {
unsigned fnlen = ef_ptr[4];
- if ((unsigned)eb_datalen >= fnlen + (5 + 8)) {
+ if ((unsigned)eb_len >= fnlen + (5 + 8)) {
uch nullchar = ef_ptr[fnlen+5];
ef_ptr[fnlen+5] = '\0'; /* terminate filename */
}
break;
case EF_JLMAC:
- if (eb_datalen >= 40 &&
+ if (eb_len >= 40 &&
makelong(ef_ptr) == 0x45454C4A /* "JLEE" */)
{
zi_showMacTypeCreator(__G__ &ef_ptr[4]);
}
break;
case EF_SMARTZIP:
- if ((eb_datalen == EB_SMARTZIP_HLEN) &&
+ if ((eb_len == EB_SMARTZIP_HLEN) &&
makelong(ef_ptr) == 0x70695A64 /* "dZip" */) {
char filenameBuf[32];
zi_showMacTypeCreator(__G__ &ef_ptr[4]);
Info(slide, 0, ((char *)slide,
LoadFarString(VmMvsExtraField),
(getVMMVSexfield(type, ef_ptr-EB_HEADSIZE,
- (unsigned)eb_datalen) > 0)?
+ (unsigned)eb_len) > 0)?
type : LoadFarStringSmall(VmMvsInvalid)));
}
break;
#endif /* CMS_MVS */
case EF_ATHEOS:
case EF_BEOS:
- if (eb_datalen >= EB_BEOS_HLEN) {
+ if (eb_len >= EB_BEOS_HLEN) {
ulg eb_uc = makelong(ef_ptr);
unsigned eb_is_uc =
*(ef_ptr+EB_FLGS_OFFS) & EB_BE_FL_UNCMPR;
}
break;
case EF_QDOS:
- if (eb_datalen >= 4) {
+ if (eb_len >= 4) {
Info(slide, 0, ((char *)slide, LoadFarString(QDOSdata),
ef_ptr[0], ef_ptr[1], ef_ptr[2], ef_ptr[3]));
} else {
}
break;
case EF_AOSVS:
- if (eb_datalen >= 5) {
+ if (eb_len >= 5) {
Info(slide, 0, ((char *)slide, LoadFarString(AOSVSdata),
((int)(uch)ef_ptr[4])/10, ((int)(uch)ef_ptr[4])%10));
} else {
}
break;
case EF_TANDEM:
- if (eb_datalen == 20) {
+ if (eb_len == 20) {
unsigned type, code;
type = (ef_ptr[18] & 0x60) >> 5;
}
break;
case EF_MD5:
- if (eb_datalen >= 19) {
+ if (eb_len >= 19) {
char md5[33];
int i;
md5));
break;
} /* else: fall through !! */
+ case EF_LHDREXTN:
+ {
+ long eb_ndx = 0;
+ int eb_state = -1;
+ uch bit_mask;
+ unsigned hnum = (unsigned)-1;
+ unsigned hver;
+
+ Info( slide, 0, ((char *)slide,
+ LoadFarString( efLHdrExtnBitMap)));
+ while (eb_ndx < eb_len)
+ {
+ switch (eb_state)
+ {
+ case -1: /* Seeking end of bit mask. */
+ Info( slide, 0, ((char *)slide,
+ LoadFarString( efLHdrExtnBitMapByte),
+ *(ef_ptr+ eb_ndx)));
+ if ((*(ef_ptr+ eb_ndx)& 0x80) == 0)
+ {
+ eb_state = 1;
+ eb_ndx++;
+ bit_mask = *ef_ptr;
+ Info( slide, 0, ((char *)slide,
+ LoadFarString( efLHdrExtnBitMapEol)));
+ }
+ break;
+ case 0: /* bit_mask[ 0]. */
+ if (bit_mask& 0x01)
+ { /* Version Made By. */
+ if (eb_ndx+ 2 <= eb_len)
+ {
+ hver = *(ef_ptr+ eb_ndx);
+ hnum = *(ef_ptr+ eb_ndx+ 1);
+ zi_vers_made_by( __G__ 1, hnum, hver);
+ eb_ndx += 2;
+ }
+ else
+ break;
+ }
+ if (bit_mask& 0x02)
+ { /* Internal File Atributes. */
+ if (eb_ndx+ 2 <= eb_len)
+ {
+ iattr = makeword( ef_ptr+ eb_ndx);
+ zi_long_intern_attr( __G__ 1, iattr);
+ eb_ndx += 2;
+ }
+ else
+ break;
+ }
+ if (bit_mask& 0x04)
+ { /* External File Atributes. */
+ if (eb_ndx+ 4 <= eb_len)
+ {
+ xattr = makelong( ef_ptr+ eb_ndx);
+ if (hnum != (unsigned)-1)
+ { /* Must know host type for ext attr. */
+ zi_long_extern_attr( __G__ 1, hnum, xattr);
+ }
+ eb_ndx += 4;
+ }
+ else
+ break;
+ }
+ if (bit_mask& 0x08)
+ {
+ if (eb_ndx+ 2 <= eb_len)
+ {
+ fc_len = makeword( ef_ptr+ eb_ndx);
+ eb_ndx += 2;
+ if (eb_ndx+ (long)fc_len <= eb_len)
+ {
+ eb_ndx += fc_len;
+ }
+ else
+ break;
+ }
+ else
+ break;
+ }
+ default:
+ break;
+ } /* switch (eb_state) */
+ } /* while (eb_ndx < eb_len) */
+ } /* case EF_LHDREXTN */
+
default:
ef_default_display:
- if (eb_datalen > 0) {
+ if (eb_len > 0) {
unsigned i, n;
- if (eb_datalen <= 24) {
+ if (eb_len <= 24) {
Info(slide, 0, ((char *)slide,
LoadFarString(ColonIndent)));
- n = eb_datalen;
+ n = eb_len;
} else {
Info(slide, 0, ((char *)slide,
LoadFarString(First20)));
}
(*G.message)((zvoid *)&G, (uch *)".", 1L, 0);
- ef_ptr += eb_datalen;
- ef_len -= eb_datalen;
+ ef_ptr += eb_len;
+ ef_len -= eb_len;
}
(*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0);
}
time_t *z_modtim;
#endif
int k, error, error_in_archive=PK_COOL;
- unsigned hostnum, hostver, methid, methnum, xattr;
+ unsigned hostnum, hostver, methid, methnum;
+ unsigned xattr_high;
+ unsigned xattr_low;
+#define xattr xattr_high
char *p, workspace[12], attribs[16];
char methbuf[5];
static ZCONST char dtype[5]="NXFS"; /* normal, maximum, fast, superfast */
- static ZCONST char Far os[NUM_HOSTS+1][4] = {
+ static ZCONST char Far oss[NUM_HOSTS+1][4] = {
"fat", "ami", "vms", "unx", "cms", "atr", "hpf", "mac", "zzz",
"cpm", "t20", "ntf", "qds", "aco", "vft", "mvs", "be ", "nsk",
"ths", "osx", "???", "???", "???", "???", "???", "???", "???",
#endif
static ZCONST char Far method[NUM_METHODS+1][5] = {
"stor", "shrk", "re:1", "re:2", "re:3", "re:4", "i#:#", "tokn",
- "def#", "d64#", "dcli", "bzp2", "lzma", "ters", "lz77", "wavp",
- "ppmd", "u###"
+ "def#", "d64#", "dcli", "bzp2", "lzma", "ters", "lz77", "jpeg",
+ "wavp", "ppmd", "aesw", "u###"
};
hostnum = (unsigned)(G.pInfo->hostnum);
hostver = (unsigned)(G.pInfo->hostver);
/*
- extnum = (unsigned)MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS);
+ extnum = (unsigned)IZ_MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS);
extver = (unsigned)G.crec.version_needed_to_extract[0];
*/
sprintf(&methbuf[1], "%03u", G.crec.compression_method);
}
- for (k = 0; k < 15; ++k)
- attribs[k] = ' ';
- attribs[15] = 0;
+ memset( attribs, ' ', (sizeof( attribs)- 1));
+ attribs[ sizeof( attribs)- 1] = 0;
+
+ xattr_high = (unsigned)((G.crec.external_file_attributes >> 16) & 0xFFFF);
+ xattr_low = (unsigned)((G.crec.external_file_attributes) & 0xFFFF);
- xattr = (unsigned)((G.crec.external_file_attributes >> 16) & 0xFFFF);
switch (hostnum) {
case VMS_:
{ int i, j;
*p++ = ','; /* group separator */
}
*--p = ' '; /* overwrite last comma */
- if ((p - attribs) < 12)
- sprintf(&attribs[12], "%u.%u", hostver/10, hostver%10);
+
+ if ((p - attribs) < 11)
+ { /* Enough space for "xx.x". Any version fits. */
+ sprintf( &attribs[ 11], "%2u.%u",
+ (hostver/ 10), (hostver% 10));
+ }
+ else if (((p - attribs) < 12) && (hostver < 100))
+ { /* Enough space for "x.x", and version complies. */
+ sprintf( &attribs[ 12], "%u.%u",
+ (hostver/ 10), (hostver% 10));
+ }
}
break;
attribs[6] = (xattr & AMI_IWRITE)? 'w' : '-';
attribs[7] = (xattr & AMI_IEXECUTE)? 'e' : '-';
attribs[8] = (xattr & AMI_IDELETE)? 'd' : '-';
- sprintf(&attribs[12], "%u.%u", hostver/10, hostver%10);
+ sprintf( &attribs[ 11], "%2u.%u", (hostver/ 10), (hostver% 10));
break;
case THEOS_:
attribs[6] = (xattr & THS_IXUSR) ? '.' : 'X';
attribs[7] = (xattr & THS_IWUSR) ? '.' : 'W';
attribs[8] = (xattr & THS_IRUSR) ? '.' : 'R';
- sprintf(&attribs[12], "%u.%u", hostver/10, hostver%10);
+ sprintf( &attribs[ 11], "%2u.%u", (hostver/ 10), (hostver% 10));
break;
case FS_VFAT_:
attribs[6] = (xattr & _THS_IXUSR) ? '.' : 'X';
attribs[7] = (xattr & _THS_IWUSR) ? '.' : 'W';
attribs[8] = (xattr & _THS_IRUSR) ? '.' : 'R';
- sprintf(&attribs[12], "%u.%u", hostver/10, hostver%10);
+ sprintf( &attribs[ 11], "%2u.%u", (hostver/ 10), (hostver% 10));
break;
} /* else: fall through! */
#endif /* OLD_THEOS_EXTRA */
)
{
xattr = (unsigned)(G.crec.external_file_attributes & 0xFF);
- sprintf(attribs, ".r.-... %u.%u", hostver/10, hostver%10);
+ sprintf( attribs, ".r.-.... ");
+ sprintf( &attribs[ 11], "%2u.%u", (hostver/ 10), (hostver% 10));
attribs[2] = (xattr & 0x01)? '-' : 'w';
attribs[5] = (xattr & 0x02)? 'h' : '-';
attribs[6] = (xattr & 0x04)? 's' : '-';
STRNICMP(p, "bat", 3) == 0)
attribs[3] = 'x';
}
+ /* Check for symlink. Currently this is for symlinks created
+ on Windows by Zip 3.1 or later. */
+ if (xattr_high && (xattr_high & UNX_IFMT) == UNX_IFLNK)
+ attribs[7] = 'l';
+ else
+ attribs[7] = '-';
break;
} /* else: fall through! */
else
attribs[9] = (xattr & UNX_ISVTX)? 'T' : '-'; /* T==undefined */
- sprintf(&attribs[12], "%u.%u", hostver/10, hostver%10);
+ sprintf( &attribs[ 11], "%2u.%u", (hostver/ 10), (hostver% 10));
break;
} /* end switch (hostnum: external attributes format) */
Info(slide, 0, ((char *)slide, "%s %s %s ", attribs,
LoadFarStringSmall(((hostnum == FS_VFAT_ && hostver == 20) ?
os_TheosOld :
- os[hostnum])),
+ oss[hostnum])),
FmZofft(G.crec.ucsize, "8", "u")));
#else
Info(slide, 0, ((char *)slide, "%s %s %s ", attribs,
- LoadFarStringSmall(os[hostnum]),
+ LoadFarStringSmall(oss[hostnum]),
FmZofft(G.crec.ucsize, "8", "u")));
#endif
Info(slide, 0, ((char *)slide, "%c",
} /* end function zi_time() */
#endif /* !NO_ZIPINFO */
+
+++ /dev/null
-ZIPINFO(1L) ZIPINFO(1L)
-
-NAME
- zipinfo - list detailed information about a ZIP archive
-
-SYNOPSIS
- zipinfo [-12smlvhMtTz] file[.zip] [file(s) ...] [-x xfile(s) ...]
-
- unzip -Z [-12smlvhMtTz] file[.zip] [file(s) ...] [-x xfile(s) ...]
-
-DESCRIPTION
- zipinfo lists technical information about files in a ZIP archive, most
- commonly found on MS-DOS systems. Such information includes file
- access permissions, encryption status, type of compression, version and
- operating system or file system of compressing program, and the like.
- The default behavior (with no options) is to list single-line entries
- for each file in the archive, with header and trailer lines providing
- summary information for the entire archive. The format is a cross
- between Unix ``ls -l'' and ``unzip -v'' output. See DETAILED DESCRIP-
- TION below. Note that zipinfo is the same program as unzip (under
- Unix, a link to it); on some systems, however, zipinfo support may have
- been omitted when unzip was compiled.
-
-ARGUMENTS
- file[.zip]
- Path of the ZIP archive(s). If the file specification is a
- wildcard, each matching file is processed in an order determined
- by the operating system (or file system). Only the filename can
- be a wildcard; the path itself cannot. Wildcard expressions are
- similar to Unix egrep(1) (regular) expressions and may contain:
-
- * matches a sequence of 0 or more characters
-
- ? matches exactly 1 character
-
- [...] matches any single character found inside the brackets;
- ranges are 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 except the characters inside the
- brackets is considered a match). To specify a verbatim
- left bracket, the three-character sequence ``[[]'' has to
- be used.
-
- (Be sure to quote any character that might otherwise be inter-
- preted or modified by the operating system, particularly under
- Unix and VMS.) If no matches are found, the specification is
- assumed to be a literal filename; and if that also fails, the
- suffix .zip is appended. Note that self-extracting ZIP files
- are supported, as with any other ZIP archive; just specify the
- .exe suffix (if any) explicitly.
-
- [file(s)]
- An optional list of archive members to be processed, separated
- by spaces. (VMS versions compiled with VMSCLI defined must
- delimit files with commas instead.) Regular expressions (wild-
- cards) may be used to match multiple members; see above. Again,
- be sure to quote expressions that would otherwise be expanded or
- modified by the operating system.
-
- [-x xfile(s)]
- An optional list of archive members to be excluded from process-
- ing.
-
-OPTIONS
- -1 list filenames only, one per line. This option excludes all
- others; headers, trailers and zipfile comments are never
- printed. It is intended for use in Unix shell scripts.
-
- -2 list filenames only, one per line, but allow headers (-h),
- trailers (-t) and zipfile comments (-z), as well. This option
- may be useful in cases where the stored filenames are particu-
- larly long.
-
- -s list zipfile info in short Unix ``ls -l'' format. This is the
- default behavior; see below.
-
- -m list zipfile info in medium Unix ``ls -l'' format. Identical to
- the -s output, except that the compression factor, expressed as
- a percentage, is also listed.
-
- -l list zipfile info in long Unix ``ls -l'' format. As with -m
- except that the compressed size (in bytes) is printed instead of
- the compression ratio.
-
- -v list zipfile information in verbose, multi-page format.
-
- -h list header line. The archive name, actual size (in bytes) and
- total number of files is printed.
-
- -M pipe all output through an internal pager similar to the Unix
- more(1) command. At the end of a screenful of output, zipinfo
- pauses with a ``--More--'' prompt; the next screenful may be
- viewed by pressing the Enter (Return) key or the space bar.
- zipinfo can be terminated by pressing the ``q'' key and, on some
- systems, the Enter/Return key. Unlike Unix more(1), there is no
- forward-searching or editing capability. Also, zipinfo doesn't
- notice if long lines wrap at the edge of the screen, effectively
- resulting in the printing of two or more lines and the likeli-
- hood that some text will scroll off the top of the screen before
- being viewed. On some systems the number of available lines on
- the screen is not detected, in which case zipinfo assumes the
- height is 24 lines.
-
- -t list totals for files listed or for all files. The number of
- files listed, their uncompressed and compressed total sizes ,
- and their overall compression factor is printed; or, if only the
- totals line is being printed, the values for the entire archive
- are given. The compressed total size does not include the 12
- additional header bytes of each encrypted entry. Note that the
- total compressed (data) size will never match the actual zipfile
- size, since the latter includes all of the internal zipfile
- headers in addition to the compressed data.
-
- -T print the file dates and times in a sortable decimal format
- (yymmdd.hhmmss). The default date format is a more standard,
- human-readable version with abbreviated month names (see exam-
- ples below).
-
- -U [UNICODE_SUPPORT only] modify or disable UTF-8 handling. When
- UNICODE_SUPPORT is available, the option -U forces unzip to
- escape all non-ASCII characters from UTF-8 coded filenames as
- ``#Uxxxx''. This option is mainly provided for debugging pur-
- pose when the fairly new UTF-8 support is suspected to mangle up
- extracted filenames.
-
- The option -UU allows to entirely disable the recognition of
- UTF-8 encoded filenames. The handling of filename codings
- within unzip falls back to the behaviour of previous versions.
-
- -z include the archive comment (if any) in the listing.
-
-DETAILED DESCRIPTION
- zipinfo has a number of modes, and its behavior can be rather difficult
- to fathom if one isn't familiar with Unix ls(1) (or even if one is).
- The default behavior is to list files in the following format:
-
- -rw-rws--- 1.9 unx 2802 t- defX 11-Aug-91 13:48 perms.2660
-
- The last three fields are the modification date and time of the file,
- and its name. The case of the filename is respected; thus files that
- come from MS-DOS PKZIP are always capitalized. If the file was zipped
- with a stored directory name, that is also displayed as part of the
- filename.
-
- The second and third fields indicate that the file was zipped under
- Unix with version 1.9 of zip. Since it comes from Unix, the file per-
- missions at the beginning of the line are printed in Unix format. The
- uncompressed file-size (2802 in this example) is the fourth field.
-
- The fifth field consists of two characters, either of which may take on
- several values. The first character may be either `t' or `b', indicat-
- ing that zip believes the file to be text or binary, respectively; but
- if the file is encrypted, zipinfo notes this fact by capitalizing the
- character (`T' or `B'). The second character may also take on four
- values, depending on whether there is an extended local header and/or
- an ``extra field'' associated with the file (fully explained in
- PKWare's APPNOTE.TXT, but basically analogous to pragmas in ANSI
- C--i.e., they provide a standard way to include non-standard informa-
- tion in the archive). If neither exists, the character will be a
- hyphen (`-'); if there is an extended local header but no extra field,
- `l'; if the reverse, `x'; and if both exist, `X'. Thus the file in
- this example is (probably) a text file, is not encrypted, and has nei-
- ther an extra field nor an extended local header associated with it.
- The example below, on the other hand, is an encrypted binary file with
- an extra field:
-
- RWD,R,R 0.9 vms 168 Bx shrk 9-Aug-91 19:15 perms.0644
-
- Extra fields are used for various purposes (see discussion of the -v
- option below) including the storage of VMS file attributes, which is
- presumably the case here. Note that the file attributes are listed in
- VMS format. Some other possibilities for the host operating system
- (which is actually a misnomer--host file system is more correct)
- include OS/2 or NT with High Performance File System (HPFS), MS-DOS,
- OS/2 or NT with File Allocation Table (FAT) file system, and Macintosh.
- These are denoted as follows:
-
- -rw-a-- 1.0 hpf 5358 Tl i4:3 4-Dec-91 11:33 longfilename.hpfs
- -r--ahs 1.1 fat 4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF
- --w------- 1.0 mac 17357 bx i8:2 4-May-92 04:02 unzip.macr
-
- File attributes in the first two cases are indicated in a Unix-like
- format, where the seven subfields indicate whether the file: (1) is a
- directory, (2) is readable (always true), (3) is writable, (4) is exe-
- cutable (guessed on the basis of the extension--.exe, .com, .bat, .cmd
- and .btm files are assumed to be so), (5) has its archive bit set, (6)
- is hidden, and (7) is a system file. Interpretation of Macintosh file
- attributes is unreliable because some Macintosh archivers don't store
- any attributes in the archive.
-
- Finally, the sixth field indicates the compression method and possible
- sub-method used. There are six methods known at present: storing (no
- compression), reducing, shrinking, imploding, tokenizing (never pub-
- licly released), and deflating. In addition, there are four levels of
- reducing (1 through 4); four types of imploding (4K or 8K sliding dic-
- tionary, and 2 or 3 Shannon-Fano trees); and four levels of deflating
- (superfast, fast, normal, maximum compression). zipinfo represents
- these methods and their sub-methods as follows: stor; re:1, re:2,
- etc.; shrk; i4:2, i8:3, etc.; tokn; and defS, defF, defN, and defX.
-
- The medium and long listings are almost identical to the short format
- except that they add information on the file's compression. The medium
- format lists the file's compression factor as a percentage indicating
- the amount of space that has been ``removed'':
-
- -rw-rws--- 1.5 unx 2802 t- 81% defX 11-Aug-91 13:48 perms.2660
-
- In this example, the file has been compressed by more than a factor of
- five; the compressed data are only 19% of the original size. The long
- format gives the compressed file's size in bytes, instead:
-
- -rw-rws--- 1.5 unx 2802 t- 538 defX 11-Aug-91 13:48 perms.2660
-
- In contrast to the unzip listings, the compressed size figures in this
- listing format denote the complete size of compressed data, including
- the 12 extra header bytes in case of encrypted entries.
-
- Adding the -T option changes the file date and time to decimal format:
-
- -rw-rws--- 1.5 unx 2802 t- 538 defX 910811.134804 perms.2660
-
- Note that because of limitations in the MS-DOS format used to store
- file times, the seconds field is always rounded to the nearest even
- second. For Unix files this is expected to change in the next major
- releases of zip(1L) and unzip.
-
- In addition to individual file information, a default zipfile listing
- also includes header and trailer lines:
-
- Archive: OS2.zip 5453 bytes 5 files
- ,,rw, 1.0 hpf 730 b- i4:3 26-Jun-92 23:40 Contents
- ,,rw, 1.0 hpf 3710 b- i4:3 26-Jun-92 23:33 makefile.os2
- ,,rw, 1.0 hpf 8753 b- i8:3 26-Jun-92 15:29 os2unzip.c
- ,,rw, 1.0 hpf 98 b- stor 21-Aug-91 15:34 unzip.def
- ,,rw, 1.0 hpf 95 b- stor 21-Aug-91 17:51 zipinfo.def
- 5 files, 13386 bytes uncompressed, 4951 bytes compressed: 63.0%
-
- The header line gives the name of the archive, its total size, and the
- total number of files; the trailer gives the number of files listed,
- their total uncompressed size, and their total compressed size (not
- including any of zip's internal overhead). If, however, one or more
- file(s) are provided, the header and trailer lines are not listed.
- This behavior is also similar to that of Unix's ``ls -l''; it may be
- overridden by specifying the -h and -t options explicitly. In such a
- case the listing format must also be specified explicitly, since -h or
- -t (or both) in the absence of other options implies that ONLY the
- header or trailer line (or both) is listed. See the EXAMPLES section
- below for a semi-intelligible translation of this nonsense.
-
- The verbose listing is mostly self-explanatory. It also lists file
- comments and the zipfile comment, if any, and the type and number of
- bytes in any stored extra fields. Currently known types of extra
- fields include PKWARE's authentication (``AV'') info; OS/2 extended
- attributes; VMS filesystem info, both PKWARE and Info-ZIP versions;
- Macintosh resource forks; Acorn/Archimedes SparkFS info; and so on.
- (Note that in the case of OS/2 extended attributes--perhaps the most
- common use of zipfile extra fields--the size of the stored EAs as
- reported by zipinfo may not match the number given by OS/2's dir com-
- mand: OS/2 always reports the number of bytes required in 16-bit for-
- mat, whereas zipinfo always reports the 32-bit storage.)
-
- Again, the compressed size figures of the individual entries include
- the 12 extra header bytes for encrypted entries. In contrast, the
- archive total compressed size and the average compression ratio shown
- in the summary bottom line are calculated without the extra 12 header
- bytes of encrypted entries.
-
-ENVIRONMENT OPTIONS
- Modifying zipinfo's default behavior via options placed in an environ-
- ment variable can be a bit complicated to explain, due to zipinfo's
- attempts to handle various defaults in an intuitive, yet Unix-like,
- manner. (Try not to laugh.) Nevertheless, there is some underlying
- logic. In brief, there are three ``priority levels'' of options: the
- default options; environment options, which can override or add to the
- defaults; and explicit options given by the user, which can override or
- add to either of the above.
-
- The default listing format, as noted above, corresponds roughly to the
- "zipinfo -hst" command (except when individual zipfile members are
- specified). A user who prefers the long-listing format (-l) can make
- use of the zipinfo's environment variable to change this default:
-
- Unix Bourne shell:
- ZIPINFO=-l; export ZIPINFO
-
- Unix C shell:
- setenv ZIPINFO -l
-
- OS/2 or MS-DOS:
- set ZIPINFO=-l
-
- VMS (quotes for lowercase):
- define ZIPINFO_OPTS "-l"
-
- If, in addition, the user dislikes the trailer line, zipinfo's concept
- of ``negative options'' may be used to override the default inclusion
- of the line. This is accomplished by preceding the undesired option
- with one or more minuses: e.g., ``-l-t'' or ``--tl'', in this example.
- The first hyphen is the regular switch character, but the one before
- the `t' is a minus sign. The dual use of hyphens may seem a little
- awkward, but it's reasonably intuitive nonetheless: simply ignore the
- first hyphen and go from there. It is also consistent with the behav-
- ior of the Unix command nice(1).
-
- As suggested above, the default variable names are ZIPINFO_OPTS for VMS
- (where the symbol used to install zipinfo as a foreign command would
- otherwise be confused with the environment variable), and ZIPINFO for
- all other operating systems. For compatibility with zip(1L), ZIPIN-
- FOOPT is also accepted (don't ask). If both ZIPINFO and ZIPINFOOPT are
- defined, however, ZIPINFO takes precedence. unzip's diagnostic option
- (-v with no zipfile name) can be used to check the values of all four
- possible unzip and zipinfo environment variables.
-
-EXAMPLES
- To get a basic, short-format listing of the complete contents of a ZIP
- archive storage.zip, with both header and totals lines, use only the
- archive name as an argument to zipinfo:
-
- zipinfo storage
-
- To produce a basic, long-format listing (not verbose), including header
- and totals lines, use -l:
-
- zipinfo -l storage
-
- To list the complete contents of the archive without header and totals
- lines, either negate the -h and -t options or else specify the contents
- explicitly:
-
- zipinfo --h-t storage
- zipinfo storage \*
-
- (where the backslash is required only if the shell would otherwise
- expand the `*' wildcard, as in Unix when globbing is turned on--double
- quotes around the asterisk would have worked as well). To turn off the
- totals line by default, use the environment variable (C shell is
- assumed here):
-
- setenv ZIPINFO --t
- zipinfo storage
-
- To get the full, short-format listing of the first example again, given
- that the environment variable is set as in the previous example, it is
- necessary to specify the -s option explicitly, since the -t option by
- itself implies that ONLY the footer line is to be printed:
-
- setenv ZIPINFO --t
- zipinfo -t storage [only totals line]
- zipinfo -st storage [full listing]
-
- The -s option, like -m and -l, includes headers and footers by default,
- unless otherwise specified. Since the environment variable specified
- no footers and that has a higher precedence than the default behavior
- of -s, an explicit -t option was necessary to produce the full listing.
- Nothing was indicated about the header, however, so the -s option was
- sufficient. Note that both the -h and -t options, when used by them-
- selves or with each other, override any default listing of member
- files; only the header and/or footer are printed. This behavior is
- useful when zipinfo is used with a wildcard zipfile specification; the
- contents of all zipfiles are then summarized with a single command.
-
- To list information on a single file within the archive, in medium for-
- mat, specify the filename explicitly:
-
- zipinfo -m storage unshrink.c
-
- The specification of any member file, as in this example, will override
- the default header and totals lines; only the single line of informa-
- tion about the requested file will be printed. This is intuitively
- what one would expect when requesting information about a single file.
- For multiple files, it is often useful to know the total compressed and
- uncompressed size; in such cases -t may be specified explicitly:
-
- zipinfo -mt storage "*.[ch]" Mak\*
-
- To get maximal information about the ZIP archive, use the verbose
- option. It is usually wise to pipe the output into a filter such as
- Unix more(1) if the operating system allows it:
-
- zipinfo -v storage | more
-
- Finally, to see the most recently modified files in the archive, use
- the -T option in conjunction with an external sorting utility such as
- Unix sort(1) (and sed(1) as well, in this example):
-
- zipinfo -T storage | sort -nr -k 7 | sed 15q
-
- The -nr option to sort(1) tells it to sort numerically in reverse order
- rather than in textual order, and the -k 7 option tells it to sort on
- the seventh field. This assumes the default short-listing format; if
- -m or -l is used, the proper sort(1) option would be -k 8. Older ver-
- sions of sort(1) do not support the -k option, but you can use the
- traditional + option instead, e.g., +6 instead of -k 7. The sed(1)
- command filters out all but the first 15 lines of the listing. Future
- releases of zipinfo may incorporate date/time and filename sorting as
- built-in options.
-
-TIPS
- The author finds it convenient to define an alias ii for zipinfo on
- systems that allow aliases (or, on other systems, copy/rename the exe-
- cutable, create a link or create a command file with the name ii). The
- ii usage parallels the common ll alias for long listings in Unix, and
- the similarity between the outputs of the two commands was intentional.
-
-BUGS
- As with unzip, zipinfo's -M (``more'') option is overly simplistic in
- its handling of screen output; as noted above, it fails to detect the
- wrapping of long lines and may thereby cause lines at the top of the
- screen to be scrolled off before being read. zipinfo should detect and
- treat each occurrence of line-wrap as one additional line printed.
- This requires knowledge of the screen's width as well as its height.
- In addition, zipinfo should detect the true screen geometry on all sys-
- tems.
-
- zipinfo's listing-format behavior is unnecessarily complex and should
- be simplified. (This is not to say that it will be.)
-
-SEE ALSO
- ls(1), funzip(1L), unzip(1L), unzipsfx(1L), zip(1L), zipcloak(1L), zip-
- note(1L), zipsplit(1L)
-
-URL
- The Info-ZIP home page is currently at
- http://www.info-zip.org/pub/infozip/
- or
- ftp://ftp.info-zip.org/pub/infozip/ .
-
-AUTHOR
- Greg ``Cave Newt'' Roelofs. ZipInfo contains pattern-matching code by
- Mark Adler and fixes/improvements by many others. Please refer to the
- CONTRIBS file in the UnZip source distribution for a more complete
- list.
-
-Info-ZIP 20 April 2009 (v3.0) ZIPINFO(1L)
--- /dev/null
+/*
+ zos/bbunzip.c - UnZip 6
+
+ Copyright (c) 1990-2014 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.
+ If, for some reason, all these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+/*--------------------------------------------------------------------------
+
+ zos/bbunzip.c
+
+ This source file supports the compilation of the Infozip 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.
+
+ 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 runopts(ENV(MVS),PLIST(MVS), TRAP(OFF), NOEXECOPS, \
+ STACK(64K), \
+ HEAP(512K,1M,ANYWHERE,FREE), \
+ NOTEST(NONE,INSPICD,PROMPT) )
+
+//#pragma strings( readonly )
+#pragma csect(code, "IZ_MAIN")
+#pragma csect(static, "IZ_WS")
+#pragma csect(test, "IZ_TEST")
+
+#pragma comment( copyright , "1990-2014 Info-ZIP. All rights reserved" )
+
+#pragma subtitle( "Load module eye-catchers" )
+#pragma page()
+
+/*------------------------------------------------------
+| Program build time eye-catchers for executable. |
+------------------------------------------------------*/
+static const char * EYECATCHER_EyeCatcher = "EYE CATCHER" ;
+static const char * EYECATCHER_Version = "06.10.00" ;
+static const char * EYECATCHER_Datestamp = __DATE__ ;
+static const char * EYECATCHER_Timestamp = __TIME__ ;
+static const char * EYECATCHER_Filename = __FILE__ ;
+
+#pragma subtitle ("Build Controls")
+#pragma page ()
+
+#define MVS
+#define _POSIX_SOURCE
+#define IZ_BIGBUILD /* Single compilation build */
+
+#define PROGRAM_ID "UNZIP"
+
+#pragma subtitle ("Include Files")
+#pragma page ()
+
+ /*------------------------------------------------------+
+ | System include files. |
+ +------------------------------------------------------*/
+
+ /*-------------------------------------------------------
+ | UNZIP utility: mainline |
+ -------------------------------------------------------*/
+#include "unzip.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: 32-bit CRC routines |
+ -------------------------------------------------------*/
+#include "crc32.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: decryption routines |
+ -------------------------------------------------------*/
+#include "crypt.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: Environment variable routines |
+ -------------------------------------------------------*/
+#include "envargs.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: explode impoded data routines |
+ -------------------------------------------------------*/
+#include "explode.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: extract/test ZIPfile members |
+ -------------------------------------------------------*/
+#include "extract.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: file I/O routines |
+ -------------------------------------------------------*/
+#include "fileio.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: global variable definitions |
+ -------------------------------------------------------*/
+#include "globals.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: inflate routines |
+ -------------------------------------------------------*/
+#include "inflate.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: list routines |
+ -------------------------------------------------------*/
+#include "list.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: regular expression routines |
+ -------------------------------------------------------*/
+#include "match.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: multiple-ZIPfile processing routines |
+ -------------------------------------------------------*/
+#include "process.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: tty I/O routines |
+ -------------------------------------------------------*/
+#include "ttyio.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: unreduce routines (dummy) |
+ -------------------------------------------------------*/
+#include "unreduce.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: unshrink routines |
+ -------------------------------------------------------*/
+#include "unshrink.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: ZIP file listing routines |
+ -------------------------------------------------------*/
+#include "zipinfo.c"
+
+ /*-------------------------------------------------------
+ | UNZIP utility: Routines common to VM/CMS and MVS |
+ -------------------------------------------------------*/
+#include "vmmvs.c"
+
+#pragma title ("LEQUNZIP -- InfoZip UNZIP Utility")
+#pragma subtitle (" ")
--- /dev/null
+//Q4XTWNBU JOB (EQ00,P),'AL DUNSMUIR',NOTIFY=&SYSUID,
+// MSGCLASS=T,REGION=0M
+/*JOBPARM S=XBAT
+//*
+//*-------------------------------------------------------------------*/
+//* C Compile STEP */
+//*-------------------------------------------------------------------*/
+//COMPILE EXEC PGM=CCNDRVR,
+// PARM='OPTF'
+//STEPLIB DD DISP=SHR,DSN=SYS1.SCEERUN
+// DD DISP=SHR,DSN=SYS1.SCCNCMP
+//SYSMSGS DD DUMMY
+//SYSOPTF DD *
+TUNE(2)
+ARCH(2)
+OPT
+CSECT
+DLL
+EXPMAC
+LONGNAME
+CHE(NONE)
+NOSEARCH
+PLIST(HOST)
+RENT
+SHOWINC
+SOURCE
+SSCOM
+TERM
+LIST
+AGGREGATE
+NOINLINE(AUTO,REPORT,,)
+NOOFFSET
+XREF
+LSE((*.C)=(LIB(DD:CLIB)),(*.H)=(LIB(DD:HLIB)))
+/*
+//SYSIN DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.C(BBUNZIP)
+//SYSLIB DD DISP=SHR,DSN=SYS1.SCEEH.H
+// DD DISP=SHR,DSN=SYS1.SCEEH.ARPA.H
+// DD DISP=SHR,DSN=SYS1.SCEEH.NET.H
+// DD DISP=SHR,DSN=SYS1.SCEEH.NETINET.H
+// DD DISP=SHR,DSN=SYS1.SCEEH.SYS.H
+// DD DISP=SHR,DSN=SYS1.SCEEH.SYS.H
+// DD DISP=SHR,DSN=SYS1.SCEEH.SYS.H
+//SYSLIN DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.OBJ(BBUNZIP)
+//SYSPRINT DD SYSOUT=*
+//SYSCPRT DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.LISTING(BBUNZIP)
+//SYSUT1 DD DSN=&&SYS1,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
+//SYSUT2 DD DSN=&&SYS2,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
+//SYSUT3 DD DSN=&&SYS3,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
+//SYSUT4 DD DSN=&&SYS4,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
+//SYSUT5 DD DSN=&&SYS5,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
+//SYSUT6 DD DSN=&&SYS6,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
+//SYSUT7 DD DSN=&&SYS7,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
+//SYSUT8 DD DSN=&&SYS8,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
+//SYSUT9 DD DSN=&&SYS9,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=VB,LRECL=137,BLKSIZE=882)
+//SYSUT10 DD DUMMY
+//SYSUT14 DD DSN=&&SYS14,UNIT=VIO,DISP=(NEW,PASS),
+// SPACE=(32000,(30,30)),
+// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
+//CLIB DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.C
+//HLIB DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.H
+//*
+//*-------------------------------------------------------------------*/
+//* BIND-to-PDSE STEP */
+//*-------------------------------------------------------------------*/
+//BIND EXEC PGM=HEWL,COND=(4,LT,COMPILE),
+// PARM='MAP,LIST,XREF,LET'
+//OBJLIB DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.OBJ
+//SYSLIB DD DISP=SHR,DSN=SYS1.SCEELKED
+// DD DISP=SHR,DSN=SYS1.SCEESPC /* SYS PROG C LIB */
+// DD DISP=SHR,DSN=SYS1.CSSLIB /* APPC/MVS */
+// DD DISP=SHR,DSN=SYS1.SISPLOAD
+// DD DISP=SHR,DSN=PROD.AUTOLIB
+// DD DISP=SHR,DSN=PROD.LIBRARY
+//SYSPRINT DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.MAP(UNZIP)
+//SYSLIN DD *
+ SETOPT PARM(REUS(RENT))
+ MODE AMODE(31),RMODE(ANY)
+ ORDER IZ_MAIN
+ PAGE IZ_MAIN
+ INCLUDE OBJLIB(BBUNZIP)
+ ENTRY CEESTART
+ NAME UNZIP(R)
+/*
+//SYSUT1 DD UNIT=VIO,SPACE=(32000,(30,30))
+//SYSLMOD DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.LOADLIB
# define NO_STRNICMP /* MVS has no strnicmp() */
# include <features.h>
/* MVS complains if a function has the same name as a csect. */
-# if defined(__UNZIP_C)
+# if defined(IZ_BIGBUILD) /* Primary C file supplies pragmas */
+# elif defined(__UNZIP_C)
# pragma csect(STATIC,"unzip_s")
# elif defined(__CRC32_C)
# pragma csect(STATIC,"crc32_s")
#define USE_STRM_INPUT
#define USE_FWRITE
+#define NO_USER_PROGRESS
#define PATH_MAX 128
/* The use of "ebcdic[LF]" is not reliable; VM/CMS C/370 uses the
* EBCDIC specific "NL" ('NewLine') control character (and not the EBCDIC
* equivalent of the ASCII "LF" ('LineFeed')) as line terminator!
- * To work around this problem, we explicitely emit the C compiler's native
+ * To work around this problem, we explicitly emit the C compiler's native
* '\n' line terminator.
*/
#if 0
--- /dev/null
+//Q4XTWNBU JOB (EQ00,P),'AL DUNSMUIR',NOTIFY=&SYSUID,
+// MSGCLASS=T
+/*JOBPARM S=XBAT
+//*
+//*-------------------------------------------------------------------*/
+//* Encode UNZIP LOADLIB using TSO XMIT */
+//*-------------------------------------------------------------------*/
+//XMIT EXEC PGM=IKJEFT01,DYNAMNBR=20
+//DDIN DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.LOADLIB
+//DDOUT DD DISP=OLD,DSN=PS1353.IZ.UNZIP.V610.XMIT(UNZIP)
+//SYSPRINT DD SYSOUT=*
+//SYSTSPRT DD SYSOUT=*
+//SYSTSIN DD *
+ TRANSMIT INFOZIP +
+ NOCOPYLIST +
+ DDNAME(DDIN) +
+ NOEPILOG +
+ NOLOG +
+ NONOTIFY +
+ OUTDDNAME(DDOUT) +
+ PDS +
+ NOPROLOG
+//
--- /dev/null
+#!/bin/sh
+#
+# zos/zcc - Zip 3.1, UnZip 6.10 09 Sept 2011
+#
+# Copyright (c) 2011 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.
+# If, for some reason, all these files are missing, the Info-ZIP license
+# also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#
+# zcc: In the z/OS UNIX Systems Services or z/VM OpenEdition environments,
+# invoke the IBM XL C compiler driver program capturing the listing
+# and error output.
+#
+# The XL C compiler driver program normally directs any listing output
+# to stdout, and error output to stderr. This is not terribly useful
+# for any but the most trivial programs, so this script was introduced
+# to make things more useful.
+#
+# - The first parameter must be the name of the XL C compiler driver
+# program - cc, c89, xlc, xlc_64, etc.
+#
+# - The object file name is extracted from the -o option parameter,
+# and the object file directory (if any) and base name determined.
+#
+# - If the -o option is not specified, but the -c option is present,
+# the source file name is extracted from the -c option parameter,
+# and the object file directory (if any) and base name determined.
+#
+# - The compiler stdout is directed to a file with the object file
+# directory and basename and the extension ".lst".
+#
+# - The compiler stderr is directed to a file with the object file
+# directory and basename and the extension ".err".
+#
+
+# Determine shell name
+zccname=$(basename "$0")
+
+# Save zcc options
+zccopts=$@
+
+# Emit usage if invoked with no operands
+if [ $# = 0 ]; then
+ echo usage: "$zccname pgm [XL_C_options] -o objfile.o srcfile.c"
+ echo Captures C compile listing in objfile.lst and errors in objfile.err
+ exit 1
+fi
+
+# Bypass the XL C driver name
+shift
+
+# Locate the XL C compiler -o option and object file name
+# - Also note the -c option and source file name
+objfile=""
+srcfile=""
+while getopts ":o:c:I:D:W:q:L:" opt; do
+ case $opt in
+ o ) objfile="$OPTARG" ;;
+ c ) srcfile="$OPTARG" ;;
+ I ) ;; # -Idir
+ D ) ;; # -Dsymbol
+ W ) ;; # -Woption
+ q ) ;; # -qoption
+ L ) ;; # -Loption
+ * ) ;; # Ignore other forms
+ esac
+done
+shift $((OPTIND -1))
+
+# Escape all parentheses and "strings" in the zcc options
+zccopts=$(echo "$zccopts" | sed -e "s/(/\'(/g" \
+ -e "s/)/)\'/g" \
+ -e "s/=\"/=\'\"/g" \
+ -e "s/\" /\"\' /g" )
+
+# Determine listing and error file directory and base names
+if [ -n "${objfile}" ]; then
+ targdir=$(dirname $objfile)
+ targname=$(basename $objfile .o)
+elif [ -n "${srcfile}" ]; then
+ targdir=$(dirname $srcfile)
+ targname=$(basename $srcfile .c)
+else
+ echo "$zccname:" options must include either "\"-o objfile.o\" \
+ "or "\"-c srcfile.c\""
+ exit 1
+fi
+
+if [ -z "$targdir" ]; then
+ targdir="."
+elif [ ! -d "$targdir" ]; then
+ echo "$zccname:" $targdir is not an existing directory
+ exit 1
+fi
+
+# Set the listing file path name
+lstname=$targdir/$targname.lst
+
+# Set the error file path name
+errname=$targdir/$targname.err
+
+# Remove any previous output files
+rm -f $lstname $errname
+
+# Invoke the C compiler capturing stdout and stderr
+eval "$zccopts >$lstname 2>$errname"
+rc=$?
+exit $rc
--- /dev/null
+#!/bin/sh
+#
+# zos/zcpp - Zip 3.1, UnZip 6.10 09 Sept 2011
+#
+# Copyright (c) 2011 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.
+# If, for some reason, all these files are missing, the Info-ZIP license
+# also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#
+# zcpp: In the z/OS UNIX Systems Services or z/VM OpenEdition environments,
+# invoke the IBM XL C compiler driver program in preprocessor mode.
+# Capture stdout, and check for warning or error messages. Return
+# a non-zero result if any were detected.
+#
+# This wrapper script is required to work around a bug in the XL C
+# compiler driver program, where an unexpected 0 result is returned
+# for the following case
+#
+# (infozip)$cat conftest_ph.c
+# #include <sys/param.h>
+#
+# (infozip)cc -E conftest_ph.c
+# ??=pragma filetag("IBM-1047")
+# ??=pragma nomargins nosequence
+# WARNING CCN3296 ./conftest_ph.c:1 #include file <sys/param.h> not found.
+# FSUM3065 The COMPILE step ended with return code 4.
+
+# Determine shell name
+zcppname=$(basename "$0")
+
+# Save zcpp options
+zcppopts=$@
+
+# Emit usage if invoked with no operands
+if [ $# = 0 ]; then
+ echo usage: "$zcppname pgm [XL_C_options] srcfile.c"
+ echo Checks C preprocessor stderr and sets useful exit code
+ exit 1
+fi
+
+# Bypass the XL C driver name
+shift
+
+# Escape all parentheses and "strings" in the zcpp options
+zcppopts=$(echo "$zcppopts" | sed -e "s/(/\'(/g" \
+ -e "s/)/)\'/g" \
+ -e "s/=\"/=\'\"/g" \
+ -e "s/\" /\"\' /g" )
+
+# Set the listing file path name
+lstname=$targdir/$targname.lst
+
+# Set the error file path name
+errname='./zcpp_stderr'
+
+# Remove any previous output files
+rm -f $errname
+
+# Invoke the C compiler capturing stderr
+eval "$zcppopts 2>${errname}"
+
+# Check the C compiler stderr output for failure messages
+rc=0
+if [ -n "${errname}" ]; then
+ if cat "${errname}" | grep "WARNING" >/dev/null 2>&1 ; then
+ rc=1
+ elif cat "${errname}" | grep "ERROR" >/dev/null 2>&1 ; then
+ rc=1
+ fi
+fi
+
+# Remove current output files
+rm -f $errname
+
+# Return useful result
+exit $rc
--- /dev/null
+//Q4XTWNBU JOB (EQ00,P),'AL DUNSMUIR',NOTIFY=&SYSUID,
+// MSGCLASS=T
+/*JOBPARM S=XBAT
+//*
+//*-------------------------------------------------------------------*/
+//* Delete previous UNZIP source archive */
+//*-------------------------------------------------------------------*/
+//SEQDMDEL EXEC PGM=IDCAMS
+//SYSPRINT DD SYSOUT=*
+//SYSIN DD *
+ DELETE PS1353.IZ.UNZIP.V610.SRC.ZIP
+ SET MAXCC = 0
+/*
+//*
+//*-------------------------------------------------------------------*
+//* Create UNZIP source archive
+//* Input: EBCDIC C and H source, JCL files
+//* Output: ZIP file (w/ ZIPped ASCII translation)
+//*-------------------------------------------------------------------*
+//SEQDMZIP EXEC PGM=LEQZIP,PARM='-ajrl DD:ZIPFILE DD:C DD:H DD:JCL'
+//C DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.C
+//H DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.H
+//JCL DD DISP=SHR,DSN=PS1353.IZ.UNZIP.V610.JCL
+//ZIPFILE DD DISP=(NEW,KEEP),DSN=PS1353.IZ.UNZIP.V610.SRC.ZIP,
+// SPACE=(10,(5,2),RLSE),AVGREC=M,
+// DCB=(RECFM=VB,LRECL=4096)
+//SYSPRINT DD SYSOUT=*
--- /dev/null
+#!/bin/sh
+#
+# zos/zld - Zip 3.1, UnZip 6.10 09 Sept 2011
+#
+# Copyright (c) 2011 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.
+# If, for some reason, all these files are missing, the Info-ZIP license
+# also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+#
+# zld: In the z/OS UNIX Systems Services or z/VM OpenEdition environments,
+# invoke the IBM XL C linker driver program capturing the listing and
+# error output.
+#
+# The XL C linker driver program normally directs any listing output to
+# stdout, and error output to stderr. This is not terribly useful for
+# any but the most trivial programs, so this script was introduced to
+# make things more useful.
+#
+# - The first parameter must be the name of the XL C compiler driver
+# program - cc, c89, xlc, xlc_64, etc.
+#
+# - The target program file name is extracted from the -o option parameter,
+# and the target file directory (if any) and base name determined.
+#
+# - The link stdout is directed to a file with the target program file
+# directory and basename and the extension ".map".
+#
+# - The compiler stderr is directed to the ".map" file.
+#
+
+# Determine shell name
+zldname=$(basename "$0")
+
+# Save zld options
+zldopts=$@
+
+# Emit usage if invoked with no operands
+if [ $# = 0 ]; then
+ echo usage: "$zldname pgm [XL_C_options] -o target objfile1.o objfile2.o"
+ echo Captures C link listing and errors in target.map
+ exit 1
+fi
+
+# Bypass the XL C linker name
+shift
+
+# Locate the XL C linker -o option and target program file name
+targfile=""
+while getopts ":o:I:D:W:q:L:" opt; do
+ case $opt in
+ o ) targfile="$OPTARG" ;;
+ I ) ;; # -Idir
+ D ) ;; # -Dsymbol
+ W ) ;; # -Woption
+ q ) ;; # -qoption
+ L ) ;; # -Loption
+ * ) ;; # Ignore other forms
+ esac
+done
+shift $((OPTIND -1))
+
+# Escape all parentheses and "strings" in the zld options
+zldopts=$(echo "$zldopts" | sed -e "s/(/\'(/g" \
+ -e "s/)/)\'/g" \
+ -e "s/=\"/=\'\"/g" \
+ -e "s/\" /\"\' /g" )
+
+# Determine listing file directory and base names
+if [ -n "${targfile}" ]; then
+ targdir=$(dirname $targfile)
+ targname=$(basename $targfile .o)
+else
+ echo "$zldname:" options must include "\"-o targfile\""
+ exit 1
+fi
+
+if [ -z "${targdir}" ]; then
+ targdir="."
+elif [ ! -d "${targdir}" ]; then
+ echo "$zldname:" $targdir is not an existing directory
+ exit 1
+fi
+
+# Set the listing file path name
+mapname=$targdir/$targname.map
+
+# Remove any previous output file
+rm -f $mapname
+
+# Invoke the C linker capturing stdout and stderr
+eval "$zldopts >$mapname 2>&1"
+rc=$?
+exit $rc
-Using ZIP and UNZIP on VM/CMS
+Using ZIP and UNZIP on VM/CMS (August 11, 2011)
=============================
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, from a DOS or OS/2 window, type this:
- SEND unzip.cmo A:unzip module a (RECFM F LRECL 1024
- Example, using FTP from CMS, type this:
- BINARY FIXED 1024
- GET unzip.cmo unzip.module.a
+ 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
+ Note: CMS ID must be logged off during transfer
+ At the sending system command prompt, type this:
+ BINARY
+ QUOTE SITE FIX 1024
+ 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
+ At the Windows "Command Prompt" window prompt, type this:
+ SEND unzip.cmo A:unzip module a (RECFM F LRECL 1024
Note: Replace "unzip.cmo" with the actual name.
5. Upload the EXECs to CMS as text files (with ASCII-to-EBCDIC
translation).
- Example, from a DOS or OS/2 window, type this:
- SEND unzip.exc A:unzip exec a (CRLF
+
+ 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
+ Note: CMS ID must be logged off during transfer
+ At the sending system command prompt, type this:
+ ASCII
+ PUT unzip.exec unzip.exec
- Example, using FTP from CMS, type this:
- GET unzip.exc unzip.exec.a
+ Example, using PCOMM terminal emulator IND$FILE transfer
+ Note: CMS ID must be logged on to PCOMM terminal emulator session
+ At the Windows "Command Prompt" window prompt, type this:
+ SEND unzip.exec A:unzip exec a (CRLF
- 6. Repeat steps 4 for each of the EXECs.
+ 6. Repeat step 5 for each of the EXECs.
Preparing the environment
-------------------------
-The executables provided were compiled with IBM C 3.1.0 and
+The executables provided were compiled with IBM XL C for z/VM V1R2 and
require the the Language Environment (LE) runtime libraries.
To provide access to the runtime libraries:
+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;
-Please report all bugs and problems to:
- Zip-Bugs@lists.wku.edu
+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 .
+-----------------------------------------------------------------------
+Revised (08/2011) by Al Dunsmuir
+e-mail: al.dunsmuir@sympatico.ca
-----------------------------------------------------------------------
+Additional notes from Ian E. Gorman.
+e-mail: ian@iosphere.net
+
+-----------------------------------------------------------------------
+Additional fixes and README re-write (4/1998) by Greg Hartwig.
+e-mail: ghartwig@ix.netcom.com
+ ghartwig@vnet.ibm.com
+-----------------------------------------------------------------------
Original CMS/MVS port by George Petrov.
e-mail: c888090@nlevdpsb.snads.philips.nl
tel: +31-40-781155
Eindhoven
The Netherlands
------------------------------------------------------------------------
-Additional fixes and README re-write (4/98) by Greg Hartwig.
-e-mail: ghartwig@ix.netcom.com
- ghartwig@vnet.ibm.com
-
------------------------------------------------------------------------
-Additional notes from Ian E. Gorman.
-e-mail: ian@iosphere.net