esac
version="z$prog (gzip) @VERSION@
-Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
exec 3>&1
if test $# -eq 1; then
- case $1 in
- *[-.]gz* | *[-.][zZ] | *.t[ga]z)
+ type_file=$(file -b --mime-type "$1")
+
+ case $type_file in
+ application/x-gzip | application/x-compress)
FILE=`expr "X$1" : 'X\(.*\)[-.][zZtga]*$'`
+ if test "$FILE" == ""; then
+ FILE="$1"
+ fi;
+
gzip_status=$(
exec 4>&1
(gzip -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
exit 2;;
esac
elif test $# -eq 2; then
- case "$1" in
- *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
- case "$2" in
- *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
+ type_file1=$(file -b --mime-type "$1")
+ type_file2=$(file -b --mime-type "$2")
+
+ case "$type_file1" in
+ application/x-gzip | application/x-compress)
+ case "$type_file2" in
+ application/x-gzip | application/x-compress)
if test "$1$2" = --; then
gzip_status=$(
exec 4>&1
(exit $cmp_status)
else
F=`expr "/$2" : '.*/\(.*\)[-.][zZtga]*$'` || F=$prog
+ if test "$F" == ""; then
+ F="$2"
+ fi;
tmp=
trap '
test -n "$tmp" && rm -f "$tmp"
eval "$cmp" - '"$2"' >&3
);;
esac;;
- *) case "$2" in
- *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
+ *) case "$type_file2" in
+ application/x-gzip | application/x-compress)
gzip_status=$(
exec 4>&1
(gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- |