|
|
echo "Usage: $prog [${comp}_options] file [file]" | echo "Usage: $prog [${comp}_options] file [file]" |
exit 2 | exit 2 |
fi | fi |
|
tmp=`tempfile -d /tmp -p gz` || { |
|
echo 'cannot create a temporary file' >&2 |
|
exit 1 |
|
} |
set $FILES | set $FILES |
if test $# -eq 1; then | if test $# -eq 1; then |
FILE=`echo "$1" | sed 's/[-.][zZtga]*$//'` | FILE=`echo "$1" | sed 's/[-.][zZtga]*$//'` |
|
|
*[-.]gz* | *[-.][zZ] | *.t[ga]z) | *[-.]gz* | *[-.][zZ] | *.t[ga]z) |
F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'` | F=`echo "$2" | sed 's|.*/||;s|[-.][zZtga]*||'` |
set -C | set -C |
trap 'rm -f /tmp/"$F".$$; exit 2' HUP INT PIPE TERM 0 |
trap 'rm -f $tmp; exit 2' HUP INT PIPE TERM 0 |
gzip -cdfq "$2" > /tmp/"$F".$$ || exit |
gzip -cdfq "$2" > $tmp || exit |
gzip -cdfq "$1" | $comp $OPTIONS - /tmp/"$F".$$ |
gzip -cdfq "$1" | $comp $OPTIONS - $tmp |
STAT="$?" | STAT="$?" |
/bin/rm -f /tmp/"$F".$$ || STAT=2 |
/bin/rm -f $tmp || STAT=2 |
trap - HUP INT PIPE TERM 0 | trap - HUP INT PIPE TERM 0 |
exit $STAT;; | exit $STAT;; |
| |