home *** CD-ROM | disk | FTP | other *** search
/ ftp.sunet.se/pub/OS2/ / 2014.11.ftp.sunet.se_pub_OS2.tar / ftp.sunet.se / pub / OS2 / hobbes / os2 / util / archiver / unz551x1.exe / unzip.txt < prev    next >
Text File  |  2004-05-22  |  49KB  |  1,009 lines

  1.  
  2. UNZIP(1L)                                               UNZIP(1L)
  3.  
  4. NAME
  5.        unzip  -  list, test and extract compressed files in a ZIP
  6.        archive
  7.  
  8. SYNOPSIS
  9.        unzip   [-Z]    [-cflptuvz[abjnoqsCLMVX$/:]]    file[.zip]
  10.        [file(s) ...]  [-x xfile(s) ...] [-d exdir]
  11.  
  12. DESCRIPTION
  13.        unzip  will  list,  test,  or  extract  files  from  a ZIP
  14.        archive, commonly found on MS-DOS  systems.   The  default
  15.        behavior  (with no options) is to extract into the current
  16.        directory (and subdirectories below it) all files from the
  17.        specified ZIP archive.  A companion program, zip(1L), cre-
  18.        ates ZIP  archives;  both  programs  are  compatible  with
  19.        archives created by PKWARE's PKZIP and PKUNZIP for MS-DOS,
  20.        but in many cases the program options or default behaviors
  21.        differ.
  22.  
  23. ARGUMENTS
  24.        file[.zip]
  25.               Path of the ZIP archive(s).  If the file specifica-
  26.               tion is a wildcard, each matching file is processed
  27.               in  an order determined by the operating system (or
  28.               file system).  Only the filename can be a wildcard;
  29.               the  path  itself cannot.  Wildcard expressions are
  30.               similar to those supported in  commonly  used  Unix
  31.               shells (sh, ksh, csh) and may contain:
  32.  
  33.               *      matches a sequence of 0 or more characters
  34.  
  35.               ?      matches exactly 1 character
  36.  
  37.               [...]  matches  any  single  character found inside
  38.                      the brackets;  ranges  are  specified  by  a
  39.                      beginning character, a hyphen, and an ending
  40.                      character.  If an  exclamation  point  or  a
  41.                      caret (`!' or `^') follows the left bracket,
  42.                      then the  range  of  characters  within  the
  43.                      brackets  is complemented (that is, anything
  44.                      except the characters inside the brackets is
  45.                      considered a match).
  46.  
  47.               (Be  sure  to quote any character that might other-
  48.               wise be interpreted or modified  by  the  operating
  49.               system,  particularly  under  Unix and VMS.)  If no
  50.               matches are found, the specification is assumed  to
  51.               be  a literal filename; and if that also fails, the
  52.               suffix .zip is appended.  Note that self-extracting
  53.               ZIP  files  are  supported,  as  with any other ZIP
  54.               archive; just specify  the  .exe  suffix  (if  any)
  55.               explicitly.
  56.  
  57. Info-ZIP               22 May 2004 (v5.51)                      1
  58.  
  59. UNZIP(1L)                                               UNZIP(1L)
  60.  
  61.        [file(s)]
  62.               An  optional  list  of  archive  members to be pro-
  63.               cessed, separated by spaces.   (VMS  versions  com-
  64.               piled  with  VMSCLI defined must delimit files with
  65.               commas instead.  See -v in OPTIONS below.)  Regular
  66.               expressions (wildcards) may be used to match multi-
  67.               ple members; see above.  Again, be  sure  to  quote
  68.               expressions  that  would  otherwise  be expanded or
  69.               modified by the operating system.
  70.  
  71.        [-x xfile(s)]
  72.               An optional list of archive members to be  excluded
  73.               from  processing.   Since wildcard characters match
  74.               directory separators (`/'), this option may be used
  75.               to  exclude  any  files that are in subdirectories.
  76.               For example, ``unzip  foo  *.[ch]  -x  */*''  would
  77.               extract  all  C source files in the main directory,
  78.               but none in any  subdirectories.   Without  the  -x
  79.               option,  all  C  source  files  in  all directories
  80.               within the zipfile would be extracted.
  81.  
  82.        [-d exdir]
  83.               An optional directory to which  to  extract  files.
  84.               By default, all files and subdirectories are recre-
  85.               ated in the current directory; the -d option allows
  86.               extraction in an arbitrary directory (always assum-
  87.               ing one has permission to write to the  directory).
  88.               This  option need not appear at the end of the com-
  89.               mand line; it is also accepted before  the  zipfile
  90.               specification  (with  the  normal options), immedi-
  91.               ately after the zipfile specification,  or  between
  92.               the  file(s)  and  the  -x  option.  The option and
  93.               directory may be  concatenated  without  any  white
  94.               space  between  them,  but note that this may cause
  95.               normal shell behavior to be suppressed.  In partic-
  96.               ular, ``-d ~'' (tilde) is expanded by Unix C shells
  97.               into the name of the  user's  home  directory,  but
  98.               ``-d~''  is treated as a literal subdirectory ``~''
  99.               of the current directory.
  100.  
  101. OPTIONS
  102.        Note that,  in  order  to  support  obsolescent  hardware,
  103.        unzip's  usage  screen  is  limited  to 22 or 23 lines and
  104.        should therefore be considered  only  a  reminder  of  the
  105.        basic  unzip  syntax rather than an exhaustive list of all
  106.        possible flags.  The exhaustive list follows:
  107.  
  108.        -Z     zipinfo(1L) mode.  If the first option on the  com-
  109.               mand line is -Z, the remaining options are taken to
  110.               be zipinfo(1L) options.  See the appropriate manual
  111.               page for a description of these options.
  112.  
  113.        -A     [OS/2,  Unix DLL] print extended help for the DLL's
  114.               programming interface (API).
  115.  
  116. Info-ZIP               22 May 2004 (v5.51)                      2
  117.  
  118. UNZIP(1L)                                               UNZIP(1L)
  119.  
  120.        -c     extract files  to  stdout/screen  (``CRT'').   This
  121.               option  is similar to the -p option except that the
  122.               name of each file is printed as  it  is  extracted,
  123.               the  -a option is allowed, and ASCII-EBCDIC conver-
  124.               sion is  automatically  performed  if  appropriate.
  125.               This  option  is  not  listed  in  the  unzip usage
  126.               screen.
  127.  
  128.        -f     freshen existing files, i.e.,  extract  only  those
  129.               files that already exist on disk and that are newer
  130.               than the disk copies.   By  default  unzip  queries
  131.               before  overwriting,  but the -o option may be used
  132.               to suppress the  queries.   Note  that  under  many
  133.               operating  systems,  the  TZ (timezone) environment
  134.               variable must be set correctly in order for -f  and
  135.               -u  to  work  properly  (under Unix the variable is
  136.               usually set automatically).  The reasons  for  this
  137.               are somewhat subtle but have to do with the differ-
  138.               ences between DOS-format file times  (always  local
  139.               time) and Unix-format times (always in GMT/UTC) and
  140.               the necessity to compare the  two.   A  typical  TZ
  141.               value  is  ``PST8PDT''  (US Pacific time with auto-
  142.               matic  adjustment  for  Daylight  Savings  Time  or
  143.               ``summer time'').
  144.  
  145.        -l     list  archive  files  (short  format).   The names,
  146.               uncompressed file sizes and modification dates  and
  147.               times  of  the  specified  files are printed, along
  148.               with totals for all files specified.  If UnZip  was
  149.               compiled  with  OS2_EAS defined, the -l option also
  150.               lists columns for the sizes of stored OS/2 extended
  151.               attributes  (EAs)  and  OS/2  access  control lists
  152.               (ACLs).  In addition, the zipfile comment and indi-
  153.               vidual  file comments (if any) are displayed.  If a
  154.               file was archived from a  single-case  file  system
  155.               (for  example,  the old MS-DOS FAT file system) and
  156.               the -L option was given, the filename is  converted
  157.               to lowercase and is prefixed with a caret (^).
  158.  
  159.        -p     extract  files  to  pipe (stdout).  Nothing but the
  160.               file data is sent to  stdout,  and  the  files  are
  161.               always extracted in binary format, just as they are
  162.               stored (no conversions).
  163.  
  164.        -t     test archive  files.   This  option  extracts  each
  165.               specified  file  in  memory  and  compares  the CRC
  166.               (cyclic redundancy check, an enhanced checksum)  of
  167.               the  expanded  file with the original file's stored
  168.               CRC value.
  169.  
  170.        -T     [most OSes] set the timestamp on the archive(s)  to
  171.               that  of  the newest file in each one.  This corre-
  172.               sponds to zip's -go option except that  it  can  be
  173.               used   on   wildcard  zipfiles  (e.g.,  ``unzip  -T
  174.  
  175. Info-ZIP               22 May 2004 (v5.51)                      3
  176.  
  177. UNZIP(1L)                                               UNZIP(1L)
  178.  
  179.               \*.zip'') and is much faster.
  180.  
  181.        -u     update  existing  files  and  create  new  ones  if
  182.               needed.   This option performs the same function as
  183.               the -f option, extracting (with query)  files  that
  184.               are  newer  than  those with the same name on disk,
  185.               and in addition it extracts those files that do not
  186.               already  exist  on disk.  See -f above for informa-
  187.               tion on setting the timezone properly.
  188.  
  189.        -v     be verbose or print diagnostic version info.   This
  190.               option  has  evolved  and  now  behaves  as both an
  191.               option and a modifier.  As an  option  it  has  two
  192.               purposes:   when  a  zipfile  is  specified with no
  193.               other options, -v lists  archive  files  verbosely,
  194.               adding to the basic -l info the compression method,
  195.               compressed size, compression ratio and 32-bit  CRC.
  196.               When no zipfile is specified (that is, the complete
  197.               command  is  simply  ``unzip  -v''),  a  diagnostic
  198.               screen  is  printed.   In  addition  to  the normal
  199.               header with release date and version,  unzip  lists
  200.               the home Info-ZIP ftp site and where to find a list
  201.               of other ftp and non-ftp sites; the target  operat-
  202.               ing  system  for  which it was compiled, as well as
  203.               (possibly) the hardware on which it  was  compiled,
  204.               the  compiler and version used, and the compilation
  205.               date; any special compilation  options  that  might
  206.               affect the program's operation (see also DECRYPTION
  207.               below); and any options stored in environment vari-
  208.               ables  that  might  do  the  same  (see ENVIRONMENT
  209.               OPTIONS below).  As a modifier it works in conjunc-
  210.               tion  with other options (e.g., -t) to produce more
  211.               verbose or debugging output; this is not yet  fully
  212.               implemented but will be in future releases.
  213.  
  214.        -z     display only the archive comment.
  215.  
  216. MODIFIERS
  217.        -a     convert  text  files.   Ordinarily  all  files  are
  218.               extracted exactly as they are stored (as ``binary''
  219.               files).   The  -a option causes files identified by
  220.               zip as text files (those with the `t' label in zip-
  221.               info listings, rather than `b') to be automatically
  222.               extracted as such, converting line endings, end-of-
  223.               file  characters  and  the  character set itself as
  224.               necessary.  (For example, Unix files use line feeds
  225.               (LFs) for end-of-line (EOL) and have no end-of-file
  226.               (EOF)  marker;  Macintoshes  use  carriage  returns
  227.               (CRs)  for  EOLs; and most PC operating systems use
  228.               CR+LF for EOLs and control-Z for EOF.  In addition,
  229.               IBM mainframes and the Michigan Terminal System use
  230.               EBCDIC rather than the more common ASCII  character
  231.               set,  and  NT  supports  Unicode.)  Note that zip's
  232.               identification  of  text  files  is  by  no   means
  233.  
  234. Info-ZIP               22 May 2004 (v5.51)                      4
  235.  
  236. UNZIP(1L)                                               UNZIP(1L)
  237.  
  238.               perfect; some ``text'' files may actually be binary
  239.               and vice versa.  unzip therefore prints  ``[text]''
  240.               or  ``[binary]'' as a visual check for each file it
  241.               extracts when using the -a option.  The -aa  option
  242.               forces  all  files to be extracted as text, regard-
  243.               less of the supposed file type.
  244.  
  245.        -b     [general] treat all files as binary (no  text  con-
  246.               versions).  This is a shortcut for ---a.
  247.  
  248.        -b     [Tandem]  force  the  creation  files with filecode
  249.               type 180 ('C') when extracting Zip  entries  marked
  250.               as  "text".  (On  Tandem, -a is enabled by default,
  251.               see above).
  252.  
  253.        -b     [VMS] auto-convert binary files (see -a  above)  to
  254.               fixed-length, 512-byte record format.  Doubling the
  255.               option (-bb) forces all files to  be  extracted  in
  256.               this format. When extracting to standard output (-c
  257.               or -p option in effect), the default conversion  of
  258.               text  record delimiters is disabled for binary (-b)
  259.               resp. all (-bb) files.
  260.  
  261.        -B     [Unix only, and only if  compiled  with  UNIXBACKUP
  262.               defined]  save  a  backup  copy of each overwritten
  263.               file with a tilde appended (e.g., the old  copy  of
  264.               ``foo''  is  renamed to ``foo~'').  This is similar
  265.               to the default behavior of emacs(1) in  many  loca-
  266.               tions.
  267.  
  268.        -C     match  filenames  case-insensitively.  unzip's phi-
  269.               losophy is ``you get what you ask  for''  (this  is
  270.               also responsible for the -L/-U change; see the rel-
  271.               evant options below).  Because  some  file  systems
  272.               are  fully  case-sensitive (notably those under the
  273.               Unix  operating  system)  and  because   both   ZIP
  274.               archives and unzip itself are portable across plat-
  275.               forms, unzip's default behavior is  to  match  both
  276.               wildcard  and  literal  filenames case-sensitively.
  277.               That is, specifying  ``makefile''  on  the  command
  278.               line  will  only match ``makefile'' in the archive,
  279.               not ``Makefile'' or ``MAKEFILE'' (and similarly for
  280.               wildcard specifications).  Since this does not cor-
  281.               respond to  the  behavior  of  many  other  operat-
  282.               ing/file  systems  (for  example,  OS/2 HPFS, which
  283.               preserves mixed case but is not sensitive  to  it),
  284.               the  -C  option  may  be used to force all filename
  285.               matches to be  case-insensitive.   In  the  example
  286.               above,  all  three  files  would then match ``make-
  287.               file'' (or ``make*'', or similar).  The  -C  option
  288.               affects  files in both the normal file list and the
  289.               excluded-file list (xlist).
  290.  
  291.        -E     [MacOS only] display contents of MacOS extra  field
  292.  
  293. Info-ZIP               22 May 2004 (v5.51)                      5
  294.  
  295. UNZIP(1L)                                               UNZIP(1L)
  296.  
  297.               during restore operation.
  298.  
  299.        -F     [Acorn  only]  suppress  removal  of  NFS  filetype
  300.               extension from stored filenames.
  301.  
  302.        -F     [non-Acorn systems supporting long  filenames  with
  303.               embedded   commas,   and   only  if  compiled  with
  304.               ACORN_FTYPE_NFS defined] translate filetype  infor-
  305.               mation from ACORN RISC OS extra field blocks into a
  306.               NFS filetype extension and append it to  the  names
  307.               of  the extracted files.  (When the stored filename
  308.               appears to already have an  appended  NFS  filetype
  309.               extension,  it  is  replaced  by  the info from the
  310.               extra field.)
  311.  
  312.        -i     [MacOS only] ignore filenames stored in MacOS extra
  313.               fields.   Instead,  the  most  compatible  filename
  314.               stored in the generic part of the entry's header is
  315.               used.
  316.  
  317.        -j     junk  paths.   The archive's directory structure is
  318.               not recreated;  all  files  are  deposited  in  the
  319.               extraction directory (by default, the current one).
  320.  
  321.        -J     [BeOS only] junk file attributes.  The file's  BeOS
  322.               file  attributes  are not restored, just the file's
  323.               data.
  324.  
  325.        -J     [MacOS only] ignore MacOS extra fields.  All Macin-
  326.               tosh   specific  info  is  skipped.  Data-fork  and
  327.               resource-fork are restored as separate files.
  328.  
  329.        -L     convert to lowercase any filename originating on an
  330.               uppercase-only  operating  system  or  file system.
  331.               (This was  unzip's  default  behavior  in  releases
  332.               prior  to 5.11; the new default behavior is identi-
  333.               cal to the old behavior with the -U  option,  which
  334.               is  now  obsolete  and  will be removed in a future
  335.               release.)   Depending  on   the   archiver,   files
  336.               archived  under  single-case file systems (VMS, old
  337.               MS-DOS FAT, etc.) may be  stored  as  all-uppercase
  338.               names;  this  can  be  ugly  or  inconvenient  when
  339.               extracting to a case-preserving file system such as
  340.               OS/2  HPFS  or  a  case-sensitive one such as under
  341.               Unix.  By default unzip  lists  and  extracts  such
  342.               filenames  exactly  as  they're  stored  (excepting
  343.               truncation, conversion of  unsupported  characters,
  344.               etc.);  this  option  causes the names of all files
  345.               from certain systems to be converted to  lowercase.
  346.               The  -LL option forces conversion of every filename
  347.               to lowercase, regardless of  the  originating  file
  348.               system.
  349.  
  350.        -M     pipe  all  output through an internal pager similar
  351.  
  352. Info-ZIP               22 May 2004 (v5.51)                      6
  353.  
  354. UNZIP(1L)                                               UNZIP(1L)
  355.  
  356.               to the Unix more(1)  command.   At  the  end  of  a
  357.               screenful   of   output,   unzip   pauses   with  a
  358.               ``--More--'' prompt;  the  next  screenful  may  be
  359.               viewed  by  pressing  the Enter (Return) key or the
  360.               space bar.  unzip can be terminated by pressing the
  361.               ``q''  key  and,  on some systems, the Enter/Return
  362.               key.  Unlike Unix more(1),  there  is  no  forward-
  363.               searching   or  editing  capability.   Also,  unzip
  364.               doesn't notice if long lines wrap at  the  edge  of
  365.               the  screen,  effectively resulting in the printing
  366.               of two or more lines and the likelihood  that  some
  367.               text  will  scroll off the top of the screen before
  368.               being viewed.  On some systems the number of avail-
  369.               able  lines on the screen is not detected, in which
  370.               case unzip assumes the height is 24 lines.
  371.  
  372.        -n     never overwrite existing files.  If a file  already
  373.               exists,  skip  the  extraction of that file without
  374.               prompting.   By  default   unzip   queries   before
  375.               extracting  any  file that already exists; the user
  376.               may choose to  overwrite  only  the  current  file,
  377.               overwrite all files, skip extraction of the current
  378.               file, skip extraction of  all  existing  files,  or
  379.               rename the current file.
  380.  
  381.        -N     [Amiga]  extract  file comments as Amiga filenotes.
  382.               File comments are created with  the  -c  option  of
  383.               zip(1L), or with the -N option of the Amiga port of
  384.               zip(1L), which stores filenotes as comments.
  385.  
  386.        -o     overwrite existing files without  prompting.   This
  387.               is a dangerous option, so use it with care.  (It is
  388.               often used with -f, however, and is the only way to
  389.               overwrite directory EAs under OS/2.)
  390.  
  391.        -P password
  392.               use  password  to decrypt encrypted zipfile entries
  393.               (if any).  THIS IS INSECURE!  Many multi-user oper-
  394.               ating  systems provide ways for any user to see the
  395.               current command line of any  other  user;  even  on
  396.               stand-alone  systems  there is always the threat of
  397.               over-the-shoulder peeking.  Storing  the  plaintext
  398.               password  as part of a command line in an automated
  399.               script is even worse.  Whenever possible,  use  the
  400.               non-echoing, interactive prompt to enter passwords.
  401.               (And where security is truly important, use  strong
  402.               encryption  such  as Pretty Good Privacy instead of
  403.               the relatively weak encryption provided by standard
  404.               zipfile utilities.)
  405.  
  406.        -q     perform  operations  quietly  (-qq = even quieter).
  407.               Ordinarily unzip prints the names of the files it's
  408.               extracting  or testing, the extraction methods, any
  409.               file or zipfile comments that may be stored in  the
  410.  
  411. Info-ZIP               22 May 2004 (v5.51)                      7
  412.  
  413. UNZIP(1L)                                               UNZIP(1L)
  414.  
  415.               archive,  and possibly a summary when finished with
  416.               each  archive.   The  -q[q]  options  suppress  the
  417.               printing of some or all of these messages.
  418.  
  419.        -s     [OS/2,  NT,  MS-DOS] convert spaces in filenames to
  420.               underscores.  Since all PC operating systems  allow
  421.               spaces  in  filenames,  unzip  by  default extracts
  422.               filenames     with     spaces     intact     (e.g.,
  423.               ``EA DATA. SF'').   This  can  be awkward, however,
  424.               since MS-DOS in particular does not gracefully sup-
  425.               port  spaces in filenames.  Conversion of spaces to
  426.               underscores can eliminate the awkwardness  in  some
  427.               cases.
  428.  
  429.        -U     (obsolete; to be removed in a future release) leave
  430.               filenames uppercase if created under  MS-DOS,  VMS,
  431.               etc.  See -L above.
  432.  
  433.        -V     retain  (VMS)  file version numbers.  VMS files can
  434.               be stored with a  version  number,  in  the  format
  435.               file.ext;##.   By  default the ``;##'' version num-
  436.               bers are stripped, but this option allows  them  to
  437.               be retained.  (On file systems that limit filenames
  438.               to particularly short lengths, the version  numbers
  439.               may  be  truncated  or  stripped regardless of this
  440.               option.)
  441.  
  442.        -X     [VMS, Unix, OS/2, NT] restore owner/protection info
  443.               (UICs)  under VMS, or user and group info (UID/GID)
  444.               under Unix, or access control  lists  (ACLs)  under
  445.               certain  network-enabled  versions  of  OS/2  (Warp
  446.               Server with IBM LAN Server/Requester  3.0  to  5.0;
  447.               Warp  Connect  with IBM Peer 1.0), or security ACLs
  448.               under Windows NT.  In most cases this will  require
  449.               special  system privileges, and doubling the option
  450.               (-XX) under NT instructs unzip  to  use  privileges
  451.               for extraction; but under Unix, for example, a user
  452.               who belongs to several  groups  can  restore  files
  453.               owned  by  any of those groups, as long as the user
  454.               IDs match his or her own.  Note that ordinary  file
  455.               attributes are always restored--this option applies
  456.               only to optional, extra ownership info available on
  457.               some operating systems.  [NT's access control lists
  458.               do not appear  to  be  especially  compatible  with
  459.               OS/2's,  so  no  attempt  is made at cross-platform
  460.               portability of access privileges.  It is not  clear
  461.               under  what  conditions  this  would ever be useful
  462.               anyway.]
  463.  
  464.        -$     [MS-DOS, OS/2, NT] restore the volume label if  the
  465.               extraction  medium is removable (e.g., a diskette).
  466.               Doubling the option (-$$) allows fixed media  (hard
  467.               disks)  to be labelled as well.  By default, volume
  468.               labels are ignored.
  469.  
  470. Info-ZIP               22 May 2004 (v5.51)                      8
  471.  
  472. UNZIP(1L)                                               UNZIP(1L)
  473.  
  474.        -/ extensions
  475.               [Acorn only] overrides the extension list  supplied
  476.               by  Unzip$Ext  environment variable. During extrac-
  477.               tion, filename extensions that  match  one  of  the
  478.               items  in  this extension list are swapped in front
  479.               of the base name of the extracted file.
  480.  
  481.        -:     [all but Acorn,  VM/CMS,  MVS,  Tandem]  allows  to
  482.               extract  archive  members into locations outside of
  483.               the current `` extraction root folder''. For  secu-
  484.               rity reasons, unzip normally removes ``parent dir''
  485.               path  components  (``../'')  from  the   names   of
  486.               extracted  file.  This safety feature (new for ver-
  487.               sion 5.50) prevents unzip from accidentally writing
  488.               files  to  ``sensitive''  areas  outside the active
  489.               extraction folder tree head.  The  -:  option  lets
  490.               unzip  switch  back  to  its previous, more liberal
  491.               behaviour, to allow  exact  extraction  of  (older)
  492.               archives  that  used  ``../''  components to create
  493.               multiple directory trees at the level of  the  cur-
  494.               rent  extraction  folder.   This  option  does  not
  495.               enable writing explicitly  to  the  root  directory
  496.               (``/'').   To  achieve this, it is necessary to set
  497.               the extraction target folder to root (e.g. -d /  ).
  498.               However,  when  the  -:  option is specified, it is
  499.               still possible to  implicitly  write  to  the  root
  500.               directory by specifiying enough ``../'' path compo-
  501.               nents within the zip file.  Use  this  option  with
  502.               extreme caution.
  503.  
  504. ENVIRONMENT OPTIONS
  505.        unzip's  default  behavior  may  be  modified  via options
  506.        placed in an environment variable.  This can be done  with
  507.        any  option,  but  it is probably most useful with the -a,
  508.        -L, -C, -q, -o, or -n modifiers:  make unzip  auto-convert
  509.        text  files  by  default,  make  it convert filenames from
  510.        uppercase systems to lowercase, make it match names  case-
  511.        insensitively,  make  it  quieter, or make it always over-
  512.        write or never overwrite files as it extracts  them.   For
  513.        example,  to  make  unzip act as quietly as possible, only
  514.        reporting errors, one would use one of the following  com-
  515.        mands:
  516.  
  517.          Unix Bourne shell:
  518.               UNZIP=-qq; export UNZIP
  519.  
  520.          Unix C shell:
  521.               setenv UNZIP -qq
  522.  
  523.          OS/2 or MS-DOS:
  524.               set UNZIP=-qq
  525.  
  526. Info-ZIP               22 May 2004 (v5.51)                      9
  527.  
  528. UNZIP(1L)                                               UNZIP(1L)
  529.  
  530.          VMS (quotes for lowercase):
  531.               define UNZIP_OPTS ""-qq""
  532.  
  533.        Environment  options are, in effect, considered to be just
  534.        like any other command-line options, except that they  are
  535.        effectively  the  first  options  on the command line.  To
  536.        override an environment option, one may  use  the  ``minus
  537.        operator'' to remove it.  For instance, to override one of
  538.        the quiet-flags in the example above, use the command
  539.  
  540.            unzip --q[other options] zipfile
  541.  
  542.        The first hyphen is the normal switch character,  and  the
  543.        second  is a minus sign, acting on the q option.  Thus the
  544.        effect here is to cancel one  quantum  of  quietness.   To
  545.        cancel  both  quiet  flags,  two  (or more) minuses may be
  546.        used:
  547.  
  548.            unzip -t--q zipfile
  549.            unzip ---qt zipfile
  550.  
  551.        (the two are equivalent).  This may seem awkward  or  con-
  552.        fusing,  but  it is reasonably intuitive:  just ignore the
  553.        first hyphen and go from there.   It  is  also  consistent
  554.        with the behavior of Unix nice(1).
  555.  
  556.        As  suggested  by the examples above, the default variable
  557.        names are UNZIP_OPTS for VMS (where  the  symbol  used  to
  558.        install unzip as a foreign command would otherwise be con-
  559.        fused with the environment variable), and  UNZIP  for  all
  560.        other  operating systems.  For compatibility with zip(1L),
  561.        UNZIPOPT is also accepted (don't ask).  If both UNZIP  and
  562.        UNZIPOPT  are  defined,  however,  UNZIP takes precedence.
  563.        unzip's diagnostic option (-v with no zipfile name) can be
  564.        used  to  check  the values of all four possible unzip and
  565.        zipinfo environment variables.
  566.  
  567.        The timezone variable (TZ) should be set according to  the
  568.        local  timezone in order for the -f and -u to operate cor-
  569.        rectly.  See the description  of  -f  above  for  details.
  570.        This  variable  may  also be necessary in order for times-
  571.        tamps on extracted files to be set correctly.  Under  Win-
  572.        dows  95/NT unzip should know the correct timezone even if
  573.        TZ is unset, assuming the timezone is correctly set in the
  574.        Control Panel.
  575.  
  576. DECRYPTION
  577.        Encrypted  archives  are fully supported by Info-ZIP soft-
  578.        ware,  but  due  to  United  States  export  restrictions,
  579.        de-/encryption  support might be disabled in your compiled
  580.        binary.  However, since spring 2000,  US  export  restric-
  581.        tions  have been liberated, and our source archives do now
  582.        include full crypt code.  In case you need binary  distri-
  583.        butions with crypt support enabled, see the file ``WHERE''
  584.  
  585. Info-ZIP               22 May 2004 (v5.51)                     10
  586.  
  587. UNZIP(1L)                                               UNZIP(1L)
  588.  
  589.        in any Info-ZIP source or binary  distribution  for  loca-
  590.        tions both inside and outside the US.
  591.  
  592.        Some  compiled  versions  of unzip may not support decryp-
  593.        tion.  To  check  a  version  for  crypt  support,  either
  594.        attempt  to  test or extract an encrypted archive, or else
  595.        check unzip's diagnostic screen (see the -v option  above)
  596.        for  ``[decryption]''  as  one  of the special compilation
  597.        options.
  598.  
  599.        As noted above, the -P option may  be  used  to  supply  a
  600.        password  on  the command line, but at a cost in security.
  601.        The preferred decryption method is simply to extract  nor-
  602.        mally; if a zipfile member is encrypted, unzip will prompt
  603.        for the password without echoing  what  is  typed.   unzip
  604.        continues  to  use the same password as long as it appears
  605.        to be valid, by testing a 12-byte  header  on  each  file.
  606.        The  correct  password  will  always check out against the
  607.        header, but there is a 1-in-256 chance that  an  incorrect
  608.        password will as well.  (This is a security feature of the
  609.        PKWARE  zipfile  format;  it  helps  prevent   brute-force
  610.        attacks  that might otherwise gain a large speed advantage
  611.        by testing only the header.)  In the case that  an  incor-
  612.        rect  password is given but it passes the header test any-
  613.        way, either an incorrect CRC will  be  generated  for  the
  614.        extracted  data or else unzip will fail during the extrac-
  615.        tion because the ``decrypted'' bytes do not  constitute  a
  616.        valid compressed data stream.
  617.  
  618.        If the first password fails the header check on some file,
  619.        unzip will prompt for another password, and  so  on  until
  620.        all  files  are  extracted.   If  a password is not known,
  621.        entering a null password (that is, just a carriage  return
  622.        or  ``Enter'')  is  taken  as a signal to skip all further
  623.        prompting.  Only unencrypted files in the archive(s)  will
  624.        thereafter be extracted.  (In fact, that's not quite true;
  625.        older versions of zip(1L) and  zipcloak(1L)  allowed  null
  626.        passwords,  so  unzip checks each encrypted file to see if
  627.        the null password works.  This may result in ``false posi-
  628.        tives'' and extraction errors, as noted above.)
  629.  
  630.        Archives  encrypted  with  8-bit  passwords  (for example,
  631.        passwords with accented European characters)  may  not  be
  632.        portable  across  systems  and/or  other  archivers.  This
  633.        problem stems from the use of  multiple  encoding  methods
  634.        for  such  characters,  including Latin-1 (ISO 8859-1) and
  635.        OEM code page 850.  DOS PKZIP  2.04g  uses  the  OEM  code
  636.        page;  Windows  PKZIP  2.50 uses Latin-1 (and is therefore
  637.        incompatible with DOS PKZIP); Info-ZIP uses the  OEM  code
  638.        page  on DOS, OS/2 and Win3.x ports but Latin-1 everywhere
  639.        else; and Nico Mak's WinZip 6.x does not allow 8-bit pass-
  640.        words  at  all.   UnZip 5.3 (or newer) attempts to use the
  641.        default character set first (e.g., Latin-1),  followed  by
  642.        the alternate one (e.g., OEM code page) to test passwords.
  643.  
  644. Info-ZIP               22 May 2004 (v5.51)                     11
  645.  
  646. UNZIP(1L)                                               UNZIP(1L)
  647.  
  648.        On EBCDIC systems, if both of these fail, EBCDIC  encoding
  649.        will be tested as a last resort.  (EBCDIC is not tested on
  650.        non-EBCDIC systems, because there are no  known  archivers
  651.        that encrypt using EBCDIC encoding.)  ISO character encod-
  652.        ings other than Latin-1 are not supported.
  653.  
  654. EXAMPLES
  655.        To use unzip to extract all members of  the  archive  let-
  656.        ters.zip  into  the  current  directory and subdirectories
  657.        below it, creating any subdirectories as necessary:
  658.  
  659.            unzip letters
  660.  
  661.        To extract all members of  letters.zip  into  the  current
  662.        directory only:
  663.  
  664.            unzip -j letters
  665.  
  666.        To test letters.zip, printing only a summary message indi-
  667.        cating whether the archive is OK or not:
  668.  
  669.            unzip -tq letters
  670.  
  671.        To test all zipfiles in the  current  directory,  printing
  672.        only the summaries:
  673.  
  674.            unzip -tq \*.zip
  675.  
  676.        (The backslash before the asterisk is only required if the
  677.        shell expands wildcards, as in Unix; double  quotes  could
  678.        have   been  used  instead,  as  in  the  source  examples
  679.        below.)  To extract to standard output all members of let-
  680.        ters.zip  whose  names end in .tex, auto-converting to the
  681.        local end-of-line convention and piping  the  output  into
  682.        more(1):
  683.  
  684.            unzip -ca letters \*.tex | more
  685.  
  686.        To  extract  the binary file paper1.dvi to standard output
  687.        and pipe it to a printing program:
  688.  
  689.            unzip -p articles paper1.dvi | dvips
  690.  
  691.        To extract all FORTRAN and C source files--*.f, *.c,  *.h,
  692.        and Makefile--into the /tmp directory:
  693.  
  694.            unzip source.zip "*.[fch]" Makefile -d /tmp
  695.  
  696.        (the  double quotes are necessary only in Unix and only if
  697.        globbing is turned on).  To  extract  all  FORTRAN  and  C
  698.        source  files, regardless of case (e.g., both *.c and *.C,
  699.        and any makefile, Makefile, MAKEFILE or similar):
  700.  
  701.            unzip -C source.zip "*.[fch]" makefile -d /tmp
  702.  
  703. Info-ZIP               22 May 2004 (v5.51)                     12
  704.  
  705. UNZIP(1L)                                               UNZIP(1L)
  706.  
  707.        To extract any such files but convert any uppercase MS-DOS
  708.        or  VMS names to lowercase and convert the line-endings of
  709.        all of the files to the local standard (without respect to
  710.        any files that might be marked ``binary''):
  711.  
  712.            unzip -aaCL source.zip "*.[fch]" makefile -d /tmp
  713.  
  714.        To extract only newer versions of the files already in the
  715.        current directory, without querying (NOTE:  be careful  of
  716.        unzipping   in   one   timezone   a   zipfile  created  in
  717.        another--ZIP archives other than those created by Zip  2.1
  718.        or  later contain no timezone information, and a ``newer''
  719.        file from an eastern timezone may, in fact, be older):
  720.  
  721.            unzip -fo sources
  722.  
  723.        To extract newer versions of the files already in the cur-
  724.        rent  directory  and to create any files not already there
  725.        (same caveat as previous example):
  726.  
  727.            unzip -uo sources
  728.  
  729.        To display a diagnostic screen  showing  which  unzip  and
  730.        zipinfo  options  are  stored  in  environment  variables,
  731.        whether decryption support was compiled in,  the  compiler
  732.        with which unzip was compiled, etc.:
  733.  
  734.            unzip -v
  735.  
  736.        In the last five examples, assume that UNZIP or UNZIP_OPTS
  737.        is set to -q.  To do a singly quiet listing:
  738.  
  739.            unzip -l file.zip
  740.  
  741.        To do a doubly quiet listing:
  742.  
  743.            unzip -ql file.zip
  744.  
  745.        (Note that the ``.zip'' is generally not  necessary.)   To
  746.        do a standard listing:
  747.  
  748.            unzip --ql file.zip
  749.        or
  750.            unzip -l-q file.zip
  751.        or
  752.            unzip -l--q file.zip
  753.        (Extra minuses in options don't hurt.)
  754.  
  755. TIPS
  756.        The  current  maintainer, being a lazy sort, finds it very
  757.        useful to define a pair of aliases:  tt for ``unzip  -tq''
  758.        and  ii  for  ``unzip -Z'' (or ``zipinfo'').  One may then
  759.        simply type ``tt zipfile'' to test an  archive,  something
  760.        that  is  worth  making a habit of doing.  With luck unzip
  761.  
  762. Info-ZIP               22 May 2004 (v5.51)                     13
  763.  
  764. UNZIP(1L)                                               UNZIP(1L)
  765.  
  766.        will report ``No errors detected  in  compressed  data  of
  767.        zipfile.zip,''  after  which  one  may  breathe  a sigh of
  768.        relief.
  769.  
  770.        The maintainer also finds it useful to set the UNZIP envi-
  771.        ronment  variable  to ``-aL'' and is tempted to add ``-C''
  772.        as well.  His ZIPINFO variable is set to ``-z''.
  773.  
  774. DIAGNOSTICS
  775.        The exit status (or error  level)  approximates  the  exit
  776.        codes defined by PKWARE and takes on the following values,
  777.        except under VMS:
  778.  
  779.               0      normal; no errors or warnings detected.
  780.  
  781.               1      one or more warning errors were encountered,
  782.                      but  processing  completed successfully any-
  783.                      way.  This includes zipfiles  where  one  or
  784.                      more  files  was  skipped due to unsupported
  785.                      compression method  or  encryption  with  an
  786.                      unknown password.
  787.  
  788.               2      a  generic  error  in the zipfile format was
  789.                      detected.   Processing  may  have  completed
  790.                      successfully  anyway;  some  broken zipfiles
  791.                      created by other archivers have simple work-
  792.                      arounds.
  793.  
  794.               3      a  severe  error  in  the zipfile format was
  795.                      detected.  Processing probably failed  imme-
  796.                      diately.
  797.  
  798.               4      unzip  was unable to allocate memory for one
  799.                      or more buffers during  program  initializa-
  800.                      tion.
  801.  
  802.               5      unzip  was  unable  to  allocate  memory  or
  803.                      unable to obtain a tty to read  the  decryp-
  804.                      tion password(s).
  805.  
  806.               6      unzip  was  unable to allocate memory during
  807.                      decompression to disk.
  808.  
  809.               7      unzip was unable to allocate  memory  during
  810.                      in-memory decompression.
  811.  
  812.               8      [currently not used]
  813.  
  814.               9      the specified zipfiles were not found.
  815.  
  816.               10     invalid  options  were specified on the com-
  817.                      mand line.
  818.  
  819.               11     no matching files were found.
  820.  
  821. Info-ZIP               22 May 2004 (v5.51)                     14
  822.  
  823. UNZIP(1L)                                               UNZIP(1L)
  824.  
  825.               50     the disk is (or was) full during extraction.
  826.  
  827.               51     the  end  of the ZIP archive was encountered
  828.                      prematurely.
  829.  
  830.               80     the user aborted unzip prematurely with con-
  831.                      trol-C (or similar)
  832.  
  833.               81     testing  or  extraction of one or more files
  834.                      failed due to unsupported compression  meth-
  835.                      ods or unsupported decryption.
  836.  
  837.               82     no  files  were  found due to bad decryption
  838.                      password(s).  (If even one file is  success-
  839.                      fully processed, however, the exit status is
  840.                      1.)
  841.  
  842.        VMS interprets standard Unix  (or  PC)  return  values  as
  843.        other,  scarier-looking things, so unzip instead maps them
  844.        into VMS-style status codes.  The current  mapping  is  as
  845.        follows:    1  (success)  for  normal exit, 0x7fff0001 for
  846.        warning    errors,    and    (0x7fff000?     +     16*nor-
  847.        mal_unzip_exit_status) for all other errors, where the `?'
  848.        is 2 (error) for unzip values 2, 9-11  and  80-82,  and  4
  849.        (fatal  error)  for  the remaining ones (3-8, 50, 51).  In
  850.        addition, there is a compilation  option  to  expand  upon
  851.        this  behavior:  defining RETURN_CODES results in a human-
  852.        readable explanation of what the error status means.
  853.  
  854. BUGS
  855.        Multi-part archives are not yet supported, except in  con-
  856.        junction  with  zip.   (All  parts  must  be  concatenated
  857.        together in order, and then ``zip -F'' must  be  performed
  858.        on the concatenated archive in order to ``fix'' it.)  This
  859.        will definitely be corrected in the next major release.
  860.  
  861.        Archives read from standard input are not  yet  supported,
  862.        except  with funzip (and then only the first member of the
  863.        archive can be extracted).
  864.  
  865.        Archives encrypted with 8-bit passwords  (e.g.,  passwords
  866.        with  accented  European  characters)  may not be portable
  867.        across systems and/or other archivers.  See the discussion
  868.        in DECRYPTION above.
  869.  
  870.        unzip's  -M  (``more'')  option tries to take into account
  871.        automatic wrapping of long lines. However,  the  code  may
  872.        fail  to detect the correct wrapping locations. First, TAB
  873.        characters (and similar control sequences) are  not  taken
  874.        into account, they are handled as ordinary printable char-
  875.        acters.  Second, depending on the actual system / OS port,
  876.        unzip  may  not detect the true screen geometry but rather
  877.        rely on "commonly used" default dimensions.   The  correct
  878.        handling  of  tabs  would  require the implementation of a
  879.  
  880. Info-ZIP               22 May 2004 (v5.51)                     15
  881.  
  882. UNZIP(1L)                                               UNZIP(1L)
  883.  
  884.        query for the actual tabulator setup on  the  output  con-
  885.        sole.
  886.  
  887.        Dates, times and permissions of stored directories are not
  888.        restored except under Unix. (On Windows NT and successors,
  889.        timestamps are now restored.)
  890.  
  891.        [MS-DOS]  When extracting or testing files from an archive
  892.        on a defective floppy diskette, if the ``Fail'' option  is
  893.        chosen  from  DOS's ``Abort, Retry, Fail?'' message, older
  894.        versions of unzip may hang the system, requiring a reboot.
  895.        This  problem  appears to be fixed, but control-C (or con-
  896.        trol-Break) can still be used to terminate unzip.
  897.  
  898.        Under DEC Ultrix, unzip would sometimes fail on long  zip-
  899.        files (bad CRC, not always reproducible).  This was appar-
  900.        ently due either to a hardware bug (cache  memory)  or  an
  901.        operating  system bug (improper handling of page faults?).
  902.        Since Ultrix has been abandoned in favor of  Digital  Unix
  903.        (OSF/1), this may not be an issue anymore.
  904.  
  905.        [Unix]  Unix  special  files  such  as FIFO buffers (named
  906.        pipes),  block  devices  and  character  devices  are  not
  907.        restored  even if they are somehow represented in the zip-
  908.        file, nor are hard-linked files relinked.   Basically  the
  909.        only  file  types  restored  by  unzip  are regular files,
  910.        directories and symbolic (soft) links.
  911.  
  912.        [OS/2] Extended attributes for  existing  directories  are
  913.        only  updated  if  the  -o  (``overwrite  all'') option is
  914.        given.  This is a  limitation  of  the  operating  system;
  915.        because  directories  only have a creation time associated
  916.        with them, unzip has  no  way  to  determine  whether  the
  917.        stored  attributes  are newer or older than those on disk.
  918.        In practice this may mean a two-pass approach is required:
  919.        first  unpack the archive normally (with or without fresh-
  920.        ening/updating existing files), then  overwrite  just  the
  921.        directory entries (e.g., ``unzip -o foo */'').
  922.  
  923.        [VMS]  When  extracting  to  another  directory,  only the
  924.        [.foo] syntax is accepted for the -d  option;  the  simple
  925.        Unix foo syntax is silently ignored (as is the less common
  926.        VMS foo.dir syntax).
  927.  
  928.        [VMS]  When  the  file  being  extracted  already  exists,
  929.        unzip's  query only allows skipping, overwriting or renam-
  930.        ing; there should additionally be a choice for creating  a
  931.        new  version  of  the  file.   In  fact, the ``overwrite''
  932.        choice does create a new version; the old version  is  not
  933.        overwritten or deleted.
  934.  
  935. SEE ALSO
  936.        funzip(1L),   zip(1L),   zipcloak(1L),  zipgrep(1L),  zip-
  937.        info(1L), zipnote(1L), zipsplit(1L)
  938.  
  939. Info-ZIP               22 May 2004 (v5.51)                     16
  940.  
  941. UNZIP(1L)                                               UNZIP(1L)
  942.  
  943. URL
  944.        The Info-ZIP home page is currently at
  945.            http://www.info-zip.org/pub/infozip/
  946.        or
  947.            ftp://ftp.info-zip.org/pub/infozip/ .
  948.  
  949. AUTHORS
  950.        The primary Info-ZIP authors (current semi-active  members
  951.        of  the  Zip-Bugs  workgroup)  are:   Onno  van der Linden
  952.        (Zip); Christian Spieler (UnZip maintenance  coordination,
  953.        VMS,  MS-DOS,  Win32,  shared  code, general Zip and UnZip
  954.        integration and optimization); Mike  White  (Windows  GUI,
  955.        Windows DLLs); Kai Uwe Rommel (OS/2); Paul Kienitz (Amiga,
  956.        Win32); Chris Herborth (BeOS, QNX, Atari); Jonathan Hudson
  957.        (SMS/QDOS);  Sergio  Monesi (Acorn RISC OS); Harald Denker
  958.        (Atari, MVS); John Bush (Solaris, Amiga);  Hunter  Goatley
  959.        (VMS);  Steve  Salisbury (Win32); Steve Miller (Windows CE
  960.        GUI), Johnny Lee (MS-DOS, Win32); and Dave  Smith  (Tandem
  961.        NSK).
  962.  
  963.        The  following  people were former members of the Info-ZIP
  964.        development group and provided major contributions to  key
  965.        parts  of  the  current  code:  Greg ``Cave Newt'' Roelofs
  966.        (UnZip, unshrink decompression); Jean-loup Gailly (deflate
  967.        compression);  Mark Adler (inflate decompression, fUnZip).
  968.  
  969.        The author of the original unzip  code  upon  which  Info-
  970.        ZIP's  was  based is Samuel H. Smith; Carl Mascott did the
  971.        first Unix port; and David P.   Kirschbaum  organized  and
  972.        led Info-ZIP in its early days with Keith Petersen hosting
  973.        the original mailing list at WSMR-SimTel20.  The full list
  974.        of  contributors  to  UnZip  has grown quite large; please
  975.        refer to the CONTRIBS file in the UnZip  source  distribu-
  976.        tion for a relatively complete version.
  977.  
  978. VERSIONS
  979.        v1.2   15 Mar 89   Samuel H. Smith
  980.        v2.0    9 Sep 89   Samuel H. Smith
  981.        v2.x   fall 1989   many Usenet contributors
  982.        v3.0    1 May 90   Info-ZIP (DPK, consolidator)
  983.        v3.1   15 Aug 90   Info-ZIP (DPK, consolidator)
  984.        v4.0    1 Dec 90   Info-ZIP (GRR, maintainer)
  985.        v4.1   12 May 91   Info-ZIP
  986.        v4.2   20 Mar 92   Info-ZIP (Zip-Bugs subgroup, GRR)
  987.        v5.0   21 Aug 92   Info-ZIP (Zip-Bugs subgroup, GRR)
  988.        v5.01  15 Jan 93   Info-ZIP (Zip-Bugs subgroup, GRR)
  989.        v5.1    7 Feb 94   Info-ZIP (Zip-Bugs subgroup, GRR)
  990.        v5.11   2 Aug 94   Info-ZIP (Zip-Bugs subgroup, GRR)
  991.        v5.12  28 Aug 94   Info-ZIP (Zip-Bugs subgroup, GRR)
  992.        v5.2   30 Apr 96   Info-ZIP (Zip-Bugs subgroup, GRR)
  993.        v5.3   22 Apr 97   Info-ZIP (Zip-Bugs subgroup, GRR)
  994.        v5.31  31 May 97   Info-ZIP (Zip-Bugs subgroup, GRR)
  995.        v5.32   3 Nov 97   Info-ZIP (Zip-Bugs subgroup, GRR)
  996.        v5.4   28 Nov 98   Info-ZIP (Zip-Bugs subgroup, SPC)
  997.  
  998. Info-ZIP               22 May 2004 (v5.51)                     17
  999.  
  1000. UNZIP(1L)                                               UNZIP(1L)
  1001.  
  1002.        v5.41  16 Apr 00   Info-ZIP (Zip-Bugs subgroup, SPC)
  1003.        v5.42  14 Jan 01   Info-ZIP (Zip-Bugs subgroup, SPC)
  1004.        v5.5   17 Feb 02   Info-ZIP (Zip-Bugs subgroup, SPC)
  1005.        v5.51  22 May 04   Info-ZIP (Zip-Bugs subgroup, SPC)
  1006.  
  1007. Info-ZIP               22 May 2004 (v5.51)                     18
  1008.  
  1009.