summaryrefslogtreecommitdiff
path: root/cmsmvs
diff options
context:
space:
mode:
authorHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:51:52 +0900
committerHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:51:52 +0900
commit49807896eda1a7081cce1a7a134fb0071f5e7eeb (patch)
treeaef757b2abf225284bf0ccb0df3a7b7aab6765aa /cmsmvs
parent3101b2a7be8f0e3cc6ff469ce2597945c862264b (diff)
downloadzip-49807896eda1a7081cce1a7a134fb0071f5e7eeb.tar.gz
zip-49807896eda1a7081cce1a7a134fb0071f5e7eeb.tar.bz2
zip-49807896eda1a7081cce1a7a134fb0071f5e7eeb.zip
Diffstat (limited to 'cmsmvs')
-rw-r--r--cmsmvs/README.CMS434
-rw-r--r--cmsmvs/README.MVS92
-rw-r--r--cmsmvs/README.MVS.LE286
-rw-r--r--cmsmvs/cczip.exec124
-rw-r--r--cmsmvs/cms.c34
-rw-r--r--cmsmvs/cmsmvs.c442
-rw-r--r--cmsmvs/cmsmvs.h134
-rw-r--r--cmsmvs/cstat.h53
-rw-r--r--cmsmvs/mc.exec95
-rw-r--r--cmsmvs/mvs.c221
-rw-r--r--cmsmvs/mvs.h40
-rw-r--r--cmsmvs/mvs.mki128
-rw-r--r--cmsmvs/pipzip.rexx27
-rw-r--r--cmsmvs/zip.exec66
-rw-r--r--cmsmvs/zip.makefile22
-rw-r--r--cmsmvs/zipcloak.exec66
-rw-r--r--cmsmvs/zipmvsc.job95
-rw-r--r--cmsmvs/zipname.conven200
-rw-r--r--cmsmvs/zipnote.exec66
-rw-r--r--cmsmvs/zipsplit.exec66
-rw-r--r--cmsmvs/zipup.h18
-rw-r--r--cmsmvs/zipvmc.exec50
22 files changed, 2759 insertions, 0 deletions
diff --git a/cmsmvs/README.CMS b/cmsmvs/README.CMS
new file mode 100644
index 0000000..a4425da
--- /dev/null
+++ b/cmsmvs/README.CMS
@@ -0,0 +1,434 @@
+Using ZIP and UNZIP on VM/CMS
+=============================
+
+
+Installing executables
+----------------------
+
+The following CMS MODULEs are available:
+ ZIP
+ ZIPNOTE
+ ZIPCLOAK
+ ZIPSPLIT
+ UNZIP
+
+In addition to these, each MODULE file also has an EXEC with the same
+name. These EXECs are front-ends to the MODULES that will attempt to
+set up the required runtime libraries before running the MODULE.
+All the EXECs are identical. Only their names are different.
+They are stored as plain text files.
+
+The CMS MODULE files have been packed using the COPYFILE command to
+allow their file format to be properly restored, since variable length
+binary files will not currently unzip properly (see below for details).
+The MODULEs are shipped with a filetype or extension of CMO (for CMS
+MODULE). Their names may vary on the distribution disk to indicate
+their level, etc.
+
+To restore them to executable MODULEs on CMS, do the following:
+ 1. Upload them to CMS with a Fixed record length with LRECL 1024.
+ Example, from a DOS or OS/2 window, type this:
+ SEND unzip.cmo A:unzip module a (RECFM F LRECL 1024
+
+ Example, using FTP from CMS, type this:
+ BINARY FIXED 1024
+ GET unzip.cmo unzip.module.a
+
+ Note: Replace "unzip.cmo" with the actual name.
+
+ 2. Use COPYFILE to unpack the file.
+ Example, in CMS type this:
+ COPYFILE UNZIP MODULE A (UNPACK REPLACE OLDDATE
+
+ 3. Repeat steps 1-2 for each of the programs.
+
+ 4. Build the ZIPINFO module by typing this:
+ COPYFILE UNZIP MODULE A ZIPINFO MODULE A (OLDDATE
+
+ 5. Upload the EXECs to CMS as text files (with ASCII-to-EBCDIC
+ translation).
+ Example, from a DOS or OS/2 window, type this:
+ SEND unzip.exc A:unzip exec a (CRLF
+
+ Example, using FTP from CMS, type this:
+ GET unzip.exc unzip.exec.a
+
+ 6. Repeat steps 4 for each of the EXECs.
+
+
+Preparing the environment
+-------------------------
+
+The executables provided were compiled with IBM C 3.1.0 and
+require the the Language Environment (LE) runtime libraries.
+
+To provide access to the runtime libraries:
+ 1. Link to the disk containing the Language Environment files,
+ if necessary.
+
+ 2. Use the command "GLOBAL LOADLIB SCEERUN"
+
+ These commands can be placed in your PROFILE EXEC.
+
+ Note: EXECs have been provided called ZIP, UNZIP, etc. that
+ issue the GLOBAL LOADLIB statement. This was done to alleviate
+ frustration of users that don't have the GLOBAL LOADLIB statement
+ in their PROFILE EXEC. These EXECs may require changing for
+ your system.
+
+ Unfortunately, there is no way, using IBM C, to produce a MODULE
+ that doesn't require a runtime library.
+
+
+Testing
+-------
+
+To test the MODULEs, just type ZIP or UNZIP. They should
+show help information on using the commands.
+
+If you see something like this:
+ DMSLIO201W The following names are undefined:
+ CEEEV003
+ DMSABE155T User abend 4093 called from 00DCD298 reason code 000003EB
+
+Then you don't have access to the proper runtime libraries, as
+described above.
+
+Here is additional information on the ZIP and UNZIP programs that
+may assist support personnel:
+ - Compiled with IBM C V3R1M0 on VM/ESA 2.2.0 with
+ CMS level 13 Service Level 702.
+
+ - Require the SCEERUN LOADLIB runtime library. This is
+ part of the Language Environment (LE).
+
+ - Linked with options RMODE ANY AMODE ANY RLDSAVE.
+
+If you continue to have trouble, report the problem to Zip-Bugs
+(see the bottom of this document).
+
+
+
+Compiling the source on VM/CMS
+------------------------------
+
+The source has been successfully compiled previously using
+C/370 2.1 and 2.2. The source has been recently compiled using
+IBM C 3.1.0 on VM/ESA 2.2.0 with CMS level 13. I don't have
+access to an MVS system so the code hasn't been tested there
+in a while.
+
+ 1. Unzip the source files required for CMS. The root-level files
+ inside the ZIP file and the files in the CMSMVS subdirectory are
+ needed. Example (use both commands):
+ unzip -aj zip23.zip -x */* -dc
+ unzip -aj zip23.zip cmsmvs/* -dc
+
+ This example unzips the files to the C-disk, while translating
+ character data and ignoring paths.
+
+ If you don't already have a working UNZIP MODULE on CMS you will
+ have to unzip the files on another system and transport them
+ to CMS. All the required files are plain text so they can
+ be transferred with ASCII-to-EBCDIC translations.
+
+ 2. Repeat step 1 with the zip file containing the UNZIP code.
+ Unzip the files to a different disk than the disk used for the ZIP
+ code.
+
+ 3. To compile the ZIP code, run the supplied CCZIP EXEC.
+ To compile the UNZIP code, run the supplied CCUNZIP EXEC.
+
+NOTE:
+Some of the ZIP and UNZIP source files have the same name. It is
+recommended that you keep the source from each on separate disks and
+move the disk you are building from ahead of the other in the search
+order.
+
+For example, you may have a 192 disk with the ZIP source code and
+a 193 disk with the UNZIP source code. To compile ZIP, access
+the 192 disk as B, then run CCZIP. This will create the following
+modules: ZIP, ZIPNOTE, ZIPSPLIT, ZIPCLOAK.
+
+To compile UNZIP, access 193 as B, then run CCUNZIP. This will create
+the following modules: UNZIP, ZIPINFO (a copy of UNZIP).
+
+
+=========================================================================
+
+
+Using ZIP/UNZIP
+---------------
+
+Documentation for the commands is in MANUAL NONAME (for ZIP) and in
+UNZIP DOC UNZIP. INFOZIP DOC describes the use of the -Z option of
+UNZIP.
+
+The rest of this section explains special notes concerning the VM/CMS
+version of ZIP and UNZIP.
+
+
+Filenames and directories
+-------------------------
+
+ 1. Specifying filenames
+
+ a. When specifying CMS files, use filename.filetype.filemode format
+ (separate the three parts of the name with a period and use no
+ spaces). Example: profile.exec.a
+
+ Unfortunately, this prevents you from using ZIP from
+ FILELIST. To unzip a zip file, however, you can type something
+ like this next to it in FILELIST:
+ unzip /n -d c
+
+ This will unzip the contents of the current file to a C-disk.
+
+ b. It is possible to use DD names with ZIP and UNZIP on CMS, though
+ it can be cumbersome. Example:
+ filedef out disk myzip zip a
+ zip dd:out file1.txt file2.txt
+
+ While you can also use a DD name for the input files, ZIP
+ currently does not correctly resolve the filename and will
+ store something like "dd:in" inside the ZIP file. A file stored
+ in this manor cannot easily be unzipped, as "dd:in" is an invalid
+ filename.
+
+ c. In places where a directory name would be used on a PC, such as
+ for the ZIP -b (work path) option or the UNZIP -d (destination
+ path) options, use a filemode letter for CMS. For example,
+ to unzip files onto a C-disk, you might type something like this:
+ unzip myzip.zip -d c
+
+ Currently, ZIP uses the A-disk for work files. When zipping
+ large files, you may want to specify a larger disk for work files.
+ This example will use a C-disk for work files.
+ zip -b C myzip.zip.c test.dat.a
+
+
+ 2. Filename conversions
+
+ a. Filemode letters are never stored into the zip file or take from
+ a zip file. Only the filename and filetype are used.
+ ZIP removes the filemode when storing the filename into the
+ zip file. UNZIP assumes "A" for the filemode unless the -d
+ option is used.
+
+ b. When unzipping, any path names are removed from the fileid
+ and the last two period-separated words are used as the
+ filename and filetype. These are truncated to a maximum of
+ eight characters, if necessary. If the filetype (extension)
+ is missing, then UNZIP uses "NONAME" for the filetype.
+ Any '(' or ')' characters are removed from the fileid.
+
+ c. All files are created in upper-case. Files in mixed-case
+ cannot currently be stored into a ZIP file.
+
+ d. Shared File System (SFS) directories are not supported.
+ Files are always accessed by fn.ft.fm. To use an SFS disk,
+ Assign it a filemode, then it can be used.
+
+
+ 3. Wildcards in file names
+
+ a. Wildcards are not supported in the zip filename. The full
+ filename of the zip file must be given (but the .zip is not
+ necessary). So, you can't do this:
+ unzip -t *.zip
+
+ b. Wildcards CAN be used with UNZIP to select (or exclude) files
+ inside a zip file. Examples:
+ unzip myzip *.c - Unzip all .c files.
+ unzip myzip *.c -x z*.c - Unzip all .c files but those
+ starting with Z.
+
+ c. Wildcards cannot currently be used to select files with ZIP.
+ So, you can't do this:
+ zip -a myzip *.exec
+
+ I expect to fix this for CMS in the future.
+
+
+ 4. File timestamps
+
+ a. The dates and times of files being zipped or unzipped are not
+ currently read or set. When a file is zipped, the timestamp
+ inside the zip file will always be the current system date and
+ time. Likewise, when unzipping, the date and time of files
+ being unzipped will always be the current system date/time.
+
+ b. Existing files are assumed to be newer than files inside a zip
+ file when using the -f freshen option of UNZIP. This will prevent
+ overwriting files that may be newer than the files inside the
+ zip file, but also effectively prevents the -f option from working.
+
+
+ 5. ASCII, EBCDIC, and binary data
+
+ Background
+ ----------
+ Most systems create data files as just a stream of bytes. Record
+ breaks happen when certain characters (new line and/or carriage
+ return characters) are encountered in the data. How to interpret
+ the data in a file is up to the user. The system must be told
+ to either notice new line characters in the data or to assume
+ that the data in the file is binary data and should be read or
+ written as-is.
+
+ CMS and MVS are record-based systems. All files are composed
+ of data records. These can be stored in fixed-length files or
+ in variable length files. With fixed-length files, each record
+ is the same length. The record breaks are implied by the
+ LRECL (logical record length) attribute associated with the file.
+ With variable-length files, each record contains the length of
+ that record. The separation of records are not part of the
+ data, but part of the file structure.
+
+ This means you can store any type of data in either type of file
+ structure without having to worry about the data being interpreted
+ as a record break. Fixed-length files may have padding at the
+ end of the file to make up a full record. Variable-length files
+ have no padding, but require extra record length data be stored
+ with the file data.
+
+ Storing fixed-length files into a zip file is simple, because all
+ the data can just be dumped into the zip file and the record
+ format (RECFM) and logical record length (LRECL) can be stored
+ in the extra data area of the zip file so they can be restored
+ when UNZIP is used.
+
+ Storing variable-length data is harder. There is no place to put
+ the record length data needed for each record of the file. This
+ data could be written to the zip file as the first two bytes of
+ each record and interpreted that way by UNZIP. That would make
+ the data unusable on systems other than CMS and MVS, though.
+
+ Currently, there isn't a solution to this problem. Each record is
+ written to the zip file and the record length information is
+ discarded. Binary data stored in variable-length files can't be put
+ into a zip file then later unzipped back into the proper records.
+ This is fine for binary data that will be read as a stream of bytes
+ but not OK where the records matter, such as with CMS MODULEs.
+
+ If the data is text (character data), there is a solution.
+ This data can be converted into ASCII when it's stored into
+ a zip file. The end of each record is now marked in the file
+ by new line characters. Another advantage of this method is
+ that the data is now accessible to non-EBCDIC systems. When
+ the data is unzipped on CMS or MVS, it is converted back into
+ EBCDIC and the records are recreated into a variable-length file.
+
+
+ So, here's what we have...
+
+ a. To store readable text data into a zip file that can be used
+ on other platforms, use the -a option with ZIP to convert the
+ data to ASCII. These files will unzip into variable-length
+ files on CMS and should not contain binary data or corruption
+ may occur.
+
+ b. Files that were zipped on an ASCII-based system will be
+ automatically translated to EBCDIC when unzipped. To prevent
+ this (to unzip binary data on CMS that was sent from an
+ ASCII-based system), use the -B option with UNZIP to force Binary
+ mode. To zip binary files on CMS, use the -B option with ZIP to
+ force Binary mode. This will prevent any data conversions from
+ taking place.
+
+ c. When using the ZIP program without specifying the "-a" or "-B"
+ option, ZIP defaults to "native" (EBCDIC) mode and tries to
+ preserve the file information (RECFM, LRECL, and BLKSIZE). So
+ when you unzip a file zipped with ZIP under CMS or MVS, UNZIP
+ restores the file info. The output will be fixed-length if the
+ original was fixed and variable-length if the original was
+ variable.
+
+ If UNZIP gives a "write error (disk full?)" message, you may be
+ trying to unzip a binary file that was zipped as a text file
+ (without using the -B option)
+
+
+ Summary
+ -------
+ Here's how to ZIP the different types of files.
+
+ RECFM F text
+ Use the -a option with ZIP to convert to ASCII for use with other
+ platforms or no options for use on EBCDIC systems only.
+
+ RECFM V text
+ Use the -a option with ZIP to convert to ASCII for use with other
+ platforms or no options for use on EBCDIC systems only.
+
+
+ RECFM F binary
+ Use the -B option with ZIP (upper-case "B").
+
+ RECFM V binary
+ Use the -B option with ZIP. Can be zipped OK but the record
+ structure is destroyed when unzipped. This is OK for data files
+ read as binary streams but not OK for files such as CMS MODULEs.
+
+
+ 6. Character Sets
+
+ If you are used to running UNZIP on systems like UNIX, DOS, OS/2 or
+ Windows, you will may have some problems with differences in the
+ character set.
+
+ There are a number of different EBCDIC code pages, like there are a
+ number of different ASCII code pages. For example, there is a US
+ EBCDIC, a German EBCDIC, and a Swedish EBCDIC. As long as you are
+ working with other people who use the same EBCDIC code page, you
+ will have no trouble. If you work with people who use ASCII, or who
+ use a different EBCDIC code page, you may need to do some
+ translation.
+
+ UNZIP translates ASCII text files to and from Open Systems EBCDIC
+ (IBM-1047), which may not be the EBCDIC that you are using. For
+ example, US EBCDIC (IBM-037) uses different character codes for
+ square brackets. In such cases, you can use the ICONV utility
+ (supplied with IBM C) to translate between your EBCDIC character set
+ and IBM-1047.
+
+ If your installation does not use IBM-1047 EBCDIC, messages from
+ UNZIP may look a little odd. For example, in a US EBCDIC
+ installation, an opening square bracket will become an i-acute and a
+ closing square bracket will become a u-grave.
+
+ The supplied ZIP and UNZIP EXECs attempt to correct this by setting
+ CMS INPUT and OUTPUT translations to adjust the display of left and
+ right brackets. You may need to change this if brackets don't
+ display correctly on your system.
+
+
+ 7. You can unzip using VM/CMS PIPELINES so unzip can be used as
+ a pipeline filter. Example:
+ 'PIPE COMMAND UNZIP -p test.zip george.test | Count Lines | Cons'
+
+
+
+
+Please report all bugs and problems to:
+ Zip-Bugs@lists.wku.edu
+
+
+-----------------------------------------------------------------------
+Original CMS/MVS port by George Petrov.
+e-mail: c888090@nlevdpsb.snads.philips.nl
+tel: +31-40-781155
+
+Philips C&P
+Eindhoven
+The Netherlands
+
+-----------------------------------------------------------------------
+Additional fixes and README re-write (4/98) by Greg Hartwig.
+e-mail: ghartwig@ix.netcom.com
+ ghartwig@vnet.ibm.com
+
+-----------------------------------------------------------------------
+Additional notes from Ian E. Gorman.
+e-mail: ian@iosphere.net
+
diff --git a/cmsmvs/README.MVS b/cmsmvs/README.MVS
new file mode 100644
index 0000000..4d451db
--- /dev/null
+++ b/cmsmvs/README.MVS
@@ -0,0 +1,92 @@
+Thank you for trying this first port of ZIP for VM/CMS and MVS!
+
+
+ Using under MVS:
+ ---------------------------
+
+1. To use the Info-ZIP's ZIP under MVS you need:
+
+ - C/370 ver 2.1 compiler or another compatible compiler supporting
+ long names for function/variable names.
+
+2. To compile the program under MVS do :
+
+ - unzip all the files from zip22.zip file. They are stored as
+ ASCII format so you have to unzip them first on PC or other
+ system that already have UNZIP, and then upload them to the
+ mainframe with ASCII to EBCDIC conversion.
+
+ - Copy all the .C files in the PDS called youruserid.ZIP.C
+
+ - Copy all the .H files in the PDS called youruserid.ZIP.H
+
+ - adjust the job ZIPMVSC.JOB to work on your size. Change my
+ userid - C888090 to yours
+
+ - execute the job ZIPMVSC to compile and link all the sources.
+
+ - maybe you have to preallocate PDS datasets named:
+ youruserid.ZIP.OBJ and youruserid.ZIP.LOAD
+
+ - execute ZIPVMC to compile and link all the sources.
+
+ - if everything is ok you will get an ZIP MODULE
+
+ - the warnings about the duplicated ASCII and EBCDIC symbols
+ are OK :-)
+
+3. Using ZIP
+
+ - Just read MANUAL
+
+ - A few exceptions concerning MVS
+
+ 3.1. if you want to make a portable zip file that is to be unzipped
+ on ASCII based systems use the -a option
+
+ 3.2. If you want to zip the input files as binary ebcdic files
+ use the -B (capital letter) option
+
+ 3.3. The date/end the time of the input files is set in the zip's
+ dir to the current system date/time
+
+ 3.4. Without specifying the "-a" or "-B" option, the ZIP program
+ defaults to "native" (EBCDIC) mode and tries to preserve the
+ file information (LRECL,BLKSIZE..)
+ So when you UNZIP a file zipped with ZIP under VM/MVS it
+ restores the file info.
+
+ There currently some problems with file with RECFM=V*
+ I don't save the length of each record yet :-)
+
+ 3.5. No wildcards are supported as input file names:
+
+ So you CAN'T use things like: zip myzip *.c
+
+ 3.6. You can use DD names for zipfilename for example:
+
+ under tso/rexx:
+
+ "alloc fi(input) da('myzip.zip')"
+ "zip dd:input file1.txt file2.txt ..."
+
+ under Batch:
+
+ //MYZIP JOB (account)
+ //STEP1 EXEC PGM=ZIP,PARM='dd:input file1.txt file2.txt'
+ //STEPLIB DD DSN=userid.UNZIP.LOAD,DISP=SHR
+ //INPUT DD DSN=userid.MYZIP.ZIP,DISP=NEW,
+ // SPACE=(15000,(15000,10000),RLSE),
+ // DCB=(LRECL=80,RECFM=F)
+ //SYSPRINT DD SYSOUT=*
+
+
+Please report all bugs and problems to :
+ zip-bugs@lists.wku.edu
+
+That's all for now.
+
+Have fun!
+
+
+George Petrov
diff --git a/cmsmvs/README.MVS.LE b/cmsmvs/README.MVS.LE
new file mode 100644
index 0000000..f7dcb8a
--- /dev/null
+++ b/cmsmvs/README.MVS.LE
@@ -0,0 +1,286 @@
+Notes on Zip under MVS Language Environment (LE).
+
+First see README.MVS. This note describes just one beta test on OS/390
+V2R5 using IBM's C compiler (5647A01), V2R4. The major difference is
+the use of LE on the beta site, together with some MVS native mode
+fixes. Changes have not been tested on CMS.
+
+Some of the notes are to clarify things that were not clear from the
+MANUAL or README.MVS.
+
+1. By default, IBM C generates the same csect name for each input
+ source. The prelink stage does not rename them and the linkage
+ editor throws away all but the first occurrence of each duplicate.
+ Oops, my code just disappeared :(.
+
+ To get around this "feature", compile with the CSECT option to
+ force sensible names on the code and data sections of each csect.
+ The name of the static data csect defaults to the source name in
+ lower case, the code csect defaults to the source name in upper
+ case. These csect names still have to be unique, they cannot be
+ the same as function names. Of course, several csects have a
+ function which is the same name as the source in lower case, not
+ exactly an unusual occurrence. Therefore to make the csect name
+ unique, some of the sources have
+
+ #ifdef MVS
+ # pragma csect(STATIC,xxxx_s)
+ #endif
+
+ Where xxxx is an abbreviation of the source name. There has to be
+ a better way!
+
+2. The prelink step always gets cond code 4. It complains about
+ unresolved references, ignore it unless the linker also complains.
+ Prelink also complains about duplicate @@PPA2 sections and so does
+ the linker, but it seems to do no harm. Compile and link steps
+ should get 0, just prelink gets 4. See JCL at the bottom.
+
+3. Under MVS native mode (not Open Edition), tmpnam() returns a quoted
+ name of 5 qualifiers. The first is a HLQ chosen according to the
+ MVS LE algorithm (see below), the other qualifiers are time stamps.
+ If running on MVS and tmpnam() returns a quoted name with at leat
+ one '.', it is only safe to let the user change the high level
+ qualifier. Therefore -b insists on a single qualifier without '.'
+ in the MVS native environment.
+
+4. In Open Edition (OE) mode, the manual says that tmpnam() returns a
+ fully qualified name in directory TMPDIR or /tmp if TMPDIR is not
+ set. There is no point in zip trying to override that name so -b
+ is ignored in MVS OE mode (untested). The user should specify
+ environment variable TMPDIR instead.
+
+5. The MVS LE algorithm for choosing the high level qualifier for
+ native filenames is interesting, as in "May you live in interesting
+ times". The HLQ varies according to the environment the program is
+ running in, sometimes it is userid, sometimes it is TSO prefix.
+ See OS/390 C/C++ Programming Guide, Using a Data Set Name,
+ somewhere around section 2.9.
+
+ If in doubt, use fully qualified and quoted names. Instead of
+ archive.zip, use 'prefix.archive.zip'. For input files, instead of
+ filename, use 'prefix.filename'. For PARM= in JCL, double up the
+ quotes. You even have to quote filenames in stdin.
+
+6. If your PARM includes any '/', make sure the PARM starts with '/'.
+ LE assumes anything before the first '/' is LE run time parameters.
+ It does no harm to always code a leading '/' for LE parms.
+
+7. JCL limits a PARM= to 100 characters total with approx. 65 on a
+ single line. Alas the syntax for continuing PARM= always embeds an
+ extra ',' somewhere in the parameters that the program finally
+ gets. No workaround, limit your PARM to a single line. With the
+ extra quotes around filenames, that does not leave much room. In
+ most cases, you will have to use '-@' to read the list of filenames
+ from SYSIN (stdin), it will not fit on a single PARM line.
+
+8. Filenames can be dataset names or you can refer to a ddname with
+ 'DD:name', case insensitive for external files, case sensitive for
+ OE files. You can even specify 'dd:name(mem)'. No wildcards, to
+ zip a complete pds you have to specify each member individually.
+ Directory recursion in OE does not appear to work at the moment.
+
+9. Zip attempts to map MVS filenames to Unix style names. It did not
+ work correctly for quoted names, fixed. Although you can pick up
+ an external (non-OE) file with a name using any case, be aware that
+ the mapping to a Unix style name faithfully follows the case you
+ supply.
+
+10. The archive file was being created with recfm=V and lrecl=32760.
+ 32760 is not valid for recfm=V under MVS, I originally changed it
+ to lrecl=32756. Then zip broke trying to fseek() over a record
+ boundary, I do not know whether this was a zip or LE bug. Trial
+ and error showed that recfm=U with byteseek seems to work on MVS.
+ No BDW or RDW, just a byte stream. The blocksize is always 6144.
+
+ NOTE: This is an incompatible change from the previous beta,
+ archive files used to be recfm=V. That should not matter
+ because we just transfer the data, ignoring BDW and RDW
+ anyway.
+
+11. Zip used to complain about preallocated but empty archives, wrong
+ length records, no signature etc. The usual IBM/360 problem of no
+ end of file marker in a new, unopened dataset. Fixed, see routine
+ readzipfile in zipfile.c for the gory details. PARM= works fine.
+
+12. Several source files have records that are more than 80 bytes long.
+ It works if you transfer to mainframe datasets with a larger lrecl,
+ I used recfm=fb,lrecl=120 for the .C and .H files. To compile with
+ anything longer than 72 bytes, you need MVS C options NOMARGINS and
+ NOSEQUENCE (NOMAR,NOSEQ).
+
+13. cmsmvs was still using zname instead of name for open. Fixed.
+
+14. zip has to jump through a lot of hoops to see if an existing
+ zipfile actually contains data. A side effect of this is that
+ creating a zipfile with the RLSE parameter is a waste of time.
+
+Keith Owens <kaos@ocs.com.au>. Not a maintainer, just a beta tester.
+Mon Sep 14 19:31:30 EST 1998
+
+
+Sample JCL to compile Zip under MVS LE. You might need a large region,
+I used REGION=128M on the job card. Also watch the output lines,
+75,000 with OPT(2), 100,000+ with OPT(2) replaced with DEF(DEBUG). You
+need to allocate prefix.ZIP.C.OBJ (recfm=FB, lrecl=80) and
+prefix.ZIP.LOAD (recfm=U, blksize is site defined).
+
+//CBC JCLLIB ORDER=CBC.SCBCPRC
+//ZIP EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(ZIP)',
+// OUTFILE='prefix.ZIP.C.OBJ(ZIP),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//CRYPT EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(CRYPT)',
+// OUTFILE='prefix.ZIP.C.OBJ(CRYPT),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//TTYIO EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(TTYIO)',
+// OUTFILE='prefix.ZIP.C.OBJ(TTYIO),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//TREES EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(TREES)',
+// OUTFILE='prefix.ZIP.C.OBJ(TREES),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//DEFLATE EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(DEFLATE)',
+// OUTFILE='prefix.ZIP.C.OBJ(DEFLATE),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//FILEIO EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(FILEIO)',
+// OUTFILE='prefix.ZIP.C.OBJ(FILEIO),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//GLOBALS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(GLOBALS)',
+// OUTFILE='prefix.ZIP.C.OBJ(GLOBALS),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//UTIL EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(UTIL)',
+// OUTFILE='prefix.ZIP.C.OBJ(UTIL),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//CRC32 EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(CRC32)',
+// OUTFILE='prefix.ZIP.C.OBJ(CRC32),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//CRCTAB EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(CRCTAB)',
+// OUTFILE='prefix.ZIP.C.OBJ(CRCTAB),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//ZIPFILE EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(ZIPFILE)',
+// OUTFILE='prefix.ZIP.C.OBJ(ZIPFILE),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//ZIPUP EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(ZIPUP)',
+// OUTFILE='prefix.ZIP.C.OBJ(ZIPUP),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//CMSMVS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(CMSMVS)',
+// OUTFILE='prefix.ZIP.C.OBJ(CMSMVS),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//MVS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
+// INFILE='prefix.ZIP.C(MVS)',
+// OUTFILE='prefix.ZIP.C.OBJ(MVS),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
+// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
+//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
+//PLINK EXEC PROC=EDCPL,
+// OUTFILE='prefix.ZIP.LOAD(ZIP),DISP=SHR',
+// PREGSIZ=6M,
+// PPARM='NONCAL,MAP,MEMORY',
+// LPARM='LIST,MAP,XREF'
+//PLKED.SYSIN DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIP)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRYPT)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(TREES)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(DEFLATE)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(FILEIO)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(GLOBALS)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(UTIL)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRC32)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRCTAB)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIPFILE)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIPUP)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(MVS)
+// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(CMSMVS)
+//LKED.SYSLIB DD DISP=SHR,DSN=CEE.SCEELKED
+//SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(2,2))
+//
+
+Sample JCL to zip the mainframe .C and .H files as ASCII (-a). Delete
+any existing archive first, point the temporary file at a particular
+prefix (-b), use 'prefix.ARCHIVE.ZIP' for the archive file, read the
+list of files to zip from stdin (SYSIN).
+
+//DELETE EXEC PGM=IDCAMS
+//SYSPRINT DD SYSOUT=*
+//SYSIN DD *
+ DELETE prefix.ARCHIVE.ZIP
+ SET MAXCC = 0
+//ZIP EXEC PGM=ZIP,
+// PARM='/-a -v -b temppref ''prefix.ARCHIVE.ZIP'' -@'
+//STEPLIB DD DSN=prefix.ZIP.LOAD,DISP=SHR
+//SYSPRINT DD SYSOUT=*
+//SYSOUT DD SYSOUT=*
+//CEEDUMP DD SYSOUT=*
+//ZIPC DD DISP=SHR,DSN=prefix.ZIP.C
+//ZIPH DD DISP=SHR,DSN=prefix.ZIP.H
+//SYSIN DD *
+dd:zipc(api)
+dd:zipc(cms)
+dd:zipc(cmsmvs)
+dd:zipc(crctab)
+dd:zipc(crc32)
+dd:zipc(crypt)
+dd:zipc(deflate)
+dd:zipc(fileio)
+dd:zipc(globals)
+dd:zipc(mktime)
+dd:zipc(mvs)
+dd:zipc(trees)
+dd:zipc(ttyio)
+dd:zipc(util)
+dd:zipc(zip)
+dd:zipc(zipcloak)
+dd:zipc(zipfile)
+dd:zipc(zipnote)
+dd:zipc(zipsplit)
+dd:zipc(zipup)
+dd:ziph(api)
+dd:ziph(cmsmvs)
+dd:ziph(crypt)
+dd:ziph(cstat)
+dd:ziph(ebcdic)
+dd:ziph(mvs)
+dd:ziph(revision)
+dd:ziph(stat)
+dd:ziph(tailor)
+dd:ziph(ttyio)
+dd:ziph(zip)
+dd:ziph(ziperr)
+dd:ziph(zipup)
diff --git a/cmsmvs/cczip.exec b/cmsmvs/cczip.exec
new file mode 100644
index 0000000..afa97d0
--- /dev/null
+++ b/cmsmvs/cczip.exec
@@ -0,0 +1,124 @@
+/* CCZIP EXEC Compile zip for VM/CMS */
+/* Author: George Petrov, 11 Apr 1995 (VMCOMPIL EXEC) */
+/* Modified for IBM C V3R1 by Ian E. Gorman, 2 Nov 1998
+ Facilities for compiling and testing were provided by
+ OmniMark Technologies Corporation, Ottawa, Canada
+*/
+Address Command
+Signal On Error
+
+/* Allow longnames, compile re-entrant code.
+ globals.c and cmsmvs.c require EXTENDED features */
+CCopts = 'LONGNAME RENT LANGLVL(EXTENDED) NOEXECOPS'
+
+/* ZIP options -- VM_CMS, REENTRANT */
+CCopts = CCopts 'DEFINE(VM_CMS,REENTRANT)'
+
+/* Link the load module to run in more or less than 16MB memory */
+LINKopts = 'AMODE ANY RMODE ANY RLDSAVE'
+
+/* resources needed to build */
+'GLOBAL TXTLIB SCEELKED CMSLIB'
+'GLOBAL LOADLIB SCEERUN'
+
+/* produce the TEXT (object) files */
+linklist=''
+modname='ZIP'
+Say 'Building' modname 'MODULE...'
+Call Compile 'ZIP'
+Call Compile 'CRCTAB'
+Call Compile 'CRC32'
+Call Compile 'CRYPT'
+Call Compile 'DEFLATE'
+Call Compile 'FILEIO'
+Call Compile 'GLOBALS'
+Call Compile 'TREES'
+Call Compile 'TTYIO'
+Call Compile 'UTIL'
+Call Compile 'ZIPUP'
+Call Compile 'ZIPFILE'
+Call Compile 'CMSMVS'
+Call Compile 'CMS'
+
+Say 'Linking...'
+'EXEC CMOD' linklist '(MODNAME' modname LINKopts
+Say modname 'built successfully.'
+
+
+/*---------------------------------------------------------------------*/
+/* Build utility programs */
+/*---------------------------------------------------------------------*/
+CCopts = CCopts 'DEFINE(UTIL)'
+
+
+linklist=''
+modname='ZIPNOTE'
+Say
+Say 'Building' modname 'MODULE...'
+Call Compile 'ZIPNOTE'
+Call Compile 'ZIPFILE'
+Call Compile 'FILEIO'
+Call Compile 'UTIL'
+Call Compile 'GLOBALS'
+Call Compile 'CMSMVS'
+
+Say 'Linking...'
+'EXEC CMOD' linklist '(MODNAME' modname LINKopts
+Say modname 'built successfully.'
+
+
+linklist=''
+modname='ZIPSPLIT'
+Say
+Say 'Building' modname 'MODULE...'
+Call Compile 'ZIPSPLIT'
+Call Compile 'ZIPFILE'
+Call Compile 'FILEIO'
+Call Compile 'UTIL'
+Call Compile 'GLOBALS'
+Call Compile 'CMSMVS'
+
+Say 'Linking...'
+'EXEC CMOD' linklist '(MODNAME' modname LINKopts
+Say modname 'built successfully.'
+
+
+linklist=''
+modname='ZIPCLOAK'
+Say
+Say 'Building' modname 'MODULE...'
+Call Compile 'ZIPCLOAK'
+Call Compile 'ZIPFILE'
+Call Compile 'FILEIO'
+Call Compile 'UTIL'
+Call Compile 'GLOBALS'
+Call Compile 'CRCTAB'
+Call Compile 'CRYPT'
+Call Compile 'TTYIO'
+Call Compile 'CMSMVS'
+
+Say 'Linking...'
+'EXEC CMOD' linklist '(MODNAME' modname LINKopts
+Say modname 'built successfully.'
+Say 'Done.'
+
+Exit rc
+
+
+
+error:
+ Say 'Error' rc 'during compilation!'
+ Say 'Error in line' sigl':'
+ Say ' 'Sourceline(sigl)
+ Exit rc
+
+
+
+Compile: Procedure Expose CCopts LINKopts linklist
+ Parse arg filename filetype filemode .
+ If filetype='' Then filetype='C'
+ linklist = linklist filename
+
+ Say 'Compiling' filename filetype filemode '...'
+ 'EXEC CC' filename filetype filemode '('CCopts
+ Return rc
diff --git a/cmsmvs/cms.c b/cmsmvs/cms.c
new file mode 100644
index 0000000..e8dfa34
--- /dev/null
+++ b/cmsmvs/cms.c
@@ -0,0 +1,34 @@
+/*
+ Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 2004-May-22 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, both of these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+/*
+ * VM/CMS specific things.
+ */
+
+#include "zip.h"
+
+int procname(n, caseflag)
+char *n; /* name to process */
+int caseflag; /* true to force case-sensitive match */
+/* Process a name or sh expression to operate on (or exclude). Return
+ an error code in the ZE_ class. */
+{
+ FILE *stream;
+
+ if (strcmp(n, "-") == 0) /* if compressing stdin */
+ return newname(n, 0, caseflag);
+ else {
+ if ((stream = fopen(n, "r")) != (FILE *)NULL)
+ {
+ fclose(stream);
+ return newname(n, 0, caseflag);
+ }
+ else return ZE_MISS;
+ }
+ return ZE_OK;
+}
diff --git a/cmsmvs/cmsmvs.c b/cmsmvs/cmsmvs.c
new file mode 100644
index 0000000..5297908
--- /dev/null
+++ b/cmsmvs/cmsmvs.c
@@ -0,0 +1,442 @@
+/*
+ Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 2004-May-22 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, both of these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+/*
+ * routines common to VM/CMS and MVS
+ */
+
+#include "zip.h"
+
+#include <stdio.h>
+#include <time.h>
+#include <errno.h>
+
+#ifndef MVS /* MVS has perfectly good definitions of the following */
+int stat(const char *path, struct stat *buf)
+{
+ if ((buf->fp = fopen(path, "r")) != NULL) {
+ fldata_t fdata;
+ if (fldata( buf->fp, buf->fname, &fdata ) == 0) {
+ buf->st_dev = fdata.__device;
+ buf->st_mode = *(short *)(&fdata);
+ }
+ strcpy( buf->fname, path );
+ fclose(buf->fp);
+ }
+ return (buf->fp != NULL ? 0 : 1);
+}
+#endif /* MVS */
+
+
+#ifndef UTIL /* the companion #endif is a bit of ways down ... */
+
+#define PAD 0
+#define PATH_END '/'
+
+/* Library functions not in (most) header files */
+
+#ifdef USE_ZIPMAIN
+int main OF((void));
+#endif
+
+int utime OF((char *, ztimbuf *));
+
+extern char *label;
+local ulg label_time = 0;
+local ulg label_mode = 0;
+local time_t label_utim = 0;
+
+#ifndef MVS /* MVS has perfectly good definitions of the following */
+int fstat(int fd, struct stat *buf)
+{
+ fldata_t fdata;
+
+ if ((fd != -1) && (fldata( (FILE *)fd, buf->fname, &fdata ) == 0)) {
+ buf->st_dev = fdata.__device;
+ buf->st_mode = *(short *)(&fdata);
+ buf->fp = (FILE *)fd;
+ return 0;
+ }
+ return -1;
+}
+#endif /* MVS */
+
+
+char *ex2in(x, isdir, pdosflag)
+char *x; /* external file name */
+int isdir; /* input: x is a directory */
+int *pdosflag; /* output: force MSDOS file attributes? */
+/* Convert the external file name to a zip file name, returning the malloc'ed
+ string or NULL if not enough memory. */
+{
+ char *n; /* internal file name (malloc'ed) */
+ char *t; /* shortened name */
+ int dosflag;
+ char mem[10] = ""; /* member name */
+ char ext[10] = ""; /* extension name */
+
+ dosflag = dosify; /* default for non-DOS non-OS/2 */
+
+ /* Find starting point in name before doing malloc */
+ for (t = x; *t == '/'; t++)
+ ;
+
+ /* Make changes, if any, to the copied name (leave original intact) */
+ if (!pathput)
+ t = last(t, PATH_END);
+
+ /* Malloc space for internal name and copy it */
+ if ((n = malloc(strlen(t) + 1)) == NULL)
+ return NULL;
+ strcpy(n, t);
+
+#ifdef MVS
+ /* strip quotes from name, non-OE format */
+ if (*n == '\'' && (t = strrchr(n, '\'')) != n) {
+ if (!*(t+1)) {
+ /* yes, it is a quoted name */
+ int l = strlen(n) - 2;
+ memmove(n, n+1, l);
+ *(n+l) = '\0';
+ }
+ }
+ /* Change member names to fn.ext */
+ if (t = strrchr(n, '(')) {
+ *t = '\0';
+ strcpy(mem,t+1); /* Save member name */
+ if (t = strchr(mem, ')')) *t = '\0'; /* Set end of mbr */
+ /* Save extension */
+ if (t = strrchr(n, '.')) t++;
+ else t = n;
+ strcpy(ext,t);
+ /* Build name as "member.ext" */
+ strcpy(t,mem);
+ strcat(t,".");
+ strcat(t,ext);
+ }
+
+ /* Change all but the last '.' to '/' */
+ if (t = strrchr(n, '.')) {
+ while (--t > n)
+ if (*t == '.')
+ *t = '/';
+ }
+#else
+ /* On CMS, remove the filemode (all past 2nd '.') */
+ if (t = strchr(n, '.'))
+ if (t = strchr(t+1, '.'))
+ *t = '\0';
+ t = n;
+#endif
+
+ strcpy(n, t);
+
+ if (isdir == 42) return n; /* avoid warning on unused variable */
+
+ if (dosify)
+ msname(n); /* msname() needs string in native charset */
+
+ strtoasc(n, n);
+
+ /* Returned malloc'ed name */
+ if (pdosflag)
+ *pdosflag = dosflag;
+ return n;
+}
+
+
+char *in2ex(n)
+char *n; /* internal file name */
+/* Convert the zip file name to an external file name, returning the malloc'ed
+ string or NULL if not enough memory. */
+{
+ char *x; /* external file name */
+
+ if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
+ return NULL;
+ strtoebc(x, n);
+ return x;
+}
+
+
+void stamp(f, d)
+char *f; /* name of file to change */
+ulg d; /* dos-style time to change it to */
+/* Set last updated and accessed time of file f to the DOS time d. */
+{
+ ztimbuf u; /* argument for utime() */
+
+ /* Convert DOS time to time_t format in u.actime and u.modtime */
+ u.actime = u.modtime = dos2unixtime(d);
+
+ utime(f, &u);
+}
+
+
+ulg filetime(f, a, n, t)
+char *f; /* name of file to get info on */
+ulg *a; /* return value: file attributes */
+long *n; /* return value: file size */
+iztimes *t; /* return value: access, modific. and creation times */
+{
+ FILE *stream;
+ time_t ltime;
+
+ if (strcmp(f, "-") != 0) { /* if not compressing stdin */
+ Trace((mesg, "opening file '%s' with '%s'\n", f, FOPR));
+ if ((stream = fopen(f, FOPR)) == (FILE *)NULL) {
+ return 0;
+ } else {
+ if (n != NULL) {
+ /* With byteseek, this will work */
+ fseek(stream, 0L, SEEK_END);
+ *n = ftell(stream);
+ Trace((mesg, "file size = %lu\n", *((ulg *)n)));
+ }
+ fclose(stream);
+ }
+ }
+ else {
+ /* Reading from stdin */
+ if (n != NULL) {
+ *n = -1L;
+ }
+ }
+
+ /* Return current time for all the times -- for now */
+ time(&ltime);
+ if (t != NULL)
+ t->atime = t->mtime = t->ctime = ltime;
+
+ /* Set attributes (always a file) */
+ if (a != NULL)
+ *a = 0;
+
+ return unix2dostime(&ltime);
+}
+
+
+
+int set_extra_field(z, z_utim)
+struct zlist far *z;
+iztimes *z_utim;
+/* create extra field and change z->att if desired */
+{
+ fldata_t fdata;
+ FILE *stream;
+ char *eb_ptr;
+#ifdef USE_EF_UT_TIME
+ extent ef_l_len = (EB_HEADSIZE+EB_UT_LEN(1));
+#else /* !USE_EF_UT_TIME */
+ extent ef_l_len = 0;
+#endif /* ?USE_EF_UT_TIME */
+ int set_cmsmvs_eb = 0;
+
+/*translate_eol = 0;*/
+ if (aflag == ASCII) {
+ z->att = ASCII;
+ } else {
+ if (bflag)
+ z->att = BINARY;
+ else
+ z->att = __EBCDIC;
+ ef_l_len += sizeof(fdata)+EB_HEADSIZE;
+ set_cmsmvs_eb = 1;
+ }
+
+ if (ef_l_len > 0) {
+ z->extra = (char *)malloc(ef_l_len);
+ if (z->extra == NULL) {
+ printf("\nFLDATA : Unable to allocate memory !\n");
+ return ZE_MEM;
+ }
+ z->cext = z->ext = ef_l_len;
+ eb_ptr = z->cextra = z->extra;
+
+ if (set_cmsmvs_eb) {
+ if (bflag)
+/*** stream = fopen(z->zname,"rb,type=record"); $RGH$ ***/
+ stream = fopen(z->name,"rb");
+ else
+ stream = fopen(z->name,"r");
+ if (stream == NULL) {
+ printf("\nFLDATA : Could not open file : %s !\n",z->name);
+ printf("Error %d: '%s'\n", errno, strerror(errno));
+ return ZE_NONE;
+ }
+
+ fldata(stream,z->name,&fdata);
+ /*put the system ID */
+#ifdef VM_CMS
+ *(eb_ptr) = EF_VMCMS & 0xFF;
+ *(eb_ptr+1) = EF_VMCMS >> 8;
+#else
+ *(eb_ptr) = EF_MVS & 0xFF;
+ *(eb_ptr+1) = EF_MVS >> 8;
+#endif
+ *(eb_ptr+2) = sizeof(fdata) & 0xFF;
+ *(eb_ptr+3) = sizeof(fdata) >> 8;
+
+ memcpy(eb_ptr+EB_HEADSIZE,&fdata,sizeof(fdata));
+ fclose(stream);
+#ifdef USE_EF_UT_TIME
+ eb_ptr += (sizeof(fdata)+EB_HEADSIZE);
+#endif /* USE_EF_UT_TIME */
+ }
+#ifdef USE_EF_UT_TIME
+ eb_ptr[0] = 0x55; /* ascii[(unsigned)('U')] */
+ eb_ptr[1] = 0x54; /* ascii[(unsigned)('T')] */
+ eb_ptr[2] = EB_UT_LEN(1); /* length of data part of e.f. */
+ eb_ptr[3] = 0;
+ eb_ptr[4] = EB_UT_FL_MTIME;
+ eb_ptr[5] = (char)(z_utim->mtime);
+ eb_ptr[6] = (char)(z_utim->mtime >> 8);
+ eb_ptr[7] = (char)(z_utim->mtime >> 16);
+ eb_ptr[8] = (char)(z_utim->mtime >> 24);
+#endif /* USE_EF_UT_TIME */
+ }
+
+ return ZE_OK;
+}
+
+int deletedir(d)
+char *d; /* directory to delete */
+/* Delete the directory *d if it is empty, do nothing otherwise.
+ Return the result of rmdir(), delete(), or system().
+ For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]).
+ */
+{
+ return 0;
+}
+
+#ifdef USE_ZIPMAIN
+/* This function is called as main() to parse arguments */
+/* into argc and argv. This is required for stand-alone */
+/* execution. This calls the "real" main() when done. */
+
+int main(void)
+ {
+ int argc=0;
+ char *argv[50];
+
+ int iArgLen;
+ char argstr[256];
+ char **pEPLIST, *pCmdStart, *pArgStart, *pArgEnd;
+
+ /* Get address of extended parameter list from S/370 Register 0 */
+ pEPLIST = (char **)__xregs(0);
+
+ /* Null-terminate the argument string */
+ pCmdStart = *(pEPLIST+0);
+ pArgStart = *(pEPLIST+1);
+ pArgEnd = *(pEPLIST+2);
+ iArgLen = pArgEnd - pCmdStart + 1;
+
+ /* Make a copy of the command string */
+ memcpy(argstr, pCmdStart, iArgLen);
+ argstr[iArgLen] = '\0'; /* Null-terminate */
+
+ /* Store first token (cmd) */
+ argv[argc++] = strtok(argstr, " ");
+
+ /* Store the rest (args) */
+ while (argv[argc-1])
+ argv[argc++] = strtok(NULL, " ");
+ argc--; /* Back off last NULL entry */
+
+ /* Call "real" main() function */
+ return zipmain(argc, argv);
+
+}
+#endif /* USE_ZIPMAIN */
+
+#endif /* !UTIL */
+
+
+/******************************/
+/* Function version_local() */
+/******************************/
+
+void version_local()
+{
+ char liblvlmsg [50+1];
+ char *compiler = "?";
+ char *platform = "?";
+ char complevel[64];
+
+ /* Map the runtime library level information */
+ union {
+ unsigned int iVRM;
+ struct {
+ unsigned int pd:4; /* Product designation */
+ unsigned int vv:4; /* Version */
+ unsigned int rr:8; /* Release */
+ unsigned int mm:16; /* Modification level */
+ } xVRM;
+ } VRM;
+
+
+ /* Break down the runtime library level */
+ VRM.iVRM = __librel();
+ sprintf(liblvlmsg, "Using runtime library level %s V%dR%dM%d",
+ (VRM.xVRM.pd==1 ? "LE" : "CE"),
+ VRM.xVRM.vv, VRM.xVRM.rr, VRM.xVRM.mm);
+ /* Note: LE = Language Environment, CE = Common Env. (C/370). */
+ /* This refers ONLY to the current runtimes, not the compiler. */
+
+
+#ifdef VM_CMS
+ platform = "VM/CMS";
+ #ifdef __IBMC__
+ compiler = "IBM C";
+ #else
+ compiler = "C/370";
+ #endif
+#endif
+
+#ifdef MVS
+ platform = "MVS";
+ #ifdef __IBMC__
+ compiler = "IBM C/C++";
+ #else
+ compiler = "C/370";
+ #endif
+#endif
+
+#ifdef __COMPILER_VER__
+ VRM.iVRM = __COMPILER_VER__;
+ sprintf(complevel," V%dR%dM%d",
+ VRM.xVRM.vv, VRM.xVRM.rr, VRM.xVRM.mm);
+#else
+#ifdef __IBMC__
+ sprintf(complevel," V%dR%d", __IBMC__ / 100, (__IBMC__ % 100)/10);
+#else
+ complevel[0] = '\0';
+#endif
+#endif
+
+
+ printf("Compiled with %s%s for %s%s%s.\n\n",
+
+ /* Add compiler name and level */
+ compiler, complevel,
+
+ /* Add platform */
+ platform,
+
+ /* Add timestamp */
+#ifdef __DATE__
+ " on " __DATE__
+#ifdef __TIME__
+ " at " __TIME__
+#endif
+#endif
+ ".\n",
+ liblvlmsg
+ );
+} /* end function version_local() */
diff --git a/cmsmvs/cmsmvs.h b/cmsmvs/cmsmvs.h
new file mode 100644
index 0000000..8fca61b
--- /dev/null
+++ b/cmsmvs/cmsmvs.h
@@ -0,0 +1,134 @@
+/*
+ Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 1999-Oct-05 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, both of these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
+*/
+/* Include file for VM/CMS and MVS */
+
+/* This is normally named osdep.h on most systems. Since CMS */
+/* generally doesn't support directories, it's been given a unique */
+/* name to avoid confusion. */
+
+
+#ifndef __cmsmvs_h /* prevent multiple inclusions */
+#define __cmsmvs_h
+
+#ifdef MVS
+# define _POSIX_SOURCE /* tell MVS we want full definitions */
+# include <features.h>
+#endif /* MVS */
+
+#include <time.h> /* the usual non-BSD time functions */
+/* cstat.h is not required for MVS and actually gets in the way. Is it
+ * needed for CMS?
+ */
+#ifdef MVS
+# include <sys/stat.h>
+# include <sys/modes.h>
+#else /* !MVS */
+# include "cstat.h"
+#endif
+
+
+/* Newer compiler version defines something for us */
+#if defined(__VM__) && !defined(VM_CMS)
+# define VM_CMS
+#endif
+
+#define CMS_MVS
+#define EBCDIC
+
+#ifndef MVS /* MVS has perfectly good definitions for the following */
+# define NO_UNISTD_H
+# define NO_FCNTL_H
+#endif /*MVS */
+
+/* If we're generating a stand-alone CMS module, patch in */
+/* a new main() function before the real main() for arg parsing. */
+#ifdef CMS_STAND_ALONE
+# define USE_ZIPMAIN
+#endif
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+#define PASSWD_FROM_STDIN
+ /* Kludge until we know how to open a non-echo tty channel */
+
+/* definition for ZIP */
+#define getch() getc(stdin)
+#define native(c) ebcdic[(c)]
+#define MAXPATHLEN 128
+#define NO_RMDIR
+#define NO_MKTEMP
+#define USE_CASE_MAP
+#ifndef MVS /* MVS has perfectly good definitions for the following */
+# define fileno(x) (char *)(x)
+# define fdopen fopen
+# define unlink remove
+# define link rename
+# define utime(f,t)
+# define isatty(t) 1
+#endif /*MVS */
+#ifdef ZCRYPT_INTERNAL
+# define ZCR_SEED2 (unsigned)3141592654L /* use PI as seed pattern */
+#endif
+
+#ifdef MVS
+# if defined(__CRC32_C)
+# pragma csect(STATIC,"crc32_s")
+# elif defined(__DEFLATE_C)
+# pragma csect(STATIC,"deflat_s")
+# elif defined(__ZIPFILE_C)
+# pragma csect(STATIC,"zipfil_s")
+# elif defined(__ZIPUP_C)
+# pragma csect(STATIC,"zipup_s")
+# endif
+#endif /* MVS */
+
+/* end defines for ZIP */
+
+
+
+/* definitions for UNZIP */
+#ifdef UNZIP
+#define INBUFSIZ 8192
+
+#define USE_STRM_INPUT
+#define USE_FWRITE
+
+#define PATH_MAX 128
+#endif /* UNZIP */
+
+
+#if 0 /*$RGH$*/
+/* RECFM=F, LRECL=1 works for sure */
+#define FOPR "rb,recfm=fb"
+#define FOPM "r+"
+#define FOPW "wb,recfm=fb,lrecl=1"
+#define FOPWT "w"
+#endif
+
+/* Try allowing ZIP files to be RECFM=V with "byteseek" for CMS, recfm=U for MVS */
+#define FOPR "rb,byteseek"
+#define FOPM "r+,byteseek"
+#ifdef MVS
+ #define FOPW "wb,recfm=u,byteseek"
+#else /* !MVS */
+ #define FOPW "wb,recfm=v,lrecl=32760,byteseek"
+#endif /* MVS */
+
+#if 0
+#define FOPW_TMP "w,byteseek"
+#else
+#define FOPW_TMP "w,type=memory(hiperspace)"
+#endif
+
+#define CBSZ 0x40000
+#define ZBSZ 0x40000
+
+#endif /* !__cmsmvs_h */
diff --git a/cmsmvs/cstat.h b/cmsmvs/cstat.h
new file mode 100644
index 0000000..f02a5c3
--- /dev/null
+++ b/cmsmvs/cstat.h
@@ -0,0 +1,53 @@
+/*
+ Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 1999-Oct-05 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, both of these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
+*/
+/* cstat.h
+
+ Definitions used for file status functions
+
+*/
+
+#ifndef __STAT_H
+#define __STAT_H
+
+#include <stdio.h>
+
+#define S_IFMT 0xF000 /* file type mask */
+#define S_IFDIR 0x4000 /* directory */
+#define S_IFIFO 0x1000 /* FIFO special */
+#define S_IFCHR 0x2000 /* character special */
+#define S_IFBLK 0x3000 /* block special */
+#define S_IFREG 0x8000 /* or just 0x0000, regular */
+#define S_IREAD 0x0100 /* owner may read */
+#define S_IWRITE 0x0080 /* owner may write */
+#define S_IEXEC 0x0040 /* owner may execute <directory search> */
+
+struct stat
+{
+ short st_dev; /* Drive number of disk containing the */
+ /* file or file handle if the file is */
+ /* on device */
+ short st_ino; /* Not meaningfull for VM/CMS */
+ short st_mode; /* Bit mask giving information about */
+ /* the file's mode */
+ short st_nlink; /* Set to the integer constant 1 */
+ int st_uid; /* Not meaningfull for VM/CMS */
+ int st_gid; /* Not meaningfull for VM/CMS */
+ short st_rdev; /* Same as st_dev */
+ long st_size; /* Size of the file in bytes */
+ long st_atime; /* Most recent access */
+ long st_mtime; /* Same as st_atime */
+ long st_ctime; /* Same as st_atime */
+ FILE *fp;
+ char fname[FILENAME_MAX];
+};
+
+int stat(const char *path, struct stat *sb);
+int fstat(int fd, struct stat *sb);
+
+#endif /* __STAT_H */
diff --git a/cmsmvs/mc.exec b/cmsmvs/mc.exec
new file mode 100644
index 0000000..ca22a18
--- /dev/null
+++ b/cmsmvs/mc.exec
@@ -0,0 +1,95 @@
+/* MAKECPIP EXEC Make program to build a C/370 module */
+/* Author: George Petrov, 29 Sep 1994 */
+
+arg fn . '(' cparms /* Filter name */
+'pipe (end ?) < 'fn' makefile', /* get all source files from */
+ '| frlab GLOBALS:'||,
+ '| drop',
+ '| strip',
+ '| var globals'
+cparms = cparms globals
+say ''
+say 'Compile options : 'cparms
+say ''
+if pos('REB',cparms) > 0 then do
+parse var cparms cp1 'REB' . ' ' cp2 /* REBuild options specified ? */
+cparms = cp1||cp2
+pipe1=,
+'pipe (end ?) < 'fn' makefile', /* get all source files from */
+ '| nfind *'||, /* the makefile and compile */
+ '| frlab TEXT:'||, /* only the those who are */
+ '| r: tolab MODULE:'||, /* changed or never compiled */
+ '| drop',
+ '| o: fanout',
+ '| chop before str /(/',
+ '| statew',
+ '| c: fanout', /* compiled */
+ '| specs /Compiling / 1 w1-3 n / .../ n',
+ '| cons'
+end
+else do
+pipe1=,
+'pipe (end ?) < 'fn' makefile', /* get all source files from */
+ '| nfind *'||, /* the makefile and compile */
+ '| frlab TEXT:'||, /* only the those who are */
+ '| r: tolab MODULE:'||, /* changed or never compiled */
+ '| drop',
+ '| o: fanout',
+ '| specs w1 1 /C/ nw w3 nw write w1 1 /TEXT A/ nw',
+ '| chop before str /(/',
+ '| statew',
+ '| change (57 66) / /0/',
+ '| sort 1.8 d', /* sort the date and time */
+ '| uniq 1-17 singles', /* if the first is a source */
+ '| sort 1.8 d 64.2 d 57.2 d 60.2 d 66.8 d', /* sort the date */
+ '| uniq 1-8 first', /* if the first is a source */
+ '| locate 9.8 /C /', /* program then it has to be */
+ '| c: fanout', /* compiled */
+ '| specs /Compiling / 1 w1-3 n / .../ n',
+ '| cons'
+end
+pipe2= '?',
+ 'r:',
+ '| drop',
+ '| specs w1 1', /* save the module name in var */
+ '| var module',
+ '?',
+ 'o:',
+ '| specs w1 1',
+ '| join * / /',
+ '| var texts', /* save all the text file names */
+ '?', /* for later include */
+ 'c:',
+ '| specs /CC / 1 w1-3 n /(NOTERM 'cparms'/ nw', /* compile! */
+ '| err: cms | cons',
+ '?',
+ 'err:',
+ '| strip both',
+ '| nfind 0'||,
+ '| var err',
+ '| specs /----> Errors found! RC=/ 1 1-* n',
+ '| cons'
+/* '| g: gate'*/
+pipe1 pipe2
+say ''
+if symbol('err') = 'VAR' & err ^= 0 then do
+ say 'Errors found in source files - link aborted! RC = 'err
+ exit err
+end
+say 'Generating module 'module
+'pipe cms cmod' fn texts' DMSCSL | > 'fn' LINK A'
+'set cmstype ht'
+'state 'fn' LINK A'
+rcc = rc
+'set cmstype rt'
+if rcc = 0 then do
+ say ''
+ say 'ERRORS discovered during linking!'
+ say 'See: 'fn' LINK A for more info'
+end
+exit rc
+error:
+say 'Error in REXX detected!'
+Say 'Syntax error on line' Sigl':' Sourceline(Sigl)
+Say 'Error was:' Errortext(RC)
+return rc
diff --git a/cmsmvs/mvs.c b/cmsmvs/mvs.c
new file mode 100644
index 0000000..fabc4f0
--- /dev/null
+++ b/cmsmvs/mvs.c
@@ -0,0 +1,221 @@
+/*
+ Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 2004-May-22 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, both of these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
+*/
+/*
+ * MVS specific things
+ */
+#include "zip.h"
+#include "mvs.h"
+#include <errno.h>
+
+static int gen_node( DIR *dirp, RECORD *recptr )
+{
+ char *ptr, *name, ttr[TTRLEN];
+ int skip, count = 2;
+ unsigned int info_byte, alias, ttrn;
+ struct dirent *new;
+
+ ptr = recptr->rest;
+ while (count < recptr->count) {
+ if (!memcmp( ptr, endmark, NAMELEN ))
+ return 1;
+ name = ptr; /* member name */
+ ptr += NAMELEN;
+ memcpy( ttr, ptr, TTRLEN ); /* ttr name */
+ ptr += TTRLEN;
+ info_byte = (unsigned int) (*ptr); /* info byte */
+ if ( !(info_byte & ALIAS_MASK) ) { /* no alias */
+ new = malloc( sizeof(struct dirent) );
+ if (dirp->D_list == NULL)
+ dirp->D_list = dirp->D_curpos = new;
+ else
+ dirp->D_curpos = (dirp->D_curpos->d_next = new);
+ new->d_next = NULL;
+ memcpy( new->d_name, name, NAMELEN );
+ new->d_name[NAMELEN] = '\0';
+ if ((name = strchr( new->d_name, ' ' )) != NULL)
+ *name = '\0'; /* skip trailing blanks */
+ }
+ skip = (info_byte & SKIP_MASK) * 2 + 1;
+ ptr += skip;
+ count += (TTRLEN + NAMELEN + skip);
+ }
+ return 0;
+}
+
+DIR *opendir(const char *dirname)
+{
+ int bytes, list_end = 0;
+ DIR *dirp;
+ FILE *fp;
+ RECORD rec;
+
+ fp = fopen( dirname, "rb" );
+ if (fp != NULL) {
+ dirp = malloc( sizeof(DIR) );
+ if (dirp != NULL) {
+ dirp->D_list = dirp->D_curpos = NULL;
+ strcpy( dirp->D_path, dirname );
+ do {
+ bytes = fread( &rec, 1, sizeof(rec), fp );
+ if (bytes == sizeof(rec))
+ list_end = gen_node( dirp, &rec );
+ } while (!feof(fp) && !list_end);
+ fclose( fp );
+ dirp->D_curpos = dirp->D_list;
+ return dirp;
+ }
+ fclose( fp );
+ }
+ return NULL;
+}
+
+struct dirent *readdir(DIR *dirp)
+{
+ struct dirent *cur;
+
+ cur = dirp->D_curpos;
+ dirp->D_curpos = dirp->D_curpos->d_next;
+ return cur;
+}
+
+void rewinddir(DIR *dirp)
+{
+ dirp->D_curpos = dirp->D_list;
+}
+
+int closedir(DIR *dirp)
+{
+ struct dirent *node;
+
+ while (dirp->D_list != NULL) {
+ node = dirp->D_list;
+ dirp->D_list = dirp->D_list->d_next;
+ free( node );
+ }
+ free( dirp );
+ return 0;
+}
+
+local char *readd(d)
+DIR *d; /* directory stream to read from */
+/* Return a pointer to the next name in the directory stream d, or NULL if
+ no more entries or an error occurs. */
+{
+ struct dirent *e;
+
+ e = readdir(d);
+ return e == NULL ? (char *) NULL : e->d_name;
+}
+
+int procname(n, caseflag)
+char *n; /* name to process */
+int caseflag; /* true to force case-sensitive match */
+/* Process a name or sh expression to operate on (or exclude). Return
+ an error code in the ZE_ class. */
+{
+ char *a; /* path and name for recursion */
+ DIR *d; /* directory stream from opendir() */
+ char *e; /* pointer to name from readd() */
+ int m; /* matched flag */
+ char *p; /* path for recursion */
+ struct stat s; /* result of stat() */
+ struct zlist far *z; /* steps through zfiles list */
+ int exists; /* 1 if file exists */
+
+ if (strcmp(n, "-") == 0) /* if compressing stdin */
+ return newname(n, 0, caseflag);
+ else if (!(exists = (LSSTAT(n, &s) == 0)))
+ {
+#ifdef MVS
+ /* special case for MVS. stat does not work on non-HFS files so if
+ * stat fails with ENOENT, try to open the file for reading anyway.
+ * If the user has no OMVS segment, stat gets an initialization error,
+ * even on external files.
+ */
+ if (errno == ENOENT || errno == EMVSINITIAL) {
+ FILE *f = fopen(n, "r");
+ if (f) {
+ /* stat got ENOENT but fopen worked, external file */
+ fclose(f);
+ exists = 1;
+ memset(&s, '\0', sizeof(s)); /* stat data is unreliable for externals */
+ s.st_mode = S_IFREG; /* fudge it */
+ }
+ }
+#endif /* MVS */
+ }
+ if (! exists) {
+ /* Not a file or directory--search for shell expression in zip file */
+ p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
+ m = 1;
+ for (z = zfiles; z != NULL; z = z->nxt) {
+ if (MATCH(p, z->iname, caseflag))
+ {
+ z->mark = pcount ? filter(z->zname, caseflag) : 1;
+ if (verbose)
+ fprintf(mesg, "zip diagnostic: %scluding %s\n",
+ z->mark ? "in" : "ex", z->name);
+ m = 0;
+ }
+ }
+ free((zvoid *)p);
+ return m ? ZE_MISS : ZE_OK;
+ }
+
+ /* Live name--use if file, recurse if directory */
+ if (!S_ISDIR(s.st_mode))
+ {
+ /* add or remove name of file */
+ if ((m = newname(n, 0, caseflag)) != ZE_OK)
+ return m;
+ } else {
+ /* Add trailing / to the directory name */
+ if ((p = malloc(strlen(n)+2)) == NULL)
+ return ZE_MEM;
+ if (strcmp(n, ".") == 0) {
+ *p = '\0'; /* avoid "./" prefix and do not create zip entry */
+ } else {
+ strcpy(p, n);
+ a = p + strlen(p);
+ if (a[-1] != '/')
+ strcpy(a, "/");
+ if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
+ free((zvoid *)p);
+ return m;
+ }
+ }
+ /* recurse into directory */
+ if (recurse && (d = opendir(n)) != NULL)
+ {
+ while ((e = readd(d)) != NULL) {
+ if (strcmp(e, ".") && strcmp(e, ".."))
+ {
+ if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
+ {
+ closedir(d);
+ free((zvoid *)p);
+ return ZE_MEM;
+ }
+ strcat(strcpy(a, p), e);
+ if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
+ {
+ if (m == ZE_MISS)
+ zipwarn("name not matched: ", a);
+ else
+ ziperr(m, a);
+ }
+ free((zvoid *)a);
+ }
+ }
+ closedir(d);
+ }
+ free((zvoid *)p);
+ } /* (s.st_mode & S_IFDIR) == 0) */
+ return ZE_OK;
+}
diff --git a/cmsmvs/mvs.h b/cmsmvs/mvs.h
new file mode 100644
index 0000000..b2f9760
--- /dev/null
+++ b/cmsmvs/mvs.h
@@ -0,0 +1,40 @@
+/*
+ Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 1999-Oct-05 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, both of these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
+*/
+/* <dirent.h> definitions */
+
+#define NAMELEN 8
+
+struct dirent {
+ struct dirent *d_next;
+ char d_name[NAMELEN+1];
+};
+
+typedef struct _DIR {
+ struct dirent *D_list;
+ struct dirent *D_curpos;
+ char D_path[FILENAME_MAX];
+} DIR;
+
+DIR * opendir(const char *dirname);
+struct dirent *readdir(DIR *dirp);
+void rewinddir(DIR *dirp);
+int closedir(DIR *dirp);
+char * readd(DIR *dirp);
+
+#define ALIAS_MASK (unsigned int) 0x80
+#define SKIP_MASK (unsigned int) 0x1F
+#define TTRLEN 3
+#define RECLEN 254
+
+typedef _Packed struct {
+ unsigned short int count;
+ char rest[RECLEN];
+} RECORD;
+
+char *endmark = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
diff --git a/cmsmvs/mvs.mki b/cmsmvs/mvs.mki
new file mode 100644
index 0000000..7990902
--- /dev/null
+++ b/cmsmvs/mvs.mki
@@ -0,0 +1,128 @@
+# Makefile for the MVS (OS/390 Base) version of ZIP 2.3
+# Produced for C/C++ V3R2 in OS/390 1.2.0 by Ian E. Gorman, 2 Nov 1998
+# Facilities for compiling and testing were made available by
+# OmniMark Technologies Corporation, Ottawa, Canada
+
+# NOTES
+#
+# The only tabs in this file are in the first character of each recipe
+# line, where they are required by make.
+#
+# Run this makefile in OpenMVS (OS/390 POSIX) using source files in the
+# HFS file system. You can write the load module to either HFS file
+# system or to a PDS in the native MVS file system. The PDS must have
+# sufficient free space to hold the load module.
+#
+# To compile to a member of a PDS:
+# make
+# or
+# make zip.mvs
+#
+# To compile a test version into the HFS file system:
+# make hfs
+
+# ZIP options -- MVS, REENTRANT
+ZIPOPTS=-DMVS -DREENTRANT
+
+# directories
+
+# generic source code
+SRC=..
+SRC_P=$(SRC)/
+
+# source code for MVS
+CMSMVS=../cmsmvs
+CMSMVS_P=$(CMSMVS)/
+
+# include files
+INCLS=-I$(SRC) -I$(CMSMVS)
+
+# object files and load modules
+BLD_P=../mvs/
+
+# Other options
+
+# Suffixes (E and O must be different)
+E=
+O=.o
+
+# Need EXTENDED features for global.c and vmvms.c, so not using c89
+CC=cc
+CFLAGS=-D_OPEN_SYS $(ZIPOPTS) $(INCLS)
+
+LD=cc
+LDFLAGS=
+
+# Files
+
+# object (TEXT) files
+OBJECTS= $(BLD_P)zip$(O) $(BLD_P)trees$(O) \
+ $(BLD_P)crypt$(O) $(BLD_P)ttyio$(O) $(BLD_P)deflate$(O) \
+ $(BLD_P)fileio$(O) $(BLD_P)globals$(O) $(BLD_P)util$(O) \
+ $(BLD_P)crc32$(O) $(BLD_P)crctab$(O) $(BLD_P)zipfile$(O) \
+ $(BLD_P)zipup$(O) $(BLD_P)cmsmvs$(O) $(BLD_P)mvs$(O)
+
+# Header files
+HFILES= $(SRC_P)api.h $(SRC_P)crypt.h $(SRC_P)ebcdic.h \
+ $(SRC_P)revision.h $(SRC_P)tailor.h $(SRC_P)ttyio.h \
+ $(SRC_P)zip.h $(SRC_P)ziperr.h $(CMSMVS_P)cmsmvs.h \
+ $(CMSMVS_P)cstat.h $(CMSMVS_P)mvs.h $(CMSMVS_P)zipup.h
+
+# Rules
+
+all: $(BLD_P)zip.mvs$(E)
+hfs: $(BLD_P)zip$(E)
+
+# link
+
+$(BLD_P)zip.mvs$(E): $(OBJECTS)
+ $(LD) -o "//INFOZIP.LOAD(ZIP)" $(LDFLAGS) $^
+ echo "tso call \"infozip(zip)\" \"'\"\"""$$""@""\"\"'\"" > $%
+ chmod a+x $%
+
+$(BLD_P)zip$(E): $(OBJECTS)
+ $(LD) -o $% $(LDFLAGS) $^
+
+# compile
+
+$(BLD_P)trees$(O): $(SRC_P)trees.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)trees.c
+
+$(BLD_P)crypt$(O): $(SRC_P)crypt.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)crypt.c
+
+$(BLD_P)ttyio$(O): $(SRC_P)ttyio.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)ttyio.c
+
+$(BLD_P)deflate$(O): $(SRC_P)deflate.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)deflate.c
+
+$(BLD_P)fileio$(O): $(SRC_P)fileio.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)fileio.c
+
+$(BLD_P)globals$(O): $(SRC_P)globals.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)globals.c
+
+$(BLD_P)zip$(O): $(SRC_P)zip.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)zip.c
+
+$(BLD_P)util$(O): $(SRC_P)util.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)util.c
+
+$(BLD_P)crc32$(O): $(SRC_P)crc32.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)crc32.c
+
+$(BLD_P)crctab$(O): $(SRC_P)crctab.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)crctab.c
+
+$(BLD_P)zipfile$(O): $(SRC_P)zipfile.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)zipfile.c
+
+$(BLD_P)zipup$(O): $(SRC_P)zipup.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(SRC_P)zipup.c
+
+$(BLD_P)cmsmvs$(O): $(CMSMVS_P)cmsmvs.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(CMSMVS_P)cmsmvs.c
+
+$(BLD_P)mvs$(O): $(CMSMVS_P)mvs.c $(HFILES)
+ $(CC) -c -o $% $(CFLAGS) $(CMSMVS_P)mvs.c
diff --git a/cmsmvs/pipzip.rexx b/cmsmvs/pipzip.rexx
new file mode 100644
index 0000000..4249ded
--- /dev/null
+++ b/cmsmvs/pipzip.rexx
@@ -0,0 +1,27 @@
+/* PIPZIP REXX Rexx filter to use ZIP */
+/* Author : George Petrov, 8 May 1995 */
+
+parse arg opts
+'callpipe *:',
+ '| specs w1 1 /./ n w2 n',
+ '| join * / /',
+ '| specs /zip 'opts'/ 1 1-* nw',
+ '| cms',
+ '| *:'
+
+exit rc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cmsmvs/zip.exec b/cmsmvs/zip.exec
new file mode 100644
index 0000000..0b9de97
--- /dev/null
+++ b/cmsmvs/zip.exec
@@ -0,0 +1,66 @@
+/***********************************************************************/
+/* */
+/* Front-end EXEC to set up linkage to the C runtime libraries */
+/* before executing a MODULE generated from C code. */
+/* */
+/* Copy this file as an EXEC with a filename matching the C MODULE. */
+/* */
+/* Greg Hartwig (ghartwig@vnet.ibm.com) 7/31/97, 4/24/98. */
+/* */
+/***********************************************************************/
+Address Command
+Parse Arg argstring
+Parse Source . . myname .
+
+/* Set output and input character translation so brackets show up */
+'SET OUTPUT AD' 'BA'x
+'SET OUTPUT BD' 'BB'x
+'SET INPUT BA AD'
+'SET INPUT BB BD'
+
+Call CLIB
+If rc<>0 Then Do
+ Say 'The required C runtime libraries don''t appear to be available.'
+ Say myname 'can not run.'
+ Exit 12
+End
+
+/* Run the command */
+myname argstring
+Exit rc
+
+
+
+
+/* Contents of the CLIB EXEC, modified for RC checking. */
+/* Removed TXTLIB setting. Only LOADLIB needed for execution. */
+CLIB:
+/***************************************************/
+/* SET UP LIBRARIES FOR LE for MVS & VM */
+/***************************************************/
+Address COMMAND
+
+loadlib ='EDCLINK' /* C/370 runtime */
+loadlib ='SCEERUN' /* LE runtime */
+
+
+theirs=queued() /* old stack contentsM068*/
+ 'QUERY LOADLIB ( LIFO' /* old setting M068*/
+ LoadlibList='' /* init list M068*/
+rc=0
+ Do while queued()^=theirs /* all lines from cmdM068*/
+ Parse upper pull 'LOADLIB' '=' Ltemp /* get one line M068*/
+ LoadlibList= Ltemp Loadliblist /* was stacked LIFO M068*/
+ End /*M068*/
+ If loadlibList='NONE' ,
+ Then Do
+ 'GLOBAL LOADLIB' Loadlib /* enforce what we need */
+ End
+ Else Do
+ Do xx=1 to Words(loadlib)
+ If Find(loadliblist,word(loadlib,xx)) = 0 ,
+ then loadliblist = loadliblist word(loadlib,xx)
+ End
+ 'GLOBAL LOADLIB' loadliblist /* enforce what we need */
+ End
+Return
diff --git a/cmsmvs/zip.makefile b/cmsmvs/zip.makefile
new file mode 100644
index 0000000..b183367
--- /dev/null
+++ b/cmsmvs/zip.makefile
@@ -0,0 +1,22 @@
+* This is a comment
+* this makefile compiles filter ZIPME
+
+GLOBALS:
+ long def(VM_CMS)
+TEXT:
+ trees c
+ crypt c
+ ttyio c
+ deflate c
+ fileio c
+ globals c
+ zip c
+ util c
+ crc32.c
+ crctab.c
+ zipfile c
+ zipup c
+ cmsmvs c
+ cms c
+MODULE:
+ zip module
diff --git a/cmsmvs/zipcloak.exec b/cmsmvs/zipcloak.exec
new file mode 100644
index 0000000..0b9de97
--- /dev/null
+++ b/cmsmvs/zipcloak.exec
@@ -0,0 +1,66 @@
+/***********************************************************************/
+/* */
+/* Front-end EXEC to set up linkage to the C runtime libraries */
+/* before executing a MODULE generated from C code. */
+/* */
+/* Copy this file as an EXEC with a filename matching the C MODULE. */
+/* */
+/* Greg Hartwig (ghartwig@vnet.ibm.com) 7/31/97, 4/24/98. */
+/* */
+/***********************************************************************/
+Address Command
+Parse Arg argstring
+Parse Source . . myname .
+
+/* Set output and input character translation so brackets show up */
+'SET OUTPUT AD' 'BA'x
+'SET OUTPUT BD' 'BB'x
+'SET INPUT BA AD'
+'SET INPUT BB BD'
+
+Call CLIB
+If rc<>0 Then Do
+ Say 'The required C runtime libraries don''t appear to be available.'
+ Say myname 'can not run.'
+ Exit 12
+End
+
+/* Run the command */
+myname argstring
+Exit rc
+
+
+
+
+/* Contents of the CLIB EXEC, modified for RC checking. */
+/* Removed TXTLIB setting. Only LOADLIB needed for execution. */
+CLIB:
+/***************************************************/
+/* SET UP LIBRARIES FOR LE for MVS & VM */
+/***************************************************/
+Address COMMAND
+
+loadlib ='EDCLINK' /* C/370 runtime */
+loadlib ='SCEERUN' /* LE runtime */
+
+
+theirs=queued() /* old stack contentsM068*/
+ 'QUERY LOADLIB ( LIFO' /* old setting M068*/
+ LoadlibList='' /* init list M068*/
+rc=0
+ Do while queued()^=theirs /* all lines from cmdM068*/
+ Parse upper pull 'LOADLIB' '=' Ltemp /* get one line M068*/
+ LoadlibList= Ltemp Loadliblist /* was stacked LIFO M068*/
+ End /*M068*/
+ If loadlibList='NONE' ,
+ Then Do
+ 'GLOBAL LOADLIB' Loadlib /* enforce what we need */
+ End
+ Else Do
+ Do xx=1 to Words(loadlib)
+ If Find(loadliblist,word(loadlib,xx)) = 0 ,
+ then loadliblist = loadliblist word(loadlib,xx)
+ End
+ 'GLOBAL LOADLIB' loadliblist /* enforce what we need */
+ End
+Return
diff --git a/cmsmvs/zipmvsc.job b/cmsmvs/zipmvsc.job
new file mode 100644
index 0000000..6b4b1ca
--- /dev/null
+++ b/cmsmvs/zipmvsc.job
@@ -0,0 +1,95 @@
+//CCZIP JOB (BI09255),
+// MSGLEVEL=(1,1),MSGCLASS=C,CLASS=D,NOTIFY=C888090
+//PROCLIB JCLLIB ORDER=(SYS1.C370.PROCLIB.M24)
+//ZIP EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(ZIP)',
+// OUTFILE='C888090.ZIP.C.OBJ(ZIP),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//CRYPT EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(CRYPT)',
+// OUTFILE='C888090.ZIP.C.OBJ(CRYPT),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//TTYIO EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(TTYIO)',
+// OUTFILE='C888090.ZIP.C.OBJ(TTYIO),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//TREES EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(TREES)',
+// OUTFILE='C888090.ZIP.C.OBJ(TREES),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//DEFLATE EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(DEFLATE)',
+// OUTFILE='C888090.ZIP.C.OBJ(DEFLATE),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//FILEIO EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(FILEIO)',
+// OUTFILE='C888090.ZIP.C.OBJ(FILEIO),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//GLOBALS EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(GLOBALS)',
+// OUTFILE='C888090.ZIP.C.OBJ(GLOBALS),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//UTIL EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(UTIL)',
+// OUTFILE='C888090.ZIP.C.OBJ(UTIL),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//CRC32 EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(CRC32)',
+// OUTFILE='C888090.ZIP.C.OBJ(CRC32),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//CRCTAB EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(CRCTAB)',
+// OUTFILE='C888090.ZIP.C.OBJ(CRCTAB),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//ZIPFILE EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(ZIPFILE)',
+// OUTFILE='C888090.ZIP.C.OBJ(ZIPFILE),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//ZIPUP EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(ZIPUP)',
+// OUTFILE='C888090.ZIP.C.OBJ(ZIPUP),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//CMSMVS EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(CMSMVS)',
+// OUTFILE='C888090.ZIP.C.OBJ(CMSMVS),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//MVS EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
+// INFILE='C888090.ZIP.C(MVS)',
+// OUTFILE='C888090.ZIP.C.OBJ(MVS),DISP=SHR',
+// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
+//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
+//PLINK EXEC PROC=EDCPL,COND=(12,LE),
+// OUTFILE='C888090.ZIP.LOAD(ZIP),DISP=SHR',
+// PPARM='NONCAL,MAP',
+// LPARM='LIST,MAP,XREF'
+//SYSPRINT DD SYSOUT=*
+//PLKED.SYSIN DD DSN=C888090.ZIP.C.OBJ(ZIP),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(BITS),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(CRYPT),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(TREES),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(DEFLATE),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(FILEIO),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(GLOBALS),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(UTIL),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(CRC32),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(CRCTAB),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(ZIPFILE),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(ZIPUP),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(CMSMVS),DISP=SHR
+// DD DSN=C888090.ZIP.C.OBJ(MVS),DISP=SHR
+//PLKED.SYSLIB DD DSN=SYS1.C370.SEDCBASE,DISP=SHR
+// DD DSN=SYS1.PL1.SIBMBASE,DISP=SHR
+//SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(2,2)),DISP=NEW
diff --git a/cmsmvs/zipname.conven b/cmsmvs/zipname.conven
new file mode 100644
index 0000000..e17fe9c
--- /dev/null
+++ b/cmsmvs/zipname.conven
@@ -0,0 +1,200 @@
+
+ Zip file/directories name convention under MVS
+ ---------------------------------------------------
+ Draft 1.1
+
+
+1. Translating native file names to Zip filenames.
+
+1.1 Zipping a PDS
+
+On MVS there are directories called PDS (Partition Data Set) which have
+the following format : name1.name2.name3(mname)
+for example: myuserid.unzip.c(unzip)
+
+So as you see the path delimiter is '.'. Each dir name can be max 8
+chars long beginning with a number.
+
+Between '(' and ')' there is the so called member name - it is also 8
+chars long. This is the actual file name.
+
+
+1.1.1 Converting MVS PDS name to zip path/filename (status: not implemented)
+
+The PDS name is converted to zippath as follows:
+in the zip : name1/name2/mname.name3
+becomes on MVS: name1.name2.name3(mname)
+
+
+1.2 Unzipping as PDS (status: implemented)
+
+When you unzip the file name myuserid/unzip/unzip.c the same process
+is done backwards, so you get : myuserid.unzip.c(unzip)
+
+Notice that the file extension is used as last dirname!
+
+
+1.2 Unzipping to a different PDS (status: implemented)
+
+You can also use -d option while unzipping for example:
+unzip mytest myuserid/unzip/unzip.c -dnewdest.test
+
+then the new name will become:
+newdest.test.myuserid.unzip.c(unzip)
+
+ Second example:
+
+unzip mytest myuserid/unzip/*.c -dnewdest.test
+
+then you get a PDS:
+newdest.test.myuserid.unzip.c(...)
+
+with all *.c files in it.
+
+
+1.3 Zipping a Sequential Dataset (status: not implemented)
+
+ Sequential dataset is a dataset with NO members.
+Such a dataset is translated from native MVS to zip format by replacing
+the '.' (points) with '/' (backslash).
+
+Example:
+on MVS: name1.name2.name3
+becomes in the zip : name1/name2/name3
+
+NOTE : The new filename in the zip has NO extension this way it can be
+ recognised as a Sequential dataset and not a PDS.
+ But this also means that all files in the zip archive that have
+ no extension will be unzipped as Sequential datasets!
+
+
+1.4 Using a DDNAMES for input. (status: not implemented)
+
+To use DDNAMES as input file names put a 'dd:' before the ddname:
+example: zip myzip dd:name1 dd:name2 dd:sales
+
+In the Zip archive the ddnames are saved as name.DDNAME so if you try
+the example above you will get in your zip file (when listing it) :
+
+..size .. date time .. crc .. NAME1.DDNAME
+..size .. date time .. crc .. NAME2.DDNAME
+..size .. date time .. crc .. SALES.DDNAME
+
+
+1.4 Using a DDNAMES as zip name (status: implemented)
+
+It is allowed to use a DDNAME as zipfile, just put dd: before it
+example: unzip dd:myzip *.c
+ this will unzip all .c files from ddname myzip
+
+example2: ZIP DD:MYZIP DD:MANE1 MYSOURCE.C MYDOC.TEXT(ZIPPING)
+ this will zip ddname name1 file mysource.c and PDS mydoc.text(zipping)
+ into as a zip file in the ddname myzip
+
+
+2. Converting longer path names (unix like) (status: not implemented)
+ to native MVS names.
+
+When in the zip archive there are dirnames longer that 8 chars they are
+chopped at the 8 position. For example
+ MyLongZippath/WithLongFileName.text
+is translated to:
+ MYLONGZI.TEXT(WITHLONG)
+
+Notice that all chars are converted to uppercase.
+
+
+2.1 Using special characters (status: implemented)
+
+Also all '_' (underscore), '+' (plus), '-' (minus), '(' and ')'
+from the file name/path in the zip archive are skipped because they
+are not valid in the MVS filenames.
+
+
+2.2 Numeric file names (status: not implemented)
+
+On MVS no name can begin with a number, so when a dir/file name begins with
+one, a leading letter 'N' is inserted. For example:
+ Contents.512
+becomes:
+ CONTENTS.N512
+
+
+
+
+ Zip file/directories name convention under VM/CMS
+ ---------------------------------------------------
+
+1. Translating native file names to Zip filenames.
+
+On VM/CMS (not ESA ) there are NO directories so you got only disks
+and files.
+
+The file names are delimited with spaces. But for use with unzip/zip
+you have to use '.' points as delimiters.
+
+For example on your A disk you have file called PROFILE EXEC
+if you want to zip it type : zip myzip profile.exec
+
+If the same file is on your F disk you have to type:
+zip myzip profile.exec.f
+
+So as you can see the general format is fname.ftype.fmode
+
+In the zipfile the disk from which the file comes is not saved!
+So only the fname.ftype is saved.
+
+If you unzip and you want to give a different destination disk just use
+the -d option like:
+
+ unzip mytest *.c -df
+
+This will unzip all *.c files to your F disk.
+
+
+2. Converting longer path names (unix like) to native VM/CMS names.
+
+When in the zip archive there are dirnames longer that 8 chars they are
+chopped at the 8 position. Also the path is removed. For example
+ Zippath/WithLongFileName.text
+is translated to:
+ WITHLONG.TEXT
+
+Notice that all chars are converted to uppercase.
+
+Also all '+' (plus), '-' (minus), '(' and ')'
+from the file name/path in the zip archive are skipped because they
+are not valid in the VM/CMS filenames.
+
+If there is no extension for the file name in the zip archive, unzip
+will add .NONAME for example:
+ mypath/dir1/testfile
+becomes:
+ TESTFILE.NONAME
+
+3. Future?
+
+There is also discussion for a new option on ZIP that you can give
+a virtual directory to be added before each file name that is zipped.
+
+For example you want to zip a few .c file and put them in the zip
+structure under the directory 'mydir/test', but you can't create dirs on
+VM/CMS so you have to the something like:
+
+ZIP myzip file1.c file2.c -dmydir/test
+
+and you get in the zip archive files:
+
+ mydir/test/file1.c
+ mydir/test/file2.c
+
+-------------------------------------------------------------------------
+
+
+NOTE: Not all of those functions are implemented in the first beta
+ release of VM/MVS UNZIP/ZIP.
+
+Every ideas/corrections/bugs will be appreciated.
+Mail to maillist: Info-ZIP@LISTS.WKU.EDU
+
+George Petrov
diff --git a/cmsmvs/zipnote.exec b/cmsmvs/zipnote.exec
new file mode 100644
index 0000000..0b9de97
--- /dev/null
+++ b/cmsmvs/zipnote.exec
@@ -0,0 +1,66 @@
+/***********************************************************************/
+/* */
+/* Front-end EXEC to set up linkage to the C runtime libraries */
+/* before executing a MODULE generated from C code. */
+/* */
+/* Copy this file as an EXEC with a filename matching the C MODULE. */
+/* */
+/* Greg Hartwig (ghartwig@vnet.ibm.com) 7/31/97, 4/24/98. */
+/* */
+/***********************************************************************/
+Address Command
+Parse Arg argstring
+Parse Source . . myname .
+
+/* Set output and input character translation so brackets show up */
+'SET OUTPUT AD' 'BA'x
+'SET OUTPUT BD' 'BB'x
+'SET INPUT BA AD'
+'SET INPUT BB BD'
+
+Call CLIB
+If rc<>0 Then Do
+ Say 'The required C runtime libraries don''t appear to be available.'
+ Say myname 'can not run.'
+ Exit 12
+End
+
+/* Run the command */
+myname argstring
+Exit rc
+
+
+
+
+/* Contents of the CLIB EXEC, modified for RC checking. */
+/* Removed TXTLIB setting. Only LOADLIB needed for execution. */
+CLIB:
+/***************************************************/
+/* SET UP LIBRARIES FOR LE for MVS & VM */
+/***************************************************/
+Address COMMAND
+
+loadlib ='EDCLINK' /* C/370 runtime */
+loadlib ='SCEERUN' /* LE runtime */
+
+
+theirs=queued() /* old stack contentsM068*/
+ 'QUERY LOADLIB ( LIFO' /* old setting M068*/
+ LoadlibList='' /* init list M068*/
+rc=0
+ Do while queued()^=theirs /* all lines from cmdM068*/
+ Parse upper pull 'LOADLIB' '=' Ltemp /* get one line M068*/
+ LoadlibList= Ltemp Loadliblist /* was stacked LIFO M068*/
+ End /*M068*/
+ If loadlibList='NONE' ,
+ Then Do
+ 'GLOBAL LOADLIB' Loadlib /* enforce what we need */
+ End
+ Else Do
+ Do xx=1 to Words(loadlib)
+ If Find(loadliblist,word(loadlib,xx)) = 0 ,
+ then loadliblist = loadliblist word(loadlib,xx)
+ End
+ 'GLOBAL LOADLIB' loadliblist /* enforce what we need */
+ End
+Return
diff --git a/cmsmvs/zipsplit.exec b/cmsmvs/zipsplit.exec
new file mode 100644
index 0000000..0b9de97
--- /dev/null
+++ b/cmsmvs/zipsplit.exec
@@ -0,0 +1,66 @@
+/***********************************************************************/
+/* */
+/* Front-end EXEC to set up linkage to the C runtime libraries */
+/* before executing a MODULE generated from C code. */
+/* */
+/* Copy this file as an EXEC with a filename matching the C MODULE. */
+/* */
+/* Greg Hartwig (ghartwig@vnet.ibm.com) 7/31/97, 4/24/98. */
+/* */
+/***********************************************************************/
+Address Command
+Parse Arg argstring
+Parse Source . . myname .
+
+/* Set output and input character translation so brackets show up */
+'SET OUTPUT AD' 'BA'x
+'SET OUTPUT BD' 'BB'x
+'SET INPUT BA AD'
+'SET INPUT BB BD'
+
+Call CLIB
+If rc<>0 Then Do
+ Say 'The required C runtime libraries don''t appear to be available.'
+ Say myname 'can not run.'
+ Exit 12
+End
+
+/* Run the command */
+myname argstring
+Exit rc
+
+
+
+
+/* Contents of the CLIB EXEC, modified for RC checking. */
+/* Removed TXTLIB setting. Only LOADLIB needed for execution. */
+CLIB:
+/***************************************************/
+/* SET UP LIBRARIES FOR LE for MVS & VM */
+/***************************************************/
+Address COMMAND
+
+loadlib ='EDCLINK' /* C/370 runtime */
+loadlib ='SCEERUN' /* LE runtime */
+
+
+theirs=queued() /* old stack contentsM068*/
+ 'QUERY LOADLIB ( LIFO' /* old setting M068*/
+ LoadlibList='' /* init list M068*/
+rc=0
+ Do while queued()^=theirs /* all lines from cmdM068*/
+ Parse upper pull 'LOADLIB' '=' Ltemp /* get one line M068*/
+ LoadlibList= Ltemp Loadliblist /* was stacked LIFO M068*/
+ End /*M068*/
+ If loadlibList='NONE' ,
+ Then Do
+ 'GLOBAL LOADLIB' Loadlib /* enforce what we need */
+ End
+ Else Do
+ Do xx=1 to Words(loadlib)
+ If Find(loadliblist,word(loadlib,xx)) = 0 ,
+ then loadliblist = loadliblist word(loadlib,xx)
+ End
+ 'GLOBAL LOADLIB' loadliblist /* enforce what we need */
+ End
+Return
diff --git a/cmsmvs/zipup.h b/cmsmvs/zipup.h
new file mode 100644
index 0000000..0ea8962
--- /dev/null
+++ b/cmsmvs/zipup.h
@@ -0,0 +1,18 @@
+/*
+ Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
+
+ See the accompanying file LICENSE, version 1999-Oct-05 or later
+ (the contents of which are also included in zip.h) for terms of use.
+ If, for some reason, both of these files are missing, the Info-ZIP license
+ also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
+*/
+#define fhow "r,byteseek"
+#define fhowb "rb,byteseek"
+
+#define fbad NULL
+typedef FILE *ftype;
+#define zopen(n,p) (ftype)fopen((n),(p))
+#define zread(f,b,n) fread((b),1,(n),(FILE*)(f))
+#define zclose(f) fclose((FILE*)(f))
+#define zerr(f) ferror((FILE*)(f))
+#define zstdin stdin
diff --git a/cmsmvs/zipvmc.exec b/cmsmvs/zipvmc.exec
new file mode 100644
index 0000000..3232649
--- /dev/null
+++ b/cmsmvs/zipvmc.exec
@@ -0,0 +1,50 @@
+/* VMCOMPIL EXEC Unzip compile for VM/CMS */
+/* Author : George Petrov, 11 Apr 1995 */
+
+signal on error
+
+parms = '(long def(VM_CMS)'
+
+/* Add local parms */
+parms = parms 'TARGET(COMPAT) SOURCE'
+
+
+say 'Compiling TREES C...'
+'cc trees c 'parms
+say 'Compiling CRYPT C...'
+'cc crypt c 'parms
+say 'Compiling TTYIO C...'
+'cc ttyio c 'parms
+say 'Compiling DEFLATE C...'
+'cc deflate c 'parms
+say 'Compiling FILEIO C...'
+'cc fileio c 'parms
+say 'Compiling GLOBALS C...'
+'cc globals c 'parms
+say 'Compiling ZIP C...'
+'cc zip c 'parms
+say 'Compiling UTIL C...'
+'cc util c 'parms
+say 'Compiling CRC32 C...'
+'cc crc32 c 'parms
+say 'Compiling CRCTAB C...'
+'cc crctab c 'parms
+say 'Compiling ZIPFILE C...'
+'cc zipfile c 'parms
+say 'Compiling ZIPUP C...'
+'cc zipup c 'parms
+say 'Compiling CMSMVS C...'
+'cc cmsmvs c 'parms
+say 'Compiling CMS C...'
+'cc cms c 'parms
+
+say 'Linking all files...'
+'cmod zip zip trees crypt deflate fileio globals ttyio',
+ 'util crc32 crctab zipfile zipup cmsmvs cms'
+say 'All Done!'
+say "To run enter : ZIP parms"
+exit rc
+
+error:
+say 'Error durring compilation!'
+exit rc