1 diff --git a/zdiff.in b/zdiff.in
2 index 9d3b4ae..506a888 100644
5 @@ -76,9 +76,15 @@ gzip_status=0
10 - *[-.]gz* | *[-.][zZ] | *.t[ga]z)
11 + type_file=$(file -b --mime-type "$1")
14 + application/x-gzip | application/x-compress)
15 FILE=`expr "X$1" : 'X\(.*\)[-.][zZtga]*$'`
16 + if test "$FILE" == ""; then
22 (gzip -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
23 @@ -88,10 +94,13 @@ if test $# -eq 1; then
26 elif test $# -eq 2; then
28 - *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
30 - *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
31 + type_file1=$(file -b --mime-type "$1")
32 + type_file2=$(file -b --mime-type "$2")
34 + case "$type_file1" in
35 + application/x-gzip | application/x-compress)
36 + case "$type_file2" in
37 + application/x-gzip | application/x-compress)
38 if test "$1$2" = --; then
41 @@ -118,6 +127,9 @@ elif test $# -eq 2; then
44 F=`expr "/$2" : '.*/\(.*\)[-.][zZtga]*$'` || F=$prog
45 + if test "$F" == ""; then
50 test -n "$tmp" && rm -f "$tmp"
51 @@ -147,8 +159,8 @@ elif test $# -eq 2; then
52 eval "$cmp" - '"$2"' >&3
56 - *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
57 + *) case "$type_file2" in
58 + application/x-gzip | application/x-compress)
61 (gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- |