annotate src/bzip2-1.0.6/bzdiff @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 8a15ff55d9af
children
rev   line source
cannam@89 1 #!/bin/sh
cannam@89 2 # sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
cannam@89 3
cannam@89 4 # Bzcmp/diff wrapped for bzip2,
cannam@89 5 # adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
cannam@89 6
cannam@89 7 # Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
cannam@89 8 # gram on compressed files. All options specified are passed
cannam@89 9 # directly to cmp or diff. If only 1 file is specified, then
cannam@89 10 # the files compared are file1 and an uncompressed file1.gz.
cannam@89 11 # If two files are specified, then they are uncompressed (if
cannam@89 12 # necessary) and fed to cmp or diff. The exit status from cmp
cannam@89 13 # or diff is preserved.
cannam@89 14
cannam@89 15 PATH="/usr/bin:/bin:$PATH"; export PATH
cannam@89 16 prog=`echo $0 | sed 's|.*/||'`
cannam@89 17 case "$prog" in
cannam@89 18 *cmp) comp=${CMP-cmp} ;;
cannam@89 19 *) comp=${DIFF-diff} ;;
cannam@89 20 esac
cannam@89 21
cannam@89 22 OPTIONS=
cannam@89 23 FILES=
cannam@89 24 for ARG
cannam@89 25 do
cannam@89 26 case "$ARG" in
cannam@89 27 -*) OPTIONS="$OPTIONS $ARG";;
cannam@89 28 *) if test -f "$ARG"; then
cannam@89 29 FILES="$FILES $ARG"
cannam@89 30 else
cannam@89 31 echo "${prog}: $ARG not found or not a regular file"
cannam@89 32 exit 1
cannam@89 33 fi ;;
cannam@89 34 esac
cannam@89 35 done
cannam@89 36 if test -z "$FILES"; then
cannam@89 37 echo "Usage: $prog [${comp}_options] file [file]"
cannam@89 38 exit 1
cannam@89 39 fi
cannam@89 40 tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
cannam@89 41 echo 'cannot create a temporary file' >&2
cannam@89 42 exit 1
cannam@89 43 }
cannam@89 44 set $FILES
cannam@89 45 if test $# -eq 1; then
cannam@89 46 FILE=`echo "$1" | sed 's/.bz2$//'`
cannam@89 47 bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
cannam@89 48 STAT="$?"
cannam@89 49
cannam@89 50 elif test $# -eq 2; then
cannam@89 51 case "$1" in
cannam@89 52 *.bz2)
cannam@89 53 case "$2" in
cannam@89 54 *.bz2)
cannam@89 55 F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
cannam@89 56 bzip2 -cdfq "$2" > $tmp
cannam@89 57 bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp
cannam@89 58 STAT="$?"
cannam@89 59 /bin/rm -f $tmp;;
cannam@89 60
cannam@89 61 *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
cannam@89 62 STAT="$?";;
cannam@89 63 esac;;
cannam@89 64 *) case "$2" in
cannam@89 65 *.bz2)
cannam@89 66 bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
cannam@89 67 STAT="$?";;
cannam@89 68 *) $comp $OPTIONS "$1" "$2"
cannam@89 69 STAT="$?";;
cannam@89 70 esac;;
cannam@89 71 esac
cannam@89 72 exit "$STAT"
cannam@89 73 else
cannam@89 74 echo "Usage: $prog [${comp}_options] file [file]"
cannam@89 75 exit 1
cannam@89 76 fi