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
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