1.!
2.!  File:       ZIP.RNH
3.!
4.!  Author:     Hunter Goatley
5.!
6.!  Date:       October 22, 1991
7.!
8.!  Description:
9.!
10.!      RUNOFF source file for portable ZIP on-line help for VMS.
11.!      Adapted from MANUAL, distributed with ZIP.
12.!
13.!      To build:       $ RUNOFF ZIP.RNH
14.!                      $ LIBR/HELP/INSERT libr ZIP
15.!
16.!  Modification history:
17.!
18.!      Hunter Goatley          22-OCT-1991 20:45
19.!              Genesis.
20.!      Jean-loup Gailly        25 March 92
21.!              Adaptation to zip 1.6.
22.!      Igor Mandrichenko       9-JUN-1992
23.!              Added explanation of -V option.
24.!      Jean-loup Gailly        14 June 92
25.!              Adaptation to zip 1.8.
26.!      Jean-loup Gailly        20 Aug 92
27.!              Adaptation to zip 1.9.
28.!      Jean-loup Gailly        31 Aug 93
29.!              Adaptation to zip 2.0.
30.!      Christian Spieler       20 Sep 93
31.!              Adaptation to zip 2.0 and OpenVMS completed.
32.!      Christian Spieler       05 Dec 95
33.!              Adaptation to zip 2.1, new options.
34.!      Christian Spieler       20 Jan 96
35.!              Changed -L and -v descriptions.
36.!      Christian Spieler       11 Feb 96
37.!              Added -X option.
38.!      Onno van der Linden,
39.!      Christian Spieler       13 Mar 96
40.!              Removed -ee option.
41.!      Christian Spieler       09 Feb 96
42.!              Updated copyright notice, Zip version.
43.!      Christian Spieler       21 Jul 97
44.!              Added -P, -R, -i@, -x@ and -tt options, modified for Zip 2.2.
45.!      Christian Spieler       14 Oct 97
46.!              unified spelling of "Info-ZIP", final cleanups for 2.2.
47.!      Steven Schweda          10 May 2007
48.!              General update for version 3.0.
49.!      Ed Gordon               12 May 2007
50.!              Minor updates for version 3.0.
51.!
52.noflags
53.lm4 .rm72
54.indent -4
551 ZIP
56.br
57Zip is a compression and file packaging utility for several operating
58systems, including UNIX, VMS,  MSDOS, OS/2, Windows 9x/NT/XP, Minix, Atari,
59Macintosh, Amiga, and Acorn RISC OS.  It is analogous to a combination of
60tar and compress and is compatible with PKZIP (Phil Katz's ZIP) for
61MSDOS systems.
62.sk
63Zip is useful for packaging a set of files for distribution, for
64archiving files, and for saving disk space by temporarily compressing
65unused files or directories.  A companion program, UnZip, unpacks Zip
66archives.
67.sk
68For brief help on Zip or UnZip, run the program without specifying any
69parameters on the command line.
70.sk
71This description covers the Zip program which uses a UNIX-style command
72line.  A separate program is available which provides a VMS-style CLI
73command line, and it has its own documentation.  Refer to the Zip
74installation instructions for details.
75.sk
76Format
77.sk;.lm+2;.literal
78ZIP [-options] archive inpath inpath ...
79.end literal;.lm-2
80.!------------------------------------------------------------------------------
81.indent -4
822 Basic_Usage
83.br
84Format
85.sk;.lm+2;.literal
86ZIP [-options] archive inpath inpath ...
87.end literal;.lm-2
88.sk
89The default action of Zip is to add or replace entries in "archive" from
90the list of "inpath" file specifications, which can include directories
91and file names with VMS-style wildcards, or the special name -@ to read
92file specifications from SYS$INPUT (stdin).
93.sk
94With SET PROCESS /PARSE_STYLE = EXTENDED (available on recent non-VAX
95systems), Zip preserves the case of the command line.  Otherwise, mixed-
96or upper-case options and arguments must be quoted.  For example,
97"-V".  Examples in this document generally do not show this quotation,
98so VAX and /PARSE_STYLE = TRADITIONAL users (that is, troglodytes) will
99need to add quotation where needed when working with these examples.
100.sk
101General
102.sk
103Zip reads one or more files, compresses the data (normally), and stores
104the compressed information into a single Zip archive file, along with
105information about each file (name, path, date and time of last
106modification, protection, and check information to verify file
107integrity).  On a VMS system, Zip can also save VMS/RMS file attributes,
108allowing UnZip to restore the files without loss of important file
109attributes.  Zip can pack an entire directory structure into a Zip
110archive with a single command.
111.sk
112Compression
113.sk
114Compression ratios of 2:1 to 3:1 are common for text files.  Zip has one
115standard compression method ("deflate") and can also store files without
116compression.  Zip (and UnZip) may be built with optional support for the
117bzip2 compression method.  Then, the user may select bzip2 compression
118instead of the default "deflate" method.  Zip automatically chooses
119simple storage over compression for a file, if the specified compression
120method does not actually compress the data in that file.
121.sk
122Compatibility
123.sk
124Zip and UnZip can work with archives produced by PKZIP (supporting most
125PKZIP features up to PKZIP version 4.6), and PKZIP and PKUNZIP can work
126with archives produced by Zip (with some exceptions, notably streamed
127archives, but recent changes in the .ZIP file standard may facilitate
128better compatibility).  Zip version 3.0 is compatible with PKZIP 2.04
129and also supports the Zip64 extensions of PKZIP 4.5 which allows
130archives as well as files to exceed the previous 2 GB limit (4 GB in
131some cases).  Zip also supports bzip2 compression if the bzip2 library
132is included when Zip is built.  Note that PKUNZIP 1.10 cannot extract
133files produced by PKZIP 2.04 or Zip 3.0.  You must use PKUNZIP 2.04g or
134UnZip 5.0p1 (or later versions) to extract them.
135.sk
136Large Archives and Zip64
137.sk
138Where the operating system and C run-time support allow, Zip 3.0 and
139UnZip 6.0 (and later versions) support large files (input and archive),
140using the Zip64 extensions to the original .ZIP file format.  On VMS,
141this genarally means non-VAX systems with VMS V7.2 or later (perhaps
142requiring a C RTL ECO before VMS V7.3-2).
143.sk
144Zip automatically uses the Zip64 extensions when a file larger than 2 GB
145is added to an archive, an archive containing a Zip64 entry is updated
146(if the resulting archive still needs Zip64), the size of the archive
147will exceed 4 GB, or when the number of entries in the archive will
148exceed about 64K.  Zip64 is also used for archives streamed to a
149non-seekable output device.  You must use a 4.5 compatible UnZip to
150extract files using the Zip64 extensions such as UnZip 6.0 or later.
151.sk
152In addition, streamed archives, entries encrypted with standard
153encryption, or split archives created with the pause option may not be
154compatible with PKZIP as data descriptors are used, and PKZIP at the
155time of this writing does not support data descriptors (but recent
156changes in the PKWare published .ZIP file standard now include some
157support for the data descriptor format Zip uses).
158.!------------------------------------------------------------------------------
159.indent -4
1602 More_Usage
161.br
162Here is a very simple example of Zip use:
163.sk;.indent 10;
164$ zip stuff.zip *.*
165.sk
166This will create the Zip archive "stuff.zip" (assuming it does not
167already exist) and put all the (non-directory) files (";0") from the
168current default directory into "stuff.zip" in a compressed form.  The
169archive is opened using a default file specification of
170"SYS$DISK:[].zip", so specifying "stuff" as the archive name would also
171create (or use an existing) "stuff.zip", but specifying "stuff.other"
172would give you that name.  In general, Zip doesn't care about the type
173in the file specification, but for split archives (archives split over
174multiple files), the user should normally specify a type-less name,
175because Zip will normally generate sequentially numbered types ".z01",
176".z02", and so on for the early splits, and then the required ".zip" for
177the last split.  These file types are required by the Zip standard for
178split archives.
179.sk
180Standard VMS wildcard expansion ($SEARCH) is used to interpret the
181"inpath" file and directory specifications, like the "*.*" in this
182example.
183.sk
184On VMS, the most natural way to archive an entire directory tree is to
185use a directory-depth wildcard ("[...]").  For example:
186.sk;.indent 10
187zip foo [...]*.*
188.sk
189This will create the file "foo.zip" containing all the files (";0") and
190directories in and below the current default directory.  A more
191UNIX-like way to do this would be to use the -r (--recurse-paths)
192option:
193.sk;.indent 10
194$ zip -r foo *.*
195.sk
196Zip avoids including its own output files when selecting files to
197include in the archive, so it should be safe, as in this case, to create
198the archive in the same drectory as the input files.
199.sk
200One or more specific files, directories, or subdirectories may also be
201specified:
202.lm +10;.literal
203zip foo.zip readme.txt [www...]*.* [.ftp...]*.* -
204 [.src]*.h [.src]*.c
205.end literal;.lm -10
206.sk
207For security reasons, paths in Zip archives are always stored as
208relative paths, so some care is needed when creating an archive so that
209it will create the intended directory structure when UnZip is used to
210unpack it.
211.sk
212To use -r with a specific directory, the name of the directory file
213itself must be specified:
214.sk;.indent 10
215zip -r foo.zip [000000]www.dir ftp.dir
216.sk
217You may want to make an archive that contains the files in [.foo], but not
218record the directory name, "foo".  You can use the -j (junk path) option
219to leave off the path:
220.sk;.indent 10
221$ zip -j foo [.foo]*.*
222.sk
223If you are short on disk space, you might not have enough room to hold
224both the original directory and the corresponding compressed Zip
225archive.  In this case, you can create the archive in steps, and use the
226-m option.  For example, if [.foo] contains the subdirectories [.tom],
227[.dick], and [.harry], you could:
228.sk
229.lm +10;.literal
230zip -m foo [.foo.tom...]*.*
231zip -m foo [.foo.dick...]*.*
232zip -m foo [.foo.harry...]*.*
233.end literal;.lm -10
234.sk
235The first command would create foo.zip, and the next two would add to
236it.  The -m option means "move", and it will cause Zip to delete all
237files added to the archive after making or updating foo.zip.  No
238deletions will be done until the Zip operation has completed with no
239errors.  This option is obviously dangerous and should be used with
240care, but it does reduce the need for free disk space.  When -m is
241used, the -T option is recommended and will test the resulting archive
242before deleting the input files.
243.sk
244If a file specification list is too long to fit conveniently on the Zip
245command line, the -@ option can be used to cause Zip to read a list of
246file specifications from SYS$INPUT (stdin).  If a DCL command procedure
247is used, the names can be specified in the procedure:
248.sk;
249.lm +10;.literal
250$ zip foo -@
251$ deck
252file_spec_1
253file_spec_2
254file_spec_3
255$ eod
256.end literal;.lm -10
257.sk
258The file specifications can also be put into a separate file, and fed
259into Zip by explicitly defining SYS$INPUT, or by using PIPE.  For
260example, with the list in foo.zfl:
261.sk;
262.lm +10;.literal
263$ define /user_mode sys$input foo.zfl
264$ zip foo -@
265.end literal;.lm -10;
266or:
267.lm +10;.literal
268$ pipe type foo.zfl | zip foo -@
269.end literal;.lm -10
270.sk
271If Zip is not able to read a file, it issues a warning but continues.
272See the -MM option for more on how Zip handles patterns that are not
273matched and files that are not readable.  If some files were skipped, a
274warning is issued at the end of the Zip operation noting how many files
275were read and how many skipped.
276.!------------------------------------------------------------------------------
277.indent -4
2782 Comments
279.br
280One-line comments may be included in the archive for each file added,
281using the -c (--entry-comments) option.  File operations (adding,
282updating) are done first, and the user is then prompted for a one-line
283comment for each file added or updated.  Enter the comment followed by
284<Return>, or just <Return> for no comment.
285.sk
286A single multi-line comment may be included for the archive as a whole,
287using the -z (--archive-comment) option.  UnZip (including UnZip SFX)
288will display this comment when it expands the archive.  The comment is
289read from SYS$INPUT (stdin), and is terminated by the usual end-of-file
290character, CTRL/Z.  As usual, in a DCL command procedure, these data can
291be included in-line in the procedure, or a user may DEFINE SYS$INPUT to
292a file to get the comment from that file.  Where supported, the DCL PIPE
293command can also be used to redirect SYS$INPUT from a file.
294.sk
295Note that -z (--archive-comment) and -@ (read file specifications from
296SYS$INPUT (stdin)) can't be used together (successfully).
297.!------------------------------------------------------------------------------
298.indent -4
2992 Compression
300.br
301Zip can archive files with or without compression.  The standard
302compression method ("deflate") is compatible with all UnZip versions
303(except really old ones that only understand the "store" method).
304Current Zip and UnZip versions may be built with optional support for
305the bzip2 compression method.  (The bzip2 method can compress better,
306especially when compressing smaller files, but uses more CPU time, and
307requires an UnZip which includes the optional bzip2 support.  See the
308installation instructions for details on adding bzip2 compression
309support at build time.)
310.sk
311Numeric compression level options control the effort put into data
312compression, with -1 being the fastest, and -9 giving the most
313compression.
314.sk
315Compression control options:
316.sk;.lm +10;.literal
317-Z mthd                      use compress method "mthd",
318--compression-method mthd    "bzip2" or "deflate" (default)
319
320-0  (--store)                no compression
321-1  (--compress-1)           compression level 1
322-2  (--compress-2)           compression level 2
323-3  (--compress-3)           compression level 3
324-4  (--compress-4)           compression level 4
325-5  (--compress-5)           compression level 5
326-6  (--compress-6)           compression level 6
327-7  (--compress-7)           compression level 7
328-8  (--compress-8)           compression level 8
329-9  (--compress-9)           compression level 9
330.end literal;.lm -10
331.sk
332Normally, a file which is already compressed will not be compressed much
333further (if at all) by Zip, and trying to do it can waste considerable
334CPU time.  Zip can suppress compression on files with particular types,
335specified as a colon- or semi-colon-separated list of file types:
336.sk;.indent 10
337-n type1[:type2[...]]  (--suffixes type1[:type2[...]])
338.sk
339For example:
340.sk;.indent 10
341zip -n .bz2:.gz:.jpeg:.jpg:.mp3:.zip foo [.foo]*.*
342.sk
343will put everything (";0") from [.foo] into foo.zip, but will store any
344files that end in .bz2, .gz, .jpeg, .jpg, .mp3, or .zip, without trying
345to compress them.
346.sk
347The default type list is .Z:.zip:.zoo:.arc:.lzh:.arj, and the comparison
348is case-insensitive.
349.sk
350-9 (--compress-9) will override -n (--suffixes), causing compression to
351be attempted for all files.
352.!------------------------------------------------------------------------------
353.indent -4
3542 Encryption
355.br
356Zip offers optional encryption, using a method which by modern standards
357is generally considered to be weak.
358.sk;.literal
359-e  --encrypt
360.end literal;.br
361Encrypt new or updated archive entries using a password which is
362supplied by the user interactively on the terminal in response to a
363prompt.  (The password will not be echoed.)  If SYS$COMMAND is not a
364terminal, Zip will exit with an error.  The password is verified before
365being accepted.
366.sk;.literal
367-P password  --password password
368.end literal;.br
369Use "password" to encrypt new or updated archive entries (if any).
370USING -P IS INSECURE!   Many multi-user operating systems provide ways
371for any user (or a privileged user) to see the current command line of
372any other user.  Even on more secure systems, there is always the threat
373of over-the-shoulder peeking.  Storing the plaintext password as part of
374a command line in a command procedure is even less secure.  Whenever
375possible, use the non-echoing, interactive password entry method.
376.sk
377Because standard Zip encryption is weak, where security is truly
378important, use a strong encryption program, such as Pretty Good Privacy
379(PGP) or GNU Privacy Guard (GnuPG), on an archive instead of standard
380Zip encryption.  A stronger encryption method, such as AES, is planned
381for Zip 3.1.
382.!------------------------------------------------------------------------------
383.indent -4
3842 Exit_Status
385.br
386On VMS, Zip's UNIX-style exit values are mapped into VMS-style status
387codes with facility code 1955 = %x7A3, and with the inhibit-message
388(%x10000000) and facility-specific (%x00008000) bits set:
389.sk
390.literal
391   %x17A38001                        normal exit
392   %x17A38000+ 16* Zip_error_code    warnings
393   %x17A38002+ 16* Zip_error_code    normal errors
394   %x17A38004+ 16* Zip_error_code    fatal errors
395.end literal
396.sk
397Note that multiplying the UNIX-style Zip error code by 16 places it
398conveniently in the hexadecimal representation of the VMS exit code,
399"__" in %x17A38__s, where "s" is the severity code.  For example, a
400truncated archive might cause Zip error code 2, which would be
401transformed into the VMS exit status %x17A38024.
402.sk
403The Zip VMS exit codes include severity values which approximate those
404defined by PKWARE, as shown in the following table:
405.literal
406
407    VMS      Zip err
408  severity    code     Error description
409 ----------+---------+----------------------------------------------
410  Success       0      Normal; no errors or warnings detected.
411  Fatal         2      Unexpected end of archive.
412  Error         3      A generic error in the  archive  format  was
413                       detected.   Processing  may  have  completed
414                       successfully anyway;  some  broken  archives
415                       created by other archivers have simple work-
416                       arounds.
417  Fatal         4      Zip was unable to allocate memory for one or
418                       more  buffers during program initialization.
419  Fatal         5      A severe error in  the  archive  format  was
420                       detected.   Processing probably failed imme-
421                       diately.
422  Error         6      Entry too large to be split with zipsplit.
423  Error         7      Invalid comment format.
424  Fatal         8      Zip -T failed or out of memory.
425  Error         9      The user aborted zip prematurely  with  con-
426                       trol-C (or equivalent).
427  Fatal        10      Zip  encountered an error while using a temp
428                       file.
429  Fatal        11      Read or seek error.
430  Warning      12      Zip has nothing to do.
431  Error        13      Missing or empty zip file.
432  Fatal        14      Error writing to a file.
433  Fatal        15      Zip was unable to create a file to write to.
434  Error        16      Bad command line parameters.
435  Error        18      Zip could not open a specified file to read.
436  Fatal        19      Zip was built with options not supported  on
437                       this system
438  Fatal        20      Attempt to read unsupported Zip64 archive
439.end literal
440.!------------------------------------------------------------------------------
441.indent -4
4422 Extra_Fields
443.br
444The .ZIP file format allows some extra data to be stored with a file in
445the archive.  For example, where local time zone information is
446available, Zip can store UTC date-time data for files.  (Look for
447USE_EF_UT_TIME in a "zip -v" report.)  On VMS, with -V or -VV, Zip will
448also store VMS-specific file attributes.  These data are packaged as
449"extra fields" in the archive.  Some extra fields are specific to a
450particular operating system (like VMS file attributes).  Large files
451(bigger than 4GB) on any OS require an extra field to hold their 64-bit
452size data.  Depending on the capabilities of the UnZip program used to
453expand the archive, these extra fields may be used or ignored when files
454are extracted from the archive.
455.sk
456Some extra fields, like UTC date-times or VMS file attributes, are
457optional.  Others, like the Zip64 extra field which holds 64-bit sizes
458for a large file, are required.
459.sk
460The -X (--strip-extra) option suppresses the saving of any optional
461extra fields in the archive.  (Thus, -X conflicts with -V or -VV.)
462.!------------------------------------------------------------------------------
463.indent -4
4642 Environment
465.br
466A user can specify default command-line options and arguments by
467defining an "environment variable" (that is, a logical name or DCL
468symbol), "ZIP_OPTS" or "ZIPOPT", to specify them.  If both "ZIP_OPTS" and
469"ZIPOPT" are specified, the definition of "ZIPOPT" prevails.
470.sk
471The C RTL function getenv() is used to sense these variables, so its
472behavior determines what happens if both a logical name and a symbol are
473defined.  As of VMS V7.3, a logical name supercedes a symbol.
474.sk
475The "zip -v" report should show the perceived settings of these
476variables.
477.!------------------------------------------------------------------------------
478.indent -4
4792 File_Names
480.br
481Zip deals with file names in the system file system and with file names
482in Zip archives.  File names in a Zip archive are stored in a UNIX-like
483path-name format.  For example, a VMS file specification like this:
484.sk;.indent 10
485[.zip30.vms]descrip.mms
486.sk
487could appear in a Zip archive as:
488.sk;.indent 10
489zip30/vms/descrip.mms
490.sk
491For security reasons, paths in Zip archives are always stored as
492relative paths, so an absolute VMS directory specification will be
493transformed to a relative path in the archive (that is, no leading "/").
494For example, the following absolute directory specification would give
495the same archive path as the previous (relative) example:
496.sk;.indent 10
497[zip30.vms]descrip.mms
498.sk
499Also, device names are dropped, so the following file specification
500would also give the same archive path:
501.sk;.indent 10
502sys$sysdevice:[zip30.vms]descrip.mms
503.sk
504If an archive is intended for use with PKUNZIP under MSDOS, then the -k
505(for "Katz", --DOS-names) option should be used to attempt to adjust the
506names and paths to conform to MSDOS character-set and length
507limitations, to store only the MSDOS file attributes (just the
508owner:write attribute from VMS), and to mark the entry as made under
509MSDOS (even though it wasn't).
510.sk
511Note that file specifications in the file system must be specified using
512VMS notation, but file names in an archive must be specified using the
513UNIX-like notation used in the archive.  For example, where a BACKUP
514command might look like this:
515.sk.indent 10
516$ back [.zip30...]*.* /excl = [...vms]*.c stuff.bck /save
517.sk
518a corresponding Zip command might look like this:
519.sk;.indent 10;
520$ zip stuff.zip [.zip30...]*.* -x */vms/*.c
521.sk
522because the files to be added to the Zip archive are specified using VMS
523file specifications, but the -x (--exclude) option excludes names based
524on their archive path/file names.  Options dealing with archive names
525include -R (--recurse-patterns), -d (--delete), -i (--include), -x
526(--exclude), and -U (--copy-entries).
527.sk
528Note: By default, on VMS, archive name pattern matching (-R, -d, -i, -x,
529and -U) is case sensitive, even when the file system is not case
530sensitive (or even case preserving).  This allows accurate matching of
531mixed-case names in an archive which may have been created on a system
532with a case sensitive file system, but it can involve extra effort on
533VMS, where it may be necessary to use unnatural case names (or the same
534names in multiple cases, like "*.obj *.OBJ") for this kind of pattern
535matching to give the desired behavior.  If completely case-blind pattern
536matching behavior is desired, specify the -ic (--ignore-case) option.
537.!------------------------------------------------------------------------------
538.indent -4
5393 Case
540.br
541For better compatibility with UNIX-like systems, Zip, by default,
542down-cases ODS2 file names.  For example, the following file on an ODS2
543file system:
544.sk;.indent 10
545[.ZIP30.VMS]DESCRIP.MMS
546.sk
547would appear in an archive as:
548.sk;.indent 10
549zip30/vms/descrip.mms
550.sk
551Zip versions before 3.0 down-cased all VMS file names.  Now, various
552options give the user control over these conversions:
553.sk
554.lm +10;.literal
555-C    preserve case of all file names
556-C-   down-case all file names
557-C2   preserve case of ODS2 names
558-C2-  down-case ODS2 file names (default)
559-C5   preserve case of ODS5 names (default)
560-C5-  down-case ODS5 file names
561.end literal;.lm -10
562.sk
563Case is handled differently for archive member names, which the user
564specifies with the -R, -d, -i, -x, and -U options.  By default, on VMS,
565archive name pattern matching is case sensitive, even when the file
566system is not case sensitive (or even case preserving).  This allows
567accurate matching of mixed-case names in an archive which may have been
568created on a system with a case sensitive file system, but it can
569involve extra effort on VMS, where it may be necessary to use unnatural
570case names (or the same names in multiple cases, like "*.obj *.OBJ") for
571this kind of pattern matching to give the desired behavior.  If
572completely case-blind pattern matching behavior is desired, specify the
573-ic (--ignore-case) option.
574.!------------------------------------------------------------------------------
575.indent -4
5762 Fixing_Damage
577.br
578Two options can be used to fix a damaged Zip archive.
579.sk;.literal
580-F  --fix
581-FF  --fixfix
582.end literal;.sk
583The -F (--fix) option can be used if some portions of the archive are
584missing, but it requires a reasonably intact central directory.  The
585input archive is scanned as usual, but zip will ignore some problems.
586The resulting archive should  be valid, but any inconsistent entries
587will be left out.
588.sk
589If the archive is too damaged or the end (where the central directory is
590situated) has been truncated, you must use -FF (--fixfix).  This is a
591change from zip 2.32, where the -F option is able to read a truncated
592archive.  The -F option now more reliably fixes archives with minor
593damage, and the -FF option is needed to fix archives where -F and -FF
594was used before.
595.sk
596With -FF, the archive is scanned from the beginning and Zip scans for
597special signatures to identify the limits between the archive members.
598The -F option is more reliable if the archive is not too much damaged,
599so try this option first.
600.sk
601Neither option will recover archives that have been incorrectly
602transferred, such as by FTP in ASCII mode instead of binary.  After the
603repair, the -t option of UnZip may show that some files have a bad CRC.
604Such files cannot be recovered; you can remove them from the archive
605using the -d option of Zip.
606.sk
607Because of the uncertainty of the "fixing" process, it's required
608to specify an output archive, rather than risking further damage to the
609original damaged archive.  For example, to fix the damaged archive
610foo.zip,
611.sk;.indent 10
612zip -F foo --out foo_fix
613.sk
614tries to read the entries normally, copying good entries to the new
615archive foo_fix.zip.  If this doesn't work, as when the archive is
616truncated, or if some entries are missed because of bad central
617directory entries, try -FF:
618.sk;.indent 10
619zip -FF foo --out foo_fixfix
620.sk
621and compare the resulting archive to the archive created using -F. The
622-FF option may create an inconsistent archive.  Depending on what is
623damaged, you can then use the -F option to fix that archive.
624.sk
625A split archive with missing split files can be fixed using -F if you
626have the last split of the archive (the ".zip" file).  If this file is
627missing, you must use -FF to fix the archive, which will prompt you for
628the splits you have.
629.sk
630Currently, the fix options can't recover an entry which has a bad
631checksum or is otherwise damaged.
632.!------------------------------------------------------------------------------
633.indent -4
6342 Log_File
635.br
636Zip normally sends messages to the user's terminal, but these may be
637also directed to a log file.
638.sk;.literal
639-la  --log-append
640.end literal;.br
641Append to an existing log file.  Default is to create a new version.
642.sk;.literal
643-lf logfilepath  --logfile-path logfilepath
644.end literal;.br
645Open a logfile at the given path.  By default, a new version will be
646created, but with the -la option an existing file will be opened and the
647new log information appended to any existing information.  Only
648warnings and errors are written to the log unless the -li option is also
649given, then all information messages are also written to the log.
650.sk;.literal
651-li  --log-info
652.end literal;.br
653Include information messages, such as file names being zipped, in the
654log.  The default is to include only the command line, any warnings
655and errors, and the final status.
656.!------------------------------------------------------------------------------
657.indent -4
6582 Modes_of_Operation
659.br
660Zip supports two distinct types of command modes, external and
661internal.  The external modes (update, grow, and freshen) read files
662from the file system (as well as from an existing archive) while the
663internal modes (delete and copy) operate exclusively on entries in an
664existing archive.
665.sk;.literal
666-u  --update
667.end literal;.br
668Update existing entries and add new files.  If the archive does not
669exist, create it.  This is the default mode, so -u is optional.
670.sk;.literal
671-g  --grow
672.end literal;.br
673Grow (append to) the specified Zip archive, instead of creating a new
674one.  If this operation fails, Zip attempts to restore the archive to
675its original state.  If the restoration fails, the archive might become
676corrupted.  This option is ignored when there's no existing archive or
677when at least one archive member must be updated or deleted.
678.sk;.literal
679-f  --freshen
680.end literal;.br
681Update existing entries in an existing archive.  Does not add new files
682to the archive.
683.sk;.literal
684-d  --delete
685.end literal;.br
686Delete entries from an existing archive.
687.sk;.literal
688-DF  --difference-archive
689.end literal;.br
690Create an incremental backup-style archive, where the resulting archive
691will contain all new and changed files since the original archive was
692created.  For this to work, the input file list and current directory
693must be the same as during the original Zip operation.
694.sk
695For example, if the existing archive was created using
696.sk;.indent 10
697zip foo_full.zip [.foo...]*.*
698.sk
699from just above the foo directory, then the command (also from just
700above the foo directory):
701.sk;.indent 10
702zip foo_full.zip [.foo...]*.* -DF -O foo_incr.zip
703.sk
704creates the archive foo_incr.zip with just the files not in foo_full.zip
705and the files where the size or date-time of the files does not match
706that in foo_full.zip.  Note that in the "zip -DF" operation, the
707original full archive is specified as the input archive, and the -O
708(--output-file) option is used to specify the new (incremental) output
709archive.
710.sk;.literal
711-FS  --filesync
712.end literal;.br
713Delete entries in the archive that do not match files on the OS.
714Normally when an archive is updated, new files are added and changed
715files are updated but files that no longer exist on the OS are not
716deleted from the archive.  This option enables deleting of entries that
717are not matched on the OS.  Enabling this option should create archives
718that are the same as new archives, but since existing entries are copied
719instead of compressed, updating an existing archive with -FS can be much
720faster than creating a new archive.  If few files are being copied from
721the old archive, it may be faster to create a new archive instead.
722.sk
723This option deletes files from the archive.  If you need to preserve the
724original archive, make a copy of the archive first, or use the  -O
725(--output) option to output the new archive to a new file.  Even though
726it's slower, creating a new archive with a new archive name is safer,
727avoids mismatches between archive and OS paths, and is preferred.
728.sk;.literal
729-U  --copy-entries
730.end literal;.br
731Select entries in an existing archive and copy them to a new archive.
732Copy mode is like update mode, but entries in the existing archive are
733selected by command line patterns rather than files from the file system
734and it uses the -O (--output-file) option to write the resulting archive
735to a new file rather than updating the existing archive, leaving the
736original archive unchanged.
737.sk
738Normally, when updating an archive using relative file specifications
739("[]", "[.xxx]", and so on), it helps to have the same default directory
740as when the archive was created, but this is not a strict requirement.
741.sk
742Date-time information in a Zip archive may be influenced by time zone.
743.!------------------------------------------------------------------------------
744.indent -4
7453 Examples
746.br
747When given the name of an existing archive, Zip will replace identically
748named entries in the archive or add entries for new names.  For example,
749if foo.zip exists and contains foo/file1 and foo/file2, and the
750directory [.foo] contains the files file1 and file3, then:
751.sk;.indent 10
752$ zip foo [.foo...]*.*
753.sk
754will replace foo/file1 in foo.zip and add foo/file3 to foo.zip.  After
755this, foo.zip contains foo/file1, foo/file2, and foo/file3, with foo/file2
756unchanged from before.  This is the default mode -u (update).
757.sk
758Update will add new entries to the archive and will replace
759existing entries only if the modified date of the file is more recent than
760the date recorded for that name in the archive.  For example:
761.sk;.indent 10
762$ zip -u stuff *.*
763.sk
764will add any new files in the current directory, and update any changed
765files in the archive stuff.zip.  Note that Zip will not try to pack
766stuff.zip into itself when you do this.  Zip avoids including its own
767output files when selecting files to include in the archive, so it
768should be safe, as in this case, to have the archive included in the
769list of input files.
770.sk
771A second mode, -f (freshen), like update will only
772replace entries with newer files.  Unlike update, however, it will not
773add files that are not already in the archive.  For example:
774.sk;.indent 10
775$ zip -f foo
776.sk
777Note that the -f option with no arguments freshens all the entries in the
778archive.  The same is true of -u, so "zip -u foo" and "zip -f foo" do
779the same thing.
780.sk
781When these options are used, Zip should be run from the same directory
782as when the original Zip command was run, so that the path names in the
783archive will continue to agree with the path names in the file system.
784Normally, it's also a good idea to keep the other options the same (-V,
785-w, and the like), to keep the archive contents consistent.
786.sk
787The -t (--from-date) and -tt (--before-date) options can also be used
788with adding, updating, or freshening to restrict further the files to be
789included in the archive.  For example:
790.sk;.indent 10
791$ zip -rt 12071991 infamy [.FOO]*.*
792.sk
793will add all the files in [.FOO] and its subdirectories that were last
794modified on December 7, 1991, or later to the achive infamy.zip.  Dates
795can be in format mmddyyyy or yyyy-mm-dd.
796.sk
797Also, files can be explicitly excluded using the -x option:
798.sk;.indent 10
799$ zip -r foo [.FOO] -x *.obj
800.sk
801which will zip up the contents of [.FOO] into foo.zip but exclude all the
802files that end in ".obj".
803.sk
804The -d (delete) mode will remove entries from an
805archive.  An example might be:
806.sk;.indent 10
807$ zip -d foo foo/harry/*.* *.obj
808.sk
809which will remove all of the files that start with "foo/harry/" and all of
810the files that end with ".obj" (in any path).
811.sk
812The last mode, -U (--copy-entries), selects entries from an existing
813archive and copies them to a new archive.
814.sk;.indent 10
815$ zip -U foo *.obj --out fooobj
816.sk
817will copy all .obj entries from foo.zip and put them in the new archive
818fooobj.zip.
819.sk
820Note: By default, on VMS, archive name pattern matching (-R, -d, -i, -x,
821and -U) is case sensitive, even when the file system is not case
822sensitive (or even case preserving).  This allows accurate matching of
823mixed-case names in an archive which may have been created on a system
824with a case sensitive file system, but it can involve extra effort on
825VMS, where it may be necessary to use unnatural case names (or the same
826names in multiple cases, like "*.obj *.OBJ") for this kind of pattern
827matching to give the desired behavior.  If completely case-blind pattern
828matching behavior is desired, specify the -ic (--ignore-case) option.
829.!------------------------------------------------------------------------------
830.indent -4
8312 Options_List
832.br
833"zip -h" provides a concise list of common command-line options.  "zip
834-h2" provides more details.  "zip -so" provides a list of all available
835options.  "zip -v" shows the program version and available features.
836(The list below was derived from a "zip -so" listing.)
837.sk
838Short-form options begin with a single hyphen ("-").  Long-form option
839begin with a double hyphen ("--"), and may be abbreviated to any
840unambiguous shorter string.  For example:
841.lm +10;.literal
842-v
843--verbose
844--verb
845.end literal;.lm -10
846.sk
847To avoid confusion, if a negatable option contains an embedded hyphen
848("-"), then avoid abbreviating it at the hyphen if you plan to negate
849it.  For example, if an option like --some-option were abbreviated to
850--some-, the parser would consider that trailing hyphen to be part of
851the option name, rather than as a negating trailing hyphen.  This
852behavior may change in the future, to interpret the trailing hyphen in
853--some- to be negating.  (So don't do it.)
854.sk
855Some options may be negated (or modified) by appending a "-":
856.lm +10;.literal
857-la-
858--show-files-
859.end literal;.lm -10
860.sk
861Some options take a value, which may immediately follow the option, or
862be separated by a space or "=".  For example:
863.lm +10;.literal
864-ttmmddyyyy
865-tt mmddyyyy
866-tt=mmddyyyy
867.end literal;.lm -10
868.sk
869.lm -4;.literal
870 Sh  Long                Description
871----+-------------------+--------------------------------------------------
872 0   store               store (instead of compress)
873 1   compress-1          compress faster (-2, -3, -4, ...)
874 9   compress-9          compress better
875 ?                       show the Zip help screen
876 @   names-stdin         read input file patterns from SYS$INPUT (1/line)
877 A   adjust-sfx          adjust self-extracting executable
878 b   temp-path  path     use "path" directory for temporary files
879 C   preserve-case       preserve case of all file names added to archive
880 C-  preserve-case-      down-case all file names added to archive
881 C2  preserve-case-2     preserve case of ODS2 names added to archive
882 C2- preserve-case-2-    down-case ODS2 file added to archive (default)
883 C5  preserve-case-5     preserve case of ODS5 names added to archive (dflt)
884 C5- preserve-case-5-    down-case ODS5 names added to archive
885 c   entry-comments      add a comment for each entry added to archive
886 D   no-dir-entries      do not add archive entries for directories
887 DF  difference-archive  difference archive: add only changed or new files
888 d   delete              delete entries in archive
889 db  display-bytes       display running byte counts
890 dc  display-counts      display running file counts
891 dd  display-dots        display progress dots for files (dflt size = 10MB)
892 dg  display-globaldots  display progress dots for archive, not each file
893 ds  dot-size   size     set progress dot interval to "size" (MB)
894 du  display-usize       display original uncompressed size for entries
895 dv  display-volume      display volume (disk) number as in_disk>out_disk
896 e   encrypt             encrypt entries, ask for password
897 F   fix                 fix mostly intact archive (try F before FF)
898 FF  fixfix              salvage what can be salvaged (not as reliable)
899 FS  filesync            remove archive entries unmatched in file system
900 f   freshen             update existing entries (only changed files)
901 fd  force-descriptors   force data descriptors as if streaming
902 fz  force-zip64         force use of Zip64 format
903 g   grow                grow existing archive (unless updating or deleting)
904 H                       show the Zip help screen
905 h   help                show the Zip help screen
906 h2  more-help           show extended Zip help
907 i   include  pat1 [pat2 [...]]  include only names matching the patterns
908 ic  ignore-case         ignore case (case-blind archive entry name matching)
909 J   junk-sfx            junk (remove) archive preamble (unzipsfx)
910 j   junk-paths          junk (don't store) directory names, only file names
911 k   DOS-names           simulate PKZIP-made archive (DOS 8.3 names)
912 L   license             show software license
913 l   to-crlf             translate end-of-lines (LF -> CRLF)
914 la  log-append          append to existing log file
915 lf  logfile-path  lfile  log to log file at lfile (default: new version)
916 li  log-info            include informational messages in log
917 ll  from-crlf           translate end-of-lines (CRLF -> LF)
918 MM  must-match          input file spec must exist (wildcards must match)
919 m   move                delete files added to archive
920 n   suffixes  sfx1[:sfx2[...]]  don't compress files with these suffixes
921 nw  no-wild             no wildcards during add or update
922 O   output-file  ozf  use "ozf" as the output archive (dflt = inp archive)
923 o   latest-time         set archive date-time to match oldest entry
924 P   password  password  encrypt with supplied "password" string
925 q   quiet               quiet operation (no info messages)
926 R   recurse-patterns    recurse into subdirs from cur dir, match names only
927 r   recurse-paths       recurse into directories from specified path pats
928 s   split-size  size    split archive at "size" (K/MB)  (0: don't split)
929 sb  split-bell          ring terminal bell at pause for split medium change
930 sc  show-command        show command line
931 sd  show-debug          show debug messages
932 sf  show-files          show files to process (only)
933 so  show-options        show list of all command-line options
934 sp  split-pause         pause to select split destination(s)
935 sv  split-verbose       be verbose about creating splits
936 T   test                test archive integrity (runs UnZip -T)
937 t   from-date  mmddyyyy  only do files since (at or after) "mmddyyyy"
938 tt  before-date  mmddyyyy  only do files before "mmddyyyy"
939 u   update              update changed files, add new files (default mode)
940 V   VMS-portable        save VMS file attributes
941 VV  VMS-specific        save VMS file attributes and all allocated blocks
942 v   verbose             verbose messages (print version info if only arg)
943 w   VMS-versions        save VMS version numbers in archive
944 ww  VMS-dot-versions    save VMS version numbers as ".nnn", not ";nnn"
945 X   strip-extra         strip all but critical extra fields
946 X-  strip-extra-        keep all extra fields
947 x   exclude  pat1 [pat2 [...]]  exclude all names matching the patterns
948 Z   compression-method mthd  use compress method "mthd" (bzip2 or deflate)
949 z   archive-comment     ask for archive comment
950.end literal;.lm +4
951.!------------------------------------------------------------------------------
952.indent -4
9532 Miscellaneous_Options
954.sk;.literal
955-D  --no-dir-entries
956.end literal;.br
957Do not create entries in the archive for directories.  By default,
958directory entries are added to an archive, so that their attributes can
959be saved in the archive.  When an archive is created using -D, UnZip
960will still create directories as needed (subject to user control), but
961they will get the default attributes (date-time, permissions, ...) on
962the destination system, rather than their original atributes.
963.sk;.literal
964-MM  --must-match
965.end literal;.br
966All input patterns must match at least one file and all input files
967found must be readable.  Normally when an input pattern does not match
968a file the "name not matched" warning is issued and when an input
969file has been found but later is missing or not readable a "missing or
970not readable" warning is issued.  In either case Zip continues
971creating the archive, with missing or unreadable new files being skipped
972and files already in the archive remaining unchanged.  After the
973archive is created, if any files were not readable zip returns the OPEN
974error code (18 on most systems) instead of the normal success return (0
975on most systems).  With -MM, Zip exits as soon as an input pattern
976is not matched (whenever the "name not matched" warning would be issued)
977or when an input file is not readable. In either case Zip exits with
978an OPEN error and no archive is created.
979.sk
980This option is useful when a known list of files is to be zipped so any
981missing or unreadable files should result in an error.  It may be less
982useful when used with wildcards, but Zip will still exit with an error
983if any input pattern doesn't match at least  one file or if any
984matched files are unreadable.  If you want to create the archive anyway
985and only need to know if files were skipped, then don't use -MM and just
986check the exit status.  Also, a log file (see -lf (--logfile-path))
987could be useful.
988.sk;.literal
989-O out_file  --output-file out_file
990.end literal;.br
991Process the archive changes as usual, but instead of updating the
992existing archive, send the output to a new archive, "out_file".  The
993output archive specified must be a different file from the input
994archive.
995.sk
996This option can be used to create updated split archives.  It can
997also be used with -U to copy entries from an existing archive to
998a new archive.  See the EXAMPLES section below.
999.sk
1000Another use is converting zip files from one split size to
1001another.  For instance, to convert an archive with 700MB CD splits
1002to one with 2GB DVD splits, can use:
1003.sk;.indent 10
1004zip -s 2g cd-split.zip --out dvd-split.zip
1005.sk
1006which uses copy mode.  See -U below.  Also:
1007.sk;.indent 10
1008zip -s 0 split.zip --out unsplit.zip
1009.sk
1010will convert a split archive to a single-file archive.
1011.sk
1012Copy mode will convert stream entries (using data descriptors and which
1013may be incompatible with some unzip programs) to normal entries (which
1014should be compatible with all unzip programs), except if standard
1015encryption was  used.  For archives with encrypted entries, zipcloak
1016will decrypt the entries and convert them to normal entries.
1017.sk;.literal
1018-o  --latest-time
1019.end literal;.br
1020Set the modification date-time of the Zip archive file to the latest
1021(newest) modification date-time found among the entries in the zip
1022archive.  This can be used without any other operations, if
1023desired.  For example:
1024.sk;.indent 10
1025zip -o foo
1026.sk
1027will change the modification date-time of foo.zip to the latest time of
1028the entries in foo.zip.
1029.sk;.literal
1030-q  --quiet
1031.end literal;.br
1032Quiet mode.  Eliminates informational messages and comment prompts.
1033This mode may be useful in command procedures, or if the Zip operation
1034is being performed as a background task ("$ spawn/nowait zip -q foo
1035*.c").
1036.sk
1037.sk;.literal
1038-T  --test
1039.end literal;.br
1040Test the integrity of a zip archive (the new one, if -O (--output-file)
1041is specified).  If the check fails, the old zip file is unchanged  and
1042(with the -m option) no input files are removed.
1043.sk
1044Implementation
1045.br
1046"zip -T" actually runs an "unzip -t" command to do the testing, so UnZip
1047must be installed properly for this to work.
1048.sk;.literal
1049-TT unzip_cmd  --unzip-command unzip_cmd
1050.end literal;.br
1051Specify the actual UnZip command, "unzip_cmd" (normally a DCL symbol) to
1052use for "zip -T".  This can be useful if multiple versions of UnZip are
1053installed on a system, and the default DCL symbol "UNZIP" would run the
1054wrong one (or the logical name DCL$PATH would lead to the wrong one).
1055.sk
1056In "unzip_cmd", the string "{}" is replaced by the temporary name of the
1057archive to be tested, otherwise the name of the archive is appended
1058to the end of the command.  The exit status is checked for success severity.
1059.sk;.literal
1060-v  --verbose
1061.end literal;.br
1062Verbose mode or print diagnostic version info.
1063.sk
1064Normally, when applied to real operations, this option enables the
1065display of a progress indicator during compression (see -dd for more on
1066dots) and requests verbose diagnostic info about archive structure
1067oddities.
1068.sk
1069When -v is the only command line argument, a diagnostic report is
1070displayed, showing:
1071.lm +3;.br;.indent -2
1072o Copyright and other legal notices
1073.br;.indent -2
1074o Program name, version, and release date
1075.br;.indent -2
1076o Pointers to Info-ZIP FTP and Web sites
1077.br;.indent -2
1078o Program build information (compiler type and version, OS version, and
1079the compilation date
1080.br;.indent -2
1081o Optional features enabled at compile-time
1082.br;.indent -2
1083o Environment variable definitions (ZIP_OPTS, ZIPOPT)
1084.lm -3;.br
1085.sk
1086This information should be included in bug reports.
1087.sk;.literal
1088-y  --symlinks
1089.end literal;.br
1090Store symbolic links as such in the Zip archive, instead of compressing
1091and storing the file referred to by the link.  A symbolic link normally
1092requires less storage than the actual file, both in the archive, and on
1093the destination file system.
1094.sk
1095On VMS, symbolic links are supported on ODS5 disks where the C RTL
1096supports symbolic links.  Full support for symbolic links seems to
1097require VMS V8.3, but a Zip program supporting symbolic links may be
1098built on VMS V7.3-2.
1099.!------------------------------------------------------------------------------
1100.indent -4
11012 Progress_Display
1102.br
1103Various options control the display of progress messages during Zip
1104operation.
1105.sk;.literal
1106-db  --display-bytes
1107.end literal;.br
1108Display running byte counts showing the bytes processed and the bytes to
1109go.
1110.sk;.literal
1111-dc  --display-counts
1112.end literal;.br
1113Display running count of entries processed and entries to go.
1114.sk;.literal
1115-dd  --display-dots
1116.end literal;.br
1117Display dots while each entry is processed (except on ports that have
1118their own progress indicator).  See -ds below for setting dot size.  The
1119default is a dot every 10 MB of input file processed.  The -v
1120(--verbose) option also displays dots and used to at a higher rate than
1121this (at the same rate as in previous versions of Zip) but this rate has
1122been changed to the new 10 MB default, and is also controlled by -ds.
1123.sk;.literal
1124-dg  --display-globaldots
1125.end literal;.br
1126Display progress dots for the archive instead of for each file.  The
1127command
1128.sk;.indent 10
1129zip -qdgds 10m
1130.sk
1131will turn off most output except dots every 10 MB.
1132.sk;.literal
1133-ds size  --dot-size size
1134.end literal;.br
1135Set amount of input file processed for each dot displayed.  See -dd to
1136enable displaying dots.  Setting this option implies -dd.  "size" is in
1137the format "nm" where n is a number and m is a multiplier.  Currently
1138"m" can be k (KB), m (MB), g (GB), or t (TB), so if "n" is 100 and "m"
1139is k, "size" would be 100k which is 100KB.  The default is 10MB.
1140.sk
1141The -v (--verbose) option also displays dots and used to default to a
1142higher rate than this (at the same rate as in previous versions of Zip)
1143but now the default is 10 MB and the -v dots are also controlled by this
1144option.  A "size" of 0 turns dots off.
1145.sk
1146This option does not control the dots from the "Scanning files" message
1147as Zip scans for input files.  The dot size for that is fixed at 2
1148seconds or a fixed number of entries, whichever is longer.
1149.sk;.literal
1150-du  --display-usize
1151.end literal;.br
1152Display the uncompressed size of each entry.
1153.sk;.literal
1154-dv  --display-volume
1155.end literal;.br
1156Display the volume (disk) number each entry is being written to.
1157.!------------------------------------------------------------------------------
1158.indent -4
11592 Self_Extracting_Archives
1160.br
1161A self-extracting archive (SFX) comprises a normal Zip archive appended
1162to a special UnZip program (such as UNZIPSFX.EXE) for the intended
1163target system.
1164.sk
1165The UnZip distribution includes a VMS command procedure,
1166[,vms]makesfx.com, which can be used directly or adapted to create an
1167SFX archive from a normal Zip archive.
1168.sk
1169The .ZIP file format includes offsets to data structures in the archive,
1170and these offsets are measured from the start of the archive file.
1171Appending an archive to an UnZip SFX executable effectively moves the
1172start of the archive file.  That makes the original offsets wrong, and
1173that will cause the UnZip SFX program to emit warning messages when it
1174tries to unpack the archive.  Zip -A can be used to adjust these offsets
1175in a self-extracting archive.  For example, to adjust the offsets in
1176foo.sfx_exe:
1177.sk;.indent 10
1178zip -A foo.sfx_exe
1179.sk
1180Similarly, the UnZip SFX program can be removed from a self-extracting
1181archive (and the offsets in the archive restored) using the -J
1182(--junk-sfx) option.  For example:
1183.sk;.indent 10
1184zip -J foo.sfx_exe
1185.sk
1186Note that a self-extracting archive contains a normal Zip archive, and a
1187normal UnZip program can be used to expand it in the normal way.  You
1188may get a warning about extra bytes at the beginning of the archive (the
1189UnZip SFX program), but UnZip should work properly after that.  This
1190allows data in a self-extracting archive to be accessed on any system,
1191not just the target system where its embedded UnZip SFX program runs.
1192.!------------------------------------------------------------------------------
1193.indent -4
11942 Split_Archives
1195.br
1196Beginning with version 3.0, Zip supports split archives.  A split
1197archive is one which is divided into multiple files, usually to allow it
1198to be stored on multiple storage media (floppy diskettes, CD-ROMs, or
1199the like) when a single medium would be too small to contain the whole
1200archive.  (Note that split archives are not just unitary archives split
1201into pieces, as the .ZIP file format includes offsets to data structures
1202in the archive, and for a split archive these are based on the start of
1203each split, not on the start of the whole archive.  Concatenating the
1204pieces will invalidate these offsets, but UnZip can usually deal with
1205it.  Zip will usually refuse to process such a spliced archive unless
1206the -FF fix option is used to fix the offsets.)
1207.sk
1208For a split archive with, say, 20 split files, the files are typically
1209named ARCHIVE.z01, ARCHIVE.z02, ..., ARCHIVE.z19, ARCHIVE.zip, where
1210"ARCHIVE" is the archive name specified by the user on the Zip command
1211line.  Note that the last split file is the ".zip" file.  In contrast,
1212"spanned" archives are the original multi-disk archive generally
1213requiring floppy disks and using volume labels to store disk numbers.
1214Zip supports split archives but not spanned archives, though a procedure
1215exists for converting split archives of the right size to spanned
1216archives.  The reverse is also true, where each file of a spanned
1217archive can be copied in order to files with the above names to create a
1218split archive.
1219.!------------------------------------------------------------------------------
1220.indent -4
12213 Options
1222.br
1223Use "-s size" to create a split archive (and to set the split size).
1224The size is given as a number followed optionally by a multiplier suffix
1225of k (KB), m (MB, the default if no suffix is specified), g (GB), or t
1226(TB).  (All are powers of 1024, not 1000).  64K is the minimum split
1227size.  For example, the following command could be used to create a
1228split archive called "foo" from the contents of the "bar" directory with
1229splits of 670MB, which might be useful for burning on CDs:
1230.sk;.indent 10
1231zip -s 670m foo [.bar...]*.*
1232.sk
1233Using -s without -sp as above creates all the splits in the directory
1234specified by "foo", in this case the current default directory.  This
1235split mode updates the splits as the archive is being created, requiring
1236all splits to remain writable, but creates split archives that are
1237readable by any UnZip that supports split archives.  See -sp below for
1238enabling split pause mode which allows splits to be written directly to
1239removable media.
1240.sk
1241The -sv option can be used to enable verbose splitting and display
1242details of how the splitting is being done.  The -sb option can be used
1243to ring the terminal bell when Zip pauses for the next split
1244destination.
1245.sk
1246The -sp option can be used to pause Zip between splits to allow
1247changing removable media, for example, but read the descriptions and
1248warnings for both -s and -sp below.
1249.sk
1250Though Zip does not update split archives, Zip provides the option
1251-O (--output-file) to allow split archives to be updated and saved in a
1252new archive.  For example:
1253.sk;.indent 10
1254zip inarchive.zip foo.c bar.c -O outarchive.zip
1255.sk
1256reads archive inarchive.zip, even if split, adds the files foo.c and
1257bar.c, and writes the resulting archive to outarchive.zip.  If
1258inarchive.zip is split, then outarchive.zip defaults to the same split
1259size.  Be aware that outarchive.zip and any split files that are created
1260with it are always overwritten without warning.  This may be changed in
1261the future.
1262.!------------------------------------------------------------------------------
1263.indent -4
12642 Temporary_Files
1265.br
1266When creating a new archive or normally when changing an existing
1267archive, Zip will write a temporary file in the archive destination
1268directory ("ZIxxxxxxxx", where "xxxxxxxx" is the hexadecimal process ID)
1269with the new contents.  Then, if and when the Zip job has completed with
1270no errors, it will rename the temporary file to the specified archive
1271name (replacing the old archive, if any).
1272.sk
1273You can use the -b (--temp-path) option to specify a different path
1274(device and/or directory) for the temporary file, but specifying a
1275different device will force Zip to copy the temporary file to its final
1276destination instead of simply renaming it, and that copying will take
1277more time than renaming, especially for a large archive.  For example:
1278.sk;.indent 10
1279$ zip -b disk$scratch:[tmp] stuff *
1280.sk
1281will cause Zip to put its temporary files in the directory
1282"disk$scratch:[tmp]", copying the temporary file back to the current
1283directory as stuff.zip when it's complete.
1284.!------------------------------------------------------------------------------
1285.indent -4
12862 Text_Files
1287.br
1288Zip offers some options to help deal with line endings in text files.
1289These may have limited utility on VMS.
1290.sk;.literal
1291-l  --to-crlf
1292.end literal;.br
1293Translate the UNIX end-of-line character LF (CR on MAC) into the MSDOS
1294convention CR-LF.  This option should not be used on binary files.  This
1295option can be used on UNIX if the Zip file is intended for PKUNZIP under
1296MSDOS.  If the input files already contain CR-LF, this option adds an
1297extra CR.  This ensure that "unzip -a" on Unix will get back an exact
1298copy of the original file, to undo the effect of "zip -l".  See -ll
1299below for the binary checks.
1300.sk;.literal
1301-ll  --from-crlf
1302.end literal;.br
1303Translate the MSDOS end-of-line CR LF into UNIX LF (CR on MAC).  This
1304option should not be used on binary files.  This option can be used on
1305MSDOS if the Zip archive is intended for UnZip under UNIX.
1306.sk
1307For both -l and -ll, if the file is converted and the file is later
1308determined to be binary, a warning is issued and the file is probably
1309corrupted.  If Zip with -l or -ll detects binary (non-text) in the first
1310buffer read from a file, it issues a warning and skips line-ending
1311conversion on the file, avoiding corruption.  This check seems to catch
1312all binary files tested, but the original check remains and if a
1313converted file is later determined to be binary, that warning is still
1314issued.  The algorithm now being used for binary detection should allow
1315line-ending conversion of text files in UTF-8 and similar encodings.
1316.!------------------------------------------------------------------------------
1317.indent -4
13182 VMS_Specifics
1319.br
1320VMS File Attributes
1321.sk;.literal
1322-V  --VMS-portable
1323-VV --VMS-specific
1324.end literal;.br
1325The -V and -VV options cause Zip to store VMS file atributes (such as
1326file organization, record format, carriage control, and so on) in
1327VMS-specific "extra fields" in an archive along with the usual data.
1328These extra fields are ignored on non-VMS systems, but on a VMS system,
1329they allow UnZip to restore the files with their VMS attributes intact.
1330.sk
1331With -V, Zip ignores any data in the file after the end-of-file (EOF)
1332point (defined by FAT$L_EFBLK and FAT$W_FFBYTE), which works well for
1333well-formed files (that is, those with no valid data beyond EOF).
1334Portable-format files (Stream_LF, fixed-512) archived with -V should be
1335extracted properly on a non-VMS system.  Files with more complex
1336structures, such as indexed files and files with embedded byte counts
1337or other such data may be of limited use on other systems.  (UnZip on
1338non-VMS systems may be able to extract various VMS-format text files,
1339however.)
1340.sk
1341With -VV, Zip processes all allocated blocks for the file (including
1342those beyond EOF).  When extracted on a VMS system, the original file
1343should be reproduced with as much fidelity as possible, but on a non-VMS
1344system, most files will be seen as corrupt because of the data from
1345beyond EOF.
1346.sk
1347VMS File Version Numbers
1348.sk;.literal
1349-w  --VMS-versions
1350-ww  --VMS-dot-versions
1351.end literal;.br
1352By default, for compatibility with non-VMS systems, Zip strips VMS file
1353version numbers from the names stored in an archive.  The -w
1354(--VMS-versions) option causes Zip to retain file version numbers on
1355names in an archive. Without -w, a version number wildcard (";*") can
1356cause errors when multiple versions of a single file are treated as
1357multiple files with the same name.
1358.sk
1359For better compatibility with non-VMS systems where semi-colons are less
1360popular in file names, the -ww (--VMS-dot-versions) option stores the
1361file version numbers with a dot (".nnn") instead of a semi-colon
1362(";nnn").
1363.!------------------------------------------------------------------------------
1364.indent -4
13652 Copyright_and_License
1366.br
1367Zip has an option to display its copyright and license.
1368.sk;.literal
1369-L  --license
1370.end literal;.br
1371The license is reproduced below.
1372.sk.lm +3
1373This is version 2007-Mar-4 of the Info-ZIP license. The definitive
1374version of this document should be available at
1375ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and a copy
1376at http://www.info-zip.org/pub/infozip/license.html.
1377.lm -3;.sk
1378--------------------------------------------------------
1379.sk
1380Copyright (c) 1990-2007 Info-ZIP.  All rights reserved.
1381.sk
1382For the purposes of this copyright and license, "Info-ZIP" is defined as
1383the following set of individuals:
1384.sk;.lm +3
1385     Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
1386     Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth,
1387     Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
1388     David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
1389     Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
1390     Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda,
1391     Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren,
1392     Rich Wales, Mike White.
1393.lm -3;.sk
1394This software is provided "as is," without warranty of any kind, express
1395or implied.  In no event shall Info-ZIP or its contributors be held
1396liable for any direct, indirect, incidental, special or consequential
1397damages arising out of the use of or inability to use this software.
1398.sk
1399Permission is granted to anyone to use this software for any purpose,
1400including commercial applications, and to alter it and redistribute it
1401freely, subject to the above disclaimer and the following restrictions:
1402.sk;.lm +7;.indent -4
1403    1. Redistributions of source code (in whole or in part) must retain
1404       the above copyright notice, definition, disclaimer, and this list
1405       of conditions.
1406.sk;.indent -4
1407    2. Redistributions in binary form (compiled executables and libraries)
1408       must reproduce the above copyright notice, definition, disclaimer,
1409       and this list of conditions in documentation and/or other materials
1410       provided with the distribution.  The sole exception to this condition
1411       is redistribution of a standard UnZipSFX binary (including SFXWiz) as
1412       part of a self-extracting archive; that is permitted without inclusion
1413       of this license, as long as the normal SFX banner has not been removed
1414       from the binary or disabled.
1415.sk;.indent -4
1416    3. Altered versions -- including, but not limited to, ports to new operating
1417       systems, existing ports with new graphical interfaces, versions with
1418       modified or added functionality, and dynamic, shared, or static library
1419       versions not from Info-ZIP -- must be plainly marked as such and must not
1420       be misrepresented as being the original source or, if binaries,
1421       compiled from the original source.  Such altered versions also must not
1422       be misrepresented as being Info-ZIP releases -- including, but not
1423       limited to, labeling of the altered versions with the names "Info-ZIP"
1424       (or any variation thereof, including, but not limited to, different
1425       capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the
1426       explicit permission of Info-ZIP.  Such altered versions are further
1427       prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP
1428       e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP
1429       will provide support for the altered versions.
1430.sk;.indent -4
1431       4. Info-ZIP retains the right to use the names "Info-ZIP", "Zip",
1432       "UnZip", "UnZipSFX", "WiZ", "Pocket UnZip", "Pocket Zip", and
1433       "MacZip" for its own source and binary releases.
1434.lm -7;.sk
1435.!------------------------------------------------------------------------------
1436.indent -4
14372 Acknowledgements
1438.br
1439       Thanks to R. P. Byrne for his Shrink.Pas program, which
1440       inspired this project, and from which the shrink algorithm
1441       was stolen; to Phil Katz for placing in the public domain
1442       the zip file format, compression format, and .ZIP filename
1443       extension, and for accepting minor changes to the file
1444       format; to Steve Burg for clarifications on the deflate
1445       format; to Haruhiko Okumura and Leonid Broukhis for providing
1446        some useful ideas for the compression algorithm; to
1447       Keith Petersen, Rich Wales, Hunter Goatley and Mark Adler
1448       for providing a mailing list and ftp site for the Info-ZIP
1449       group to use; and most importantly, to the Info-ZIP group
1450       itself (listed in the file infozip.who) without whose
1451       tireless testing and bug-fixing efforts a portable zip
1452       would not have been possible.  Finally we should thank
1453       (blame) the first Info-ZIP moderator, David Kirschbaum,
1454       for getting us into this mess in the first place.
1455.!------------------------------------------------------------------------------
1456.indent -4
14572 Bugs
1458.br
1459All bug reports, patches, or suggestions should go to zip-bugs via the
1460web site contact form at http://www.Info-ZIP.org.  Patches should be
1461sent as unified or context diffs only (diff -u or diff -c).
1462.sk
1463Any bug report should include the Zip version, any special compilation
1464options (see "zip -v" report), the host system type and operating system
1465version, and any other relevant information (compiler version, lunar
1466phase, ...).
1467.!------------------------------------------------------------------------------
1468