From c9eeee0968c583182eb5027538002b1bae627ff6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 26 Sep 2002 08:33:24 +0000 Subject: [PATCH] gzip 1.3.5 --- zdiff.in | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/zdiff.in b/zdiff.in index 110454c..8190192 100644 --- a/zdiff.in +++ b/zdiff.in @@ -27,19 +27,18 @@ do FILES="$FILES $ARG" else echo "${prog}: $ARG not found or not a regular file" - exit 1 + exit 2 fi ;; esac done if test -z "$FILES"; then echo "Usage: $prog [${comp}_options] file [file]" - exit 1 + exit 2 fi set $FILES if test $# -eq 1; then FILE=`echo "$1" | sed 's/[-.][zZtga]*$//'` gzip -cd "$1" | $comp $OPTIONS - "$FILE" - STAT="$?" elif test $# -eq 2; then case "$1" in @@ -47,24 +46,24 @@ elif test $# -eq 2; then case "$2" in *[-.]gz* | *[-.][zZ] | *.t[ga]z) F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'` - gzip -cdfq "$2" > /tmp/"$F".$$ + set -C + trap 'rm -f /tmp/"$F".$$; exit 2' HUP INT PIPE TERM 0 + gzip -cdfq "$2" > /tmp/"$F".$$ || exit gzip -cdfq "$1" | $comp $OPTIONS - /tmp/"$F".$$ STAT="$?" - /bin/rm -f /tmp/"$F".$$;; + /bin/rm -f /tmp/"$F".$$ || STAT=2 + trap - HUP INT PIPE TERM 0 + exit $STAT;; - *) gzip -cdfq "$1" | $comp $OPTIONS - "$2" - STAT="$?";; + *) gzip -cdfq "$1" | $comp $OPTIONS - "$2";; esac;; *) case "$2" in *[-.]gz* | *[-.][zZ] | *.t[ga]z) - gzip -cdfq "$2" | $comp $OPTIONS "$1" - - STAT="$?";; - *) $comp $OPTIONS "$1" "$2" - STAT="$?";; + gzip -cdfq "$2" | $comp $OPTIONS "$1" -;; + *) $comp $OPTIONS "$1" "$2";; esac;; esac - exit "$STAT" else echo "Usage: $prog [${comp}_options] file [file]" - exit 1 + exit 2 fi -- 2.47.2