diff options
Diffstat (limited to 'vms')
39 files changed, 8325 insertions, 2645 deletions
diff --git a/vms/00binary.vms b/vms/00binary.vms deleted file mode 100644 index aa0dc41..0000000 --- a/vms/00binary.vms +++ /dev/null @@ -1,87 +0,0 @@ -First information about the binary distribution of VMS Zip 2.3 --------------------------------------------------------------- -This archive comes in different variations: - - "zip22x-vms-<cpu-compiler>-{obj|exe}.zip", - - where <cpu-compiler> is "axp", "vax-decc", or "vax-vaxc", depending on - the environment used for creating the binaries. - - ...-obj.zip denotes object library distributions which require - a link step on the local machine. - - ...-exe.zip denotes "ready-to-run" executable distributions, that do - not require additional work but do not run on VMS versions which are - older than the system used for building the executables. - -Contents of the "vms" executables archives for Zip 2.3: - -a) common files (documentation etc.): - 00binary.vms this file - 00readme.txt additional VMS info about compiling Zip - readme what Zip is; general information - changes list of changes against the previous official version - algorith.txt description of the deflation algorithm - infozip.who list of contributors to the "portable Zip" project - manual Zip manual page, human-readable format - whatsnew list of important changes and new features - where pointer to Zip/UnZip support archives - zip.hlp VMS help module, for Zip's default command interface - zip_cli.hlp VMS help module, for Zip's VMSCLI command interface - -b) object library distributions: - link_zip.com command procedure for the linking step - vms/ auxiliary directory, required for link step - - zip.<cpu_compiler>_olb object library for Zip (both command interfaces) - zipcli.<cpu_compiler>_olb additional object library (Zip CLI interface) - zipcloak.<cpu_compiler>_obj main object file for ZipCloak - zipnote.<cpu_compiler>_obj main object file for ZipNote - zipsplit.<cpu_compiler>_obj main object file for ZipSplit - ziputils.<cpu_compiler>_olb object library for the Zip Utilities - -c) executable distributions: - zip.exe Zip executable, default (UNIX style) command interface - zipcloak.exe Utility for encrypting and decrypting zip archives - zipnote.exe Utility for editing entry names and comments - zipsplit.exe Utility for splitting large zip archives - zip_cli.exe Zip executable, VMSCLI command interface - - -In case you decided to fetch the object library distribution, you -have to link the executables on your local site. This requires -installed runtime support for the C runtime library, which may not be -present on older VAX systems (prior to VMS 6). -To create the executables, just invoke the "link_zip.com" command procedure. -This will generate all executables (both zip with UNIX style command syntax -and zip_cli with VMSCLI command interface), but note that the executable's -extension is ".<cpu_compiler>_exe"! -In case your are on a VAX and your current working directory carries -both the DECC and the VAXC object distributions, you have to specify -either "VAXC" or "DECC" to tell link_zip.com which binaries you want -to build. - -Additionally, link_zip.com defines foreign commands for the just created -executables, so you can test them straight ahead. -If you want to use the default (UNIX like) command interface, you can -proceed straight ahead after unpacking the distribution. -When you rather prefer to use the VMSCLI interface, you have to specify -the option "VMSCLI" (or just "CLI") to the command starting link_zip.com. - -The executables (object libraries) in this archive have been compiled -with the following options enabled: - * VMS_PK_EXTRA (this is the default option) - * [decription support] - -The environment used for compilation was: - -a) On Alpha AXP : OpenVMS(AXP) 6.2; DEC C V 5.6-003 -b1) On VAX : OpenVMS(VAX) 6.2; DEC C V 4.0 -b2) alternatively VAX C V 3.2 - -One final note: -The binary files of the distribution have been archived with "saving all VMS -attributes" enabled. Please do not repack the binary part of the archives on -a non-VMS system, to prevent corruption of the files. - -02-Feb-1999, Christian Spieler diff --git a/vms/00readme.txt b/vms/00readme.txt deleted file mode 100644 index 020d8ae..0000000 --- a/vms/00readme.txt +++ /dev/null @@ -1,126 +0,0 @@ -***************************************** -************ vms/00readme.txt *********** -***************************************** - -Additional information for compiling Zip for VMS: - -A) Support for storing VMS specific file attributes - ================================================ - -The current version of Zip comes with two different types of support -to store VMS file attributes in extra blocks: - - -- the traditional Info-ZIP format in vms/vms_im.c -and - - -- a new PKware (ASI) type extra field structure in vms/vms_pk.c - -Both versions should supply exactly the same functionality. -Up to Zip 2.1, the default configuration was to use the traditional IM style, -since it was well tested and known to be stable. -==> NEW <== -As of Zip 2.2, this default has been changed to use PK style extra field -format. This change is needed to support indexed VMS files. The -IM style code in UnZip (!!) has a known problem that prevents the correct -restoring operation for some (but not all) indexed VMS files. - -IMPORTANT: To extract new PK style extra fields, Info-ZIP's - UnZip version 5.2 or newer is required, previous - versions will crash with an access violation !!!! - -If you want to use the old IM style support (to achieve compatibility -with older versions of UnZip), the preprocessor symbol VMS_IM_EXTRA -has to be defined at compile time. - -MMS (MMK) users have to edit vms/descrip.mms and add this symbol to -the definition of the COMMON_DEFS macro; for example: - -COMMON_DEFS = VMS_IM_EXTRA, - -if VMS_IM_EXTRA is the only option. (NOTE the trailing comma!) - -Users of the DCL make procedure can select the PK style support by defining -the DCL symbol LOCAL_ZIP as a list of user specific compilation options -(do not forget the trailing comma!!). Example: -$ LOCAL_ZIP == "VMS_IM_EXTRA," - - -B) Notes on the compiler switches used on VMS: - =========================================== - -The source has been successfully compiled on VMS 6.1 (VMS 6.2 for AXP), using - - DEC C 5.2 and 5.6 for Alpha AXP - - DEC C 4.0 for VMS VAX - - VAX C 3.2 - -1. Discussion of the /STANDARD switch: - -With the exception of some few rough spots in the VMS specific sources, -the code is fully compatible with the "RELAXED_ANSI" mode of the DEC C -compilers. The problems found in vmsmunch.c and vms_pk.c are caused -by incompatibles between the system include headers supplied for DEC C -(AXP) and DEC C (VAX) which cannot get worked around. (Some system -service structure members have type "unsigned int" in the VAX version, -but "pointer to [miscellanous]" in the AXP headers.) -I consider the AXP headers to show the direction of `future developement' -and have adapted the sources to match the AXP's header files. -This means: -On Alpha AXP, we can equally well use "/STANDARD=RELAXED" instead of -"/STANDARD=VAXC" without getting any warnings. -With the current release of DEC C on VAX, the /STANDARD=VAXC switch is -required to suppress the "assignment to incompatible type" warnings. -Beginning with the Zip 2.1 release, the compiler mode for Alpha AXP has -been changed to "/STANDARD=RELAX", since the "ANSI mode" executables are -slightly smaller. - -2. The /PREFIX_LIBRARY_ENTRIES switch: - -In (strict and relaxed) ANSI mode on Alpha AXP, only the standard ANSI -RTL function names get prefixed with "DECC$" by the compiler per default. -This results in unresolved references to such functions as "read()", "open()" -"lseek()" at link step. (The same might be true for earlier releases of DEC C -on VAX.) To resolve this problem, one has to explicitely request prefixing -of all DEC C RTL function by applying the "/PREFIX=ALL" switch. -Although this switch is not needed in "VAXC" mode, it does not hurt either. -Therefore, "/PREFIX=ALL" is applied regardless of the compilation mode, -to avoid any problems when switching over to ANSI standard mode in the future. - -C) Support for UT extra field UTC time stamps - ========================================== -Beginning with Zip 2.1 and UnZip 5.2, the Info-ZIP compression utilities -do principally support saving and restoring the modification time of -Zipfile entries as UTC (GMT) universal time. This new information is -stored in an "extra field" labeled "UT" (Unix style GMT modification/access -times, ...). -Previous version of Zip and UnZip used local time, stored in MSDOS compatible -format (as specified by PKware for the Zip file format). This practice caused -a lot of "time synchronization" trouble when transporting Zip archives world -wide between largely different time zones. - -Unfortunately, VMS (and the VMS C runtime environment) up to VMS 6.x does not -contain support for timezone handling and assumes "local time == UTC time". -This has changed with the release of VMS 7.0, which does (finally) support -the concept of "universal world time" that is required for time synchronization -in intercontinental networks... - -For this reason, the UTC time stamp support is disabled in VMS Zip by default, -otherwise users would experience annoying time stamp deviations when -locally transfering Zip archives between VMS nodes and other (UNIX, OS/2, -WinNT/Win95, MSDOS) systems. -But when compiled on a VMS 7.x system, the UTC "UT extra field" support is -automatically enabled. - -For users located in the GMT time zone (or a nearby timezone, like CET), -it might be worthwhile to enable UTC support by hand. - -The default configuration can be overridden by defining one of the -following preprocessor macro: - - USE_EF_UT_TIME includes "UT" time stamp support - NO_EF_UT_TIME disables "UT" time stamp support - -When using MMS/MMK, you should add the appropiate symbol to the "COMMON_DEFS" -list in vms/descrip.mms; if the command procedure is used for compiling, -you can add the macro to the "LOCAL_ZIP" DCL symbol. - -14-Oct-1997 Christian Spieler 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 index cae91b3..9816bd5 100644 --- a/vms/cmdline.c +++ b/vms/cmdline.c @@ -1,13 +1,39 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 */ -#define module_name VMS_ZIP_CMDLINE -#define module_ident "02-006" + +/* + 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 @@ -24,6 +50,8 @@ ** ** 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). @@ -53,11 +81,29 @@ */ -#if defined(__DECC) || defined(__GNUC__) -#pragma module module_name module_ident -#else -#module module_name module_ident -#endif +/* 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 @@ -121,49 +167,103 @@ $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 */ +$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, "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(__GNUC__) && !defined(zip_clitable)) +#if !defined(zip_clitable) # define zip_clitable ZIP_CLITABLE #endif #if defined(__DECC) || defined(__GNUC__) @@ -203,15 +303,28 @@ static unsigned long get_list (struct dsc$descriptor_s *, 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(int argc, char **argv) /* Main program. */ { return (vms_zip_cmdline(&argc, &argv)); } -#endif /* TEST */ + +#endif /* def TEST */ unsigned long @@ -245,7 +358,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) ** */ register unsigned long status; - char options[48]; + 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 */ @@ -307,10 +420,19 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) 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'; /* @@ -318,6 +440,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_freshen); if (status & 1) + /* /FRESHEN */ *ptr++ = 'f'; /* @@ -325,6 +448,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_move); if (status & 1) + /* /MOVE */ *ptr++ = 'm'; /* @@ -332,6 +456,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_update); if (status & 1) + /* /UPDATE */ *ptr++ = 'u'; /* @@ -339,6 +464,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_level); if (status & 1) { + /* /LEVEL = value */ unsigned long binval; @@ -355,30 +481,187 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_adjust); if (status & 1) + /* /ADJUST_OFFSETS */ *ptr++ = 'A'; /* ** Add comments? */ status = cli$present(&cli_comments); - if (status & 1) { -/* while ((status = cli$get_value(&cli_comments, &work_str)) & 1) { - if (strncmp(work_str.dsc$a_pointer,"ZIP",3) == 0) - *ptr++ = 'z'; - if (strncmp(work_str.dsc$a_pointer,"FIL",3) == 0) - *ptr++ = 'c'; - } */ + 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'; /* @@ -387,6 +670,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) 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) @@ -395,6 +679,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) work_str.dsc$w_length); the_cmd_line[cmdl_len-1] = '\0'; } else { + /* /ENCRYPT */ *ptr++ = 'e'; } @@ -404,30 +689,71 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) 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) - *ptr++ = 'h'; + { + 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'; /* @@ -435,6 +761,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_pkzip); if (status & 1) + /* /KEEP_VERSION */ *ptr++ = 'k'; /* @@ -442,8 +769,10 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ 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'; } } @@ -453,6 +782,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_license); if (status & 1) + /* /LICENSE */ *ptr++ = 'L'; /* @@ -460,6 +790,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_latest); if (status & 1) + /* /LATEST */ *ptr++ = 'o'; /* @@ -467,8 +798,10 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_full_path); if (status == CLI$_PRESENT) + /* /FULL_PATH */ *ptr++ = 'p'; else if (status == CLI$_NEGATED) + /* /NOFULL_PATH */ *ptr++ = 'j'; /* @@ -476,6 +809,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_unsfx); if (status & 1) + /* /UNSFX */ *ptr++ = 'J'; /* @@ -484,23 +818,52 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) 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) { - *ptr++ = 'v'; + 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) - *ptr++ = 'v'; + /* /VERBOSE = MORE */ + verbo = 2; if ((status = cli$present(&cli_verbose_debug)) & 1) { - *ptr++ = 'v'; - *ptr++ = 'v'; + /* /VERBOSE = DEBUG */ + verbo = 3; } + for (i = 0; i < verbo; i++) + *ptr++ = 'v'; } /* @@ -510,16 +873,10 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_quiet); if (status & 1) + /* /QUIET */ *ptr++ = 'q'; /* - ** Suppress creation of any extra field. - */ - status = cli$present(&cli_extra_fields); - if (!(status & 1)) - *ptr++ = 'X'; - - /* ** Save the VMS file attributes (and all allocated blocks?). */ status = cli$present(&cli_vms); @@ -537,16 +894,27 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ 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) { @@ -573,12 +941,14 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) /* ** ** OK. We've done all the regular options, so check for -b (temporary - ** file path), -t (exclude before time), -n (special suffixes), zipfile, + ** 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; @@ -589,11 +959,378 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) 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]); @@ -614,6 +1351,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ status = cli$present(&cli_before); if (status & 1) { + /* /BEFORE = value */ char before_time[9]; status = get_time(&cli_before, &before_time[0]); @@ -634,6 +1372,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ 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) @@ -645,9 +1384,35 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) } /* + ** 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); @@ -665,6 +1430,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ 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); @@ -675,6 +1441,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ 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; @@ -690,6 +1457,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ 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) @@ -705,6 +1473,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ 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; @@ -720,6 +1489,7 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) */ 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) @@ -769,6 +1539,15 @@ vms_zip_cmdline (int *argc_p, char ***argv_p) 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. */ @@ -967,27 +1746,40 @@ void VMSCLI_help(void) /* VMSCLI version */ /* help array */ static char *text[] = { -"Zip %s (%s). Usage: zip==\"$disk:[dir]zip.exe\"", -"zip zipfile[.zip] [list] [/EXCL=(xlist)] /options /modifiers", -" The default action is to add or replace zipfile entries from list, except", -" those in xlist. The include file list may contain the special name - to", -" compress standard input. If both zipfile and list are omitted, zip", +"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.", +" Type zip -h for Unix-style flags.", " Major options include:", -" /FRESHEN, /UPDATE, /DELETE, /[NO]MOVE, /COMMENTS[={ZIP_FILE|FILES}],", -" /LATEST, /TEST, /ADJUST_OFFSETS, /FIX_ARCHIVE[=FULL], /UNSFX", +" /COPY, /DELETE, /DIFFERENCE, /FILESYNC, /FRESHEN, /GROW, /MOVE, /UPDATE,", +" /ADJUST_OFFSETS, /FIX_ARCHIVE[={NORMAL|FULL}], /TEST[=UNZIP=cmd], /UNSFX,", " Modifiers include:", -" /EXCLUDE=(file list), /INCLUDE=(file list), /SINCE=\"creation time\",", +" /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],/[NO]RECURSE,/[NO]DIRNAMES,/JUNK,/ENCRYPT[=\"pwd\"],\ + /QUIET, /VERBOSE[={MORE|DEBUG}], /[NO]DIRNAMES, /JUNK, /ENCRYPT[=\"pwd\"],\ ", #else /* !CRYPT */ -" /QUIET, /VERBOSE[=MORE], /[NO]RECURSE, /[NO]DIRNAMES, /JUNK,", +" /QUIET, /VERBOSE[={MORE|DEBUG}], /[NO]DIRNAMES, /JUNK,", #endif /* ?CRYPT */ -" /[NO]KEEP_VERSION, /[NO]VMS, /[NO]PKZIP, /TRANSLATE_EOL[={LF|CRLF}],", -" /[NO]EXTRA_FIELDS /LEVEL=[0-9], /TEMP_PATH=directory, /BATCH[=list file]" +" /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) { 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 index 2324d60..8c60369 100644 --- a/vms/cvthelp.tpu +++ b/vms/cvthelp.tpu @@ -1,13 +1,13 @@ ! TITLE CVTHELP.TPU -! IDENT 01-000 +! IDENT 01-001 ! !++ -! Copyright (c) 1990-1999 Info-ZIP. All rights reserved. +! Copyright (c) 1990-2001 Info-ZIP. All rights reserved. ! -! See the accompanying file LICENSE, version 1999-Oct-05 or later +! 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, both of these files are missing, the Info-ZIP license -! also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +! 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 ! !++ ! @@ -26,6 +26,9 @@ ! ! 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. ! @@ -50,6 +53,8 @@ Local temp 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"); @@ -60,6 +65,7 @@ Local temp 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 diff --git a/vms/descrip.mms b/vms/descrip.mms index b44c413..ae2bc04 100644 --- a/vms/descrip.mms +++ b/vms/descrip.mms @@ -1,315 +1,358 @@ -# VMS Makefile for Zip, ZipNote, ZipCloak and ZipSplit - -# -# Modified to support both AXP and VAX by Hunter Goatley, 10-SEP-1993 06:43 -# Modified (DECC VAX, Zip 2.1) by Christian Spieler, 16-SEP-1995 -# Modified (Addition of VMS CLI) by Christian Spieler, 10-OCT-1995 -# Modified (fixed VAXC, changed compiler opts) by C. Spieler, 10-DEC-1995 -# Modified (removed zipup_.obj from Zip utils) by C. Spieler, 08-JAN-1996 -# Modified (cmdline$O depends on crypt.h) by C. Spieler, 09-JAN-1996 -# Modified (split crypt -> crypt, ttyio) by C. Spieler, 16-JAN-1996 -# Modified (modified VMSCLI compilation) by C. Spieler, 25-JUL-1997 -# Modified (comment concerning online help) by C. Spieler, 14-OCT-1997 -# Last modified (removed bits.c source file) by C. Spieler, 25-JUN-1998 -# -# To build Zip and the Ziputils, use one of the following commands, -# depending on your system: -# -# $ MMS/MACRO=(__ALPHA__=1) ! Alpha AXP, (DEC C) -# $ MMS/MACRO=(__DECC__=1) ! VAX, using DEC C -# $ MMS/MACRO=(__FORCE_VAXC__=1) ! VAX, prefering VAXC over DECC -# $ MMS/MACRO=(__VAXC__=1) ! VAX, where VAXC is default -# $ MMS/MACRO=(__GNUC__=1) ! VAX, using GNU C -# -# Other MMS macros intended for use on the MMS' command line are: -# __DEBUG__=1 ! compile for debugging -# For some discussion on the compiler switches used, see documentation -# in 00readme.vms. -# -.IFDEF __ALPHA__ -E = .AXP_EXE -O = .AXP_OBJ -A = .AXP_OLB -.ELSE -.IFDEF __DECC__ -E = .VAX_DECC_EXE -O = .VAX_DECC_OBJ -A = .VAX_DECC_OLB -.ENDIF -.IFDEF __FORCE_VAXC__ -__VAXC__ = 1 -.ENDIF -.IFDEF __VAXC__ -E = .VAX_VAXC_EXE -O = .VAX_VAXC_OBJ -A = .VAX_VAXC_OLB -.ENDIF -.IFDEF __GNUC__ -E = .VAX_GNUC_EXE -O = .VAX_GNUC_OBJ -A = .VAX_GNUC_OLB -.ENDIF -.ENDIF -.IFDEF O -.ELSE -!If EXE and OBJ extensions aren't defined, define them -E = .EXE -O = .OBJ -A = .OLB -.ENDIF +# 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;* -!The following preprocessor macros are set to enable the VMS CLI$ interface: -CLI_DEFS = VMSCLI, - -!!!!!!!!!!!!!!!!!!!!!!!!!!! USER CUSTOMIZATION !!!!!!!!!!!!!!!!!!!!!!!!!!!! -! add any other optional preprocessor flags (macros) except VMSCLI to the -! following line for a custom version (do not forget a trailing comma!!): -COMMON_DEFS = -! -! WARNING: Do not use VMSCLI here!! The creation of a Zip executable -! utilizing the VMS CLI$ command interface is handled differently. -!!!!!!!!!!!!!!!!!!!!!!!! END OF USER CUSTOMIZATION !!!!!!!!!!!!!!!!!!!!!!!! - -.IFDEF __GNUC__ -CC = gcc -LIBS = ,GNU_CC:[000000]GCCLIB.OLB/LIB -.ELSE -CC = cc -LIBS = -.ENDIF +# 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. -CFLAGS = /NOLIST/INCL=(SYS$DISK:[]) - -OPTFILE = sys$disk:[.vms]vaxcshr.opt - -.IFDEF __ALPHA__ !Under OpenVMS AXP, we must use /PREFIX=ALL -CFLG_ARCH = /STANDARD=RELAX/PREFIX=ALL/ANSI_ALIAS -OPTFILE_LIST = -OPTIONS = $(LIBS) -.ELSE -.IFDEF __DECC__ !Under DECC VAX, we must use /PREFIX=ALL -CFLG_ARCH = /DECC/STANDARD=VAXC/PREFIX=ALL -OPTFILE_LIST = -OPTIONS = $(LIBS) -.ELSE !VAXC, or GNU C on VAX -.IFDEF __FORCE_VAXC__ !Select VAXC on systems where DEC C exists -CFLG_ARCH = /VAXC -.ELSE !No flag allowed/needed on a pure VAXC system -CFLG_ARCH = -.ENDIF -OPTFILE_LIST = ,$(OPTFILE) -OPTIONS = $(LIBS),$(OPTFILE)/OPT -.ENDIF -.ENDIF +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 "" -.IFDEF __DEBUG__ -CDEB = /DEBUG/NOOPTIMIZE -LDEB = /DEBUG -.ELSE -CDEB = -LDEB = /NOTRACE -.ENDIF +# CLEAN_EXE target. Delete the executables in [.$(DEST)]. -CFLAGS_ALL = $(CFLG_ARCH) $(CFLAGS) $(CDEB) - - /def=($(COMMON_DEFS) VMS) -CFLAGS_CLI = $(CFLG_ARCH) $(CFLAGS) $(CDEB) - - /def=($(COMMON_DEFS) $(CLI_DEFS) VMS) -CFLAGS_UTIL = $(CFLG_ARCH) $(CFLAGS) $(CDEB) - - /def=($(COMMON_DEFS) UTIL, VMS) +CLEAN_EXE : + if (f$search( "[.$(DEST)]*.EXE") .nes. "") then - + delete /noconfirm [.$(DEST)]*.EXE;* -LINKFLAGS = $(LDEB) +# Object library module dependencies. -OBJM = zip$(O), zipcli$(O) -OBJZ = crc32$(O), crctab$(O), crypt$(O), ttyio$(O), - - zipfile$(O), zipup$(O), fileio$(O), globals$(O), util$(O) -OBJV = vmszip$(O), vms$(O), vmsmunch$(O) -OBJI = deflate$(O), trees$(O) -OBJU = ZIPFILE=zipfile_$(O), FILEIO=fileio_$(O), globals$(O), - - UTIL=util_$(O), VMS=vms_$(O), vmsmunch$(O) -OBJR = crctab$(O), CRYPT=crypt_$(O), ttyio$(O) -OBJC = zipcloak$(O) -OBJN = zipnote$(O) -OBJS = zipsplit$(O) +$(LIB_ZIP) : $(LIB_ZIP)($(MODS_OBJS_LIB_ZIP)) + @ write sys$output "$(MMS$TARGET) updated." -ZIPX_UNX = zip -ZIPX_CLI = zip_cli -OBJSZIPLIB = $(OBJZ), $(OBJI), $(OBJV) -OBJSZIP = zip$(O), $(OBJSZIPLIB) -OBJSCLI = ZIP=zipcli$(O), - - ZIP_CLITABLE=zip_cli$(O), VMS_ZIP_CMDLINE=cmdline$(O) -ZIPHELP_UNX_RNH = [.vms]vms_zip.rnh -ZIPHELP_CLI_RNH = [.vms]zip_cli.rnh +$(LIB_ZIPCLI) : $(LIB_ZIPCLI)($(MODS_OBJS_LIB_ZIPCLI)) + @ write sys$output "$(MMS$TARGET) updated." -OLBZIP = zip$(A) -OLBCLI = zipcli$(A) -OLBUTI = ziputils$(A) +$(LIB_ZIPUTILS) : $(LIB_ZIPUTILS)($(MODS_OBJS_LIB_ZIPUTILS)) + @ write sys$output "$(MMS$TARGET) updated." -ZIP_H = zip.h,ziperr.h,tailor.h,[.vms]osdep.h +# Module ID options file. -ZIPS = $(ZIPX_UNX)$(E), $(ZIPX_CLI)$(E),- - zipcloak$(E), zipnote$(E), zipsplit$(E) -ZIPHELPS = $(ZIPX_UNX).hlp, $(ZIPX_CLI).hlp +OPT_ID = SYS$DISK:[.VMS]ZIP.OPT -# -# Define our new suffixes list -# -.SUFFIXES : -.SUFFIXES : $(E) $(A) $(O) .C .MAR .CLD .HLP .RNH +# 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) -$(O)$(E) : - $(LINK) $(LINKFLAGS) /EXE=$(MMS$TARGET) $(MMS$SOURCE) +[.$(DEST)]ZIPFILE_.OBJ : ZIPFILE.C + $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE) -$(O)$(A) : - If "''F$Search("$(MMS$TARGET)")'" .EQS. "" Then $(LIBR)/Create $(MMS$TARGET) - $(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE) +[.$(DEST)]VMS_.OBJ : [.VMS]VMS.C + $(CC) $(CFLAGS) $(CDEFS_UTIL) $(MMS$SOURCE) -.CLD$(O) : - SET COMMAND /OBJECT=$(MMS$TARGET) $(CLDFLAGS) $(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 -.c$(O) : - $(CC) $(CFLAGS_ALL) /OBJ=$(MMS$TARGET) $(MMS$SOURCE) +# 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 -.RNH.HLP : - runoff /out=$@ $< - - -# rules for zip, zipnote, zipsplit, and VMS online help file. - -default : $(ZIPS), $(ZIPHELPS) - @ ! - -vmszip$(O) : [.vms]vmszip.c -vmsmunch$(O) : [.vms]vmsmunch.c -vms$(O) : [.vms]vms.c [.vms]vms_im.c [.vms]vms_pk.c [.vms]vms.h -zipcli$(O) : zip.c - $(CC) $(CFLAGS_CLI) /OBJ=$(MMS$TARGET) $< -cmdline$(O) : [.vms]cmdline.c $(ZIP_H) crypt.h revision.h - $(CC) $(CFLAGS_CLI) /OBJ=$(MMS$TARGET) $< -zip_cli$(O) : [.vms]zip_cli.cld - - -zipfile_$(O) : zipfile.c,[.vms]vmsmunch.h,[.vms]vmsdefs.h - $(CC) $(CFLAGS_UTIL) /OBJECT=$(MMS$TARGET) $< -fileio_$(O) : fileio.c - $(CC) $(CFLAGS_UTIL) /OBJECT=$(MMS$TARGET) $< -util_$(O) : util.c - $(CC) $(CFLAGS_UTIL) /OBJECT=$(MMS$TARGET) $< -crypt_$(O) : crypt.c,crypt.h,ttyio.h - $(CC) $(CFLAGS_UTIL) /OBJECT=$(MMS$TARGET) $< -vms_$(O) : [.vms]vms.c,[.vms]vms_im.c,[.vms]vms_pk.c, - - [.vms]vms.h,[.vms]vmsdefs.h - $(CC) $(CFLAGS_UTIL) /OBJECT=$(MMS$TARGET) $< - -$(OBJM),zipcloak$(O),zipnote$(O),zipsplit$(O),zipup$(O) : revision.h - -$(OBJM),zipcloak$(O),zipup$(O),crypt$(O),ttyio$(O) : crypt.h - -$(OBJM),zipcloak$(O),crypt$(O),ttyio$(O) : ttyio.h - -zipup$(O) : [.vms]zipup.h - -$(OBJM), zipfile$(O), vmszip$(O), vmsmunch$(O) : [.vms]vmsmunch.h - -zipfile$(O), vms$(O), vmsmunch$(O) : [.vms]vmsdefs.h - -$(OBJM) : $(ZIP_H) -$(OBJZ) : $(ZIP_H) -$(OBJV) : $(ZIP_H) -$(OBJI) : $(ZIP_H) -$(OBJU) : $(ZIP_H) -$(OBJR) : $(ZIP_H) -$(OBJC) : $(ZIP_H) -$(OBJN) : $(ZIP_H) -$(OBJS) : $(ZIP_H) - - -$(ZIPX_UNX)$(E) : $(OLBZIP)($(OBJSZIP))$(OPTFILE_LIST) - $(LINK)$(LINKFLAGS) /EXE=$@ - - $(OLBZIP)/inc=(zip,globals)/lib$(OPTIONS) - -$(ZIPX_CLI)$(E) : $(OLBCLI)($(OBJSCLI)),$(OLBZIP)($(OBJSZIPLIB))$(OPTFILE_LIST) - $(LINK)$(LINKFLAGS) /EXE=$@ - - $(OLBCLI)/inc=(zip)/lib, $(OLBZIP)/inc=(globals)/lib$(OPTIONS) - -zipcloak$(E) : $(OBJC),$(OLBUTI)($(OBJR),$(OBJU))$(OPTFILE_LIST) - $(LINK)$(LINKFLAGS) /EXE=$@ $<, - - $(OLBUTI)/inc=(globals)/lib$(OPTIONS) - -zipnote$(E) : $(OBJN),$(OLBUTI)($(OBJU))$(OPTFILE_LIST) - $(LINK)$(LINKFLAGS) /EXE=$@ $<, - - $(OLBUTI)/inc=(globals)/lib$(OPTIONS) - -zipsplit$(E) : $(OBJS),$(OLBUTI)($(OBJU))$(OPTFILE_LIST) - $(LINK)$(LINKFLAGS) /EXE=$@ $<, - - $(OLBUTI)/inc=(globals)/lib$(OPTIONS) - -$(OPTFILE) : - @ open/write tmp $(OPTFILE) - @ write tmp "SYS$SHARE:VAXCRTL.EXE/SHARE" - @ close tmp - -$(ZIPHELP_CLI_RNH) : [.vms]zip_cli.help - @ set default [.vms] - edit/tpu/nosection/nodisplay/command=cvthelp.tpu zip_cli.help - @ set default [-] - -$(ZIPX_UNX).hlp : $(ZIPHELP_UNX_RNH) - runoff /out=$@ $< - -$(ZIPX_CLI).hlp : $(ZIPHELP_CLI_RNH) - -clean.com : - @ open/write tmp $(MMS$TARGET) - @ write tmp "$!" - @ write tmp "$! Clean.com -- procedure to delete files. It always returns success" - @ write tmp "$! status despite any error or warnings. Also it extracts" - @ write tmp "$! filename from MMS ""module=file"" format." - @ write tmp "$!" - @ write tmp "$ on control_y then goto ctly" - @ write tmp "$ if p1.eqs."""" then exit 1" - @ write tmp "$ i = -1" - @ write tmp "$scan_list:" - @ write tmp "$ i = i+1" - @ write tmp "$ item = f$elem(i,"","",p1)" - @ write tmp "$ if item.eqs."""" then goto scan_list" - @ write tmp "$ if item.eqs."","" then goto done ! End of list" - @ write tmp "$ item = f$edit(item,""trim"") ! Clean of blanks" - @ write tmp "$ wild = f$elem(1,""="",item)" - @ write tmp "$ show sym wild" - @ write tmp "$ if wild.eqs.""="" then wild = f$elem(0,""="",item)" - @ write tmp "$ vers = f$parse(wild,,,""version"",""syntax_only"")" - @ write tmp "$ if vers.eqs."";"" then wild = wild - "";"" + "";*""" - @ write tmp "$scan:" - @ write tmp "$ f = f$search(wild)" - @ write tmp "$ if f.eqs."""" then goto scan_list" - @ write tmp "$ on error then goto err" - @ write tmp "$ on warning then goto warn" - @ write tmp "$ delete/log 'f'" - @ write tmp "$warn:" - @ write tmp "$err:" - @ write tmp "$ goto scan" - @ write tmp "$done:" - @ write tmp "$ctly:" - @ write tmp "$ exit 1" - @ close tmp - -clean : clean.com - @clean "$(OBJM)" - @clean "$(OBJZ)" - @clean "$(OBJI)" - @clean "$(OBJV)" - @clean "$(OBJU)" - @clean "$(OBJR)" - @clean "$(OBJN)" - @clean "$(OBJS)" - @clean "$(OBJC)" - @clean "$(OBJSCLI)" - @clean "$(OLBZIP)" - @clean "$(OLBCLI)" - @clean "$(OLBUTI)" - @clean "$(OPTFILE)" - @clean "$(ZIPS)" - @clean "$(ZIPHELP_CLI_RNH)" - @clean "$(ZIPHELPS)" - - delete/noconfirm/nolog clean.com;* 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/link_zip.com b/vms/link_zip.com deleted file mode 100755 index 54149a3..0000000 --- a/vms/link_zip.com +++ /dev/null @@ -1,204 +0,0 @@ -$ ! LINK_ZIP.COM -$ ! -$ ! Command procedure to (re)link the VMS versions of -$ ! Zip, ZipCloak, ZipNote, and ZipSplit -$ ! -$ ! Command args: -$ ! - select compiler environment: "VAXC", "DECC", "GNUC" -$ ! - 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" -$ ! -$ on error then goto error -$ on control_y then goto error -$ OLD_VERIFY = f$verify(0) -$! -$ 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 -$! 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. -$ pos_cli = f$locate("VMSCLI",local_zip) -$ len_local_zip = f$length(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 -$ delete/symbol/local len_local_zip -$!##################### Customizing section ############################# -$! -$ zipx_unx = "zip" -$ zipx_cli = "zip_cli" -$! -$ MAY_USE_DECC = 1 ! Use DEC C when its presence is detected -$ MAY_USE_GNUC = 0 ! Do not prefer GNUC over DEC or VAX C -$! -$! 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 curr_arg .eqs. "VAXC" -$ THEN MAY_USE_DECC = 0 -$ MAY_USE_GNUC = 0 -$ ENDIF -$ IF curr_arg .eqs. "DECC" -$ THEN MAY_USE_DECC = 1 -$ MAY_USE_GNUC = 0 -$ ENDIF -$ IF curr_arg .eqs. "GNUC" -$ THEN MAY_USE_DECC = 0 -$ MAY_USE_GNUC = 1 -$ ENDIF -$ IF (curr_arg .eqs. "VMSCLI") .or. (curr_arg .eqs. "CLI") -$ THEN -$ CLI_IS_DEFAULT = 1 -$ ENDIF -$ IF (curr_arg .eqs. "NOVMSCLI") .or. (curr_arg .eqs. "NOCLI") -$ THEN -$ CLI_IS_DEFAULT = 0 -$ ENDIF -$ 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 -$ ! -$ my_name = f$env("procedure") -$ workdir = f$env("default") -$ here = f$parse(workdir,,,"device") + f$parse(workdir,,,"directory") -$ axp = f$getsyi("HW_MODEL").ge.1024 -$ if axp -$ then -$ ! Alpha AXP -$ ARCH_NAME == "Alpha" -$ ARCH_PREF = "AXP_" -$ HAVE_DECC_VAX = 0 -$ USE_DECC_VAX = 0 -$ IF (f$search("SYS$DISK:[]ZIP.''ARCH_PREF'OLB").eqs."") -$ THEN -$ say "Cannot find any AXP object library for Zip." -$ say " You must keep all binary files of the object distribution" -$ say " in the current directory !" -$ goto error -$ ENDIF -$ if MAY_USE_GNUC -$ then say "Up to now, the GNU C ports available on OpenVMS AXP" -$ say "contain so many nasty bugs and lack support for a number of" -$ say "required VMS specific features." -$ say "These design flaws make it impossible to compile Zip -$ say "using GCC, sorry." -$ goto error -$ endif -$ ARCH_CC_P = ARCH_PREF -$ opts = "" -$ say "Linking on AXP using DEC C" -$ else -$ ! VAX -$ ARCH_NAME == "VAX" -$ ARCH_PREF = "VAX_" -$ ! check which object libraries are present: -$ HAVE_DECC_VAX =(f$search("SYS$DISK:[]ZIP.''ARCH_PREF'DECC_OLB").nes."") -$ HAVE_VAXC_VAX =(f$search("SYS$DISK:[]ZIP.''ARCH_PREF'VAXC_OLB").nes."") -$ HAVE_GNUC_VAX =(f$search("SYS$DISK:[]ZIP.''ARCH_PREF'GNUC_OLB").nes."") -$ IF .not.HAVE_DECC_VAX .and. .not.HAVE_VAXC_VAX .and. .not.HAVE_GNUC_VAX -$ THEN -$ say "Cannot find any VAX object library for Zip." -$ say " You must keep all binary files of the object distribution" -$ say " in the current directory !" -$ goto error -$ ENDIF -$ IF HAVE_DECC_VAX .AND. MAY_USE_DECC -$ THEN -$ ! We use DECC: -$ USE_DECC_VAX = 1 -$ ARCH_CC_P = "''ARCH_PREF'DECC_" -$ opts = "" -$ say "Linking on VAX using DEC C" -$ ELSE -$ ! We use VAXC (or GNU C): -$ USE_DECC_VAX = 0 -$ opts = ",SYS$DISK:[.VMS]VAXCSHR.OPT/OPTIONS" -$ if HAVE_GNUC_VAX .and. (.not.HAVE_VAXC_VAX .or. MAY_USE_GNUC) -$ then -$ ARCH_CC_P = "''ARCH_PREF'GNUC_" -$ opts = ",GNU_CC:[000000]GCCLIB.OLB/LIB ''opts'" -$ say "Linking on VAX using GNU C" -$ else -$ ARCH_CC_P = "''ARCH_PREF'VAXC_" -$ say "Linking on VAX using VAX C" -$ endif -$ ENDIF -$ endif -$ LFLAGS = "/notrace" -$ if (opts .nes. "") .and. - - (f$locate("VAXCSHR",f$edit(opts,"UPCASE")) .lt. f$length(opts)) .and. - - (f$search("[.vms]vaxcshr.opt") .eqs. "") -$ then create [.vms]vaxcshr.opt -$ open/append tmp [.vms]vaxcshr.opt -$ write tmp "SYS$SHARE:VAXCRTL.EXE/SHARE" -$ close tmp -$ endif -$ set verify ! like "echo on", eh? -$ ! -$ !------------------------------- Zip section -------------------------------- -$ ! -$ link'LFLAGS'/exe='zipx_unx'.'ARCH_CC_P'exe - - zip.'ARCH_CC_P'olb;/incl=(zip,globals)/lib 'opts' -$ ! -$ !------------------------ Zip (CLI interface) section ----------------------- -$ ! -$ link'LFLAGS'/exe='zipx_cli'.'ARCH_CC_P'exe - - zipcli.'ARCH_CC_P'olb;/incl=(zip)/lib, - - zip.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts' -$ ! -$ !-------------------------- Zip utilities section --------------------------- -$ ! -$ link'LFLAGS'/exe=zipcloak.'ARCH_CC_P'exe zipcloak.'ARCH_CC_P'obj, - - ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts' -$ link'LFLAGS'/exe=zipnote.'ARCH_CC_P'exe zipnote.'ARCH_CC_P'obj, - - ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts' -$ link'LFLAGS'/exe=zipsplit.'ARCH_CC_P'exe zipsplit.'ARCH_CC_P'obj, - - ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts' -$ ! -$ !----------------------------- Symbols section ------------------------------ -$ ! -$ ! Set up symbols for the various executables. Edit the example below, -$ ! changing "disk:[directory]" as appropriate. -$ ! -$ zip == "$''here'''ZIPEXEC'.''ARCH_CC_P'exe" -$ zipcloak == "$''here'zipcloak.''ARCH_CC_P'exe" -$ zipnote == "$''here'zipnote.''ARCH_CC_P'exe" -$ zipsplit == "$''here'zipsplit.''ARCH_CC_P'exe" -$ ! -$error: -$ if here .nes. "" then set default 'here' -$ dummy = f$verify(OLD_VERIFY) -$ exit diff --git a/vms/make_zip.com b/vms/make_zip.com deleted file mode 100755 index cb7358b..0000000 --- a/vms/make_zip.com +++ /dev/null @@ -1,287 +0,0 @@ -$ ! MAKE_ZIP.COM -$ ! -$ ! "Makefile" for VMS versions of Zip, ZipCloak, ZipNote, -$ ! and ZipSplit (stolen from Unzip) -$ ! -$ ! Command args: -$ ! - select compiler environment: "VAXC", "DECC", "GNUC" -$ ! - 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" -$ ! -$ ! To define additional options, define the global symbol -$ ! LOCAL_ZIP prior to executing MAKE_ZIP.COM, e.g.: -$ ! -$ ! $ LOCAL_ZIP == "VMS_IM_EXTRA," -$ ! $ @MAKE_ZIP -$ ! -$ ! The trailing "," may be omitted. Valid VMS-specific options -$ ! include VMS_PK_EXTRA and VMS_IM_EXTRA; see the INSTALL file -$ ! for other options. -$ ! NOTE: This command procedure does always generate both the -$ ! "default" Zip containing the UNIX style command interface -$ ! and the "VMSCLI" Zip containing the CLI compatible command -$ ! interface. There is no need to add "VMSCLI" to the LOCAL_ZIP -$ ! symbol. (The only effect of "VMSCLI" is now 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 -$! 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. -$ pos_cli = f$locate("VMSCLI",local_zip) -$ len_local_zip = f$length(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 -$ delete/symbol/local len_local_zip -$!##################### Customizing section ############################# -$! -$ zipx_unx = "zip" -$ zipx_cli = "zip_cli" -$! -$ MAY_USE_DECC = 1 ! Use DEC C when its presence is detected -$ MAY_USE_GNUC = 0 ! Do not prefer GNUC over DEC or VAX C -$! -$! 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 curr_arg .eqs. "VAXC" -$ THEN MAY_USE_DECC = 0 -$ MAY_USE_GNUC = 0 -$ ENDIF -$ IF curr_arg .eqs. "DECC" -$ THEN MAY_USE_DECC = 1 -$ MAY_USE_GNUC = 0 -$ ENDIF -$ IF curr_arg .eqs. "GNUC" -$ THEN MAY_USE_DECC = 0 -$ MAY_USE_GNUC = 1 -$ ENDIF -$ IF (curr_arg .eqs. "VMSCLI") .or. (curr_arg .eqs. "CLI") -$ THEN -$ CLI_IS_DEFAULT = 1 -$ ENDIF -$ IF (curr_arg .eqs. "NOVMSCLI") .or. (curr_arg .eqs. "NOCLI") -$ THEN -$ CLI_IS_DEFAULT = 0 -$ ENDIF -$ 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 -$ ! -$ my_name = f$env("procedure") -$ workdir = f$env("default") -$ here = f$parse(workdir,,,"device") + f$parse(workdir,,,"directory") -$ axp = f$getsyi("HW_MODEL").ge.1024 -$ if axp -$ then -$ ! Alpha AXP -$ ARCH_NAME == "Alpha" -$ ARCH_PREF = "AXP_" -$ HAVE_DECC_VAX = 0 -$ USE_DECC_VAX = 0 -$ HAVE_DECC_AXP = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes."") -$ MAY_HAVE_GNUC = (f$trnlnm("GNU_CC_VERSION").nes."") -$ IF (.not.HAVE_DECC_AXP .and. MAY_HAVE_GNUC) .or. (MAY_USE_GNUC) -$ THEN say "Up to now, the GNU C ports available on OpenVMS AXP" -$ say "contain so many nasty bugs and lack support for a number of" -$ say "required VMS specific features." -$ say "These design flaws make it impossible to compile Zip -$ say "using GCC, sorry." -$ goto error -$ ENDIF -$ ! We use DECC: -$ USE_DECC_AXP = 1 -$ ARCH_CC_P = ARCH_PREF -$ cc = "cc/standard=relax/prefix=all/ansi" -$ defs = "''local_zip'VMS" -$ opts = "" -$ say "Compiling on AXP using DEC C" -$ else -$ ! VAX -$ ARCH_NAME == "VAX" -$ ARCH_PREF = "VAX_" -$ 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/standard=vaxc/prefix=all" -$ ARCH_CC_P = "''ARCH_PREF'DECC_" -$ defs = "''local_zip'VMS" -$ opts = "" -$ say "Compiling on VAX using DEC C" -$ ELSE -$ ! We use VAXC (or GNU C): -$ USE_DECC_VAX = 0 -$ defs = "''local_zip'VMS" -$ opts = ",SYS$DISK:[.VMS]VAXCSHR.OPT/OPTIONS" -$ if (.not.HAVE_VAXC_VAX .and. MAY_HAVE_GNUC) .or. (MAY_USE_GNUC) -$ then -$ ARCH_CC_P = "''ARCH_PREF'GNUC_" -$ cc = "gcc" -$ opts = ",GNU_CC:[000000]GCCLIB.OLB/LIB ''opts'" -$ say "Compiling on VAX using GNU C" -$ else -$ ARCH_CC_P = "''ARCH_PREF'VAXC_" -$ if HAVE_DECC_VAX -$ then -$ cc = "cc/vaxc" -$ else -$ cc = "cc" -$ endif -$ say "Compiling on VAX using VAX C" -$ endif -$ ENDIF -$ endif -$ DEF_UNX = "/def=(''DEFS')" -$ DEF_CLI = "/def=(''DEFS',VMSCLI)" -$ DEF_UTIL = "/def=(''DEFS',UTIL)" -$ LFLAGS = "/notrace" -$ if (opts .nes. "") .and. - - (f$locate("VAXCSHR",f$edit(opts,"UPCASE")) .lt. f$length(opts)) .and. - - (f$search("[.vms]vaxcshr.opt") .eqs. "") -$ then create [.vms]vaxcshr.opt -$ open/append tmp [.vms]vaxcshr.opt -$ write tmp "SYS$SHARE:VAXCRTL.EXE/SHARE" -$ close tmp -$ endif -$ set verify ! like "echo on", eh? -$ ! -$ !------------------------------- Zip section -------------------------------- -$ ! -$ runoff/out=zip.hlp [.vms]vms_zip.rnh -$ ! -$ cc 'DEF_UNX' /obj=zip.'ARCH_CC_P'obj zip.c -$ cc 'DEF_UNX' /obj=crc32.'ARCH_CC_P'obj crc32.c -$ cc 'DEF_UNX' /obj=crctab.'ARCH_CC_P'obj crctab.c -$ cc 'DEF_UNX' /obj=crypt.'ARCH_CC_P'obj crypt.c -$ cc 'DEF_UNX' /obj=ttyio.'ARCH_CC_P'obj ttyio.c -$ cc 'DEF_UNX' /obj=zipfile.'ARCH_CC_P'obj zipfile.c -$ cc 'DEF_UNX' /obj=zipup.'ARCH_CC_P'obj zipup.c -$ cc 'DEF_UNX' /obj=fileio.'ARCH_CC_P'obj fileio.c -$ cc 'DEF_UNX' /obj=globals.'ARCH_CC_P'obj globals.c -$ cc 'DEF_UNX' /obj=util.'ARCH_CC_P'obj util.c -$ cc 'DEF_UNX' /obj=deflate.'ARCH_CC_P'obj deflate.c -$ cc 'DEF_UNX' /obj=trees.'ARCH_CC_P'obj trees.c -$ cc 'DEF_UNX' /obj=vmszip.'ARCH_CC_P'obj/inc=SYS$DISK:[] [.vms]vmszip.c -$ cc 'DEF_UNX' /obj=vms.'ARCH_CC_P'obj/inc=SYS$DISK:[] [.vms]vms.c -$ cc 'DEF_UNX' /obj=vmsmunch.'ARCH_CC_P'obj/inc=SYS$DISK:[] [.vms]vmsmunch.c -$ ! -$ if f$search("zip.''ARCH_CC_P'olb") .eqs. "" then - - lib/obj/create zip.'ARCH_CC_P'olb -$ lib/obj/replace zip.'ARCH_CC_P'olb - - zip.'ARCH_CC_P'obj;, - - crc32.'ARCH_CC_P'obj;, crctab.'ARCH_CC_P'obj;, - - crypt.'ARCH_CC_P'obj;, ttyio.'ARCH_CC_P'obj;, - - zipfile.'ARCH_CC_P'obj;, zipup.'ARCH_CC_P'obj;, - - fileio.'ARCH_CC_P'obj;, util.'ARCH_CC_P'obj;, globals.'ARCH_CC_P'obj;,- - deflate.'ARCH_CC_P'obj;, trees.'ARCH_CC_P'obj;, - - vmszip.'ARCH_CC_P'obj;, vms.'ARCH_CC_P'obj;, - - vmsmunch.'ARCH_CC_P'obj; -$ ! -$ link'LFLAGS'/exe='zipx_unx'.'ARCH_CC_P'exe - - zip.'ARCH_CC_P'olb;/incl=(zip,globals)/lib 'opts' -$ ! -$ !------------------------ Zip (CLI interface) section ----------------------- -$ ! -$ set default [.vms] -$ edit/tpu/nosection/nodisplay/command=cvthelp.tpu zip_cli.help -$ set default [-] -$ runoff/out=zip_cli.hlp [.vms]zip_cli.rnh -$ ! -$ cc 'DEF_CLI' /obj=zipcli.'ARCH_CC_P'obj zip.c -$ cc 'DEF_CLI'/INCLUDE=SYS$DISK:[] /OBJ=cmdline.'ARCH_CC_P'obj - - [.vms]cmdline.c -$ set command/obj=zip_cli.'ARCH_CC_P'obj [.vms]zip_cli.cld -$ ! -$ if f$search("zipcli.''ARCH_CC_P'olb") .eqs. "" then - - lib/obj/create zipcli.'ARCH_CC_P'olb -$ lib/obj/replace zipcli.'ARCH_CC_P'olb - - zipcli.'ARCH_CC_P'obj;, - - cmdline.'ARCH_CC_P'obj;, zip_cli.'ARCH_CC_P'obj; -$ ! -$ link'LFLAGS'/exe='zipx_cli'.'ARCH_CC_P'exe - - zipcli.'ARCH_CC_P'olb;/incl=(zip)/lib, - - zip.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts' -$ ! -$ !-------------------------- Zip utilities section --------------------------- -$ ! -$ cc 'DEF_UTIL' /obj=zipfile_.'ARCH_CC_P'obj zipfile.c -$ cc 'DEF_UTIL' /obj=fileio_.'ARCH_CC_P'obj fileio.c -$ cc 'DEF_UTIL' /obj=util_.'ARCH_CC_P'obj util.c -$ cc 'DEF_UTIL' /obj=crypt_.'ARCH_CC_P'obj crypt.c -$ cc 'DEF_UTIL'/incl=SYS$DISK:[] /obj=vms_.'ARCH_CC_P'obj [.vms]vms.c -$ if f$search("ziputils.''ARCH_CC_P'olb") .eqs. "" then - - lib/obj/create ziputils.'ARCH_CC_P'olb -$ lib/obj/replace ziputils.'ARCH_CC_P'olb - - zipfile_.'ARCH_CC_P'obj;, fileio_.'ARCH_CC_P'obj;, - - util_.'ARCH_CC_P'obj;, globals.'ARCH_CC_P'obj;, - - crctab.'ARCH_CC_P'obj;, crypt_.'ARCH_CC_P'obj;, ttyio.'ARCH_CC_P'obj;,- - vms_.'ARCH_CC_P'obj;, vmsmunch.'ARCH_CC_P'obj; -$ cc 'DEF_UNX' /obj=zipcloak.'ARCH_CC_P'obj zipcloak.c -$ cc 'DEF_UNX' /obj=zipnote.'ARCH_CC_P'obj zipnote.c -$ cc 'DEF_UNX' /obj=zipsplit.'ARCH_CC_P'obj zipsplit.c -$ link'LFLAGS'/exe=zipcloak.'ARCH_CC_P'exe zipcloak.'ARCH_CC_P'obj, - - ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts' -$ link'LFLAGS'/exe=zipnote.'ARCH_CC_P'exe zipnote.'ARCH_CC_P'obj, - - ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts' -$ link'LFLAGS'/exe=zipsplit.'ARCH_CC_P'exe zipsplit.'ARCH_CC_P'obj, - - ziputils.'ARCH_CC_P'olb;/incl=(globals)/lib 'opts' -$ ! -$ !----------------------------- Symbols section ------------------------------ -$ ! -$ ! Set up symbols for the various executables. Edit the example below, -$ ! changing "disk:[directory]" as appropriate. -$ ! -$ zip == "$''here'''ZIPEXEC'.''ARCH_CC_P'exe" -$ zipcloak == "$''here'zipcloak.''ARCH_CC_P'exe" -$ zipnote == "$''here'zipnote.''ARCH_CC_P'exe" -$ zipsplit == "$''here'zipsplit.''ARCH_CC_P'exe" -$ ! -$error: -$ if here .nes. "" then set default 'here' -$ dummy = f$verify(OLD_VERIFY) -$ exit diff --git a/vms/makefile.vms b/vms/makefile.vms deleted file mode 100644 index 99eb179..0000000 --- a/vms/makefile.vms +++ /dev/null @@ -1,251 +0,0 @@ -#============================================================================ -# Makefile for VMS Zip, ZipCloak, ZipNote and ZipSplit Greg Roelofs -# Version: 2.0 [for use with Todd Aven's MAKE/VMS 3.4] 25-JUN-1998 -#============================================================================ - -# ChangeLog: 10-SEP-1993 08:53 by Hunter Goatley (add AXP support) -# 15-OCT-1995 22:40 by Chr. Spieler (Zip 2.1) -# 11-DEC-1995 12:09 by Chr. Spieler (AXP uses RELAXED_ANSI mode) -# 08-JAN-1996 19:08 by Chr. Spieler (updated header dependencies) -# 16-JAN-1996 19:08 by Chr. Spieler (crypt -> crypt & ttyio) -# 25-JUL-1997 22:25 by Chr. Spieler (syncronized with descrip.mms) -# 25-JUN-1998 23:53 by Chr. Spieler (removed bits.c source) - - -########################### USER CUSTOMIZATION ############################ -# add any optional preprocessor flags (macros) to the following line -# for a custom version (do not forget a trailing comma##): -COMMON_DEFS = -######################## END OF USER CUSTOMIZATION ######################## - -##################### -# MACRO DEFINITIONS # -##################### - -CFLAGS = /NOLIST/INCL=(SYS$DISK:[]) -CC = cc -LIB = -# Define the macro __GNUC__ to use the GNU compiler (also add /undef=__STDC__ -# to CFLAGS, and possibly replace /obj=$@ [below] with copy/rename/delete -# setup). NOT TESTED. - -OPTFILE = sys$disk:[.vms]vaxcshr.opt - -%IFDEF __ALPHA -CC = CC/STANDARD=RELAX/PREFIX=ALL/ANSI -E = .AXP_EXE -O = .AXP_OBJ -OPTFILE_LIST = -OPTIONS = -%ELSE -%IFDEF __DECC__ -CC = CC/DECC/STANDARD=VAXC/PREFIX=ALL -E = .VAX_DECC_exe -O = .VAX_DECC_obj -OPTFILE_LIST = -OPTIONS = -%ELSE -%IFDEF __GNUC__ -CC = gcc -E = .VAX_GNUC_exe -O = .VAX_GNUC_obj -LIB = gnu_cc:[000000]gcclib.olb/lib, -%ELSE -E = .VAX_VAXC_exe -O = .VAX_VAXC_obj -%ENDIF -OPTFILE_LIST = ,$(OPTFILE) -OPTIONS = ,$(OPTFILE)/OPTIONS -%ENDIF -%ENDIF - -CFLAGS_ALL = $(CFLAGS) /def=($(COMMON_DEFS) VMS) -CFLAGS_CLI = $(CFLAGS) /def=($(COMMON_DEFS) VMSCLI, VMS) -CFLAGS_UTIL = $(CFLAGS) /def=($(COMMON_DEFS) UTIL, VMS) -LD = LINK -LDFLAGS = /NOTRACE - -# object file lists -OBJM = zip$O, zipcli$O -OBJZ = crc32$O, crctab$O, crypt$O, ttyio$O,- - zipfile$O, zipup$O, fileio$O, globals$O, util$O -OBJV = vmszip$O, vms$O, vmsmunch$O -OBJI = deflate$O, trees$O -OBJU = zipfile_$O, fileio_$O, globals$O,- - util_$O, vms_$O, vmsmunch$O -OBJR = crctab$O, crypt_$O, ttyio$O -OBJC = zipcloak$O, $(OBJR), $(OBJU) -OBJN = zipnote$O, $(OBJU) -OBJS = zipsplit$O, $(OBJU) - -ZIPX_UNX = zip -ZIPX_CLI = zip_cli -OBJSZIPLIB = $(OBJZ), $(OBJI), $(OBJV) -OBJSZIP = zip$O, $(OBJSZIPLIB) -OBJSCLI = zipcli$O, zip_cli$O, cmdline$O -OBJSZIP_CLI = $(OBJSCLI), $(OBJSZIPLIB) -ZIPHELP_UNX_RNH = [.vms]vms_zip.rnh -ZIPHELP_CLI_RNH = [.vms]zip_cli.rnh - -ZIP_H = zip.h ziperr.h tailor.h [.vms]osdep.h - -ZIPS = $(ZIPX_UNX)$E $(ZIPX_CLI)$E zipcloak$E zipnote$E zipsplit$E -ZIPHELPS = $(ZIPX_UNX).hlp $(ZIPX_CLI).hlp - -############################################### -# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES # -############################################### - -default : $(ZIPS) $(ZIPHELPS) - - -# suffix rules -*$O: *.c # `*.c' necessary? - $(CC)$(CFLAGS_ALL)/OBJECT=$@ $< - -*.hlp: *.rnh - runoff /out=$@ $< - - -# executables makerules (trailing `$' makes line a data line) -$(ZIPX_UNX)$E : $(OBJSZIP) $(OPTFILE_LIST) - $(LD) $(LDFLAGS)/EXEC=$(ZIPX_UNX)$E $(OBJSZIP) $(LIB) $(OPTIONS) - -$(ZIPX_CLI)$E : $(OBJSZIP_CLI) $(OPTFILE_LIST) - $(LD) $(LDFLAGS)/EXEC=$(ZIPX_CLI)$E $(OBJSZIP_CLI) $(LIB) $(OPTIONS) - -zipcloak$E : $(OBJC) $(OPTFILE_LIST) - $(LD) $(LDFLAGS)/EXEC=ZIPCLOAK$E $(OBJC) $(LIB) $(OPTIONS) - -zipnote$E : $(OBJN) $(OPTFILE_LIST) - $(LD) $(LDFLAGS)/EXEC=ZIPNOTE$E $(OBJN) $(LIB) $(OPTIONS) - -zipsplit$E : $(OBJS) $(OPTFILE_LIST) - $(LD) $(LDFLAGS)/EXEC=ZIPSPLIT$E $(OBJS) $(LIB) $(OPTIONS) - -$(OPTFILE) : - open/write tmp $(OPTFILE) - write tmp "SYS$SHARE:VAXCRTL.EXE/SHARE" - close tmp - -$(ZIPHELP_CLI_RNH) : [.vms]zip_cli.help - set default [.vms] - edit/tpu/nosection/nodisplay/command=cvthelp.tpu zip_cli.help - set default [-] - -$(ZIPX_UNX).hlp : $(ZIPHELP_UNX_RNH) - runoff /out=$@ $< - -$(ZIPX_CLI).hlp : $(ZIPHELP_CLI_RNH) - -# dependencies for zip, zipnote, zipcloak, and zipsplit -vmszip$O : [.vms]vmszip.c [.vms]vmsmunch.h - $(CC)$(CFLAGS_ALL)/OBJECT=vmszip$O [.vms]vmszip.c -vms$O : [.vms]vms.c [.vms]vms_im.c [.vms]vms_pk.c \ - [.vms]vms.h [.vms]vmsdefs.h - $(CC)$(CFLAGS_ALL)/OBJECT=vms$O [.vms]vms.c -vmsmunch$O : [.vms]vmsmunch.c [.vms]vmsmunch.h [.vms]vmsdefs.h - $(CC)$(CFLAGS_ALL)/OBJECT=vmsmunch$O [.vms]vmsmunch.c -zipcli$O : zip.c [.vms]vmsmunch.h - $(CC) $(CFLAGS_CLI) /OBJ=$(MMS$TARGET) $< -cmdline$O : [.vms]cmdline.c $(ZIP_H) crypt.h revision.h - $(CC) $(CFLAGS_CLI) /OBJ=$(MMS$TARGET) $< -zip_cli$O : [.vms]zip_cli.cld - -crypt_$O : crypt.c crypt.h ttyio.h - $(CC)$(CFLAGS_UTIL)/OBJECT=crypt_$O crypt.c -zipfile_$O : zipfile.c [.vms]vmsmunch.h [.vms]vmsdefs.h - $(CC)$(CFLAGS_UTIL)/OBJECT=zipfile_$O zipfile.c -fileio_$O : fileio.c - $(CC)$(CFLAGS_UTIL)/OBJECT=fileio_$O fileio.c -util_$O : util.c - $(CC)$(CFLAGS_UTIL)/OBJECT=util_$O util.c -vms_$O : [.vms]vms.c [.vms]vms_im.c [.vms]vms_pk.c \ - [.vms]vms.h [.vms]vmsdefs.h - $(CC)$(CFLAGS_UTIL)/OBJECT=vms_$O [.vms]vms.c - -$(OBJM) zipcloak$O zipnote$O zipsplit$O zipup$O : revision.h -$(OBJM) zipcloak$O zipup$O crypt$O ttyio$O : crypt.h -$(OBJM) zipcloak$O crypt$O ttyio$O : ttyio.h -zipup$O : [.vms]zipup.h -zipfile$O : [.vms]vmsmunch.h [.vms]vmsdefs.h -zip$O : [.vms]vmsmunch.h -$(OBJM) : $(ZIP_H) -$(OBJZ) : $(ZIP_H) -$(OBJI) : $(ZIP_H) -$(OBJN) : $(ZIP_H) -$(OBJS) : $(ZIP_H) -$(OBJC) : $(ZIP_H) - -clean.com : - @ open/write tmp $@ - @ write tmp "$!" - @ write tmp "$! Clean.com -- procedure to delete files. It always returns success" - @ write tmp "$! status despite any error or warnings. Also it extracts" - @ write tmp "$! filename from MMS ""module=file"" format." - @ write tmp "$!" - @ write tmp "$ on control_y then goto ctly" - @ write tmp "$ if p1.eqs."""" then exit 1" - @ write tmp "$ i = -1" - @ write tmp "$scan_list:" - @ write tmp "$ i = i+1" - @ write tmp "$ item = f$elem(i,"","",p1)" - @ write tmp "$ if item.eqs."""" then goto scan_list" - @ write tmp "$ if item.eqs."","" then goto done ! End of list" - @ write tmp "$ item = f$edit(item,""trim"") ! Clean of blanks" - @ write tmp "$ wild = f$elem(1,""="",item)" - @ write tmp "$ show sym wild" - @ write tmp "$ if wild.eqs.""="" then wild = f$elem(0,""="",item)" - @ write tmp "$ vers = f$parse(wild,,,""version"",""syntax_only"")" - @ write tmp "$ if vers.eqs."";"" then wild = wild - "";"" + "";*""" - @ write tmp "$scan:" - @ write tmp "$ f = f$search(wild)" - @ write tmp "$ if f.eqs."""" then goto scan_list" - @ write tmp "$ on error then goto err" - @ write tmp "$ on warning then goto warn" - @ write tmp "$ delete/log 'f'" - @ write tmp "$warn:" - @ write tmp "$err:" - @ write tmp "$ goto scan" - @ write tmp "$done:" - @ write tmp "$ctly:" - @ write tmp "$ exit 1" - @ close tmp - -clean : clean.com - @clean "$(OBJM)" - @clean "$(OBJZ)" - @clean "$(OBJI)" - @clean "$(OBJV)" - @clean "$(OBJU)" - @clean "$(OBJR)" - @clean "$(OBJN)" - @clean "$(OBJS)" - @clean "$(OBJC)" - @clean "$(ZIPS)" - @clean "$(ZIPHELP_CLI_RNH)" - @clean "$(ZIPHELPS)" - - delete/noconfirm/nolog clean.com;* - - -# the backslash '\' is the continuation character if it occurs as -# the last non-white character on the line. -# the hyphen '-' is the DCL continuation character, so if it occurs -# as the last non-white character on the line, the next line will -# not have the dollar sign '$' prepended. - - -################################ -# INDIVIDUAL MACHINE MAKERULES # -################################ - -generic : default # first try if unknown -generic2 : default # second try if unknown -vax : default -vms : default - -all : $(ZIPS) -zip : zip$E -zipcloak : zipcloak$E -zipnote : zipnote$E -zipsplit : zipsplit$E 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 index 77aee44..d7a07a4 100644 --- a/vms/osdep.h +++ b/vms/osdep.h @@ -1,9 +1,9 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 @@ -27,14 +27,61 @@ # define NO_FCNTL_H /* VAXC does not supply fcntl.h. */ #endif /* VAX C */ -#define NO_UNISTD_H - #define USE_CASE_MAP -#define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \ - procname(n, 1)) +#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) @@ -48,6 +95,18 @@ # 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 @@ -61,12 +120,25 @@ # define VMS_PK_EXTRA 1 /* PK style VMS support is default */ #endif -#define unlink delete -#define NO_SYMLINK +/* 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. */ 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 */ + @@ -1,9 +1,9 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 */ /* @@ -15,7 +15,7 @@ * vms_stat() added - version of stat() that handles special * case when end-of-file-block == 0 * - * 2.3.1 11-oct-2004 SMS + * 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 @@ -28,9 +28,10 @@ #ifdef VMS /* For VMS only ! */ -#define NO_ZIPUP_H /* prevent inclusion of vms/zipup.h */ +#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> @@ -39,6 +40,7 @@ #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. @@ -64,7 +66,7 @@ # include "vms.h" -#else /* def UTIL */ +#else /* not UTIL */ /* Include the `VMS attributes' preserving file-io code. We distinguish between two incompatible flavours of storing VMS attributes in the @@ -84,7 +86,7 @@ #include "vms_pk.c" #include "vms_im.c" -#endif /* def UTIL */ +#endif /* not UTIL [else] */ #ifndef ERR #define ERR(x) (((x)&1)==0) @@ -94,13 +96,12 @@ #define NULL (void*)(0L) #endif -int vms_stat(file,s) -char *file; -stat_t *s; +int vms_stat( char *file, stat_t *s) { int status; int staterr; struct FAB fab; + struct NAM_STRUCT nam; struct XABFHC fhc; /* @@ -123,11 +124,21 @@ stat_t *s; */ fab = cc$rms_fab; + nam = CC_RMS_NAM; fhc = cc$rms_xabfhc; - fab.fab$l_fna = file; - fab.fab$b_fns = strlen(file); + 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); @@ -151,49 +162,105 @@ stat_t *s; 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; { -/*--------------------------------------------------------------------------- - Return an intelligent status/severity level if RETURN_SEVERITY defined: - - $STATUS $SEVERITY = $STATUS & 7 - 31 .. 16 15 .. 3 2 1 0 - ----- - VMS 0 0 0 0 Warning - FACILITY 0 0 1 1 Success - Number 0 1 0 2 Error - MESSAGE 0 1 1 3 Information - Number 1 0 0 4 Severe (fatal) error - - 0x7FFF0000 was chosen (by experimentation) to be outside the range of - VMS FACILITYs that have dedicated message numbers. Hopefully this will - always result in silent exits--it does on VMS 5.4. Note that the C li- - brary translates exit arguments of zero to a $STATUS value of 1 (i.e., - exit is both silent and has a $SEVERITY of "success"). - ---------------------------------------------------------------------------*/ { - int severity; - - switch (e) { /* $SEVERITY: */ - case ZE_NONE: - severity = 0; break; /* warning */ - case ZE_FORM: - case ZE_BIG: - case ZE_NOTE: - case ZE_ABORT: - case ZE_NAME: - case ZE_PARMS: - case ZE_OPEN: - severity = 2; break; /* error */ - default: - severity = 4; break; /* fatal */ - } +#ifndef OLD_STATUS - exit( /* $SEVERITY: */ - (e == ZE_OK) ? 1 : /* success */ - (0x7FFF0000 | (e << 4) | severity) /* warning, error, fatal */ + /* + * 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 */ } } @@ -209,7 +276,7 @@ void version_local() char *chrp1; char *chrp2; char buf[40]; - char vms_vers[16]; + char vms_vers[ 16]; int ver_maj; #endif #ifdef __DECC_VER @@ -226,10 +293,10 @@ void version_local() /* 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'); + chrp1 = strchr( &vms_vers[ 1], '.'); + for (chrp2 = &vms_vers[ 1]; + chrp2 < chrp1; + ver_maj = ver_maj* 10+ *(chrp2++)- '0'); #endif /* def VMS_VERSION */ @@ -265,7 +332,7 @@ void version_local() # if defined( __alpha) "OpenVMS", (sprintf( buf, " (%s Alpha)", vms_vers), buf), -# elif defined( __IA64) /* defined( __alpha) */ +# elif defined( __ia64) /* defined( __alpha) */ "OpenVMS", (sprintf( buf, " (%s IA64)", vms_vers), buf), # else /* defined( __alpha) */ @@ -304,51 +371,9 @@ void version_local() * actually uses the directory part of the argument or "tempath". */ -/* Define macros for use with either NAM or NAML. */ - -#ifdef NAML$C_MAXRSS /* NAML is available. Use it. */ - -#define NAM_STRUCT NAML - -#define CC_RMS_NAM cc$rms_naml -#define FAB_NAM fab$l_naml -#define NAME nam -#define NAME_DNA naml$l_long_defname -#define NAME_DNS naml$l_long_defname_size -#define NAME_FNA naml$l_long_filename -#define NAME_FNS naml$l_long_filename_size -#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_MAXRSS NAML$C_MAXRSS -#define NAM_NOP naml$b_nop -#define NAM_TYPE naml$l_long_type -#define NAM_M_SYNCHK NAML$M_SYNCHK - -#else /* def NAML$C_MAXRSS */ /* NAML is not available. Use NAM. */ - -#define NAM_STRUCT NAM - -#define CC_RMS_NAM cc$rms_nam -#define FAB_NAM fab$l_nam -#define NAME fab -#define NAME_DNA fab$l_dna -#define NAME_DNS fab$b_dns -#define NAME_FNA fab$l_fna -#define NAME_FNS fab$b_fns -#define NAM_ESA nam$l_esa -#define NAM_ESL nam$l_esl -#define NAM_ESS nam$b_ess -#define NAM_MAXRSS NAM$C_MAXRSS -#define NAM_NOP nam$b_nop -#define NAM_TYPE nam$l_type -#define NAM_M_SYNCHK NAM$M_SYNCHK - -#endif /* def NAML$C_MAXRSS */ - -char *tempname( zip) -char *zip; /* Path name of Zip archive. */ +char *tempname( char *zip) +/* char *zip; */ /* Path name of Zip archive. */ { char *temp_name; /* Return value. */ int sts; /* System service status. */ @@ -366,23 +391,23 @@ char *zip; /* Path name of Zip archive. */ } jpi_itm_lst = { sizeof( pid), JPI$_PID, &pid, &pid_len }; /* ZI<UNIQUE> name storage. */ - static char zip_tmp_nam[16] = "ZI<unique>.;"; + 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. */ + 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)); + 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); + sprintf( &zip_tmp_nam[ 2], "%08X", pid); #endif /* def VMS_UNIQUE_TEMP_BY_TIME */ @@ -407,11 +432,13 @@ char *zip; /* Path name of Zip archive. */ #endif /* def NAML$C_MAXRSS */ - NAME.NAME_DNA = zip; /* Default name = Zip archive name. */ - NAME.NAME_DNS = strlen( NAME.NAME_DNA); + /* 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); - NAME.NAME_FNA = zip_tmp_nam; /* File name = "ZI<unique>,;". */ - NAME.NAME_FNS = strlen( NAME.NAME_FNA); + /* 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. */ @@ -424,12 +451,12 @@ char *zip; /* Path name of Zip archive. */ if ((sts& STS$M_SEVERITY) == STS$M_SUCCESS) { /* Overlay any resulting file type (typically ".ZIP") with none. */ - strcpy( nam.NAM_TYPE, ".;"); + 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); + temp_name = malloc( strlen( nam.NAM_ESA)+ 1); if (temp_name != NULL) { @@ -437,7 +464,174 @@ char *zip; /* Path name of Zip archive. */ } } return temp_name; -} /* tempname() for VMS */ +} /* 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. @@ -452,7 +646,7 @@ char *zip; /* Path name of Zip archive. */ * rab$b_mbf multi-buffer count (used with rah and wbh). */ -#define DIAG_FLAG verbose +#define DIAG_FLAG (verbose >= 2) /* Default RMS parameter values. */ @@ -608,6 +802,8 @@ 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) @@ -707,8 +903,6 @@ decc_feat_t decc_feat_array[] = { /* Preserve command-line case with SET PROCESS/PARSE_STYLE=EXTENDED */ { "DECC$ARGV_PARSE_STYLE", 1 }, -#if 0 /* Possibly useful in the future. */ - /* Preserve case for file names on ODS5 disks. */ { "DECC$EFS_CASE_PRESERVE", 1 }, @@ -716,8 +910,6 @@ decc_feat_t decc_feat_array[] = { while preserving VMS-ness of ";version". */ { "DECC$EFS_CHARSET", 1 }, -#endif /* 0 */ - /* List terminator. */ { (char *)NULL, 0 } }; @@ -738,10 +930,10 @@ decc_init_done = 1; /* Loop through all items in the decc_feat_array[]. */ -for (i = 0; decc_feat_array[i].name != NULL; i++) +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); + feat_index = decc$feature_get_index( decc_feat_array[ i].name); if (feat_index >= 0) { /* Valid item. Collect its properties. */ @@ -749,29 +941,29 @@ for (i = 0; decc_feat_array[i].name != NULL; i++) 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)) + 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) + if (feat_value != decc_feat_array[ i].value) { sts = decc$feature_set_value( feat_index, 1, - decc_feat_array[i].value); + 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); + 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); + printf( " UNKNOWN DECC FEATURE: %s.\n", decc_feat_array[ i].name); } } } @@ -780,20 +972,28 @@ for (i = 0; decc_feat_array[i].name != NULL; i++) #pragma nostandard -/* Establish the LIB$INITIALIZE PSECT, with proper alignment and - attributes. +/* Establish the LIB$INITIALIZE PSECTs, with proper alignment and + other attributes. Note that "nopic" is significant only on VAX. */ -globaldef { "LIB$INITIALIZ" } readonly _align (LONGWORD) - int spare[8] = { 0 }; -globaldef { "LIB$INITIALIZE" } readonly _align (LONGWORD) - void (*x_decc_init)() = decc_init; +#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); + +int LIB$INITIALIZE( void); + #pragma extern_model strict_refdef -int dmy_lib$initialize = (int) lib$initialize; +int dmy_lib$initialize = (int) LIB$INITIALIZE; + #pragma extern_model restore #pragma standard @@ -1,9 +1,9 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 */ /*--------------------------------------------------------------------------- @@ -69,6 +69,87 @@ #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; @@ -268,4 +349,6 @@ struct PK_header #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 index da84945..001088b 100644 --- a/vms/vms_im.c +++ b/vms/vms_im.c @@ -1,9 +1,9 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 */ /* @@ -32,6 +32,8 @@ * 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 ! */ @@ -111,6 +113,7 @@ int set_extra_field(z, z_utim) 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; @@ -171,19 +174,45 @@ int set_extra_field(z, z_utim) */ 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. */ - fab.fab$b_fns = strlen(z->name); - fab.fab$l_fna = z->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 */ + + 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)) @@ -319,10 +348,13 @@ int set_extra_field(z, z_utim) 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; - fab.fab$l_dna = NULL; #ifdef DEBUG dump_rms_block( (uch *)&fab ); @@ -375,10 +407,10 @@ int set_extra_field(z, z_utim) } /* Copy xtra[] data into cxtra[]. */ - memcpy( cxtra, xtra, (scan - xtra)); + memcpy( cxtra, xtra, (scan- xtra)); /* Set sizes and pointers. */ - z->cext = z->ext = scan - xtra; + z->cext = z->ext = scan- xtra; z->extra = (char*) xtra; z->cextra = (char*) cxtra; @@ -433,9 +465,10 @@ typedef struct user_context { ulg sig; struct FAB *fab; + struct NAM_STRUCT *nam; struct RAB *rab; - unsigned int size; - unsigned int rest; + uzoff_t size; + uzoff_t rest; int status; } Ctx, *Ctxptr; @@ -444,6 +477,7 @@ Ctx init_ctx = CTXSIG, NULL, NULL, + NULL, 0L, 0L, 0 @@ -465,46 +499,83 @@ Ctx init_ctx = struct RAB *vms_open(name) char *name; { - struct RAB *rab; struct FAB *fab; + struct NAM_STRUCT *nam; + struct RAB *rab; struct XABFHC *fhc; Ctxptr ctx; - if ((fab = (struct FAB *) malloc(FABL)) == (struct FAB *)NULL) + if ((fab = (struct FAB *) malloc(FABL)) == NULL) return NULL; - if ((rab = (struct RAB *) malloc(RABL)) == (struct RAB *)NULL) + + if ((nam = + (struct NAM_STRUCT *) malloc( sizeof( struct NAM_STRUCT))) == NULL) { free(fab); - return (struct RAB *)NULL; + 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(rab); free(fab); + free(nam); + free(rab); return (struct RAB *)NULL; } if ((ctx = (Ctxptr) malloc(CTXL)) == (Ctxptr)NULL) { - free(fhc); 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$l_fna = name; - fab->fab$b_fns = strlen(name); + 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(fhc); free(fab); + free(nam); free(rab); + free(fhc); free(ctx); return (struct RAB *)NULL; } @@ -516,14 +587,16 @@ struct RAB *vms_open(name) { sys$close(fab); free(fab); + free(nam); free(rab); free(ctx); return (struct RAB *)NULL; } *ctx = init_ctx; - ctx->rab = rab; ctx->fab = fab; + ctx->nam = nam; + ctx->rab = rab; if (fhc->xab$l_ebk == 0) { @@ -531,7 +604,7 @@ struct RAB *vms_open(name) (This occurs with a zero-length file, for example.) */ ctx->size = - ctx->rest = (fhc->xab$l_hbk) * BLOCK_BYTES; + ctx->rest = ((uzoff_t) fhc->xab$l_hbk)* BLOCK_BYTES; } else { @@ -540,11 +613,11 @@ struct RAB *vms_open(name) If -VV, store allocated-blocks size in ->rest. */ ctx->size = - ((fhc->xab$l_ebk)- 1) * BLOCK_BYTES + fhc->xab$w_ffb; + (((uzoff_t) fhc->xab$l_ebk)- 1)* BLOCK_BYTES+ fhc->xab$w_ffb; if (vms_native < 2) ctx->rest = ctx->size; else - ctx->rest = (fhc->xab$l_hbk) * BLOCK_BYTES; + ctx->rest = ((uzoff_t) fhc->xab$l_hbk)* BLOCK_BYTES; } free(fhc); @@ -560,14 +633,17 @@ 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); @@ -600,8 +676,8 @@ int vms_rewind(rab) } -#define KByte (2 * BLOCK_BYTES) -#define MAX_READ_BYTES (32 * KByte) +#define KByte (2* BLOCK_BYTES) +#define MAX_READ_BYTES (32* KByte) /************************** * Function vms_read * @@ -647,7 +723,7 @@ size_t size; /* Round odd-ball request up to the next whole block. This really should never happen. (assert()?) */ - size = (size + BLOCK_BYTES - 1)& ~(BLOCK_BYTES - 1); + size = (size+ BLOCK_BYTES- 1)& ~(BLOCK_BYTES- 1); } /* Reduce "size" when next (last) read would overrun the EOF, 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 index d1467d3..9aa203d 100644 --- a/vms/vms_pk.c +++ b/vms/vms_pk.c @@ -1,9 +1,9 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 */ /* @@ -53,13 +53,18 @@ * 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 2.3.1 20-Oct-2004, Steven Schweda. + * 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 ! */ @@ -72,6 +77,7 @@ #define VMS_ZIP #endif +#include "crc32.h" #include "vms.h" #include "vmsdefs.h" @@ -105,8 +111,8 @@ typedef struct { struct iosb iosb; long vbn; - unsigned int size; - unsigned int rest; + uzoff_t size; + uzoff_t rest; int status; ush chan; ush chan_pad; /* alignment member */ @@ -118,8 +124,8 @@ typedef struct /* Forward declarations of public functions: */ ioctx_t *vms_open(char *file); -size_t vms_read(register ioctx_t *ctx, - register char *buf, register size_t size); +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, @@ -141,23 +147,22 @@ ioctx_t *vms_open(file) char *file; { static struct atrdef Atr[VMS_MAX_ATRCNT+1]; - static struct NAM Nam; + 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$t_dvi[1]}; - static struct dsc$descriptor_s FileName = - {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0}; - static char EName[NAM$C_MAXRSS]; - static char RName[NAM$C_MAXRSS]; + {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; + struct FAB Fab; register ioctx_t *ctx; register struct fatdef *fat; int status; int i; - ulg efblk, hiblk; + ulg efblk; + ulg hiblk; if ( (ctx=(ioctx_t *)malloc(sizeof(ioctx_t))) == NULL ) return NULL; @@ -187,50 +192,95 @@ char *file; Atr[13].atr$w_size = 0; Atr[13].atr$l_addr = GVTC NULL; - /* initialize RMS structures, we need a NAM to retrieve the FID */ + /* Initialize RMS structures. We need a NAM[L] to retrieve the FID. */ Fab = cc$rms_fab; - Fab.fab$l_fna = file ; /* name of file */ - Fab.fab$b_fns = strlen(file); - Fab.fab$l_nam = &Nam; /* FAB has an associated NAM */ - Nam = cc$rms_nam; - Nam.nam$l_esa = EName; /* expanded filename */ - Nam.nam$b_ess = sizeof(EName); - Nam.nam$l_rsa = RName; /* resultant filename */ - Nam.nam$b_rss = sizeof(RName); - - /* do $PARSE and $SEARCH here */ + 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)) return NULL; - /* search for the first file.. If none signal error */ + 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)) return NULL; - /* initialize Device name length, note that this points into the NAM - to get the device name filled in by the $PARSE, $SEARCH services */ - DevDesc.dsc$w_length = Nam.nam$t_dvi[0]; + 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)) return NULL; - FileName.dsc$a_pointer = Nam.nam$l_name; - FileName.dsc$w_length = Nam.nam$b_name+Nam.nam$b_type+Nam.nam$b_ver; + if (!(status & 1)) + { + fprintf( stderr, + " vms_open(): $assign sts = %%x%08x.\n", status); + return NULL; + } - /* Initialize the FIB */ + /* 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$w_fid[i]; - for (i=0;i<3;i++) - Fib.FIB$W_DID[i]=Nam.nam$w_did[i]; - /* 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, &FileName, 0, 0, - Atr, 0); + 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; } @@ -247,7 +297,7 @@ char *file; (This occurs with a zero-length file, for example.) */ ctx -> size = - ctx -> rest = hiblk * BLOCK_BYTES; + ctx -> rest = ((uzoff_t) hiblk)* BLOCK_BYTES; } else { @@ -256,12 +306,12 @@ char *file; If multiple -V, store allocated-blocks size in ->rest. */ ctx -> size = - ((efblk) - 1) * BLOCK_BYTES + fat -> fat$w_ffbyte; + (((uzoff_t) efblk)- 1)* BLOCK_BYTES+ fat -> fat$w_ffbyte; if (vms_native < 2) ctx -> rest = ctx -> size; else - ctx -> rest = hiblk * BLOCK_BYTES; + ctx -> rest = ((uzoff_t) hiblk)* BLOCK_BYTES; } ctx -> status = SS$_NORMAL; @@ -270,8 +320,8 @@ char *file; } -#define KByte (2 * BLOCK_BYTES) -#define MAX_READ_BYTES (32 * KByte) +#define KByte (2* BLOCK_BYTES) +#define MAX_READ_BYTES (32* KByte) /*----------------* | vms_read() | @@ -288,9 +338,9 @@ char *buf; size_t size; { int act_cnt; - int rest_rndup; + uzoff_t rest_rndup; int status; - unsigned int bytes_read = 0; + size_t bytes_read = 0; /* If previous read hit EOF, fail early. */ if (ctx -> status == SS$_ENDOFFILE) @@ -447,12 +497,12 @@ iztimes *z_utim; return ZE_OK; /* skip silently if no valid TZ info */ # endif - if ((xtra = (uch *) malloc( EB_HEADSIZE + EB_UT_LEN( 1))) == NULL) + 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) + if ((cxtra = (uch *) malloc( EB_HEADSIZE+ EB_UT_LEN( 1))) == NULL) return ZE_MEM; - + /* Fill xtra[] with data. */ xtra[ 0] = 'U'; xtra[ 1] = 'T'; @@ -465,10 +515,10 @@ iztimes *z_utim; xtra[ 8] = (byte) (z_utim->mtime >> 24); /* Copy xtra[] data into cxtra[]. */ - memcpy( cxtra, xtra, (EB_HEADSIZE + EB_UT_LEN( 1))); + memcpy( cxtra, xtra, (EB_HEADSIZE+ EB_UT_LEN( 1))); /* Set sizes and pointers. */ - z->cext = z->ext = (EB_HEADSIZE + EB_UT_LEN( 1)); + z->cext = z->ext = (EB_HEADSIZE+ EB_UT_LEN( 1)); z->extra = (char*) xtra; z->cextra = (char*) cxtra; @@ -485,10 +535,10 @@ iztimes *z_utim; if (ctx->acllen > 0) l += PK_FLDHDR_SIZE + ctx->acllen; - if ((xtra = (uch *) malloc(l)) == NULL) + if ((xtra = (uch *) malloc( l)) == NULL) return ZE_MEM; - if ((cxtra = (uch *) malloc(l)) == NULL) + if ((cxtra = (uch *) malloc( l)) == NULL) return ZE_MEM; /* Fill xtra[] with data. */ diff --git a/vms/vms_zip.rnh b/vms/vms_zip.rnh deleted file mode 100644 index c9599b0..0000000 --- a/vms/vms_zip.rnh +++ /dev/null @@ -1,548 +0,0 @@ -.! -.! 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. -.! -.noflags -.lm4 .rm72 -.indent -4 -1 ZIP -.br -Zip is a compression and file packaging utility for Unix, MSDOS, OS/2, and -VMS. It is analogous to a combination of tar and compress and is -compatible with PKZIP (Phil Katz ZIP) for MSDOS systems. -.sk -There is a companion to Zip called UnZip (of course). Zip and UnZip can -work with files produced by PKZIP under MSDOS, and PKZIP and PKUNZIP can -work with files produced by Zip. -.sk -Zip 2.2 is compatible with PKZIP 2.04. -Note that PKUNZIP 1.10 cannot extract files produced by PKZIP 2.04 -or zip 2.2. You must use PKZIP 2.04g or unzip 5.0p1 (or later versions) -to extract them. -.sk -For a brief help on Zip and Unzip, run each without specifying any -parameters on the command line. -.sk -The program 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. -.sk -Zip puts one or more compressed files into a single "zip file", along with -information about the files (name, path, date and time of last modification, -protection, and check information to verify file integrity). Zip can pack -an entire directory structure in a zip file with a single command. -Compression ratios of 2:1 to 3:1 are common for text files. Zip has -one compression method (deflation) and can also store files without -compression. It automatically chooses the better of the two for each file -to be compressed. -.sk -Format: -.sk;.lm+1;.literal -ZIP [-options] [-b path] [-n suffixes] [-t mmddyyyy] [-tt mmddyyyy] - zipfile file(s) [-x list] [-i list] -.end literal;.lm-1 -.!------------------------------------------------------------------------------ -.indent -4 -2 Options -.br -The default action of Zip is to add or replace zipfile entries from list, which -can include the special name -@ to read names from SYS$INPUT. The following -list of options was taken from the on-line help generated when Zip is run -without any command-line parameters: -.sk -.literal - -A adjust self-extracting exe - -b use "path" for temp files - -c add one-line comments - -d delete entries in zipfile - -D do not add directory entries - -e encrypt - -f freshen: only changed files - -F fix zipfile (-FF try harder) - -g allow growing existing zipfile (unless updating or deleting) - -h show the zip help screen - -i include only names matching the following patterns - -i@ include only names matching the patterns in "file" - -j junk (don't record) directory names - -J junk (remove) prepended (SFX) stub - -k simulate PKZIP made zipfile - -l translate end-of-lines (LF -> CRLF) - -ll translate end-of-lines (CRLF -> LF) - -L show software license - -m move into zipfile (delete files) - -n don't compress theses suffixes - -o make zipfile as old as latest entry - -P encrypt with supplied "password" string - -q quiet operation - -r recurse into directories from specified path patterns - -R recurse into subdirs from current dir, match filenames only - -t only do files after "mmddyyyy" - -tt only do files before "mmddyyyy" - -T test zip file integrity (calls unzip) - -u update: only changed or new files - -v verbose messages/print version info - -V save VMS file attributes - -w append the VMS version number to name stored in zip file - -x exclude all names matching the following patterns - -x@ exclude all names matching the patterns in "file" - -X suppress storing of any extra file attributes - -z add zipfile comment - -0 store only - -1 compress faster - -9 compress better - -@ read list of input files from SYS$INPUT -.end literal -.!------------------------------------------------------------------------------ -.indent -4 -2 How_To_Use_Zip -.br -The simplest use of Zip is as follows: -.sk;.indent 10;$ zip stuff * -.sk -This will create the file "STUFF.ZIP" (assuming it does not exist) and put -all the files in the current directory in STUFF.ZIP in a compressed form. -The .ZIP suffix is added automatically, unless the zipfile name given -contains a dot already. This allows specifying suffixes other than ".ZIP". -.sk -To zip up an entire directory, the command: -.sk;.indent 10 -$ zip -r foo *.* -.sk -will create the file "FOO.ZIP" containing all the files and directories in -the in the current directory. The "r" option means recurse through the -directory structure. If you wish to recurse through the subdirectory [x.y] -use the following syntax: -.sk;.indent 10 -zip -r foo [x]y.dir -.sk -You may want to make a zip file 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 -You might be zipping to save disk space, in which case you could: -.sk;.indent 10 -$ zip -rm foo *.txt -.sk -where the "m" option means "move". This will delete all files matching -*.txt after making FOO.ZIP. No deletions will be done until the zip has -completed with no errors. This option is obviously more dangerous and -should be used with care. -.sk -If the zip file already exists, these commands will replace existing or add -new entries to the zip file. For example, if you were really short on disk -space, you might not have enough room simultaneously to hold the directory -[.FOO] and the compressed FOO.ZIP. In this case, you could do it in steps. -If [.FOO] contained the subdirectories [.TOM], [.DICK], and [.HARRY], then -you could: -.sk; -.indent 10;$ zip -rm foo [.foo.tom] -.indent 10;$ zip -rm foo [.foo.dick] -.indent 10;$ zip -rm foo [.foo.harry] -.sk -where the first command would create FOO.ZIP, and the next two would add to -it. At the completion of each zip command, the files in the directory just -zipped would be deleted, making room in which the next Zip command could -work. -.!------------------------------------------------------------------------------ -.indent -4 -2 Modifying_Existing_Zip_Files -.br -When given the name of an existing zip file with the above commands, Zip -will replace identically named entries in the Zip file 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 foo/file1 and -foo/file3, then: -.sk;.indent 10 -$ zip -r 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. -.sk -When changing an existing zip file, Zip will write a temporary file with -the new contents, and only replace the old one when the zip has completed -with no errors. You can use -the -b option to specify a different path (usually a different dev- ice) to -put the temporary files in. For example: -.sk;.indent 10 -$ zip -b scratch$:[tmp] stuff * -.sk -will put the temporary zip file and the temporary compression files in the -directory "SCRATCH$:[TMP]", copying over STUFF.ZIP in the current directory -when done. -.sk -If you are only adding entries to a zip file, not replacing, and the -g -option is given, then Zip grows (appends to) the file instead of copying -it. The danger of this is that if the operation fails, the original zip -file is corrupted and lost. -.sk -There are two other ways to change or add entries in a zip file that are -restrictions of simple addition or replacement. The first is -u (update) -which will add new entries to the zip file as before but will replace -existing entries only if the modified date of the file is more recent than -the date recorded for that name in the zip file. 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 zip file STUFF.ZIP. Note that Zip will not try to pack -STUFF.ZIP into itself when you do this. Zip will always exclude the zip -file from the files on which to be operated. -.sk -The second restriction is -f (freshen) which, like update, will only -replace entries with newer files; unlike update, will not add files that -are not already in the zip file. For this option, you may want to simply -freshen all of the files that are in the specified zip file. To do this -you would simply: -.sk;.indent 10 -$ zip -f foo -.sk -Note that the -f option with no arguments freshens all the entries in the -zip file. The same is true of -u, and hence "zip -u foo" and "zip -f foo" -both do the same thing. -.sk -This command should be run from the same directory from which the original -zip command was run, since paths stored in zip files are always relative. -.sk -Another restriction that can be used with adding, updating, or freshening -is -t (time), which will not operate on files modified earlier than the -specified date. 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 zip file INFAMY.ZIP. -.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 last operation is -d (delete) which will remove entries from a zip -file. 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 -Under VMS, -d is case sensitive when it matches names in the zip file. -This allows deleting names that were zipped on other systems, but requires -that the names be entered in upper case if they were zipped on an MSDOS -system (by PKZIP or in PKZIP compatibility mode), so that the names can be -found in the zip file and deleted. -.!------------------------------------------------------------------------------ -.indent -4 -2 More_Options -.br -As mentioned before, Zip will use the best of two methods: deflate or store. -The option -0 will force Zip to use store on all files. For example: -.sk;.indent 10 -zip -r0 foo foo.dir -.sk -will zip up the directory foo into foo.zip using only store. -.sk -The speed of deflation can also be controlled with options -1 (fastest -method but less compression) to -9 (best compression but slower). The -default value is -6. For example: -.sk;.indent 10 -zip -r8 foo foo.dir -.sk -In nearly all cases, a file that is already compressed cannot be compressed -further by Zip, or if it can, the effect is minimal. The -n option -prevents Zip from trying to compress files that have the -given suffixes. Such files are simply stored (0% -compression) in the -output zip file, so that Zip doesn't waste its time trying to compress -them. The suffixes are separated by -either colons or semicolons. For example, in DCL: -.sk -.indent 10;$ zip -rn ".Z:.zip:.tiff:.gif:.snd" foo [.FOO]*.* -.sk -will put everything in [.FOO] into FOO.ZIP, but will store any files that end -in .Z, .ZIP, .TIFF, .GIF, or .SND without trying to compress them. (Image and -sound files often have their own specialized compression methods.) -The default suffix list is ".Z:.zip;.zoo:.arc:.lzh:.arj". -The environment variable ZIPOPT can be used to change this default. For -example: -.sk -.indent 10;$ ZIPOPT == "-n .Z:.zip:.tiff:.gif:.snd" -.sk -The variable ZIPOPT can be used for any option (except -i and -x) -and can include several options. -.sk -For VMS Zip, the alternatively environment variable name ZIP_OPTS may -be used, if a more "VMS-like" name is prefered. If both ZIPOPT and -ZIP_OPTS are present (and do not equate to whitespace only), -the content of ZIPOPT takes precedence and ZIP_OPTS is ignored. -.sk -Under Unix, Zip will store the full path (relative to the current path) -and name of the file (or just the name if -j is specified) in the zip -file along with the Unix attributes, and it will mark the entry as made -under Unix. If the zip file is intended for PKUNZIP under MSDOS, then -the -k (Katz) option should be used to attempt to convert the names and -paths to conform to MSDOS, store only the MSDOS attribute (just the -user write attribute from Unix), and mark the entry as made under MSDOS -(even though it wasn't). -.sk -The -o (older) option will set the "last modified" time of the zip file to -the latest "last modified" time of the entries in the zip file. This can -be used without any other operations, if desired. For example: -.sk;.indent 10 -$ zip -o foo -.sk -will change the last modified time of FOO.ZIP to the latest time of the -entries in FOO.ZIP. -.sk -The -e and -c options operate on all files updated or added to the zip -file. Encryption (-e) will prompt for a password on the terminal and will -not echo the password as it is typed (if SYS$COMMAND is not a TTY, Zip will -exit with an error). New zip entries will be encrypted using that password. -For added peace of mind, Zip will prompt for the password a second time, -checking that the two inputs are the same before using it. -.sk -One-line comments can be added for each file with the -c option. The zip -file operations (adding or updating) will be done first, and you will then -be prompted for a one-line comment for each file. You can then enter the -comment followed by return, or just return for no comment. -.sk -The -z option will prompt you for a multi-line comment for the entire zip -file. This option can be used by itself, or in combination with other -options. The comment is ended by a line containing just a period, or an -end of file condition (^D on Unix, ^Z on MSDOS, OS/2, and OpenVMS). -.sk -The -q (quiet) option eliminates the informational messages and comment -prompts while Zip is operating. This might be used in shell scripts, for -example, or if the zip operation is being performed as a background task -("$ spawn/nowait zip -q foo *.c"). -.sk -Zip can take a list of file names to operate on from SYS$INPUT using the -"-@" -option. -.! In Unix, this option can be used with the find command to extend -.!greatly the functionality of Zip. For example, to zip up all the C source -.!files in the current directory and its subdirectories, you can: -.!.sk -.!find . -type f -name "*.[ch]" -print | zip source -@ -.!.sk -.!Note that the pattern must be quoted to keep the shell from expanding it. -.sk -The -X option (remember to quote it!) suppresses saving of additional -"extra file attributes" in the zipfile. Its effect is to disable the -VMS only -V option (see below), and prevent storing of UNIX compatible -GMT modification time stamps. These UNIX compatible GMT time stamps --- which are quite useful when transporting Zip archives world wide (but -are only recognized by Info-ZIP's UnZip 5.20 or later) -- -are included in the zipfile unless -X or -V is specified (in case your -version of Zip has the USE_EF_UT_TIME option compiled in). -.sk -Under VMS only, the -w option will append the version number of the files -to the name and zip up multiple versions of files. Without -w, Zip will -only use the most recent version of the specified file(s). -.sk -One more option that valid only under VMS is -V option. This option saves -all (hopefully) file attributes needed to make EXACT copy of the -file after extraction from archive. To extract a file with saved attributes, -use UnZip version 5.20 or later. Note that to specify this option you should -quote it ("-V"). Be carefull: it's rather hard (if possible at all) to extract -a file archived on VMS with this option specified on other systems. See -documentation on UnZip for further information. -.sk -The -l option translates the Unix end-of-line character LF into the -MSDOS convention CR LF. This option should not be used on binary files. -This option can be used on Unix or VMS if the zip file is intended for -PKUNZIP under MSDOS. -.sk -If Zip is run with the -h option, or with no arguments and standard output is -a terminal, the license and the command-argument and option help is shown. -.sk -The -L option shows the Zip license. -.sk -The -v option, when given as the only command line argument, directs Zip to -display diagnostic information that shows when and how the executable was -built and set up. This includes info on used compiler and compiler version -(if available) as well as any optional compile time feature flags. -Additionally, the content of the environment variables -(logical names) read by Zip for runtime configuration are shown. This -information is especially valuable when reporting problems or bugs. -.!------------------------------------------------------------------------------ -.indent -4 -2 Diagnostics -.br - On VMS, Zip's UNIX style exit values are mapped into proper - VMS status codes: -.literal - 1 (success) normal exit, - (0x7fff0000 + 16*Zip_error_level) warnings - (0x7fff0002 + 16*Zip_error_level) normal errors - (0x7fff0004 + 16*Zip_error_level) fatal errors -.end literal - - The Zip error level (or exit code) approximates the exit - codes defined by PKWARE and takes on the following values: -.literal - - VMS Zip Type of error - severity errcode - - 0 normal; no errors or warnings detected. - F 2 unexpected end of zip file. - E 3 a generic error in the zipfile format was - detected. Processing may have completed - successfully anyway; some broken zipfiles - created by other archivers have simple work- - arounds. - F 4 zip was unable to allocate memory for one or - more buffers during program initialization. - F 5 a severe error in the zipfile format was - detected. Processing probably failed imme- - diately. - E 6 entry too large to be split with zipsplit - E 7 invalid comment format - F 8 zip -T failed or out of memory - E 9 the user aborted zip prematurely with con- - trol-C (or similar) - F 10 zip encountered an error while using a temp - file - F 11 read or seek error - W 12 zip has nothing to do - E 13 missing or empty zip file - F 14 error writing to a file - F 15 zip was unable to create a file to write to - E 16 bad command line parameters - E 18 zip could not open a specified file to read -.end literal -.!------------------------------------------------------------------------------ -.indent -4 -2 Copyright -.br - Copyright (C) 1990-1997 Mark Adler, Richard B. Wales, Jean-loup Gailly, - Onno van der Linden, Christian Spieler and Igor Mandrichenko. - Permission is granted to any individual or institution to use, copy, or - redistribute this software so long as all of the original files are - included, that it is not sold for profit, and that this copyright - notice is retained. -.sk - LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES - ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER - EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE - LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. -.sk - Please send bug reports or comments by email to: - Zip-Bugs@lists.wku.edu. For bug reports, please include - the version of Zip (see zip -h), the make options you used to - compile it (see zip -v), the machine and operating system you are using, - and as much additional information as possible. - Thank you for your support. -.!------------------------------------------------------------------------------ -.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 for- - mat; to Steve Burg for clarifications on the deflate format; - 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 tire- - less 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 -.sk - Zip 2.2 is not compatible with PKUNZIP 1.10. Use Zip 1.1 instead - to produce zip archives which can be extracted by PKUNZIP 1.10. -.sk - WARNING: zip files produced by this version of zip must not be - *updated* by zip 1.0 or PKZIP 1.10 or PKZIP 1.93a, if they contain - encrypted members, or if they have been produced in a pipe or on a non - seekable device. The old versions of zip or pkzip would destroy the - zip structure. The old versions can list the contents of the zip file - but cannot extract it anyway (because of the new compression algorithm). - If you do not use encryption and use regular disk files, you do - not have to care about this problem. -.sk - Under VMS, not all of the odd file formats are treated properly. - Only zip files of format stream-LF and fixed length 512 byte are - expected to work with Zip. Others can be converted using Rahul - Dhesi's BILF program. This version of Zip handles some of the - conversion internally. The use of the "-V" option to save the - VMS attributes should work without problem for at least all types - of sequential files. Beginning with Zip 2.2, the "-V" option uses - a new format to store the VMS attributes that should now allow - proper restoration of all sorts of indexed files. It has been - approved that there are problems with VMS UnZip to restore some - indexed files which were saved with previous versions of Zip. -.sk - When using Kermit to transfer zip files from VMS to MSDOS, type "set - file type block" on the VMS side. When transfering from MSDOS to VMS, - type "set file type fixed" on the VMS machine. In both cases, type - "set file type binary" on MSDOS. -.sk - Under VMS, zip hangs for file specification that uses DECnet - syntax (foo::*.*). -.sk - LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES - ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER - EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE - LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. -.sk - That having been said, please send any problems or comments - via email to the Internet address Zip-Bugs@lists.wku.edu. For - bug reports, please include the version of Zip, the make - options you used to compile it, the machine and operating - system you are using, and as much additional information as - possible. Thank you for your support. -.!------------------------------------------------------------------------------ diff --git a/vms/vmsdefs.h b/vms/vmsdefs.h index d5ca610..73d013a 100644 --- a/vms/vmsdefs.h +++ b/vms/vmsdefs.h @@ -1,9 +1,9 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2000 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 */ /*--------------------------------------------------------------------------- diff --git a/vms/vmsmunch.c b/vms/vmsmunch.c index b40ef45..8140036 100644 --- a/vms/vmsmunch.c +++ b/vms/vmsmunch.c @@ -1,13 +1,22 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 */ -#define module_name VMSMUNCH -#define module_version "V1.3-4" + +/* 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: * @@ -97,24 +106,39 @@ ---------------------------------------------------------------------------*/ - -#if defined(__DECC) || defined(__GNUC__) -#pragma module module_name module_version -#else -#module module_name module_version -#endif +/* 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 <descrip.h> -#include <rms.h> #include <iodef.h> #include <starlet.h> -#include <atrdef.h> /* this gets created with the c3.0 compiler */ #include <fibdef.h> /* this gets created with the c3.0 compiler */ /* @@ -136,6 +160,7 @@ # 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. */ @@ -164,7 +189,6 @@ static void bintim(char *time, long int binval[2]); #endif /* def __VAX */ - /*************************/ /* Function VMSmunch() */ /*************************/ @@ -178,13 +202,13 @@ int VMSmunch( /* original file.c variables */ static struct FAB Fab; - static struct NAM Nam; + 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$t_dvi[1]}; + {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,&Nam.NAM_DVI[1]}; static struct fatdef Fat; static union { struct fchdef fch; @@ -225,8 +249,8 @@ int VMSmunch( {0,0,0} } ; - static char EName[NAM$C_MAXRSS]; - static char RName[NAM$C_MAXRSS]; + 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}; @@ -248,16 +272,16 @@ int VMSmunch( get the file info. ---------------------------------------------------------------------------*/ - /* initialize RMS structures, we need a NAM to retrieve the FID */ + /* 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$l_nam = &Nam; /* FAB has an associated NAM */ - Nam = cc$rms_nam; - Nam.nam$l_esa = EName; /* expanded filename */ - Nam.nam$b_ess = sizeof(EName); - Nam.nam$l_rsa = RName; /* resultant filename */ - Nam.nam$b_rss = sizeof(RName); + 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); @@ -268,20 +292,20 @@ int VMSmunch( if (!(status & 1)) return(status); while (status & 1) { - /* initialize Device name length, note that this points into the NAM + /* 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$t_dvi[0]; + 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; + 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$w_fid[i]; - Fib.FIB$W_DID[i]=Nam.nam$w_did[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 */ @@ -346,8 +370,8 @@ int VMSmunch( /* 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$w_fid[i]; - Fib.FIB$W_DID[i]=Nam.nam$w_did[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 */ diff --git a/vms/vmsmunch.h b/vms/vmsmunch.h index 53d77b4..458ad78 100644 --- a/vms/vmsmunch.h +++ b/vms/vmsmunch.h @@ -1,10 +1,10 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-1999 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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.info-zip.org/pub/infozip/license.html + also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html */ /*--------------------------------------------------------------------------- diff --git a/vms/vmszip.c b/vms/vmszip.c index 2221644..2dae718 100644 --- a/vms/vmszip.c +++ b/vms/vmszip.c @@ -1,21 +1,26 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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-09-25 SMS. - Added case-insensitive file name comparisons, with the option of - preserving case in file names. Defining VMS_PRESERVE_CASE will cause - incompatibility with Zip 2.3 and earlier. +/* 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. */ -/* #define VMS_PRESERVE_CASE */ /* Not for general use. */ - #include "zip.h" +#include "vmsmunch.h" +#include "vms.h" #include <ctype.h> #include <time.h> @@ -36,22 +41,108 @@ #include <strings.h> /* str[n]casecmp() */ #endif /* def HAVE_STRCASECMP */ -#include <descrip.h> -#include <rms.h> +#include <dvidef.h> +#include <lib$routines.h> #include <ssdef.h> +#include <stsdef.h> #include <starlet.h> -#define PATH_START '[' -#define PATH_END ']' -#define PATH_START2 '<' -#define PATH_END2 '>' -#include "vms/vmsmunch.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, -/* Extra malloc() space in names for cutpath() */ -#define PAD 5 /* may have to change .FOO] to ]FOO.DIR;1 */ +/* 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, -#ifndef UTIL /* the companion #endif is a bit of ways down ... */ +/* 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 @@ -65,9 +156,9 @@ typedef struct zdirent { int d_wild; /* flag for wildcard vs. non-wild */ struct FAB fab; - struct NAM nam; - char d_qualwildname[NAM$C_MAXRSS + 1]; - char d_name[NAM$C_MAXRSS + 1]; + struct NAM_STRUCT nam; + char d_qualwildname[ NAM_MAXRSS+ 1]; + char d_name[ NAM_MAXRSS+ 1]; } zDIR; extern char *label; @@ -75,6 +166,8 @@ 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 *)); @@ -88,10 +181,7 @@ local char *strupper OF((char *)); */ #ifndef HAVE_STRCASECMP -int strncasecmp( s1, s2, n) -char *s1; -char *s2; -size_t n; +int strncasecmp( char *s1, char *s2, size_t n) { /* Initialization prepares for n == 0. */ char c1 = '\0'; @@ -113,7 +203,7 @@ size_t n; s1++; s2++; } -return ((unsigned int)c1 - (unsigned int)c2); +return ((unsigned int) c1- (unsigned int) c2); } #ifndef UINT_MAX @@ -127,16 +217,20 @@ return ((unsigned int)c1 - (unsigned int)c2); /* 2004-09-27 SMS. eat_carets(). + Delete ODS5 extended file name escape characters ("^") in the original buffer. - Note that the current scheme handles only simple EFN cases, but it + Note that the current scheme does not handle all EFN cases, but it could be made more complicated. */ -local void eat_carets( str) -char *str; /* Source pointer. */ +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 != '^')) @@ -149,16 +243,50 @@ char *str; /* Source pointer. */ strd = str; while (*str != '\0') { - if (*str == '^') - { - /* Found a caret. Skip it, and take the next character. */ - *strd = *(++str); - } - else + uchr = *str; + if (uchr == '^') { - /* Found a non-caret. Take it. */ - *strd = *str; + /* 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++; @@ -169,6 +297,240 @@ char *str; /* Source pointer. */ } } + +/* 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 @@ -177,32 +539,45 @@ char *str; /* Source pointer. */ 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(p, d) -char *p; -zDIR *d; +local void vms_wild( char *p, zDIR *d) { /* - * Do wildcard setup + * Do wildcard setup. */ - /* set up the FAB and NAM blocks. */ - d->fab = cc$rms_fab; /* initialize fab */ - d->nam = cc$rms_nam; /* initialize nam */ + /* 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] */ - d->fab.fab$l_nam = &d->nam; /* fab -> nam */ - d->fab.fab$l_fna = p; /* argument wild name */ - d->fab.fab$b_fns = strlen(p); /* length */ +#ifdef NAML$C_MAXRSS - d->fab.fab$l_dna = "sys$disk:[]"; /* Default fspec */ - d->fab.fab$b_dns = sizeof("sys$disk:[]")-1; + d->fab.fab$l_dna =(char *) -1; /* Using NAML for default name. */ + d->fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */ - d->nam.nam$l_esa = d->d_qualwildname; /* qualified wild name */ - d->nam.nam$b_ess = NAM$C_MAXRSS; /* max length */ - d->nam.nam$l_rsa = d->d_name; /* matching file name */ - d->nam.nam$b_rss = NAM$C_MAXRSS; /* max length */ +#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) @@ -212,16 +587,16 @@ zDIR *d; /* have qualified wild name (i.e., disk:[dir.subdir]*.*); null-terminate * and set wild-flag */ - d->d_qualwildname[d->nam.nam$b_esl] = '\0'; - d->d_wild = (d->nam.nam$l_fnb & NAM$M_WILDCARD)? 1 : 0; /* not used... */ + 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(n) -ZCONST char *n; /* directory to open */ +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 */ @@ -235,20 +610,27 @@ ZCONST char *n; /* directory to open */ return NULL; } /* Directory may be in form "[DIR.SUB1.SUB2]" or "[DIR.SUB1]SUB2.DIR;1". - If latter, convert to former. */ - if (m > 0 && *(c = strcpy(p,n)+m-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) != ']')) { - while (--c > p && *c != ';') - ; - if ((c- p < 5) || strncasecmp( (c- 4), ".DIR", 4)) + 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 -= 3; - *c-- = '\0'; /* terminate at "DIR;#" */ + c -= 4; /* The "D". */ + *c-- = '\0'; /* terminate at "DIR;1" */ *c = ']'; /* "." --> "]" */ - while (c > p && *--c != ']') + + /* Replace the formerly last "]" with ".". + For ODS5, ignore "^]". + */ + while ((c > p) && ((*--c != ']') || (*(c- 1) == '^'))) ; *c = '.'; /* "]" --> "." */ } @@ -259,8 +641,8 @@ ZCONST char *n; /* directory to open */ return d; } -local char *readd(d) -zDIR *d; /* directory stream to read from */ +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. */ { @@ -268,30 +650,56 @@ zDIR *d; /* directory stream to read from */ 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$b_rsl] = '\0'; /* null terminate */ + d->d_name[d->nam.NAM_RSL] = '\0'; /* null terminate */ return (char *)d->d_name; /* OK */ } } while (r == RMS$_PRV); return NULL; } -int wild(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. */ + +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; @@ -301,8 +709,8 @@ char *p; /* path/pattern to match */ * 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'; + 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 */ @@ -314,9 +722,9 @@ char *p; /* path/pattern to match */ return f ? ZE_OK : ZE_MISS; } -int procname(n, caseflag) -char *n; /* name to process */ -int caseflag; /* true to force case-sensitive match */ +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. */ { @@ -388,8 +796,7 @@ int caseflag; /* true to force case-sensitive match */ Cuter strlower() and strupper() functions. */ -local char *strlower( s) -char *s; +local char *strlower( char *s) /* Convert all uppercase letters to lowercase in string s */ { for ( ; *s != '\0'; s++) @@ -399,8 +806,7 @@ char *s; return s; } -local char *strupper( s) -char *s; +local char *strupper( char *s) /* Convert all lowercase letters to uppercase in string s */ { for ( ; *s != '\0'; s++) @@ -410,54 +816,132 @@ char *s; return s; } -char *ex2in(x, isdir, 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. */ +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 *t; /* shortened name */ + 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 */ - /* Find starting point in name before doing malloc */ - t = x; - if ((n = strrchr(t, ':')) != NULL) - t = n + 1; - if ( (*t == PATH_START && (n = strrchr(t, PATH_END)) != NULL) - || (*t == PATH_START2 && (n = strrchr(t, PATH_END2)) != NULL) ) - /* external name contains valid VMS path specification */ - if (*(++t) == '.') - /* path is relative to current directory, skip leading '.' */ - t++; - - if (!pathput) - t = last(last(t, PATH_END), PATH_END2); - - /* Malloc space for internal name and copy it */ - if ((n = malloc(strlen(t) + 1)) == NULL) + /* 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, t); + strcpy( n, ext_dir_and_name); - if (((t = strrchr(n, PATH_END)) != NULL) || - (t = strrchr(n, PATH_END2)) != NULL) + /* Convert VMS directory separators (".") to "/". */ + if (dir_len > 0) { - *t = '/'; - while (--t > n) - if (*t == '.') - *t = '/'; + 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] = '/'; } - /* Fix from Greg Roelofs: */ - /* Get current working directory and strip from n (t now = n) */ + /* If relative path, then strip off the current directory. */ + if (relative_dir_s) { - char cwd[256], *p, *q; - int c; + char cwd[ NAM_MAXRSS+ 1]; + char *cwd_dir_only; + char *q; + int cwd_dir_only_len; - q = getcwd( cwd, 256); + q = getcwd( cwd, (sizeof( cwd)- 1)); /* 2004-09-24 SMS. With SET PROCESSS /PARSE = EXTENDED, getcwd() can return a @@ -466,63 +950,149 @@ int *pdosflag; /* output: force MSDOS file attributes? */ comparison around here. */ -#if 0 /* fix by Igor */ - if ((q != NULL) && ((p = strchr(cwd, '.')) != NULL)) -#else - if ((q != NULL) && ((p = strchr(cwd, PATH_START)) != NULL || - (p = strchr(cwd, PATH_START2)) != NULL)) -#endif + /* Locate the directory part of the external name. */ + dir_len = find_dir( q, &cwd_dir_only); + if (dir_len > 0) { - if (*(++p) == '.') - p++; - if ((q = strrchr(p, PATH_END)) != NULL || - (q = strrchr(p, PATH_END2)) != NULL) + /* Skip first "[" (or "<"). */ + cwd_dir_only++; + /* Convert VMS directory separators (".") to "/". */ + for (q = cwd_dir_only; q < cwd_dir_only+ dir_len; q++) { - *q = '/'; - while (--q > p) - if (*q == '.') - *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. - /* strip bogus path parts from n */ - if (strncasecmp( n, p, (c = strlen( p))) == 0) + 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))) { - q = n + c; - while (*t++ = *q++) - ; + /* Down-case for this ODS level. */ + down_case = 1; } } } - } -#ifndef VMS_PRESERVE_CASE - strlower( n); -#endif /* ndef VMS_PRESERVE_CASE */ +#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( (t = n + strlen( n) - 6), ".DIR;1")) + if (strcasecmp( (nn = n+ strlen( n)- DIR_TYPE_VER_LEN), DIR_TYPE_VER)) error("directory not version 1"); else if (pathput) - strcpy(t, "/"); + strcpy( nn, "/"); else *n = '\0'; /* directories are discarded with zip -rj */ } - else if (!vmsver) - if ((t = strrchr(n, ';')) != NULL) - *t = '\0'; + 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 = '.'; + } - if ((t = strrchr(n, '.')) != NULL) + /* Remove a type-less dot. */ + /* (Note that currently "name..ver" is not altered.) */ + if ((ext_dir_and_name = strrchr( n, '.')) != NULL) { - if ( t[1] == '\0') /* "filename." -> "filename" */ - *t = '\0'; - else if (t[1] == ';') /* "filename.;vvv" -> "filename;vvv" */ + 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 = t+1; - while (*t++ = *f++) ; + char *f = ext_dir_and_name+ 1; + while (*ext_dir_and_name++ = *f++); } } @@ -532,47 +1102,219 @@ int *pdosflag; /* output: force MSDOS file attributes? */ /* Returned malloc'ed name */ if (pdosflag) *pdosflag = dosflag; + return n; } -char *in2ex(n) -char *n; /* internal file name */ +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; - if ((t = strrchr(n, '/')) == NULL) +#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 + PAD)) == NULL) + if ((x = malloc(strlen(n) + 1 + DIR_PAD)) == NULL) return NULL; strcpy(x, n); } else { - if ((x = malloc(strlen(n) + 3 + PAD)) == NULL) + if ((x = malloc(strlen(n) + 3 + DIR_PAD)) == NULL) return NULL; - x[0] = PATH_START; - x[1] = '.'; - strcpy(x + 2, n); - *(t = x + 2 + (t - n)) = PATH_END; + + /* 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) - if (*t == '/') + { + 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); } -#ifndef VMS_PRESERVE_CASE - strupper( x); -#endif /* ndef VMS_PRESERVE_CASE */ +#endif /* ndef NAML$C_MAXRSS */ return x; } -void stamp(f, d) -char *f; /* name of file to change */ -ulg d; /* dos-style time to change it to */ +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; @@ -601,11 +1343,11 @@ ulg d; /* dos-style time to change it to */ zipwarn("can't set zipfile time: ", f); } -ulg filetime(f, a, n, t) -char *f; /* name of file to get info on */ -ulg *a; /* return value: file attributes */ -long *n; /* return value: file size */ -iztimes *t; /* return value: access, modific. and creation times */ +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 @@ -619,7 +1361,7 @@ iztimes *t; /* return value: access, modific. and creation times */ a file size of -1 */ { struct stat s; /* results of stat() */ - /* malloc name so not dependent on FNMAX - 11/8/04 EG */ + /* convert to a malloc string dump FNMAX - 11/8/04 EG */ char *name; int len = strlen(f); @@ -679,8 +1421,9 @@ iztimes *t; /* return value: access, modific. and creation times */ #endif } -int deletedir(d) -char *d; /* directory to delete */ +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]). @@ -699,5 +1442,3 @@ char *d; /* directory to delete */ free(s); return r; } - -#endif /* !UTIL */ 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 index 714b23c..38fc421 100644 --- a/vms/zip_cli.cld +++ b/vms/zip_cli.cld @@ -1,5 +1,5 @@ Module ZIP_CLITABLE - Ident "02-006" + Ident "03-001" Define Verb ZIP Parameter P1, Label=ZIPFILE, Prompt="Zip file" @@ -17,57 +17,152 @@ Define Verb ZIP Qualifier BATCH, NonNegatable, VALUE(type=$FILE) Qualifier BEFORE, NonNegatable, VALUE(type=$DATETIME) Qualifier COMMENTS, NonNegatable, - VALUE(type=COMMENTS_KEYWORDS) + 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, Default - Qualifier FIX_ARCHIVE, NonNegatable, VALUE(type=FIX_OPTIONS) + 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 HELP, NonNegatable + 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 + 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) + 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 ZIP_FILE, DEFAULT + Keyword ARCHIVE, DEFAULT Keyword FILES + Keyword ZIP_FILE -Define Type FIX_OPTIONS - Keyword NORMAL, DEFAULT - Keyword FULL +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 index 3236e48..1bb39c2 100644 --- a/vms/zip_cli.help +++ b/vms/zip_cli.help @@ -32,77 +32,577 @@ .! 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 Unix, MSDOS, OS/2, and -VMS. It is analogous to a combination of tar and compress and is -compatible with PKZIP (Phil Katz ZIP) for MSDOS systems. +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. -There is a companion to Zip called UnZip (of course). Zip and UnZip can -work with files produced by PKZIP under MSDOS, and PKZIP and PKUNZIP can -work with files produced by Zip. +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. -Zip 2.2 is compatible with PKZIP 2.04. -Note that PKUNZIP 1.10 cannot extract files produced by PKZIP 2.04 -or zip 2.2. You must use PKZIP 2.04g or unzip 5.0p1 (or later versions) -to extract them. +For brief help on Zip or UnZip, run the program without specifying any +parameters on the command line. -For a brief help on Zip and Unzip, run each without specifying any -parameters on the command line. If you want to get the help screen -describing the alternate UNIX style command interface, you must -specify the -h option. +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. -Zip puts one or more compressed files into a single "zip file" along with -information about the files, including the name, path if requested, date -and time last modified, protection, and check information to verify the -fidelity of each entry. Zip can pack an entire directory structure in a -zip file with a single command. Compression ratios of 2:1 to 3:1 are -common for text files. Zip has has one compression method (deflation) and -can also store files without compression. It automatically chooses the better -of the two for each file to be compressed. +<FORMAT> +ZIP [/options] archive inpath, inpath ... -Zip is useful for packaging a set of files to send to someone or for -distribution; for archiving or backing up files; and for saving disk space -by temporarily compressing unused files or directories. +.! +<TOPIC> +Basic_Usage <FORMAT> -ZIP zipfile [file[,...]] [/qualifiers] +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> -Parameters - -<PARAMETER> -zipfile - -<PTEXT> -File specification for the ZIP archive. Zip will perform the requested action -for every zipfile matching the specification. -The default file specification is SYS$DISK:[].ZIP. - -Note that self-extracting ZIP files are supported; just specify the .EXE -suffix yourself. -<TXETP> - -<PARAMETER> -file - -<PTEXT> -An optional comma-separated list of files to be added or replaced in the -zipfile. For unconditional add / replacement actions, a list must be -specified. For the freshening operation, all archive members are processed -per default; the optional file list restricts processing to the specified -archive members. -Expressions may be used to match multiple members. For add/update operations, -wildcard expressions are interpreted in VMS wildcard syntax to match -external files. In contrast, for freshening/deletion operation, wildcard -expressions are interpreted in UNIX compatible syntax to match the -internal names of archive members in the zipfile. -<TXETP> +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> @@ -116,52 +616,101 @@ Adjust internal offsets of the Zip archive members after some data /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. -Try to work with the existing Zip archive. This option is ignored when -any existing entry in the Zip archive gets updated or deleted. -Without the /APPEND qualifier, Zip always creates a backup copy when -modifying the archive. This is slower, but prevents corruption of the -old archive in case of a fatal problem (power failures, program crash...). +See also /DELETE /DIFFERENCE, /FRESHEN, /UPDATE. <QUALIFIER> /BATCH -/BATCH[=listfile] +/BATCH[=list_file] -Read list of files to add/update to the Zip archive from the listfile. -The listfile defaults to SYS$INPUT. +Read input file specifications (inpaths) from "list_file" (one per +line). The list_file defaults to SYS$INPUT. <QUALIFIER> /BEFORE -/BEFORE=(VMS time specification) +/BEFORE=VMS_date_time -Only handle files that are older than the specified date and time. -The specified time is compared with the files' RMS creation 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> -/COMMENT +/COMMENTS -/COMMENT[=KEYWORD[,KEYWORD]] +/COMMENTS[=KEYWORD[,KEYWORD]] Add comments to the Zip archive. + <LITERAL> -| ZIP_FILE Add/replace the multi-line archive comment. (default) +| 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; this requires Zip -to be run in interactive mode. +The Zip program prompts for each comment to be added, which makes sense +only if Zip is run interactively. -The one-line archive member comments are terminated by typing RETURN. -To skip a file comment, just type RETURN without entering any further -characters. +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 supplying a ^Z. +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 zip file. +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 @@ -170,40 +719,80 @@ Delete entries from zip file. 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 added and updated archive entries. +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 since THIS IS INSECURE. Remember to enclose the password -string with quotes, to prevent automatic conversion to upper case or -misinterpretation of punctuation characters by DCL. - -When the password was not specified, Zip prompts for it on SYS$COMMAND. -For typing the password, terminal echo is suspended. For added user -security, the password prompt appears twice and the two user inputs are -checked for identity before using the password. +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 included in -parentheses. +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=listfile +/EXLIST=list_file -The files matching the filename patterns listed in "listfile" are +The files matching the filename patterns listed in "list_file" are excluded when deleting, updating or adding files in the archive. -The "listfile" is a normal text file with one filename pattern entry per -line. The name pattern entries are recognized exactly as found in -"listfile", including leading, embedding and trailing whitespace or most +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 @@ -211,22 +800,113 @@ control characters (with exception of LineFeed and probably CarriageReturn). /EXTRA_FIELDS (default) /NOEXTRA_FIELDS -Allows inclusion of extra file attributes information in the zipfile's -entry headers. -Examples are: the VMS attributes (enabled by the /VMS qualifier), or -additional GMT time stamps. These GMT time stamps are quite useful when -transporting a Zip archive world wide, but they are only recognized -by Info-ZIP's UnZip version 5.20 and later, and take up some additional -space. -When /EXTRA_FIELDS is negated, the /VMS qualifier to request saving of the -VMS RMS file attributes is ignored, too! +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 -Freshen existing zipfile entries; replace if newer. Does not cause any new -files to be added to the archive. +Update existing entries in an existing archive. Does not add new files +to the archive. + +See also /DELETE, /DIFFERENCE, /GROW, /UPDATE. <QUALIFIER> /FULL_PATH @@ -234,32 +914,46 @@ files to be added to the archive. /NOFULL_PATH Directs Zip to store the directory part of the file names (relative to -the current working directory) in the Zip archive. +the current working directory) in the Zip archive. With /NOFULL_PATH, +Zip stores only the file names, discarding any directory information. <QUALIFIER> -/HELP +/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 -Display Zip's help screen, including the version message. +/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 included in -parentheses. +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=listfile +/INLIST=list_file -The files matching the filename patterns listed in "listfile" are -included when deleting, updating or adding files in the archive. -The "listfile" is a normal text file with one filename pattern entry per +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 -"listfile", including leading, embedding and trailing whitespace or most +"list_file", including leading, embedded, and trailing whitespace or most control characters (with exception of LineFeed and probably CarriageReturn). <QUALIFIER> /JUNK @@ -267,23 +961,23 @@ control characters (with exception of LineFeed and probably CarriageReturn). /JUNK /NOJUNK (default) -Junk 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. +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 include the version number appendix in the stored file names. -This allows to store multiple version of the same file in a single Zip -archive. +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. -The normal behaviour of Zip without /KEEP_VERSION is to use only the most -recent version of a specified file and strip of the version number from -the stored file name. This behaviour ensures better compatibility when -transfering a Zip archive to non VMS systems. +See also /DOT_VERSION. <QUALIFIER> /LATEST @@ -312,31 +1006,138 @@ The default level is 6. 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. -Entries which have been added (or freshened) to the zip file get removed from -the file system. If a directory is empty afterwards, it is also removed. +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. -The file names are truncated and converted to upper case to match the -MSDOS 8+3 file name syntax. Only the MSDOS compatible attributes are stored; -the file owner's write permission is mapped to the "readonly" attribute. -The archive entry is marked as being made under MSDOS regardless of the true -host system of Zip. +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 -Perform operations quietly. +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 @@ -350,268 +1151,486 @@ The optional keywords recognized are: | FILENAMES start from current dir; | only use filename part of file patterns (-R) <LARETIL> -The new FILENAMES optional keyword modifies the recursion algorithm to -be (almost) compatible to PKZIP's behaviour on subdirectory recursion. +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 -On VMS, this behaviour can be alternatively archived by using -the "subdirectory recursing wildcard" [...] in the "include files" parameter -list. +/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 time specification) +/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. -Only handle files that are newer than the specified date and time. -The specified time is compared with the files' RMS creation time. +See also /BEFORE. <QUALIFIER> -/STORETYPES +/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. -/STORETYPES=(.ext1,.ext2,... ) +VERBOSE enables verbose splitting and display details of how the +splitting is being done. -For files with the specified extensions, Zip does not try to compress the -data but stores them verbatim. This speeds up operation on files that -have already been compressed and where a second compression step usually -does not gain much space. -The default list of extensions where compression is suppressed is -(.Z,.zip,.zoo,.arc,.arj). +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: -But note: when maximum level of compression is requested (/LEVEL=9), the -STORETYPES heuristic is not used. In this case, Zip tries to compress ALL -files. +<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=dirspec +/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). -Specifies an alternate directory where Zip creates its temporary files. -When this qualifier is not given, Zip attempts to write to the current -working directory. +/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 +/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. -Test archive integrity. +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. -The optional keywords recognized are: +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> -This option should only be used with text files. The second option CRLF -is only useful when a DOS text file has been transfered to a VMS disk -in stream (or stream_lf) format. +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, for example a self-extracting -executable stub. +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 -Freshen existing archive entries; create new ones if needed. -<QUALIFIER> -/VERBOSE - -/VERBOSE[=MORE|DEBUG] - -Switch on verbose messages. This includes diagnostics on discovered -oddities in the zipfile's structure, and a progress indicator during -compression operation. - -When this qualifier is the only command line argument given, it has a special -meaning. In this case a screen of diagnostic information about the program -version is displayed. This display includes the Zip version number and -release date, and it shows some information to determine when and how -the executable was built and set up. This includes info on the used compiler's -name and version, the date of the build (if available), and some optional -compile time feature flags. Additionally, the contents of the environment -variables (=logical names on VMS) that are read by Zip for runtime -configuration are shown. -This information is especially valuable when reporting problems or bugs. +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> -/VMS - -/VMS[=ALL] - -Store VMS file attributes in Zip archive. - -When the optional keyword ALL is specified, all allocated blocks in a -file are stored in the Zip archive, including data beyond the -End-of-File (EOF) marker. +/VERBOSE -/VMS provides good fidelity for well-formed files (no data past EOF) -when unpacked on a VMS system. Also, some types of file (notably -Stream_LF text files) will be unpacked as expected on a non-VMS system. +/VERBOSE[=NORMAL|MORE|DEBUG] [, COMMAND]] -/VMS=ALL provides good fidelity, even for files with data past EOF, when -unpacked on a VMS system. However, the data from beyond the EOF marker -will typically cause a file to appear corrupted when unpacked on a -non-VMS system. -<TOPIC> -Authors +Verbose mode or print diagnostic version info. -Info-ZIP; currently maintained by Onno van der Linden. VMS support maintained -by Igor Mandrichenko, Christian Spieler, and Hunter Goatley. Originally based -on a program by Samuel H. Smith. +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. -VMS on-line help ported from Zip's MANUAL by Christian Spieler, using -Hunter Goatley's work for UnZip. +/VERBOSE with no value is equivalent to /VERBOSE=NORMAL. MORE adds more +messages, and DEBUG adds still more messages. -<TOPIC> -Exit_Codes +When /VERBOSE is the only command line argument, a diagnostic report is +displayed, showing: -On VMS, Zip's UNIX style exit values are mapped into proper -VMS status codes: <LITERAL> -| 1 (success) normal exit, -| (0x7fff0000 + 16*Zip_error_level) warnings -| (0x7fff0002 + 16*Zip_error_level) normal errors -| (0x7fff0004 + 16*Zip_error_level) fatal errors +| 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> -The Zip error level (or exit code) approximates the exit -codes defined by PKWARE and takes on the following values: -<LITERAL> -| VMS Zip Type of error -| severity errcode -| - 0 normal; no errors or warnings detected. -| F 2 unexpected end of zip file. -| E 3 a generic error in the zipfile format was -| detected. Processing may have completed -| successfully anyway; some broken zipfiles -| created by other archivers have simple work- -| arounds. -| F 4 zip was unable to allocate memory for one or -| more buffers during program initialization. -| F 5 a severe error in the zipfile format was -| detected. Processing probably failed imme- -| diately. -| E 6 entry too large to be split with zipsplit -| E 7 invalid comment format -| F 8 zip -T failed, or out of memory -| E 9 the user aborted zip prematurely with con- -| trol-C (or similar) -| F 10 zip encountered an error while using a temp -| file -| F 11 read or seek error -| W 12 zip has nothing to do -| E 13 missing or empty zip file -| F 14 error writing to a file -| F 15 zip was unable to create a file for writing -| E 16 bad command line parameters -| E 18 zip could not open a specified file to read -<LARETIL> +This information should be included in bug reports. -<TOPIC> -Logical_Names +/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 -Zip scans its process environment for the logical name ZIP_OPTS, which -can be used to specify a string of default options to modify Zip's -behaviour. For the syntax, see help topic UNIX_Options. -With the exception of "-i" and "-x", all recognized UNIX style options -can be used within the ZIP_OPTS equivalence string. +/VMS[=ALL] -For example, the following will cause Zip to skip directories, include -VMS attribute information perform all operations at quiet-level 1 by default: +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> -| $ define ZIP_OPTS "-qDV" +/NOWILDCARD +/WILDCARD=NOSPAN <LARETIL> -Note that the quotation marks here are required to preserve lowercase options -(opposite of the command-line behavior). +Controls wildcard processing. + +/NOWILDCARD Wildcard processing is disabled. -ZIP_OPTS may be defined as a symbol rather than a logical, but if both -are defined, the logical is used. +/WILDCARD=NOSPAN Wildcards don't span directory boundaries in paths. +<QUALIFIER> +/ZIP64 -The alternative logical name ZIPOPT (more UNIX-like naming convention) -is recognized as well. If both ZIPOPT and ZIP_OPTS are present (and do -not equate to whitespace only), the content of ZIPOPT takes precedence -and ZIP_OPTS is ignored. +/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 -The default action of Zip is to add or replace zipfile entries from list, which -can include the special name -@ to read names from SYS$INPUT. The following -list of options was taken from the on-line help generated when Zip is run -with the -h command-line option: +"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> -| -A adjust self-extracting exe -| -b use "path" for temp files -| -c add one-line comments -| -d delete entries in zipfile -| -D do not add directory entries -| -e encrypt -| -f freshen: only changed files -| -F fix zipfile (-FF try harder) -| -g allow growing existing zipfile (unless updating or deleting) -| -h show this help -| -i include only names matching the following patterns -| -i@ include only names matching the patterns listed in "file" -| -j junk (don't record) directory names -| -J junk (remove) prepended (SFX) stub -| -k simulate PKZIP made zipfile -| -l translate end-of-lines (LF -> CRLF) -| -ll translate end-of-lines (CRLF -> LF) -| -L show software license -| -m move into zipfile (delete files) -| -n don't compress theses suffixes -| -o make zipfile as old as latest entry -| -P encrypt with specified "password" -| -q quiet operation -| -r recurse into subdirs, match against specified paths -| -R recurse into subdirs of current dir, match filenames only -| -t only do files after "mmddyyyy" -| -tt only do files before "mmddyyyy" -| -T test zip file integrity (calls unzip) -| -u update: only changed or new files -| -v verbose messages/print version info -| -V save VMS file attributes -| -w append the VMS version number to name stored in zip file -| -x exclude names matching the following patterns -| -x@ exclude names matching the patterns listed in "file" -| -X suppress storing of any extra file attributes -| -z add zipfile comment -| -0 store only -| -1 compress faster -| -9 compress better -| -@ read list of files to process from SYS$INPUT +| -v +| --verbose +| --verb <LARETIL> -Note that uppercase options such as -A, -D, -L, -T and -V must be specified -in quotes. For example: +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> -| $ zip "-VD" -a zipfile +| -la- +| --show-files- <LARETIL> -To negate a default option on the command line, add one or more minus signs -before the option letter, in addition to the leading switch character `-': - +Some options take a value, which may immediately follow the option, or +be separated by a space or "=". For example: <LITERAL> -| $ zip --ql zipfile +| -ttmmddyyyy +| -tt mmddyyyy +| -tt=mmddyyyy <LARETIL> -or +<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> -| $ zip -l-q zipfile +| /LICENSE <LARETIL> -At present it is not possible to decrement an option below zero--that is, -more than a few minuses have no effect. +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 index eea74b6..8fe757f 100644 --- a/vms/zipup.h +++ b/vms/zipup.h @@ -1,12 +1,17 @@ /* Copyright (c) 1990-2005 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + 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, both of these files are missing, the Info-ZIP license + 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 */ -#define fhow "r","mbc=60" + +#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)) @@ -16,9 +21,36 @@ typedef void *ftype; #define zstdin stdin ftype vms_open OF((char *)); -size_t vms_read OF((ftype, char *, size_t)); +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 */ |