rpms/unzoo/devel import.log, NONE, 1.1 unzoo.c, NONE, 1.1 unzoo.spec, NONE, 1.1
John W. Linville
linville at fedoraproject.org
Wed Apr 1 17:18:02 UTC 2009
- Previous message: rpms/frescobaldi/devel frescobaldi.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message: rpms/reiserfs-utils/devel import.log, NONE, 1.1 .cvsignore, 1.7, 1.8 reiserfs-utils.spec, 1.19, 1.20 sources, 1.7, 1.8 header-fix.patch, 1.2, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: linville
Update of /cvs/pkgs/rpms/unzoo/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21817/devel
Added Files:
import.log unzoo.c unzoo.spec
Log Message:
Package import
--- NEW FILE import.log ---
unzoo-4_4-4_fc10:HEAD:unzoo-4.4-4.fc10.src.rpm:1238606204
--- NEW FILE unzoo.c ---
/****************************************************************************
**
*A unzoo.c Tools Martin Schoenert
**
*H @(#)$Id: unzoo.c,v 4.4 2000/05/29 08:56:57 sal Exp $
**
*Y 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'.
**
** COMPILATION
**
** Under UNIX with the standard C compiler, compile 'unzoo' as follows
** cc -o unzoo -DSYS_IS_UNIX -O unzoo.c
** If your UNIX has the 'mkdir' system call, you may add '-DSYS_HAS_MKDIR'
** for a slightly faster executable. BSD has it, else try 'man 2 mkdir'.
**
** Under DOS with the DJGPP GNU C compiler, compile 'unzoo' as follows
** gcc -o unzoo.out -DSYS_IS_DOS_DJGPP -O2 unzoo.c
** copy /b \djgpp\bin\go32.exe+unzoo.out unzoo.exe
**
** Under TOS with the GNU compiler and unixmode, compile 'unzoo' as follows
** gcc -o unzoo.ttp -DSYS_IS_TOS_GCC -O2 unzoo.c
**
** Under OS/2 2 with the emx development system, compile 'unzoo' as follows
** gcc -o unzoo.exe -DSYS_IS_OS2_EMX -Zomf -Zsys -O2 unzoo.c
** To create an executable that runs under OS/2 and DOS, but which requires
** the emx runtime, compile without the '-Zomf' and '-Zsys' options.
**
** On a VAX running VMS with the DEC C compiler, compile 'unzoo' as follows
** cc unzoo/define=SYS_IS_VMS
** link unzoo
** Then perform the following global symbolic assignment
** unzoo :== $<dev>:[<dir>]unzoo.exe
** where <dir> is the name of the directory where you have installed
** 'unzoo' and <dev> is the device on which this directory is, for example
** unzoo :== $dia1:[progs.archivers]unzoo
** You may want to put this symbolic assignment into your 'login.com' file.
**
** On a Macintosh with the MPW C compiler, compile 'unzoo' as follows
** C -model far -d SYS_IS_MAC_MPW -opt on unzoo.c
** Link -model far -d -c '????' -t APPL unzoo.c.o -o unzoo <continued>
** "{CLibraries}"StdClib.o "{Libraries}"SIOW.o <continued>
** "{Libraries}"Runtime.o "{Libraries}"Interface.o
** Rez -a "{RIncludes}"SIOW.r -o unzoo
** Afterwards choose the 'Get Info' command in the finder 'File' menu and
** increase the amount of memory 'unzoo' gets upon startup to 256 KBytes.
** To create a MPW tool instead of a standalone, link with creator 'MPS '
** instead of '????', with type 'MPST' instead of 'APPL' and with 'Stubs.o'
** instead of 'SIOW.o'. The 'Rez' command is not required for the tool.
** Alternatively choose the 'Create Build Commands...' command from the MPW
** 'Build' menu to create a makefile. Edit it and add '-d SYS_IS_MAC_MPW'
** to the compile command. Choose the 'Build...' command from the 'Build'
** menu to build 'unzoo'.
**
** On other systems with a C compiler, try to compile 'unzoo' as follows
** cc -o unzoo -DSYS_IS_GENERIC -O unzoo.c
**
** PORTING
**
** If this does not work, you must supply new definitions for the macros
** 'OPEN_READ_ARCH', 'OPEN_READ_TEXT' and 'OPEN_WRIT_TEXT'. If you want
** 'unzoo' to keep long file names, you must supply a definition for the
[...2448 lines suppressed...]
OpenWritFile( (char*)0, 0L );
/* decode the file */
if ( ! GotoReadArch( Entry.posdat ) ) {
printf("unzoo: cannot find data in archive '%s'\n",arc);
return 0;
}
res = 0;
ErrMsg = "this should not happen";
if ( out == 0 || out == 2 )
printf("%s \t-- ",Entry.patl);
else
printf("********\n%s\n********\n",Entry.patl);
fflush( stdout );
if ( Entry.method == 0 ) res = DecodeCopy( Entry.siznow );
if ( Entry.method == 1 ) res = DecodeLzd();
if ( Entry.method == 2 ) res = DecodeLzh();
/* check that everything went ok */
if ( res == 0 ) printf("error, %s\n",ErrMsg);
else if ( Crc != Entry.crcdat ) printf("error, CRC failed\n");
else if ( out == 2 && bin == 1 ) printf("extracted as text\n");
else if ( out == 2 && bin == 2 ) printf("extracted as binary\n");
#ifdef SYS_IS_MAC_MPW
else if ( out == 2 && bin == 3 ) printf("extracted as MacBinary\n");
#endif
else if ( out == 0 ) printf("tested\n");
fflush( stdout );
/* close the file after extraction */
if ( out == 1 || out == 2 )
ClosWritFile();
/* set the file time, evt. correct for timezone of packing system */
secs = 24*60*60L*(365*(Entry.year - 70)
+ BeginMonth[Entry.month]
+ Entry.day - 1
+ (Entry.year - 69) / 4
+ (Entry.year % 4 == 0 && 1 < Entry.month)
- (Entry.year + 299) / 400
- (Entry.year % 400 == 100 && 1 < Entry.month))
+60*60L*Entry.hour + 60L*Entry.min + Entry.sec;
if ( Entry.timzon < 127 ) secs += 15*60*(Entry.timzon );
else if ( 127 < Entry.timzon ) secs += 15*60*(Entry.timzon - 256);
if ( out == 2 ) {
if ( ! SETF_TIME( patl, secs ) )
printf("unzoo: '%s' could not set the times\n",patl);
}
/* set the file permissions */
if ( out == 2 && (Entry.permis >> 22) == 1 ) {
if ( ! SETF_PERM( patl, Entry.permis ) )
printf("unzoo: '%s' could not set the permissions\n",patl);
}
}
/* close the archive file */
if ( ! ClosReadArch() ) {
printf("unzoo: could not close the archive '%s'\n",arc);
return 0;
}
/* indicate success */
return 1;
}
/****************************************************************************
**
*F HelpArch() . . . . . . . . . . . . . . . . . . . . . . . print some help
**
** 'HelpArch' prints some help about 'unzoo'.
*/
int HelpArch ()
{
printf("unzoo -- a zoo archive extractor by Martin Schoenert\n");
printf(" ($Id: unzoo.c,v 4.4 2000/05/29 08:56:57 sal Exp $)\n");
printf(" based on 'booz' version 2.0 by Rahul Dhesi\n");
printf("\n");
printf("unzoo [-l] [-v] <archive>[.zoo] [<file>..]\n");
printf(" list the members of the archive\n");
printf(" -v: list also the generation numbers and the comments\n");
printf(" <file>: list only files matching at least one pattern,\n");
printf(" '?' matches any char, '*' matches any string.\n");
printf("\n");
printf("unzoo -x [-abnpo] [-j <prefix>] <archive>[.zoo] [<file>..]\n");
printf(" extract the members of the archive\n");
printf(" -a: extract all members as text files ");
printf("(not only those with !TEXT! comments)\n");
printf(" -b: extract all members as binary files ");
printf("(even those with !TEXT! comments)\n");
printf(" -n: extract no members, only test the integrity\n");
printf(" -p: extract to stdout\n");
printf(" -o: extract over existing files\n");
printf(" -j: extract to '<prefix><membername>'\n");
printf(" <file>: extract only files matching at least one pattern,\n");
printf(" '?' matches any char, '*' matches any string.\n");
return 1;
}
/****************************************************************************
**
*F main(<argc>,<argv>) . . . . . . . . . . . . . . . . . . . . main program
**
** 'main' is the main program, it decodes the arguments and then calls the
** appropriate function.
*/
int main ( argc, argv )
int argc;
char * argv [];
{
unsigned long res; /* result of command */
unsigned long cmd; /* command help/list/extract */
unsigned long ver; /* list verbose option */
unsigned long bim; /* extraction mode option */
unsigned long out; /* output destination option */
unsigned long ovr; /* overwrite file option */
char * pre; /* prefix to prepend to path names */
char argl [256]; /* interactive command line */
int argd; /* interactive command count */
char * argw [256]; /* interactive command vector */
char * p; /* loop variable */
#ifdef SYS_IS_MAC_THC
SIOUXSettings.autocloseonquit = 1;
SIOUXSettings.asktosaveonclose = 0;
#endif
/* repeat until the user enters an empty line */
InitCrc();
IsSpec['\0'] = 1; IsSpec[';'] = 1;
argd = 1;
do {
/* scan the command line arguments */
cmd = 1; ver = 0; bim = 0; out = 2; ovr = 0;
pre = "";
while ( 1 < argc && argv[1][0] == '-' ) {
if ( argv[1][2] != '\0' ) cmd = 0;
switch ( argv[1][1] ) {
case 'l': case 'L': if ( cmd != 0 ) cmd = 1; break;
case 'v': case 'V': if ( cmd != 1 ) cmd = 0; ver = 1; break;
case 'x': case 'X': if ( cmd != 0 ) cmd = 2; break;
case 'a': case 'A': if ( cmd != 2 ) cmd = 0; bim = 1; break;
case 'b': case 'B': if ( cmd != 2 ) cmd = 0; bim = 2; break;
case 'n': case 'N': if ( cmd != 2 ) cmd = 0; out = 0; break;
case 'p': case 'P': if ( cmd != 2 ) cmd = 0; out = 1; break;
case 'o': case 'O': if ( cmd != 2 ) cmd = 0; ovr = 1; break;
case 'j': case 'J': if ( argc == 2 ) { cmd = 0; break; }
pre = argv[2]; argc--; argv++;
break;
default: cmd = 0; break;
}
argc--; argv++;
}
/* execute the command or print help */
if ( cmd == 1 && 1 < argc )
res = ListArch( ver, argv[1],
(unsigned long)argc-2, argv+2 );
else if ( cmd == 2 && 1 < argc )
res = ExtrArch( bim, out, ovr, pre, argv[1],
(unsigned long)argc-2, argv+2 );
else
res = HelpArch();
/* in interactive mode read another line */
if ( 1 < argd || argc <= 1 ) {
/* read a command line */
printf("\nEnter a command line or an empty line to quit:\n");
fflush( stdout );
if ( fgets( argl, sizeof(argl), stdin ) == (char*)0 ) break;
#ifdef SYS_IdfgdfsgasfgdsgfdS_MAC_THC
if ( *argl == '\n' && argl[1]=='\0') break;
#endif
/* parse the command line into argc */
argd = 1;
p = argl;
while ( *p==' ' || *p=='\t' || *p=='\n' ) *p++ = '\0';
while ( *p != '\0' ) {
argw[argd++] = p;
while ( *p!=' ' && *p!='\t' && *p!='\n' && *p!='\0' ) p++;
while ( *p==' ' || *p=='\t' || *p=='\n' ) *p++ = '\0';
}
argc = argd; argv = argw;
}
} while ( 1 < argd );
/* just to please lint */
return ! res;
}
--- NEW FILE unzoo.spec ---
Name: unzoo
Version: 4.4
Release: 4%{?dist}
Summary: ZOO archive extractor
Group: Applications/Archiving
License: Public Domain
URL: http://archives.math.utk.edu/software/multi-platform/gap/util/unzoo.c
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source0: http://archives.math.utk.edu/software/multi-platform/gap/util/unzoo.c
%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.
%prep
%setup -Tc -n %{name}-%{version}
cp -a %{SOURCE0} .
cat %{SOURCE0} | sed -e '/SYNTAX/,/\*\//!d' | cut -c5- > unzoo.txt
%build
gcc %{optflags} -o unzoo -DSYS_IS_UNIX unzoo.c
%install
rm -rf %{buildroot}
# Install binaries
install -Dpm 755 unzoo %{buildroot}%{_bindir}/unzoo
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_bindir}/unzoo
%doc unzoo.txt
%changelog
* Thu Mar 26 2009 John W. Linville <linville at redhat.com> - 4.4-4
- Copy source to build directory so it is included in debuginfo
* Thu Mar 26 2009 John W. Linville <linville at redhat.com> - 4.4-3
- Use setup macro in prep phase (cleaner spec, generates debuginfo)
- Add release info in changelog
* Wed Mar 25 2009 John W. Linville <linville at redhat.com> - 4.4-2
- Revise in accordance with new package review comments
* Mon Mar 23 2009 John W. Linville <linville at redhat.com> - 4.4-1
- Initial release for Fedora
- Previous message: rpms/frescobaldi/devel frescobaldi.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message: rpms/reiserfs-utils/devel import.log, NONE, 1.1 .cvsignore, 1.7, 1.8 reiserfs-utils.spec, 1.19, 1.20 sources, 1.7, 1.8 header-fix.patch, 1.2, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the scm-commits
mailing list