Updated gzip from version 1.2.2 to 1.2.4 due to popular demand

This commit is contained in:
Nate Williams 1993-10-14 00:33:38 +00:00
parent 08222b297c
commit 87601b6e8d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=597
29 changed files with 623 additions and 306 deletions

View File

@ -1,9 +1,70 @@
Wed Aug 18 09:34:23 1993 Jean-loup Gailly (jloup@chorus.fr)
* version 1.2.4
By default, do not restore file name and timestamp from those saved
inside the .gz file (behave as 'compress'). Added the --name option
to force name and timestamp restoration.
Accept - as synonym for stdin.
Use manlinks=so or ln to support either hard links or .so in man pages
Accept foo.gz~ in zdiff.
Added support for Windows NT
Handle ENAMETOOLONG for strict Posix systems
Use --recursive instead of --recurse to comply with Webster and
the GNU stdandard.
Allow installation of shell scripts with a g prefix: make G=g install
Install by default zcat as gzcat if gzcat already exists in path.
Let zmore behave as more when invoked without parameters (give help)
Let gzip --list reject files not in gzip format even with --force.
Don't complain about non gzip files for options -rt or -rl.
Added advice in INSTALL for several systems.
Added makefile entries for NeXTstep 3.1 (if configure fails)
Avoid problem with memcpy on Pyramid (gave crc error on some files)
Support the -r option when compiled with Borland C++ on msdos.
Force lower case file names only for FAT file systems (not HPFS)
Rewrite one expression in inflate.c to avoid cc bug on Solaris x86.
In the msdos makefiles, get match.asm from the msdos subdirectory.
Catch SIGTERM and SIGHUP only if they are not ignored.
getopt.c: on Amiga, "#if !defined(const)" does not compile.
Use register parameters on Amiga.
Do not force names to lower case on Amiga.
Fix support of Atari TOS (Makefile.st and tailor.h)
In unlzw.c, do not suggest using zcat if zcat already used.
In INSTALL, suggest using bsdinst for HPUX.
Document Turbo C++ 1.0 bug in INSTALL.
Improved the documentation relative to the --no-name option.
Avoid signed/unsigned warnings in several files.
Added pointer to jka-compr19.el in README.
Added pointer to OS/2 executables in README.
Added --block-compress in tar -z example (gzip.1 and gzip.texi).
Don't keep rcsid in executable (avoid compilation warnings).
Check also the correctness of the first byte of an .Z file.
Return non zero status for an invalid option.
Remove "NEWFILES" from os2/gzip.def for Borland C++ on OS/2.
Remove "time stamp restored" message (just obey the -N request).
Thu Jun 24 10:27:57 1993 Jean-loup Gailly (jloup@chorus.fr)
* version 1.2.3
Don't display the output name when decompressing except with --verbose.
Remove usage of alloca in getopt.c and all makefiles.
Use ASCPP instead of CPP to avoid breaking AC_HEADER_CHECK on RiscOS.
Added the zfile shell script in subdirectory sample.
Moved the list of compiler bugs from README to INSTALL.
Added vms/Readme.vms.
Fix DIST_BUFSIZE check in unlzh.c for 16 bit machines.
Fix REGSIGTYP macro in configure.in.
Use 'define' instead of == in vms/gzip.hlp.
Avoid warnings in unlzh.c
Allow separate installation of binaries and man pages.
Simplified handling of file names with spaces in zgrep and znew.
Fix dependencies and remove rule for trees.c in amiga/Makefile.sasc
Add missing quote in gzexe.
Thu Jun 17 13:47:05 1993 Jean-loup Gailly (jloup@chorus.fr)
* version 1.2.2
Fix a compilation error in gzip.c on Sun with cc (worked with gcc).
Wed Jun 16 11:20:27 1993 Jean-loup Gailly (jloup@chorus.fr)
* version 1.2.1

View File

@ -4,7 +4,7 @@ PROG= gzip
SRCS= gzip.c zip.c deflate.c trees.c bits.c unzip.c inflate.c util.c \
crypt.c lzw.c unlzw.c unlzh.c unpack.c getopt.c match.S
MAN1= gzexe.1 gzip.1 zdiff.1 zforce.1 zmore.1 znew.1
CFLAGS+=-DASMV -DHAVE_UNISTD_H=1 -DDIRENT=1
CFLAGS+=-DASMV -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DDIRENT=1
MLINKS= gzip.1 gunzip.1 gzip.1 zcat.1 gzip.1 gzcat.1
LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip
LINKS+= ${BINDIR}/gzip ${BINDIR}/gzcat

View File

@ -1,7 +1,32 @@
Current Version: 1.2.2.
Current Version: 1.2.4.
See the file ChangeLog for the details of all changes.
Major changes from 1.2 to 1.2.1
Major changes from 1.2.3 to 1.2.4
* By default, do not restore file name and timestamp from those saved
inside the .gz file (behave as 'compress'). Added the --name option
to force name and timestamp restoration.
* Accept - as synonym for stdin.
* Use manlinks=so or ln to support either hard links or .so in man pages
* Accept foo.gz~ in zdiff.
* Added support for Windows NT
* Handle ENAMETOOLONG for strict Posix systems
* Use --recursive instead of --recurse to comply with Webster and
the GNU stdandard.
* Allow installation of shell scripts with a g prefix: make G=g install
* Install by default zcat as gzcat if gzcat already exists in path.
* Let zmore behave as more when invoked without parameters (give help)
* Let gzip --list reject files not in gzip format even with --force.
* Don't complain about non gzip files for options -rt or -rl.
* Added advice in INSTALL for several systems.
Major changes from 1.2.2 to 1.2.3
* Don't display the output name when decompressing except with --verbose.
* Remove usage of alloca in getopt.c and all makefiles.
* Added the zfile shell script in subdirectory sample.
* Moved the list of compiler bugs from README to INSTALL.
* Added vms/Readme.vms.
Major changes from 1.2.1 to 1.2.2
* Fix a compilation error on Sun with cc (worked with gcc).
Major changes from 1.2 to 1.2.1

View File

