Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6724 → Rev 6725

/programs/fs/unzip60/vms/Contents
0,0 → 1,42
Contents of the "vms" sub-archive for UnZip 6.00 and later:
 
Contents this file
INSTALL.VMS VMS-specific build and install instructions
NOTES.TXT description of new features in VMS Zip 3.0 and UnZip 6.0
README general VMS info about using UnZip and zipfiles
UNZIP_MSG.MSG messages source for VMS built-in error message facility
unzip_def.rnh UnZip default help page, RUNOFF format
unzip_cli.help UnZip VMSCLI help page, TPU format
unzipsfx.hlp UnZipSFX pre-formatted help page
cvthelp.tpu TPU macro file to convert .help file to RUNOFF format
cmdline.c VMS-style command-line-interface code (if VMSCLI defined)
unz_cli.cld more VMS-command-line stuff (if VMSCLI defined)
vms.c VMS file manipulation code
vms.h VMS header file for UnZip
vmscfg.h VMS-specific configuration settings
vmsdefs.h VMS system declarations (missing C compiler support)
build_unzip.com command file to build or (re-)link UnZip
descrip.mms MMK/MMS makefile for UnZip/ZipInfo and UnZipSFX
descrip_deps.mms MMK/MMS include file providing source dependencies
descrip_mkdeps.mms MMK/MMS makefile for regenerating descrip_deps.mms
descrip_src.mms MMK/MMS include file, provides environment setup
collect_deps.com command file used in source dependencies creation
mod_deps.com command file used in source dependencies creation
unzip.opt options file used for linking unzip
unzipsfx.opt options file used for linking unzipsfx
makesfx.com command file to create self-extracting archives
unixio_gcc.h unixio.h system header replacement for gcc
unixlib_gcc.h unixlib.h system header replacement for gcc
bzlib.h VMS wrapper header file for the bzip2 library definitions
find_bzip2_lib.com command procedure to set up environment for bzip2 support
infback9.h VMS wrapper header file for zlib inflate64 definitions
zlib.h VMS wrapper header file for zlib library definitions
 
MAKE/VMS is no longer supported since MMK (MMS clone by Matt Madison/MadGoat
Enterprises, compatible with descrip.mms) is both free and becoming quite
popular. MMK is available by anonymous ftp from ftp.spc.edu/ftp.wku.edu and
by mailserver at lists.wku.edu. Check VMS newsgroups for announcements and
exact location.
 
Detailed compilation and installation instructions can be found in the
INSTALL.VMS file in this directory.
/programs/fs/unzip60/vms/INSTALL.VMS
0,0 → 1,145
 
VMS (OpenVMS):
 
On VMS, two build methods are provided: a command procedure, and
description files for MMS or MMK. Both methods must be run from
the main directory, not the [.VMS] subdirectory.
 
A simple build using the command procedure looks like this:
@ [.VMS]BUILD_UNZIP.COM
 
A simple build using MMS or MMK looks like this:
MMS /DESCRIP = [.VMS]DESCRIP.MMS ! Or, with MMK, ...
MMK /DESCRIP = [.VMS]DESCRIP.MMS
 
Various options for each build method are explained in comments in
the main builder file, either BUILD_UNZIP.COM or DESCRIP.MMS.
 
Here are some more complex build examples:
 
o Build with the large-file option enabled (non-VAX only):
 
@ [.VMS]BUILD_UNZIP LARGE
or:
MMS /DESC = [.VMS] /MACRO = LARGE=1
 
o Re-link the executables (small-file and large-file):
 
@ [.VMS]BUILD_UNZIP LINK
@ [.VMS]BUILD_UNZIP LARGE LINK
or
MMK /DESC = [.VMS] CLEAN_EXE ! Deletes existing executables.
MMK /DESC = [.VMS] ! Builds new executables.
MMK /DESC = [.VMS] /MACRO = LARGE=1 CLEAN_EXE
MMK /DESC = [.VMS] /MACRO = LARGE=1
 
o Build a large-file product from scratch, for debug, getting
compiler listings and link maps:
 
MMS /DESC = [.VMS] CLEAN
MMS /DESC = [.VMS] /MACRO = (DBG=1, LARGE=1. LIST=1)
 
On VAX, the builders attempt to cope with the various available C
compilers, DEC/Compaq/HP C, VAX C, or GNU C. If DEC/Compaq/HP C is
not available or not desired, comments in the relevant builder file
explain the command-line options used to select a different
compiler.
 
By default, Zip uses (and UnZip supports) the "deflate" compression
method. To add support for the optional "bzip2" compression method,
first obtain and build the bzip2 software (http://www.bzip.org/ or,
for a more VMS-friendly kit, http://antinode.info/dec/sw/bzip2.html).
Then, define the macro IZ_BZIP2 on the BUILD_UNZIP.COM or MMS/MMK
command line to specify the directory where the bzip2 files may be
found. For example:
 
@ [.VMS]BUILD_UNZIP LARGE -
IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_4B_VMS]
or:
MMS /DESC = [.VMS] /MACRO = (LARGE=1, -
IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_4B_VMS])
 
Note that historically, UnZip has been built with the default
compiler option, /NAMES = UPPERCASE, while bzip2 is normally built
with /NAMES = AS_IS, to avoid name collisions. With modern
compilers, the "#pragma names" directives in [.VMS]BZLIB.H will
handle these differences without user intervention. An old
compiler (for example, DEC C V4.0-000) will emit complaints
%CC-I-UNKNOWNPRAGMA, and will mishandle the bzip2 library function
names, which will cause the link to fail. To solve this problem,
either build the bzip2 BZ_NO_STDIO object library with /NAMES =
UPPERCASE, or else build UnZip with /NAMES = AS_IS. For example:
 
@ [.VMS]BUILD_UNZIP LARGE "CCOPTS=/NAMES=AS_IS" -
IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_4B_VMS]
or:
MMS /DESC = [.VMS] /MACRO = (LARGE=1, "CCOPTS=/NAMES=AS_IS", -
IZ_BZIP2=SYS$SYSDEVICE:[UTILITY.SOURCE.BZIP2.BZIP2-1_0_4B_VMS])
 
System-architecture-specific files (like objects and executables)
are placed in separate directories, such as [.ALPHA], [.IA64], or
[.VAX]. Large-file products get their own directories, [.ALPHAL]
or [.IA64L]. On VAX, VAX C products are placed in [.VAXV], GNU C
products in [.VAXG]. Each product builder announces what the
destination directory will be when it is run.
 
Common files, such as the help libraries (UNZIP.HLP for the default
UNIX-like command-line interface, UNZIP_CLI.HLP for the VMS-like
command-line interface), are placed in the main directory. With a
mixed-architecture VMS cluster, the same main directory on a shared
disk may may be used by all system types. (Using the NOHELP option
with BUILD_UNZIP.COM can keep it from making the same help files
repeatedly.) Building the help files is detailed below.
 
Completing installation:
 
To complete the installation, the executables may be left in place,
or moved (or copied) to a convenient place. While other methods
(like DCL$PATH) exist, most users define symbols to make the UnZip
executables available as foreign commands. These symbol definitions
may be placed in a user's SYS$LOGIN:LOGIN.COM, or in a more central
location, like SYS$MANAGER:SYLOGIN.COM. Typical symbol definitions
might look like these:
 
UNZIP :== $ dev:[dir]UNZIP.EXE ! UNIX-like command line.
or:
UNZIP :== $ dev:[dir]UNZIP_CLI.EXE ! VMS-like command line.
 
On a non-VAX system, different symbols could be defined for the
small-file and large-file programs. For example:
 
UNZIPS :== $ dev:[dir.ALPHA]UNZIP.EXE ! UNZIPS = small-file UnZip.
UNZIP*L :== $ dev:[dir.ALPHAL]UNZIP.EXE !UNZIP[L] = large-file UnZip.
 
The builders create help text files, UNZIP.HLP and UNZIP_CLI.HLP.
These may be incorporated into an existing help library, or a separate
UnZip help library may be created using commands like these, using
either UNZIP.HLP (as shown) or UNZIP_CLI.HLP:
 
LIBRARY /HELP dev:[dir]existing_library.HLB UNZIP.HLP
 
LIBRARY /CREATE /HELP UNZIP.HLB UNZIP.HLP
 
UnZip help may then be accessed from a separate UnZip help library
using a command like:
 
HELP /LIBRARY = device:[directory]UNZIP.HLB
 
For greater ease, the user (or system manager) may define a
HLP$LIBRARY logical name to allow the HELP utility to find the UnZip
help library automatically. See HELP HELP /USERLIBRARY for more
details. The command procedure HLP_LIB_NEXT.COM may be used to
determine the next available HLP$LIBRARY logical name, and could be
adapted to define a HLP$LIBRARY logical name for a UnZip help library.
 
The builders also create VMS message files, UNZIP_MSG.EXE, in the
destination directory with the program executables. A user may
gain DCL access to the UnZip error messages using a command like:
 
SET MESSAGE device:[directory]UNZIP_MSG.EXE
 
For system-wide access, the system manager may move or copy this
file to SYS$MESSAGE, although this could cause some confusion if
multiple versions of UnZip are used on the system, and their error
message source files differ.
 
/programs/fs/unzip60/vms/NOTES.TXT
0,0 → 1,372
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: 2009-03-02.
 
 
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 or UnZip "-v" (/VERBOSE) report should include
SYMLINK_SUPPORT (Zip) or SYMLINKS (UnZip) in its list of "special
compilation options" if the program was built with symlink support.
 
 
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.
/programs/fs/unzip60/vms/README
0,0 → 1,98
VMS README for UnZip 5.3 and later, 25 February 1997
----------------------------------------------------
 
Notes about using UnZip and zipfiles under VMS (see INSTALL for instructions
on compiling):
 
- Install UnZip as foreign symbol by adding this to login.com:
$ unzip == "$disk:[dir]unzip.exe"
$ zipinfo == "$disk:[dir]unzip.exe ""-Z"""
where "disk" and "dir" are location of UnZip executable; the "$" before
the disk name is important. Some people, including the author, prefer
a short alias such as "ii" instead of "zipinfo"; edit to taste. (All of
the quotes around the -Z are necessary, but don't ask us to explain it...)
 
- Optionally install UnZipSFX for use with the MAKESFX.COM command file:
$ unzipsfx :== disk:[dir]unzipsfx.exe
Thereafter an archive "foo.zip" may be converted to "foo.exe" simply by
typing "@makesfx foo" (assuming MAKESFX.COM is in the current directory).
Note that there is *no* leading "$" in this case.
 
- After proper installation, the default version of UnZip is invoked just
as in Unix or MS-DOS: "unzip -opts archive files". The hyphen ('-') is
the switch character, not the slash ('/') as in native VMS commands. An
alternative is available if VMSCLI is defined during compilation; this
version does provide a native VMS-style command interface (e.g., /ZIPINFO
instead of -Z). Both versions accept the command "unzip -v", which can
be used to check whether VMSCLI was defined or not; but an even simpler
method is to type "unzip" and look at the help screen. Note that options
placed in an environment variable (UNZIP_OPTS) must be of the short, hy-
phenated form regardless of how UnZip was compiled.
 
- The VMS C runtime library translates all command-line text to lowercase
unless it is quoted, making some options and/or filenames not work as
intended. For example:
unzip -V zipfile vms/README;*
is translated to
unzip -v zipfile vms/readme;*
which may not match the contents of the zipfile and definitely won't
extract the file with its version number as intended. This can be
avoided by use of the -C option (/CASE_INSENSITIVE) or by enclosing
the uppercase stuff in quotes:
unzip "-V" zipfile "vms/README;*"
Note that quoting the whole line probably won't work, since it would
be interpreted as a single argument by the C library.
 
- Wildcards that refer to files internal to the archive behave like Unix
wildcards, not VMS ones (assuming UnZip was not compiled with VMSWILD
defined). This is both a matter of consistency (see above) and power--
full Unix regular expressions are supported, so that one can specify
"all .c and .h files that start with a, b, c or d and do not have a 2
before the dot" as "[a-d]*[^2].[ch]". Of course, "*.[ch]" is a much more
common wildcard specification, but the power is there if you need it.
Note that "*" matches zipfile directory separators ('/'), too. If UnZip
*was* compiled with VMSWILD defined (do "unzip -v" to check), the single-
character wildcard is "%" rather than "?", and character sets (ranges)
are delimited with () instead of [] (for example, "*.(ch)").
 
- Wildcards that refer to zipfiles (i.e., external VMS files) behave like
normal VMS wildcards regardless of whether VMSWILD was defined or not.
Ranges are not supported. Thus "unzip *font-%.zip" is about as much as
one can do for specifying wildcard zipfiles.
 
- Created files get whatever permissions were stored in the archive (mapped
to VMS and/or masked with your default permissions, depending on the
originating operating system), but created directories additionally in-
herit the (possibly more restrictive) permissions of the parent directory.
And obviously things won't work if you don't have permission to write to
the extraction directory.
 
- When transferring files, particularly via Kermit, pay attention to the
settings! In particular, zipfiles must be transferred in some binary
mode, which is NOT Kermit's default mode, and this mode must usually be
set on BOTH sides of the transfer (e.g., both VAX and PC). See the notes
below for details.
 
 
 
 
From Info-ZIP Digest (Wed, 6 Nov 1991), Volume 91, Issue 290:
 
Date: Tue, 5 Nov 91 15:31 CDT
From: Hugh Schmidt <HUGH@macc.wisc.edu>
 
****************************************************
*** VMS ZIP and PKZIP compatibility using KERMIT ***
****************************************************
 
Many use Procomm's kermit to transfer zipped files between PC and VMS
VAX. The following VMS kermit settings make VMS Zip/UnZip compatible
with PC Zip/UnZip or PKZIP/PKUNZIP:
VMS kermit Procomm kermit
------------------- --------------------
Uploading PC zipfile to VMS: set file type fixed set file type binary
Downloading VMS zipfile to PC: set file type block set file type binary
 
"Block I/O lets you bypass the VMS RMS record-processing capabilities
entirely", (Guide to VMS file applications, Section 8.5). The kermit
guys must have known this!
/programs/fs/unzip60/vms/UNZIP_MSG.MSG
0,0 → 1,59
! VMS Error Message Source File for UnZip
!
! Because the facility code was formally assigned by HP, the .FACILITY
! directive below specifies /SYSTEM. Because the messages are, in
! general, specific to UnZip, this file is not compiled with /SHARED.
! For example:
!
! MESSAGE /OBJECT = [.dest]UNZIP_MSG.OBJ /NOSYMBOLS [.VMS]UNZIP_MSG.MSG
!
! LINK /SHAREABLE = [.dest]UNZIP_MSG.EXE [.dest]UNZIP_MSG.OBJ
!
!-----------------------------------------------------------------------
 
.TITLE Info-ZIP UnZip Error Messages
.FACILITY IZ_UNZIP, 1954 /SYSTEM
.IDENT 'V6.0-000'
 
! PK_
.BASE 0
OK /SUCCESS <Normal successful completion>
.BASE 2
WARN /WARNING <Generic warning - bad CRC, unknown compress method, ...>
.BASE 4
ERR /ERROR <Error in zipfile>
.BASE 6
BADERR /SEVERE <Error in zipfile>
.BASE 8
MEM /SEVERE <insufficient memory (init)>
.BASE 10
MEM2 /SEVERE <insufficient memory (password)>
.BASE 12
MEM3 /SEVERE <insufficient memory (file expand)>
.BASE 14
MEM4 /SEVERE <insufficient memory (memory expand)>
.BASE 16
MEM5 /SEVERE <insufficient memory (???)>
.BASE 18
NOZIP /ERROR <zipfile not found>
.BASE 20
PARAM /ERROR <Invalid parameters specified on command line>
.BASE 22
FIND /ERROR <No files found to extract or view>
 
.BASE 100
DISK /SEVERE <I/O error - disk full, ...>
.BASE 102
EOF /SEVERE <Unexpected end-of-file in zipfile>
 
! IZ_
.BASE 160
CTRLC /ERROR <User interrupt (CRTL/C)>
.BASE 162
UNSUP /ERROR <Unsupported compression or encryption for all files>
.BASE 164
BADPWD /ERROR <Bad decryption password for all files>
.BASE 166
ERRBF /ERROR <Large-file archive, small-file program>
 
.END
/programs/fs/unzip60/vms/build_unzip.com
0,0 → 1,802
$! BUILD_UNZIP.COM
$!
$! Build procedure for VMS versions of UnZip/ZipInfo and UnZipSFX.
$!
$! Last revised: 2009-03-01 SMS.
$!
$! Command arguments:
$! - suppress help file processing: "NOHELP"
$! - suppress message file processing: "NOMSG"
$! - select link-only: "LINK"
$! - select compiler environment: "VAXC", "DECC", "GNUC"
$! - select BZIP2 support: "USEBZ2"
$! This option is a shortcut for "IZ_BZIP2=SYS$DISK:[.bzip2]", and
$! runs the DCL build procedure there,
$! - select BZIP2 support: "IZ_BZIP2=dev:[dir]", where "dev:[dir]"
$! (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.
$! By default, the SFX programs are built without BZIP2 support.
$! Add "BZIP2_SFX=1" to the LOCAL_UNZIP C macros to enable it.
$! (See LOCAL_UNZIP, below.)
$! - use ZLIB compression library: "IZ_ZLIB=dev:[dir]", where
$! "dev:[dir]" (or a suitable logical name) tells where to find
$! "zlib.h". The ZLIB object library (LIBZ.OLB) is expected to be
$! in a "[.dest]" directory under that one ("dev:[dir.ALPHAL]",
$! for example), or in that directory itself.
$! - select large-file support: "LARGE"
$! - select compiler listings: "LIST" Note that the whole argument
$! 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 UnZip:
$! "VMSCLI" or "CLI"
$! - force installation of UNIX interface version of UnZip
$! (override LOCAL_UNZIP environment): "NOVMSCLI" or "NOCLI"
$!
$! To specify additional options, define the symbol LOCAL_UNZIP
$! as a comma-separated list of the C macros to be defined, and
$! then run BUILD_UNZIP.COM. For example:
$!
$! $ LOCAL_UNZIP = "RETURN_CODES"
$! $ @ [.VMS]BUILD_UNZIP.COM
$!
$! VMS-specific options include VMSWILD and RETURN_CODES. See the
$! INSTALL file for other options (for example, CHECK_VERSIONS).
$!
$! If you edit this procedure to set LOCAL_UNZIP here, be sure to
$! use only one "=", to avoid affecting other procedures.
$!
$! Note: This command procedure always generates both the "default"
$! UnZip having the UNIX style command interface and the "VMSCLI"
$! UnZip having the CLI compatible command interface. There is no
$! need to add "VMSCLI" to the LOCAL_UNZIP symbol. (The only effect
$! of "VMSCLI" now is the selection of the CLI style UnZip
$! 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_UNZIP) .eqs. "")
$ then
$ LOCAL_UNZIP = ""
$ else ! Trim blanks and append comma if missing
$ LOCAL_UNZIP = f$edit( LOCAL_UNZIP, "TRIM")
$ if (f$extract( (f$length( LOCAL_UNZIP)- 1), 1, LOCAL_UNZIP) .nes. ",")
$ then
$ LOCAL_UNZIP = LOCAL_UNZIP + ", "
$ endif
$ endif
$!
$! Check for the presence of "VMSCLI" in LOCAL_UNZIP. If yes, we will
$! define the foreign command for "unzip" to use the executable
$! containing the CLI interface.
$!
$ pos_cli = f$locate( "VMSCLI", LOCAL_UNZIP)
$ len_local_unzip = f$length( LOCAL_UNZIP)
$ if (pos_cli .ne. len_local_unzip)
$ then
$ CLI_IS_DEFAULT = 1
$ ! Remove "VMSCLI" macro from LOCAL_UNZIP. The UnZip executable
$ ! including the CLI interface is now created unconditionally.
$ LOCAL_UNZIP = f$extract( 0, pos_cli, LOCAL_UNZIP)+ -
f$extract( pos_cli+7, len_local_unzip- (pos_cli+ 7), LOCAL_UNZIP)
$ else
$ CLI_IS_DEFAULT = 0
$ endif
$ delete /symbol /local pos_cli
$ delete /symbol /local len_local_unzip
$!
$!##################### Customizing section #############################
$!
$ unzx_unx = "UNZIP"
$ unzx_cli = "UNZIP_CLI"
$ unzsfx_unx = "UNZIPSFX"
$ unzsfx_cli = "UNZIPSFX_CLI"
$!
$ CCOPTS = ""
$ IZ_BZIP2 = ""
$ BUILD_BZIP2 = 0
$ IZ_ZLIB = ""
$ 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, 6, curr_arg) .eqs. "USEBZ2")
$ then
$ if (IZ_BZIP2 .eqs. "")
$ then
$ IZ_BZIP2 = "SYS$DISK:[.BZIP2]"
$ BUILD_BZIP2 = 1
$ endif
$ goto argloop_end
$ endif
$!
$ if (f$extract( 0, 7, curr_arg) .eqs. "IZ_ZLIB")
$ then
$ opts = f$edit( curr_arg, "COLLAPSE")
$ eq = f$locate( "=", opts)
$ IZ_ZLIB = 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
$ UNZEXEC = unzx_cli
$ else
$ UNZEXEC = unzx_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 UnZip."
$ 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 UnZip."
$ goto error
$ endif
$!
$ cc = "cc /standard = relax /prefix = all /ansi"
$ defs = "''LOCAL_UNZIP'MODERN"
$ 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_UNZIP'MODERN"
$ else
$ ! We use VAXC (or GNU C):
$ USE_DECC_VAX = 0
$ defs = "''LOCAL_UNZIP'VMS"
$ if ((.not. HAVE_VAXC_VAX .and. MAY_HAVE_GNUC) .or. MAY_USE_GNUC)
$ then
$ cc = "gcc"
$ dest = "''dest'G"
$ cmpl = "GNU C"
$ opts = "GNU_CC:[000000]GCCLIB.OLB /LIBRARY,"
$ else
$ if (HAVE_DECC_VAX)
$ then
$ cc = "cc /vaxc"
$ else
$ cc = "cc"
$ endif
$ dest = "''dest'V"
$ cmpl = "VAX C"
$ endif
$ opts = "''opts' SYS$DISK:[.''dest']VAXCSHR.OPT /OPTIONS,"
$ endif
$ endif
$!
$ if (IZ_BZIP2 .nes. "")
$ then
$ defs = "USE_BZIP2, ''defs'"
$ 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_SXUNX = "/define = (''defs', SFX)"
$ DEF_SXCLI = "/define = (''defs', VMSCLI, SFX)"
$ endif
$!
$! Search directory for BZIP2.
$!
$ if (BUILD_BZIP2)
$ then
$! Our own BZIP2 directory.
$ seek_bz = dest
$ else
$! User-specified BZIP2 directory.
$ seek_bz = arch
$ endif
$!
$! Search directory for ZLIB.
$!
$ seek_zl = arch
$!
$! Change the destination directory, if the large-file option is enabled.
$!
$ if (LARGE_FILE .ne. 0)
$ then
$ dest = "''dest'L"
$ endif
$!
$! If BZIP2 support was selected, find the header file and object
$! library. Complain if things fail.
$!
$ cc_incl = "[]"
$ lib_bzip2_opts = ""
$ if (IZ_BZIP2 .nes. "")
$ then
$ bz2_olb = "LIBBZ2_NS.OLB"
$ if (.not. LINK_ONLY)
$ then
$ define incl_bzip2 'IZ_BZIP2'
$ if (BUILD_BZIP2 .and. (IZ_BZIP2 .eqs. "SYS$DISK:[.BZIP2]"))
$ then
$ set def [.BZIP2]
$ @buildbz2.com
$ set def [-]
$ endif
$ endif
$!
$ @ [.VMS]FIND_BZIP2_LIB.COM 'IZ_BZIP2' 'seek_bz' 'bz2_olb' lib_bzip2
$ if (f$trnlnm( "lib_bzip2") .eqs. "")
$ then
$ say "Can't find BZIP2 object library. Can't link."
$ goto error
$ else
$ lib_bzip2_opts = "lib_bzip2:''bz2_olb' /library,"
$ cc_incl = cc_incl+ ", [.VMS]"
$ endif
$ endif
$!
$! If ZLIB use was selected, find the object library.
$! Complain if things fail.
$!
$ lib_zlib_opts = ""
$ if (IZ_ZLIB .nes. "")
$ then
$ zlib_olb = "LIBZ.OLB"
$ define incl_zlib 'IZ_ZLIB'
$ defs = "''defs', USE_ZLIB"
$ @ [.VMS]FIND_BZIP2_LIB.COM 'IZ_ZLIB' 'seek_zl' 'zlib_olb' lib_zlib
$ if (f$trnlnm( "lib_zlib") .eqs. "")
$ then
$ say "Can't find ZLIB object library. Can't link."
$ goto error
$ else
$ lib_zlib_opts = "lib_zlib:''zlib_olb' /library, "
$ if (f$locate( "[.VMS]", cc_incl) .ge. f$length( cc_incl))
$ then
$ cc_incl = cc_incl+ ", [.VMS]"
$ endif
$ @ [.VMS]FIND_BZIP2_LIB.COM 'IZ_ZLIB' -
contrib.infback9 infback9.h'zlib_olb' incl_zlib_contrib_infback9
$ endif
$ 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 (IZ_BZIP2 .nes. "")
$ then
$ if (.not. LINK_ONLY)
$ then
$ say " BZIP2 include dir: ''f$trnlnm( "incl_bzip2")'"
$ endif
$ say " BZIP2 library dir: ''f$trnlnm( "lib_bzip2")'"
$ endif
$ if (IZ_ZLIB .nes. "")
$ then
$ if (.not. LINK_ONLY)
$ then
$ say " ZLIB include dir: ''f$trnlnm( "incl_zlib")'"
$ endif
$ say " ZLIB library dir: ''f$trnlnm( "lib_zlib")'"
$ endif
$ if (.not. LINK_ONLY)
$ then
$ say " cc = ''cc'"
$ endif
$ say " link = ''link'"
$ if (.not. MAKE_HELP)
$ then
$ say " Not making new help files."
$ endif
$ if (.not. MAKE_MSG)
$ then
$ say " Not making new message files."
$ endif
$ say ""
$!
$ tmp = f$verify( 1) ! Turn echo on to see what's happening.
$!
$!------------------------------- UnZip section ------------------------------
$!
$ if (.not. LINK_ONLY)
$ then
$!
$! Process the help file, if desired.
$!
$ if (MAKE_HELP)
$ then
$ runoff /out = UNZIP.HLP [.VMS]UNZIP_DEF.RNH
$ endif
$!
$! Process the message file, if desired.
$!
$ if (MAKE_MSG)
$ then
$ message /object = [.'dest']UNZIP_MSG.OBJ /nosymbols -
[.VMS]UNZIP_MSG.MSG
$ link /shareable = [.'dest']UNZIP_MSG.EXE [.'dest']UNZIP_MSG.OBJ
$ endif
$!
$! Compile the sources.
$!
$ cc 'DEF_UNX' /object = [.'dest']UNZIP.OBJ UNZIP.C
$ cc 'DEF_UNX' /object = [.'dest']CRC32.OBJ CRC32.C
$ cc 'DEF_UNX' /object = [.'dest']CRYPT.OBJ CRYPT.C
$ cc 'DEF_UNX' /object = [.'dest']ENVARGS.OBJ ENVARGS.C
$ cc 'DEF_UNX' /object = [.'dest']EXPLODE.OBJ EXPLODE.C
$ cc 'DEF_UNX' /object = [.'dest']EXTRACT.OBJ EXTRACT.C
$ cc 'DEF_UNX' /object = [.'dest']FILEIO.OBJ FILEIO.C
$ cc 'DEF_UNX' /object = [.'dest']GLOBALS.OBJ GLOBALS.C
$ cc 'DEF_UNX' /object = [.'dest']INFLATE.OBJ INFLATE.C
$ cc 'DEF_UNX' /object = [.'dest']LIST.OBJ LIST.C
$ cc 'DEF_UNX' /object = [.'dest']MATCH.OBJ MATCH.C
$ cc 'DEF_UNX' /object = [.'dest']PROCESS.OBJ PROCESS.C
$ cc 'DEF_UNX' /object = [.'dest']TTYIO.OBJ TTYIO.C
$ cc 'DEF_UNX' /object = [.'dest']UBZ2ERR.OBJ UBZ2ERR.C
$ cc 'DEF_UNX' /object = [.'dest']UNREDUCE.OBJ UNREDUCE.C
$ cc 'DEF_UNX' /object = [.'dest']UNSHRINK.OBJ UNSHRINK.C
$ cc 'DEF_UNX' /object = [.'dest']ZIPINFO.OBJ ZIPINFO.C
$ cc 'DEF_UNX' /object = [.'dest']VMS.OBJ [.VMS]VMS.C
$!
$! Create the object library.
$!
$ if (f$search( "[.''dest']UNZIP.OLB") .eqs. "") then -
libr /object /create [.'dest']UNZIP.OLB
$!
$ libr /object /replace [.'dest']UNZIP.OLB -
[.'dest']CRC32.OBJ, -
[.'dest']CRYPT.OBJ, -
[.'dest']ENVARGS.OBJ, -
[.'dest']EXPLODE.OBJ, -
[.'dest']EXTRACT.OBJ, -
[.'dest']FILEIO.OBJ, -
[.'dest']GLOBALS.OBJ, -
[.'dest']INFLATE.OBJ, -
[.'dest']LIST.OBJ, -
[.'dest']MATCH.OBJ, -
[.'dest']PROCESS.OBJ, -
[.'dest']TTYIO.OBJ, -
[.'dest']UBZ2ERR.OBJ, -
[.'dest']UNREDUCE.OBJ, -
[.'dest']UNSHRINK.OBJ, -
[.'dest']ZIPINFO.OBJ, -
[.'dest']VMS.OBJ
$!
$ endif
$!
$! Link the executable.
$!
$ link /executable = [.'dest']'unzx_unx'.EXE -
SYS$DISK:[.'dest']UNZIP.OBJ, -
SYS$DISK:[.'dest']UNZIP.OLB /library, -
'lib_bzip2_opts' -
SYS$DISK:[.'dest']UNZIP.OLB /library, -
'lib_zlib_opts' -
'opts' -
SYS$DISK:[.VMS]UNZIP.OPT /options
$!
$!----------------------- UnZip (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 -
UNZIP_CLI.HELP
$ set default [-]
$ runoff /output = UNZIP_CLI.HLP [.VMS]UNZIP_CLI.RNH
$ endif
$!
$! Compile the CLI sources.
$!
$ cc 'DEF_CLI' /object = [.'dest']UNZIPCLI.OBJ UNZIP.C
$ cc 'DEF_CLI' /object = [.'dest']CMDLINE.OBJ -
[.VMS]CMDLINE.C
$!
$! Create the command definition object file.
$!
$ set command /object = [.'dest']UNZ_CLI.OBJ [.VMS]UNZ_CLI.CLD
$!
$! Create the CLI object library.
$!
$ if (f$search( "[.''dest']UNZIPCLI.OLB") .eqs. "") then -
libr /object /create [.'dest']UNZIPCLI.OLB
$!
$ libr /object /replace [.'dest']UNZIPCLI.OLB -
[.'dest']CMDLINE.OBJ, -
[.'dest']UNZ_CLI.OBJ
$!
$ endif
$!
$! Link the CLI executable.
$!
$ link /executable = [.'dest']'unzx_cli'.EXE -
SYS$DISK:[.'dest']UNZIPCLI.OBJ, -
SYS$DISK:[.'dest']UNZIPCLI.OLB /library, -
SYS$DISK:[.'dest']UNZIP.OLB /library, -
'lib_bzip2_opts' -
SYS$DISK:[.'dest']UNZIP.OLB /library, -
'lib_zlib_opts' -
'opts' -
SYS$DISK:[.VMS]UNZIP.OPT /options
$!
$!-------------------------- UnZipSFX section --------------------------------
$!
$ if (.not. LINK_ONLY)
$ then
$!
$! Compile the variant SFX sources.
$!
$ cc 'DEF_SXUNX' /object = [.'dest']UNZIPSFX.OBJ UNZIP.C
$ cc 'DEF_SXUNX' /object = [.'dest']CRC32_.OBJ CRC32.C
$ cc 'DEF_SXUNX' /object = [.'dest']CRYPT_.OBJ CRYPT.C
$ cc 'DEF_SXUNX' /object = [.'dest']EXTRACT_.OBJ EXTRACT.C
$ cc 'DEF_SXUNX' /object = [.'dest']FILEIO_.OBJ FILEIO.C
$ cc 'DEF_SXUNX' /object = [.'dest']GLOBALS_.OBJ GLOBALS.C
$ cc 'DEF_SXUNX' /object = [.'dest']INFLATE_.OBJ INFLATE.C
$ cc 'DEF_SXUNX' /object = [.'dest']MATCH_.OBJ MATCH.C
$ cc 'DEF_SXUNX' /object = [.'dest']PROCESS_.OBJ PROCESS.C
$ cc 'DEF_SXUNX' /object = [.'dest']TTYIO_.OBJ TTYIO.C
$ cc 'DEF_SXUNX' /object = [.'dest']UBZ2ERR_.OBJ UBZ2ERR.C
$ cc 'DEF_SXUNX' /object = [.'dest']VMS_.OBJ [.VMS]VMS.C
$!
$! Create the SFX object library.
$!
$ if (f$search( "[.''dest']UNZIPSFX.OLB") .eqs. "") then -
libr /object /create [.'dest']UNZIPSFX.OLB
$!
$ libr /object /replace [.'dest']UNZIPSFX.OLB -
[.'dest']CRC32_.OBJ, -
[.'dest']CRYPT_.OBJ, -
[.'dest']EXTRACT_.OBJ, -
[.'dest']FILEIO_.OBJ, -
[.'dest']GLOBALS_.OBJ, -
[.'dest']INFLATE_.OBJ, -
[.'dest']MATCH_.OBJ, -
[.'dest']PROCESS_.OBJ, -
[.'dest']TTYIO_.OBJ, -
[.'dest']UBZ2ERR_.OBJ, -
[.'dest']VMS_.OBJ
$!
$ endif
$!
$! Link the SFX executable.
$!
$ link /executable = [.'dest']'unzsfx_unx'.EXE -
SYS$DISK:[.'dest']UNZIPSFX.OBJ, -
SYS$DISK:[.'dest']UNZIPSFX.OLB /library, -
'lib_bzip2_opts' -
SYS$DISK:[.'dest']UNZIPSFX.OLB /library, -
'lib_zlib_opts' -
'opts' -
SYS$DISK:[.VMS]UNZIPSFX.OPT /options
$!
$!--------------------- UnZipSFX (CLI interface) section ---------------------
$!
$ if (.not. LINK_ONLY)
$ then
$!
$! Compile the SFX CLI sources.
$!
$ cc 'DEF_SXCLI' /object = [.'dest']UNZSXCLI.OBJ UNZIP.C
$ cc 'DEF_SXCLI' /object = [.'dest']CMDLINE_.OBJ -
[.VMS]CMDLINE.C
$!
$! Create the SFX CLI object library.
$!
$ if (f$search( "[.''dest']UNZSXCLI.OLB") .eqs. "") then -
libr /object /create [.'dest']UNZSXCLI.OLB
$!
$ libr /object /replace [.'dest']UNZSXCLI.OLB -
[.'dest']CMDLINE_.OBJ, -
[.'dest']UNZ_CLI.OBJ
$!
$ endif
$!
$! Link the SFX CLI executable.
$!
$ link /executable = [.'dest']'unzsfx_cli'.EXE -
SYS$DISK:[.'dest']UNZSXCLI.OBJ, -
SYS$DISK:[.'dest']UNZSXCLI.OLB /library, -
SYS$DISK:[.'dest']UNZIPSFX.OLB /library, -
'lib_bzip2_opts' -
SYS$DISK:[.'dest']UNZIPSFX.OLB /library, -
'lib_zlib_opts' -
'opts' -
SYS$DISK:[.VMS]UNZIPSFX.OPT /options
$!
$!----------------------------- 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.
$!
$ unzip == "$''there'''unzexec'.EXE"
$ zipinfo == "$''there'''unzexec'.EXE ""-Z"""
$!
$! Deassign the temporary process logical names, restore the original
$! default directory, and restore the DCL verify status.
$!
$ error:
$!
$ 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
$!
$ if (IZ_ZLIB .nes. "")
$ then
$ if (f$trnlnm( "incl_zlib", "LNM$PROCESS_TABLE") .nes. "")
$ then
$ deassign incl_zlib
$ endif
$ if (f$trnlnm( "incl_zlib_contrib_infback9", -
"LNM$PROCESS_TABLE") .nes. "")
$ then
$ deassign incl_zlib_contrib_infback9
$ endif
$ if (f$trnlnm( "lib_zlib", "LNM$PROCESS_TABLE") .nes. "")
$ then
$ deassign lib_zlib
$ endif
$ endif
$!
$ 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
$!
/programs/fs/unzip60/vms/bzlib.h
0,0 → 1,21
/* 2007-01-02 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 bzerrcode );
 
#pragma names restore
/programs/fs/unzip60/vms/cmdline.c
0,0 → 1,1136
/*
Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
 
See the accompanying file LICENSE, version 2007-Mar-04 or later
(the contents of which are also included in unzip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
 
/* 2004-12-13 SMS.
* Disabled the module name macro to accommodate old GNU C which didn't
* obey the directive, and thus confused MMS/MMK where the object
* library dependencies need to have the correct module name.
*/
#if 0
#define module_name VMS_UNZIP_CMDLINE
#define module_ident "02-013"
#endif /* 0 */
 
/*
**
** Facility: UNZIP
**
** Module: VMS_UNZIP_CMDLINE
**
** Author: Hunter Goatley <goathunter@MadGoat.com>
**
** Date: 25 Apr 97 (orig. Zip version, 30 Jul 93)
**
** Abstract: Routines to handle a VMS CLI interface for UnZip. The CLI
** command line is parsed and a new argc/argv are built and
** returned to UnZip.
**
** Modified by:
**
** 02-013 S. Schweda, C. Spieler 29-Dec-2007 03:34
** Extended /RESTORE qualifier to support timestamp restoration
** options.
** 02-012 Steven Schweda 07-Jul-2006 19:04
** Added /TEXT=STMLF qualifier option.
** 02-011 Christian Spieler 21-Apr-2005 01:23
** Added /FULL=DIAGNOSTICS option modifier.
** 02-010 Steven Schweda 14-FEB-2005 20:04
** Added /DOT_VERSION (-Y) and /ODS2 (-2) qualifiers.
** 02-009 Steven Schweda 28-JAN-2005 16:16
** Added /TIMESTAMP (-T) qualifier.
** 02-008 Christian Spieler 08-DEC-2001 23:44
** Added support for /TRAVERSE_DIRS argument
** 02-007 Christian Spieler 24-SEP-2001 21:12
** Escape verbatim '%' chars in format strings; version unchanged.
** 02-007 Onno van der Linden 02-Jul-1998 19:07
** Modified to support GNU CC 2.8 on Alpha; version unchanged.
** 02-007 Johnny Lee 25-Jun-1998 07:38
** Fixed typo (superfluous ';'); no version num change.
** 02-007 Hunter Goatley 11-NOV-1997 10:38
** Fixed "zip" vs. "unzip" typo; no version num change.
** 02-007 Christian Spieler 14-SEP-1997 22:43
** Cosmetic mods to stay in sync with Zip; no version num change.
** 02-007 Christian Spieler 12-JUL-1997 02:05
** Revised argv vector construction for better handling of quoted
** arguments (e.g.: embedded white space); no version num change.
** 02-007 Christian Spieler 04-MAR-1997 22:25
** Made /CASE_INSENSITIVE common to UnZip and ZipInfo mode;
** added support for /PASSWORD="decryption_key" argument.
** 02-006 Christian Spieler 11-MAY-1996 22:40
** Added SFX version of VMSCLI_usage().
** 02-005 Patrick Ellis 09-MAY-1996 22:25
** Show UNIX style usage screen when UNIX style options are used.
** 02-004 Christian Spieler 06-FEB-1996 02:20
** Added /HELP qualifier.
** 02-003 Christian Spieler 23-DEC-1995 17:20
** Adapted to UnZip 5.2.
** 02-002 Hunter Goatley 16-JUL-1994 10:20
** Fixed some typos.
** 02-001 Cave Newt 14-JUL-1994 15:18
** Removed obsolete /EXTRACT option; fixed /*TEXT options;
** wrote VMSCLI usage() function
** 02-000 Hunter Goatley 12-JUL-1994 00:00
** Original UnZip version (v5.11).
** 01-000 Hunter Goatley 30-JUL-1993 07:54
** Original version (for Zip v1.9p1).
**
*/
 
/* Stand-alone test procedure:
*
* cc /define = TEST=1 [.vms]cmdline.c /include = [] /object = [.vms]
* set command /object = [.vms]unz_cli.obj [.vms]unz_cli.cld
* link /executable = [] [.vms]cmdline.obj, [.vms]unz_cli.obj
* EXEC*UTE == "$SYS$DISK:[]'"
* exec cmdline [ /qualifiers ...] [parameters ...]
*/
 
 
/* 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 */
 
#define UNZIP_INTERNAL
#include "unzip.h"
#ifndef TEST
# include "unzvers.h" /* for VMSCLI_usage() */
#endif /* !TEST */
 
/* Workaround for broken header files of older DECC distributions
* that are incompatible with the /NAMES=AS_IS qualifier. */
/* - lib$routines.h definitions: */
#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
/* - str$routines.h definitions: */
#define str$concat STR$CONCAT
#define str$find_first_substring STR$FIND_FIRST_SUBSTRING
 
#include <ssdef.h>
#include <descrip.h>
#include <climsgdef.h>
#include <clidef.h>
#include <lib$routines.h>
#include <str$routines.h>
 
#ifndef CLI$_COMMA
globalvalue CLI$_COMMA;
#endif
 
/*
** "Macro" to initialize a dynamic string descriptor.
*/
#define init_dyndesc(dsc) {\
dsc.dsc$w_length = 0;\
dsc.dsc$b_dtype = DSC$K_DTYPE_T;\
dsc.dsc$b_class = DSC$K_CLASS_D;\
dsc.dsc$a_pointer = NULL;}
 
/*
** Memory allocation step for argv string buffer.
*/
#define ARGBSIZE_UNIT 256
 
/*
** Memory reallocation macro for argv string buffer.
*/
#define CHECK_BUFFER_ALLOCATION(buf, reserved, requested) { \
if ((requested) > (reserved)) { \
char *save_buf = (buf); \
(reserved) += ARGBSIZE_UNIT; \
if (((buf) = (char *) realloc((buf), (reserved))) == NULL) { \
if (save_buf != NULL) free(save_buf); \
return (SS$_INSFMEM); \
} \
} \
}
 
/*
** Define descriptors for all of the CLI parameters and qualifiers.
*/
#if 0
$DESCRIPTOR(cli_extract, "EXTRACT"); /* obsolete */
#endif
$DESCRIPTOR(cli_text, "TEXT"); /* -a[a] */
$DESCRIPTOR(cli_text_auto, "TEXT.AUTO"); /* -a */
$DESCRIPTOR(cli_text_all, "TEXT.ALL"); /* -aa */
$DESCRIPTOR(cli_text_none, "TEXT.NONE"); /* ---a */
$DESCRIPTOR(cli_text_stmlf, "TEXT.STMLF"); /* -S */
$DESCRIPTOR(cli_binary, "BINARY"); /* -b[b] */
$DESCRIPTOR(cli_binary_auto, "BINARY.AUTO"); /* -b */
$DESCRIPTOR(cli_binary_all, "BINARY.ALL"); /* -bb */
$DESCRIPTOR(cli_binary_none, "BINARY.NONE"); /* ---b */
$DESCRIPTOR(cli_case_insensitive,"CASE_INSENSITIVE"); /* -C */
$DESCRIPTOR(cli_screen, "SCREEN"); /* -c */
$DESCRIPTOR(cli_directory, "DIRECTORY"); /* -d */
$DESCRIPTOR(cli_freshen, "FRESHEN"); /* -f */
$DESCRIPTOR(cli_help, "HELP"); /* -h */
$DESCRIPTOR(cli_junk, "JUNK"); /* -j */
$DESCRIPTOR(cli_lowercase, "LOWERCASE"); /* -L */
$DESCRIPTOR(cli_list, "LIST"); /* -l */
$DESCRIPTOR(cli_brief, "BRIEF"); /* -l */
$DESCRIPTOR(cli_full, "FULL"); /* -v */
$DESCRIPTOR(cli_full_diags, "FULL.DIAGNOSTICS"); /* -vv */
$DESCRIPTOR(cli_existing, "EXISTING"); /* -o, -oo, -n */
$DESCRIPTOR(cli_exist_newver, "EXISTING.NEW_VERSION"); /* -o */
$DESCRIPTOR(cli_exist_over, "EXISTING.OVERWRITE"); /* -oo */
$DESCRIPTOR(cli_exist_noext, "EXISTING.NOEXTRACT"); /* -n */
$DESCRIPTOR(cli_overwrite, "OVERWRITE"); /* -o, -n */
$DESCRIPTOR(cli_quiet, "QUIET"); /* -q */
$DESCRIPTOR(cli_super_quiet, "QUIET.SUPER"); /* -qq */
$DESCRIPTOR(cli_test, "TEST"); /* -t */
$DESCRIPTOR(cli_pipe, "PIPE"); /* -p */
$DESCRIPTOR(cli_password, "PASSWORD"); /* -P */
$DESCRIPTOR(cli_timestamp, "TIMESTAMP"); /* -T */
$DESCRIPTOR(cli_uppercase, "UPPERCASE"); /* -U */
$DESCRIPTOR(cli_update, "UPDATE"); /* -u */
$DESCRIPTOR(cli_version, "VERSION"); /* -V */
$DESCRIPTOR(cli_restore, "RESTORE"); /* -X */
$DESCRIPTOR(cli_restore_own, "RESTORE.OWNER_PROT"); /* -X */
$DESCRIPTOR(cli_restore_date, "RESTORE.DATE"); /* -DD */
$DESCRIPTOR(cli_restore_date_all, "RESTORE.DATE.ALL"); /* --D */
$DESCRIPTOR(cli_restore_date_files, "RESTORE.DATE.FILES"); /* -D */
$DESCRIPTOR(cli_dot_version, "DOT_VERSION"); /* -Y */
$DESCRIPTOR(cli_comment, "COMMENT"); /* -z */
$DESCRIPTOR(cli_exclude, "EXCLUDE"); /* -x */
$DESCRIPTOR(cli_ods2, "ODS2"); /* -2 */
$DESCRIPTOR(cli_traverse, "TRAVERSE_DIRS"); /* -: */
 
$DESCRIPTOR(cli_information, "ZIPINFO"); /* -Z */
$DESCRIPTOR(cli_short, "SHORT"); /* -Zs */
$DESCRIPTOR(cli_medium, "MEDIUM"); /* -Zm */
$DESCRIPTOR(cli_long, "LONG"); /* -Zl */
$DESCRIPTOR(cli_verbose, "VERBOSE"); /* -Zv */
$DESCRIPTOR(cli_header, "HEADER"); /* -Zh */
$DESCRIPTOR(cli_totals, "TOTALS"); /* -Zt */
$DESCRIPTOR(cli_times, "TIMES"); /* -ZT */
$DESCRIPTOR(cli_one_line, "ONE_LINE"); /* -Z2 */
 
$DESCRIPTOR(cli_page, "PAGE"); /* -M , -ZM */
 
$DESCRIPTOR(cli_yyz, "YYZ_UNZIP");
 
$DESCRIPTOR(cli_zipfile, "ZIPFILE");
$DESCRIPTOR(cli_infile, "INFILE");
$DESCRIPTOR(unzip_command, "unzip ");
 
static int show_VMSCLI_usage;
 
#ifndef vms_unzip_cld
# define vms_unzip_cld VMS_UNZIP_CLD
#endif
#if defined(__DECC) || defined(__GNUC__)
extern void *vms_unzip_cld;
#else
globalref void *vms_unzip_cld;
#endif
 
/* extern unsigned long LIB$GET_INPUT(void), LIB$SIG_TO_RET(void); */
 
#ifndef cli$dcl_parse
# define cli$dcl_parse CLI$DCL_PARSE
#endif
#ifndef cli$present
# define cli$present CLI$PRESENT
#endif
#ifndef cli$get_value
# define cli$get_value CLI$GET_VALUE
#endif
extern unsigned long cli$dcl_parse ();
extern unsigned long cli$present ();
extern unsigned long cli$get_value ();
 
unsigned long vms_unzip_cmdline (int *, char ***);
static unsigned long get_list (struct dsc$descriptor_s *,
struct dsc$descriptor_d *, int,
char **, unsigned long *, unsigned long *);
static unsigned long check_cli (struct dsc$descriptor_s *);
 
#ifdef TEST
int
main(int argc, char **argv)
{
return (vms_unzip_cmdline(&argc, &argv));
}
#endif /* TEST */
 
unsigned long
vms_unzip_cmdline (int *argc_p, char ***argv_p)
{
/*
** Routine: vms_unzip_cmdline
**
** Function:
**
** Parse the DCL command line and create a fake argv array to be
** handed off to Zip.
**
** NOTE: the argv[] is built as we go, so all the parameters are
** checked in the appropriate order!!
**
** Formal parameters:
**
** argc_p - Address of int to receive the new argc
** argv_p - Address of char ** to receive the argv address
**
** Calling sequence:
**
** status = vms_unzip_cmdline (&argc, &argv);
**
** Returns:
**
** SS$_NORMAL - Success.
** SS$_INSFMEM - A malloc() or realloc() failed
** SS$_ABORT - Bad time value
**
*/
register unsigned long status;
char options[256];
char *the_cmd_line; /* buffer for argv strings */
unsigned long cmdl_size; /* allocated size of buffer */
unsigned long cmdl_len; /* used size of buffer */
char *ptr;
int x, len, zipinfo, exclude_list;
int restore_date;
 
int new_argc;
char **new_argv;
 
struct dsc$descriptor_d work_str;
struct dsc$descriptor_d foreign_cmdline;
struct dsc$descriptor_d output_directory;
struct dsc$descriptor_d password_arg;
 
init_dyndesc(work_str);
init_dyndesc(foreign_cmdline);
init_dyndesc(output_directory);
init_dyndesc(password_arg);
 
/*
** See if the program was invoked by the CLI (SET COMMAND) or by
** a foreign command definition. Check for /YYZ_UNZIP, which is a
** valid default qualifier solely for this test.
*/
show_VMSCLI_usage = TRUE;
status = check_cli(&cli_yyz);
if (!(status & 1)) {
lib$get_foreign(&foreign_cmdline);
/*
** If nothing was returned or the first character is a "-", then
** assume it's a UNIX-style command and return.
*/
if (foreign_cmdline.dsc$w_length == 0)
return (SS$_NORMAL);
if ((*(foreign_cmdline.dsc$a_pointer) == '-') ||
((foreign_cmdline.dsc$w_length > 1) &&
(*(foreign_cmdline.dsc$a_pointer) == '"') &&
(*(foreign_cmdline.dsc$a_pointer + 1) == '-'))) {
show_VMSCLI_usage = FALSE;
return (SS$_NORMAL);
}
 
str$concat(&work_str, &unzip_command, &foreign_cmdline);
status = cli$dcl_parse(&work_str, &vms_unzip_cld, lib$get_input,
lib$get_input, 0);
if (!(status & 1)) return (status);
}
 
/*
** There's always going to be a new_argv[] because of the image name.
*/
if ((the_cmd_line = (char *) malloc(cmdl_size = ARGBSIZE_UNIT)) == NULL)
return (SS$_INSFMEM);
 
strcpy(the_cmd_line, "unzip");
cmdl_len = sizeof("unzip");
 
/*
** First, check to see if any of the regular options were specified.
*/
 
options[0] = '-';
ptr = &options[1]; /* Point to temporary buffer */
 
/*
** Is it ZipInfo??
*/
zipinfo = 0;
status = cli$present(&cli_information);
if (status & 1) {
 
zipinfo = 1;
 
*ptr++ = 'Z';
 
if (cli$present(&cli_one_line) & 1)
*ptr++ = '2';
if (cli$present(&cli_short) & 1)
*ptr++ = 's';
if (cli$present(&cli_medium) & 1)
*ptr++ = 'm';
if (cli$present(&cli_long) & 1)
*ptr++ = 'l';
if (cli$present(&cli_verbose) & 1)
*ptr++ = 'v';
if (cli$present(&cli_header) & 1)
*ptr++ = 'h';
if (cli$present(&cli_comment) & 1)
*ptr++ = 'c';
if (cli$present(&cli_totals) & 1)
*ptr++ = 't';
if (cli$present(&cli_times) & 1)
*ptr++ = 'T';
 
}
else {
 
#if 0
/*
** Extract files?
*/
status = cli$present(&cli_extract);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'x';
#endif
 
/*
** Write binary files in VMS binary (fixed-length, 512-byte records,
** record attributes: none) format
** (auto-convert, or force to convert all files)
*/
status = cli$present(&cli_binary);
if (status != CLI$_ABSENT) {
*ptr++ = '-';
*ptr++ = '-';
*ptr++ = 'b';
if ((status & 1) &&
!((status = cli$present(&cli_binary_none)) & 1)) {
*ptr++ = 'b';
if ((status = cli$present(&cli_binary_all)) & 1)
*ptr++ = 'b';
}
}
 
/*
** Convert files as text (CR LF -> LF, etc.)
** (auto-convert, or force to convert all files)
*/
status = cli$present(&cli_text);
if (status != CLI$_ABSENT) {
*ptr++ = '-';
*ptr++ = '-';
*ptr++ = 'a';
if ((status & 1) &&
!((status = cli$present(&cli_text_none)) & 1)) {
*ptr++ = 'a';
if ((status = cli$present(&cli_text_all)) & 1)
*ptr++ = 'a';
if ((status = cli$present(&cli_text_stmlf)) & 1)
*ptr++ = 'S';
}
}
 
/*
** Extract files to screen?
*/
status = cli$present(&cli_screen);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'c';
 
/*
** Re-create directory structure? (default)
*/
status = cli$present(&cli_directory);
if (status == CLI$_PRESENT) {
status = cli$get_value(&cli_directory, &output_directory);
}
 
/*
** Restore directory date-times.
*/
restore_date = 0;
status = cli$present(&cli_restore_date);
if (status != CLI$_ABSENT) {
/* Emit "----D" to reset the timestamp restore state "D_flag"
** consistently to 0 (independent of optional environment
** option settings).
*/
*ptr++ = '-';
*ptr++ = '-';
*ptr++ = '-';
*ptr++ = 'D';
if (status == CLI$_NEGATED) {
/* /RESTORE=NODATE */
restore_date = 2;
} else {
status = cli$present(&cli_restore_date_all);
if (status == CLI$_PRESENT) {
/* /RESTORE=(DATE=ALL) */
restore_date = 0;
} else {
/* /RESTORE=(DATE=FILES) (default) */
restore_date = 1;
}
}
/* Emit the required number of (positive) "D" characters. */
while (restore_date > 0) {
*ptr++ = 'D';
restore_date--;
}
}
 
/*
** Freshen existing files, create none
*/
status = cli$present(&cli_freshen);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'f';
 
/*
** Show the help.
*/
status = cli$present(&cli_help);
if (status & 1)
*ptr++ = 'h';
 
/*
** Junk stored directory names on unzip
*/
status = cli$present(&cli_junk);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'j';
 
/*
** List contents (/BRIEF (default) or /FULL)
*/
status = cli$present(&cli_list);
if (status & 1) {
if (cli$present(&cli_full) & 1) {
*ptr++ = 'v';
if (cli$present(&cli_full_diags) & 1)
*ptr++ = 'v';
} else
*ptr++ = 'l';
}
 
/*
** Existing files: new version, overwrite, no extract?
*/
status = cli$present(&cli_exist_newver);
if (status == CLI$_PRESENT) {
*ptr++ = 'o';
}
status = cli$present(&cli_exist_over);
if (status == CLI$_PRESENT) {
*ptr++ = 'o';
*ptr++ = 'o';
}
status = cli$present(&cli_exist_noext);
if (status == CLI$_PRESENT) {
*ptr++ = 'n';
}
 
/*
** Overwrite files (deprecated) ?
*/
status = cli$present(&cli_overwrite);
if (status == CLI$_NEGATED)
*ptr++ = 'n';
else if (status != CLI$_ABSENT)
*ptr++ = 'o';
 
/*
** Decryption password from command line?
*/
status = cli$present(&cli_password);
if (status == CLI$_PRESENT) {
status = cli$get_value(&cli_password, &password_arg);
}
 
/*
** Pipe files to SYS$OUTPUT with no informationals?
*/
status = cli$present(&cli_pipe);
if (status != CLI$_ABSENT)
*ptr++ = 'p';
 
/*
** Quiet
*/
status = cli$present(&cli_quiet);
if (status & 1) {
*ptr++ = 'q';
if ((status = cli$present(&cli_super_quiet)) & 1)
*ptr++ = 'q';
}
 
/*
** Test archive integrity
*/
status = cli$present(&cli_test);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 't';
 
/*
** Set archive timestamp according to its newest file.
*/
status = cli$present(&cli_timestamp);
if (status & 1)
*ptr++ = 'T';
 
/*
** Extract "foo.ext.###" as "foo.ext;###" (treat .### as version number)
*/
status = cli$present(&cli_dot_version);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'Y';
 
/*
** Force conversion of extracted file names to old ODS2 conventions
*/
status = cli$present(&cli_ods2);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = '2';
 
/*
** Traverse directories (don't skip "../" path components)
*/
status = cli$present(&cli_traverse);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = ':';
 
/*
** Make (some) names lowercase
*/
status = cli$present(&cli_lowercase);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'L';
 
/*
** Uppercase (don't convert to lower)
*/
status = cli$present(&cli_uppercase);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'U';
 
/*
** Update (extract only new and newer files)
*/
status = cli$present(&cli_update);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'u';
 
/*
** Version (retain VMS/DEC-20 file versions)
*/
status = cli$present(&cli_version);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'V';
 
/*
** Restore owner/protection info
*/
status = cli$present(&cli_restore_own);
if (status != CLI$_ABSENT) {
if (status == CLI$_NEGATED) {
*ptr++ = '-';
} else if ((status = cli$present(&cli_restore))
== CLI$_NEGATED) {
*ptr++ = '-';
}
*ptr++ = 'X';
}
 
/*
** Display only the archive comment
*/
status = cli$present(&cli_comment);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'z';
 
} /* ZipInfo check way up there.... */
 
/* The following options are common to both UnZip and ZipInfo mode. */
 
/*
** Match filenames case-insensitively (-C)
*/
status = cli$present(&cli_case_insensitive);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'C';
 
/*
** Use builtin pager for all screen output
*/
status = cli$present(&cli_page);
if (status == CLI$_NEGATED)
*ptr++ = '-';
if (status != CLI$_ABSENT)
*ptr++ = 'M';
 
/*
** Check existence of a list of files to exclude, fetch is done later.
*/
status = cli$present(&cli_exclude);
exclude_list = ((status & 1) != 0);
 
/*
** If the user didn't give any DCL qualifier, assume he wants the
** Un*x interface.
if ( (ptr == &options[1]) &&
(output_directory.dsc$w_length == 0) &&
(password_arg.dsc$w_length == 0) &&
(!exclude_list) ) {
free(the_cmd_line);
return (SS$_NORMAL);
}
*/
 
/*
** Now copy the final options string to the_cmd_line.
*/
len = ptr - &options[0];
if (len > 1) {
options[len] = '\0';
x = cmdl_len;
cmdl_len += len + 1;
CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
strcpy(&the_cmd_line[x], options);
}
 
/*
** If specified, add the decryption password argument.
**/
if (password_arg.dsc$w_length != 0) {
x = cmdl_len;
cmdl_len += password_arg.dsc$w_length + 4;
CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
strcpy(&the_cmd_line[x], "-P");
strncpy(&the_cmd_line[x+3], password_arg.dsc$a_pointer,
password_arg.dsc$w_length);
the_cmd_line[cmdl_len-1] = '\0';
}
 
/*
** Now get the specified zip file name.
*/
status = cli$present(&cli_zipfile);
if (status & 1) {
status = cli$get_value(&cli_zipfile, &work_str);
 
x = cmdl_len;
cmdl_len += work_str.dsc$w_length + 1;
CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
strncpy(&the_cmd_line[x], work_str.dsc$a_pointer,
work_str.dsc$w_length);
the_cmd_line[cmdl_len-1] = '\0';
 
}
 
/*
** Get the output directory, for UnZip.
**/
if (output_directory.dsc$w_length != 0) {
x = cmdl_len;
cmdl_len += output_directory.dsc$w_length + 4;
CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
strcpy(&the_cmd_line[x], "-d");
strncpy(&the_cmd_line[x+3], output_directory.dsc$a_pointer,
output_directory.dsc$w_length);
the_cmd_line[cmdl_len-1] = '\0';
}
 
/*
** Run through the list of files to unzip.
*/
status = cli$present(&cli_infile);
if (status & 1) {
status = get_list(&cli_infile, &foreign_cmdline, '\0',
&the_cmd_line, &cmdl_size, &cmdl_len);
if (!(status & 1)) return (status);
}
 
/*
** Get the list of files to exclude, if there are any.
*/
if (exclude_list) {
x = cmdl_len;
cmdl_len += 3;
CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
strcpy(&the_cmd_line[x], "-x");
 
status = get_list(&cli_exclude, &foreign_cmdline, '\0',
&the_cmd_line, &cmdl_size, &cmdl_len);
if (!(status & 1)) return (status);
}
 
/*
** We have finished collecting the strings for the argv vector,
** release unused space.
*/
if ((the_cmd_line = (char *) realloc(the_cmd_line, cmdl_len)) == NULL)
return (SS$_INSFMEM);
 
/*
** Now that we've built our new UNIX-like command line, count the
** number of args and build an argv array.
*/
for (new_argc = 0, x = 0; x < cmdl_len; x++)
if (the_cmd_line[x] == '\0')
new_argc++;
 
/*
** Allocate memory for the new argv[]. The last element of argv[]
** is supposed to be NULL, so allocate enough for new_argc+1.
*/
if ((new_argv = (char **) calloc(new_argc+1, sizeof(char *))) == NULL)
return (SS$_INSFMEM);
 
/*
** For each option, store the address in new_argv[] and convert the
** separating blanks to nulls so each argv[] string is terminated.
*/
for (ptr = the_cmd_line, x = 0; x < new_argc; x++) {
new_argv[x] = ptr;
ptr += strlen(ptr) + 1;
}
new_argv[new_argc] = NULL;
 
#if defined(TEST) || defined(DEBUG)
printf("new_argc = %d\n", new_argc);
for (x = 0; x < new_argc; x++)
printf("new_argv[%d] = %s\n", x, new_argv[x]);
#endif /* TEST || DEBUG */
 
/*
** All finished. Return the new argc and argv[] addresses to Zip.
*/
*argc_p = new_argc;
*argv_p = new_argv;
 
return (SS$_NORMAL);
}
 
 
static unsigned long
get_list (struct dsc$descriptor_s *qual, struct dsc$descriptor_d *rawtail,
int delim, char **p_str, unsigned long *p_size, unsigned long *p_end)
{
/*
** Routine: get_list
**
** Function: This routine runs through a comma-separated CLI list
** and copies the strings to the argv buffer. The
** specified separation character is used to separate
** the strings in the argv buffer.
**
** All unquoted strings are converted to lower-case.
**
** Formal parameters:
**
** qual - Address of descriptor for the qualifier name
** rawtail - Address of descriptor for the full command line tail
** delim - Character to use to separate the list items
** p_str - Address of pointer pointing to output buffer (argv strings)
** p_size - Address of number containing allocated size for output string
** p_end - Address of number containing used length in output buf
**
*/
 
register unsigned long status;
struct dsc$descriptor_d work_str;
 
init_dyndesc(work_str);
 
status = cli$present(qual);
if (status & 1) {
 
unsigned long len, old_len;
long ind, sind;
int keep_case;
char *src, *dst; int x;
 
/*
** Just in case the string doesn't exist yet, though it does.
*/
if (*p_str == NULL) {
*p_size = ARGBSIZE_UNIT;
if ((*p_str = (char *) malloc(*p_size)) == NULL)
return (SS$_INSFMEM);
len = 0;
} else {
len = *p_end;
}
 
while ((status = cli$get_value(qual, &work_str)) & 1) {
old_len = len;
len += work_str.dsc$w_length + 1;
CHECK_BUFFER_ALLOCATION(*p_str, *p_size, len)
 
/*
** Look for the filename in the original foreign command
** line to see if it was originally quoted. If so, then
** don't convert it to lowercase.
*/
keep_case = FALSE;
str$find_first_substring(rawtail, &ind, &sind, &work_str);
if ((ind > 1 && *(rawtail->dsc$a_pointer + ind - 2) == '"') ||
(ind == 0))
keep_case = TRUE;
 
/*
** Copy the string to the buffer, converting to lowercase.
*/
src = work_str.dsc$a_pointer;
dst = *p_str+old_len;
for (x = 0; x < work_str.dsc$w_length; x++) {
if (!keep_case && ((*src >= 'A') && (*src <= 'Z')))
*dst++ = *src++ + 32;
else
*dst++ = *src++;
}
if (status == CLI$_COMMA)
(*p_str)[len-1] = (char)delim;
else
(*p_str)[len-1] = '\0';
}
*p_end = len;
}
 
return (SS$_NORMAL);
 
}
 
static unsigned long
check_cli (struct dsc$descriptor_s *qual)
{
/*
** Routine: check_cli
**
** Function: Check to see if a CLD was used to invoke the program.
**
** Formal parameters:
**
** qual - Address of descriptor for qualifier name to check.
**
*/
lib$establish(lib$sig_to_ret); /* Establish condition handler */
return (cli$present(qual)); /* Just see if something was given */
}
 
#ifndef TEST
#ifdef SFX
 
#ifdef SFX_EXDIR
# define SFXOPT_EXDIR "\n and /DIRECTORY=exdir-spec"
#else
# define SFXOPT_EXDIR ""
#endif
 
#ifdef MORE
# define SFXOPT1 "/PAGE, "
#else
# define SFXOPT1 ""
#endif
 
int VMSCLI_usage(__GPRO__ int error) /* returns PK-type error code */
{
extern ZCONST char UnzipSFXBanner[];
#ifdef BETA
extern ZCONST char BetaVersion[];
#endif
int flag;
 
if (!show_VMSCLI_usage)
return usage(__G__ error);
 
flag = (error? 1 : 0);
 
Info(slide, flag, ((char *)slide, UnzipSFXBanner,
UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL, UZ_VERSION_DATE));
Info(slide, flag, ((char *)slide, "\
Valid main options are /TEST, /FRESHEN, /UPDATE, /PIPE, /SCREEN, /COMMENT%s.\n",
SFXOPT_EXDIR));
Info(slide, flag, ((char *)slide, "\
Modifying options are /TEXT, /BINARY, /JUNK, /EXISTING, /QUIET,\n\
/CASE_INSENSITIVE, /LOWERCASE, %s/VERSION, /RESTORE.\n",
SFXOPT1));
#ifdef BETA
Info(slide, flag, ((char *)slide, BetaVersion, "\n", "SFX"));
#endif
 
if (error)
return PK_PARAM;
else
return PK_COOL; /* just wanted usage screen: no error */
 
} /* end function VMSCLI_usage() */
 
 
#else /* !SFX */
 
int VMSCLI_usage(__GPRO__ int error) /* returns PK-type error code */
{
extern ZCONST char UnzipUsageLine1[];
#ifdef BETA
extern ZCONST char BetaVersion[];
#endif
int flag;
 
if (!show_VMSCLI_usage)
return usage(__G__ error);
 
/*---------------------------------------------------------------------------
If user requested usage, send it to stdout; else send to stderr.
---------------------------------------------------------------------------*/
 
flag = (error? 1 : 0);
 
 
/*---------------------------------------------------------------------------
Print either ZipInfo usage or UnZip usage, depending on incantation.
---------------------------------------------------------------------------*/
 
if (uO.zipinfo_mode) {
 
#ifndef NO_ZIPINFO
 
Info(slide, flag, ((char *)slide, "\
ZipInfo %d.%d%d%s %s, by Newtware and the fine folks at Info-ZIP.\n\n\
List name, date/time, attribute, size, compression method, etc., about files\n\
in list (excluding those in xlist) contained in the specified .zip archive(s).\
\n\"file[.zip]\" may be a wildcard name containing * or %% (e.g., \"*font-%%\
.zip\").\n", ZI_MAJORVER, ZI_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
UZ_VERSION_DATE));
 
Info(slide, flag, ((char *)slide, "\
usage: zipinfo file[.zip] [list] [/EXCL=(xlist)] [/DIR=exdir] /options\n\
or: unzip /ZIPINFO file[.zip] [list] [/EXCL=(xlist)] [/DIR=exdir] /options\
\n\nmain\
listing-format options: /SHORT short \"ls -l\" format (def.)\n\
/ONE_LINE just filenames, one/line /MEDIUM medium Unix \"ls -l\" format\n\
/VERBOSE verbose, multi-page format /LONG long Unix \"ls -l\" format\n\
"));
 
Info(slide, flag, ((char *)slide, "\
miscellaneous options:\n \
/HEADER print header line /TOTALS totals for listed files or for all\n\
/COMMENT print zipfile comment /TIMES times in sortable decimal format\n\
/[NO]CASE_INSENSITIVE match filenames case-insensitively\n\
/[NO]PAGE page output through built-in \"more\"\n\
/EXCLUDE=(file-spec1,etc.) exclude file-specs from listing\n"));
 
Info(slide, flag, ((char *)slide, "\n\
Type unzip \"-Z\" for Unix style flags\n\
Remember that non-lowercase filespecs must be\
quoted in VMS (e.g., \"Makefile\").\n"));
 
#endif /* !NO_ZIPINFO */
 
} else { /* UnZip mode */
 
Info(slide, flag, ((char *)slide, UnzipUsageLine1,
UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
UZ_VERSION_DATE));
 
#ifdef BETA
Info(slide, flag, ((char *)slide, BetaVersion, "", ""));
#endif
 
Info(slide, flag, ((char *)slide, "\
Usage: unzip file[.zip] [list] [/EXCL=(xlist)] [/DIR=exdir] /options /modifiers\
\n Default action is to extract files in list, except those in xlist, to exdir\
;\n file[.zip] may be a wildcard. %s\n\n",
#ifdef NO_ZIPINFO
"(ZipInfo mode is disabled in this version.)"
#else
"Type \"unzip /ZIPINFO\" for ZipInfo-mode usage."
#endif
));
 
Info(slide, flag, ((char *)slide, "\
Major options include (type unzip -h for Unix style flags):\n\
/[NO]TEST, /LIST, /[NO]SCREEN, /PIPE, /[NO]FRESHEN, /[NO]UPDATE,\n\
/[NO]COMMENT, /DIRECTORY=directory-spec, /EXCLUDE=(file-spec1,etc.)\n\n\
Modifiers include:\n\
/BRIEF, /FULL, /[NO]TEXT[=NONE|AUTO|ALL], /[NO]BINARY[=NONE|AUTO|ALL],\n\
/EXISTING={NEW_VERSION|OVERWRITE|NOEXTRACT}, /[NO]JUNK, /QUIET,\n\
/QUIET[=SUPER], /[NO]PAGE, /[NO]CASE_INSENSITIVE, /[NO]LOWERCASE,\n\
/[NO]VERSION, /RESTORE[=([NO]OWNER_PROT[,NODATE|DATE={ALL|FILES}])]\n\n"));
 
Info(slide, flag, ((char *)slide, "\
Examples (see unzip.txt or \"HELP UNZIP\" for more info):\n\
unzip edit1 /EXCL=joe.jou /CASE_INSENSITIVE => Extract all files except\
\n\
joe.jou (or JOE.JOU, or any combination of case) from zipfile edit1.zip.\
\n \
unzip zip201 \"Makefile.VMS\" vms/*.[ch] => extract VMS Makefile and\
\n\
*.c and *.h files; must quote uppercase names if /CASE_INSENS not used.\
\n\
unzip foo /DIR=tmp:[.test] /JUNK /TEXT /EXIS=NEW => extract all files to\
\n\
tmp. dir., flatten hierarchy, auto-conv. text files, create new versions.\
\n"));
 
} /* end if (zipinfo_mode) */
 
if (error)
return PK_PARAM;
else
return PK_COOL; /* just wanted usage screen: no error */
 
} /* end function VMSCLI_usage() */
 
#endif /* ?SFX */
#endif /* !TEST */
/programs/fs/unzip60/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:
$!
/programs/fs/unzip60/vms/cvthelp.tpu
0,0 → 1,180
! TITLE CVTHELP.TPU
! IDENT 01-001
!
!++
! Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
!
! See the accompanying file LICENSE, version 2000-Apr-09 or later
! (the contents of which are also included in zip.h) for terms of use.
! If, for some reason, all these files are missing, the Info-ZIP license
! also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
!
!++
!
! Program: CVTHELP.TPU
!
! Author: Hunter Goatley
!
! Date: January 12, 1992
!
! Purpose: Convert .HELP files to RUNOFF .RNH files. Substitutes
! RUNOFF commands for tags imbedded in the .HELP file.
!
! Calling sequence:
!
! $ EDIT/TPU/NOJOURNAL/NODISPLAY/COMMAND=CVTHELP file.HELP
!
! Modified by:
!
! 01-001 Hunter Goatley 7-FEB-2001 15:40
! Added <NEXT> for qualifier separators.
!
! 01-000 Hunter Goatley 12-JAN-1992 15:15
! Original version.
!
!--
Procedure eve_convert_help
Local temp
,x
;
 
qualifier_level := 0;
hg$substitute_topic(current_buffer, "<MAIN>", ".indent-3", "1");
hg$substitute_topic(current_buffer, "<QUALIFIER>", ".sk;.indent-3", "");
hg$substitute_topic(current_buffer, "<TOPIC>", ".indent-3", "2");
hg$substitute_topic(current_buffer, "<SUBTOPIC>", ".indent-3", "3");
hg$substitute_topic(current_buffer, "<SUBSUBTOPIC>", ".indent-3", "4");
hg$substitute_comment(current_buffer,"<QUALIFIERS>",".indent-3;2 Qualifiers");
hg$substitute_comment(current_buffer,"<PARAMETER>",".indent-2");
hg$substitute_comment(current_buffer,"<PTEXT>",".lm+3");
hg$substitute_comment(current_buffer,"<TXETP>",".lm-3");
hg$substitute_comment(current_buffer,"<ETEXT>",".lm+4");
hg$substitute_comment(current_buffer,"<TXETE>",".lm-4");
hg$substitute_comment(current_buffer,"<INIT>",".noflags;.lm3;.rm70");
hg$substitute_comment(current_buffer,"<LITERAL>",".lm+4;.literal");
hg$substitute_comment(current_buffer,"<LARETIL>",".end literal;.lm-4");
hg$substitute_comment(current_buffer,"<DOT1LIST>",'.list 1,"o"');
hg$substitute_comment(current_buffer,"<DOT0LIST>",'.list 0,"o"');
hg$substitute_comment(current_buffer,"<ENTRY>",".le");
hg$substitute_comment(current_buffer,"<TSIL>",".end list");
hg$substitute_comment(current_buffer,"<CENTER>",".center");
hg$substitute_comment(current_buffer,"<FORMAT>",".sk;.indent2");
hg$substitute_comment(current_buffer,"<NOTE>",".note");
hg$substitute_comment(current_buffer,"<ETON>",".end note");
hg$substitute_comment(current_buffer, LINE_BEGIN & LINE_END,".sk");
hg$substitute_comment(current_buffer, LINE_BEGIN & "|", "");
hg$substitute_comment(current_buffer,"<NEXT>",".br");
 
EndProcedure; ! eve_convert_help
 
Procedure hg$substitute_comment (the_buffer, target, new)
Local temp
,save_pos
,x
;
on_error;
endon_error;
 
save_pos := mark(none);
position(beginning_of(the_buffer));
loop
x := search(target, forward);
exitif x = 0;
position (x);
erase_character(length(x));
copy_text(new);
endloop;
 
position(save_pos);
 
EndProcedure; ! hg$substitute_comment
 
Procedure hg$substitute_topic (the_buffer, target, new, level)
Local temp
,save_pos
,x
;
on_error;
endon_error;
 
save_pos := mark(none);
position(beginning_of(the_buffer));
loop
x := search(target, forward);
exitif x = 0;
position (x);
erase_character(length(x));
move_vertical(-1);
if (length(current_line) = 0)
then copy_text("|");
endif;
move_vertical(1);
copy_text(".!------------------------------------------------------");
split_line;
copy_text(new);
move_horizontal(-current_offset);
move_vertical(1);
if level <> "" then
copy_text(level + " ");
! else
! if qualifier_level = 0
! then
! copy_text("2 Qualifiers");
! split_line; split_line;
! copy_text(new); split_line;
! qualifier_level := 1;
! endif;
endif;
move_horizontal(-current_offset);
move_vertical(1);
if length(current_line) = 0
then
if (target = "<MAIN>") OR (target = "<TOPIC>")
OR (target = "<SUBTOPIC>") or (target = "<SUBSUBTOPIC>")
then copy_text(".br");
else copy_text(".sk");
endif;
endif;
endloop;
 
position(save_pos);
 
EndProcedure; ! hg$substitute_topic
 
!===============================================================================
Procedure tpu$init_procedure
Local temp
,orig_filespec
,f
;
 
on_error
endon_error;
 
!Prompt user for information
 
orig_filespec := get_info(command_line, "file_name");
if orig_filespec = ""
then
message("No .HELP file given");
quit;
endif;
f := file_parse(orig_filespec, ".HELP"); !Add .LIS ending
 
! Create a buffer and window for editing
 
main_buf := create_buffer ("MAIN",f);
set (eob_text, main_buf, "[End of buffer]");
 
position (beginning_of(main_buf));
 
eve_convert_help;
 
f := file_parse(orig_filespec,"","",NAME);
 
write_file (main_buf, f+".RNH");
 
quit;
EndProcedure; !TPU$INIT_PROCEDURE
 
tpu$init_procedure;
/programs/fs/unzip60/vms/descrip.mms
0,0 → 1,397
# 1 March 2009. SMS.
#
# UnZip 6.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:
#
# USEBZ2=1 Build with optional BZIP2 support. This macro
# is a shortcut for IZ_BZIP2=SYS$DISK:[.BZIP2].
# Additionally, it forces invokation of the UnZip-supplied
# bzip2 make script provided in [.bzip2]descrbz2.mms.
# This results in a "single-command" build of UnZip with
# bzip2 support directly from the sources.
#
# IZ_BZIP2=dev:[dir] Build with optional BZIP2 support. The value
# of the MMS macro, ("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.
# By default, the SFX programs are built without BZIP2
# support. Add "BZIP2_SFX=1" to the LOCAL_UNZIP C
# macros to enable it. (See LOCAL_UNZIP, below.)
#
# IZ_ZLIB=dev:[dir] Use ZLIB compression library instead of internal
# compression routines. The value of the MMS
# macro ("dev:[dir]", or a suitable logical name)
# tells where to find "zlib.h". The ZLIB object
# library (LIBZ.OLB) is expected to be in a
# "[.dest]" directory under that one
# ("dev:[dir.ALPHAL]", for example), or in that
# directory itself.
#
# CCOPTS=xxx Compile with CC options xxx. For example:
# CCOPTS=/ARCH=HOST
#
# DBG=1 Compile with /DEBUG /NOOPTIMIZE.
# Link with /DEBUG /TRACEBACK.
# (Default is /NOTRACEBACK.)
#
# LARGE=1 Enable large-file (>2GB) support. Non-VAX only.
#
# 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.
#
# NOSHARE=1 Link /NOSYSSHR (not using shareable images).
# NOSHARE=OLDVAX Link /NOSYSSHR on VAX for:
# DEC C with VMS before V7.3.
# VAX C without DEC C RTL (DEC C not installed).
#
# "LOCAL_UNZIP= c_macro_1=value1 [, c_macro_2=value2 [...]]"
# Compile with these additional C macros defined.
#
# 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_UNZIP = SYS$DISK:[.$(DEST)]UNZIP.OLB
LIB_UNZIP_CLI = SYS$DISK:[.$(DEST)]UNZIPCLI.OLB
LIB_UNZIPSFX = SYS$DISK:[.$(DEST)]UNZIPSFX.OLB
LIB_UNZIPSFX_CLI = SYS$DISK:[.$(DEST)]UNZSFXCLI.OLB
 
# Help file names.
 
UNZIP_HELP = UNZIP.HLP UNZIP_CLI.HLP
 
# Message file names.
 
UNZIP_MSG_MSG = [.VMS]UNZIP_MSG.MSG
UNZIP_MSG_EXE = [.$(DEST)]UNZIP_MSG.EXE
UNZIP_MSG_OBJ = [.$(DEST)]UNZIP_MSG.OBJ
 
 
# TARGETS.
 
# Default target, ALL. Build All executables,
# and help files.
 
ALL : $(UNZIP) $(UNZIP_CLI) $(UNZIPSFX) $(UNZIPSFX_CLI) $(UNZIP_HELP) \
$(UNZIP_MSG_EXE)
@ write sys$output "Done."
 
# CLEAN target. Delete the [.$(DEST)] directory and everything in it.
 
CLEAN :
if (f$search( "[.$(DEST)]*.*") .nes. "") then -
delete [.$(DEST)]*.*;*
if (f$search( "$(DEST).dir") .nes. "") then -
set protection = w:d $(DEST).dir;*
if (f$search( "$(DEST).dir") .nes. "") then -
delete $(DEST).dir;*
 
# CLEAN_ALL target. Delete:
# The [.$(DEST)] directories and everything in them.
# All help-related derived files,
# All individual C dependency files.
# Also mention:
# Comprehensive dependency file.
#
CLEAN_ALL :
if (f$search( "[.ALPHA*]*.*") .nes. "") then -
delete [.ALPHA*]*.*;*
if (f$search( "ALPHA*.dir", 1) .nes. "") then -
set protection = w:d ALPHA*.dir;*
if (f$search( "ALPHA*.dir", 2) .nes. "") then -
delete ALPHA*.dir;*
if (f$search( "[.IA64*]*.*") .nes. "") then -
delete [.IA64*]*.*;*
if (f$search( "IA64*.dir", 1) .nes. "") then -
set protection = w:d IA64*.dir;*
if (f$search( "IA64*.dir", 2) .nes. "") then -
delete IA64*.dir;*
if (f$search( "[.VAX*]*.*") .nes. "") then -
delete [.VAX*]*.*;*
if (f$search( "VAX*.dir", 1) .nes. "") then -
set protection = w:d VAX*.dir;*
if (f$search( "VAX*.dir", 2) .nes. "") then -
delete VAX*.dir;*
if (f$search( "[.VMS]UNZIP_CLI.RNH") .nes. "") then -
delete [.VMS]UNZIP_CLI.RNH;*
if (f$search( "UNZIP_CLI.HLP") .nes. "") then -
delete UNZIP_CLI.HLP;*
if (f$search( "UNZIP.HLP") .nes. "") then -
delete UNZIP.HLP;*
if (f$search( "*.MMSD") .nes. "") then -
delete *.MMSD;*
if (f$search( "[.VMS]*.MMSD") .nes. "") then -
delete [.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 ""
 
# CLEAN_EXE target. Delete the executables in [.$(DEST)].
 
CLEAN_EXE :
if (f$search( "[.$(DEST)]*.EXE") .nes. "") then -
delete [.$(DEST)]*.EXE;*
 
 
# Object library module dependencies.
 
$(LIB_UNZIP) : $(LIB_UNZIP)($(MODS_OBJS_LIB_UNZIP))
@ write sys$output "$(MMS$TARGET) updated."
 
$(LIB_UNZIP_CLI) : $(LIB_UNZIP_CLI)($(MODS_OBJS_LIB_UNZIP_CLI))
@ write sys$output "$(MMS$TARGET) updated."
 
$(LIB_UNZIPSFX) : $(LIB_UNZIPSFX)($(MODS_OBJS_LIB_UNZIPSFX))
@ write sys$output "$(MMS$TARGET) updated."
 
$(LIB_UNZIPSFX_CLI) : $(LIB_UNZIPSFX_CLI)($(MODS_OBJS_LIB_UNZIPSFX_CLI))
@ write sys$output "$(MMS$TARGET) updated."
 
 
# Module ID options files.
 
OPT_ID = SYS$DISK:[.VMS]UNZIP.OPT
OPT_ID_SFX = SYS$DISK:[.VMS]UNZIPSFX.OPT
 
# Default C compile rule.
 
.C.OBJ :
$(CC) $(CFLAGS) $(CDEFS_UNX) $(MMS$SOURCE)
 
 
# Normal sources in [.VMS].
 
[.$(DEST)]VMS.OBJ : [.VMS]VMS.C
 
# Command-line interface files.
 
[.$(DEST)]CMDLINE.OBJ : [.VMS]CMDLINE.C
$(CC) $(CFLAGS) $(CDEFS_CLI) $(MMS$SOURCE)
 
[.$(DEST)]UNZIPCLI.OBJ : UNZIP.C
$(CC) $(CFLAGS) $(CDEFS_CLI) $(MMS$SOURCE)
 
[.$(DEST)]UNZ_CLI.OBJ : [.VMS]UNZ_CLI.CLD
 
# SFX variant sources.
 
[.$(DEST)]CRC32_.OBJ : CRC32.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]CRYPT_.OBJ : CRYPT.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]EXTRACT_.OBJ : EXTRACT.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]FILEIO_.OBJ : FILEIO.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]GLOBALS_.OBJ : GLOBALS.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]INFLATE_.OBJ : INFLATE.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]MATCH_.OBJ : MATCH.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]PROCESS_.OBJ : PROCESS.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]TTYIO_.OBJ : TTYIO.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]UBZ2ERR_.OBJ : UBZ2ERR.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]VMS_.OBJ : [.VMS]VMS.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
[.$(DEST)]UNZIPSFX.OBJ : UNZIP.C
$(CC) $(CFLAGS) $(CDEFS_SFX) $(MMS$SOURCE)
 
# SFX CLI variant sources.
 
[.$(DEST)]CMDLINE_.OBJ : [.VMS]CMDLINE.C
$(CC) $(CFLAGS) $(CDEFS_SFX_CLI) $(MMS$SOURCE)
 
[.$(DEST)]UNZSFXCLI.OBJ : UNZIP.C
$(CC) $(CFLAGS) $(CDEFS_SFX_CLI) $(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
 
# Local BZIP2 object library.
 
$(LIB_BZ2_LOCAL) :
$(MMS) $(MMSQUALIFIERS) /DESCR=$(IZ_BZIP2)descrbz2.mms'macro' -
/MACRO = (SRCDIR=$(IZ_BZIP2), DSTDIR=$(BZ2DIR_BIN), -
DEST=$(IZ_BZIP2)$(DESTM)) $(MMSTARGETS)
 
# Normal UnZip executable.
 
$(UNZIP) : [.$(DEST)]UNZIP.OBJ \
$(LIB_UNZIP) $(LIB_BZ2_DEP) $(OPT_FILE) $(OPT_ID)
$(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
$(LIB_UNZIP) /library, -
$(LIB_BZIP2_OPTS) -
$(LIB_UNZIP) /library, -
$(LIB_ZLIB_OPTS) -
$(LFLAGS_ARCH) -
$(OPT_ID) /options -
$(NOSHARE_OPTS)
 
# CLI UnZip executable.
 
$(UNZIP_CLI) : [.$(DEST)]UNZIPCLI.OBJ \
$(LIB_UNZIP_CLI) $(LIB_BZ2_DEP) $(OPT_FILE) $(OPT_ID)
$(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
$(LIB_UNZIP_CLI) /library, -
$(LIB_UNZIP) /library, -
$(LIB_BZIP2_OPTS) -
$(LIB_UNZIP) /library, -
$(LIB_ZLIB_OPTS) -
$(LFLAGS_ARCH) -
$(OPT_ID) /options -
$(NOSHARE_OPTS)
 
# SFX UnZip executable.
 
$(UNZIPSFX) : [.$(DEST)]UNZIPSFX.OBJ \
$(LIB_UNZIPSFX) $(LIB_BZ2_DEP) $(OPT_FILE) $(OPT_ID_SFX)
$(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
$(LIB_UNZIPSFX) /library, -
$(LIB_BZIP2_OPTS) -
$(LIB_UNZIPSFX) /library, -
$(LIB_ZLIB_OPTS) -
$(LFLAGS_ARCH) -
$(OPT_ID_SFX) /options -
$(NOSHARE_OPTS)
 
# SFX CLI UnZip executable.
 
$(UNZIPSFX_CLI) : [.$(DEST)]UNZSFXCLI.OBJ \
$(LIB_UNZIPSFX_CLI) $(LIB_UNZIPSFX) $(LIB_BZ2_DEP) \
$(OPT_FILE) $(OPT_ID_SFX)
$(LINK) $(LINKFLAGS) $(MMS$SOURCE), -
$(LIB_UNZIPSFX_CLI) /library, -
$(LIB_UNZIPSFX) /library, -
$(LIB_BZIP2_OPTS) -
$(LIB_UNZIPSFX) /library, -
$(LIB_ZLIB_OPTS) -
$(LFLAGS_ARCH) -
$(OPT_ID_SFX) /options -
$(NOSHARE_OPTS)
 
 
# Help files.
 
UNZIP.HLP : [.VMS]UNZIP_DEF.RNH
runoff /output = $(MMS$TARGET) $(MMS$SOURCE)
 
UNZIP_CLI.HLP : [.VMS]UNZIP_CLI.HELP [.VMS]CVTHELP.TPU
edit /tpu /nosection /nodisplay /command = [.VMS]CVTHELP.TPU -
$(MMS$SOURCE)
rename UNZIP_CLI.RNH [.VMS]
purge /nolog /keep = 1 [.VMS]UNZIP_CLI.RNH
runoff /output = $(MMS$TARGET) [.VMS]UNZIP_CLI.RNH
 
# Message file.
 
$(UNZIP_MSG_EXE) : $(UNZIP_MSG_OBJ)
link /shareable = $(MMS$TARGET) $(UNZIP_MSG_OBJ)
 
$(UNZIP_MSG_OBJ) : $(UNZIP_MSG_MSG)
message /object = $(MMS$TARGET) /nosymbols $(UNZIP_MSG_MSG)
 
# Include generated source dependencies.
 
INCL_DESCRIP_DEPS = 1
.INCLUDE [.VMS]DESCRIP_DEPS.MMS
 
/programs/fs/unzip60/vms/descrip_deps.mms
0,0 → 1,240
#
# UnZip for VMS - MMS (or MMK) Source Dependency File.
#
 
# This description file is included by other description files. It is
# not intended to be used alone. Verify proper inclusion.
 
.IFDEF INCL_DESCRIP_DEPS
.ELSE
$$$$ THIS DESCRIPTION FILE IS NOT INTENDED TO BE USED THIS WAY.
.ENDIF
 
[.$(DEST)]CRC32.OBJ : []CRC32.C
[.$(DEST)]CRC32.OBJ : []ZIP.H
[.$(DEST)]CRC32.OBJ : []UNZIP.H
[.$(DEST)]CRC32.OBJ : []UNZPRIV.H
[.$(DEST)]CRC32.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]CRC32.OBJ : []GLOBALS.H
[.$(DEST)]CRC32.OBJ : []CRC32.H
[.$(DEST)]CRC32_.OBJ : []CRC32.C
[.$(DEST)]CRC32_.OBJ : []ZIP.H
[.$(DEST)]CRC32_.OBJ : []UNZIP.H
[.$(DEST)]CRC32_.OBJ : []UNZPRIV.H
[.$(DEST)]CRC32_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]CRC32_.OBJ : []GLOBALS.H
[.$(DEST)]CRC32_.OBJ : []CRC32.H
[.$(DEST)]CRYPT.OBJ : []CRYPT.C
[.$(DEST)]CRYPT.OBJ : []ZIP.H
[.$(DEST)]CRYPT.OBJ : []UNZIP.H
[.$(DEST)]CRYPT.OBJ : []UNZPRIV.H
[.$(DEST)]CRYPT.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]CRYPT.OBJ : []GLOBALS.H
[.$(DEST)]CRYPT.OBJ : []CRYPT.H
[.$(DEST)]CRYPT.OBJ : []TTYIO.H
[.$(DEST)]CRYPT.OBJ : []CRC32.H
[.$(DEST)]CRYPT_.OBJ : []CRYPT.C
[.$(DEST)]CRYPT_.OBJ : []ZIP.H
[.$(DEST)]CRYPT_.OBJ : []UNZIP.H
[.$(DEST)]CRYPT_.OBJ : []UNZPRIV.H
[.$(DEST)]CRYPT_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]CRYPT_.OBJ : []GLOBALS.H
[.$(DEST)]CRYPT_.OBJ : []CRYPT.H
[.$(DEST)]CRYPT_.OBJ : []TTYIO.H
[.$(DEST)]CRYPT_.OBJ : []CRC32.H
[.$(DEST)]ENVARGS.OBJ : []ENVARGS.C
[.$(DEST)]ENVARGS.OBJ : []UNZIP.H
[.$(DEST)]ENVARGS.OBJ : []UNZPRIV.H
[.$(DEST)]ENVARGS.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]ENVARGS.OBJ : []GLOBALS.H
[.$(DEST)]EXPLODE.OBJ : []EXPLODE.C
[.$(DEST)]EXPLODE.OBJ : []UNZIP.H
[.$(DEST)]EXPLODE.OBJ : []UNZPRIV.H
[.$(DEST)]EXPLODE.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]EXPLODE.OBJ : []GLOBALS.H
[.$(DEST)]EXTRACT.OBJ : []EXTRACT.C
[.$(DEST)]EXTRACT.OBJ : []UNZIP.H
[.$(DEST)]EXTRACT.OBJ : []UNZPRIV.H
[.$(DEST)]EXTRACT.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]EXTRACT.OBJ : []GLOBALS.H
[.$(DEST)]EXTRACT.OBJ : []CRC32.H
[.$(DEST)]EXTRACT.OBJ : []ZIP.H
[.$(DEST)]EXTRACT.OBJ : []CRYPT.H
[.$(DEST)]EXTRACT_.OBJ : []EXTRACT.C
[.$(DEST)]EXTRACT_.OBJ : []UNZIP.H
[.$(DEST)]EXTRACT_.OBJ : []UNZPRIV.H
[.$(DEST)]EXTRACT_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]EXTRACT_.OBJ : []GLOBALS.H
[.$(DEST)]EXTRACT_.OBJ : []CRC32.H
[.$(DEST)]EXTRACT_.OBJ : []ZIP.H
[.$(DEST)]EXTRACT_.OBJ : []CRYPT.H
[.$(DEST)]FILEIO.OBJ : []FILEIO.C
[.$(DEST)]FILEIO.OBJ : []UNZIP.H
[.$(DEST)]FILEIO.OBJ : []UNZPRIV.H
[.$(DEST)]FILEIO.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]FILEIO.OBJ : []GLOBALS.H
[.$(DEST)]FILEIO.OBJ : []CRC32.H
[.$(DEST)]FILEIO.OBJ : []ZIP.H
[.$(DEST)]FILEIO.OBJ : []CRYPT.H
[.$(DEST)]FILEIO.OBJ : []TTYIO.H
[.$(DEST)]FILEIO.OBJ : []EBCDIC.H
[.$(DEST)]FILEIO_.OBJ : []FILEIO.C
[.$(DEST)]FILEIO_.OBJ : []UNZIP.H
[.$(DEST)]FILEIO_.OBJ : []UNZPRIV.H
[.$(DEST)]FILEIO_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]FILEIO_.OBJ : []GLOBALS.H
[.$(DEST)]FILEIO_.OBJ : []CRC32.H
[.$(DEST)]FILEIO_.OBJ : []ZIP.H
[.$(DEST)]FILEIO_.OBJ : []CRYPT.H
[.$(DEST)]FILEIO_.OBJ : []TTYIO.H
[.$(DEST)]FILEIO_.OBJ : []EBCDIC.H
[.$(DEST)]GLOBALS.OBJ : []GLOBALS.C
[.$(DEST)]GLOBALS.OBJ : []UNZIP.H
[.$(DEST)]GLOBALS.OBJ : []UNZPRIV.H
[.$(DEST)]GLOBALS.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]GLOBALS.OBJ : []GLOBALS.H
[.$(DEST)]GLOBALS_.OBJ : []GLOBALS.C
[.$(DEST)]GLOBALS_.OBJ : []UNZIP.H
[.$(DEST)]GLOBALS_.OBJ : []UNZPRIV.H
[.$(DEST)]GLOBALS_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]GLOBALS_.OBJ : []GLOBALS.H
[.$(DEST)]INFLATE.OBJ : []INFLATE.C
[.$(DEST)]INFLATE.OBJ : []INFLATE.H
[.$(DEST)]INFLATE.OBJ : []UNZIP.H
[.$(DEST)]INFLATE.OBJ : []UNZPRIV.H
[.$(DEST)]INFLATE.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]INFLATE.OBJ : []GLOBALS.H
[.$(DEST)]INFLATE_.OBJ : []INFLATE.C
[.$(DEST)]INFLATE_.OBJ : []INFLATE.H
[.$(DEST)]INFLATE_.OBJ : []UNZIP.H
[.$(DEST)]INFLATE_.OBJ : []UNZPRIV.H
[.$(DEST)]INFLATE_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]INFLATE_.OBJ : []GLOBALS.H
[.$(DEST)]LIST.OBJ : []LIST.C
[.$(DEST)]LIST.OBJ : []UNZIP.H
[.$(DEST)]LIST.OBJ : []UNZPRIV.H
[.$(DEST)]LIST.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]LIST.OBJ : []GLOBALS.H
[.$(DEST)]MATCH.OBJ : []MATCH.C
[.$(DEST)]MATCH.OBJ : []UNZIP.H
[.$(DEST)]MATCH.OBJ : []UNZPRIV.H
[.$(DEST)]MATCH.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]MATCH.OBJ : []GLOBALS.H
[.$(DEST)]MATCH_.OBJ : []MATCH.C
[.$(DEST)]MATCH_.OBJ : []UNZIP.H
[.$(DEST)]MATCH_.OBJ : []UNZPRIV.H
[.$(DEST)]MATCH_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]MATCH_.OBJ : []GLOBALS.H
[.$(DEST)]PROCESS.OBJ : []PROCESS.C
[.$(DEST)]PROCESS.OBJ : []UNZIP.H
[.$(DEST)]PROCESS.OBJ : []UNZPRIV.H
[.$(DEST)]PROCESS.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]PROCESS.OBJ : []GLOBALS.H
[.$(DEST)]PROCESS.OBJ : []CRC32.H
[.$(DEST)]PROCESS.OBJ : []ZIP.H
[.$(DEST)]PROCESS_.OBJ : []PROCESS.C
[.$(DEST)]PROCESS_.OBJ : []UNZIP.H
[.$(DEST)]PROCESS_.OBJ : []UNZPRIV.H
[.$(DEST)]PROCESS_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]PROCESS_.OBJ : []GLOBALS.H
[.$(DEST)]PROCESS_.OBJ : []CRC32.H
[.$(DEST)]PROCESS_.OBJ : []ZIP.H
[.$(DEST)]TTYIO.OBJ : []TTYIO.C
[.$(DEST)]TTYIO.OBJ : []ZIP.H
[.$(DEST)]TTYIO.OBJ : []UNZIP.H
[.$(DEST)]TTYIO.OBJ : []UNZPRIV.H
[.$(DEST)]TTYIO.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]TTYIO.OBJ : []GLOBALS.H
[.$(DEST)]TTYIO.OBJ : []CRYPT.H
[.$(DEST)]TTYIO.OBJ : []TTYIO.H
[.$(DEST)]TTYIO_.OBJ : []TTYIO.C
[.$(DEST)]TTYIO_.OBJ : []ZIP.H
[.$(DEST)]TTYIO_.OBJ : []UNZIP.H
[.$(DEST)]TTYIO_.OBJ : []UNZPRIV.H
[.$(DEST)]TTYIO_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]TTYIO_.OBJ : []GLOBALS.H
[.$(DEST)]TTYIO_.OBJ : []CRYPT.H
[.$(DEST)]TTYIO_.OBJ : []TTYIO.H
[.$(DEST)]UBZ2ERR.OBJ : []UBZ2ERR.C
[.$(DEST)]UBZ2ERR.OBJ : []UNZIP.H
[.$(DEST)]UBZ2ERR.OBJ : []UNZPRIV.H
[.$(DEST)]UBZ2ERR.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]UBZ2ERR.OBJ : []GLOBALS.H
[.$(DEST)]UBZ2ERR_.OBJ : []UBZ2ERR.C
[.$(DEST)]UBZ2ERR_.OBJ : []UNZIP.H
[.$(DEST)]UBZ2ERR_.OBJ : []UNZPRIV.H
[.$(DEST)]UBZ2ERR_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]UBZ2ERR_.OBJ : []GLOBALS.H
[.$(DEST)]UNREDUCE.OBJ : []UNREDUCE.C
[.$(DEST)]UNREDUCE.OBJ : []UNZIP.H
[.$(DEST)]UNREDUCE.OBJ : []UNZPRIV.H
[.$(DEST)]UNREDUCE.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]UNREDUCE.OBJ : []GLOBALS.H
[.$(DEST)]UNSHRINK.OBJ : []UNSHRINK.C
[.$(DEST)]UNSHRINK.OBJ : []UNZIP.H
[.$(DEST)]UNSHRINK.OBJ : []UNZPRIV.H
[.$(DEST)]UNSHRINK.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]UNSHRINK.OBJ : []GLOBALS.H
[.$(DEST)]UNZIP.OBJ : []UNZIP.C
[.$(DEST)]UNZIP.OBJ : []UNZIP.H
[.$(DEST)]UNZIP.OBJ : []UNZPRIV.H
[.$(DEST)]UNZIP.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]UNZIP.OBJ : []GLOBALS.H
[.$(DEST)]UNZIP.OBJ : []CRYPT.H
[.$(DEST)]UNZIP.OBJ : []UNZVERS.H
[.$(DEST)]UNZIP.OBJ : []CONSTS.H
[.$(DEST)]UNZIPSFX.OBJ : []UNZIP.C
[.$(DEST)]UNZIPSFX.OBJ : []UNZIP.H
[.$(DEST)]UNZIPSFX.OBJ : []UNZPRIV.H
[.$(DEST)]UNZIPSFX.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]UNZIPSFX.OBJ : []GLOBALS.H
[.$(DEST)]UNZIPSFX.OBJ : []CRYPT.H
[.$(DEST)]UNZIPSFX.OBJ : []UNZVERS.H
[.$(DEST)]UNZIPSFX.OBJ : []CONSTS.H
[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZIP.C
[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZIP.H
[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZPRIV.H
[.$(DEST)]UNZIPSFX_CLI.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]UNZIPSFX_CLI.OBJ : []GLOBALS.H
[.$(DEST)]UNZIPSFX_CLI.OBJ : []CRYPT.H
[.$(DEST)]UNZIPSFX_CLI.OBJ : []UNZVERS.H
[.$(DEST)]UNZIPSFX_CLI.OBJ : []CONSTS.H
[.$(DEST)]UNZIP_CLI.OBJ : []UNZIP.C
[.$(DEST)]UNZIP_CLI.OBJ : []UNZIP.H
[.$(DEST)]UNZIP_CLI.OBJ : []UNZPRIV.H
[.$(DEST)]UNZIP_CLI.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]UNZIP_CLI.OBJ : []GLOBALS.H
[.$(DEST)]UNZIP_CLI.OBJ : []CRYPT.H
[.$(DEST)]UNZIP_CLI.OBJ : []UNZVERS.H
[.$(DEST)]UNZIP_CLI.OBJ : []CONSTS.H
[.$(DEST)]ZIPINFO.OBJ : []ZIPINFO.C
[.$(DEST)]ZIPINFO.OBJ : []UNZIP.H
[.$(DEST)]ZIPINFO.OBJ : []UNZPRIV.H
[.$(DEST)]ZIPINFO.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]ZIPINFO.OBJ : []GLOBALS.H
[.$(DEST)]CMDLINE.OBJ : [.VMS]CMDLINE.C
[.$(DEST)]CMDLINE.OBJ : []UNZIP.H
[.$(DEST)]CMDLINE.OBJ : []UNZPRIV.H
[.$(DEST)]CMDLINE.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]CMDLINE.OBJ : []GLOBALS.H
[.$(DEST)]CMDLINE.OBJ : []UNZVERS.H
[.$(DEST)]VMS.OBJ : [.VMS]VMS.C
[.$(DEST)]VMS.OBJ : []UNZIP.H
[.$(DEST)]VMS.OBJ : []UNZPRIV.H
[.$(DEST)]VMS.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]VMS.OBJ : []GLOBALS.H
[.$(DEST)]VMS.OBJ : []CRC32.H
[.$(DEST)]VMS.OBJ : []ZIP.H
[.$(DEST)]VMS.OBJ : []UNZIP.H
[.$(DEST)]VMS.OBJ : [.VMS]VMS.H
[.$(DEST)]VMS.OBJ : [.VMS]VMSDEFS.H
[.$(DEST)]VMS_.OBJ : [.VMS]VMS.C
[.$(DEST)]VMS_.OBJ : []UNZIP.H
[.$(DEST)]VMS_.OBJ : []UNZPRIV.H
[.$(DEST)]VMS_.OBJ : [.VMS]VMSCFG.H
[.$(DEST)]VMS_.OBJ : []GLOBALS.H
[.$(DEST)]VMS_.OBJ : []CRC32.H
[.$(DEST)]VMS_.OBJ : []ZIP.H
[.$(DEST)]VMS_.OBJ : []UNZIP.H
[.$(DEST)]VMS_.OBJ : [.VMS]VMS.H
[.$(DEST)]VMS_.OBJ : [.VMS]VMSDEFS.H
/programs/fs/unzip60/vms/descrip_mkdeps.mms
0,0 → 1,289
# 1 February 2008. SMS.
#
# UnZip 6.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_UNZIP_N = $(FILTER-OUT *], \
$(PATSUBST *]*.OBJ, *] *, $(MODS_OBJS_LIB_UNZIP_N)))
 
MODS_LIB_UNZIP_V = $(FILTER-OUT *], \
$(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_UNZIP_V)))
 
MODS_LIB_UNZIPCLI_V = $(FILTER-OUT *], \
$(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_UNZIPCLI_C_V)))
 
MODS_LIB_UNZIPSFX_N = $(FILTER-OUT *], \
$(PATSUBST *]*.OBJ, *] *, $(MODS_OBJS_LIB_UNZIPSFX_N)))
 
MODS_LIB_UNZIPSFX_V = $(FILTER-OUT *], \
$(PATSUBST *]*.OBJ, *] [.VMS]*, $(MODS_OBJS_LIB_UNZIPSFX_V)))
 
MODS_UNZIP = $(FILTER-OUT *], \
$(PATSUBST *]*.EXE, *] *, $(UNZIP)))
 
MODS_UNZIP_CLI = $(FILTER-OUT *], \
$(PATSUBST *]*.EXE, *] *, $(UNZIP_CLI)))
 
MODS_UNZIPSFX = $(FILTER-OUT *], \
$(PATSUBST *]*.EXE, *] *, $(UNZIPSFX)))
 
MODS_UNZIPSFX_CLI = $(FILTER-OUT *], \
$(PATSUBST *]*.EXE, *] *, $(UNZIPSFX_CLI)))
 
# Complete list of C object dependency file names.
# Note that the CLI UnZip main program object file is a special case.
 
DEPS = $(FOREACH NAME, \
$(MODS_LIB_UNZIP_N) $(MODS_LIB_UNZIP_V) \
$(MODS_LIB_UNZIPCLI_V) \
$(MODS_LIB_UNZIPSFX_N) $(MODS_LIB_UNZIPSFX_V) \
$(MODS_UNZIP) $(MODS_UNZIP_CLI) \
$(MODS_UNZIPSFX) $(MODS_UNZIPSFX_CLI), \
$(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 P4, which prevents immediate macro
# expansion, is removed by COLLECT_DEPS.COM.
#
@[.VMS]COLLECT_DEPS.COM "UnZip" -
"$(MMS$TARGET)" "[...]*.mmsd" "[.$ (DEST)]" $(MMSDESCRIPTION_FILE)
@ write sys$output -
"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)
 
EXTRACT_.MMSD : EXTRACT.C EXTRACT.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)
 
GLOBALS_.MMSD : GLOBALS.C GLOBALS.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)
 
INFLATE_.MMSD : INFLATE.C INFLATE.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)
 
MATCH_.MMSD : MATCH.C MATCH.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)
 
PROCESS_.MMSD : PROCESS.C PROCESS.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)
 
TTYIO_.MMSD : TTYIO.C TTYIO.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)
 
UBZ2ERR_.MMSD : UBZ2ERR.C UBZ2ERR.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)
 
UNZIP_CLI.MMSD : UNZIP.C UNZIP.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)
 
UNZIPSFX.MMSD : UNZIP.C UNZIP.MMSD
$(CC) $(CFLAGS_INCL) $(CFLAGS_SFX) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
@[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
 
UNZIPSFX_CLI.MMSD : UNZIP.C UNZIP.MMSD
$(CC) $(CFLAGS_INCL) $(CFLAGS_CLI) $(CFLAGS_SFX) $(MMS$SOURCE) -
/NOLIST /NOOBJECT /MMS_DEPENDENCIES = -
(FILE = $(MMS$TARGET), NOSYSTEM_INCLUDE_FILES)
@[.VMS]MOD_DEP.COM $(MMS$TARGET) $(MMS$TARGET_NAME).OBJ $(MMS$TARGET)
 
# 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)
 
/programs/fs/unzip60/vms/descrip_src.mms
0,0 → 1,462
# 1 March 2009. SMS.
#
# UnZip 6.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 LARGE # LARGE
.IFDEF __VAX__ # __VAX__
.ELSE # __VAX__
DESTL = L
.ENDIF # __VAX__
.ENDIF # LARGE
 
DEST = $(DESTM)$(DESTL)
SEEK_BZ = $(DESTM)
 
# 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__
 
# Shortcut to include BZIP2 support from the optional bzip2 source subdir
# in the UnZip source location.
 
BZ2DIR_BIN = SYS$DISK:[.BZIP2.$(DESTM)]
BZ2_OLB = LIBBZ2_NS.OLB
LIB_BZ2_LOCAL = $(BZ2DIR_BIN)$(BZ2_OLB)
 
.IFDEF USEBZ2 # USEBZ2
.IFDEF IZ_BZIP2 # IZ_BZIP2
.ELSE # IZ_BZIP2
IZ_BZIP2 = SYS$DISK:[.BZIP2]
LIB_BZ2_DEP = $(LIB_BZ2_LOCAL)
BUILD_BZIP2 = 1
.ENDIF # IZ_BZIP2
.ENDIF # USEBZ2
 
# Complain about any problems (and die) if warranted. Otherwise, show
# optional package directories being used, and the destination
# directory. Make the destination directory, if necessary.
 
.FIRST
.IFDEF __MMK__ # __MMK__
@ write sys$output ""
.ENDIF # __MMK__
.IFDEF UNK_DEST # UNK_DEST
@ 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
@ 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
@ 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
@ 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
.IFDEF BUILD_BZIP2 # BUILD_BZIP2
@ if (f$search( "$(IZ_BZIP2)bzlib.h") .eqs. "") then -
write sys$output " Can not find header file $(IZ_BZIP2)bzlib.h"
@ if (f$search( "$(IZ_BZIP2)bzlib.h") .eqs. "") then -
write sys$output ""
@ if (f$search( "$(IZ_BZIP2)bzlib.h") .eqs. "") then -
I_WILL_DIE_NOW. /$$$$INVALID$$$$
@ write sys$output " BZIP2 dir: $(BZ2DIR_BIN)"
@ define lib_bzip2 $(BZ2DIR_BIN)
@ if (f$search( "$(IZ_BZIP2)$(DESTM).dir") .eqs. "") then -
create /directory $(BZ2DIR_BIN)
.ELSE # BUILD_BZIP2
@ @[.VMS]FIND_BZIP2_LIB.COM $(IZ_BZIP2) $(SEEK_BZ) $(BZ2_OLB) lib_bzip2
@ if (f$trnlnm( "lib_bzip2") .eqs. "") then -
write sys$output " Can not find BZIP2 object library."
@ if (f$trnlnm( "lib_bzip2") .eqs. "") then -
write sys$output ""
@ if (f$trnlnm( "lib_bzip2") .eqs. "") then -
I_WILL_DIE_NOW. /$$$$INVALID$$$$
@ write sys$output " BZIP2 dir: ''f$trnlnm( "lib_bzip2")'"
.ENDIF # BUILD_BZIP2
@ write sys$output ""
@ define incl_bzip2 $(IZ_BZIP2)
.ENDIF # IZ_BZIP2
.IFDEF IZ_ZLIB # IZ_ZLIB
@ @[.VMS]FIND_BZIP2_LIB.COM $(IZ_ZLIB) $(SEEK_BZ) LIBZ.OLB lib_zlib
@ if (f$trnlnm( "lib_zlib") .eqs. "") then -
write sys$output " Can not find ZLIB object library."
@ if (f$trnlnm( "lib_zlib") .eqs. "") then -
write sys$output ""
@ if (f$trnlnm( "lib_zlib") .eqs. "") then -
I_WILL_DIE_NOW. /$$$$INVALID$$$$
@ write sys$output " ZLIB dir: ''f$trnlnm( "lib_zlib")'"
@ write sys$output ""
@ define incl_zlib $(IZ_ZLIB)
@ @[.VMS]FIND_BZIP2_LIB.COM $(IZ_ZLIB) -
contrib.infback9 infback9.h incl_zlib_contrib_infback9
.ENDIF # IZ_ZLIB
@ write sys$output " Destination: [.$(DEST)]"
@ write sys$output ""
if (f$search( "$(DEST).DIR;1") .eqs. "") then -
create /directory [.$(DEST)]
.ENDIF # LARGE_VAX
.ENDIF # NON_VAX_CMPL
.ENDIF # VAX_MULTI_CMPL
.ENDIF # UNK_DEST
 
# BZIP2 options.
 
.IFDEF IZ_BZIP2 # IZ_BZIP2
CDEFS_BZ = , USE_BZIP2
CFLAGS_INCL = /include = ([], [.VMS])
LIB_BZIP2_OPTS = lib_bzip2:$(BZ2_OLB) /library,
.ENDIF # IZ_BZIP2
 
# ZLIB options.
 
.IFDEF IZ_ZLIB # IZ_ZLIB
CDEFS_ZL = , USE_ZLIB
.IFDEF CFLAGS_INCL # CFLAGS_INCL
.ELSE # CFLAGS_INCL
CFLAGS_INCL = /include = ([], [.VMS])
.ENDIF # CFLAGS_INCL
LIB_ZLIB_OPTS = LIB_ZLIB:LIBZ.OLB /library,
.ELSE # IZ_ZLIB
.IFDEF CFLAGS_INCL # CFLAGS_INCL
.ELSE # CFLAGS_INCL
CFLAGS_INCL = /include = []
.ENDIF # CFLAGS_INCL
.ENDIF # IZ_ZLIB
 
# DBG options.
 
.IFDEF DBG # DBG
CFLAGS_DBG = /debug /nooptimize
LINKFLAGS_DBG = /debug /traceback
.ELSE # DBG
CFLAGS_DBG =
LINKFLAGS_DBG = /notraceback
.ENDIF # DBG
 
# Large-file options.
 
.IFDEF LARGE # LARGE
CDEFS_LARGE = , LARGE_FILE_SUPPORT
.ENDIF # LARGE
 
# C compiler defines.
 
.IFDEF LOCAL_UNZIP
C_LOCAL_UNZIP = , $(LOCAL_UNZIP)
.ENDIF
 
CDEFS = VMS $(CDEFS_BZ) $(CDEFS_LARGE) $(CDEFS_ZL) $(C_LOCAL_UNZIP)
 
CDEFS_UNX = /define = ($(CDEFS))
 
CDEFS_CLI = /define = ($(CDEFS), VMSCLI)
 
CDEFS_SFX = /define = ($(CDEFS), SFX)
 
CDEFS_SFX_CLI = /define = ($(CDEFS), SFX, VMSCLI)
 
# 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
 
# LINK (share) library options.
# Omit shareable image options file for NOSHARE.
 
.IFDEF VAXC_OR_FORCE_VAXC # VAXC_OR_FORCE_VAXC
.IFDEF NOSHARE # NOSHARE
OPT_FILE =
LFLAGS_ARCH =
.ELSE # NOSHARE
OPT_FILE = [.$(DEST)]VAXCSHR.OPT
LFLAGS_ARCH = $(OPT_FILE) /options,
.ENDIF # NOSHARE
.ELSE # VAXC_OR_FORCE_VAXC
.IFDEF GNUC # GNUC
LFLAGS_GNU = GNU_CC:[000000]GCCLIB.OLB /LIBRARY
.IFDEF NOSHARE # NOSHARE
OPT_FILE =
LFLAGS_ARCH = $(LFLAGS_GNU),
.ELSE # NOSHARE
OPT_FILE = [.$(DEST)]VAXCSHR.OPT
LFLAGS_ARCH = $(LFLAGS_GNU), SYS$DISK:$(OPT_FILE) /options,
.ENDIF # NOSHARE
.ELSE # GNUC
OPT_FILE =
LFLAGS_ARCH =
.ENDIF # GNUC
.ENDIF # VAXC_OR_FORCE_VAXC
 
# LINK NOSHARE options.
 
.IFDEF NOSHARE # NOSHARE
.IFDEF __ALPHA__ # __ALPHA__
NOSHARE_OPTS = , SYS$LIBRARY:STARLET.OLB /LIBRARY\
/INCLUDE = CMA$TIS /NOSYSSHR
.ELSE # __ALPHA__
.IFDEF __IA64__ # __IA64__
NOSHARE_OPTS = , SYS$LIBRARY:STARLET.OLB /LIBRARY\
/INCLUDE = CMA$TIS /NOSYSSHR
.ELSE # __IA64__
OLDVAX_OLDVAX = 1
.IFDEF DECC # DECC
.IFDEF OLDVAX_$(NOSHARE) # OLDVAX_$(NOSHARE)
NOSHARE_OPTS = , SYS$LIBRARY:DECCRTL.OLB /LIBRARY\
/INCLUDE = CMA$TIS /NOSYSSHR
.ELSE # OLDVAX_$(NOSHARE)
NOSHARE_OPTS = , SYS$LIBRARY:DECCRTL.OLB /LIBRARY\
/INCLUDE = (CMA$TIS, CMA$TIS_VEC) /NOSYSSHR
.ENDIF # OLDVAX_$(NOSHARE)
.ELSE # DECC
.IFDEF OLDVAX_$(NOSHARE) # OLDVAX_$(NOSHARE)
NOSHARE_OPTS = , SYS$LIBRARY:VAXCRTL.OLB /LIBRARY,\
SYS$LIBRARY:IMAGELIB.OLB /LIBRARY /NOSYSSHR
.ELSE # OLDVAX_$(NOSHARE)
NOSHARE_OPTS = , SYS$LIBRARY:VAXCRTL.OLB /LIBRARY,\
SYS$LIBRARY:DECCRTL.OLB /LIBRARY /INCLUDE = CMA$TIS,\
SYS$LIBRARY:IMAGELIB.OLB /LIBRARY /NOSYSSHR
.ENDIF # OLDVAX_$(NOSHARE)
.ENDIF # DECC
.ENDIF # __IA64__
.ENDIF # __ALPHA__
.ELSE # NOSHARE
NOSHARE_OPTS =
.ENDIF # NOSHARE
 
# 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_UNZIP_N = \
CRC32=[.$(DEST)]CRC32.OBJ \
CRYPT=[.$(DEST)]CRYPT.OBJ \
ENVARGS=[.$(DEST)]ENVARGS.OBJ \
EXPLODE=[.$(DEST)]EXPLODE.OBJ \
EXTRACT=[.$(DEST)]EXTRACT.OBJ \
FILEIO=[.$(DEST)]FILEIO.OBJ \
GLOBALS=[.$(DEST)]GLOBALS.OBJ \
INFLATE=[.$(DEST)]INFLATE.OBJ \
LIST=[.$(DEST)]LIST.OBJ \
MATCH=[.$(DEST)]MATCH.OBJ \
PROCESS=[.$(DEST)]PROCESS.OBJ \
TTYIO=[.$(DEST)]TTYIO.OBJ \
UBZ2ERR=[.$(DEST)]UBZ2ERR.OBJ \
UNREDUCE=[.$(DEST)]UNREDUCE.OBJ \
UNSHRINK=[.$(DEST)]UNSHRINK.OBJ \
ZIPINFO=[.$(DEST)]ZIPINFO.OBJ
 
# Primary object library, [.VMS].
 
MODS_OBJS_LIB_UNZIP_V = \
VMS=[.$(DEST)]VMS.OBJ
 
MODS_OBJS_LIB_UNZIP = $(MODS_OBJS_LIB_UNZIP_N) $(MODS_OBJS_LIB_UNZIP_V)
 
# CLI object library, [.VMS].
 
MODS_OBJS_LIB_UNZIPCLI_C_V = \
CMDLINE=[.$(DEST)]CMDLINE.OBJ
 
MODS_OBJS_LIB_UNZIPCLI_CLD_V = \
VMS_UNZIP_CLD=[.$(DEST)]UNZ_CLI.OBJ
 
MODS_OBJS_LIB_UNZIP_CLI = \
$(MODS_OBJS_LIB_UNZIPCLI_C_V) \
$(MODS_OBJS_LIB_UNZIPCLI_CLD_V)
 
# SFX object library, [].
 
MODS_OBJS_LIB_UNZIPSFX_N = \
CRC32$(GCC_)=[.$(DEST)]CRC32_.OBJ \
CRYPT$(GCC_)=[.$(DEST)]CRYPT_.OBJ \
EXTRACT$(GCC_)=[.$(DEST)]EXTRACT_.OBJ \
FILEIO$(GCC_)=[.$(DEST)]FILEIO_.OBJ \
GLOBALS$(GCC_)=[.$(DEST)]GLOBALS_.OBJ \
INFLATE$(GCC_)=[.$(DEST)]INFLATE_.OBJ \
MATCH$(GCC_)=[.$(DEST)]MATCH_.OBJ \
PROCESS$(GCC_)=[.$(DEST)]PROCESS_.OBJ \
TTYIO$(GCC_)=[.$(DEST)]TTYIO_.OBJ \
UBZ2ERR$(GCC_)=[.$(DEST)]UBZ2ERR_.OBJ
 
# SFX object library, [.VMS].
 
MODS_OBJS_LIB_UNZIPSFX_V = \
VMS$(GCC_)=[.$(DEST)]VMS_.OBJ
 
MODS_OBJS_LIB_UNZIPSFX = \
$(MODS_OBJS_LIB_UNZIPSFX_N) \
$(MODS_OBJS_LIB_UNZIPSFX_V)
 
# SFX object library, [.VMS] (no []).
 
MODS_OBJS_LIB_UNZIPSFX_CLI_C_V = \
CMDLINE$(GCC_)=[.$(DEST)]CMDLINE_.OBJ
 
MODS_OBJS_LIB_UNZIPSFX_CLI_CLD_V = \
VMS_UNZIP_CLD=[.$(DEST)]UNZ_CLI.OBJ
 
MODS_OBJS_LIB_UNZIPSFX_CLI = \
$(MODS_OBJS_LIB_UNZIPSFX_CLI_C_V) \
$(MODS_OBJS_LIB_UNZIPSFX_CLI_CLD_V)
 
# Executables.
 
UNZIP = [.$(DEST)]UNZIP.EXE
 
UNZIP_CLI = [.$(DEST)]UNZIP_CLI.EXE
 
UNZIPSFX = [.$(DEST)]UNZIPSFX.EXE
 
UNZIPSFX_CLI = [.$(DEST)]UNZIPSFX_CLI.EXE
 
/programs/fs/unzip60/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
$!
/programs/fs/unzip60/vms/hlp_lib_next.com
0,0 → 1,16
$! 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
$!
/programs/fs/unzip60/vms/infback9.h
0,0 → 1,9
/* 2008-07-29 SMS.
* VMS-specific INFBACK9.H jacket header file to help find the
* relatively obscure actual header file.
*
* The logical name INCL_ZLIB_CONTRIB_INFBACK9 must point to the ZLIB
* source subdirectory where infback9.h is situated.
*/
 
#include "INCL_ZLIB_CONTRIB_INFBACK9:INFBACK9.H"
/programs/fs/unzip60/vms/makesfx.com
0,0 → 1,72
$!
$! MAKESFX.COM: command-procedure to create self-extracting ZIP archives
$! usage: @MAKESFX foo (foo.zip -> foo.exe)
$!
$! Change history:
$!
$! Date Who What
$! -------- ---- -----------------------------------------------------------
$! 19940804 MPJZ Created
$! 19940810 GRR Removed superflous creation of name symbol
$! 20000113 MPJZ Better symbol check, fixed bug in zip "-A" check
$!
$! MPJZ: Martin P.J. Zinser
$!
$! For this to work a symbol unzipsfx has to be defined which contains the
$! location of the unzip stub (e.g., unzipsfx:== device:[dir]unzipsfx.exe)
$!
$! The zipfile given in p1 will be concatenated with unzipsfx and given a
$! filename extension of .exe. The default file extension for p1 is .zip
$!
$! Use at your own risk, there is no guarantee here. If it doesn't work,
$! blame me (zinser@decus.de), not the people from Info-ZIP.
$!
$!-----------------------------------------------------------------------------
$!
$! First check stub related stuff
$!
$ if (f$type(unzipsfx).nes."STRING")
$ then
$ type sys$input
You need to define the symbol "unzipsfx" to point to the location of the
unzipsfx stub before invoking this procedure.
Exiting now...
$ exit 2
$ endif
$ usfx = f$parse(unzipsfx) - ";"
$ if (f$search(usfx).eqs."")
$ then
$ write sys$output "The unzipsfx stub can not be found on the location"
$ write sys$output "pointed to by the unzipsfx symbol -- ''usfx'"
$ write sys$output "Exiting now"
$ exit 2
$ endif
$!
$! Now check the input file
$!
$ if (p1.eqs."")
$ then
$ type sys$input
Required parameter input-file missing
Exiting now...
$ exit 2
$ endif
$ inf = p1
$ file = f$parse(inf,,,"DEVICE") + f$parse(inf,,,"DIRECTORY") + -
f$parse(inf,,,"NAME")
$ finf = file + f$parse(inf,".ZIP",,"TYPE") + f$parse(inf,,,"VERSION")
$ if (f$search(finf).eqs."")
$ then
$ write sys$output "Input file ''finf' does not exist"
$ exit 2
$ endif
$!
$! Finally create the self-extracting archive
$!
$ copy 'usfx','finf' 'file'.exe
$!
$! Zip "-A" will make the resulting archive compatible with other
$! unzip programs, but is not essential for running the exe.
$!
$ if (f$type(zip).eqs."STRING") then zip "-A" 'file'.exe
$ exit
/programs/fs/unzip60/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:
$!
/programs/fs/unzip60/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 */
 
/programs/fs/unzip60/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 */
 
/programs/fs/unzip60/vms/unz_cli.cld
0,0 → 1,103
Module VMS_UNZIP_CLD
Ident "03-003"
 
Define Verb UNZIP
Parameter P1, Label=ZIPFILE, Prompt="Zip file"
Parameter P2, Label=INFILE, VALUE(LIST), Prompt="Files to UnZip"
Qualifier BINARY, VALUE(TYPE=CONVBIN_KEYWORDS), Negatable
Qualifier TEXT, VALUE(TYPE=CONVTXT_KEYWORDS, LIST), Negatable
Qualifier SCREEN, Negatable
Qualifier DIRECTORY, VALUE(REQUIRED,TYPE=$FILE), Nonnegatable
Qualifier FRESHEN, Negatable
Qualifier HELP, Nonnegatable
Qualifier JUNK, Negatable
Qualifier LIST, Nonnegatable
Qualifier BRIEF, Nonnegatable, Default
Qualifier FULL, VALUE(TYPE=FULL_MODIFIER), Nonnegatable
Qualifier EXISTING, VALUE(REQUIRED, TYPE=EXISTING_KEYWORDS),
Nonnegatable
Qualifier OVERWRITE, Negatable
Qualifier QUIET, VALUE(TYPE=QUIET_MODIFIER), Nonnegatable
Qualifier TEST, Negatable
Qualifier PIPE, Nonnegatable
Qualifier PASSWORD, VALUE(REQUIRED), Nonnegatable
Qualifier TIMESTAMP, Nonnegatable
Qualifier TRAVERSE_DIRS, Negatable
Qualifier UPPERCASE, Negatable
Qualifier UPDATE, Negatable
Qualifier VERSION, Negatable
Qualifier RESTORE, VALUE(TYPE=RESTORE_KEYWORDS, LIST), Negatable
Qualifier COMMENT, Negatable
Qualifier EXCLUDE, VALUE(LIST), Nonnegatable
Qualifier CASE_INSENSITIVE, Negatable
Qualifier LOWERCASE, Negatable
Qualifier PAGE, Negatable
Qualifier DOT_VERSION, Negatable
Qualifier ODS2, Negatable
Qualifier YYZ_UNZIP, NonNegatable, Default
Qualifier ZIPINFO, Syntax=INFORMATION, NonNegatable
DisAllow BRIEF and FULL
DisAllow DIRECTORY and SCREEN
DisAllow BINARY and TEXT.ALL
DisAllow BINARY.ALL and TEXT
DisAllow (OVERWRITE or (neg OVERWRITE)) and EXISTING
DisAllow (neg RESTORE) and RESTORE.DATE
DisAllow (neg RESTORE) and (neg RESTORE.DATE)
DisAllow (neg RESTORE) and RESTORE.OWNER_PROT
DisAllow (neg RESTORE) and (neg RESTORE.OWNER_PROT)
DisAllow (neg RESTORE.DATE) and RESTORE.DATE.ALL
DisAllow (neg RESTORE.DATE) and RESTORE.DATE.FILES
DisAllow TEXT.ALL and TEXT.AUTO
DisAllow TEXT.AUTO and TEXT.NONE
DisAllow TEXT.NONE and TEXT.ALL
DisAllow TEXT.NONE and TEXT.STMLF
DisAllow (neg TEXT) and TEXT.STMLF
DisAllow ZIPINFO and HELP
 
Define Type CONVBIN_KEYWORDS
Keyword AUTO, DEFAULT
Keyword ALL
Keyword NONE
 
Define Type CONVTXT_KEYWORDS
Keyword AUTO, DEFAULT
Keyword ALL
Keyword NONE
Keyword STMLF
 
Define Type EXISTING_KEYWORDS
Keyword NEW_VERSION
Keyword OVERWRITE
Keyword NOEXTRACT
 
Define Type RESTORE_KEYWORDS
Keyword DATE, VALUE(TYPE=RESTOREDATE_KEYS, Required),
Negatable
Keyword OWNER_PROT, Default, Negatable
 
Define Type RESTOREDATE_KEYS
Keyword FILES, DEFAULT
Keyword ALL
 
Define Type QUIET_MODIFIER
Keyword SUPER
 
Define Type FULL_MODIFIER
Keyword DIAGNOSTICS
 
Define Syntax INFORMATION
Parameter P1, Label=ZIPFILE, Prompt="Zip file"
Parameter P2, Label=INFILE, VALUE(LIST), Prompt="Files to display"
Qualifier ZIPINFO, NonNegatable, Default
Qualifier ONE_LINE, Nonnegatable
Qualifier SHORT, Nonnegatable
Qualifier MEDIUM, Nonnegatable
Qualifier LONG, Nonnegatable
Qualifier VERBOSE, Nonnegatable
Qualifier HEADER, Nonnegatable
Qualifier COMMENT, Nonnegatable
Qualifier TOTALS, Nonnegatable
Qualifier TIMES, Nonnegatable
Qualifier EXCLUDE, VALUE(LIST), Nonnegatable
Qualifier CASE_INSENSITIVE, Negatable
Qualifier PAGE, Negatable
/programs/fs/unzip60/vms/unzip.opt
0,0 → 1,0
Ident = "UnZip 6.0"
/programs/fs/unzip60/vms/unzip_cli.help
0,0 → 1,619
.!
.! File: UNZIP_CLI.HELP
.!
.! Author: Hunter Goatley
.!
.! Date: 12 Jul 94 (orig. UNZIP.RNH, 23 Oct 91)
.!
.! Description:
.!
.! TPU-processable source file to produce VMS on-line help for
.! portable UnZip. Adapted from UNZIP.RNH, originally based on
.! UNZIP.MAN (now UNZIP.TXT).
.!
.! To build:
.! $ EDIT /TPU/NOSECTION/NODISPLAY/COMMAND=CVTHELP.TPU UNZIP_CLI.HELP
.! $ RUNOFF /OUT=UNZIP.HLP UNZIP_CLI.RNH
.! $ LIBR /HELP/INSERT libr UNZIP
.!
.! Modification history:
.!
.! 02-001 Hunter Goatley 12-JUL-1994 16:59
.! Genesis.
.! 02-002 Cave Newt 14-JUL-1994 11:36
.! Fixed /*TEXT options and added/removed various options.
.! 02-003 Cave Newt 28-JUL-1994 08:54
.! Removed semicolons from comments and moved /ZIPINFO.
.! 02-004 Christian Spieler 06-OCT-1995 02:02
.! Changed to conform to revised .CLD definition.
.! 02-005 Christian Spieler 06-FEB-1996 02:20
.! Added description of /HELP qualifier.
.! 02-006 Christian Spieler 12-MAY-1996 00:50
.! Some clarifications/cleanups.
.! 02-007 Christian Spieler 04-MAR-1997 22:25
.! Added /[NO]CASE_INSENSITIVE to ZipInfo mode;
.! documented the new /PASSWORD="decryption_key" option.
.! 02-007 Christian Spieler 22-JUL-1997 22:37
.! Formatting changes (prevent line wraps);
.! added "Exit_Codes" subtopic (no version number change).
.! 02-007 Christian Spieler 28-APR-2000 03:22
.! Changed references to plaintext UnZip documentation file
.! into UNZIP.TXT (no version number change).
.! 02-007 Hunter Goatley 07-Feb-2001 15:43
.! Reformatted qualifier item headers to show negated form of
.! option qualifier on separate line (no version number change).
.! 02-008 Christian Spieler 18-Apr-2001 22:29
.! Added description for extended functionality of -b option.
.! 02-009 Christian Spieler 10-Dec-2001 13:37
.! Added description for new /TRAVERSE_DIRS option.
.! 02-010 Steven Schweda 28-Jan-2005 16:16:36
.! Added /TIMESTAMP (-T) qualifier.
.! 02-010 Christian Spieler 29-Jan-2005 01:50
.! Completed description of -T qualifier (also for UNIX style).
.! 02-011 Steven Schweda 14-FEB-2005 20:04
.! Added /DOT_VERSION (-Y) and /ODS2 (-2) qualifiers.
.! 02-012 Steven Schweda 07-JUL-2006 01:30
.! Added /TEXT = STMLF (-s) qualifier.
.! 02-012 Christian Spieler 04-Mar-2007 14:39
.! Changed -s qualifier into -S;
.! updated documentation of UnZip's exit codes.
.! 03-002 S. Schweda, C. Spieler 09-Jan-2008 03:35
.! Added documentation of extended /RESTORE=(...) qualifier.
.! 03-003 S. Schweda, C. Spieler 13-Sep-2008 20:00
.! Added /EXISTING qualifier.
.!
<INIT>
<MAIN>
UNZIP
 
UnZip is used to extract files compressed and packaged by Zip (see HELP ZIP
for information on ZIP).
 
For a brief help on Zip and Unzip, run each without specifying any
parameters on the command line (or apply the /HELP qualifier).
To get a brief help sceen about the alternate UNIX style command interface,
run each with the -h option applied.
 
UNZIP will list, test, or extract from a ZIP archive. ZIP archives are commonly
found on MS-DOS systems; a VMS version of ZIP can also be found here.
 
Archive member extraction is implied by the absence of the /SCREEN (-c),
/PIPE (-p), /TEST (-t), /TIMESTAMP (-T), /LIST (-l, -v) or /COMMENT (-z)
qualifiers (options).
All archive members are processed unless a filespec is provided to
specify a subset of the archive members.
<FORMAT>
UNZIP zipfile [file[,...]] [/qualifiers]
 
.!
<TOPIC>
Parameters
 
<PARAMETER>
zipfile
 
<PTEXT>
File specification for the ZIP archive(s) with optional wildcards. UnZip will
perform actions specified for every zipfile matching the specification.
The default file specification is SYS$DISK:[].ZIP.
 
Note that self-extracting ZIP files are supported; just specify the .EXE
suffix yourself.
<TXETP>
 
<PARAMETER>
file
 
<PTEXT>
An optional comma-separated list of archive members to be processed;
if no list is given, all archive members are processed. Expressions
may be used to match multiple members. Expressions should be enclosed
in double-quotes to prevent interpretation by DCL. Multiple filenames
should be separated by blanks. Each file specification is similar to
a Unix egrep expression and may contain:
 
<LITERAL>
|* matches a sequence of 0 or more characters
|? matches exactly 1 character
|[...] matches any single character found inside the brackets;
| ranges are specified by a beginning character, a hyphen,
| and an ending character. If a '!' or '^' immediately
| follows the left bracket, then any character not in the
| given range is matched.
| Hint: To specify a verbatim left bracket '[', the
| three-character sequence "[[]" has to be used.
<LARETIL>
<TXETP>
 
<QUALIFIERS>
<QUALIFIER>
/ZIPINFO
 
/ZIPINFO
 
Displays information about the Zip archive and the files contained therein.
This function used to be provided by a separate ZipInfo program.
 
The following qualifiers may be specified with /ZIPINFO:
 
<LITERAL>
| /SHORT Short UNIX "ls -l" format (default)
| /MEDIUM Medium UNIX "ls -l" format
| /LONG Long UNIX "ls -l" format
| /VERBOSE Verbose, multi-page format
| /ONE_LINE Filenames only, one per line
| /HEADER Print header lines
| /TOTALS Print totals for files
| /TIMES Print file times in sortable decimal format
| /[NO]CASE_INSENSITIVE Match filenames case-insensitively
| /[NO]PAGE Page screen output through built-in "more"
<LARETIL>
<QUALIFIER>
/BINARY
 
/BINARY[=KEYWORD]
<NEXT>
/NOBINARY (default)
 
Selects conversion to VMS "standard" binary file format for
extracted files, which is "fixed length 512 byte records,
no record attributes". When extracting to SYS$OUTPUT (/SCREEN
or /PIPE qualifier), this qualifier deactivates the default
"text data" conversion, instead.
The optional keywords recognized are:
<LITERAL>
| AUTO Automatically extracts files marked as "binary" (rather
| than "text") in standard VMS binary file format. (default)
| ALL Extracts all files in standard VMS binary file format.
| NONE Same as /NOBINARY.
<LARETIL>
 
Note that a combination of /BINARY[=AUTO] and /TEXT[=AUTO] is allowed.
(see /TEXT qualifier)
<QUALIFIER>
/BRIEF
 
/BRIEF (default)
 
When used with /LIST, specifies that a brief listing of the archive's
contents is to be displayed. A brief listing shows the length, date,
time, and file name for the files in the archive.
<QUALIFIER>
/CASE_INSENSITIVE
 
/CASE_INSENSITIVE
<NEXT>
/NOCASE_INSENSITIVE (default)
 
Match filenames case-insensitively. (Good default option under VMS.)
<QUALIFIER>
/COMMENT
 
/COMMENT
<NEXT>
/NOCOMMENT
 
Display the archive comment.
<QUALIFIER>
/DIRECTORY
 
/DIRECTORY=directory-spec
 
Specifies the output directory where all the extracted files are to be
placed.
<QUALIFIER>
/DOT_VERSION
 
/DOT_VERSION
<NEXT>
/NODOT_VERSION (default)
 
Causes UnZip to treat archived file name endings of ".nnn" (where "nnn"
is a decimal number) as if they were VMS version numbers (";nnn"). (The
default is to treat them as file types.) Example: "a.b.3" -> "a.b;3".
<QUALIFIER>
/EXCLUDE
 
/EXCLUDE=(file[,...])
 
A comma-separated list of files to exclude when extracting files.
If multiple files are specified, the list should be included in
parentheses.
<QUALIFIER>
/EXISTING
 
/EXISTING = keyword
 
Valid keywords (exactly one must be specified) are:
<LITERAL>
| NEW_VERSION Create a new version of an existing file.
| OVERWRITE Overwrite the same version of an existing file.
| (But only if the archive member name includes a
| version number.)
| NOEXTRACT Do not extract. An existing file is not affected.
<LARETIL>
 
When UnZip would extract an archive member, but the destination file
already exists, UnZip will, by default, ask the user what to do.
/EXISTING lets the user specify on the command line what to do in this
situation, eliminating the interactive question(s).
 
NOEXTRACT will always stop UnZip from extracting an archive member if
the destination file already exists.
 
If an archive member name does not include a VMS version number, or if
UnZip is run with /NOVERSION (the default, causing it to ignore version
numbers), then either NEW_VERSION or OVERWRITE will cause UnZip to
create a new version of the existing file.
 
If an archive member name does include a VMS version number, and if
UnZip is run with /VERSION, then NEW_VERSION will cause UnZip to create
a new version of the existing file, and OVERWRITE will cause UnZip to
overwrite the existing file which has the version specified by the
archive member name.
<QUALIFIER>
/FRESHEN
 
/FRESHEN
<NEXT>
/NOFRESHEN
 
Freshen existing files; replace if newer. Does not cause any new files to
be created.
<QUALIFIER>
/FULL
 
/FULL
 
When used with /LIST, specifies that a full listing of the archive's
contents is to be displayed. A full listing shows the length,
compression method, compressed size, compression ratio, date,
time, CRC value, and file name for the files in the archive.
<QUALIFIER>
/HELP
 
/HELP
 
Displays a one-page brief help screen and exits quietly.
<QUALIFIER>
/JUNK
 
/JUNK
<NEXT>
/NOJUNK (default)
 
Junk the stored paths (don't recreated the archive's directory
structure.
<QUALIFIER>
/LIST
 
/LIST
 
List the contents of the archive. /BRIEF and /FULL can be used to
specify the amount of information displayed. The default is /BRIEF.
<QUALIFIER>
/LOWERCASE
 
/LOWERCASE
<NEXT>
/NOLOWERCASE (default)
 
Convert filenames from all-uppercase operating systems to lowercase. This
option has no effect under VMS.
<QUALIFIER>
/ODS2
 
/ODS2
<NEXT>
/NOODS2 (default)
 
Causes UnZip to convert archived file names to ODS2-compatible file
names (substituting "_" for any invalid characters), regardless of the
type of the destination file system.
 
The default is to use ODS5-compatible file names when the destination
file system is ODS5, and to convert the names to ODS2-compatible names
when the destination file system is ODS2.
 
Beginning in UnZip 6.0, ODS2-compatible names are explicitly set to
upper case.
<QUALIFIER>
/OVERWRITE
 
/OVERWRITE
<NEXT>
/NOOVERWRITE
 
See /EXISTING.
 
/OVERWRITE is equivalent to /EXISTING = NEW_VERSION.
<NEXT>
/NOOVERWRITE is equivalent to /EXISTING = NOEXTRACT.
<QUALIFIER>
/PAGE
 
/PAGE
<NEXT>
/NOPAGE
 
Feed all screen output through the built-in "more" pager.
<QUALIFIER>
/PASSWORD
 
/PASSWORD=decryption-password
 
Specifies a decryption password and prevents UnZip from prompting for
a password in case the specified decryption key was wrong. The supplied
string must be enclosed in double-quotes whenever it contains lowercase
or special characters.
<QUALIFIER>
/PIPE
 
/PIPE
 
Extract files to SYS$OUTPUT with no informational messages.
<QUALIFIER>
/QUIET
 
/QUIET[=SUPER]
 
Perform operations quietly. The keyword SUPER can be specified to make
operations even more quiet.
<QUALIFIER>
/RESTORE
 
/RESTORE[=(KEYWORD, ...)]
 
Selects restoration options for some meta-data.
The optional keywords recognized are:
<LITERAL>
| OWNER_PROT Restore file owner and ACL protection settings.
| NOOWNER_PROT Do not restore file owner and ACL protection settings.
| NODATE Do not restore any timestamps.
| DATE=ALL Restore timestamps for all extracted entries, files
| and directories.
| DATE=FILES Restore timestamps for extracted files. (default)
<LARETIL>
 
By default, VMS UnZip restores the original date-time attributes for files,
but not for directories. This agrees with the behavior of VMS BACKUP
(and UnZip versions before 5.52 where the capability to restore directory
timestamps was added).
 
For compatibility with UnZip versions before 6.0 (5.53), the following
obsolete short forms are still accepted:
<LITERAL>
| Obsolete form: Modern form:
| /RESTORE /RESTORE = OWNER_PROT
| /NORESTORE /RESTORE = NOOWNER_PROT
<LARETIL>
<QUALIFIER>
/SCREEN
 
/SCREEN
<NEXT>
/NOSCREEN
 
Extracts matching files to SYS$OUTPUT (the terminal).
<QUALIFIER>
/TEST
 
/TEST
<NEXT>
/NOTEST
 
Test archive files.
<QUALIFIER>
/TEXT
 
/TEXT[=(KEYWORD, ...)]
<NEXT>
/NOTEXT (default)
 
Selects conversion to VMS standard text file format.
The optional keywords recognized are:
<LITERAL>
| AUTO Automatically extracts files marked as "text" (rather
| than "binary") in standard VMS text file format. (default)
| ALL Extracts all files in standard VMS text file format.
| NONE Same as /NOTEXT.
| STMLF Use Stream_LF record format for text files (instead of the
| default variable-length record format).
<LARETIL>
 
A similar functionality is available for binary files, see qualifier /BINARY.
<QUALIFIER>
/TIMESTAMP
 
/TIMESTAMP
 
Sets the timestamp of an archive to that of its newest file. This qualifier
corresponds to zip's /APPEND/LATEST (-go) option, but can be applied to
wildcard zipfile specifications (e.g. "*.zip") and is much faster.
<QUALIFIER>
/TRAVERSE_DIRS
 
/TRAVERSE_DIRS
<NEXT>
/NOTRAVERSE_DIRS (default)
 
Allows to extract archive members into locations outside of the currently
active "extraction root dir". For security reasons, UnZip normally
removes "parent dir" path components ("../") from the names of extracted
files. This feature (new for UnZip 5.50) prevents UnZip from accidentally
writing files to "sensitive" areas outside the directory tree below the
specified "extraction root". By specifying the /TRAVERSE_DIRS option,
this security feature can be switched off. This allows users to extract
(older) archives that made use of "../" to create multiple directory
trees at the level of the current extraction folder.
<QUALIFIER>
/UPDATE
 
/UPDATE
<NEXT>
/NOUPDATE
 
Update existing files; create new ones if needed.
<QUALIFIER>
/VERSION
 
/VERSION
<NEXT>
/NOVERSION (default)
 
Retain VMS file version numbers.
 
<TOPIC>
Authors
 
Info-ZIP; currently maintained by Christian Spieler. VMS support maintained
by Igor Mandrichenko, Steven M. Schweda, Christian Spieler and Hunter Goatley.
Originally based on a program by Samuel H. Smith.
 
VMS on-line help ported from UNZIP.TXT by Hunter Goatley.
 
<TOPIC>
Exit_Status
 
On VMS, UnZip's UNIX-style exit values are mapped into VMS-style status
codes with facility code 1954 = %x7A2, and with the inhibit-message
(%x10000000) and facility-specific (%x00008000) bits set:
<LITERAL>
| %x17A28001 normal exit
| %x17A28000 + 16*UnZip_error_code warnings
| %x17A28002 + 16*UnZip_error_code normal errors
| %x17A28004 + 16*UnZip_error_code fatal errors
<LARETIL>
 
Note that multiplying the UNIX-style UnZip error code by 16 places it
conveniently in the hexadecimal representation of the VMS exit code,
"__" in %x17A28__s, where "s" is the severity code. For example, a
missing archive might cause UnZip error code 9, which would be
transformed into the VMS exit status %X17A28092.
 
The UnZip VMS exit codes include severity values which approximate those
defined by PKWARE, as shown in the following table:
<LITERAL>
| VMS UnZip err
| severity code Error description
| ----------+---------+----------------------------------------------
| Success 0 Normal. No errors or warnings detected.
| Warning 1 One or more warnings were encountered, but
| processing completed successfully anyway.
| This includes archives where one or more
| (but not all) files were skipped because of
| unsupported compress or encrypt methods, or
| bad passwords.
| Error 2 Error in the archive format. Processing may
| have completed successfully anyway. Some
| defects in archives (made by other programs)
| can be repaired transparently.
| Fatal 3 Severe error in the archive format. Process-
| ing probably failed immediately.
| Fatal 4 Memory allocation failed in program initial-
| ization.
| Fatal 5 Memory allocation failed in password pro-
| cessing.
| Fatal 6 Memory allocation failed while decompressing
| to disk.
| Fatal 7 Memory allocation failed while decompressing
| in memory.
| Fatal 8 Memory allocation failed (reserved for
| future use).
| Error 9 Specified archive files were not found.
| Error 10 Invalid command-line options or parameters.
| Error 11 No files matched selection criteria.
| Fatal 50 Disk full.
| Fatal 51 Unexpected end-of-file while reading the
| archive.
| Error 80 User interrupt (Ctrl/C).
| Error 81 No files were processed, because of unsup-
| ported compress or encrypt methods.
| Error 82 No files were processed, because of bad
| password(s).
| Fatal 83 Large-file archive could not be processed by
| this small-file program.
<LARETIL>
 
<TOPIC>
UNIX_Options
 
The default action of UnZip is to extract all zipfile entries. The following
options and modifiers can be provided:
 
<LITERAL>
| -Z ZipInfo mode
| -c extract files to SYS$OUTPUT (terminal)
| -f freshen existing files (replace if newer); create none
| -h show brief help screen and exit quietly
| -l list archive files (short format)
| -p extract files to SYS$OUTPUT; no informational messages
| -t test archive files
| -T set zipfile timestamps to that of each archive's newest entry
| -u update existing files; create new ones if needed
| -v list archive files (verbose format)
| -z display only the archive comment
|
|MODIFIERS
| -a extract text files in standard VMS text file format
| -aa extract all files as text
| -b auto-extract only binary files in fixed 512-byte record format
| -bb extract all files as binary in fixed 512-byte record format
| -j junk paths (don't recreate archive's directory structure)
| -n never overwrite or make a new version of an existing file
| -o always make a new version (-oo: overwrite orig) existing file
| -q perform operations quietly (-qq => even quieter)
| -C match filenames case-insensitively
| -D do not restore any timestamps (--D restore them even for dirs)
| -L convert filenames to lowercase if created under DOS, VMS, etc.
| -M feed screen output through built-in "more" pager
| -P<password> supply decryption password on the cmd line (insecure!)
| -S use Stream_LF record format to extract text files (with -a[a])
| -V retain (VMS) file version numbers
| -X restore owner/ACL protection info (may require privileges)
| -Y treat ".nnn" suffix as version number ("a.b.3" -> "a.b;3")
| -: allow "../" path components to traverse across top extract dir
| -2 force creation of ODS2-compatible file names
<LARETIL>
 
Note that uppercase options such as -C, -D, -L, -M, -P, -S, -T, -V, -X, -Y,
and -Z must be specified in quotes (unless SET PROC/PARSE=EXTEND is set).
For example:
 
<LITERAL>
| $ unzip "-VX" -a zipfile
<LARETIL>
 
<TOPIC>
UNZIP_OPTS_Default
 
UnZip allows to modify its default behaviour by specifying (UNIX style)
option defaults via the UNZIP_OPTS logical name.
For example, the following will cause UnZip to match filenames without regard
to case, restore owner/protection information and perform all operations at
quiet-level 1 by default:
 
<LITERAL>
| $ define UNZIP_OPTS "-qCX"
<LARETIL>
 
Note that the quotation marks here are required to preserve lowercase options
(opposite of the command-line behavior). To negate a default option on the
command line, add one or more minus signs before the option letter, in
addition to the leading switch character `-':
 
<LITERAL>
| $ unzip --ql zipfile
<LARETIL>
 
or
 
<LITERAL>
| $ unzip -l-q zipfile
<LARETIL>
 
At present it is not possible to decrement an option below zero--that is,
more than a few minuses have no effect.
 
UNZIP_OPTS may be defined as a symbol rather than a logical, but if both
are defined, the logical is used.
/programs/fs/unzip60/vms/unzip_def.rnh
0,0 → 1,296
.!
.! File: UNZIP_DEF.RNH
.!
.! Author: Hunter Goatley
.!
.! Date: October 23, 1991
.!
.! Description:
.!
.! RUNOFF source file for VMS on-line help for portable UnZip.
.! Adapted from UNZIP.MAN (now UNZIP.TXT).
.!
.! To build: $ REN UNZIP_DEF.RNH UNZIP.RNH
.! $ RUNOFF UNZIP.RNH
.! $ LIBR/HELP/INSERT libr UNZIP
.!
.! Modification history:
.!
.! 01-001 Hunter Goatley 23-OCT-1991 09:21
.! Genesis.
.! 01-002 Cave Newt 16-MAR-1992 22:37
.! Updated for UnZip 4.2.
.! 01-003 Igor Mandrichenko 23-MAY-1992 22:14
.! Added -X option to command syntax.
.! 01-004 Cave Newt 24-MAY-1992 13:30
.! Added UNZIP_OPTS environment variable help.
.! 01-005 Igor Mandrichenko 14-DEC-1993 18:55
.! Modified for UnZip V5.1
.! 01-006 Cave Newt 21-DEC-1993 12:38
.! Added -x option and cleaned up.
.! 01-007 Cave Newt 14-JUL-1994 09:45
.! Added -Z, -C and -L options, removed -U, minor clean-up.
.! 01-008 Cave Newt 28-JUL-1994 08:57
.! Removed semi-colons from comments.
.! 02-001 Christian Spieler 09-DEC-1995 02:25
.! Modified for UnZip 5.2.
.! 02-002 Christian Spieler 06-FEB-1996 02:25
.! Added -h "help" option.
.! 02-003 Christian Spieler 04-MAR-1997 20:25
.! Added -P "command line password" option.
.! 02-004 Christian Spieler 26-JUL-1997 00:05
.! Added Exit_Codes subtopic, explaining UnZip's VMS return codes.
.! 02-005 Christian Spieler 28-APR-2000 03:22
.! Changed references to plaintext UnZip documentation file
.! into "UNZIP.TXT".
.! 02-006 Christian Spieler 15-APR-2001 22:29
.! Added description for extended functionality of -b option.
.! 02-007 Christian Spieler 10-DEC-2001 13:58
.! Added description for new -: traverse dirs option.
.! 02-008 Christian Spieler 29-JAN-2005 01:50
.! Added description for the -T "set archive timestamp" option.
.! 02-009 Christian Spieler 04-MAR-2007 14:37
.! Added description for the -S "Stream-LF text files" option;
.! updated the documentation of the VMS exit codes.
.! 02-010 S. Schweda, C. Spieler 28-Dec-2007 21:28
.! Added description for the -D "timestamp restoration" option.
.!
.noflags
.lm4 .rm72
.indent -4
1 UNZIP
.br
UnZip is used to extract files compressed and packaged by Zip (see HELP ZIP
for information on ZIP).
.sk
For a brief help on Zip and Unzip, run each without specifying any
parameters on the command line, or specify the -h flag (but not in UnZip's
Zipinfo mode).
.sk
UNZIP will list, test, or extract from a ZIP archive. ZIP archives are commonly
found on MS-DOS systems; a VMS version of ZIP can also be found here.
.sk
Archive member extraction is implied by the absence of the -c, -p, -t, -l, -v or
-z options. All archive members are processed unless a filespec is provided to
specify a subset of the archive members.
Format:
.sk;.lm+1;.literal
UNZIP [-cfhlptTuvxz[ajnoqCDLMSVXY:2]] file[.zip] [list] [-x xlist] [-d out_dir]
.end literal;.lm-1
.!------------------------------------------------------------------------------
.indent -4
2 Parameters
.sk;.indent -4
file[.zip]
.sk
File specification for the ZIP archive(s) with optional wildcards. UnZip will
perform actions specified for every zipfile matching the specification.
Default file specification is SYS$DISK:[].ZIP.
Note that self-extracting ZIP files are supported; just specify the .EXE
suffix yourself.
.sk;.indent -4
[list]
.sk
An optional list of archive members to be processed; if no list is given, all
archive members are processed. Expressions may be
used to match multiple members. Expressions should be enclosed in double-quotes
to prevent interpretation by DCL. Multiple filenames should be separated by
blanks. Each file specification is similar to a Unix egrep expression and may
contain:
.sk
.literal
* matches a sequence of 0 or more characters
? matches exactly 1 character
[...] matches any single character found inside the brackets;
ranges are specified by a beginning character, a hyphen,
and an ending character. If a '!' or '^' immediately
follows the left bracket, then any character not in the
given range is matched.
Hint: To specify a verbatim left bracket '[', the
three-character sequence "[[]" has to be used.
.end literal
.sk
.sk;.indent -4
[-x xlist]
.sk
An optional list of archive members to be excluded from processing. The xlist
overrides any files included in the normal list.
.sk;.indent -4
[-d out_dir]
.sk
Optional directory specification to be used as target root directory
for files to be extracted. Directory should be specified in "[.foo]"
format rather than "foo.dir" or "foo/" format.
.!------------------------------------------------------------------------------
.indent -4
2 Options
.br
The default action of UnZip is to extract all zipfile entries. The following
options and modifiers can be provided:
.sk;.literal
-Z ZipInfo mode
-c extract files to SYS$OUTPUT (terminal)
-f freshen existing files (replace if newer); create none
-h show brief help screen and exit quietly
-l list archive files (short format)
-p extract files to SYS$OUTPUT; no informational messages
-t test archive files
-T set zipfile timestamps to that of each archive's newest entry
-u update existing files; create new ones if needed
-v list archive files (verbose format)
-z display only the archive comment
.end literal;.sk;.literal
MODIFIERS
-a extract text files in standard VMS text file format
-aa extract all files as text
-b auto-extract only binary files in fixed 512-byte record format
-bb extract all files as binary in fixed 512-byte record format
-j junk paths (don't recreate archive's directory structure)
-n never overwrite or make a new version of an existing file
-o always make a new version (-oo: overwrite orig) existing file
-q perform operations quietly (-qq => even quieter)
-C match filenames case-insensitively
-D do not restore any timestamps (--D restore them even for dirs)
-L convert filenames to lowercase if created under DOS, VMS, etc.
-M feed screen output through built-in "more" pager
-P<password> supply decryption password on the cmd line (insecure!)
-S use Stream_LF record format to extract text files (with -a[a])
-V retain (VMS) file version numbers
-X restore owner/ACL protection info (may require privileges)
-Y treat ".nnn" suffix as version number ("a.b.3" -> "a.b;3")
-: allow "../" path components to traverse across top extract dir
-2 force creation of ODS2-compatible file names
.end literal;.sk
Note that uppercase options (-C, -D, -L, -M, -P, -S, -T, -V, -X, -Y, and
-Z) must be specified in quotes (unless SET PROC/PARSE=EXTEND is set).
For example:
.sk;.literal
unzip "-VX" -a zipfile
.end literal;.sk
When extracting to SYS$OUTPUT (-c or -p options) redirected to a file,
you may want to override the default text file conversion by specifying
the -b option. A single "-b" option switches to "binary piping" mode
for Zip entries marked as non-text, only. To force "binary piping" mode
even for Zip file entries marked as text, the "-bb" option should be used.
(Please note that a later "-a" cancels any -b option, see below.)
.sk
The output conversion options -b and -a may be combined to perform
binary conversions on binary files and text conversion on text files.
But note: For compatibility with implementation on other systems, -b cancels
any -a option; to get the intended result, -a must be specified AFTER -b.
And, in combination, "text" recognition takes precedence; this means
that -bba (-bb -a) has the same effect as -ba (-b -a), and -aa overrides
binary conversion for ALL files.
.sk
The conversion option -S is only effective when used together with
-a or -aa. When specified, "text" files are written in Stream-LF record
format instead of the VMS default of Variable-Length record format.
(When no conversion options are specified, all non-VMS entries are always
written as Stream-LF files.)
.sk
Please note that using the "-P<password>" option is higly insecure, the
plaintext password may be seen by others. For this reason (and because of
lack of space), the "-P<password>" option is not advertised on UnZip's
online help screen.
.!------------------------------------------------------------------------------
.indent -4
2 Exit_Status
.br
On VMS, UnZip's UNIX-style exit values are mapped into VMS-style status
codes with facility code 1954 = %x7A2, and with the inhibit-message
(%x10000000) and facility-specific (%x00008000) bits set:
.sk
.literal
%x17A28001 normal exit
%x17A28000 + 16*UnZip_error_code warnings
%x17A28002 + 16*UnZip_error_code normal errors
%x17A28004 + 16*UnZip_error_code fatal errors
.end literal
.sk
Note that multiplying the UNIX-style UnZip error code by 16 places it
conveniently in the hexadecimal representation of the VMS exit code,
"__" in %x17A28__s, where "s" is the severity code. For example, a
missing archive might cause UnZip error code 9, which would be
transformed into the VMS exit status %X17A28092.
.sk
The UnZip VMS exit codes include severity values which approximate those
defined by PKWARE, as shown in the following table:
.literal
 
VMS UnZip err
severity code Error description
----------+---------+----------------------------------------------
Success 0 Normal. No errors or warnings detected.
Warning 1 One or more warnings were encountered, but
processing completed successfully anyway.
This includes archives where one or more
(but not all) files were skipped because of
unsupported compress or encrypt methods, or
bad passwords.
Error 2 Error in the archive format. Processing may
have completed successfully anyway. Some
defects in archives (made by other programs)
can be repaired transparently.
Fatal 3 Severe error in the archive format. Process-
ing probably failed immediately.
Fatal 4 Memory allocation failed in program initial-
ization.
Fatal 5 Memory allocation failed in password pro-
cessing.
Fatal 6 Memory allocation failed while decompressing
to disk.
Fatal 7 Memory allocation failed while decompressing
in memory.
Fatal 8 Memory allocation failed (reserved for
future use).
Error 9 Specified archive files were not found.
Error 10 Invalid command-line options or parameters.
Error 11 No files matched selection criteria.
Fatal 50 Disk full.
Fatal 51 Unexpected end-of-file while reading the
archive.
Error 80 User interrupt (Ctrl/C).
Error 81 No files were processed, because of unsup-
ported compress or encrypt methods.
Error 82 No files were processed, because of bad
password(s).
Fatal 83 Large-file archive could not be processed by
this small-file program.
.end literal
.!------------------------------------------------------------------------------
.indent -4
2 Logical_Names
.br
UnZip allows to modify its default behaviour by specifying option defaults
via the UNZIP_OPTS logical name.
For example, the following will cause UnZip to restore owner/protection
information and perform all operations at quiet-level 1 by default:
.sk;.literal
define UNZIP_OPTS "-qX"
.end literal;.sk
Note that the quotation marks here are required to preserve lowercase options
(opposite of the command-line behavior).
To negate a default option on the command line, add one or more minus
signs before the option letter, in addition to the leading switch character
`-':
.sk;.literal
unzip --ql zipfile
.end literal
or
.literal
unzip -l-q zipfile
.end literal;.sk
At present it is not possible to decrement an option below zero--that is,
more than a few minuses have no effect.
.sk
UNZIP_OPTS may be defined as a symbol rather than a logical name, but if
both are defined, the logical name takes precedence.
.!-----------------------------------------------------------------------------
.indent -4
2 Authors
.br
Info-ZIP; currently maintained by Christian Spieler. VMS support maintained
by Christian Spieler and Hunter Goatley. Originally based on a program
by Samuel H. Smith.
.sk
VMS on-line help ported from UNZIP.TXT by Hunter Goatley.
/programs/fs/unzip60/vms/unzipsfx.hlp
0,0 → 1,233
1 UNZIPSFX
 
unzipsfx - self-extracting stub for prepending to ZIP
archives
 
<name of unzipsfx+archive combo> [-cfptuz[ajnoqsCLV$]]
[file(s) ...] [-x xfile(s) ...]
 
unzipsfx is a modified version of unzip designed to be
prepended to existing ZIP archives in order to form self-
extracting archives. Instead of taking its first non-flag
argument to be the zipfile(s) to be extracted, unzipsfx
seeks itself under the name by which it was invoked and
tests or extracts the contents of the appended archive.
Because the executable stub adds bulk to the archive (the
whole purpose of which is to be as small as possible), a
number of the regular version's less-vital capabilities have
been removed. Among these are the usage (or help) screen,
the listing and diagnostic functions (-l and -v), the abil-
ity to decompress older compression formats (the ``reduce,''
``shrink'' and ``implode'' methods), and the ability to
extract to a directory other than the current one. Decryp-
tion is supported as a compile-time option but should be
avoided unless the attached archive contains encrypted
files.
 
Note that self-extracting archives made with unzipsfx are no
more (or less) portable across different operating systems
than is the unzip executable itself. In general a self-
extracting archive made on a particular Unix system, for
example, will only self-extract under the same flavor of
Unix. Regular unzip may still be used to extract the embed-
ded archive as with any normal zipfile, although it will
generate a harmless warning about extra bytes at the begin-
ning of the zipfile.
 
 
 
[file(s)]
 
An optional list of archive members to be processed.
Regular expressions (wildcards) similar to those in
Unix egrep(1) may be used to match multiple members.
These wildcards may contain:
 
* matches a sequence of 0 or more characters
 
? matches exactly 1 character
 
[...]
matches any single character found inside the
brackets; ranges are specified by a beginning
character, a hyphen, and an ending character. If
an exclamation point or a caret (`!' or `^') fol-
lows the left bracket, then the range of charac-
ters within the brackets is complemented (that is,
anything except the characters inside the brackets
is considered a match).
 
(Be sure to quote any character which might otherwise
be interpreted or modified by the operating system,
particularly under Unix and VMS.)
 
[-x xfile(s)]
 
An optional list of archive members to be excluded from
processing. Since wildcard characters match directory
separators (`/'), this option may be used to exclude
any files which are in subdirectories. For example,
``unzip foo *.[ch] -x */*'' would extract all C source
files in the main directory, but none in any subdirec-
tories. Without the -x option, all C source files in
all directories within the zipfile would be extracted.
 
2 Options
 
unzipsfx supports the following unzip options: -c and
-p (extract to standard output/screen), -f and -u (freshen
and update existing files upon extraction), -t (test
archive) and -z (print archive comment). All normal listing
options (-l, -v and -Z) have been removed, but the testing
option (-t) may be used as a ``poor man's'' listing. Alter-
natively, those creating self-extracting archives may wish
to include a short listing in the zipfile comment.
 
See unzip for a more complete description of these
options.
 
MODIFIERS
 
unzipsfx currently supports all unzip modifiers: -a
(convert text files), -n (never overwrite), -o (overwrite
without prompting), -q (operate quietly), -C (match names
case-insenstively), -L (convert uppercase-OS names to lower-
case), -j (junk paths) and -V (retain version numbers); plus
the following operating-system specific options: -X
(restore VMS owner/protection info), -s (convert spaces in
filenames to underscores [DOS, OS/2, NT]) and -$ (restore
volume label [DOS, OS/2, NT, Amiga]).
 
(Support for regular ASCII text-conversion may be removed in
future versions, since it is simple enough for the archive's
creator to ensure that text files have the appropriate for-
mat for the local OS. EBCDIC conversion will of course con-
tinue to be supported since the zipfile format implies ASCII
storage of text files.)
 
See unzip for a more complete description of these
modifiers.
 
2 Environment_options
 
unzipsfx uses the same environment variables as unzip
does, although this is likely to be an issue only for the
person creating and testing the self-extracting archive.
See unzip for details.
 
2 Decryption
 
Decryption is supported exactly as in unzip; that is,
interactively with a non-echoing prompt for the password(s).
See unzip for details. Once again, note that if the
archive has no encrypted files there is no reason to use a
version of unzipsfx with decryption support; that only adds
to the size of the archive.
 
2 Examples
 
To create a self-extracting archive letters from a regular
zipfile letters.zip and change the new archive's permissions
to be world-executable under Unix:
 
cat unzipsfx letters.zip > letters
chmod 755 letters
 
To create the same archive under MS-DOS, OS/2 or NT (note
the use of the /b [binary] option to the copy command):
 
copy /b unzipsfx.exe+letters.zip letters.exe
 
Under VMS:
 
copy unzipsfx.exe,letters.zip letters.exe
letters == "$currentdisk:[currentdir]letters.exe"
 
(The VMS append command may also be used. The second com-
mand installs the new program as a ``foreign command'' capa-
ble of taking arguments.) To test (or list) the newly
created self-extracting archive:
 
letters -t
 
To test letters quietly, printing only a summary message
indicating whether the archive is OK or not:
 
letters -tq
 
To extract the complete contents into the current directory,
recreating all files and subdirectories as necessary:
 
letters
 
To extract only the README file to standard output (the
screen):
 
letters -c README
 
To print only the zipfile comment:
 
letters -z
 
2 Limitations
 
The principle and fundamental limitation of unzipsfx is that
it is not portable across architectures or operating sys-
tems, and therefore neither are the resulting archives. For
some architectures there is limited portability, however
(e.g., between some flavors of Intel-based Unix).
 
unzipsfx has no knowledge of the user's PATH, so in general
an archive must either be in the current directory when it
is invoked, or else a full or relative path must be given.
If a user attempts to extract the archive from a directory
in the PATH other than the current one, unzipsfx will print
a warning to the effect, ``can't find myself.'' This is
always true under Unix and may be true in some cases under
MS-DOS, depending on the compiler used (Microsoft C fully
qualifies the program name, but other compilers may not).
Under OS/2 and NT there are operating-system calls available
which provide the full path name, so the archive may be
invoked from anywhere in the user's path. The situation is
not known for Atari TOS, MacOS, etc.
 
As noted above, a number of the normal unzip functions
have been removed in order to make unzipsfx smaller: usage
and diagnostic info, listing functions and extraction to
other directories. Also, only stored and deflated files are
supported. The latter limitation is mainly relevant to
those who create SFX archives, however.
 
VMS users must know how to set up self-extracting archives
as foreign commands in order to use any of unzipsfx's
options. This is not necessary for simple extraction, but
the command to do so then becomes, e.g., ``run letters'' (to
continue the examples given above).
 
unzipsfx is not supported on the Amiga because of the way
the loader works; the entire archive contents would be
loaded into memory by default. It may be possible to work
around this by defining the attached archive to be a ``debug
hunk,'' but compatibility problems between the ROM levels of
older Amigas and newer ones are likely to cause problems
regardless.
 
All current bugs in unzip exist in unzipsfx as well.
 
2 Diagnostics
 
unzipsfx's exit status (error level) is identical to that of
unzip; see the corresponding help entry.
 
2 See_also
 
funzip, unzip, zip, zipcloak, zipgrep,
zipinfo, zipnote, zipsplit
 
2 Authors
 
Greg Roelofs was responsible for the basic modifications to
UnZip necessary to create UnZipSFX. See unzip for the
current list of zip-bugs authors, or the file CONTRIBS in
the UnZip source distribution for the full list of Info-ZIP
contributors.
/programs/fs/unzip60/vms/unzipsfx.opt
0,0 → 1,0
Ident = "UnZipSFX 6.0"
/programs/fs/unzip60/vms/vms.c
0,0 → 1,5751
/*
Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
 
See the accompanying file LICENSE, version 2009-Jan-02 or later
(the contents of which are also included in unzip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*---------------------------------------------------------------------------
 
vms.c Igor Mandrichenko and others
 
This file contains routines to extract VMS file attributes from a zipfile
extra field and create a file with these attributes. The code was almost
entirely written by Igor, with a couple of routines by GRR and lots of
modifications and fixes by Christian Spieler.
 
Contains: check_format()
open_outfile()
find_vms_attrs()
flush()
close_outfile()
defer_dir_attribs()
set_direc_attribs()
dos_to_unix_time() (TIMESTAMP only)
stamp_file() (TIMESTAMP only)
vms_msg_text()
do_wild()
mapattr()
mapname()
checkdir()
check_for_newer()
return_VMS
screensize()
screenlinewrap()
version()
 
---------------------------------------------------------------------------*/
 
#ifdef VMS /* VMS only! */
 
#define UNZIP_INTERNAL
 
#include "unzip.h"
#include "crc32.h"
#include "vms.h"
#include "vmsdefs.h"
 
#ifdef MORE
# include <ttdef.h>
#endif
#include <unixlib.h>
 
#include <dvidef.h>
#include <ssdef.h>
#include <stsdef.h>
 
/* Workaround for broken header files of older DECC distributions
* that are incompatible with the /NAMES=AS_IS qualifier. */
#define lib$getdvi LIB$GETDVI
#define lib$getsyi LIB$GETSYI
#define lib$sys_getmsg LIB$SYS_GETMSG
#include <lib$routines.h>
 
#ifndef EEXIST
# include <errno.h> /* For mkdir() status codes */
#endif
 
/* On VAX, define Goofy VAX Type-Cast to obviate /standard = vaxc.
Otherwise, lame system headers on VAX cause compiler warnings.
(GNU C may define vax but not __VAX.)
*/
#ifdef vax
# define __VAX 1
#endif
 
#ifdef __VAX
# define GVTC (unsigned int)
#else
# define GVTC
#endif
 
/* With GNU C, some FAB bits may be declared only as masks, not as
* structure bits.
*/
#ifdef __GNUC__
# define OLD_FABDEF 1
#endif
 
#define ASYNCH_QIO /* Use asynchronous PK-style QIO writes */
 
/* buffer size for a single block write (using RMS or QIO WRITEVBLK),
must be less than 64k and a multiple of 512 ! */
#define BUFS512 (((OUTBUFSIZ>0xFFFF) ? 0xFFFF : OUTBUFSIZ) & (~511))
/* buffer size for record output (RMS limit for max. record size) */
#define BUFSMAXREC 32767
/* allocation size for RMS and QIO output buffers */
#define BUFSALLOC (BUFS512 * 2 > BUFSMAXREC ? BUFS512 * 2 : BUFSMAXREC)
/* locbuf size */
 
/* VMS success or warning status */
#define OK(s) (((s) & STS$M_SUCCESS) != 0)
#define STRICMP(s1, s2) STRNICMP(s1, s2, 2147483647)
 
/* Interactive inquiry response codes for replace(). */
 
#define REPL_NO_EXTRACT 0
#define REPL_NEW_VERSION 1
#define REPL_OVERWRITE 2
#define REPL_ERRLV_WARN 256
#define REPL_TASKMASK 255
 
/* 2008-09-13 CS.
* Note: In extract.c, there are similar strings "InvalidResponse" and
* "AssumeNone" defined. However, as the UI functionality of the VMS
* "version-aware" query is slightly different from the generic variant,
* these strings are kept separate for now to allow independent
* "fine tuning" without affecting the other variant of the
* "overwrite or ..." user query.
*/
ZCONST char Far InvalidResponse[] =
"error: invalid response [%.1s]\n";
ZCONST char Far AssumeNo[] =
"\n(EOF or read error, treating as \"[N]o extract (all)\" ...)\n";
 
 
#ifdef SET_DIR_ATTRIB
/* Structure for holding directory attribute data for final processing
* after all files are in place.
*/
typedef struct vmsdirattr {
struct vmsdirattr *next; /* link to next in (linked) list */
char *fn; /* file (directory) name */
 
/* Non-VMS attributes data */
ulg mod_dos_datetime; /* G.lrec.last_mod_dos_datetime */
unsigned perms; /* same as min_info.file_attr */
 
unsigned xlen; /* G.lrec.extra_field_length */
char buf[1]; /* data buffer (extra_field, fn) */
} vmsdirattr;
#define VmsAtt(d) ((vmsdirattr *)d) /* typecast shortcut */
#endif /* SET_DIR_ATTRIB */
 
/*
* Local static storage
*/
static struct FAB fileblk; /* File Access Block */
static struct XABDAT dattim; /* date-time XAB */
static struct XABRDT rdt; /* revision date-time XAB */
static struct RAB rab; /* Record Access Block */
static struct NAM_STRUCT nam; /* name block */
 
static struct FAB *outfab = NULL;
static struct RAB *outrab = NULL;
static struct XABFHC *xabfhc = NULL; /* file header characteristics */
static struct XABDAT *xabdat = NULL; /* date-time */
static struct XABRDT *xabrdt = NULL; /* revision date-time */
static struct XABPRO *xabpro = NULL; /* protection */
static struct XABKEY *xabkey = NULL; /* key (indexed) */
static struct XABALL *xaball = NULL; /* allocation */
static struct XAB *first_xab = NULL, *last_xab = NULL;
 
static int replace_code_all = -1; /* All-file response for replace(). */
 
static uch rfm;
 
static uch locbuf[BUFSALLOC]; /* Space for 2 buffers of BUFS512 */
static unsigned loccnt = 0;
static uch *locptr;
static char got_eol = 0;
 
struct bufdsc
{
struct bufdsc *next;
uch *buf;
unsigned bufcnt;
};
 
static struct bufdsc b1, b2, *curbuf; /* buffer ring for asynchronous I/O */
 
static int _flush_blocks(__GPRO__ uch *rawbuf, unsigned size, int final_flag);
static int _flush_stream(__GPRO__ uch *rawbuf, unsigned size, int final_flag);
static int _flush_varlen(__GPRO__ uch *rawbuf, unsigned size, int final_flag);
static int _flush_qio(__GPRO__ uch *rawbuf, unsigned size, int final_flag);
static int _close_rms(__GPRO);
static int _close_qio(__GPRO);
#ifdef ASYNCH_QIO
static int WriteQIO(__GPRO__ uch *buf, unsigned len);
#endif
static int WriteBuffer(__GPRO__ uch *buf, unsigned len);
static int WriteRecord(__GPRO__ uch *rec, unsigned len);
 
static int (*_flush_routine)(__GPRO__ uch *rawbuf, unsigned size,
int final_flag);
static int (*_close_routine)(__GPRO);
 
#ifdef SYMLINKS
static int _read_link_rms(__GPRO__ int byte_count, char *link_text_buf);
#endif /* SYMLINKS */
 
static void init_buf_ring(void);
static void set_default_datetime_XABs(__GPRO);
static int create_default_output(__GPRO);
static int create_rms_output(__GPRO);
static int create_qio_output(__GPRO);
static int replace(__GPRO);
static int replace_rms_newversion(__GPRO);
static int replace_rms_overwrite(__GPRO);
static int find_vms_attrs(__GPRO__ int set_date_time);
static void free_up(void);
#ifdef CHECK_VERSIONS
static int get_vms_version(char *verbuf, int len);
#endif /* CHECK_VERSIONS */
static unsigned find_eol(ZCONST uch *p, unsigned n, unsigned *l);
#ifdef SET_DIR_ATTRIB
static char *vms_path_fixdown(ZCONST char *dir_spec, char *dir_file);
#endif
#ifdef TIMESTAMP
static time_t mkgmtime(struct tm *tm);
static void uxtime2vmstime(time_t utimeval, long int binval[2]);
#endif /* TIMESTAMP */
static int vms_msg_fetch(int status);
static void vms_msg(__GPRO__ ZCONST char *string, int status);
 
 
/*
2005-02-14 SMS.
Added some ODS5 support:
Use longer name structures in NAML, where available.
Locate special characters mindful of "^" escapes.
*/
 
/* 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 converting Zip file names to
(simpler) ODS2 or (escaped) ODS5 extended file names.
 
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 ODS2 1
Lower-case ODS2 2
Period 4
Space 8
ODS5 simple 16
ODS5 1-char escape 32
ODS5 hex-hex escape 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 ! " # $ % & ' ( ) * + , - . / */
8, 32, 32, 32, 17, 32, 32, 32, 32, 32, 0, 32, 32, 17, 4, 0,
 
/* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 32, 32, 32, 32, 32, 32,
 
/* @ A B C D E F G H I J K L M N O */
32, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
 
/* P Q R S T U V W X Y Z [ \ ] ^ _ */
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 32, 32, 32, 32, 17,
 
/* ` a b c d e f g h i j k l m n o */
32, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
 
/* p q r s t u v w x y z { | } ~ DEL */
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 32, 32, 32, 32, 64,
 
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 64
};
 
 
/* 2004-11-23 SMS.
*
* get_rms_defaults().
*
* Get user-specified values from (DCL) SET RMS_DEFAULT. FAB/RAB
* items of particular interest are:
*
* fab$w_deq default extension quantity (blocks) (write).
* rab$b_mbc multi-block count.
* rab$b_mbf multi-buffer count (used with rah and wbh).
*/
 
#define DIAG_FLAG (uO.vflag >= 3)
 
/* Default RMS parameter values.
* The default extend quantity (deq) should not matter much here, as the
* initial allocation should always be set according to the known file
* size, and no extension should be needed.
*/
 
#define RMS_DEQ_DEFAULT 16384 /* About 1/4 the max (65535 blocks). */
#define RMS_MBC_DEFAULT 127 /* The max, */
#define RMS_MBF_DEFAULT 2 /* Enough to enable rah and wbh. */
 
/* GETJPI item descriptor structure. */
typedef struct
{
short buf_len;
short itm_cod;
void *buf;
int *ret_len;
} jpi_item_t;
 
/* Durable storage */
static int rms_defaults_known = 0;
 
/* JPI item buffers. */
static unsigned short rms_ext;
static char rms_mbc;
static unsigned char rms_mbf;
 
/* Active RMS item values. */
unsigned short rms_ext_active;
char rms_mbc_active;
unsigned char rms_mbf_active;
 
/* GETJPI item lengths. */
static int rms_ext_len; /* Should come back 2. */
static int rms_mbc_len; /* Should come back 1. */
static int rms_mbf_len; /* Should come back 1. */
 
/* Desperation attempts to define unknown macros. Probably doomed.
* If these get used, expect sys$getjpiw() to return %x00000014 =
* %SYSTEM-F-BADPARAM, bad parameter value.
* They keep compilers with old header files quiet, though.
*/
#ifndef JPI$_RMS_EXTEND_SIZE
# define JPI$_RMS_EXTEND_SIZE 542
#endif /* ndef JPI$_RMS_EXTEND_SIZE */
 
#ifndef JPI$_RMS_DFMBC
# define JPI$_RMS_DFMBC 535
#endif /* ndef JPI$_RMS_DFMBC */
 
#ifndef JPI$_RMS_DFMBFSDK
# define JPI$_RMS_DFMBFSDK 536
#endif /* ndef JPI$_RMS_DFMBFSDK */
 
/* GETJPI item descriptor set. */
 
struct
{
jpi_item_t rms_ext_itm;
jpi_item_t rms_mbc_itm;
jpi_item_t rms_mbf_itm;
int term;
} jpi_itm_lst =
{ { 2, JPI$_RMS_EXTEND_SIZE, &rms_ext, &rms_ext_len },
{ 1, JPI$_RMS_DFMBC, &rms_mbc, &rms_mbc_len },
{ 1, JPI$_RMS_DFMBFSDK, &rms_mbf, &rms_mbf_len },
0
};
 
static int get_rms_defaults()
{
int sts;
 
/* Get process RMS_DEFAULT values. */
 
sts = sys$getjpiw(0, 0, 0, &jpi_itm_lst, 0, 0, 0);
if ((sts & STS$M_SEVERITY) != STS$K_SUCCESS)
{
/* Failed. Don't try again. */
rms_defaults_known = -1;
}
else
{
/* Fine, but don't come back. */
rms_defaults_known = 1;
}
 
/* Limit the active values according to the RMS_DEFAULT values. */
 
if (rms_defaults_known > 0)
{
/* Set the default values. */
rms_ext_active = RMS_DEQ_DEFAULT;
rms_mbc_active = RMS_MBC_DEFAULT;
rms_mbf_active = RMS_MBF_DEFAULT;
 
/* Default extend quantity. Use the user value, if set. */
if (rms_ext > 0)
{
rms_ext_active = rms_ext;
}
 
/* Default multi-block count. Use the user value, if set. */
if (rms_mbc > 0)
{
rms_mbc_active = rms_mbc;
}
 
/* Default multi-buffer count. Use the user value, if set. */
if (rms_mbf > 0)
{
rms_mbf_active = rms_mbf;
}
}
 
if (DIAG_FLAG)
{
fprintf(stderr, "Get RMS defaults. getjpi sts = %%x%08x.\n", sts);
 
if (rms_defaults_known > 0)
{
fprintf(stderr,
" Default: deq = %6d, mbc = %3d, mbf = %3d.\n",
rms_ext, rms_mbc, rms_mbf);
}
}
return sts;
}
 
 
int check_format(__G)
__GDEF
{
int rtype;
int sts;
struct FAB fab;
#ifdef NAML$C_MAXRSS
struct NAML nam;
#endif
 
fab = cc$rms_fab; /* Initialize FAB. */
 
#ifdef NAML$C_MAXRSS
 
nam = cc$rms_naml; /* Initialize NAML. */
fab.fab$l_naml = &nam; /* Point FAB to NAML. */
 
fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = G.zipfn;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(G.zipfn);
 
if (ERR(sts = sys$open(&fab)))
{
Info(slide, 1, ((char *)slide, "\n\
error: cannot open zipfile [ %s ].\n",
FnFilter1(G.zipfn)));
vms_msg(__G__ " sys$open() error: ", sts);
return PK_ERR;
}
rtype = fab.fab$b_rfm;
sys$close(&fab);
 
if (rtype == FAB$C_VAR || rtype == FAB$C_VFC)
{
Info(slide, 1, ((char *)slide, "\n\
Error: zipfile is in variable-length record format. Please\n\
run \"bilf l %s\" to convert the zipfile to stream-LF\n\
record format. (BILF is available at various VMS archives.)\n\n",
FnFilter1(G.zipfn)));
return PK_ERR;
}
 
return PK_COOL;
}
 
 
 
#define PRINTABLE_FORMAT(x) ( (x) == FAB$C_VAR \
|| (x) == FAB$C_STMLF \
|| (x) == FAB$C_STMCR \
|| (x) == FAB$C_STM )
 
/* VMS extra field types */
#define VAT_NONE 0
#define VAT_IZ 1 /* old Info-ZIP format */
#define VAT_PK 2 /* PKWARE format */
 
/*
* open_outfile() assignments:
*
* VMS attributes ? create_xxx _flush_xxx
* ---------------- ---------- ----------
* not found 'default' text mode ?
* yes -> 'stream'
* no -> 'block'
*
* yes, in IZ format 'rms' uO.cflag ?
* yes -> switch (fab.rfm)
* VAR -> 'varlen'
* STM* -> 'stream'
* default -> 'block'
* no -> 'block'
*
* yes, in PK format 'qio' uO.cflag ?
* yes -> switch (pka_rattr)
* VAR -> 'varlen'
* STM* -> 'stream'
* default -> 'block'
* no -> 'qio'
*
* "text mode" == G.pInfo->textmode || (uO.cflag && !uO.bflag)
* (simplified, for complete expression see create_default_output() code)
*/
 
/* The VMS version of open_outfile() supports special return codes:
* OPENOUT_OK a file has been opened normally
* OPENOUT_FAILED the file open process failed
* OPENOUT_SKIPOK file open skipped at user request, err level OK
* OPENOUT_SKIPWARN file open skipped at user request, err level WARN
*/
int open_outfile(__G)
__GDEF
{
/* Get process RMS_DEFAULT values, if not already done. */
if (rms_defaults_known == 0)
{
get_rms_defaults();
}
 
switch (find_vms_attrs(__G__ (uO.D_flag <= 1)))
{
case VAT_NONE:
default:
return create_default_output(__G);
case VAT_IZ:
return create_rms_output(__G);
case VAT_PK:
return create_qio_output(__G);
}
}
 
static void init_buf_ring()
{
locptr = &locbuf[0];
loccnt = 0;
 
b1.buf = &locbuf[0];
b1.bufcnt = 0;
b1.next = &b2;
b2.buf = &locbuf[BUFS512];
b2.bufcnt = 0;
b2.next = &b1;
curbuf = &b1;
}
 
 
/* Static data storage for time conversion: */
 
/* string constants for month names */
static ZCONST char *month[] =
{"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
 
/* buffer for time string */
static char timbuf[24]; /* length = first entry in "date_str" + 1 */
 
/* fixed-length string descriptor for timbuf: */
static ZCONST struct dsc$descriptor date_str =
{sizeof(timbuf)-1, DSC$K_DTYPE_T, DSC$K_CLASS_S, timbuf};
 
 
static void set_default_datetime_XABs(__GPRO)
{
unsigned yr, mo, dy, hh, mm, ss;
#ifdef USE_EF_UT_TIME
iztimes z_utime;
struct tm *t;
 
if (G.extra_field &&
#ifdef IZ_CHECK_TZ
G.tz_is_valid &&
#endif
(ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
G.lrec.last_mod_dos_datetime, &z_utime, NULL)
& EB_UT_FL_MTIME))
t = localtime(&(z_utime.mtime));
else
t = (struct tm *)NULL;
if (t != (struct tm *)NULL)
{
yr = t->tm_year + 1900;
mo = t->tm_mon;
dy = t->tm_mday;
hh = t->tm_hour;
mm = t->tm_min;
ss = t->tm_sec;
}
else
{
yr = ((G.lrec.last_mod_dos_datetime >> 25) & 0x7f) + 1980;
mo = ((G.lrec.last_mod_dos_datetime >> 21) & 0x0f) - 1;
dy = (G.lrec.last_mod_dos_datetime >> 16) & 0x1f;
hh = (G.lrec.last_mod_dos_datetime >> 11) & 0x1f;
mm = (G.lrec.last_mod_dos_datetime >> 5) & 0x3f;
ss = (G.lrec.last_mod_dos_datetime << 1) & 0x3e;
}
#else /* !USE_EF_UT_TIME */
 
yr = ((G.lrec.last_mod_dos_datetime >> 25) & 0x7f) + 1980;
mo = ((G.lrec.last_mod_dos_datetime >> 21) & 0x0f) - 1;
dy = (G.lrec.last_mod_dos_datetime >> 16) & 0x1f;
hh = (G.lrec.last_mod_dos_datetime >> 11) & 0x1f;
mm = (G.lrec.last_mod_dos_datetime >> 5) & 0x3f;
ss = (G.lrec.last_mod_dos_datetime << 1) & 0x1f;
#endif /* ?USE_EF_UT_TIME */
 
dattim = cc$rms_xabdat; /* fill XABs with default values */
rdt = cc$rms_xabrdt;
sprintf(timbuf, "%02u-%3s-%04u %02u:%02u:%02u.00",
dy, month[mo], yr, hh, mm, ss);
sys$bintim(&date_str, &dattim.xab$q_cdt);
memcpy(&rdt.xab$q_rdt, &dattim.xab$q_cdt, sizeof(rdt.xab$q_rdt));
}
 
 
/* The following return codes are supported:
* OPENOUT_OK a file has been opened normally
* OPENOUT_FAILED the file open process failed
* OPENOUT_SKIPOK file open skipped at user request, err level OK
* OPENOUT_SKIPWARN file open skipped at user request, err level WARN
*/
static int create_default_output(__GPRO)
{
int ierr;
int text_output, bin_fixed;
 
/* Extract the file in text format (Variable_length by default,
* Stream_LF with "-S" (/TEXT = STMLF), when
* a) explicitly requested by the user (through the -a option),
* and it is not a symbolic link,
* or
* b) piping to SYS$OUTPUT, unless "binary" piping was requested
* by the user (through the -b option).
*/
text_output = (G.pInfo->textmode
#ifdef SYMLINKS
&& !G.symlnk
#endif
) ||
(uO.cflag &&
(!uO.bflag || (!(uO.bflag - 1) && G.pInfo->textfile)));
/* Use fixed length 512 byte record format for disk file when
* a) explicitly requested by the user (-b option),
* and
* b) it is not a symbolic link,
* and
* c) it is not extracted in text mode.
*/
bin_fixed = !text_output &&
#ifdef SYMLINKS
!G.symlnk &&
#endif
(uO.bflag != 0) && ((uO.bflag != 1) || !G.pInfo->textfile);
 
rfm = FAB$C_STMLF; /* Default, stream-LF format from VMS or UNIX */
 
if (!uO.cflag) /* Redirect output */
{
rab = cc$rms_rab; /* Initialize RAB. */
fileblk = cc$rms_fab; /* Initialize FAB. */
 
fileblk.fab$l_xab = NULL; /* No XABs. */
rab.rab$l_fab = &fileblk; /* Point RAB to FAB. */
 
outfab = &fileblk; /* Set pointers used elsewhere. */
outrab = &rab;
 
if (text_output && (!uO.S_flag))
{ /* Default format for output `real' text file */
fileblk.fab$b_rfm = FAB$C_VAR; /* variable length records */
fileblk.fab$b_rat = FAB$M_CR; /* implied (CR) carriage ctrl */
}
else if (bin_fixed)
{ /* Default format for output `real' binary file */
fileblk.fab$b_rfm = FAB$C_FIX; /* fixed length records */
fileblk.fab$w_mrs = 512; /* record size 512 bytes */
fileblk.fab$b_rat = 0; /* no carriage ctrl */
}
else
{ /* Default format for output misc (bin or text) file */
fileblk.fab$b_rfm = FAB$C_STMLF; /* stream-LF record format */
fileblk.fab$b_rat = FAB$M_CR; /* implied (CR) carriage ctrl */
}
 
#ifdef NAML$C_MAXRSS
 
nam = CC_RMS_NAM; /* Initialize NAML. */
fileblk.FAB_NAM = &nam; /* Point FAB to NAML. */
 
fileblk.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fileblk.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNS = strlen(G.filename);
 
/* Prepare date-time XABs, unless user requests not to. */
if (uO.D_flag <= 1) {
set_default_datetime_XABs(__G);
dattim.xab$l_nxt = fileblk.fab$l_xab;
fileblk.fab$l_xab = (void *) &dattim;
}
 
/* 2005-02-14 SMS. What does this mean? ----vvvvvvvvvvvvvvvvvvvvvvvvvvv */
fileblk.fab$w_ifi = 0; /* Clear IFI. It may be nonzero after ZIP */
fileblk.fab$b_fac = FAB$M_BRO | FAB$M_PUT; /* {block|record} output */
#ifdef SYMLINKS
if (G.symlnk)
/* Symlink file is read back to retrieve the link text. */
fileblk.fab$b_fac |= FAB$M_GET;
#endif
 
/* 2004-11-23 SMS.
* If RMS_DEFAULT values have been determined, and have not been
* set by the user, then set some FAB/RAB parameters for faster
* output. User-specified RMS_DEFAULT values override the
* built-in default values, so if the RMS_DEFAULT values could
* not be determined, then these (possibly unwise) values could
* not be overridden, and hence will not be set. Honestly,
* this seems to be excessively cautious, but only old VMS
* versions will be affected.
*/
 
/* If RMS_DEFAULT (and adjusted active) values are available,
* then set the FAB/RAB parameters. If RMS_DEFAULT values are
* not available, then suffer with the default behavior.
*/
if (rms_defaults_known > 0)
{
/* Set the FAB/RAB parameters accordingly. */
fileblk.fab$w_deq = rms_ext_active;
rab.rab$b_mbc = rms_mbc_active;
rab.rab$b_mbf = rms_mbf_active;
 
#ifdef OLD_FABDEF
 
/* Truncate at EOF on close, as we may over-extend. */
fileblk.fab$l_fop |= FAB$M_TEF ;
 
/* If using multiple buffers, enable write-behind. */
if (rms_mbf_active > 1)
{
rab.rab$l_rop |= RAB$M_WBH;
}
}
 
/* Set the initial file allocation according to the file
* size. Also set the "sequential access only" flag, as
* otherwise, on a file system with highwater marking
* enabled, allocating space for a large file may lock the
* disk for a long time (minutes).
*/
fileblk.fab$l_alq = (unsigned) (G.lrec.ucsize+ 511)/ 512;
fileblk.fab$l_fop |= FAB$M_SQO;
 
#else /* !OLD_FABDEF */
 
/* Truncate at EOF on close, as we may over-extend. */
fileblk.fab$v_tef = 1;
 
/* If using multiple buffers, enable write-behind. */
if (rms_mbf_active > 1)
{
rab.rab$v_wbh = 1;
}
}
 
/* Set the initial file allocation according to the file
* size. Also set the "sequential access only" flag, as
* otherwise, on a file system with highwater marking
* enabled, allocating space for a large file may lock the
* disk for a long time (minutes).
*/
fileblk.fab$l_alq = (unsigned) (G.lrec.ucsize+ 511)/ 512;
fileblk.fab$v_sqo = 1;
 
#endif /* ?OLD_FABDEF */
 
ierr = sys$create(outfab);
if (ierr == RMS$_FEX)
{
/* File exists.
* Consider command-line options, or ask the user what to do.
*/
ierr = replace(__G);
switch (ierr & REPL_TASKMASK)
{
case REPL_NO_EXTRACT: /* No extract. */
free_up();
return ((ierr & REPL_ERRLV_WARN)
? OPENOUT_SKIPWARN : OPENOUT_SKIPOK);
case REPL_NEW_VERSION: /* Create a new version. */
ierr = replace_rms_newversion(__G);
break;
case REPL_OVERWRITE: /* Overwrite the existing file. */
ierr = replace_rms_overwrite(__G);
break;
}
}
 
if (ERR(ierr))
{
char buf[NAM_MAXRSS + 128]; /* Name length + message length. */
 
sprintf(buf, "[ Cannot create ($create) output file %s ]\n",
G.filename);
vms_msg(__G__ buf, ierr);
if (fileblk.fab$l_stv != 0)
{
vms_msg(__G__ "", fileblk.fab$l_stv);
}
free_up();
return OPENOUT_FAILED;
}
 
if (!text_output)
{
rab.rab$l_rop |= (RAB$M_BIO | RAB$M_ASY);
}
rab.rab$b_rac = RAB$C_SEQ;
 
if ((ierr = sys$connect(&rab)) != RMS$_NORMAL)
{
#ifdef DEBUG
vms_msg(__G__ "create_default_output: sys$connect failed.\n", ierr);
if (fileblk.fab$l_stv != 0)
{
vms_msg(__G__ "", fileblk.fab$l_stv);
}
#endif
Info(slide, 1, ((char *)slide,
"Cannot create ($connect) output file: %s\n",
FnFilter1(G.filename)));
free_up();
return OPENOUT_FAILED;
}
} /* end if (!uO.cflag) */
 
init_buf_ring();
 
_flush_routine = text_output ? got_eol=0,_flush_stream : _flush_blocks;
_close_routine = _close_rms;
return OPENOUT_OK;
}
 
 
 
/* The following return codes are supported:
* OPENOUT_OK a file has been opened normally
* OPENOUT_FAILED the file open process failed
* OPENOUT_SKIPOK file open skipped at user request, err level OK
* OPENOUT_SKIPWARN file open skipped at user request, err level WARN
*/
static int create_rms_output(__GPRO)
{
int ierr;
int text_output;
 
/* extract the file in text (variable-length) format, when
* piping to SYS$OUTPUT, unless "binary" piping was requested
* by the user (through the -b option); the "-a" option is
* ignored when extracting zip entries with VMS attributes saved
*/
text_output = uO.cflag &&
(!uO.bflag || (!(uO.bflag - 1) && G.pInfo->textfile));
 
rfm = outfab->fab$b_rfm; /* Use record format from VMS extra field */
 
if (uO.cflag) /* SYS$OUTPUT */
{
if (text_output && !PRINTABLE_FORMAT(rfm))
{
Info(slide, 1, ((char *)slide,
"[ File %s has illegal record format to put to screen ]\n",
FnFilter1(G.filename)));
free_up();
return OPENOUT_FAILED;
}
}
else /* File output */
{
rab = cc$rms_rab; /* Initialize RAB. */
 
/* The output FAB has already been initialized with the values
* found in the Zip file's "VMS attributes" extra field.
*/
 
#ifdef NAML$C_MAXRSS
 
nam = CC_RMS_NAM; /* Initialize NAML. */
outfab->FAB_NAM = &nam; /* Point FAB to NAML. */
 
outfab->fab$l_dna = (char *) -1; /* Using NAML for default name. */
outfab->fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNS = strlen(G.filename);
 
/* Prepare date-time XABs, unless user requests not to. */
if (uO.D_flag <= 1) {
/* If no XAB date/time, use attributes from non-VMS fields. */
if (!(xabdat && xabrdt))
{
set_default_datetime_XABs(__G);
 
if (xabdat == NULL)
{
dattim.xab$l_nxt = outfab->fab$l_xab;
outfab->fab$l_xab = (void *) &dattim;
}
}
}
/* 2005-02-14 SMS. What does this mean? ----vvvvvvvvvvvvvvvvvvvvvvvvvvv */
outfab->fab$w_ifi = 0; /* Clear IFI. It may be nonzero after ZIP */
outfab->fab$b_fac = FAB$M_BIO | FAB$M_PUT; /* block-mode output */
#ifdef SYMLINKS
/* 2007-02-28 SMS.
* VMS/RMS symlink properties will be restored naturally when
* the link file is recreated this way, so there's no need to do
* the deferred symlink post-processing step for this file.
* Therefore, clear the pInfo->symlink flag here, and the symlink
* "close file" processor will only display the link text.
*/
if (G.symlnk) {
G.pInfo->symlink = 0;
if (QCOND2) {
/* Symlink file is read back to display the link text. */
outfab->fab$b_fac |= FAB$M_GET;
}
}
#endif /* SYMLINKS */
 
/* 2004-11-23 SMS.
* Set the "sequential access only" flag, as otherwise, on a
* file system with highwater marking enabled, allocating space
* for a large file may lock the disk for a long time (minutes).
*/
#ifdef OLD_FABDEF
outfab-> fab$l_fop |= FAB$M_SQO;
#else /* !OLD_FABDEF */
outfab-> fab$v_sqo = 1;
#endif /* ?OLD_FABDEF */
 
ierr = sys$create(outfab);
if (ierr == RMS$_FEX)
{
/* File exists.
* Consider command-line options, or ask the user what to do.
*/
ierr = replace(__G);
switch (ierr & REPL_TASKMASK)
{
case REPL_NO_EXTRACT: /* No extract. */
free_up();
return ((ierr & REPL_ERRLV_WARN)
? OPENOUT_SKIPWARN : OPENOUT_SKIPOK);
case REPL_NEW_VERSION: /* Create a new version. */
ierr = replace_rms_newversion(__G);
break;
case REPL_OVERWRITE: /* Overwrite the existing file. */
ierr = replace_rms_overwrite(__G);
break;
}
}
 
if (ERR(ierr))
{
char buf[NAM_MAXRSS + 128]; /* Name length + message length. */
 
sprintf(buf, "[ Cannot create ($create) output file %s ]\n",
G.filename);
vms_msg(__G__ buf, ierr);
if (outfab->fab$l_stv != 0)
{
vms_msg(__G__ "", outfab->fab$l_stv);
}
free_up();
return OPENOUT_FAILED;
}
 
if (outfab->fab$b_org & (FAB$C_REL | FAB$C_IDX)) {
/* relative and indexed files require explicit allocation */
ierr = sys$extend(outfab);
if (ERR(ierr))
{
char buf[NAM_MAXRSS + 128]; /* Name length + msg length. */
 
sprintf(buf, "[ Cannot allocate space for %s ]\n", G.filename);
vms_msg(__G__ buf, ierr);
if (outfab->fab$l_stv != 0)
{
vms_msg(__G__ "", outfab->fab$l_stv);
}
free_up();
return OPENOUT_FAILED;
}
}
 
outrab = &rab;
rab.rab$l_fab = outfab;
{
rab.rab$l_rop |= (RAB$M_BIO | RAB$M_ASY);
}
rab.rab$b_rac = RAB$C_SEQ;
 
if ((ierr = sys$connect(outrab)) != RMS$_NORMAL)
{
#ifdef DEBUG
vms_msg(__G__ "create_rms_output: sys$connect failed.\n", ierr);
if (outfab->fab$l_stv != 0)
{
vms_msg(__G__ "", outfab->fab$l_stv);
}
#endif
Info(slide, 1, ((char *)slide,
"Cannot create ($connect) output file: %s\n",
FnFilter1(G.filename)));
free_up();
return OPENOUT_FAILED;
}
} /* end if (!uO.cflag) */
 
init_buf_ring();
 
if ( text_output )
switch (rfm)
{
case FAB$C_VAR:
_flush_routine = _flush_varlen;
break;
case FAB$C_STM:
case FAB$C_STMCR:
case FAB$C_STMLF:
_flush_routine = _flush_stream;
got_eol = 0;
break;
default:
_flush_routine = _flush_blocks;
break;
}
else
_flush_routine = _flush_blocks;
_close_routine = _close_rms;
return OPENOUT_OK;
}
 
 
 
static int pka_devchn;
static int pka_io_pending;
static unsigned pka_vbn;
 
/* IOSB for QIO[W] read and write operations. */
#if defined(__DECC) || defined(__DECCXX)
#pragma __member_alignment __save
#pragma __nomember_alignment
#endif /* __DECC || __DECCXX */
static struct
{
unsigned short status;
unsigned int count; /* Unaligned ! */
unsigned short dummy;
} pka_io_iosb;
#if defined(__DECC) || defined(__DECCXX)
#pragma __member_alignment __restore
#endif /* __DECC || __DECCXX */
 
/* IOSB for QIO[W] miscellaneous ACP operations. */
static struct
{
unsigned short status;
unsigned short dummy;
unsigned int count;
} pka_acp_iosb;
 
static struct fibdef pka_fib;
static struct atrdef pka_atr[VMS_MAX_ATRCNT];
static int pka_idx;
static ulg pka_uchar;
static struct fatdef pka_rattr;
 
/* Directory attribute storage, descriptor (list). */
static struct atrdef pka_recattr[2] =
{ { sizeof(pka_rattr), ATR$C_RECATTR, GVTC &pka_rattr}, /* RECATTR. */
{ 0, 0, 0 } /* List terminator. */
};
 
static struct dsc$descriptor pka_fibdsc =
{ sizeof(pka_fib), DSC$K_DTYPE_Z, DSC$K_CLASS_S, (void *) &pka_fib };
 
static struct dsc$descriptor_s pka_devdsc =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &nam.NAM_DVI[1] };
 
static struct dsc$descriptor_s pka_fnam =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
 
/* Expanded and resultant name storage. */
static char exp_nam[NAM_MAXRSS];
static char res_nam[NAM_MAXRSS];
 
/* Special ODS5-QIO-compatible name storage. */
#ifdef NAML$C_MAXRSS
static char sys_nam[NAML$C_MAXRSS]; /* Probably need less here. */
#endif /* NAML$C_MAXRSS */
 
#define PK_PRINTABLE_RECTYP(x) ( (x) == FAT$C_VARIABLE \
|| (x) == FAT$C_STREAMLF \
|| (x) == FAT$C_STREAMCR \
|| (x) == FAT$C_STREAM )
 
 
/* The following return codes are supported:
* OPENOUT_OK a file has been opened normally
* OPENOUT_FAILED the file open process failed
* OPENOUT_SKIPOK file open skipped at user request, err level OK
* OPENOUT_SKIPWARN file open skipped at user request, err level WARN
*/
static int create_qio_output(__GPRO)
{
int status;
int i;
int text_output;
 
/* extract the file in text (variable-length) format, when
* piping to SYS$OUTPUT, unless "binary" piping was requested
* by the user (through the -b option); the "-a" option is
* ignored when extracting zip entries with VMS attributes saved
*/
text_output = uO.cflag &&
(!uO.bflag || (!(uO.bflag - 1) && G.pInfo->textfile));
 
if ( uO.cflag )
{
int rtype;
 
if (text_output)
{
rtype = pka_rattr.fat$v_rtype;
if (!PK_PRINTABLE_RECTYP(rtype))
{
Info(slide, 1, ((char *)slide,
"[ File %s has illegal record format to put to screen ]\n",
FnFilter1(G.filename)));
return OPENOUT_FAILED;
}
}
else
/* force "block I/O" for binary piping mode */
rtype = FAT$C_UNDEFINED;
 
init_buf_ring();
 
switch (rtype)
{
case FAT$C_VARIABLE:
_flush_routine = _flush_varlen;
break;
case FAT$C_STREAM:
case FAT$C_STREAMCR:
case FAT$C_STREAMLF:
_flush_routine = _flush_stream;
got_eol = 0;
break;
default:
_flush_routine = _flush_blocks;
break;
}
_close_routine = _close_rms;
}
else /* !(uO.cflag) : redirect output */
{
fileblk = cc$rms_fab; /* Initialize FAB. */
nam = CC_RMS_NAM; /* Initialize NAM[L]. */
fileblk.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
 
#ifdef NAML$C_MAXRSS
 
fileblk.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fileblk.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
/* Special ODS5-QIO-compatible name storage. */
nam.naml$l_filesys_name = sys_nam;
nam.naml$l_filesys_name_alloc = sizeof(sys_nam);
 
#endif /* NAML$C_MAXRSS */
 
/* VMS-format file name, derived from archive. */
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNS = strlen(G.filename);
 
/* Expanded and resultant name storage. */
nam.NAM_ESA = exp_nam;
nam.NAM_ESS = sizeof(exp_nam);
nam.NAM_RSA = res_nam;
nam.NAM_RSS = sizeof(res_nam);
 
if ( ERR(status = sys$parse(&fileblk)) )
{
vms_msg(__G__ "create_qio_output: sys$parse failed.\n", status);
return OPENOUT_FAILED;
}
 
pka_devdsc.dsc$w_length = (unsigned short)nam.NAM_DVI[0];
 
if ( ERR(status = sys$assign(&pka_devdsc, &pka_devchn, 0, 0)) )
{
vms_msg(__G__ "create_qio_output: sys$assign failed.\n", status);
return OPENOUT_FAILED;
}
 
#ifdef NAML$C_MAXRSS
 
/* Enable fancy name characters. Note that "fancy" here does
not include Unicode, for which there's no support elsewhere.
*/
pka_fib.fib$v_names_8bit = 1;
pka_fib.fib$b_name_format_in = FIB$C_ISL1;
 
/* ODS5 Extended names used as input to QIO have peculiar
encoding (perhaps to minimize storage?), so the special
filesys_name result (typically containing fewer carets) must
be used here.
*/
pka_fnam.dsc$a_pointer = nam.naml$l_filesys_name;
pka_fnam.dsc$w_length = nam.naml$l_filesys_name_size;
 
#else /* !NAML$C_MAXRSS */
 
/* Extract only the name.type;version.
2005-02-14 SMS.
Note: In old code, the version in the name here was retained
only if -V (uO.V_flag, so that there might be an explicit
version number in the archive (or perhaps not)), but the
version should already have been stripped before this in
adj_file_name_odsX(), and sys$parse() here should always
return a good version number which may be used as-is. If
not, here's where to fix the (new) problem. Note that the
ODS5-compatible code uses the whole thing in filesys_name,
too, and that's critical for proper interpretation of funny
names. (Omitting the ";" can cause trouble, so it should
certainly be kept, even if the version digits are removed
here.)
*/
 
pka_fnam.dsc$a_pointer = nam.NAM_L_NAME;
pka_fnam.dsc$w_length =
nam.NAM_B_NAME + nam.NAM_B_TYPE + nam.NAM_B_VER;
 
#if 0
pka_fnam.dsc$w_length = nam.NAM_B_NAME + nam.NAM_B_TYPE;
if ( uO.V_flag /* keep versions */ )
pka_fnam.dsc$w_length += nam.NAM_B_VER;
#endif /* 0 */
 
#endif /* ?NAML$C_MAXRSS */
 
/* Move the directory ID from the NAM[L] to the FIB.
Clear the FID in the FIB, as we're using the name.
*/
for (i = 0; i < 3; i++)
{
pka_fib.FIB$W_DID[i] = nam.NAM_DID[i];
pka_fib.FIB$W_FID[i] = 0;
}
 
/* 2004-11-23 SMS.
* Set the "sequential access only" flag, as otherwise, on a
* file system with highwater marking enabled, allocating space
* for a large file may lock the disk for a long time (minutes).
* (The "no other readers" flag is also required, if you want
* the "sequential access only" flag to have any effect.)
*/
pka_fib.FIB$L_ACCTL = FIB$M_WRITE | FIB$M_SEQONLY | FIB$M_NOREAD;
 
/* Allocate space for the file */
pka_fib.FIB$W_EXCTL = FIB$M_EXTEND;
if ( pka_uchar & FCH$M_CONTIG )
pka_fib.FIB$W_EXCTL |= FIB$M_ALCON | FIB$M_FILCON;
if ( pka_uchar & FCH$M_CONTIGB )
pka_fib.FIB$W_EXCTL |= FIB$M_ALCONB;
 
#define SWAPW(x) ( (((x)>>16)&0xFFFF) + ((x)<<16) )
 
pka_fib.fib$l_exsz = SWAPW(pka_rattr.fat$l_hiblk);
 
status = sys$qiow(0, /* event flag */
pka_devchn, /* channel */
IO$_CREATE|IO$M_CREATE|IO$M_ACCESS, /* funct */
&pka_acp_iosb, /* IOSB */
0, /* AST address */
0, /* AST parameter */
&pka_fibdsc, /* P1 = File Info Block */
&pka_fnam, /* P2 = File name (descr) */
0, /* P3 (= Resulting name len) */
0, /* P4 (= Resulting name descr) */
pka_atr, /* P5 = Attribute descr */
0); /* P6 (not used) */
 
if ( !ERR(status) )
status = pka_acp_iosb.status;
 
if ( status == SS$_DUPFILENAME )
{
/* File exists. Prepare to ask user what to do. */
 
/* Arrange to store the resultant file spec (with new
* version?) where the message code will find it.
*/
short res_nam_len;
struct dsc$descriptor_s res_nam_dscr =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
 
res_nam_dscr.dsc$a_pointer = G.filename;
res_nam_dscr.dsc$w_length = sizeof(G.filename);
 
/* File exists.
* Consider command-line options, or ask the user what to do.
*/
status = replace(__G);
switch (status & REPL_TASKMASK)
{
case REPL_NO_EXTRACT: /* No extract. */
free_up();
return ((status & REPL_ERRLV_WARN)
? OPENOUT_SKIPWARN : OPENOUT_SKIPOK);
case REPL_NEW_VERSION: /* Create a new version. */
pka_fib.FIB$W_NMCTL |= FIB$M_NEWVER;
break;
case REPL_OVERWRITE: /* Overwrite the existing file. */
pka_fib.FIB$W_NMCTL |= FIB$M_SUPERSEDE;
break;
}
 
/* Retry file creation with new (user-specified) policy. */
status = sys$qiow(0, /* event flag */
pka_devchn, /* channel */
IO$_CREATE|IO$M_CREATE|IO$M_ACCESS, /* funct */
&pka_acp_iosb, /* IOSB */
0, /* AST address */
0, /* AST parameter */
&pka_fibdsc, /* P1 = File Info Block */
&pka_fnam, /* P2 = File name (descr) */
&res_nam_len, /* P3 = Resulting name len */
&res_nam_dscr, /* P4 = Resulting name descr */
pka_atr, /* P5 = Attribute descr */
0); /* P6 (not used) */
 
if ( !ERR(status) )
status = pka_acp_iosb.status;
 
if (res_nam_len > 0)
{
/* NUL-terminate the resulting file spec. */
G.filename[res_nam_len] = '\0';
}
 
/* Clear any user-specified version policy flags
* (for the next file to be processed).
*/
pka_fib.FIB$W_NMCTL &= (~(FIB$M_NEWVER| FIB$M_SUPERSEDE));
}
 
if ( ERR(status) )
{
char buf[NAM_MAXRSS + 128]; /* Name length + message length. */
 
sprintf(buf, "[ Cannot create (QIO) output file %s ]\n",
G.filename);
vms_msg(__G__ buf, status);
sys$dassgn(pka_devchn);
return OPENOUT_FAILED;
}
 
#ifdef ASYNCH_QIO
init_buf_ring();
pka_io_pending = FALSE;
#else
locptr = locbuf;
loccnt = 0;
#endif
pka_vbn = 1;
_flush_routine = _flush_qio;
_close_routine = _close_qio;
} /* end if (!uO.cflag) */
return OPENOUT_OK;
}
 
 
/* 2008-07-23 SMS.
* Segregated user query function from file re-open functions/code.
*
* There was no code in create_qio_output() to deal with an
* SS$_DUPFILENAME condition, leading to ugly run-time failures, and its
* requirements differ from those of the RMS (non-QIO) functions,
* create_default_output() and create_rms_output().
*
* Whether it makes sense to have a second layer of VMS-specific
* querying after the generic UnZip query in extract.c:
* extract_or_test_entrylist() is another question, but changing that
* looks more scary than just getting the VMS-specific stuff to work
* right (better?).
*/
 
/* "File exists" handler(s). Ask user about further action. */
 
/* RMS create new version. */
static int replace_rms_newversion(__GPRO)
{
int ierr;
struct NAM_STRUCT nam;
 
nam = CC_RMS_NAM; /* Initialize local NAM[L] block. */
outfab->FAB_NAM = &nam; /* Point FAB to local NAM[L]. */
 
/* Arrange to store the resultant file spec (with new version), so
* that we can extract the actual file version from it, for later
* use in the "extracting:/inflating:/..." message (G.filename).
*/
nam.NAM_RSA = res_nam;
nam.NAM_RSS = sizeof(res_nam);
 
#ifdef NAML$C_MAXRSS
 
outfab->fab$l_dna = (char *) -1; /* Using NAML for default name. */
outfab->fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNS = strlen(G.filename);
 
/* Maximize version number. */
outfab->fab$l_fop |= FAB$M_MXV;
 
/* Create the new-version file. */
ierr = sys$create(outfab);
 
if (nam.NAM_RSL > 0)
{
/* File spec version pointers.
* Versions must exist, so a simple right-to-left search for ";"
* should work, even on ODS5 extended file specs.
*/
char *semi_col_orig;
char *semi_col_res;
 
/* NUL-terminate the (complete) resultant file spec. */
res_nam[nam.NAM_RSL] = '\0';
 
/* Find the versions (";") in the original and resultant file specs. */
semi_col_orig = strrchr(G.filename, ';');
semi_col_res = strrchr(res_nam, ';');
 
if ((semi_col_orig != NULL) && (semi_col_res != NULL))
{
/* Transfer the resultant version to the original file spec. */
strcpy((semi_col_orig + 1), (semi_col_res + 1));
}
}
return ierr;
}
 
 
/* RMS overwrite original version. */
static int replace_rms_overwrite(__GPRO)
{
/* Supersede existing file. */
outfab->fab$l_fop |= FAB$M_SUP;
/* Create (overwrite) the original-version file. */
return sys$create(outfab);
}
 
 
/* Main query function to ask user how to handle an existing file
* (unless command-line options already specify what to do).
*/
static int replace(__GPRO)
{
char answ[10];
int replace_code;
 
if (replace_code_all >= 0)
{
/* Use the previous all-file response. */
replace_code = replace_code_all;
}
else if (uO.overwrite_none)
{
/* "-n". Do not extract this (or any) file. */
replace_code = replace_code_all = REPL_NO_EXTRACT;
}
else if (uO.overwrite_all == 1)
{
/* "-o". Create a new version of this (or any) file. */
replace_code = replace_code_all = REPL_NEW_VERSION;
}
else if (uO.overwrite_all > 1)
{
/* "-oo". Overwrite (supersede) this (or any) existing file. */
replace_code = replace_code_all = REPL_OVERWRITE;
}
else
{
replace_code = -1;
do
{
/* Request, accept, and decode a response. */
Info(slide, 0x81, ((char *)slide,
"%s exists: new [v]ersion, [o]verwrite, or [n]o extract?\n\
(Uppercase response [V,O,N] => Do same for all files): ",
FnFilter1(G.filename)));
fflush(stderr);
 
if (fgets(answ, sizeof(answ), stdin) == (char *)NULL)
{
Info(slide, 1, ((char *)slide, AssumeNo));
/* Handle the NULL answer as "N",
* do not extract any existing files. */
replace_code_all = REPL_NO_EXTRACT;
/* Set a warning indicator. */
replace_code = REPL_NO_EXTRACT | REPL_ERRLV_WARN;
/* We are finished, break out of the query loop. */
break;
}
 
/* Strip off a trailing newline, to avoid corrupt
* complaints when displaying the answer.
*/
if (answ[strlen(answ) - 1] == '\n')
answ[strlen(answ) - 1] = '\0';
 
/* Extra newline to avoid having the extracting:/inflating:/...:
* message overwritten by the next query.
*/
Info(slide, 1, ((char *)slide, "\n"));
 
/* Interpret response. Store upper-case answer for future use. */
switch (answ[0])
{
case 'N':
replace_code_all = REPL_NO_EXTRACT;
case 'n':
/* Do not extract this file. */
replace_code = REPL_NO_EXTRACT;
break;
case 'O':
replace_code_all = REPL_OVERWRITE;
case 'o':
/* Overwrite (supersede) this existing file. */
replace_code = REPL_OVERWRITE;
break;
case 'V':
replace_code_all = REPL_NEW_VERSION;
case 'v':
/* Create a new version of this file. */
replace_code = REPL_NEW_VERSION;
break;
default:
/* Invalid response. Try again. */
Info(slide, 1, ((char *)slide, InvalidResponse, answ));
}
} while (replace_code < 0);
}
return replace_code;
}
 
 
 
#define W(p) (*(unsigned short*)(p))
#define L(p) (*(unsigned long*)(p))
#define EQL_L(a, b) ( L(a) == L(b) )
#define EQL_W(a, b) ( W(a) == W(b) )
 
/*
* Function find_vms_attrs() scans the ZIP entry extra field, if any,
* and looks for VMS attribute records. Various date-time attributes
* are ignored if set_date_time is FALSE (typically for a directory).
*
* For a set of IZ records, a FAB and various XABs are created and
* chained together.
*
* For a PK record, the pka_atr[] attribute descriptor array is
* populated.
*
* The return value is a VAT_* value, according to the type of extra
* field attribute data found.
*/
static int find_vms_attrs(__GPRO__ int set_date_time)
{
uch *scan = G.extra_field;
struct EB_header *hdr;
int len;
int type=VAT_NONE;
 
outfab = NULL;
xabfhc = NULL;
xabdat = NULL;
xabrdt = NULL;
xabpro = NULL;
first_xab = last_xab = NULL;
 
if (scan == NULL)
return VAT_NONE;
len = G.lrec.extra_field_length;
 
#define LINK(p) {/* Link xaballs and xabkeys into chain */ \
if ( first_xab == NULL ) \
first_xab = (void *) p; \
if ( last_xab != NULL ) \
last_xab->xab$l_nxt = (void *) p; \
last_xab = (void *) p; \
p->xab$l_nxt = NULL; \
}
/* End of macro LINK */
 
while (len > 0)
{
hdr = (struct EB_header *)scan;
if (EQL_W(&hdr->tag, IZ_SIGNATURE))
{
/*
* Info-ZIP-style extra block decoding.
*/
uch *blk;
unsigned siz;
uch *block_id;
 
type = VAT_IZ;
 
siz = hdr->size;
blk = (uch *)(&hdr->data[0]);
block_id = (uch *)(&((struct IZ_block *)hdr)->bid);
 
if (EQL_L(block_id, FABSIG)) {
outfab = (struct FAB *)extract_izvms_block(__G__ blk,
siz, NULL, (uch *)&cc$rms_fab, FABL);
} else if (EQL_L(block_id, XALLSIG)) {
xaball = (struct XABALL *)extract_izvms_block(__G__ blk,
siz, NULL, (uch *)&cc$rms_xaball, XALLL);
LINK(xaball);
} else if (EQL_L(block_id, XKEYSIG)) {
xabkey = (struct XABKEY *)extract_izvms_block(__G__ blk,
siz, NULL, (uch *)&cc$rms_xabkey, XKEYL);
LINK(xabkey);
} else if (EQL_L(block_id, XFHCSIG)) {
xabfhc = (struct XABFHC *) extract_izvms_block(__G__ blk,
siz, NULL, (uch *)&cc$rms_xabfhc, XFHCL);
} else if (EQL_L(block_id, XDATSIG)) {
if (set_date_time) {
xabdat = (struct XABDAT *) extract_izvms_block(__G__ blk,
siz, NULL, (uch *)&cc$rms_xabdat, XDATL);
}
} else if (EQL_L(block_id, XRDTSIG)) {
if (set_date_time) {
xabrdt = (struct XABRDT *) extract_izvms_block(__G__ blk,
siz, NULL, (uch *)&cc$rms_xabrdt, XRDTL);
}
} else if (EQL_L(block_id, XPROSIG)) {
xabpro = (struct XABPRO *) extract_izvms_block(__G__ blk,
siz, NULL, (uch *)&cc$rms_xabpro, XPROL);
} else if (EQL_L(block_id, VERSIG)) {
#ifdef CHECK_VERSIONS
char verbuf[80];
unsigned verlen = 0;
uch *vers;
char *m;
 
get_vms_version(verbuf, sizeof(verbuf));
vers = extract_izvms_block(__G__ blk, siz,
&verlen, NULL, 0);
if ((m = strrchr((char *) vers, '-')) != NULL)
*m = '\0'; /* Cut out release number */
if (strcmp(verbuf, (char *) vers) && uO.qflag < 2)
{
Info(slide, 0, ((char *)slide,
"[ Warning: VMS version mismatch."));
 
Info(slide, 0, ((char *)slide,
" This version %s --", verbuf));
strncpy(verbuf, (char *) vers, verlen);
verbuf[verlen] = '\0';
Info(slide, 0, ((char *)slide,
" version made by %s ]\n", verbuf));
}
free(vers);
#endif /* CHECK_VERSIONS */
} else {
Info(slide, 1, ((char *)slide,
"[ Warning: Unknown block signature %s ]\n",
block_id));
}
}
else if (hdr->tag == PK_SIGNATURE)
{
/*
* PKWARE-style extra block decoding.
*/
struct PK_header *blk;
register byte *scn;
register int len;
 
type = VAT_PK;
 
blk = (struct PK_header *)hdr;
len = blk->size - (PK_HEADER_SIZE - EB_HEADSIZE);
scn = (byte *)(&blk->data);
pka_idx = 0;
 
if (blk->crc32 != crc32(CRCVAL_INITIAL, scn, (extent)len))
{
Info(slide, 1, ((char *)slide,
"[ Warning: CRC error, discarding PKWARE extra field ]\n"));
len = 0;
type = VAT_NONE;
}
 
while (len > PK_FLDHDR_SIZE)
{
register struct PK_field *fld;
int skip=0;
 
fld = (struct PK_field *)scn;
switch(fld->tag)
{
case ATR$C_UCHAR:
pka_uchar = L(&fld->value);
break;
case ATR$C_RECATTR:
pka_rattr = *(struct fatdef *)(&fld->value);
break;
case ATR$C_UIC:
case ATR$C_ADDACLENT:
skip = !uO.X_flag;
break;
case ATR$C_CREDATE:
case ATR$C_REVDATE:
case ATR$C_EXPDATE:
case ATR$C_BAKDATE:
case ATR$C_ASCDATES:
skip = (set_date_time == FALSE);
break;
}
 
if ( !skip )
{
pka_atr[pka_idx].atr$w_size = fld->size;
pka_atr[pka_idx].atr$w_type = fld->tag;
pka_atr[pka_idx].atr$l_addr = GVTC &fld->value;
++pka_idx;
}
len -= fld->size + PK_FLDHDR_SIZE;
scn += fld->size + PK_FLDHDR_SIZE;
}
pka_atr[pka_idx].atr$w_size = 0; /* End of list */
pka_atr[pka_idx].atr$w_type = 0;
pka_atr[pka_idx].atr$l_addr = 0; /* NULL when DECC VAX gets fixed */
}
len -= hdr->size + EB_HEADSIZE;
scan += hdr->size + EB_HEADSIZE;
}
 
if ( type == VAT_IZ )
{
if (outfab != NULL)
{
/* Do not link XABPRO or XABRDT now.
* Leave them for sys$close() resp. set_direc_attribs().
*/
outfab->fab$l_xab = NULL;
if (xabfhc != NULL)
{
xabfhc->xab$l_nxt = outfab->fab$l_xab;
outfab->fab$l_xab = (void *) xabfhc;
}
if (xabdat != NULL)
{
xabdat->xab$l_nxt = outfab->fab$l_xab;
outfab->fab$l_xab = (void *) xabdat;
}
if (first_xab != NULL) /* Link xaball,xabkey subchain */
{
last_xab->xab$l_nxt = outfab->fab$l_xab;
outfab->fab$l_xab = (void *) first_xab;
}
}
else
type = VAT_NONE;
}
return type;
}
 
 
 
static void free_up()
{
/*
* Free up all allocated XABs.
*/
if (xabdat != NULL) free(xabdat);
if (xabpro != NULL) free(xabpro);
if (xabrdt != NULL) free(xabrdt);
if (xabfhc != NULL) free(xabfhc);
while (first_xab != NULL)
{
struct XAB *x;
 
x = (struct XAB *) first_xab->xab$l_nxt;
free(first_xab);
first_xab = x;
}
/* Free FAB storage, if not the static one. */
if (outfab != NULL && outfab != &fileblk)
free(outfab);
}
 
 
 
#ifdef CHECK_VERSIONS
 
static int get_vms_version(verbuf, len)
char *verbuf;
int len;
{
int i = SYI$_VERSION;
int verlen = 0;
struct dsc$descriptor version;
char *m;
 
version.dsc$a_pointer = verbuf;
version.dsc$w_length = len - 1;
version.dsc$b_dtype = DSC$K_DTYPE_B;
version.dsc$b_class = DSC$K_CLASS_S;
 
if (ERR(lib$getsyi(&i, 0, &version, &verlen, 0, 0)) || verlen == 0)
return 0;
 
/* Cut out trailing spaces "V5.4-3 " -> "V5.4-3" */
for (m = verbuf + verlen, i = verlen - 1; i > 0 && verbuf[i] == ' '; --i)
--m;
*m = '\0';
 
/* Cut out release number "V5.4-3" -> "V5.4" */
if ((m = strrchr(verbuf, '-')) != NULL)
*m = '\0';
return strlen(verbuf) + 1; /* Transmit ending '\0' too */
}
 
#endif /* CHECK_VERSIONS */
 
 
 
/* flush contents of output buffer */
int flush(__G__ rawbuf, size, unshrink) /* return PK-type error code */
__GDEF
uch *rawbuf;
ulg size;
int unshrink;
{
G.crc32val = crc32(G.crc32val, rawbuf, (extent)size);
if (uO.tflag)
return PK_COOL; /* Do not output. Update CRC only */
else
return (*_flush_routine)(__G__ rawbuf, size, 0);
}
 
 
 
static int _flush_blocks(__G__ rawbuf, size, final_flag)
/* Asynchronous version */
__GDEF
uch *rawbuf;
unsigned size;
int final_flag; /* 1 if this is the final flushout */
{
int status;
unsigned off = 0;
 
while (size > 0)
{
if (curbuf->bufcnt < BUFS512)
{
unsigned ncpy;
 
ncpy = size > (BUFS512 - curbuf->bufcnt) ?
(BUFS512 - curbuf->bufcnt) : size;
memcpy(curbuf->buf + curbuf->bufcnt, rawbuf + off, ncpy);
size -= ncpy;
curbuf->bufcnt += ncpy;
off += ncpy;
}
if (curbuf->bufcnt == BUFS512)
{
status = WriteBuffer(__G__ curbuf->buf, curbuf->bufcnt);
if (status)
return status;
curbuf = curbuf->next;
curbuf->bufcnt = 0;
}
}
 
return (final_flag && (curbuf->bufcnt > 0)) ?
WriteBuffer(__G__ curbuf->buf, curbuf->bufcnt) :
PK_COOL;
}
 
 
 
#ifdef ASYNCH_QIO
static int WriteQIO(__G__ buf, len)
__GDEF
uch *buf;
unsigned len;
{
int status;
 
if (pka_io_pending) {
status = sys$synch(0, &pka_io_iosb);
if (!ERR(status))
status = pka_io_iosb.status;
if (ERR(status))
{
vms_msg(__G__ "[ WriteQIO: sys$synch found I/O failure ]\n",
status);
return PK_DISK;
}
pka_io_pending = FALSE;
}
/*
* Put content of buffer as a single VB
*/
status = sys$qio(0, pka_devchn, IO$_WRITEVBLK,
&pka_io_iosb, 0, 0,
buf, len, pka_vbn,
0, 0, 0);
if (ERR(status))
{
vms_msg(__G__ "[ WriteQIO: sys$qio failed ]\n", status);
return PK_DISK;
}
pka_io_pending = TRUE;
pka_vbn += (len>>9);
 
return PK_COOL;
}
 
/*
2004-10-01 SMS. Changed to clear the extra byte written out by qio()
and sys$write() when an odd byte count is incremented to the next
even value, either explicitly (qio), or implicitly (sys$write), on
the theory that a reliable NUL beats left-over garbage. Alpha and
VAX object files seem frequently to have even more than one byte of
extra junk past EOF, so this may not help them.
*/
 
static int _flush_qio(__G__ rawbuf, size, final_flag)
/* Asynchronous version */
__GDEF
uch *rawbuf;
unsigned size;
int final_flag; /* 1 if this is the final flushout */
{
int status;
unsigned off = 0;
 
while (size > 0)
{
if (curbuf->bufcnt < BUFS512)
{
unsigned ncpy;
 
ncpy = size > (BUFS512 - curbuf->bufcnt) ?
(BUFS512 - curbuf->bufcnt) : size;
memcpy(curbuf->buf + curbuf->bufcnt, rawbuf + off, ncpy);
size -= ncpy;
curbuf->bufcnt += ncpy;
off += ncpy;
}
if (curbuf->bufcnt == BUFS512)
{
status = WriteQIO(__G__ curbuf->buf, curbuf->bufcnt);
if (status)
return status;
curbuf = curbuf->next;
curbuf->bufcnt = 0;
}
}
 
if (final_flag && (curbuf->bufcnt > 0))
{
unsigned bufcnt_even;
 
/* Round up to an even byte count. */
bufcnt_even = (curbuf->bufcnt+1) & (~1);
/* If there is one, clear the extra byte. */
if (bufcnt_even > curbuf->bufcnt)
curbuf->buf[curbuf->bufcnt] = '\0';
 
return WriteQIO(curbuf->buf, bufcnt_even);
}
else
{
return PK_COOL;
}
}
 
#else /* !ASYNCH_QIO */
 
static int _flush_qio(__G__ rawbuf, size, final_flag)
__GDEF
uch *rawbuf;
unsigned size;
int final_flag; /* 1 if this is the final flushout */
{
int status;
uch *out_ptr=rawbuf;
 
if ( final_flag )
{
if ( loccnt > 0 )
{
unsigned loccnt_even;
 
/* Round up to an even byte count. */
loccnt_even = (loccnt+1) & (~1);
/* If there is one, clear the extra byte. */
if (loccnt_even > loccnt)
locbuf[loccnt] = '\0';
 
status = sys$qiow(0, pka_devchn, IO$_WRITEVBLK,
&pka_io_iosb, 0, 0,
locbuf,
loccnt_even,
pka_vbn,
0, 0, 0);
if (!ERR(status))
status = pka_io_iosb.status;
if (ERR(status))
{
vms_msg(__G__ "[ Write QIO failed ]\n", status);
return PK_DISK;
}
}
return PK_COOL;
}
 
if ( loccnt > 0 )
{
/*
* Fill local buffer upto 512 bytes then put it out
*/
unsigned ncpy;
 
ncpy = 512-loccnt;
if ( ncpy > size )
ncpy = size;
 
memcpy(locptr, out_ptr, ncpy);
locptr += ncpy;
loccnt += ncpy;
size -= ncpy;
out_ptr += ncpy;
if ( loccnt == 512 )
{
status = sys$qiow(0, pka_devchn, IO$_WRITEVBLK,
&pka_io_iosb, 0, 0,
locbuf, loccnt, pka_vbn,
0, 0, 0);
if (!ERR(status))
status = pka_io_iosb.status;
if (ERR(status))
{
vms_msg(__G__ "[ Write QIO failed ]\n", status);
return PK_DISK;
}
 
pka_vbn++;
loccnt = 0;
locptr = locbuf;
}
}
 
if ( size >= 512 )
{
unsigned nblk, put_cnt;
 
/*
* Put rest of buffer as a single VB
*/
put_cnt = (nblk = size>>9)<<9;
status = sys$qiow(0, pka_devchn, IO$_WRITEVBLK,
&pka_io_iosb, 0, 0,
out_ptr, put_cnt, pka_vbn,
0, 0, 0);
if (!ERR(status))
status = pka_io_iosb.status;
if (ERR(status))
{
vms_msg(__G__ "[ Write QIO failed ]\n", status);
return PK_DISK;
}
 
pka_vbn += nblk;
out_ptr += put_cnt;
size -= put_cnt;
}
 
if ( size > 0 )
{
memcpy(locptr, out_ptr, size);
loccnt += size;
locptr += size;
}
 
return PK_COOL;
}
#endif /* ?ASYNCH_QIO */
 
 
 
/*
* The routine _flush_varlen() requires: "(size & 1) == 0"
* (The variable-length record algorithm assumes an even byte-count!)
*/
static int _flush_varlen(__G__ rawbuf, size, final_flag)
__GDEF
uch *rawbuf;
unsigned size;
int final_flag;
{
unsigned nneed;
unsigned reclen;
uch *inptr=rawbuf;
 
/*
* Flush local buffer
*/
 
if ( loccnt > 0 ) /* incomplete record left from previous call */
{
reclen = *(ush*)locbuf;
nneed = reclen + 2 - loccnt;
if ( nneed > size )
{
if ( size+loccnt > BUFSMAXREC )
{
char buf[80];
Info(buf, 1, (buf,
"[ Record too long (%u bytes) ]\n", reclen));
return PK_DISK;
}
memcpy(locbuf+loccnt, inptr, size);
loccnt += size;
size = 0;
}
else
{
memcpy(locbuf+loccnt, inptr, nneed);
loccnt += nneed;
size -= nneed;
inptr += nneed;
if ( reclen & 1 )
{
size--;
inptr++;
}
if ( WriteRecord(__G__ locbuf+2, reclen) )
return PK_DISK;
loccnt = 0;
}
}
/*
* Flush incoming records
*/
while (size > 0)
{
reclen = *(ush*)inptr;
if ( reclen+2 <= size )
{
if (WriteRecord(__G__ inptr+2, reclen))
return PK_DISK;
size -= 2+reclen;
inptr += 2+reclen;
if ( reclen & 1 )
{
--size;
++inptr;
}
}
else
{
memcpy(locbuf, inptr, size);
loccnt = size;
size = 0;
}
 
}
/*
* Final flush rest of local buffer
*/
if ( final_flag && loccnt > 0 )
{
char buf[80];
 
Info(buf, 1, (buf,
"[ Warning, incomplete record of length %u ]\n",
(unsigned)*(ush*)locbuf));
if ( WriteRecord(__G__ locbuf+2, loccnt-2) )
return PK_DISK;
}
return PK_COOL;
}
 
 
 
/*
* Routine _flush_stream breaks decompressed stream into records
* depending on format of the stream (fab->rfm, G.pInfo->textmode, etc.)
* and puts out these records. It also handles CR LF sequences.
* Should be used when extracting *text* files.
*/
 
#define VT 0x0B
#define FF 0x0C
 
/* The file is from MSDOS/OS2/NT -> handle CRLF as record end, throw out ^Z */
 
/* GRR NOTES: cannot depend on hostnum! May have "flip'd" file or re-zipped
* a Unix file, etc. */
 
#ifdef USE_ORIG_DOS
# define ORG_DOS \
(G.pInfo->hostnum==FS_FAT_ \
|| G.pInfo->hostnum==FS_HPFS_ \
|| G.pInfo->hostnum==FS_NTFS_)
#else
# define ORG_DOS 1
#endif
 
/* Record delimiters */
#ifdef undef
#define RECORD_END(c, f) \
( ( ORG_DOS || G.pInfo->textmode ) && c==CTRLZ \
|| ( f == FAB$C_STMLF && c==LF ) \
|| ( f == FAB$C_STMCR || ORG_DOS || G.pInfo->textmode ) && c==CR \
|| ( f == FAB$C_STM && (c==CR || c==LF || c==FF || c==VT) ) \
)
#else
# define RECORD_END(c, f) ((c) == LF || (c) == (CR))
#endif
 
static unsigned find_eol(p, n, l)
/*
* Find first CR, LF, CR/LF or LF/CR in string 'p' of length 'n'.
* Return offset of the sequence found or 'n' if not found.
* If found, return in '*l' length of the sequence (1 or 2) or
* zero if sequence end not seen, i.e. CR or LF is last char
* in the buffer.
*/
ZCONST uch *p;
unsigned n;
unsigned *l;
{
unsigned off = n;
ZCONST uch *q;
 
*l = 0;
 
for (q=p ; n > 0 ; --n, ++q)
if ( RECORD_END(*q, rfm) )
{
off = q-p;
break;
}
 
if ( n > 1 )
{
*l = 1;
if ( ( q[0] == CR && q[1] == LF ) || ( q[0] == LF && q[1] == CR ) )
*l = 2;
}
 
return off;
}
 
/* Record delimiters that must be put out */
#define PRINT_SPEC(c) ( (c)==FF || (c)==VT )
 
 
 
static int _flush_stream(__G__ rawbuf, size, final_flag)
__GDEF
uch *rawbuf;
unsigned size;
int final_flag; /* 1 if this is the final flushout */
{
int rest;
unsigned end = 0, start = 0;
 
if (size == 0 && loccnt == 0)
return PK_COOL; /* Nothing to do ... */
 
if ( final_flag )
{
unsigned recsize;
 
/*
* This is flush only call. size must be zero now.
* Just eject everything we have in locbuf.
*/
recsize = loccnt - (got_eol ? 1 : 0);
/*
* If the last char of file was ^Z ( end-of-file in MSDOS ),
* we will see it now.
*/
if ( recsize==1 && locbuf[0] == CTRLZ )
return PK_COOL;
 
return WriteRecord(__G__ locbuf, recsize);
}
 
 
if ( loccnt > 0 )
{
/* Find end of record partially saved in locbuf */
 
unsigned recsize;
int complete=0;
 
if ( got_eol )
{
recsize = loccnt - 1;
complete = 1;
 
if ( (got_eol == CR && rawbuf[0] == LF) ||
(got_eol == LF && rawbuf[0] == CR) )
end = 1;
 
got_eol = 0;
}
else
{
unsigned eol_len;
unsigned eol_off;
 
eol_off = find_eol(rawbuf, size, &eol_len);
 
if ( loccnt+eol_off > BUFSMAXREC )
{
/*
* No room in locbuf. Dump it and clear
*/
char buf[80]; /* CANNOT use slide for Info() */
 
recsize = loccnt;
start = 0;
Info(buf, 1, (buf,
"[ Warning: Record too long (%u) ]\n", loccnt+eol_off));
complete = 1;
end = 0;
}
else
{
if ( eol_off >= size )
{
end = size;
complete = 0;
}
else if ( eol_len == 0 )
{
got_eol = rawbuf[eol_off];
end = size;
complete = 0;
}
else
{
memcpy(locptr, rawbuf, eol_off);
recsize = loccnt + eol_off;
locptr += eol_off;
loccnt += eol_off;
end = eol_off + eol_len;
complete = 1;
}
}
}
 
if ( complete )
{
if (WriteRecord(__G__ locbuf, recsize))
return PK_DISK;
loccnt = 0;
locptr = locbuf;
}
} /* end if ( loccnt ) */
 
for (start = end; start < size && end < size; )
{
unsigned eol_off, eol_len;
 
got_eol = 0;
 
#ifdef undef
if (uO.cflag)
/* skip CR's at the beginning of record */
while (start < size && rawbuf[start] == CR)
++start;
#endif
 
if ( start >= size )
continue;
 
/* Find record end */
end = start+(eol_off = find_eol(rawbuf+start, size-start, &eol_len));
 
if ( end >= size )
continue;
 
if ( eol_len > 0 )
{
if ( WriteRecord(__G__ rawbuf+start, end-start) )
return PK_DISK;
start = end + eol_len;
}
else
{
got_eol = rawbuf[end];
end = size;
continue;
}
}
 
rest = size - start;
 
if (rest > 0)
{
if ( rest > BUFSMAXREC )
{
unsigned recsize;
char buf[80]; /* CANNOT use slide for Info() */
 
recsize = rest - (got_eol ? 1 : 0 );
Info(buf, 1, (buf,
"[ Warning: Record too long (%u) ]\n", recsize));
got_eol = 0;
return WriteRecord(__G__ rawbuf+start, recsize);
}
else
{
memcpy(locptr, rawbuf + start, rest);
locptr += rest;
loccnt += rest;
}
}
return PK_COOL;
}
 
 
 
static int WriteBuffer(__G__ buf, len)
__GDEF
uch *buf;
unsigned len;
{
int status;
 
if (uO.cflag)
{
(void)(*G.message)((zvoid *)&G, buf, len, 0);
}
else
{
status = sys$wait(outrab);
if (ERR(status))
{
vms_msg(__G__ "[ WriteBuffer: sys$wait failed ]\n", status);
if (outrab->rab$l_stv != 0)
{
vms_msg(__G__ "", outrab->rab$l_stv);
}
}
 
/* If odd byte count, then this must be the final record.
Clear the extra byte past EOF to help keep the file clean.
*/
if (len & 1)
buf[len] = '\0';
 
outrab->rab$w_rsz = len;
outrab->rab$l_rbf = (char *) buf;
 
if (ERR(status = sys$write(outrab)))
{
vms_msg(__G__ "[ WriteBuffer: sys$write failed ]\n", status);
if (outrab->rab$l_stv != 0)
{
vms_msg(__G__ "", outrab->rab$l_stv);
}
return PK_DISK;
}
}
return PK_COOL;
}
 
 
 
static int WriteRecord(__G__ rec, len)
__GDEF
uch *rec;
unsigned len;
{
int status;
 
if (uO.cflag)
{
(void)(*G.message)((zvoid *)&G, rec, len, 0);
(void)(*G.message)((zvoid *)&G, (uch *) ("\n"), 1, 0);
}
else
{
if (ERR(status = sys$wait(outrab)))
{
vms_msg(__G__ "[ WriteRecord: sys$wait failed ]\n", status);
if (outrab->rab$l_stv != 0)
{
vms_msg(__G__ "", outrab->rab$l_stv);
}
}
outrab->rab$w_rsz = len;
outrab->rab$l_rbf = (char *) rec;
 
if (ERR(status = sys$put(outrab)))
{
vms_msg(__G__ "[ WriteRecord: sys$put failed ]\n", status);
if (outrab->rab$l_stv != 0)
{
vms_msg(__G__ "", outrab->rab$l_stv);
}
return PK_DISK;
}
}
return PK_COOL;
}
 
 
 
#ifdef SYMLINKS
/* Read symlink text from a still-open rms file. */
 
static int _read_link_rms(int byte_count, char *link_text_buf)
{
/* Use RMS to read the link text into the user's buffer.
* Rewind, then read byte count = byte_count.
* NUL-terminate the link text.
*
* $WAIT may be pointless if not async, but $WAIT elsewhere seems
* to be used unconditionally, so what do I know?
*/
int sts;
int bytes_read;
 
/* Clear the bytes-read count. */
bytes_read = 0;
 
/* Wait for anything pending. */
sts = sys$wait(outrab);
{
/* Rewind. */
sts = sys$rewind(outrab);
if (!ERR(sts))
{
/* Wait for $REWIND. */
sts = sys$wait(outrab);
if (!ERR(sts))
{
/* Read the link text. */
outrab->rab$w_usz = byte_count;
outrab->rab$l_ubf = link_text_buf;
sts = sys$read(outrab);
if (!ERR(sts))
{
/* Wait for $READ. */
sts = sys$wait(outrab);
 
if (!ERR(sts))
/* Set the resultant byte count. */
bytes_read = outrab->rab$w_rsz;
}
}
}
}
 
/* NUL-terminate the link text. */
link_text_buf[bytes_read] = '\0';
 
return sts;
}
 
#endif /* SYMLINKS */
 
 
 
void close_outfile(__G)
__GDEF
{
int status;
 
status = (*_flush_routine)(__G__ NULL, 0, 1);
if (status)
return /* PK_DISK */;
if (uO.cflag)
return /* PK_COOL */; /* Don't close stdout */
/* return */ (*_close_routine)(__G);
}
 
 
 
static int _close_rms(__GPRO)
{
int status;
struct XABPRO pro;
int retcode = PK_OK;
 
#ifdef SYMLINKS
 
/*----------------------------------------------------------------------
UNIX description:
If symbolic links are supported, allocate storage for a symlink
control structure, put the uncompressed "data" and other required
info in it, and add the structure to the "deferred symlinks" chain.
Since we know it's a symbolic link to start with, we shouldn't have
to worry about overflowing unsigned ints with unsigned longs.
----------------------------------------------------------------------*/
 
if (G.symlnk) {
extent ucsize = (extent)G.lrec.ucsize;
 
/* 2007-03-03 SMS.
* If the symlink is already a symlink (restored with VMS/RMS
* symlink attributes), then read the link text from the file,
* and close the file (using the appropriate methods), and then
* return.
*/
if (G.pInfo->symlink == 0)
{
if (QCOND2)
{
/* Link text storage. */
char* link_target = malloc(ucsize + 1);
 
if (link_target == NULL)
{
Info(slide, 0x201, ((char *)slide,
"warning: cannot show symlink (%s) target, no mem\n",
FnFilter1(G.filename)));
retcode = PK_MEM;
}
else
{
/* Read the link text. */
status = _read_link_rms(ucsize, link_target);
 
if (ERR(status))
{
Info(slide, 0x201, ((char *)slide,
"warning: error reading symlink text: %s\n",
strerror(EVMSERR, status)));
retcode = PK_DISK;
}
else
{
Info(slide, 0, ((char *)slide, "-> %s ",
FnFilter1(link_target)));
}
 
free(link_target);
}
}
}
else
{
extent slnk_entrysize;
slinkentry *slnk_entry;
 
/* It's a symlink in need of post-processing. */
/* Size of the symlink entry is the sum of
* (struct size (includes 1st '\0') + 1 additional trailing '\0'),
* system specific attribute data size (might be 0),
* and the lengths of name and link target.
*/
slnk_entrysize = (sizeof(slinkentry) + 1) +
ucsize + strlen(G.filename);
 
if (slnk_entrysize < ucsize) {
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed: mem alloc overflow\n",
FnFilter1(G.filename)));
retcode = PK_ERR;
}
else
{
if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize))
== NULL) {
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed, no mem\n",
FnFilter1(G.filename)));
retcode = PK_MEM;
}
else
{
slnk_entry->next = NULL;
slnk_entry->targetlen = ucsize;
/* don't set attributes for symlinks */
slnk_entry->attriblen = 0;
slnk_entry->target = slnk_entry->buf;
slnk_entry->fname = slnk_entry->target + ucsize + 1;
strcpy(slnk_entry->fname, G.filename);
 
/* Read the link text using the appropriate method. */
status = _read_link_rms(ucsize, slnk_entry->target);
 
if (ERR(status))
{
Info(slide, 0x201, ((char *)slide,
"warning: error reading symlink text (rms): %s\n",
strerror(EVMSERR, status)));
free(slnk_entry);
retcode = PK_DISK;
}
else
{
if (QCOND2)
Info(slide, 0, ((char *)slide, "-> %s ",
FnFilter1(slnk_entry->target)));
 
/* Add this symlink record to the list of
deferred symlinks. */
if (G.slink_last != NULL)
G.slink_last->next = slnk_entry;
else
G.slink_head = slnk_entry;
G.slink_last = slnk_entry;
}
}
}
}
}
#endif /* SYMLINKS */
 
/* Link XABRDT, XABDAT, and (optionally) XABPRO. */
if (xabrdt != NULL)
{
xabrdt->xab$l_nxt = NULL;
outfab->fab$l_xab = (void *) xabrdt;
}
else
{
rdt.xab$l_nxt = NULL;
outfab->fab$l_xab = (void *) &rdt;
}
if (xabdat != NULL)
{
xabdat->xab$l_nxt = outfab->fab$l_xab;
outfab->fab$l_xab = (void *)xabdat;
}
 
if (xabpro != NULL)
{
if ( !uO.X_flag )
xabpro->xab$l_uic = 0; /* Use default (user's) uic */
xabpro->xab$l_nxt = outfab->fab$l_xab;
outfab->fab$l_xab = (void *) xabpro;
}
else
{
pro = cc$rms_xabpro;
pro.xab$w_pro = G.pInfo->file_attr;
pro.xab$l_nxt = outfab->fab$l_xab;
outfab->fab$l_xab = (void *) &pro;
}
 
status = sys$wait(outrab);
if (ERR(status))
{
vms_msg(__G__ "[ _close_rms: sys$wait failed ]\n", status);
if (outrab->rab$l_stv != 0)
{
vms_msg(__G__ "", outrab->rab$l_stv);
}
}
 
status = sys$close(outfab);
#ifdef DEBUG
if (ERR(status))
{
vms_msg(__G__
"\r[ Warning: cannot set owner/protection/time attributes ]\n",
status);
if (outfab->fab$l_stv != 0)
{
vms_msg(__G__ "", outfab->fab$l_stv);
}
retcode = PK_WARN;
}
#endif
free_up();
return retcode;
}
 
 
 
static int _close_qio(__GPRO)
{
int status;
 
pka_fib.FIB$L_ACCTL =
FIB$M_WRITE | FIB$M_NOTRUNC ;
pka_fib.FIB$W_EXCTL = 0;
 
pka_fib.FIB$W_FID[0] =
pka_fib.FIB$W_FID[1] =
pka_fib.FIB$W_FID[2] =
pka_fib.FIB$W_DID[0] =
pka_fib.FIB$W_DID[1] =
pka_fib.FIB$W_DID[2] = 0;
 
#ifdef ASYNCH_QIO
if (pka_io_pending) {
status = sys$synch(0, &pka_io_iosb);
if (!ERR(status))
status = pka_io_iosb.status;
if (ERR(status))
{
vms_msg(__G__ "[ _close_qio: sys$synch found I/O failure ]\n",
status);
}
pka_io_pending = FALSE;
}
#endif /* ASYNCH_QIO */
 
#ifdef SYMLINKS
if (G.symlnk && QCOND2)
{
/* Read back the symlink target specification for display purpose. */
extent ucsize = (extent)G.lrec.ucsize;
char *link_target; /* Link text storage. */
 
if ((link_target = malloc(ucsize + 1)) == NULL)
{
Info(slide, 0x201, ((char *)slide,
"warning: cannot show symlink (%s) target, no mem\n",
FnFilter1(G.filename)));
}
else
{
unsigned bytes_read = 0;
 
status = sys$qiow(0, /* event flag */
pka_devchn, /* channel */
IO$_READVBLK, /* function */
&pka_io_iosb, /* IOSB */
0, /* AST address */
0, /* AST parameter */
link_target, /* P1 = buffer address */
ucsize, /* P2 = requested byte count */
1, /* P3 = VBN (1 = first) */
0, /* P4 (not used) */
0, /* P5 (not used) */
0); /* P6 (not used) */
 
if (!ERR(status))
/* Final status. */
status = pka_io_iosb.status;
 
/* Set the resultant byte count. */
if (!ERR(status))
bytes_read = pka_io_iosb.count;
 
/* NUL-terminate the link text. */
link_target[bytes_read] = '\0';
 
if (ERR(status))
{
Info(slide, 0x201, ((char *)slide,
"warning: error reading symlink text (qio): %s\n",
strerror(EVMSERR, status)));
}
else
{
Info(slide, 0, ((char *)slide, "-> %s ",
FnFilter1(link_target)));
}
 
free(link_target);
 
}
}
#endif /* SYMLINKS */
 
status = sys$qiow(0, pka_devchn, IO$_DEACCESS, &pka_acp_iosb,
0, 0,
&pka_fibdsc, 0, 0, 0,
pka_atr, 0);
 
sys$dassgn(pka_devchn);
if ( !ERR(status) )
status = pka_acp_iosb.status;
if ( ERR(status) )
{
vms_msg(__G__ "[ Deaccess QIO failed ]\n", status);
return PK_DISK;
}
return PK_COOL;
}
 
 
 
#ifdef SET_DIR_ATTRIB
 
/*
* 2006-10-04 SMS.
* vms_path_fixdown().
*
* Convert VMS directory spec to VMS directory file name. That is,
* change "dev:[a.b.c.e]" to "dev:[a.b.c]e.DIR;1". The result (always
* larger than the source) is returned in the user's buffer.
*/
 
#define DIR_TYPE_VER ".DIR;1"
 
static char *vms_path_fixdown(ZCONST char *dir_spec, char *dir_file)
{
char dir_close;
char dir_open;
unsigned i;
unsigned dir_spec_len;
 
dir_spec_len = strlen(dir_spec);
if (dir_spec_len == 0) return NULL;
i = dir_spec_len - 1;
dir_close = dir_spec[i];
 
/* Identify the directory delimiters (which must exist). */
if (dir_close == ']')
{
dir_open = '[';
}
else if (dir_close == '>')
{
dir_open = '<';
}
else
{
return NULL;
}
 
/* Find the beginning of the last directory name segment. */
while ((i > 0) && ((dir_spec[i - 1] == '^') ||
((dir_spec[i] != '.') && (dir_spec[i] != dir_open))))
{
i--;
}
 
/* Form the directory file name from the pieces. */
if (dir_spec[i] == dir_open)
{
/* Top-level directory. */
sprintf(dir_file, "%.*s000000%c%.*s%s",
/* "dev:[" "000000" "]" */
(i + 1), dir_spec, dir_close,
/* "a" ".DIR;1" */
(dir_spec_len - i - 2), (dir_spec + i + 1), DIR_TYPE_VER);
}
else
{
/* Non-top-level directory. */
sprintf(dir_file, "%.*s%c%.*s%s",
/* "dev:[a.b.c" "]" */
i, dir_spec, dir_close,
/* "e" ".DIR;1" */
(dir_spec_len - i - 2), (dir_spec + i + 1), DIR_TYPE_VER);
}
return dir_file;
} /* end function vms_path_fixdown(). */
 
 
 
/* Save directory attributes (as the archive's extra field). */
 
/* 2006-12-13 SMS.
* This could probably be made more efficient by analyzing the data
* here, extracting the important data, and saving only what's needed.
* Given the existing code, it seemed simpler to save them all here, and
* deal with what's important in set_direc_attribs().
*/
 
int defer_dir_attribs(__G__ pd)
__GDEF
direntry **pd;
{
vmsdirattr *d_entry;
unsigned fnlen;
unsigned xlen;
 
/* Allocate space to save the file (directory) name, the extra
* block, and all the other data needed by the extra-block data
* scanner functions. If that works, save the data.
*/
fnlen = strlen(G.filename);
xlen = G.lrec.extra_field_length;
d_entry = (vmsdirattr *) malloc(sizeof(vmsdirattr) + fnlen + xlen);
*pd = (direntry *) d_entry;
if (d_entry == (vmsdirattr *) NULL)
{
return PK_MEM;
}
 
/* Save extra block length and data. */
d_entry->xlen = xlen;
memcpy(d_entry->buf, G.extra_field, xlen);
 
/* Set pointer to file (directory) name. */
d_entry->fn = d_entry->buf + xlen;
 
/* Save file (directory) name. */
strcpy(d_entry->fn, G.filename);
/* Strip the closing ']' char, to allow proper sorting. */
d_entry->fn[fnlen - 1] = '\0';
 
/* Save generic permission data from mapattr(). */
d_entry->perms = G.pInfo->file_attr;
 
/* Save G.lrec.last_mod_dos_datetime. */
d_entry->mod_dos_datetime = G.lrec.last_mod_dos_datetime;
 
return PK_OK;
} /* end function defer_dir_attribs() */
 
 
 
int set_direc_attribs(__G__ d)
__GDEF
direntry *d;
{
uch *sav_ef_ptr;
int i;
int status;
int type;
ush attr;
struct XABPRO pro;
char dir_name[NAM_MAXRSS + 1];
char warnmsg[NAM_MAXRSS + 128]; /* Name length + message length. */
int retcode = PK_OK;
 
/* Re-append the closing ']' character which has been stripped in
* defer_dir_attribs() for compatibility with generic sorting code.
*/
strcat(VmsAtt(d)->fn, "]");
 
/* Convert "[a.b.c]" form into "[a.b]c.DIR;1" */
vms_path_fixdown(VmsAtt(d)->fn, dir_name);
 
/* Dummy up critical global (G) data from the preserved directory
* attribute data.
*/
sav_ef_ptr = G.extra_field;
G.extra_field = (uch *)((VmsAtt(d)->xlen > 0) ? VmsAtt(d)->buf : NULL);
G.lrec.extra_field_length = VmsAtt(d)->xlen;
 
/* Extract the VMS file attributes from the preserved attribute
* data, if they exist, and restore the date-time stamps.
*/
type = find_vms_attrs(__G__ (uO.D_flag <= 0));
 
if (outfab == NULL)
{
/* Default and PK schemes need a FAB. (IZ supplies one.)
* In a degenerate case, this could be the first use of fileblk,
* so we assume that we need to initialize it.
*/
fileblk = cc$rms_fab; /* Initialize FAB. */
outfab = &fileblk; /* Set pointer used elsewhere. */
}
 
/* Arrange FAB-NAM[L] for file (directory) access. */
if (type != VAT_NONE)
{
if (type == VAT_IZ)
{
/* Make an attribute descriptor list for the VMS creation and
* revision dates (which were stored in the IZ XABs by
* find_vms_attrs()).
*/
pka_idx = 0;
 
if (xabrdt != NULL)
{
/* Revision date-time from XABRDT. */
pka_atr[pka_idx].atr$w_size = 8;
pka_atr[pka_idx].atr$w_type = ATR$C_REVDATE;
pka_atr[pka_idx].atr$l_addr = GVTC &xabrdt->xab$q_rdt;
++pka_idx;
}
if (xabdat != NULL)
{
/* Trust the XABRDT value for revision date. */
if (xabrdt == NULL)
{
/* Revision date-time from XABDAT. */
pka_atr[pka_idx].atr$w_size = 8;
pka_atr[pka_idx].atr$w_type = ATR$C_REVDATE;
pka_atr[pka_idx].atr$l_addr = GVTC &xabdat->xab$q_rdt;
++pka_idx;
}
/* Creation date-time from XABDAT. */
pka_atr[pka_idx].atr$w_size = 8;
pka_atr[pka_idx].atr$w_type = ATR$C_CREDATE;
pka_atr[pka_idx].atr$l_addr = GVTC &xabdat->xab$q_cdt;
++pka_idx;
}
if (xabpro != NULL)
{
if ( uO.X_flag ) {
pka_atr[pka_idx].atr$w_size = 4;
pka_atr[pka_idx].atr$w_type = ATR$C_UIC;
pka_atr[pka_idx].atr$l_addr = GVTC &xabpro->xab$l_uic;
++pka_idx;
}
attr = xabpro->xab$w_pro;
}
else
{
/* Revoke directory Delete permission for all. */
attr = VmsAtt(d)->perms
| (((1<< XAB$V_NODEL)<< XAB$V_SYS)|
((1<< XAB$V_NODEL)<< XAB$V_OWN)|
((1<< XAB$V_NODEL)<< XAB$V_GRP)|
((1<< XAB$V_NODEL)<< XAB$V_WLD));
}
pka_atr[pka_idx].atr$w_size = 2;
pka_atr[pka_idx].atr$w_type = ATR$C_FPRO;
pka_atr[pka_idx].atr$l_addr = GVTC &attr;
++pka_idx;
}
}
else
{
/* No VMS attribute data were found. Prepare to assemble
* non-VMS attribute data.
*/
pka_idx = 0;
 
/* Get the (already converted) non-VMS permissions. */
attr = VmsAtt(d)->perms; /* Use right-sized prot storage. */
 
/* Revoke directory Delete permission for all. */
attr |= (((1<< XAB$V_NODEL)<< XAB$V_SYS)|
((1<< XAB$V_NODEL)<< XAB$V_OWN)|
((1<< XAB$V_NODEL)<< XAB$V_GRP)|
((1<< XAB$V_NODEL)<< XAB$V_WLD));
 
pka_atr[pka_idx].atr$w_size = 2;
pka_atr[pka_idx].atr$w_type = ATR$C_FPRO;
pka_atr[pka_idx].atr$l_addr = GVTC &attr;
++pka_idx;
 
/* Restore directory date-time if user requests it (-D). */
if (uO.D_flag <= 0)
{
/* Set the directory date-time from the non-VMS data.
* Dummy up the DOS-style modification date into global (G)
* data from the preserved directory attribute data.
*/
G.lrec.last_mod_dos_datetime = VmsAtt(d)->mod_dos_datetime;
 
/* Extract date-time data from the normal attribute data. */
set_default_datetime_XABs(__G);
 
/* Make an attribute descriptor list for the VMS creation
* and revision dates (which were stored in the XABs by
* set_default_datetime_XABs()).
*/
pka_atr[pka_idx].atr$w_size = 8;
pka_atr[pka_idx].atr$w_type = ATR$C_CREDATE;
pka_atr[pka_idx].atr$l_addr = GVTC &dattim.xab$q_cdt;
++pka_idx;
pka_atr[pka_idx].atr$w_size = 8;
pka_atr[pka_idx].atr$w_type = ATR$C_REVDATE;
pka_atr[pka_idx].atr$l_addr = GVTC &rdt.xab$q_rdt;
++pka_idx;
}
 
/* Set the directory protection from the non-VMS data. */
 
/* Terminate the attribute descriptor list. */
pka_atr[pka_idx].atr$w_size = 0; /* End of list */
pka_atr[pka_idx].atr$w_type = 0;
pka_atr[pka_idx].atr$l_addr = 0; /* NULL when DECC VAX gets fixed. */
}
 
nam = CC_RMS_NAM; /* Initialize NAM[L]. */
outfab->FAB_NAM = &nam; /* Point FAB to NAM[L]. */
 
/* Point the FAB-NAM[L] to the VMS-format directory file name. */
 
#ifdef NAML$C_MAXRSS
 
outfab->fab$l_dna = (char *) -1; /* Using NAML for default name. */
outfab->fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
/* Special ODS5-QIO-compatible name storage. */
nam.naml$l_filesys_name = sys_nam;
nam.naml$l_filesys_name_alloc = sizeof(sys_nam);
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNA = dir_name;
FAB_OR_NAML(*outfab, nam).FAB_OR_NAML_FNS = strlen(dir_name);
 
/* Expanded and resultant name storage. */
nam.NAM_ESA = exp_nam;
nam.NAM_ESS = sizeof(exp_nam);
nam.NAM_RSA = res_nam;
nam.NAM_RSS = sizeof(res_nam);
 
status = sys$parse(outfab);
if ( ERR(status) )
{
sprintf(warnmsg,
"warning: set-dir-attributes failed ($parse) for %s.\n",
dir_name);
vms_msg(__G__ warnmsg, status);
retcode = PK_WARN;
goto cleanup_exit;
}
 
/* Set the length in the device name descriptor. */
pka_devdsc.dsc$w_length = (unsigned short) nam.NAM_DVI[0];
 
/* Open a channel to the disk device. */
status = sys$assign(&pka_devdsc, &pka_devchn, 0, 0);
if ( ERR(status) )
{
sprintf(warnmsg,
"warning: set-dir-attributes failed ($assign) for %s.\n",
dir_name);
vms_msg(__G__ warnmsg, status);
retcode = PK_WARN;
goto cleanup_exit;
}
 
/* Move the directory ID from the NAM[L] to the FIB.
Clear the FID in the FIB, as we're using the name.
*/
for (i = 0; i < 3; i++)
{
pka_fib.FIB$W_DID[i] = nam.NAM_DID[i];
pka_fib.FIB$W_FID[i] = 0;
}
 
#ifdef NAML$C_MAXRSS
 
/* Enable fancy name characters. Note that "fancy" here does
not include Unicode, for which there's no support elsewhere.
*/
pka_fib.fib$v_names_8bit = 1;
pka_fib.fib$b_name_format_in = FIB$C_ISL1;
 
/* ODS5 Extended names used as input to QIO have peculiar
encoding (perhaps to minimize storage?), so the special
filesys_name result (typically containing fewer carets) must
be used here.
*/
pka_fnam.dsc$a_pointer = nam.naml$l_filesys_name;
pka_fnam.dsc$w_length = nam.naml$l_filesys_name_size;
 
#else /* !NAML$C_MAXRSS */
 
/* ODS2-only: Use the whole name. */
pka_fnam.dsc$a_pointer = nam.NAM_L_NAME;
pka_fnam.dsc$w_length = nam.NAM_B_NAME + nam.NAM_B_TYPE + nam.NAM_B_VER;
 
#endif /* ?NAML$C_MAXRSS */
 
/* 2007-07-13 SMS.
* Our freshly created directory can easily contain fewer files than
* the original archived directory (for example, if not all the
* files in the original directory were included in the archive), so
* its size may differ from that of the archived directory. Thus,
* simply restoring the original RECATTR attributes structure, which
* includes EFBLK (and so on) can cause "SYSTEM-W-BADIRECTORY, bad
* directory file format" complaints. Instead, we overwrite
* selected archived attributes with current attributes, to avoid
* setting obsolete/inappropriate attributes on the newly created
* directory file.
*
* First, see if there is a RECATTR structure about which we need to
* worry.
*/
for (i = 0; pka_atr[i].atr$w_type != 0; i++)
{
if (pka_atr[i].atr$w_type == ATR$C_RECATTR)
{
/* We found a RECATTR structure which (we must assume) needs
* adjustment. Retrieve the RECATTR data for the existing
* (newly created) directory file.
*/
status = sys$qiow(0, /* event flag */
pka_devchn, /* channel */
IO$_ACCESS, /* function code */
&pka_acp_iosb, /* IOSB */
0, /* AST address */
0, /* AST parameter */
&pka_fibdsc, /* P1 = File Info Block */
&pka_fnam, /* P2 = File name */
0, /* P3 = Rslt nm len */
0, /* P4 = Rslt nm str */
pka_recattr, /* P5 = Attributes */
0); /* P6 (not used) */
 
/* If initial success, then get the final status from the IOSB. */
if ( !ERR(status) )
status = pka_acp_iosb.status;
 
if ( ERR(status) )
{
sprintf(warnmsg,
"warning: set-dir-attributes failed ($qiow acc) for %s.\n",
dir_name);
vms_msg(__G__ warnmsg, status);
retcode = PK_WARN;
}
else
{
/* We should have valid RECATTR data. Overwrite the
* critical bits of the archive RECATTR structure with
* the current bits. The book says that an attempt to
* modify HIBLK will be ignored, and FFBYTE should
* always be zero, but safety is cheap.
*/
struct fatdef *ptr_recattr;
 
ptr_recattr = (struct fatdef *) pka_atr[i].atr$l_addr;
ptr_recattr->fat$l_hiblk = pka_rattr.fat$l_hiblk;
ptr_recattr->fat$l_efblk = pka_rattr.fat$l_efblk;
ptr_recattr->fat$w_ffbyte = pka_rattr.fat$w_ffbyte;
}
/* There should be only one RECATTR structure in the list, so
* escape from the loop after the first/only one has been
* processed.
*/
break;
}
}
 
/* Modify the file (directory) attributes. */
status = sys$qiow(0, /* event flag */
pka_devchn, /* channel */
IO$_MODIFY, /* function code */
&pka_acp_iosb, /* IOSB */
0, /* AST address */
0, /* AST parameter */
&pka_fibdsc, /* P1 = File Info Block */
&pka_fnam, /* P2 = File name */
0, /* P3 = Rslt nm len */
0, /* P4 = Rslt nm str */
pka_atr, /* P5 = Attributes */
0); /* P6 (not used) */
 
/* If initial success, then get the final status from the IOSB. */
if ( !ERR(status) )
status = pka_acp_iosb.status;
 
if ( ERR(status) )
{
sprintf(warnmsg,
"warning: set-dir-attributes failed ($qiow mod) for %s.\n",
dir_name);
vms_msg(__G__ warnmsg, status);
retcode = PK_WARN;
}
sys$dassgn(pka_devchn);
cleanup_exit:
free_up(); /* Free FAB, XAB storage. */
free(d); /* Free directory attribute storage. */
G.extra_field = sav_ef_ptr; /* Restore original pointer. */
return retcode;
} /* end function set_direc_attribs() */
 
#endif /* SET_DIR_ATTRIB */
 
 
 
#ifdef TIMESTAMP
 
/* Nonzero if `y' is a leap year, else zero. */
#define leap(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0)
 
/* Number of leap years from 1970 to `y' (not including `y' itself). */
#define nleap(y) (((y) - 1969) / 4 - ((y) - 1901) / 100 + ((y) - 1601) / 400)
 
/* Accumulated number of days from 01-Jan up to start of current month. */
static ZCONST short ydays[] = {
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
};
 
/***********************/
/* Function mkgmtime() */
/***********************/
 
static time_t mkgmtime(tm)
struct tm *tm;
{
time_t m_time;
int yr, mo, dy, hh, mm, ss;
unsigned days;
 
yr = tm->tm_year - 70;
mo = tm->tm_mon;
dy = tm->tm_mday - 1;
hh = tm->tm_hour;
mm = tm->tm_min;
ss = tm->tm_sec;
 
/* calculate days from BASE to this year and add expired days this year */
dy = (unsigned)dy + ((unsigned)yr * 365) + (unsigned)nleap(yr+1970) +
(unsigned)ydays[mo] + ((mo > 1) && leap(yr+1970));
 
/* convert date & time to seconds relative to 00:00:00, 01/01/1970 */
return (time_t)((unsigned long)(unsigned)dy * 86400L +
(unsigned long)hh * 3600L +
(unsigned long)(mm * 60 + ss));
 
} /* end function mkgmtime() */
 
 
 
/*******************************/
/* Function dos_to_unix_time() */ /* only used for timestamping of archives */
/*******************************/
 
time_t dos_to_unix_time(dosdatetime)
ulg dosdatetime;
{
struct tm *ltm; /* Local time. */
time_t loctime; /* The time_t value of local time. */
time_t then; /* The time to return. */
long tzoffset_adj; /* timezone-adjustment `remainder' */
int bailout_cnt; /* counter of tries for tz correction */
 
then = time(NULL);
ltm = localtime(&then);
 
/* dissect date */
ltm->tm_year = ((int)(dosdatetime >> 25) & 0x7f) + 80;
ltm->tm_mon = ((int)(dosdatetime >> 21) & 0x0f) - 1;
ltm->tm_mday = ((int)(dosdatetime >> 16) & 0x1f);
 
/* dissect time */
ltm->tm_hour = (int)(dosdatetime >> 11) & 0x1f;
ltm->tm_min = (int)(dosdatetime >> 5) & 0x3f;
ltm->tm_sec = (int)(dosdatetime << 1) & 0x3e;
 
loctime = mkgmtime(ltm);
 
/* Correct for the timezone and any daylight savings time.
The correction is verified and repeated when not correct, to
take into account the rare case that a change to or from daylight
savings time occurs between when it is the time in `tm' locally
and when it is that time in Greenwich. After the second correction,
the "timezone & daylight" offset should be correct in all cases. To
be sure, we allow a third try, but then the loop is stopped. */
bailout_cnt = 3;
then = loctime;
do {
ltm = localtime(&then);
tzoffset_adj = (ltm != NULL) ? (loctime - mkgmtime(ltm)) : 0L;
if (tzoffset_adj == 0L)
break;
then += tzoffset_adj;
} while (--bailout_cnt > 0);
 
if ( (dosdatetime >= DOSTIME_2038_01_18) &&
(then < (time_t)0x70000000L) )
then = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */
if (then < (time_t)0L) /* a converted DOS time cannot be negative */
then = S_TIME_T_MAX; /* -> saturate at max signed time_t value */
return then;
 
} /* end function dos_to_unix_time() */
 
 
 
/*******************************/
/* Function uxtime2vmstime() */
/*******************************/
 
static void uxtime2vmstime( /* convert time_t value into 64 bit VMS bintime */
time_t utimeval,
long int binval[2] )
{
time_t m_time = utimeval;
struct tm *t = localtime(&m_time);
 
if (t == (struct tm *)NULL) {
/* time conversion error; use current time instead, hoping
that localtime() does not reject it as well! */
m_time = time(NULL);
t = localtime(&m_time);
}
sprintf(timbuf, "%02d-%3s-%04d %02d:%02d:%02d.00",
t->tm_mday, month[t->tm_mon], t->tm_year + 1900,
t->tm_hour, t->tm_min, t->tm_sec);
sys$bintim(&date_str, binval);
} /* end function uxtime2vmstime() */
 
 
 
/***************************/
/* Function stamp_file() */ /* adapted from VMSmunch...it just won't die! */
/***************************/
 
int stamp_file(fname, modtime)
ZCONST char *fname;
time_t modtime;
{
int status;
int i;
static long int Cdate[2], Rdate[2], Edate[2], Bdate[2];
static short int revisions;
#if defined(__DECC) || defined(__DECCXX)
#pragma __member_alignment __save
#pragma __nomember_alignment
#endif /* __DECC || __DECCXX */
static union {
unsigned short int value;
struct {
unsigned system : 4;
unsigned owner : 4;
unsigned group : 4;
unsigned world : 4;
} bits;
} prot;
#if defined(__DECC) || defined(__DECCXX)
#pragma __member_alignment __restore
#endif /* __DECC || __DECCXX */
static unsigned long uic;
static struct fjndef jnl;
 
static struct atrdef Atr[] = {
{sizeof(pka_rattr), ATR$C_RECATTR, GVTC &pka_rattr},
{sizeof(pka_uchar), ATR$C_UCHAR, GVTC &pka_uchar},
{sizeof(Cdate), ATR$C_CREDATE, GVTC &Cdate[0]},
{sizeof(Rdate), ATR$C_REVDATE, GVTC &Rdate[0]},
{sizeof(Edate), ATR$C_EXPDATE, GVTC &Edate[0]},
{sizeof(Bdate), ATR$C_BAKDATE, GVTC &Bdate[0]},
{sizeof(revisions), ATR$C_ASCDATES, GVTC &revisions},
{sizeof(prot), ATR$C_FPRO, GVTC &prot},
{sizeof(uic), ATR$C_UIC, GVTC &uic},
{sizeof(jnl), ATR$C_JOURNAL, GVTC &jnl},
{0, 0, 0}
};
 
fileblk = cc$rms_fab; /* Initialize FAB. */
nam = CC_RMS_NAM; /* Initialize NAM[L]. */
fileblk.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
 
#ifdef NAML$C_MAXRSS
 
fileblk.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fileblk.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
/* Special ODS5-QIO-compatible name storage. */
nam.naml$l_filesys_name = sys_nam;
nam.naml$l_filesys_name_alloc = sizeof(sys_nam);
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNA = (char *)fname;
FAB_OR_NAML(fileblk, nam).FAB_OR_NAML_FNS = strlen(fname);
 
nam.NAM_ESA = exp_nam;
nam.NAM_ESS = sizeof(exp_nam);
nam.NAM_RSA = res_nam;
nam.NAM_RSS = sizeof(res_nam);
 
if ( ERR(status = sys$parse(&fileblk)) )
{
vms_msg(__G__ "stamp_file: sys$parse failed.\n", status);
return -1;
}
 
pka_devdsc.dsc$w_length = (unsigned short)nam.NAM_DVI[0];
 
if ( ERR(status = sys$assign(&pka_devdsc, &pka_devchn, 0, 0)) )
{
vms_msg(__G__ "stamp_file: sys$assign failed.\n", status);
return -1;
}
 
/* Load the descriptor with the appropriate name data: */
#ifdef NAML$C_MAXRSS
 
/* Enable fancy name characters. Note that "fancy" here does
not include Unicode, for which there's no support elsewhere.
*/
pka_fib.fib$v_names_8bit = 1;
pka_fib.fib$b_name_format_in = FIB$C_ISL1;
 
/* ODS5 Extended names used as input to QIO have peculiar
encoding (perhaps to minimize storage?), so the special
filesys_name result (typically containing fewer carets) must
be used here.
*/
pka_fnam.dsc$a_pointer = nam.naml$l_filesys_name;
pka_fnam.dsc$w_length = nam.naml$l_filesys_name_size;
 
#else /* !NAML$C_MAXRSS */
 
/* Extract only the name.type;version. */
pka_fnam.dsc$a_pointer = nam.NAM_L_NAME;
pka_fnam.dsc$w_length = nam.NAM_B_NAME + nam.NAM_B_TYPE + nam.NAM_B_VER;
 
#endif /* ?NAML$C_MAXRSS */
 
/* Move the directory ID from the NAM[L] to the FIB.
Clear the FID in the FIB, as we're using the name.
*/
for (i = 0; i < 3; i++)
{
pka_fib.FIB$W_DID[i] = nam.NAM_DID[i];
pka_fib.FIB$W_FID[i] = 0;
}
 
/* Use the IO$_ACCESS function to return info about the file.
This way, the file is not opened, and the expiration and
revision dates are not modified.
*/
status = sys$qiow(0, pka_devchn, IO$_ACCESS,
&pka_acp_iosb, 0, 0,
&pka_fibdsc, &pka_fnam, 0, 0, Atr, 0);
 
if ( !ERR(status) )
status = pka_acp_iosb.status;
 
if ( ERR(status) )
{
vms_msg(__G__ "[ Access file QIO failed. ]\n", status);
sys$dassgn(pka_devchn);
return -1;
}
 
uxtime2vmstime(modtime, Cdate);
memcpy(Rdate, Cdate, sizeof(Cdate));
 
/* Note: Part of the FIB was cleared by earlier QIOW, so reset it. */
pka_fib.FIB$L_ACCTL = FIB$M_NORECORD;
 
/* Move the directory ID from the NAM[L] to the FIB.
Clear the FID in the FIB, as we're using the name.
*/
for (i = 0; i < 3; i++)
{
pka_fib.FIB$W_DID[i] = nam.NAM_DID[i];
pka_fib.FIB$W_FID[i] = 0;
}
 
/* Use the IO$_MODIFY function to change info about the file */
/* Note, used this way, the file is not opened, however this would */
/* normally cause the expiration and revision dates to be modified. */
/* Using FIB$M_NORECORD prohibits this from happening. */
status = sys$qiow(0, pka_devchn, IO$_MODIFY,
&pka_acp_iosb, 0, 0,
&pka_fibdsc, &pka_fnam, 0, 0, Atr, 0);
 
if ( !ERR(status) )
status = pka_acp_iosb.status;
 
if ( ERR(status) )
{
vms_msg(__G__ "[ Modify file QIO failed. ]\n", status);
sys$dassgn(pka_devchn);
return -1;
}
 
if ( ERR(status = sys$dassgn(pka_devchn)) )
{
vms_msg(__G__ "stamp_file: sys$dassgn failed.\n", status);
return -1;
}
 
return 0;
 
} /* end function stamp_file() */
 
#endif /* TIMESTAMP */
 
 
 
#ifdef DEBUG
#if 0 /* currently not used anywhere ! */
void dump_rms_block(p)
unsigned char *p;
{
unsigned char bid, len;
int err;
char *type;
char buf[132];
int i;
 
err = 0;
bid = p[0];
len = p[1];
switch (bid)
{
case FAB$C_BID:
type = "FAB";
break;
case XAB$C_ALL:
type = "xabALL";
break;
case XAB$C_KEY:
type = "xabKEY";
break;
case XAB$C_DAT:
type = "xabDAT";
break;
case XAB$C_RDT:
type = "xabRDT";
break;
case XAB$C_FHC:
type = "xabFHC";
break;
case XAB$C_PRO:
type = "xabPRO";
break;
default:
type = "Unknown";
err = 1;
break;
}
printf("Block @%08X of type %s (%d).", p, type, bid);
if (err)
{
printf("\n");
return;
}
printf(" Size = %d\n", len);
printf(" Offset - Hex - Dec\n");
for (i = 0; i < len; i += 8)
{
int j;
 
printf("%3d - ", i);
for (j = 0; j < 8; j++)
if (i + j < len)
printf("%02X ", p[i + j]);
else
printf(" ");
printf(" - ");
for (j = 0; j < 8; j++)
if (i + j < len)
printf("%03d ", p[i + j]);
else
printf(" ");
printf("\n");
}
}
 
#endif /* never */
#endif /* DEBUG */
 
 
 
static char vms_msgbuf[256]; /* VMS-specific error message. */
static $DESCRIPTOR(vms_msgbuf_dscr, vms_msgbuf);
 
 
char *vms_msg_text(void)
{
return vms_msgbuf;
}
 
 
static int vms_msg_fetch(int status)
{
int msglen = 0;
int sts;
 
sts = lib$sys_getmsg(&status, &msglen, &vms_msgbuf_dscr, 0, 0);
 
vms_msgbuf[msglen] = '\0';
return sts;
}
 
 
static void vms_msg(__GPRO__ ZCONST char *string, int status)
{
if (ERR(vms_msg_fetch(status)))
Info(slide, 1, ((char *)slide,
"%s[ VMS status = %d ]\n", string, status));
else
Info(slide, 1, ((char *)slide,
"%s[ %s ]\n", string, vms_msgbuf));
}
 
 
 
#ifndef SFX
 
/* 2004-11-23 SMS.
* Changed to return the resulting file name even when sys$search()
* fails. Before, if the user specified "fred.zip;4" and there was
* none, the error message would complain:
* cannot find either fred.zip;4 or fred.zip;4.zip.
* when it wasn't really looking for "fred.zip;4.zip".
*/
/* 2005-08-11 SPC.
* The calling interface for the VMS version of do_wild() differs from all
* other implementations in the way it returns status info.
* There are three return states:
* a) pointer to buffer with non-zero-length string
* - canonical full filespec of existing file (search succeeded).
* b) pointer to buffer with zero-length string
* - initial file search has failed, extended VMS error info is available
* through call to vms_msg_text().
* c) NULL pointer
* - repeated file search has failed, because
* i) the list of matches for the pattern has been exhausted after at
* least one successful attempt.
* ii) a second attempt for a failed initial pattern (where do_wild()
* has returned a zero-length string) was tried and failed again.
*/
char *do_wild( __G__ wld )
__GDEF
ZCONST char *wld;
{
int status;
 
static char filenam[NAM_MAXRSS + 1];
static char efn[NAM_MAXRSS];
static char last_wild[NAM_MAXRSS + 1];
static struct FAB fab;
static struct NAM_STRUCT nam;
static int first_call = 1;
static ZCONST char deflt[] = "[]*.ZIP";
 
if ( first_call || strcmp(wld, last_wild) )
{ /* (Re)Initialize everything */
 
strcpy( last_wild, wld );
 
fab = cc$rms_fab; /* Initialize FAB. */
nam = CC_RMS_NAM; /* Initialize NAM[L]. */
fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
 
#ifdef NAML$C_MAXRSS
 
fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = (char *) deflt;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = sizeof(deflt) - 1;
 
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = last_wild;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(last_wild);
 
nam.NAM_ESA = efn;
nam.NAM_ESS = sizeof(efn)-1;
nam.NAM_RSA = filenam;
nam.NAM_RSS = sizeof(filenam)-1;
 
first_call = 0;
 
/* 2005-08-08 SMS.
* Parse the file spec. If sys$parse() fails, save the VMS
* error message for later use, and return an empty string.
*/
nam.NAM_NOP = NAM_M_SYNCHK; /* Syntax-only analysis. */
if ( !OK(status = sys$parse(&fab)) )
{
vms_msg_fetch(status);
filenam[0] = '\0'; /* Initialization failed */
return filenam;
}
 
/* 2005-11-16 SMS.
* If syntax-only parse worked, re-parse normally so that
* sys$search() will work properly. Regardless of parse error,
* leave filenam[] as-was.
*/
nam.NAM_NOP = 0; /* Normal analysis. */
if ( OK(status = sys$parse(&fab)) )
{
status = sys$search(&fab);
}
 
if ( !OK(status) )
{
/* Save the VMS error message for later use. */
vms_msg_fetch(status);
}
}
else
{
if ( !OK(sys$search(&fab)) )
{
first_call = 1; /* Reinitialize next time */
return (char *)NULL;
}
}
filenam[nam.NAM_RSL] = '\0'; /* Add the NUL terminator. */
return filenam;
 
} /* end function do_wild() */
 
#endif /* !SFX */
 
 
 
static ulg unix_to_vms[8]={ /* Map from UNIX rwx to VMS rwed */
/* Note that unix w bit is mapped to VMS wd bits */
/* no access */
XAB$M_NOREAD | XAB$M_NOWRITE | XAB$M_NODEL | XAB$M_NOEXE, /* --- */
XAB$M_NOREAD | XAB$M_NOWRITE | XAB$M_NODEL, /* --x */
XAB$M_NOREAD | XAB$M_NOEXE, /* -w- */
XAB$M_NOREAD, /* -wx */
XAB$M_NOWRITE | XAB$M_NODEL | XAB$M_NOEXE, /* r-- */
XAB$M_NOWRITE | XAB$M_NODEL, /* r-x */
XAB$M_NOEXE, /* rw- */
0 /* rwx */
/* full access */
};
 
#define SETDFPROT /* We are using undocumented VMS System Service */
/* SYS$SETDFPROT here. If your version of VMS does */
/* not have that service, undef SETDFPROT. */
/* IM: Maybe it's better to put this to Makefile */
/* and DESCRIP.MMS */
#ifdef SETDFPROT
extern int sys$setdfprot();
#endif
 
int mapattr(__G)
__GDEF
{
ulg tmp = G.crec.external_file_attributes;
ulg theprot;
static ulg defprot = (ulg)-1L,
sysdef, owndef, grpdef, wlddef; /* Default protection fields */
 
/* IM: The only field of XABPRO we need to set here is */
/* file protection, so we need not to change type */
/* of G.pInfo->file_attr. WORD is quite enough. */
 
if ( defprot == (ulg)-1L )
{
/*
* First time here -- Get user default settings
*/
 
#ifdef SETDFPROT /* Undef this if linker cat't resolve SYS$SETDFPROT */
defprot = (ulg)0L;
if ( !ERR(sys$setdfprot(0, &defprot)) )
{
sysdef = defprot & ( (1L<<XAB$S_SYS)-1 ) << XAB$V_SYS;
owndef = defprot & ( (1L<<XAB$S_OWN)-1 ) << XAB$V_OWN;
grpdef = defprot & ( (1L<<XAB$S_GRP)-1 ) << XAB$V_GRP;
wlddef = defprot & ( (1L<<XAB$S_WLD)-1 ) << XAB$V_WLD;
}
else
#endif /* SETDFPROT */
{
umask(defprot = umask(0));
defprot = ~defprot;
wlddef = unix_to_vms[defprot & 07] << XAB$V_WLD;
grpdef = unix_to_vms[(defprot>>3) & 07] << XAB$V_GRP;
owndef = unix_to_vms[(defprot>>6) & 07] << XAB$V_OWN;
sysdef = owndef >> (XAB$V_OWN - XAB$V_SYS);
defprot = sysdef | owndef | grpdef | wlddef;
}
}
 
switch (G.pInfo->hostnum) {
case AMIGA_:
tmp = (unsigned)(tmp>>16 & 0x0f); /* Amiga RWED bits */
G.pInfo->file_attr = (tmp << XAB$V_OWN) |
grpdef | sysdef | wlddef;
break;
 
case THEOS_:
tmp &= 0xF1FFFFFFL;
if ((tmp & 0xF0000000L) != 0x40000000L)
tmp &= 0x01FFFFFFL; /* not a dir, mask all ftype bits */
else
tmp &= 0x41FFFFFFL; /* leave directory bit as set */
/* fall through! */
 
case UNIX_:
case VMS_: /*IM: ??? Does VMS Zip store protection in UNIX format ?*/
/* GRR: Yup. Bad decision on my part... */
case ACORN_:
case ATARI_:
case ATHEOS_:
case BEOS_:
case QDOS_:
case TANDEM_:
{
int r = FALSE;
unsigned uxattr = (unsigned)(tmp >> 16); /* drwxrwxrwx */
 
if (uxattr == 0 && G.extra_field) {
/* Some (non-Info-ZIP) implementations of Zip for Unix and
* VMS (and probably others ??) leave 0 in the upper 16-bit
* part of the external_file_attributes field. Instead, they
* store file permission attributes in some e.f. block.
* As a work-around, we search for the presence of one of
* these extra fields and fall back to the MSDOS compatible
* part of external_file_attributes if one of the known
* e.f. types has been detected.
* Later, we might implement extraction of the permission
* bits from the VMS extra field. But for now, the work-around
* should be sufficient to provide "readable" extracted files.
* (For ASI Unix e.f., an experimental remap of the e.f.
* mode value IS already provided!)
*/
ush ebID;
unsigned ebLen;
uch *ef = G.extra_field;
unsigned ef_len = G.crec.extra_field_length;
 
while (!r && ef_len >= EB_HEADSIZE) {
ebID = makeword(ef);
ebLen = (unsigned)makeword(ef+EB_LEN);
if (ebLen > (ef_len - EB_HEADSIZE))
/* discoverd some e.f. inconsistency! */
break;
switch (ebID) {
case EF_ASIUNIX:
if (ebLen >= (EB_ASI_MODE+2)) {
uxattr =
(unsigned)makeword(ef+(EB_HEADSIZE+EB_ASI_MODE));
/* force stop of loop: */
ef_len = (ebLen + EB_HEADSIZE);
break;
}
/* else: fall through! */
case EF_PKVMS:
/* "found nondecypherable e.f. with perm. attr" */
r = TRUE;
default:
break;
}
ef_len -= (ebLen + EB_HEADSIZE);
ef += (ebLen + EB_HEADSIZE);
}
}
if (!r) {
#ifdef SYMLINKS
/* Check if the file is a (POSIX-compatible) symbolic link.
* We restrict symlink support to those "made-by" hosts that
* are known to support symbolic links.
*/
G.pInfo->symlink = S_ISLNK(uxattr) &&
SYMLINK_HOST(G.pInfo->hostnum);
#endif
theprot = (unix_to_vms[uxattr & 07] << XAB$V_WLD)
| (unix_to_vms[(uxattr>>3) & 07] << XAB$V_GRP)
| (unix_to_vms[(uxattr>>6) & 07] << XAB$V_OWN);
if ( uxattr & 0x4000 )
/* Directory -- set D bits */
theprot |= (XAB$M_NODEL << XAB$V_SYS)
| (XAB$M_NODEL << XAB$V_OWN)
| (XAB$M_NODEL << XAB$V_GRP)
| (XAB$M_NODEL << XAB$V_WLD);
G.pInfo->file_attr = theprot;
break;
}
}
/* fall through! */
 
/* all remaining cases: expand MSDOS read-only bit into write perms */
case FS_FAT_:
case FS_HPFS_:
case FS_NTFS_:
case MAC_:
case TOPS20_:
default:
theprot = defprot;
if ( tmp & 1 ) /* Test read-only bit */
{ /* Bit is set -- set bits in all fields */
tmp = XAB$M_NOWRITE | XAB$M_NODEL;
theprot |= (tmp << XAB$V_SYS) | (tmp << XAB$V_OWN) |
(tmp << XAB$V_GRP) | (tmp << XAB$V_WLD);
}
G.pInfo->file_attr = theprot;
break;
} /* end switch (host-OS-created-by) */
 
return 0;
 
} /* end function mapattr() */
 
 
#define PATH_DEFAULT "SYS$DISK:[]"
 
/* dest_struct_level()
 
Returns file system structure level for argument, negative on
error.
*/
 
int dest_struct_level(char *path)
{
int acp_code;
 
#ifdef DVI$C_ACP_F11V5
 
/* Should know about ODS5 file system. Do actual check.
(This should be non-VAX with __CRTL_VER >= 70200000.)
*/
 
int sts;
 
struct FAB fab;
struct NAM_STRUCT nam;
char e_name[NAM_MAXRSS + 1];
 
struct dsc$descriptor_s dev_descr =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 };
 
fab = cc$rms_fab; /* Initialize FAB. */
nam = CC_RMS_NAM; /* Initialize NAM[L]. */
fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
 
#ifdef NAML$C_MAXRSS
 
fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = PATH_DEFAULT;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = strlen(PATH_DEFAULT);
 
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = path;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(path);
 
nam.NAM_ESA = e_name;
nam.NAM_ESS = sizeof(e_name) - 1;
 
nam.NAM_NOP = NAM_M_SYNCHK; /* Syntax-only analysis. */
sts = sys$parse(&fab);
 
if ((sts & STS$M_SUCCESS) == STS$K_SUCCESS)
{
/* Load resultant device name into device descriptor. */
dev_descr.dsc$a_pointer = nam.NAM_L_DEV;
dev_descr.dsc$w_length = nam.NAM_B_DEV;
 
/* 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 = -2;
}
}
else
{
acp_code = -1;
}
 
#else /* !DVI$C_ACP_F11V5 */
 
/* Too old for ODS5 file system. Return level 2. */
 
acp_code = DVI$C_ACP_F11V2;
 
#endif /* ?DVI$C_ACP_F11V5 */
 
return acp_code;
}
 
/* 2005-02-12 SMS.
Note that these name conversion functions do no length checking.
Buffer overflows are possible.
*/
 
static void adj_dir_name_ods2(char *dest, char *src, int src_len)
{
/* The source string (src) typically extends beyond the directory
segment of interest, hence the confining src_len argument.
*/
unsigned char uchr;
unsigned char prop;
char * src_last;
 
for (src_last = src + src_len; src < src_last; src++)
{
prop = char_prop[uchr = *src]; /* Get source char, properties. */
if ((prop & 2) != 0) /* Up-case lower case. */
{
uchr -= ('a' - 'A'); /* (Simple-fast is adequate.) */
}
else if ((prop & 1) == 0) /* Replace invalid char */
{
uchr = '_'; /* with "_". */
}
*dest++ = uchr; /* Store good char. */
}
*dest = '\0'; /* Terminate destination. */
}
 
 
static void adj_dir_name_ods5(char *dest, char *src, int src_len)
{
/* The source string (src) typically extends beyond the directory
segment of interest, hence the confining src_len argument.
*/
unsigned char uchr;
unsigned char prop;
char * src_last;
 
for (src_last = src + src_len; src < src_last; src++)
{
prop = char_prop[uchr = *src]; /* Get source char, props. */
prop = char_prop[uchr]; /* Get source char props. */
if ((prop & (32+8+4)) != 0) /* Escape 1-char, including */
{ /* SP and dot. */
*dest++ = '^'; /* Insert caret. */
if ((prop & 8) != 0) /* Replace SP with "_". */
{
uchr = '_';
}
else if (uchr == '?')
{
uchr = '/'; /* Replace "?" with "/". */
}
}
else if ((prop & 64) != 0) /* Escape hex-hex. */
{
*dest++ = '^'; /* Insert caret. */
*dest++ = hex_digit[uchr >> 4]; /* First hex digit. */
uchr = hex_digit[uchr & 15]; /* Second hex digit. */
}
else if ((prop & 16) == 0) /* Replace invalid with "_". */
{
uchr = '_';
}
*dest++ = uchr; /* Put good (or last) char. */
}
*dest = '\0'; /* Terminate destination. */
}
 
 
static void adj_file_name_ods2(char *dest, char *src)
{
unsigned char uchr;
unsigned char prop;
char *endp;
char *versionp;
char *last_dot;
 
endp = src + strlen(src); /* Pointer to the NUL-terminator of src. */
/* Starting at the end, find the last non-decimal-digit. */
versionp = endp;
while ((--versionp >= src) && isdigit(*versionp));
 
/* Left-most non-digit of a valid version is ";" (or perhaps "."). */
if ((*versionp != ';') && ((uO.Y_flag == 0) || (*versionp != '.')))
{
/* No valid version. The last dot is the last dot. */
versionp = endp;
}
else
{ /* Some kind of valid version. */
if (!uO.V_flag) /* Not -V, so cut off version. */
{
*versionp = '\0';
}
else if (*versionp == '.')
{
*versionp = ';'; /* Replace version dot with ";". */
}
}
 
/* 2008-11-04 SMS.
* Simplified the scheme here to escape all non-last dots. This
* should work when Zip works correctly (Zip 3.1).
* Note that if no last dot is found, the non-last-dot test below
* will always fail, but that's not a problem.
*/
 
/* Find the last dot (if any). */
last_dot = versionp;
while ((--last_dot >= src) && (*last_dot != '.'));
 
/* Critical features having been located, transform the name. */
while ((uchr = *src++) != '\0') /* Get source character. */
{
/* Note that "src" has been incremented, affecting "src <=". */
prop = char_prop[uchr]; /* Get source char properties. */
if ((prop & 2) != 0) /* Up-case lower case. */
{
uchr -= ('a' - 'A'); /* (Simple-fast is adequate.) */
}
else if ((prop & 4) != 0) /* Dot. */
{
if (src <= last_dot) /* Replace non-last dot */
{
uchr = '_'; /* with "_". */
}
}
else if ((prop & 1) == 0) /* Replace SP or invalid char, */
{
if (src <= versionp) /* if not in version, */
{
uchr = '_'; /* with "_". */
}
}
*dest++ = uchr; /* Store good char. */
}
*dest = '\0'; /* Terminate destination. */
}
 
 
static void adj_file_name_ods5(char *dest, char *src)
{
unsigned char uchr;
unsigned char prop;
char *endp;
char *versionp;
char *last_dot;
 
endp = src + strlen(src); /* Pointer to the NUL-terminator of src. */
/* Starting at the end, find the last non-decimal-digit. */
versionp = endp;
while ((--versionp >= src) && isdigit(*versionp));
 
/* Left-most non-digit of a valid version is ";" (or perhaps "."). */
if ((*versionp != ';') && ((uO.Y_flag == 0) || (*versionp != '.')))
{
/* No valid version. The last dot is the last dot. */
versionp = endp;
}
else
{ /* Some kind of valid version. */
if (!uO.V_flag) /* Not -V, so cut off version. */
{
*versionp = '\0';
}
else if (*versionp == '.')
{
*versionp = ';'; /* Replace version dot with ";". */
}
}
 
/* 2008-11-04 SMS.
* Simplified the scheme here to escape all non-last dots. This
* should work when Zip works correctly (Zip 3.1).
* Note that if no last dot is found, the non-last-dot test below
* will always fail, but that's not a problem.
*/
 
/* Find the last dot (if any). */
last_dot = versionp;
while ((--last_dot >= src) && (*last_dot != '.'));
 
/* Critical features having been located, transform the name. */
while ((uchr = *src++) != '\0') /* Get source character. */
{
/* Note that "src" has been incremented, affecting "src <=". */
prop = char_prop[uchr]; /* Get source char props. */
if ((prop & (32+8)) != 0) /* Escape 1-char, including */
{ /* SP (but not dot). */
if (src <= versionp) /* No escapes for version. */
{
*dest++ = '^'; /* Insert caret. */
if ((prop & 8) != 0) /* Replace SP with "_". */
{
uchr = '_';
}
else if (uchr == '?')
{
uchr = '/'; /* Replace "?" with "/". */
}
}
}
else if ((prop & 4) != 0) /* Dot. */
{
if (src <= last_dot) /* Escape non-last dot */
{
*dest++ = '^'; /* Insert caret. */
}
}
else if ((prop & 64) != 0) /* Escape hex-hex. */
{
*dest++ = '^'; /* Insert caret. */
*dest++ = hex_digit[uchr >> 4]; /* First hex digit. */
uchr = hex_digit[uchr & 15]; /* Second hex digit. */
}
else if ((prop & 16) == 0) /* Replace invalid with "_". */
{
uchr = '_';
}
*dest++ = uchr; /* Put good (or last) char. */
}
*dest = '\0'; /* Terminate destination. */
}
 
 
 
# define FN_MASK 7
# define USE_DEFAULT (FN_MASK+1)
 
/*
* Checkdir function codes:
* ROOT - set root path from unzip qq d:[dir]
* INIT - get ready for "filename"
* APPEND_DIR - append pathcomp
* APPEND_NAME - append filename
* APPEND_NAME | USE_DEFAULT - expand filename using collected path
* GETPATH - return resulting filespec
* END - free dynamically allocated space prior to program exit
*/
 
static int created_dir;
static int dest_file_sys_level;
static int ods2_names = -1;
 
int mapname(__G__ renamed)
/* returns: */
/* MPN_OK if no error, */
/* MPN_INF_TRUNC if caution (filename trunc), */
/* MPN_INF_SKIP if warning (skip file, dir doesn't exist), */
/* MPN_ERR_SKIP if error (skip file), */
/* MPN_CREATED_DIR if has created directory, */
/* MPN_VOL_LABEL if path was volume label (skip it) */
/* MPN_NOMEM if no memory (skip file) */
__GDEF
int renamed;
{
char pathcomp[FILNAMSIZ]; /* Path-component buffer. */
char *last_slash; /* Last slash in path. */
char *next_slash; /* Next slash in path. */
int dir_len; /* Length of a directory segment. */
 
char *cp = (char *)NULL; /* character pointer */
int killed_ddot = FALSE; /* Set when skipping "../" pathcomp. */
int error = MPN_OK;
 
if ( renamed )
{
if ( !(error = checkdir(__G__ pathcomp, APPEND_NAME | USE_DEFAULT)) )
strcpy(G.filename, pathcomp);
return error;
}
 
/*---------------------------------------------------------------------------
Initialize various pointers and counters and stuff.
---------------------------------------------------------------------------*/
 
if (G.pInfo->vollabel)
return MPN_VOL_LABEL; /* can't set disk volume labels on VMS */
 
/* can create path as long as not just freshening, or if user told us */
G.create_dirs = !uO.fflag;
 
created_dir = FALSE; /* not yet */
 
/* If not yet known, determine the destination file system type
(ODS2 or ODS5). (If the user specified a destination, we should
already have this, so use the default destination.)
*/
if (ods2_names < 0)
{
/* If user doesn't force ODS2, set flag according to destination. */
if (uO.ods2_flag == 0)
{
ods2_names =
(dest_struct_level(PATH_DEFAULT) <= DVI$C_ACP_F11V2);
}
else
{
ods2_names = 1; /* User demands ODS2 names. */
}
}
 
/* GRR: for VMS, convert to internal format now or later? or never? */
if (checkdir(__G__ pathcomp, INIT) == 10)
return MPN_NOMEM; /* Initialize path buffer, unless no memory. */
 
/* Locate and treat directory segments one at a time.
When pointer exceeds last_slash, then directory segments are
done, and only the name (with version?) remains.
*/
 
*pathcomp = '\0'; /* Initialize translation buffer. */
last_slash = strrchr(G.filename, '/'); /* Find last slash. */
 
if (uO.jflag) /* If junking directories, */
cp = last_slash; /* start at (will be after) the last slash. */
 
if (cp == NULL) /* If no '/', or keeping directories, */
cp = G.filename; /* start at the front of the pathname. */
else /* Else, with directories to junk, */
++cp; /* start after the last slash. */
 
/* Loop through the directory segments. */
while (cp < last_slash)
{
next_slash = strchr(cp, '/'); /* Find the next slash. */
dir_len = next_slash- cp;
 
/* Filter out unacceptable directories. */
if ((dir_len == 2) && (strncmp(cp, "..", 2) == 0))
{ /* Double dot. */
if (!uO.ddotflag) /* Not allowed. Skip it. */
{
dir_len = 0;
killed_ddot = TRUE; /* Record skipping double-dot. */
}
}
else if ((dir_len == 1) && (strncmp(cp, ".", 1) == 0))
{ /* Single dot. No-op. Skip it. */
dir_len = 0;
}
 
/* If non-null, acceptable directory, then process it. */
if (dir_len > 0)
{
if (ods2_names) /* Make directory name ODS2-compliant. */
{
adj_dir_name_ods2(pathcomp, cp, dir_len);
}
else /* Make directory name ODS5-compliant. */
{
adj_dir_name_ods5(pathcomp, cp, dir_len);
}
if (((error = checkdir(__G__ pathcomp, APPEND_DIR))
& MPN_MASK) > MPN_INF_TRUNC)
return error;
}
cp = next_slash+ 1; /* Continue at the next name segment. */
} /* end while loop */
 
/* Show warning when stripping insecure "parent dir" path components */
if (killed_ddot && QCOND2) {
Info(slide, 0, ((char *)slide,
"warning: skipped \"../\" path component(s) in %s\n",
FnFilter1(G.filename)));
if (!(error & ~MPN_MASK))
error = (error & MPN_MASK) | PK_WARN;
}
 
/* If there is one, adjust the name.type;version segment. */
if (strlen(cp) == 0)
{
/* Directory only, no file name. Create the directory, as needed.
Report directory creation to user.
*/
checkdir(__G__ "", APPEND_NAME); /* create directory, if not found */
checkdir(__G__ G.filename, GETPATH);
if (created_dir) {
if (QCOND2) {
Info(slide, 0, ((char *)slide, " creating: %s\n",
FnFilter1(G.filename)));
}
/* set dir time (note trailing '/') */
return (error & ~MPN_MASK) | MPN_CREATED_DIR;
}
/* dir existed already; don't look for data to extract */
return (error & ~MPN_MASK) | MPN_INF_SKIP;
}
 
/* Process the file name. */
if (ods2_names) /* Make file name ODS2-compliant. */
{
adj_file_name_ods2(pathcomp, cp);
}
else /* Make file name ODS5-compliant. */
{
adj_file_name_ods5(pathcomp, cp);
}
 
checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */
checkdir(__G__ G.filename, GETPATH);
 
return error;
 
} /* end function mapname() */
 
 
 
int checkdir(__G__ pathcomp, fcn)
/*
* returns:
* MPN_OK - no problem detected
* MPN_INF_TRUNC - (on APPEND_NAME) truncated filename
* MPN_INF_SKIP - path doesn't exist, not allowed to create
* MPN_ERR_SKIP - path doesn't exist, tried to create and failed; or path
* exists and is not a directory, but is supposed to be
* MPN_ERR_TOOLONG - path is too long
* MPN_NOMEM - can't allocate memory for filename buffers
*/
__GDEF
char *pathcomp;
int fcn;
{
int function=fcn & FN_MASK;
static char pathbuf[FILNAMSIZ];
 
/* previously created directory (initialized to impossible dir. spec.) */
static char lastdir[FILNAMSIZ] = "\t";
 
static char *pathptr = pathbuf; /* For debugger */
static char *devptr, *dirptr;
static int devlen, dirlen;
static int root_dirlen;
static char *end;
static int first_comp, root_has_dir;
static int rootlen=0;
static char *rootend;
static int mkdir_failed=0;
int status;
struct FAB fab;
struct NAM_STRUCT nam;
 
 
/************
*** ROOT ***
************/
 
#if (!defined(SFX) || defined(SFX_EXDIR))
if (function == ROOT)
{ /* Assume VMS root spec */
/* 2006-01-20 SMS.
Changed to use sys$parse() instead of sys$filescan() for analysis
of the user-specified destination directory. Previously, various
values behaved badly, without complaint, e.g. "-d sys$scratch".
*/
char *root_dest;
 
/* If the root path has already been set, return immediately. */
if (rootlen > 0)
return MPN_OK;
 
/* Initialization. */
root_dest = PATH_DEFAULT; /* Default destination for ODSx sensing. */
root_has_dir = 0; /* Root includes a directory. */
fab = cc$rms_fab; /* Initialize FAB. */
nam = CC_RMS_NAM; /* Initialize NAM[L]. */
fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
 
#ifdef NAML$C_MAXRSS
 
fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
/* Specified file spec. */
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = pathcomp;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(pathcomp);
 
/* Default file spec. */
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = PATH_DEFAULT;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = strlen(PATH_DEFAULT);
 
/* Expanded file spec. */
nam.NAM_ESA = pathbuf;
nam.NAM_ESS = NAM_MAXRSS;
 
status = sys$parse(&fab);
 
/* OK so far, if OK or if directory not found. */
if (((status & STS$M_SEVERITY) != STS$K_SUCCESS) &&
(status != RMS$_DNF))
{
/* Invalid destination directory specified. */
Info(slide, 1, ((char *)slide,
"Invalid destination directory (parse error): %s\n",
FnFilter1(pathcomp)));
return MPN_ERR_SKIP;
}
 
/* Should be only a device:[directory], so name+type+version
should have length 2 (".;").
*/
if (nam.NAM_B_NAME + nam.NAM_B_TYPE + nam.NAM_B_VER > 2)
{
Info(slide, 1, ((char *)slide,
"Invalid destination directory (includes file name): %s\n",
FnFilter1(nam.NAM_ESA)));
return MPN_ERR_SKIP;
}
 
/* Truncate at name, leaving only "dev:[dir]". */
*nam.NAM_L_NAME = '\0';
rootlen = nam.NAM_L_NAME - nam.NAM_ESA;
 
/* Remove any trailing dots in directory. */
if ((nam.NAM_ESA[rootlen-1] == ']') &&
(nam.NAM_ESA[rootlen-2] != '^'))
{
root_has_dir = 1;
rootlen -= 2;
while ((nam.NAM_ESA[rootlen] == '.') &&
(nam.NAM_ESA[rootlen-1] != '^'))
{
rootlen--;
}
nam.NAM_ESA[++rootlen] = ']';
nam.NAM_ESA[++rootlen] = '\0';
}
 
devlen = nam.NAM_L_DIR - nam.NAM_ESA;
 
/* If directory not found, then create it. */
if (status == RMS$_DNF)
{
if (status = mkdir(nam.NAM_ESA, 0))
{
Info(slide, 1, ((char *)slide,
"Can not create destination directory: %s\n",
FnFilter1(nam.NAM_ESA)));
 
/* path didn't exist, tried to create, and failed. */
return MPN_ERR_SKIP;
}
}
 
/* Save the (valid) device:[directory] spec. */
strcpy(pathbuf, nam.NAM_ESA);
root_dest = pathbuf;
 
/* At this point, the true destination is known. If the user
supplied an invalid destination directory, the default
directory will be used. (This may be pointless, but should
be safe.)
*/
 
/* If not yet known, determine the destination (root_dest) file
system type (ODS2 or ODS5).
*/
if (ods2_names < 0)
{
/* If user doesn't force ODS2, set flag according to dest. */
if (uO.ods2_flag == 0)
{
ods2_names = (dest_struct_level(root_dest) <= DVI$C_ACP_F11V2);
}
else
{
ods2_names = 1; /* User demands ODS2 names. */
}
}
 
/* Replace trailing "]" with ".", for later appending. */
if ((pathbuf[rootlen-1] == ']') || (pathbuf[rootlen-1] == '>'))
{
pathbuf[rootlen-1] = '.';
}
 
/* Set various pointers and lengths. */
devptr = pathbuf;
dirptr = pathbuf + (nam.NAM_L_DIR - nam.NAM_ESA);
rootend = pathbuf + rootlen;
*(end = rootend) = '\0';
root_dirlen = dirlen = rootlen - devlen;
first_comp = !root_has_dir;
return MPN_OK;
}
#endif /* !SFX || SFX_EXDIR */
 
 
/************
*** INIT ***
************/
 
if ( function == INIT )
{
if ( strlen(G.filename) + rootlen + 13 > NAM_MAXRSS )
return MPN_ERR_TOOLONG;
 
if ( rootlen == 0 ) /* No root given, reset everything. */
{
devptr = dirptr = rootend = pathbuf;
devlen = dirlen = 0;
}
end = rootend;
first_comp = !root_has_dir;
if ( dirlen = root_dirlen )
end[-1] = '.';
*end = '\0';
return MPN_OK;
}
 
 
/******************
*** APPEND_DIR ***
******************/
if ( function == APPEND_DIR )
{
int cmplen;
 
cmplen = strlen(pathcomp);
 
if ( first_comp )
{
*end++ = '[';
if ( cmplen )
*end++ = '.'; /* "dir/..." --> "[.dir...]" */
/* else "/dir..." --> "[dir...]" */
first_comp = 0;
}
 
if ( cmplen == 1 && *pathcomp == '.' )
; /* "..././..." -- ignore */
 
else if ( cmplen == 2 && pathcomp[0] == '.' && pathcomp[1] == '.' )
{ /* ".../../..." -- convert to "...-..." */
*end++ = '-';
*end++ = '.';
}
 
else if ( cmplen + (end-pathptr) > NAM_MAXRSS )
return MPN_ERR_TOOLONG;
 
else
{
strcpy(end, pathcomp);
*(end+=cmplen) = '.';
++end;
}
dirlen = end - dirptr;
*end = '\0';
return MPN_OK;
}
 
 
/*******************
*** APPEND_NAME ***
*******************/
if ( function == APPEND_NAME )
{
if ( fcn & USE_DEFAULT )
{ /* Expand renamed filename using collected path, return
* at pathcomp */
fab = cc$rms_fab; /* Initialize FAB. */
nam = CC_RMS_NAM; /* Initialize NAM[L]. */
fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
 
#ifdef NAML$C_MAXRSS
 
fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNA = pathptr;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_DNS = end - pathptr;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = G.filename;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(G.filename);
 
nam.NAM_ESA = pathcomp; /* (Great design. ---v. SMS.) */
nam.NAM_ESS = NAM_MAXRSS; /* Assume large enough. */
 
if (!OK(status = sys$parse(&fab)) && status == RMS$_DNF )
/* Directory not found: */
{ /* ... try to create it */
char save;
char *dirend;
int mkdir_failed;
 
dirend = (char*)nam.NAM_L_DIR + nam.NAM_B_DIR;
save = *dirend;
*dirend = '\0';
if ( (mkdir_failed = mkdir(nam.NAM_L_DEV, 0)) &&
errno == EEXIST )
mkdir_failed = 0;
*dirend = save;
if ( mkdir_failed )
return 3;
created_dir = TRUE;
} /* if (sys$parse... */
pathcomp[nam.NAM_ESL] = '\0';
return MPN_OK;
} /* if (USE_DEFAULT) */
else
{
*end = '\0';
if ( dirlen )
{
dirptr[dirlen-1] = ']'; /* Close directory */
 
/*
* Try to create the target directory.
* Don't waste time creating directory that was created
* last time.
*/
if ( STRICMP(lastdir, pathbuf) )
{
mkdir_failed = 0;
if ( mkdir(pathbuf, 0) )
{
if ( errno != EEXIST )
mkdir_failed = 1; /* Mine for GETPATH */
}
else
created_dir = TRUE;
strcpy(lastdir, pathbuf);
}
}
else
{ /*
* Target directory unspecified.
* Try to create "SYS$DISK:[]"
*/
if ( strcmp(lastdir, PATH_DEFAULT) )
{
strcpy(lastdir, PATH_DEFAULT);
mkdir_failed = 0;
if ( mkdir(lastdir, 0) && errno != EEXIST )
mkdir_failed = 1; /* Mine for GETPATH */
}
}
if ( strlen(pathcomp) + (end-pathbuf) > 255 )
return MPN_INF_TRUNC;
strcpy(end, pathcomp);
end += strlen(pathcomp);
return MPN_OK;
}
}
 
 
/***************
*** GETPATH ***
***************/
if ( function == GETPATH )
{
if ( mkdir_failed )
return MPN_ERR_SKIP;
*end = '\0'; /* To be safe */
strcpy( pathcomp, pathbuf );
return MPN_OK;
}
 
 
/***********
*** END ***
***********/
if ( function == END )
{
Trace((stderr, "checkdir(): nothing to free...\n"));
rootlen = 0;
return MPN_OK;
}
 
return MPN_INVALID; /* should never reach */
 
}
 
 
 
int check_for_newer(__G__ filenam) /* return 1 if existing file newer or */
__GDEF /* equal; 0 if older; -1 if doesn't */
char *filenam; /* exist yet */
{
#ifdef USE_EF_UT_TIME
iztimes z_utime;
struct tm *t;
#endif
char *filenam_stat;
unsigned short timbuf[7];
unsigned dy, mo, yr, hh, mm, ss, dy2, mo2, yr2, hh2, mm2, ss2;
struct FAB fab;
struct XABDAT xdat;
#ifdef NAML$C_MAXRSS
struct NAM_STRUCT nam;
#endif
 
/* 2008-07-12 SMS.
* Special case for "." as a file name, not as the current directory.
* Substitute ".;" to keep stat() from seeing a plain ".".
*/
if (strcmp(filenam, ".") == 0)
filenam_stat = ".;";
else
filenam_stat = filenam;
 
if (stat(filenam_stat, &G.statbuf))
return DOES_NOT_EXIST;
 
fab = cc$rms_fab; /* Initialize FAB. */
xdat = cc$rms_xabdat; /* Initialize XAB. */
 
#ifdef NAML$C_MAXRSS
 
nam = CC_RMS_NAM; /* Initialize NAM[L]. */
fab.FAB_NAM = &nam; /* Point FAB to NAM[L]. */
 
fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */
fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */
 
#endif /* NAML$C_MAXRSS */
 
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNA = filenam;
FAB_OR_NAML(fab, nam).FAB_OR_NAML_FNS = strlen(filenam);
 
fab.fab$l_xab = (char *) &xdat;
fab.fab$l_fop = FAB$M_GET | FAB$M_UFO;
 
if (ERR(sys$open(&fab))) /* open failure: report exists and */
return EXISTS_AND_OLDER; /* older so new copy will be made */
sys$numtim(&timbuf, &xdat.xab$q_cdt);
fab.fab$l_xab = NULL;
 
sys$dassgn(fab.fab$l_stv);
sys$close(&fab); /* be sure file is closed and RMS knows about it */
 
#ifdef USE_EF_UT_TIME
if (G.extra_field &&
#ifdef IZ_CHECK_TZ
G.tz_is_valid &&
#endif
(ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
G.lrec.last_mod_dos_datetime, &z_utime, NULL)
& EB_UT_FL_MTIME))
t = localtime(&(z_utime.mtime));
else
t = (struct tm *)NULL;
 
if (t != (struct tm *)NULL)
{
yr2 = (unsigned)(t->tm_year) + 1900;
mo2 = (unsigned)(t->tm_mon) + 1;
dy2 = (unsigned)(t->tm_mday);
hh2 = (unsigned)(t->tm_hour);
mm2 = (unsigned)(t->tm_min);
ss2 = (unsigned)(t->tm_sec);
 
/* round to nearest sec--may become 60,
but doesn't matter for compare */
ss = (unsigned)((float)timbuf[5] + (float)timbuf[6]*.01 + 0.5);
TTrace((stderr, "check_for_newer: using Unix extra field mtime\n"));
}
else
#endif /* USE_EF_UT_TIME */
{
yr2 = ((G.lrec.last_mod_dos_datetime >> 25) & 0x7f) + 1980;
mo2 = (G.lrec.last_mod_dos_datetime >> 21) & 0x0f;
dy2 = (G.lrec.last_mod_dos_datetime >> 16) & 0x1f;
hh2 = (G.lrec.last_mod_dos_datetime >> 11) & 0x1f;
mm2 = (G.lrec.last_mod_dos_datetime >> 5) & 0x3f;
ss2 = (G.lrec.last_mod_dos_datetime << 1) & 0x1f;
 
/* round to nearest 2 secs--may become 60,
but doesn't matter for compare */
ss = (unsigned)((float)timbuf[5] + (float)timbuf[6]*.01 + 1.) & (~1);
}
yr = timbuf[0];
mo = timbuf[1];
dy = timbuf[2];
hh = timbuf[3];
mm = timbuf[4];
 
if (yr > yr2)
return EXISTS_AND_NEWER;
else if (yr < yr2)
return EXISTS_AND_OLDER;
 
if (mo > mo2)
return EXISTS_AND_NEWER;
else if (mo < mo2)
return EXISTS_AND_OLDER;
 
if (dy > dy2)
return EXISTS_AND_NEWER;
else if (dy < dy2)
return EXISTS_AND_OLDER;
 
if (hh > hh2)
return EXISTS_AND_NEWER;
else if (hh < hh2)
return EXISTS_AND_OLDER;
 
if (mm > mm2)
return EXISTS_AND_NEWER;
else if (mm < mm2)
return EXISTS_AND_OLDER;
 
if (ss >= ss2)
return EXISTS_AND_NEWER;
 
return EXISTS_AND_OLDER;
}
 
 
 
#ifdef RETURN_CODES
void return_VMS(__G__ err)
__GDEF
#else
void return_VMS(err)
#endif
int err;
{
int severity;
 
#ifdef RETURN_CODES
/*---------------------------------------------------------------------------
Do our own, explicit processing of error codes and print message, since
VMS misinterprets return codes as rather obnoxious system errors ("access
violation," for example).
---------------------------------------------------------------------------*/
 
switch (err) {
case PK_COOL:
break; /* life is fine... */
case PK_WARN:
Info(slide, 1, ((char *)slide, "\n\
[return-code %d: warning error \
(e.g., failed CRC or unknown compression method)]\n", err));
break;
case PK_ERR:
case PK_BADERR:
Info(slide, 1, ((char *)slide, "\n\
[return-code %d: error in zipfile \
(e.g., cannot find local file header sig)]\n", err));
break;
case PK_MEM:
case PK_MEM2:
case PK_MEM3:
case PK_MEM4:
case PK_MEM5:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: insufficient memory]\n", err));
break;
case PK_NOZIP:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: zipfile not found]\n", err));
break;
case PK_PARAM: /* exit(PK_PARAM); gives "access violation" */
Info(slide, 1, ((char *)slide, "\n\
[return-code %d: bad or illegal parameters specified on command line]\n",
err));
break;
case PK_FIND:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: no files found to extract/view/etc.]\n",
err));
break;
case PK_DISK:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: disk full or other I/O error]\n", err));
break;
case PK_EOF:
Info(slide, 1, ((char *)slide, "\n\
[return-code %d: unexpected EOF in zipfile (i.e., truncated)]\n", err));
break;
case IZ_CTRLC:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: you hit ctrl-C to terminate]\n", err));
break;
case IZ_UNSUP:
Info(slide, 1, ((char *)slide, "\n\
[return-code %d: unsupported compression or encryption for all files]\n",
err));
break;
case IZ_BADPWD:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: bad decryption password for all files]\n",
err));
break;
#ifdef DO_SAFECHECK_2GB
case IZ_ERRBF:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: big-file archive, small-file program]\n",
err));
break;
#endif /* DO_SAFECHECK_2GB */
default:
Info(slide, 1, ((char *)slide,
"\n[return-code %d: unknown return-code (screw-up)]\n", err));
break;
}
#endif /* RETURN_CODES */
 
/*---------------------------------------------------------------------------
* Return an intelligent status/severity level:
*
* 2007-01-29 SMS.
*
* VMS Status Code Summary (See STSDEF.H for details.)
*
* Bits: 31:28 27:16 15:3 2 1 0
* Field: Control Facility Message Severity
* -----
* 0 0 0 0 Warning
* 0 0 1 1 Success
* 0 1 0 2 Error
* 0 1 1 3 Information
* 1 0 0 4 Severe (fatal) error
*
* In the Control field, bits 31:29 are reserved. Bit 28 inhibits
* printing the message. In the Facility field, bit 27 means
* customer-defined (not HP-assigned, like us). In the Message field,
* bit 15 means facility-specific (which our messages are).
*
* Note that the C library translates exit(0) to a $STATUS value of 1
* (i.e., exit is both silent and has a $SEVERITY of "success").
*
* Previous versions of Info-ZIP programs used a generic ("chosen (by
* experimentation)") Control+Facility code of 0x7FFF, which included
* some reserved control bits, the inhibit-printing bit, and the
* customer-defined bit.
*
* HP has now assigned official Facility names and corresponding
* Facility codes for the Info-ZIP products:
*
* Facility Name Facility Code
* IZ_UNZIP 1954 = 0x7A2
* IZ_ZIP 1955 = 0x7A3
*
* Now, unless the CTL_FAC_IZ_UZP macro is defined at build-time, we
* will use the official Facility code.
*
---------------------------------------------------------------------------*/
 
/* Official HP-assigned Info-ZIP UnZip Facility code. */
#define FAC_IZ_UZP 1954 /* 0x7A2 */
 
#ifndef CTL_FAC_IZ_UZP
/*
* Default is inhibit-printing with the official Facility code.
*/
# define CTL_FAC_IZ_UZP ((0x1 << 12) | FAC_IZ_UZP)
# define MSG_FAC_SPEC 0x8000 /* Facility-specific code. */
#else /* CTL_FAC_IZ_UZP */
/* Use the user-supplied Control+Facility code for err or warn. */
# ifndef MSG_FAC_SPEC /* Old default is not Facility-specific. */
# define MSG_FAC_SPEC 0x0 /* Facility-specific code. Or 0x8000. */
# endif /* !MSG_FAC_SPEC */
#endif /* ?CTL_FAC_IZ_ZIP */
#define VMS_UZ_FAC_BITS ((CTL_FAC_IZ_UZP << 16) | MSG_FAC_SPEC)
 
severity = (err == PK_WARN) ? 0 : /* warn */
(err == PK_ERR || /* error */
(err >= PK_NOZIP && err <= PK_FIND) || /* ... */
(err >= IZ_CTRLC && err <= IZ_BADPWD)) ? 2 : /* ... */
4; /* fatal */
 
exit( /* $SEVERITY: */
(err == PK_COOL) ? SS$_NORMAL : /* success */
(VMS_UZ_FAC_BITS | (err << 4) | severity) /* warning, error, fatal */
);
 
} /* end function return_VMS() */
 
 
#ifdef MORE
static int scrnlines = -1;
static int scrncolumns = -1;
static int scrnwrap = -1;
 
 
static int getscreeninfo(int *tt_rows, int *tt_cols, int *tt_wrap)
{
/*
* For VMS v5.x:
* IO$_SENSEMODE/SETMODE info: Programming, Vol. 7A, System Programming,
* I/O User's: Part I, sec. 8.4.1.1, 8.4.3, 8.4.5, 8.6
* sys$assign(), sys$qio() info: Programming, Vol. 4B, System Services,
* System Services Reference Manual, pp. sys-23, sys-379
* fixed-length descriptor info: Programming, Vol. 3, System Services,
* Intro to System Routines, sec. 2.9.2
* GRR, 15 Aug 91 / SPC, 07 Aug 1995, 14 Nov 1999
*/
 
#ifndef OUTDEVICE_NAME
#define OUTDEVICE_NAME "SYS$OUTPUT"
#endif
 
static ZCONST struct dsc$descriptor_s OutDevDesc =
{(sizeof(OUTDEVICE_NAME) - 1), DSC$K_DTYPE_T, DSC$K_CLASS_S,
OUTDEVICE_NAME};
/* {dsc$w_length, dsc$b_dtype, dsc$b_class, dsc$a_pointer}; */
 
short OutDevChan, iosb[4];
long status;
struct tt_characts
{
uch class, type;
ush pagewidth;
union {
struct {
uch ttcharsbits[3];
uch pagelength;
} ttdef_bits;
unsigned ttcharflags;
} ttdef_area;
} ttmode; /* total length = 8 bytes */
 
 
/* assign a channel to standard output */
status = sys$assign(&OutDevDesc, &OutDevChan, 0, 0);
if (OK(status))
{
/* use sys$qiow and the IO$_SENSEMODE function to determine
* the current tty status.
*/
status = sys$qiow(0, OutDevChan, IO$_SENSEMODE, &iosb, 0, 0,
&ttmode, sizeof(ttmode), 0, 0, 0, 0);
/* deassign the output channel by way of clean-up */
(void) sys$dassgn(OutDevChan);
}
 
if ( OK(status) && OK(status = iosb[0]) ) {
if (tt_rows != NULL)
*tt_rows = ( (ttmode.ttdef_area.ttdef_bits.pagelength >= 5)
? (int) (ttmode.ttdef_area.ttdef_bits.pagelength)
/* TT device value */
: (24) ); /* VT 100 default */
if (tt_cols != NULL)
*tt_cols = ( (ttmode.pagewidth >= 10)
? (int) (ttmode.pagewidth) /* TT device value */
: (80) ); /* VT 100 default */
if (tt_wrap != NULL)
*tt_wrap = ((ttmode.ttdef_area.ttcharflags & TT$M_WRAP) != 0);
} else {
/* VT 100 defaults */
if (tt_rows != NULL)
*tt_rows = 24;
if (tt_cols != NULL)
*tt_cols = 80;
if (tt_wrap != NULL)
*tt_wrap = FALSE;
}
 
return (OK(status));
}
 
int screensize(int *tt_rows, int *tt_cols)
{
if (scrnlines < 0 || scrncolumns < 0)
getscreeninfo(&scrnlines, &scrncolumns, &scrnwrap);
if (tt_rows != NULL) *tt_rows = scrnlines;
if (tt_cols != NULL) *tt_cols = scrncolumns;
return !(scrnlines > 0 && scrncolumns > 0);
}
 
int screenlinewrap()
{
if (scrnwrap == -1)
getscreeninfo(&scrnlines, &scrncolumns, &scrnwrap);
return (scrnwrap);
}
#endif /* MORE */
 
 
#ifndef SFX
 
/************************/
/* Function version() */
/************************/
 
/* 2004-11-23 SMS.
* Changed to include the "-x" part of the VMS version.
* Added the IA64 system type name.
* Prepared for VMS versions after 9. (We should live so long.)
*/
 
void version(__G)
__GDEF
{
int len;
#ifdef VMS_VERSION
char *chrp1;
char *chrp2;
char buf[40];
char vms_vers[16];
int ver_maj;
#endif
#ifdef __DECC_VER
char buf2[40];
int vtyp;
#endif
 
#ifdef VMS_VERSION
/* Truncate the version string at the first (trailing) space. */
strncpy(vms_vers, VMS_VERSION, sizeof(vms_vers));
vms_vers[sizeof(vms_vers)-1] = '\0';
chrp1 = strchr(vms_vers, ' ');
if (chrp1 != NULL)
*chrp1 = '\0';
 
/* Determine the major version number. */
ver_maj = 0;
chrp1 = strchr(&vms_vers[1], '.');
for (chrp2 = &vms_vers[1];
chrp2 < chrp1;
ver_maj = ver_maj * 10 + *(chrp2++) - '0');
#endif /* VMS_VERSION */
 
/* DEC C in ANSI mode does not like "#ifdef MACRO" inside another
macro when MACRO is equated to a value (by "#define MACRO 1"). */
 
len = sprintf((char *)slide, LoadFarString(CompiledWith),
 
#ifdef __GNUC__
"gcc ", __VERSION__,
#else
# if defined(DECC) || defined(__DECC) || defined (__DECC__)
"DEC C",
# ifdef __DECC_VER
(sprintf(buf2, " %c%d.%d-%03d",
((vtyp = (__DECC_VER / 10000) % 10) == 6 ? 'T' :
(vtyp == 8 ? 'S' : 'V')),
__DECC_VER / 10000000,
(__DECC_VER % 10000000) / 100000, __DECC_VER % 1000), buf2),
# else
"",
# endif
# else
# ifdef VAXC
"VAX C", "",
# else
"unknown compiler", "",
# endif
# endif
#endif
 
#ifdef VMS_VERSION
# if defined(__alpha)
"OpenVMS",
(sprintf(buf, " (%s Alpha)", vms_vers), buf),
# elif defined(__ia64)
"OpenVMS",
(sprintf(buf, " (%s IA64)", vms_vers), buf),
# else /* VAX */
(ver_maj >= 6) ? "OpenVMS" : "VMS",
(sprintf(buf, " (%s VAX)", vms_vers), buf),
# endif
#else
"VMS",
"",
#endif /* ?VMS_VERSION */
 
#ifdef __DATE__
" on ", __DATE__
#else
"", ""
#endif
);
 
(*G.message)((zvoid *)&G, slide, (ulg)len, 0);
 
} /* end function version() */
 
#endif /* !SFX */
 
 
 
#ifdef __DECC
 
/* 2004-11-20 SMS.
*
* acc_cb(), access callback function for DEC C open().
*
* Set some RMS FAB/RAB items, with consideration of user-specified
* values from (DCL) SET RMS_DEFAULT. Items of particular interest are:
*
* fab$w_deq default extension quantity (blocks) (write).
* rab$b_mbc multi-block count.
* rab$b_mbf multi-buffer count (used with rah and wbh).
*
* See also the OPEN* macros in VMSCFG.H. Currently, no notice is
* taken of the caller-ID value, but options could be set differently
* for read versus write access. (I assume that specifying fab$w_deq,
* for example, for a read-only file has no ill effects.)
*/
 
/* Global storage. */
 
int openr_id = OPENR_ID; /* Callback id storage, read. */
 
/* acc_cb() */
 
int acc_cb(int *id_arg, struct FAB *fab, struct RAB *rab)
{
int sts;
 
/* Get process RMS_DEFAULT values, if not already done. */
if (rms_defaults_known == 0)
{
get_rms_defaults();
}
 
/* If RMS_DEFAULT (and adjusted active) values are available, then set
* the FAB/RAB parameters. If RMS_DEFAULT values are not available,
* suffer with the default parameters.
*/
if (rms_defaults_known > 0)
{
/* Set the FAB/RAB parameters accordingly. */
fab-> fab$w_deq = rms_ext_active;
rab-> rab$b_mbc = rms_mbc_active;
rab-> rab$b_mbf = rms_mbf_active;
 
/* Truncate at EOF on close, as we'll probably over-extend. */
fab-> fab$v_tef = 1;
 
/* If using multiple buffers, enable read-ahead and write-behind. */
if (rms_mbf_active > 1)
{
rab-> rab$v_rah = 1;
rab-> rab$v_wbh = 1;
}
 
if (DIAG_FLAG)
{
fprintf(stderr,
"Open callback. ID = %d, deq = %6d, mbc = %3d, mbf = %3d.\n",
*id_arg, fab-> fab$w_deq, rab-> rab$b_mbc, rab-> rab$b_mbf);
}
}
 
/* Declare success. */
return 0;
}
 
 
 
/*
* 2004-09-19 SMS.
*
*----------------------------------------------------------------------
*
* decc_init()
*
* On non-VAX systems, uses LIB$INITIALIZE to set a collection of C
* RTL features without using the DECC$* logical name method.
*
*----------------------------------------------------------------------
*/
 
#ifdef __CRTL_VER
#if !defined(__VAX) && (__CRTL_VER >= 70301000)
 
#include <unixlib.h>
 
/*--------------------------------------------------------------------*/
 
/* Global storage. */
 
/* Flag to sense if decc_init() was called. */
 
static int decc_init_done = -1;
 
/*--------------------------------------------------------------------*/
 
/* decc_init()
 
Uses LIB$INITIALIZE to set a collection of C RTL features without
requiring the user to define the corresponding logical names.
*/
 
/* Structure to hold a DECC$* feature name and its desired value. */
 
typedef struct
{
char *name;
int value;
} decc_feat_t;
 
/* Array of DECC$* feature names and their desired values. */
 
decc_feat_t decc_feat_array[] = {
 
/* Preserve command-line case with SET PROCESS/PARSE_STYLE=EXTENDED */
{ "DECC$ARGV_PARSE_STYLE", 1 },
 
/* Preserve case for file names on ODS5 disks. */
{ "DECC$EFS_CASE_PRESERVE", 1 },
 
/* Enable multiple dots (and most characters) in ODS5 file names,
while preserving VMS-ness of ";version". */
{ "DECC$EFS_CHARSET", 1 },
 
/* List terminator. */
{ (char *)NULL, 0 } };
 
 
/* LIB$INITIALIZE initialization function. */
 
static void decc_init(void)
{
int feat_index;
int feat_value;
int feat_value_max;
int feat_value_min;
int i;
int sts;
 
/* Set the global flag to indicate that LIB$INITIALIZE worked. */
 
decc_init_done = 1;
 
/* Loop through all items in the decc_feat_array[]. */
 
for (i = 0; decc_feat_array[i].name != NULL; i++)
{
/* Get the feature index. */
feat_index = decc$feature_get_index(decc_feat_array[i].name);
if (feat_index >= 0)
{
/* Valid item. Collect its properties. */
feat_value = decc$feature_get_value(feat_index, 1);
feat_value_min = decc$feature_get_value(feat_index, 2);
feat_value_max = decc$feature_get_value(feat_index, 3);
 
if ((decc_feat_array[i].value >= feat_value_min) &&
(decc_feat_array[i].value <= feat_value_max))
{
/* Valid value. Set it if necessary. */
if (feat_value != decc_feat_array[i].value)
{
sts = decc$feature_set_value(
feat_index,
1,
decc_feat_array[i].value);
}
}
else
{
/* Invalid DECC feature value. */
printf(" INVALID DECC FEATURE VALUE, %d: %d <= %s <= %d.\n",
feat_value,
feat_value_min, decc_feat_array[i].name, feat_value_max);
}
}
else
{
/* Invalid DECC feature name. */
printf(" UNKNOWN DECC FEATURE: %s.\n", decc_feat_array[i].name);
}
}
}
 
/* Get "decc_init()" into a valid, loaded LIB$INITIALIZE PSECT. */
 
#pragma nostandard
 
/* Establish the LIB$INITIALIZE PSECT, with proper alignment and
attributes.
*/
globaldef {"LIB$INITIALIZ"} readonly _align (LONGWORD)
int spare[8] = { 0 };
globaldef {"LIB$INITIALIZE"} readonly _align (LONGWORD)
void (*x_decc_init)() = decc_init;
 
/* Fake reference to ensure loading the LIB$INITIALIZE PSECT. */
 
#pragma extern_model save
/* The declaration for LIB$INITIALIZE() is missing in the VMS system header
files. Addionally, the lowercase name "lib$initialize" is defined as a
macro, so that this system routine can be reference in code using the
traditional C-style lowercase convention of function names for readability.
(VMS system functions declared in the VMS system headers are defined in a
similar way to allow using lowercase names within the C code, whereas the
"externally" visible names in the created object files are uppercase.)
*/
#ifndef lib$initialize
# define lib$initialize LIB$INITIALIZE
#endif
int lib$initialize(void);
#pragma extern_model strict_refdef
int dmy_lib$initialize = (int)lib$initialize;
#pragma extern_model restore
 
#pragma standard
 
#endif /* !defined(__VAX) && (__CRTL_VER >= 70301000) */
#endif /* __CRTL_VER */
#endif /* __DECC */
 
#endif /* VMS */
/programs/fs/unzip60/vms/vms.h
0,0 → 1,382
/*
Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
 
See the accompanying file LICENSE, version 2009-Jan-02 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*---------------------------------------------------------------------------
 
vms.h
 
Generic VMS header file for Info-ZIP's Zip and UnZip.
 
---------------------------------------------------------------------------*/
 
#ifndef __vms_h
#define __vms_h 1
 
#ifndef __DESCRIP_LOADED
#include <descrip.h>
#endif
#ifndef __STARLET_LOADED
/* Workaround for broken header files of older DECC distributions
* that are incompatible with the /NAMES=AS_IS qualifier. */
#define sys$assign SYS$ASSIGN
#define sys$bintim SYS$BINTIM
#define sys$close SYS$CLOSE
#define sys$connect SYS$CONNECT
#define sys$create SYS$CREATE
#define sys$dassgn SYS$DASSGN
#define sys$extend SYS$EXTEND
#define sys$getjpiw SYS$GETJPIW
#define sys$numtim SYS$NUMTIM
#define sys$open SYS$OPEN
#define sys$parse SYS$PARSE
#define sys$put SYS$PUT
#define sys$qio SYS$QIO
#define sys$qiow SYS$QIOW
#define sys$read SYS$READ
#define sys$rewind SYS$REWIND
#define sys$search SYS$SEARCH
#define sys$setdfprot SYS$SETDFPROT
#define sys$synch SYS$SYNCH
#define sys$wait SYS$WAIT
#define sys$write SYS$WRITE
#include <starlet.h>
#endif /* ndef __STARLET_LOADED */
#ifndef __SYIDEF_LOADED
#include <syidef.h>
#endif
#ifndef __ATRDEF_LOADED
#include <atrdef.h>
#endif
#ifndef __FIBDEF_LOADED
#include <fibdef.h>
#endif
#ifndef __IODEF_LOADED
#include <iodef.h>
#endif
#if !defined(_RMS_H) && !defined(__RMS_LOADED)
#include <rms.h>
#endif
 
#define ERR(s) !((s) & 1) /* VMS system error */
 
#ifndef SYI$_VERSION
#define SYI$_VERSION 4096 /* VMS 5.4 definition */
#endif
 
/*
* Under Alpha (DEC C in VAXC mode) and under `good old' VAXC, the FIB unions
* are declared as variant_unions. DEC C (Alpha) in ANSI modes and third
* party compilers which do not support `variant_union' define preprocessor
* symbols to `hide' the "intermediate union/struct" names from the
* programmer's API.
* We check the presence of these defines and for DEC's FIBDEF.H defining
* __union as variant_union to make sure we access the structure correctly.
*/
#define variant_union 1
#if defined(fib$w_did) || (defined(__union) && (__union == variant_union))
# define FIB$W_DID fib$w_did
# define FIB$W_FID fib$w_fid
# define FIB$L_ACCTL fib$l_acctl
# define FIB$W_EXCTL fib$w_exctl
# define FIB$W_NMCTL fib$w_nmctl
#else
# define FIB$W_DID fib$r_did_overlay.fib$w_did
# define FIB$W_FID fib$r_fid_overlay.fib$w_fid
# define FIB$L_ACCTL fib$r_acctl_overlay.fib$l_acctl
# define FIB$W_EXCTL fib$r_exctl_overlay.fib$w_exctl
# define FIB$W_NMCTL fib$r_nmctl_overlay.fib$w_nmctl
#endif
#undef variant_union
 
 
/* 2005-02-10 SMS. Copied NAM[L] macros here from Zip. */
 
/* Define macros for use with either NAM or NAML. */
 
#ifdef NAML$C_MAXRSS /* NAML is available (ODS5 support...) */
 
# ifndef NAM_MAXRSS /* May have been defined before. */
# define NAM_MAXRSS NAML$C_MAXRSS
# endif
 
# 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_ESA naml$l_long_expand
# define NAM_ESL naml$l_long_expand_size
# define NAM_ESS naml$l_long_expand_alloc
# define NAM_RSA naml$l_long_result
# define NAM_RSL naml$l_long_result_size
# define NAM_RSS naml$l_long_result_alloc
# define NAM_DID naml$w_did
# define NAM_DVI naml$t_dvi
# define NAM_FID naml$w_fid
# define NAM_FNB naml$l_fnb
# define NAM_NOP naml$b_nop
# define NAM_M_SYNCHK NAML$M_SYNCHK
# define NAM_B_DEV naml$l_long_dev_size
# define NAM_L_DEV naml$l_long_dev
# define NAM_B_DIR naml$l_long_dir_size
# define NAM_L_DIR naml$l_long_dir
# define NAM_B_NAME naml$l_long_name_size
# define NAM_L_NAME naml$l_long_name
# define NAM_B_TYPE naml$l_long_type_size
# define NAM_L_TYPE naml$l_long_type
# define NAM_B_VER naml$l_long_ver_size
# define NAM_L_VER naml$l_long_ver
 
#else /* !NAML$C_MAXRSS */ /* NAML is not available. Use NAM. */
 
# ifndef NAM_MAXRSS /* May have been defined before. */
# define NAM_MAXRSS NAM$C_MAXRSS
# endif
 
# 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_ESA nam$l_esa
# define NAM_ESL nam$b_esl
# define NAM_ESS nam$b_ess
# define NAM_RSA nam$l_rsa
# define NAM_RSL nam$b_rsl
# define NAM_RSS nam$b_rss
# define NAM_DID nam$w_did
# define NAM_DVI nam$t_dvi
# define NAM_FID nam$w_fid
# define NAM_FNB nam$l_fnb
# define NAM_NOP nam$b_nop
# define NAM_M_SYNCHK NAM$M_SYNCHK
# define NAM_B_DEV nam$b_dev
# define NAM_L_DEV nam$l_dev
# define NAM_B_DIR nam$b_dir
# define NAM_L_DIR nam$l_dir
# define NAM_B_NAME nam$b_name
# define NAM_L_NAME nam$l_name
# define NAM_B_TYPE nam$b_type
# define NAM_L_TYPE nam$l_type
# define NAM_B_VER nam$b_ver
# define NAM_L_VER nam$l_ver
 
#endif /* ?NAML$C_MAXRSS */
 
 
struct EB_header /* Common header of extra block */
{ ush tag;
ush size;
uch data[1];
};
 
#ifndef EB_HEADSIZE
# define EB_HEADSIZE 4
#endif
 
/*------ Old style Info-ZIP extra field definitions -----*/
 
#if (!defined(VAXC) && !defined(_RMS_H) && !defined(__RMS_LOADED))
 
struct XAB { /* This definition may be skipped */
unsigned char xab$b_cod;
unsigned char xab$b_bln;
short int xabdef$$_fill_1;
char *xab$l_nxt;
};
 
#endif /* !VAXC && !_RMS_H && !__RMS_LOADED */
 
#ifndef EB_IZVMS_BCMASK
# define EB_IZVMS_BCMASK 07 /* 3 bits for compression type */
#endif
#ifndef EB_IZVMS_BCSTOR
# define EB_IZVMS_BCSTOR 0 /* Stored */
#endif
#ifndef EB_IZVMS_BC00
# define EB_IZVMS_BC00 1 /* 0byte -> 0bit compression */
#endif
#ifndef EB_IZVMS_BCDEFL
# define EB_IZVMS_BCDEFL 2 /* Deflated */
#endif
 
/*
* Extra record format
* ===================
* signature (2 bytes) = 'I','M'
* size (2 bytes)
* block signature (4 bytes)
* flags (2 bytes)
* uncomprssed size(2 bytes)
* reserved (4 bytes)
* data ((size-12) bytes)
* ....
*/
 
struct IZ_block /* Extra field block header structure */
{
ush sig;
ush size;
ulg bid;
ush flags;
ush length;
ulg reserved;
uch body[1]; /* The actual size is unknown */
};
 
/*
* Extra field signature and block signatures
*/
 
#define IZ_SIGNATURE "IM"
#define FABSIG "VFAB"
#define XALLSIG "VALL"
#define XFHCSIG "VFHC"
#define XDATSIG "VDAT"
#define XRDTSIG "VRDT"
#define XPROSIG "VPRO"
#define XKEYSIG "VKEY"
#define XNAMSIG "VNAM"
#define VERSIG "VMSV"
 
/*
* Block sizes
*/
 
#define FABL (cc$rms_fab.fab$b_bln)
#define RABL (cc$rms_rab.rab$b_bln)
#define XALLL (cc$rms_xaball.xab$b_bln)
#define XDATL (cc$rms_xabdat.xab$b_bln)
#define XFHCL (cc$rms_xabfhc.xab$b_bln)
#define XKEYL (cc$rms_xabkey.xab$b_bln)
#define XPROL (cc$rms_xabpro.xab$b_bln)
#define XRDTL (cc$rms_xabrdt.xab$b_bln)
#define XSUML (cc$rms_xabsum.xab$b_bln)
#define EXTBSL 4 /* Block signature length */
#define RESL 8 /* Reserved 8 bytes */
#define EXTHL (EB_HEADSIZE+EXTBSL+RESL)
 
typedef unsigned char byte;
 
struct iosb
{
ush status;
ush count;
ulg spec;
};
 
/*------------ PKWARE extra block definitions ----------*/
 
/* Structure of PKWARE extra header */
 
#ifdef VMS_ZIP
 
#if defined(__DECC) || defined(__DECCXX)
#pragma __nostandard
#endif /* __DECC || __DECCXX */
 
#if defined(__DECC) || defined(__DECCXX)
#pragma __member_alignment __save
#pragma __nomember_alignment
#endif /* __DECC || __DECCXX */
 
#ifdef VMS_ORIGINAL_PK_LAYOUT
/* The original order of ATR fields in the PKZIP VMS-extra field leads
* to unaligned fields in the PK_info structure representing the
* extra field layout. When compiled for Alpha AXP, this results in
* some performance (and code size) penalty. It is not allowed to
* apply structure padding, since this is explicitly forbidden in
* the specification (APPNOTE.TXT) for the PK VMS extra field.
*/
typedef struct PK_info
{
ush tag_ra; ush len_ra; byte ra[ATR$S_RECATTR];
ush tag_uc; ush len_uc; byte uc[ATR$S_UCHAR];
ush tag_jr; ush len_jr; byte jr[ATR$S_JOURNAL];
ush tag_cd; ush len_cd; byte cd[ATR$S_CREDATE];
ush tag_rd; ush len_rd; byte rd[ATR$S_REVDATE];
ush tag_ed; ush len_ed; byte ed[ATR$S_EXPDATE];
ush tag_bd; ush len_bd; byte bd[ATR$S_BAKDATE];
ush tag_rn; ush len_rn; ush rn;
ush tag_ui; ush len_ui; byte ui[ATR$S_UIC];
ush tag_fp; ush len_fp; byte fp[ATR$S_FPRO];
ush tag_rp; ush len_rp; byte rp[ATR$S_RPRO];
} PK_info_t;
#else /* !VMS_ORIGINAL_PK_LAYOUT */
/* The Info-ZIP support for the PK VMS extra field uses a reordered
* field layout to achieve ``natural alignment'' of the PK_info structure
* members whenever possible. This rearrangement does not violate the
* PK's VMS extra field specification and should not break any ``well
* behaving'' (PK)Unzip utility. (`Well behaving' means that (PK)Unzip
* should use the field tag to identify the ATR$ field rather than
* assuming a fixed order of ATR$ fields in the PK VMS extra field.)
*/
typedef struct PK_info
{
ush tag_ra; ush len_ra; byte ra[ATR$S_RECATTR];
ush tag_uc; ush len_uc; byte uc[ATR$S_UCHAR];
ush tag_cd; ush len_cd; byte cd[ATR$S_CREDATE];
ush tag_rd; ush len_rd; byte rd[ATR$S_REVDATE];
ush tag_ed; ush len_ed; byte ed[ATR$S_EXPDATE];
ush tag_bd; ush len_bd; byte bd[ATR$S_BAKDATE];
ush tag_rn; ush len_rn; ush rn;
ush tag_ui; ush len_ui; byte ui[ATR$S_UIC];
ush tag_fp; ush len_fp; byte fp[ATR$S_FPRO];
ush tag_rp; ush len_rp; byte rp[ATR$S_RPRO];
ush tag_jr; ush len_jr; byte jr[ATR$S_JOURNAL];
} PK_info_t;
#endif /* ?VMS_ORIGINAL_PK_LAYOUT */
 
#if defined(__DECC) || defined(__DECCXX)
#pragma __member_alignment __restore
#endif /* __DECC || __DECCXX */
 
#if defined(__DECC) || defined(__DECCXX)
#pragma __standard
#endif /* __DECC || __DECCXX */
 
#endif /* VMS_ZIP */
 
/* PKWARE "VMS" tag */
#define PK_SIGNATURE 0x000C
 
/* Total number of attributes to be saved */
#define VMS_ATTR_COUNT 11
#define VMS_MAX_ATRCNT 20
 
struct PK_field
{
ush tag;
ush size;
byte value[1];
};
 
#define PK_FLDHDR_SIZE 4
 
struct PK_header
{
ush tag;
ush size;
ulg crc32;
byte data[1];
};
 
#define PK_HEADER_SIZE 8
 
#endif /* !__vms_h */
/programs/fs/unzip60/vms/vmscfg.h
0,0 → 1,191
/*
Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
 
See the accompanying file LICENSE, version 2009-Jan-02 or later
(the contents of which are also included in unzip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*---------------------------------------------------------------------------
OpenVMS specific configuration section (included by unzpriv.h):
---------------------------------------------------------------------------*/
 
#ifndef __vmscfg_h /* Prevent (unlikely) multiple inclusions. */
#define __vmscfg_h
 
/* Workaround for broken header files of older DECC distributions
* that are incompatible with the /NAMES=AS_IS qualifier. */
#define cma$tis_errno_get_addr CMA$TIS_ERRNO_GET_ADDR
 
/* LARGE FILE SUPPORT - 10/6/04 EG */
/* This needs to be set before the includes so they set the right sizes */
 
#ifdef NO_LARGE_FILE_SUPPORT
# ifdef LARGE_FILE_SUPPORT
# undef LARGE_FILE_SUPPORT
# endif
#endif
 
#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
# else
# ifndef ZIP64_SUPPORT
# define ZIP64_SUPPORT
# endif
# endif
 
#endif /* def LARGE_FILE_SUPPORT */
 
/* 2007-02-22 SMS.
* Enable symbolic links according to the available C RTL support,
* unless prohibited by the user defining NO_SYMLINKS.
*/
#if !defined(__VAX) && defined(__CRTL_VER) && __CRTL_VER >= 70301000
# ifndef NO_SYMLINKS
# define SYMLINKS
# endif
#endif
 
#ifdef SYMLINKS
# include <unistd.h>
#endif
 
# include <types.h> /* GRR: experimenting... */
# include <stat.h>
# include <time.h> /* the usual non-BSD time functions */
# include <file.h> /* same things as fcntl.h has */
# include <unixio.h>
# include <rms.h>
 
/* Define maximum path length according to NAM[L] member size. */
# ifndef NAM_MAXRSS
# ifdef NAML$C_MAXRSS
# define NAM_MAXRSS NAML$C_MAXRSS
# else
# define NAM_MAXRSS NAM$C_MAXRSS
# endif
# endif
 
# define _MAX_PATH (NAM_MAXRSS+1) /* to define FILNAMSIZ below */
 
# ifdef RETURN_CODES /* VMS interprets standard PK return codes incorrectly */
# define RETURN(ret) return_VMS(__G__ (ret)) /* verbose version */
# define EXIT(ret) return_VMS(__G__ (ret))
# else
# define RETURN return_VMS /* quiet version */
# define EXIT return_VMS
# endif
# ifdef VMSCLI
# define USAGE(ret) VMSCLI_usage(__G__ (ret))
# endif
# define DIR_BEG '['
# define DIR_END ']'
# define DIR_EXT ".dir"
# ifndef UZ_FNFILTER_REPLACECHAR
/* We use '?' instead of the single char wildcard '%' as "unprintable
* charcode" placeholder, because '%' is valid for ODS-5 names but '?'
* is invalid. This choice may allow easier detection of "unprintables"
* when reading the fnfilter() output.
*/
# define UZ_FNFILTER_REPLACECHAR '?'
# endif
# ifndef DATE_FORMAT
# define DATE_FORMAT DF_MDY
# endif
# define lenEOL 1
# define PutNativeEOL *q++ = native(LF);
# define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols)
# define SCREENWIDTH 80
# define SCREENLWRAP screenlinewrap()
# if (defined(__VMS_VERSION) && !defined(VMS_VERSION))
# define VMS_VERSION __VMS_VERSION
# endif
# if (defined(__VMS_VER) && !defined(__CRTL_VER))
# define __CRTL_VER __VMS_VER
# endif
# if ((!defined(__CRTL_VER)) || (__CRTL_VER < 70000000))
# define NO_GMTIME /* gmtime() of earlier VMS C RTLs is broken */
# else
# if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME))
# define USE_EF_UT_TIME
# endif
# if (!defined(HAVE_STRNICMP) && !defined(NO_STRNICMP))
# define HAVE_STRNICMP
# ifdef STRNICMP
# undef STRNICMP
# endif
# define STRNICMP strncasecmp
# endif
# endif
# ifndef HAVE_STRNICMP /* use our private zstrnicmp() */
# define NO_STRNICMP /* unless explicitly overridden */
# endif
# if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
# define TIMESTAMP
# endif
# define SET_DIR_ATTRIB
# define RESTORE_UIDGID
/* 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
/* Enable "better" unprintable charcodes filtering in fnfilter().
* (On VMS, the isprint() implementation seems to detect 8-bit printable
* characters even for the default "C" locale. A previous localization
* setup by calling setlocale() is not neccessary.) */
# if (!defined(NO_WORKING_ISPRINT) && !defined(HAVE_WORKING_ISPRINT))
# define HAVE_WORKING_ISPRINT
# endif
 
#ifdef NO_OFF_T
typedef long zoff_t;
#else
typedef off_t zoff_t;
#endif
#define ZOFF_T_DEFINED
 
typedef struct stat z_stat;
#define Z_STAT_DEFINED
 
 
#ifdef __DECC
 
/* File open callback ID values. */
# define OPENR_ID 1
 
/* File open callback ID storage. */
extern int openr_id;
 
/* File open callback function. */
extern int acc_cb();
 
/* Option macros for open().
* General: Stream access
*
* Callback function (DEC C only) sets deq, mbc, mbf, rah, wbh, ...
*/
# define OPNZIP_RMS_ARGS "ctx=stm", "acc", acc_cb, &openr_id
 
#else /* !__DECC */ /* (So, GNU C, VAX C, ...)*/
 
# define OPNZIP_RMS_ARGS "ctx=stm"
 
#endif /* ?__DECC */
 
#endif /* !__vmscfg_h */
/programs/fs/unzip60/vms/vmsdefs.h
0,0 → 1,320
/*
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
 
See the accompanying file LICENSE, version 2000-Apr-09 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*---------------------------------------------------------------------------
 
vmsdefs.h
 
Contents of three header files from Joe
Meadows' FILE program. Used by vmsmunch
 
06-Apr-1994 Jamie Hanrahan jeh@cmkrnl.com
Moved "contents of three header files" from
VMSmunch.h to VMSdefs.h .
 
16-Sep-1995 Christian Spieler
Added #pragma (no)member_alignment directives
to achieve compatibility with DEC C and Alpha AXP
 
05-Oct-1995 Christian Spieler
Revised fatdef, fchdef, fjndef to achieve closer
compatibility with DEC's system include header files
supplied with C version 4.0 and newer.
 
10-Oct-1995 Christian Spieler
Use lowercase filenames for vms specific sources
(VMSmunch.? -> vmsmunch.?, VMSdefs.h -> vmsdefs.h)
 
15-Dec-1995 Christian Spieler
Removed the last "tabs" from the source.
 
24-Jun-1997 Onno van der Linden / Chr. Spieler
Modifications to support the VMS port of GNU C 2.x.
 
27-Jul-1999 Chr. Spieler
Added Info-ZIP copyright note for identification.
 
---------------------------------------------------------------------------*/
 
#ifndef __vmsdefs_h
#define __vmsdefs_h 1
 
#if defined(__DECC) || defined(__DECCXX)
#pragma __nostandard
#endif /* __DECC || __DECCXX */
 
#if defined(__DECC) || defined(__DECCXX)
#pragma __member_alignment __save
#pragma __nomember_alignment
#endif /* __DECC || __DECCXX */
 
#if !(defined(__VAXC) || defined(VAXC)) || defined(__GNUC__)
#define __struct struct
#define __union union
#else
#define __struct variant_struct
#define __union variant_union
#endif /* !(__VAXC || VAXC) || __GNUC__ */
 
#ifdef __cplusplus
extern "C" {
#endif
 
/*---------------------------------------------------------------------------
fatdef.h
---------------------------------------------------------------------------*/
 
/* This header file was created by Joe Meadows, and is not copyrighted
in any way. No guarantee is made as to the accuracy of the contents
of this header file. This header file was last modified on Sep. 22th,
1987. (Modified to include this statement) */
 
#define FAT$K_LENGTH 32
#define FAT$C_LENGTH 32
#define FAT$S_FATDEF 32
 
struct fatdef {
__union {
unsigned char fat$b_rtype; /* record type */
__struct {
unsigned fat$v_rtype : 4; /* record type subfield */
unsigned fat$v_fileorg : 4; /* file organization */
} fat$r_rtype_bits;
} fat$r_rtype_overlay;
# define FAT$S_RTYPE 4
# define FAT$V_RTYPE 0
# define FAT$C_UNDEFINED 0
# define FAT$C_FIXED 1
# define FAT$C_VARIABLE 2
# define FAT$C_VFC 3
# define FAT$C_STREAM 4
# define FAT$C_STREAMLF 5
# define FAT$C_STREAMCR 6
# define FAT$S_FILEORG 4
# define FAT$V_FILEORG 4
# define FAT$C_SEQUENTIAL 0
# define FAT$C_RELATIVE 1
# define FAT$C_INDEXED 2
# define FAT$C_DIRECT 3
__union {
unsigned char fat$b_rattrib; /* record attributes */
__struct {
unsigned fat$v_fortrancc : 1;
unsigned fat$v_impliedcc : 1;
unsigned fat$v_printcc : 1;
unsigned fat$v_nospan : 1;
unsigned fat$v_msbrcw : 1;
} fat$r_rattrib_bits;
} fat$r_rattrib_overlay;
# define FAT$V_FORTRANCC 0
# define FAT$M_FORTRANCC 1
# define FAT$V_IMPLIEDCC 1
# define FAT$M_IMPLIEDCC 2
# define FAT$V_PRINTCC 2
# define FAT$M_PRINTCC 4
# define FAT$V_NOSPAN 3
# define FAT$M_NOSPAN 8
# define FAT$V_MSBRCW 4
# define FAT$M_MSBRCW 16
unsigned short int fat$w_rsize; /* record size in bytes */
__union
{
unsigned long int fat$l_hiblk; /* highest allocated VBN */
__struct
{
unsigned short int fat$w_hiblkh; /* high order word */
unsigned short int fat$w_hiblkl; /* low order word */
} fat$r_hiblk_fields;
} fat$r_hiblk_overlay;
__union
{
unsigned long int fat$l_efblk; /* end of file VBN */
__struct
{
unsigned short int fat$w_efblkh; /* high order word */
unsigned short int fat$w_efblkl; /* low order word */
} fat$r_efblk_fields;
} fat$r_efblk_overlay;
unsigned short int fat$w_ffbyte; /* first free byte in EFBLK */
unsigned char fat$b_bktsize; /* bucket size in blocks */
unsigned char fat$b_vfcsize; /* # of control bytes in VFC record */
unsigned short int fat$w_maxrec; /* maximum record size in bytes */
unsigned short int fat$w_defext; /* default extend quantity */
unsigned short int fat$w_gbc; /* global buffer count */
char fat$fill[8];
unsigned short int fat$w_versions;
};
 
#if !(defined(__VAXC) || defined(VAXC)) || defined(__GNUC__)
#define fat$b_rtype fat$r_rtype_overlay.fat$b_rtype
#define fat$v_rtype fat$r_rtype_overlay.fat$r_rtype_bits.fat$v_rtype
#define fat$v_fileorg fat$r_rtype_overlay.fat$r_rtype_bits.fat$v_fileorg
#define fat$b_rattrib fat$r_rattrib_overlay.fat$b_rattrib
#define fat$v_fortrancc fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_fortrancc
#define fat$v_impliedcc fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_impliedcc
#define fat$v_printcc fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_printcc
#define fat$v_nospan fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_nospan
#define fat$v_msbrcw fat$r_rattrib_overlay.fat$r_rattrib_bits.fat$v_msbrcw
#define fat$l_hiblk fat$r_hiblk_overlay.fat$l_hiblk
#define fat$w_hiblkh fat$r_hiblk_overlay.fat$r_hiblk_fields.fat$w_hiblkh
#define fat$w_hiblkl fat$r_hiblk_overlay.fat$r_hiblk_fields.fat$w_hiblkl
#define fat$l_efblk fat$r_efblk_overlay.fat$l_efblk
#define fat$w_efblkh fat$r_efblk_overlay.fat$r_efblk_fields.fat$w_efblkh
#define fat$w_efblkl fat$r_efblk_overlay.fat$r_efblk_fields.fat$w_efblkl
#endif /* !(__VAXC || VAXC) || __GNUC__ */
 
#define __FATDEF_LOADED 1 /* prevent inclusion of DECC's fatdef.h */
 
/*---------------------------------------------------------------------------
fchdef.h
---------------------------------------------------------------------------*/
 
/* This header file was created by Joe Meadows, and is not copyrighted
in any way. No guarantee is made as to the accuracy of the contents
of this header file. This header file was last modified on Sep. 22th,
1987. (Modified to include this statement) */
 
#define FCH$V_BADACL 0x00B
#define FCH$M_BADACL (1 << FCH$V_BADACL)
#define FCH$V_BADBLOCK 0x00E
#define FCH$M_BADBLOCK (1 << FCH$V_BADBLOCK)
#define FCH$V_CONTIG 0x007
#define FCH$M_CONTIG (1 << FCH$V_CONTIG)
#define FCH$V_CONTIGB 0x005
#define FCH$M_CONTIGB (1 << FCH$V_CONTIGB)
#define FCH$V_DIRECTORY 0x00D
#define FCH$M_DIRECTORY (1 << FCH$V_DIRECTORY)
#define FCH$V_ERASE 0x011
#define FCH$M_ERASE (1 << FCH$V_ERASE)
#define FCH$V_LOCKED 0x006
#define FCH$M_LOCKED (1 << FCH$V_LOCKED)
#define FCH$V_MARKDEL 0x00F
#define FCH$M_MARKDEL (1 << FCH$V_MARKDEL)
#define FCH$V_NOBACKUP 0x001
#define FCH$M_NOBACKUP (1 << FCH$V_NOBACKUP)
#define FCH$V_NOCHARGE 0x010
#define FCH$M_NOCHARGE (1 << FCH$V_NOCHARGE)
#define FCH$V_READCHECK 0x003
#define FCH$M_READCHECK (1 << FCH$V_READCHECK)
#define FCH$V_SPOOL 0x00C
#define FCH$M_SPOOL (1 << FCH$V_SPOOL)
#define FCH$V_WRITCHECK 0x004
#define FCH$M_WRITCHECK (1 << FCH$V_WRITCHECK)
#define FCH$V_WRITEBACK 0x002
#define FCH$M_WRITEBACK (1 << FCH$V_WRITEBACK)
 
struct fchdef {
__union {
int fch$$_fill_1;
__struct {
unsigned fch$$_fill_31 : 8;
unsigned fch$v_vcc_state : 3; /* VCC state bits */
unsigned fch$$_fill_32 : 7;
unsigned fch$$_alm_state : 2;
unsigned fch$v_associated : 1; /* ISO 9660 Associated file */
unsigned fch$v_existence : 1; /* ISO 9660 Existence file */
unsigned fch$v_fill_6 : 2;
} fch$r_fill_1_chunks;
__struct {
unsigned fch$v_wascontig : 1;
unsigned fch$v_nobackup : 1 ;
unsigned fch$v_writeback : 1;
unsigned fch$v_readcheck : 1;
unsigned fch$v_writcheck : 1;
unsigned fch$v_contigb : 1;
unsigned fch$v_locked : 1;
unsigned fch$v_contig : 1;
unsigned fch$$_fill_3 : 3;
unsigned fch$v_badacl : 1;
unsigned fch$v_spool : 1;
unsigned fch$v_directory : 1;
unsigned fch$v_badblock : 1;
unsigned fch$v_markdel : 1;
unsigned fch$v_nocharge : 1;
unsigned fch$v_erase : 1;
unsigned fch$$_fill_4 : 1;
unsigned fch$v_shelved : 1;
unsigned fch$v_scratch : 1;
unsigned fch$v_nomove : 1;
unsigned fch$v_noshelvable : 1;
} fch$r_fill_1_bits;
} fch$r_fch_union;
};
 
#if !(defined(__VAXC) || defined(VAXC)) || defined(__GNUC__)
#define fch$v_vcc_state fch$r_fch_union.fch$r_fill_1_chunks.fch$v_vcc_state
#define fch$v_associated fch$r_fch_union.fch$r_fill_1_chunks.fch$v_associated
#define fch$v_existence fch$r_fch_union.fch$r_fill_1_chunks.fch$v_existence
#define fch$v_wascontig fch$r_fch_union.fch$r_fill_1_bits.fch$v_wascontig
#define fch$v_nobackup fch$r_fch_union.fch$r_fill_1_bits.fch$v_nobackup
#define fch$v_writeback fch$r_fch_union.fch$r_fill_1_bits.fch$v_writeback
#define fch$v_readcheck fch$r_fch_union.fch$r_fill_1_bits.fch$v_readcheck
#define fch$v_writcheck fch$r_fch_union.fch$r_fill_1_bits.fch$v_writcheck
#define fch$v_contigb fch$r_fch_union.fch$r_fill_1_bits.fch$v_contigb
#define fch$v_locked fch$r_fch_union.fch$r_fill_1_bits.fch$v_locked
#define fch$v_contig fch$r_fch_union.fch$r_fill_1_bits.fch$v_contig
#define fch$v_badacl fch$r_fch_union.fch$r_fill_1_bits.fch$v_badacl
#define fch$v_spool fch$r_fch_union.fch$r_fill_1_bits.fch$v_spool
#define fch$v_directory fch$r_fch_union.fch$r_fill_1_bits.fch$v_directory
#define fch$v_badblock fch$r_fch_union.fch$r_fill_1_bits.fch$v_badblock
#define fch$v_markdel fch$r_fch_union.fch$r_fill_1_bits.fch$v_markdel
#define fch$v_nocharge fch$r_fch_union.fch$r_fill_1_bits.fch$v_nocharge
#define fch$v_erase fch$r_fch_union.fch$r_fill_1_bits.fch$v_erase
#define fch$v_shelved fch$r_fch_union.fch$r_fill_1_bits.fch$v_shelved
#define fch$v_scratch fch$r_fch_union.fch$r_fill_1_bits.fch$v_scratch
#define fch$v_nomove fch$r_fch_union.fch$r_fill_1_bits.fch$v_nomove
#define fch$v_noshelvable fch$r_fch_union.fch$r_fill_1_bits.fch$v_noshelvable
#endif /* !(__VAXC || VAXC) || __GNUC__ */
 
#define __FCHDEF_LOADED 1 /* prevent inclusion of DECC's fchdef.h */
 
/*---------------------------------------------------------------------------
fjndef.h
---------------------------------------------------------------------------*/
 
/* This header file was created by Joe Meadows, and is not copyrighted
in any way. No guarantee is made as to the accuracy of the contents
of this header file. This header file was last modified on Sep. 22th,
1987. (Modified to include this statement) */
 
#define FJN$M_ONLY_RU 1
#define FJN$M_RUJNL 2
#define FJN$M_BIJNL 4
#define FJN$M_AIJNL 8
#define FJN$M_ATJNL 16
#define FJN$M_NEVER_RU 32
#define FJN$M_JOURNAL_FILE 64
#define FJN$S_FJNDEF 1
struct fjndef {
unsigned fjn$v_only_ru : 1;
unsigned fjn$v_rujnl : 1;
unsigned fjn$v_bijnl : 1;
unsigned fjn$v_aijnl : 1;
unsigned fjn$v_atjnl : 1;
unsigned fjn$v_never_ru : 1;
unsigned fjn$v_journal_file : 1;
unsigned fjn$v_fill_7 : 1;
} ;
 
#define __FJNDEF_LOADED 1 /* prevent inclusion of DECC's fjndef.h */
 
/*---------------------------------------------------------------------------*/
 
#ifdef __cplusplus
}
#endif
 
#if defined(__DECC) || defined(__DECCXX)
#pragma __member_alignment __restore
#endif /* __DECC || __DECCXX */
 
#if defined(__DECC) || defined(__DECCXX)
#pragma __standard
#endif /* __DECC || __DECCXX */
 
#endif /* !__vmsdefs_h */
/programs/fs/unzip60/vms/zlib.h
0,0 → 1,7
/* 2008-07-26 SMS.
* VMS-specific ZLIB.H jacket header file.
*
* The logical name INCL_ZLIB must point to the ZLIB source directory.
*/
 
#include "INCL_ZLIB:ZLIB.H"