summaryrefslogtreecommitdiffstats
path: root/zdiff.in
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 16:11:02 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 16:11:02 +0000
commit4e47773f0570bdffefd062b85265242f9f13ef96 (patch)
tree815a38d504a9005ddd7f548c0067a43172f05a02 /zdiff.in
parentAdding upstream version 0.3. (diff)
downloadzutils-4e47773f0570bdffefd062b85265242f9f13ef96.tar.xz
zutils-4e47773f0570bdffefd062b85265242f9f13ef96.zip
Adding upstream version 0.4.upstream/0.4
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r--zdiff.in58
1 files changed, 28 insertions, 30 deletions
diff --git a/zdiff.in b/zdiff.in
index 21c3fbd..9ac0a58 100644
--- a/zdiff.in
+++ b/zdiff.in
@@ -95,24 +95,15 @@ fi
if [ -z "${file2}" ]; then
case "${file1}" in
- *.gz)
- file2=`printf "%s" "${file1}" | sed 's/.gz$//'` ;;
- *.tgz)
- file2=`printf "%s" "${file1}" | sed 's/tgz$/tar/'` ;;
- *.bz2)
- file2=`printf "%s" "${file1}" | sed 's/.bz2$//'` ;;
- *.tbz)
- file2=`printf "%s" "${file1}" | sed 's/tbz$/tar/'` ;;
- *.tbz2)
- file2=`printf "%s" "${file1}" | sed 's/tbz2$/tar/'` ;;
- *.lz)
- file2=`printf "%s" "${file1}" | sed 's/.lz$//'` ;;
- *.tlz)
- file2=`printf "%s" "${file1}" | sed 's/tlz$/tar/'` ;;
- *.xz)
- file2=`printf "%s" "${file1}" | sed 's/.xz$//'` ;;
- *.txz)
- file2=`printf "%s" "${file1}" | sed 's/txz$/tar/'` ;;
+ *.gz) file2=`printf "%s" "${file1}" | sed -e 's,.gz$,,'` ;;
+ *.tgz) file2=`printf "%s" "${file1}" | sed -e 's,tgz$,tar,'` ;;
+ *.bz2) file2=`printf "%s" "${file1}" | sed -e 's,.bz2$,,'` ;;
+ *.tbz) file2=`printf "%s" "${file1}" | sed -e 's,tbz$,tar,'` ;;
+ *.tbz2) file2=`printf "%s" "${file1}" | sed -e 's,tbz2$,tar,'` ;;
+ *.lz) file2=`printf "%s" "${file1}" | sed -e 's,.lz$,,'` ;;
+ *.tlz) file2=`printf "%s" "${file1}" | sed -e 's,tlz$,tar,'` ;;
+ *.xz) file2=`printf "%s" "${file1}" | sed -e 's,.xz$,,'` ;;
+ *.txz) file2=`printf "%s" "${file1}" | sed -e 's,txz$,tar,'` ;;
*)
if [ -f "${file1}.gz" ]; then file2="${file1}.gz"
elif [ -f "${file1}.bz2" ]; then file2="${file1}.bz2"
@@ -127,18 +118,25 @@ fi
prog1=
prog2=
-case "${file1}" in
-*.gz | *.tgz) prog1=gzip ;;
-*.bz2 | *.tbz | *.tbz2) prog1=bzip2 ;;
-*.lz | *.tlz) prog1=lzip ;;
-*.xz | *.txz) prog1=xz ;;
-esac
-case "${file2}" in
-*.gz | *.tgz) prog2=gzip ;;
-*.bz2 | *.tbz | *.tbz2) prog2=bzip2 ;;
-*.lz | *.tlz) prog2=lzip ;;
-*.xz | *.txz) prog2=xz ;;
-esac
+bindir=`echo "$0" | sed -e 's,[^/]*$,,'`
+if [ -f "${file1}" ]; then
+ prog_name=`"${bindir}"zutils -t -- "${file1}"`
+ case "${prog_name}" in
+ gzip) prog1=gzip ;;
+ bzip2) prog1=bzip2 ;;
+ lzip) prog1=lzip ;;
+ xz) prog1=xz ;;
+ esac
+fi
+if [ -f "${file2}" ]; then
+ prog_name=`"${bindir}"zutils -t -- "${file2}"`
+ case "${prog_name}" in
+ gzip) prog2=gzip ;;
+ bzip2) prog2=bzip2 ;;
+ lzip) prog2=lzip ;;
+ xz) prog2=xz ;;
+ esac
+fi
retval=0
if [ -n "${prog1}" ]; then