2 # sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
4 # xzcmp and xzdiff 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.xz.
8 # If two files are specified, then they are uncompressed and
9 # fed to cmp or diff. The exit status from cmp or diff is
12 prog=`echo $0 | sed 's|.*/||'`
14 *cmp) comp=${CMP-cmp} ;;
15 *) comp=${DIFF-diff} ;;
23 -*) OPTIONS="$OPTIONS $ARG";;
24 *) if test -f "$ARG"; then
27 echo "${prog}: $ARG not found or not a regular file"
32 if test -z "$FILES"; then
33 echo "Usage: $prog [${comp}_options] file [file]"
37 if test $# -eq 1; then
38 FILE=`echo "$1" | sed 's/[-.][almtxz]*$//'`
39 xz -dc "$1" | $comp $OPTIONS - "$FILE"
41 elif test $# -eq 2; then
43 *[-.]xz | *.txz | *[-.]lzma | *.tlz)
45 *[-.]xz | *.txz | *[-.]lzma | *.tlz)
46 F=`echo "$2" | sed 's|.*/||;s|[-.][almtxz]*||'`
47 TF=`/usr/bin/mktemp ${TMPDIR:-/tmp}/"$F".XXXXXXXXXX` || exit 1
48 trap 'rm -f "$TF"; exit 2' EXIT HUP INT PIPE TERM
49 xz -dc -- "$2" > "$TF" || exit
50 xz -dc -- "$1" | $comp $OPTIONS - "$TF"
53 trap EXIT HUP INT PIPE TERM
56 *) xz -dc -- "$1" | $comp $OPTIONS - "$2";;
59 *[-.]xz | *.txz | *[-.]lzma | *.tlz)
60 xz -dc -- "$2" | $comp $OPTIONS "$1" -;;
61 *) $comp $OPTIONS "$1" "$2";;
65 echo "Usage: $prog [${comp}_options] file [file]"