Commit Graph

70 Commits

Author SHA1 Message Date
agc f8dc59869d Fix a reference to stale storage on the stack - malloc the new file
name when gunzip'ing via strdup(3).  Fixes a bug whereby the new
filename would appear as gibberish when verbosely gunzipping.

Fix an off-by-one error when allocating the filename with added suffix,
and properly NUL-terminate the new filename.

It's NULL, not 0, in char * assignments - there are some still to do here.
2004-05-17 18:10:33 +00:00
bouyer 41bff69bbe Always initialise savename. Fix gzip -c core dump on sparc (and probably
others). OK'd by mrg@.
2004-05-06 17:43:57 +00:00
wiz af350435db Remove typeset line, since sh(1) does not support it.
Closes PR 25403 by Jukka Salmi.
2004-05-01 08:22:41 +00:00
mrg 99d2aa3dc3 clean up file descriptor handling. don't lose them... 2004-04-27 13:45:50 +00:00
mrg a9c239e635 - the default compression level in GNU gzip is 6 not 5; copy that default.
- note that -t/-l/-v & bzip2 is not handled the same as gzip in a comment.
2004-04-27 11:26:28 +00:00
jdolecek dd23e5ed48 quote pattern when passing to grep, so that paterns containing
spaces would be handled properly

fixes PR bin/25345 by Arto Selonen
2004-04-27 09:18:16 +00:00
mrg b02eba12c2 crank version. 2004-04-27 02:25:06 +00:00
mrg d6dd48bc60 - fix "gunzip file.gz"
- fix "gzip <lots of files>"

