2 # sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
4 # Bzcmp/diff wrapped for bzip2,
5 # adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
7 # Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
8 # gram on compressed files. All options specified are passed
9 # directly to cmp or diff. If only 1 file is specified, then
10 # the files compared are file1 and an uncompressed file1.gz.
11 # If two files are specified, then they are uncompressed (if
12 # necessary) and fed to cmp or diff. The exit status from cmp
13 # or diff is preserved.
15 PATH
="/usr/bin:$PATH"; export PATH
16 prog
=`echo $0 | sed 's|.*/||'`
18 *cmp) comp
=${CMP-cmp} ;;
19 *) comp
=${DIFF-diff} ;;
27 -*) OPTIONS
="$OPTIONS $ARG";;
28 *) if test -f "$ARG"; then
31 echo "${prog}: $ARG not found or not a regular file"
36 if test -z "$FILES"; then
37 echo "Usage: $prog [${comp}_options] file [file]"
40 tmp
=`tempfile -d /tmp -p bz` ||
{
41 echo 'cannot create a temporary file' >&2
45 if test $# -eq 1; then
46 FILE
=`echo "$1" | sed 's/.bz2$//'`
47 bzip2 -cd "$FILE.bz2" |
$comp $OPTIONS - "$FILE"
50 elif test $# -eq 2; then
55 F
=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
56 bzip2 -cdfq "$2" > $tmp
57 bzip2 -cdfq "$1" |
$comp $OPTIONS - $tmp
61 *) bzip2 -cdfq "$1" |
$comp $OPTIONS - "$2"
66 bzip2 -cdfq "$2" |
$comp $OPTIONS "$1" -
68 *) $comp $OPTIONS "$1" "$2"
74 echo "Usage: $prog [${comp}_options] file [file]"