summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-02-05 20:54:25 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2007-02-05 20:54:25 +0000
commite24e0fedb97d741ef5ef34a2c38807ef4dd5bf57 (patch)
tree8d7657394a27b86d1458977ba029e801e60261bb
parent2d97657ee315734d908e9008cb9843755bfbc88b (diff)
downloadgzip-e24e0fedb97d741ef5ef34a2c38807ef4dd5bf57.tar.gz
* gunzip.in, zcat.in, zcmp.in, zegrep.in, zfgrep.in: New files.
* Makefile.am (EXTRA_DIST): Add them. (bin_SCRIPTS, MOSTLYCLEANFILES): Add gunzip, zcat, zcmp, zdgrep, zfgrep. (.in): Use GZIP_BINDIR as the location of gzip binaries, if it is set. (check-local): Use GZIP_BINDIR. (install-exec-hook, remove-installed-links): Make 'uncompress' an alias for gunzip. * gzexe.1: At least one arg is required. Don't give cat as an example, since gzexe refuses to compress cat due to a bootstrapping issue. List more utilities in this category. * gzexe.in, zdiff.in, zforce.in, zgrep.in, zless.in, zmore.in, znew.in: Report our name in usage. * gzexe.in: Don't compress bash. Don't use rmdir, so it's OK to compress rmdir. * gzip.c: Now requires that you compile with -DGNU_STANDARD=0 to get non GNU-standard behavior. We now build with GNU-standard behavior by default, so that programs do not depend on the names of their executables. * zdiff.in: Don't depend on the name of the executable, as per GNU standard. Instead, rely on an internal --__cmp option. Support ' in options. Check for failures in subsidiary gzip invocations. * zgrep.1: Clarify compression issues. * zgrep.in: Don't assume POSIX-style case syntax. Remove unused var have_optarg. * zless.1: zless sets LESSMETACHARS now.
-rw-r--r--ChangeLog29
-rw-r--r--Makefile.am31
-rw-r--r--gunzip.in3
-rw-r--r--gzexe.134
-rw-r--r--gzexe.in16
-rw-r--r--gzip.c9
-rw-r--r--zcat.in3
-rw-r--r--zcmp.in3
-rw-r--r--zdiff.in121
-rw-r--r--zegrep.in3
-rw-r--r--zfgrep.in3
-rw-r--r--zforce.in6
-rw-r--r--zgrep.131
-rw-r--r--zgrep.in22
-rw-r--r--zless.14
-rw-r--r--zless.in6
-rw-r--r--zmore.in6
-rw-r--r--znew.in6
18 files changed, 211 insertions, 125 deletions
diff --git a/ChangeLog b/ChangeLog
index b8415aa..f35fb0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2007-02-05 Paul Eggert <eggert@cs.ucla.edu>
+
+ * gunzip.in, zcat.in, zcmp.in, zegrep.in, zfgrep.in: New files.
+ * Makefile.am (EXTRA_DIST): Add them.
+ (bin_SCRIPTS, MOSTLYCLEANFILES): Add gunzip, zcat, zcmp, zdgrep, zfgrep.
+ (.in): Use GZIP_BINDIR as the location of gzip binaries, if it is set.
+ (check-local): Use GZIP_BINDIR.
+ (install-exec-hook, remove-installed-links): Make 'uncompress' an
+ alias for gunzip.
+ * gzexe.1: At least one arg is required. Don't give cat as an
+ example, since gzexe refuses to compress cat due to a bootstrapping
+ issue. List more utilities in this category.
+ * gzexe.in, zdiff.in, zforce.in, zgrep.in, zless.in, zmore.in, znew.in:
+ Report our name in usage.
+ * gzexe.in: Don't compress bash. Don't use rmdir, so it's
+ OK to compress rmdir.
+ * gzip.c: Now requires that you compile with -DGNU_STANDARD=0 to
+ get non GNU-standard behavior. We now build with GNU-standard
+ behavior by default, so that programs do not depend on the names
+ of their executables.
+ * zdiff.in: Don't depend on the name of the executable, as per
+ GNU standard. Instead, rely on an internal --__cmp option.
+ Support ' in options. Check for failures in subsidiary gzip
+ invocations.
+ * zgrep.1: Clarify compression issues.
+ * zgrep.in: Don't assume POSIX-style case syntax. Remove unused var
+ have_optarg.
+ * zless.1: zless sets LESSMETACHARS now.
+
2007-01-10 Paul Eggert <eggert@cs.ucla.edu>
* m4/shell.m4 (AC_PROG_SHELL): Test that $(...) works.
diff --git a/Makefile.am b/Makefile.am
index 8cde55e..5799d75 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
# Make gzip (GNU zip).
-# Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2006, 2007 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
@@ -26,7 +26,7 @@ man_MANS = gunzip.1 gzexe.1 gzip.1 \
EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
algorithm.doc amiga/match.a amiga/Makefile.gcc amiga/Makefile.sasc \
amiga/tailor.c amiga/utime.h atari/Makefile.st crypt.h \
- gzexe.in gzip.doc gzip.h lzw.h msdos/match.asm msdos/tailor.c \
+ gunzip.in gzexe.in gzip.doc gzip.h lzw.h msdos/match.asm msdos/tailor.c \
msdos/gzip.prj msdos/doturboc.bat msdos/Makefile.msc msdos/Makefile.bor \
msdos/Makefile.djg nt/Makefile.nt os2/gzip.def os2/Makefile.os2 \
os2/gzip16.def primos/include/errno.h primos/include/fcntl.h \
@@ -35,11 +35,12 @@ EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
primos/primos.c primos/ci.opts revision.h sample/makecrc.c \
sample/ztouch sample/add.c sample/sub.c sample/zread.c sample/zfile \
tailor.h vms/Makefile.mms vms/gzip.hlp vms/vms.c vms/Readme.vms \
- vms/Makefile.vms vms/Makefile.gcc vms/makegzip.com zdiff.in \
- zforce.in zgrep.in zless.in zmore.in znew.in
+ vms/Makefile.vms vms/Makefile.gcc vms/makegzip.com zcat.in zcmp.in zdiff.in \
+ zegrep.in zfgrep.in zforce.in zgrep.in zless.in zmore.in znew.in
bin_PROGRAMS = gzip
-bin_SCRIPTS = gzexe zdiff zgrep zforce zless zmore znew
+bin_SCRIPTS = gunzip gzexe zcat zcmp zdiff \
+ zegrep zfgrep zforce zgrep zless zmore znew
gzip_SOURCES = \
bits.c crypt.c deflate.c gzip.c inflate.c lzw.c \
trees.c unlzh.c unlzw.c unpack.c unzip.c util.c zip.c
@@ -55,7 +56,7 @@ SUFFIXES = .in
.in:
sed \
-e 's|/bin/sh|$(SHELL)|g' \
- -e 's|BINDIR|$(bindir)|g' \
+ -e 's|BINDIR|$${GZIP_BINDIR-'\''$(bindir)'\''}|g' \
-e 's|[@]VERSION@|$(VERSION)|g' \
$(srcdir)/$@.in >$@
chmod a+x $@
@@ -64,12 +65,12 @@ SUFFIXES = .in
FILES_TO_CHECK = $(bin_SCRIPTS) $(gzip_LDADD) \
$(top_srcdir)/ChangeLog $(top_srcdir)/configure $(top_srcdir)/gzip.c
check-local: $(FILES_TO_CHECK) gzip.doc.gz
- test '$(srcdir)' != . || ./zdiff -c gzip.doc.gz
- ./zdiff -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc
- ./zdiff $(srcdir)/gzip.doc gzip.doc.gz
- ./zdiff -c - $(srcdir)/gzip.doc <gzip.doc.gz
- ./zdiff -c gzip.doc.gz gzip.doc.gz
- ./zgrep -iV >/dev/null
+ { test '$(srcdir)' != . || GZIP_BINDIR=. ./zdiff -c gzip.doc.gz; }
+ GZIP_BINDIR=. ./zdiff -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc
+ GZIP_BINDIR=. ./zdiff $(srcdir)/gzip.doc gzip.doc.gz
+ GZIP_BINDIR=. ./zdiff -c - $(srcdir)/gzip.doc <gzip.doc.gz
+ GZIP_BINDIR=. ./zdiff -c gzip.doc.gz gzip.doc.gz
+ GZIP_BINDIR=. ./zgrep -iV >/dev/null
for file in $(FILES_TO_CHECK); do \
./gzip -cv -- "$$file" | ./gzip -d | cmp - "$$file" || exit; \
done
@@ -80,9 +81,7 @@ install-exec-hook remove-installed-links:
@for prog_ext in $(bin_PROGRAMS) $(bin_SCRIPTS); do \
prog=`echo "$$prog_ext"|sed 's/$(EXEEXT)$$//'`; \
case $$prog in \
- gzip) aliases='gunzip zcat';; \
- zdiff) aliases='zcmp';; \
- zgrep) aliases='zegrep zfgrep';; \
+ gunzip) aliases='uncompress';; \
*) continue;; \
esac; \
transform='$(transform)'; \
@@ -108,4 +107,4 @@ uninstall-local: remove-installed-links
MAINTAINERCLEANFILES = gzip.doc
MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
- gzexe zdiff zforce zgrep zless zmore znew
+ gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew
diff --git a/gunzip.in b/gunzip.in
new file mode 100644
index 0000000..9490f16
--- /dev/null
+++ b/gunzip.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+PATH=BINDIR:$PATH
+exec gzip -d "$@"
diff --git a/gzexe.1 b/gzexe.1
index 8b62cd6..01ad9ad 100644
--- a/gzexe.1
+++ b/gzexe.1
@@ -3,22 +3,22 @@
gzexe \- compress executable files in place
.SH SYNOPSIS
.B gzexe
-[ name ... ]
+.I "name .\|.\|."
.SH DESCRIPTION
The
.I gzexe
utility allows you to compress executables in place and have them
automatically uncompress and execute when you run them (at a penalty
-in performance). For example if you execute ``gzexe /bin/cat'' it
+in performance). For example if you execute ``gzexe /usr/bin/gdb'' it
will create the following two files:
.nf
.br
- -r-xr-xr-x 1 root bin 9644 Feb 11 11:16 /bin/cat
- -r-xr-xr-x 1 bin bin 24576 Nov 23 13:21 /bin/cat~
+ -rwxr-xr-x 1 root root 1026675 Jun 7 13:53 /usr/bin/gdb
+ -rwxr-xr-x 1 root root 2304524 May 30 13:02 /usr/bin/gdb~
.fi
-/bin/cat~ is the original file and /bin/cat is the self-uncompressing
-executable file. You can remove /bin/cat~ once you are sure that
-/bin/cat works properly.
+/usr/bin/gdb~ is the original file and /usr/bin/gdb is the self-uncompressing
+executable file. You can remove /usr/bin/gdb~ once you are sure that
+/usr/bin/gdb works properly.
.PP
This utility is most useful on systems with very small disks.
.SH OPTIONS
@@ -28,16 +28,24 @@ Decompress the given executables instead of compressing them.
.SH "SEE ALSO"
gzip(1), znew(1), zmore(1), zcmp(1), zforce(1)
.SH CAVEATS
-The compressed executable is a shell script. This may create some
-security holes. In particular, the compressed executable relies
+The compressed executable is a shell script. This may create some
+security holes. In particular, the compressed executable relies
on the PATH environment variable to find
.I gzip
-and some other utilities
-.I (tail, chmod, ln, sleep).
+and some standard utilities
+.RI ( basename ,
+.IR chmod ,
+.IR ln ,
+.IR mkdir ,
+.IR mktemp ,
+.IR rm ,
+.IR sleep ,
+and
+.IR tail ).
.SH "BUGS"
-.I gzexe
+.I gzexe
attempts to retain the original file attributes on the compressed executable,
but you may have to fix them manually in some cases, using
.I chmod
or
-.I chown.
+.IR chown .
diff --git a/gzexe.in b/gzexe.in
index a27ec5c..0acd3bb 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -13,7 +13,7 @@
# On Ultrix, /bin/sh is too buggy, change the first line to: #!/bin/sh5
-# Copyright (C) 1998, 2002, 2004, 2006 Free Software Foundation
+# Copyright (C) 1998, 2002, 2004, 2006, 2007 Free Software Foundation
# Copyright (C) 1993 Jean-loup Gailly
# This program is free software; you can redistribute it and/or modify
@@ -36,21 +36,21 @@ nl='
IFS=" $tab$nl"
version='gzexe (gzip) @VERSION@
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly.'
-usage='Usage: gzexe [OPTION] FILE...
+usage="Usage: $0 [OPTION] FILE...
Rename each FILE with a compressed version of itself, renaming FILE to FILE~.
-d Decompress each FILE instead of compressing it.
--help display this help and exit
--version output version information and exit
-Report bugs to <bug-gzip@gnu.org>.'
+Report bugs to <bug-gzip@gnu.org>."
PATH="BINDIR:$PATH"
@@ -106,11 +106,11 @@ for i do
continue
fi
case /$file in
- */basename | */cat | */chmod | */cp | \
+ */basename | */bash | */cat | */chmod | */cp | \
*/dirname | */echo | */expr | */gzip | \
- */ln | */mkdir | */mktemp | */mv | */rm | */rmdir | \
+ */ln | */mkdir | */mktemp | */mv | */rm | \
*/sed | */sh | */sleep | */test | */tail)
- echo >&2 "$0: $i would depend on itself"; continue;;
+ echo >&2 "$0: $i might depend on itself"; continue;;
esac
dir=`dirname "$file"` || dir=$TMPDIR
@@ -167,7 +167,7 @@ fi || { (exit 127); exit 127; }
gztmp=$gztmpdir/$0
case $0 in
-* | */*'
-') mkdir -p "$gztmp" && rmdir "$gztmp";;
+') mkdir -p "$gztmp" && rm -r "$gztmp";;
*/*) gztmp=$gztmpdir/`basename "$0"`;;
esac || { (exit 127); exit 127; }
diff --git a/gzip.c b/gzip.c
index 8f72526..0d34b77 100644
--- a/gzip.c
+++ b/gzip.c
@@ -1,6 +1,6 @@
/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
- Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 1992-1993 Jean-loup Gailly
This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,7 @@
*/
static char *license_msg[] = {
-"Copyright (C) 2006 Free Software Foundation, Inc.",
+"Copyright (C) 2007 Free Software Foundation, Inc.",
"Copyright (C) 1993 Jean-loup Gailly.",
"This is free software. You may redistribute copies of it under the terms of",
"the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.",
@@ -409,8 +409,11 @@ int main (argc, argv)
if (env != NULL) args = argv;
#ifndef GNU_STANDARD
+# define GNU_STANDARD 1
+#endif
+#if !GNU_STANDARD
/* For compatibility with old compress, use program name as an option.
- * If you compile with -DGNU_STANDARD, this program will behave as
+ * Unless you compile with -DGNU_STANDARD=0, this program will behave as
* gzip even if it is invoked under the name gunzip or zcat.
*
* Systems which do not support links can still use -d or -dc.
diff --git a/zcat.in b/zcat.in
new file mode 100644
index 0000000..0ef85cf
--- /dev/null
+++ b/zcat.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+PATH=BINDIR:$PATH
+exec gzip -cd "$@"
diff --git a/zcmp.in b/zcmp.in
new file mode 100644
index 0000000..23284ff
--- /dev/null
+++ b/zcmp.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+PATH=BINDIR:$PATH
+exec zdiff --__cmp "$@"
diff --git a/zdiff.in b/zdiff.in
index b17eafc..1eeaa7e 100644
--- a/zdiff.in
+++ b/zdiff.in
@@ -1,30 +1,40 @@
#!/bin/sh
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
-# Zcmp and zdiff are used to invoke the cmp or the diff pro-
-# gram on compressed files. All options specified are passed
-# directly to cmp or diff. If only 1 file is specified, then
-# the files compared are file1 and an uncompressed file1.gz.
-# If two files are specified, then they are uncompressed (if
-# necessary) and fed to cmp or diff. The exit status from cmp
-# or diff is preserved.
-
-PATH="BINDIR:$PATH"; export PATH
-case "$0" in
- *cmp) prog=cmp ; cmp='${CMP-cmp}' ;;
+# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
+# Copyright (C) 1993 Jean-loup Gailly
+
+# 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 of the License, 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, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+PATH=BINDIR:$PATH
+
+case $1 in
+ --__cmp) shift
+ prog=cmp; cmp='${CMP-cmp}' ;;
*) prog=diff; cmp='${DIFF-diff}';;
esac
-cmp0=$cmp
version="z$prog (gzip) @VERSION@
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly."
-usage="Usage: z$prog [OPTION]... FILE1 [FILE2]
+usage="Usage: $0 [OPTION]... FILE1 [FILE2]
Compare FILE1 to FILE2, using their uncompressed contents if they are
compressed. If FILE2 is omitted, compare FILE1 to the uncompressed
contents of FILE1.gz. Do comparisons like '$prog' does.
@@ -33,16 +43,23 @@ OPTIONs are the same as for '$prog'.
Report bugs to <bug-gzip@gnu.org>."
-FILES=
+# sed script to escape all ' for the shell, and then (to handle trailing
+# newlines correctly) turn trailing X on last line into '.
+escape='
+ s/'\''/'\''\\'\'''\''/g
+ $s/X$/'\''/
+'
+
while :; do
case $1 in
- --h*) echo "$usage" || exit 2; exit;;
+ --h*) printf '%s\n' "$usage" || exit 2; exit;;
--v*) echo "$version" || exit 2; exit;;
--) shift; break;;
- -*\'*) echo >&2 "$prog: $1: option contains apostrophe"; exit 2;;
- -?*) cmp="$cmp '$1'"; shift;;
+ -*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
+ -?*) cmp="$cmp '$1'";;
*) break;;
esac
+ shift
done
cmp="$cmp --"
@@ -51,13 +68,19 @@ do
test "X$file" = X- || <"$file" || exit 2
done
+gzip_status=0
+exec 3>&1
+
if test $# -eq 1; then
case $1 in
*[-.]gz* | *[-.][zZ] | *.t[ga]z)
FILE=`expr "X$1" : 'X\(.*\)[-.][zZtga]*$'`
- gzip -cd -- "$1" | eval "$cmp" - '"$FILE"';;
+ gzip_status=$(
+ exec 4>&1
+ (gzip -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
+ );;
*)
- echo >&2 "$prog: $1: unknown compressed file extension"
+ echo >&2 "$0: $1: unknown compressed file extension"
exit 2;;
esac
elif test $# -eq 2; then
@@ -66,16 +89,27 @@ elif test $# -eq 2; then
case "$2" in
*[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
if test "$1$2" = --; then
- gzip -cdfq - | eval "$cmp" - -
+ gzip_status=$(
+ exec 4>&1
+ (gzip -cdfq - 4>&-; echo $? >&4) 3>&- |
+ eval "$cmp" - - >&3
+ )
elif
# Reject Solaris 8's buggy /bin/bash 2.03.
echo X |
- (echo X | eval "$cmp0" /dev/fd/3 - >/dev/null 2>&1) \
- 3<&0
+ (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) \
+ 5<&0
then
- gzip -cdfq -- "$1" |
- (gzip -cdfq -- "$2" |
- eval "$cmp" /dev/fd/3 -) 3<&0
+ gzip_status=$(
+ exec 4>&1
+ (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
+ ((gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
+ eval "$cmp" /dev/fd/5 -) 5<&0
+ )
+ case $gzip_status in
+ *[1-9]*) gzip_status=1;;
+ *) gzip_status=0;;
+ esac
else
F=`expr "/$2" : '.*/\(.*\)[-.][zZtga]*$'` || F=$prog
tmp=
@@ -84,27 +118,44 @@ elif test $# -eq 2; then
(exit 2); exit 2
' HUP INT PIPE TERM 0
if type mktemp >/dev/null 2>&1; then
- tmp=`mktemp -t -- "$F.XXXXXX"` || exit
+ tmp=`mktemp -t -- "$F.XXXXXX"` || exit 2
else
set -C
tmp=${TMPDIR-/tmp}/$F.$$
fi
- gzip -cdfq -- "$2" > "$tmp" || exit
- gzip -cdfq -- "$1" | eval "$cmp" - '"$tmp"'
- STAT="$?"
- rm -f "$tmp" || STAT=2
+ gzip -cdfq -- "$2" > "$tmp" || exit 2
+ gzip_status=$(
+ exec 4>&1
+ (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
+ eval "$cmp" - '"$tmp"' >&3
+ )
+ cmp_status=$?
+ rm -f "$tmp" || gzip_status=$?
trap - HUP INT PIPE TERM 0
- exit $STAT
+ (exit $cmp_status)
fi;;
- *) gzip -cdfq -- "$1" | eval "$cmp" - '"$2"';;
+ *)
+ gzip_status=$(
+ exec 4>&1
+ (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
+ eval "$cmp" - '"$2"' >&3
+ );;
esac;;
*) case "$2" in
*[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
- gzip -cdfq -- "$2" | eval "$cmp" '"$1"' -;;
+ gzip_status=$(
+ exec 4>&1
+ (gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- |
+ eval "$cmp" '"$1"' - >&3
+ );;
*) eval "$cmp" '"$1"' '"$2"';;
esac;;
esac
else
- echo >&2 "$usage"
+ echo >&2 "$0: invalid number of operands; try \`$0 --help' for help"
exit 2
fi
+
+cmp_status=$?
+test "$gzip_status" -eq 0 || exit 2
+exit $cmp_status
diff --git a/zegrep.in b/zegrep.in
new file mode 100644
index 0000000..620b8cb
--- /dev/null
+++ b/zegrep.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+PATH=BINDIR:$PATH
+exec zgrep -E "$@"
diff --git a/zfgrep.in b/zfgrep.in
new file mode 100644
index 0000000..7962364
--- /dev/null
+++ b/zfgrep.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+PATH=BINDIR:$PATH
+exec zgrep -F "$@"
diff --git a/zforce.in b/zforce.in
index 58a3489..b1a995e 100644
--- a/zforce.in
+++ b/zforce.in
@@ -6,7 +6,7 @@
# 12345678901234 is renamed to 12345678901.gz
-# Copyright (C) 2002 Free Software Foundation
+# Copyright (C) 2002, 2007 Free Software Foundation
# Copyright (C) 1993 Jean-loup Gailly
# This program is free software; you can redistribute it and/or modify
@@ -26,14 +26,14 @@
PATH="BINDIR:$PATH"; export PATH
version="zforce (gzip) @VERSION@
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly."
-usage="Usage: zforce [FILE]...
+usage="Usage: $0 [FILE]...
Force a .gz extension on all compressed FILEs so that gzip will
not compress them twice.
diff --git a/zgrep.1 b/zgrep.1
index a52a88a..ef37bd8 100644
--- a/zgrep.1
+++ b/zgrep.1
@@ -7,38 +7,23 @@ zgrep \- search possibly compressed files for a regular expression
.BI [\ -e\ ] " pattern"
.IR filename ".\|.\|."
.SH DESCRIPTION
-.IR Zgrep
-is used to invoke the
+.I Zgrep
+invokes
.I grep
-on compress'ed or gzip'ed files. All options specified are passed directly to
-.I grep.
+on compressed or gzipped files.
+All options specified are passed directly to
+.IR grep .
If no file is specified, then the standard input is decompressed
if necessary and fed to grep.
Otherwise the given files are uncompressed if necessary and fed to
-.I grep.
+.IR grep .
.PP
-If
-.I zgrep
-is invoked as
-.I zegrep
-or
-.I zfgrep
-then
-.I egrep
-or
-.I fgrep
-is used instead of
-.I grep.
If the GREP environment variable is set,
.I zgrep
uses it as the
.I grep
-program to be invoked. For example:
-
- for sh: GREP=fgrep zgrep string files
- for csh: (setenv GREP fgrep; zgrep string files)
+program to be invoked.
.SH AUTHOR
Charles Levert (charles@comm.polymtl.ca)
.SH "SEE ALSO"
-grep(1), egrep(1), fgrep(1), zdiff(1), zmore(1), znew(1), zforce(1),
-gzip(1), gzexe(1)
+grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)
diff --git a/zgrep.in b/zgrep.in
index b787b01..8350d92 100644
--- a/zgrep.in
+++ b/zgrep.in
@@ -3,7 +3,7 @@
# zgrep -- a wrapper around a grep program that decompresses files as needed
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
-# Copyright (C) 1998, 2001, 2002, 2006 Free Software Foundation
+# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
# Copyright (C) 1993 Jean-loup Gailly
# This program is free software; you can redistribute it and/or modify
@@ -20,27 +20,22 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-PATH="BINDIR:$PATH"; export PATH
+PATH=BINDIR:$PATH
+grep='${GREP-grep}'
-case "$0" in
-(*egrep) grep='${EGREP-egrep}' ;;
-(*fgrep) grep='${FGREP-fgrep}' ;;
-(*) grep='${GREP-grep}' ;;
-esac
-
-eval 'version="z'"$grep"' (gzip) @VERSION@
-Copyright (C) 2006 Free Software Foundation, Inc.
+version='zgrep (gzip) @VERSION@
+Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
-Written by Jean-loup Gailly."'
+Written by Jean-loup Gailly.'
-usage="Usage: z$grep [OPTION]... [-e] PATTERN [FILE]...
+usage="Usage: $0 [OPTION]... [-e] PATTERN [FILE]...
Look for instances of PATTERN in the input FILEs, using their
uncompressed contents if they are compressed.
-OPTIONs are the same as for '$grep'.
+OPTIONs are the same as for 'grep'.
Report bugs to <bug-gzip@gnu.org>."
@@ -70,7 +65,6 @@ while test $# -ne 0; do
(--binary-*=* | --[lm]a*=* | --reg*=*)
;;
(-[ABCDefm] | --binary-* | --file | --[lm]a* | --reg*)
- have_optarg=1
case ${1?"$option option requires an argument"} in
(*\'*)
optarg=" '"$(printf '%sX\n' "$1" | sed "$escape");;
diff --git a/zless.1 b/zless.1
index c73c69a..28ca839 100644
--- a/zless.1
+++ b/zless.1
@@ -8,7 +8,9 @@ zless \- file perusal filter for crt viewing of compressed text
.I Zless
is a filter which allows examination of compressed or plain text files
one screenful at a time on a soft-copy terminal. It is the equivalent of
-setting the environment variable LESSOPEN to "|gzip -cdfq -- %s",
+setting the environment variable LESSOPEN to '|gzip -cdfq -- %s',
+and the environment variable LESSMETACHARS to
+'<space><tab><newline>;*?"()<>[|&^`#\$%=~',
and then running
.IR less .
However, enough people seem to think that having the
diff --git a/zless.in b/zless.in
index 974891a..52352cb 100644
--- a/zless.in
+++ b/zless.in
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 1998, 2002, 2006 Free Software Foundation
+# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
# 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
@@ -19,14 +19,14 @@
PATH="BINDIR:$PATH"; export PATH
version="zless (gzip) @VERSION@
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Eggert."
-usage="Usage: zless [OPTION]... [FILE]...
+usage="Usage: $0 [OPTION]... [FILE]...
Like 'less', but operate on the uncompressed contents of any compressed FILEs.
Options are the same as for 'less'.
diff --git a/zmore.in b/zmore.in
index 82bc70f..8ed26ae 100644
--- a/zmore.in
+++ b/zmore.in
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2001, 2002 Free Software Foundation
+# Copyright (C) 2001, 2002, 2007 Free Software Foundation
# Copyright (C) 1992, 1993 Jean-loup Gailly
# This program is free software; you can redistribute it and/or modify
@@ -20,14 +20,14 @@
PATH="BINDIR:$PATH"; export PATH
version="zmore (gzip) @VERSION@
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly."
-usage="Usage: zmore [OPTION]... [FILE]...
+usage="Usage: $0 [OPTION]... [FILE]...
Like 'more', but operate on the uncompressed contents of any compressed FILEs.
Report bugs to <bug-gzip@gnu.org>."
diff --git a/znew.in b/znew.in
index 986ffc7..503521c 100644
--- a/znew.in
+++ b/znew.in
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 1998, 2002, 2004 Free Software Foundation
+# Copyright (C) 1998, 2002, 2004, 2007 Free Software Foundation
# Copyright (C) 1993 Jean-loup Gailly
# This program is free software; you can redistribute it and/or modify
@@ -20,14 +20,14 @@
PATH="BINDIR:$PATH"; export PATH
version="znew (gzip) @VERSION@
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly."
-usage="Usage: znew [OPTION]... [FILE]...
+usage="Usage: $0 [OPTION]... [FILE]...
Recompress files from .Z (compress) format to .gz (gzip) format.
Options: