2 # sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
4 # Zcmp and zdiff are used to invoke the cmp or the diff pro-
5 # gram on compressed files. All options specified are passed
6 # directly to cmp or diff. If only 1 file is specified, then
7 # the files compared are file1 and an uncompressed file1.gz.
8 # If two files are specified, then they are uncompressed (if
9 # necessary) and fed to cmp or diff. The exit status from cmp
10 # or diff is preserved.
12 # $FreeBSD: src/gnu/usr.bin/gzip/zdiff,v 1.5.2.1 2002/01/28 01:21:12 nectar Exp $
13 # $DragonFly: src/gnu/usr.bin/gzip/Attic/zdiff,v 1.2 2003/06/17 04:25:46 dillon Exp $
15 prog=`echo $0 | sed 's|.*/||'`
17 *cmp) comp=${CMP-cmp} ;;
18 *) comp=${DIFF-diff} ;;
26 -*) OPTIONS="$OPTIONS $ARG";;
27 *) if test -f "$ARG"; then
30 echo "${prog}: $ARG not found or not a regular file"
35 if test -z "$FILES"; then
36 echo "Usage: $prog [${comp}_options] file [file]"
40 if test $# -eq 1; then
41 FILE=`echo "$1" | sed 's/[-.][zZtga]*$//'`
42 gzip -cd "$1" | $comp $OPTIONS - "$FILE"
45 elif test $# -eq 2; then
47 *[-.]gz* | *[-.][zZ] | *.t[ga]z)
49 *[-.]gz* | *[-.][zZ] | *.t[ga]z)
50 F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'`
52 gzip -cdfq "$2" > "$tmp"
53 gzip -cdfq "$1" | $comp $OPTIONS - "$tmp"
57 *) gzip -cdfq "$1" | $comp $OPTIONS - "$2"
61 *[-.]gz* | *[-.][zZ] | *.t[ga]z)
62 gzip -cdfq "$2" | $comp $OPTIONS "$1" -
64 *) $comp $OPTIONS "$1" "$2"
70 echo "Usage: $prog [${comp}_options] file [file]"