home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / compress / amyzip92.lha / ZIp.DOC < prev    next >
Text File  |  1991-12-07  |  24KB  |  572 lines

  1.  
  2.  
  3.  
  4. ZIP(1)              UNIX Programmer's Manual               ZIP(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      zip - package and compress (archive) files
  10.  
  11. SYNOPSIS
  12.      zip [ -cdefghijklmnoqrsuwyz ] [ -b path ] [ -t mmddyy ] zip-
  13.      file list [ -x list ]
  14.  
  15. DESCRIPTION
  16.      Zip is a compression and file packaging utility for Unix,
  17.      MSDOS, OS/2, and VMS.  It is analogous to a combination of
  18.      tar and compress and is compatible with PKZIP (Phil Katz
  19.      ZIP) for MSDOS systems.
  20.  
  21.      There is a companion to Zip called UnZip (of course) which
  22.      you should be able to find the same place you got Zip. Zip
  23.      and UnZip can work with files produced by PKZIP under MSDOS,
  24.      and PKZIP and PKUNZIP can work with files produced by Zip.
  25.  
  26.      Zip puts one or more compressed files into a single "zip
  27.      file" along with information about the files, including the
  28.      name, path if requested, date and time last modified, pro-
  29.      tection, and check information to verify the fidelity of
  30.      each entry.  Zip can pack an entire directory structure in a
  31.      zip file with a single command.  Compression ratios of 2:1
  32.      to 3:1 are common for text files.  Zip has two compression
  33.      methods, implosion and shrinking, and automatically chooses
  34.      the better of the two for each file to be compressed.
  35.  
  36.      Zip is useful for packaging a set of files to send to some-
  37.      one or for distribution; for archiving or backing up files;
  38.      and for saving disk space by temporarily compressing unused
  39.      files or directories.
  40.  
  41. HOW TO INSTALL ZIP
  42.  
  43.     *** AmyZIP ***
  44.     *
  45.     * If you are reading this, then you've already unarchived
  46.     * the files... Simply copy ZIP to someplace in your command
  47.     * search path (c: is a logical place). Ship and ZipNote
  48.     * will probably not be necessary so you may discard these
  49.     * executables.
  50.     *
  51.     * Read over the documentation, readme's, contents, etc. so
  52.     * you understand what you have, how it works, and how this
  53.     * version of ZIp may differ from the Unix model.
  54.     *
  55.     * If you wish to hack on the source code, you'll need the
  56.     * source, of course, SAS C v5.10b, and the PD "Make" program
  57.     * (LMK may work acceptably well, we haven't tried it).
  58.     * To increment version numbers you'll need to edit the
  59.     * ZIP.C source, (search for "92"). Please furnish Steve
  60.     * Lewis and Ross Martin any of your completed source code
  61.     * modifications so we don't reinvent the wheel.
  62.     *
  63.     *************
  64.  
  65.  
  66.      Zip is distributed as C source code that can be compiled on
  67.      a wide range of Unix machines, VAXes running VMS, and MSDOS
  68.      machines using Microsoft or Borland C++, and OS/2 machines
  69.      using Microsoft C.  You will need Unzip (under Unix, MSDOS,
  70.      or VMS) or PKUNZIP (under MSDOS) to unpack the distribution
  71.      file, zip10.zip.
  72.  
  73.      First, unpack the source as follows, assuming that you have
  74.      zip10.zip in the current directory:
  75.  
  76.           mkdir zipsrc
  77.           cd zipsrc
  78.           unzip ../zip10
  79.  
  80.      This extracts all source files and documentation in the
  81.      directory called "zipsrc". You then do:
  82.  
  83.  
  84.           make system
  85.  
  86.      where "system" is one of: bsd, bsdold, sysv, next, next10,
  87.      sun, hpux, dnix, cray, 3b1, zilog, aux, convex, aix, or
  88.      minix.  If you are using a NeXT running version 2.0 or
  89.      greater, then make next.  If you are using 1.0, then make
  90.      next10.  If you are using Sun OS 4.x, then make sun.  If you
  91.      are using HPUX, then make hpux.  The other special systems
  92.      are DNIX 5.2 or 5.3, Cray Unicos, AT&T 3B1 (also known as
  93.      Unix PC or PC 7300), Zilog Zeus, A/UX, Convex, AIX, and
  94.      MINIX.  Otherwise, if you are using BSD Unix, try bsd.  If
  95.      the linker cannot find _memset or _memcpy, try bsdold.  If
  96.      you are using System V Unix or SCO Unix, try sysv.  Also use
  97.      sysv on a Silicon Graphics (SGI) machine.  You can also
  98.      cross-compile Zip for MSDOS under SCO 386 Unix using "make
  99.      scodos".
  100.  
  101.      If none of these compiles, links, and functions properly on
  102.      your Unix system, see the section BUGS below for how to get
  103.      help.
  104.  
  105.      If the appropriate system was selected, then the executable
  106.      "zip" will be created.  You can move the executable "zip" to
  107.      an appropriate directory in the search path using a command
  108.      like:
  109.  
  110.           mv zip ~/bin
  111.  
  112.      or
  113.  
  114.           mv zip /usr/local/bin
  115.  
  116.      You can use the command "set" to see the current search
  117.      path.  If you are using the C-Shell (csh), enter the com-
  118.      mand:
  119.  
  120.           rehash
  121.  
  122.      so csh can find the new command in the path.  You are now
  123.      ready to use Zip.
  124.  
  125.      You can also move the manual page (the raw form of what
  126.      you're reading) to where the Unix man command can find it
  127.      (assuming you have the necessary privileges):
  128.  
  129.           mv zip.1 /usr/man/man1
  130.  
  131.      You can get rid of the now unnecessary source and object
  132.      files with:
  133.  
  134.           cd ..
  135.           rm -r zipsrc
  136.  
  137.      This will remove the directory zip and its contents created
  138.      by unzip.  You should keep the zip10.zip file around though,
  139.      in case you need to build it again or want to give it to a
  140.      colleague.
  141.  
  142.      The steps for installation under MSDOS, OS/2, and VMS are
  143.      similar to the above: first unzip the distribution files
  144.      into their own directory.  Then under MSDOS do one of:
  145.  
  146.           make makefile.msc
  147.           make -fmakefile.bor
  148.  
  149.  
  150.      for Microsoft or Borland C++, respectively.  Under OS/2:
  151.  
  152.           nmake -f makefile.os2
  153.  
  154.      for Microsoft C 6.00.  Under VAX VMS:
  155.  
  156.  
  157.           @makevms
  158.  
  159.      The installation process will also compile and link several
  160.      other utilities.  They are zipcloak for encrypting and
  161.      decrypting zip files, zipnote for editing zip file comments,
  162.      zipsplit for splitting a zip file into several zip files,
  163.      and ship for sending zip files or any other binary file via
  164.      electronic mail.  For command help on any of the zip* utili-
  165.      ties, simply enter the name with no arguments.  For help
  166.      with ship, enter "ship -h".
  167.  
  168. HOW TO USE ZIP
  169.      The simplest use of Zip is as follows:
  170.  
  171.           zip stuff *
  172.  
  173.      This will create the file "stuff.zip" (assuming it does not
  174.      exist) and put all the files in the current directory in
  175.      stuff.zip in a compressed form.  The .zip suffix is added
  176.      automatically, unless that file name given contains a dot
  177.      already.  This allows specifying suffixes other than ".zip".
  178.  
  179.      Because of the way the shell does filename substitution,
  180.      files that start with a "." are not included.  To include
  181.      those as well, you can:
  182.  
  183.           zip stuff .* *
  184.  
  185.      Even this will not include any subdirectories that are in
  186.      the current directory.  To zip up an entire directory, the
  187.      command:
  188.  
  189.           zip -r foo foo
  190.  
  191.      will create the file "foo.zip" containing all the files and
  192.      directories in the directory "foo" that is in the current
  193.      directory.  The "r" option means recurse through the direc-
  194.      tory structure.  In this case, all the files and directories
  195.      in foo are zipped, including the ones that start with a ".",
  196.      since the recursion does not use the shell's file-name sub-
  197.      stitution.  You should not use -r with the name ".*", since
  198.      that matches ".." which will attempt to zip up the parent
  199.      directory--probably not what was intended.
  200.  
  201.      You may want to make a zip file that contains the files in
  202.      foo, but not record the directory name, foo.  You can use
  203.      the -j (junk path) option to leave off the path:
  204.  
  205.           zip -j foo foo/*
  206.  
  207.      The -y option (only under Unix) will store symbolic links as
  208.      such in the zip file, instead of compressing and storing the
  209.      file referred to in the link.
  210.  
  211.      You might be zipping to save disk space, in which case you
  212.      could:
  213.  
  214.           zip -rm foo foo
  215.  
  216.      where the "m" option means "move".  This will delete foo and
  217.      its contents after making foo.zip.  No deletions will be
  218.      done until the zip has completed with no errors.  This
  219.      option is obviously more dangerous and should be used with
  220.      care.
  221.  
  222.  
  223.      If the zip file already exists, these commands will replace
  224.      existing or add new entries to the zip file.  For example,
  225.      if you were really short on disk space, you might not have
  226.      enough room simultaneously to hold the directory foo and the
  227.      compressed foo.zip.  In this case, you could do it in steps.
  228.      If foo contained the subdirectories tom, dick, and harry,
  229.      then you could:
  230.  
  231.           zip -rm foo foo/tom
  232.           zip -rm foo foo/dick
  233.           zip -rm foo foo/harry
  234.  
  235.      where the first command would create foo.zip, and the next
  236.      two would add to it.  At the completion of each zip command,
  237.      the directory just zipped would be deleted, making room in
  238.      which the next Zip command could work.
  239.  
  240. MODIFYING EXISTING ZIP FILES
  241.      When given the name of an existing zip file with the above
  242.      commands, Zip will replace identically named entries in the
  243.      Zip file or add entries for new names.  For example, if
  244.      foo.zip exists and contains foo/file1 and foo/file2, and the
  245.      directory foo contains the files foo/file1 and foo/file3,
  246.      then:
  247.  
  248.           zip -r foo foo
  249.  
  250.      will replace foo/file1 in foo.zip and add foo/file3 to
  251.      foo.zip.  After this, foo.zip contains foo/file1, foo/file2,
  252.      and foo/file3, with foo/file2 unchanged from before.
  253.  
  254.      When changing an existing zip file, Zip will write a tem-
  255.      porary file with the new contents, and only replace the old
  256.      one when the zip has completed with no errors.  Also, the
  257.      two methods, shrink and implode, create temporary files that
  258.      are deleted after each file is zipped.  You can use the -b
  259.      option to specify a different path (usually a different dev-
  260.      ice) to put the temporary files in.  For example:
  261.  
  262.           zip -b /tmp stuff *
  263.  
  264.      will put the temporary zip file and the temporary compres-
  265.      sion files in the directory "/tmp", copying over stuff.zip
  266.      in the current directory when done.
  267.  
  268.      If you are only adding entries to a zip file, not replacing,
  269.      and the -g option is given, then Zip grows (appends to) the
  270.      file instead of copying it.  The danger of this is that if
  271.      the operation fails, the original zip file is corrupted and
  272.      lost.
  273.  
  274.      There are two other ways to change or add entries in a zip
  275.      file that are restrictions of simple addition or replace-
  276.      ment.  The first is -u (update) which will add new entries
  277.      to the zip file as before but will replace existing entries
  278.      only if the modified date of the file is more recent than
  279.      the date recorded for that name in the zip file.  For exam-
  280.      ple:
  281.  
  282.           zip -u stuff *
  283.  
  284.      will add any new files in the current directory, and update
  285.      any changed files in the zip file stuff.zip.  Note that Zip
  286.      will not try to pack stuff.zip into itself when you do this.
  287.      Zip will always exclude the zip file from the files on which
  288.      to be operated.
  289.  
  290.      The second restriction is -f (freshen) which, like update,
  291.      will only replace entries with newer files; unlike update,
  292.      will not add files that are not already in the zip file.
  293.      For this option, you may want to simply freshen all of the
  294.      files that are in the specified zip file.  To do this you
  295.      would simply:
  296.  
  297.           zip -f foo
  298.  
  299.      Note that the -f option with no arguments freshens all the
  300.      entries in the zip file.  The same is true of -u, and hence
  301.      "zip -u foo" and "zip -f foo" both do the same thing.
  302.  
  303.      This command should be run from the same directory from
  304.      which the original zip command was run, since paths stored
  305.      in zip files are always relative.
  306.  
  307.      Another restriction that can be used with adding, updating,
  308.      or freshening is -t (time), which will not operate on files
  309.      modified earlier than the specified date.  For example:
  310.  
  311.           zip -rt 120791 infamy foo
  312.  
  313.      will add all the files in foo and its subdirectories that
  314.      were last modified on December 7, 1991, or later to the zip
  315.      file infamy.zip.
  316.  
  317.      Also, files can be explicitly excluded using the -x option:
  318.  
  319.           zip -r foo foo -x \*.o
  320.  
  321.      which will zip up the contents of foo into foo.zip but
  322.      exclude all the files that end in ".o".  Here the backslash
  323.      causes Zip to match file names that were found when foo was
  324.      searched.
  325.  
  326.      The last operation is -d (delete) which will remove entries
  327.      from a zip file.  An example might be:
  328.  
  329.           zip -d foo foo/tom/junk foo/harry/\* \*.o
  330.  
  331.      which will remove the entry foo/tom/junk, all of the files
  332.      that start with "foo/harry/", and all of the files that end
  333.      with ".o" (in any path).  Note that once again, the shell
  334.      expansion has been inhibited with backslashes, so that Zip
  335.      can see the asterisks. Zip can then match on the contents of
  336.      the zip file instead of the contents of the current direc-
  337.      tory.
  338.  
  339.      Under MSDOS, -d is case sensitive when it matches names in
  340.      the zip file.  This allows deleting names that were zipped
  341.      on other systems, but requires that the names be entered in
  342.      upper case if they were zipped on an MSDOS system, so that
  343.      the names can be found in the zip file and deleted.
  344.  
  345. MORE OPTIONS
  346.      As mentioned before, Zip will use the best of two methods:
  347.      shrink or implode.  Usually implode is better, but sometimes
  348.      shrink is better, especially for smaller files.  Sometimes
  349.      neither method produces a packed version smaller than the
  350.      original file, in which case it is stored in the zip file
  351.      with no compression (called the "store" method).
  352.  
  353.      The option -s (shrink) will force Zip always to use shrink
  354.      or store, and the -i (implode) option forces Zip to use
  355.      implode or store.  Shrinking is faster than imploding, and
  356.      so -s might be used when speed is more important than
  357.      optimal compression.  Implode only (-i) might be used when
  358.      the unzipper for which the zip file is destined can only
  359.      handle implosion.  An example of this is the PKSFXjr program
  360.      that comes with PKZIP.  Also, -i is slightly faster than
  361.      imploding and shrinking at the same time.  For example:
  362.  
  363.           zip -rs foo foo
  364.  
  365.      will zip up the directory foo into foo.zip using only shrink
  366.      or store.  The speed of implosion can also be controlled
  367.      with options -0 (fastest method but less compression) to -9
  368.      (best compression but slower). The default value is -5. For
  369.      example:
  370.  
  371.           zip -r0 foo foo
  372.  
  373.      In nearly all cases, a file that is already compressed can-
  374.      not be compressed further by Zip, or if it can, the effect
  375.      is minimal.  The -n option prevents Zip from trying to
  376.      compress files that have the suffixes: .Z, .zip, .zoo, or
  377.      .arc.  Such files are simply stored (0% compression) in the
  378.      output zip file, so that Zip doesn't waste its time trying
  379.      to compress them.  If the environment variable NOZIP is set,
  380.      then the suffixes listed there are used instead of the
  381.      default list.  The suffixes are separated by either colons
  382.      or semicolons.  For example, in Unix csh:
  383.  
  384.           setenv NOZIP .Z:.zip:.tiff:.gif:.snd
  385.           zip -rn foo foo
  386.  
  387.      will put everything in foo into foo.zip, but will store any
  388.      files that end in .Z, .zip, .tiff, .gif, or .snd without
  389.      trying to compress them.  (Image and sound files often have
  390.      their own specialized compression methods.)  If the environ-
  391.      ment variable NOZIP exists but is empty or contains just a
  392.      colon or semicolon, then zip -n will store all the entries
  393.      and do no compression.
  394.  
  395.      Under Unix and under OS/2 (if files from a HPFS are stored),
  396.      Zip will store the full path (relative to the current path)
  397.      and name of the file (or just the name if -j is specified)
  398.      in the zip file along with the Unix attributes, and it will
  399.      mark the entry as made under Unix.  If the zip file is
  400.      intended for PKUNZIP under MSDOS, then the -k (Katz) option
  401.      should be used to attempt to convert the names and paths to
  402.      conform to MSDOS, store only the MSDOS attribute (just the
  403.      user write attribute from Unix), and mark the entry as made
  404.      under MSDOS (even though it wasn't).
  405.  
  406.      The -o (older) option will set the "last modified" time of
  407.      the zip file to the latest "last modified" time of the
  408.      entries in the zip file.  This can be used without any other
  409.      operations, if desired.  For example:
  410.  
  411.           zip -o foo
  412.  
  413.  
  414.      will change the last modified time of foo.zip to the latest
  415.      time of the entries in foo.zip.
  416.  
  417.      The -e and -c options operate on all files updated or added
  418.      to the zip file.  Encryption (-e) will prompt for a password
  419.      on the terminal and will not echo the password as it is
  420.      typed (if stderr is not a TTY, Zip will exit with an error).
  421.      New zip entries will be encrypted using that password.  For
  422.      added peace of mind, you can use -ee, which will prompt for
  423.      the password twice, checking that the two are the same
  424.      before using it.
  425.  
  426.      One-line comments can be added for each file with the -c
  427.      option.  The zip file operations (adding or updating) will
  428.      be done first, and you will then be prompted for a one-line
  429.      comment for each file.  You can then enter the comment fol-
  430.      lowed by return, or just return for no comment.
  431.  
  432.      The -z option will prompt you for a multi-line comment for
  433.      the entire zip file.  This option can be used by itself, or
  434.      in combination with other options.  The comment is ended by
  435.      a line containing just a period, or an end of file condition
  436.      (^D on Unix, ^Z on MSDOS, OS/2, and VAX/VMS).  Since -z
  437.      reads the lines from stdin, you can simply take the comment
  438.      from a file:
  439.  
  440.           zip -z foo < foowhat
  441.  
  442.      The -q (quiet) option eliminates the informational messages
  443.      and comment prompts while Zip is operating.  This might be
  444.      used in shell scripts, for example, or if the zip operation
  445.      is being performed as a background task ("zip -q foo *.c
  446.      &").
  447.  
  448.      Zip can take a list of file names to operate on from stdin
  449.      using the - option.  In Unix, this option can be used with
  450.      the find command to extend greatly the functionality of Zip.
  451.      For example, to zip up all the C source files in the current
  452.      directory and its subdirectories, you can:
  453.  
  454.           find . -type f -name "*.[ch]" -print | zip source -
  455.  
  456.      Note that the pattern must be quoted to keep the shell from
  457.      expanding it.
  458.  
  459.      Under VMS only, the -w option will append the version number
  460.      of the files to the name and zip up multiple versions of
  461.      files.  Without -w, Zip will only use the most recent ver-
  462.      sion of the specified file(s).
  463.  
  464.      If Zip is run with no arguments or with the -h option, the
  465.      license and the command-argument and option help is shown.
  466.      The -l option just shows the license.
  467.  
  468. ABOUT PATTERN MATCHING
  469.      (Note: this section applies to Unix.  Watch this space for
  470.      details on MSDOS and VMS operation.)
  471.  
  472.      The Unix shell (sh or csh) does filename substitution on
  473.      command arguments.  The special characters are ?, which
  474.      matches any single character; * which matches any number of
  475.      characters (including none); and [] which matches any char-
  476.      acter in the range inside the brackets (like [a-f] or
  477.      [0-9]).  When these characters are encountered (and not
  478.      escaped with a backslash or quotes), the shell will look for
  479.      files relative to the current path that match the pattern,
  480.      and replace the argument with a list of the names that
  481.      matched.
  482.  
  483.      Zip can do the same matching on names that are in the zip
  484.      file being modified or, in the case of the -x (exclude)
  485.      option, on the list of files to be operated on, by using
  486.      backslashes or quotes to tell the shell not to do the name
  487.      expansion.  In general, when Zip encounters a name in the
  488.      list of files to do, it first looks for the name in the file
  489.      system.  If it finds it, it then adds it to the list of
  490.      files to do.  If it does not find it, it will look for the
  491.      name in the zip file being modified (if it exists), using
  492.      the pattern matching characters above, if any.  For each
  493.      match, it will add that name to the list of files to do.
  494.      After -x (exclude), the names are removed from the to-do
  495.      list instead of added.
  496.  
  497.      The pattern matching includes the path, and so patterns like
  498.      \*.o match names that end in ".o", no matter what the path
  499.      prefix is.  Note that the backslash must precede every spe-
  500.      cial character (i.e. ?*[]), or the entire argument must be
  501.      enclosed in double quotes ("").
  502.  
  503.      In general, using backslash to make Zip do the pattern
  504.      matching is used with the -f (freshen) and -d (delete)
  505.      options, and sometimes after the -x (exclude) option when
  506.      used with any operation (add, -u, -f, or -d).  Zip will
  507.      never use pattern matching to search the file system.  If
  508.      Zip has recursed into a directory, all files (and all direc-
  509.      tories) in there are fair game.
  510.  
  511. COPYRIGHT
  512.      Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and
  513.      Jean-loup Gailly.  Permission is granted to any individual
  514.      or institution to use, copy, or redistribute this software
  515.      so long as all of the original files are included unmodi-
  516.      fied, that it is not sold for profit, and that this copy-
  517.      right notice is retained.
  518.  
  519. ACKNOWLEDGEMENTS
  520.      Thanks to R. P. Byrne for his Shrink.Pas program which
  521.      inspired this project, and from which the shrink algorithm
  522.      was stolen; to Phil Katz for making the zip file format,
  523.      compression format, and .ZIP filename extension all public
  524.      domain; to Keith Petersen for providing a mailing list and
  525.      ftp site for the INFO-ZIP group to use; and most impor-
  526.      tantly, to the INFO-ZIP group itself (listed in the file
  527.      infozip.who) without whose tireless testing and bug-fixing
  528.      efforts a portable Zip would not have been possible.
  529.      Finally we should thank (blame) the INFO-ZIP moderator,
  530.      David Kirschbaum for getting us into this mess in the first
  531.      place.
  532.  
  533. SEE ALSO
  534.      unzip(1), tar(1), compress(1)
  535.  
  536. BUGS
  537.      Versions of PKUNZIP before 1.1 have a bug that on rare occa-
  538.      sions will prevent it from unzipping files produced by Zip
  539.      or PKZIP 1.1.  If you experience such problems, we recommend
  540.      that you get PKUNZIP 1.1 or the portable Unzip, neither of
  541.      which have this problem.
  542.  
  543.      Under MSDOS, Zip will find hidden and system files, but not
  544.      set the attributes appropriately in the zip file so that
  545.      Unzip can restore them.  This will be fixed in the next
  546.      version.
  547.  
  548.      Under VMS, not all of the odd file formats are treated prop-
  549.      erly.  Only stream-LF format zip files are expected to work
  550.      with Zip.  Others can be converted using Rahul Dhesi's BILF
  551.      program.  The next version of Zip will handle some of the
  552.      conversion internally.
  553.  
  554.      LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTIL-
  555.      ITIES ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY
  556.      KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE
  557.      COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES RESULTING FROM
  558.      THE USE OF THIS SOFTWARE.
  559.  
  560.      That having been said, please send any problems or comments
  561.      via email to the Internet address zip-bugs@cs.ucla.edu.  For
  562.      bug reports, please include the version of Zip, the make
  563.      options you used to compile it, the machine and operating
  564.      system you are using, and as much additional information as
  565.      possible.  Thank you for your support.
  566.  
  567.     *AMYZIP caveates*
  568.  
  569.     Anything which relies on a time or datestamp *may* behave
  570.     unpredictably in v.92 - be careful!
  571.  
  572.