diff options
Diffstat (limited to 'zdiff.in')
-rw-r--r-- | zdiff.in | 58 |
1 files changed, 28 insertions, 30 deletions
@@ -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 |