aboutsummaryrefslogtreecommitdiff
path: root/src/scripts/xzdiff.in
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2024-02-13 17:00:17 +0200
committerLasse Collin <lasse.collin@tukaani.org>2024-02-14 18:31:16 +0200
commit109f1913d4824c8214d5bbd38ebebf62c37572da (patch)
tree2fccdb7a3e79699118d9d1c938c096ded8718ec3 /src/scripts/xzdiff.in
parentliblzma: Choose the range decoder variants using a bitmask macro. (diff)
downloadxz-109f1913d4824c8214d5bbd38ebebf62c37572da.tar.xz
Scripts: Add lz4 support to xzgrep and xzdiff.
Diffstat (limited to '')
-rw-r--r--src/scripts/xzdiff.in14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in
index 40a1fd33..ee5726e8 100644
--- a/src/scripts/xzdiff.in
+++ b/src/scripts/xzdiff.in
@@ -84,13 +84,15 @@ if test $# -eq 1; then
xz1=lzop;;
*[-.]zst | *.tzst)
xz1='zstd -q';;
+ *[-.]lz4)
+ xz1=lz4;;
*)
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
exit 2;;
esac
case $1 in
- *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst)
- FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ2]*$'`;;
+ *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
+ FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;;
*.t[abglx]z)
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
*.tbz2)
@@ -110,17 +112,19 @@ elif test $# -eq 2; then
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
*[-.]lzo | *.tzo) xz1=lzop;;
*[-.]zst | *.tzst) xz1='zstd -q';;
+ *[-.]lz4) xz1=lz4;;
esac
case $2 in
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
*[-.]lzo | *.tzo) xz2=lzop;;
*[-.]zst | *.tzst) xz2='zstd -q';;
+ *[-.]lz4) xz2=lz4;;
esac
case $1 in
- *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
+ *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
case "$2" in
- *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
+ *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
if test "$1$2" = --; then
xz_status=$(
exec 4>&1
@@ -184,7 +188,7 @@ elif test $# -eq 2; then
esac;;
*)
case "$2" in
- *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
+ *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
xz_status=$(
exec 4>&1
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |