summaryrefslogtreecommitdiff
path: root/vms
diff options
context:
space:
mode:
authorLorry <lorry@roadtrain.codethink.co.uk>2012-07-20 19:30:57 +0100
committerLorry <lorry@roadtrain.codethink.co.uk>2012-07-20 19:30:57 +0100
commit04664087ad66f5614f82a2cfba3ae4eda15e792b (patch)
tree332090b15fd2db1b93abf40dccf06211d9aba297 /vms
downloadzip-04664087ad66f5614f82a2cfba3ae4eda15e792b.tar.gz
Tarball conversion
Diffstat (limited to 'vms')
-rw-r--r--vms/NOTES.TXT382
-rw-r--r--vms/VMS_ZIP.RNH1467
-rw-r--r--vms/build_zip.com690
-rw-r--r--vms/bzlib.h21
-rw-r--r--vms/cmdline.c1802
-rw-r--r--vms/collect_deps.com89
-rw-r--r--vms/cvthelp.tpu182
-rw-r--r--vms/descrip.mms358
-rw-r--r--vms/descrip_deps.mms207
-rw-r--r--vms/descrip_mkdeps.mms247
-rw-r--r--vms/descrip_src.mms373
-rw-r--r--vms/find_bzip2_lib.com71
-rw-r--r--vms/hlp_lib_next.com17
-rw-r--r--vms/install_vms.txt158
-rw-r--r--vms/mod_dep.com33
-rw-r--r--vms/osdep.h178
-rw-r--r--vms/stream_lf.fdl3
-rw-r--r--vms/unixio_gcc.h27
-rw-r--r--vms/unixlib_gcc.h16
-rw-r--r--vms/vms.c1007
-rw-r--r--vms/vms.h354
-rw-r--r--vms/vms_im.c926
-rw-r--r--vms/vms_msg_gen.c91
-rw-r--r--vms/vms_pk.c600
-rw-r--r--vms/vmsdefs.h320
-rw-r--r--vms/vmsmunch.c434
-rw-r--r--vms/vmsmunch.h55
-rw-r--r--vms/vmszip.c1444
-rw-r--r--vms/zip.opt1
-rw-r--r--vms/zip_cli.cld168
-rw-r--r--vms/zip_cli.help1636
-rw-r--r--vms/zip_msg.msg57
-rw-r--r--vms/zipup.h56
33 files changed, 13470 insertions, 0 deletions
diff --git a/vms/NOTES.TXT b/vms/NOTES.TXT
new file mode 100644
index 0000000..4f94ec3
--- /dev/null
+++ b/vms/NOTES.TXT
@@ -0,0 +1,382 @@
+ VMS Notes for Info-ZIP Zip 3.0 and UnZip 6.0
+ ============================================
+
+ This document describes some VMS-specific behavior and implementation
+details of the Info-ZIP Zip and UnZip programs.
+
+ Last modified: 2008-04-10.
+
+
+ Command-line Case
+ -----------------
+
+ Zip and UnZip now include code which can preserve the case of
+command-line parameters and options, which obviates quoting upper-case
+options like "-V" or "-Z". This works on non-VAX systems with a
+sufficiently recent C RTL, and SET PROCESS /PARSE_STYLE = EXTENDED.
+(Sufficiently recent here means __CRTL_VER >= 70301000, which includes
+VMS V7.3-1 with a C Run Time Library ECO, or V7.3-2 or newer.) This
+code uses the decc$feature_set_value() function to enable the
+DECC$ARGV_PARSE_STYLE feature. There is a small range of C RTL versions
+where this function is unavailable, but where manually setting the
+logical name DECC$ARGV_PARSE_STYLE to "ENABLE" will work. HELP CRTL
+leads to some additional information on these features.
+
+
+ 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.
+
+ 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.
+
+ UnZip should preserve case when it extracts to an ODS5 destination
+disk (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.
+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
+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
+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
+used to extract that archive onto an ODS5 destination. Normally, things
+will work regardless of such case changes, but there may be some
+untested combinations of unexpected name cases and quirky MMS (or MMK)
+behavior, where something goes wrong. Complaints are always welcome,
+but it may not be possible to get everything to work as expected with
+every version of VMS, MMS (or MMK), Zip, and UnZip, on every file
+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
+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.)
+
+ Symlink support can be disabled at build-time, if desired, by
+defining the C macro NO_SYMLINKS. (See comments in the builder
+regarding LOCAL_UNZIP or LOCAL_ZIP, as appropriate.) For example, using
+MMS to build UnZip:
+
+ MMS /DESCRIP = [.VMS] /MACRO = ("LOCAL_UNZIP=NO_SYMLINKS=1")
+
+or, using the command procedure to build Zip:
+
+ LOCAL_ZIP == "NO_SYMLINKS=1"
+ @ [.VMS]BUILD_ZIP.COM
+ DELETE /SYMBOL /GLOBAL LOCAL_ZIP
+
+ The Zip "-v" (/VERBOSE) report should include SYMLINK_SUPPORT in its
+list of "Zip special compilation options" if Zip was built with symlink
+support. Currently, UnZip is less convenient, but searching the UnZip
+executable (or EXTRACT.OBJ) for "symlink" should fail if symlink support
+is missing (or succeed if it's present):
+
+ $ SEARCH /NOOUTPUT UNZIP.EXE SYMLINK ! No symlink support.
+ %SEARCH-I-NOMATCHES, no strings matched
+or:
+ $ SEARCH /NOOUTPUT EXTRACT.OBJ SYMLINK ! Symlink support.
+ $ SHOW SYMBOL $STATUS
+ $STATUS == "%X00000001"
+
+
+ File I/O Performance
+ --------------------
+
+ When compiled using DEC/Compaq/HP C (not GNU C or VAX C), the Zip and
+UnZip file I/O code now includes access callback functions which are
+used to try to set some RMS parameters to non-default values, with the
+intention of improving file I/O speed. This affects reading an archive
+file in UnZip and writing one in Zip. (Reading and writing the
+individual data files are handled in more exotic ways, making these
+parameters less important for them.)
+
+ Currently, the built-in default parameters enable read-ahead and
+write-behind, using a multi-buffer count of 2, and a multi-block count
+of 127 (the maximum). For writing the archive, the default extend
+quantity is 16384 blocks (8MB), with truncation enabled. This
+combination is believed to be, at worst, fairly harmless for most
+situations, and, in most cases, to provide a substantial speed
+improvement, especially with large archives.
+
+ This code allows SET RMS_DEFAULT parameters to override the built-in
+default values. On some old VMS versions, sys$getjpi() can not provide
+the SET RMS_DEFAULT values, and in this situation, the callback function
+will not try to use its improved parameter values. Users on such old
+VMS versions who seek improved I/O speed may wish to bypass this check,
+which requires changing the code in the get_rms_defaults() function in
+[.VMS]VMS.C. The "-vv" (/VERBOSE = MORE) option on both programs
+enables diagnostic messages which show the operation of the callback
+function. A message showing a failure status from sys$getjpi()
+indicates this problem.
+
+ Sample results (UnZip shown, Zip similar):
+
+ VMS VAX V5.4, VAX C. Callback code disabled, no messages:
+ WIMP $ unzip -tvv TESTMAKE.ZIP
+ Archive: SYS$SYSDEVICE:[UTILITY.SOURCE.ZIP.UNZIP60C]TESTMAKE.ZIP;1
+ [...]
+
+ VMS VAX V5.5-2, DEC C. SYS$GETJPI() fails (%SYSTEM-F-BADPARAM):
+ WEAK $ unzip -tvv TESTMAKE.ZIP
+ Get RMS defaults. getjpi sts = %x00000014.
+ Archive: DUA1:[UTILITY.SOURCE.ZIP.UNZIP60C]TESTMAKE.ZIP;1
+ [...]
+
+ VMS VAX V7.3, DEC/Compaq C. Callback code works:
+ WUSS $ unzip -tvv TESTMAKE.ZIP
+ Get RMS defaults. getjpi sts = %x00000001.
+ Default: deq = 0, mbc = 0, mbf = 0.
+ Open callback. ID = 1, deq = 16384, mbc = 127, mbf = 2.
+ Archive: ALP$DKA0:[UTILITY.SOURCE.ZIP.UNZIP60C]TESTMAKE.ZIP;1
+ [...]
+
+ VMSV5.5-2 is too old. V7.3 is new enough. Anyone with more precise
+information is invited to contribute it.
+
+ 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 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.
+
+
+ Changes to the "-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.
+
+ 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)
+marker in a data file, but generally not all the disk blocks allocated
+for the file. When extracted on a VMS system, the result was usually
+acceptable (because the data from beyond the EOF marker were usually
+ignored). However, when extracted on a non-VMS system, the resulting
+file was usually corrupted by being NUL-padded to the next larger 16KB
+multiple in size.
+
+ Now (Zip 2.31 and later), with "-V" (/VMS), Zip truncates a data file
+at EOF, and portable-format files (Stream_LF, fixed-512) should be
+extracted properly on a non-VMS system. On a VMS system, well-formed
+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
+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.
+
+
+ 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.
+
+ Zip and UnZip now have facility names and codes assigned by HP
+(UnZip: IZ_UNZIP, 1954; Zip: IZ_ZIP, 1955). Now, by default, the
+programs exit with standard 32-bit VMS status values which differ from
+the old ones in several ways: The official facility code is used, and
+the facility-specific bit is set. (For compatibility with older
+versions, the internal status codes are still left-shifted by 4 bits.
+This also makes it easier to extract the internal status code from a
+hexadecimal representation of the VMS status code.) The builders also
+create non-executable message files (UNZIP_MSG.EXE and ZIP_MSG.EXE) so
+that, after a suitable SET MESSAGE command, the program messages will be
+available from DCL. For example:
+
+ $ SET MESSAGE dev:[dir]ZIP_MSG.EXE
+ $ ZIP FRED.ZIP no_such_file
+ zip warning: name not matched: no_such_file
+
+ zip error: Nothing to do!
+ (dev:[dir]FRED.ZIP;)
+
+ ALP $ WRITE SYS$OUTPUT F$MESSAGE( $STATUS)
+ %IZ_ZIP-W-NONE, Nothing to do
+
+The message files may be copied into SYS$MESSAGE to make them generally
+available, although this could cause some confusion if multiple versions
+of the programs are used on the system, and their error message source
+files differ. Each different destination directory will get its own
+UNZIP_MSG.EXE or ZIP_MSG.EXE ([.ALPHA], [.ALPHAL], [.VAX], and so on),
+but all of the same-architecture files are equivalent to each other.
+That is, on an Alpha system, any of the [.ALPHA*]ZIP_MSG.EXE files could
+be used; on an IA64 system, any of the [.IA64*]ZIP_MSG.EXE files could
+be used; and on a VAX system, any of the [.VAX*]ZIP_MSG.EXE files could
+be used. (Similar for UNZIP_MSG.EXE, of course.)
+
+ If desired, the programs may be built to use the old exit status values
+by defining a C macro with the old facility value:
+"CTL_FAC_IZ_UNZIP=0x7FFF" (UnZip) or "CTL_FAC_IZ_ZIP=0x7FFF" (Zip).
+(See comments in the builder regarding LOCAL_UNZIP or LOCAL_ZIP, as
+appropriate.) This will maintain compatibility with older program
+versions, but will make the programs incompatible with the new error
+message files.
+
+
+ VMS File Attribute Schemes
+ --------------------------
+
+ Zip's "-V" (/VMS) option causes VMS file attributes to be stored in
+an archive. Since Zip version 2.2 (released in 1996), Zip has, by
+default, stored VMS file attributes using a scheme ("PK") which is
+compatible with the one used by PKWARE in their PKZIP product. Before
+that, a different scheme ("IM") was used. UnZip versions before 5.2
+support only the older IM scheme, but since UnZip version 5.2, both
+schemes have been supported by UnZip.
+
+ The IM scheme has not been well tested recently, but it is still
+available. Some problems were seen when the IM scheme was used with
+symbolic links on VMS V8.3. Details on how build Zip to use the IM
+scheme instead of the PK scheme are included in comments in the main
+builder files. Look for VMS_IM_EXTRA in [.VMS]BUILD_ZIP.COM or IM in
+[.VMS]DESCRIP.MMS.
+
+ The "special compilation options" section of a "zip -v" ("zip
+/verbose") report should show either VMS_PK_EXTRA or VMS_IM_EXTRA,
+according to how Zip was built.
+
+
+ UTC Date-Times
+ --------------
+
+ Zip archives traditionally include local (MS-DOS compatible)
+date-time information for files. Since Zip version 2.1, it has also
+been possible to store UTC date-time information in the archive, and
+since UnZip version 5.2, UnZip has been able to use this UTC date-time
+information when extracting files.
+
+ On VMS, support in the C run-time environment for UTC became
+available with VMS V7.0. UTC support in Zip and UnZip is automatically
+enabled at compile time, if it is available on the system where the code
+is compiled (__CRTL_VER >= 70000000). It may be disabled at compile
+time by defining the C macro NO_EF_UT_TIME. Details on how build Zip
+and UnZip with additional C macros defined are included in comments in
+the main builder files. Look for LOCAL_[UN]ZIP in
+[.VMS]BUILD_[UN]ZIP.COM or in [.VMS]DESCRIP.MMS. For example, using MMS
+to build UnZip:
+
+ MMS /DESCRIP = [.VMS] /MACRO = ("LOCAL_UNZIP=NO_EF_UT_TIME=1")
+
+or, using the command procedure to build Zip:
+
+ LOCAL_ZIP == "NO_EF_UT_TIME=1"
+ @ [.VMS]BUILD_ZIP.COM
+ DELETE /SYMBOL /GLOBAL LOCAL_ZIP
+
+ The "special compilation options" section of a "zip -v" ("zip
+/verbose") or "unzip -v" ("unzip /verbose") report should show
+USE_EF_UT_TIME if the program was built with UTC support.
+
+
+ Building with the LIST option using MMK or MMS
+ ----------------------------------------------
+
+ Currently, building with MMK or MMS using the LIST option (as in
+"/MACRO = LIST=1") may cause a failure for some old versions of the DEC
+C compiler. The LIST option currently adds "/show = (all, nomessages)"
+to the CC command line, and some old DEC C compilers do not support the
+"nomessages" keyword. When VAX C is used, this keyword is omitted, but
+the builder does not distinguish between the various DEC/Compaq/HP C
+versions. The work-arounds are to use BUILD_[UN]ZIP.COM, or edit
+[.VMS]DESCRIP_SRC.MMS to remove the troublesome keyword.
+
+
+ GNU C
+ -----
+
+ Zip and UnZip have been built using GNU C (VAX) version 2.3, mostly
+for fun, but serious users are encouraged to report any interest in
+continuing this activity. The GNU C 2.3 header files were missing some
+things, including definitions of SEEK_CUR, SEEK_END, and SEEK_SET. The
+VMS-specific code now expects to find unixio.h and unixlib.h, which were
+absent from the GNU C 2.3 distribution.
+
+ To work around these difficulties, the Zip and UnZip kits include
+some emergency replacement unixio.h and unixlib.h files which appear to
+work for these programs, at least. To install them, use commands like
+the following:
+
+ COPY [.VMS]UNIXIO_GCC.H GNU_CC_INCLUDE:[000000]UNIXIO.H
+ COPY [.VMS]UNIXLIB_GCC.H GNU_CC_INCLUDE:[000000]UNIXLIB.H
+ SET PROTECTION W:RE GNU_CC_INCLUDE:[000000]UNIXIO.H, UNIXLIB.H
+
+ There may be an error in the GNU C header file ATRDEF.H which can
+cause Zip to fail, when making a "-V" archive, with a spurious "could
+not open for reading" error message, followed by more bad behavior. It
+probably also causes trouble of some kind in UnZip. To check the
+questionable macro definition, use a command like the following:
+
+ SEARCH GNU_CC_INCLUDE:[000000]ATRDEF.H ATR$S_JOURNAL
+
+This should show something equivalent to this:
+
+ #define ATR$S_JOURNAL 0x001
+
+If you see "0x002" (or equivalent) instead of "0x001" (or equivalent),
+then this value must be corrected in the file before building Zip or
+UnZip.
+
+ You may also see several warnings from the compiler caused by other
+defects in the GNU C header files, such as:
+
+<various>: warning: passing arg 4 of `qsort' from incompatible pointer type
+
+[...]rab.h:134: warning: unnamed struct/union that defines no instances
+[...]rab.h:143: warning: unnamed struct/union that defines no instances
+
+These warnings appear to be harmless.
+
diff --git a/vms/VMS_ZIP.RNH b/vms/VMS_ZIP.RNH
new file mode 100644
index 0000000..183ceea
--- /dev/null
+++ b/vms/VMS_ZIP.RNH
@@ -0,0 +1,1467 @@
+.!
+.! File: ZIP.RNH
+.!
+.! Author: Hunter Goatley
+.!
+.! Date: October 22, 1991
+.!
+.! Description:
+.!
+.! RUNOFF source file for portable ZIP on-line help for VMS.
+.! Adapted from MANUAL, distributed with ZIP.
+.!
+.! To build: $ RUNOFF ZIP.RNH
+.! $ LIBR/HELP/INSERT libr ZIP
+.!
+.! Modification history:
+.!
+.! Hunter Goatley 22-OCT-1991 20:45
+.! Genesis.
+.! Jean-loup Gailly 25 March 92
+.! Adaptation to zip 1.6.
+.! Igor Mandrichenko 9-JUN-1992
+.! Added explanation of -V option.
+.! Jean-loup Gailly 14 June 92
+.! Adaptation to zip 1.8.
+.! Jean-loup Gailly 20 Aug 92
+.! Adaptation to zip 1.9.
+.! Jean-loup Gailly 31 Aug 93
+.! Adaptation to zip 2.0.
+.! Christian Spieler 20 Sep 93
+.! Adaptation to zip 2.0 and OpenVMS completed.
+.! Christian Spieler 05 Dec 95
+.! Adaptation to zip 2.1, new options.
+.! Christian Spieler 20 Jan 96
+.! Changed -L and -v descriptions.
+.! Christian Spieler 11 Feb 96
+.! Added -X option.
+.! Onno van der Linden,
+.! Christian Spieler 13 Mar 96
+.! Removed -ee option.
+.! Christian Spieler 09 Feb 96
+.! Updated copyright notice, Zip version.
+.! Christian Spieler 21 Jul 97
+.! Added -P, -R, -i@, -x@ and -tt options, modified for Zip 2.2.
+.! Christian Spieler 14 Oct 97
+.! unified spelling of "Info-ZIP", final cleanups for 2.2.
+.! Steven Schweda 10 May 2007
+.! General update for version 3.0.
+.! Ed Gordon 12 May 2007
+.! Minor updates for version 3.0.
+.!
+.noflags
+.lm4 .rm72
+.indent -4
+1 ZIP
+.br
+Zip is a compression and file packaging utility for several operating
+systems, including UNIX, VMS, MSDOS, OS/2, Windows 9x/NT/XP, Minix, Atari,
+Macintosh, Amiga, and Acorn RISC OS. It is analogous to a combination of
+tar and compress and is compatible with PKZIP (Phil Katz's ZIP) for
+MSDOS systems.
+.sk
+Zip is useful for packaging a set of files for distribution, for
+archiving files, and for saving disk space by temporarily compressing
+unused files or directories. A companion program, UnZip, unpacks Zip
+archives.
+.sk
+For brief help on Zip or UnZip, run the program without specifying any
+parameters on the command line.
+.sk
+This description covers the Zip program which uses a UNIX-style command
+line. A separate program is available which provides a VMS-style CLI
+command line, and it has its own documentation. Refer to the Zip
+installation instructions for details.
+.sk
+Format
+.sk;.lm+2;.literal
+ZIP [-options] archive inpath inpath ...
+.end literal;.lm-2
+.!------------------------------------------------------------------------------
+.indent -4
+2 Basic_Usage
+.br
+Format
+.sk;.lm+2;.literal
+ZIP [-options] archive inpath inpath ...
+.end literal;.lm-2
+.sk
+The default action of Zip is to add or replace entries in "archive" from
+the list of "inpath" file specifications, which can include directories
+and file names with VMS-style wildcards, or the special name -@ to read
+file specifications from SYS$INPUT (stdin).
+.sk
+With SET PROCESS /PARSE_STYLE = EXTENDED (available on recent non-VAX
+systems), Zip preserves the case of the command line. Otherwise, mixed-
+or upper-case options and arguments must be quoted. For example,
+"-V". Examples in this document generally do not show this quotation,
+so VAX and /PARSE_STYLE = TRADITIONAL users (that is, troglodytes) will
+need to add quotation where needed when working with these examples.
+.sk
+General
+.sk
+Zip reads one or more files, compresses the data (normally), and stores
+the compressed information into a single Zip archive file, along with
+information about each file (name, path, date and time of last
+modification, protection, and check information to verify file
+integrity). On a VMS system, Zip can also save VMS/RMS file attributes,
+allowing UnZip to restore the files without loss of important file
+attributes. Zip can pack an entire directory structure into a Zip
+archive with a single command.
+.sk
+Compression
+.sk
+Compression ratios of 2:1 to 3:1 are common for text files. Zip has one
+standard compression method ("deflate") and can also store files without
+compression. Zip (and UnZip) may be built with optional support for the
+bzip2 compression method. Then, the user may select bzip2 compression
+instead of the default "deflate" method. Zip automatically chooses
+simple storage over compression for a file, if the specified compression
+method does not actually compress the data in that file.
+.sk
+Compatibility
+.sk
+Zip and UnZip can work with archives produced by PKZIP (supporting most
+PKZIP features up to PKZIP version 4.6), and PKZIP and PKUNZIP can work
+with archives produced by Zip (with some exceptions, notably streamed
+archives, but recent changes in the .ZIP file standard may facilitate
+better compatibility). Zip version 3.0 is compatible with PKZIP 2.04
+and also supports the Zip64 extensions of PKZIP 4.5 which allows
+archives as well as files to exceed the previous 2 GB limit (4 GB in
+some cases). Zip also supports bzip2 compression if the bzip2 library
+is included when Zip is built. Note that PKUNZIP 1.10 cannot extract
+files produced by PKZIP 2.04 or Zip 3.0. You must use PKUNZIP 2.04g or
+UnZip 5.0p1 (or later versions) to extract them.
+.sk
+Large Archives and Zip64
+.sk
+Where the operating system and C run-time support allow, Zip 3.0 and
+UnZip 6.0 (and later versions) support large files (input and archive),
+using the Zip64 extensions to the original .ZIP file format. On VMS,
+this genarally means non-VAX systems with VMS V7.2 or later (perhaps
+requiring a C RTL ECO before VMS V7.3-2).
+.sk
+Zip automatically uses the Zip64 extensions when a file larger than 2 GB
+is added to an archive, an archive containing a Zip64 entry is updated
+(if the resulting archive still needs Zip64), the size of the archive
+will exceed 4 GB, or when the number of entries in the archive will
+exceed about 64K. Zip64 is also used for archives streamed to a
+non-seekable output device. You must use a 4.5 compatible UnZip to
+extract files using the Zip64 extensions such as UnZip 6.0 or later.
+.sk
+In addition, streamed archives, entries encrypted with standard
+encryption, or split archives created with the pause option may not be
+compatible with PKZIP as data descriptors are used, and PKZIP at the
+time of this writing does not support data descriptors (but recent
+changes in the PKWare published .ZIP file standard now include some
+support for the data descriptor format Zip uses).
+.!------------------------------------------------------------------------------
+.indent -4
+2 More_Usage
+.br
+Here is a very simple example of Zip use:
+.sk;.indent 10;
+$ zip stuff.zip *.*
+.sk
+This will create the Zip archive "stuff.zip" (assuming it does not
+already exist) and put all the (non-directory) files (";0") from the
+current default directory into "stuff.zip" in a compressed form. The
+archive is opened using a default file specification of
+"SYS$DISK:[].zip", so specifying "stuff" as the archive name would also
+create (or use an existing) "stuff.zip", but specifying "stuff.other"
+would give you that name. In general, Zip doesn't care about the type
+in the file specification, but for split archives (archives split over
+multiple files), the user should normally specify a type-less name,
+because Zip will normally generate sequentially numbered types ".z01",
+".z02", and so on for the early splits, and then the required ".zip" for
+the last split. These file types are required by the Zip standard for
+split archives.
+.sk
+Standard VMS wildcard expansion ($SEARCH) is used to interpret the
+"inpath" file and directory specifications, like the "*.*" in this
+example.
+.sk
+On VMS, the most natural way to archive an entire directory tree is to
+use a directory-depth wildcard ("[...]"). For example:
+.sk;.indent 10
+zip foo [...]*.*
+.sk
+This will create the file "foo.zip" containing all the files (";0") and
+directories in and below the current default directory. A more
+UNIX-like way to do this would be to use the -r (--recurse-paths)
+option:
+.sk;.indent 10
+$ zip -r foo *.*
+.sk
+Zip avoids including its own output files when selecting files to
+include in the archive, so it should be safe, as in this case, to create
+the archive in the same drectory as the input files.
+.sk
+One or more specific files, directories, or subdirectories may also be
+specified:
+.lm +10;.literal
+zip foo.zip readme.txt [www...]*.* [.ftp...]*.* -
+ [.src]*.h [.src]*.c
+.end literal;.lm -10
+.sk
+For security reasons, paths in Zip archives are always stored as
+relative paths, so some care is needed when creating an archive so that
+it will create the intended directory structure when UnZip is used to
+unpack it.
+.sk
+To use -r with a specific directory, the name of the directory file
+itself must be specified:
+.sk;.indent 10
+zip -r foo.zip [000000]www.dir ftp.dir
+.sk
+You may want to make an archive that contains the files in [.foo], but not
+record the directory name, "foo". You can use the -j (junk path) option
+to leave off the path:
+.sk;.indent 10
+$ zip -j foo [.foo]*.*
+.sk
+If you are short on disk space, you might not have enough room to hold
+both the original directory and the corresponding compressed Zip
+archive. In this case, you can create the archive in steps, and use the
+-m option. For example, if [.foo] contains the subdirectories [.tom],
+[.dick], and [.harry], you could:
+.sk
+.lm +10;.literal
+zip -m foo [.foo.tom...]*.*
+zip -m foo [.foo.dick...]*.*
+zip -m foo [.foo.harry...]*.*
+.end literal;.lm -10
+.sk
+The first command would create foo.zip, and the next two would add to
+it. The -m option means "move", and it will cause Zip to delete all
+files added to the archive after making or updating foo.zip. No
+deletions will be done until the Zip operation has completed with no
+errors. This option is obviously dangerous and should be used with
+care, but it does reduce the need for free disk space. When -m is
+used, the -T option is recommended and will test the resulting archive
+before deleting the input files.
+.sk
+If a file specification list is too long to fit conveniently on the Zip
+command line, the -@ option can be used to cause Zip to read a list of
+file specifications from SYS$INPUT (stdin). If a DCL command procedure
+is used, the names can be specified in the procedure:
+.sk;
+.lm +10;.literal
+$ zip foo -@
+$ deck
+file_spec_1
+file_spec_2
+file_spec_3
+$ eod
+.end literal;.lm -10
+.sk
+The file specifications can also be put into a separate file, and fed
+into Zip by explicitly defining SYS$INPUT, or by using PIPE. For
+example, with the list in foo.zfl:
+.sk;
+.lm +10;.literal
+$ define /user_mode sys$input foo.zfl
+$ zip foo -@
+.end literal;.lm -10;
+or:
+.lm +10;.literal
+$ pipe type foo.zfl | zip foo -@
+.end literal;.lm -10
+.sk
+If Zip is not able to read a file, it issues a warning but continues.
+See the -MM option for more on how Zip handles patterns that are not
+matched and files that are not readable. If some files were skipped, a
+warning is issued at the end of the Zip operation noting how many files
+were read and how many skipped.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Comments
+.br
+One-line comments may be included in the archive for each file added,
+using the -c (--entry-comments) option. File operations (adding,
+updating) are done first, and the user is then prompted for a one-line
+comment for each file added or updated. Enter the comment followed by
+<Return>, or just <Return> for no comment.
+.sk
+A single multi-line comment may be included for the archive as a whole,
+using the -z (--archive-comment) option. UnZip (including UnZip SFX)
+will display this comment when it expands the archive. The comment is
+read from SYS$INPUT (stdin), and is terminated by the usual end-of-file
+character, CTRL/Z. As usual, in a DCL command procedure, these data can
+be included in-line in the procedure, or a user may DEFINE SYS$INPUT to
+a file to get the comment from that file. Where supported, the DCL PIPE
+command can also be used to redirect SYS$INPUT from a file.
+.sk
+Note that -z (--archive-comment) and -@ (read file specifications from
+SYS$INPUT (stdin)) can't be used together (successfully).
+.!------------------------------------------------------------------------------
+.indent -4
+2 Compression
+.br
+Zip can archive files with or without compression. The standard
+compression method ("deflate") is compatible with all UnZip versions
+(except really old ones that only understand the "store" method).
+Current Zip and UnZip versions may be built with optional support for
+the bzip2 compression method. (The bzip2 method can compress better,
+especially when compressing smaller files, but uses more CPU time, and
+requires an UnZip which includes the optional bzip2 support. See the
+installation instructions for details on adding bzip2 compression
+support at build time.)
+.sk
+Numeric compression level options control the effort put into data
+compression, with -1 being the fastest, and -9 giving the most
+compression.
+.sk
+Compression control options:
+.sk;.lm +10;.literal
+-Z mthd use compress method "mthd",
+--compression-method mthd "bzip2" or "deflate" (default)
+
+-0 (--store) no compression
+-1 (--compress-1) compression level 1
+-2 (--compress-2) compression level 2
+-3 (--compress-3) compression level 3
+-4 (--compress-4) compression level 4
+-5 (--compress-5) compression level 5
+-6 (--compress-6) compression level 6
+-7 (--compress-7) compression level 7
+-8 (--compress-8) compression level 8
+-9 (--compress-9) compression level 9
+.end literal;.lm -10
+.sk
+Normally, a file which is already compressed will not be compressed much
+further (if at all) by Zip, and trying to do it can waste considerable
+CPU time. Zip can suppress compression on files with particular types,
+specified as a colon- or semi-colon-separated list of file types:
+.sk;.indent 10
+-n type1[:type2[...]] (--suffixes type1[:type2[...]])
+.sk
+For example:
+.sk;.indent 10
+zip -n .bz2:.gz:.jpeg:.jpg:.mp3:.zip foo [.foo]*.*
+.sk
+will put everything (";0") from [.foo] into foo.zip, but will store any
+files that end in .bz2, .gz, .jpeg, .jpg, .mp3, or .zip, without trying
+to compress them.
+.sk
+The default type list is .Z:.zip:.zoo:.arc:.lzh:.arj, and the comparison
+is case-insensitive.
+.sk
+-9 (--compress-9) will override -n (--suffixes), causing compression to
+be attempted for all files.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Encryption
+.br
+Zip offers optional encryption, using a method which by modern standards
+is generally considered to be weak.
+.sk;.literal
+-e --encrypt
+.end literal;.br
+Encrypt new or updated archive entries using a password which is
+supplied by the user interactively on the terminal in response to a
+prompt. (The password will not be echoed.) If SYS$COMMAND is not a
+terminal, Zip will exit with an error. The password is verified before
+being accepted.
+.sk;.literal
+-P password --password password
+.end literal;.br
+Use "password" to encrypt new or updated archive entries (if any).
+USING -P IS INSECURE! Many multi-user operating systems provide ways
+for any user (or a privileged user) to see the current command line of
+any other user. Even on more secure systems, there is always the threat
+of over-the-shoulder peeking. Storing the plaintext password as part of
+a command line in a command procedure is even less secure. Whenever
+possible, use the non-echoing, interactive password entry method.
+.sk
+Because standard Zip encryption is weak, where security is truly
+important, use a strong encryption program, such as Pretty Good Privacy
+(PGP) or GNU Privacy Guard (GnuPG), on an archive instead of standard
+Zip encryption. A stronger encryption method, such as AES, is planned
+for Zip 3.1.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Exit_Status
+.br
+On VMS, Zip's UNIX-style exit values are mapped into VMS-style status
+codes with facility code 1955 = %x7A3, and with the inhibit-message
+(%x10000000) and facility-specific (%x00008000) bits set:
+.sk
+.literal
+ %x17A38001 normal exit
+ %x17A38000+ 16* Zip_error_code warnings
+ %x17A38002+ 16* Zip_error_code normal errors
+ %x17A38004+ 16* Zip_error_code fatal errors
+.end literal
+.sk
+Note that multiplying the UNIX-style Zip error code by 16 places it
+conveniently in the hexadecimal representation of the VMS exit code,
+"__" in %x17A38__s, where "s" is the severity code. For example, a
+truncated archive might cause Zip error code 2, which would be
+transformed into the VMS exit status %x17A38024.
+.sk
+The Zip VMS exit codes include severity values which approximate those
+defined by PKWARE, as shown in the following table:
+.literal
+
+ VMS Zip err
+ severity code Error description
+ ----------+---------+----------------------------------------------
+ Success 0 Normal; no errors or warnings detected.
+ Fatal 2 Unexpected end of archive.
+ Error 3 A generic error in the archive format was
+ detected. Processing may have completed
+ successfully anyway; some broken archives
+ created by other archivers have simple work-
+ arounds.
+ Fatal 4 Zip was unable to allocate memory for one or
+ more buffers during program initialization.
+ Fatal 5 A severe error in the archive format was
+ detected. Processing probably failed imme-
+ diately.
+ Error 6 Entry too large to be split with zipsplit.
+ Error 7 Invalid comment format.
+ Fatal 8 Zip -T failed or out of memory.
+ Error 9 The user aborted zip prematurely with con-
+ trol-C (or equivalent).
+ Fatal 10 Zip encountered an error while using a temp
+ file.
+ Fatal 11 Read or seek error.
+ Warning 12 Zip has nothing to do.
+ Error 13 Missing or empty zip file.
+ Fatal 14 Error writing to a file.
+ Fatal 15 Zip was unable to create a file to write to.
+ Error 16 Bad command line parameters.
+ Error 18 Zip could not open a specified file to read.
+ Fatal 19 Zip was built with options not supported on
+ this system
+ Fatal 20 Attempt to read unsupported Zip64 archive
+.end literal
+.!------------------------------------------------------------------------------
+.indent -4
+2 Extra_Fields
+.br
+The .ZIP file format allows some extra data to be stored with a file in
+the archive. For example, where local time zone information is
+available, Zip can store UTC date-time data for files. (Look for
+USE_EF_UT_TIME in a "zip -v" report.) On VMS, with -V or -VV, Zip will
+also store VMS-specific file attributes. These data are packaged as
+"extra fields" in the archive. Some extra fields are specific to a
+particular operating system (like VMS file attributes). Large files
+(bigger than 4GB) on any OS require an extra field to hold their 64-bit
+size data. Depending on the capabilities of the UnZip program used to
+expand the archive, these extra fields may be used or ignored when files
+are extracted from the archive.
+.sk
+Some extra fields, like UTC date-times or VMS file attributes, are
+optional. Others, like the Zip64 extra field which holds 64-bit sizes
+for a large file, are required.
+.sk
+The -X (--strip-extra) option suppresses the saving of any optional
+extra fields in the archive. (Thus, -X conflicts with -V or -VV.)
+.!------------------------------------------------------------------------------
+.indent -4
+2 Environment
+.br
+A user can specify default command-line options and arguments by
+defining an "environment variable" (that is, a logical name or DCL
+symbol), "ZIP_OPTS" or "ZIPOPT", to specify them. If both "ZIP_OPTS" and
+"ZIPOPT" are specified, the definition of "ZIPOPT" prevails.
+.sk
+The C RTL function getenv() is used to sense these variables, so its
+behavior determines what happens if both a logical name and a symbol are
+defined. As of VMS V7.3, a logical name supercedes a symbol.
+.sk
+The "zip -v" report should show the perceived settings of these
+variables.
+.!------------------------------------------------------------------------------
+.indent -4
+2 File_Names
+.br
+Zip deals with file names in the system file system and with file names
+in Zip archives. File names in a Zip archive are stored in a UNIX-like
+path-name format. For example, a VMS file specification like this:
+.sk;.indent 10
+[.zip30.vms]descrip.mms
+.sk
+could appear in a Zip archive as:
+.sk;.indent 10
+zip30/vms/descrip.mms
+.sk
+For security reasons, paths in Zip archives are always stored as
+relative paths, so an absolute VMS directory specification will be
+transformed to a relative path in the archive (that is, no leading "/").
+For example, the following absolute directory specification would give
+the same archive path as the previous (relative) example:
+.sk;.indent 10
+[zip30.vms]descrip.mms
+.sk
+Also, device names are dropped, so the following file specification
+would also give the same archive path:
+.sk;.indent 10
+sys$sysdevice:[zip30.vms]descrip.mms
+.sk
+If an archive is intended for use with PKUNZIP under MSDOS, then the -k
+(for "Katz", --DOS-names) option should be used to attempt to adjust the
+names and paths to conform to MSDOS character-set and length
+limitations, to store only the MSDOS file attributes (just the
+owner:write attribute from VMS), and to mark the entry as made under
+MSDOS (even though it wasn't).
+.sk
+Note that file specifications in the file system must be specified using
+VMS notation, but file names in an archive must be specified using the
+UNIX-like notation used in the archive. For example, where a BACKUP
+command might look like this:
+.sk.indent 10
+$ back [.zip30...]*.* /excl = [...vms]*.c stuff.bck /save
+.sk
+a corresponding Zip command might look like this:
+.sk;.indent 10;
+$ zip stuff.zip [.zip30...]*.* -x */vms/*.c
+.sk
+because the files to be added to the Zip archive are specified using VMS
+file specifications, but the -x (--exclude) option excludes names based
+on their archive path/file names. Options dealing with archive names
+include -R (--recurse-patterns), -d (--delete), -i (--include), -x
+(--exclude), and -U (--copy-entries).
+.sk
+Note: By default, on VMS, archive name pattern matching (-R, -d, -i, -x,
+and -U) is case sensitive, even when the file system is not case
+sensitive (or even case preserving). This allows accurate matching of
+mixed-case names in an archive which may have been created on a system
+with a case sensitive file system, but it can involve extra effort on
+VMS, where it may be necessary to use unnatural case names (or the same
+names in multiple cases, like "*.obj *.OBJ") for this kind of pattern
+matching to give the desired behavior. If completely case-blind pattern
+matching behavior is desired, specify the -ic (--ignore-case) option.
+.!------------------------------------------------------------------------------
+.indent -4
+3 Case
+.br
+For better compatibility with UNIX-like systems, Zip, by default,
+down-cases ODS2 file names. For example, the following file on an ODS2
+file system:
+.sk;.indent 10
+[.ZIP30.VMS]DESCRIP.MMS
+.sk
+would appear in an archive as:
+.sk;.indent 10
+zip30/vms/descrip.mms
+.sk
+Zip versions before 3.0 down-cased all VMS file names. Now, various
+options give the user control over these conversions:
+.sk
+.lm +10;.literal
+-C preserve case of all file names
+-C- down-case all file names
+-C2 preserve case of ODS2 names
+-C2- down-case ODS2 file names (default)
+-C5 preserve case of ODS5 names (default)
+-C5- down-case ODS5 file names
+.end literal;.lm -10
+.sk
+Case is handled differently for archive member names, which the user
+specifies with the -R, -d, -i, -x, and -U options. By default, on VMS,
+archive name pattern matching is case sensitive, even when the file
+system is not case sensitive (or even case preserving). This allows
+accurate matching of mixed-case names in an archive which may have been
+created on a system with a case sensitive file system, but it can
+involve extra effort on VMS, where it may be necessary to use unnatural
+case names (or the same names in multiple cases, like "*.obj *.OBJ") for
+this kind of pattern matching to give the desired behavior. If
+completely case-blind pattern matching behavior is desired, specify the
+-ic (--ignore-case) option.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Fixing_Damage
+.br
+Two options can be used to fix a damaged Zip archive.
+.sk;.literal
+-F --fix
+-FF --fixfix
+.end literal;.sk
+The -F (--fix) option can be used if some portions of the archive are
+missing, but it requires a reasonably intact central directory. The
+input archive is scanned as usual, but zip will ignore some problems.
+The resulting archive should be valid, but any inconsistent entries
+will be left out.
+.sk
+If the archive is too damaged or the end (where the central directory is
+situated) has been truncated, you must use -FF (--fixfix). This is a
+change from zip 2.32, where the -F option is able to read a truncated
+archive. The -F option now more reliably fixes archives with minor
+damage, and the -FF option is needed to fix archives where -F and -FF
+was used before.
+.sk
+With -FF, the archive is scanned from the beginning and Zip scans for
+special signatures to identify the limits between the archive members.
+The -F option is more reliable if the archive is not too much damaged,
+so try this option first.
+.sk
+Neither option will recover archives that have been incorrectly
+transferred, such as by FTP in ASCII mode instead of binary. After the
+repair, the -t option of UnZip may show that some files have a bad CRC.
+Such files cannot be recovered; you can remove them from the archive
+using the -d option of Zip.
+.sk
+Because of the uncertainty of the "fixing" process, it's required
+to specify an output archive, rather than risking further damage to the
+original damaged archive. For example, to fix the damaged archive
+foo.zip,
+.sk;.indent 10
+zip -F foo --out foo_fix
+.sk
+tries to read the entries normally, copying good entries to the new
+archive foo_fix.zip. If this doesn't work, as when the archive is
+truncated, or if some entries are missed because of bad central
+directory entries, try -FF:
+.sk;.indent 10
+zip -FF foo --out foo_fixfix
+.sk
+and compare the resulting archive to the archive created using -F. The
+-FF option may create an inconsistent archive. Depending on what is
+damaged, you can then use the -F option to fix that archive.
+.sk
+A split archive with missing split files can be fixed using -F if you
+have the last split of the archive (the ".zip" file). If this file is
+missing, you must use -FF to fix the archive, which will prompt you for
+the splits you have.
+.sk
+Currently, the fix options can't recover an entry which has a bad
+checksum or is otherwise damaged.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Log_File
+.br
+Zip normally sends messages to the user's terminal, but these may be
+also directed to a log file.
+.sk;.literal
+-la --log-append
+.end literal;.br
+Append to an existing log file. Default is to create a new version.
+.sk;.literal
+-lf logfilepath --logfile-path logfilepath
+.end literal;.br
+Open a logfile at the given path. By default, a new version will be
+created, but with the -la option an existing file will be opened and the
+new log information appended to any existing information. Only
+warnings and errors are written to the log unless the -li option is also
+given, then all information messages are also written to the log.
+.sk;.literal
+-li --log-info
+.end literal;.br
+Include information messages, such as file names being zipped, in the
+log. The default is to include only the command line, any warnings
+and errors, and the final status.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Modes_of_Operation
+.br
+Zip supports two distinct types of command modes, external and
+internal. The external modes (update, grow, and freshen) read files
+from the file system (as well as from an existing archive) while the
+internal modes (delete and copy) operate exclusively on entries in an
+existing archive.
+.sk;.literal
+-u --update
+.end literal;.br
+Update existing entries and add new files. If the archive does not
+exist, create it. This is the default mode, so -u is optional.
+.sk;.literal
+-g --grow
+.end literal;.br
+Grow (append to) the specified Zip archive, instead of creating a new
+one. If this operation fails, Zip attempts to restore the archive to
+its original state. If the restoration fails, the archive might become
+corrupted. This option is ignored when there's no existing archive or
+when at least one archive member must be updated or deleted.
+.sk;.literal
+-f --freshen
+.end literal;.br
+Update existing entries in an existing archive. Does not add new files
+to the archive.
+.sk;.literal
+-d --delete
+.end literal;.br
+Delete entries from an existing archive.
+.sk;.literal
+-DF --difference-archive
+.end literal;.br
+Create an incremental backup-style archive, where the resulting archive
+will contain all new and changed files since the original archive was
+created. For this to work, the input file list and current directory
+must be the same as during the original Zip operation.
+.sk
+For example, if the existing archive was created using
+.sk;.indent 10
+zip foo_full.zip [.foo...]*.*
+.sk
+from just above the foo directory, then the command (also from just
+above the foo directory):
+.sk;.indent 10
+zip foo_full.zip [.foo...]*.* -DF -O foo_incr.zip
+.sk
+creates the archive foo_incr.zip with just the files not in foo_full.zip
+and the files where the size or date-time of the files does not match
+that in foo_full.zip. Note that in the "zip -DF" operation, the
+original full archive is specified as the input archive, and the -O
+(--output-file) option is used to specify the new (incremental) output
+archive.
+.sk;.literal
+-FS --filesync
+.end literal;.br
+Delete entries in the archive that do not match files on the OS.
+Normally when an archive is updated, new files are added and changed
+files are updated but files that no longer exist on the OS are not
+deleted from the archive. This option enables deleting of entries that
+are not matched on the OS. Enabling this option should create archives
+that are the same as new archives, but since existing entries are copied
+instead of compressed, updating an existing archive with -FS can be much
+faster than creating a new archive. If few files are being copied from
+the old archive, it may be faster to create a new archive instead.
+.sk
+This option deletes files from the archive. If you need to preserve the
+original archive, make a copy of the archive first, or use the -O
+(--output) option to output the new archive to a new file. Even though
+it's slower, creating a new archive with a new archive name is safer,
+avoids mismatches between archive and OS paths, and is preferred.
+.sk;.literal
+-U --copy-entries
+.end literal;.br
+Select entries in an existing archive and copy them to a new archive.
+Copy mode is like update mode, but entries in the existing archive are
+selected by command line patterns rather than files from the file system
+and it uses the -O (--output-file) option to write the resulting archive
+to a new file rather than updating the existing archive, leaving the
+original archive unchanged.
+.sk
+Normally, when updating an archive using relative file specifications
+("[]", "[.xxx]", and so on), it helps to have the same default directory
+as when the archive was created, but this is not a strict requirement.
+.sk
+Date-time information in a Zip archive may be influenced by time zone.
+.!------------------------------------------------------------------------------
+.indent -4
+3 Examples
+.br
+When given the name of an existing archive, Zip will replace identically
+named entries in the archive or add entries for new names. For example,
+if foo.zip exists and contains foo/file1 and foo/file2, and the
+directory [.foo] contains the files file1 and file3, then:
+.sk;.indent 10
+$ zip foo [.foo...]*.*
+.sk
+will replace foo/file1 in foo.zip and add foo/file3 to foo.zip. After
+this, foo.zip contains foo/file1, foo/file2, and foo/file3, with foo/file2
+unchanged from before. This is the default mode -u (update).
+.sk
+Update will add new entries to the archive and will replace
+existing entries only if the modified date of the file is more recent than
+the date recorded for that name in the archive. For example:
+.sk;.indent 10
+$ zip -u stuff *.*
+.sk
+will add any new files in the current directory, and update any changed
+files in the archive stuff.zip. Note that Zip will not try to pack
+stuff.zip into itself when you do this. Zip avoids including its own
+output files when selecting files to include in the archive, so it
+should be safe, as in this case, to have the archive included in the
+list of input files.
+.sk
+A second mode, -f (freshen), like update will only
+replace entries with newer files. Unlike update, however, it will not
+add files that are not already in the archive. For example:
+.sk;.indent 10
+$ zip -f foo
+.sk
+Note that the -f option with no arguments freshens all the entries in the
+archive. The same is true of -u, so "zip -u foo" and "zip -f foo" do
+the same thing.
+.sk
+When these options are used, Zip should be run from the same directory
+as when the original Zip command was run, so that the path names in the
+archive will continue to agree with the path names in the file system.
+Normally, it's also a good idea to keep the other options the same (-V,
+-w, and the like), to keep the archive contents consistent.
+.sk
+The -t (--from-date) and -tt (--before-date) options can also be used
+with adding, updating, or freshening to restrict further the files to be
+included in the archive. For example:
+.sk;.indent 10
+$ zip -rt 12071991 infamy [.FOO]*.*
+.sk
+will add all the files in [.FOO] and its subdirectories that were last
+modified on December 7, 1991, or later to the achive infamy.zip. Dates
+can be in format mmddyyyy or yyyy-mm-dd.
+.sk
+Also, files can be explicitly excluded using the -x option:
+.sk;.indent 10
+$ zip -r foo [.FOO] -x *.obj
+.sk
+which will zip up the contents of [.FOO] into foo.zip but exclude all the
+files that end in ".obj".
+.sk
+The -d (delete) mode will remove entries from an
+archive. An example might be:
+.sk;.indent 10
+$ zip -d foo foo/harry/*.* *.obj
+.sk
+which will remove all of the files that start with "foo/harry/" and all of
+the files that end with ".obj" (in any path).
+.sk
+The last mode, -U (--copy-entries), selects entries from an existing
+archive and copies them to a new archive.
+.sk;.indent 10
+$ zip -U foo *.obj --out fooobj
+.sk
+will copy all .obj entries from foo.zip and put them in the new archive
+fooobj.zip.
+.sk
+Note: By default, on VMS, archive name pattern matching (-R, -d, -i, -x,
+and -U) is case sensitive, even when the file system is not case
+sensitive (or even case preserving). This allows accurate matching of
+mixed-case names in an archive which may have been created on a system
+with a case sensitive file system, but it can involve extra effort on
+VMS, where it may be necessary to use unnatural case names (or the same
+names in multiple cases, like "*.obj *.OBJ") for this kind of pattern
+matching to give the desired behavior. If completely case-blind pattern
+matching behavior is desired, specify the -ic (--ignore-case) option.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Options_List
+.br
+"zip -h" provides a concise list of common command-line options. "zip
+-h2" provides more details. "zip -so" provides a list of all available
+options. "zip -v" shows the program version and available features.
+(The list below was derived from a "zip -so" listing.)
+.sk
+Short-form options begin with a single hyphen ("-"). Long-form option
+begin with a double hyphen ("--"), and may be abbreviated to any
+unambiguous shorter string. For example:
+.lm +10;.literal
+-v
+--verbose
+--verb
+.end literal;.lm -10
+.sk
+To avoid confusion, if a negatable option contains an embedded hyphen
+("-"), then avoid abbreviating it at the hyphen if you plan to negate
+it. For example, if an option like --some-option were abbreviated to
+--some-, the parser would consider that trailing hyphen to be part of
+the option name, rather than as a negating trailing hyphen. This
+behavior may change in the future, to interpret the trailing hyphen in
+--some- to be negating. (So don't do it.)
+.sk
+Some options may be negated (or modified) by appending a "-":
+.lm +10;.literal
+-la-
+--show-files-
+.end literal;.lm -10
+.sk
+Some options take a value, which may immediately follow the option, or
+be separated by a space or "=". For example:
+.lm +10;.literal
+-ttmmddyyyy
+-tt mmddyyyy
+-tt=mmddyyyy
+.end literal;.lm -10
+.sk
+.lm -4;.literal
+ Sh Long Description
+----+-------------------+--------------------------------------------------
+ 0 store store (instead of compress)
+ 1 compress-1 compress faster (-2, -3, -4, ...)
+ 9 compress-9 compress better
+ ? show the Zip help screen
+ @ names-stdin read input file patterns from SYS$INPUT (1/line)
+ A adjust-sfx adjust self-extracting executable
+ b temp-path path use "path" directory for temporary files
+ C preserve-case preserve case of all file names added to archive
+ C- preserve-case- down-case all file names added to archive
+ C2 preserve-case-2 preserve case of ODS2 names added to archive
+ C2- preserve-case-2- down-case ODS2 file added to archive (default)
+ C5 preserve-case-5 preserve case of ODS5 names added to archive (dflt)
+ C5- preserve-case-5- down-case ODS5 names added to archive
+ c entry-comments add a comment for each entry added to archive
+ D no-dir-entries do not add archive entries for directories
+ DF difference-archive difference archive: add only changed or new files
+ d delete delete entries in archive
+ db display-bytes display running byte counts
+ dc display-counts display running file counts
+ dd display-dots display progress dots for files (dflt size = 10MB)
+ dg display-globaldots display progress dots for archive, not each file
+ ds dot-size size set progress dot interval to "size" (MB)
+ du display-usize display original uncompressed size for entries
+ dv display-volume display volume (disk) number as in_disk>out_disk
+ e encrypt encrypt entries, ask for password
+ F fix fix mostly intact archive (try F before FF)
+ FF fixfix salvage what can be salvaged (not as reliable)
+ FS filesync remove archive entries unmatched in file system
+ f freshen update existing entries (only changed files)
+ fd force-descriptors force data descriptors as if streaming
+ fz force-zip64 force use of Zip64 format
+ g grow grow existing archive (unless updating or deleting)
+ H show the Zip help screen
+ h help show the Zip help screen
+ h2 more-help show extended Zip help
+ i include pat1 [pat2 [...]] include only names matching the patterns
+ ic ignore-case ignore case (case-blind archive entry name matching)
+ J junk-sfx junk (remove) archive preamble (unzipsfx)
+ j junk-paths junk (don't store) directory names, only file names
+ k DOS-names simulate PKZIP-made archive (DOS 8.3 names)
+ L license show software license
+ l to-crlf translate end-of-lines (LF -> CRLF)
+ la log-append append to existing log file
+ lf logfile-path lfile log to log file at lfile (default: new version)
+ li log-info include informational messages in log
+ ll from-crlf translate end-of-lines (CRLF -> LF)
+ MM must-match input file spec must exist (wildcards must match)
+ m move delete files added to archive
+ n suffixes sfx1[:sfx2[...]] don't compress files with these suffixes
+ nw no-wild no wildcards during add or update
+ O output-file ozf use "ozf" as the output archive (dflt = inp archive)
+ o latest-time set archive date-time to match oldest entry
+ P password password encrypt with supplied "password" string
+ q quiet quiet operation (no info messages)
+ R recurse-patterns recurse into subdirs from cur dir, match names only
+ r recurse-paths recurse into directories from specified path pats
+ s split-size size split archive at "size" (K/MB) (0: don't split)
+ sb split-bell ring terminal bell at pause for split medium change
+ sc show-command show command line
+ sd show-debug show debug messages
+ sf show-files show files to process (only)
+ so show-options show list of all command-line options
+ sp split-pause pause to select split destination(s)
+ sv split-verbose be verbose about creating splits
+ T test test archive integrity (runs UnZip -T)
+ t from-date mmddyyyy only do files since (at or after) "mmddyyyy"
+ tt before-date mmddyyyy only do files before "mmddyyyy"
+ u update update changed files, add new files (default mode)
+ V VMS-portable save VMS file attributes
+ VV VMS-specific save VMS file attributes and all allocated blocks
+ v verbose verbose messages (print version info if only arg)
+ w VMS-versions save VMS version numbers in archive
+ ww VMS-dot-versions save VMS version numbers as ".nnn", not ";nnn"
+ X strip-extra strip all but critical extra fields
+ X- strip-extra- keep all extra fields
+ x exclude pat1 [pat2 [...]] exclude all names matching the patterns
+ Z compression-method mthd use compress method "mthd" (bzip2 or deflate)
+ z archive-comment ask for archive comment
+.end literal;.lm +4
+.!------------------------------------------------------------------------------
+.indent -4
+2 Miscellaneous_Options
+.sk;.literal
+-D --no-dir-entries
+.end literal;.br
+Do not create entries in the archive for directories. By default,
+directory entries are added to an archive, so that their attributes can
+be saved in the archive. When an archive is created using -D, UnZip
+will still create directories as needed (subject to user control), but
+they will get the default attributes (date-time, permissions, ...) on
+the destination system, rather than their original atributes.
+.sk;.literal
+-MM --must-match
+.end literal;.br
+All input patterns must match at least one file and all input files
+found must be readable. Normally when an input pattern does not match
+a file the "name not matched" warning is issued and when an input
+file has been found but later is missing or not readable a "missing or
+not readable" warning is issued. In either case Zip continues
+creating the archive, with missing or unreadable new files being skipped
+and files already in the archive remaining unchanged. After the
+archive is created, if any files were not readable zip returns the OPEN
+error code (18 on most systems) instead of the normal success return (0
+on most systems). With -MM, Zip exits as soon as an input pattern
+is not matched (whenever the "name not matched" warning would be issued)
+or when an input file is not readable. In either case Zip exits with
+an OPEN error and no archive is created.
+.sk
+This option is useful when a known list of files is to be zipped so any
+missing or unreadable files should result in an error. It may be less
+useful when used with wildcards, but Zip will still exit with an error
+if any input pattern doesn't match at least one file or if any
+matched files are unreadable. If you want to create the archive anyway
+and only need to know if files were skipped, then don't use -MM and just
+check the exit status. Also, a log file (see -lf (--logfile-path))
+could be useful.
+.sk;.literal
+-O out_file --output-file out_file
+.end literal;.br
+Process the archive changes as usual, but instead of updating the
+existing archive, send the output to a new archive, "out_file". The
+output archive specified must be a different file from the input
+archive.
+.sk
+This option can be used to create updated split archives. It can
+also be used with -U to copy entries from an existing archive to
+a new archive. See the EXAMPLES section below.
+.sk
+Another use is converting zip files from one split size to
+another. For instance, to convert an archive with 700MB CD splits
+to one with 2GB DVD splits, can use:
+.sk;.indent 10
+zip -s 2g cd-split.zip --out dvd-split.zip
+.sk
+which uses copy mode. See -U below. Also:
+.sk;.indent 10
+zip -s 0 split.zip --out unsplit.zip
+.sk
+will convert a split archive to a single-file archive.
+.sk
+Copy mode will convert stream entries (using data descriptors and which
+may be incompatible with some unzip programs) to normal entries (which
+should be compatible with all unzip programs), except if standard
+encryption was used. For archives with encrypted entries, zipcloak
+will decrypt the entries and convert them to normal entries.
+.sk;.literal
+-o --latest-time
+.end literal;.br
+Set the modification date-time of the Zip archive file to the latest
+(newest) modification date-time found among the entries in the zip
+archive. This can be used without any other operations, if
+desired. For example:
+.sk;.indent 10
+zip -o foo
+.sk
+will change the modification date-time of foo.zip to the latest time of
+the entries in foo.zip.
+.sk;.literal
+-q --quiet
+.end literal;.br
+Quiet mode. Eliminates informational messages and comment prompts.
+This mode may be useful in command procedures, or if the Zip operation
+is being performed as a background task ("$ spawn/nowait zip -q foo
+*.c").
+.sk
+.sk;.literal
+-T --test
+.end literal;.br
+Test the integrity of a zip archive (the new one, if -O (--output-file)
+is specified). If the check fails, the old zip file is unchanged and
+(with the -m option) no input files are removed.
+.sk
+Implementation
+.br
+"zip -T" actually runs an "unzip -t" command to do the testing, so UnZip
+must be installed properly for this to work.
+.sk;.literal
+-TT unzip_cmd --unzip-command unzip_cmd
+.end literal;.br
+Specify the actual UnZip command, "unzip_cmd" (normally a DCL symbol) to
+use for "zip -T". This can be useful if multiple versions of UnZip are
+installed on a system, and the default DCL symbol "UNZIP" would run the
+wrong one (or the logical name DCL$PATH would lead to the wrong one).
+.sk
+In "unzip_cmd", the string "{}" is replaced by the temporary name of the
+archive to be tested, otherwise the name of the archive is appended
+to the end of the command. The exit status is checked for success severity.
+.sk;.literal
+-v --verbose
+.end literal;.br
+Verbose mode or print diagnostic version info.
+.sk
+Normally, when applied to real operations, this option enables the
+display of a progress indicator during compression (see -dd for more on
+dots) and requests verbose diagnostic info about archive structure
+oddities.
+.sk
+When -v is the only command line argument, a diagnostic report is
+displayed, showing:
+.lm +3;.br;.indent -2
+o Copyright and other legal notices
+.br;.indent -2
+o Program name, version, and release date
+.br;.indent -2
+o Pointers to Info-ZIP FTP and Web sites
+.br;.indent -2
+o Program build information (compiler type and version, OS version, and
+the compilation date
+.br;.indent -2
+o Optional features enabled at compile-time
+.br;.indent -2
+o Environment variable definitions (ZIP_OPTS, ZIPOPT)
+.lm -3;.br
+.sk
+This information should be included in bug reports.
+.sk;.literal
+-y --symlinks
+.end literal;.br
+Store symbolic links as such in the Zip archive, instead of compressing
+and storing the file referred to by the link. A symbolic link normally
+requires less storage than the actual file, both in the archive, and on
+the destination file system.
+.sk
+On VMS, symbolic links are supported on ODS5 disks where the C RTL
+supports symbolic links. Full support for symbolic links seems to
+require VMS V8.3, but a Zip program supporting symbolic links may be
+built on VMS V7.3-2.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Progress_Display
+.br
+Various options control the display of progress messages during Zip
+operation.
+.sk;.literal
+-db --display-bytes
+.end literal;.br
+Display running byte counts showing the bytes processed and the bytes to
+go.
+.sk;.literal
+-dc --display-counts
+.end literal;.br
+Display running count of entries processed and entries to go.
+.sk;.literal
+-dd --display-dots
+.end literal;.br
+Display dots while each entry is processed (except on ports that have
+their own progress indicator). See -ds below for setting dot size. The
+default is a dot every 10 MB of input file processed. The -v
+(--verbose) option also displays dots and used to at a higher rate than
+this (at the same rate as in previous versions of Zip) but this rate has
+been changed to the new 10 MB default, and is also controlled by -ds.
+.sk;.literal
+-dg --display-globaldots
+.end literal;.br
+Display progress dots for the archive instead of for each file. The
+command
+.sk;.indent 10
+zip -qdgds 10m
+.sk
+will turn off most output except dots every 10 MB.
+.sk;.literal
+-ds size --dot-size size
+.end literal;.br
+Set amount of input file processed for each dot displayed. See -dd to
+enable displaying dots. Setting this option implies -dd. "size" is in
+the format "nm" where n is a number and m is a multiplier. Currently
+"m" can be k (KB), m (MB), g (GB), or t (TB), so if "n" is 100 and "m"
+is k, "size" would be 100k which is 100KB. The default is 10MB.
+.sk
+The -v (--verbose) option also displays dots and used to default to a
+higher rate than this (at the same rate as in previous versions of Zip)
+but now the default is 10 MB and the -v dots are also controlled by this
+option. A "size" of 0 turns dots off.
+.sk
+This option does not control the dots from the "Scanning files" message
+as Zip scans for input files. The dot size for that is fixed at 2
+seconds or a fixed number of entries, whichever is longer.
+.sk;.literal
+-du --display-usize
+.end literal;.br
+Display the uncompressed size of each entry.
+.sk;.literal
+-dv --display-volume
+.end literal;.br
+Display the volume (disk) number each entry is being written to.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Self_Extracting_Archives
+.br
+A self-extracting archive (SFX) comprises a normal Zip archive appended
+to a special UnZip program (such as UNZIPSFX.EXE) for the intended
+target system.
+.sk
+The UnZip distribution includes a VMS command procedure,
+[,vms]makesfx.com, which can be used directly or adapted to create an
+SFX archive from a normal Zip archive.
+.sk
+The .ZIP file format includes offsets to data structures in the archive,
+and these offsets are measured from the start of the archive file.
+Appending an archive to an UnZip SFX executable effectively moves the
+start of the archive file. That makes the original offsets wrong, and
+that will cause the UnZip SFX program to emit warning messages when it
+tries to unpack the archive. Zip -A can be used to adjust these offsets
+in a self-extracting archive. For example, to adjust the offsets in
+foo.sfx_exe:
+.sk;.indent 10
+zip -A foo.sfx_exe
+.sk
+Similarly, the UnZip SFX program can be removed from a self-extracting
+archive (and the offsets in the archive restored) using the -J
+(--junk-sfx) option. For example:
+.sk;.indent 10
+zip -J foo.sfx_exe
+.sk
+Note that a self-extracting archive contains a normal Zip archive, and a
+normal UnZip program can be used to expand it in the normal way. You
+may get a warning about extra bytes at the beginning of the archive (the
+UnZip SFX program), but UnZip should work properly after that. This
+allows data in a self-extracting archive to be accessed on any system,
+not just the target system where its embedded UnZip SFX program runs.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Split_Archives
+.br
+Beginning with version 3.0, Zip supports split archives. A split
+archive is one which is divided into multiple files, usually to allow it
+to be stored on multiple storage media (floppy diskettes, CD-ROMs, or
+the like) when a single medium would be too small to contain the whole
+archive. (Note that split archives are not just unitary archives split
+into pieces, as the .ZIP file format includes offsets to data structures
+in the archive, and for a split archive these are based on the start of
+each split, not on the start of the whole archive. Concatenating the
+pieces will invalidate these offsets, but UnZip can usually deal with
+it. Zip will usually refuse to process such a spliced archive unless
+the -FF fix option is used to fix the offsets.)
+.sk
+For a split archive with, say, 20 split files, the files are typically
+named ARCHIVE.z01, ARCHIVE.z02, ..., ARCHIVE.z19, ARCHIVE.zip, where
+"ARCHIVE" is the archive name specified by the user on the Zip command
+line. Note that the last split file is the ".zip" file. In contrast,
+"spanned" archives are the original multi-disk archive generally
+requiring floppy disks and using volume labels to store disk numbers.
+Zip supports split archives but not spanned archives, though a procedure
+exists for converting split archives of the right size to spanned
+archives. The reverse is also true, where each file of a spanned
+archive can be copied in order to files with the above names to create a
+split archive.
+.!------------------------------------------------------------------------------
+.indent -4
+3 Options
+.br
+Use "-s size" to create a split archive (and to set the split size).
+The size is given as a number followed optionally by a multiplier suffix
+of k (KB), m (MB, the default if no suffix is specified), g (GB), or t
+(TB). (All are powers of 1024, not 1000). 64K is the minimum split
+size. For example, the following command could be used to create a
+split archive called "foo" from the contents of the "bar" directory with
+splits of 670MB, which might be useful for burning on CDs:
+.sk;.indent 10
+zip -s 670m foo [.bar...]*.*
+.sk
+Using -s without -sp as above creates all the splits in the directory
+specified by "foo", in this case the current default directory. This
+split mode updates the splits as the archive is being created, requiring
+all splits to remain writable, but creates split archives that are
+readable by any UnZip that supports split archives. See -sp below for
+enabling split pause mode which allows splits to be written directly to
+removable media.
+.sk
+The -sv option can be used to enable verbose splitting and display
+details of how the splitting is being done. The -sb option can be used
+to ring the terminal bell when Zip pauses for the next split
+destination.
+.sk
+The -sp option can be used to pause Zip between splits to allow
+changing removable media, for example, but read the descriptions and
+warnings for both -s and -sp below.
+.sk
+Though Zip does not update split archives, Zip provides the option
+-O (--output-file) to allow split archives to be updated and saved in a
+new archive. For example:
+.sk;.indent 10
+zip inarchive.zip foo.c bar.c -O outarchive.zip
+.sk
+reads archive inarchive.zip, even if split, adds the files foo.c and
+bar.c, and writes the resulting archive to outarchive.zip. If
+inarchive.zip is split, then outarchive.zip defaults to the same split
+size. Be aware that outarchive.zip and any split files that are created
+with it are always overwritten without warning. This may be changed in
+the future.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Temporary_Files
+.br
+When creating a new archive or normally when changing an existing
+archive, Zip will write a temporary file in the archive destination
+directory ("ZIxxxxxxxx", where "xxxxxxxx" is the hexadecimal process ID)
+with the new contents. Then, if and when the Zip job has completed with
+no errors, it will rename the temporary file to the specified archive
+name (replacing the old archive, if any).
+.sk
+You can use the -b (--temp-path) option to specify a different path
+(device and/or directory) for the temporary file, but specifying a
+different device will force Zip to copy the temporary file to its final
+destination instead of simply renaming it, and that copying will take
+more time than renaming, especially for a large archive. For example:
+.sk;.indent 10
+$ zip -b disk$scratch:[tmp] stuff *
+.sk
+will cause Zip to put its temporary files in the directory
+"disk$scratch:[tmp]", copying the temporary file back to the current
+directory as stuff.zip when it's complete.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Text_Files
+.br
+Zip offers some options to help deal with line endings in text files.
+These may have limited utility on VMS.
+.sk;.literal
+-l --to-crlf
+.end literal;.br
+Translate the UNIX end-of-line character LF (CR on MAC) into the MSDOS
+convention CR-LF. This option should not be used on binary files. This
+option can be used on UNIX if the Zip file is intended for PKUNZIP under
+MSDOS. If the input files already contain CR-LF, this option adds an
+extra CR. This ensure that "unzip -a" on Unix will get back an exact
+copy of the original file, to undo the effect of "zip -l". See -ll
+below for the binary checks.
+.sk;.literal
+-ll --from-crlf
+.end literal;.br
+Translate the MSDOS end-of-line CR LF into UNIX LF (CR on MAC). This
+option should not be used on binary files. This option can be used on
+MSDOS if the Zip archive is intended for UnZip under UNIX.
+.sk
+For both -l and -ll, if the file is converted and the file is later
+determined to be binary, a warning is issued and the file is probably
+corrupted. If Zip with -l or -ll detects binary (non-text) in the first
+buffer read from a file, it issues a warning and skips line-ending
+conversion on the file, avoiding corruption. This check seems to catch
+all binary files tested, but the original check remains and if a
+converted file is later determined to be binary, that warning is still
+issued. The algorithm now being used for binary detection should allow
+line-ending conversion of text files in UTF-8 and similar encodings.
+.!------------------------------------------------------------------------------
+.indent -4
+2 VMS_Specifics
+.br
+VMS File Attributes
+.sk;.literal
+-V --VMS-portable
+-VV --VMS-specific
+.end literal;.br
+The -V and -VV options cause Zip to store VMS file atributes (such as
+file organization, record format, carriage control, and so on) in
+VMS-specific "extra fields" in an archive along with the usual data.
+These extra fields are ignored on non-VMS systems, but on a VMS system,
+they allow UnZip to restore the files with their VMS attributes intact.
+.sk
+With -V, Zip ignores any data in the file after the end-of-file (EOF)
+point (defined by FAT$L_EFBLK and FAT$W_FFBYTE), which works well for
+well-formed files (that is, those with no valid data beyond EOF).
+Portable-format files (Stream_LF, fixed-512) archived with -V should be
+extracted properly on a non-VMS system. Files with more complex
+structures, such as indexed files and files with embedded byte counts
+or other such data may be of limited use on other systems. (UnZip on
+non-VMS systems may be able to extract various VMS-format text files,
+however.)
+.sk
+With -VV, Zip processes 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.
+.sk
+VMS File Version Numbers
+.sk;.literal
+-w --VMS-versions
+-ww --VMS-dot-versions
+.end literal;.br
+By default, for compatibility with non-VMS systems, Zip strips VMS file
+version numbers from the names stored in an archive. The -w
+(--VMS-versions) option causes Zip to retain file version numbers on
+names in an archive. Without -w, a version number wildcard (";*") can
+cause errors when multiple versions of a single file are treated as
+multiple files with the same name.
+.sk
+For better compatibility with non-VMS systems where semi-colons are less
+popular in file names, the -ww (--VMS-dot-versions) option stores the
+file version numbers with a dot (".nnn") instead of a semi-colon
+(";nnn").
+.!------------------------------------------------------------------------------
+.indent -4
+2 Copyright_and_License
+.br
+Zip has an option to display its copyright and license.
+.sk;.literal
+-L --license
+.end literal;.br
+The license is reproduced below.
+.sk.lm +3
+This is version 2007-Mar-4 of the Info-ZIP license. The definitive
+version of this document should be available at
+ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and a copy
+at http://www.info-zip.org/pub/infozip/license.html.
+.lm -3;.sk
+--------------------------------------------------------
+.sk
+Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+.sk
+For the purposes of this copyright and license, "Info-ZIP" is defined as
+the following set of individuals:
+.sk;.lm +3
+ 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.
+.lm -3;.sk
+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.
+.sk
+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:
+.sk;.lm +7;.indent -4
+ 1. Redistributions of source code (in whole or in part) must retain
+ the above copyright notice, definition, disclaimer, and this list
+ of conditions.
+.sk;.indent -4
+ 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. 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.
+.sk;.indent -4
+ 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.
+.sk;.indent -4
+ 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.
+.lm -7;.sk
+.!------------------------------------------------------------------------------
+.indent -4
+2 Acknowledgements
+.br
+ Thanks to R. P. Byrne for his Shrink.Pas program, which
+ inspired this project, and from which the shrink algorithm
+ was stolen; to Phil Katz for placing in the public domain
+ the zip file format, compression format, and .ZIP filename
+ extension, and for accepting minor changes to the file
+ format; to Steve Burg for clarifications on the deflate
+ format; to Haruhiko Okumura and Leonid Broukhis for providing
+ some useful ideas for the compression algorithm; to
+ Keith Petersen, Rich Wales, Hunter Goatley and Mark Adler
+ for providing a mailing list and ftp site for the Info-ZIP
+ group to use; and most importantly, to the Info-ZIP group
+ itself (listed in the file infozip.who) without whose
+ tireless testing and bug-fixing efforts a portable zip
+ would not have been possible. Finally we should thank
+ (blame) the first Info-ZIP moderator, David Kirschbaum,
+ for getting us into this mess in the first place.
+.!------------------------------------------------------------------------------
+.indent -4
+2 Bugs
+.br
+All bug reports, patches, or suggestions should go to zip-bugs via the
+web site contact form at http://www.Info-ZIP.org. Patches should be
+sent as unified or context diffs only (diff -u or diff -c).
+.sk
+Any bug report should include the Zip version, any special compilation
+options (see "zip -v" report), the host system type and operating system
+version, and any other relevant information (compiler version, lunar
+phase, ...).
+.!------------------------------------------------------------------------------
diff --git a/vms/build_zip.com b/vms/build_zip.com
new file mode 100644
index 0000000..7bbe13d
--- /dev/null
+++ b/vms/build_zip.com
@@ -0,0 +1,690 @@
+$! BUILD_ZIP.COM
+$!
+$! Build procedure for VMS versions of Zip.
+$!
+$! last revised: 2007-03-15 SMS.
+$!
+$! Command arguments:
+$! - suppress help file processing: "NOHELP"
+$! - suppress message file processing: "NOMSG"
+$! - select link-only: "LINK"
+$! - select compiler environment: "VAXC", "DECC", "GNUC"
+$! - 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
+$! 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
+$! 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 zip:
+$! "VMSCLI" or "CLI"
+$! - force installation of UNIX interface version of zip
+$! (override LOCAL_ZIP environment): "NOVMSCLI" or "NOCLI"
+$! - 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
+$! example), or in that directory itself.
+$!
+$! To specify additional options, define the global symbol
+$! LOCAL_ZIP as a comma-separated list of the C macros to be
+$! defined, and then run BUILD_ZIP.COM. For example:
+$!
+$! $ LOCAL_ZIP == "VMS_IM_EXTRA"
+$! $ @ [.VMS]BUILD_ZIP.COM
+$!
+$! Valid VMS-specific options include VMS_PK_EXTRA and VMS_IM_EXTRA.
+$! See the INSTALL file for other options. (VMS_PK_EXTRA is the
+$! default.)
+$!
+$! If editing this procedure to set LOCAL_ZIP, be sure to use only
+$! one "=", to avoid affecting other procedures. For example:
+$! $ LOCAL_ZIP = "VMS_IM_EXTRA"
+$!
+$! Note: This command procedure always generates both the "default"
+$! Zip having the UNIX style command interface and the "VMSCLI" Zip
+$! having the CLI compatible command interface. There is no need to
+$! add "VMSCLI" to the LOCAL_ZIP symbol. (The only effect of
+$! "VMSCLI" now is the selection of the CLI style Zip executable in
+$! the foreign command definition.)
+$!
+$!
+$ on error then goto error
+$ on control_y then goto error
+$ OLD_VERIFY = f$verify( 0)
+$!
+$ edit := edit ! override customized edit commands
+$ say := write sys$output
+$!
+$!##################### Read settings from environment ########################
+$!
+$ if (f$type( LOCAL_ZIP) .eqs. "")
+$ then
+$ LOCAL_ZIP = ""
+$ else ! Trim blanks and append comma if missing
+$ LOCAL_ZIP = f$edit( LOCAL_ZIP, "TRIM")
+$ if (f$extract( f$length( LOCAL_ZIP)- 1, 1, LOCAL_ZIP) .nes. ",")
+$ then
+$ LOCAL_ZIP = LOCAL_ZIP + ","
+$ endif
+$ endif
+$!
+$! Check for the presence of "VMSCLI" in LOCAL_ZIP. If yes, we will
+$! define the foreign command for "zip" to use the executable
+$! containing the CLI interface.
+$!
+$ len_local_zip = f$length( LOCAL_ZIP)
+$!
+$ pos_cli = f$locate( "VMSCLI", LOCAL_ZIP)
+$ if (pos_cli .ne. len_local_zip)
+$ then
+$ CLI_IS_DEFAULT = 1
+$ ! Remove "VMSCLI" macro from LOCAL_ZIP. The Zip executable
+$ ! including the CLI interface is now created unconditionally.
+$ LOCAL_ZIP = f$extract( 0, pos_cli, LOCAL_ZIP)+ -
+ f$extract( pos_cli+7, len_local_zip- (pos_cli+ 7), LOCAL_ZIP)
+$ else
+$ CLI_IS_DEFAULT = 0
+$ endif
+$ delete /symbol /local pos_cli
+$!
+$! Check for the presence of "VMS_IM_EXTRA" in LOCAL_ZIP. If yes, we
+$! will (later) add "I" to the destination directory name.
+$!
+$ desti = ""
+$ pos_im = f$locate( "VMS_IM_EXTRA", LOCAL_ZIP)
+$ if (pos_im .ne. len_local_zip)
+$ then
+$ desti = "I"
+$ endif
+$!
+$ delete /symbol /local len_local_zip
+$!
+$!##################### Customizing section #############################
+$!
+$ zipx_unx = "ZIP"
+$ zipx_cli = "ZIP_CLI"
+$!
+$ CCOPTS = ""
+$ IZ_BZIP2 = ""
+$ LINKOPTS = "/notraceback"
+$ LINK_ONLY = 0
+$ LISTING = " /nolist"
+$ LARGE_FILE = 0
+$ MAKE_HELP = 1
+$ MAKE_MSG = 1
+$ MAY_USE_DECC = 1
+$ MAY_USE_GNUC = 0
+$!
+$! Process command line parameters requesting optional features.
+$!
+$ arg_cnt = 1
+$ argloop:
+$ current_arg_name = "P''arg_cnt'"
+$ curr_arg = f$edit( 'current_arg_name', "UPCASE")
+$ if (curr_arg .eqs. "") then goto argloop_out
+$!
+$ if (f$extract( 0, 5, curr_arg) .eqs. "CCOPT")
+$ then
+$ opts = f$edit( curr_arg, "COLLAPSE")
+$ eq = f$locate( "=", opts)
+$ CCOPTS = f$extract( (eq+ 1), 1000, opts)
+$ goto argloop_end
+$ endif
+$!
+$ if f$extract( 0, 7, curr_arg) .eqs. "IZ_BZIP"
+$ then
+$ opts = f$edit( curr_arg, "COLLAPSE")
+$ eq = f$locate( "=", opts)
+$ IZ_BZIP2 = f$extract( (eq+ 1), 1000, opts)
+$ goto argloop_end
+$ endif
+$!
+$ if (f$extract( 0, 5, curr_arg) .eqs. "LARGE")
+$ then
+$ LARGE_FILE = 1
+$ goto argloop_end
+$ endif
+$!
+$ if (f$extract( 0, 7, curr_arg) .eqs. "LINKOPT")
+$ then
+$ opts = f$edit( curr_arg, "COLLAPSE")
+$ eq = f$locate( "=", opts)
+$ LINKOPTS = f$extract( (eq+ 1), 1000, opts)
+$ goto argloop_end
+$ endif
+$!
+$! Note: LINK test must follow LINKOPTS test.
+$!
+$ if (f$extract( 0, 4, curr_arg) .eqs. "LINK")
+$ then
+$ LINK_ONLY = 1
+$ goto argloop_end
+$ endif
+$!
+$ if (f$extract( 0, 4, curr_arg) .eqs. "LIST")
+$ then
+$ LISTING = "/''curr_arg'" ! But see below for mods.
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "NOHELP")
+$ then
+$ MAKE_HELP = 0
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "NOMSG")
+$ then
+$ MAKE_MSG = 0
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "VAXC")
+$ then
+$ MAY_USE_DECC = 0
+$ MAY_USE_GNUC = 0
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "DECC")
+$ then
+$ MAY_USE_DECC = 1
+$ MAY_USE_GNUC = 0
+$ goto argloop_end
+$ endif
+$!
+$ if (curr_arg .eqs. "GNUC")
+$ then
+$ MAY_USE_DECC = 0
+$ MAY_USE_GNUC = 1
+$ goto argloop_end
+$ endif
+$!
+$ if ((curr_arg .eqs. "VMSCLI") .or. (curr_arg .eqs. "CLI"))
+$ then
+$ CLI_IS_DEFAULT = 1
+$ goto argloop_end
+$ endif
+$!
+$ if ((curr_arg .eqs. "NOVMSCLI") .or. (curr_arg .eqs. "NOCLI"))
+$ then
+$ CLI_IS_DEFAULT = 0
+$ goto argloop_end
+$ endif
+$!
+$ say "Unrecognized command-line option: ''curr_arg'"
+$ goto error
+$!
+$ argloop_end:
+$ arg_cnt = arg_cnt + 1
+$ goto argloop
+$ argloop_out:
+$!
+$ if (CLI_IS_DEFAULT)
+$ then
+$ ZIPEXEC = zipx_cli
+$ else
+$ ZIPEXEC = zipx_unx
+$ endif
+$!
+$!#######################################################################
+$!
+$! Find out current disk, directory, compiler and options
+$!
+$ workdir = f$environment( "default")
+$ here = f$parse( workdir, , , "device")+ f$parse( workdir, , , "directory")
+$!
+$! Sense the host architecture (Alpha, Itanium, or VAX).
+$!
+$ if (f$getsyi( "HW_MODEL") .lt. 1024)
+$ then
+$ arch = "VAX"
+$ else
+$ if (f$getsyi( "ARCH_TYPE") .eq. 2)
+$ then
+$ arch = "ALPHA"
+$ else
+$ if (f$getsyi( "ARCH_TYPE") .eq. 3)
+$ then
+$ arch = "IA64"
+$ else
+$ arch = "unknown_arch"
+$ endif
+$ endif
+$ endif
+$!
+$ dest = arch
+$ cmpl = "DEC/Compaq/HP C"
+$ opts = ""
+$ if (arch .nes. "VAX")
+$ then
+$ HAVE_DECC_VAX = 0
+$ USE_DECC_VAX = 0
+$!
+$ if (MAY_USE_GNUC)
+$ then
+$ say "GNU C is not supported for ''arch'."
+$ say "You must use DEC/Compaq/HP C to build Zip."
+$ goto error
+$ endif
+$!
+$ if (.not. MAY_USE_DECC)
+$ then
+$ say "VAX C is not supported for ''arch'."
+$ say "You must use DEC/Compaq/HP C to build Zip."
+$ goto error
+$ endif
+$!
+$ cc = "cc /standard = relax /prefix = all /ansi"
+$ defs = "''LOCAL_ZIP' VMS"
+$ if (LARGE_FILE .ne. 0)
+$ then
+$ defs = "LARGE_FILE_SUPPORT, ''defs'"
+$ endif
+$ else
+$ if (LARGE_FILE .ne. 0)
+$ then
+$ say "LARGE_FILE_SUPPORT is not available on VAX."
+$ LARGE_FILE = 0
+$ endif
+$ HAVE_DECC_VAX = (f$search( "SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
+$ HAVE_VAXC_VAX = (f$search( "SYS$SYSTEM:VAXC.EXE") .nes. "")
+$ MAY_HAVE_GNUC = (f$trnlnm( "GNU_CC") .nes. "")
+$ if (HAVE_DECC_VAX .and. MAY_USE_DECC)
+$ then
+$ ! We use DECC:
+$ USE_DECC_VAX = 1
+$ cc = "cc /decc /prefix = all"
+$ defs = "''LOCAL_ZIP' VMS"
+$ else
+$ ! We use VAXC (or GNU C):
+$ USE_DECC_VAX = 0
+$ defs = "''LOCAL_ZIP' VMS"
+$ if ((.not. HAVE_VAXC_VAX .and. MAY_HAVE_GNUC) .or. MAY_USE_GNUC)
+$ then
+$ cc = "gcc"
+$ opts = "GNU_CC:[000000]GCCLIB.OLB /LIBRARY,"
+$ dest = "''dest'G"
+$ cmpl = "GNU C"
+$ else
+$ if (HAVE_DECC_VAX)
+$ then
+$ cc = "cc /vaxc"
+$ else
+$ cc = "cc"
+$ endif
+$ dest = "''dest'V"
+$ cmpl = "VAC C"
+$ endif
+$ opts = "''opts' SYS$DISK:[.''dest']VAXCSHR.OPT /OPTIONS,"
+$ endif
+$ endif
+$!
+$! Change the destination directory, according to the VMS_IM_EXTRA and
+$! large-file options. Set the bzip2 directory.
+$!
+$ dest = dest+ desti
+$ seek_bz = arch
+$ if (LARGE_FILE .ne. 0)
+$ then
+$ dest = dest+ "L"
+$ seek_bz = seek_bz+ "L"
+$ endif
+$!
+$! If BZIP2 support was selected, find the object library.
+$! Complain if things fail.
+$!
+$ cc_incl = "[]"
+$ incl_bzip2_m = ""
+$ lib_bzip2_opts = ""
+$ if (IZ_BZIP2 .nes. "")
+$ then
+$ bz2_olb = "LIBBZ2_NS.OLB"
+$ define incl_bzip2 'IZ_BZIP2'
+$ defs = "''defs', BZIP2_SUPPORT"
+$ @ [.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
+$ say "BZIP2 dir = ''f$trnlnm( "lib_bzip2")'"
+$ incl_bzip2_m = ", ZBZ2ERR"
+$ lib_bzip2_opts = "lib_bzip2:''bz2_olb' /library, "
+$ cc_incl = cc_incl+ ", [.VMS]"
+$ endif
+$ endif
+$!
+$! Reveal the plan. If compiling, set some compiler options.
+$!
+$ if (LINK_ONLY)
+$ then
+$ say "Linking on ''arch' for ''cmpl'."
+$ else
+$ say "Compiling on ''arch' using ''cmpl'."
+$!
+$ DEF_UNX = "/define = (''defs')"
+$ DEF_CLI = "/define = (''defs', VMSCLI)"
+$ DEF_UTIL = "/define = (''defs', UTIL)"
+$ endif
+$!
+$! If [.'dest'] does not exist, either complain (link-only) or make it.
+$!
+$ if (f$search( "''dest'.DIR;1") .eqs. "")
+$ then
+$ if (LINK_ONLY)
+$ then
+$ say "Can't find directory ""[.''dest']"". Can't link."
+$ goto error
+$ else
+$ create /directory [.'dest']
+$ endif
+$ endif
+$!
+$ if (.not. LINK_ONLY)
+$ then
+$!
+$! Arrange to get arch-specific list file placement, if LISTING, and if
+$! the user didn't specify a particular "/LIST =" destination.
+$!
+$ L = f$edit( LISTING, "COLLAPSE")
+$ if ((f$extract( 0, 5, L) .eqs. "/LIST") .and. -
+ (f$extract( 4, 1, L) .nes. "="))
+$ then
+$ LISTING = " /LIST = [.''dest']"+ f$extract( 5, 1000, LISTING)
+$ endif
+$!
+$! Define compiler command.
+$!
+$ cc = cc+ " /include = (''cc_incl')"+ LISTING+ CCOPTS
+$!
+$ endif
+$!
+$! Define linker command.
+$!
+$ link = "link ''LINKOPTS'"
+$!
+$! Make a VAXCRTL options file for GNU C or VAC C, if needed.
+$!
+$ if ((opts .nes. "") .and. -
+ (f$locate( "VAXCSHR", f$edit( opts, "UPCASE")) .lt. f$length( opts)) .and. -
+ (f$search( "[.''dest']VAXCSHR.OPT") .eqs. ""))
+$ then
+$ open /write opt_file_ln [.'dest']VAXCSHR.OPT
+$ write opt_file_ln "SYS$SHARE:VAXCRTL.EXE /SHARE"
+$ close opt_file_ln
+$ endif
+$!
+$! Show interesting facts.
+$!
+$ say " architecture = ''arch' (destination = [.''dest'])"
+$ if (.not. LINK_ONLY)
+$ then
+$ say " cc = ''cc'"
+$ endif
+$ say " link = ''link'"
+$ if (.not. MAKE_HELP)
+$ then
+$ say " Not making new help files."
+$ endif
+$ say ""
+$ 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.
+$!
+$!-------------------------------- Zip section -------------------------------
+$!
+$ if (.not. LINK_ONLY)
+$ then
+$!
+$! Process the help file, if desired.
+$!
+$ if (MAKE_HELP)
+$ then
+$ runoff /out = ZIP.HLP [.VMS]VMS_ZIP.RNH
+$ endif
+$!
+$! Process the message file, if desired.
+$!
+$ if (MAKE_MSG)
+$ then
+$!
+$! Create the message source file first, if it's not found.
+$!
+$ if (f$search( "[.VMS]ZIP_MSG.MSG") .eqs. "")
+$ then
+$ cc /include = [] /object = [.'dest']VMS_MSG_GEN.OBJ -
+ [.VMS]VMS_MSG_GEN.C
+$ link /executable = [.'dest']VMS_MSG_GEN.EXE -
+ [.'dest']VMS_MSG_GEN.OBJ
+$ create /fdl = [.VMS]STREAM_LF.FDL [.VMS]ZIP_MSG.MSG
+$ define /user_mode sys$output [.VMS]ZIP_MSG.MSG
+$ run [.'dest']VMS_MSG_GEN.EXE
+$ purge [.VMS]ZIP_MSG.MSG
+$ delete [.'dest']VMS_MSG_GEN.EXE;*, -
+ [.'dest']VMS_MSG_GEN.OBJ;*
+$ endif
+$!
+$ message /object = [.'dest']ZIP_MSG.OBJ /nosymbols -
+ [.VMS]ZIP_MSG.MSG
+$ link /shareable = [.'dest']ZIP_MSG.EXE [.'dest']ZIP_MSG.OBJ
+$ endif
+$!
+$! Compile the sources.
+$!
+$ cc 'DEF_UNX' /object = [.'dest']ZIP.OBJ ZIP.C
+$ cc 'DEF_UNX' /object = [.'dest']CRC32.OBJ CRC32.C
+$ cc 'DEF_UNX' /object = [.'dest']CRYPT.OBJ CRYPT.C
+$ cc 'DEF_UNX' /object = [.'dest']DEFLATE.OBJ DEFLATE.C
+$ cc 'DEF_UNX' /object = [.'dest']FILEIO.OBJ FILEIO.C
+$ cc 'DEF_UNX' /object = [.'dest']GLOBALS.OBJ GLOBALS.C
+$ cc 'DEF_UNX' /object = [.'dest']TREES.OBJ TREES.C
+$ cc 'DEF_UNX' /object = [.'dest']TTYIO.OBJ TTYIO.C
+$ cc 'DEF_UNX' /object = [.'dest']UTIL.OBJ UTIL.C
+$ cc 'DEF_UNX' /object = [.'dest']ZBZ2ERR.OBJ ZBZ2ERR.C
+$ cc 'DEF_UNX' /object = [.'dest']ZIPFILE.OBJ ZIPFILE.C
+$ cc 'DEF_UNX' /object = [.'dest']ZIPUP.OBJ ZIPUP.C
+$ cc /include = [] 'DEF_UNX' /object = [.'dest']VMS.OBJ -
+ [.VMS]VMS.C
+$ cc /include = [] 'DEF_UNX' /object = [.'dest']VMSMUNCH.OBJ -
+ [.VMS]VMSMUNCH.C
+$ cc /include = [] 'DEF_UNX' /object = [.'dest']VMSZIP.OBJ -
+ [.VMS]VMSZIP.C
+$!
+$! Create the object library.
+$!
+$ if (f$search( "[.''dest']ZIP.OLB") .eqs. "") then -
+ libr /object /create [.'dest']ZIP.OLB
+$!
+$ libr /object /replace [.'dest']ZIP.OLB -
+ [.'dest']CRC32.OBJ, -
+ [.'dest']CRYPT.OBJ, -
+ [.'dest']DEFLATE.OBJ, -
+ [.'dest']FILEIO.OBJ, -
+ [.'dest']GLOBALS.OBJ, -
+ [.'dest']TREES.OBJ, -
+ [.'dest']TTYIO.OBJ, -
+ [.'dest']UTIL.OBJ, -
+ [.'dest']ZBZ2ERR.OBJ, -
+ [.'dest']ZIPFILE.OBJ, -
+ [.'dest']ZIPUP.OBJ, -
+ [.'dest']VMS.OBJ, -
+ [.'dest']VMSMUNCH.OBJ, -
+ [.'dest']VMSZIP.OBJ
+$!
+$ endif
+$!
+$! Link the executable.
+$!
+$ link /executable = [.'dest']'ZIPX_UNX'.EXE -
+ [.'dest']ZIP.OBJ, -
+ [.'dest']ZIP.OLB /include = (GLOBALS 'incl_bzip2_m') /library, -
+ 'lib_bzip2_opts' -
+ 'opts' -
+ SYS$DISK:[.VMS]ZIP.OPT /options
+$!
+$!------------------------ Zip (CLI interface) section -----------------------
+$!
+$ if (.not. LINK_ONLY)
+$ then
+$!
+$! Process the CLI help file, if desired.
+$!
+$ if (MAKE_HELP)
+$ then
+$ set default [.VMS]
+$ edit /tpu /nosection /nodisplay /command = cvthelp.tpu -
+ zip_cli.help
+$ set default [-]
+$ runoff /output = ZIP_CLI.HLP [.VMS]ZIP_CLI.RNH
+$ endif
+$!
+$! Compile the CLI sources.
+$!
+$ cc 'DEF_CLI' /object = [.'dest']ZIPCLI.OBJ ZIP.C
+$ cc /include = [] 'DEF_CLI' /object = [.'dest']CMDLINE.OBJ -
+ [.VMS]CMDLINE.C
+$!
+$! Create the command definition object file.
+$!
+$ set command /object = [.'dest']ZIP_CLI.OBJ [.VMS]ZIP_CLI.CLD
+$!
+$! Create the CLI object library.
+$!
+$ if (f$search( "[.''dest']ZIPCLI.OLB") .eqs. "") then -
+ libr /object /create [.'dest']ZIPCLI.OLB
+$!
+$ libr /object /replace [.'dest']ZIPCLI.OLB -
+ [.'dest']ZIPCLI.OBJ, -
+ [.'dest']CMDLINE.OBJ, -
+ [.'dest']ZIP_CLI.OBJ
+$!
+$ endif
+$!
+$! Link the CLI executable.
+$!
+$ link /executable = [.'dest']'ZIPX_CLI'.EXE -
+ [.'dest']ZIPCLI.OBJ, -
+ [.'dest']ZIPCLI.OLB /library, -
+ [.'dest']ZIP.OLB /include = (GLOBALS 'incl_bzip2_m') /library, -
+ 'lib_bzip2_opts' -
+ 'opts' -
+ SYS$DISK:[.VMS]ZIP.OPT /options
+$!
+$!--------------------------- Zip utilities section --------------------------
+$!
+$ if (.not. LINK_ONLY)
+$ then
+$!
+$! Compile the variant Zip utilities library sources.
+$!
+$ cc 'DEF_UTIL' /object = [.'dest']CRC32_.OBJ CRC32.C
+$ cc 'DEF_UTIL' /object = [.'dest']CRYPT_.OBJ CRYPT.C
+$ cc 'DEF_UTIL' /object = [.'dest']FILEIO_.OBJ FILEIO.C
+$ cc 'DEF_UTIL' /object = [.'dest']UTIL_.OBJ UTIL.C
+$ cc 'DEF_UTIL' /object = [.'dest']ZIPFILE_.OBJ ZIPFILE.C
+$ cc 'DEF_UTIL' /include = [] /object = [.'dest']VMS_.OBJ [.VMS]VMS.C
+$!
+$! Create the Zip utilities object library.
+$!
+$ if f$search( "[.''dest']ZIPUTILS.OLB") .eqs. "" then -
+ libr /object /create [.'dest']ZIPUTILS.OLB
+$!
+$ libr /object /replace [.'dest']ZIPUTILS.OLB -
+ [.'dest']CRC32_.OBJ, -
+ [.'dest']CRYPT_.OBJ, -
+ [.'dest']FILEIO_.OBJ, -
+ [.'dest']GLOBALS.OBJ, -
+ [.'dest']TTYIO.OBJ, -
+ [.'dest']UTIL_.OBJ, -
+ [.'dest']ZIPFILE_.OBJ, -
+ [.'dest']VMS_.OBJ, -
+ [.'dest']VMSMUNCH.OBJ
+$!
+$! Compile the Zip utilities main program sources.
+$!
+$ cc 'DEF_UTIL' /object = [.'dest']ZIPCLOAK.OBJ ZIPCLOAK.C
+$ cc 'DEF_UTIL' /object = [.'dest']ZIPNOTE.OBJ ZIPNOTE.C
+$ cc 'DEF_UTIL' /object = [.'dest']ZIPSPLIT.OBJ ZIPSPLIT.C
+$!
+$ endif
+$!
+$! Link the Zip utilities executables.
+$!
+$ link /executable = [.'dest']ZIPCLOAK.EXE -
+ [.'dest']ZIPCLOAK.OBJ, -
+ [.'dest']ZIPUTILS.OLB /include = (GLOBALS) /library, -
+ 'opts' -
+ SYS$DISK:[.VMS]ZIP.OPT /options
+$!
+$ link /executable = [.'dest']ZIPNOTE.EXE -
+ [.'dest']ZIPNOTE.OBJ, -
+ [.'dest']ZIPUTILS.OLB /include = (GLOBALS) /library, -
+ 'opts' -
+ SYS$DISK:[.VMS]ZIP.OPT /OPTIONS
+$!
+$ LINK /EXECUTABLE = [.'DEST']ZIPSPLIT.EXE -
+ [.'DEST']ZIPSPLIT.OBJ, -
+ [.'DEST']ZIPUTILS.OLB /INCLUDE = (globals) /LIBRARY, -
+ 'opts' -
+ SYS$DISK:[.VMS]ZIP.OPT /options
+$!
+$!----------------------- Logical name removal section -----------------------
+$!
+$ if (IZ_BZIP2 .nes. "")
+$ then
+$ if (f$trnlnm( "incl_bzip2", "LNM$PROCESS_TABLE") .nes. "")
+$ then
+$ deassign incl_bzip2
+$ endif
+$ if (f$trnlnm( "lib_bzip2", "LNM$PROCESS_TABLE") .nes. "")
+$ then
+$ deassign lib_bzip2
+$ endif
+$ endif
+$!
+$!------------------------------ Symbols section -----------------------------
+$!
+$ there = here- "]"+ ".''dest']"
+$!
+$! Define the foreign command symbols. Similar commands may be useful
+$! in SYS$MANAGER:SYLOGIN.COM and/or users' LOGIN.COM.
+$!
+$ zip == "$''there'''ZIPEXEC'.exe"
+$ zipcloak == "$''there'zipcloak.exe"
+$ zipnote == "$''there'zipnote.exe"
+$ zipsplit == "$''there'zipsplit.exe"
+$!
+$! Restore the original default directory and DCL verify status.
+$!
+$ error:
+$!
+$ if (f$type( here) .nes. "")
+$ then
+$ if (here .nes. "")
+$ then
+$ set default 'here'
+$ endif
+$ endif
+$!
+$ if (f$type( OLD_VERIFY) .nes. "")
+$ then
+$ tmp = f$verify( OLD_VERIFY)
+$ endif
+$!
+$ exit
+$!
diff --git a/vms/bzlib.h b/vms/bzlib.h
new file mode 100644
index 0000000..20488ea
--- /dev/null
+++ b/vms/bzlib.h
@@ -0,0 +1,21 @@
+/* 2007-01-13 SMS.
+ * VMS-specific BZLIB.H jacket header file to ensure compatibility with
+ * BZIP2 code compiled using /NAMES = AS_IS.
+ *
+ * The logical name INCL_BZIP2 must point to the BZIP2 source directory.
+ *
+ * A "names as_is" prototype for bz_internal_error() is included for the
+ * same reason. See bzip2 "bzlib_private.h". Note that this "names
+ * as_is" prototype must be the first to be read by the compiler, but
+ * one or more other prototypes (perhaps with the default "names"
+ * attributes) should cause no trouble.
+ */
+
+#pragma names save
+#pragma names as_is
+
+#include "INCL_BZIP2:BZLIB.H"
+
+extern void bz_internal_error ( int errcode );
+
+#pragma names restore
diff --git a/vms/cmdline.c b/vms/cmdline.c
new file mode 100644
index 0000000..9816bd5
--- /dev/null
+++ b/vms/cmdline.c
@@ -0,0 +1,1802 @@
+/*
+ Copyright (c) 1990-2007 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
+*/
+
+/*
+ Test procedure:
+
+ Compile and link (in [.VMS] directory):
+
+ define vms SYS$DISK:[]
+ set command /object ZIP_CLI.CLD
+ cc /define = (TEST, VMSCLI) /include = [-] CMDLINE
+ link link CMDLINE.OBJ, ZIP_CLI.OBJ
+
+ Run:
+
+ exec*ute == "$SYS$DISK:[]'"
+ exec cmdline [options ...]
+
+*/
+
+/* 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
+ * library dependencies need to have the correct module name.
+ */
+#if 0
+# define module_name VMS_ZIP_CMDLINE
+# define module_ident "02-006"
+#endif /* 0 */
+
+/*
+**
+** Facility: ZIP
+**
+** Module: VMS_ZIP_CMDLINE
+**
+** Author: Hunter Goatley <goathunter@MadGoat.com>
+**
+** Date: July 30, 1993
+**
+** Abstract: Routines to handle a VMS CLI interface for Zip. The CLI
+** command line is parsed and a new argc/argv are built and
+** returned to Zip.
+**
+** Modified by:
+**
+** 02-007 Steven Schweda 09-FEB-2005
+** Added /PRESERVE_CASE.
+** 02-006 Onno van der Linden,
+** Christian Spieler 07-JUL-1998 23:03
+** Support GNU CC 2.8 on Alpha AXP (vers-num unchanged).
+** 02-006 Johnny Lee 25-JUN-1998 07:40
+** Fixed typo (superfluous ';') (vers-num unchanged).
+** 02-006 Christian Spieler 12-SEP-1997 23:17
+** Fixed bugs in /BEFORE and /SINCE handlers (vers-num unchanged).
+** 02-006 Christian Spieler 12-JUL-1997 02:05
+** Complete revision of the argv strings construction.
+** Added handling of "-P pwd", "-R", "-i@file", "-x@file" options.
+** 02-005 Patrick Ellis 09-MAY-1996 22:25
+** Show UNIX style help screen when UNIX style options are used.
+** 02-004 Onno van der Linden,
+** Christian Spieler 13-APR-1996 20:05
+** Removed /ENCRYPT=VERIFY ("-ee" option).
+** 02-003 Christian Spieler 11-FEB-1996 23:05
+** Added handling of /EXTRAFIELDS qualifier ("-X" option).
+** 02-002 Christian Spieler 09-JAN-1996 22:25
+** Added "#include crypt.h", corrected typo.
+** 02-001 Christian Spieler 04-DEC-1995 16:00
+** Fixed compilation in DEC CC's ANSI mode.
+** 02-000 Christian Spieler 10-OCT-1995 17:54
+** Modified for Zip v2.1, added several new options.
+** 01-000 Hunter Goatley 30-JUL-1993 07:54
+** Original version (for Zip v1.9p1).
+**
+*/
+
+
+/* 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
+ * library dependencies need to have the correct module name.
+ */
+#if 0
+# if defined(__DECC) || defined(__GNUC__)
+# pragma module module_name module_ident
+# else
+# module module_name module_ident
+# endif
+#endif /* 0 */
+
+/* Accomodation for /NAMES = AS_IS with old header files. */
+
+#define lib$establish LIB$ESTABLISH
+#define lib$get_foreign LIB$GET_FOREIGN
+#define lib$get_input LIB$GET_INPUT
+#define lib$sig_to_ret LIB$SIG_TO_RET
+#define ots$cvt_tu_l OTS$CVT_TU_L
+#define str$concat STR$CONCAT
+#define str$find_first_substring STR$FIND_FIRST_SUBSTRING
+#define str$free1_dx STR$FREE1_DX
+
+#include "zip.h"
+#ifndef TEST
+#include "crypt.h" /* for VMSCLI_help() */
+#include "revision.h" /* for VMSCLI_help() */
+#endif /* !TEST */
+
+#include <ssdef.h>
+#include <descrip.h>
+#include <climsgdef.h>
+#include <clidef.h>
+#include <lib$routines.h>
+#include <ots$routines.h>
+#include <str$routines.h>
+
+#ifndef CLI$_COMMA
+globalvalue CLI$_COMMA;
+#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;}
+
+/*
+** Memory allocation step for argv string buffer.
+*/
+#define ARGBSIZE_UNIT 256
+
+/*
+** 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); \
+ } \
+ } \
+}
+
+/*
+** Define descriptors for all of the CLI parameters and qualifiers.
+*/
+$DESCRIPTOR(cli_delete, "DELETE"); /* -d */
+$DESCRIPTOR(cli_freshen, "FRESHEN"); /* -f */
+$DESCRIPTOR(cli_move, "MOVE"); /* -m */
+$DESCRIPTOR(cli_update, "UPDATE"); /* -u */
+$DESCRIPTOR(cli_exclude, "EXCLUDE"); /* -x */
+$DESCRIPTOR(cli_include, "INCLUDE"); /* -i */
+$DESCRIPTOR(cli_exlist, "EXLIST"); /* -x@ */
+$DESCRIPTOR(cli_inlist, "INLIST"); /* -i@ */
+$DESCRIPTOR(cli_adjust, "ADJUST_OFFSETS"); /* -A */
+$DESCRIPTOR(cli_append, "APPEND"); /* -g */
+$DESCRIPTOR(cli_batch, "BATCH"); /* -@ */
+$DESCRIPTOR(cli_before, "BEFORE"); /* -tt */
+$DESCRIPTOR(cli_comments, "COMMENTS"); /* -c,-z */
+$DESCRIPTOR(cli_comment_archive,"COMMENTS.ARCHIVE"); /* -z */
+$DESCRIPTOR(cli_comment_zipfile,"COMMENTS.ZIP_FILE"); /* -z */
+$DESCRIPTOR(cli_comment_files, "COMMENTS.FILES"); /* -c */
+$DESCRIPTOR(cli_compression, "COMPRESSION"); /* -Z */
+$DESCRIPTOR(cli_compression_b, "COMPRESSION.BZIP2"); /* -Zb */
+$DESCRIPTOR(cli_compression_d, "COMPRESSION.DEFLATE"); /* -Zd */
+$DESCRIPTOR(cli_compression_s, "COMPRESSION.STORE"); /* -Zs */
+$DESCRIPTOR(cli_copy_entries, "COPY_ENTRIES"); /* -U */
+$DESCRIPTOR(cli_descriptors, "DESCRIPTORS"); /* -fd */
+$DESCRIPTOR(cli_difference, "DIFFERENCE"); /* -DF */
+$DESCRIPTOR(cli_dirnames, "DIRNAMES"); /* -D */
+$DESCRIPTOR(cli_display, "DISPLAY"); /* -d? */
+$DESCRIPTOR(cli_display_bytes, "DISPLAY.BYTES"); /* -db */
+$DESCRIPTOR(cli_display_counts, "DISPLAY.COUNTS"); /* -dc */
+$DESCRIPTOR(cli_display_dots, "DISPLAY.DOTS"); /* -dd,-ds */
+$DESCRIPTOR(cli_display_globaldots, "DISPLAY.GLOBALDOTS"); /* -dg */
+$DESCRIPTOR(cli_display_usize, "DISPLAY.USIZE"); /* -du */
+$DESCRIPTOR(cli_display_volume, "DISPLAY.VOLUME"); /* -dv */
+$DESCRIPTOR(cli_dot_version, "DOT_VERSION"); /* -ww */
+$DESCRIPTOR(cli_encrypt, "ENCRYPT"); /* -e,-P */
+$DESCRIPTOR(cli_extra_fields, "EXTRA_FIELDS"); /* -X [/NO] */
+$DESCRIPTOR(cli_extra_fields_normal, "EXTRA_FIELDS.NORMAL"); /* no -X */
+$DESCRIPTOR(cli_extra_fields_keep, "EXTRA_FIELDS.KEEP_EXISTING"); /* -X- */
+$DESCRIPTOR(cli_filesync, "FILESYNC"); /* -FS */
+$DESCRIPTOR(cli_fix_archive, "FIX_ARCHIVE"); /* -F[F] */
+$DESCRIPTOR(cli_fix_normal, "FIX_ARCHIVE.NORMAL"); /* -F */
+$DESCRIPTOR(cli_fix_full, "FIX_ARCHIVE.FULL"); /* -FF */
+$DESCRIPTOR(cli_full_path, "FULL_PATH"); /* -p */
+$DESCRIPTOR(cli_grow, "GROW"); /* -g */
+$DESCRIPTOR(cli_help, "HELP"); /* -h */
+$DESCRIPTOR(cli_help_normal, "HELP.NORMAL"); /* -h */
+$DESCRIPTOR(cli_help_extended, "HELP.EXTENDED"); /* -h2 */
+$DESCRIPTOR(cli_junk, "JUNK"); /* -j */
+$DESCRIPTOR(cli_keep_version, "KEEP_VERSION"); /* -w */
+$DESCRIPTOR(cli_latest, "LATEST"); /* -o */
+$DESCRIPTOR(cli_level, "LEVEL"); /* -[0-9] */
+$DESCRIPTOR(cli_license, "LICENSE"); /* -L */
+$DESCRIPTOR(cli_log_file, "LOG_FILE"); /* -la,-lf,-li */
+$DESCRIPTOR(cli_log_file_append, "LOG_FILE.APPEND"); /* -la */
+$DESCRIPTOR(cli_log_file_file, "LOG_FILE.FILE"); /* -lf */
+$DESCRIPTOR(cli_log_file_info, "LOG_FILE.INFORMATIONAL"); /* -li */
+$DESCRIPTOR(cli_must_match, "MUST_MATCH"); /* -MM */
+$DESCRIPTOR(cli_output, "OUTPUT"); /* -O */
+$DESCRIPTOR(cli_patt_case, "PATTERN_CASE"); /* -ic[-] */
+$DESCRIPTOR(cli_patt_case_blind, "PATTERN_CASE.BLIND"); /* -ic */
+$DESCRIPTOR(cli_patt_case_sensitive, "PATTERN_CASE.SENSITIVE"); /* -ic- */
+$DESCRIPTOR(cli_pkzip, "PKZIP"); /* -k */
+$DESCRIPTOR(cli_pres_case, "PRESERVE_CASE"); /* -C */
+$DESCRIPTOR(cli_pres_case_no2, "PRESERVE_CASE.NOODS2");/* -C2- */
+$DESCRIPTOR(cli_pres_case_no5, "PRESERVE_CASE.NOODS5");/* -C5- */
+$DESCRIPTOR(cli_pres_case_ods2, "PRESERVE_CASE.ODS2"); /* -C2 */
+$DESCRIPTOR(cli_pres_case_ods5, "PRESERVE_CASE.ODS5"); /* -C5 */
+$DESCRIPTOR(cli_quiet, "QUIET"); /* -q */
+$DESCRIPTOR(cli_recurse, "RECURSE"); /* -r,-R */
+$DESCRIPTOR(cli_recurse_path, "RECURSE.PATH"); /* -r */
+$DESCRIPTOR(cli_recurse_fnames, "RECURSE.FILENAMES"); /* -R */
+$DESCRIPTOR(cli_show, "SHOW"); /* -s? */
+$DESCRIPTOR(cli_show_command, "SHOW.COMMAND"); /* -sc */
+$DESCRIPTOR(cli_show_debug, "SHOW.DEBUG"); /* -sd */
+$DESCRIPTOR(cli_show_files, "SHOW.FILES"); /* -sf */
+$DESCRIPTOR(cli_show_options, "SHOW.OPTIONS"); /* -so */
+$DESCRIPTOR(cli_since, "SINCE"); /* -t */
+$DESCRIPTOR(cli_split, "SPLIT"); /* -s,-sb,-sp,-sv */
+$DESCRIPTOR(cli_split_bell, "SPLIT.BELL"); /* -sb */
+$DESCRIPTOR(cli_split_pause, "SPLIT.PAUSE"); /* -sp */
+$DESCRIPTOR(cli_split_size, "SPLIT.SIZE"); /* -s */
+$DESCRIPTOR(cli_split_verbose, "SPLIT.VERBOSE"); /* -sv */
+$DESCRIPTOR(cli_store_types, "STORE_TYPES"); /* -n */
+$DESCRIPTOR(cli_sverbose, "SVERBOSE"); /* -sv */
+$DESCRIPTOR(cli_symlinks, "SYMLINKS"); /* -y */
+$DESCRIPTOR(cli_temp_path, "TEMP_PATH"); /* -b */
+$DESCRIPTOR(cli_test, "TEST"); /* -T */
+$DESCRIPTOR(cli_test_unzip, "TEST.UNZIP"); /* -TT */
+$DESCRIPTOR(cli_translate_eol, "TRANSLATE_EOL"); /* -l[l] */
+$DESCRIPTOR(cli_transl_eol_lf, "TRANSLATE_EOL.LF"); /* -l */
+$DESCRIPTOR(cli_transl_eol_crlf,"TRANSLATE_EOL.CRLF"); /* -ll */
+$DESCRIPTOR(cli_unsfx, "UNSFX"); /* -J */
+$DESCRIPTOR(cli_verbose, "VERBOSE"); /* -v (?) */
+$DESCRIPTOR(cli_verbose_normal, "VERBOSE.NORMAL"); /* -v */
+$DESCRIPTOR(cli_verbose_more, "VERBOSE.MORE"); /* -vv */
+$DESCRIPTOR(cli_verbose_debug, "VERBOSE.DEBUG"); /* -vvv */
+$DESCRIPTOR(cli_verbose_command,"VERBOSE.COMMAND"); /* (none) */
+$DESCRIPTOR(cli_vms, "VMS"); /* -V */
+$DESCRIPTOR(cli_vms_all, "VMS.ALL"); /* -VV */
+$DESCRIPTOR(cli_wildcard, "WILDCARD"); /* -nw */
+$DESCRIPTOR(cli_wildcard_nospan,"WILDCARD.NOSPAN"); /* -W */
+
+$DESCRIPTOR(cli_yyz, "YYZ_ZIP");
+
+$DESCRIPTOR(cli_zip64, "ZIP64"); /* -fz */
+$DESCRIPTOR(cli_zipfile, "ZIPFILE");
+$DESCRIPTOR(cli_infile, "INFILE");
+$DESCRIPTOR(zip_command, "zip ");
+
+static int show_VMSCLI_help;
+
+#if !defined(zip_clitable)
+# define zip_clitable ZIP_CLITABLE
+#endif
+#if defined(__DECC) || defined(__GNUC__)
+extern void *zip_clitable;
+#else
+globalref void *zip_clitable;
+#endif
+
+/* extern unsigned long LIB$GET_INPUT(void), LIB$SIG_TO_RET(void); */
+
+#ifndef __STARLET_LOADED
+#ifndef sys$bintim
+# define sys$bintim SYS$BINTIM
+#endif
+#ifndef sys$numtim
+# define sys$numtim SYS$NUMTIM
+#endif
+extern int sys$bintim ();
+extern int sys$numtim ();
+#endif /* !__STARLET_LOADED */
+#ifndef cli$dcl_parse
+# define cli$dcl_parse CLI$DCL_PARSE
+#endif
+#ifndef cli$present
+# define cli$present CLI$PRESENT
+#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_zip_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 get_time (struct dsc$descriptor_s *qual, char *timearg);
+static unsigned long check_cli (struct dsc$descriptor_s *);
+static int verbose_command = 0;
+
+
+#ifdef TEST
+
+char errbuf[ FNMAX+ 81]; /* Error message buffer. */
+
+void ziperr( int c, char *h) /* Error message display function. */
+{
+/* int c: error code from the ZE_ class */
+/* char *h: message about how it happened */
+
+printf( "%d: %s\n", c, h);
+}
+
+int
+main(int argc, char **argv) /* Main program. */
+{
+ return (vms_zip_cmdline(&argc, &argv));
+}
+
+#endif /* def TEST */
+
+
+unsigned long
+vms_zip_cmdline (int *argc_p, char ***argv_p)
+{
+/*
+** Routine: vms_zip_cmdline
+**
+** Function:
+**
+** Parse the DCL command line and create a fake argv array to be
+** handed off to Zip.
+**
+** NOTE: the argv[] is built as we go, so all the parameters are
+** checked in the appropriate order!!
+**
+** Formal parameters:
+**
+** argc_p - Address of int to receive the new argc
+** argv_p - Address of char ** to receive the argv address
+**
+** Calling sequence:
+**
+** status = vms_zip_cmdline (&argc, &argv);
+**
+** Returns:
+**
+** SS$_NORMAL - Success.
+** SS$_INSFMEM - A malloc() or realloc() failed
+** SS$_ABORT - Bad time value
+**
+*/
+ register unsigned long status;
+ char options[ 64];
+ 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 *ptr;
+ int x, len;
+
+ int new_argc;
+ char **new_argv;
+
+ struct dsc$descriptor_d work_str;
+ struct dsc$descriptor_d foreign_cmdline;
+
+ init_dyndesc(work_str);
+ init_dyndesc(foreign_cmdline);
+
+ /*
+ ** See if the program was invoked by the CLI (SET COMMAND) or by
+ ** a foreign command definition. Check for /YYZ_ZIP, which is a
+ ** valid default qualifier solely for this test.
+ */
+ show_VMSCLI_help = TRUE;
+ status = check_cli(&cli_yyz);
+ if (!(status & 1)) {
+ lib$get_foreign(&foreign_cmdline);
+ /*
+ ** If nothing was returned or the first character is a "-", then
+ ** assume it's a UNIX-style command and return.
+ */
+ if (foreign_cmdline.dsc$w_length == 0)
+ return (SS$_NORMAL);
+ if ((*(foreign_cmdline.dsc$a_pointer) == '-') ||
+ ((foreign_cmdline.dsc$w_length > 1) &&
+ (*(foreign_cmdline.dsc$a_pointer) == '"') &&
+ (*(foreign_cmdline.dsc$a_pointer + 1) == '-'))) {
+ show_VMSCLI_help = FALSE;
+ return (SS$_NORMAL);
+ }
+
+ str$concat(&work_str, &zip_command, &foreign_cmdline);
+ status = cli$dcl_parse(&work_str, &zip_clitable, lib$get_input,
+ lib$get_input, 0);
+ if (!(status & 1)) return (status);
+ }
+
+ /*
+ ** There's always going to be a new_argv[] because of the image name.
+ */
+ if ((the_cmd_line = (char *) malloc(cmdl_size = ARGBSIZE_UNIT)) == NULL)
+ return (SS$_INSFMEM);
+
+ strcpy(the_cmd_line, "zip");
+ cmdl_len = sizeof("zip");
+
+ /*
+ ** First, check to see if any of the regular options were specified.
+ */
+
+ options[0] = '-';
+ ptr = &options[1]; /* Point to temporary buffer */
+
+ /*
+ ** Copy entries.
+ */
+ status = cli$present(&cli_copy_entries);
+ if (status & 1)
+ /* /COPY_ENTRIES */
+ *ptr++ = 'U';
+
+ /*
+ ** Delete the specified files from the zip file?
+ */
+ status = cli$present(&cli_delete);
+ if (status & 1)
+ /* /DELETE */
+ *ptr++ = 'd';
+
+ /*
+ ** Freshen (only changed files).
+ */
+ status = cli$present(&cli_freshen);
+ if (status & 1)
+ /* /FRESHEN */
+ *ptr++ = 'f';
+
+ /*
+ ** Delete the files once they've been added to the zip file.
+ */
+ status = cli$present(&cli_move);
+ if (status & 1)
+ /* /MOVE */
+ *ptr++ = 'm';
+
+ /*
+ ** Add changed and new files.
+ */
+ status = cli$present(&cli_update);
+ if (status & 1)
+ /* /UPDATE */
+ *ptr++ = 'u';
+
+ /*
+ ** Check for the compression level (-0 through -9).
+ */
+ status = cli$present(&cli_level);
+ if (status & 1) {
+ /* /LEVEL = value */
+
+ unsigned long binval;
+
+ status = cli$get_value(&cli_level, &work_str);
+ status = ots$cvt_tu_l(&work_str, &binval);
+ if (!(status & 1) || (binval > 9)) {
+ return (SS$_ABORT);
+ }
+ *ptr++ = binval + '0';
+ }
+
+ /*
+ ** Adjust offsets of zip archive entries.
+ */
+ status = cli$present(&cli_adjust);
+ if (status & 1)
+ /* /ADJUST_OFFSETS */
+ *ptr++ = 'A';
+
+ /*
+ ** Add comments?
+ */
+ status = cli$present(&cli_comments);
+ if (status & 1)
+ {
+ int archive_or_zip_file = 0;
+
+ if ((status = cli$present(&cli_comment_archive)) & 1)
+ /* /COMMENTS = ARCHIVE */
+ archive_or_zip_file = 1;
+ if ((status = cli$present(&cli_comment_zipfile)) & 1)
+ /* /COMMENTS = ZIP_FILE */
+ archive_or_zip_file = 1;
+ if (archive_or_zip_file != 0)
+ /* /COMMENTS = ARCHIVE */
+ *ptr++ = 'z';
+ if ((status = cli$present(&cli_comment_files)) & 1)
+ /* /COMMENTS = FILES */
+ *ptr++ = 'c';
+ }
+
+ /*
+ ** Preserve case in file names.
+ */
+#define OPT_C "-C" /* Preserve case all. */
+#define OPT_CN "-C-" /* Down-case all. */
+#define OPT_C2 "-C2" /* Preserve case ODS2. */
+#define OPT_C2N "-C2-" /* Down-case ODS2. */
+#define OPT_C5 "-C5" /* Preserve case ODS5. */
+#define OPT_C5N "-C5-" /* Down-case ODS5. */
+
+ status = cli$present( &cli_pres_case);
+ if ((status & 1) || (status == CLI$_NEGATED))
+ {
+ /* /[NO]PRESERVE_CASE */
+ char *opt;
+ int ods2 = 0;
+ int ods5 = 0;
+
+ if (status == CLI$_NEGATED)
+ {
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_CN)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_CN);
+ }
+ else
+ {
+ if (cli$present( &cli_pres_case_no2) & 1)
+ {
+ /* /PRESERVE_CASE = NOODS2 */
+ ods2 = -1;
+ }
+ if (cli$present( &cli_pres_case_no5) & 1)
+ {
+ /* /PRESERVE_CASE = NOODS5 */
+ ods5 = -1;
+ }
+ if (cli$present( &cli_pres_case_ods2) & 1)
+ {
+ /* /PRESERVE_CASE = ODS2 */
+ ods2 = 1;
+ }
+ if (cli$present( &cli_pres_case_ods5) & 1)
+ {
+ /* /PRESERVE_CASE = ODS5 */
+ ods5 = 1;
+ }
+
+ if (ods2 == ods5)
+ {
+ /* Plain "-C[-]". */
+ if (ods2 < 0)
+ opt = OPT_CN;
+ else
+ opt = OPT_C;
+
+ x = cmdl_len;
+ cmdl_len += strlen( opt)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], opt);
+ }
+ else
+ {
+ if (ods2 != 0)
+ {
+ /* "-C2[-]". */
+ if (ods2 < 0)
+ opt = OPT_C2N;
+ else
+ opt = OPT_C2;
+
+ x = cmdl_len;
+ cmdl_len += strlen( opt)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], opt);
+ }
+
+ if (ods5 != 0)
+ {
+ /* "-C5[-]". */
+ if (ods5 < 0)
+ opt = OPT_C5N;
+ else
+ opt = OPT_C5;
+
+ x = cmdl_len;
+ cmdl_len += strlen( opt)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], opt);
+ }
+ }
+ }
+ }
+
+ /*
+ ** Pattern case sensitivity.
+ */
+#define OPT_IC "-ic" /* Case-insensitive pattern matching. */
+#define OPT_ICN "-ic-" /* Case-sensitive pattern matching. */
+
+ status = cli$present( &cli_patt_case);
+ if (status & 1)
+ {
+ if (cli$present( &cli_patt_case_blind) & 1)
+ {
+ /* "-ic". */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_IC)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_IC);
+ }
+ else if (cli$present( &cli_patt_case_sensitive) & 1)
+ {
+ /* "-ic-". */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_ICN)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_ICN);
+ }
+ }
+
+ /*
+ ** Data descriptors.
+ */
+#define OPT_FD "-fd"
+
+ status = cli$present( &cli_descriptors);
+ if (status & 1)
+ {
+ /* /DESCRIPTORS */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_FD)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_FD);
+ }
+
+ /*
+ ** Difference archive. Add only new or changed files.
+ */
+#define OPT_DF "-DF" /* Difference archive. */
+
+ if ((status = cli$present( &cli_difference)) & 1)
+ {
+ /* /DIFFERENCE */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_DF)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_DF);
+ }
+
+ /*
+ ** Do not add/modify directory entries.
+ */
+ status = cli$present(&cli_dirnames);
+ if (!(status & 1))
+ /* /DIRNAMES */
+ *ptr++ = 'D';
+
+ /*
+ ** Encrypt?
+ */
+ status = cli$present(&cli_encrypt);
+ if (status & 1)
+ if ((status = cli$get_value(&cli_encrypt, &work_str)) & 1) {
+ /* /ENCRYPT = value */
+ x = cmdl_len;
+ cmdl_len += work_str.dsc$w_length + 4;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], "-P");
+ strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
+ work_str.dsc$w_length);
+ the_cmd_line[cmdl_len-1] = '\0';
+ } else {
+ /* /ENCRYPT */
+ *ptr++ = 'e';
+ }
+
+ /*
+ ** Fix the zip archive structure.
+ */
+ status = cli$present(&cli_fix_archive);
+ if (status & 1) {
+ *ptr++ = 'F';
+ /* /FIX_ARCHIVE = NORMAL */
+ if ((status = cli$present(&cli_fix_full)) & 1) {
+ /* /FIX_ARCHIVE = FULL */
+ *ptr++ = 'F';
+ }
+ }
+
+ /*
+ ** Filesync. Delete archive entry if no such file.
+ */
+#define OPT_FS "-FS" /* Filesync. */
+
+ if ((status = cli$present( &cli_filesync)) & 1)
+ {
+ /* /FILESYNC */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_FS)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_FS);
+ }
+
+ /*
+ ** Append (allow growing of existing zip file).
+ */
+ status = cli$present(&cli_append);
+ if (status & 1)
+ /* /APPEND */
+ *ptr++ = 'g';
+
+ status = cli$present(&cli_grow);
+ if (status & 1)
+ /* /GROW */
+ *ptr++ = 'g';
+
+ /*
+ ** Show the help.
+ */
+#define OPT_H2 "-h2"
+
+ status = cli$present(&cli_help);
+ if (status & 1)
+ {
+ status = cli$present( &cli_help_normal);
+ if (status & 1)
+ {
+ /* /HELP [= NORMAL] */
+ *ptr++ = 'h';
+ }
+ status = cli$present( &cli_help_extended);
+ if (status & 1)
+ {
+ /* /HELP = EXTENDED */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_H2)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_H2);
+ }
+ }
+
+ /*
+ ** Junk path names (directory specs).
+ */
+ status = cli$present(&cli_junk);
+ if (status & 1)
+ /* /JUNK */
+ *ptr++ = 'j';
+
+ /*
+ ** Simulate zip file made by PKZIP.
+ */
+ status = cli$present(&cli_pkzip);
+ if (status & 1)
+ /* /KEEP_VERSION */
+ *ptr++ = 'k';
+
+ /*
+ ** Translate end-of-line.
+ */
+ status = cli$present(&cli_translate_eol);
+ if (status & 1) {
+ /* /TRANSLATE_EOL [= LF]*/
+ *ptr++ = 'l';
+ if ((status = cli$present(&cli_transl_eol_crlf)) & 1) {
+ /* /TRANSLATE_EOL = CRLF */
+ *ptr++ = 'l';
+ }
+ }
+
+ /*
+ ** Show the software license.
+ */
+ status = cli$present(&cli_license);
+ if (status & 1)
+ /* /LICENSE */
+ *ptr++ = 'L';
+
+ /*
+ ** Set zip file time to time of latest file in it.
+ */
+ status = cli$present(&cli_latest);
+ if (status & 1)
+ /* /LATEST */
+ *ptr++ = 'o';
+
+ /*
+ ** Store full path (default).
+ */
+ status = cli$present(&cli_full_path);
+ if (status == CLI$_PRESENT)
+ /* /FULL_PATH */
+ *ptr++ = 'p';
+ else if (status == CLI$_NEGATED)
+ /* /NOFULL_PATH */
+ *ptr++ = 'j';
+
+ /*
+ ** Junk Zipfile prefix (SFX stub etc.).
+ */
+ status = cli$present(&cli_unsfx);
+ if (status & 1)
+ /* /UNSFX */
+ *ptr++ = 'J';
+
+ /*
+ ** Recurse through subdirectories.
+ */
+ status = cli$present(&cli_recurse);
+ if (status & 1) {
+ if ((status = cli$present(&cli_recurse_fnames)) & 1)
+ /* /RECURSE [= PATH] */
+ *ptr++ = 'R';
+ else
+ /* /RECURSE [= FILENAMES] */
+ *ptr++ = 'r';
+ }
+
+ /*
+ ** Test Zipfile.
+ */
+ status = cli$present(&cli_test);
+ if (status & 1) {
+ /* /TEST */
+ *ptr++ = 'T';
+ }
+
+ /*
+ ** Be verbose.
+ */
+ status = cli$present(&cli_verbose);
+ if (status & 1) {
+ int i;
+ int verbo = 0;
+
+ /* /VERBOSE */
+ if ((status = cli$present(&cli_verbose_command)) & 1)
+ {
+ /* /VERBOSE = COMMAND */
+ verbose_command = 1;
+ }
+
+ /* Note that any or all of the following options may be
+ specified, and the maximum one is used.
+ */
+ if ((status = cli$present(&cli_verbose_normal)) & 1)
+ /* /VERBOSE [ = NORMAL ] */
+ verbo = 1;
+ if ((status = cli$present(&cli_verbose_more)) & 1)
+ /* /VERBOSE = MORE */
+ verbo = 2;
+ if ((status = cli$present(&cli_verbose_debug)) & 1) {
+ /* /VERBOSE = DEBUG */
+ verbo = 3;
+ }
+ for (i = 0; i < verbo; i++)
+ *ptr++ = 'v';
+ }
+
+ /*
+ ** Quiet mode.
+ ** (Quiet mode is processed after verbose, because a "-v" modifier
+ ** resets "noisy" to 1.)
+ */
+ status = cli$present(&cli_quiet);
+ if (status & 1)
+ /* /QUIET */
+ *ptr++ = 'q';
+
+ /*
+ ** Save the VMS file attributes (and all allocated blocks?).
+ */
+ status = cli$present(&cli_vms);
+ if (status & 1) {
+ /* /VMS */
+ *ptr++ = 'V';
+ if ((status = cli$present(&cli_vms_all)) & 1) {
+ /* /VMS = ALL */
+ *ptr++ = 'V';
+ }
+ }
+
+ /*
+ ** Keep the VMS version number as part of the file name when stored.
+ */
+ status = cli$present(&cli_keep_version);
+ if (status & 1)
+ /* /KEEP_VERSION */
+ *ptr++ = 'w';
+
+ /*
+ ** Store symlinks as symlinks.
+ */
+ status = cli$present(&cli_symlinks);
+ if (status & 1)
+ /* /SYMLINKS */
+ *ptr++ = 'y';
+
+ /*
+ ** `Batch' processing: read filenames to archive from stdin
+ ** or the specified file.
+ */
+ status = cli$present(&cli_batch);
+ if (status & 1) {
+ /* /BATCH */
+ status = cli$get_value(&cli_batch, &work_str);
+ if (status & 1) {
+ /* /BATCH = value */
+ work_str.dsc$a_pointer[work_str.dsc$w_length] = '\0';
+ if ((stdin = freopen(work_str.dsc$a_pointer, "r", stdin)) == NULL)
+ {
+ sprintf(errbuf, "could not open list file: %s",
+ work_str.dsc$a_pointer);
+ ziperr(ZE_PARMS, errbuf);
+ }
+ }
+ *ptr++ = '@';
+ }
+
+ /*
+ ** 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);
+ }
+
+ /*
+ **
+ ** OK. We've done all the regular options, so check for -b (temporary
+ ** file path), -n (special suffixes), -O (output atchive file),
+ ** -t (exclude before time), -Z (compression method), zipfile,
+ ** files to zip, and exclude list.
+ **
+ */
+ status = cli$present(&cli_temp_path);
+ if (status & 1) {
+ /* /TEMP_PATH = value */
+ status = cli$get_value(&cli_temp_path, &work_str);
+ x = cmdl_len;
+ cmdl_len += work_str.dsc$w_length + 4;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], "-b");
+ strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
+ work_str.dsc$w_length);
+ the_cmd_line[cmdl_len-1] = '\0';
+ }
+
+ status = cli$present(&cli_output);
+ if (status & 1) {
+ /* /OUTPUT = value */
+ status = cli$get_value(&cli_output, &work_str);
+ x = cmdl_len;
+ cmdl_len += work_str.dsc$w_length + 4;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], "-O");
+ strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
+ work_str.dsc$w_length);
+ the_cmd_line[cmdl_len-1] = '\0';
+ }
+
+ /*
+ ** Handle "-db", "-dc", "-dd", "-ds".
+ */
+#define OPT_DB "-db"
+#define OPT_DC "-dc"
+#define OPT_DD "-dd"
+#define OPT_DG "-dg"
+#define OPT_DS "-ds="
+#define OPT_DU "-du"
+#define OPT_DV "-dv"
+
+ status = cli$present( &cli_display);
+ if (status & 1)
+ {
+ if ((status = cli$present( &cli_display_bytes)) & 1)
+ {
+ /* /DISPLAY = BYTES */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_DB)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_DB);
+ }
+
+ if ((status = cli$present( &cli_display_counts)) & 1)
+ {
+ /* /DISPLAY = COUNTS */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_DC)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_DC);
+ }
+
+ if ((status = cli$present( &cli_display_dots)) & 1)
+ {
+ /* /DISPLAY = DOTS [= value] */
+ status = cli$get_value( &cli_display_dots, &work_str);
+
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_DD)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_DD);
+
+ /* -dd[=value] now -dd -ds=value - 5/8/05 EG */
+ if (work_str.dsc$w_length > 0) {
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_DS);
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_DS);
+
+ x = cmdl_len;
+ cmdl_len += work_str.dsc$w_length+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strncpy( &the_cmd_line[ x],
+ work_str.dsc$a_pointer, work_str.dsc$w_length);
+ }
+ }
+
+ if ((status = cli$present( &cli_display_globaldots)) & 1)
+ {
+ /* /DISPLAY = GLOBALDOTS */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_DG)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_DG);
+ }
+
+ if ((status = cli$present( &cli_display_usize)) & 1)
+ {
+ /* /DISPLAY = USIZE */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_DU)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_DU);
+ }
+
+ if ((status = cli$present( &cli_display_volume)) & 1)
+ {
+ /* /DISPLAY = VOLUME */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_DV)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_DV);
+ }
+ }
+
+ /*
+ ** Handle "-la", "-lf", "-li".
+ */
+#define OPT_LA "-la"
+#define OPT_LF "-lf"
+#define OPT_LI "-li"
+
+ status = cli$present( &cli_log_file);
+ if (status & 1)
+ {
+ /* /SHOW */
+ if ((status = cli$present( &cli_log_file_append)) & 1)
+ {
+ /* /LOG_FILE = APPEND */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_LA)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_LA);
+ }
+
+ status = cli$present(&cli_log_file_file);
+ if (status & 1) {
+ /* /LOG_FILE = FILE = file */
+ status = cli$get_value(&cli_log_file_file, &work_str);
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_LF)+ 2+ work_str.dsc$w_length;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], OPT_LF);
+ strncpy(&the_cmd_line[x+strlen( OPT_LF)+ 1], work_str.dsc$a_pointer,
+ work_str.dsc$w_length);
+ the_cmd_line[cmdl_len-1] = '\0';
+ }
+
+ if ((status = cli$present( &cli_log_file_info)) & 1)
+ {
+ /* /LOG = INFO */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_LI)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_LI);
+ }
+ }
+
+ /*
+ ** Handle "-s", "-sb", "-sp", "-sv".
+ */
+#define OPT_S "-s"
+#define OPT_SB "-sb"
+#define OPT_SP "-sp"
+#define OPT_SV "-sv"
+
+ status = cli$present( &cli_split);
+ if (status & 1)
+ {
+ status = cli$present( &cli_split_bell);
+ if (status & 1)
+ {
+ /* /SPLIT = BELL */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_SB)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_SB);
+ }
+
+ status = cli$present( &cli_split_pause);
+ if (status & 1)
+ {
+ /* /SPLIT = PAUSE */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_SP)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_SP);
+ }
+
+ status = cli$present( &cli_split_size);
+ if (status & 1)
+ {
+ /* /SPLIT = SIZE = size */
+ status = cli$get_value( &cli_split_size, &work_str);
+
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_S)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_S);
+
+ x = cmdl_len;
+ cmdl_len += work_str.dsc$w_length+ 1;
+ strncpy( &the_cmd_line[ x],
+ work_str.dsc$a_pointer, work_str.dsc$w_length);
+ }
+
+ status = cli$present( &cli_split_verbose);
+ if (status & 1)
+ {
+ /* /SPLIT = VERBOSE */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_SV)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_SV);
+ }
+ }
+
+ /*
+ ** Handle "-sc", "-sd", "-sf", "-so".
+ */
+#define OPT_SC "-sc"
+#define OPT_SD "-sd"
+#define OPT_SF "-sf"
+#define OPT_SO "-so"
+
+ status = cli$present( &cli_show);
+ if (status & 1)
+ {
+ /* /SHOW */
+ if ((status = cli$present( &cli_show_command)) & 1)
+ {
+ /* /SHOW = COMMAND */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_SC)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_SC);
+ }
+
+ if ((status = cli$present( &cli_show_debug)) & 1)
+ {
+ /* /SHOW = DEBUG */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_SD)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_SD);
+ }
+
+ if ((status = cli$present( &cli_show_files)) & 1)
+ {
+ /* /SHOW = FILES */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_SF)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_SF);
+ }
+
+ if ((status = cli$present( &cli_show_options)) & 1)
+ {
+ /* /SHOW = OPTIONS */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_SO)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_SO);
+ }
+ }
+
+ /*
+ ** Handle "-fz".
+ */
+#define OPT_FZ "-fz"
+
+ status = cli$present( &cli_zip64);
+ if (status & 1)
+ {
+ /* /ZIP64 */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_FZ)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_FZ);
+ }
+
+ /*
+ ** Handle "-nw" and "-W".
+ */
+#define OPT_NW "-nw"
+#define OPT_W "-W"
+
+ status = cli$present( &cli_wildcard);
+ if (status & 1)
+ {
+ if ((status = cli$present( &cli_wildcard_nospan)) & 1)
+ {
+ /* /WILDCARD = NOSPAN */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_W)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_W);
+ }
+ }
+ else if (status == CLI$_NEGATED)
+ {
+ /* /NOWILDCARD */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_NW)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_NW);
+ }
+
+ /*
+ ** Handle "-MM".
+ */
+#define OPT_MM "-MM"
+
+ status = cli$present( &cli_must_match);
+ if (status & 1)
+ {
+ /* /MUST_MATCH */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_MM)+ 1;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_MM);
+ }
+
+ /*
+ ** UnZip command for archive test.
+ */
+#define OPT_TT "-TT"
+
+ status = cli$present(&cli_test);
+ if (status & 1) {
+ /* /TEST */
+ status = cli$present(&cli_test_unzip);
+ if (status & 1) {
+ /* /TEST = UNZIP = value */
+ status = cli$get_value(&cli_test_unzip, &work_str);
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_TT)+ 2+ work_str.dsc$w_length;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], OPT_TT);
+ strncpy(&the_cmd_line[x+strlen( OPT_TT)+ 1], work_str.dsc$a_pointer,
+ work_str.dsc$w_length);
+ the_cmd_line[cmdl_len-1] = '\0';
+ }
+ }
+
+ /*
+ ** Handle "-Z".
+ */
+#define OPT_ZB "-Zb"
+#define OPT_ZD "-Zd"
+#define OPT_ZS "-Zs"
+
+ status = cli$present( &cli_compression);
+ if (status & 1)
+ {
+ if ((status = cli$present( &cli_compression_b)) & 1)
+ {
+ /* /COMPRESSION = BZIP2 */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_ZB)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_ZB);
+ }
+
+ if ((status = cli$present( &cli_compression_d)) & 1)
+ {
+ /* /COMPRESSION = DEFLATE */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_ZD)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_ZD);
+ }
+
+ if ((status = cli$present( &cli_compression_s)) & 1)
+ {
+ /* /COMPRESSION = STORE */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_ZS)+ 1;
+ CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_ZS);
+ }
+ }
+
+ /*
+ ** Handle "-t mmddyyyy".
+ */
+ status = cli$present(&cli_since);
+ if (status & 1) {
+ /* /SINCE = value */
+ char since_time[9];
+
+ status = get_time(&cli_since, &since_time[0]);
+ if (!(status & 1)) return (status);
+
+ /*
+ ** Now let's add the option "-t mmddyyyy" to the new command line.
+ */
+ x = cmdl_len;
+ cmdl_len += (3 + 9);
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], "-t");
+ strcpy(&the_cmd_line[x+3], since_time);
+ }
+
+ /*
+ ** Handle "-tt mmddyyyy".
+ */
+ status = cli$present(&cli_before);
+ if (status & 1) {
+ /* /BEFORE = value */
+ char before_time[9];
+
+ status = get_time(&cli_before, &before_time[0]);
+ if (!(status & 1)) return (status);
+
+ /*
+ ** Now let's add the option "-tt mmddyyyy" to the new command line.
+ */
+ x = cmdl_len;
+ cmdl_len += (4 + 9);
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], "-tt");
+ strcpy(&the_cmd_line[x+4], before_time);
+ }
+
+ /*
+ ** Handle "-n suffix:suffix:...". (File types to store only.)
+ */
+ status = cli$present(&cli_store_types);
+ if (status & 1) {
+ /* /STORE_TYPES = value_list */
+ x = cmdl_len;
+ cmdl_len += 3;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], "-n");
+
+ status = get_list(&cli_store_types, &foreign_cmdline, ':',
+ &the_cmd_line, &cmdl_size, &cmdl_len);
+ if (!(status & 1)) return (status);
+ }
+
+ /*
+ ** Handle "-X", keep or strip extra fields.
+ */
+#define OPT_X "-X"
+#define OPT_XN "-X-"
+
+ status = cli$present(&cli_extra_fields);
+ if (status & 1) {
+ /* /EXTRA_FIELDS */
+ if ((status = cli$present( &cli_extra_fields_keep)) & 1) {
+ /* /EXTRA_FIELDS = KEEP_EXISTING */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_XN)+ 1;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_XN);
+ }
+ }
+ else if (status == CLI$_NEGATED) {
+ /* /NOEXTRA_FIELDS */
+ x = cmdl_len;
+ cmdl_len += strlen( OPT_X)+ 1;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy( &the_cmd_line[ x], OPT_X);
+ }
+
+ /*
+ ** Now get the specified zip file name.
+ */
+ status = cli$present(&cli_zipfile);
+ /* zipfile */
+ if (status & 1) {
+ status = cli$get_value(&cli_zipfile, &work_str);
+
+ x = cmdl_len;
+ cmdl_len += work_str.dsc$w_length + 1;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strncpy(&the_cmd_line[x], work_str.dsc$a_pointer,
+ work_str.dsc$w_length);
+ the_cmd_line[cmdl_len-1] = '\0';
+
+ }
+
+ /*
+ ** Run through the list of input files.
+ */
+ status = cli$present(&cli_infile);
+ if (status & 1) {
+ /* infile_list */
+ status = get_list(&cli_infile, &foreign_cmdline, '\0',
+ &the_cmd_line, &cmdl_size, &cmdl_len);
+ if (!(status & 1)) return (status);
+ }
+
+ /*
+ ** List file containing exclude patterns present? ("-x@exclude.lst")
+ */
+ status = cli$present(&cli_exlist);
+ if (status & 1) {
+ /* /EXLIST = list */
+ status = cli$get_value(&cli_exlist, &work_str);
+ x = cmdl_len;
+ cmdl_len += work_str.dsc$w_length + 4;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strncpy(&the_cmd_line[x], "-x@", 3);
+ strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
+ work_str.dsc$w_length);
+ the_cmd_line[cmdl_len-1] = '\0';
+ }
+
+ /*
+ ** Any files to exclude? ("-x file file")
+ */
+ status = cli$present(&cli_exclude);
+ if (status & 1) {
+ /* /EXCLUDE = list */
+ x = cmdl_len;
+ cmdl_len += 3;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], "-x");
+
+ status = get_list(&cli_exclude, &foreign_cmdline, '\0',
+ &the_cmd_line, &cmdl_size, &cmdl_len);
+ if (!(status & 1)) return (status);
+ }
+
+ /*
+ ** List file containing include patterns present? ("-x@exclude.lst")
+ */
+ status = cli$present(&cli_inlist);
+ if (status & 1) {
+ /* /INLIST = list */
+ status = cli$get_value(&cli_inlist, &work_str);
+ x = cmdl_len;
+ cmdl_len += work_str.dsc$w_length + 4;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strncpy(&the_cmd_line[x], "-i@", 3);
+ strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
+ work_str.dsc$w_length);
+ the_cmd_line[cmdl_len-1] = '\0';
+ }
+
+ /*
+ ** Any files to include? ("-i file file")
+ */
+ status = cli$present(&cli_include);
+ if (status & 1) {
+ /* /INCLUDE = list */
+ x = cmdl_len;
+ cmdl_len += 3;
+ CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
+ strcpy(&the_cmd_line[x], "-i");
+
+ status = get_list(&cli_exclude, &foreign_cmdline, '\0',
+ &the_cmd_line, &cmdl_size, &cmdl_len);
+ if (!(status & 1)) return (status);
+ }
+
+
+ /*
+ ** We have finished collecting the strings for the argv vector,
+ ** release unused space.
+ */
+ if ((the_cmd_line = (char *) realloc(the_cmd_line, cmdl_len)) == NULL)
+ return (SS$_INSFMEM);
+
+ /*
+ ** Now that we've built our new UNIX-like command line, count the
+ ** number of args and build an argv array.
+ */
+ for (new_argc = 0, x = 0; x < cmdl_len; x++)
+ if (the_cmd_line[x] == '\0')
+ new_argc++;
+
+ /*
+ ** Allocate memory for the new argv[]. The last element of argv[]
+ ** 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);
+
+ /*
+ ** For each option, store the address in new_argv[] and convert the
+ ** separating blanks to nulls so each argv[] string is terminated.
+ */
+ for (ptr = the_cmd_line, x = 0; x < new_argc; x++) {
+ new_argv[x] = ptr;
+ ptr += strlen(ptr) + 1;
+ }
+ 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);
+}
+
+
+
+static unsigned long
+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)
+{
+/*
+** Routine: get_list
+**
+** Function: This routine runs through a comma-separated CLI list
+** and copies the strings to the argv buffer. The
+** specified separation character is used to separate
+** the strings in the argv buffer.
+**
+** All unquoted strings are converted to lower-case.
+**
+** Formal parameters:
+**
+** qual - Address of descriptor for the qualifier name
+** rawtail - Address of descriptor for the full command line tail
+** delim - Character to use to separate the list items
+** p_str - Address of pointer pointing to output buffer (argv strings)
+** p_size - Address of number containing allocated size for output string
+** p_end - Address of number containing used length in output buf
+**
+*/
+
+ register unsigned long status;
+ struct dsc$descriptor_d work_str;
+
+ init_dyndesc(work_str);
+
+ status = cli$present(qual);
+ if (status & 1) {
+
+ unsigned long len, old_len;
+ long ind, sind;
+ int keep_case;
+ char *src, *dst; int x;
+
+ /*
+ ** Just in case the string doesn't exist yet, though it does.
+ */
+ if (*p_str == NULL) {
+ *p_size = ARGBSIZE_UNIT;
+ if ((*p_str = (char *) malloc(*p_size)) == NULL)
+ return (SS$_INSFMEM);
+ len = 0;
+ } else {
+ len = *p_end;
+ }
+
+ while ((status = cli$get_value(qual, &work_str)) & 1) {
+ old_len = len;
+ len += work_str.dsc$w_length + 1;
+ CHECK_BUFFER_ALLOCATION(*p_str, *p_size, len)
+
+ /*
+ ** Look for the filename in the original foreign command
+ ** line to see if it was originally quoted. If so, then
+ ** don't convert it to lowercase.
+ */
+ keep_case = FALSE;
+ str$find_first_substring(rawtail, &ind, &sind, &work_str);
+ if ((ind > 1 && *(rawtail->dsc$a_pointer + ind - 2) == '"') ||
+ (ind == 0))
+ keep_case = TRUE;
+
+ /*
+ ** Copy the string to the buffer, converting to lowercase.
+ */
+ src = work_str.dsc$a_pointer;
+ dst = *p_str+old_len;
+ for (x = 0; x < work_str.dsc$w_length; x++) {
+ if (!keep_case && ((*src >= 'A') && (*src <= 'Z')))
+ *dst++ = *src++ + 32;
+ else
+ *dst++ = *src++;
+ }
+ if (status == CLI$_COMMA)
+ (*p_str)[len-1] = (char)delim;
+ else
+ (*p_str)[len-1] = '\0';
+ }
+ *p_end = len;
+ }
+
+ return (SS$_NORMAL);
+
+}
+
+
+static unsigned long
+get_time (struct dsc$descriptor_s *qual, char *timearg)
+{
+/*
+** Routine: get_time
+**
+** Function: This routine reads the argument string of the qualifier
+** "qual" that should be a VMS syntax date-time string. The
+** date-time string is converted into the standard format
+** "mmddyyyy", specifying an absolute date. The converted
+** string is written into the 9 bytes wide buffer "timearg".
+**
+** Formal parameters:
+**
+** qual - Address of descriptor for the qualifier name
+** timearg - Address of a buffer carrying the 8-char time string returned
+**
+*/
+
+ register unsigned long status;
+ struct dsc$descriptor_d time_str;
+ struct quadword {
+ long high;
+ long low;
+ } bintimbuf = {0,0};
+#ifdef __DECC
+#pragma member_alignment save
+#pragma nomember_alignment
+#endif /* __DECC */
+ struct tim {
+ short year;
+ short month;
+ short day;
+ short hour;
+ short minute;
+ short second;
+ short hundred;
+ } numtimbuf;
+#ifdef __DECC
+#pragma member_alignment restore
+#endif
+
+ init_dyndesc(time_str);
+
+ status = cli$get_value(qual, &time_str);
+ /*
+ ** If a date is given, convert it to 64-bit binary.
+ */
+ if (time_str.dsc$w_length) {
+ status = sys$bintim(&time_str, &bintimbuf);
+ if (!(status & 1)) return (status);
+ str$free1_dx(&time_str);
+ }
+ /*
+ ** Now call $NUMTIM to get the month, day, and year.
+ */
+ status = sys$numtim(&numtimbuf, (bintimbuf.low ? &bintimbuf : NULL));
+ /*
+ ** Write the "mmddyyyy" string to the return buffer.
+ */
+ if (!(status & 1)) {
+ *timearg = '\0';
+ } else {
+ sprintf(timearg, "%02d%02d%04d", numtimbuf.month,
+ numtimbuf.day, numtimbuf.year);
+ }
+ return (status);
+}
+
+
+static unsigned long
+check_cli (struct dsc$descriptor_s *qual)
+{
+/*
+** Routine: check_cli
+**
+** Function: Check to see if a CLD was used to invoke the program.
+**
+** Formal parameters:
+**
+** qual - Address of descriptor for qualifier name to check.
+**
+*/
+ lib$establish(lib$sig_to_ret); /* Establish condition handler */
+ return (cli$present(qual)); /* Just see if something was given */
+}
+
+
+#ifndef TEST
+
+void VMSCLI_help(void) /* VMSCLI version */
+/* Print help (along with license info) to stdout. */
+{
+ extent i; /* counter for help array */
+
+ /* help array */
+ static char *text[] = {
+"Zip %s (%s). Usage: (zip :== $ dev:[dir]zip_cli.exe)",
+"zip archive[.zip] [list] [/EXCL=(xlist)] /options /modifiers",
+" The default action is to add or replace archive entries from list, except",
+" those in xlist. The include file list may contain the special name \"-\" to",
+" compress standard input. If both archive and list are omitted, Zip",
+" compresses stdin to stdout.",
+" Type zip -h for Unix-style flags.",
+" Major options include:",
+" /COPY, /DELETE, /DIFFERENCE, /FILESYNC, /FRESHEN, /GROW, /MOVE, /UPDATE,",
+" /ADJUST_OFFSETS, /FIX_ARCHIVE[={NORMAL|FULL}], /TEST[=UNZIP=cmd], /UNSFX,",
+" Modifiers include:",
+" /BATCH[=list_file], /BEFORE=creation_time, /COMMENTS[={ARCHIVE|FILES}],",
+" /EXCLUDE=(file_list), /EXLIST=file, /INCLUDE=(file_list), /INLIST=file,",
+" /LATEST, /OUTPUT=out_archive, /SINCE=creation_time, /TEMP_PATH=directory,",
+" /LOG_FILE=(FILE=log_file[,APPEND][,INFORMATIONAL]), /MUST_MATCH,",
+" /PATTERN_CASE={BLIND|SENSITIVE}, /NORECURSE|/RECURSE[={PATH|FILENAMES}],",
+" /STORE_TYPES=(type_list),",
+#if CRYPT
+"\
+ /QUIET, /VERBOSE[={MORE|DEBUG}], /[NO]DIRNAMES, /JUNK, /ENCRYPT[=\"pwd\"],\
+",
+#else /* !CRYPT */
+" /QUIET, /VERBOSE[={MORE|DEBUG}], /[NO]DIRNAMES, /JUNK,",
+#endif /* ?CRYPT */
+" /COMPRESSION = {BZIP2|DEFLATE|STORE}, /LEVEL=[0-9], /NOVMS|/VMS[=ALL],",
+" /STORE_TYPES=(type_list), /[NO]PRESERVE_CASE[=([NO]ODS{2|5}[,...])],",
+" /[NO]PKZIP, /[NO]KEEP_VERSION, /DOT_VERSION, /TRANSLATE_EOL[={LF|CRLF}],",
+" /DISPLAY=([BYTES][,COUNTS][,DOTS=mb_per_dot][,GLOBALDOTS][,USIZE]",
+" [,VOLUME]), /DESCRIPTORS, /[NO]EXTRA_FIELDS, /ZIP64,",
+#ifdef S_IFLNK
+" /SPLIT = (SIZE=ssize [,BELL] [,PAUSE] [,VERBOSE]), /SYMLINKS"
+#else /* S_IFLNK */
+" /SPLIT = (SIZE=ssize [,BELL] [,PAUSE] [,VERBOSE])"
+#endif /* S_IFLNK [else] */
+ };
+
+ if (!show_VMSCLI_help) {
+ help();
+ return;
+ }
+
+ for (i = 0; i < sizeof(copyright)/sizeof(char *); i++)
+ {
+ printf(copyright[i], "zip");
+ putchar('\n');
+ }
+ for (i = 0; i < sizeof(text)/sizeof(char *); i++)
+ {
+ printf(text[i], VERSION, REVDATE);
+ putchar('\n');
+ }
+} /* end function VMSCLI_help() */
+
+#endif /* !TEST */
diff --git a/vms/collect_deps.com b/vms/collect_deps.com
new file mode 100644
index 0000000..349307c
--- /dev/null
+++ b/vms/collect_deps.com
@@ -0,0 +1,89 @@
+$! 1 December 2006. SMS.
+$!
+$! Info-ZIP VMS accessory procedure.
+$!
+$! 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.
+$!
+$! 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
+$! immediate evaluation of a macro invocation.
+$!
+$ prefix = f$edit( p4, "COLLAPSE")
+$!
+$ dev_lose = f$edit( f$parse( p5, , , "DEVICE", "SYNTAX_ONLY"), "UPCASE")
+$ dir_lose = f$edit( f$parse( p5, , , "DIRECTORY", "SYNTAX_ONLY"), "UPCASE")
+$ suffix = ".VMS]"
+$ suffix_loc = f$locate( suffix, dir_lose)
+$ if (suffix_loc .lt f$length( dir_lose))
+$ then
+$ dev_dir_lose = dev_lose+ dir_lose- suffix
+$ else
+$ dev_dir_lose = dev_lose+ dir_lose- "]"
+$ endif
+$!
+$! For portability, make the output file record format Stream_LF.
+$!
+$ create /fdl = sys$input 'p2'
+RECORD
+ Carriage_Control carriage_return
+ Format stream_lf
+$!
+$ open /read /write /error = end_main deps_out 'p2'
+$ on error then goto loop_main_end
+$!
+$! Include proper-inclusion-check preface.
+$!
+$ 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 "#"
+$ write deps_out ""
+$ write deps_out -
+ "# This description file is included by other description files. It is"
+$ write deps_out -
+ "# not intended to be used alone. Verify proper inclusion."
+$ write deps_out ""
+$ write deps_out ".IFDEF ''incl_macro'"
+$ write deps_out ".ELSE"
+$ write deps_out -
+ "$$$$ THIS DESCRIPTION FILE IS NOT INTENDED TO BE USED THIS WAY."
+$ write deps_out ".ENDIF"
+$ write deps_out ""
+$!
+$! Actual dependencies from individual dependency files.
+$!
+$ loop_main_top:
+$ file = f$search( p3)
+$ if (file .eqs. "") then goto loop_main_end
+$!
+$ open /read /error = end_subs deps_in 'file'
+$ loop_subs_top:
+$ read /error = loop_subs_end deps_in line
+$ line_reduced = f$edit( line, "COMPRESS, TRIM, UPCASE")
+$ colon = f$locate( " : ", line_reduced)
+$ d_d_l_loc = f$locate( dev_dir_lose, -
+ f$extract( (colon+ 3), 1000, line_reduced))
+$ if (d_d_l_loc .eq. 0)
+$ then
+$ front = f$extract( 0, (colon+ 3), line_reduced)
+$ back = f$extract( (colon+ 3+ f$length( dev_dir_lose)), -
+ 1000, line_reduced)
+$ line = front+ "["+ back
+$ endif
+$ write deps_out "''prefix'"+ "''line'"
+$ goto loop_subs_top
+$!
+$ loop_subs_end:
+$ close deps_in
+$!
+$ goto loop_main_top
+$!
+$ loop_main_end:
+$ close deps_out
+$!
+$ end_main:
+$!
diff --git a/vms/cvthelp.tpu b/vms/cvthelp.tpu
new file mode 100644
index 0000000..8c60369
--- /dev/null
+++ b/vms/cvthelp.tpu
@@ -0,0 +1,182 @@
+! TITLE CVTHELP.TPU
+! IDENT 01-001
+!
+!++
+! Copyright (c) 1990-2001 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
+!
+!++
+!
+! Program: CVTHELP.TPU
+!
+! Author: Hunter Goatley
+!
+! Date: January 12, 1992
+!
+! Purpose: Convert .HELP files to RUNOFF .RNH files. Substitutes
+! RUNOFF commands for tags imbedded in the .HELP file.
+!
+! Calling sequence:
+!
+! $ EDIT/TPU/NOJOURNAL/NODISPLAY/COMMAND=CVTHELP file.HELP
+!
+! Modified by:
+!
+! 01-001 Hunter Goatley 7-FEB-2001 15:40
+! Added <NEXT> for qualifier separators.
+!
+! 01-000 Hunter Goatley 12-JAN-1992 15:15
+! Original version.
+!
+!--
+Procedure eve_convert_help
+Local temp
+ ,x
+ ;
+
+ qualifier_level := 0;
+ hg$substitute_topic(current_buffer, "<MAIN>", ".indent-3", "1");
+ hg$substitute_topic(current_buffer, "<QUALIFIER>", ".sk;.indent-3", "");
+ hg$substitute_topic(current_buffer, "<TOPIC>", ".indent-3", "2");
+ hg$substitute_topic(current_buffer, "<SUBTOPIC>", ".indent-3", "3");
+ hg$substitute_topic(current_buffer, "<SUBSUBTOPIC>", ".indent-3", "4");
+ hg$substitute_comment(current_buffer,"<QUALIFIERS>",".indent-3;2 Qualifiers");
+ hg$substitute_comment(current_buffer,"<PARAMETER>",".indent-2");
+ hg$substitute_comment(current_buffer,"<PTEXT>",".lm+3");
+ hg$substitute_comment(current_buffer,"<TXETP>",".lm-3");
+ hg$substitute_comment(current_buffer,"<ETEXT>",".lm+4");
+ hg$substitute_comment(current_buffer,"<TXETE>",".lm-4");
+ 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,"<LITERAL0>",".literal");
+ hg$substitute_comment(current_buffer,"<0LARETIL>",".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");
+ hg$substitute_comment(current_buffer,"<TSIL>",".end list");
+ hg$substitute_comment(current_buffer,"<CENTER>",".center");
+ hg$substitute_comment(current_buffer,"<FORMAT>",".sk;.indent2");
+ hg$substitute_comment(current_buffer,"<NOTE>",".note");
+ hg$substitute_comment(current_buffer,"<ETON>",".end note");
+ hg$substitute_comment(current_buffer, LINE_BEGIN & LINE_END,".sk");
+ hg$substitute_comment(current_buffer, LINE_BEGIN & "|", "");
+ hg$substitute_comment(current_buffer,"<NEXT>",".br");
+
+EndProcedure; ! eve_convert_help
+
+Procedure hg$substitute_comment (the_buffer, target, new)
+Local temp
+ ,save_pos
+ ,x
+ ;
+ on_error;
+ endon_error;
+
+ save_pos := mark(none);
+ position(beginning_of(the_buffer));
+ loop
+ x := search(target, forward);
+ exitif x = 0;
+ position (x);
+ erase_character(length(x));
+ copy_text(new);
+ endloop;
+
+ position(save_pos);
+
+EndProcedure; ! hg$substitute_comment
+
+Procedure hg$substitute_topic (the_buffer, target, new, level)
+Local temp
+ ,save_pos
+ ,x
+ ;
+ on_error;
+ endon_error;
+
+ save_pos := mark(none);
+ position(beginning_of(the_buffer));
+ loop
+ x := search(target, forward);
+ exitif x = 0;
+ position (x);
+ erase_character(length(x));
+ move_vertical(-1);
+ if (length(current_line) = 0)
+ then copy_text("|");
+ endif;
+ move_vertical(1);
+ copy_text(".!------------------------------------------------------");
+ split_line;
+ copy_text(new);
+ move_horizontal(-current_offset);
+ move_vertical(1);
+ if level <> "" then
+ copy_text(level + " ");
+! else
+! if qualifier_level = 0
+! then
+! copy_text("2 Qualifiers");
+! split_line; split_line;
+! copy_text(new); split_line;
+! qualifier_level := 1;
+! endif;
+ endif;
+ move_horizontal(-current_offset);
+ move_vertical(1);
+ if length(current_line) = 0
+ then
+ if (target = "<MAIN>") OR (target = "<TOPIC>")
+ OR (target = "<SUBTOPIC>") or (target = "<SUBSUBTOPIC>")
+ then copy_text(".br");
+ else copy_text(".sk");
+ endif;
+ endif;
+ endloop;
+
+ position(save_pos);
+
+EndProcedure; ! hg$substitute_topic
+
+!===============================================================================
+Procedure tpu$init_procedure
+Local temp
+ ,orig_filespec
+ ,f
+ ;
+
+ on_error
+ endon_error;
+
+ !Prompt user for information
+
+ orig_filespec := get_info(command_line, "file_name");
+ if orig_filespec = ""
+ then
+ message("No .HELP file given");
+ quit;
+ endif;
+ f := file_parse(orig_filespec, ".HELP"); !Add .LIS ending
+
+ ! Create a buffer and window for editing
+
+ main_buf := create_buffer ("MAIN",f);
+ set (eob_text, main_buf, "[End of buffer]");
+
+ position (beginning_of(main_buf));
+
+ eve_convert_help;
+
+ f := file_parse(orig_filespec,"","",NAME);
+
+ write_file (main_buf, f+".RNH");
+
+ quit;
+EndProcedure; !TPU$INIT_PROCEDURE
+
+tpu$init_procedure;
diff --git a/vms/descrip.mms b/vms/descrip.mms
new file mode 100644
index 0000000..ae2bc04
--- /dev/null
+++ b/vms/descrip.mms
@@ -0,0 +1,358 @@
+# 23 February 2007. SMS.
+#
+# Zip 3.0 for VMS - MMS (or MMK) Description File.
+#
+# Usage:
+#
+# MMS /DESCRIP = [.VMS]DESCRIP.MMS [/MACRO = (<see_below>)] [target]
+#
+# Note that this description file must be used from the main
+# distribution directory, not from the [.VMS] subdirectory.
+#
+# Optional macros:
+#
+# 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.)
+#
+# IM=1 Use the old "IM" scheme for storing VMS/RMS file
+# atributes, instead of the newer "PK" scheme.
+#
+# IZ_BZIP2=dev:[dir] Add optional BZIP2 support. The valus of the
+# MMS macro IZ_BZIP2 ("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 example), or in that
+# directory itself.
+#
+# LARGE=1 Enable large-file (>2GB) support. Non-VAX only.
+#
+# 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_ZIP=c_macro_1=value1 [, c_macro_2=value2 [...]]"
+# Compile with these additional C macros defined.
+#
+# VAX-specific optional macros:
+#
+# VAXC=1 Use the VAX C compiler, assuming "CC" runs it.
+# (That is, DEC C is not installed, or else DEC C is
+# installed, but VAX C is the default.)
+#
+# FORCE_VAXC=1 Use the VAX C compiler, assuming "CC /VAXC" runs it.
+# (That is, DEC C is installed, and it is the
+# default, but you want VAX C anyway, you fool.)
+#
+# GNUC=1 Use the GNU C compiler. (Seriously under-tested.)
+#
+#
+# The default target, ALL, builds the selected product executables and
+# help files.
+#
+# Other targets:
+#
+# CLEAN deletes architecture-specific files, but leaves any
+# individual source dependency files and the help files.
+#
+# CLEAN_ALL deletes all generated files, except the main (collected)
+# source dependency file.
+#
+# CLEAN_EXE deletes only the architecture-specific executables.
+# Handy if all you wish to do is re-link the executables.
+#
+# Example commands:
+#
+# To build the conventional small-file product using the DEC/Compaq/HP C
+# compiler (Note: DESCRIP.MMS is the default description file name.):
+#
+# MMS /DESCRIP = [.VMS]
+#
+# To get the large-file executables (on a non-VAX system):
+#
+# MMS /DESCRIP = [.VMS] /MACRO = (LARGE=1)
+#
+# To delete the architecture-specific generated files for this system
+# type:
+#
+# MMS /DESCRIP = [.VMS] /MACRO = (LARGE=1) CLEAN ! Large-file.
+# or
+# MMS /DESCRIP = [.VMS] CLEAN ! Small-file.
+#
+# To build a complete small-file product for debug with compiler
+# listings and link maps:
+#
+# MMS /DESCRIP = [.VMS] CLEAN
+# MMS /DESCRIP = [.VMS] /MACRO = (DBG=1, LIST=1)
+#
+########################################################################
+
+# Include primary product description file.
+
+INCL_DESCRIP_SRC = 1
+.INCLUDE [.VMS]DESCRIP_SRC.MMS
+
+# Object library names.
+
+LIB_ZIP = [.$(DEST)]ZIP.OLB
+LIB_ZIPCLI = [.$(DEST)]ZIPCLI.OLB
+LIB_ZIPUTILS = [.$(DEST)]ZIPUTILS.OLB
+
+# Help file names.
+
+ZIP_HELP = ZIP.HLP ZIP_CLI.HLP
+
+# Message file names.
+
+ZIP_MSG_MSG = [.VMS]ZIP_MSG.MSG
+ZIP_MSG_EXE = [.$(DEST)]ZIP_MSG.EXE
+ZIP_MSG_OBJ = [.$(DEST)]ZIP_MSG.OBJ
+
+
+# TARGETS.
+
+# Default target, ALL. Build All Zip executables, utility executables,
+# and help files.
+
+ALL : $(ZIP) $(ZIP_CLI) $(ZIPUTILS) $(ZIP_HELP) $(ZIP_MSG_EXE)
+ @ write sys$output "Done."
+
+# CLEAN target. Delete the [.$(DEST)] directory and everything in it.
+
+CLEAN :
+ if (f$search( "[.$(DEST)]*.*") .nes. "") then -
+ delete /noconfirm [.$(DEST)]*.*;*
+ if (f$search( "$(DEST).DIR") .nes. "") then -
+ set protection = w:d $(DEST).DIR;*
+ if (f$search( "$(DEST).DIR") .nes. "") then -
+ delete /noconfirm $(DEST).DIR;*
+
+# CLEAN_ALL target. Delete:
+# The [.$(DEST)] directories and everything in them.
+# All help-related derived files,
+# All individual C dependency files.
+# Also mention:
+# Comprehensive dependency file.
+
+CLEAN_ALL :
+ if (f$search( "[.ALPHA*]*.*") .nes. "") then -
+ delete /noconfirm [.ALPHA*]*.*;*
+ if (f$search( "ALPHA*.DIR", 1) .nes. "") then -
+ set protection = w:d ALPHA*.DIR;*
+ if (f$search( "ALPHA*.DIR", 2) .nes. "") then -
+ delete /noconfirm ALPHA*.DIR;*
+ if (f$search( "[.IA64*]*.*") .nes. "") then -
+ delete /noconfirm [.IA64*]*.*;*
+ if (f$search( "IA64*.DIR", 1) .nes. "") then -
+ set protection = w:d IA64*.DIR;*
+ if (f$search( "IA64*.DIR", 2) .nes. "") then -
+ delete /noconfirm IA64*.DIR;*
+ if (f$search( "[.VAX*]*.*") .nes. "") then -
+ delete /noconfirm [.VAX*]*.*;*
+ if (f$search( "VAX*.DIR", 1) .nes. "") then -
+ set protection = w:d VAX*.DIR;*
+ if (f$search( "VAX*.DIR", 2) .nes. "") then -
+ delete /noconfirm VAX*.DIR;*
+ if (f$search( "[.vms]ZIP_CLI.RNH") .nes. "") then -
+ delete /noconfirm [.vms]ZIP_CLI.RNH;*
+ if (f$search( "ZIP_CLI.HLP") .nes. "") then -
+ delete /noconfirm ZIP_CLI.HLP;*
+ if (f$search( "ZIP.HLP") .nes. "") then -
+ delete /noconfirm ZIP.HLP;*
+ if (f$search( "*.MMSD") .nes. "") then -
+ delete /noconfirm *.MMSD;*
+ if (f$search( "[.vms]*.MMSD") .nes. "") then -
+ delete /noconfirm [.vms]*.MMSD;*
+ @ write sys$output ""
+ @ write sys$output "Note: This procedure will not"
+ @ write sys$output " DELETE [.VMS]DESCRIP_DEPS.MMS;*"
+ @ write sys$output -
+ "You may choose to, but a recent version of MMS (V3.5 or newer?) is"
+ @ write sys$output -
+ "needed to regenerate it. (It may also be recovered from the original"
+ @ write sys$output -
+ "distribution kit.) See [.VMS]DESCRIP_MKDEPS.MMS for instructions on"
+ @ write sys$output -
+ "generating [.VMS]DESCRIP_DEPS.MMS."
+ @ write sys$output ""
+ @ write sys$output -
+ "It also does not delete the error message source file:"
+ @ write sys$output " DELETE [.VMS]ZIP_MSG.MSG;*"
+ @ write sys$output -
+ "but it can regenerate it if needed."
+ @ write sys$output ""
+
+# CLEAN_EXE target. Delete the executables in [.$(DEST)].
+
+CLEAN_EXE :
+ if (f$search( "[.$(DEST)]*.EXE") .nes. "") then -
+ delete /noconfirm [.$(DEST)]*.EXE;*
+
+
+# Object library module dependencies.
+
+$(LIB_ZIP) : $(LIB_ZIP)($(MODS_OBJS_LIB_ZIP))
+ @ write sys$output "$(MMS$TARGET) updated."
+
+$(LIB_ZIPCLI) : $(LIB_ZIPCLI)($(MODS_OBJS_LIB_ZIPCLI))
+ @ write sys$output "$(MMS$TARGET) updated."
+
+$(LIB_ZIPUTILS) : $(LIB_ZIPUTILS)($(MODS_OBJS_LIB_ZIPUTILS))
+ @ write sys$output "$(MMS$TARGET) updated."
+
+# Module ID options file.
+
+OPT_ID = SYS$DISK:[.VMS]ZIP.OPT
+
+# Default C compile rule.
+
+.C.OBJ :
+ $(CC) $(CFLAGS) $(CDEFS_UNX) $(MMS$SOURCE)
+
+
+# Normal sources in [.VMS].
+
+[.$(DEST)]VMS.OBJ : [.VMS]VMS.C
+[.$(DEST)]VMSMUNCH.OBJ : [.VMS]VMSMUNCH.C
+[.$(DEST)]VMSZIP.OBJ : [.VMS]VMSZIP.C
+
+# Command-line interface files.
+
+[.$(DEST)]CMDLINE.OBJ : [.VMS]CMDLINE.C
+ $(CC) $(CFLAGS) $(CDEFS_CLI) $(MMS$SOURCE)
+
+[.$(DEST)]ZIPCLI.OBJ : ZIP.C
+ $(CC) $(CFLAGS) $(CDEFS_CLI) $(MMS$SOURCE)
+
+[.$(DEST)]ZIP_CLI.OBJ : [.VMS]ZIP_CLI.CLD
+
+# Utility variant sources.
+
+[.$(DEST)]CRC32_.OBJ : CRC32.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+[.$(DEST)]CRYPT_.OBJ : CRYPT.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+[.$(DEST)]FILEIO_.OBJ : FILEIO.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+[.$(DEST)]UTIL_.OBJ : UTIL.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+[.$(DEST)]ZIPFILE_.OBJ : ZIPFILE.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+[.$(DEST)]VMS_.OBJ : [.VMS]VMS.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+# Utility main sources.
+
+[.$(DEST)]ZIPCLOAK.OBJ : ZIPCLOAK.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+[.$(DEST)]ZIPNOTE.OBJ : ZIPNOTE.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+[.$(DEST)]ZIPSPLIT.OBJ : ZIPSPLIT.C
+ $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE)
+
+# VAX C LINK options file.
+
+.IFDEF OPT_FILE
+$(OPT_FILE) :
+ open /write opt_file_ln $(OPT_FILE)
+ write opt_file_ln "SYS$SHARE:VAXCRTL.EXE /SHARE"
+ close opt_file_ln
+.ENDIF
+
+# Normal Zip executable.
+
+$(ZIP) : [.$(DEST)]ZIP.OBJ $(LIB_ZIP) $(OPT_FILE)
+ $(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
+ $(LIB_ZIP) /include = (GLOBALS $(INCL_BZIP2_M)) /library, -
+ $(LIB_BZIP2_OPTS) -
+ $(LFLAGS_ARCH) -
+ $(OPT_ID) /options
+
+# CLI Zip executable.
+
+$(ZIP_CLI) : [.$(DEST)]ZIPCLI.OBJ \
+ $(LIB_ZIPCLI) $(OPT_ID) $(OPT_FILE)
+ $(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
+ $(LIB_ZIPCLI) /library, -
+ $(LIB_ZIP) /include = (GLOBALS $(INCL_BZIP2_M)) /library, -
+ $(LIB_BZIP2_OPTS) -
+ $(LFLAGS_ARCH) -
+ $(OPT_ID) /options
+
+# Utility executables.
+
+[.$(DEST)]ZIPCLOAK.EXE : [.$(DEST)]ZIPCLOAK.OBJ \
+ $(LIB_ZIPUTILS) \
+ $(OPT_ID) $(OPT_FILE)
+ $(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
+ $(LIB_ZIPUTILS) /include = (GLOBALS) /library, -
+ $(LFLAGS_ARCH) -
+ $(OPT_ID) /options
+
+[.$(DEST)]ZIPNOTE.EXE : [.$(DEST)]ZIPNOTE.OBJ \
+ $(LIB_ZIPUTILS) \
+ $(OPT_ID) $(OPT_FILE)
+ $(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
+ $(LIB_ZIPUTILS) /include = (GLOBALS) /library, -
+ $(LFLAGS_ARCH) -
+ $(OPT_ID) /options
+
+[.$(DEST)]ZIPSPLIT.EXE : [.$(DEST)]ZIPSPLIT.OBJ \
+ $(LIB_ZIPUTILS) \
+ $(OPT_ID) $(OPT_FILE)
+ $(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
+ $(LIB_ZIPUTILS) /include = (GLOBALS) /library, -
+ $(LFLAGS_ARCH) -
+ $(OPT_ID) /options
+
+# Help files.
+
+ZIP.HLP : [.VMS]VMS_ZIP.RNH
+ runoff /output = $(MMS$TARGET) $(MMS$SOURCE)
+
+ZIP_CLI.HLP : [.VMS]ZIP_CLI.HELP [.VMS]CVTHELP.TPU
+ edit := edit
+ edit /tpu /nosection /nodisplay /command = [.VMS]CVTHELP.TPU -
+ $(MMS$SOURCE)
+ rename /noconfirm ZIP_CLI.RNH; [.VMS];
+ purge /noconfirm /nolog /keep = 1 [.VMS]ZIP_CLI.RNH
+ runoff /output = $(MMS$TARGET) [.VMS]ZIP_CLI.RNH
+
+# Message file.
+
+$(ZIP_MSG_EXE) : $(ZIP_MSG_OBJ)
+ link /shareable = $(MMS$TARGET) $(ZIP_MSG_OBJ)
+
+$(ZIP_MSG_OBJ) : $(ZIP_MSG_MSG)
+ message /object = $(MMS$TARGET) /nosymbols $(ZIP_MSG_MSG)
+
+$(ZIP_MSG_MSG) : ZIPERR.H [.VMS]STREAM_LF.FDL [.VMS]VMS_MSG_GEN.C
+ $(CC) /include = [] /object = [.$(DEST)]VMS_MSG_GEN.OBJ -
+ [.VMS]VMS_MSG_GEN.C
+ $(LINK) /executable = [.$(DEST)]VMS_MSG_GEN.EXE -
+ $(LFLAGS_ARCH) -
+ [.$(DEST)]VMS_MSG_GEN.OBJ
+ create /fdl = [.VMS]STREAM_LF.FDL $(MMS$TARGET)
+ define /user_mode sys$output $(MMS$TARGET)
+ run [.$(DEST)]VMS_MSG_GEN.EXE
+ purge $(MMS$TARGET)
+ delete [.$(DEST)]VMS_MSG_GEN.EXE;*, [.$(DEST)]VMS_MSG_GEN.OBJ;*
+
+# Include generated source dependencies.
+
+INCL_DESCRIP_DEPS = 1
+.INCLUDE [.VMS]DESCRIP_DEPS.MMS
+
diff --git a/vms/descrip_deps.mms b/vms/descrip_deps.mms
new file mode 100644
index 0000000..cf8f9b1
--- /dev/null
+++ b/vms/descrip_deps.mms
@@ -0,0 +1,207 @@
+#
+# Zip 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 : []TAILOR.H
+[.$(DEST)]CRC32.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]CRC32.OBJ : []ZIPERR.H
+[.$(DEST)]CRC32.OBJ : []CRC32.H
+[.$(DEST)]CRC32_.OBJ : []CRC32.C
+[.$(DEST)]CRC32_.OBJ : []ZIP.H
+[.$(DEST)]CRC32_.OBJ : []TAILOR.H
+[.$(DEST)]CRC32_.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]CRC32_.OBJ : []ZIPERR.H
+[.$(DEST)]CRC32_.OBJ : []CRC32.H
+[.$(DEST)]CRYPT.OBJ : []CRYPT.C
+[.$(DEST)]CRYPT.OBJ : []ZIP.H
+[.$(DEST)]CRYPT.OBJ : []TAILOR.H
+[.$(DEST)]CRYPT.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]CRYPT.OBJ : []ZIPERR.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 : []TAILOR.H
+[.$(DEST)]CRYPT_.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]CRYPT_.OBJ : []ZIPERR.H
+[.$(DEST)]CRYPT_.OBJ : []CRYPT.H
+[.$(DEST)]CRYPT_.OBJ : []TTYIO.H
+[.$(DEST)]CRYPT_.OBJ : []CRC32.H
+[.$(DEST)]DEFLATE.OBJ : []DEFLATE.C
+[.$(DEST)]DEFLATE.OBJ : []ZIP.H
+[.$(DEST)]DEFLATE.OBJ : []TAILOR.H
+[.$(DEST)]DEFLATE.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]DEFLATE.OBJ : []ZIPERR.H
+[.$(DEST)]FILEIO.OBJ : []FILEIO.C
+[.$(DEST)]FILEIO.OBJ : []ZIP.H
+[.$(DEST)]FILEIO.OBJ : []TAILOR.H
+[.$(DEST)]FILEIO.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]FILEIO.OBJ : []ZIPERR.H
+[.$(DEST)]FILEIO.OBJ : []CRC32.H
+[.$(DEST)]FILEIO.OBJ : [.VMS]VMS.H
+[.$(DEST)]FILEIO_.OBJ : []FILEIO.C
+[.$(DEST)]FILEIO_.OBJ : []ZIP.H
+[.$(DEST)]FILEIO_.OBJ : []TAILOR.H
+[.$(DEST)]FILEIO_.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]FILEIO_.OBJ : []ZIPERR.H
+[.$(DEST)]FILEIO_.OBJ : []CRC32.H
+[.$(DEST)]FILEIO_.OBJ : [.VMS]VMS.H
+[.$(DEST)]GLOBALS.OBJ : []GLOBALS.C
+[.$(DEST)]GLOBALS.OBJ : []ZIP.H
+[.$(DEST)]GLOBALS.OBJ : []TAILOR.H
+[.$(DEST)]GLOBALS.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]GLOBALS.OBJ : []ZIPERR.H
+[.$(DEST)]TREES.OBJ : []TREES.C
+[.$(DEST)]TREES.OBJ : []ZIP.H
+[.$(DEST)]TREES.OBJ : []TAILOR.H
+[.$(DEST)]TREES.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]TREES.OBJ : []ZIPERR.H
+[.$(DEST)]TTYIO.OBJ : []TTYIO.C
+[.$(DEST)]TTYIO.OBJ : []ZIP.H
+[.$(DEST)]TTYIO.OBJ : []TAILOR.H
+[.$(DEST)]TTYIO.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]TTYIO.OBJ : []ZIPERR.H
+[.$(DEST)]TTYIO.OBJ : []CRYPT.H
+[.$(DEST)]TTYIO.OBJ : []TTYIO.H
+[.$(DEST)]UTIL.OBJ : []UTIL.C
+[.$(DEST)]UTIL.OBJ : []ZIP.H
+[.$(DEST)]UTIL.OBJ : []TAILOR.H
+[.$(DEST)]UTIL.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]UTIL.OBJ : []ZIPERR.H
+[.$(DEST)]UTIL.OBJ : []EBCDIC.H
+[.$(DEST)]UTIL_.OBJ : []UTIL.C
+[.$(DEST)]UTIL_.OBJ : []ZIP.H
+[.$(DEST)]UTIL_.OBJ : []TAILOR.H
+[.$(DEST)]UTIL_.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]UTIL_.OBJ : []ZIPERR.H
+[.$(DEST)]UTIL_.OBJ : []EBCDIC.H
+[.$(DEST)]ZBZ2ERR.OBJ : []ZBZ2ERR.C
+[.$(DEST)]ZBZ2ERR.OBJ : []ZIP.H
+[.$(DEST)]ZBZ2ERR.OBJ : []TAILOR.H
+[.$(DEST)]ZBZ2ERR.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZBZ2ERR.OBJ : []ZIPERR.H
+[.$(DEST)]ZIP.OBJ : []ZIP.C
+[.$(DEST)]ZIP.OBJ : []ZIP.H
+[.$(DEST)]ZIP.OBJ : []TAILOR.H
+[.$(DEST)]ZIP.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZIP.OBJ : []ZIPERR.H
+[.$(DEST)]ZIP.OBJ : []REVISION.H
+[.$(DEST)]ZIP.OBJ : []CRC32.H
+[.$(DEST)]ZIP.OBJ : []CRYPT.H
+[.$(DEST)]ZIP.OBJ : []TTYIO.H
+[.$(DEST)]ZIP.OBJ : [.VMS]VMSMUNCH.H
+[.$(DEST)]ZIP.OBJ : [.VMS]VMS.H
+[.$(DEST)]ZIPCLI.OBJ : []ZIP.C
+[.$(DEST)]ZIPCLI.OBJ : []ZIP.H
+[.$(DEST)]ZIPCLI.OBJ : []TAILOR.H
+[.$(DEST)]ZIPCLI.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZIPCLI.OBJ : []ZIPERR.H
+[.$(DEST)]ZIPCLI.OBJ : []REVISION.H
+[.$(DEST)]ZIPCLI.OBJ : []CRC32.H
+[.$(DEST)]ZIPCLI.OBJ : []CRYPT.H
+[.$(DEST)]ZIPCLI.OBJ : []TTYIO.H
+[.$(DEST)]ZIPCLI.OBJ : [.VMS]VMSMUNCH.H
+[.$(DEST)]ZIPCLI.OBJ : [.VMS]VMS.H
+[.$(DEST)]ZIPCLOAK.OBJ : []ZIPCLOAK.C
+[.$(DEST)]ZIPCLOAK.OBJ : []ZIP.H
+[.$(DEST)]ZIPCLOAK.OBJ : []TAILOR.H
+[.$(DEST)]ZIPCLOAK.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZIPCLOAK.OBJ : []ZIPERR.H
+[.$(DEST)]ZIPCLOAK.OBJ : []REVISION.H
+[.$(DEST)]ZIPCLOAK.OBJ : []CRC32.H
+[.$(DEST)]ZIPCLOAK.OBJ : []CRYPT.H
+[.$(DEST)]ZIPCLOAK.OBJ : []TTYIO.H
+[.$(DEST)]ZIPFILE.OBJ : []ZIPFILE.C
+[.$(DEST)]ZIPFILE.OBJ : []ZIP.H
+[.$(DEST)]ZIPFILE.OBJ : []TAILOR.H
+[.$(DEST)]ZIPFILE.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZIPFILE.OBJ : []ZIPERR.H
+[.$(DEST)]ZIPFILE.OBJ : []REVISION.H
+[.$(DEST)]ZIPFILE.OBJ : [.VMS]VMS.H
+[.$(DEST)]ZIPFILE.OBJ : [.VMS]VMSMUNCH.H
+[.$(DEST)]ZIPFILE.OBJ : [.VMS]VMSDEFS.H
+[.$(DEST)]ZIPFILE_.OBJ : []ZIPFILE.C
+[.$(DEST)]ZIPFILE_.OBJ : []ZIP.H
+[.$(DEST)]ZIPFILE_.OBJ : []TAILOR.H
+[.$(DEST)]ZIPFILE_.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZIPFILE_.OBJ : []ZIPERR.H
+[.$(DEST)]ZIPFILE_.OBJ : []REVISION.H
+[.$(DEST)]ZIPFILE_.OBJ : [.VMS]VMS.H
+[.$(DEST)]ZIPFILE_.OBJ : [.VMS]VMSMUNCH.H
+[.$(DEST)]ZIPFILE_.OBJ : [.VMS]VMSDEFS.H
+[.$(DEST)]ZIPNOTE.OBJ : []ZIPNOTE.C
+[.$(DEST)]ZIPNOTE.OBJ : []ZIP.H
+[.$(DEST)]ZIPNOTE.OBJ : []TAILOR.H
+[.$(DEST)]ZIPNOTE.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZIPNOTE.OBJ : []ZIPERR.H
+[.$(DEST)]ZIPNOTE.OBJ : []REVISION.H
+[.$(DEST)]ZIPSPLIT.OBJ : []ZIPSPLIT.C
+[.$(DEST)]ZIPSPLIT.OBJ : []ZIP.H
+[.$(DEST)]ZIPSPLIT.OBJ : []TAILOR.H
+[.$(DEST)]ZIPSPLIT.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZIPSPLIT.OBJ : []ZIPERR.H
+[.$(DEST)]ZIPSPLIT.OBJ : []REVISION.H
+[.$(DEST)]ZIPUP.OBJ : []ZIPUP.C
+[.$(DEST)]ZIPUP.OBJ : []ZIP.H
+[.$(DEST)]ZIPUP.OBJ : []TAILOR.H
+[.$(DEST)]ZIPUP.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]ZIPUP.OBJ : []ZIPERR.H
+[.$(DEST)]ZIPUP.OBJ : []REVISION.H
+[.$(DEST)]ZIPUP.OBJ : []CRC32.H
+[.$(DEST)]ZIPUP.OBJ : []CRYPT.H
+[.$(DEST)]ZIPUP.OBJ : [.VMS]ZIPUP.H
+[.$(DEST)]CMDLINE.OBJ : [.VMS]CMDLINE.C
+[.$(DEST)]CMDLINE.OBJ : []ZIP.H
+[.$(DEST)]CMDLINE.OBJ : []TAILOR.H
+[.$(DEST)]CMDLINE.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]CMDLINE.OBJ : []ZIPERR.H
+[.$(DEST)]CMDLINE.OBJ : []CRYPT.H
+[.$(DEST)]CMDLINE.OBJ : []REVISION.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMS.C
+[.$(DEST)]VMS.OBJ : []ZIP.H
+[.$(DEST)]VMS.OBJ : []TAILOR.H
+[.$(DEST)]VMS.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]VMS.OBJ : []ZIPERR.H
+[.$(DEST)]VMS.OBJ : [.VMS]ZIPUP.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMS_PK.C
+[.$(DEST)]VMS.OBJ : []CRC32.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMS.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMSDEFS.H
+[.$(DEST)]VMS.OBJ : [.VMS]VMS_IM.C
+[.$(DEST)]VMSMUNCH.OBJ : [.VMS]VMSMUNCH.C
+[.$(DEST)]VMSMUNCH.OBJ : []ZIP.H
+[.$(DEST)]VMSMUNCH.OBJ : []TAILOR.H
+[.$(DEST)]VMSMUNCH.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]VMSMUNCH.OBJ : []ZIPERR.H
+[.$(DEST)]VMSMUNCH.OBJ : [.VMS]VMS.H
+[.$(DEST)]VMSMUNCH.OBJ : [.VMS]VMSMUNCH.H
+[.$(DEST)]VMSMUNCH.OBJ : [.VMS]VMSDEFS.H
+[.$(DEST)]VMSZIP.OBJ : [.VMS]VMSZIP.C
+[.$(DEST)]VMSZIP.OBJ : []ZIP.H
+[.$(DEST)]VMSZIP.OBJ : []TAILOR.H
+[.$(DEST)]VMSZIP.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]VMSZIP.OBJ : []ZIPERR.H
+[.$(DEST)]VMSZIP.OBJ : [.VMS]VMSMUNCH.H
+[.$(DEST)]VMSZIP.OBJ : [.VMS]VMS.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMS.C
+[.$(DEST)]VMS_.OBJ : []ZIP.H
+[.$(DEST)]VMS_.OBJ : []TAILOR.H
+[.$(DEST)]VMS_.OBJ : [.VMS]OSDEP.H
+[.$(DEST)]VMS_.OBJ : []ZIPERR.H
+[.$(DEST)]VMS_.OBJ : [.VMS]ZIPUP.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMS_PK.C
+[.$(DEST)]VMS_.OBJ : []CRC32.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMS.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMSDEFS.H
+[.$(DEST)]VMS_.OBJ : [.VMS]VMS_IM.C
diff --git a/vms/descrip_mkdeps.mms b/vms/descrip_mkdeps.mms
new file mode 100644
index 0000000..9bf5add
--- /dev/null
+++ b/vms/descrip_mkdeps.mms
@@ -0,0 +1,247 @@
+# 1 February 2008. SMS.
+#
+# Zip 3.0 for VMS - MMS Dependency Description File.
+#
+# 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
+#
+# Note that this description file must be used from the main
+# distribution directory, not from the [.VMS] subdirectory.
+#
+# This description file uses these command procedures:
+#
+# [.VMS]MOD_DEP.COM
+# [.VMS]COLLECT_DEPS.COM
+#
+# MMK users without MMS will be unable to generate the dependencies file
+# using this description file, however there should be one supplied in
+# the kit. If this file has been deleted, users in this predicament
+# will need to recover it from the original distribution kit.
+#
+# Note: This dependency generation scheme assumes that the dependencies
+# do not depend on host architecture type or other such variables.
+# Therefore, no "#include" directive in the C source itself should be
+# conditional on such variables.
+#
+# The default target is the comprehensive source dependency file,
+# DEPS_FILE = [.VMS]DESCRIP_DEPS.MMS.
+#
+# Other targets:
+#
+# CLEAN deletes the individual source dependency files,
+# *.MMSD;*, but leaves the comprehensive source dependency
+# file.
+#
+# CLEAN_ALL deletes all source dependency files, including the
+# individual *.MMSD;* files and the comprehensive file,
+# DESCRIP_DEPS.MMS.*.
+#
+
+# Required command procedures.
+
+COMS = [.VMS]MOD_DEP.COM [.VMS]COLLECT_DEPS.COM
+
+# Include the source file lists (among other data).
+
+INCL_DESCRIP_SRC = 1
+.INCLUDE [.VMS]DESCRIP_SRC.MMS
+
+# The ultimate product, a comprehensive dependency list.
+
+DEPS_FILE = [.VMS]DESCRIP_DEPS.MMS
+
+# Detect valid qualifier and/or macro options.
+
+.IF $(FINDSTRING Skip, $(MMSQUALIFIERS)) .eq Skip
+DELETE_MMSD = 1
+.ELSIF NOSKIP
+PURGE_MMSD = 1
+.ELSE
+UNK_MMSD = 1
+.ENDIF
+
+# Dependency suffixes and rules.
+#
+# .FIRST is assumed to be used already, so the MMS qualifier/macro check
+# is included in each rule (one way or another).
+
+.SUFFIXES_BEFORE .C .MMSD
+
+.C.MMSD :
+.IF UNK_MMSD
+ @ write sys$output -
+ " /SKIP_INTERMEDIATES is expected on the MMS command line."
+ @ write sys$output -
+ " For normal behavior (delete .MMSD files), specify ""/SKIP""."
+ @ write sys$output -
+ " To retain the .MMSD files, specify ""/MACRO = NOSKIP=1""."
+ @ exit %x00000004
+.ENDIF
+ $(CC) $(CFLAGS_INCL) $(MMS$SOURCE) /NOLIST /NOOBJECT -
+ /MMS_DEPENDENCIES = (FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
+
+# List of MMS dependency files.
+
+# In case it's not obvious...
+# To extract module name lists from object library module=object lists:
+# 1. Transform "module=[.dest]name.OBJ" into "module=[.dest] name".
+# 2. For [.VMS], add [.VMS] to name.
+# 3. Delete "*]" words.
+#
+# A similar scheme works for executable lists.
+
+MODS_LIB_ZIP_N = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] *, $(MODS_OBJS_LIB_ZIP_N)))
+
+MODS_LIB_ZIP_V = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_ZIP_V)))
+
+MODS_LIB_ZIPUTILS_N = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] *, $(MODS_OBJS_LIB_ZIPUTILS_N)))
+
+MODS_LIB_ZIPUTILS_N_V = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_ZIPUTILS_N_V)))
+
+MODS_LIB_ZIPUTILS_U = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] *, $(MODS_OBJS_LIB_ZIPUTILS_U)))
+
+MODS_LIB_ZIPUTILS_U_V = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_ZIPUTILS_U_V)))
+
+MODS_LIB_ZIPCLI_V = $(FILTER-OUT *], \
+ $(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_ZIPCLI_C_V)))
+
+MODS_ZIP = $(FILTER-OUT *], \
+ $(PATSUBST *]*.EXE, *] *, $(ZIP)))
+
+MODS_ZIPUTILS = $(FILTER-OUT *], \
+ $(PATSUBST *]*.EXE, *] *, $(ZIPUTILS)))
+
+# Complete list of C object dependency file names.
+# Note that the CLI Zip main program object file is a special case.
+
+DEPS = $(FOREACH NAME, \
+ $(MODS_LIB_ZIP_N) $(MODS_LIB_ZIP_V) \
+ $(MODS_ZIPUTILS_N) $(MODS_ZIPUTILS_N_V) \
+ $(MODS_LIB_ZIPUTILS_U) $(MODS_LIB_ZIPUTILS_U_V) \
+ $(MODS_LIB_ZIPCLI_V) \
+ $(MODS_ZIP) ZIPCLI $(MODS_ZIPUTILS), \
+ $(NAME).MMSD)
+
+# Default target is the comprehensive dependency list.
+
+$(DEPS_FILE) : $(DEPS) $(COMS)
+.IF UNK_MMSD
+ @ write sys$output -
+ " /SKIP_INTERMEDIATES is expected on the MMS command line."
+ @ write sys$output -
+ " For normal behavior (delete individual .MMSD files), specify ""/SKIP""."
+ @ write sys$output -
+ " To retain the individual .MMSD files, specify ""/MACRO = NOSKIP=1""."
+ @ exit %x00000004
+.ENDIF
+#
+# Note that the space in P3, which prevents immediate macro
+# expansion, is removed by COLLECT_DEPS.COM.
+#
+ @[.VMS]COLLECT_DEPS.COM "Zip" -
+ "$(MMS$TARGET)" "[...]*.MMSD" "[.$ (DEST)]" $(MMSDESCRIPTION_FILE)
+ @ 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;*
+.ELSE
+ @ write sys$output -
+ "Purging intermediate .MMSD files..."
+ purge /log *.MMSD, [.VMS]*.MMSD
+.ENDIF
+
+# CLEAN target. Delete the individual C dependency files.
+
+CLEAN :
+ if (f$search( "*.MMSD") .nes. "") then -
+ delete /log *.MMSD;*
+ if (f$search( "[.VMS]*.MMSD") .nes. "") then -
+ delete /log [.VMS]*.MMSD;*
+
+# CLEAN_ALL target. Delete:
+# The individual C dependency files.
+# The collected source dependency file.
+
+CLEAN_ALL :
+ if (f$search( "*.MMSD") .nes. "") then -
+ delete /log *.MMSD;*
+ if (f$search( "[.VMS]*.MMSD") .nes. "") then -
+ delete /log [.VMS]*.MMSD;*
+ if (f$search( "[.VMS]DESCRIP_DEPS.MMS") .nes. "") then -
+ delete /log [.VMS]DESCRIP_DEPS.MMS;*
+
+# Explicit dependencies and rules for utility variant modules.
+#
+# The extra dependency on the normal dependency file obviates including
+# the /SKIP warning code in each rule here.
+
+CRC32_.MMSD : CRC32.C CRC32.MMSD
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_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)
+
+CRYPT_.MMSD : CRYPT.C CRYPT.MMSD
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_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)
+
+FILEIO_.MMSD : FILEIO.C FILEIO.MMSD
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_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)
+
+UTIL_.MMSD : UTIL.C UTIL.MMSD
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_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)
+
+ZIPFILE_.MMSD : ZIPFILE.C ZIPFILE.MMSD
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_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)
+
+[.VMS]VMS_.MMSD : [.VMS]VMS.C [.VMS]VMS.MMSD
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_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)
+
+ZIPCLI.MMSD : ZIP.C ZIP.MMSD
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_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)
+
+# Special case. No normal (non-CLI) version.
+
+[.VMS]CMDLINE.MMSD : [.VMS]CMDLINE.C
+.IF UNK_MMSD
+ @ write sys$output -
+ " /SKIP_INTERMEDIATES is expected on the MMS command line."
+ @ write sys$output -
+ " For normal behavior (delete .MMSD files), specify ""/SKIP""."
+ @ write sys$output -
+ " To retain the .MMSD files, specify ""/MACRO = NOSKIP=1""."
+ @ exit %x00000004
+.ENDIF
+ $(CC) $(CFLAGS_INCL) $(CFLAGS_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)
+
diff --git a/vms/descrip_src.mms b/vms/descrip_src.mms
new file mode 100644
index 0000000..33f3281
--- /dev/null
+++ b/vms/descrip_src.mms
@@ -0,0 +1,373 @@
+# 23 February 2007. SMS.
+#
+# Zip 3.0 for VMS - MMS (or MMK) Source Description File.
+#
+
+# This description file is included by other description files. It is
+# not intended to be used alone. Verify proper inclusion.
+
+.IFDEF INCL_DESCRIP_SRC
+.ELSE
+$$$$ THIS DESCRIPTION FILE IS NOT INTENDED TO BE USED THIS WAY.
+.ENDIF
+
+
+# Define MMK architecture macros when using MMS.
+
+.IFDEF __MMK__ # __MMK__
+.ELSE # __MMK__
+ALPHA_X_ALPHA = 1
+IA64_X_IA64 = 1
+VAX_X_VAX = 1
+.IFDEF $(MMS$ARCH_NAME)_X_ALPHA # $(MMS$ARCH_NAME)_X_ALPHA
+__ALPHA__ = 1
+.ENDIF # $(MMS$ARCH_NAME)_X_ALPHA
+.IFDEF $(MMS$ARCH_NAME)_X_IA64 # $(MMS$ARCH_NAME)_X_IA64
+__IA64__ = 1
+.ENDIF # $(MMS$ARCH_NAME)_X_IA64
+.IFDEF $(MMS$ARCH_NAME)_X_VAX # $(MMS$ARCH_NAME)_X_VAX
+__VAX__ = 1
+.ENDIF # $(MMS$ARCH_NAME)_X_VAX
+.ENDIF # __MMK__
+
+# Combine command-line VAX C compiler macros.
+
+.IFDEF VAXC # VAXC
+VAXC_OR_FORCE_VAXC = 1
+.ELSE # VAXC
+.IFDEF FORCE_VAXC # FORCE_VAXC
+VAXC_OR_FORCE_VAXC = 1
+.ENDIF # FORCE_VAXC
+.ENDIF # VAXC
+
+# Analyze architecture-related and option macros.
+
+.IFDEF __ALPHA__ # __ALPHA__
+DECC = 1
+DESTM = ALPHA
+.ELSE # __ALPHA__
+.IFDEF __IA64__ # __IA64__
+DECC = 1
+DESTM = IA64
+.ELSE # __IA64__
+.IFDEF __VAX__ # __VAX__
+.IFDEF VAXC_OR_FORCE_VAXC # VAXC_OR_FORCE_VAXC
+DESTM = VAXV
+.ELSE # VAXC_OR_FORCE_VAXC
+.IFDEF GNUC # GNUC
+CC = GCC
+DESTM = VAXG
+.ELSE # GNUC
+DECC = 1
+DESTM = VAX
+.ENDIF # GNUC
+.ENDIF # VAXC_OR_FORCE_VAXC
+.ELSE # __VAX__
+DESTM = UNK
+UNK_DEST = 1
+.ENDIF # __VAX__
+.ENDIF # __IA64__
+.ENDIF # __ALPHA__
+
+.IFDEF IM # IM
+DESTI = I
+.ELSE # IM
+DESTI =
+.ENDIF # IM
+
+.IFDEF LARGE # LARGE
+.IFDEF __VAX__ # __VAX__
+DESTL =
+.ELSE # __VAX__
+DESTL = L
+.ENDIF # __VAX__
+.ELSE # LARGE
+DESTL =
+.ENDIF # LARGE
+
+DEST = $(DESTM)$(DESTI)$(DESTL)
+SEEK_BZ = $(DESTM)$(DESTL)
+
+# Library module name suffix for XXX_.OBJ with GNU C.
+
+.IFDEF GNUC # GNUC
+GCC_ = _
+.ELSE # GNUC
+GCC_ =
+.ENDIF # GNUC
+
+# Check for option problems.
+
+.IFDEF __VAX__ # __VAX__
+.IFDEF LARGE # LARGE
+LARGE_VAX = 1
+.ENDIF # LARGE
+.IFDEF VAXC_OR_FORCE_VAXC # VAXC_OR_FORCE_VAXC
+.IFDEF GNUC # GNUC
+VAX_MULTI_CMPL = 1
+.ENDIF # GNUC
+.ENDIF # VAXC_OR_FORCE_VAXC
+.ELSE # __VAX__
+.IFDEF VAXC_OR_FORCE_VAXC # VAXC_OR_FORCE_VAXC
+NON_VAX_CMPL = 1
+.ELSE # VAXC_OR_FORCE_VAXC
+.IFDEF GNUC # GNUC
+NON_VAX_CMPL = 1
+.ENDIF # GNUC
+.ENDIF # VAXC_OR_FORCE_VAXC
+.ENDIF # __VAX__
+
+# Complain if warranted. Otherwise, show destination directory.
+# Make the destination directory, if necessary.
+
+.IFDEF UNK_DEST # UNK_DEST
+.FIRST
+ @ write sys$output -
+ " Unknown system architecture."
+.IFDEF __MMK__ # __MMK__
+ @ write sys$output -
+ " MMK on IA64? Try adding ""/MACRO = __IA64__""."
+.ELSE # __MMK__
+ @ write sys$output -
+ " MMS too old? Try adding ""/MACRO = MMS$ARCH_NAME=ALPHA"","
+ @ write sys$output -
+ " or ""/MACRO = MMS$ARCH_NAME=IA64"", or ""/MACRO = MMS$ARCH_NAME=VAX"","
+ @ write sys$output -
+ " as appropriate. (Or try a newer version of MMS.)"
+.ENDIF # __MMK__
+ @ write sys$output ""
+ I_WILL_DIE_NOW. /$$$$INVALID$$$$
+.ELSE # UNK_DEST
+.IFDEF VAX_MULTI_CMPL # VAX_MULTI_CMPL
+.FIRST
+ @ write sys$output -
+ " Macro ""GNUC"" is incompatible with ""VAXC"" or ""FORCE_VAXC""."
+ @ write sys$output ""
+ I_WILL_DIE_NOW. /$$$$INVALID$$$$
+.ELSE # VAX_MULTI_CMPL
+.IFDEF NON_VAX_CMPL # NON_VAX_CMPL
+.FIRST
+ @ write sys$output -
+ " Macros ""GNUC"", ""VAXC"", and ""FORCE_VAXC"" are valid only on VAX."
+ @ write sys$output ""
+ I_WILL_DIE_NOW. /$$$$INVALID$$$$
+.ELSE # NON_VAX_CMPL
+.IFDEF LARGE_VAX # LARGE_VAX
+.FIRST
+ @ write sys$output -
+ " Macro ""LARGE"" is invalid on VAX."
+ @ write sys$output ""
+ I_WILL_DIE_NOW. /$$$$INVALID$$$$
+.ELSE # LARGE_VAX
+.IFDEF IZ_BZIP2 # IZ_BZIP2
+CDEFS_BZ = , BZIP2_SUPPORT
+CFLAGS_INCL = /INCLUDE = ([], [.VMS])
+INCL_BZIP2_M = , ZBZ2ERR
+LIB_BZIP2_OPTS = LIB_BZIP2:LIBBZ2_NS.OLB /library,
+.FIRST
+ @ define incl_bzip2 $(IZ_BZIP2)
+ @ @[.VMS]FIND_BZIP2_LIB.COM $(IZ_BZIP2) $(SEEK_BZ) -
+ LIBBZ2_NS.OLB lib_bzip2
+ @ write sys$output ""
+ @ if (f$trnlnm( "lib_bzip2") .nes. "") then -
+ write sys$output " BZIP2 dir: ''f$trnlnm( "lib_bzip2")'"
+ @ if (f$trnlnm( "lib_bzip2") .eqs. "") then -
+ write sys$output " Can not find BZIP2 object library."
+ @ write sys$output ""
+ @ if (f$trnlnm( "lib_bzip2") .eqs. "") then -
+ I_WILL_DIE_NOW. /$$$$INVALID$$$$
+ @ write sys$output " Destination: [.$(DEST)]"
+ @ write sys$output ""
+ if (f$search( "$(DEST).DIR;1") .eqs. "") then -
+ create /directory [.$(DEST)]
+.ELSE # IZ_BZIP2
+CDEFS_BZ =
+CFLAGS_INCL = /include = []
+INCL_BZIP2_M = , ZBZ2ERR
+LIB_BZIP2_OPTS =
+.FIRST
+ @ write sys$output " Destination: [.$(DEST)]"
+ @ write sys$output ""
+ if (f$search( "$(DEST).DIR;1") .eqs. "") then -
+ create /directory [.$(DEST)]
+.ENDIF # IZ_BZIP2
+.ENDIF # LARGE_VAX
+.ENDIF # NON_VAX_CMPL
+.ENDIF # VAX_MULTI_CMPL
+.ENDIF # UNK_DEST
+
+# DBG options.
+
+.IFDEF DBG # DBG
+CFLAGS_DBG = /debug /nooptimize
+LINKFLAGS_DBG = /debug /traceback
+.ELSE # DBG
+CFLAGS_DBG =
+LINKFLAGS_DBG = /notraceback
+.ENDIF # DBG
+
+# "IM" scheme for storing VMS/RMS file attributes.
+
+.IFDEF IM # IM
+CDEFS_IM = , VMS_IM_EXTRA
+.ELSE # IM
+CDEFS_IM =
+.ENDIF # IM
+
+# Large-file options.
+
+.IFDEF LARGE # LARGE
+CDEFS_LARGE = , LARGE_FILE_SUPPORT
+.ELSE # LARGE
+CDEFS_LARGE =
+.ENDIF # LARGE
+
+# C compiler defines.
+
+.IFDEF LOCAL_ZIP
+C_LOCAL_ZIP = , $(LOCAL_ZIP)
+.ELSE
+C_LOCAL_ZIP =
+.ENDIF
+
+CDEFS = VMS $(CDEFS_BZ) $(CDEFS_IM) $(CDEFS_LARGE) $(C_LOCAL_ZIP)
+
+CDEFS_UNX = /define = ($(CDEFS))
+
+CDEFS_CLI = /define = ($(CDEFS), VMSCLI)
+
+CDEFS_UTIL = /define = ($(CDEFS), UTIL)
+
+# Other C compiler options.
+
+.IFDEF DECC # DECC
+CFLAGS_ARCH = /decc /prefix = (all)
+.ELSE # DECC
+.IFDEF FORCE_VAXC # FORCE_VAXC
+CFLAGS_ARCH = /vaxc
+.IFDEF VAXC # VAXC
+.ELSE # VAXC
+VAXC = 1
+.ENDIF # VAXC
+.ELSE # FORCE_VAXC
+CFLAGS_ARCH =
+.ENDIF # FORCE_VAXC
+.ENDIF # DECC
+
+.IFDEF VAXC_OR_FORCE_VAXC # VAXC_OR_FORCE_VAXC
+OPT_FILE = [.$(DEST)]VAXCSHR.OPT
+LFLAGS_ARCH = $(OPT_FILE) /options,
+.ELSE # VAXC_OR_FORCE_VAXC
+.IFDEF GNUC # GNUC
+OPT_FILE = [.$(DEST)]VAXCSHR.OPT
+LFLAGS_GNU = GNU_CC:[000000]GCCLIB.OLB /LIBRARY
+LFLAGS_ARCH = $(LFLAGS_GNU), SYS$DISK:$(OPT_FILE) /options,
+.ELSE # GNUC
+OPT_FILE =
+LFLAGS_ARCH =
+.ENDIF # GNUC
+.ENDIF # VAXC_OR_FORCE_VAXC
+
+# LIST options.
+
+.IFDEF LIST # LIST
+.IFDEF DECC # DECC
+CFLAGS_LIST = /list = $*.LIS /show = (all, nomessages)
+.ELSE # DECC
+CFLAGS_LIST = /list = $*.LIS /show = (all)
+.ENDIF # DECC
+LINKFLAGS_LIST = /map = $*.MAP /cross_reference /full
+.ELSE # LIST
+CFLAGS_LIST =
+LINKFLAGS_LIST =
+.ENDIF # LIST
+
+# Common CFLAGS and LINKFLAGS.
+
+CFLAGS = \
+ $(CFLAGS_ARCH) $(CFLAGS_DBG) $(CFLAGS_INCL) $(CFLAGS_LIST) $(CCOPTS) \
+ /object = $(MMS$TARGET)
+
+LINKFLAGS = \
+ $(LINKFLAGS_DBG) $(LINKFLAGS_LIST) $(LINKOPTS) \
+ /executable = $(MMS$TARGET)
+
+# Object library module=object lists.
+
+# Primary object library, [].
+
+MODS_OBJS_LIB_ZIP_N = \
+ CRC32=[.$(DEST)]CRC32.OBJ \
+ CRYPT=[.$(DEST)]CRYPT.OBJ \
+ DEFLATE=[.$(DEST)]DEFLATE.OBJ \
+ FILEIO=[.$(DEST)]FILEIO.OBJ \
+ GLOBALS=[.$(DEST)]GLOBALS.OBJ \
+ TREES=[.$(DEST)]TREES.OBJ \
+ TTYIO=[.$(DEST)]TTYIO.OBJ \
+ UTIL=[.$(DEST)]UTIL.OBJ \
+ ZBZ2ERR=[.$(DEST)]ZBZ2ERR.OBJ \
+ ZIPFILE=[.$(DEST)]ZIPFILE.OBJ \
+ ZIPUP=[.$(DEST)]ZIPUP.OBJ
+
+# Primary object library, [.VMS].
+
+MODS_OBJS_LIB_ZIP_V = \
+ VMS=[.$(DEST)]VMS.OBJ \
+ VMSMUNCH=[.$(DEST)]VMSMUNCH.OBJ \
+ VMSZIP=[.$(DEST)]VMSZIP.OBJ
+
+MODS_OBJS_LIB_ZIP = $(MODS_OBJS_LIB_ZIP_N) $(MODS_OBJS_LIB_ZIP_V)
+
+# Utility object library, normal, [].
+
+MODS_OBJS_LIB_ZIPUTILS_N = \
+ GLOBALS=[.$(DEST)]GLOBALS.OBJ \
+ TTYIO=[.$(DEST)]TTYIO.OBJ
+
+# Utility object library, variant, [].
+
+MODS_OBJS_LIB_ZIPUTILS_U = \
+ CRC32$(GCC_)=[.$(DEST)]CRC32_.OBJ \
+ CRYPT$(GCC_)=[.$(DEST)]CRYPT_.OBJ \
+ FILEIO$(GCC_)=[.$(DEST)]FILEIO_.OBJ \
+ UTIL$(GCC_)=[.$(DEST)]UTIL_.OBJ \
+ ZIPFILE$(GCC_)=[.$(DEST)]ZIPFILE_.OBJ
+
+# Utility object library, normal, [.VMS].
+
+MODS_OBJS_LIB_ZIPUTILS_N_V = \
+ VMSMUNCH=[.$(DEST)]VMSMUNCH.OBJ
+
+# Utility object library, variant, [.VMS].
+
+MODS_OBJS_LIB_ZIPUTILS_U_V = \
+ VMS$(GCC_)=[.$(DEST)]VMS_.OBJ
+
+MODS_OBJS_LIB_ZIPUTILS = $(MODS_OBJS_LIB_ZIPUTILS_N) \
+ $(MODS_OBJS_LIB_ZIPUTILS_U) \
+ $(MODS_OBJS_LIB_ZIPUTILS_N_V) \
+ $(MODS_OBJS_LIB_ZIPUTILS_U_V) \
+
+# CLI object library, [.VMS].
+
+MODS_OBJS_LIB_ZIPCLI_C_V = \
+ CMDLINE=[.$(DEST)]CMDLINE.OBJ
+
+MODS_OBJS_LIB_ZIPCLI_CLD_V = \
+ ZIP_CLITABLE=[.$(DEST)]ZIP_CLI.OBJ
+
+MODS_OBJS_LIB_ZIPCLI = \
+ $(MODS_OBJS_LIB_ZIPCLI_C_V) \
+ $(MODS_OBJS_LIB_ZIPCLI_CLD_V)
+
+# Executables.
+
+ZIP = [.$(DEST)]ZIP.EXE
+
+ZIP_CLI = [.$(DEST)]ZIP_CLI.EXE
+
+ZIPUTILS = \
+ [.$(DEST)]ZIPCLOAK.EXE \
+ [.$(DEST)]ZIPNOTE.EXE \
+ [.$(DEST)]ZIPSPLIT.EXE
+
diff --git a/vms/find_bzip2_lib.com b/vms/find_bzip2_lib.com
new file mode 100644
index 0000000..21ebf7b
--- /dev/null
+++ b/vms/find_bzip2_lib.com
@@ -0,0 +1,71 @@
+$! 28 December 2006. SMS.
+$!
+$! Info-ZIP VMS accessory procedure.
+$!
+$! Find the BZIP2 object library under P1, starting in the [.'P2']
+$! destination directory. (We assume, initially, that the BZIP2
+$! directory has a destination directory structure like ours.)
+$!
+$! Set the P4 logical name to the directory where it was found.
+$! P5 and P6 may be used for qualifiers on the DEFINE command.
+$!
+$ bz_orig = p1
+$ dest = p2
+$ libbz2 = p3
+$!
+$! Remove any trailing colon, to allow logical name translation.
+$!
+$ bz_dev_dir = ""
+$ bz_base = bz_orig
+$ if (f$extract( (f$length( bz_base)- 1), 1, bz_base) .eqs. ":")
+$ then
+$ bz_base = bz_base- ":"
+$ endif
+$!
+$ bz_base_eqv = f$trnlnm( bz_base)
+$ if (bz_base_eqv .nes. "")
+$ then
+$ bz_orig = bz_base_eqv
+$ bz_base = bz_base_eqv
+$ endif
+$ bz_base = bz_base- "]"
+$!
+$! Candidate 1 = the actual analogue destination directory.
+$!
+$ bz_dev_dir_cand = bz_base+ "."+ dest+ "]"
+$ lib_cand = bz_dev_dir_cand+ libbz2
+$ if (f$search( lib_cand) .nes. "")
+$ then
+$ bz_dev_dir = bz_dev_dir_cand
+$ else
+$!
+$! Candidate 2 = the actual analogue destination directory + "L".
+$!
+$ bz_dev_dir_cand = bz_base+ "."+ dest+ "L]"
+$ lib_cand = bz_dev_dir_cand+ libbz2
+$ if (f$search( lib_cand) .nes. "")
+$ then
+$ bz_dev_dir = bz_dev_dir_cand
+$ else
+$!
+$! Candidate 3 = the actual user-specified directory.
+$!
+$ bz_dev_dir_cand = bz_orig
+$ lib_cand = bz_dev_dir_cand+ libbz2
+$ if (f$search( lib_cand) .nes. "")
+$ then
+$ bz_dev_dir = bz_dev_dir_cand
+$ endif
+$ endif
+$ endif
+$!
+$ if (bz_dev_dir .nes. "")
+$ then
+$ if (p4 .eqs. "")
+$ then
+$ write sys$output bz_dev_dir
+$ else
+$ define 'p5' 'p4' 'bz_dev_dir' 'p6'
+$ endif
+$ endif
+$!
diff --git a/vms/hlp_lib_next.com b/vms/hlp_lib_next.com
new file mode 100644
index 0000000..f9b14a5
--- /dev/null
+++ b/vms/hlp_lib_next.com
@@ -0,0 +1,17 @@
+$! 21 November 2004. SMS.
+$!
+$! HLP_LIB_NEXT.COM
+$!
+$! Find the next available HLP$LIBRARY[_*] logical name.
+$!
+$ base = "HLP$LIBRARY"
+$ candidate = base
+$ i = 0
+$!
+$ loop_top:
+$ if (i .gt. 0) then candidate = base+ "_"+ f$string( i)
+$ i = i+ 1
+$ if (f$trnlnm( candidate) .nes. "") then goto loop_top
+$!
+$ write sys$output candidate
+$!
diff --git a/vms/install_vms.txt b/vms/install_vms.txt
new file mode 100644
index 0000000..47dfebb
--- /dev/null
+++ b/vms/install_vms.txt
@@ -0,0 +1,158 @@
+
+ VMS (OpenVMS):
+
+ Building:
+
+ 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_ZIP.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_ZIP.COM or DESCRIP.MMS.
+
+ Note that on non-VAX systems with VMS V7.2 or later (and with a
+ sufficiently new C compiler), Zip 3.0 can support files (both data
+ files and Zip archives) larger than 2GB. For the greatest
+ compatibility with previous Zip versions, the builders by default
+ 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_ZIP LARGE
+ or:
+ MMS /DESC = [.VMS] /MACRO = LARGE=1
+
+ o Re-link the executables (small-file and large-file):
+
+ @ [.VMS]BUILD_ZIP LINK
+ @ [.VMS]BUILD_ZIP 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 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_ZIP.COM or MMS/MMK command
+ line to specify the directory where the bzip2 files may be found.
+ For example:
+
+ @ [.VMS]BUILD_ZIP LARGE -
+ IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_3C_VMS]
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1, -
+ IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_3C_VMS])
+
+ Note that historically, Zip 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 Zip with /NAMES = AS_IS. For example:
+
+ @ [.VMS]BUILD_ZIP LARGE "CCOPTS=/NAMES=AS_IS" -
+ IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_3C_VMS]
+ or:
+ MMS /DESC = [.VMS] /MACRO = (LARGE=1, "CCOPTS=/NAMES=AS_IS", -
+ IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_3C_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 (ZIP.HLP for the default
+ UNIX-like command-line interface, ZIP_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_ZIP.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 Zip
+ 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:
+
+ ZIP :== $ dev:[dir]ZIP.EXE ! UNIX-like command line.
+ or:
+ ZIP :== $ dev:[dir]ZIP_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:
+
+ ZIPS :== $ dev:[dir.ALPHA]ZIP.EXE ! ZIPS = small-file Zip.
+ ZIP*L :== $ dev:[dir.ALPHAL]ZIP.EXE ! ZIP[L] = large-file Zip.
+
+ The builders create help text files, ZIP.HLP and ZIP_CLI.HLP.
+ These may be incorporated into an existing help library, or a separate
+ Zip help library may be created using commands like these, using
+ either ZIP.HLP (as shown) or ZIP_CLI.HLP:
+
+ $ LIBRARY /HELP dev:[dir]existing_library.HLB ZIP.HLP
+
+ $ LIBRARY /CREATE /HELP ZIP.HLB ZIP.HLP
+
+ Zip help may then be accessed from a separate Zip help library
+ using a command like:
+
+ $ HELP /LIBRARY = device:[directory]ZIP.HLB
+
+ For greater ease, the user (or system manager) may define a
+ HLP$LIBRARY logical name to allow the HELP utility to find the Zip
+ 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 Zip help library.
+
+ The builders also create VMS message files, ZIP_MSG.EXE, in the
+ destination directory with the program executables. A user may
+ gain DCL access to the Zip error messages using a command like:
+
+ $ SET MESSAGE device:[directory]ZIP_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 Zip are used on the system, and their error
+ message source files differ.
+
+ Some further information may be found in the files
+ [.VMS]00README.TXT and [.VMS]00BINARY.VMS, though much of what's
+ there is now obsolete.
diff --git a/vms/mod_dep.com b/vms/mod_dep.com
new file mode 100644
index 0000000..bbc6d2d
--- /dev/null
+++ b/vms/mod_dep.com
@@ -0,0 +1,33 @@
+$! 3 March 2005. SMS.
+$!
+$! Info-ZIP VMS accessory procedure.
+$!
+$! Modify a dependencies file (P1), changing the object file name to
+$! P2.
+$! P3 = output file specification.
+$!
+$!
+$ prefix = f$edit( p3, "COLLAPSE")
+$!
+$! Strip any device:[directory] from P2.
+$!
+$ obj_name = f$parse( P2, , , "NAME", "SYNTAX_ONLY")+ -
+ f$parse( P2, , , "TYPE", "SYNTAX_ONLY")
+$!
+$ open /read /error = end_main deps_in 'p1'
+$ open /write /error = end_main deps_out 'p3'
+$ on error then goto loop_main_end
+$ loop_main_top:
+$ read /error = loop_main_end deps_in line
+$ line_reduced = f$edit( line, "COMPRESS, TRIM")
+$ colon = f$locate( " : ", line_reduced)
+$ line = obj_name+ f$extract( colon, 2000, line)
+$ write deps_out "''line'"
+$ goto loop_main_top
+$!
+$ loop_main_end:
+$ close deps_in
+$ close deps_out
+$!
+$ end_main:
+$!
diff --git a/vms/osdep.h b/vms/osdep.h
new file mode 100644
index 0000000..d7a07a4
--- /dev/null
+++ b/vms/osdep.h
@@ -0,0 +1,178 @@
+/*
+ Copyright (c) 1990-2007 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 VMS
+# define VMS 1
+#endif
+
+#if (defined(__VMS_VER) && !defined(__CRTL_VER))
+# define __CRTL_VER __VMS_VER
+#endif
+
+#if (defined(__VMS_VERSION) && !defined(VMS_VERSION))
+# define VMS_VERSION __VMS_VERSION
+#endif
+
+#if !(defined(__DECC) || defined(__DECCXX) || defined(__GNUC__))
+ /* VAX C does not properly support the void keyword. (Only functions
+ are allowed to have the type "void".) */
+# ifndef NO_TYPEDEF_VOID
+# define NO_TYPEDEF_VOID
+# endif
+# define NO_FCNTL_H /* VAXC does not supply fcntl.h. */
+#endif /* VAX C */
+
+#define USE_CASE_MAP
+#define PROCNAME(n) \
+ (((action == ADD) || (action == UPDATE) || (action == FRESHEN)) ? \
+ wild(n) : procname(n, filter_match_case))
+
+/* 2004-11-09 SMS.
+ Large file support.
+*/
+#ifdef LARGE_FILE_SUPPORT
+
+# define _LARGEFILE /* Define the pertinent macro. */
+
+/* LARGE_FILE_SUPPORT implies ZIP64_SUPPORT,
+ unless explicitly disabled by NO_ZIP64_SUPPORT.
+*/
+# ifdef NO_ZIP64_SUPPORT
+# ifdef ZIP64_SUPPORT
+# undef ZIP64_SUPPORT
+# endif /* def ZIP64_SUPPORT */
+# else /* def NO_ZIP64_SUPPORT */
+# ifndef ZIP64_SUPPORT
+# define ZIP64_SUPPORT
+# endif /* ndef ZIP64_SUPPORT */
+# endif /* def NO_ZIP64_SUPPORT */
+
+# define ZOFF_T_FORMAT_SIZE_PREFIX "ll"
+
+#else /* def LARGE_FILE_SUPPORT */
+
+# define ZOFF_T_FORMAT_SIZE_PREFIX "l"
+
+#endif /* def LARGE_FILE_SUPPORT */
+
+/* Need _LARGEFILE for types.h. */
+
+#include <types.h>
+
+#ifdef __GNUC__
+#include <sys/types.h>
+#endif /* def __GNUC__ */
+
+/* Need types.h for off_t. */
+
+#ifdef LARGE_FILE_SUPPORT
+ typedef off_t zoff_t;
+ typedef unsigned long long uzoff_t;
+#else /* def LARGE_FILE_SUPPORT */
+ typedef long zoff_t;
+ typedef unsigned long uzoff_t;
+#endif /* def LARGE_FILE_SUPPORT */
+
+#include <stat.h>
+
+typedef struct stat z_stat;
+
+#include <unixio.h>
+
+#if defined(__GNUC__) && !defined(ZCRYPT_INTERNAL)
+# include <unixlib.h> /* ctermid() declaration needed in ttyio.c */
+#endif
+#ifdef ZCRYPT_INTERNAL
+# include <unixlib.h> /* getpid() declaration for srand seed */
+#endif
+
+#if defined(_MBCS)
+# undef _MBCS /* Zip on VMS does not support MBCS */
+#endif
+
+/* VMS is run on little-endian processors with 4-byte ints:
+ * enable the optimized CRC-32 code */
+#ifdef IZ_CRC_BE_OPTIMIZ
+# undef IZ_CRC_BE_OPTIMIZ
+#endif
+#if !defined(IZ_CRC_LE_OPTIMIZ) && !defined(NO_CRC_OPTIMIZ)
+# define IZ_CRC_LE_OPTIMIZ
+#endif
+#if !defined(IZ_CRCOPTIM_UNFOLDTBL) && !defined(NO_CRC_OPTIMIZ)
+# define IZ_CRCOPTIM_UNFOLDTBL
+#endif
+
+#if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)
+# if (defined(__CRTL_VER) && (__CRTL_VER >= 70000000))
+# define USE_EF_UT_TIME
+# endif
+#endif
+
+#if defined(VMS_PK_EXTRA) && defined(VMS_IM_EXTRA)
+# undef VMS_IM_EXTRA /* PK style takes precedence */
+#endif
+#if !defined(VMS_PK_EXTRA) && !defined(VMS_IM_EXTRA)
+# define VMS_PK_EXTRA 1 /* PK style VMS support is default */
+#endif
+
+/* 2007-02-22 SMS.
+ * <unistd.h> is needed for symbolic link functions, so use it when the
+ * symbolic link criteria are met.
+ */
+#if defined(__VAX) || __CRTL_VER < 70301000
+# define NO_UNISTD_H
+# define NO_SYMLINKS
+#endif /* defined(__VAX) || __CRTL_VER < 70301000 */
+
+/* 2007-02-22 SMS. Use delete() when unlink() is not available. */
+#if defined(NO_UNISTD_H) || (__CRTL_VER < 70000000)
+# define unlink delete
+#endif /* defined(NO_UNISTD_H) || __CRTL_VER < 70000000) */
+
+#define SSTAT vms_stat
+#define EXIT(exit_code) vms_exit(exit_code)
+#define RETURN(exit_code) return (vms_exit(exit_code), 1)
+
+
+#ifdef __DECC
+
+/* File open callback ID values. */
+
+# define FOPM_ID 1
+# define FOPR_ID 2
+# define FOPW_ID 3
+
+/* File open callback ID storage. */
+
+extern int fopm_id;
+extern int fopr_id;
+extern int fopw_id;
+
+/* File open callback ID function. */
+
+extern int acc_cb();
+
+/* Option macros for zfopen().
+ * General: Stream access
+ * Output: fixed-length, 512-byte records.
+ *
+ * Callback function (DEC C only) sets deq, mbc, mbf, rah, wbh, ...
+ */
+
+# define FOPM "r+b", "ctx=stm", "rfm=fix", "mrs=512", "acc", acc_cb, &fopm_id
+# define FOPR "rb", "ctx=stm", "acc", acc_cb, &fopr_id
+# define FOPW "wb", "ctx=stm", "rfm=fix", "mrs=512", "acc", acc_cb, &fopw_id
+
+#else /* def __DECC */ /* (So, GNU C, VAX C, ...)*/
+
+# define FOPM "r+b", "ctx=stm", "rfm=fix", "mrs=512"
+# define FOPR "rb", "ctx=stm"
+# define FOPW "wb", "ctx=stm", "rfm=fix", "mrs=512"
+
+#endif /* def __DECC */
+
diff --git a/vms/stream_lf.fdl b/vms/stream_lf.fdl
new file mode 100644
index 0000000..ab0f907
--- /dev/null
+++ b/vms/stream_lf.fdl
@@ -0,0 +1,3 @@
+RECORD
+ Carriage_Control carriage_return
+ Format stream_lf
diff --git a/vms/unixio_gcc.h b/vms/unixio_gcc.h
new file mode 100644
index 0000000..05bc421
--- /dev/null
+++ b/vms/unixio_gcc.h
@@ -0,0 +1,27 @@
+/* 2004-12-12 SMS.
+ *
+ * Emergency replacement UNIXIO.H for GNU C, for use as needed.
+ * Install as GNU_CC_INCLUDE:[000000]UNIXIO.H
+ */
+
+#ifndef __UNIXIO_LOADED
+#define __UNIXIO_LOADED 1
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#ifndef SEEK_SET
+# define SEEK_SET 0
+#endif /* ndef SEEK_SET */
+
+#ifndef SEEK_CUR
+# define SEEK_CUR 1
+#endif /* ndef SEEK_CUR */
+
+#ifndef SEEK_END
+# define SEEK_END 2
+#endif /* ndef SEEK_END */
+
+#endif /* ndef __UNIXIO_LOADED */
+
diff --git a/vms/unixlib_gcc.h b/vms/unixlib_gcc.h
new file mode 100644
index 0000000..eda4ed9
--- /dev/null
+++ b/vms/unixlib_gcc.h
@@ -0,0 +1,16 @@
+/* 2004-12-12 SMS.
+ *
+ * Emergency replacement UNIXLIB.H for GNU C, for use as needed.
+ * Install as GNU_CC_INCLUDE:[000000]UNIXLIB.H
+ */
+
+#ifndef __UNIXLIB_LOADED
+#define __UNIXLIB_LOADED 1
+
+#include <sys/types.h>
+#include <stdlib.h>
+
+typedef struct stat stat_t;
+
+#endif /* ndef __UNIXLIB_LOADED */
+
diff --git a/vms/vms.c b/vms/vms.c
new file mode 100644
index 0000000..1b194c6
--- /dev/null
+++ b/vms/vms.c
@@ -0,0 +1,1007 @@
+/*
+ Copyright (c) 1990-2007 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
+*/
+/*
+ * vms.c (zip) by Igor Mandrichenko Version 2.2-2
+ *
+ * Revision history:
+ * ...
+ * 2.2-2 18-jan-1993 I.Mandrichenko
+ * vms_stat() added - version of stat() that handles special
+ * case when end-of-file-block == 0
+ *
+ * 3.0 11-oct-2004 SMS
+ * It would be nice to know why vms_stat() is needed. If EOF can't
+ * be trusted for a zero-length file, why trust it for any file?
+ * Anyway, I removed the (int) cast on ->st_size, which may now be
+ * bigger than an int, just in case this code ever does get used.
+ * (A true zero-length file should still report zero length, even
+ * after the long fight with RMS.)
+ * Moved the VMS_PK_EXTRA test(s) into VMS_IM.C and VMS_PK.C to
+ * allow more general automatic dependency generation.
+ */
+
+#ifdef VMS /* For VMS only ! */
+
+#define NO_ZIPUP_H /* Prevent full inclusion of vms/zipup.h. */
+
+#include "zip.h"
+#include "zipup.h" /* Only partial. */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <jpidef.h>
+#include <fab.h> /* Needed only in old environments. */
+#include <nam.h> /* Needed only in old environments. */
+#include <starlet.h>
+#include <ssdef.h>
+#include <stsdef.h>
+
+/* On VAX, define Goofy VAX Type-Cast to obviate /standard = vaxc.
+ Otherwise, lame system headers on VAX cause compiler warnings.
+ (GNU C may define vax but not __VAX.)
+*/
+#ifdef vax
+# define __VAX 1
+#endif /* def vax */
+
+#ifdef __VAX
+# define GVTC (unsigned int)
+#else /* def __VAX */
+# define GVTC
+#endif /* def __VAX */
+
+
+#ifdef UTIL
+
+/* For utilities, include only vms.h, as either of the vms_XX.c files
+ * would do.
+ */
+
+# include "vms.h"
+
+#else /* not UTIL */
+
+/* Include the `VMS attributes' preserving file-io code. We distinguish
+ between two incompatible flavours of storing VMS attributes in the
+ Zip archive:
+ a) The "PKware" style follows the extra field specification for
+ PKware's VMS Zip.
+ b) The "IM (Info-ZIP)" flavour was defined from scratch by
+ Igor Mandrichenko. This version has be used in official Info-ZIP
+ releases for several years and is known to work well.
+ */
+
+/* Note that only one of these #include directives will include any
+ * active code, depending on VMS_PK_EXTRA. Both are included here (and
+ * tested there) to allow more general automatic dependency generation.
+ */
+
+#include "vms_pk.c"
+#include "vms_im.c"
+
+#endif /* not UTIL [else] */
+
+#ifndef ERR
+#define ERR(x) (((x)&1)==0)
+#endif
+
+#ifndef NULL
+#define NULL (void*)(0L)
+#endif
+
+int vms_stat( char *file, stat_t *s)
+{
+ int status;
+ int staterr;
+ struct FAB fab;
+ struct NAM_STRUCT nam;
+ struct XABFHC fhc;
+
+ /*
+ * In simplest case when stat() returns "ok" and file size is
+ * nonzero or this is directory, finish with this
+ */
+
+ if( (staterr=stat(file,s)) == 0
+ && ( s->st_size >= 0 /* Size - ok */
+ || (s->st_mode & S_IFREG) == 0 /* Not a plain file */
+ )
+ ) return staterr;
+
+ /*
+ * Get here to handle the special case when stat() returns
+ * invalid file size. Use RMS to compute the size.
+ * When EOF block is zero, set file size to its physical size.
+ * One more case to get here is when this is remote file accessed
+ * via DECnet.
+ */
+
+ fab = cc$rms_fab;
+ nam = CC_RMS_NAM;
+ fhc = cc$rms_xabfhc;
+ fab.FAB_NAM = &nam;
+ fab.fab$l_xab = (char*)(&fhc);
+
+#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 /* def NAML$C_MAXRSS */
+
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = file;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen( file);
+
+ fab.fab$b_fac = FAB$M_GET;
+
+ status = sys$open(&fab);
+ fab.fab$l_xab = (char*)0L;
+ sys$close(&fab);
+
+ if( !ERR(status) )
+ {
+ if( fhc.xab$l_ebk > 0 )
+ s->st_size = ( fhc.xab$l_ebk-1 ) * 512 + fhc.xab$w_ffb;
+ else if( fab.fab$b_org == FAB$C_IDX
+ || fab.fab$b_org == FAB$C_REL
+ || fab.fab$b_org == FAB$C_HSH )
+ /* Special case, when ebk=0: save entire allocated space */
+ s->st_size = fhc.xab$l_hbk * 512;
+ else
+ s->st_size = fhc.xab$w_ffb;
+ return 0; /* stat() success code */
+ }
+ else
+ return status;
+}
+
+
+/*
+ * 2007-01-29 SMS.
+ *
+ * VMS Status Code Summary (See STSDEF.H for details.)
+ *
+ * Bits: 31:28 27:16 15:3 2:0
+ * Field: Control Facility Message Severity
+ *
+ * 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). The
+ * Severity codes are 0 = Warning, 1 = Success, 2 = Error, 3 = Info,
+ * 4 = Severe (fatal).
+ *
+ * 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_ZIP macro is defined at build-time, we
+ * will use the official Facility code.
+ *
+ */
+
+/* Official HP-assigned Info-ZIP Zip Facility code. */
+#define FAC_IZ_ZIP 1955 /* 0x7A3 */
+
+#ifndef CTL_FAC_IZ_ZIP
+ /*
+ * Default is inhibit-printing with the official Facility code.
+ */
+# define CTL_FAC_IZ_ZIP ((0x1 << 12)| FAC_IZ_ZIP)
+# define MSG_FAC_SPEC 0x8000 /* Facility-specific code. */
+#else /* ndef CTL_FAC_IZ_ZIP */
+ /* Use the user-supplied Control+Facility code for err or warn. */
+# define OLD_STATUS
+# 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_ZIP [else] */
+
+
+/* Return an intelligent status/severity code. */
+
+void vms_exit(e)
+ int e;
+{
+ {
+#ifndef OLD_STATUS
+
+ /*
+ * Exit with code comprising Control, Facility, (facility-specific)
+ * Message, and Severity.
+ */
+ exit( (CTL_FAC_IZ_ZIP << 16) | /* Facility */
+ MSG_FAC_SPEC | /* Facility-specific */
+ (e << 4) | /* Message code */
+ (ziperrors[ e].severity & 0x07) /* Severity */
+ );
+
+#else /* ndef OLD_STATUS */
+
+ /* 2007-01-17 SMS.
+ * Defining OLD_STATUS provides the same behavior as in Zip versions
+ * before an official VMS Facility code had been assigned, which
+ * means that Success (ZE_OK) gives a status value of 1 (SS$_NORMAL)
+ * with no Facility code, while any error or warning gives a status
+ * value which includes a Facility code. (Curiously, under the old
+ * scheme, message codes were left-shifted by 4 instead of 3,
+ * resulting in all-even message codes.) I don't like this, but I
+ * was afraid to remove it, as someone, somewhere may be depending
+ * on it. Define CTL_FAC_IZ_ZIP as 0x7FFF to get the old behavior.
+ * Define only OLD_STATUS to get the old behavior for Success
+ * (ZE_OK), but using the official HP-assigned Facility code for an
+ * error or warning. Define MSG_FAC_SPEC to get the desired
+ * behavior.
+ *
+ * Exit with simple SS$_NORMAL for ZE_OK. Otherwise, exit with code
+ * comprising Control, Facility, Message, and Severity.
+ */
+ exit(
+ (e == ZE_OK) ? SS$_NORMAL : /* Success (others below) */
+ ((CTL_FAC_IZ_ZIP << 16) | /* Facility */
+ MSG_FAC_SPEC | /* Facility-specific (?) */
+ (e << 4) | /* Message code */
+ (ziperrors[ e].severity & 0x07) /* Severity */
+ )
+ );
+
+#endif /* ndef OLD_STATUS */
+ }
+}
+
+
+/******************************/
+/* Function version_local() */
+/******************************/
+
+void version_local()
+{
+ static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n";
+#ifdef VMS_VERSION
+ char *chrp1;
+ char *chrp2;
+ char buf[40];
+ char vms_vers[ 16];
+ int ver_maj;
+#endif
+#ifdef __DECC_VER
+ char buf2[40];
+ int vtyp;
+#endif
+
+#ifdef VMS_VERSION
+ /* Truncate the version string at the first (trailing) space. */
+ strncpy( vms_vers, VMS_VERSION, sizeof( vms_vers));
+ chrp1 = strchr( vms_vers, ' ');
+ if (chrp1 != NULL)
+ *chrp1 = '\0';
+
+ /* Determine the major version number. */
+ ver_maj = 0;
+ chrp1 = strchr( &vms_vers[ 1], '.');
+ for (chrp2 = &vms_vers[ 1];
+ chrp2 < chrp1;
+ ver_maj = ver_maj* 10+ *(chrp2++)- '0');
+
+#endif /* def 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"). */
+
+ printf(CompiledWith,
+
+#ifdef __GNUC__
+ "gcc ", __VERSION__,
+#else
+# if defined(DECC) || defined(__DECC) || defined (__DECC__)
+ "DEC C",
+# 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
+ "",
+# endif
+# else
+# ifdef VAXC
+ "VAX C", "",
+# else
+ "unknown compiler", "",
+# endif
+# endif
+#endif
+
+#ifdef VMS_VERSION
+# if defined( __alpha)
+ "OpenVMS",
+ (sprintf( buf, " (%s Alpha)", vms_vers), buf),
+# elif defined( __ia64) /* defined( __alpha) */
+ "OpenVMS",
+ (sprintf( buf, " (%s IA64)", vms_vers), buf),
+# else /* defined( __alpha) */
+ (ver_maj >= 6) ? "OpenVMS" : "VMS",
+ (sprintf( buf, " (%s VAX)", vms_vers), buf),
+# endif /* defined( __alpha) */
+#else
+ "VMS",
+ "",
+#endif /* def VMS_VERSION */
+
+#ifdef __DATE__
+ " on ", __DATE__
+#else
+ "", ""
+#endif
+ );
+
+} /* end function version_local() */
+
+/* 2004-10-08 SMS.
+ *
+ * tempname() for VMS.
+ *
+ * Generate a temporary Zip archive file name, near the actual
+ * destination Zip archive file, or at "tempath", if specified.
+ *
+ * Using sys$parse() is probably more work than it's worth, but it
+ * should also be ODS5-safe.
+ *
+ * Note that the generic method using tmpnam() (in FILEIO.C)
+ * produces "ziXXXXXX", where "XXXXXX" is the low six digits of the
+ * decimal representation of the process ID. This method produces
+ * "ZIxxxxxxxx", where "xxxxxxxx" is the (whole) eight-digit
+ * hexadecimal representation of the process ID. More important, it
+ * actually uses the directory part of the argument or "tempath".
+ */
+
+
+char *tempname( char *zip)
+/* char *zip; */ /* Path name of Zip archive. */
+{
+ char *temp_name; /* Return value. */
+ int sts; /* System service status. */
+
+ static int pid; /* Process ID. */
+ static int pid_len; /* Returned size of process ID. */
+
+ struct /* Item list for GETJPIW. */
+ {
+ short buf_len; /* Buffer length. */
+ short itm_cod; /* Item code. */
+ int *buf; /* Buffer address. */
+ int *ret_len; /* Returned length. */
+ int term; /* Item list terminator. */
+ } jpi_itm_lst = { sizeof( pid), JPI$_PID, &pid, &pid_len };
+
+ /* ZI<UNIQUE> name storage. */
+ static char zip_tmp_nam[ 16] = "ZI<unique>.;";
+
+ struct FAB fab; /* FAB structure. */
+ struct NAM_STRUCT nam; /* NAM[L] structure. */
+
+ char exp_str[ NAM_MAXRSS+ 1]; /* Expanded name storage. */
+
+#ifdef VMS_UNIQUE_TEMP_BY_TIME
+
+ /* Use alternate time-based scheme to generate a unique temporary name. */
+ sprintf( &zip_tmp_nam[ 2], "%08X", time( NULL));
+
+#else /* def VMS_UNIQUE_TEMP_BY_TIME */
+
+ /* Use the process ID to generate a unique temporary name. */
+ sts = sys$getjpiw( 0, 0, 0, &jpi_itm_lst, 0, 0, 0);
+ sprintf( &zip_tmp_nam[ 2], "%08X", pid);
+
+#endif /* def VMS_UNIQUE_TEMP_BY_TIME */
+
+ /* Smoosh the unique temporary name against the actual Zip archive
+ name (or "tempath") to create the full temporary path name.
+ (Truncate it at the file type to remove any file type.)
+ */
+ if (tempath != NULL) /* Use "tempath", if it's been specified. */
+ zip = tempath;
+
+ /* Initialize the FAB and NAM[L], and link the NAM[L] to the FAB. */
+ fab = cc$rms_fab;
+ nam = CC_RMS_NAM;
+ fab.FAB_NAM = &nam;
+
+ /* Point the FAB/NAM[L] fields to the actual name and default name. */
+
+#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 /* def NAML$C_MAXRSS */
+
+ /* Default name = Zip archive name. */
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNA = zip;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNS = strlen( zip);
+
+ /* File name = "ZI<unique>,;". */
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = zip_tmp_nam;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen( zip_tmp_nam);
+
+ nam.NAM_ESA = exp_str; /* Expanded name (result) storage. */
+ nam.NAM_ESS = NAM_MAXRSS; /* Size of expanded name storage. */
+
+ nam.NAM_NOP = NAM_M_SYNCHK; /* Syntax-only analysis. */
+
+ temp_name = NULL; /* Prepare for failure (unlikely). */
+ sts = sys$parse( &fab, 0, 0); /* Parse the name(s). */
+
+ if ((sts& STS$M_SEVERITY) == STS$M_SUCCESS)
+ {
+ /* Overlay any resulting file type (typically ".ZIP") with none. */
+ strcpy( nam.NAM_L_TYPE, ".;");
+
+ /* Allocate temp name storage (as caller expects), and copy the
+ (truncated) temp name into the new location.
+ */
+ temp_name = malloc( strlen( nam.NAM_ESA)+ 1);
+
+ if (temp_name != NULL)
+ {
+ strcpy( temp_name, nam.NAM_ESA);
+ }
+ }
+ return temp_name;
+} /* tempname() for VMS. */
+
+
+/* 2005-02-17 SMS.
+ *
+ * ziptyp() for VMS.
+ *
+ * Generate a real Zip archive file name (exact, if it exists), using
+ * a default file name.
+ *
+ * 2005-02-17 SMS. Moved to here from [-]ZIPFILE.C, to segregate
+ * better the RMS stuff.
+ *
+ * Before 2005-02-17, if sys$parse() failed, ziptyp() returned a null
+ * string ("&zero", where "static char zero = '\0';"). This
+ * typically caused Zip to proceed, but then the final rename() of
+ * the temporary archive would (silently) fail (null file name, after
+ * all), leaving only the temporary archive file, and providing no
+ * warning message to the victim. Now, when sys$parse() fails,
+ * ziptyp() returns the original string, so a later open() fails, and
+ * a relatively informative message is provided. (A VMS-specific
+ * message could also be provided here, if desired.)
+ *
+ * 2005-09-16 SMS.
+ * Changed name parsing in ziptyp() to solve a problem with a
+ * search-list logical name device-directory spec for the zipfile.
+ * Previously, when the zipfile did not exist (so sys$search()
+ * failed), the expanded name was used, but as it was
+ * post-sys$search(), it was based on the _last_ member of the search
+ * list instead of the first. Now, the expanded name from the
+ * original sys$parse() (pre-sys$search()) is retained, and it is
+ * used if sys$search() fails. This name is based on the first
+ * member of the search list, as a user might expect.
+ */
+
+/* Default Zip archive file spec. */
+#define DEF_DEVDIRNAM "SYS$DISK:[].zip"
+
+char *ziptyp( char *s)
+{
+ int status;
+ int exp_len;
+ struct FAB fab;
+ struct NAM_STRUCT nam;
+ char result[ NAM_MAXRSS+ 1];
+ char exp[ NAM_MAXRSS+ 1];
+ char *p;
+
+ fab = cc$rms_fab; /* Initialize FAB. */
+ nam = CC_RMS_NAM; /* Initialize NAM[L]. */
+ fab.FAB_NAM = &nam; /* FAB -> 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 /* def NAML$C_MAXRSS */
+
+ /* Argument file name and length. */
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = s;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen( s);
+
+ /* Default file spec and length. */
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNA = DEF_DEVDIRNAM;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNS = sizeof( DEF_DEVDIRNAM)- 1;
+
+ nam.NAM_ESA = exp; /* Expanded name, */
+ nam.NAM_ESS = NAM_MAXRSS; /* storage size. */
+ nam.NAM_RSA = result; /* Resultant name, */
+ nam.NAM_RSS = NAM_MAXRSS; /* storage size. */
+
+ status = sys$parse(&fab);
+ if ((status & 1) == 0)
+ {
+ /* Invalid file name. Return (re-allocated) original, and hope
+ for a later error message.
+ */
+ if ((p = malloc( strlen( s)+ 1)) != NULL )
+ {
+ strcpy( p, s);
+ }
+ return p;
+ }
+
+ /* Save expanded name length from sys$parse(). */
+ exp_len = nam.NAM_ESL;
+
+ /* Leave expanded name as-is, in case of search failure. */
+ nam.NAM_ESA = NULL; /* Expanded name, */
+ nam.NAM_ESS = 0; /* storage size. */
+
+ status = sys$search(&fab);
+ if (status & 1)
+ { /* Zip file exists. Use resultant (complete, exact) name. */
+ if ((p = malloc( nam.NAM_RSL+ 1)) != NULL )
+ {
+ result[ nam.NAM_RSL] = '\0';
+ strcpy( p, result);
+ }
+ }
+ else
+ { /* New Zip file. Use pre-search expanded name. */
+ if ((p = malloc( exp_len+ 1)) != NULL )
+ {
+ exp[ exp_len] = '\0';
+ strcpy( p, exp);
+ }
+ }
+ return p;
+} /* ziptyp() for VMS. */
+
+
+/* 2005-12-30 SMS.
+ *
+ * vms_file_version().
+ *
+ * Return the ";version" part of a VMS file specification.
+ */
+
+char *vms_file_version( char *s)
+{
+ int status;
+ struct FAB fab;
+ struct NAM_STRUCT nam;
+ char *p;
+
+ static char exp[ NAM_MAXRSS+ 1]; /* Expanded name storage. */
+
+
+ fab = cc$rms_fab; /* Initialize FAB. */
+ nam = CC_RMS_NAM; /* Initialize NAM[L]. */
+ fab.FAB_NAM = &nam; /* FAB -> 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 /* def NAML$C_MAXRSS */
+
+ /* Argument file name and length. */
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = s;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen( s);
+
+ nam.NAM_ESA = exp; /* Expanded name, */
+ nam.NAM_ESS = NAM_MAXRSS; /* storage size. */
+
+ nam.NAM_NOP = NAM_M_SYNCHK; /* Syntax-only analysis. */
+
+ status = sys$parse(&fab);
+
+ if ((status & 1) == 0)
+ {
+ /* Invalid file name. Return "". */
+ exp[ 0] = '\0';
+ p = exp;
+ }
+ else
+ {
+ /* Success. NUL-terminate, and return a pointer to the ";" in
+ the expanded name storage buffer.
+ */
+ p = nam.NAM_L_VER;
+ p[ nam.NAM_B_VER] = '\0';
+ }
+ return p;
+} /* vms_file_version(). */
+
+
+/* 2004-11-23 SMS.
+ *
+ * get_rms_defaults().
+ *
+ * Get user-specified values from (DCL) SET RMS_DEFAULT. FAB/RAB
+ * items of particular interest are:
+ *
+ * fab$w_deq default extension quantity (blocks) (write).
+ * rab$b_mbc multi-block count.
+ * rab$b_mbf multi-buffer count (used with rah and wbh).
+ */
+
+#define DIAG_FLAG (verbose >= 2)
+
+/* Default RMS parameter values. */
+
+#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. */
+
+/* GETJPI item descriptor structure. */
+typedef struct
+ {
+ short buf_len;
+ short itm_cod;
+ void *buf;
+ int *ret_len;
+ } jpi_item_t;
+
+/* Durable storage */
+
+static int rms_defaults_known = 0;
+
+/* JPI item buffers. */
+static unsigned short rms_ext;
+static char rms_mbc;
+static unsigned char rms_mbf;
+
+/* Active RMS item values. */
+unsigned short rms_ext_active;
+char rms_mbc_active;
+unsigned char rms_mbf_active;
+
+/* GETJPI item lengths. */
+static int rms_ext_len; /* Should come back 2. */
+static int rms_mbc_len; /* Should come back 1. */
+static int rms_mbf_len; /* Should come back 1. */
+
+/* Desperation attempts to define unknown macros. Probably doomed.
+ * If these get used, expect sys$getjpiw() to return %x00000014 =
+ * %SYSTEM-F-BADPARAM, bad parameter value.
+ * They keep compilers with old header files quiet, though.
+ */
+#ifndef JPI$_RMS_EXTEND_SIZE
+# define JPI$_RMS_EXTEND_SIZE 542
+#endif /* ndef JPI$_RMS_EXTEND_SIZE */
+
+#ifndef JPI$_RMS_DFMBC
+# define JPI$_RMS_DFMBC 535
+#endif /* ndef JPI$_RMS_DFMBC */
+
+#ifndef JPI$_RMS_DFMBFSDK
+# 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;
+ int term;
+ } jpi_itm_lst =
+ { { 2, JPI$_RMS_EXTEND_SIZE, &rms_ext, &rms_ext_len },
+ { 1, JPI$_RMS_DFMBC, &rms_mbc, &rms_mbc_len },
+ { 1, JPI$_RMS_DFMBFSDK, &rms_mbf, &rms_mbf_len },
+ 0
+ };
+
+int get_rms_defaults()
+{
+int sts;
+
+/* Get process RMS_DEFAULT values. */
+
+sts = sys$getjpiw( 0, 0, 0, &jpi_itm_lst, 0, 0, 0);
+if ((sts& STS$M_SEVERITY) != STS$M_SUCCESS)
+ {
+ /* Failed. Don't try again. */
+ rms_defaults_known = -1;
+ }
+else
+ {
+ /* Fine, but don't come back. */
+ rms_defaults_known = 1;
+ }
+
+/* Limit the active values according to the RMS_DEFAULT values. */
+
+if (rms_defaults_known > 0)
+ {
+ /* Set the default values. */
+
+ rms_ext_active = RMS_DEQ_DEFAULT;
+ rms_mbc_active = RMS_MBC_DEFAULT;
+ rms_mbf_active = RMS_MBF_DEFAULT;
+
+ /* Default extend quantity. Use the user value, if set. */
+ if (rms_ext > 0)
+ {
+ rms_ext_active = rms_ext;
+ }
+
+ /* Default multi-block count. Use the user value, if set. */
+ if (rms_mbc > 0)
+ {
+ rms_mbc_active = rms_mbc;
+ }
+
+ /* Default multi-buffer count. Use the user value, if set. */
+ if (rms_mbf > 0)
+ {
+ rms_mbf_active = rms_mbf;
+ }
+ }
+
+if (DIAG_FLAG)
+ {
+ fprintf( stderr,
+ "Get RMS defaults. getjpi sts = %%x%08x.\n",
+ sts);
+
+ if (rms_defaults_known > 0)
+ {
+ fprintf( stderr,
+ " Default: deq = %6d, mbc = %3d, mbf = %3d.\n",
+ rms_ext, rms_mbc, rms_mbf);
+ }
+ }
+return sts;
+}
+
+#ifdef __DECC
+
+/* 2004-11-23 SMS.
+ *
+ * acc_cb(), access callback function for DEC C zfopen().
+ *
+ * Set some RMS FAB/RAB items, with consideration of user-specified
+ * values from (DCL) SET RMS_DEFAULT. Items of particular interest are:
+ *
+ * fab$w_deq default extension quantity (blocks).
+ * rab$b_mbc multi-block count.
+ * rab$b_mbf multi-buffer count (used with rah and wbh).
+ *
+ * See also the FOP* macros in OSDEP.H. Currently, no notice is
+ * 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.)
+ */
+
+/* Global storage. */
+
+int fopm_id = FOPM_ID; /* Callback id storage, modify. */
+int fopr_id = FOPR_ID; /* Callback id storage, read. */
+int fopw_id = FOPW_ID; /* Callback id storage, write. */
+
+int fhow_id = FHOW_ID; /* Callback id storage, in read. */
+
+/* acc_cb() */
+
+int acc_cb( int *id_arg, struct FAB *fab, struct RAB *rab)
+{
+int sts;
+
+/* Get process RMS_DEFAULT values, if not already done. */
+if (rms_defaults_known == 0)
+ {
+ get_rms_defaults();
+ }
+
+/* If RMS_DEFAULT (and adjusted active) values are available, then set
+ * the FAB/RAB parameters. If RMS_DEFAULT values are not available,
+ * suffer with the default parameters.
+ */
+if (rms_defaults_known > 0)
+ {
+ /* Set the FAB/RAB parameters accordingly. */
+ fab-> fab$w_deq = rms_ext_active;
+ rab-> rab$b_mbc = rms_mbc_active;
+ rab-> rab$b_mbf = rms_mbf_active;
+
+ /* Truncate at EOF on close, as we'll probably over-extend. */
+ fab-> fab$v_tef = 1;
+
+ /* If using multiple buffers, enable read-ahead and write-behind. */
+ if (rms_mbf_active > 1)
+ {
+ rab-> rab$v_rah = 1;
+ rab-> rab$v_wbh = 1;
+ }
+
+ if (DIAG_FLAG)
+ {
+ fprintf( mesg,
+ "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);
+ }
+ }
+
+/* Declare success. */
+return 0;
+}
+
+#endif /* def __DECC */
+
+/*
+ * 2004-09-19 SMS.
+ *
+ *----------------------------------------------------------------------
+ *
+ * decc_init()
+ *
+ * On non-VAX systems, uses LIB$INITIALIZE to set a collection of C
+ * RTL features without using the DECC$* logical name method.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#ifdef __DECC
+
+#ifdef __CRTL_VER
+
+#if !defined( __VAX) && (__CRTL_VER >= 70301000)
+
+#include <unixlib.h>
+
+/*--------------------------------------------------------------------*/
+
+/* Global storage. */
+
+/* Flag to sense if decc_init() was called. */
+
+int decc_init_done = -1;
+
+/*--------------------------------------------------------------------*/
+
+/* decc_init()
+
+ Uses LIB$INITIALIZE to set a collection of C RTL features without
+ requiring the user to define the corresponding logical names.
+*/
+
+/* Structure to hold a DECC$* feature name and its desired value. */
+
+typedef struct
+ {
+ char *name;
+ int value;
+ } decc_feat_t;
+
+/* Array of DECC$* feature names and their desired values. */
+
+decc_feat_t decc_feat_array[] = {
+
+ /* Preserve command-line case with SET PROCESS/PARSE_STYLE=EXTENDED */
+ { "DECC$ARGV_PARSE_STYLE", 1 },
+
+ /* Preserve case for file names on ODS5 disks. */
+ { "DECC$EFS_CASE_PRESERVE", 1 },
+
+ /* Enable multiple dots (and most characters) in ODS5 file names,
+ while preserving VMS-ness of ";version". */
+ { "DECC$EFS_CHARSET", 1 },
+
+ /* List terminator. */
+ { (char *)NULL, 0 } };
+
+/* LIB$INITIALIZE initialization function. */
+
+static void decc_init( void)
+{
+int feat_index;
+int feat_value;
+int feat_value_max;
+int feat_value_min;
+int i;
+int sts;
+
+/* Set the global flag to indicate that LIB$INITIALIZE worked. */
+
+decc_init_done = 1;
+
+/* Loop through all items in the decc_feat_array[]. */
+
+for (i = 0; decc_feat_array[ i].name != NULL; i++)
+ {
+ /* Get the feature index. */
+ feat_index = decc$feature_get_index( decc_feat_array[ i].name);
+ if (feat_index >= 0)
+ {
+ /* Valid item. Collect its properties. */
+ feat_value = decc$feature_get_value( feat_index, 1);
+ feat_value_min = decc$feature_get_value( feat_index, 2);
+ feat_value_max = decc$feature_get_value( feat_index, 3);
+
+ if ((decc_feat_array[ i].value >= feat_value_min) &&
+ (decc_feat_array[ i].value <= feat_value_max))
+ {
+ /* Valid value. Set it if necessary. */
+ if (feat_value != decc_feat_array[ i].value)
+ {
+ sts = decc$feature_set_value( feat_index,
+ 1,
+ decc_feat_array[ i].value);
+ }
+ }
+ else
+ {
+ /* Invalid DECC feature value. */
+ printf( " INVALID DECC FEATURE VALUE, %d: %d <= %s <= %d.\n",
+ feat_value,
+ feat_value_min, decc_feat_array[ i].name, feat_value_max);
+ }
+ }
+ else
+ {
+ /* Invalid DECC feature name. */
+ printf( " UNKNOWN DECC FEATURE: %s.\n", decc_feat_array[ i].name);
+ }
+ }
+}
+
+/* Get "decc_init()" into a valid, loaded LIB$INITIALIZE PSECT. */
+
+#pragma nostandard
+
+/* Establish the LIB$INITIALIZE PSECTs, with proper alignment and
+ other attributes. Note that "nopic" is significant only on VAX.
+*/
+#pragma extern_model save
+
+#pragma extern_model strict_refdef "LIB$INITIALIZ" 2, nopic, nowrt
+const int spare[ 8] = { 0 };
+
+#pragma extern_model strict_refdef "LIB$INITIALIZE" 2, nopic, nowrt
+void (*const x_decc_init)() = decc_init;
+
+#pragma extern_model restore
+
+/* Fake reference to ensure loading the LIB$INITIALIZE PSECT. */
+
+#pragma extern_model save
+
+int LIB$INITIALIZE( void);
+
+#pragma extern_model strict_refdef
+int dmy_lib$initialize = (int) LIB$INITIALIZE;
+
+#pragma extern_model restore
+
+#pragma standard
+
+#endif /* !defined( __VAX) && (__CRTL_VER >= 70301000) */
+
+#endif /* def __CRTL_VER */
+
+#endif /* def __DECC */
+
+#endif /* VMS */
diff --git a/vms/vms.h b/vms/vms.h
new file mode 100644
index 0000000..8685fdd
--- /dev/null
+++ b/vms/vms.h
@@ -0,0 +1,354 @@
+/*
+ Copyright (c) 1990-2007 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
+*/
+/*---------------------------------------------------------------------------
+
+ vms.h
+
+ Generic VMS header file for Info-ZIP's Zip and UnZip.
+
+ ---------------------------------------------------------------------------*/
+
+#ifndef __vms_h
+#define __vms_h 1
+
+#ifndef __DESCRIP_LOADED
+#include <descrip.h>
+#endif
+#ifndef __STARLET_LOADED
+#include <starlet.h>
+#endif
+#ifndef __SYIDEF_LOADED
+#include <syidef.h>
+#endif
+#ifndef __ATRDEF_LOADED
+#include <atrdef.h>
+#endif
+#ifndef __FIBDEF_LOADED
+#include <fibdef.h>
+#endif
+#ifndef __IODEF_LOADED
+#include <iodef.h>
+#endif
+#if !defined(_RMS_H) && !defined(__RMS_LOADED)
+#include <rms.h>
+#endif
+
+#define ERR(s) !((s) & 1) /* VMS system error */
+
+#ifndef SYI$_VERSION
+#define SYI$_VERSION 4096 /* VMS 5.4 definition */
+#endif
+
+/*
+ * Under Alpha (DEC C in VAXC mode) and under `good old' VAXC, the FIB unions
+ * are declared as variant_unions. DEC C (Alpha) in ANSI modes and third
+ * party compilers which do not support `variant_union' define preprocessor
+ * symbols to `hide' the "intermediate union/struct" names from the
+ * programmer's API.
+ * We check the presence of these defines and for DEC's FIBDEF.H defining
+ * __union as variant_union to make sure we access the structure correctly.
+ */
+#define variant_union 1
+#if defined(fib$w_did) || (defined(__union) && (__union == variant_union))
+# define FIB$W_DID fib$w_did
+# define FIB$W_FID fib$w_fid
+# define FIB$L_ACCTL fib$l_acctl
+# define FIB$W_EXCTL fib$w_exctl
+#else
+# define FIB$W_DID fib$r_did_overlay.fib$w_did
+# define FIB$W_FID fib$r_fid_overlay.fib$w_fid
+# define FIB$L_ACCTL fib$r_acctl_overlay.fib$l_acctl
+# define FIB$W_EXCTL fib$r_exctl_overlay.fib$w_exctl
+#endif
+#undef variant_union
+
+
+/* 2005-02-08 SMS. Moved NAM[L] macros here from VMS.C. */
+
+/* Define macros for use with either NAM or NAML. */
+
+#ifdef NAML$C_MAXRSS /* NAML is available. Use it. */
+
+# define NAM_STRUCT NAML
+
+# define FAB_OR_NAML( fab, nam) nam
+# define FAB_OR_NAML_DNA naml$l_long_defname
+# define FAB_OR_NAML_DNS naml$l_long_defname_size
+# 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_DID naml$w_did
+# define NAM_DVI naml$t_dvi
+# 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_FID naml$w_fid
+# define NAM_FNB naml$l_fnb
+# 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_MAXRSS NAML$C_MAXRSS
+# define NAM_NOP naml$b_nop
+# define NAM_M_EXP_DEV NAML$M_EXP_DEV
+# 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
+
+#else /* def NAML$C_MAXRSS */ /* NAML is not available. Use NAM. */
+
+# define NAM_STRUCT NAM
+
+# define FAB_OR_NAML( fab, nam) fab
+# define FAB_OR_NAML_DNA fab$l_dna
+# define FAB_OR_NAML_DNS fab$b_dns
+# 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_DID nam$w_did
+# define NAM_DVI nam$t_dvi
+# define NAM_ESA nam$l_esa
+# define NAM_ESL nam$b_esl
+# define NAM_ESS nam$b_ess
+# define NAM_FID nam$w_fid
+# define NAM_FNB nam$l_fnb
+# define NAM_RSA nam$l_rsa
+# define NAM_RSL nam$b_rsl
+# define NAM_RSS nam$b_rss
+# define NAM_MAXRSS NAM$C_MAXRSS
+# define NAM_NOP nam$b_nop
+# define NAM_M_EXP_DEV NAM$M_EXP_DEV
+# 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
+
+#endif /* def NAML$C_MAXRSS */
+
+
+struct EB_header /* Common header of extra block */
+{ ush tag;
+ ush size;
+ uch data[1];
+};
+
+#ifndef EB_HEADSIZE
+# define EB_HEADSIZE 4
+#endif
+
+/*------ Old style Info-ZIP extra field definitions -----*/
+
+#if (!defined(VAXC) && !defined(_RMS_H) && !defined(__RMS_LOADED))
+
+struct XAB { /* This definition may be skipped */
+ unsigned char xab$b_cod;
+ unsigned char xab$b_bln;
+ short int xabdef$$_fill_1;
+ char *xab$l_nxt;
+};
+
+#endif /* !VAXC && !_RMS_H && !__RMS_LOADED */
+
+#ifndef EB_IZVMS_BCMASK
+# define EB_IZVMS_BCMASK 07 /* 3 bits for compression type */
+#endif
+#ifndef EB_IZVMS_BCSTOR
+# define EB_IZVMS_BCSTOR 0 /* Stored */
+#endif
+#ifndef EB_IZVMS_BC00
+# define EB_IZVMS_BC00 1 /* 0byte -> 0bit compression */
+#endif
+#ifndef EB_IZVMS_BCDEFL
+# define EB_IZVMS_BCDEFL 2 /* Deflated */
+#endif
+
+/*
+ * Extra record format
+ * ===================
+ * signature (2 bytes) = 'I','M'
+ * size (2 bytes)
+ * block signature (4 bytes)
+ * flags (2 bytes)
+ * uncomprssed size(2 bytes)
+ * reserved (4 bytes)
+ * data ((size-12) bytes)
+ * ....
+ */
+
+struct IZ_block /* Extra field block header structure */
+{
+ ush sig;
+ ush size;
+ ulg bid;
+ ush flags;
+ ush length;
+ ulg reserved;
+ uch body[1]; /* The actual size is unknown */
+};
+
+/*
+ * Extra field signature and block signatures
+ */
+
+#define IZ_SIGNATURE "IM"
+#define FABSIG "VFAB"
+#define XALLSIG "VALL"
+#define XFHCSIG "VFHC"
+#define XDATSIG "VDAT"
+#define XRDTSIG "VRDT"
+#define XPROSIG "VPRO"
+#define XKEYSIG "VKEY"
+#define XNAMSIG "VNAM"
+#define VERSIG "VMSV"
+
+/*
+ * Block sizes
+ */
+
+#define FABL (cc$rms_fab.fab$b_bln)
+#define RABL (cc$rms_rab.rab$b_bln)
+#define XALLL (cc$rms_xaball.xab$b_bln)
+#define XDATL (cc$rms_xabdat.xab$b_bln)
+#define XFHCL (cc$rms_xabfhc.xab$b_bln)
+#define XKEYL (cc$rms_xabkey.xab$b_bln)
+#define XPROL (cc$rms_xabpro.xab$b_bln)
+#define XRDTL (cc$rms_xabrdt.xab$b_bln)
+#define XSUML (cc$rms_xabsum.xab$b_bln)
+#define EXTBSL 4 /* Block signature length */
+#define RESL 8 /* Reserved 8 bytes */
+#define EXTHL (EB_HEADSIZE+EXTBSL+RESL)
+
+typedef unsigned char byte;
+
+struct iosb
+{
+ ush status;
+ ush count;
+ ulg spec;
+};
+
+/*------------ PKWARE extra block definitions ----------*/
+
+/* Structure of PKWARE extra header */
+
+#ifdef VMS_ZIP
+
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __nostandard
+#endif /* __DECC || __DECCXX */
+
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __member_alignment __save
+#pragma __nomember_alignment
+#endif /* __DECC || __DECCXX */
+
+#ifdef VMS_ORIGINAL_PK_LAYOUT
+/* The original order of ATR fields in the PKZIP VMS-extra field leads
+ * to unaligned fields in the PK_info structure representing the
+ * extra field layout. When compiled for Alpha AXP, this results in
+ * some performance (and code size) penalty. It is not allowed to
+ * apply structure padding, since this is explicitely forbidden in
+ * the specification (APPNOTE.TXT) for the PK VMS extra field.
+ */
+typedef struct
+{
+ ush tag_ra; ush len_ra; byte ra[ATR$S_RECATTR];
+ ush tag_uc; ush len_uc; byte uc[ATR$S_UCHAR];
+ ush tag_jr; ush len_jr; byte jr[ATR$S_JOURNAL];
+ ush tag_cd; ush len_cd; byte cd[ATR$S_CREDATE];
+ ush tag_rd; ush len_rd; byte rd[ATR$S_REVDATE];
+ ush tag_ed; ush len_ed; byte ed[ATR$S_EXPDATE];
+ ush tag_bd; ush len_bd; byte bd[ATR$S_BAKDATE];
+ ush tag_rn; ush len_rn; ush rn;
+ ush tag_ui; ush len_ui; byte ui[ATR$S_UIC];
+ ush tag_fp; ush len_fp; byte fp[ATR$S_FPRO];
+ ush tag_rp; ush len_rp; byte rp[ATR$S_RPRO];
+} PK_info_t;
+#else /* !VMS_ORIGINAL_PK_LAYOUT */
+/* The Info-ZIP support for the PK VMS extra field uses a reordered
+ * field layout to achieve ``natural alignment'' of the PK_info structure
+ * members whenever possible. This rearrangement does not violate the
+ * PK's VMS extra field specification and should not break any ``well
+ * behaving'' (PK)Unzip utility. (`Well behaving' means that (PK)Unzip
+ * should use the field tag to identify the ATR$ field rather than
+ * assuming a fixed order of ATR$ fields in the PK VMS extra field.)
+ */
+typedef struct
+{
+ ush tag_ra; ush len_ra; byte ra[ATR$S_RECATTR];
+ ush tag_uc; ush len_uc; byte uc[ATR$S_UCHAR];
+ ush tag_cd; ush len_cd; byte cd[ATR$S_CREDATE];
+ ush tag_rd; ush len_rd; byte rd[ATR$S_REVDATE];
+ ush tag_ed; ush len_ed; byte ed[ATR$S_EXPDATE];
+ ush tag_bd; ush len_bd; byte bd[ATR$S_BAKDATE];
+ ush tag_rn; ush len_rn; ush rn;
+ ush tag_ui; ush len_ui; byte ui[ATR$S_UIC];
+ ush tag_fp; ush len_fp; byte fp[ATR$S_FPRO];
+ ush tag_rp; ush len_rp; byte rp[ATR$S_RPRO];
+ ush tag_jr; ush len_jr; byte jr[ATR$S_JOURNAL];
+} PK_info_t;
+#endif /* ?VMS_ORIGINAL_PK_LAYOUT */
+
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __member_alignment __restore
+#endif /* __DECC || __DECCXX */
+
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __standard
+#endif /* __DECC || __DECCXX */
+
+#endif /* VMS_ZIP */
+
+/* PKWARE "VMS" tag */
+#define PK_SIGNATURE 0x000C
+
+/* Total number of attributes to be saved */
+#define VMS_ATTR_COUNT 11
+#define VMS_MAX_ATRCNT 20
+
+struct PK_field
+{
+ ush tag;
+ ush size;
+ byte value[1];
+};
+
+#define PK_FLDHDR_SIZE 4
+
+struct PK_header
+{
+ ush tag;
+ ush size;
+ ulg crc32;
+ byte data[1];
+};
+
+#define PK_HEADER_SIZE 8
+
+char *vms_file_version( char *s);
+
+#endif /* !__vms_h */
diff --git a/vms/vms_im.c b/vms/vms_im.c
new file mode 100644
index 0000000..001088b
--- /dev/null
+++ b/vms/vms_im.c
@@ -0,0 +1,926 @@
+/*
+ Copyright (c) 1990-2007 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
+*/
+/*
+ * vms_im.c (zip) by Igor Mandrichenko Version 2.2-2
+ *
+ * Revision history:
+ * ...
+ * 2.1-1 16-feb-1993 I.Mandrichenko
+ * Get file size from XABFHC and check bytes rest in file before
+ * reading.
+ * 2.1-2 2-mar-1993 I.Mandrichenko
+ * Make code more standard
+ * 2.2 21-jun-1993 I.Mandrichenko
+ * Free all allocated space, use more static storage.
+ * Use memcompress() from bits.c (deflation) for block compression.
+ * To revert to old compression method #define OLD_COMPRESS
+ * 2.2-2 28-sep-1995 C.Spieler
+ * Reorganized code for easier maintance of the two incompatible
+ * flavours (IM style and PK style) VMS attribute support.
+ * Generic functions (common to both flavours) are now collected
+ * in a `wrapper' source file that includes one of the VMS attribute
+ * handlers.
+ * 3.0 23-Oct-2004 Steven Schweda
+ * Changed to maintain compatibility with VMS_PK.C. Note that
+ * reading with sys$read() prevents getting any data past EOF,
+ * regardless of appearances. Moved the VMS_PK_EXTRA test into
+ * here from VMS.C to allow more general automatic dependency
+ * generation.
+ * 17-Feb-2005 Steven Schweda
+ * Added support for ODS5 extended names.
+ */
+
+#ifdef VMS /* For VMS only ! */
+
+#ifndef VMS_PK_EXTRA
+
+#define OLD_COMPRESS /*To use old compression method define it.*/
+
+#ifdef VMS_ZIP
+#undef VMS_ZIP /* do NOT include PK style Zip definitions */
+#endif
+
+#include "vms.h"
+
+#ifndef __LIB$ROUTINES_LOADED
+#include <lib$routines.h>
+#endif
+
+#ifndef UTIL
+
+#define RET_ERROR 1
+#define RET_SUCCESS 0
+#define RET_EOF 0
+
+#define Kbyte 1024
+
+typedef struct XAB *xabptr;
+
+/*
+ * Block sizes
+ */
+
+#define EXTL0 ((FABL + EXTHL)+ \
+ (XFHCL + EXTHL)+ \
+ (XPROL + EXTHL)+ \
+ (XDATL + EXTHL)+ \
+ (XRDTL + EXTHL))
+
+#ifdef OLD_COMPRESS
+#define PAD sizeof(uch)
+#else
+#define PAD 10*sizeof(ush) /* Two extra bytes for compr. header */
+#endif
+
+#define PAD0 (5*PAD) /* Reserve space for the case when
+ * compression fails */
+static int _compress(uch *from, uch *to, int size);
+#ifdef DEBUG
+static void dump_rms_block(uch *p);
+#endif /* DEBUG */
+
+/********************************
+ * Function set_extra_field *
+ ********************************/
+/*
+ | 2004-11-11 SMS.
+ | Changed to use separate storage for ->extra and ->cextra. Zip64
+ | processing may move (reallocate) one and not the other.
+ */
+
+static uch *_compress_block(register struct IZ_block *to,
+ uch *from, int size, char *sig);
+static int get_vms_version(char *verbuf, int len);
+
+int set_extra_field(z, z_utim)
+ struct zlist far *z;
+ iztimes *z_utim;
+/*
+ * Get file VMS file attributes and store them into extent fields.
+ * Store VMS version also.
+ * On error leave z intact.
+ */
+{
+ int status;
+ uch *xtra;
+ uch *cxtra;
+ uch *scan;
+ extent extra_l;
+ static struct FAB fab;
+ static struct NAM_STRUCT nam;
+ static struct XABSUM xabsum;
+ static struct XABFHC xabfhc;
+ static struct XABDAT xabdat;
+ static struct XABPRO xabpro;
+ static struct XABRDT xabrdt;
+ xabptr x = (xabptr)NULL, xab_chain = (xabptr)NULL, last_xab = (xabptr)NULL;
+ int nk, na;
+ int i;
+ int rc=RET_ERROR;
+ char verbuf[80];
+ int verlen = 0;
+
+ if (!vms_native)
+ {
+#ifdef USE_EF_UT_TIME
+ /*
+ * A `portable' zipfile entry is created. Create an "UT" extra block
+ * containing UNIX style modification time stamp in UTC, which helps
+ * maintaining the `real' "last modified" time when the archive is
+ * transfered across time zone boundaries.
+ */
+# ifdef IZ_CHECK_TZ
+ if (!zp_tz_is_valid)
+ return ZE_OK; /* skip silently if no valid TZ info */
+# endif
+ if ((xtra = (uch *) malloc( EB_HEADSIZE+ EB_UT_LEN( 1))) == NULL)
+ return ZE_MEM;
+
+ if ((cxtra = (uch *) malloc( EB_HEADSIZE+ EB_UT_LEN( 1))) == NULL)
+ return ZE_MEM;
+
+ /* Fill xtra[] with data. */
+ xtra[ 0] = 'U';
+ xtra[ 1] = 'T';
+ xtra[ 2] = EB_UT_LEN(1); /* length of data part of e.f. */
+ xtra[ 3] = 0;
+ xtra[ 4] = EB_UT_FL_MTIME;
+ xtra[ 5] = (uch) (z_utim->mtime);
+ xtra[ 6] = (uch) (z_utim->mtime >> 8);
+ xtra[ 7] = (uch) (z_utim->mtime >> 16);
+ xtra[ 8] = (uch) (z_utim->mtime >> 24);
+
+ /* Copy xtra[] data into cxtra[]. */
+ memcpy( cxtra, xtra, (EB_HEADSIZE+ EB_UT_LEN( 1)));
+
+ /* Set sizes and pointers. */
+ z->cext = z->ext = (EB_HEADSIZE+ EB_UT_LEN( 1));
+ z->extra = (char *) xtra;
+ z->cextra = (char *) cxtra;
+
+#endif /* USE_EF_UT_TIME */
+
+ return RET_SUCCESS;
+ }
+
+ /*
+ * Initialize RMS control blocks and link them
+ */
+
+ fab = cc$rms_fab;
+ nam = CC_RMS_NAM;
+ xabsum = cc$rms_xabsum;
+ xabdat = cc$rms_xabdat;
+ xabfhc = cc$rms_xabfhc;
+ xabpro = cc$rms_xabpro;
+ xabrdt = cc$rms_xabrdt;
+
+ fab.FAB_NAM = &nam;
+ fab.fab$l_xab = (char*)&xabsum;
+ /*
+ * Open the file and read summary information.
+ */
+
+#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 /* def NAML$C_MAXRSS */
+
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = z->name;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen( z->name);
+
+#ifdef NAML$M_OPEN_SPECIAL
+ /* 2007-02-28 SMS.
+ * If processing symlinks as symlinks ("-y"), then $OPEN the
+ * link, not the target file.
+ *
+ * (nam.naml$v_open_special gets us the symlink itself instead of
+ * its target. fab.fab$v_bio is necessary to allow sys$open() to
+ * work. Without it, you get status %x0001860c, "%RMS-F-ORG,
+ * invalid file organization value".)
+ */
+ if (linkput)
+ {
+ nam.naml$v_open_special = 1;
+ fab.fab$v_bio = 1;
+ }
+#endif /* def NAML$M_OPEN_SPECIAL */
+
+ status = sys$open(&fab);
+ if (ERR(status))
+ {
+#ifdef DEBUG
+ printf("set_extra_field: sys$open for file %s:\n error status = %d\n",
+ z->name, status);
+#endif
+ goto err_exit;
+ }
+
+ nk = xabsum.xab$b_nok;
+ na = xabsum.xab$b_noa;
+#ifdef DEBUG
+ printf("%d keys, %d alls\n", nk, na);
+#endif
+
+ /*
+ * Allocate XABKEY and XABALL blocks and link them
+ */
+
+ xabfhc.xab$l_nxt = (char*)&xabdat;
+ xabdat.xab$l_nxt = (char*)&xabpro;
+ xabpro.xab$l_nxt = (char*)&xabrdt;
+ xabrdt.xab$l_nxt = NULL;
+
+ xab_chain = (xabptr)(&xabfhc);
+ last_xab = (xabptr)(&xabrdt);
+
+#define INIT(ptr,size,type,init) \
+ if ( (ptr = (type *)malloc(size)) == NULL ) \
+ { \
+ printf( "set_extra_field: Insufficient memory.\n" ); \
+ goto err_exit; \
+ } \
+ *(ptr) = (init);
+ /*
+ * Allocate and initialize all needed XABKEYs and XABALLs
+ */
+ for (i = 0; i < nk; i++)
+ {
+ struct XABKEY *k;
+ INIT(k, XKEYL, struct XABKEY, cc$rms_xabkey);
+ k->xab$b_ref = i;
+ if (last_xab != NULL)
+ last_xab->xab$l_nxt = (char*)k;
+ last_xab = (xabptr)k;
+ }
+ for (i = 0; i < na; i++)
+ {
+ struct XABALL *a;
+ INIT(a, XALLL, struct XABALL, cc$rms_xaball);
+ a->xab$b_aid = i;
+ if (last_xab != NULL)
+ last_xab->xab$l_nxt = (char*)a;
+ last_xab = (xabptr)a;
+ }
+
+ fab.fab$l_xab = (char*)xab_chain;
+#ifdef DEBUG
+ printf("Dump of XAB chain before $DISPLAY:\n");
+ for (x = xab_chain; x != NULL; x = x->xab$l_nxt)
+ dump_rms_block((uch *)x);
+#endif
+ /*
+ * Get information on the file structure etc.
+ */
+ status = sys$display(&fab, 0, 0);
+ if (ERR(status))
+ {
+#ifdef DEBUG
+ printf("set_extra_field: sys$display for file %s:\n error status = %d\n",
+ z->name, status);
+#endif
+ goto err_exit;
+ }
+
+#ifdef DEBUG
+ printf("\nDump of XAB chain after $DISPLAY:\n");
+ for (x = xab_chain; x != NULL; x = x->xab$l_nxt)
+ dump_rms_block((uch *)x);
+#endif
+
+ fab.fab$l_xab = NULL; /* Keep XABs */
+ status = sys$close(&fab);
+ if (ERR(status))
+ {
+#ifdef DEBUG
+ printf("set_extra_field: sys$close for file %s:\n error status = %d\n",
+ z->name, status);
+#endif
+ goto err_exit;
+ }
+
+ extra_l = EXTL0 + nk * (XKEYL + EXTHL) + na * (XALLL + EXTHL);
+#ifndef OLD_COMPRESS
+ extra_l += PAD0 + (nk+na) * PAD;
+#endif
+
+ if ( (verlen = get_vms_version(verbuf, sizeof(verbuf))) > 0 )
+ {
+ extra_l += verlen + EXTHL;
+#ifndef OLD_COMPRESS
+ extra_l += PAD;
+#endif
+ }
+
+ if ((scan = xtra = (uch *) malloc( extra_l)) == (uch*)NULL)
+ {
+#ifdef DEBUG
+ printf(
+ "set_extra_field: Insufficient memory to allocate extra L buffer\n");
+#endif
+ goto err_exit;
+ }
+
+ if ((cxtra = (uch *) malloc( extra_l)) == (uch*)NULL)
+ {
+#ifdef DEBUG
+ printf(
+ "set_extra_field: Insufficient memory to allocate extra C buffer\n");
+#endif
+ goto err_exit;
+ }
+
+ if (verlen > 0)
+ scan = _compress_block((struct IZ_block *)scan, (uch *)verbuf,
+ verlen, VERSIG);
+
+ /*
+ * Zero all unusable fields to improve compression
+ */
+ fab.fab$b_fns = fab.fab$b_shr = fab.fab$b_dns = fab.fab$b_fac = 0;
+ fab.fab$w_ifi = 0;
+ fab.fab$l_stv = fab.fab$l_sts = fab.fab$l_ctx = 0;
+ fab.fab$l_dna = NULL;
+ fab.fab$l_fna = NULL;
+ fab.fab$l_nam = NULL;
+#ifdef NAML$C_MAXRSS
+ fab.fab$l_naml = NULL;
+#endif /* def NAML$C_MAXRSS */
+ fab.fab$l_xab = NULL;
+
+#ifdef DEBUG
+ dump_rms_block( (uch *)&fab );
+#endif
+ scan = _compress_block((struct IZ_block *)scan, (uch *)&fab, FABL, FABSIG);
+ for (x = xab_chain; x != NULL;)
+ {
+ int bln;
+ char *sig;
+ xabptr next;
+
+ next = (xabptr)(x->xab$l_nxt);
+ x->xab$l_nxt = 0;
+
+ switch (x->xab$b_cod)
+ {
+ case XAB$C_ALL:
+ bln = XALLL;
+ sig = XALLSIG;
+ break;
+ case XAB$C_KEY:
+ bln = XKEYL;
+ sig = XKEYSIG;
+ break;
+ case XAB$C_PRO:
+ bln = XPROL;
+ sig = XPROSIG;
+ break;
+ case XAB$C_FHC:
+ bln = XFHCL;
+ sig = XFHCSIG;
+ break;
+ case XAB$C_DAT:
+ bln = XDATL;
+ sig = XDATSIG;
+ break;
+ case XAB$C_RDT:
+ bln = XRDTL;
+ sig = XRDTSIG;
+ break;
+ default:
+ bln = 0;
+ sig = 0L;
+ break;
+ }
+ if (bln > 0)
+ scan = _compress_block((struct IZ_block *)scan, (uch *)x,
+ bln, sig);
+ x = next;
+ }
+
+ /* Copy xtra[] data into cxtra[]. */
+ memcpy( cxtra, xtra, (scan- xtra));
+
+ /* Set sizes and pointers. */
+ z->cext = z->ext = scan- xtra;
+ z->extra = (char*) xtra;
+ z->cextra = (char*) cxtra;
+
+ rc = RET_SUCCESS;
+
+err_exit:
+ /*
+ * Give up all allocated blocks
+ */
+ for (x = (struct XAB *)xab_chain; x != NULL; )
+ {
+ struct XAB *next;
+ next = (xabptr)(x->xab$l_nxt);
+ if (x->xab$b_cod == XAB$C_ALL || x->xab$b_cod == XAB$C_KEY)
+ free(x);
+ x = next;
+ }
+ return rc;
+}
+
+static int get_vms_version(verbuf, len)
+char *verbuf;
+int len;
+{
+ int i = SYI$_VERSION;
+ int verlen = 0;
+ struct dsc$descriptor version;
+ char *m;
+
+ version.dsc$a_pointer = verbuf;
+ version.dsc$w_length = len - 1;
+ version.dsc$b_dtype = DSC$K_DTYPE_B;
+ version.dsc$b_class = DSC$K_CLASS_S;
+
+ if (ERR(lib$getsyi(&i, 0, &version, &verlen, 0, 0)) || verlen == 0)
+ return 0;
+
+ /* Cut out trailing spaces "V5.4-3 " -> "V5.4-3" */
+ for (m = verbuf + verlen, i = verlen - 1; i > 0 && verbuf[i] == ' '; --i)
+ --m;
+ *m = 0;
+
+ /* Cut out release number "V5.4-3" -> "V5.4" */
+ if ((m = strrchr(verbuf, '-')) != NULL)
+ *m = 0;
+ return strlen(verbuf) + 1; /* Transmit ending 0 too */
+}
+
+#define CTXSIG ((ulg)('CtXx'))
+
+typedef struct user_context
+{
+ ulg sig;
+ struct FAB *fab;
+ struct NAM_STRUCT *nam;
+ struct RAB *rab;
+ uzoff_t size;
+ uzoff_t rest;
+ int status;
+} Ctx, *Ctxptr;
+
+Ctx init_ctx =
+{
+ CTXSIG,
+ NULL,
+ NULL,
+ NULL,
+ 0L,
+ 0L,
+ 0
+};
+
+#define CTXL sizeof(Ctx)
+#define CHECK_RAB(_r) ( (_r) != NULL && \
+ (_r) -> rab$b_bid == RAB$C_BID && \
+ (_r) -> rab$b_bln == RAB$C_BLN && \
+ (_r) -> rab$l_ctx != 0 && \
+ (_r) -> rab$l_fab != NULL )
+
+
+#define BLOCK_BYTES 512
+
+/**************************
+ * Function vms_open *
+ **************************/
+struct RAB *vms_open(name)
+ char *name;
+{
+ struct FAB *fab;
+ struct NAM_STRUCT *nam;
+ struct RAB *rab;
+ struct XABFHC *fhc;
+ Ctxptr ctx;
+
+ if ((fab = (struct FAB *) malloc(FABL)) == NULL)
+ return NULL;
+
+ if ((nam =
+ (struct NAM_STRUCT *) malloc( sizeof( struct NAM_STRUCT))) == NULL)
+ {
+ free(fab);
+ return NULL;
+ }
+
+ if ((rab = (struct RAB *) malloc(RABL)) == NULL)
+ {
+ free(fab);
+ free(nam);
+ return NULL;
+ }
+
+ if ((fhc = (struct XABFHC *) malloc(XFHCL)) == (struct XABFHC *)NULL)
+ {
+ free(fab);
+ free(nam);
+ free(rab);
+ return (struct RAB *)NULL;
+ }
+ if ((ctx = (Ctxptr) malloc(CTXL)) == (Ctxptr)NULL)
+ {
+ free(fab);
+ free(nam);
+ free(rab);
+ free(fhc);
+ return (struct RAB *)NULL;
+ }
+ *fab = cc$rms_fab;
+ *nam = CC_RMS_NAM;
+ *rab = cc$rms_rab;
+ *fhc = cc$rms_xabfhc;
+
+ fab->FAB_NAM = nam;
+
+#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 /* def NAML$C_MAXRSS */
+
+ FAB_OR_NAML( fab, nam)->FAB_OR_NAML_FNA = name;
+ FAB_OR_NAML( fab, nam)->FAB_OR_NAML_FNS = strlen( name);
+
+ fab->fab$b_fac = FAB$M_GET | FAB$M_BIO;
+ fab->fab$l_xab = (char*)fhc;
+
+#ifdef NAML$M_OPEN_SPECIAL
+ /* 2007-02-28 SMS.
+ * If processing symlinks as symlinks ("-y"), then $OPEN the
+ * link, not the target file. (Note that here the required
+ * fab->fab$v_bio flag was set above.)
+ */
+ if (linkput)
+ {
+ nam->naml$v_open_special = 1;
+ }
+#endif /* def NAML$M_OPEN_SPECIAL */
+
+ if (ERR(sys$open(fab)))
+ {
+ sys$close(fab);
+ free(fab);
+ free(nam);
+ free(rab);
+ free(fhc);
+ free(ctx);
+ return (struct RAB *)NULL;
+ }
+
+ rab->rab$l_fab = fab;
+ rab->rab$l_rop = RAB$M_BIO;
+
+ if (ERR(sys$connect(rab)))
+ {
+ sys$close(fab);
+ free(fab);
+ free(nam);
+ free(rab);
+ free(ctx);
+ return (struct RAB *)NULL;
+ }
+
+ *ctx = init_ctx;
+ ctx->fab = fab;
+ ctx->nam = nam;
+ ctx->rab = rab;
+
+ if (fhc->xab$l_ebk == 0)
+ {
+ /* Only known size is all allocated blocks.
+ (This occurs with a zero-length file, for example.)
+ */
+ ctx->size =
+ ctx->rest = ((uzoff_t) fhc->xab$l_hbk)* BLOCK_BYTES;
+ }
+ else
+ {
+ /* Store normal (used) size in ->size.
+ If only one -V, store normal (used) size in ->rest.
+ If -VV, store allocated-blocks size in ->rest.
+ */
+ ctx->size =
+ (((uzoff_t) fhc->xab$l_ebk)- 1)* BLOCK_BYTES+ fhc->xab$w_ffb;
+ if (vms_native < 2)
+ ctx->rest = ctx->size;
+ else
+ ctx->rest = ((uzoff_t) fhc->xab$l_hbk)* BLOCK_BYTES;
+ }
+
+ free(fhc);
+ fab->fab$l_xab = NULL;
+ rab->rab$l_ctx = (unsigned) ctx;
+ return rab;
+}
+
+/**************************
+ * Function vms_close *
+ **************************/
+int vms_close(rab)
+ struct RAB *rab;
+{
+ struct FAB *fab;
+ struct NAM_STRUCT *nam;
+ Ctxptr ctx;
+
+ if (!CHECK_RAB(rab))
+ return RET_ERROR;
+ fab = (ctx = (Ctxptr)(rab->rab$l_ctx))->fab;
+ nam = (ctx = (Ctxptr)(rab->rab$l_ctx))->nam;
+ sys$close(fab);
+
+ free(fab);
+ free(nam);
+ free(rab);
+ free(ctx);
+
+ return RET_SUCCESS;
+}
+
+/**************************
+ * Function vms_rewind *
+ **************************/
+int vms_rewind(rab)
+ struct RAB *rab;
+{
+ Ctxptr ctx;
+
+ int status;
+ if (!CHECK_RAB(rab))
+ return RET_ERROR;
+
+ ctx = (Ctxptr) (rab->rab$l_ctx);
+ if (ERR(status = sys$rewind(rab)))
+ {
+ ctx->status = status;
+ return RET_ERROR;
+ }
+
+ ctx->status = 0;
+ ctx->rest = ctx->size;
+
+ return RET_SUCCESS;
+}
+
+
+#define KByte (2* BLOCK_BYTES)
+#define MAX_READ_BYTES (32* KByte)
+
+/**************************
+ * Function vms_read *
+ **************************/
+size_t vms_read(rab, buf, size)
+struct RAB *rab;
+char *buf;
+size_t size;
+/*
+ * size must be greater or equal to 512 !
+ */
+{
+ int status;
+ Ctxptr ctx;
+
+ ctx = (Ctxptr)rab->rab$l_ctx;
+
+ if (!CHECK_RAB(rab))
+ return 0;
+
+ if (ctx -> rest == 0)
+ return 0; /* Eof */
+
+ /* If request is smaller than a whole block, fail.
+ This really should never happen. (assert()?)
+ */
+ if (size < BLOCK_BYTES)
+ return 0;
+
+ /* 2004-09-27 SMS.
+ Code here now resembles low-level QIO code in VMS_PK.C, but I
+ doubt that sys$read() will actually get past the official EOF.
+ */
+
+ /* Adjust request size as appropriate. */
+ if (size > MAX_READ_BYTES)
+ {
+ /* Restrict request to MAX_READ_BYTES. */
+ size = MAX_READ_BYTES;
+ }
+ else
+ {
+ /* Round odd-ball request up to the next whole block.
+ This really should never happen. (assert()?)
+ */
+ size = (size+ BLOCK_BYTES- 1)& ~(BLOCK_BYTES- 1);
+ }
+
+ /* Reduce "size" when next (last) read would overrun the EOF,
+ but never below one byte (so we'll always get a nice EOF).
+ */
+ if (size > ctx->rest)
+ size = ctx->rest;
+ if (size == 0)
+ size = 1;
+
+ rab->rab$l_ubf = buf;
+ rab->rab$w_usz = size;
+ status = sys$read(rab);
+
+ if (!ERR(status) && rab->rab$w_rsz > 0)
+ {
+ ctx -> status = 0;
+ ctx -> rest -= rab->rab$w_rsz;
+ return rab->rab$w_rsz;
+ }
+ else
+ {
+ ctx->status = (status==RMS$_EOF ? 0:status);
+ if (status == RMS$_EOF)
+ ctx -> rest = 0;
+ return 0;
+ }
+}
+
+/**************************
+ * Function vms_error *
+ **************************/
+int vms_error(rab)
+ struct RAB *rab;
+{
+ if (!CHECK_RAB(rab))
+ return RET_ERROR;
+ return ((Ctxptr) (rab->rab$l_ctx))->status;
+}
+
+
+#ifdef DEBUG
+static void dump_rms_block(p)
+ uch *p;
+{
+ uch bid, len;
+ int err;
+ char *type;
+ char buf[132];
+ int i;
+
+ err = 0;
+ bid = p[0];
+ len = p[1];
+ switch (bid)
+ {
+ case FAB$C_BID:
+ type = "FAB";
+ break;
+ case XAB$C_ALL:
+ type = "xabALL";
+ break;
+ case XAB$C_KEY:
+ type = "xabKEY";
+ break;
+ case XAB$C_DAT:
+ type = "xabDAT";
+ break;
+ case XAB$C_RDT:
+ type = "xabRDT";
+ break;
+ case XAB$C_FHC:
+ type = "xabFHC";
+ break;
+ case XAB$C_PRO:
+ type = "xabPRO";
+ break;
+ default:
+ type = "Unknown";
+ err = 1;
+ break;
+ }
+ printf("Block @%08X of type %s (%d).", p, type, bid);
+ if (err)
+ {
+ printf("\n");
+ return;
+ }
+ printf(" Size = %d\n", len);
+ printf(" Offset - Hex - Dec\n");
+ for (i = 0; i < len; i += 8)
+ {
+ int j;
+
+ printf("%3d - ", i);
+ for (j = 0; j < 8; j++)
+ if (i + j < len)
+ printf("%02X ", p[i + j]);
+ else
+ printf(" ");
+ printf(" - ");
+ for (j = 0; j < 8; j++)
+ if (i + j < len)
+ printf("%03d ", p[i + j]);
+ else
+ printf(" ");
+ printf("\n");
+ }
+}
+#endif /* DEBUG */
+
+#ifdef OLD_COMPRESS
+# define BC_METHOD EB_IZVMS_BC00
+# define COMP_BLK(to,tos,from,froms) _compress( from,to,froms )
+#else
+# define BC_METHOD EB_IZVMS_BCDEFL
+# define COMP_BLK(to,tos,from,froms) memcompress(to,tos,from,froms)
+#endif
+
+static uch *_compress_block(to,from,size,sig)
+register struct IZ_block *to;
+uch *from;
+int size;
+char *sig;
+{
+ ulg cl;
+ to -> sig = *(ush*)IZ_SIGNATURE;
+ to -> bid = *(ulg*)(sig);
+ to -> flags = BC_METHOD;
+ to -> length = size;
+#ifdef DEBUG
+ printf("\nmemcompr(%d,%d,%d,%d)\n",&(to->body[0]),size+PAD,from,size);
+#endif
+ cl = COMP_BLK( &(to->body[0]), size+PAD, from, size );
+#ifdef DEBUG
+ printf("Compressed to %d\n",cl);
+#endif
+ if (cl >= size)
+ {
+ memcpy(&(to->body[0]), from, size);
+ to->flags = EB_IZVMS_BCSTOR;
+ cl = size;
+#ifdef DEBUG
+ printf("Storing block...\n");
+#endif
+ }
+ return (uch*)(to) + (to->size = cl + EXTBSL + RESL) + EB_HEADSIZE;
+}
+
+#define NBITS 32
+
+static int _compress(from,to,size)
+uch *from,*to;
+int size;
+{
+ int off=0;
+ ulg bitbuf=0;
+ int bitcnt=0;
+ int i;
+
+#define _BIT(val,len) { \
+ if (bitcnt + (len) > NBITS) \
+ while(bitcnt >= 8) \
+ { \
+ to[off++] = (uch)bitbuf; \
+ bitbuf >>= 8; \
+ bitcnt -= 8; \
+ } \
+ bitbuf |= ((ulg)(val))<<bitcnt; \
+ bitcnt += len; \
+ }
+
+#define _FLUSH { \
+ while(bitcnt>0) \
+ { \
+ to[off++] = (uch)bitbuf; \
+ bitbuf >>= 8; \
+ bitcnt -= 8; \
+ } \
+ }
+
+ for (i=0; i<size; i++)
+ {
+ if (from[i])
+ {
+ _BIT(1,1);
+ _BIT(from[i],8);
+ }
+ else
+ _BIT(0,1);
+ }
+ _FLUSH;
+ return off;
+}
+
+#endif /* !UTIL */
+
+#endif /* ndef VMS_PK_EXTRA */
+
+#endif /* VMS */
diff --git a/vms/vms_msg_gen.c b/vms/vms_msg_gen.c
new file mode 100644
index 0000000..4599cb0
--- /dev/null
+++ b/vms/vms_msg_gen.c
@@ -0,0 +1,91 @@
+/*
+ * VMS Message Source File Generator.
+ *
+ * 2007-01-29 SMS.
+ *
+ * Generates a VMS error message source file from data in "ziperr.h".
+ *
+ * On a VMS system, the standard builders should do the work. On a
+ * non-VMS system:
+ *
+ * cc -I. vms/vms_msg_gen.c -o vms_msg_gen
+ * ./vms_msg_gen > vms/zip_msg.msg
+ * rm ./vms_msg_gen
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#define GLOBALS /* Include data for ziperrors[] in ziperr.h. */
+#include "ziperr.h"
+
+main()
+{
+ int base_prev;
+ int code_vms;
+ int code_zip;
+ int i;
+
+ char *sev_str[ 8] = {
+ "/WARNING",
+ "/SUCCESS",
+ "/ERROR",
+ "/INFORMATIONAL",
+ "/FATAL",
+ "/??????",
+ "/???????",
+ "/????????"
+ };
+
+ char *text1[] = {
+"! VMS Error Message Source File for Zip",
+"!",
+"! Because the facility code was formally assigned by HP, the .FACILITY",
+"! directive below specifies /SYSTEM. Because the messages are, in",
+"! general, specific to Zip, this file is not compiled with /SHARED.",
+"! For example:",
+"!",
+"! MESSAGE /OBJECT = [.dest]ZIP_MSG.OBJ /NOSYMBOLS [.VMS]ZIP_MSG.MSG",
+"!",
+"! LINK /SHAREABLE = [.dest]ZIP_MSG.EXE [.dest]ZIP_MSG.OBJ",
+"!",
+"!-----------------------------------------------------------------------",
+"",
+".TITLE Info-ZIP Zip Error Messages",
+".FACILITY IZ_ZIP, 1955 /SYSTEM",
+NULL /* End-of-text marker. */
+};
+
+ /* Initialize the .BASE counter. */
+ base_prev = -2;
+
+ /* Put out the header text. */
+ for (i = 0; text1[ i] != NULL; i++)
+ {
+ printf( "%s\n", text1[ i]);
+ }
+ printf( ".IDENT '%s'\n", VMS_MSG_IDENT);
+ printf( "\n");
+
+ /* Put out the error messages. */
+ for (code_zip = 0; code_zip <= ZE_MAXERR; code_zip++)
+ {
+ if ((ziperrors[ code_zip].string != NULL) &&
+ (strlen(ziperrors[ code_zip].string) != 0))
+ {
+ code_vms = 2* code_zip; /* 4-bit left-shift, not 3. */
+ if (code_vms != base_prev+ 1)
+ {
+ printf( ".BASE %d\n", code_vms);
+ }
+ printf( "%-7s %-13s <%s>\n",
+ ziperrors[ code_zip].name,
+ sev_str[ ziperrors[ code_zip].severity & 0x07],
+ ziperrors[ code_zip].string);
+ base_prev = code_vms;
+ }
+ }
+ /* Put out the .END directive. */
+ printf( "\n");
+ printf( ".END\n");
+}
diff --git a/vms/vms_pk.c b/vms/vms_pk.c
new file mode 100644
index 0000000..9aa203d
--- /dev/null
+++ b/vms/vms_pk.c
@@ -0,0 +1,600 @@
+/*
+ Copyright (c) 1990-2007 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
+*/
+/*
+ * vms_pk.c by Igor Mandrichenko
+ *
+ * version 2.0 20-Mar-1993
+ * Generates PKWARE version of VMS attributes
+ * extra field according to appnote 2.0.
+ * Uses low level QIO-ACP interface.
+ * version 2.0-1 10-Apr-1993
+ * Save ACLs
+ * version 2.1 24-Aug-1993
+ * By default produce 0x010C extra record ID instead of
+ * PKWARE's 0x000C. The format is mostly compatible with
+ * PKWARE.
+ * Incompatibility (?): zip produces multiple ACE
+ * fields.
+ * version 2.1-1 Clean extra fields in vms_get_attributes().
+ * Fixed bug with EOF.
+ * version 2.1-2 15-Sep-1995, Chr. Spieler
+ * Removed extra fields cleanup from vms_get_attributes().
+ * This is now done in zipup.c
+ * Modified (according to UnZip's vms.[ch]) the fib stuff
+ * for DEC C (AXP,VAX) support.
+ * version 2.2 28-Sep-1995, Chr. Spieler
+ * Reorganized code for easier maintance of the two
+ * incompatible flavours (IM style and PK style) VMS
+ * attribute support. Generic functions (common to
+ * both flavours) are now collected in a `wrapper'
+ * source file that includes one of the VMS attribute
+ * handlers.
+ * Made extra block header conforming to PKware's
+ * specification (extra block header has a length
+ * of four bytes, two bytes for a signature, and two
+ * bytes for the length of the block excluding this
+ * header.
+ * version 2.2-1 19-Oct-1995, Chr. Spieler
+ * Fixed bug in CRC calculation.
+ * Use official PK VMS extra field id.
+ * version 2.2-2 21-Nov-1997, Chr. Spieler
+ * Fixed bug in vms_get_attributes() for directory
+ * entries (access to uninitialized ioctx record).
+ * Removed unused second arg for vms_open().
+ * version 2.2-3 04-Apr-1999, Chr. Spieler
+ * Changed calling interface of vms_get_attributes()
+ * to accept a void pointer as first argument.
+ * version 2.2-4 26-Jan-2002, Chr. Spieler
+ * Modified vms_read() to handle files larger than 2GByte
+ * (up to size limit of "unsigned long", resp. 4GByte).
+ * version 3.0 20-Oct-2004, Steven Schweda.
+ * Changed vms_read() to read all the allocated
+ * blocks in a file, for sure. Changed the default
+ * chunk size from 16K to 32K. Changed to use the
+ * new typedef for the ioctx structure. Moved the
+ * VMS_PK_EXTRA test into here from VMS.C to allow
+ * more general automatic dependency generation.
+ * 08-Feb-2005, SMS.
+ * Changed to accomodate ODS5 extended file names:
+ * NAM structure -> NAM[L], and so on. (VMS.H.)
+ * Added some should-never-appear error messages in
+ * vms_open().
+ */
+
+#ifdef VMS /* For VMS only ! */
+
+#ifdef VMS_PK_EXTRA
+
+#include <ssdef.h>
+
+#ifndef VMS_ZIP
+#define VMS_ZIP
+#endif
+
+#include "crc32.h"
+#include "vms.h"
+#include "vmsdefs.h"
+
+#ifndef ERR
+#define ERR(x) (((x)&1)==0)
+#endif
+
+#ifndef NULL
+#define NULL (void*)(0L)
+#endif
+
+#ifndef UTIL
+
+static PK_info_t PK_def_info =
+{
+ ATR$C_RECATTR, ATR$S_RECATTR, {0},
+ ATR$C_UCHAR, ATR$S_UCHAR, {0},
+ ATR$C_CREDATE, ATR$S_CREDATE, {0},
+ ATR$C_REVDATE, ATR$S_REVDATE, {0},
+ ATR$C_EXPDATE, ATR$S_EXPDATE, {0},
+ ATR$C_BAKDATE, ATR$S_BAKDATE, {0},
+ ATR$C_ASCDATES, sizeof(ush), 0,
+ ATR$C_UIC, ATR$S_UIC, {0},
+ ATR$C_FPRO, ATR$S_FPRO, {0},
+ ATR$C_RPRO, ATR$S_RPRO, {0},
+ ATR$C_JOURNAL, ATR$S_JOURNAL, {0}
+};
+
+/* File description structure for Zip low level I/O */
+typedef struct
+{
+ struct iosb iosb;
+ long vbn;
+ uzoff_t size;
+ uzoff_t rest;
+ int status;
+ ush chan;
+ ush chan_pad; /* alignment member */
+ long acllen;
+ uch aclbuf[ATR$S_READACL];
+ PK_info_t PKi;
+} ioctx_t;
+
+
+/* Forward declarations of public functions: */
+ioctx_t *vms_open(char *file);
+unsigned int vms_read(register ioctx_t *ctx,
+ register char *buf, register unsigned int size);
+int vms_error(ioctx_t *ctx);
+int vms_rewind(ioctx_t *ctx);
+int vms_get_attributes(ioctx_t *ctx, struct zlist far *z,
+ iztimes *z_utim);
+int vms_close(ioctx_t *ctx);
+
+
+#define BLOCK_BYTES 512
+
+
+/*---------------*
+ | vms_open() |
+ *---------------*
+ | This routine opens file for reading fetching its attributes.
+ | Returns pointer to file description structure.
+ */
+
+ioctx_t *vms_open(file)
+char *file;
+{
+ static struct atrdef Atr[VMS_MAX_ATRCNT+1];
+ static struct NAM_STRUCT Nam;
+ static struct fibdef Fib;
+ static struct dsc$descriptor FibDesc =
+ {sizeof(Fib),DSC$K_DTYPE_Z,DSC$K_CLASS_S,(char *)&Fib};
+ static struct dsc$descriptor_s DevDesc =
+ {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,&Nam.NAM_DVI[1]};
+ static char EName[NAM_MAXRSS];
+ static char RName[NAM_MAXRSS];
+
+ struct FAB Fab;
+ register ioctx_t *ctx;
+ register struct fatdef *fat;
+ int status;
+ int i;
+ ulg efblk;
+ ulg hiblk;
+
+ if ( (ctx=(ioctx_t *)malloc(sizeof(ioctx_t))) == NULL )
+ return NULL;
+ ctx -> PKi = PK_def_info;
+
+#define FILL_REQ(ix,id,b) { \
+ Atr[ix].atr$l_addr = GVTC &(b); \
+ Atr[ix].atr$w_type = (id); \
+ Atr[ix].atr$w_size = sizeof(b); \
+}
+
+ FILL_REQ(0, ATR$C_RECATTR, ctx->PKi.ra);
+ FILL_REQ(1, ATR$C_UCHAR, ctx->PKi.uc);
+ FILL_REQ(2, ATR$C_REVDATE, ctx->PKi.rd);
+ FILL_REQ(3, ATR$C_EXPDATE, ctx->PKi.ed);
+ FILL_REQ(4, ATR$C_CREDATE, ctx->PKi.cd);
+ FILL_REQ(5, ATR$C_BAKDATE, ctx->PKi.bd);
+ FILL_REQ(6, ATR$C_ASCDATES, ctx->PKi.rn);
+ FILL_REQ(7, ATR$C_JOURNAL, ctx->PKi.jr);
+ FILL_REQ(8, ATR$C_RPRO, ctx->PKi.rp);
+ FILL_REQ(9, ATR$C_FPRO, ctx->PKi.fp);
+ FILL_REQ(10,ATR$C_UIC, ctx->PKi.ui);
+ FILL_REQ(11,ATR$C_ACLLENGTH,ctx->acllen);
+ FILL_REQ(12,ATR$C_READACL, ctx->aclbuf);
+
+ Atr[13].atr$w_type = 0; /* End of ATR list */
+ Atr[13].atr$w_size = 0;
+ Atr[13].atr$l_addr = GVTC NULL;
+
+ /* Initialize RMS structures. We need a NAM[L] to retrieve the FID. */
+ Fab = cc$rms_fab;
+ Nam = CC_RMS_NAM;
+ Fab.FAB_NAM = &Nam; /* FAB has an associated 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 /* def NAML$C_MAXRSS */
+
+ FAB_OR_NAML( Fab, Nam).FAB_OR_NAML_FNA = file ; /* File name. */
+ FAB_OR_NAML( Fab, Nam).FAB_OR_NAML_FNS = strlen(file);
+ Nam.NAM_ESA = EName; /* expanded filename */
+ Nam.NAM_ESS = sizeof(EName);
+ Nam.NAM_RSA = RName; /* resultant filename */
+ Nam.NAM_RSS = sizeof(RName);
+
+ /* Do $PARSE and $SEARCH here. */
+ status = sys$parse(&Fab);
+
+ if (!(status & 1))
+ {
+ fprintf( stderr,
+ " vms_open(): $parse sts = %%x%08x.\n", status);
+ return NULL;
+ }
+
+#ifdef NAML$M_OPEN_SPECIAL
+ /* 2007-02-28 SMS.
+ * If processing symlinks as symlinks ("-y"), then $SEARCH for the
+ * link, not the target file.
+ */
+ if (linkput)
+ {
+ Nam.naml$v_open_special = 1;
+ }
+#endif /* def NAML$M_OPEN_SPECIAL */
+
+ /* Search for the first file. If none, signal error. */
+ status = sys$search(&Fab);
+
+ if (!(status & 1))
+ {
+ fprintf( stderr,
+ " vms_open(): $search sts = %%x%08x.\n", status);
+ return NULL;
+ }
+
+ /* Initialize Device name length. Note that this points into the
+ NAM[L] to get the device name filled in by the $PARSE, $SEARCH
+ services.
+ */
+ DevDesc.dsc$w_length = Nam.NAM_DVI[0];
+
+ status = sys$assign(&DevDesc,&ctx->chan,0,0);
+
+ if (!(status & 1))
+ {
+ fprintf( stderr,
+ " vms_open(): $assign sts = %%x%08x.\n", status);
+ return NULL;
+ }
+
+ /* Move the FID (and not the DID) into the FIB.
+ 2005=02-08 SMS.
+ Note that only the FID is needed, not the DID, and not the file
+ name. Setting these other items causes failures on ODS5.
+ */
+ Fib.FIB$L_ACCTL = FIB$M_NOWRITE;
+
+ for (i = 0; i < 3; i++)
+ {
+ Fib.FIB$W_FID[ i] = Nam.NAM_FID[ i];
+ Fib.FIB$W_DID[ i] = 0;
+ }
+
+ /* Use the IO$_ACCESS function to return info about the file. */
+ status = sys$qiow( 0, ctx->chan,
+ (IO$_ACCESS| IO$M_ACCESS), &ctx->iosb, 0, 0,
+ &FibDesc, 0, 0, 0, Atr, 0);
+
+ if (ERR(status) || ERR(status = ctx->iosb.status))
+ {
+ vms_close(ctx);
+ fprintf( stderr,
+ " vms_open(): $qiow (access) sts = %%x%08x, iosb sts = %%x%08x.\n",
+ status, ctx->iosb.status);
+ return NULL;
+ }
+
+ fat = (struct fatdef *)&(ctx -> PKi.ra);
+
+#define SWAPW(x) ( (((x)>>16)&0xFFFF) + ((x)<<16) )
+
+ efblk = SWAPW(fat->fat$l_efblk);
+ hiblk = SWAPW(fat->fat$l_hiblk);
+
+ if (efblk == 0)
+ {
+ /* Only known size is all allocated blocks.
+ (This occurs with a zero-length file, for example.)
+ */
+ ctx -> size =
+ ctx -> rest = ((uzoff_t) hiblk)* BLOCK_BYTES;
+ }
+ else
+ {
+ /* Store normal (used) size in ->size.
+ If only one -V, store normal (used) size in ->rest.
+ If multiple -V, store allocated-blocks size in ->rest.
+ */
+ ctx -> size =
+ (((uzoff_t) efblk)- 1)* BLOCK_BYTES+ fat -> fat$w_ffbyte;
+
+ if (vms_native < 2)
+ ctx -> rest = ctx -> size;
+ else
+ ctx -> rest = ((uzoff_t) hiblk)* BLOCK_BYTES;
+ }
+
+ ctx -> status = SS$_NORMAL;
+ ctx -> vbn = 1;
+ return ctx;
+}
+
+
+#define KByte (2* BLOCK_BYTES)
+#define MAX_READ_BYTES (32* KByte)
+
+/*----------------*
+ | vms_read() |
+ *----------------*
+ | Reads file in (multi-)block-sized chunks into the buffer.
+ | Stops on EOF. Returns number of bytes actually read.
+ | Note: This function makes no sense (and will error) if the buffer
+ | size ("size") is not a multiple of the disk block size (512).
+ */
+
+size_t vms_read( ctx, buf, size)
+ioctx_t *ctx;
+char *buf;
+size_t size;
+{
+ int act_cnt;
+ uzoff_t rest_rndup;
+ int status;
+ size_t bytes_read = 0;
+
+ /* If previous read hit EOF, fail early. */
+ if (ctx -> status == SS$_ENDOFFILE)
+ return 0; /* EOF. */
+
+ /* If no more expected to be read, fail early. */
+ if (ctx -> rest == 0)
+ return 0; /* Effective EOF. */
+
+ /* If request is smaller than a whole block, fail.
+ This really should never happen. (assert()?)
+ */
+ if (size < BLOCK_BYTES)
+ return 0;
+
+ /* Note that on old VMS VAX versions (like V5.5-2), QIO[W] may fail
+ with status %x0000034c (= %SYSTEM-F-IVBUFLEN, invalid buffer
+ length) when size is not a multiple of 512. Thus the requested
+ size is boosted as needed, but the IOSB byte count returned is
+ reduced when it exceeds the actual bytes remaining (->rest).
+ */
+
+ /* Adjust request size as appropriate. */
+ if (size > MAX_READ_BYTES)
+ {
+ /* Restrict request to MAX_READ_BYTES. */
+ size = MAX_READ_BYTES;
+ }
+ else
+ {
+ /* Round odd-ball request up to the next whole block.
+ This really should never happen. (assert()?)
+ */
+ size = (size+ BLOCK_BYTES- 1)& ~(BLOCK_BYTES- 1);
+ }
+ rest_rndup = (ctx -> rest+ BLOCK_BYTES- 1)& ~(BLOCK_BYTES- 1);
+
+ /* Read (QIOW) until error or "size" bytes have been read. */
+ do
+ {
+ /* Reduce "size" when next (last) read would overrun the EOF,
+ but never below one block (so we'll always get a nice EOF).
+ */
+ if (size > rest_rndup)
+ size = rest_rndup;
+
+ status = sys$qiow( 0, ctx->chan, IO$_READVBLK,
+ &ctx->iosb, 0, 0,
+ buf, size, ctx->vbn, 0, 0, 0);
+
+ /* If initial status was good, use final status. */
+ if ( !ERR(status) )
+ status = ctx->iosb.status;
+
+ if ( !ERR(status) || status == SS$_ENDOFFILE )
+ {
+ act_cnt = ctx->iosb.count;
+ /* Ignore whole-block boost when remainder is smaller. */
+ if (act_cnt > ctx->rest)
+ {
+ act_cnt = ctx->rest;
+ status = SS$_ENDOFFILE;
+ }
+ /* Adjust counters/pointers according to delivered bytes. */
+ size -= act_cnt;
+ buf += act_cnt;
+ bytes_read += act_cnt;
+ ctx->vbn += ctx->iosb.count/ BLOCK_BYTES;
+ }
+
+ } while ( !ERR(status) && (size > 0) );
+
+ if (!ERR(status))
+ {
+ /* Record any successful status as SS$_NORMAL. */
+ ctx -> status = SS$_NORMAL;
+ }
+ else if (status == SS$_ENDOFFILE)
+ {
+ /* Record EOF as SS$_ENDOFFILE. (Ignore error status codes?) */
+ ctx -> status = SS$_ENDOFFILE;
+ }
+
+ /* Decrement bytes-to-read. Return the total bytes read. */
+ ctx -> rest -= bytes_read;
+
+ return bytes_read;
+}
+
+/*-----------------*
+ | vms_error() |
+ *-----------------*
+ | Returns whether last operation on the file caused an error
+ */
+
+int vms_error(ctx)
+ioctx_t *ctx;
+{ /* EOF is not actual error */
+ return ERR(ctx->status) && (ctx->status != SS$_ENDOFFILE);
+}
+
+/*------------------*
+ | vms_rewind() |
+ *------------------*
+ | Rewinds file to the beginning for the next vms_read().
+ */
+
+int vms_rewind(ctx)
+ioctx_t *ctx;
+{
+ ctx -> vbn = 1;
+ ctx -> rest = ctx -> size;
+ return 0;
+}
+
+/*--------------------------*
+ | vms_get_attributes() |
+ *--------------------------*
+ | Malloc a PKWARE extra field and fill with file attributes. Returns
+ | error number of the ZE_??? class.
+ | If the passed ioctx record "FILE *" pointer is NULL, vms_open() is
+ | called to fetch the file attributes.
+ | When `vms_native' is not set, a generic "UT" type timestamp extra
+ | field is generated instead.
+ |
+ | 2004-11-11 SMS.
+ | Changed to use separate storage for ->extra and ->cextra. Zip64
+ | processing may move (reallocate) one and not the other.
+ */
+
+int vms_get_attributes(ctx, z, z_utim)
+ioctx_t *ctx; /* Internal file control structure. */
+struct zlist far *z; /* Zip entry to compress. */
+iztimes *z_utim;
+{
+ byte *p;
+ byte *xtra;
+ byte *cxtra;
+ struct PK_header *h;
+ extent l;
+ int notopened;
+
+ if ( !vms_native )
+ {
+#ifdef USE_EF_UT_TIME
+ /*
+ * A `portable' zipfile entry is created. Create an "UT" extra block
+ * containing UNIX style modification time stamp in UTC, which helps
+ * maintaining the `real' "last modified" time when the archive is
+ * transfered across time zone boundaries.
+ */
+# ifdef IZ_CHECK_TZ
+ if (!zp_tz_is_valid)
+ return ZE_OK; /* skip silently if no valid TZ info */
+# endif
+
+ if ((xtra = (uch *) malloc( EB_HEADSIZE+ EB_UT_LEN( 1))) == NULL)
+ return ZE_MEM;
+
+ if ((cxtra = (uch *) malloc( EB_HEADSIZE+ EB_UT_LEN( 1))) == NULL)
+ return ZE_MEM;
+
+ /* Fill xtra[] with data. */
+ xtra[ 0] = 'U';
+ xtra[ 1] = 'T';
+ xtra[ 2] = EB_UT_LEN(1); /* length of data part of e.f. */
+ xtra[ 3] = 0;
+ xtra[ 4] = EB_UT_FL_MTIME;
+ xtra[ 5] = (byte) (z_utim->mtime);
+ xtra[ 6] = (byte) (z_utim->mtime >> 8);
+ xtra[ 7] = (byte) (z_utim->mtime >> 16);
+ xtra[ 8] = (byte) (z_utim->mtime >> 24);
+
+ /* Copy xtra[] data into cxtra[]. */
+ memcpy( cxtra, xtra, (EB_HEADSIZE+ EB_UT_LEN( 1)));
+
+ /* Set sizes and pointers. */
+ z->cext = z->ext = (EB_HEADSIZE+ EB_UT_LEN( 1));
+ z->extra = (char*) xtra;
+ z->cextra = (char*) cxtra;
+
+#endif /* USE_EF_UT_TIME */
+
+ return ZE_OK;
+ }
+
+ notopened = (ctx == NULL);
+ if ( notopened && ((ctx = vms_open(z->name)) == NULL) )
+ return ZE_OPEN;
+
+ l = PK_HEADER_SIZE + sizeof(ctx->PKi);
+ if (ctx->acllen > 0)
+ l += PK_FLDHDR_SIZE + ctx->acllen;
+
+ if ((xtra = (uch *) malloc( l)) == NULL)
+ return ZE_MEM;
+
+ if ((cxtra = (uch *) malloc( l)) == NULL)
+ return ZE_MEM;
+
+ /* Fill xtra[] with data. */
+
+ h = (struct PK_header *) xtra;
+ h->tag = PK_SIGNATURE;
+ h->size = l - EB_HEADSIZE;
+ p = (h->data);
+
+ /* Copy default set of attributes */
+ memcpy(h->data, (char*)&(ctx->PKi), sizeof(ctx->PKi));
+ p += sizeof(ctx->PKi);
+
+ if ( ctx->acllen > 0 )
+ {
+ struct PK_field *f;
+
+ if (dosify)
+ zipwarn("file has ACL, may be incompatible with PKUNZIP","");
+
+ f = (struct PK_field *)p;
+ f->tag = ATR$C_ADDACLENT;
+ f->size = ctx->acllen;
+ memcpy((char *)&(f->value[0]), ctx->aclbuf, ctx->acllen);
+ p += PK_FLDHDR_SIZE + ctx->acllen;
+ }
+
+
+ h->crc32 = CRCVAL_INITIAL; /* Init CRC register */
+ h->crc32 = crc32(h->crc32, (uch *)(h->data), l - PK_HEADER_SIZE);
+
+ /* Copy xtra[] data into cxtra[]. */
+ memcpy( cxtra, xtra, l);
+
+ /* Set sizes and pointers. */
+ z->ext = z->cext = l;
+ z->extra = (char *) xtra;
+ z->cextra = (char *) cxtra;
+
+ if (notopened) /* close "ctx", if we have opened it here */
+ vms_close(ctx);
+
+ return ZE_OK;
+}
+
+
+int vms_close(ctx)
+ioctx_t *ctx;
+{
+ sys$dassgn(ctx->chan);
+ free(ctx);
+ return 0;
+}
+
+#endif /* !_UTIL */
+
+#endif /* def VMS_PK_EXTRA */
+
+#endif /* VMS */
diff --git a/vms/vmsdefs.h b/vms/vmsdefs.h
new file mode 100644
index 0000000..73d013a
--- /dev/null
+++ b/vms/vmsdefs.h
@@ -0,0 +1,320 @@
+/*
+ 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 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
+*/
+/*---------------------------------------------------------------------------
+
+ vmsdefs.h
+
+ Contents of three header files from Joe
+ Meadows' FILE program. Used by vmsmunch
+
+ 06-Apr-1994 Jamie Hanrahan jeh@cmkrnl.com
+ Moved "contents of three header files" from
+ VMSmunch.h to VMSdefs.h .
+
+ 16-Sep-1995 Christian Spieler
+ Added #pragma (no)member_alignment directives
+ to achieve compatibility with DEC C and Alpha AXP
+
+ 05-Oct-1995 Christian Spieler
+ Revised fatdef, fchdef, fjndef to achieve closer
+ compatibility with DEC's system include header files
+ supplied with C version 4.0 and newer.
+
+ 10-Oct-1995 Christian Spieler
+ Use lowercase filenames for vms specific sources
+ (VMSmunch.? -> vmsmunch.?, VMSdefs.h -> vmsdefs.h)
+
+ 15-Dec-1995 Christian Spieler
+ Removed the last "tabs" from the source.
+
+ 24-Jun-1997 Onno van der Linden / Chr. Spieler
+ Modifications to support the VMS port of GNU C 2.x.
+
+ 27-Jul-1999 Chr. Spieler
+ Added Info-ZIP copyright note for identification.
+
+ ---------------------------------------------------------------------------*/
+
+#ifndef __vmsdefs_h
+#define __vmsdefs_h 1
+
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __nostandard
+#endif /* __DECC || __DECCXX */
+
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __member_alignment __save
+#pragma __nomember_alignment
+#endif /* __DECC || __DECCXX */
+
+#if !(defined(__VAXC) || defined(VAXC)) || defined(__GNUC__)
+#define __struct struct
+#define __union union
+#else
+#define __struct variant_struct
+#define __union variant_union
+#endif /* !(__VAXC || VAXC) || __GNUC__ */
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------
+ fatdef.h
+ ---------------------------------------------------------------------------*/
+
+/* This header file was created by Joe Meadows, and is not copyrighted
+ in any way. No guarantee is made as to the accuracy of the contents
+ of this header file. This header file was last modified on Sep. 22th,
+ 1987. (Modified to include this statement) */
+
+#define FAT$K_LENGTH 32
+#define FAT$C_LENGTH 32
+#define FAT$S_FATDEF 32
+
+struct fatdef {
+ __union {
+ unsigned char fat$b_rtype; /* record type */
+ __struct {
+ unsigned fat$v_rtype : 4; /* record type subfield */
+ unsigned fat$v_fileorg : 4; /* file organization */
+ } fat$r_rtype_bits;
+ } fat$r_rtype_overlay;
+# define FAT$S_RTYPE 4
+# define FAT$V_RTYPE 0
+# define FAT$C_UNDEFINED 0
+# define FAT$C_FIXED 1
+# define FAT$C_VARIABLE 2
+# define FAT$C_VFC 3
+# define FAT$C_STREAM 4
+# define FAT$C_STREAMLF 5
+# define FAT$C_STREAMCR 6
+# define FAT$S_FILEORG 4
+# define FAT$V_FILEORG 4
+# define FAT$C_SEQUENTIAL 0
+# define FAT$C_RELATIVE 1
+# define FAT$C_INDEXED 2
+# define FAT$C_DIRECT 3
+ __union {
+ unsigned char fat$b_rattrib; /* record attributes */
+ __struct {
+ unsigned fat$v_fortrancc : 1;
+ unsigned fat$v_impliedcc : 1;
+ unsigned fat$v_printcc : 1;
+ unsigned fat$v_nospan : 1;
+ unsigned fat$v_msbrcw : 1;
+ } fat$r_rattrib_bits;
+ } fat$r_rattrib_overlay;
+# define FAT$V_FORTRANCC 0
+# define FAT$M_FORTRANCC 1
+# define FAT$V_IMPLIEDCC 1
+# define FAT$M_IMPLIEDCC 2
+# define FAT$V_PRINTCC 2
+# define FAT$M_PRINTCC 4
+# define FAT$V_NOSPAN 3
+# define FAT$M_NOSPAN 8
+# define FAT$V_MSBRCW 4
+# define FAT$M_MSBRCW 16
+ unsigned short int fat$w_rsize; /* record size in bytes */
+ __union
+ {
+ unsigned long int fat$l_hiblk; /* highest allocated VBN */
+ __struct
+ {
+ unsigned short int fat$w_hiblkh; /* high order word */
+ unsigned short int fat$w_hiblkl; /* low order word */
+ } fat$r_hiblk_fields;
+ } fat$r_hiblk_overlay;
+ __union
+ {
+ unsigned long int fat$l_efblk; /* end of file VBN */
+ __struct
+ {
+ unsigned short int fat$w_efblkh; /* high order word */
+ unsigned short int fat$w_efblkl; /* low order word */
+ } fat$r_efblk_fields;
+ } fat$r_efblk_overlay;
+ unsigned short int fat$w_ffbyte; /* first free byte in EFBLK */
+ unsigned char fat$b_bktsize; /* bucket size in blocks */
+ unsigned char fat$b_vfcsize; /* # of control bytes in VFC record */
+ unsigned short int fat$w_maxrec; /* maximum record size in bytes */
+ unsigned short int fat$w_defext; /* default extend quantity */
+ unsigned short int fat$w_gbc; /* global buffer count */
+ char fat$fill[8];
+ unsigned short int fat$w_versions;
+};
+
+#if !(defined(__VAXC) || defined(VAXC)) || defined(__GNUC__)
+#define fat$b_rtype fat$r_rtype_overlay.fat$b_rtype
+#define fat$v_rtype fat$r_rtype_overlay.fat$r_rtype_bits.fat$v_rtype
+#define fat$v_fileorg fat$r_rtype_overlay.fat$r_rtype_bits.fat$v_fileorg
+#define fat$b_rattrib fat$r_rattrib_overlay.fat$b_rattrib
+#define fat$v_fortrancc fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_fortrancc
+#define fat$v_impliedcc fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_impliedcc
+#define fat$v_printcc fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_printcc
+#define fat$v_nospan fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_nospan
+#define fat$v_msbrcw fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_msbrcw
+#define fat$l_hiblk fat$r_hiblk_overlay.fat$l_hiblk
+#define fat$w_hiblkh fat$r_hiblk_overlay.fat$r_hiblk_fields.fat$w_hiblkh
+#define fat$w_hiblkl fat$r_hiblk_overlay.fat$r_hiblk_fields.fat$w_hiblkl
+#define fat$l_efblk fat$r_efblk_overlay.fat$l_efblk
+#define fat$w_efblkh fat$r_efblk_overlay.fat$r_efblk_fields.fat$w_efblkh
+#define fat$w_efblkl fat$r_efblk_overlay.fat$r_efblk_fields.fat$w_efblkl
+#endif /* !(__VAXC || VAXC) || __GNUC__ */
+
+#define __FATDEF_LOADED 1 /* prevent inclusion of DECC's fatdef.h */
+
+/*---------------------------------------------------------------------------
+ fchdef.h
+ ---------------------------------------------------------------------------*/
+
+/* This header file was created by Joe Meadows, and is not copyrighted
+ in any way. No guarantee is made as to the accuracy of the contents
+ of this header file. This header file was last modified on Sep. 22th,
+ 1987. (Modified to include this statement) */
+
+#define FCH$V_BADACL 0x00B
+#define FCH$M_BADACL (1 << FCH$V_BADACL)
+#define FCH$V_BADBLOCK 0x00E
+#define FCH$M_BADBLOCK (1 << FCH$V_BADBLOCK)
+#define FCH$V_CONTIG 0x007
+#define FCH$M_CONTIG (1 << FCH$V_CONTIG)
+#define FCH$V_CONTIGB 0x005
+#define FCH$M_CONTIGB (1 << FCH$V_CONTIGB)
+#define FCH$V_DIRECTORY 0x00D
+#define FCH$M_DIRECTORY (1 << FCH$V_DIRECTORY)
+#define FCH$V_ERASE 0x011
+#define FCH$M_ERASE (1 << FCH$V_ERASE)
+#define FCH$V_LOCKED 0x006
+#define FCH$M_LOCKED (1 << FCH$V_LOCKED)
+#define FCH$V_MARKDEL 0x00F
+#define FCH$M_MARKDEL (1 << FCH$V_MARKDEL)
+#define FCH$V_NOBACKUP 0x001
+#define FCH$M_NOBACKUP (1 << FCH$V_NOBACKUP)
+#define FCH$V_NOCHARGE 0x010
+#define FCH$M_NOCHARGE (1 << FCH$V_NOCHARGE)
+#define FCH$V_READCHECK 0x003
+#define FCH$M_READCHECK (1 << FCH$V_READCHECK)
+#define FCH$V_SPOOL 0x00C
+#define FCH$M_SPOOL (1 << FCH$V_SPOOL)
+#define FCH$V_WRITCHECK 0x004
+#define FCH$M_WRITCHECK (1 << FCH$V_WRITCHECK)
+#define FCH$V_WRITEBACK 0x002
+#define FCH$M_WRITEBACK (1 << FCH$V_WRITEBACK)
+
+struct fchdef {
+ __union {
+ int fch$$_fill_1;
+ __struct {
+ unsigned fch$$_fill_31 : 8;
+ unsigned fch$v_vcc_state : 3; /* VCC state bits */
+ unsigned fch$$_fill_32 : 7;
+ unsigned fch$$_alm_state : 2;
+ unsigned fch$v_associated : 1; /* ISO 9660 Associated file */
+ unsigned fch$v_existence : 1; /* ISO 9660 Existence file */
+ unsigned fch$v_fill_6 : 2;
+ } fch$r_fill_1_chunks;
+ __struct {
+ unsigned fch$v_wascontig : 1;
+ unsigned fch$v_nobackup : 1 ;
+ unsigned fch$v_writeback : 1;
+ unsigned fch$v_readcheck : 1;
+ unsigned fch$v_writcheck : 1;
+ unsigned fch$v_contigb : 1;
+ unsigned fch$v_locked : 1;
+ unsigned fch$v_contig : 1;
+ unsigned fch$$_fill_3 : 3;
+ unsigned fch$v_badacl : 1;
+ unsigned fch$v_spool : 1;
+ unsigned fch$v_directory : 1;
+ unsigned fch$v_badblock : 1;
+ unsigned fch$v_markdel : 1;
+ unsigned fch$v_nocharge : 1;
+ unsigned fch$v_erase : 1;
+ unsigned fch$$_fill_4 : 1;
+ unsigned fch$v_shelved : 1;
+ unsigned fch$v_scratch : 1;
+ unsigned fch$v_nomove : 1;
+ unsigned fch$v_noshelvable : 1;
+ } fch$r_fill_1_bits;
+ } fch$r_fch_union;
+};
+
+#if !(defined(__VAXC) || defined(VAXC)) || defined(__GNUC__)
+#define fch$v_vcc_state fch$r_fch_union.fch$r_fill_1_chunks.fch$v_vcc_state
+#define fch$v_associated fch$r_fch_union.fch$r_fill_1_chunks.fch$v_associated
+#define fch$v_existence fch$r_fch_union.fch$r_fill_1_chunks.fch$v_existence
+#define fch$v_wascontig fch$r_fch_union.fch$r_fill_1_bits.fch$v_wascontig
+#define fch$v_nobackup fch$r_fch_union.fch$r_fill_1_bits.fch$v_nobackup
+#define fch$v_writeback fch$r_fch_union.fch$r_fill_1_bits.fch$v_writeback
+#define fch$v_readcheck fch$r_fch_union.fch$r_fill_1_bits.fch$v_readcheck
+#define fch$v_writcheck fch$r_fch_union.fch$r_fill_1_bits.fch$v_writcheck
+#define fch$v_contigb fch$r_fch_union.fch$r_fill_1_bits.fch$v_contigb
+#define fch$v_locked fch$r_fch_union.fch$r_fill_1_bits.fch$v_locked
+#define fch$v_contig fch$r_fch_union.fch$r_fill_1_bits.fch$v_contig
+#define fch$v_badacl fch$r_fch_union.fch$r_fill_1_bits.fch$v_badacl
+#define fch$v_spool fch$r_fch_union.fch$r_fill_1_bits.fch$v_spool
+#define fch$v_directory fch$r_fch_union.fch$r_fill_1_bits.fch$v_directory
+#define fch$v_badblock fch$r_fch_union.fch$r_fill_1_bits.fch$v_badblock
+#define fch$v_markdel fch$r_fch_union.fch$r_fill_1_bits.fch$v_markdel
+#define fch$v_nocharge fch$r_fch_union.fch$r_fill_1_bits.fch$v_nocharge
+#define fch$v_erase fch$r_fch_union.fch$r_fill_1_bits.fch$v_erase
+#define fch$v_shelved fch$r_fch_union.fch$r_fill_1_bits.fch$v_shelved
+#define fch$v_scratch fch$r_fch_union.fch$r_fill_1_bits.fch$v_scratch
+#define fch$v_nomove fch$r_fch_union.fch$r_fill_1_bits.fch$v_nomove
+#define fch$v_noshelvable fch$r_fch_union.fch$r_fill_1_bits.fch$v_noshelvable
+#endif /* !(__VAXC || VAXC) || __GNUC__ */
+
+#define __FCHDEF_LOADED 1 /* prevent inclusion of DECC's fchdef.h */
+
+/*---------------------------------------------------------------------------
+ fjndef.h
+ ---------------------------------------------------------------------------*/
+
+/* This header file was created by Joe Meadows, and is not copyrighted
+ in any way. No guarantee is made as to the accuracy of the contents
+ of this header file. This header file was last modified on Sep. 22th,
+ 1987. (Modified to include this statement) */
+
+#define FJN$M_ONLY_RU 1
+#define FJN$M_RUJNL 2
+#define FJN$M_BIJNL 4
+#define FJN$M_AIJNL 8
+#define FJN$M_ATJNL 16
+#define FJN$M_NEVER_RU 32
+#define FJN$M_JOURNAL_FILE 64
+#define FJN$S_FJNDEF 1
+struct fjndef {
+ unsigned fjn$v_only_ru : 1;
+ unsigned fjn$v_rujnl : 1;
+ unsigned fjn$v_bijnl : 1;
+ unsigned fjn$v_aijnl : 1;
+ unsigned fjn$v_atjnl : 1;
+ unsigned fjn$v_never_ru : 1;
+ unsigned fjn$v_journal_file : 1;
+ unsigned fjn$v_fill_7 : 1;
+} ;
+
+#define __FJNDEF_LOADED 1 /* prevent inclusion of DECC's fjndef.h */
+
+/*---------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+ }
+#endif
+
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __member_alignment __restore
+#endif /* __DECC || __DECCXX */
+
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __standard
+#endif /* __DECC || __DECCXX */
+
+#endif /* !__vmsdefs_h */
diff --git a/vms/vmsmunch.c b/vms/vmsmunch.c
new file mode 100644
index 0000000..8140036
--- /dev/null
+++ b/vms/vmsmunch.c
@@ -0,0 +1,434 @@
+/*
+ Copyright (c) 1990-2007 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
+*/
+
+/* 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
+ * library dependencies need to have the correct module name.
+ */
+#if 0
+# define module_name VMSMUNCH
+# define module_version "V1.3-4"
+#endif /* 0 */
+
+/*
+ * Modified by:
+ *
+ * v1.3.1 O.v.d.Linden, C. Spieler 04-JUL-1998 14:35
+ * Modified check that decides on the type of definitions for
+ * FIB$W_FID etc. to support GNU C.
+ *
+ * v1.3 Hunter Goatley 14-SEP-1992 08:51
+ * Added definitions of FIB$W_FID, FIB$W_DID, and
+ * FIB$L_ACCTL to allow for the fact that fibdef
+ * contains variant_unions under Alpha.
+ */
+/*---------------------------------------------------------------------------
+
+ vmsmunch.c version 1.2 28 Apr 1992
+
+ This routine is a blatant and unrepentent appropriation of all the nasty
+ and difficult-to-do and complicated VMS shenanigans which Joe Meadows has
+ so magnificently captured in his FILE utility. Not only that, it's even
+ allowed! (see below). But let it be clear at the outset that Joe did all
+ the work; yea, verily, he is truly a godlike unit.
+
+ The appropriations and modifications herein were performed primarily by
+ him known as "Cave Newt," although the Info-ZIP working group probably had
+ their fingers in it somewhere along the line. The idea is to put the raw
+ power of Joe's original routine at the disposal of various routines used
+ by UnZip (and Zip, possibly), not least among them the utime() function.
+ Read on for details...
+
+ 01-SEP-1994 Richard Levitte <levitte@e.kth.se>
+ If one of the fields given to VMSmunch are NULL,
+ do not update the corresponding daytime.
+
+ 18-JUL-1994 Hunter Goatley <goathunter@WKU.EDU>
+ Fixed IO$_ACCESS call.
+
+ 18-Jul-1994 Richard Levitte levitte@e.kth.se
+ Changed VMSmunch() to deassign the channel before
+ returning when an error has occured.
+
+ 02-Apr-1994 Jamie Hanrahan jeh@cmkrnl.com
+ Moved definition of VMStimbuf struct from here
+ to vmsmunch.h
+ ---------------------------------------------------------------------------
+
+ Usage (i.e., "interface," in geek-speak):
+
+ int VMSmunch( char *filename, int action, char *ptr );
+
+ filename the name of the file on which to be operated, obviously
+ action an integer which specifies what action to take
+ ptr pointer to any extra item which may be needed (else NULL)
+
+ The possible values for the action argument are as follows:
+
+ GET_TIMES get the creation and revision dates of filename; ptr
+ must point to an empty VMStimbuf struct, as defined
+ in vmsmunch.h
+ (with room for at least 24 characters, including term.)
+ SET_TIMES set the creation and revision dates of filename (utime
+ option); ptr must point to a valid VMStimbuf struct,
+ as defined in vmsmunch.h
+ GET_RTYPE get the record type of filename; ptr must point to an
+ integer which, on return, is set to the type (as defined
+ in vmsdefs.h: FAT$C_* defines)
+ CHANGE_RTYPE change the record type to that specified by the integer
+ to which ptr points; save the old record type (later
+ saves overwrite earlier ones)
+ RESTORE_RTYPE restore the record type to the previously saved value;
+ or, if none, set it to "fixed-length, 512-byte" record
+ format (ptr not used)
+
+ ---------------------------------------------------------------------------
+
+ Comments from FILE.C, a utility to modify file characteristics:
+
+ Written by Joe Meadows Jr, at the Fred Hutchinson Cancer Research Center
+ BITNET: JOE@FHCRCVAX
+ PHONE: (206) 467-4970
+
+ There are no restrictions on this code, you may sell it, include it
+ with any commercial package, or feed it to a whale.. However, I would
+ appreciate it if you kept this comment in the source code so that anyone
+ receiving this code knows who to contact in case of problems. Note that
+ I do not demand this condition..
+
+ ---------------------------------------------------------------------------*/
+
+
+/* 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
+ * library dependencies need to have the correct module name.
+ */
+#if 0
+# if defined(__DECC) || defined(__GNUC__)
+# pragma module module_name module_version
+# else
+# module module_name module_version
+# endif
+#endif /* 0 */
+
+/*****************************/
+/* Includes, Defines, etc. */
+/*****************************/
+
+/* Accomodation for /NAMES = AS_IS with old header files. */
+
+#define sys$asctim SYS$ASCTIM
+#define sys$assign SYS$ASSIGN
+#define sys$bintim SYS$BINTIM
+#define sys$dassgn SYS$DASSGN
+#define sys$parse SYS$PARSE
+#define sys$qiow SYS$QIOW
+#define sys$search SYS$SEARCH
+
+#include "zip.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <iodef.h>
+#include <starlet.h>
+#include <fibdef.h> /* this gets created with the c3.0 compiler */
+
+/*
+ * Under Alpha (DEC C in VAXC mode) and under `good old' VAXC, the FIB unions
+ * are declared as variant_unions. DEC C (Alpha) in ANSI modes and third
+ * party compilers which do not support `variant_union' define preprocessor
+ * symbols to `hide' the "intermediate union/struct" names from the
+ * programmer's API.
+ * We check the presence of these defines and for DEC's FIBDEF.H defining
+ * __union as variant_union to make sure we access the structure correctly.
+ */
+#if defined(fib$w_did) || (defined(__union) && (__union == variant_union))
+# define FIB$W_DID fib$w_did
+# define FIB$W_FID fib$w_fid
+# define FIB$L_ACCTL fib$l_acctl
+#else
+# define FIB$W_DID fib$r_did_overlay.fib$w_did
+# define FIB$W_FID fib$r_fid_overlay.fib$w_fid
+# define FIB$L_ACCTL fib$r_acctl_overlay.fib$l_acctl
+#endif
+
+#include "vms.h"
+#include "vmsmunch.h" /* GET/SET_TIMES, RTYPE, etc. */
+#include "vmsdefs.h" /* fatdef.h, etc. */
+
+static void asctim(char *time, long int binval[2]);
+static void bintim(char *time, long int binval[2]);
+
+/* from <ssdef.h> */
+#ifndef SS$_NORMAL
+# define SS$_NORMAL 1
+# define SS$_BADPARAM 20
+#endif
+
+
+/* On VAX, define Goofy VAX Type-Cast to obviate /standard = vaxc.
+ Otherwise, lame system headers on VAX cause compiler warnings.
+ (GNU C may define vax but not __VAX.)
+*/
+#ifdef vax
+# define __VAX 1
+#endif /* def vax */
+
+#ifdef __VAX
+# define GVTC (unsigned int)
+#else /* def __VAX */
+# define GVTC
+#endif /* def __VAX */
+
+
+/*************************/
+/* Function VMSmunch() */
+/*************************/
+
+int VMSmunch(
+ char *filename,
+ int action,
+ char *ptr )
+{
+
+ /* original file.c variables */
+
+ static struct FAB Fab;
+ static struct NAM_STRUCT Nam;
+ static struct fibdef Fib; /* short fib */
+
+ static struct dsc$descriptor FibDesc =
+ {sizeof(Fib),DSC$K_DTYPE_Z,DSC$K_CLASS_S,(char *)&Fib};
+ static struct dsc$descriptor_s DevDesc =
+ {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,&Nam.NAM_DVI[1]};
+ static struct fatdef Fat;
+ static union {
+ struct fchdef fch;
+ long int dummy;
+ } uchar;
+ static struct fjndef jnl;
+ static long int Cdate[2],Rdate[2],Edate[2],Bdate[2];
+ static short int revisions;
+ static unsigned long uic;
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __member_alignment __save
+#pragma __nomember_alignment
+#endif /* __DECC || __DECCXX */
+ static union {
+ unsigned short int value;
+ struct {
+ unsigned system : 4;
+ unsigned owner : 4;
+ unsigned group : 4;
+ unsigned world : 4;
+ } bits;
+ } prot;
+#if defined(__DECC) || defined(__DECCXX)
+#pragma __member_alignment __restore
+#endif /* __DECC || __DECCXX */
+
+ static struct atrdef Atr[] = {
+ {sizeof(Fat),ATR$C_RECATTR, GVTC &Fat}, /* record attributes */
+ {sizeof(uchar),ATR$C_UCHAR, GVTC &uchar}, /* File characteristics */
+ {sizeof(Cdate),ATR$C_CREDATE, GVTC &Cdate[0]}, /* Creation date */
+ {sizeof(Rdate),ATR$C_REVDATE, GVTC &Rdate[0]}, /* Revision date */
+ {sizeof(Edate),ATR$C_EXPDATE, GVTC &Edate[0]}, /* Expiration date */
+ {sizeof(Bdate),ATR$C_BAKDATE, GVTC &Bdate[0]}, /* Backup date */
+ {sizeof(revisions),ATR$C_ASCDATES, GVTC &revisions}, /* number of revs */
+ {sizeof(prot),ATR$C_FPRO, GVTC &prot}, /* file protection */
+ {sizeof(uic),ATR$C_UIC, GVTC &uic}, /* file owner */
+ {sizeof(jnl),ATR$C_JOURNAL, GVTC &jnl}, /* journal flags */
+ {0,0,0}
+ } ;
+
+ static char EName[NAM_MAXRSS];
+ static char RName[NAM_MAXRSS];
+ static struct dsc$descriptor_s FileName =
+ {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
+ static struct dsc$descriptor_s string = {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
+ static short int DevChan;
+ static short int iosb[4];
+
+ static long int i,status;
+/* static char *retval; */
+
+
+ /* new VMSmunch variables */
+
+ static int old_rtype=FAT$C_FIXED; /* storage for record type */
+
+
+
+/*---------------------------------------------------------------------------
+ Initialize attribute blocks, parse filename, resolve any wildcards, and
+ get the file info.
+ ---------------------------------------------------------------------------*/
+
+ /* Initialize RMS structures. We need a NAM[L] to retrieve the FID. */
+ Fab = cc$rms_fab;
+ Fab.fab$l_fna = filename;
+ Fab.fab$b_fns = strlen(filename);
+ Fab.FAB_NAM = &Nam; /* FAB has an associated NAM[L]. */
+ Nam = CC_RMS_NAM;
+ Nam.NAM_ESA = EName; /* expanded filename */
+ Nam.NAM_ESS = sizeof(EName);
+ Nam.NAM_RSA = RName; /* resultant filename */
+ Nam.NAM_RSS = sizeof(RName);
+
+ /* do $PARSE and $SEARCH here */
+ status = sys$parse(&Fab);
+ if (!(status & 1)) return(status);
+
+ /* search for the first file.. If none signal error */
+ status = sys$search(&Fab);
+ if (!(status & 1)) return(status);
+
+ while (status & 1) {
+ /* initialize Device name length, note that this points into the NAM[L]
+ to get the device name filled in by the $PARSE, $SEARCH services */
+ DevDesc.dsc$w_length = Nam.NAM_DVI[0];
+
+ status = sys$assign(&DevDesc,&DevChan,0,0);
+ if (!(status & 1)) return(status);
+
+ FileName.dsc$a_pointer = Nam.NAM_L_NAME;
+ FileName.dsc$w_length = Nam.NAM_B_NAME+Nam.NAM_B_TYPE+Nam.NAM_B_VER;
+
+ /* Initialize the FIB */
+ for (i=0;i<3;i++) {
+ Fib.FIB$W_FID[i]=Nam.NAM_FID[i];
+ Fib.FIB$W_DID[i]=Nam.NAM_DID[i];
+ }
+
+ /* Use the IO$_ACCESS function to return info about the file */
+ /* Note, used this way, the file is not opened, and the expiration */
+ /* and revision dates are not modified */
+ status = sys$qiow(0,DevChan,IO$_ACCESS,&iosb,0,0,
+ &FibDesc,&FileName,0,0,&Atr,0);
+ if (!(status & 1) || !((status = iosb[0]) & 1)) {
+ sys$dassgn(DevChan);
+ return(status);
+ }
+
+ /*-----------------------------------------------------------------------
+ We have the current information from the file: now see what user
+ wants done with it.
+ -----------------------------------------------------------------------*/
+
+ switch (action) {
+
+ case GET_TIMES: /* non-modifying */
+ asctim(((struct VMStimbuf *)ptr)->modtime, Cdate);
+ asctim(((struct VMStimbuf *)ptr)->actime, Rdate);
+ sys$dassgn(DevChan);
+ return RMS$_NORMAL; /* return to user */
+ break;
+
+ case SET_TIMES:
+ if (((struct VMStimbuf *)ptr)->modtime != (char *)NULL)
+ bintim(((struct VMStimbuf *)ptr)->modtime, Cdate);
+ if (((struct VMStimbuf *)ptr)->actime != (char *)NULL)
+ bintim(((struct VMStimbuf *)ptr)->actime, Rdate);
+ break;
+
+ case GET_RTYPE: /* non-modifying */
+ *(int *)ptr = Fat.fat$v_rtype;
+ sys$dassgn(DevChan);
+ return RMS$_NORMAL; /* return to user */
+ break;
+
+ case CHANGE_RTYPE:
+ old_rtype = Fat.fat$v_rtype; /* save current one */
+ if ((*(int *)ptr < FAT$C_UNDEFINED) ||
+ (*(int *)ptr > FAT$C_STREAMCR))
+ Fat.fat$v_rtype = FAT$C_STREAMLF; /* Unix I/O happy */
+ else
+ Fat.fat$v_rtype = *(int *)ptr;
+ break;
+
+ case RESTORE_RTYPE:
+ Fat.fat$v_rtype = old_rtype;
+ break;
+
+ default:
+ sys$dassgn(DevChan);
+ return SS$_BADPARAM; /* anything better? */
+ }
+
+ /*-----------------------------------------------------------------------
+ Go back and write modified data to the file header.
+ -----------------------------------------------------------------------*/
+
+ /* note, part of the FIB was cleared by earlier QIOW, so reset it */
+ Fib.FIB$L_ACCTL = FIB$M_NORECORD;
+ for (i=0;i<3;i++) {
+ Fib.FIB$W_FID[i]=Nam.NAM_FID[i];
+ Fib.FIB$W_DID[i]=Nam.NAM_DID[i];
+ }
+
+ /* Use the IO$_MODIFY function to change info about the file */
+ /* Note, used this way, the file is not opened, however this would */
+ /* normally cause the expiration and revision dates to be modified. */
+ /* Using FIB$M_NORECORD prohibits this from happening. */
+ status = sys$qiow(0,DevChan,IO$_MODIFY,&iosb,0,0,
+ &FibDesc,&FileName,0,0,&Atr,0);
+ if (!(status & 1) || !((status = iosb[0]) & 1)) {
+ sys$dassgn(DevChan);
+ return(status);
+ }
+
+ status = sys$dassgn(DevChan);
+ if (!(status & 1)) return(status);
+
+ /* look for next file, if none, no big deal.. */
+ status = sys$search(&Fab);
+ }
+ return(status);
+} /* end function VMSmunch() */
+
+
+
+
+
+/***********************/
+/* Function asctim() */
+/***********************/
+
+static void asctim( /* convert 64-bit binval to string, put in time */
+ char *time,
+ long int binval[2] )
+{
+ static struct dsc$descriptor date_str={23,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
+ /* dsc$w_length, dsc$b_dtype, dsc$b_class, dsc$a_pointer */
+
+ date_str.dsc$a_pointer = time;
+ sys$asctim(0, &date_str, binval, 0);
+ time[23] = '\0';
+}
+
+
+
+
+
+/***********************/
+/* Function bintim() */
+/***********************/
+
+static void bintim( /* convert time string to 64 bits, put in binval */
+ char *time,
+ long int binval[2] )
+{
+ static struct dsc$descriptor date_str={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
+
+ date_str.dsc$w_length = strlen(time);
+ date_str.dsc$a_pointer = time;
+ sys$bintim(&date_str, binval);
+}
diff --git a/vms/vmsmunch.h b/vms/vmsmunch.h
new file mode 100644
index 0000000..458ad78
--- /dev/null
+++ b/vms/vmsmunch.h
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 1990-1999 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
+*/
+/*---------------------------------------------------------------------------
+
+ vmsmunch.h
+
+ A few handy #defines, plus the contents of three header files from Joe
+ Meadows' FILE program. Used by VMSmunch and by various routines which
+ call VMSmunch (e.g., in Zip and UnZip).
+
+ 02-Apr-1994 Jamie Hanrahan jeh@cmkrnl.com
+ Moved definition of VMStimbuf struct from vmsmunch.c
+ to here.
+
+ 06-Apr-1994 Jamie Hanrahan jeh@cmkrnl.com
+ Moved "contents of three header files" (not needed by
+ callers of vmsmunch) to VMSdefs.h .
+
+ 07-Apr-1994 Richard Levitte levitte@e.kth.se
+ Inserted a forward declaration of VMSmunch.
+
+ 17-Sep-1995 Chr. Spieler spieler@linac.ikp.physik.th-darmstadt.de
+ Added wrapper to prevent multiple loading of this file.
+
+ 10-Oct-1995 Chr. Spieler spieler@linac.ikp.physik.th-darmstadt.de
+ Use lowercase names for all VMS specific source files
+
+ 15-Dec-1995 Chr. Spieler spieler@linac.ikp.physik.th-darmstadt.de
+ Removed ALL "tabs" from source file.
+
+ ---------------------------------------------------------------------------*/
+
+#ifndef __vmsmunch_h
+#define __vmsmunch_h 1
+
+#define GET_TIMES 4
+#define SET_TIMES 0
+#define GET_RTYPE 1
+#define CHANGE_RTYPE 2
+#define RESTORE_RTYPE 3
+
+struct VMStimbuf { /* VMSmunch */
+ char *actime; /* VMS revision date, ASCII format */
+ char *modtime; /* VMS creation date, ASCII format */
+};
+
+extern int VMSmunch(char *filename, int action, char *ptr);
+
+#endif /* !__vmsmunch_h */
diff --git a/vms/vmszip.c b/vms/vmszip.c
new file mode 100644
index 0000000..2dae718
--- /dev/null
+++ b/vms/vmszip.c
@@ -0,0 +1,1444 @@
+/*
+ Copyright (c) 1990-2007 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
+*/
+
+/* 2005-02-14 SMS.
+ Added some ODS5 support.
+ Use longer name structures in NAML, where available.
+ Locate special characters mindful of "^" escapes.
+ Replaced compile-time case preservation (VMS_PRESERVE_CASE macro)
+ with command-line-specified case preservation (vms_case_x
+ variables).
+ Prototyped all functions.
+ Removed "#ifndef UTIL", as no one should be compiling it that way.
+*/
+
+#include "zip.h"
+#include "vmsmunch.h"
+#include "vms.h"
+
+#include <ctype.h>
+#include <time.h>
+#include <unixlib.h>
+
+/* 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.)
+*/
+#ifdef __CRTL_VER
+#if __CRTL_VER >= 70000000
+#define HAVE_STRCASECMP
+#endif /* __CRTL_VER >= 70000000 */
+#endif /* def __CRTL_VER */
+
+#ifdef HAVE_STRCASECMP
+#include <strings.h> /* str[n]casecmp() */
+#endif /* def HAVE_STRCASECMP */
+
+#include <dvidef.h>
+#include <lib$routines.h>
+#include <ssdef.h>
+#include <stsdef.h>
+#include <starlet.h>
+
+/* Directory file type with version, and its strlen(). */
+#define DIR_TYPE_VER ".DIR;1"
+#define DIR_TYPE_VER_LEN (sizeof( DIR_TYPE_VER)- 1)
+
+/* Extra malloc() space in names for cutpath(). (May have to change
+ ".FOO]" to "]FOO.DIR;1".)
+*/
+#define DIR_PAD (DIR_TYPE_VER_LEN- 1)
+
+/* Hex digit table. */
+
+char hex_digit[ 16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+};
+
+/* Character property table for (re-)escaping ODS5 extended file names.
+ Note that this table ignore Unicode, and does not identify invalid
+ characters.
+
+ ODS2 valid characters: 0-9 A-Z a-z $ - _
+
+ ODS5 Invalid characters:
+ C0 control codes (0x00 to 0x1F inclusive)
+ Asterisk (*)
+ Question mark (?)
+
+ ODS5 Invalid characters only in VMS V7.2 (which no one runs, right?):
+ Double quotation marks (")
+ Backslash (\)
+ Colon (:)
+ Left angle bracket (<)
+ Right angle bracket (>)
+ Slash (/)
+ Vertical bar (|)
+
+ Characters escaped by "^":
+ SP ! # % & ' ( ) + , . ; = @ [ ] ^ ` { } ~
+
+ Either "^_" or "^ " is accepted as a space. Period (.) is a special
+ case. Note that un-escaped < and > can also confuse a directory
+ spec.
+
+ Characters put out as ^xx:
+ 7F (DEL)
+ 80-9F (C1 control characters)
+ A0 (nonbreaking space)
+ FF (Latin small letter y diaeresis)
+
+ Other cases:
+ Unicode: "^Uxxxx", where "xxxx" is four hex digits.
+
+ Property table values:
+ Normal escape: 1
+ Space: 2
+ Dot: 4
+ Hex-hex escape: 8
+ -------------------
+ Hex digit: 64
+*/
+
+unsigned char char_prop[ 256] = {
+
+/* NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+/* DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+/* SP ! " # $ % & ' ( ) * + , - . / */
+ 2, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 4, 0,
+
+/* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 1, 1, 1, 1, 1,
+
+/* @ A B C D E F G H I J K L M N O */
+ 1, 64, 64, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+/* P Q R S T U V W X Y Z [ \ ] ^ _ */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0,
+
+/* ` a b c d e f g h i j k l m n o */
+ 1, 64, 64, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+/* p q r s t u v w x y z { | } ~ DEL */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 8,
+
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8
+};
+
+/* The C RTL from OpenVMS 7.0 and newer supplies POSIX compatible versions of
+ * opendir() et al. Thus, we have to use other names in our private code for
+ * directory scanning to prevent symbol name conflicts at link time.
+ * For now, we do not use the library supplied "dirent.h" functions, since
+ * our private implementation provides some functionality which may not be
+ * present in the library versions. For example:
+ * ==> zopendir("DISK:[DIR.SUB1]SUB2.DIR") scans "DISK:[DIR.SUB1.SUB2]".
+ */
+
+typedef struct zdirent {
+ int d_wild; /* flag for wildcard vs. non-wild */
+ struct FAB fab;
+ struct NAM_STRUCT nam;
+ char d_qualwildname[ NAM_MAXRSS+ 1];
+ char d_name[ NAM_MAXRSS+ 1];
+} zDIR;
+
+extern char *label;
+local ulg label_time = 0;
+local ulg label_mode = 0;
+local time_t label_utim = 0;
+
+local int relative_dir_s = 0; /* Relative directory spec. */
+
+/* Local functions */
+local void vms_wild OF((char *, zDIR *));
+local zDIR *zopendir OF((ZCONST char *));
+local char *readd OF((zDIR *));
+local char *strlower OF((char *));
+local char *strupper OF((char *));
+
+/* 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);
+}
+
+#ifndef UINT_MAX
+#define UINT_MAX 4294967295U
+#endif
+
+#define strcasecmp( s1, s2) strncasecmp( s1, s2, UINT_MAX)
+
+#endif /* ndef HAVE_STRCASECMP */
+
+
+/* 2004-09-27 SMS.
+ eat_carets().
+
+ Delete ODS5 extended file name escape characters ("^") in the
+ original buffer.
+ Note that the current scheme does not handle all EFN cases, but it
+ could be made more complicated.
+*/
+
+local void eat_carets( char *str)
+/* char *str; Source pointer. */
+{
+ char *strd; /* Destination pointer. */
+ char hdgt;
+ unsigned char uchr;
+ unsigned char prop;
+
+ /* Skip ahead to the first "^", if any. */
+ while ((*str != '\0') && (*str != '^'))
+ str++;
+
+ /* If no caret was found, quit early. */
+ if (*str != '\0')
+ {
+ /* Shift characters leftward as carets are found. */
+ strd = str;
+ while (*str != '\0')
+ {
+ uchr = *str;
+ if (uchr == '^')
+ {
+ /* Found a caret. Skip it, and check the next character. */
+ uchr = *(++str);
+ prop = char_prop[ uchr];
+ if (prop& 64)
+ {
+ /* Hex digit. Get char code from this and next hex digit. */
+ if (uchr <= '9')
+ {
+ hdgt = uchr- '0'; /* '0' - '9' -> 0 - 9. */
+ }
+ else
+ {
+ hdgt = ((uchr- 'A')& 7)+ 10; /* [Aa] - [Ff] -> 10 - 15. */
+ }
+ hdgt <<= 4; /* X16. */
+ uchr = *(++str); /* Next char must be hex digit. */
+ if (uchr <= '9')
+ {
+ uchr = hdgt+ uchr- '0';
+ }
+ else
+ {
+ uchr = hdgt+ ((uchr- 'A')& 15)+ 10;
+ }
+ }
+ else if (uchr == '_')
+ {
+ /* Convert escaped "_" to " ". */
+ uchr = ' ';
+ }
+ else if (uchr == '/')
+ {
+ /* Convert escaped "/" (invalid Zip) to "?" (invalid VMS). */
+ uchr = '?';
+ }
+ /* Else, not a hex digit. Must be a simple escaped character
+ (or Unicode, which is not yet handled here).
+ */
+ }
+ /* Else, not a caret. Use as-is. */
+ *strd = uchr;
+
+ /* Advance destination and source pointers. */
+ strd++;
+ str++;
+ }
+ /* Terminate the destination string. */
+ *strd = '\0';
+ }
+}
+
+
+/* 2007-05-22 SMS.
+ * explicit_dev().
+ *
+ * Determine if an explicit device name is present in a (VMS) file
+ * specification.
+ */
+local int explicit_dev( char *file_spec)
+{
+ int sts;
+ struct FAB fab; /* FAB. */
+ struct NAM_STRUCT nam; /* NAM[L]. */
+
+ /* Initialize the FAB and NAM[L], and link the NAM[L] to the FAB. */
+ nam = CC_RMS_NAM;
+ fab = cc$rms_fab;
+ fab.FAB_NAM = &nam;
+
+ /* Point the FAB/NAM[L] fields to the actual name and default name. */
+
+#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 /* def NAML$C_MAXRSS */
+
+ /* File name. */
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = file_spec;
+ FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen( file_spec);
+
+ nam.NAM_NOP = NAM_M_SYNCHK; /* Syntax-only analysis. */
+ sts = sys$parse( &fab, 0, 0); /* Parse the file spec. */
+
+ /* Device found = $PARSE success and "device was explicit" flag. */
+ return (((sts& STS$M_SEVERITY) == STS$M_SUCCESS) &&
+ ((nam.NAM_FNB& NAM_M_EXP_DEV) != 0));
+}
+
+
+/* 2005-02-04 SMS.
+ find_dir().
+
+ Find directory boundaries in an ODS2 or ODS5 file spec.
+ Returns length (zero if no directory, negative if error),
+ and sets "start" argument to first character (typically "[") location.
+
+ No one will care about the details, but the return values are:
+
+ 0 No dir.
+ -2 [, no end. -3 <, no end.
+ -4 [, multiple start. -5 <, multiple start.
+ -8 ], no start. -9 >, no start.
+ -16 ], wrong end. -17 >, wrong end.
+ -32 ], multiple end. -33 >, multiple end.
+
+ Note that the current scheme handles only simple EFN cases, but it
+ could be made more complicated.
+*/
+int find_dir( char *file_spec, char **start)
+{
+ char *cp;
+ char chr;
+
+ char *end_tmp = NULL;
+ char *start_tmp = NULL;
+ int lenth = 0;
+
+ for (cp = file_spec; cp < file_spec+ strlen( file_spec); cp++)
+ {
+ chr = *cp;
+ if (chr == '^')
+ {
+ /* Skip ODS5 extended name escaped characters. */
+ cp++;
+ /* If escaped char is a hex digit, skip the second hex digit, too. */
+ if (char_prop[ (unsigned char) *cp]& 64)
+ cp++;
+ }
+ else if (chr == '[')
+ {
+ /* Found start. */
+ if (start_tmp == NULL)
+ {
+ /* First time. Record start location. */
+ start_tmp = cp;
+ /* Error if no end. */
+ lenth = -2;
+ }
+ else
+ {
+ /* Multiple start characters. */
+ lenth = -4;
+ break;
+ }
+ }
+ else if (chr == '<')
+ {
+ /* Found start. */
+ if (start_tmp == NULL)
+ {
+ /* First time. Record start location. */
+ start_tmp = cp;
+ /* Error if no end. */
+ lenth = -3;
+ }
+ else
+ {
+ /* Multiple start characters. */
+ lenth = -5;
+ break;
+ }
+ }
+ else if (chr == ']')
+ {
+ /* Found end. */
+ if (end_tmp == NULL)
+ {
+ /* First time. */
+ if (lenth == 0)
+ {
+ /* End without start. */
+ lenth = -8;
+ break;
+ }
+ else if (lenth != -2)
+ {
+ /* Wrong kind of end. */
+ lenth = -16;
+ break;
+ }
+ /* End ok. Record end location. */
+ end_tmp = cp;
+ lenth = end_tmp+ 1- start_tmp;
+ /* Could break here, ignoring excessive end characters. */
+ }
+ else
+ {
+ /* Multiple end characters. */
+ lenth = -32;
+ break;
+ }
+ }
+ else if (chr == '>')
+ {
+ /* Found end. */
+ if (end_tmp == NULL)
+ {
+ /* First time. */
+ if (lenth == 0)
+ {
+ /* End without start. */
+ lenth = -9;
+ break;
+ }
+ else if (lenth != -3)
+ {
+ /* Wrong kind of end. */
+ lenth = -17;
+ break;
+ }
+ /* End ok. Record end location. */
+ end_tmp = cp;
+ lenth = end_tmp+ 1- start_tmp;
+ /* Could break here, ignoring excessive end characters. */
+ }
+ else
+ {
+ /* Multiple end characters. */
+ lenth = -33;
+ break;
+ }
+ }
+ }
+
+ /* If both start and end were found,
+ then set result pointer where safe.
+ */
+ if (lenth > 0)
+ {
+ if (start != NULL)
+ {
+ *start = start_tmp;
+ }
+ }
+ return lenth;
+}
+
+
+/* 2005-02-08 SMS.
+ file_sys_type().
+
+ Determine the file system type for the (VMS) path name argument.
+*/
+local int file_sys_type( 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.)
+*/
+
+ int sts;
+
+ struct dsc$descriptor_s dev_descr =
+ { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 };
+
+ /* Load path argument into device descriptor. */
+ dev_descr.dsc$a_pointer = path;
+ dev_descr.dsc$w_length = strlen( dev_descr.dsc$a_pointer);
+
+ /* Get filesystem type code.
+ (Text results for this item code have been unreliable.)
+ */
+ sts = lib$getdvi( &((int) DVI$_ACPTYPE), 0, &dev_descr, &acp_code, 0, 0);
+
+ if ((sts & STS$M_SUCCESS) != STS$K_SUCCESS)
+ {
+ acp_code = -1;
+ }
+
+#else /* def DVI$C_ACP_F11V5 */
+
+/* Too old for ODS5 file system. Must be ODS2. */
+
+ acp_code = DVI$C_ACP_F11V2;
+
+#endif /* def DVI$C_ACP_F11V5 */
+
+ return acp_code;
+}
+
+/*---------------------------------------------------------------------------
+
+ _vms_findfirst() and _vms_findnext(), based on public-domain DECUS C
+ fwild() and fnext() routines (originally written by Martin Minow, poss-
+ ibly modified by Jerry Leichter for bintnxvms.c), were written by Greg
+ Roelofs and are still in the public domain. Routines approximate the
+ behavior of MS-DOS (MSC and Turbo C) findfirst and findnext functions.
+
+ 2005-01-04 SMS.
+ Changed to use NAML instead of NAM, where available.
+
+ ---------------------------------------------------------------------------*/
+
+static char wild_version_part[10]="\0";
+
+local void vms_wild( char *p, zDIR *d)
+{
+ /*
+ * Do wildcard setup.
+ */
+ /* Set up the FAB and NAM[L] blocks. */
+ d->fab = cc$rms_fab; /* Initialize FAB. */
+ d->nam = CC_RMS_NAM; /* Initialize NAM[L]. */
+
+ d->fab.FAB_NAM = &d->nam; /* FAB -> NAM[L] */
+
+#ifdef NAML$C_MAXRSS
+
+ d->fab.fab$l_dna =(char *) -1; /* Using NAML for default name. */
+ d->fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
+
+#endif /* def NAML$C_MAXRSS */
+
+ /* Argument file name and length. */
+ d->FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = p;
+ d->FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen(p);
+
+#define DEF_DEVDIR "SYS$DISK:[]"
+
+ /* Default file spec and length. */
+ d->FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNA = DEF_DEVDIR;
+ d->FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNS = sizeof( DEF_DEVDIR)- 1;
+
+ d->nam.NAM_ESA = d->d_qualwildname; /* qualified wild name */
+ d->nam.NAM_ESS = NAM_MAXRSS; /* max length */
+ d->nam.NAM_RSA = d->d_name; /* matching file name */
+ d->nam.NAM_RSS = NAM_MAXRSS; /* max length */
+
+ /* parse the file name */
+ if (sys$parse(&d->fab) != RMS$_NORMAL)
+ return;
+ /* Does this replace d->fab.fab$l_fna with a new string in its own space?
+ I sure hope so, since p is free'ed before this routine returns. */
+
+ /* have qualified wild name (i.e., disk:[dir.subdir]*.*); null-terminate
+ * and set wild-flag */
+ d->d_qualwildname[d->nam.NAM_ESL] = '\0';
+ d->d_wild = (d->nam.NAM_FNB & NAM$M_WILDCARD)? 1 : 0; /* not used... */
+#ifdef DEBUG
+ fprintf(mesg, " incoming wildname: %s\n", p);
+ fprintf(mesg, " qualified wildname: %s\n", d->d_qualwildname);
+#endif /* DEBUG */
+}
+
+local zDIR *zopendir( ZCONST char *n)
+/* ZCONST char *n; directory to open */
+/* Start searching for files in the VMS directory n */
+{
+ char *c; /* scans VMS path */
+ zDIR *d; /* malloc'd return value */
+ int m; /* length of name */
+ char *p; /* malloc'd temporary string */
+
+ if ((d = (zDIR *)malloc(sizeof(zDIR))) == NULL ||
+ (p = malloc((m = strlen(n)) + 4)) == NULL) {
+ if (d != NULL) free((zvoid *)d);
+ return NULL;
+ }
+ /* Directory may be in form "[DIR.SUB1.SUB2]" or "[DIR.SUB1]SUB2.DIR;1".
+ If latter, convert to former.
+ 2005-01-31 SMS. Changed to require ";1", as VMS does, which
+ simplified the code slightly, too. Note that ODS5 allows ".DIR" in
+ any case (upper, lower, mixed).
+ */
+ if ((m > 0) && (*(c = strcpy(p,n)+m-1) != ']'))
+ {
+ if ((c- p < DIR_TYPE_VER_LEN) ||
+ strcasecmp((c+ 1- DIR_TYPE_VER_LEN), DIR_TYPE_VER))
+ {
+ free((zvoid *)d); free((zvoid *)p);
+ return NULL;
+ }
+ c -= 4; /* The "D". */
+ *c-- = '\0'; /* terminate at "DIR;1" */
+ *c = ']'; /* "." --> "]" */
+
+ /* Replace the formerly last "]" with ".".
+ For ODS5, ignore "^]".
+ */
+ while ((c > p) && ((*--c != ']') || (*(c- 1) == '^')))
+ ;
+ *c = '.'; /* "]" --> "." */
+ }
+ strcat(p, "*.*");
+ strcat(p, wild_version_part);
+ vms_wild(p, d); /* set up wildcard */
+ free((zvoid *)p);
+ return d;
+}
+
+local char *readd( zDIR *d)
+/* zDIR *d; directory stream to read from */
+/* Return a pointer to the next name in the directory stream d, or NULL if
+ no more entries or an error occurs. */
+{
+ int r; /* return code */
+
+ do {
+ d->fab.fab$w_ifi = 0; /* internal file index: what does this do? */
+/*
+ 2005-02-04 SMS.
+
+ From the docs:
+
+ Note that you must close the file before invoking the Search
+ service (FAB$W_IFI must be 0).
+
+ The same is true for PARSE. Most likely, it's cleared by setting
+ "fab = cc$rms_fab", and left that way, so clearing it here may very
+ well be pointless. (I think it is, and I've never seen it explicitly
+ cleared elsewhere, but I haven't tested it everywhere either.)
+*/
+ /* get next match to possible wildcard */
+ if ((r = sys$search(&d->fab)) == RMS$_NORMAL)
+ {
+ d->d_name[d->nam.NAM_RSL] = '\0'; /* null terminate */
+ return (char *)d->d_name; /* OK */
+ }
+ } while (r == RMS$_PRV);
+ return NULL;
+}
+
+
+int wild( char *p)
+/* char *p; path/pattern to match */
+/* Expand the pattern based on the contents of the file system.
+ Return an error code in the ZE_ class.
+ Note that any command-line file argument may need wildcard expansion,
+ so all user-specified constituent file names pass through here.
+*/
+{
+ zDIR *d; /* stream for reading directory */
+ char *e; /* name found in directory */
+ int f; /* true if there was a match */
+
+ int dir_len; /* Length of the directory part of the name. */
+ char *dir_start; /* First character of the directory part. */
+
+ /* special handling of stdin request */
+ if (strcmp(p, "-") == 0) /* if compressing stdin */
+ return newname(p, 0, 0);
+
+ /* Determine whether this name has an absolute or relative directory
+ spec. It's relative if there is no directory, or if the directory
+ has a leading dot ("[.").
+ */
+ dir_len = find_dir( p, &dir_start);
+ relative_dir_s = ((dir_len <= 0)? 1 : (dir_start[ 1] == '.'));
+
+ /* Search given pattern for matching names */
+ if ((d = (zDIR *)malloc(sizeof(zDIR))) == NULL)
+ return ZE_MEM;
+ vms_wild(p, d); /* pattern may be more than just directory name */
+
+ /*
+ * Save version specified by user to use in recursive drops into
+ * subdirectories.
+ */
+ strncpy(wild_version_part, d->nam.NAM_L_VER, d->nam.NAM_B_VER);
+ wild_version_part[d->nam.NAM_B_VER] = '\0';
+
+ f = 0;
+ while ((e = readd(d)) != NULL) /* "dosmatch" is already built in */
+ if (procname(e, 0) == ZE_OK)
+ f = 1;
+ free(d);
+
+ /* Done */
+ return f ? ZE_OK : ZE_MISS;
+}
+
+int procname( char *n, int caseflag)
+/* char *n; name to process */
+/* int caseflag; true to force case-sensitive match */
+/* Process a name or sh expression to operate on (or exclude). Return
+ an error code in the ZE_ class. */
+{
+ zDIR *d; /* directory stream from zopendir() */
+ char *e; /* pointer to name from readd() */
+ int m; /* matched flag */
+ char *p; /* path for recursion */
+ struct stat s; /* result of stat() */
+ struct zlist far *z; /* steps through zfiles list */
+
+ if (strcmp(n, "-") == 0) /* if compressing stdin */
+ return newname(n, 0, caseflag);
+ else if (LSSTAT(n, &s)
+#if defined(__TURBOC__) || defined(VMS) || defined(__WATCOMC__)
+ /* For these 3 compilers, stat() succeeds on wild card names! */
+ || isshexp(n)
+#endif
+ )
+ {
+ /* Not a file or directory--search for shell expression in zip file */
+ if (caseflag) {
+ p = malloc(strlen(n) + 1);
+ if (p != NULL)
+ strcpy(p, n);
+ } else
+ p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
+ m = 1;
+ for (z = zfiles; z != NULL; z = z->nxt) {
+ if (MATCH(p, z->iname, caseflag))
+ {
+ z->mark = pcount ? filter(z->zname, caseflag) : 1;
+ if (verbose)
+ fprintf(mesg, "zip diagnostic: %scluding %s\n",
+ z->mark ? "in" : "ex", z->name);
+ m = 0;
+ }
+ }
+ free((zvoid *)p);
+ return m ? ZE_MISS : ZE_OK;
+ }
+
+ /* Live name--use if file, recurse if directory */
+ if ((s.st_mode & S_IFDIR) == 0)
+ {
+ /* add or remove name of file */
+ if ((m = newname(n, 0, caseflag)) != ZE_OK)
+ return m;
+ } else {
+ if (dirnames && (m = newname(n, 1, caseflag)) != ZE_OK) {
+ return m;
+ }
+ /* recurse into directory */
+ if (recurse && (d = zopendir(n)) != NULL)
+ {
+ while ((e = readd(d)) != NULL) {
+ if ((m = procname(e, caseflag)) != ZE_OK) /* recurse on name */
+ {
+ free(d);
+ return m;
+ }
+ }
+ free(d);
+ }
+ } /* (s.st_mode & S_IFDIR) == 0) */
+ return ZE_OK;
+}
+
+/* 2004-09-24 SMS.
+ Cuter strlower() and strupper() functions.
+*/
+
+local char *strlower( char *s)
+/* Convert all uppercase letters to lowercase in string s */
+{
+ for ( ; *s != '\0'; s++)
+ if (isupper( *s))
+ *s = tolower( *s);
+
+ return s;
+}
+
+local char *strupper( char *s)
+/* Convert all lowercase letters to uppercase in string s */
+{
+ for ( ; *s != '\0'; s++)
+ if (islower( *s))
+ *s = toupper( *s);
+
+ return s;
+}
+
+char *ex2in( char *x, int isdir, int *pdosflag)
+/* char *x; external file name */
+/* int isdir; input: x is a directory */
+/* int *pdosflag; output: force MSDOS file attributes? */
+
+/* Convert the external file name to a zip file name, returning the
+ malloc'ed string or NULL if not enough memory.
+
+ 2005-02-09 SMS.
+ Added some ODS5 support.
+
+ Note that if we were really clever, we'd save the truncated original
+ file name for later use as "iname", instead of running the de-escaped
+ product back through in2ex() to recover it later.
+
+ 2005-11-13 SMS.
+ Changed to translate "[..." into enough "/" characters to cause
+ in2ex() to reconstruct it. This should not be needed, however, as
+ pattern matching really should avoid ex2in() and in2ex().
+*/
+{
+ char *n; /* Internal file name (malloc'ed). */
+ char *nn; /* Temporary "n"-like pointer. */
+ char *ext_dir_and_name; /* External dir]name (less "dev:["). */
+ char chr; /* Temporary character storage. */
+ int dosflag;
+ int down_case; /* Resultant down-case flag. */
+ int dir_len; /* Directory spec length. */
+ int ods_level; /* File system type. */
+
+ dosflag = dosify; /* default for non-DOS and non-OS/2 */
+
+ /* Locate the directory part of the external name. */
+ dir_len = find_dir( x, &ext_dir_and_name);
+ if (dir_len <= 0)
+ {
+ /* Directory not found. Use whole external name. */
+ ext_dir_and_name = x;
+ }
+ else if (pathput)
+ {
+ /* Include directory. */
+ if (ext_dir_and_name[ 1] == '.')
+ {
+ /* Relative path. If not a directory-depth wildcard, then drop
+ first "[." (or "<."). If "[..." (or "<..."), then preserve all
+ characters, including the first "[" (or "<") for special
+ handling below.
+ */
+ if ((ext_dir_and_name[ 2] != '.') || (ext_dir_and_name[ 3] != '.'))
+ {
+ /* Normal relative path. Drop first "[." (or "<."). */
+ dir_len -= 2;
+ ext_dir_and_name += 2;
+ }
+ }
+ else
+ {
+ /* Absolute path. Skip first "[" (or "<"). */
+ dir_len -= 1;
+ ext_dir_and_name += 1;
+
+ /* 2007-04-26 SMS.
+ Skip past "000000." or "000000]" (or "000000>"), which should
+ not be stored in the archive. This arises, for example, with
+ "zip -r archive [000000]foo.dir"
+ */
+#define MFD "000000"
+
+ if ((strncmp( ext_dir_and_name, MFD, strlen( MFD)) == 0) &&
+ ((ext_dir_and_name[ 6] == '.') ||
+ (ext_dir_and_name[ 6] == ']') ||
+ (ext_dir_and_name[ 6] == '>')))
+ {
+ dir_len -= 7;
+ ext_dir_and_name += 7;
+ }
+ }
+ }
+ else
+ {
+ /* Junking paths. Skip the whole directory spec. */
+ ext_dir_and_name += dir_len;
+ dir_len = 0;
+ }
+
+ /* Malloc space for internal name and copy it. */
+ if ((n = malloc(strlen( ext_dir_and_name)+ 1)) == NULL)
+ return NULL;
+ strcpy( n, ext_dir_and_name);
+
+ /* Convert VMS directory separators (".") to "/". */
+ if (dir_len > 0)
+ {
+ for (nn = n; nn < n+ dir_len; nn++)
+ {
+ chr = *nn;
+ if (chr == '^')
+ {
+ /* Skip ODS5 extended name escaped characters. */
+ nn++;
+ /* If escaped char is a hex digit, skip the second hex digit, too. */
+ if (char_prop[ (unsigned char) *nn]& 64)
+ nn++;
+ }
+ else if ((chr == '.') || ((nn == n) && ((chr == '[') || (chr == '<'))))
+ {
+ /* Convert VMS directory separator (".", or initial "[" or "<"
+ of "[..." or "<...") to "/".
+ */
+ *nn = '/';
+ }
+ }
+ /* Replace directory end character (typically "]") with "/". */
+ n[ dir_len- 1] = '/';
+ }
+
+ /* If relative path, then strip off the current directory. */
+ if (relative_dir_s)
+ {
+ char cwd[ NAM_MAXRSS+ 1];
+ char *cwd_dir_only;
+ char *q;
+ int cwd_dir_only_len;
+
+ q = getcwd( cwd, (sizeof( cwd)- 1));
+
+ /* 2004-09-24 SMS.
+ With SET PROCESSS /PARSE = EXTENDED, getcwd() can return a
+ mixed-case result, confounding the comparisons below with an
+ all-uppercase name in "n". Always use a case-insensitive
+ comparison around here.
+ */
+
+ /* Locate the directory part of the external name. */
+ dir_len = find_dir( q, &cwd_dir_only);
+ if (dir_len > 0)
+ {
+ /* Skip first "[" (or "<"). */
+ cwd_dir_only++;
+ /* Convert VMS directory separators (".") to "/". */
+ for (q = cwd_dir_only; q < cwd_dir_only+ dir_len; q++)
+ {
+ chr = *q;
+ if (chr == '^')
+ {
+ /* Skip ODS5 extended name escaped characters. */
+ q++;
+ /* If escaped char is a hex digit, skip the second hex digit, too. */
+ if (char_prop[ (unsigned char) *q]& 64)
+ q++;
+ }
+ else if (chr == '.')
+ {
+ /* Convert VMS directory separator (".") to "/". */
+ *q = '/';
+ }
+ }
+ /* Replace directory end character (typically "]") with "/". */
+ cwd_dir_only[ dir_len- 2] = '/';
+ }
+
+ /* If the slash-converted cwd matches the front of the internal
+ name, then shuffle the remainder of the internal name to the
+ beginning of the internal name storage.
+
+ Because we already know that the path is relative, this test may
+ always succeed.
+ */
+ cwd_dir_only_len = strlen( cwd_dir_only);
+ if (strncasecmp( n, cwd_dir_only, cwd_dir_only_len) == 0)
+ {
+ nn = n+ cwd_dir_only_len;
+ q = n;
+ while (*q++ = *nn++);
+ }
+ } /* (relative_dir_s) */
+
+ /* 2007-05-22 SMS.
+ * If a device name is present, assume that it's a real (VMS) file
+ * specification, and do down-casing according to the ODS2 or ODS5
+ * down-casing policy. If no device name is present, assume that it's
+ * a pattern ("-i", ...), and do no down-casing here. (Case
+ * sensitivity in patterns is handled elsewhere.)
+ */
+ if (explicit_dev( x))
+ {
+ /* If ODS5 is possible, do complicated down-case check.
+
+ Note that the test for ODS2/ODS5 is misleading and over-broad.
+ Here, "ODS2" includes anything from DVI$C_ACP_F11V1 (=1, ODS1) up
+ to (but not including) DVI$C_ACP_F11V5 (= 11, DVI$C_ACP_F11V5),
+ while "ODS5" includes anything from DVI$C_ACP_F11V5 on up. See
+ DVIDEF.H.
+ */
+
+#if defined( DVI$C_ACP_F11V5) && defined( NAML$C_MAXRSS)
+
+ /* Check options and/or ODS level for down-case or preserve case. */
+ down_case = 0; /* Assume preserve case. */
+ if ((vms_case_2 <= 0) && (vms_case_5 < 0))
+ {
+ /* Always down-case. */
+ down_case = 1;
+ }
+ else if ((vms_case_2 <= 0) || (vms_case_5 < 0))
+ {
+ /* Down-case depending on ODS level. (Use (full) external name.) */
+ ods_level = file_sys_type( x);
+
+ if (ods_level > 0)
+ {
+ /* Valid ODS level. (Name (full) contains device.)
+ * Down-case accordingly.
+ */
+ if (((ods_level < DVI$C_ACP_F11V5) && (vms_case_2 <= 0)) ||
+ ((ods_level >= DVI$C_ACP_F11V5) && (vms_case_5 < 0)))
+ {
+ /* Down-case for this ODS level. */
+ down_case = 1;
+ }
+ }
+ }
+
+#else /* defined( DVI$C_ACP_F11V5) && defined( NAML$C_MAXRSS) */
+
+/* No case-preserved names are possible (VAX). Do simple down-case check. */
+
+ down_case = (vms_case_2 <= 0);
+
+#endif /* defined( DVI$C_ACP_F11V5) && defined( NAML$C_MAXRSS) [else] */
+
+ /* If down-casing, convert to lower case. */
+ if (down_case != 0)
+ {
+ strlower( n);
+ }
+ }
+
+ /* Remove simple ODS5 extended file name escape characters. */
+ eat_carets( n);
+
+ if (isdir)
+ {
+ if (strcasecmp( (nn = n+ strlen( n)- DIR_TYPE_VER_LEN), DIR_TYPE_VER))
+ error("directory not version 1");
+ else
+ if (pathput)
+ strcpy( nn, "/");
+ else
+ *n = '\0'; /* directories are discarded with zip -rj */
+ }
+ else if (vmsver == 0)
+ {
+ /* If not keeping version numbers, truncate the name at the ";".
+ (No escaped characters are expected in the version.)
+ */
+ if ((ext_dir_and_name = strrchr( n, ';')) != NULL)
+ *ext_dir_and_name = '\0';
+ }
+ else if (vmsver > 1)
+ {
+ /* Keeping version numbers, but as ".nnn", not ";nnn". */
+ if ((ext_dir_and_name = strrchr( n, ';')) != NULL)
+ *ext_dir_and_name = '.';
+ }
+
+ /* Remove a type-less dot. */
+ /* (Note that currently "name..ver" is not altered.) */
+ if ((ext_dir_and_name = strrchr( n, '.')) != NULL)
+ {
+ if (ext_dir_and_name[ 1] == '\0') /* "name." -> "name" */
+ *ext_dir_and_name = '\0';
+ else if (ext_dir_and_name[ 1] == ';') /* "name.;ver" -> "name;ver" */
+ {
+ char *f = ext_dir_and_name+ 1;
+ while (*ext_dir_and_name++ = *f++);
+ }
+ }
+
+ if (dosify)
+ msname(n);
+
+ /* Returned malloc'ed name */
+ if (pdosflag)
+ *pdosflag = dosflag;
+
+ return n;
+}
+
+
+char *in2ex( char *n)
+/* char *n; internal file name */
+/* Convert the zip file name to an external file name, returning the malloc'ed
+ string or NULL if not enough memory. */
+{
+ char *x; /* external file name */
+ char *t; /* scans name */
+ int i;
+ char chr;
+ char *endp;
+ char *last_slash;
+ char *versionp;
+
+#ifdef NAML$C_MAXRSS
+
+ char buf[ NAML$C_MAXRSS+ 1];
+ unsigned char prop;
+ unsigned char uchr;
+ char *last_dot;
+
+#endif /* def NAML$C_MAXRSS */
+
+ /* Locate the last slash. */
+ last_slash = strrchr( n, '/');
+
+/* If ODS5 is possible, replace escape carets in name. */
+
+#ifdef NAML$C_MAXRSS
+
+ endp = n+ strlen( n);
+
+ /* Locate the version delimiter, if one is expected. */
+ if (vmsver == 0)
+ { /* No version expected. */
+ versionp = endp;
+ }
+ else
+ {
+ if (vmsver > 1)
+ { /* Expect a dot-version, ".nnn". Locate the version ".".
+ Temporarily terminate at this dot to allow the last-dot search
+ below to find the last non-version dot.
+ */
+ versionp = strrchr( n, '.');
+ if (versionp != NULL) /* Can't miss. */
+ {
+ *versionp = '\0';
+ }
+ }
+ else
+ { /* Expect a semi-colon-version, ";nnn". Locate the ";". */
+ versionp = strrchr( n, ';');
+ }
+ if ((versionp == NULL) || (versionp < last_slash))
+ { /* If confused, and the version delimiter was not in the name,
+ then ignore it.
+ */
+ versionp = endp;
+ }
+ }
+
+ /* No escape needed for the last dot, if it's part of the file name.
+ All dots in a directory must be escaped.
+ */
+ last_dot = strrchr( n, '.');
+
+ if ((last_dot != NULL) && (last_slash != NULL) && (last_dot < last_slash))
+ {
+ last_dot = last_slash;
+ }
+
+ /* Replace the version dot if necessary. */
+ if ((vmsver > 1) && (versionp != NULL) && (versionp < endp))
+ {
+ *versionp = '.';
+ }
+
+ /* Add ODS5 escape sequences. Leave "/" and "?" for later.
+ The name here looks (roughly) like: dir1/dir2/a.b
+ */
+ t = n;
+ x = buf;
+ while (uchr = *t++)
+ {
+ /* Characters in the version do not need escaping. */
+ if (t <= versionp)
+ {
+ prop = char_prop[ uchr]& 31;
+ if (prop)
+ {
+ if (prop& 4)
+ { /* Dot. */
+ if (t < last_dot)
+ {
+ /* Dot which must be escaped. */
+ *x++ = '^';
+ }
+ }
+ else if (prop& 8)
+ {
+ /* Character needing hex-hex escape. */
+ *x++ = '^';
+ *x++ = hex_digit[ uchr>> 4];
+ uchr = hex_digit[ uchr& 15];
+ }
+ else
+ {
+ /* Non-dot character which must be escaped (and simple works).
+ "?" gains the caret but remains "?" until later.
+ ("/" remains (unescaped) "/".)
+ */
+ *x++ = '^';
+ if (prop& 2)
+ {
+ /* Escaped space (represented as "^_"). */
+ uchr = '_';
+ }
+ }
+ }
+ }
+ *x++ = uchr;
+ }
+ *x = '\0';
+
+ /* Point "n" to altered name buffer, and re-find the last slash. */
+ n = buf;
+ last_slash = strrchr( n, '/');
+
+#endif /* def NAML$C_MAXRSS */
+
+ if ((t = last_slash) == NULL)
+ {
+ if ((x = malloc(strlen(n) + 1 + DIR_PAD)) == NULL)
+ return NULL;
+ strcpy(x, n);
+ }
+ else
+ {
+ if ((x = malloc(strlen(n) + 3 + DIR_PAD)) == NULL)
+ return NULL;
+
+ /* Begin with "[". */
+ x[ 0] = '[';
+ i = 1;
+ if (*n != '/')
+ {
+ /* Relative path. Add ".". */
+ x[ i++] = '.';
+ }
+ else
+ {
+ /* Absolute path. Skip leading "/". */
+ n++;
+ }
+ strcpy( (x+ i), n);
+
+ /* Place the final ']'. Remember where the name starts. */
+ *(t = x + i + (t - n)) = ']';
+ last_slash = t;
+
+ /* Replace "/" with ".", and "?" with (now escaped) "/", in the
+ directory part of the name.
+ */
+ while (--t > x)
+ {
+ chr = *t;
+ if (chr == '/')
+ {
+ *t = '.';
+ }
+ else if (chr == '?')
+ {
+ *t = '/';
+ }
+ }
+
+ /* Replace "?" with (now escaped) "/", in the non-directory part of
+ the name.
+ */
+ while ((chr = *(++last_slash)) != '\0')
+ {
+ if (chr == '?')
+ {
+ *last_slash = '/';
+ }
+ }
+ }
+
+/* If case preservation is impossible (VAX, say), and down-casing, then
+ up-case. If case preservation is possible and wasn't done, then
+ there's no way to ensure proper restoration of original case, so
+ don't try. This may differ from pre-3.0 behavior.
+*/
+#ifndef NAML$C_MAXRSS
+
+ if (vms_case_2 <= 0)
+ {
+ strupper( x);
+ }
+
+#endif /* ndef NAML$C_MAXRSS */
+
+ return x;
+}
+
+void stamp( char *f, ulg d)
+/* char *f; name of file to change */
+/* ulg d; dos-style time to change it to */
+/* Set last updated and accessed time of file f to the DOS time d. */
+{
+ int tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year;
+ char timbuf[24];
+ static ZCONST char *month[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
+ "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
+ struct VMStimbuf {
+ char *actime; /* VMS revision date, ASCII format */
+ char *modtime; /* VMS creation date, ASCII format */
+ } ascii_times;
+
+ ascii_times.actime = ascii_times.modtime = timbuf;
+
+ /* Convert DOS time to ASCII format for VMSmunch */
+ tm_sec = (int)(d << 1) & 0x3e;
+ tm_min = (int)(d >> 5) & 0x3f;
+ tm_hour = (int)(d >> 11) & 0x1f;
+ tm_mday = (int)(d >> 16) & 0x1f;
+ tm_mon = ((int)(d >> 21) & 0xf) - 1;
+ tm_year = ((int)(d >> 25) & 0x7f) + 1980;
+ sprintf(timbuf, "%02d-%3s-%04d %02d:%02d:%02d.00", tm_mday, month[tm_mon],
+ tm_year, tm_hour, tm_min, tm_sec);
+
+ /* Set updated and accessed times of f */
+ if (VMSmunch(f, SET_TIMES, (char *)&ascii_times) != RMS$_NMF)
+ zipwarn("can't set zipfile time: ", f);
+}
+
+ulg filetime( char *f, ulg *a, zoff_t *n, iztimes *t)
+/* char *f; name of file to get info on */
+/* ulg *a; return value: file attributes */
+/* zoff_t *n; return value: file size */
+/* iztimes *t; return value: access, modific. and creation times */
+/* If file *f does not exist, return 0. Else, return the file's last
+ modified date and time as an MSDOS date and time. The date and
+ time is returned in a long with the date most significant to allow
+ unsigned integer comparison of absolute times. Also, if a is not
+ a NULL pointer, store the file attributes there, with the high two
+ bytes being the Unix attributes, and the low byte being a mapping
+ of that to DOS attributes. If n is not NULL, store the file size
+ there. If t is not NULL, the file's access, modification and creation
+ times are stored there as UNIX time_t values.
+ If f is "-", use standard input as the file. If f is a device, return
+ a file size of -1 */
+{
+ struct stat s; /* results of stat() */
+ /* convert to a malloc string dump FNMAX - 11/8/04 EG */
+ char *name;
+ int len = strlen(f);
+
+ if (f == label) {
+ if (a != NULL)
+ *a = label_mode;
+ if (n != NULL)
+ *n = -2; /* convention for a label name */
+ if (t != NULL)
+ t->atime = t->mtime = t->ctime = label_utim;
+ return label_time;
+ }
+ if ((name = malloc(len + 1)) == NULL) {
+ ZIPERR(ZE_MEM, "filetime");
+ }
+ strcpy(name, f);
+ if (name[len - 1] == '/')
+ name[len - 1] = '\0';
+ /* not all systems allow stat'ing a file with / appended */
+
+ if (strcmp(f, "-") == 0) {
+ if (fstat(fileno(stdin), &s) != 0) {
+ free(name);
+ error("fstat(stdin)");
+ }
+ } else if (LSSTAT(name, &s) != 0) {
+ /* Accept about any file kind including directories
+ * (stored with trailing / with -r option)
+ */
+ free(name);
+ return 0;
+ }
+ free(name);
+
+ if (a != NULL) {
+ *a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE);
+ if ((s.st_mode & S_IFDIR) != 0) {
+ *a |= MSDOS_DIR_ATTR;
+ }
+ }
+ if (n != NULL)
+ *n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1;
+ if (t != NULL) {
+ t->atime = s.st_mtime;
+#ifdef USE_MTIME
+ t->mtime = s.st_mtime; /* Use modification time in VMS */
+#else
+ t->mtime = s.st_ctime; /* Use creation time in VMS */
+#endif
+ t->ctime = s.st_ctime;
+ }
+
+#ifdef USE_MTIME
+ return unix2dostime((time_t *)&s.st_mtime); /* Use modification time in VMS */
+#else
+ return unix2dostime((time_t *)&s.st_ctime); /* Use creation time in VMS */
+#endif
+}
+
+int deletedir( char *d)
+/* char *d; directory to delete */
+
+/* Delete the directory *d if it is empty, do nothing otherwise.
+ Return the result of rmdir(), delete(), or system().
+ For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]).
+ */
+{
+ /* code from Greg Roelofs, who horked it from Mark Edwards (unzip) */
+ int r, len;
+ char *s; /* malloc'd string for system command */
+
+ len = strlen(d);
+ if ((s = malloc(len + 34)) == NULL)
+ return 127;
+
+ system(strcat(strcpy(s, "set prot=(o:rwed) "), d));
+ r = delete(d);
+ free(s);
+ return r;
+}
diff --git a/vms/zip.opt b/vms/zip.opt
new file mode 100644
index 0000000..7a4a872
--- /dev/null
+++ b/vms/zip.opt
@@ -0,0 +1 @@
+Ident = "Zip 3.0"
diff --git a/vms/zip_cli.cld b/vms/zip_cli.cld
new file mode 100644
index 0000000..38fc421
--- /dev/null
+++ b/vms/zip_cli.cld
@@ -0,0 +1,168 @@
+ Module ZIP_CLITABLE
+ Ident "03-001"
+
+Define Verb ZIP
+ Parameter P1, Label=ZIPFILE, Prompt="Zip file"
+ Parameter P2, Label=INFILE, VALUE(list), Prompt="Files to Zip"
+ Qualifier DELETE, NonNegatable
+ Qualifier FRESHEN, NonNegatable
+ Qualifier MOVE, NonNegatable
+ Qualifier UPDATE, NonNegatable
+ Qualifier EXCLUDE, NonNegatable, VALUE(required,list)
+ Qualifier INCLUDE, NonNegatable, VALUE(required,list)
+ Qualifier EXLIST, NonNegatable, VALUE(type=$FILE,required)
+ Qualifier INLIST, NonNegatable, VALUE(type=$FILE,required)
+ Qualifier ADJUST_OFFSETS, NonNegatable
+ Qualifier APPEND, NonNegatable
+ Qualifier BATCH, NonNegatable, VALUE(type=$FILE)
+ Qualifier BEFORE, NonNegatable, VALUE(type=$DATETIME)
+ Qualifier COMMENTS, NonNegatable,
+ VALUE(list,type=COMMENTS_KEYWORDS)
+ Qualifier COMPRESSION, NonNegatable, VALUE(type=COMPRESS_OPTS)
+ Qualifier COPY_ENTRIES, NonNegatable
+ Qualifier DESCRIPTORS, NonNegatable
+ Qualifier DIFFERENCE, NonNegatable
+ Qualifier DIRNAMES, Negatable, Default
+ Qualifier DISPLAY, NonNegatable,
+ VALUE(type=DISPLAY_KEYWORDS, required, list)
+ Qualifier DOT_VERSION, NonNegatable
+ Qualifier ENCRYPT, Negatable, VALUE
+ Qualifier EXTRA_FIELDS, Negatable, VALUE(type=EXTRA_OPTS)
+ Qualifier FILESYNC, NonNegatable
+ Qualifier FIX_ARCHIVE, NonNegatable, VALUE(type=FIX_OPTS)
+ Qualifier FULL_PATH, Negatable, Default
+ Qualifier GROW, NonNegatable
+ Qualifier HELP, NonNegatable, VALUE(type=HELP_OPTS)
+ Qualifier JUNK, NonNegatable
+ Qualifier KEEP_VERSION, Negatable
+ Qualifier LATEST, NonNegatable
+ Qualifier LEVEL, VALUE(type=$NUMBER,required)
+ Qualifier LICENSE, NonNegatable
+ Qualifier LOG_FILE, NonNegatable,
+ VALUE(list, required, type=LOG_OPTS)
+ Qualifier MUST_MATCH, NonNegatable
+ Qualifier OUTPUT, VALUE(required,type=$FILE)
+ Qualifier PATTERN_CASE, NonNegatable, VALUE(type=PATT_CASE_OPTS)
+ Qualifier PAUSE, Negatable
+ Qualifier PKZIP, Negatable
+ Qualifier PRESERVE_CASE, Negatable,
+ VALUE(type=PRES_CASE_OPTS, list)
+ Qualifier QUIET, NonNegatable
+ Qualifier RECURSE, Negatable, VALUE(type=RECURSE_OPTS)
+ Qualifier SHOW, NonNegatable,
+ VALUE(type=SHOW_KEYWORDS, required, list)
+ Qualifier SINCE, NonNegatable, VALUE(type=$DATETIME)
+ Qualifier SPLIT, NonNegatable,
+ VALUE(list, required, type=SPLIT_OPTS)
+ Qualifier STORE_TYPES, NonNegatable, VALUE(required,list)
+ Qualifier SYMLINKS, NonNegatable
+ Qualifier TEMP_PATH, VALUE(required,type=$FILE)
+ Qualifier TEST, NonNegatable, VALUE(type=TEST_OPTS)
+ Qualifier TRANSLATE_EOL, NonNegatable,
+ VALUE(type=EOL_KEYWORDS)
+ Qualifier UNSFX, NonNegatable
+ Qualifier VERBOSE, NonNegatable,
+ VALUE(type=VERBOSE_OPTS, list)
+ Qualifier VMS, NonNegatable, VALUE(type=VMS_OPTS)
+ Qualifier WILDCARD, VALUE(type=WILDCARD_OPTS)
+ Qualifier YYZ_ZIP, NonNegatable, Default
+ Qualifier ZIP64, NonNegatable
+
+ Disallow COPY_ENTRIES and (DELETE or FRESHEN or UPDATE)
+ Disallow DELETE and (COPY_ENTRIES or FRESHEN or UPDATE)
+ Disallow FRESHEN and (COPY_ENTRIES or DELETE or UPDATE)
+ Disallow UPDATE and (COPY_ENTRIES or DELETE or FRESHEN)
+ Disallow DIFFERENCE and (neg OUTPUT)
+ Disallow DIFFERENCE and
+ (FIX_ARCHIVE.NORMAL or FIX_ARCHIVE.FULL or
+ COPY_ENTRIES or DELETE)
+ Disallow APPEND and GROW
+ Disallow FIX_ARCHIVE.NORMAL and FIX_ARCHIVE.FULL
+ Disallow (FIX_ARCHIVE.NORMAL or FIX_ARCHIVE.FULL) and
+ (neg OUTPUT)
+ Disallow TRANSLATE_EOL.LF and TRANSLATE_EOL.CRLF
+ Disallow FULL_PATH and JUNK
+ Disallow RECURSE.PATH and RECURSE.FILENAMES
+ Disallow (neg EXTRA_FIELDS) and
+ (KEEP_EXISTING or EXTRA_FIELDS.NORMAL)
+
+Define Type PATT_CASE_OPTS
+ Keyword BLIND
+ Keyword SENSITIVE, DEFAULT
+
+Define Type COMMENTS_KEYWORDS
+ Keyword ARCHIVE, DEFAULT
+ Keyword FILES
+ Keyword ZIP_FILE
+
+Define Type COMPRESS_OPTS
+ Keyword BZIP2
+ Keyword DEFLATE, DEFAULT
+ Keyword STORE
+
+Define Type DISPLAY_KEYWORDS
+ Keyword BYTES
+ Keyword COUNTS
+ Keyword DOTS, VALUE
+ Keyword GLOBALDOTS
+ Keyword USIZE
+ Keyword VOLUME
+
+Define Type EOL_KEYWORDS
+ Keyword LF, DEFAULT
+ Keyword CRLF
+
+Define Type EXTRA_OPTS
+ Keyword NORMAL, DEFAULT
+ Keyword KEEP_EXISTING
+
+Define Type FIX_OPTS
+ Keyword NORMAL, DEFAULT
+ Keyword FULL
+
+Define Type HELP_OPTS
+ Keyword NORMAL, DEFAULT
+ Keyword EXTENDED
+
+Define Type LOG_OPTS
+ Keyword APPEND, Negatable
+ Keyword INFORMATIONAL, Negatable
+ Keyword FILE, NonNegatable, VALUE(required, type=$FILE)
+
+Define Type PRES_CASE_OPTS
+ Keyword NOODS2
+ Keyword NOODS5
+ Keyword ODS2
+ Keyword ODS5
+
+Define Type RECURSE_OPTS
+ Keyword PATH, DEFAULT
+ Keyword FILENAMES
+
+Define Type SHOW_KEYWORDS
+ Keyword COMMAND
+ Keyword DEBUG
+ Keyword FILES
+ Keyword OPTIONS
+
+Define Type SPLIT_OPTS
+ Keyword BELL, Negatable
+ Keyword PAUSE, Negatable
+ Keyword SIZE, VALUE(required)
+ Keyword VERBOSE, Negatable
+
+Define Type TEST_OPTS
+ Keyword UNZIP, VALUE(required)
+
+Define Type VERBOSE_OPTS
+ Keyword NORMAL, DEFAULT
+ Keyword MORE
+ Keyword DEBUG
+ Keyword COMMAND
+
+Define Type VMS_OPTS
+ Keyword ALL
+
+Define Type WILDCARD_OPTS
+ Keyword NOSPAN
+
diff --git a/vms/zip_cli.help b/vms/zip_cli.help
new file mode 100644
index 0000000..1bb39c2
--- /dev/null
+++ b/vms/zip_cli.help
@@ -0,0 +1,1636 @@
+.!
+.! File: ZIP_CLI.HELP
+.!
+.! Author: Christian Spieler
+.!
+.! Date: 05 Dec 95 (orig. ZIP.RNH, 22 Oct 91)
+.!
+.! Description:
+.!
+.! TPU-processable source file to produce VMS on-line help for
+.! portable Zip. Adapted from ZIP.RNH, originally based on
+.! ZIP.MAN (now MANUAL).
+.!
+.! To build:
+.! $ EDIT /TPU/NOSECTION/NODISPLAY/COMMAND=CVTHELP.TPU ZIP_CLI.HELP
+.! $ RUNOFF /OUT=ZIP_CLI.HLP ZIP_CLI.RNH
+.! $ LIBR /HELP/INSERT libr ZIP_CLI
+.!
+.! Modification history:
+.!
+.! 01-001 Christian Spieler 05-DEC-1995 02:02
+.! Genesis.
+.! 01-002 Christian Spieler 20-JAN-1996 03:09
+.! Modified /LICENSE and /VERBOSE descriptions.
+.! 01-003 Christian Spieler 11-FEB-1996 23:09
+.! Added /[NO]EXTRA_FIELDS description.
+.! 01-004 Christian Spieler 11-MAR-1996 20:08
+.! Removed /ENCRYPT=VERIFY option.
+.! 01-005 Christian Spieler 11-MAY-1996 23:08
+.! Corrected/enhanced info about how to get help on UNIX options.
+.! 01-006 Christian Spieler 21-JUL-1997 22:26
+.! Updated for new options of Zip 2.2.
+.! 01-006 Christian Spieler 14-OCT-1997 22:04
+.! Cleanups for Zip 2.2 release (no version change).
+.! 01-007 Steven Schweda 15-MAY-2007
+.! Zip 3.0.
+.! 01-007 Ed Gordon 15-MAY-2007
+.! Minor updates to Zip 3.0 help.
+.!
+<INIT>
+<MAIN>
+ZIP
+
+Zip is a compression and file packaging utility for several operating
+systems, including UNIX, VMS, MSDOS, OS/2, Windows 9x/NT/XP, Minix,
+Atari, Macintosh, Amiga, and Acorn RISC OS. It is analogous to a
+combination of tar and compress and is compatible with PKZIP (Phil
+Katz's ZIP) for MSDOS systems.
+
+Zip is useful for packaging a set of files for distribution, for
+archiving files, and for saving disk space by temporarily compressing
+unused files or directories. A companion program, UnZip, unpacks Zip
+archives.
+
+For brief help on Zip or UnZip, run the program without specifying any
+parameters on the command line.
+
+This description covers the Zip program which uses a VMS-style CLI
+command line. The VMS CLI Zip program also accepts UNIX-style "-opt"
+options, but a separate Zip program is available which provides only a
+UNIX-style command line, and it has its own documentation. Refer to
+the Zip installation instructions for details.
+
+<FORMAT>
+ZIP [/options] archive inpath, inpath ...
+
+.!
+
+<TOPIC>
+Basic_Usage
+
+<FORMAT>
+ZIP [/options] archive inpath, inpath ...
+
+The default action of Zip is to add or replace entries in "archive" from
+the list of "inpath" file specifications, which can include directories
+and file names with VMS-style wildcards. If /BATCH is specified, Zip
+will read file specifications from a list file or from SYS$INPUT
+(stdin).
+
+With SET PROCESS /PARSE_STYLE = EXTENDED (available on recent non-VAX
+systems), Zip preserves the case of the command line. Otherwise, mixed-
+or upper-case arguments (file names) must be quoted. Examples in this
+document generally do not show this quotation, so VAX and /PARSE_STYLE =
+TRADITIONAL users (that is, troglodytes) will need to add quotation
+where needed when working with these examples.
+
+General
+
+Zip reads one or more files, compresses the data (normally), and stores
+the compressed information into a single Zip archive file, along with
+information about each file (name, path, date and time of last
+modification, protection, and check information to verify file
+integrity). On a VMS system, Zip can also save VMS/RMS file attributes,
+allowing UnZip to restore the files without loss of important file
+attributes. Zip can pack an entire directory structure into a Zip
+archive with a single command.
+
+Compression
+
+Compression ratios of 2:1 to 3:1 are common for text files. Zip has one
+standard compression method ("deflate") and can also store files without
+compression. Zip (and UnZip) may be built with optional support for the
+bzip2 compression method. Then, the user may select bzip2 compression
+instead of the default "deflate" method. Zip automatically chooses
+simple storage over compression for a file, if the specified compression
+method does not actually compress the data in that file.
+
+Compatibility
+
+Zip and UnZip can work with archives produced by PKZIP (supporting most
+PKZIP features up to PKZIP version 4.6), and PKZIP and PKUNZIP can work
+with archives produced by Zip (with some exceptions, notably streamed
+archives, but recent changes in the .ZIP file standard may facilitate
+better compatibility). Zip version 3.0 is compatible with PKZIP 2.04
+and also supports the Zip64 extensions of PKZIP 4.5 which allows
+archives as well as files to exceed the previous 2 GB limit (4 GB in
+some cases). Zip also supports bzip2 compression if the bzip2 library
+is included when Zip is built. Note that PKUNZIP 1.10 cannot extract
+files produced by PKZIP 2.04 or Zip 3.0. You must use PKUNZIP 2.04g or
+UnZip 5.0p1 (or later versions) to extract them.
+
+Large Archives and Zip64
+
+Where the operating system and C run-time support allow, Zip 3.0 and
+UnZip 6.0 (and later versions) support large files (input and archive),
+using the Zip64 extensions to the original .ZIP file format. On VMS,
+this genarally means non-VAX systems with VMS V7.2 or later (perhaps
+requiring a C RTL ECO before VMS V7.3-2).
+
+Zip automatically uses the Zip64 extensions when a file 4 GB or larger
+is added to an archive, an archive containing a Zip64 entry is updated
+(if the resulting archive still needs Zip64), the size of the archive
+will exceed 4 GB, or when the number of entries in the archive will
+exceed about 64K. Zip64 is also used for archives streamed to a
+non-seekable output device. You must use a 4.5 compatible UnZip to
+extract files using the Zip64 extensions such as UnZip 6.0 or later.
+
+In addition, streamed archives, entries encrypted with standard
+encryption, or split archives created with the pause option may not be
+compatible with PKZIP as data descriptors are used, and PKZIP at the
+time of this writing does not support data descriptors (but recent
+changes in the PKWare published .ZIP file standard now include some
+support for the data descriptor format Zip uses).
+
+<TOPIC>
+More_Usage
+
+Here is a very simple example of Zip use:
+
+<LITERAL>
+| zip stuff.zip *.*
+<LARETIL>
+
+This will create the Zip archive "stuff.zip" (assuming it does not
+already exist) and put all the (non-directory) files (";0") from the
+current default directory into "stuff.zip" in a compressed form. The
+archive is opened using a default file specification of
+"SYS$DISK:[].zip", so specifying "stuff" as the archive name would also
+create (or use an existing) "stuff.zip", but specifying "stuff.other"
+would give you that name. In general, Zip doesn't care about the type
+in the file specification, but for split archives (archives split over
+multiple files), the user should normally specify a type-less name,
+because Zip will normally generate sequentially numbered types ".z01",
+".z02", and so on for the early splits, and then the required ".zip" for
+the last split. These file types are required by the Zip standard for
+split archives.
+
+Standard VMS wildcard expansion ($SEARCH) is used to interpret the
+"inpath" file and directory specifications, like the "*.*" in this
+example.
+
+On VMS, the most natural way to archive an entire directory tree is to
+use a directory-depth wildcard ("[...]"). For example:
+
+<LITERAL>
+| zip foo [...]*.*
+<LARETIL>
+
+This will create the file "foo.zip" containing all the files (";0") and
+directories in and below the current default directory. A more
+UNIX-like way to do this would be to use the /RECURSE option:
+
+<LITERAL>
+| zip /recurse foo *.*
+<LARETIL>
+
+Zip avoids including its own output files when selecting files to
+include in the archive, so it should be safe, as in this case, to create
+the archive in the same drectory as the input files.
+
+One or more specific files, directories, or subdirectories may also be
+specified:
+
+<LITERAL>
+| zip foo.zip readme.txt, [www...]*.*, [.ftp...]*.*, -
+| [.src]*.h, [.src]*.c
+<LARETIL>
+
+For security reasons, paths in Zip archives are always stored as
+relative paths, so some care is needed when creating an archive so that
+it will create the intended directory structure when UnZip is used to
+unpack it.
+
+To use /RECURSE with a specific directory, the name of the directory
+file itself must be specified:
+
+<LITERAL>
+| zip /recurse foo.zip [000000]www.dir, ftp.dir
+<LARETIL>
+
+You may want to make an archive that contains the files in [.foo], but
+not record the directory name, "foo". You can use the /JUNK (junk path)
+option to leave off the path:
+
+<LITERAL>
+| zip /junk foo [.foo]*.*
+<LARETIL>
+
+If you are short on disk space, you might not have enough room to hold
+both the original directory and the corresponding compressed Zip
+archive. In this case, you can create the archive in steps, and use the
+-m option. For example, if [.foo] contains the subdirectories [.tom],
+[.dick], and [.harry], you could:
+
+<LITERAL>
+| zip /move foo [.foo.tom...]*.*
+| zip /move foo [.foo.dick...]*.*
+| zip /move foo [.foo.harry...]*.*
+<LARETIL>
+
+The first command would create foo.zip, and the next two would add to
+it. The /MOVE option will cause Zip to delete all files added to the
+archive after making or updating foo.zip. No deletions will be done
+until the Zip operation has completed with no errors. This option is
+obviously dangerous and should be used with care, but it does reduce the
+need for free disk space. When /MOVE is used, the /TEST option is
+recommended and will test the resulting archive before deleting the
+input files.
+
+If a file specification list is too long to fit conveniently on the Zip
+command line, the /BATCH option can be used to cause Zip to read a list
+of file specifications from a file or from SYS$INPUT (stdin). If a DCL
+command procedure is used, the names can be specified in the procedure:
+
+<LITERAL>
+| $ zip foo /batch
+| $ deck
+| file_spec_1
+| file_spec_2
+| file_spec_3
+| $ eod
+<LARETIL>
+
+The file specifications can also be put into a separate file, and fed
+into Zip by specifying that file as "/BATCH = list_file", or by
+explicitly defining SYS$INPUT, or by using PIPE. For example, with the
+list in foo.zfl:
+<LITERAL>
+| zip foo /batch = foo.zfl
+<LARETIL>
+or:
+<LITERAL>
+| define /user_mode sys$input foo.zfl
+| zip foo /batch
+<LARETIL>
+or:
+<LITERAL>
+| pipe type foo.zfl | zip foo /batch
+<LARETIL>
+
+If Zip is not able to read a file, it issues a warning but continues.
+See the /MUST_MATCH option for more on how Zip handles patterns that are
+not matched and files that are not readable. If some files were
+skipped, a warning is issued at the end of the Zip operation noting how
+many files were read and how many skipped.
+<TOPIC>
+Environment
+
+A user can specify default command-line options and arguments by
+defining an "environment variable" (that is, a logical name or DCL
+symbol), "ZIP_OPTS" or "ZIPOPT", to specify them. If both "ZIP_OPTS"
+and "ZIPOPT" are specified, the definition of "ZIPOPT" prevails.
+
+UNIX-style command-line options are required in these variables, even
+for the VMS CLI Zip program. For details, see the help topic
+UNIX_Options, or the separate Zip help for the UNIX-style command line.
+
+The C RTL function getenv() is used to sense these variables, so its
+behavior determines what happens if both a logical name and a symbol are
+defined. As of VMS V7.3, a logical name supercedes a symbol.
+
+The "zip /VERBOSE" report should show the perceived settings of these
+variables.
+
+For example, the following will cause Zip to skip directories, include
+VMS portable attribute information, and perform all operations at
+quiet-level 1 by default:
+
+<LITERAL>
+| $ define ZIP_OPTS "-qDV"
+<LARETIL>
+
+Note that the quotation marks here are required to preserve lowercase
+options (opposite of the command-line behavior).
+
+<TOPIC>
+Exit_Status
+
+On VMS, Zip's UNIX-style exit values are mapped into VMS-style status
+codes with facility code 1955 = %x7A3, and with the inhibit-message
+(%x10000000) and facility-specific (%x00008000) bits set:
+
+<LITERAL>
+| %x17A38001 normal exit
+| %x17A38000+ 16* Zip_error_code warnings
+| %x17A38002+ 16* Zip_error_code normal errors
+| %x17A38004+ 16* Zip_error_code fatal errors
+<LARETIL>
+
+Note that multiplying the UNIX-style Zip error code by 16 places it
+conveniently in the hexadecimal representation of the VMS exit code,
+"__" in %x17A38__s, where "s" is the severity code. For example, a
+truncated archive might cause Zip error code 2, which would be
+transformed into the VMS exit status %x17A38024.
+
+The Zip VMS exit codes include severity values which approximate those
+defined by PKWARE, as shown in the following table:
+
+<LITERAL0>
+| VMS Zip err
+|severity code Error description
+|---------+---------+----------------------------------------------
+|Success 0 (OK) Normal; no errors or warnings detected.
+|Fatal 2 (EOF) Unexpected end of archive.
+|Error 3 (FORM) A generic error in the archive format
+| was detected. Processing may have completed
+| successfully anyway; some broken archives
+| created by other archivers have simple work-
+| arounds.
+|Fatal 4 (MEM) Zip was unable to allocate memory for
+| one or more buffers during program initializ-
+| ation.
+|Fatal 5 (LOGIC) A severe error in the archive format
+| was detected. Processing probably failed
+| immediately.
+|Error 6 (BIG) Entry too large to split, read, or
+| write.
+|Error 7 (NOTE) Invalid comment format.
+|Fatal 8 (TEST) Zip -T failed or out of memory.
+|Error 9 (ABORT) The user aborted zip prematurely
+| with control-C (or equivalent).
+|Fatal 10 (TEMP) Zip encountered an error while using
+| a tempfile.
+|Fatal 11 (READ) Read or seek error.
+|Warning 12 (NONE) Zip has nothing to do.
+|Error 13 (NAME) Missing or empty zip file.
+|Fatal 14 (WRITE) Error writing to a file.
+|Fatal 15 (CREAT) Zip was unable to create a file to
+| write to.
+|Error 16 (PARMS) Bad command line parameters.
+|Error 18 (OPEN) Zip could not open a specified file
+| to read.
+|Fatal 19 (COMPERR) Zip was built with options not
+| supported on this system.
+|Fatal 20 (ZIP64) Attempt to read unsupported Zip64
+| archive.
+<0LARETIL>
+
+<TOPIC>
+File_Names
+
+Zip deals with file names in the system file system and with file names
+in Zip archives. File names in a Zip archive are stored in a UNIX-like
+path-name format. For example, a VMS file specification like this:
+
+<LITERAL>
+[.zip30.vms]descrip.mms
+<LARETIL>
+
+could appear in a Zip archive as:
+
+<LITERAL>
+zip30/vms/descrip.mms
+<LARETIL>
+
+For security reasons, paths in Zip archives are always stored as
+relative paths, so an absolute VMS directory specification will be
+transformed to a relative path in the archive (that is, no leading "/").
+For example, the following absolute directory specification would give
+the same archive path as the previous (relative) example:
+
+<LITERAL>
+[zip30.vms]descrip.mms
+<LARETIL>
+
+Also, device names are dropped, so the following file specification
+would also give the same archive path:
+
+<LITERAL>
+sys$sysdevice:[zip30.vms]descrip.mms
+<LARETIL>
+
+If an archive is intended for use with PKUNZIP under MSDOS, then the
+/PKZIP option should be used to attempt to adjust the names and paths to
+conform to MSDOS character-set and length limitations, to store only the
+MSDOS file attributes (just the owner:write attribute from VMS), and to
+mark the entry as made under MSDOS (even though it wasn't).
+
+Note that file specifications in the file system must be specified using
+VMS notation, but file names in an archive must be specified using the
+UNIX-like notation used in the archive. For example, where a BACKUP
+command might look like this:
+
+<LITERAL>
+$ back [.zip30...]*.* /excl = [...vms]*.c stuff.bck /save
+<LARETIL>
+
+a corresponding Zip command might look like this:
+
+<LITERAL>
+$ zip /exclude = "*/vms/*.c" stuff.zip [.zip30...]*.*
+<LARETIL>
+
+because the files to be added to the Zip archive are specified using VMS
+file specifications, but the /EXCLUDE option excludes names based
+on their archive path/file names. Options dealing with archive names
+include /COPY_ENTRIES, /DELETE, /EXCLUDE, /INCLUDE, and
+/RECURSE=FILENAMES.
+
+Note that a UNIX-like path specification must be quoted, or else the
+slashes ("/") will confuse the command-line interpreter, causing errors
+like "%CLI-W-IVQUAL, unrecognized qualifier - check validity, spelling,
+and placement".
+
+Note: By default, on VMS, archive name pattern matching (/COPY_ENTRIES,
+/DELETE, /EXCLUDE, /INCLUDE, and /RECURSE=FILENAMES) is case sensitive,
+even when the file system is not case sensitive (or even case
+preserving). This allows accurate matching of mixed-case names in an
+archive which may have been created on a system with a case sensitive
+file system, but it can involve extra effort on VMS, where it may be
+necessary to use unnatural case names (or the same names in multiple
+cases, like "*.obj *.OBJ") for this kind of pattern matching to give the
+desired behavior. If completely case-blind pattern matching behavior is
+desired, specify the /PATTERN_CASE=BLIND option.
+<TOPIC>
+Modes_of_Operation
+
+Zip supports two distinct types of command modes, external and
+internal. The external modes (update, grow, and freshen) read files
+from the file system (as well as from an existing archive) while the
+internal modes (delete and copy) operate exclusively on entries in an
+existing archive.
+
+<LITERAL>
+ /UPDATE
+<LARETIL>
+
+Update existing entries and add new files. If the archive does not
+exist, create it. This is the default mode, so /UPDATE is optional.
+
+<LITERAL>
+ /GROW
+<LARETIL>
+
+Grow (append to) the specified Zip archive, instead of creating a new
+one. If this operation fails, Zip attempts to restore the archive to
+its original state. If the restoration fails, the archive might become
+corrupted. This option is ignored when there's no existing archive or
+when at least one archive member must be updated or deleted.
+
+<LITERAL>
+ /FRESHEN
+<LARETIL>
+
+Update existing entries in an existing archive. Does not add new files
+to the archive.
+
+<LITERAL>
+ /DELETE
+<LARETIL>
+
+Delete entries from an existing archive.
+
+<LITERAL>
+ /COPY_ENTRIES
+<LARETIL>
+
+Select entries in an existing archive and copy them to a new archive.
+Copy mode is like update mode, but entries in the existing archive are
+selected by command line patterns rather than files from the file system
+and it uses the /OUTPUT option to write the resulting archive to a new
+file rather than updating the existing archive, leaving the original
+archive unchanged.
+
+<LITERAL>
+ /DIFFERENCE
+<LARETIL>
+
+Create an incremental backup-style archive, where the resulting archive
+will contain all new and changed files since the original archive was
+created. For this to work, the input file list and current directory
+must be the same as during the original Zip operation.
+
+For example, if the existing archive was created using
+
+<LITERAL>
+zip foo_full.zip [.foo...]*.*
+<LARETIL>
+
+from just above the foo directory, then the command (also from just
+above the foo directory):
+
+<LITERAL>
+zip /difference /output = foo_incr.zip foo_full.zip [.foo...]*.*
+<LARETIL>
+
+creates the archive foo_incr.zip with just the files not in foo_full.zip
+and the files where the size or date-time of the files does not match
+that in foo_full.zip. Note that in the "ZIP /DIFFERENCE" operation, the
+original full archive is specified as the input archive, and the /OUTPUT
+option is used to specify the new (incremental) output archive.
+
+<LITERAL>
+ /FILESYNC
+<LARETIL>
+
+Delete entries in the archive that do not match files on the OS.
+Normally files already in an archive that are not updated remain
+in the archive unchanged. The /FILESYNC option deletes files in
+the archive that are not matched during the directory scan,
+resulting in the archive being updated having the same contents
+as a new archive would. If much of the archive will remain
+unchanged, this can be faster than creating a new archive as
+copying entries is faster than compressing and adding new files.
+
+Normally, when updating an archive using relative file specifications
+("[]", "[.xxx]", and so on), it helps to have the same default directory
+as when the archive was created, but this is not a strict requirement.
+
+<TOPIC>
+Self_Extracting_Archives
+
+A self-extracting archive (SFX) comprises a normal Zip archive appended
+to a special UnZip program (such as UNZIPSFX_CLI.EXE) for the intended
+target system.
+
+The UnZip distribution includes a VMS command procedure,
+[,vms]makesfx.com, which can be used directly or adapted to create an
+SFX archive from a normal Zip archive.
+
+The .ZIP file format includes offsets to data structures in the archive,
+and these offsets are measured from the start of the archive file.
+Appending an archive to an UnZip SFX executable effectively moves the
+start of the archive file. That makes the original offsets wrong, and
+that will cause the UnZip SFX program to emit warning messages when it
+tries to unpack the archive. Zip /ADJUST_OFFSETS can be used to adjust
+these offsets in a self-extracting archive. For example, to adjust the
+offsets in foo.sfx_exe:
+
+<LITERAL>
+| zip /adjust_offsets foo.sfx_exe
+<LARETIL>
+
+Similarly, the UnZip SFX program can be removed from a self-extracting
+archive (and the offsets in the archive restored) using the /UNSFX
+option. For example:
+
+<LITERAL>
+| zip /unsfx foo.sfx_exe
+<LARETIL>
+
+Note that a self-extracting archive contains a normal Zip archive, and a
+normal UnZip program can be used to expand it in the normal way. You
+may get a warning about extra bytes at the beginning of the archive (the
+UnZip SFX program), but UnZip should work properly after that. This
+allows data in a self-extracting archive to be accessed on any system,
+not just the target system where its embedded UnZip SFX program runs.
+
+<TOPIC>
+Split_Archives
+
+Beginning with version 3.0, Zip supports split archives. A split
+archive is one which is divided into multiple files, usually to allow it
+to be stored on multiple storage media (floppy diskettes, CD-ROMs, or
+the like) when a single medium would be too small to contain the whole
+archive. (Note that split archives are not just unitary archives split
+into pieces, as the .ZIP file format includes offsets to data structures
+in the archive, and for a split archive these are based on the start of
+each split, not on the start of the whole archive. Concatenating the
+pieces will invalidate these offsets, but UnZip can usually deal with
+it. Zip will usually refuse to process such a spliced archive unless
+the /FIX = FULL option is used to fix the offsets.)
+
+For a split archive with, say, 20 split files, the files are typically
+named ARCHIVE.z01, ARCHIVE.z02, ..., ARCHIVE.z19, ARCHIVE.zip, where
+"ARCHIVE" is the archive name specified by the user on the Zip command
+line. Note that the last split file is the ".zip" file. In contrast,
+"spanned" archives are the original multi-disk archive generally
+requiring floppy disks and using volume labels to store disk numbers.
+Zip supports split archives but not spanned archives, though a procedure
+exists for converting split archives of the right size to spanned
+archives. The reverse is also true, where each file of a spanned
+archive can be copied in order to files with the above names to create a
+split archive.
+
+<QUALIFIERS>
+<QUALIFIER>
+/ADJUST_OFFSETS
+
+/ADJUST_OFFSETS
+
+Adjust internal offsets of the Zip archive members after some data
+(e.g. a SFX executable stub) has been prepended to the archive file.
+<QUALIFIER>
+/APPEND
+
+/APPEND
+/GROW
+
+Grow (append to) the specified Zip archive, instead of creating a new
+one. If this operation fails, Zip attempts to restore the archive to
+its original state. If the restoration fails, the archive might become
+corrupted. This option is ignored when there's no existing archive or
+when at least one archive member must be updated or deleted.
+
+See also /DELETE /DIFFERENCE, /FRESHEN, /UPDATE.
+<QUALIFIER>
+/BATCH
+
+/BATCH[=list_file]
+
+Read input file specifications (inpaths) from "list_file" (one per
+line). The list_file defaults to SYS$INPUT.
+<QUALIFIER>
+/BEFORE
+
+/BEFORE=VMS_date_time
+
+Restricts the files by date-time when adding, updating, or freshening an
+archive. Only files with modification date-times earlier than the
+specified date-time are accepted.
+
+See also /SINCE.
+<QUALIFIER>
+/COMMENTS
+
+/COMMENTS[=KEYWORD[,KEYWORD]]
+
+Add comments to the Zip archive.
+
+<LITERAL>
+| ARCHIVE Add/replace the multi-line archive comment. (default)
+| FILES Add file comment to each updated/added archive member.
+<LARETIL>
+
+The Zip program prompts for each comment to be added, which makes sense
+only if Zip is run interactively.
+
+The one-line file (archive member) comments are terminated by typing
+<Return>. To skip a file comment, just type <Return> without entering
+any further characters.
+
+The Zip archive comment may be multi-line. The comment is ended by a
+line containing just a period, or by an end-of-file character (CTRL/Z).
+<QUALIFIER>
+/COMPRESSION
+
+/COMPRESSION = {BZIP2|DEFLATE|STORE}
+
+Specify the compression method to be used when adding or updating files
+in an archive. STORE disables compression (like /LEVEL = 0). Default:
+/COMPRESSION = DEFLATE.
+
+Zip can archive files with or without compression. The standard
+compression method ("deflate") is compatible with all UnZip versions
+(except really old ones that only understand the "store" method).
+Current Zip and UnZip versions may be built with optional support for
+the bzip2 compression method. (The bzip2 method can compress better,
+especially when compressing highly redundant files, but uses more CPU
+time, and requires an UnZip which includes the optional bzip2 support.
+See the installation instructions for details on adding bzip2
+compression support at build time.)
+<QUALIFIER>
+/COPY_ENTRIES
+
+/COPY_ENTRIES
+
+Select entries in an existing archive and copy them to a new archive.
+Copy mode is like update mode, but entries in the existing archive are
+selected by command line patterns rather than files from the file system
+and it uses the /OUTPUT option to write the resulting archive to a new
+file rather than updating the existing archive, leaving the original
+archive unchanged.
+<QUALIFIER>
+/DELETE
+
+/DELETE
+
+Delete entries from archive.
+
+See also /DIFFERENCE, /FRESHEN, /GROW, /UPDATE.
+<QUALIFIER>
+/DIFFERENCE
+
+/DIFFERENCE
+
+Create an incremental backup-style archive, where the resulting archive
+will contain all new and changed files since the original archive was
+created. For this to work, the input file list and current directory
+must be the same as during the original Zip operation.
+
+See also /DELETE, /FRESHEN, /GROW, /UPDATE.
+<QUALIFIER>
+/DIRNAMES
+
+/DIRNAMES (default)
+/NODIRNAMES
+
+Store directory entries in the archive.
+<QUALIFIER>
+/DISPLAY
+
+/DISPLAY=(KEYWORD[,KEYWORD[...]])
+
+Enable display of progress messages.
+<LITERAL>
+| BYTES Running count of bytes processed and bytes to go.
+| COUNTS Running count of entries done and entries to go.
+| DOTS = size Dots every <size> MB while processing files.
+| (0: no dots.)
+| GLOBALDOTS Progress dots reflect the whole archive instead of each
+| file.
+| USIZE Uncompressed size of each entry.
+| VOLUME Display the volume (disk) number each entry is being
+| written to.
+<LARETIL>
+
+The default is a dot every 10 MB of input file processed. The /VERBOSE
+option also displays dots and used to at a higher rate than this (at the
+same rate as in previous versions of Zip) but this rate has been changed
+to the new 10 MB default, and is also controlled by /DISPLAY=DOTS=size.
+<QUALIFIER>
+/DOT_VERSION
+
+/DOT_VERSION
+
+Directs Zip to retain VMS file version numbers on names in an archive,
+but as ".nnn" instead of ";nnn". By default, for compatibility
+with non-VMS systems, Zip strips VMS file version numbers from the names
+stored in an archive. Thus, without /DOT_VERSION or /KEEP_VERSION, a
+version number wildcard (";*") can cause errors when multiple versions
+of a single file are treated as multiple files with the same name.
+
+See also /KEEP_VERSION.
+<QUALIFIER>
+/ENCRYPT
+
+/ENCRYPT[="password"]
+
+Encrypt new or updated archive entries using a password which is
+supplied by the user interactively on the terminal in response to a
+prompt. (The password will not be echoed.) If SYS$COMMAND is not a
+terminal, Zip will exit with an error. The password is verified before
+being accepted.
+
+You may specify the password on the command line, although we do not
+recommend it because THIS IS INSECURE. Remember to enclose the password
+string with quotation marks ("pass word"), to prevent automatic
+conversion to upper case or misinterpretation of punctuation characters
+by DCL.
+
+Because standard Zip encryption is weak, where security is truly
+important, use a strong encryption program, such as Pretty Good Privacy
+(PGP) or GNU Privacy Guard (GnuPG), on an archive instead of standard
+Zip encryption. A stronger encryption method, such as AES, is planned
+for Zip 3.1.
+<QUALIFIER>
+/EXCLUDE
+
+/EXCLUDE=(file[,...])
+
+A comma-separated list of files to exclude when deleting, updating, or
+adding files in the archive. If multiple files are specified, the list
+should be enclosed in parentheses.
+<QUALIFIER>
+/EXLIST
+
+/EXLIST=list_file
+
+The files matching the filename patterns listed in "list_file" are
+excluded when deleting, updating or adding files in the archive.
+The "list_file" is a normal text file with one filename pattern entry per
+line. The name pattern entries are recognized exactly as found in
+"list_file", including leading, embedded, and trailing whitespace or most
+control characters (with exception of LineFeed and probably CarriageReturn).
+<QUALIFIER>
+/EXTRA_FIELDS
+
+/EXTRA_FIELDS (default)
+/NOEXTRA_FIELDS
+
+Allows (or suppresses) the saving of any optional extra fields in the
+archive. (/NOEXTRA_FIELDS conflicts with /VMS[=ALL].)
+
+The .ZIP file format allows some extra data to be stored with a file in
+the archive. For example, where local time zone information is
+available, Zip can store UTC date-time data for files. (Look for
+USE_EF_UT_TIME in a "zip -v" report.) On VMS, with /VMS[=ALL], Zip will
+also store VMS-specific file attributes. These data are packaged as
+"extra fields" in the archive. Some extra fields are specific to a
+particular operating system (like VMS file attributes). Large files
+(bigger than 4GB) on any OS require an extra field to hold their 64-bit
+size data. Depending on the capabilities of the UnZip program used to
+expand the archive, these extra fields may be used or ignored when files
+are extracted from the archive.
+
+Some extra fields, like UTC date-times or VMS file attributes, are
+optional. Others, like the Zip64 extra field which holds 64-bit sizes
+for a large file, are required.
+<QUALIFIER>
+/FILESYNC
+
+/FILESYNC
+
+Delete entries in the archive that do not match files on the OS.
+Normally when an archive is updated, new files are added and changed
+files are updated but files that no longer exist on the OS are not
+deleted from the archive. This option enables deleting of entries that
+are not matched on the OS. Enabling this option should create archives
+that are the same as new archives, but since existing entries are copied
+instead of compressed, updating an existing archive with /FILESYNC can
+be much faster than creating a new archive. If few files are being
+copied from the old archive, it may be faster to create a new archive
+instead.
+
+This option deletes files from the archive. If you need to preserve the
+original archive, make a copy of the archive first, or use the /OUTPUT
+option to output the new archive to a new file. Even though it's
+slower, creating a new archive with a new archive name is safer, avoids
+mismatches between archive and OS paths, and is preferred.
+<QUALIFIER>
+/FIX_ARCHIVE
+
+/FIX=_ARCHIVE={NORMAL|FULL}
+
+The /FIX_ARCHIVE=NORMAL option (NORMAL is the default) can be used if
+some portions of the archive are missing, but it requires a reasonably
+intact central directory. The input archive is scanned as usual, but
+zip will ignore some problems. The resulting archive should be valid,
+but any inconsistent entries will be left out.
+
+If the archive is too damaged or the end (where the central directory is
+situated) has been truncated, you must use /FIX_ARCHIVE=FULL. This is
+a change from zip 2.32, where the /FIX=NORMAL option was able to read a
+truncated archive. The /FIX=NORMAL option now more reliably fixes
+archives with minor damage, and the /FIX=FULL option is needed to fix
+some archives where /FIX=NORMAL was sufficient before.
+
+With /FIX=FULL, the archive is scanned from the beginning and Zip scans
+for special signatures to identify the limits between the archive
+members. The /FIX=NORMAL option is more reliable if the archive is not
+too much damaged, so try this option first.
+
+Neither option will recover archives that have been incorrectly
+transferred, such as by FTP in ASCII mode instead of binary. After the
+repair, the /TEST (-t) option of UnZip may show that some files have a
+bad CRC. Such files cannot be recovered; you can remove them from the
+archive using the /DELETE option of Zip.
+
+Because of the uncertainty of the "fixing" process, it's required
+to specify an output archive, rather than risking further damage to the
+original damaged archive. For example, to fix the damaged archive
+foo.zip:
+
+<LITERAL>
+zip /fix_archive /output=foo_fix foo
+<LARETIL>
+
+tries to read the entries normally, copying good entries to the new
+archive foo_fix.zip. If this doesn't work, as when the archive is
+truncated, or if some entries are missed because of bad central
+directory entries, try /FIX_ARCHIVE=FULL:
+
+<LITERAL>
+zip /fix_archive=full /output=foo_fixfix foo
+<LARETIL>
+
+and compare the resulting archive to the archive created using
+/FIX=NORMAL. The /FIX=FULL option may create an inconsistent archive.
+Depending on what is damaged, you can then use the /FIX=NORMAL option to
+fix that archive.
+
+A split archive with missing split files can be fixed using /FIX=NORMAL
+if you have the last split of the archive (the ".zip" file). If this
+file is missing, you must use /FIX=FULL to fix the archive, which will
+prompt you for the splits you have.
+
+Currently, the fix options can't recover an entry which has a bad
+checksum or is otherwise damaged.
+<QUALIFIER>
+/FRESHEN
+
+/FRESHEN
+
+Update existing entries in an existing archive. Does not add new files
+to the archive.
+
+See also /DELETE, /DIFFERENCE, /GROW, /UPDATE.
+<QUALIFIER>
+/FULL_PATH
+
+/FULL_PATH (default)
+/NOFULL_PATH
+
+Directs Zip to store the directory part of the file names (relative to
+the current working directory) in the Zip archive. With /NOFULL_PATH,
+Zip stores only the file names, discarding any directory information.
+<QUALIFIER>
+/GROW
+
+/GROW
+/APPEND
+
+Grow (append to) the specified Zip archive, instead of creating a new
+one. If this operation fails, Zip attempts to restore the archive to
+its original state. If the restoration fails, the archive might become
+corrupted. This option is ignored when there's no existing archive or
+when at least one archive member must be updated or deleted.
+
+See also /DELETE, /DIFFERENCE, /FRESHEN, /UPDATE.
+<QUALIFIER>
+/HELP
+
+/HELP[=EXTENDED]
+
+Display Zip's help screen, including the version message. With
+/HELP=EXTENDED, more detailed (longer) help information is shown.
+<QUALIFIER>
+/INCLUDE
+
+/INCLUDE=(file[,...])
+
+A comma-separated list of files to include when deleting, updating, or
+adding files in the archive. If multiple files are specified, the list
+should be enclosed in parentheses.
+<QUALIFIER>
+/INLIST
+
+/INLIST=list_file
+
+The files matching the filename patterns listed in "list_file" are
+included when deleting, updating, or adding files in the archive.
+The "list_file" is a normal text file with one filename pattern entry per
+line. The name pattern entries are recognized exactly as found in
+"list_file", including leading, embedded, and trailing whitespace or most
+control characters (with exception of LineFeed and probably CarriageReturn).
+<QUALIFIER>
+/JUNK
+
+/JUNK
+/NOJUNK (default)
+
+Junk (discard) the directory part of the file names for added entries
+(do not not save the directory structure). The /JUNK qualifier is an
+alias for /NOFULL_PATH.
+<QUALIFIER>
+/KEEP_VERSION
+
+/KEEP_VERSION
+/NOKEEP_VERSION (default)
+
+Directs Zip to retain VMS file version numbers on names in an archive.
+By default, for compatibility with non-VMS systems, Zip strips VMS
+file version numbers from the names stored in an archive. Thus, without
+/DOT_VERSION or /KEEP_VERSION, a version number wildcard (";*") can
+cause errors when multiple versions of a single file are treated as
+multiple files with the same name.
+
+See also /DOT_VERSION.
+<QUALIFIER>
+/LATEST
+
+/LATEST
+
+The archive's creation and modification time is set to the latest
+modification time of all archive members.
+<QUALIFIER>
+/LEVEL
+
+/LEVEL=number
+
+Specifies the compression level:
+<LITERAL>
+| 0 Store
+| 1 Fastest compression (Defl:F)
+| ...
+| 9 Best compression (Defl:X)
+<LARETIL>
+
+The default level is 6.
+<QUALIFIER>
+/LICENSE
+
+/LICENSE
+
+Displays the Zip license.
+<QUALIFIER>
+/LOG_FILE
+
+/LOG_FILE=(FILE=log_file [, APPEND] [, INFORMATIONAL])
+
+Zip normally sends messages to the user's terminal, but these may be
+also directed to a log file.
+
+<LITERAL>
+ FILE=log_file
+<LARETIL>
+
+Open a logfile at the given path. By default, a new version will be
+created.
+
+<LITERAL>
+ APPEND
+<LARETIL>
+
+Append to an existing log file. Default is to create a new version.
+
+<LITERAL>
+ INFORMATIONAL
+<LARETIL>
+
+Only warnings and errors are written to the log unless the INFORMATIONAL
+option is also specified, then all information messages are also written
+to the log.
+<QUALIFIER>
+/MOVE
+
+/MOVE
+
+Move the specified files into the Zip archive. That is, Zip will delete
+any files which are successfully added to or updated in the archive. No
+deletions will be done until the Zip operation has completed with no
+errors. This option is obviously dangerous and should be used with
+care, but it does reduce the need for free disk space. It's recommended
+that /TEST also be used to test the archive before the input files are
+deleted.
+<QUALIFIER>
+/MUST_MATCH
+
+/MUST_MATCH
+
+All input patterns must match at least one file and all input files
+found must be readable. Normally when an input pattern does not match
+a file the "name not matched" warning is issued and when an input
+file has been found but later is missing or not readable a "missing or
+not readable" warning is issued. In either case Zip continues
+creating the archive, with missing or unreadable new files being skipped
+and files already in the archive remaining unchanged. After the
+archive is created, if any files were not readable zip returns the OPEN
+error code (18 on most systems) instead of the normal success return (0
+on most systems). With /MUST_MATCH, Zip exits as soon as an input
+pattern is not matched (whenever the "name not matched" warning would be
+issued) or when an input file is not readable. In either case Zip exits
+with an OPEN error and no archive is created.
+
+This option is useful when a known list of files is to be zipped so any
+missing or unreadable files should result in an error. It may be less
+useful when used with wildcards, but Zip will still exit with an error
+if any input pattern doesn't match at least one file or if any
+matched files are unreadable. If you want to create the archive anyway
+and only need to know if files were skipped, then don't use /MUST_MATCH
+and just check the exit status. Also, a log file (see /LOG_FILE) could
+be useful.
+<QUALIFIER>
+/PATTERN_CASE
+
+/PATTERN_CASE={BLIND|SENSITIVE}
+
+<LITERAL>
+| BLIND Use case-blind pattern matching for archive entry names.
+| SENSITIVE Use case-sensitive pattern matching for archive entry
+| names. (Default.)
+<LARETIL>
+
+By default, on VMS, archive name pattern matching (/COPY_ENTRIES,
+/DELETE, /EXCLUDE, /INCLUDE, and /RECURSE=FILENAMES) is case sensitive,
+even when the file system is not case sensitive (or even case
+preserving). This allows accurate matching of mixed-case names in an
+archive which may have been created on a system with a case sensitive
+file system, but it can involve extra effort on VMS, where it may be
+necessary to use unnatural case names (or the same names in multiple
+cases, like "*.obj *.OBJ") for this kind of pattern matching to give the
+desired behavior. If completely case-blind pattern matching behavior is
+desired, specify the /PATTERN_CASE=BLIND option.
+<QUALIFIER>
+/PKZIP
+
+/PKZIP
+/NOPKZIP (default)
+
+Create PKZIP-compatible archive entries. File names and paths are
+adjusted to conform to MSDOS character-set and length
+limitations, to store only the MSDOS file attributes (just the
+owner:write attribute from VMS), and to mark the entry as made under
+MSDOS (even though it wasn't).
+<QUALIFIER>
+/PRESERVE_CASE
+
+/NOPRESERVE_CASE
+/PRESERVE_CASE[=(keyword[, ...])]
+
+Directs Zip to preserve the case of, or convert to lower-case, file names
+in the archive. Optional keywords are:
+<LITERAL>
+| NOODS2 Down-case ODS2 file names (default).
+| NOODS5 Down-case ODS5 file names.
+| ODS2 Preserve case of ODS2 file names.
+| ODS5 Preserve case of ODS5 file names (default).
+<LARETIL>
+
+By default, file names from an ODS2 file system are converted to lower
+case for storage in an archive, while the case of file names from an
+ODS5 file system is preserved.
+
+/NOPRESERVE_CASE is equivalent to /PRESERVE_CASE = (NOODS2, NOODS5),
+which causes all file names to be converted to lower-case. This is
+equivalent to the behavior of Zip before version 3.0.
+
+/PRESERVE_CASE is equivalent to /PRESERVE_CASE = (ODS2, ODS5), which
+preserves the case of all file names.
+<QUALIFIER>
+/QUIET
+
+/QUIET
+
+Quiet mode. Eliminates informational messages and comment prompts.
+This mode may be useful in command procedures, or if the Zip operation
+is being performed as a background task ("$ spawn/nowait zip /quiet foo
+*.c").
+<QUALIFIER>
+/RECURSE
+
+/RECURSE[=KEYWORD]
+/NORECURSE (default)
+
+Directs Zip to recurse into subdirectories.
+The optional keywords recognized are:
+<LITERAL>
+| PATH take patterns as full path specifiers (-r) (default)
+| FILENAMES start from current dir;
+| only use filename part of file patterns (-R)
+<LARETIL>
+The optional FILENAMES keyword modifies the recursion algorithm to be
+(almost) compatible to PKZIP's behaviour on subdirectory recursion.
+
+On VMS, directory recursion can also be requested by using the
+directory depth wildcard ("[...]") in an input file specification.
+<QUALIFIER>
+/SHOW
+
+/SHOW=(KEYWORD[,KEYWORD[...]])
+
+Controls various diagnostic messages.
+
+The keywords recognized are:
+<LITERAL>
+| COMMAND Show command line arguments as processed (only, then exit).
+| DEBUG Show Debug information.
+| FILES Show files to process (only, then exit).
+| OPTIONS Show all available command-line options on this system.
+<LARETIL>
+<QUALIFIER>
+/SINCE
+
+/SINCE=VMS_date_time
+
+Restricts the files by date-time when adding, updating, or freshening an
+archive. Only files with modification date-times at or later than the
+specified date-time are accepted.
+
+See also /BEFORE.
+<QUALIFIER>
+/SPLIT
+
+/SPLIT = (SIZE=size [, PAUSE [, BELL]] [, VERBOSE])
+
+Enables split archives, specifies the size of the splits, and controls
+other related behavior.
+
+SIZE=size specifies the split size. The size is given as a number
+followed optionally by a multiplier suffix of k (KB), m (MB, the default
+if no suffix is specified), g (GB), or t (TB). (All are powers of 1024,
+not 1000). 64K is the minimum split size. For example, the following
+command could be used to create a split archive called "foo" from the
+contents of the "bar" directory with splits of 670MB, which might be
+useful for burning on CDs:
+
+<LITERAL>
+| zip /split = size = 670m foo [.bar...]*.*
+<LARETIL>
+
+Using /SPLIT without PAUSE as above creates all the splits in the
+directory
+specified by "foo", in this case the current default directory. This
+split mode updates the splits as the archive is being created, requiring
+all splits to remain writable, but creates split archives that are
+readable by any UnZip that supports split archives. See PAUSE below for
+enabling split pause mode which allows splits to be written directly to
+removable media.
+
+PAUSE causes Zip to pause between splits to allow
+changing removable media, for example. PAUSE uses stream mode to
+write splits so unzips that can't read stream mode entries may not
+be able to read some entries in the archive. Unless standard encryption
+was used, copy mode using /COPY_ENTRIES can convert stream mode entries
+to normal entries.
+
+BELL ring the terminal bell when Zip pauses for the next split
+destination.
+
+VERBOSE enables verbose splitting and display details of how the
+splitting is being done.
+
+Though Zip does not update split archives, Zip provides the option
+/OUTPUT to allow split archives to be updated and saved in a new
+archive. For example:
+
+<LITERAL>
+| zip inarchive.zip foo.c bar.c /output = outarchive.zip
+<LARETIL>
+
+reads archive inarchive.zip, even if split, adds the files foo.c and
+bar.c, and writes the resulting archive to outarchive.zip. If
+inarchive.zip is split, then outarchive.zip defaults to the same split
+size. Be aware that outarchive.zip and any split files that are created
+with it are always overwritten without warning. This may be changed in
+the future.
+<QUALIFIER>
+/STORE_TYPES
+
+/STORE_TYPES=(.ext1,.ext2,... )
+
+Normally, a file which is already compressed will not be compressed much
+further (if at all) by Zip, and trying to do it can waste considerable
+CPU time. Zip can suppress compression on files with particular types,
+specified with /STORE_TYPES. The default list of types where
+compression is suppressed is /STORE_TYPES=(.Z, .zip, .zoo, .arc, .lzh,
+ .arj), and the comparison is case-insensitive.
+
+/LEVEL=9 will override /STORE_TYPES, causing compression to be attempted
+for all files.
+<QUALIFIER>
+/SYMLINKS
+
+/SYMLINKS
+
+Store symbolic links as such in the Zip archive, instead of compressing
+and storing the file referred to by the link. A symbolic link normally
+requires less storage than the actual file, both in the archive, and on
+the destination file system.
+
+On VMS, symbolic links are supported on ODS5 disks where the C RTL
+supports symbolic links. Full support for symbolic links seems to
+require VMS V8.3, but a Zip program supporting symbolic links may be
+built on VMS V7.3-2.
+<QUALIFIER>
+/TEMP_PATH
+
+/TEMP_PATH=temp_dir
+
+When creating a new archive or normally when changing an existing
+archive, Zip will write a temporary file in the archive destination
+directory ("ZIxxxxxxxx", where "xxxxxxxx" is the hexadecimal process ID)
+with the new contents. Then, if and when the Zip job has completed with
+no errors, it will rename the temporary file to the specified archive
+name (replacing the old archive, if any).
+
+/TEMP_PATH=temp_dir specifies an alternate device:[directory],
+"temp_dir", for the temporary file, but specifying a different device
+will force Zip to copy the temporary file to its final destination
+instead of simply renaming it, and that copying will take more time than
+renaming, especially for a large archive. For example:
+
+<LITERAL>
+| zip /temp_path = disk$scratch:[tmp] stuff *
+<LARETIL>
+
+will cause Zip to put its temporary files in the directory
+"disk$scratch:[tmp]", copying the temporary file back to the current
+directory as stuff.zip when it's complete.
+<QUALIFIER>
+/TEST
+
+/TEST[=UNZIP=unzip_cmd]
+
+Test the integrity of a Zip archive (the new one, if /OUTPUT is
+specified). If the check fails, the old archive is unchanged and
+(with the /MOVE option) no input files are removed.
+
+Implementation
+"zip /TEST" actually runs an "unzip -t" command to do the testing, so
+UnZip must be installed properly for this to work.
+
+With UNZIP=unzip_cmd, Zip uses the UnZip command specified by
+"unzip_cmd" (normally a DCL symbol), instead of the default command,
+"unzip -t". This can be useful if multiple versions of UnZip are
+installed on a system, and the default DCL symbol "UNZIP" would run the
+wrong one (or the logical name DCL$PATH would lead to the wrong one).
+
+In "unzip_cmd", the string "{}" is replaced by the name of the
+(temporary) archive to be tested, otherwise the name of the archive is
+appended to the end of the command. The exit status is checked for
+success severity.
+<QUALIFIER>
+/TRANSLATE_EOL
+
+/TRANSLATE_EOL[=KEYWORD]
+
+Selects conversion of the end-of-line markers in text files. This
+option should be used on text files only. The optional keywords
+recognized are:
+<LITERAL>
+| LF convert LF -> CRLF (UNIX to DOS) (default)
+| CRLF convert CRLF -> LF, strip trailing CTRL-Z's (DOS to UNIX)
+<LARETIL>
+
+The CRLF option may be useful when a DOS text file has been transfered
+to a VMS disk in stream (or stream_lf) format.
+<QUALIFIER>
+/UNSFX
+
+/UNSFX
+
+Strip any prepended data from the Zip archive. ZIP /UNSFX is normally
+used to convert a self-extracting archive to a normal archive by
+removing the UnZip SFX executable from the beginning of the SFX archive.
+
+Note that a self-extracting archive contains a normal Zip archive, and a
+normal UnZip program can be used to expand it in the normal way. You
+may get a warning about extra bytes at the beginning of the archive (the
+UnZip SFX program), but UnZip should work properly after that. This
+allows data in a self-extracting archive to be accessed on any system,
+not just the target system where its embedded UnZip SFX program runs.
+<QUALIFIER>
+/UPDATE
+
+/UPDATE
+
+Update existing archive entries and add new files. If the archive does
+not exist, create it. This is the default mode, so /UPDATE is optional.
+
+See also /DELETE /DIFFERENCE, /GROW, /FRESHEN.
+<QUALIFIER>
+/VERBOSE
+
+/VERBOSE[=NORMAL|MORE|DEBUG] [, COMMAND]]
+
+Verbose mode or print diagnostic version info.
+
+Normally, when applied to real operations, this option enables the
+display of a progress indicator during compression (see /DISPLAY=DOTS
+for more on dots) and requests verbose diagnostic info about archive
+structure oddities.
+
+/VERBOSE with no value is equivalent to /VERBOSE=NORMAL. MORE adds more
+messages, and DEBUG adds still more messages.
+
+When /VERBOSE is the only command line argument, a diagnostic report is
+displayed, showing:
+
+<LITERAL>
+| o Copyright and other legal notices
+| o Program name, version, and release date
+| o Pointers to Info-ZIP FTP and Web sites
+| o Program build information (compiler type and version, OS version,
+| and the compilation date
+| o Optional features enabled at compile-time
+| o Environment variable definitions (ZIP_OPTS, ZIPOPT)
+<LARETIL>
+
+This information should be included in bug reports.
+
+/VERBOSE=COMMAND causes Zip to display the UNIX-style command-line
+argument vector which is generated from the VMS-style CLI command line
+before executing the command. This is of primary interest to program
+developers debugging the CLI.
+<QUALIFIER>
+/VMS
+
+/VMS[=ALL]
+
+The /VMS and /VMS=ALL options cause Zip to store VMS file atributes
+(such as file organization, record format, carriage control, and so on)
+in VMS-specific "extra fields" in an archive along with the usual data.
+These extra fields are ignored on non-VMS systems, but on a VMS system,
+they allow UnZip to restore the files with their VMS attributes intact.
+
+With /VMS, Zip ignores any data in the file after the end-of-file (EOF)
+point (defined by FAT$L_EFBLK and FAT$W_FFBYTE), which works well for
+well-formed files (that is, those with no valid data beyond EOF).
+Portable-format files (Stream_LF, fixed-512) archived with /VMS should
+be extracted properly on a non-VMS system. Files with more complex
+structures, such as indexed files and files with embedded byte counts or
+other such data may be of limited use on other systems. (UnZip on
+non-VMS systems may be able to extract various VMS-format text files,
+however.)
+
+With /VMS=ALL, Zip processes 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.
+<QUALIFIER>
+/WILDCARD
+
+<LITERAL>
+/NOWILDCARD
+/WILDCARD=NOSPAN
+<LARETIL>
+
+Controls wildcard processing.
+
+/NOWILDCARD Wildcard processing is disabled.
+
+/WILDCARD=NOSPAN Wildcards don't span directory boundaries in paths.
+<QUALIFIER>
+/ZIP64
+
+/ZIP64
+
+Forces use of Zip64 archive format, even for small files. This is
+mainly for testing and should never be used. Zip will automatically
+use Zip64 as needed without this option.
+<TOPIC>
+UNIX_Options
+
+"zip -h" provides a concise list of common command-line options. "zip
+-h2" provides more details. "zip -so" provides a list of all available
+options. "zip -v" shows the program version and available features.
+(The list below was derived from a "zip -so" listing.)
+
+Short-form options begin with a single hyphen ("-"). Long-form option
+begin with a double hyphen ("--"), and may be abbreviated to any
+unambiguous shorter string. For example:
+
+<LITERAL>
+| -v
+| --verbose
+| --verb
+<LARETIL>
+
+To avoid confusion, if a negatable option contains an embedded hyphen
+("-"), then avoid abbreviating it at the hyphen if you plan to negate
+it. For example, if an option like --some-option were abbreviated to
+--some-, the parser would consider that trailing hyphen to be part of
+the option name, rather than as a negating trailing hyphen. This
+behavior may change in the future, to interpret the trailing hyphen in
+--some- to be negating. (So don't do it.)
+
+Some options may be negated (or modified) by appending a "-":
+
+<LITERAL>
+| -la-
+| --show-files-
+<LARETIL>
+
+Some options take a value, which may immediately follow the option, or
+be separated by a space or "=". For example:
+<LITERAL>
+| -ttmmddyyyy
+| -tt mmddyyyy
+| -tt=mmddyyyy
+<LARETIL>
+
+<LITERAL0>
+| Sh Long Description
+|----+-------------------+------------------------------------------------
+| 0 store store (instead of compress)
+| 1 compress-1 compress faster (-2, -3, -4, ...)
+| 9 compress-9 compress better
+| ? show the Zip help screen
+| @ names-stdin read input file patterns from SYS$INPUT (1/line)
+| A adjust-sfx adjust self-extracting executable
+| b temp-path path use "path" directory for temporary files
+| C preserve-case preserve case of all file names added to archive
+| C- preserve-case- down-case all file names added to archive
+| C2 preserve-case-2 preserve case of ODS2 names added to archive
+| C2- preserve-case-2- down-case ODS2 file added to archive (default)
+| C5 preserve-case-5 preserve case of ODS5 names added to arcv (dflt)
+| C5- preserve-case-5- down-case ODS5 names added to archive
+| c entry-comments add a comment for each entry added to archive
+| D no-dir-entries do not add archive entries for directories
+| DF difference-archive difference archive: add only changed/new files
+| d delete delete entries in archive
+| db display-bytes display running byte counts
+| dc display-counts display running file counts
+| dd display-dots display progress dots for files (dflt sz = 10MB)
+| dg display-globaldots display progress dots for archive, not each file
+| ds dot-size size set progress dot interval to "size" (MB)
+| du display-usize display original uncompressed size for entries
+| dv display-volume display volume (disk) number as in_disk>out_disk
+| e encrypt encrypt entries, ask for password
+| F fix fix mostly intact archive (try F before FF)
+| FF fixfix salvage what can be salvaged (not as reliable)
+| FS filesync remove archive entries unmatched in file system
+| f freshen update existing entries (only changed files)
+| fd force-descriptors force data descriptors as if streaming
+| fz force-zip64 force use of Zip64 format
+| g grow grow existing archive (unless update or delete)
+| H show the Zip help screen
+| h help show the Zip help screen
+| h2 more-help show extended Zip help
+| i include pat1 [pat2 [...]] include only names matching the patterns
+| J junk-sfx junk (remove) archive preamble (unzipsfx)
+| j junk-paths junk (don't store) dir names, only file names
+| k DOS-names simulate PKZIP-made archive (DOS 8.3 names)
+| L license show software license
+| l to-crlf translate end-of-lines (LF -> CRLF)
+| la log-append append to existing log file
+| lf logfile-path lfile log to log file at lfile (default: new version)
+| li log-info include informational messages in log
+| ll from-crlf translate end-of-lines (CRLF -> LF)
+| MM must-match input file spec must exist (wildcrds must match)
+| m move delete files added to archive
+| n suffixes sfx1[:sfx2[...]] don't compress files with these suffixes
+| nw no-wild no wildcards during add or update
+| O output-file ozf use "ozf" as the output archive (dflt = inp archv)
+| o latest-time set archive date-time to match oldest entry
+| P password password encrypt with supplied "password" string
+| q quiet quiet operation (no info messages)
+| R recurse-patterns recurse subdirs from cur dir, match names only
+| r recurse-paths recurse directories from specified path pats
+| s split-size size split archive at "size" (K/MB) (0: don't split)
+| sb split-bell ring termnl bell at pause for split medium chng
+| sc show-command show command line
+| sd show-debug show debug messages
+| sf show-files show files to process (only)
+| so show-options show list of all command-line options
+| sp split-pause pause to select split destination(s)
+| sv split-verbose be verbose about creating splits
+| T test test archive integrity (runs UnZip -T)
+| t from-date mmddyyyy only do files since (at or after) "mmddyyyy"
+| tt before-date mmddyyyy only do files before "mmddyyyy"
+| u update update changed files, add new files (default)
+| V VMS-portable save VMS file attributes
+| VV VMS-specific save VMS file attributes and all allocated blks
+| v verbose verbose messages (version info if only arg)
+| w VMS-versions save VMS version numbers in archive
+| ww VMS-dot-versions save VMS version numbers as ".nnn", not ";nnn"
+| X strip-extra strip all but critical extra fields
+| X- strip-extra- keep all extra fields
+| x exclude pat1 [pat2 [...]] exclude all names matching the patterns
+| Z compression-method mthd use cmprs method "mthd" (bzip2 or deflate)
+| z archive-comment ask for archive comment
+<0LARETIL>
+
+With SET PROCESS /PARSE_STYLE = EXTENDED (available on recent non-VAX
+systems), Zip preserves the case of the command line. Otherwise, mixed-
+or upper-case options and arguments must be quoted. For example,
+"-V". Examples in this document generally do not show this quotation.
+<TOPIC>
+Copyright_and_License
+
+Zip has an option to display its copyright and license.
+
+<LITERAL>
+| /LICENSE
+<LARETIL>
+
+The license is reproduced below.
+
+This is version 2007-Mar-4 of the Info-ZIP license. The definitive
+version of this document should be available at
+ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and a copy
+at http://www.info-zip.org/pub/infozip/license.html.
+
+--------------------------------------------------------
+<LITERAL0>
+|Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+|
+|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. 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.
+<0LARETIL>
+
+===
diff --git a/vms/zip_msg.msg b/vms/zip_msg.msg
new file mode 100644
index 0000000..8654148
--- /dev/null
+++ b/vms/zip_msg.msg
@@ -0,0 +1,57 @@
+! VMS Error Message Source File for Zip
+!
+! Because the facility code was formally assigned by HP, the .FACILITY
+! directive below specifies /SYSTEM. Because the messages are, in
+! general, specific to Zip, this file is not compiled with /SHARED.
+! For example:
+!
+! MESSAGE /OBJECT = [.dest]ZIP_MSG.OBJ /NOSYMBOLS [.VMS]ZIP_MSG.MSG
+!
+! LINK /SHAREABLE = [.dest]ZIP_MSG.EXE [.dest]ZIP_MSG.OBJ
+!
+!-----------------------------------------------------------------------
+
+.TITLE Info-ZIP Zip Error Messages
+.FACILITY IZ_ZIP, 1955 /SYSTEM
+.IDENT 'V3.0-000'
+
+.BASE 0
+OK /SUCCESS <Normal successful completion>
+.BASE 4
+EOF /FATAL <Unexpected end of zip file>
+.BASE 6
+FORM /ERROR <Zip file structure invalid>
+.BASE 8
+MEM /FATAL <Out of memory>
+.BASE 10
+LOGIC /FATAL <Internal logic error>
+.BASE 12
+BIG /ERROR <Entry too big to split, read, or write>
+.BASE 14
+NOTE /ERROR <Invalid comment format>
+.BASE 16
+TEST /FATAL <Zip file invalid, could not spawn unzip, or wrong unzip>
+.BASE 18
+ABORT /ERROR <Interrupted>
+.BASE 20
+TEMP /FATAL <Temporary file failure>
+.BASE 22
+READ /FATAL <Input file read failure>
+.BASE 24
+NONE /WARNING <Nothing to do!>
+.BASE 26
+NAME /ERROR <Missing or empty zip file>
+.BASE 28
+WRITE /FATAL <Output file write failure>
+.BASE 30
+CREAT /FATAL <Could not create output file>
+.BASE 32
+PARMS /ERROR <Invalid command arguments>
+.BASE 36
+OPEN /ERROR <File not found or no read permission>
+.BASE 38
+COMPERR /FATAL <Not supported>
+.BASE 40
+ZIP64 /FATAL <Attempt to read unsupported Zip64 archive>
+
+.END
diff --git a/vms/zipup.h b/vms/zipup.h
new file mode 100644
index 0000000..8fe757f
--- /dev/null
+++ b/vms/zipup.h
@@ -0,0 +1,56 @@
+/*
+ Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 2005-Feb-10 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 __zipup_h
+#define __zipup_h 1
+
+#ifndef NO_ZIPUP_H
+
+#define fbad NULL
+typedef void *ftype;
+#define zopen(n,p) (vms_native?vms_open(n) :(ftype)fopen((n), p))
+#define zread(f,b,n) (vms_native?vms_read(f,b,n):fread((b),1,(n),(FILE*)(f)))
+#define zclose(f) (vms_native?vms_close(f) :fclose((FILE*)(f)))
+#define zerr(f) (vms_native?vms_error(f) :ferror((FILE*)(f)))
+#define zstdin stdin
+
+ftype vms_open OF((char *));
+unsigned int vms_read OF((ftype, char *, unsigned int));
+int vms_close OF((ftype));
+int vms_error OF((ftype));
+#ifdef VMS_PK_EXTRA
+int vms_get_attributes OF((ftype, struct zlist far *, iztimes *));
+#endif
+
+#endif /* !NO_ZIPUP_H */
+#endif /* !__zipup_h */
+
+
+#ifndef __zipup_cb_h
+#define __zipup_cb_h 1
+
+#ifdef __DECC
+
+/* File open callback ID values. (See also OSDEP.H.) */
+
+# define FHOW_ID 4
+
+/* File open callback ID storage. */
+
+extern int fhow_id;
+
+#define fhow "r", "acc", acc_cb, &fhow_id
+
+#else /* def __DECC */ /* (So, GNU C, VAX C, ...)*/
+
+#define fhow "r", "mbc=60"
+
+#endif /* def __DECC */
+
+#endif /* ndef __zipup_cb_h */