Skip to content
Snippets Groups Projects
Commit 119d3ce1d749 authored by Lasse Collin's avatar Lasse Collin
Browse files

Scripts: Add zstd support to xzdiff.

parent 3cb6bcc5ecde
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.\" .\"
.\" License: GNU GPLv2+ .\" License: GNU GPLv2+
.\" .\"
.TH XZDIFF 1 "2011-03-19" "Tukaani" "XZ Utils" .TH XZDIFF 1 "2021-01-11" "Tukaani" "XZ Utils"
.SH NAME .SH NAME
xzcmp, xzdiff, lzcmp, lzdiff \- compare compressed files xzcmp, xzdiff, lzcmp, lzdiff \- compare compressed files
.SH SYNOPSIS .SH SYNOPSIS
...@@ -34,4 +34,5 @@ ...@@ -34,4 +34,5 @@
.BR lzma (1), .BR lzma (1),
.BR gzip (1), .BR gzip (1),
.BR bzip2 (1), .BR bzip2 (1),
.BR lzop (1),
or or
...@@ -37,5 +38,5 @@ ...@@ -37,5 +38,5 @@
or or
.BR lzop (1). .BR zstd (1).
All options specified are passed directly to All options specified are passed directly to
.BR cmp (1) .BR cmp (1)
or or
...@@ -68,6 +69,7 @@ ...@@ -68,6 +69,7 @@
.BR gzip (1), .BR gzip (1),
.BR bzip2 (1), .BR bzip2 (1),
.BR lzop (1), .BR lzop (1),
.BR zstd (1),
.BR zdiff (1) .BR zdiff (1)
.SH BUGS .SH BUGS
Messages from the Messages from the
......
...@@ -80,8 +80,10 @@ ...@@ -80,8 +80,10 @@
xz1=gzip;; xz1=gzip;;
*[-.]lzo | *.tzo) *[-.]lzo | *.tzo)
xz1=lzop;; xz1=lzop;;
*[-.]zst | *.tzst)
xz1='zstd -q';;
*) *)
echo >&2 "$0: $1: Unknown compressed file name suffix" echo >&2 "$0: $1: Unknown compressed file name suffix"
exit 2;; exit 2;;
esac esac
case $1 in case $1 in
...@@ -83,13 +85,13 @@ ...@@ -83,13 +85,13 @@
*) *)
echo >&2 "$0: $1: Unknown compressed file name suffix" echo >&2 "$0: $1: Unknown compressed file name suffix"
exit 2;; exit 2;;
esac esac
case $1 in case $1 in
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lzo) *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lzo | *[-.]zst)
FILE=`expr "X$1" : 'X\(.*\)[-.][abglmoxzZ2]*$'`;; FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ2]*$'`;;
*.t[abglx]z) *.t[abglx]z)
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;; FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
*.tbz2) *.tbz2)
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;; FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
*.tzo) *.tzo)
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;; FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
...@@ -90,9 +92,11 @@ ...@@ -90,9 +92,11 @@
*.t[abglx]z) *.t[abglx]z)
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;; FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
*.tbz2) *.tbz2)
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;; FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
*.tzo) *.tzo)
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;; FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
*.tzst)
FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;;
esac esac
xz_status=$( xz_status=$(
exec 4>&1 exec 4>&1
...@@ -103,8 +107,9 @@ ...@@ -103,8 +107,9 @@
*[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;; *[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;;
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
*[-.]lzo | *.tzo) xz1=lzop;; *[-.]lzo | *.tzo) xz1=lzop;;
*[-.]zst | *.tzst) xz1='zstd -q';;
esac esac
case $2 in case $2 in
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;; *[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
*[-.]lzo | *.tzo) xz2=lzop;; *[-.]lzo | *.tzo) xz2=lzop;;
...@@ -106,7 +111,8 @@ ...@@ -106,7 +111,8 @@
esac esac
case $2 in case $2 in
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;; *[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
*[-.]lzo | *.tzo) xz2=lzop;; *[-.]lzo | *.tzo) xz2=lzop;;
*[-.]zst | *.tzst) xz2='zstd -q';;
esac esac
case $1 in case $1 in
...@@ -111,4 +117,4 @@ ...@@ -111,4 +117,4 @@
esac esac
case $1 in case $1 in
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | -) *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
case "$2" in case "$2" in
...@@ -114,5 +120,5 @@ ...@@ -114,5 +120,5 @@
case "$2" in case "$2" in
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | -) *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
if test "$1$2" = --; then if test "$1$2" = --; then
xz_status=$( xz_status=$(
exec 4>&1 exec 4>&1
...@@ -176,7 +182,7 @@ ...@@ -176,7 +182,7 @@
esac;; esac;;
*) *)
case "$2" in case "$2" in
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | -) *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
xz_status=$( xz_status=$(
exec 4>&1 exec 4>&1
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- | ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment