summaryrefslogtreecommitdiff
path: root/usr.bin/compress/main.c
AgeCommit message (Collapse)Author
2005-07-22sort synopsis and options list; sync usage() (as best we can);Jason McIntyre
help + ok jaredy@
2005-07-11Don't set timestamps created from stack garbage when compressingTodd C. Miller
from stdin. Based on a patch from marc@
2005-06-26be a bit more carefull not writing to the stream after the timestampsOtto Moerbeek
have been set. ok deraadt@
2005-04-17spacingTheo de Raadt
2005-04-17use correct functions names in warn()Hans-Joerg Hoexer
ok deraadt millert
2005-04-14use f{chown,chmod,utimes,chflags} instead; done with hshoexer, ok otto mickeyTheo de Raadt
2005-02-24remove docompress() completely in case of -DSMALL andMoritz Jodeit
replace it with a better error message. ok millert@ henning@
2005-02-07In list mode (which implies test mode), do not forget to initializeOtto Moerbeek
uncompressed_name. Spotted by markus@; ok hshoexer@ millert@
2005-01-27Compute compression ratio using signed arithmetic, since the compressed sizeOtto Moerbeek
might be larger than the original, yielding negative percentages. Spotted by markus@ ok henning@ hshoexer@
2004-09-20Make "gunzip foo.bar" work when there is a foo.bar.gz file.Todd C. Miller
OK otto@
2004-07-29Don't set the output filename when in -t mode. Avoids an error whenTodd C. Miller
the input filename lacks a .gz. OK mickey@
2004-02-29don't stat(2) outfile in testmode; ok millert@, miod@Markus Friedl
2004-01-22Make exit code for "unknown suffix" and "name too long" match GNU gzip.Todd C. Miller
Fixes an interaction with the perl CPAN module which checks the exit value.
2003-12-16do not implement -L (print copyright) with SMALLHenning Brauer
186 bytes more bytes we can waste elsewhere
2003-12-16really don't do -V #ifdef SMALLHenning Brauer
2003-12-16do not include rcsids with -DSMALL and as it is meaningless then do notHenning Brauer
implement -V then. following a discussion with millert@
2003-12-16avoid name clash with newer libz; breaks on static archsHenning Brauer
ok millert@
2003-12-09Fixes based on a patch from Moritz Jodeit; mickey@ OKTodd C. Miller
o break out of inflate() when we hit an error o fix printf format #ifdef SMALL o add version string of nullopen.c to -V output o remove unnecessary initializations to 0 for variables cat and decomp o beautify -l output to make it line up with the heading
2003-09-05KNF nit pointed out by theoHenning Brauer
2003-09-05dont error out when the input file is a symlink AND output goes to stdoutHenning Brauer
inspired by PR3409, ckuethe@ualberta.ca, tho fixed differently matches gnu gzip behaviour ok millert@ tedu@ deraadt@
2003-09-05add a null compressor from canacar@ that lets gzcat work with uncompressedTed Unangst
files. also introduce SMALLness that removes null and Z compressors to save floppy space. ok deraadt@
2003-08-05spacingTheo de Raadt
2003-07-29Instead of checking for "stdout" in decompress(), just do the checkTodd C. Miller
in list_stats(). Looks cleaner and we don't have to rely on any special flags being set.
2003-07-29Check cat, not pipin when deciding whether or not to make useTodd C. Miller
"stdout" as the filename in -l mode. Fixes "gzip -lN < foo.gz"
2003-07-27Return FAILURE for "file would grow" case so the .gz file gets removed.Todd C. Miller
Problem noticed by otto@
2003-07-25o deal with the case where -N was specified but no saved mtime in the gz fileTodd C. Miller
o a filename in the header should turn off cat mode if -N o make setmode() be smart about pipin and not set outfile based on /dev/stdin. mickey@ OK
2003-07-18Previously, "cat" mode (ie: zcat) was set if no input file was specified,Todd C. Miller
and input was read from the standard input. However, if the -o option is specified, we don't need (or want) cat mode since the user has told us where the output should go.
2003-07-18Change "nosave" back into a boolean for improved grokability.Todd C. Miller
It is now initialized to -1 and, if the user did not specify the -n or -N flags, is set equal to "decomp". In other words, unless overridden via -n/-N, it is false when compressing, and true when decompressing (which is what we want).
2003-07-17o implement -l, -n and -N (including setting outfile + mtime)Todd C. Miller
o make -v behave like GNU gzip for compress/decompress stats o write a full gzip header w/ mtime and file name o for -t/-l just don't write data instead of writing to /dev/null o exit code is now more consistent with GNU gzip o a crc error on decompress no longer causes unlink(outfile) mickey@ OK
2003-07-15Don't compress a file that already has a known compression prefix.Todd C. Miller
This matches GNU gzip behavior.
2003-07-14Improved (and cleaner) suffix handling code. Now "gunzip foo.tgz"Todd C. Miller
works as expected. mickey@ OK
2003-07-14-t and implied -c due to piped in input is a legal combination of flagsMichael Shalayeff
2003-07-11Move magic number checking into main.c and make it work whenTodd C. Miller
decompressing from a pipe. Currently assumes that magic numbers are 2 bytes but this is relatively easy to change as needed in the future. Discussed w/ mickey@
2003-07-08fix fd closing logicand close in gzopen(); found by wilfried@ and millert@ okMichael Shalayeff
2003-06-30Make usage() take the exit val are an argument and have the -h flagTodd C. Miller
use this to exit(0), not exit(1). Some configure/install sqcripts check for the existence of gzip by running "gzip -h" and checking the subshell's exit value. Noticed by naddy@
2003-06-29Return EINVAL on crc failure for gzip and make the driver programTodd C. Miller
interpret this correctly. Makes "gzip -t" more useful. Discussed with deraadt@
2003-06-27Fix -t mode; it needs to set decomp=1 tooTodd C. Miller
2003-06-23Fix a typo in my last commit and convert file "-" to /dev/stdin likeTodd C. Miller
GNU gzip does.
2003-06-23When trying to cat a non-file, say "foo not a regular file" instead ofTodd C. Miller
"foo not a regular file: unchanged" since we never change the file in cat mode.
2003-06-22man page changes from jmc: use this as gzip tooTheo de Raadt
2003-06-22knf and ansiTheo de Raadt
2003-06-10mostly ansi cleanup; pval okTheo de Raadt
2003-06-044 was deleted, should be 3Theo de Raadt
2003-04-07strlcpy; from Hans-Joerg.Hoexer@yerbouti.franken.deTheo de Raadt
2003-01-07Avoid trashing an existing output file when the input cannot be read.Todd C. Miller
Changes open order slightly and makes a distiction between errors < 0 and > 0. Prompted by a discussion on the freebsd-audit list.
2003-01-06fix aproblem w/ -oct mix check and compressing /dev/stdin; millert@ okMichael Shalayeff
2002-12-17o Implement -r (recursive) optionTodd C. Miller
o add missing options to OPTSTRING o add some option mixing sanity checks o truncate existing files when uncompressing o fixed some problems with suffix handling This brings us closer to being able to replace GNU gzip; mickey@ OK
2002-12-08grop long option names, like gzip.Michael Shalayeff
add most of the gzip's options (a few unimplemented yet). some cleaning, etc. millert@ ok
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
2001-11-19kill more registersMike Pechkin
millert@ ok