3 # sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
5 # Zcmp and zdiff are used to invoke the cmp or the diff pro-
6 # gram on compressed files. All options specified are passed
7 # directly to cmp or diff. If only 1 file is specified, then
8 # the files compared are file1 and an uncompressed file1.gz.
9 # If two files are specified, then they are uncompressed (if
10 # necessary) and fed to cmp or diff. The exit status from cmp
11 # or diff is preserved.
13 PATH="BINDIR:$PATH"; export PATH
15 *cmp) prog=cmp ; comp=${CMP-cmp} ;;
16 *) prog=diff; comp=${DIFF-diff} ;;
19 version="z$prog (gzip) @VERSION@
20 Copyright (C) 2006 Free Software Foundation, Inc.
21 This is free software. You may redistribute copies of it under the terms of
22 the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
23 There is NO WARRANTY, to the extent permitted by law.
25 Written by Jean-loup Gailly."
27 usage="Usage: z$prog [OPTION]... FILE1 [FILE2]
28 Compare FILE1 to FILE2, using their uncompressed contents if they are
29 compressed. If FILE2 is omitted, compare FILE1 to the uncompressed
30 contents of FILE1.gz. Do comparisons like '$prog' does.
32 OPTIONs are the same as for '$prog'.
34 Report bugs to <bug-gzip@gnu.org>."
40 --h*) echo "$usage" || exit 2; exit;;
41 --v*) echo "$version" || exit 2; exit;;
43 -*) OPTIONS="$OPTIONS $ARG"; shift;;
48 echo "$prog: $file not found or not a regular file"
52 if test $# -eq 1; then
53 FILE=`echo "$1" | sed 's/[-.][zZtga]*$//'`
54 gzip -cd -- "$1" | $comp $OPTIONS - "$FILE"
56 elif test $# -eq 2; then
58 *[-.]gz* | *[-.][zZ] | *.t[ga]z)
60 *[-.]gz* | *[-.][zZ] | *.t[ga]z)
61 F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'`
63 trap 'rm -f /tmp/"$F".$$; exit 2' HUP INT PIPE TERM 0
64 gzip -cdfq -- "$2" > /tmp/"$F".$$ || exit
65 gzip -cdfq -- "$1" | $comp $OPTIONS - /tmp/"$F".$$
67 /bin/rm -f /tmp/"$F".$$ || STAT=2
68 trap - HUP INT PIPE TERM 0
71 *) gzip -cdfq -- "$1" | $comp $OPTIONS - "$2";;
74 *[-.]gz* | *[-.][zZ] | *.t[ga]z)
75 gzip -cdfq -- "$2" | $comp $OPTIONS "$1" -;;
76 *) $comp $OPTIONS "$1" "$2";;