Scripts: Add lzop (.lzo) support to xzdiff and xzgrep.
This commit is contained in:
parent
923b22483b
commit
4eb83e3204
|
@ -6,7 +6,7 @@
|
|||
.\"
|
||||
.\" License: GNU GPLv2+
|
||||
.\"
|
||||
.TH XZDIFF 1 "2010-09-27" "Tukaani" "XZ Utils"
|
||||
.TH XZDIFF 1 "2011-03-19" "Tukaani" "XZ Utils"
|
||||
.SH NAME
|
||||
xzcmp, xzdiff, lzcmp, lzdiff \- compare compressed files
|
||||
.SH SYNOPSIS
|
||||
|
@ -33,8 +33,9 @@ on files compressed with
|
|||
.BR xz (1),
|
||||
.BR lzma (1),
|
||||
.BR gzip (1),
|
||||
.BR bzip2 (1),
|
||||
or
|
||||
.BR bzip2 (1).
|
||||
.BR lzop (1).
|
||||
All options specified are passed directly to
|
||||
.BR cmp (1)
|
||||
or
|
||||
|
@ -66,6 +67,7 @@ are provided for backward compatibility with LZMA Utils.
|
|||
.BR xz (1),
|
||||
.BR gzip (1),
|
||||
.BR bzip2 (1),
|
||||
.BR lzop (1),
|
||||
.BR zdiff (1)
|
||||
.SH BUGS
|
||||
Messages from the
|
||||
|
|
|
@ -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>&- |
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
.\"
|
||||
.\" License: GNU GPLv2+
|
||||
.\"
|
||||
.TH XZGREP 1 "2010-09-27" "Tukaani" "XZ Utils"
|
||||
.TH XZGREP 1 "2011-03-19" "Tukaani" "XZ Utils"
|
||||
.SH NAME
|
||||
xzgrep \- search compressed files for a regular expression
|
||||
.SH SYNOPSIS
|
||||
|
@ -40,8 +40,9 @@ which may be either uncompressed or compressed with
|
|||
.BR xz (1),
|
||||
.BR lzma (1),
|
||||
.BR gzip (1),
|
||||
.BR bzip2 (1),
|
||||
or
|
||||
.BR bzip2 (1).
|
||||
.BR lzop (1).
|
||||
All options specified are passed directly to
|
||||
.BR grep (1).
|
||||
.PP
|
||||
|
@ -51,9 +52,10 @@ is specified, then standard input is decompressed if necessary
|
|||
and fed to
|
||||
.BR grep (1).
|
||||
When reading from standard input,
|
||||
.BR gzip (1)
|
||||
.BR gzip (1),
|
||||
.BR bzip2 (1),
|
||||
and
|
||||
.BR bzip2 (1)
|
||||
.BR lzop (1)
|
||||
compressed files are not supported.
|
||||
.PP
|
||||
If
|
||||
|
@ -92,4 +94,5 @@ or
|
|||
.BR xz (1),
|
||||
.BR gzip (1),
|
||||
.BR bzip2 (1),
|
||||
.BR lzop (1),
|
||||
.BR zgrep (1)
|
||||
|
|
|
@ -22,10 +22,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
|
||||
*egrep*) prog=xzegrep; grep=${GREP:-egrep};;
|
||||
|
@ -149,6 +149,7 @@ for i; do
|
|||
case $i in
|
||||
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdfq";;
|
||||
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdfq";;
|
||||
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdfq";;
|
||||
*) uncompress="$xz -cdfq";;
|
||||
esac
|
||||
# Fail if xz or grep (or sed) fails.
|
||||
|
|
Loading…
Reference in New Issue