diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2011-03-19 13:08:22 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2011-03-19 13:08:22 +0200 |
commit | 4eb83e32046a6d670862bc91c3d82530963b455e (patch) | |
tree | 27bf7f51bab90921187310dba4eac464bbee9e0f /src/scripts/xzdiff.in | |
parent | xz: Add --block-size=SIZE. (diff) | |
download | xz-4eb83e32046a6d670862bc91c3d82530963b455e.tar.xz |
Scripts: Add lzop (.lzo) support to xzdiff and xzgrep.
Diffstat (limited to 'src/scripts/xzdiff.in')
-rw-r--r-- | src/scripts/xzdiff.in | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in index 45633e0a..0fa446f6 100644 --- a/src/scripts/xzdiff.in +++ b/src/scripts/xzdiff.in @@ -19,10 +19,10 @@ # Instead of unsetting XZ_OPT, just make sure that xz will use file format # autodetection. This way memory usage limit and thread limit can be -# specified via XZ_OPT. With gzip and bzip2 it's OK to just unset the +# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the # environment variables. xz='@xz@ --format=auto' -unset GZIP BZIP BZIP2 +unset GZIP BZIP BZIP2 LZOP case ${0##*/} in *cmp*) prog=xzcmp; cmp=${CMP:-cmp};; @@ -77,17 +77,21 @@ if test $# -eq 1; then xz1=bzip2;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;; + *[-.]lzo | *.tzo) + xz1=lzop;; *) echo >&2 "$0: $1: Unknown compressed file name suffix" exit 2;; esac case $1 in - *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma) - FILE=`expr "X$1" : 'X\(.*\)[-.][abglmxzZ2]*$'`;; + *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lzo) + FILE=`expr "X$1" : 'X\(.*\)[-.][abglmoxzZ2]*$'`;; *.t[abglx]z) FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;; *.tbz2) FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;; + *.tzo) + FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;; esac xz_status=$( exec 4>&1 @@ -97,15 +101,17 @@ elif test $# -eq 2; then case $1 in *[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;; + *[-.]lzo | *.tzo) xz1=lzop;; esac case $2 in *[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;; + *[-.]lzo | *.tzo) xz2=lzop;; esac case $1 in - *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | -) + *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | -) case "$2" in - *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | -) + *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | -) if test "$1$2" = --; then xz_status=$( exec 4>&1 @@ -125,7 +131,7 @@ elif test $# -eq 2; then *) xz_status=0;; esac else - F=`expr "/$2" : '.*/\(.*\)[-.][ablmtxz2]*$'` || F=$prog + F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog tmp= trap ' test -n "$tmp" && rm -f "$tmp" @@ -152,7 +158,7 @@ elif test $# -eq 2; then esac;; *) case "$2" in - *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | -) + *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | -) xz_status=$( exec 4>&1 ($xz2 -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- | |