1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
unzoo.c Tools Martin Schoenert
@(#)$Id: unzoo.c,v 4.4 2000/05/29 08:56:57 sal Exp $
This file is in the Public Domain.
SYNTAX
'unzoo'
'unzoo [-l] [-v] <archive>[.zoo] [<file>..]'
'unzoo -x [-abnpo] <archive>[.zoo] [<file>..]'
DESCRIPTION
'unzoo' is a zoo archive extractor. A zoo archive is a file that
contains several files, called its members, usually in compressed form to
save space. 'unzoo' can list all or selected members or extract all or
selected members, i.e., uncompress them and write them to files. It
cannot add new members or delete members. For this you need the zoo
archiver, called 'zoo', written by Rahul Dhesi.
If you call 'unzoo' with no arguments, it will first print a summary of
the commands and then prompt for command lines interactively, until you
enter an empty line. This is useful on systems that do not support the
notion of command line arguments such as the Macintosh.
If you call 'unzoo' with the '-l' option, it lists the members in the
archive <archive>. For each member 'unzoo' prints the size that the
extracted file would have, the compression factor, the size that the
member occupies in the archive (not counting the space needed to store
the attributes such as the path name of the file), the date and time when
the files were last modified, and finally the path name itself. Finally
'unzoo' prints a grand total for the file sizes, the compression factor,
and the member sizes.
The '-v' suboption causes 'unzoo' to append to each path name, separated
by a ';', the generation number of the member, where higher numbers mean
later generations. Members for which generations are disabled are listed
with ';0'. Also 'unzoo' will print the comments associated with the
archive itself or the members, preceeded by the string '# '.
If you call 'unzoo' with the '-x' option, it extracts the members from
the archive <archive>. Members are stored with a full path name in the
archive and if the operating system supports this, they will be extracted
into appropriate subdirectories, which will be created on demand.
The members are usually extracted as binary files, with no translation.
However, if a member has a comment that starts with the string '!TEXT!',
it is extracted as a text file, i.e., it will be translated from the
universal text file format (with <lf> as line separator as under UNIX) to
the local text file format (e.g., with <cr>/<lf> as separator under DOS).
If the archive itself has a comment that starts with '!TEXT!' then all
members will be extracted as text files, even those that have no comment.
For each member the name is printed followed by '-- extracted as binary'
or '-- extracted as text' when the member has been completely extracted.
The '-a' suboption causes 'unzoo' to extract all members as text files,
even if they have no comment starting with '!TEXT!'.
The '-b' suboption causes 'unzoo' to extract all members as binary files,
even if they have a comment starting with '!TEXT!'.
The '-n' suboption causes 'unzoo' to suppress writing the files. You use
this suboption to test the integrity of the archive without extracting
the members. For each member the name is printed followed by '-- tested'
if the member is intact or by '-- error, CRC failed' if it is not.
The '-p' suboption causes 'unzoo' to print the files to stdout instead of
writing them to files.
The '-o' suboption causes 'unzoo' to overwrite existing files without
asking you for confirmation. The default is to ask for confirmation
'<file> exists, overwrite it? (Yes/No/All/Ren)'. To this you can answer
with 'y' to overwrite the file, 'n' to skip extraction of the file, 'a'
to overwrite this and all following files, or 'r' to enter a new name for
the file. 'unzoo' will never overwrite existing read-only files.
The '-j <prefix>' suboption causes 'unzoo' to prepend the string <prefix>
to all path names for the members before they are extracted. So for
example if an archive contains absolute path names under UNIX, '-j ./'
can be used to convert them to relative pathnames. This option is also
useful on the Macintosh where you start 'unzoo' by clicking, because
then the current directory will be the one where 'unzoo' is, not the one
where the archive is. Note that the directory <prefix> must exist,
'unzoo' will not create it on demand.
If no <files> argument is given all members are listed or extracted.
If one or more <files> arguments are given, only members whose names
match at least one of the <files> patterns are listed or extracted.
<files> can contain the wildcard '?', which matches any character in
names, and '*', which matches any number of characters in names. When
you pass the <files> arguments on the command line you will usually have
to quote them to keep the shell from trying to expand them.
Usually 'unzoo' will only list or extract the latest generation of each
member. But if you append ';<nr>' to a path name pattern the generation
with the number <nr> is listed or extracted. <nr> itself can contain the
wildcard characters '?' and '*', so appending ';*' to a path name pattern
causes all generations to be listed or extracted.
COMPATIBILITY
'unzoo' is based heavily on the 'booz' archive extractor by Rahul Dhesi.
I basically stuffed everything in one file (so no 'Makefile' is needed),
cleaned it up (so that it is now more portable and a little bit faster),
and added the support for long file names, directories, and comments.
'unzoo' differs in some details from 'booz' and the zoo archiver 'zoo'.
'unzoo' can only list and extract members from archives, like 'booz'.
'zoo' can also add members, delete members, etc.
'unzoo' can extract members as text files, converting from universal text
format to the local text format, if the '-a' option is given or the '-b'
option is not given and the member has a comment starting with '!TEXT!'.
So in the absence of the '-a' option and comments starting with '!TEXT!',
'unzoo' behaves like 'zoo' and 'booz', which always extract as binary.
But 'unzoo' can correctly extract text files from archives that were
created under UNIX (or other systems using the universal text format) and
extended with '!TEXT!' comments on systems such as DOS, VMS, Macintosh.
'unzoo' can handle long names, which it converts in a system dependent
manner to local names, like 'zoo' (this may not be available on all
systems). 'booz' always uses the short DOS format names.
'unzoo' extracts members into subdirectories, which it automatically
creates, like 'zoo' (this may not be available on all systems). 'booz'
always extracts all members into the current directory.
'unzoo' can handle comments and generations in the archive, like 'zoo'.
'booz' ignores all comments and generations.
'unzoo' cannot handle members compressed with the old method, only with
the new high method or not compressed at all. 'zoo' and 'booz' also
handle members compress with the old method. This shall be fixed soon.
'unzoo' can handle archives in binary format under VMS, i.e., it is not
necessary to convert them to stream linefeed format with 'bilf' first.
'zoo' and 'booz' require this conversion.
'unzoo' is somewhat faster than 'zoo' and 'booz'.
'unzoo' should be much easier to port than both 'zoo' and 'booz'.
ACKNOWLEDGMENTS
Rahul Dhesi wrote the 'zoo' archiver and the 'booz' archive extractor.
Haruhiko Okumura wrote the LZH code (originally for his 'ar' archiver).
David Schwaderer provided the CRC-16 calculation in PC Tech Journal 4/85.
Jeff Damens wrote the name match code in 'booz' (originally for Kermit).
Harald Boegeholz ported 'unzoo' to OS/2 with the emx development system.
Dave Bayer ported 'unzoo' to the Macintosh, including Macbinary support.
|