both reported by tron@.
2004-04-27 01:23:35 +00:00
mrg 4db02197fc - properly parse --fast/--best/-1..-9 again. noted by taca@.
- minor clean up.
2004-04-26 03:01:55 +00:00
mrg 1d0e9794a0 significantly rototill. don't use the high-level gzio functions
anymore, use the low-level inflate()/deflate() directly.  this
allows support file-type detection on stdin; now can decompress
.Z and .bz2 files fed to stdin (fixes PR#25192) additionally it
makes -v work with stdin or stdout (fixes PR#25215.)

(with these changes, we no longer need gzopenfull(3) in libz.)

thanks to martin@ for the code gzip.c:gz_uncompress() is based on.
2004-04-25 16:20:33 +00:00
mrg 98445d2478 be sure we don't try to remove an output file we haven't actually created.
(reported by kimmo.)
2004-04-12 14:42:14 +00:00
mrg ff187e728e - completely rewrite print_ratio(). fixes PR#25072 and a few other cases
- print_list() was getting the compressed/uncompressed sizes backwards.
2004-04-07 14:25:43 +00:00
mrg 8a618ce17c remove a chunk more code with -DSMALL and in the process fix -DSMALL
that was broken in the previous commit (by exposing "fflag".)
2004-03-31 15:46:25 +00:00
tron 17ebf9b589 Handle files with link count larger than 1 if "-f" option is used. This
is consistent with the old "gzip" and required by "pkgsrc" to implement
"MANZ" properly.
2004-03-31 15:19:14 +00:00
mrg ff930808e7 backout previous. fix the bug it inspired instead. we will want this
version of the code when doing file-type detection.
2004-03-30 11:43:32 +00:00
mrg 7149a52947 factor out filetype checking code 2004-03-30 11:42:04 +00:00
mrg d4e27c8dfb use off_t instead of ssize_t in a few places.
fix "gzip -l" in -DSMALL (it wasn't doing a stat(2)).
2004-03-30 09:42:58 +00:00
mrg 70da2f0f10 patch from tron@ to convert to using public bz interfaces. simonb says
no reason not to and this fixes PR#24964.
2004-03-30 09:15:07 +00:00
wiz 1612675940 s/compress/gzip/, our compress is not the backend for gzip.
Noted by hubertf.
2004-03-29 09:59:42 +00:00
mrg ed20265f67 shave another 612 bytes off -DSMALL on x86. now x_gzip with -l support
is actually smaller than the older x_gzip without it!
2004-03-28 13:54:44 +00:00
mrg 15fba948a6 still do argv[0] processing -DSMALL, from tsutsui.
pass the smaller list of options to getopt with -DSMALL.
2004-03-28 08:18:14 +00:00
mrg 720263a2ef crank version 2004-03-28 04:13:40 +00:00
mrg d7f0a538e2 remove a bunch more stuff with -DSMALL. now we are about 400 bytes larger
than x_gzip... given we add -l support, time to retire x_gzip/gzip.c.
2004-03-28 04:07:45 +00:00
mrg 57a27c0187 remove another 3KB or so of text/data on i386 with -DSMALL. now only
about 1.1KB larger than the old x_gzip sources, but includes (required
for sysinst) gzip -l support.
2004-03-28 03:47:18 +00:00
tsutsui b6e59003c4 Allow disabling bzip2 (.bz2) and compress (.Z) support
by -DNO_BZIP2_SUPPORT and -DNO_COMPRESS_SUPPORT.
OK'ed by mrg.
2004-03-27 22:33:43 +00:00
mrg 6506e19a17 minor cleanup. 2004-03-06 09:41:36 +00:00
he 2f8028b1b0 Fix mismatched type error in fropen() usage by converting return
type of zread() from ssize_t to int.
2004-02-18 18:29:07 +00:00
wiz 15d66087e7 Mention compress(1) support, and add bzip2(1) and compress(1) to SEE ALSO.
Bump date.
2004-02-18 09:16:27 +00:00
mrg 91d1fa9407 support decompressing "compress"ed files. from rtr@ with a few minor edits
from me.  code in zuncompress liberally borrowed from usr.bin/compress.
2004-02-18 08:19:48 +00:00
mrg 49637d1931 use gzopenfull() 2004-01-29 13:18:58 +00:00
grant 23032f5513 void functions need not call return 2004-01-25 05:19:49 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
mrg d8d414bd77 prepend_gzip: avoid searching beyond this string 2004-01-03 02:39:18 +00:00
simonb 95a042fe31 Fix off-by-one error in the malloc of the new argv in prepend_gzip(). 2004-01-02 10:09:42 +00:00
wiz 7569ff6812 Fix typo in comment. 2004-01-02 03:12:21 +00:00
wiz 75806e5a61 Sort sections. New sentence, new line. Bump date. 2004-01-02 03:01:13 +00:00
mrg 0b76a77c33 implement $GZIP handling. 2004-01-02 02:55:26 +00:00
mrg 91536bce55 note that $GZIP support is missing still 2004-01-02 01:40:59 +00:00
mrg 74e9c5767a allow HAVE_ZLIB_GZOPENFULL to be overriden externally 2004-01-02 01:34:01 +00:00
mrg e4b2fd8644 don't dump core in the face of unknown long options. from cjep@ 2004-01-01 05:28:44 +00:00
wiz a8763d1922 .P -> .Pp (typo fix). 2004-01-01 03:51:36 +00:00
mrg 09e6110c19 add some simple -DSMALL support. reduces the size of gzip(1) itself a by
nearly 2.5KB text.
2004-01-01 02:58:36 +00:00
mrg ecadec7f36 port simonb's bzip2 support.
misc cleanups.
2004-01-01 02:44:09 +00:00
wiz e000293cc0 Add RCS Id. 2003-12-28 17:26:48 +00:00
wiz 6ac2a4f4db Add a BSD licensed zgrep written by me.
Much nicer than the old one, if I may say so.

Thanks go to atatat for testing and suggestions.
2003-12-28 17:26:00 +00:00
mrg 0889156103 GNU gzip compatibility: don't let "gzip -dc" (zcat) operate on non-gzip
files by default.  -f must be used.
2003-12-28 13:42:28 +00:00
mrg f13009df25 fix an error in the previous 2003-12-28 13:40:56 +00:00
mrg 7530d0a53d zdiff is also zcmp (from wiz) 2003-12-28 13:37:23 +00:00
wiz 98018344b7 No argument necessary after .Nm; add missing comma to enumeration. 2003-12-28 12:49:41 +00:00
wiz 28c2ebe997 Use more macros. 2003-12-28 12:48:03 +00:00