@ -1,4 +1,4 @@
This is the file README for the gzip distribution, version 1.2.2.
This is the file README for the gzip distribution, version 1.2.4.
gzip (GNU zip) is a compression utility designed to be a replacement
for 'compress'. Its main advantages over compress are much better
@ -32,34 +32,12 @@ INSTALL for installation instructions. Some answers to frequently
asked questions are given in the file INSTALL, please read it. (In
particular, please don't ask me once more for an /etc/magic entry.)
WARNINGS about broken optimizers:
- on the NeXT, "cc -finline-functions" is broken. gzip produces
valid .gz files but they are much too large because the string
matching code misses most matches. Use "cc -O" instead.
- on the Mips R4000, gcc -O (version 2.3.1) generates bad code, use cc
or just gcc -g instead.
- gcc 2.3.3 and 2.4.3 on the SGI Indigo IRIX 4.0.5 also produce bad code.
Use instead: make CC='cc -O2' or gcc without -O.
- On Solaris 2.1 for x86, the January 1993 "OEM" compiler release
generates bad code. This is fixed in the June 1993 "FCS" release.
- on Sparc with SunOS 4.1.1 and the SC1.0 compiler, the optimizer
works up to -O3 but -O4 does not work.
- MSC 5.1 with -Ox and -DDYN_ALLOC generates bad code in inflate.c.
The default is static allocation (no DYN_ALLOC) and -Ox works on inflate.c.
But -Ox does not work on util.c, so you must use -Oait -Gs.
- On dnix 5.3 2.2 cc version 2.37c is buggy. Version 2.38d works.
- On an Alliant running Concentrix, cc (even without optimization) generates
incorrect code. You have to use gcc.
For all machines, Use "make check" to check that gzip was compiled correctly.
WARNING: on several systems, compiler bugs cause gzip to fail, in
particular when optimization options are on. See the section "Special
targets" at the end of the INSTALL file for a list of known problems.
For all machines, use "make check" to check that gzip was compiled
correctly. Try compiling gzip without any optimization if you have a
problem.
Please send all comments and bug reports by electronic mail to:
Jean-loup Gailly <jloup@chorus.fr>
@ -82,18 +60,19 @@ file from emacs. It recognizes automatically encrypted and compressed
files when they are first visited or written. It is available via
anonymous ftp to roebling.poly.edu [128.238.5.31] in /pub/crypt++.el.
The same directory contains also patches to dired, ange-ftp and info.
GNU tar 1.11.2 has a -z option to invoke directly gzip, so you don't have
to patch it.
GNU tar 1.11.2 has a -z option to invoke directly gzip, so you don't have to
patch it. The package ftp.uu.net:/languages/emacs-lisp/misc/jka-compr19.el.Z
also supports gzip'ed files.
The znew and gzexe shell scripts provided with gzip benefit from
(but do not require) the cpmod utility to transfer file attributes.
It is available by anonymous ftp on gatekeeper.dec.com in
/.0/usenet/comp.sources.unix/volume11/cpmod.Z.
The sample programs zread.c, sub.c and add.c are provided as examples
of useful complements to gzip. Read the comments inside each source file.
The perl script ztouch is also provided as example (not installed
by default since it relies on perl).
The sample programs zread.c, sub.c and add.c in subdirectory sample
are provided as examples of useful complements to gzip. Read the
comments inside each source file. The perl script ztouch is also
provided as example (not installed by default since it relies on perl).
gzip is free software, you can redistribute it and/or modify it under
@ -102,16 +81,22 @@ provided under the name COPYING. The latest version of gzip are always
available by ftp in prep.ai.mit.edu:/pub/gnu, or in any of the prep
mirror sites:
- sources in gzip-*.tar (or .shar or .tar.gz)
- sources in gzip-*.tar (or .shar or .tar.gz).
- Solaris 2 executables in sparc-sun-solaris2/gzip-binaries-*.tar
- MSDOS lha self-extracting exe in gzip-msdos-*.exe. Once extracted,
copy gzip.exe to gunzip.exe and zcat.exe, or use "gzip -d" to decompress.
gzip386.exe runs much faster but only on 386 and above; it needs go32.exe,
available in omnigate.clarkson.edu:/pub/msdos/djgpp/djdev110.zip
gzip386.exe runs much faster but only on 386 and above; it is compiled with
djgpp 1.10 available in directory omnigate.clarkson.edu:/pub/msdos/djgpp.
A VMS executable is available in ftp.spc.edu:[.macro32.savesets]gzip-1-*.zip
(use [.macro32]unzip.exe to extract). A PRIMOS executable is available
in ftp.lysator.liu.se:/pub/primos/run/gzip.run.
OS/2 executables (16 and 32 bits versions) are available in
ftp.tu-muenchen.de:/pub/comp/os/os2/archiver/gz*-[16,32].zip
Some ftp servers can automatically make a tar.Z from a tar file. If
you are getting gzip for the first time, you can ask for a tar.Z file
instead of the much larger tar file.
Many thanks to those who provided me with bug reports and feedback.
See the files THANKS and ChangeLog for more details.

View File

@ -4,6 +4,7 @@ Haruhiko Okumura (unlzh.c). The zip deflate format was defined by Phil Katz.
Thanks to those who reported problems and suggested various
improvements. Here is a partial list of them:
Robert Abramovitz bromo@cougar.tandem.com
Jay Adams jka@ece.cmu.edu
Mark Adler madler@cco.caltech.edu
Edwin Allum edwin@csri.toronto.edu
@ -13,6 +14,7 @@ Ken-ichiro Aoki aoki@madonna.physics.ucla.edu
David Ascher da@marlowe.cog.brown.edu
Eric Backus ericb@lsid.hp.com
Becky A. Badgett badgett@cs.utexas.edu
Bo Nygaard Bai bai@iesd.auc.dk
Dave Barber dbarber@apocalypse.bbn.com
Rene Beaulieu reneb@distri.hydro.qc.ca
Neal Becker neal@ctd.comsat.com
@ -20,26 +22,34 @@ Dieter Becker becker@med-in.uni-sb.de
Nelson H. F. Beebe beebe@geronimo.math.utah.edu
Jeff Beadles jeff@onion.rain.com
David J. N. Begley dbegley@st.nepean.uws.edu.au
Bob Beresh rberesh@rd.hydro.on.ca
Jim Bernard jbernard@iola.mines.colorado.edu
Karl Berry karl@cs.umb.edu
James W. Birdsall jwbirdsa@picarefy.picarefy.com
Scott Bolte scott@craycos.com
Wayne E. Bouchard web@paladine.hacks.arizona.edu
Marc Boucher marc@cam.org
Ola Brahammar pt90ob@pt.hk-r.se
Dave Brennan brennan@hal.com
Alan Brown dogbowl@dogbox.acme.gen.nz
Michael L. Brown brown@wi.extrel.com
Rodney Brown rdb@mel.cocam.oz.au
Bruce bde@runx.oz.au
Bill Bumgarner bbum@stone.com
Leila Burrell-Davis leilabd@syma.sussex.ac.uk
Roger Butenuth butenuth@ira.uka.de
Jon Cargille jcargill@cs.wisc.edu
Bud Carlson bud@isle.pegasus.com
Lim Fung Chai fclim@i1sin.daq.semi.harris.com
Wes Chalfant wes@kofax.com
Andrew A. Chernov ache@astral.msk.su
Paul Close pdc@lunch.wpd.sgi.com
Jeff Coffler coffler@jac.enet.dec.com
Will Colley wcc3@occs.cs.oberlin.edu
Roger Cornelius sherpa!rac@uunet.uu.net
Kevin Cosgrove kevinc@tekig6.pen.tek.com
Stephen J Cowley s.j.cowley@amtp.cam.ac.uk
Ron Cox roncox@indirect.com
Frank Crawford frank@photon.ansto.gov.au
James R. Crawford qralston@cislabs.pitt.edu
Lawrence Crowl crowl@research.cs.orst.edu
@ -49,12 +59,16 @@ John M. DeDourek dedourek@aixive2.cs.unb.ca
Jeff Deifik jdeifik@isi.edu
Vince DeMarco vince@whatnxt.cuc.ab.ca
Michael De La Rue p91152@cplab.physics.edinburgh.ac.uk
Jeff Delinck delinck@pa621a.inland.com
John DeRoo deroo@grout.adv.shr.dec.com
Jim Diamond zsd@axe.drea.dnd.ca
Stefano Diomedi sd@teculx.tecsiel.it
Lawrence R. Dodd dodd@roebling.poly.edu
Matthew Donadio donadio@mxd120.rh.psu.edu
Andy Dougherty andy@crystal.phys.lafayette.edu
Darrell Duane dduane@mason1.gmu.edu
John Eaton jwe@che.utexas.edu
Will Edgington wedgingt@ptolemy.arc.nasa.gov
Brian Edmonds edmonds@edmonds.home.cs.ubc.ca
Paul Eggert eggert@twinsun.com
Enami enami@sys.ptg.sony.co.jp
@ -64,12 +78,16 @@ Rik Faith faith@cs.unc.edu
Larry Fahnoe fahnoe@c1mpls.mn.org
Cristian Ferretti cfs@poincare.mat.puc.cl
Karl-Jose Filler pla_jfi@pki-nbg.philips.de
Valery Fine fine@vxcern.cern.ch
Bob Fischer bobf@milne.geology.yale.edu
Per Foreby perf@efd.lth.se
Alexander Fraser alex@cs.umb.edu
Noah Friedman friedman@gnu.ai.mit.edu
Bob Friesenhahn bfriesen@iphase.com
Gerhard Friesland-Koepke frieslan@rzdspc3.informatik.uni-hamburg.de
Andy Fyfe andy@scp.caltech.edu
Geoff geoff@frs.faxon.com
Arnd Gerns gerns@informatik.uni-hildesheim.de
Kaveh R. Ghazi ghazi@staccato.rutgers.edu
Torbjorn Granlund tege@sics.se
Carl Greco cgreco@parrot.creighton.edu
@ -77,6 +95,7 @@ Bruno Haible haible@ma2s2.mathematik.uni-karlsruhe.de
Junio Hamano junio@shadow.twinsun.com
Harald Hanche-Olsen hanche@ams.sunysb.edu
Darrel R. Hankerson hankedr@mail.auburn.edu
Mark Hanning-Lee markhl@romeo.caltech.edu
Lars Hecking st000002@hrz1.hrz.th-darmstadt.de
Ruediger Helsch ruediger@ramz.ing.tu-bs.de
Mark C. Henderson mch@sqwest.wimsey.bc.ca
@ -85,6 +104,7 @@ Jarkko Hietaniemi jhi@dol-guldur.hut.fi
Thomas Hiller hiller@fzi.de
Eiji Hirai hirai@cc.swarthmore.edu
Kjetil Torgrim Homme kjetilho@ifi.uio.no
Robert D. Houk rdh@sli.com
Jim Howard jim_howard@mentorg.com
Preston Hunt gt5708a@prism.gatech.edu
Shane C Hutchins sch@nymph.msel.unh.edu
@ -92,26 +112,32 @@ Hutch hutchinson@wrair-emh1.army.mil
Lester Ingber ingber@alumni.caltech.edu
Ken Ishii ishii@sni-usa.com
Per Steinar Iversen iversen@vsfys1.fi.uib.no
Chris Jacobsen jacobsen@xray1.physics.sunysb.edu
Michal Jaegermann ntomczak@vm.ucs.ualberta.ca
Brian Jones brianj@skat.usc.edu
Denny de Jonge witaddj@dutrex.tudelft.nl
Arne H. Juul arnej@lise.unit.no
Dana Jacobsen jacobsd@solar.cor2.epa.gov
Peter Jannesen peter@ncs.nl
Brian D. Johnston johnstonb@med.ge.com
Walter W. Jones wwj@candela.cfr.nist.gov
Tom Judson judson@scf.usc.edu
Henry G. Juengst juengst@saph2.physik.uni-bonn.de
Sarantos Kapidakis sarantos%manteion@ics.forth.gr
Amir J. Katz amir@matis.ingr.com
Steve Kelem kelem@castor.xilinx.com
Steven Kimball kimball@shrew.sanders.lockheed.com
Randy Kirchhof rkk@posms.aus.tx.us
Ned Kittlitz kittlitz@seagoon.sw.stratus.com
Sakai Kiyotaka ksakai@mtl.t.u-tokyo.ac.jp
Philip C Kizer pckizer@gonzo.tamu.edu
Pete Klammer pklammer@ouray.denver.colorado.edu
Fritz Kleemann kleemann@informatik.uni-wuerzburg.dbp.de
Wilhelm B. Kloke wb@ifado.arb-phys.uni-dortmund.de
Tom Kloos tk@sequent.com
Carsten Koch carsten.koch@icem.de
Winfried Koenig win@in.rhein-main.de
Mathias Koerber mathias@solomon.technet.sg
Steph Konigsdorfer s.konigsdorfer@frmy.bull.fr
Leif Kornstaedt leif@rumtifsl.ruessel.sub.org
Michael D. Lawler mdlawler@bsu-cs.bsu.edu
@ -120,17 +146,23 @@ Howard D. Leadmon howardl@wb3ffv.ampr.org
Alexander Lehmann alex@hal.rhein-main.de
Simon Leinen simon@lia.di.epfl.ch
Burt Leland burt@molecular.com
Tony Leneis tony@plaza.adp.ds.com
Hugues Leroy hugues.leroy@irisa.fr
Marty Leisner leisner@eso.mc.xerox.com
Charles Levert charles@aramis.comm.polymtl.ca
Richard Levitte levitte@e.kth.se
Torbj|rn Lindh toobii@elixir.e.kth.se
David R. Linn drl@vuse.vanderbilt.edu
Antonio Lioy cat@athena.polito.it
Jamie Lokier u90jl@ecs.oxford.ac.uk
Richard Lloyd R.K.Lloyd@csc.liv.ac.uk
David J. MacKenzie djm@eng.umd.edu
John R MacMillan john@chance.gts.org
Ron Male male@eso.mc.xerox.com
Don R. Maszle maze@bea.lbl.gov
Jaye Mathisen osyjm@cs.montana.edu
Telly Mavroidis mavroidi@acf2.nyu.edu
Imed Eddine Mbarki mbarki@pacific.cmpe.psu.edu
Steeve McCauley steeve@pooh.geophys.mcgill.ca
Tom McConnell tmcconne@sedona.intel.com
Tod McQuillin mcquill@ccit05.duq.edu
@ -141,19 +173,27 @@ Dean S. Messing deanm@medulla.labs.tek.com
M. Mesturino mesturino@cselt.stet.it
Luke Mewburn zak@rmit.edu.au
Jim Meyering meyering@cs.utexas.edu
Dragan Milicic milicic@math.utah.edu
Frederic Miserey none.fred@applelink.apple.com
Marcel J.E. Mol marcel@duteca.et.tudelft.nl
Soren Juul Moller sjm@dde.dk
Chris Moore moore@src.bae.co.uk
Dan Mosedale mosedale@genome.stanford.edu
Helmut Muelner hmuelner@fiicmds04.tu-graz.ac.at
Urban D Mueller umueller@amiga.physik.unizh.ch
Ulrich Mueller ulm@vsnhdb.cern.ch
Timothy Murphy tim@maths.tcd.ie
Greg Naber greg@squally.halcyon.com
Jay Nayegandhi jayng@bbiv02.enet.dec.com
Paul K. Neville II pkn2@idsi.com
Karl L. Noell noell@informatik.fh-wiesbaden.dbp.de
Demizu Noritoshi nori-d@is.aist-nara.ac.jp
Todd Ogasawara todd@protege.pegasus.com
Helge Oldach helge.oldach@stollmann.de
Arthur David Olson ado@elsie.nci.nih.gov
Piet van Oostrum piet@cs.ruu.nl
Rafael R. Pappalardo rafapa@obelix.cica.es
Mike Pearlman canuck@masc38.rice.edu
Yves Perrenoud pyves@nuga.alphanet.ch
Hal Peterson hrp@pecan.cray.com
Pascal Petit petit@cadillac.ibp.fr
@ -163,6 +203,7 @@ Jay Pinkos pinkos@butyng.bu.edu
Thomas Plass thomas@cogsci.ed.ac.uk
Mike Polo mikep@cfsmo.honeywell.com
Francesco Potorti pot@fly.cnuce.cnr.it
Will Priest bpriest@lobby.ti.com
David Purves purves@apogee.com
Andreas Raab ar@nvmr.robin.de
Eric S. Raymond esr@snark.thyrsus.com
@ -185,7 +226,11 @@ Niimi Satoshi a01309@cfi.waseda.ac.jp
Marc Schaefer sysadm@alphanet.ch
Andreas Schwab schwab@lamothe.informatik.uni-dortmund.de
Eric Schenk schenk@cs.toronto.edu
Eric P. Scott eps@cs.sfsu.edu
Olaf Seibert rhialto@mbfys.kun.nl
Sunando Sen sens@fasecon.econ.nyu.edu
Harry Shamansky hts@hertz.eng.ohio-state.edu
Amos Shapira amoss@cs.huji.ac.il
Rick Sladkey jrs@world.std.com
Daniel L Smith dls@autodesk.com
Fred Smith fredex%fcshome@merk.merk.com
@ -206,20 +251,25 @@ Jeff Treece treece@sabbagh.com
Oliver Trepte oliver@ikaros.fysik4.kth.se
Stephane Tsacas slt@is21.isoft.fr
Stephen Tweedie sct@dcs.ed.ac.uk
John R. Vanderpool fish@daacdev1.stx.com
Sotiris Vassilopoulos vassilopoulos@virginia.edu
Pedro A. M. Vazquez vazquez@iqm.unicamp.br
Arjan de Vet devet@win.tue.nl
Larry W. Virden lvirden@cas.org
Vadim V. Vlasov vvlasov@inucres.msk.su
Eduard Vopicka eduard.vopicka@vse.cs
Theo Vosse vosse@ruls41.leidenuniv.nl
Darin Wayrynen darin@pcg.uucp
Marcel Waldvogel marcel@nice.usergroup.ethz.ch
Stephen J. Walick steve@nshore.org
Gray Watson gray@antaire.com
David Watt dmwatt@smersh.cambridge.ma.us
Scott Weikart scott@igc.apc.org
Ivo Welch iwelch@agsm.ucla.edu
Jochen Wiedmann zrawi01@zmcipdec1.zdv.uni-tuebingen.de
Gijsb. Wiesenekker wiesenecker@sara.nl
Wietze van Winden wietze@swi.psy.uva.nl
Frank Wuebbeling wuebbel@math.uni-muenster.de
Larry W. Virden lwv26@cas.org
Bill Wohler wohler@sap-ag.de
Jamie Zawinski jwz@lucid.com

View File

@ -8,6 +8,11 @@ Some of the planned features include:
library, but this would degrade performance. In the meantime, you can
look at the sample program zread.c.
The library should have one mode in which compressed data is sent
as soon as input is available, instead of waiting for complete
blocks. This can be useful for sending compressed data to/from interactive
programs.
- Make it convenient to define alternative user interfaces (in
particular for windowing environments).

View File

@ -59,7 +59,7 @@
# include <stdio.h>
#endif
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: bits.c,v 0.9 1993/06/11 10:16:58 jloup Exp $";
#endif

View File

@ -1,6 +1,6 @@
/* crypt.c (dummy version) -- do not perform encryption
* Hardly worth copyrighting :-)
*/
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: crypt.c,v 0.6 1993/03/22 09:48:47 jloup Exp $";
#endif

View File

@ -67,8 +67,8 @@
#include "gzip.h"
#include "lzw.h" /* just for consistency checking */
#ifndef lint
static char rcsid[] = "$Id: deflate.c,v 0.14 1993/06/12 20:11:10 jloup Exp $";
#ifdef RCSID
static char rcsid[] = "$Id: deflate.c,v 0.15 1993/06/24 10:53:53 jloup Exp $";
#endif
/* ===========================================================================
@ -97,7 +97,7 @@ static char rcsid[] = "$Id: deflate.c,v 0.14 1993/06/12 20:11:10 jloup Exp $";
/* To save space (see unlzw.c), we overlay prev+head with tab_prefix and
* window with tab_suffix. Check that we can do this:
*/
#if WSIZE<<1 > 1<<BITS
#if (WSIZE<<1) > (1<<BITS)
error: cannot overlay window with tab_suffix and prev with tab_prefix0
#endif
#if HASH_BITS > BITS-1
@ -199,7 +199,7 @@ local unsigned int max_lazy_match;
local int compr_level;
/* compression level (1..9) */
int near good_match;
unsigned near good_match;
/* Use a faster search when the previous match is longer than this */
@ -574,8 +574,8 @@ local void fill_window()
/* ===========================================================================
* Processes a new input file and return its compressed length. This
* function does not perform lazy evaluationof matches and inserts
* new strings in the dictionary only for unmatched strings. It is used
* only for the fast compression options.
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
local ulg deflate_fast()
{

View File

@ -3,67 +3,64 @@
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 1992 Free Software Foundation, Inc.
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* AIX requires this to be the first thing in the file. */
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not __GNUC__ */
#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__))))
#include <alloca.h>
#else
#ifdef _AIX
#pragma alloca
#else
char *alloca ();
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef __STDC__
# ifndef const
# define const
# endif
#endif
#endif /* alloca.h */
#endif /* not __GNUC__ */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. */
#ifndef _NO_PROTO
# define _NO_PROTO
#define _NO_PROTO
#endif
#include <stdio.h>
#include "tailor.h"
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#if defined(USG) || defined(STDC_HEADERS) || defined(__GNU_LIBRARY__)
#include <string.h>
#endif
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#undef alloca
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
#else /* Not GNU C library. */
#define __alloca alloca
#endif /* GNU C library. */
#if !__STDC__
#define const
#endif
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
long-named option. Because this is not POSIX.2 compliant, it is
being phased out. */
#define GETOPT_COMPAT
/* #define GETOPT_COMPAT */
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
@ -101,6 +98,7 @@ char *optarg = 0;
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* XXX 1003.2 says this must be 1 before any call. */
int optind = 0;
/* The next char to be scanned in the option-element
@ -117,6 +115,13 @@ static char *nextchar;
int opterr = 1;
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
#define BAD_OPTION '\0'
int optopt = BAD_OPTION;
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
@ -152,39 +157,53 @@ static enum
} ordering;
#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
#define my_index strchr
#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n))
#define my_strlen strlen
#else
/* Avoid depending on library functions or files
whose names are inconsistent. */
char *getenv ();
#if __STDC__ || defined(PROTO)
extern char *getenv(const char *name);
extern int strcmp (const char *s1, const char *s2);
extern int strncmp(const char *s1, const char *s2, int n);
static int my_strlen(const char *s);
static char *my_index (const char *str, int chr);
#else
extern char *getenv ();
#endif
static int
my_strlen (str)
const char *str;
{
int n = 0;
while (*str++)
n++;
return n;
}
static char *
my_index (string, chr)
char *string;
my_index (str, chr)
const char *str;
int chr;
{
while (*string)
while (*str)
{
if (*string == chr)
return string;
string++;
if (*str == chr)
return (char *) str;
str++;
}
return 0;
}
static void
my_bcopy (from, to, size)
char *from, *to;
int size;
{
int i;
for (i = 0; i < size; i++)
to[i] = from[i];
}
#endif /* GNU C library. */
/* Handle permutation of arguments. */
@ -203,32 +222,49 @@ static int last_nonopt;
the options processed since those non-options were skipped.
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
the new indices of the non-options in ARGV after they are moved.
To perform the swap, we first reverse the order of all elements. So
all options now come before all non options, but they are in the
wrong order. So we put back the options and non options in original
order by reversing them again. For example:
original input: a b c -x -y
reverse all: -y -x c b a
reverse options: -x -y c b a
reverse non options: -x -y a b c
*/
#if __STDC__ || defined(PROTO)
static void exchange (char **argv);
#endif
static void
exchange (argv)
char **argv;
{
int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *);
#ifdef _CRAY
char *temp[last_nonopt - first_nonopt];
#else
char **temp = (char **) __alloca (nonopts_size);
#endif
/* Interchange the two blocks of data in ARGV. */
my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size);
my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt],
(optind - last_nonopt) * sizeof (char *));
my_bcopy ((char *) temp,
(char *) &argv[first_nonopt + optind - last_nonopt],
nonopts_size);
/* Update records for the slots the non-options now occupy. */
char *temp, **first, **last;
/* Reverse all the elements [first_nonopt, optind) */
first = &argv[first_nonopt];
last = &argv[optind-1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
/* Put back the options in order */
first = &argv[first_nonopt];
first_nonopt += (optind - last_nonopt);
last = &argv[first_nonopt - 1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
/* Put back the non options in order */
first = &argv[first_nonopt];
last_nonopt = optind;
last = &argv[last_nonopt-1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
@ -251,8 +287,8 @@ exchange (argv)
OPTSTRING is a string containing the legitimate option characters.
If an option character is seen that is not listed in OPTSTRING,
return '?' after printing an error message. If you set `opterr' to
zero, the error message is suppressed but we still return '?'.
return BAD_OPTION after printing an error message. If you set `opterr' to
zero, the error message is suppressed but we still return BAD_OPTION.
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
so the following text in the same ARGV-element, or the text of the following
@ -431,7 +467,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
p++, option_index++)
if (!strncmp (p->name, nextchar, s - nextchar))
{
if (s - nextchar == strlen (p->name))
if (s - nextchar == my_strlen (p->name))
{
/* Exact match found. */
pfound = p;
@ -455,9 +491,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (opterr)
fprintf (stderr, "%s: option `%s' is ambiguous\n",
argv[0], argv[optind]);
nextchar += strlen (nextchar);
nextchar += my_strlen (nextchar);
optind++;
return '?';
return BAD_OPTION;
}
if (pfound != NULL)
@ -485,8 +521,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
"%s: option `%c%s' doesn't allow an argument\n",
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += strlen (nextchar);
return '?';
nextchar += my_strlen (nextchar);
return BAD_OPTION;
}
}
else if (pfound->has_arg == 1)
@ -498,11 +534,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (opterr)
fprintf (stderr, "%s: option `%s' requires an argument\n",
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
return '?';
nextchar += my_strlen (nextchar);
return optstring[0] == ':' ? ':' : BAD_OPTION;
}
}
nextchar += strlen (nextchar);
nextchar += my_strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
@ -520,7 +556,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
#ifdef GETOPT_COMPAT
|| argv[optind][0] == '+'
#endif /* GETOPT_COMPAT */
|| my_index ((char*)optstring, *nextchar) == NULL)
|| my_index (optstring, *nextchar) == NULL)
{
if (opterr)
{
@ -535,7 +571,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
}
nextchar = (char *) "";
optind++;
return '?';
return BAD_OPTION;
}
}
@ -543,7 +579,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
char c = *nextchar++;
char *temp = my_index ((char*)optstring, c);
char *temp = my_index (optstring, c);
/* Increment `optind' when we start to process its last character. */
if (*nextchar == '\0')
@ -553,13 +589,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
if (opterr)
{
#if 0
if (c < 040 || c >= 0177)
fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
argv[0], c);
else
fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
#endif
}
return '?';
optopt = c;
return BAD_OPTION;
}
if (temp[1] == ':')
{
@ -588,9 +630,21 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
else if (optind == argc)
{
if (opterr)
fprintf (stderr, "%s: option `-%c' requires an argument\n",
argv[0], c);
c = '?';
{
#if 0
fprintf (stderr, "%s: option `-%c' requires an argument\n",
argv[0], c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: option requires an argument -- %c\n",
argv[0], c);
#endif
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = BAD_OPTION;
}
else
/* We already incremented `optind' once;
@ -626,22 +680,7 @@ getopt_long (argc, argv, options, long_options, opt_index)
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
@ -694,7 +733,7 @@ main (argc, argv)
printf ("option c with value `%s'\n", optarg);
break;
case '?':
case BAD_OPTION:
break;
default:

View File

@ -1,16 +1,16 @@
/* Declarations for getopt.
Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
@ -49,6 +49,10 @@ extern int optind;
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
@ -86,12 +90,9 @@ struct option
/* Names for the values of the `has_arg' field of `struct option'. */
enum _argtype
{
no_argument,
required_argument,
optional_argument
};
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#if __STDC__ || defined(PROTO)
#if defined(__GNU_LIBRARY__)

View File

@ -92,7 +92,7 @@ for i do
skip=18
if tail +$skip $0 | gzip -cd > /tmp/gztmp$$; then
chmod 700 /tmp/gztmp$$
prog="`echo $0 | sed 's|^.*/||`"
prog="`echo $0 | sed 's|^.*/||'`"
if /bin/ln /tmp/gztmp$$ "/tmp/$prog" 2>/dev/null; then
trap '/bin/rm -f /tmp/gztmp$$ "/tmp/$prog"; exit $res' 0
(/bin/sleep 5; /bin/rm -f /tmp/gztmp$$ "/tmp/$prog") 2>/dev/null &

View File

@ -5,7 +5,7 @@ gzip, gunzip, zcat \- compress or expand files
.SH SYNOPSIS
.ll +8
.B gzip
.RB [ " \-acdfhlLnrtvV19 " ]
.RB [ " \-acdfhlLnNrtvV19 " ]
.RB [ \-S\ suffix ]
[
.I "name \&..."
@ -13,7 +13,7 @@ gzip, gunzip, zcat \- compress or expand files
.ll -8
.br
.B gunzip
.RB [ " \-acfhlLnrtvV " ]
.RB [ " \-acfhlLnNrtvV " ]
.RB [ \-S\ suffix ]
[
.I "name \&..."
@ -35,16 +35,16 @@ while keeping the same ownership modes, access and modification times.
.B "\-gz"
for VMS,
.B "z"
for MSDOS, OS/2 FAT and Atari.)
If no files are specified, the standard input is compressed to the
standard output.
for MSDOS, OS/2 FAT, Windows NT FAT and Atari.)
If no files are specified, or if a file name is "-", the standard input is
compressed to the standard output.
.I Gzip
will only attempt to compress regular files.
In particular, it will ignore symbolic links.
.PP
If the new file name is too long for its file system,
If the compressed file name is too long for its file system,
.I gzip
truncates it and keeps the original file name in the compressed file.
truncates it.
.I Gzip
attempts to truncate only the parts of the file name longer than 3 characters.
(A part is delimited by dots.) If the name consists of small parts only,
@ -53,6 +53,14 @@ to 14 characters, gzip.msdos.exe is compressed to gzi.msd.exe.gz.
Names are not truncated on systems which do not have a limit on file name
length.
.PP
By default,
.I gzip
keeps the original file name and timestamp in the compressed file. These
are used when decompressing the file with the
.B \-N
option. This is useful when the compressed file name was truncated or
when the time stamp was not preserved after a file transfer.
.PP
Compressed files can be restored to their original form using
.I gzip -d
or
@ -226,6 +234,9 @@ The compression methods currently supported are deflate, compress, lzh
(SCO compress -H) and pack. The crc is given as ffffffff for a file
not in gzip format.
With --name, the uncompressed name, date and time are
those stored within the compress file if present.
With --verbose, the size totals and compression ratio for all files
is also displayed, unless some sizes are unknown. With --quiet,
the title and totals lines are not displayed.
@ -236,17 +247,26 @@ Display the
license and quit.
.TP
.B \-n --no-name
When compressing, do not save the original file name by default. (The
original name is always saved if the name had to be truncated.) When
decompressing, do not restore the original file name if present: remove
only the
When compressing, do not save the original file name and time stamp by
default. (The original name is always saved if the name had to be
truncated.) When decompressing, do not restore the original file name
if present (remove only the
.I gzip
suffix from the compressed file name.
suffix from the compressed file name) and do not restore the original
time stamp if present (copy it from the compressed file). This option
is the default when decompressing.
.TP
.B \-N --name
When compressing, always save the original file name and time stamp; this
is the default. When decompressing, restore the original file name and
time stamp if present. This option is useful on systems which have
a limit on file name length or when the time stamp has been lost after
a file transfer.
.TP
.B \-q --quiet
Suppress all warnings.
.TP
.B \-r --recurse
.B \-r --recursive
Travel the directory structure recursively. If any of the file names
specified on the command line are directories,
.I gzip
@ -258,7 +278,7 @@ will descend into the directory and compress all the files it finds there
.B \-S .suf --suffix .suf
Use suffix .suf instead of .gz. Any suffix can be given, but suffixes
other than .z and .gz should be avoided to avoid confusion when files
are transferred to other. A null suffix forces gunzip to try
are transferred to other systems. A null suffix forces gunzip to try
decompression on all given files regardless of suffix, as in:
gunzip -S "" * (*.* for MSDOS)
@ -289,7 +309,7 @@ and
.B \-9
or
.B \-\-best
indicates the slowest compression method (optimal compression).
indicates the slowest compression method (best compression).
The default compression level is
.BR \-6
(that is, biased towards high compression at expense of speed).
@ -320,7 +340,19 @@ compresses better than
If you want to recompress concatenated files to get better compression, do:
zcat old.gz | gzip > new.gz
gzip -cd old.gz | gzip > new.gz
If a compressed file consists of several members, the uncompressed
size and CRC reported by the --list option applies to the last member
only. If you need the uncompressed size for all members, you can use:
gzip -cd file.gz | wc -c
If you wish to create a single archive file with multiple members so
that members can later be extracted independently, use an archiver
such as tar or zip. GNU tar supports the -z option to invoke gzip
transparently. gzip is designed as a complement to tar, not as a
replacement.
.SH "ENVIRONMENT"
The environment variable
.B GZIP
@ -328,9 +360,9 @@ can hold a set of default options for
.I gzip.
These options are interpreted first and can be overwritten by
explicit command line parameters. For example:
for sh: GZIP="-8 -v"; export GZIP
for csh: setenv GZIP "-8 -v"
for MSDOS: set GZIP=-8 -v
for sh: GZIP="-8v --name"; export GZIP
for csh: setenv GZIP "-8v --name"
for MSDOS: set GZIP=-8v --name
On Vax/VMS, the name of the environment variable is GZIP_OPT, to
avoid a conflict with the symbol set for invocation of the program.
@ -341,7 +373,7 @@ pack(1), compact(1)
Exit status is normally 0;
if an error occurs, exit status is 1. If a warning occurs, exit status is 2.
.PP
Usage: gzip [-cdfhlLnrtvV19] [-S suffix] [file ...]
Usage: gzip [-cdfhlLnNrtvV19] [-S suffix] [file ...]
.in +8
Invalid options were specified on the command line.
.in -8
@ -427,13 +459,20 @@ and emits a warning by default. You have to use the --quiet option to
suppress the warning. This option can be set in the
.B GZIP
environment variable as in:
for sh: GZIP="-q" tar xfz /dev/rmt/datn
for csh: (setenv GZIP "-q"; tar xfz /dev/rmt/datn)
for sh: GZIP="-q" tar -xfz --block-compress /dev/rst0
for csh: (setenv GZIP -q; tar -xfz --block-compr /dev/rst0
In the above example, gzip is invoked implicitly by the -z option
of GNU tar. Make sure that the same block size (-b option of
tar) is used for reading and writing compressed data on tapes.
In the above example, gzip is invoked implicitly by the -z option of
GNU tar. Make sure that the same block size (-b option of tar) is used
for reading and writing compressed data on tapes. (This example
assumes you are using the GNU version of tar.)
.SH BUGS
The --list option reports incorrect sizes if they exceed 2 gigabytes.
The --list option reports sizes as -1 and crc as ffffffff if the
compressed file is on a non seekable media.
In some rare cases, the --best option gives worse compression than
the default compression level (-6). On some highly redundant files,
.I compress
compresses better than
.I gzip.

View File

@ -44,8 +44,8 @@ static char *license_msg[] = {
* For the meaning of all compilation flags, see comments in Makefile.in.
*/
#ifndef lint
static char rcsid[] = "$Id: gzip.c,v 0.22 1993/06/16 16:53:43 jloup Exp $";
#ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 0.24 1993/06/24 10:52:07 jloup Exp $";
#endif
#include <ctype.h>
@ -202,7 +202,8 @@ int ascii = 0; /* convert end-of-lines to local OS conventions */
int to_stdout = 0; /* output to stdout (-c) */
int decompress = 0; /* decompress (-d) */
int force = 0; /* don't ask questions, compress links (-f) */
int no_name = 0; /* don't save or restore the original file name */
int no_name = -1; /* don't save or restore the original file name */
int no_time = -1; /* don't save or restore the original file time */
int recursive = 0; /* recurse through directories (-r) */
int list = 0; /* list the file contents (-l) */
int verbose = 0; /* be verbose (-v) */
@ -218,7 +219,7 @@ int exit_code = OK; /* program exit code */
int save_orig_name; /* set if original name must be saved */
int last_member; /* set for .zip and .Z files */
int part_nb; /* number of parts in .gz file */
long time_stamp; /* original time stamp (modification time) */
long time_stamp; /* original time stamp (modification time) */
long ifile_size; /* input file size, -1 for devices (debug only) */
char *env; /* contents of GZIP env variable */
char **args = NULL; /* argv pointer if GZIP env variable defined */
@ -253,12 +254,14 @@ struct option longopts[] =
/* {"pkzip", 0, 0, 'k'}, force output in pkzip format */
{"list", 0, 0, 'l'}, /* list .gz file contents */
{"license", 0, 0, 'L'}, /* display software license */
{"no-name", 0, 0, 'n'}, /* don't save or restore the original name */
{"no-name", 0, 0, 'n'}, /* don't save or restore original name & time */
{"name", 0, 0, 'N'}, /* save or restore original name & time */
{"quiet", 0, 0, 'q'}, /* quiet mode */
{"silent", 0, 0, 'q'}, /* quiet mode */
{"recurse", 0, 0, 'r'}, /* recurse through directories */
{"recursive", 0, 0, 'r'}, /* recurse through directories */
{"suffix", 1, 0, 'S'}, /* use given suffix instead of .gz */
{"test", 0, 0, 't'}, /* test compressed file integrity */
{"no-time", 0, 0, 'T'}, /* don't save or restore the time stamp */
{"verbose", 0, 0, 'v'}, /* verbose mode */
{"version", 0, 0, 'V'}, /* display version number */
{"fast", 0, 0, '1'}, /* compress faster */
@ -287,20 +290,24 @@ local void shorten_name OF((char *name));
local int get_method OF((int in));
local void do_list OF((int ifd, int method));
local int check_ofname OF((void));
local void reset_times OF((char *name, struct stat *statb));
local void copy_stat OF((struct stat *ifstat));
local void treat_dir OF((char *dir));
local void do_exit OF((int exitcode));
int main OF((int argc, char **argv));
int (*work) OF((int infile, int outfile)) = zip; /* function to call */
#ifndef NO_DIR
local void treat_dir OF((char *dir));
#endif
#ifndef NO_UTIME
local void reset_times OF((char *name, struct stat *statb));
#endif
#define strequ(s1, s2) (strcmp((s1),(s2)) == 0)
/* ======================================================================== */
local void usage()
{
fprintf(stderr, "usage: %s [-%scdfhlLn%stvV19] [-S suffix] [file ...]\n",
fprintf(stderr, "usage: %s [-%scdfhlLnN%stvV19] [-S suffix] [file ...]\n",
progname,
#if O_BINARY
"a",
@ -328,18 +335,19 @@ local void help()
" -f --force force overwrite of output file and compress links",
" -h --help give this help",
/* -k --pkzip force output in pkzip format */
" -l --list list .gz file contents",
" -l --list list compressed file contents",
" -L --license display software license",
" -n --no-name do not save or restore the original name",
#ifdef UNDOCUMENTED
" -m --no-time do not save or restore the original modification time",
" -M --time save or restore the original modification time",
#endif
" -n --no-name do not save or restore the original name and time stamp",
" -N --name save or restore the original name and time stamp",
" -q --quiet suppress all warnings",
#ifndef NO_DIR
" -r --recurse recurse through directories",
#endif
#ifdef MAX_EXT_CHARS
" -S .suf --suffix .suf use suffix .suf instead of .z",
#else
" -S .suf --suffix .suf use suffix .suf instead of .gz",
" -r --recursive operate recursively on directories",
#endif
" -S .suf --suffix .suf use suffix .suf on compressed files",
" -t --test test compressed file integrity",
" -v --verbose verbose mode",
" -V --version display version number",
@ -417,7 +425,7 @@ int main (argc, argv)
int argc;
char **argv;
{
int file_count = 0; /* number of files to precess */
int file_count; /* number of files to precess */
int proglen; /* length of progname */
int optc; /* current option */
@ -437,13 +445,17 @@ int main (argc, argv)
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
if (foreground) {
signal (SIGINT, (sig_type)abort_gzip);
(void) signal (SIGINT, (sig_type)abort_gzip);
}
#ifdef SIGTERM
signal(SIGTERM, (sig_type)abort_gzip);
if (signal(SIGTERM, SIG_IGN) != SIG_IGN) {
(void) signal(SIGTERM, (sig_type)abort_gzip);
}
#endif
#ifdef SIGHUP
signal(SIGHUP, (sig_type)abort_gzip);
if (signal(SIGHUP, SIG_IGN) != SIG_IGN) {
(void) signal(SIGHUP, (sig_type)abort_gzip);
}
#endif
#ifndef GNU_STANDARD
@ -466,7 +478,7 @@ int main (argc, argv)
strncpy(z_suffix, Z_SUFFIX, sizeof(z_suffix)-1);
z_len = strlen(z_suffix);
while ((optc = getopt_long (argc, argv, "ab:cdfhlLnqrS:tvVZ123456789",
while ((optc = getopt_long (argc, argv, "ab:cdfhH?lLmMnNqrS:tvVZ123456789",
longopts, (int *)0)) != EOF) {
switch (optc) {
case 'a':
@ -486,8 +498,14 @@ int main (argc, argv)
list = decompress = to_stdout = 1; break;
case 'L':
license(); do_exit(OK); break;
case 'm': /* undocumented, may change later */
no_time = 1; break;
case 'M': /* undocumented, may change later */
no_time = 0; break;
case 'n':
no_name = 1; break;
no_name = no_time = 1; break;
case 'N':
no_name = no_time = 0; break;
case 'q':
quiet = 1; verbose = 0; break;
case 'r':
@ -532,6 +550,12 @@ int main (argc, argv)
}
} /* loop on all arguments */
/* By default, save name and timestamp on compression but do not
* restore them on decompression.
*/
if (no_time < 0) no_time = decompress;
if (no_name < 0) no_name = decompress;
file_count = argc - optind;
#if O_BINARY
@ -571,7 +595,7 @@ int main (argc, argv)
} else { /* Standard input */
treat_stdin();
}
if (list && !quiet) {
if (list && !quiet && file_count > 1) {
do_list(-1, -1); /* print totals */
}
do_exit(exit_code);
@ -583,7 +607,8 @@ int main (argc, argv)
*/
local void treat_stdin()
{
if (!force && isatty(fileno((FILE *)(decompress ? stdin : stdout)))) {
if (!force && !list &&
isatty(fileno((FILE *)(decompress ? stdin : stdout)))) {
/* Do not send compressed data to the terminal or read it from
* the terminal. We get here when user invoked the program
* without parameters, so be helpful. According to the GNU standards:
@ -614,22 +639,19 @@ local void treat_stdin()
strcpy(ofname, "stdout");
/* Get the time stamp on the input file. */
#ifdef NO_STDIN_FSTAT
time_stamp = 0; /* time unknown */
#else
if (fstat(fileno(stdin), &istat) != 0) {
error("fstat(stdin)");
time_stamp = 0; /* time unknown by default */
#ifndef NO_STDIN_FSTAT
if (list || !no_time) {
if (fstat(fileno(stdin), &istat) != 0) {
error("fstat(stdin)");
}
# ifdef NO_PIPE_TIMESTAMP
if (S_ISREG(istat.st_mode))
# endif
time_stamp = istat.st_mtime;
#endif /* NO_STDIN_FSTAT */
}
/* If you do not wish to save the time stamp when input comes from a pipe,
* compile with -DNO_PIPE_TIMESTAMP.
*/
#ifdef NO_PIPE_TIMESTAMP
if (!S_ISREG(istat.st_mode))
time_stamp = 0;
else
#endif
time_stamp = istat.st_mtime;
#endif
ifile_size = -1L; /* convention for unknown size */
clear_bufs(); /* clear input and output buffers */
@ -682,6 +704,14 @@ local void treat_stdin()
local void treat_file(iname)
char *iname;
{
/* Accept "-" as synonym for stdin */
if (strequ(iname, "-")) {
int cflag = to_stdout;
treat_stdin();
to_stdout = cflag;
return;
}
/* Check if the input file is present, set ifname and istat: */
if (get_istat(iname, &istat) != OK) return;
@ -693,7 +723,9 @@ local void treat_file(iname)
st = istat;
treat_dir(iname);
/* Warning: ifname is now garbage */
# ifndef NO_UTIME
reset_times (iname, &st);
# endif
} else
#endif
WARN((stderr,"%s: %s is a directory -- ignored\n", progname, ifname));
@ -713,10 +745,12 @@ local void treat_file(iname)
}
ifile_size = istat.st_size;
time_stamp = istat.st_mtime;
time_stamp = no_time && !list ? 0 : istat.st_mtime;
/* Generate output file name */
if (to_stdout && !list) {
/* Generate output file name. For -r and (-t or -l), skip files
* without a valid gzip suffix (check done in make_ofname).
*/
if (to_stdout && !list && !test) {
strcpy(ofname, "stdout");
} else if (make_ofname() != OK) {
@ -761,7 +795,7 @@ local void treat_file(iname)
} else {
if (create_outfile() != OK) return;
if (save_orig_name && !verbose && !quiet) {
if (!decompress && save_orig_name && !verbose && !quiet) {
fprintf(stderr, "%s: %s compressed to %s\n",
progname, ifname, ofname);
}
@ -1045,7 +1079,11 @@ local int make_ofname()
if (decompress) {
if (suff == NULL) {
if (list) return OK;
/* Whith -t or -l, try all files (even without .gz suffix)
* except with -r (behave as with just -dr).
*/
if (!recursive && (list || test)) return OK;
/* Avoid annoying messages with -r */
if (verbose || (!recursive && !quiet)) {
WARN((stderr,"%s: %s: unknown suffix -- ignored\n",
@ -1104,6 +1142,7 @@ local int make_ofname()
* original name was given and to_stdout is not set.
* Return the compression method, -1 for error, -2 for warning.
* Set inptr to the offset of the next byte to be processed.
* Updates time_stamp if there is one and --no-time is not used.
* This function may be called repeatedly for an input file consisting
* of several contiguous gzip'ed members.
* IN assertions: there is at least one remaining compressed member.
@ -1112,8 +1151,9 @@ local int make_ofname()
local int get_method(in)
int in; /* input file descriptor */
{
uch flags;
uch flags; /* compression flags */
char magic[2]; /* magic header */
ulg stamp; /* time stamp */
/* If --force and --stdout, zcat == cat, so do not complain about
* premature end of file: use try_byte instead of get_byte.
@ -1126,7 +1166,6 @@ local int get_method(in)
magic[0] = (char)get_byte();
magic[1] = (char)get_byte();
}
time_stamp = istat.st_mtime; /* may be modified later for some methods */
method = -1; /* unknown yet */
part_nb++; /* number of parts in gzip file */
header_bytes = 0;
@ -1168,10 +1207,11 @@ local int get_method(in)
exit_code = ERROR;
if (force <= 1) return -1;
}
time_stamp = (ulg)get_byte();
time_stamp |= ((ulg)get_byte()) << 8;
time_stamp |= ((ulg)get_byte()) << 16;
time_stamp |= ((ulg)get_byte()) << 24;
stamp = (ulg)get_byte();
stamp |= ((ulg)get_byte()) << 8;
stamp |= ((ulg)get_byte()) << 16;
stamp |= ((ulg)get_byte()) << 24;
if (stamp != 0 && !no_time) time_stamp = stamp;
(void)get_byte(); /* Ignore extra flags for the moment */
(void)get_byte(); /* Ignore OS type for the moment */
@ -1199,7 +1239,7 @@ local int get_method(in)
if (no_name || (to_stdout && !list) || part_nb > 1) {
/* Discard the old name */
char c; /* dummy used for NeXTstep 3.0 cc optimizer bug */
while ((c=get_byte()) != 0) c++;
do {c=get_byte();} while (c != 0);
} else {
/* Copy the base name. Keep a directory prefix intact. */
char *p = basename(ofname);
@ -1214,7 +1254,7 @@ local int get_method(in)
/* If necessary, adapt the name to local OS conventions: */
if (!list) {
MAKE_LEGAL_NAME(base);
base++; /* avoid warning about unused variable */
if (base) list=0; /* avoid warning about unused variable */
}
} /* no_name || to_stdout */
} /* ORIG_NAME */
@ -1252,7 +1292,7 @@ local int get_method(in)
method = LZHED;
last_member = 1;
} else if (force && to_stdout) { /* pass input unchanged */
} else if (force && to_stdout && !list) { /* pass input unchanged */
method = STORED;
work = copy;
inptr = 0;
@ -1314,7 +1354,7 @@ local void do_list(ifd, method)
printf(" (totals)\n");
return;
}
crc = ~0; /* unknown */
crc = (ulg)~0; /* unknown */
bytes_out = -1L;
bytes_in = ifile_size;
@ -1330,7 +1370,7 @@ local void do_list(ifd, method)
if (bytes_in != -1L) {
uch buf[8];
bytes_in += 8L;
if (read(ifd, buf, sizeof(buf)) != sizeof(buf)) {
if (read(ifd, (char*)buf, sizeof(buf)) != sizeof(buf)) {
read_error();
}
crc = LG(buf);
@ -1338,7 +1378,7 @@ local void do_list(ifd, method)
}
}
#endif /* RECORD_IO */
date = ctime(&time_stamp) + 4; /* skip the day of the week */
date = ctime((time_t*)&time_stamp) + 4; /* skip the day of the week */
date[12] = '\0'; /* suppress the 1/100sec and the year */
if (verbose) {
printf("%5s %08lx %11s ", methods[method], crc, date);
@ -1408,9 +1448,9 @@ local int name_too_long(name, statb)
* with .tgz. Truncate the last part of the name which is longer than
* MIN_PART characters: 1234.678.012.gz -> 123.678.012.gz. If the name
* has only parts shorter than MIN_PART truncate the longest part.
* For decompression, just remove the last character of the name.
*
* IN assertion: This function is only called for the compressed file;
* the suffix of the given name is z_suffix.
* IN assertion: for compression, the suffix of the given name is z_suffix.
*/
local void shorten_name(name)
char *name;
@ -1421,10 +1461,15 @@ local void shorten_name(name)
int min_part = MIN_PART; /* current minimum part length */
char *p;
len = strlen(name);
if (decompress) {
if (len <= 1) error("name too short");
name[len-1] = '\0';
return;
}
p = get_suffix(name);
if (p == NULL) error("can't recover suffix\n");
*p = '\0';
len = strlen(name);
save_orig_name = 1;
/* compress 1234567890.tar to 1234567890.tgz */
@ -1477,9 +1522,22 @@ local int check_ofname()
{
struct stat ostat; /* stat for ofname */
#ifdef ENAMETOOLONG
/* Check for strictly conforming Posix systems (which return ENAMETOOLONG
* instead of silently truncating filenames).
*/
errno = 0;
while (stat(ofname, &ostat) != 0) {
if (errno != ENAMETOOLONG) return 0; /* ofname does not exist */
shorten_name(ofname);
}
#else
if (stat(ofname, &ostat) != 0) return 0;
/* Check for name truncation on existing file: */
#endif
/* Check for name truncation on existing file. Do this even on systems
* defining ENAMETOOLONG, because on most systems the strict Posix
* behavior is disabled by default (silent name truncation allowed).
*/
if (!decompress && name_too_long(ofname, &ostat)) {
shorten_name(ofname);
if (stat(ofname, &ostat) != 0) return 0;
@ -1489,8 +1547,13 @@ local int check_ofname()
* the same by name truncation or links).
*/
if (same_file(&istat, &ostat)) {
fprintf(stderr, "%s: %s and %s are the same file\n",
progname, ifname, ofname);
if (strequ(ifname, ofname)) {
fprintf(stderr, "%s: %s: cannot %scompress onto itself\n",
progname, ifname, decompress ? "de" : "");
} else {
fprintf(stderr, "%s: %s and %s are the same file\n",
progname, ifname, ofname);
}
exit_code = ERROR;
return ERROR;
}
@ -1521,6 +1584,7 @@ local int check_ofname()
}
#ifndef NO_UTIME
/* ========================================================================
* Set the access and modification times from the given stat buffer.
*/
@ -1528,7 +1592,6 @@ local void reset_times (name, statb)
char *name;
struct stat *statb;
{
#ifndef NO_UTIME
struct utimbuf timep;
/* Copy the time stamp */
@ -1540,10 +1603,8 @@ local void reset_times (name, statb)
WARN((stderr, "%s: ", progname));
if (!quiet) perror(ofname);
}
#else
name = name; statb = statb; /* avoid warnings */
#endif
}
#endif
/* ========================================================================
@ -1556,7 +1617,7 @@ local void copy_stat(ifstat)
#ifndef NO_UTIME
if (decompress && time_stamp != 0 && ifstat->st_mtime != time_stamp) {
ifstat->st_mtime = time_stamp;
if (verbose) {
if (verbose > 1) {
fprintf(stderr, "%s: time stamp restored\n", ofname);
}
}
@ -1651,6 +1712,10 @@ local void treat_dir(dir)
local void do_exit(exitcode)
int exitcode;
{
static int in_exit = 0;
if (in_exit) exit(exitcode);
in_exit = 1;
if (env != NULL) free(env), env = NULL;
if (args != NULL) free((char*)args), args = NULL;
FREE(inbuf);

View File

@ -96,7 +96,7 @@
the two sets of lengths.
*/
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp $";
#endif
@ -309,7 +309,8 @@ int *m; /* maximum lookup bits, returns actual */
do {
Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"),
n-i, *p));
c[*p++]++; /* assume all entries <= BMAX */
c[*p]++; /* assume all entries <= BMAX */
p++; /* Can't combine with above line (Solaris bug) */
} while (--i);
if (c[0] == n) /* null input--all zero length codes */
{

View File

@ -2,7 +2,7 @@
* This is a dummy version avoiding patent problems.
*/
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: lzw.c,v 0.9 1993/06/10 13:27:31 jloup Exp $";
#endif
@ -19,7 +19,8 @@ int lzw(in, out)
if (msg_done) return ERROR;
msg_done = 1;
fprintf(stderr,"output in compress .Z format not supported\n");
in++, out++; /* avoid warnings on unused variables */
exit_code = ERROR;
if (in != out) { /* avoid warnings on unused variables */
exit_code = ERROR;
}
return ERROR;
}

View File

@ -4,13 +4,13 @@
* terms of the GNU General Public License, see the file COPYING.
*/
#define VERSION "1.2.2"
#define VERSION "1.2.4"
#define PATCHLEVEL 0
#define REVDATE "17 Jun 93"
#define REVDATE "18 Aug 93"
/* This version does not support compression into old compress format: */
#ifdef LZW
# undef LZW
#endif
/* $Id: revision.h,v 0.23 1993/06/16 15:03:51 jloup Exp $ */
/* $Id: revision.h,v 0.25 1993/06/24 08:29:52 jloup Exp $ */

View File

@ -34,8 +34,12 @@
# else
# define MAXSEG_64K
# ifdef __TURBOC__
# define NO_UTIME
# define NO_OFF_T
# ifdef __BORLANDC__
# define DIRENT
# else
# define NO_UTIME
# endif
# else /* MSC */
# define HAVE_SYS_UTIME_H
# define NO_UTIME_H
@ -70,11 +74,11 @@
# define NO_MULTIPLE_DOTS
# define MAX_EXT_CHARS 3
# define Z_SUFFIX "z"
# define casemap(c) tolow(c)
# endif
# define NO_CHOWN
# define PROTO
# define STDC_HEADERS
# define casemap(c) tolow(c)
# include <io.h>
# define OS_CODE 0x06
# define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
@ -104,6 +108,27 @@
# endif
#endif
#ifdef WIN32 /* Windows NT */
# define HAVE_SYS_UTIME_H
# define NO_UTIME_H
# define PATH_SEP2 '\\'
# define PATH_SEP3 ':'
# define MAX_PATH_LEN 260
# define NO_CHOWN
# define PROTO
# define STDC_HEADERS
# define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
# include <io.h>
# include <malloc.h>
# ifdef NTFAT
# define NO_MULTIPLE_DOTS
# define MAX_EXT_CHARS 3
# define Z_SUFFIX "z"
# define casemap(c) tolow(c) /* Force file names to lower case */
# endif
# define OS_CODE 0x0b
#endif
#ifdef MSDOS
# ifdef __TURBOC__
# include <alloc.h>
@ -149,7 +174,6 @@
#ifdef AMIGA
# define PATH_SEP2 ':'
# define STDC_HEADERS
# define casemap(c) tolow(c) /* Force file names to lower case */
# define OS_CODE 0x01
# define ASMV
# ifdef __GNUC__
@ -178,11 +202,15 @@
# define ASMV
# define OS_CODE 0x05
# ifdef TOSFS
# define NO_SYMLINK
# define PATH_SEP2 '\\'
# define PATH_SEP3 ':'
# define MAX_PATH_LEN 128
# define NO_MULTIPLE_DOTS
# define MAX_EXT_CHARS 3
# define Z_SUFFIX "z"
# define NO_CHOWN
# define casemap(c) tolow(c) /* Force file names to lower case */
# define NO_SYMLINK
# endif
#endif
@ -221,8 +249,8 @@
# endif
#endif
#ifdef WIN32
# define OS_CODE 0x0b
#if defined(pyr) && !defined(NOMEMCPY) /* Pyramid */
# define NOMEMCPY /* problem with overlapping copies */
#endif
#ifdef TOPS20

View File

@ -58,7 +58,7 @@
#include "tailor.h"
#include "gzip.h"
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: trees.c,v 0.12 1993/06/10 13:27:54 jloup Exp $";
#endif

View File

@ -3,6 +3,10 @@
* written by Haruhiko Okumura.
*/
#ifdef RCSID
static char rcsid[] = "$Id: unlzh.c,v 1.2 1993/06/24 10:59:01 jloup Exp $";
#endif
#include <stdio.h>
#include "tailor.h"
@ -18,12 +22,20 @@ local void decode_start OF((void));
local void huf_decode_start OF((void));
local unsigned decode_c OF((void));
local unsigned decode_p OF((void));
local void read_pt_len OF((int nn, int nbit, int i_special));
local void read_c_len OF((void));
/* io.c */
local void fillbuf OF((int n));
local unsigned getbits OF((int n));
local void init_getbits OF((void));
/* maketbl.c */
local void make_table OF((int nchar, uch bitlen[],
int tablebits, ush table[]));
#define DICBIT 13 /* 12(-lh4-) or 13(-lh5-) */
#define DICSIZ ((unsigned) 1 << DICBIT)
@ -66,7 +78,7 @@ local void init_getbits OF((void));
/* local ush right[2 * NC - 1]; */
#define left prev
#define right head
#if NC > 1<<(BITS-2)
#if NC > (1<<(BITS-2))
error cannot overlay left+right and prev
#endif
@ -82,10 +94,14 @@ local ush pt_table[256];
/* local ush c_table[4096]; */
#define c_table d_buf
#if DIST_BUFSIZE < 4096
#if (DIST_BUFSIZE-1) < 4095
error cannot overlay c_table and d_buf
#endif
/***********************************************************
io.c -- input/output
***********************************************************/
local ush bitbuf;
local unsigned subbitbuf;
local int bitcount;
@ -132,16 +148,16 @@ local void make_table(nchar, bitlen, tablebits, table)
unsigned i, k, len, ch, jutbits, avail, nextcode, mask;
for (i = 1; i <= 16; i++) count[i] = 0;
for (i = 0; i < nchar; i++) count[bitlen[i]]++;
for (i = 0; i < (unsigned)nchar; i++) count[bitlen[i]]++;
start[1] = 0;
for (i = 1; i <= 16; i++)
start[i + 1] = start[i] + (count[i] << (16 - i));
if (start[17] != (ush)((unsigned) 1 << 16))
if ((start[17] & 0xffff) != 0)
error("Bad table\n");
jutbits = 16 - tablebits;
for (i = 1; i <= tablebits; i++) {
for (i = 1; i <= (unsigned)tablebits; i++) {
start[i] >>= jutbits;
weight[i] = (unsigned) 1 << (tablebits - i);
}
@ -151,17 +167,17 @@ local void make_table(nchar, bitlen, tablebits, table)
}
i = start[tablebits + 1] >> jutbits;
if (i != (ush)((unsigned) 1 << 16)) {
if (i != 0) {
k = 1 << tablebits;
while (i != k) table[i++] = 0;
}
avail = nchar;
mask = (unsigned) 1 << (15 - tablebits);
for (ch = 0; ch < nchar; ch++) {
for (ch = 0; ch < (unsigned)nchar; ch++) {
if ((len = bitlen[ch]) == 0) continue;
nextcode = start[len] + weight[len];
if (len <= tablebits) {
if (len <= (unsigned)tablebits) {
for (i = start[len]; i < nextcode; i++) table[i] = ch;
} else {
k = start[len];

View File

@ -7,7 +7,7 @@
* to accommodate in-memory decompression.
*/
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: unlzw.c,v 0.15 1993/06/10 13:28:35 jloup Exp $";
#endif
@ -281,8 +281,10 @@ int unlzw(in, out)
goto resetbuf;
}
input(inbuf,posbits,code,n_bits,bitmask);
Tracev((stderr, "%d ", code));
if (oldcode == -1) {
if (code >= 256) error("corrupt input.");
outbuf[outpos++] = (char_type)(finchar = (int)(oldcode=code));
continue;
}
@ -316,7 +318,8 @@ int unlzw(in, out)
write_buf(out, (char*)outbuf, outpos);
bytes_out += (ulg)outpos;
}
error("corrupt input. Use zcat to recover some data.");
error(to_stdout ? "corrupt input." :
"corrupt input. Use zcat to recover some data.");
}
*--stackp = (char_type)finchar;
code = oldcode;

View File

@ -4,7 +4,7 @@
* terms of the GNU General Public License, see the file COPYING.
*/
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: unpack.c,v 1.4 1993/06/11 19:25:36 jloup Exp $";
#endif
@ -57,7 +57,7 @@ local int peek_bits; /* Number of peek bits currently used */
* codes encountered in the input stream are short codes (by construction).
* So for most codes a single lookup will be necessary.
*/
#if 1<<MAX_PEEK > OUTBUFSIZ
#if (1<<MAX_PEEK) > OUTBUFSIZ
error cannot overlay prefix_len and outbuf
#endif
@ -219,7 +219,7 @@ int unpack(in, out)
do {
len++, mask = (mask<<1)+1;
look_bits(peek, len, mask);
} while (peek < parents[len]);
} while (peek < (unsigned)parents[len]);
/* loop as long as peek is a parent node */
}
/* At this point, peek is the next complete code, of len bits */
@ -232,7 +232,7 @@ int unpack(in, out)
flush_window();
Trace((stderr, "bytes_out %ld\n", bytes_out));
if (orig_len != bytes_out) {
if (orig_len != (ulg)bytes_out) {
error("invalid compressed data--length error");
}
return OK;

View File

@ -13,7 +13,7 @@
either deflated or stored.
*/
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: unzip.c,v 0.13 1993/06/10 13:29:00 jloup Exp $";
#endif
@ -174,7 +174,7 @@ int unzip(in, out)
if (orig_crc != updcrc(outbuf, 0)) {
error("invalid compressed data--crc error");
}
if (orig_len != bytes_out) {
if (orig_len != (ulg)bytes_out) {
error("invalid compressed data--length error");
}

View File

@ -4,7 +4,7 @@
* terms of the GNU General Public License, see the file COPYING.
*/
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: util.c,v 0.15 1993/06/15 09:04:13 jloup Exp $";
#endif
@ -301,7 +301,7 @@ char *add_envopt(argcp, argvp, env)
if (*p) *p++ = '\0'; /* mark it */
}
if (nargc == 0) {
free(env); env = NULL;
free(env);
return NULL;
}
*argcp += nargc;

View File

@ -42,21 +42,21 @@ if test $# -eq 1; then
elif test $# -eq 2; then
case "$1" in
*[-.]gz | *[-.][zZ] | *.t[ga]z)
*[-.]gz* | *[-.][zZ] | *.t[ga]z)
case "$2" in
*[-.]gz | *[-.][zZ] | *.t[ga]z)
F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*$||'`
gzip -cd "$2" > /tmp/"$F".$$
gzip -cd "$1" | $comp $OPTIONS - /tmp/"$F".$$
*[-.]gz* | *[-.][zZ] | *.t[ga]z)
F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'`
gzip -cdfq "$2" > /tmp/"$F".$$
gzip -cdfq "$1" | $comp $OPTIONS - /tmp/"$F".$$
STAT="$?"
/bin/rm -f /tmp/"$F".$$;;
*) gzip -cd "$1" | $comp $OPTIONS - "$2"
*) gzip -cdfq "$1" | $comp $OPTIONS - "$2"
STAT="$?";;
esac;;
*) case "$2" in
*[-.]gz | *[-.][zZ] | *.t[ga]z)
gzip -cd "$2" | $comp $OPTIONS "$1" -
*[-.]gz* | *[-.][zZ] | *.t[ga]z)
gzip -cdfq "$2" | $comp $OPTIONS "$1" -
STAT="$?";;
*) $comp $OPTIONS "$1" "$2"
STAT="$?";;

View File

@ -4,7 +4,7 @@
* terms of the GNU General Public License, see the file COPYING.
*/
#ifndef lint
#ifdef RCSID
static char rcsid[] = "$Id: zip.c,v 0.17 1993/06/10 13:29:25 jloup Exp $";
#endif

View File

@ -21,7 +21,11 @@ else
fi
if test $# = 0; then
if test -t 0; then
echo usage: zmore files...
else
gzip -cdfq | eval ${PAGER-more}
fi
else
FIRST=1
for FILE

View File

@ -40,21 +40,15 @@ if test "$ext" = ".Z"; then
exit 1
fi
A=
fileno=0
for arg
do
case "$arg" in
-*) opt="$opt $arg";;
*) fileno=`expr $fileno + 1`
eval A$fileno=\$arg
A="$A \"\$A$fileno\""
;;
-*) opt="$opt $arg"; shift;;
*) break;;
esac
done
if test $fileno -eq 0; then
if test $# -eq 0; then
echo "recompress .Z files into $ext (gzip) files"
echo usage: `echo $0 | sed 's,^.*/,,'` "[-tv9KP]" file.Z...
echo " -t tests the new files before deleting originals"
@ -65,8 +59,6 @@ if test $fileno -eq 0; then
exit 1
fi
eval set "$A" # the files are now in $1, $2, ...
opt=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
case "$opt" in
*t*) check=1; opt=`echo "$opt" | sed 's/t//g'`

View File

@ -7,6 +7,8 @@ znew \- recompress .Z files to .gz files
.SH DESCRIPTION
.I Znew
recompresses files from .Z (compress) format to .gz (gzip) format.
If you want to recompress a file already in gzip format, rename the file
to force a .Z extension then apply znew.
.SH OPTIONS
.TP
.B \-f