diff options
Diffstat (limited to 'src/scripts')
-rw-r--r-- | src/scripts/Makefile.am | 6 | ||||
-rw-r--r-- | src/scripts/Makefile.in | 7 | ||||
-rw-r--r-- | src/scripts/xzdiff.1 | 95 | ||||
-rw-r--r-- | src/scripts/xzdiff.in | 19 | ||||
-rw-r--r-- | src/scripts/xzgrep.1 | 119 | ||||
-rw-r--r-- | src/scripts/xzgrep.in | 8 | ||||
-rw-r--r-- | src/scripts/xzless.1 | 12 | ||||
-rw-r--r-- | src/scripts/xzless.in | 21 | ||||
-rw-r--r-- | src/scripts/xzmore.1 | 78 | ||||
-rw-r--r-- | src/scripts/xzmore.in | 3 |
10 files changed, 222 insertions, 146 deletions
diff --git a/src/scripts/Makefile.am b/src/scripts/Makefile.am index fe5742d..29c561c 100644 --- a/src/scripts/Makefile.am +++ b/src/scripts/Makefile.am @@ -1,9 +1,5 @@ -## +## SPDX-License-Identifier: 0BSD ## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## nodist_bin_SCRIPTS = xzdiff xzgrep xzmore xzless dist_man_MANS = xzdiff.1 xzgrep.1 xzmore.1 xzless.1 diff --git a/src/scripts/Makefile.in b/src/scripts/Makefile.in index 42dbfff..5cd5dbd 100644 --- a/src/scripts/Makefile.in +++ b/src/scripts/Makefile.in @@ -99,8 +99,8 @@ host_triplet = @host@ subdir = src/scripts ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_capsicum.m4 \ - $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/getopt.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/build-to-host.m4 $(top_srcdir)/m4/getopt.m4 \ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/host-cpu-c-abi.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ @@ -189,7 +189,6 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ -CAPSICUM_LIB = @CAPSICUM_LIB@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ @@ -318,6 +317,8 @@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/src/scripts/xzdiff.1 b/src/scripts/xzdiff.1 index 24fed68..8f473ed 100644 --- a/src/scripts/xzdiff.1 +++ b/src/scripts/xzdiff.1 @@ -1,67 +1,90 @@ +.\" SPDX-License-Identifier: 0BSD .\" -.\" Original zdiff.1 for gzip: Jean-loup Gailly +.\" Authors: Lasse Collin +.\" Jia Tan .\" -.\" Modifications for XZ Utils: Lasse Collin -.\" Andrew Dudman +.\" (Note that this file is not based on gzip's zdiff.1.) .\" -.\" License: GNU GPLv2+ -.\" -.TH XZDIFF 1 "2021-06-04" "Tukaani" "XZ Utils" +.TH XZDIFF 1 "2024-02-13" "Tukaani" "XZ Utils" .SH NAME xzcmp, xzdiff, lzcmp, lzdiff \- compare compressed files +. .SH SYNOPSIS .B xzcmp -.RI [ cmp_options "] " file1 " [" file2 ] +.RI [ option... ] +.I file1 +.RI [ file2 ] .br .B xzdiff -.RI [ diff_options "] " file1 " [" file2 ] +\&... .br .B lzcmp -.RI [ cmp_options "] " file1 " [" file2 ] +\&... .br .B lzdiff -.RI [ diff_options "] " file1 " [" file2 ] +\&... +. .SH DESCRIPTION .B xzcmp and .B xzdiff -invoke +compare uncompressed contents of two files. +Uncompressed data and options are passed to .BR cmp (1) or .BR diff (1) -on files compressed with +unless +.B \-\-help +or +.B \-\-version +is specified. +.PP +If both +.I file1 +and +.I file2 +are specified, they can be uncompressed files or files in formats that .BR xz (1), -.BR lzma (1), .BR gzip (1), .BR bzip2 (1), .BR lzop (1), +.BR zstd (1), or -.BR zstd (1). -All options specified are passed directly to -.BR cmp (1) -or -.BR diff (1). -If only one file is specified, then the files compared are +.BR lz4 (1) +can decompress. +The required decompression commands are determined from +the filename suffixes of .I file1 -(which must have a suffix of a supported compression format) and +and +.IR file2 . +A file with an unknown suffix is assumed to be either uncompressed +or in a format that +.BR xz (1) +can decompress. +.PP +If only one filename is provided, .I file1 -from which the compression format suffix has been stripped. -If two files are specified, -then they are uncompressed if necessary and fed to -.BR cmp (1) -or -.BR diff (1). -The exit status from -.BR cmp (1) -or -.BR diff (1) -is preserved unless a decompression error occurs; then exit status is 2. +must have a suffix of a supported compression format and the name for +.I file2 +is assumed to be +.I file1 +with the compression format suffix removed. .PP -The names +The commands .B lzcmp and .B lzdiff are provided for backward compatibility with LZMA Utils. +. +.SH EXIT STATUS +If a decompression error occurs, the exit status is +.BR 2 . +Otherwise the exit status of +.BR cmp (1) +or +.BR diff (1) +is used. +. .SH "SEE ALSO" .BR cmp (1), .BR diff (1), @@ -70,10 +93,4 @@ are provided for backward compatibility with LZMA Utils. .BR bzip2 (1), .BR lzop (1), .BR zstd (1), -.BR zdiff (1) -.SH BUGS -Messages from the -.BR cmp (1) -or -.BR diff (1) -programs refer to temporary filenames instead of those specified. +.BR lz4 (1) diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in index c17d78b..179218d 100644 --- a/src/scripts/xzdiff.in +++ b/src/scripts/xzdiff.in @@ -1,4 +1,5 @@ #!@POSIX_SHELL@ +# SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation # Copyright (C) 1993 Jean-loup Gailly @@ -30,7 +31,7 @@ case ${0##*/} in *) prog=xzdiff; cmp=${DIFF:-diff};; esac -version="$prog (@PACKAGE_NAME@) @VERSION@" +version="$prog (@PACKAGE_NAME@) @PACKAGE_VERSION@" usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2] Compare FILE1 to FILE2, using their uncompressed contents if they are @@ -83,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) @@ -109,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 @@ -183,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>&- | @@ -194,7 +199,7 @@ elif test $# -eq 2; then esac;; esac else - printf '%s\n' "$0: Invalid number of operands; try \`${0##*/} --help' for help" >&2 + printf '%s\n' "$0: Invalid number of operands; try '${0##*/} --help' for help" >&2 exit 2 fi diff --git a/src/scripts/xzgrep.1 b/src/scripts/xzgrep.1 index e0514b8..63f012c 100644 --- a/src/scripts/xzgrep.1 +++ b/src/scripts/xzgrep.1 @@ -1,19 +1,18 @@ +.\" SPDX-License-Identifier: 0BSD .\" -.\" Original zgrep.1 for gzip: Jean-loup Gailly -.\" Charles Levert <charles@comm.polymtl.ca> +.\" Authors: Lasse Collin +.\" Jia Tan .\" -.\" Modifications for XZ Utils: Lasse Collin +.\" (Note that this file is not based on gzip's zgrep.1.) .\" -.\" License: GNU GPLv2+ -.\" -.TH XZGREP 1 "2022-07-19" "Tukaani" "XZ Utils" +.TH XZGREP 1 "2024-02-13" "Tukaani" "XZ Utils" .SH NAME -xzgrep \- search compressed files for a regular expression +xzgrep \- search possibly-compressed files for patterns +. .SH SYNOPSIS .B xzgrep -.RI [ grep_options ] -.RB [ \-e ] -.I pattern +.RI [ option... ] +.RI [ pattern_list ] .RI [ file... ] .br .B xzegrep @@ -30,54 +29,84 @@ xzgrep \- search compressed files for a regular expression .br .B lzfgrep \&... +. .SH DESCRIPTION .B xzgrep invokes .BR grep (1) -on +on uncompressed contents of files. +The formats of the .I files -which may be either uncompressed or compressed with +are determined from the filename suffixes. +Any +.I file +with a suffix supported by .BR xz (1), -.BR lzma (1), .BR gzip (1), .BR bzip2 (1), .BR lzop (1), +.BR zstd (1), or -.BR zstd (1). -All options specified are passed directly to -.BR grep (1). +.BR lz4 (1) +will be decompressed; +all other files are assumed to be uncompressed. .PP If no +.I files +are specified or .I file -is specified, then standard input is decompressed if necessary -and fed to -.BR grep (1). -When reading from standard input, -.BR gzip (1), -.BR bzip2 (1), -.BR lzop (1), -and -.BR zstd (1) -compressed files are not supported. +is +.B \- +then standard input is read. +When reading from standard input, only files supported by +.BR xz (1) +are decompressed. +Other files are assumed to be in uncompressed form already. +.PP +Most +.I options +of +.BR grep (1) +are supported. +However, the following options are not supported: +.IP "" 4 +.BR \-r , +.B \-\-recursive +.IP "" 4 +.BR \-R , +.B \-\-dereference\-recursive +.IP "" 4 +.BR \-d , +.BI \-\-directories= action +.IP "" 4 +.BR \-Z , +.B \-\-null +.IP "" 4 +.BR \-z , +.B \-\-null\-data +.IP "" 4 +.BI \-\-include= glob +.IP "" 4 +.BI \-\-exclude= glob +.IP "" 4 +.BI \-\-exclude\-from= file +.IP "" 4 +.BI \-\-exclude\-dir= glob .PP -If -.B xzgrep -is invoked as .B xzegrep -or +is an alias for +.BR "xzgrep \-E" . .B xzfgrep -then -.B grep \-E -or -.B grep \-F -is used instead of -.BR grep (1). -The same applies to names +is an alias for +.BR "xzgrep \-F" . +.PP +The commands .BR lzgrep , .BR lzegrep , and -.BR lzfgrep , -which are provided for backward compatibility with LZMA Utils. +.B lzfgrep +are provided for backward compatibility with LZMA Utils. +. .SH EXIT STATUS .TP 0 @@ -91,18 +120,19 @@ No errors occurred. >1 One or more errors occurred. It is unknown if matches were found. +. .SH ENVIRONMENT .TP .B GREP -If the +If .B GREP -environment variable is set, -.B xzgrep -uses it instead of -.BR grep (1), +is set to a non-empty value, +it is used instead of +.BR "grep" , .BR "grep \-E" , or .BR "grep \-F" . +. .SH "SEE ALSO" .BR grep (1), .BR xz (1), @@ -110,4 +140,5 @@ or .BR bzip2 (1), .BR lzop (1), .BR zstd (1), +.BR lz4 (1), .BR zgrep (1) diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in index 490e47d..c9cd02d 100644 --- a/src/scripts/xzgrep.in +++ b/src/scripts/xzgrep.in @@ -1,4 +1,5 @@ #!@POSIX_SHELL@ +# SPDX-License-Identifier: GPL-2.0-or-later # xzgrep -- a wrapper around a grep program that decompresses files as needed # Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca> @@ -34,7 +35,7 @@ case ${0##*/} in *) prog=xzgrep; grep=${GREP:-grep};; esac -version="$prog (@PACKAGE_NAME@) @VERSION@" +version="$prog (@PACKAGE_NAME@) @PACKAGE_VERSION@" usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]... Look for instances of PATTERN in the input FILEs, using their @@ -156,7 +157,7 @@ done eval "set -- $operands "'${1+"$@"}' if test $have_pat -eq 0; then - case ${1?"Missing pattern; try \`${0##*/} --help' for help"} in + case ${1?"Missing pattern; try '${0##*/} --help' for help"} in (*\'*) grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");; (*) @@ -180,6 +181,7 @@ for i; do *[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";; *[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";; *[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q. + *[-.]lz4) uncompress="lz4 -cdf";; *) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check. esac # xz_status will hold the decompressor's exit status. @@ -275,7 +277,7 @@ for i; do test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status" elif test "$xz_status" -gt 0; then # Decompression failed but we will continue with the remaining - # files anwyway. Set exit status to at least 2 to indicate an error. + # files anyway. Set exit status to at least 2 to indicate an error. test "$r" -lt 2 && r=2 fi diff --git a/src/scripts/xzless.1 b/src/scripts/xzless.1 index 2d05459..570e601 100644 --- a/src/scripts/xzless.1 +++ b/src/scripts/xzless.1 @@ -1,13 +1,11 @@ +.\" SPDX-License-Identifier: 0BSD .\" .\" Authors: Andrew Dudman .\" Lasse Collin .\" -.\" This file has been put into the public domain. -.\" You can do whatever you want with this file. -.\" .\" (Note that this file is not based on gzip's zless.1.) .\" -.TH XZLESS 1 "2010-09-27" "Tukaani" "XZ Utils" +.TH XZLESS 1 "2024-02-12" "Tukaani" "XZ Utils" .SH NAME xzless, lzless \- view xz or lzma compressed (text) files .SH SYNOPSIS @@ -19,10 +17,10 @@ xzless, lzless \- view xz or lzma compressed (text) files .SH DESCRIPTION .B xzless is a filter that displays text from compressed files to a terminal. -It works on files compressed with +Files supported by .BR xz (1) -or -.BR lzma (1). +are decompressed; +other files are assumed to be in uncompressed form already. If no .I files are given, diff --git a/src/scripts/xzless.in b/src/scripts/xzless.in index 79a849e..6346966 100644 --- a/src/scripts/xzless.in +++ b/src/scripts/xzless.in @@ -1,4 +1,5 @@ #!@POSIX_SHELL@ +# SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation @@ -23,7 +24,7 @@ # specified via XZ_OPT. xz='@xz@ --format=auto' -version='xzless (@PACKAGE_NAME@) @VERSION@' +version='xzless (@PACKAGE_NAME@) @PACKAGE_VERSION@' usage="Usage: ${0##*/} [OPTION]... [FILE]... Like 'less', but operate on the uncompressed contents of xz compressed FILEs. @@ -47,13 +48,27 @@ if test "${LESSMETACHARS+set}" != set; then LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~' fi -if test "$(less -V | { read _ ver _ && echo ${ver%%.*}; })" -ge 429; then +VER=$(less -V | { read _ ver _ && echo ${ver%%.*}; }) +if test "$VER" -ge 451; then + # less 451 or later: If the compressed file is valid but has + # zero bytes of uncompressed data, using two vertical bars ||- makes + # "less" check the exit status of xz and if it is zero then display + # an empty file. With a single vertical bar |- and no output from xz, + # "less" would attempt to display the raw input file instead. + LESSOPEN="||-$xz -cdfqQ -- %s" +elif test "$VER" -ge 429; then # less 429 or later: LESSOPEN pipe will be used on # standard input if $LESSOPEN begins with |-. LESSOPEN="|-$xz -cdfqQ -- %s" else LESSOPEN="|$xz -cdfqQ -- %s" fi + +SHOW_PREPROC_ERRORS= +if test "$VER" -ge 632; then + SHOW_PREPROC_ERRORS=--show-preproc-errors +fi + export LESSMETACHARS LESSOPEN -exec less "$@" +exec less $SHOW_PREPROC_ERRORS "$@" diff --git a/src/scripts/xzmore.1 b/src/scripts/xzmore.1 index 9613974..afe89b8 100644 --- a/src/scripts/xzmore.1 +++ b/src/scripts/xzmore.1 @@ -1,53 +1,63 @@ +.\" SPDX-License-Identifier: 0BSD .\" -.\" Original zdiff.1 for gzip: Jean-loup Gailly -.\" Modifications for XZ Utils: Lasse Collin +.\" Authors: Andrew Dudman +.\" Lasse Collin .\" -.\" License: GNU GPLv2+ +.\" (Note that this file is based on xzless.1 instead of gzip's zmore.1.) .\" -.TH XZMORE 1 "2013-06-30" "Tukaani" "XZ Utils" +.TH XZMORE 1 "2024-02-12" "Tukaani" "XZ Utils" .SH NAME xzmore, lzmore \- view xz or lzma compressed (text) files +. .SH SYNOPSIS .B xzmore -.RI [ file... ] +.RI [ file ...] .br .B lzmore -.RI [ file... ] +.RI [ file ...] +. .SH DESCRIPTION -.B xzmore -is a filter which allows examination of +.B xzmore +displays text from compressed files to a terminal using +.BR more (1). +Files supported by .BR xz (1) -or -.BR lzma (1) -compressed text files one screenful at a time -on a soft-copy terminal. +are decompressed; +other files are assumed to be in uncompressed form already. +If no +.I files +are given, +.B xzmore +reads from standard input. +See the +.BR more (1) +manual for the keyboard commands. .PP -To use a pager other than the default -.B more, -set environment variable -.B PAGER -to the name of the desired program. -The name +Note that scrolling backwards might not be possible +depending on the implementation of +.BR more (1). +This is because +.B xzmore +uses a pipe to pass the decompressed data to +.BR more (1). +.BR xzless (1) +uses +.BR less (1) +which provides more advanced features. +.PP +The command .B lzmore is provided for backward compatibility with LZMA Utils. +. +.SH ENVIRONMENT .TP -.BR e " or " q -When the prompt \-\-More\-\-(Next file: -.IR file ) -is printed, this command causes -.B xzmore -to exit. -.TP -.B s -When the prompt \-\-More\-\-(Next file: -.IR file ) -is printed, this command causes -.B xzmore -to skip the next file and continue. -.PP -For list of keyboard commands supported while actually viewing the -content of a file, refer to manual of the pager you use, usually +.B PAGER +If +.B PAGER +is set, +its value is used as the pager instead of .BR more (1). +. .SH "SEE ALSO" .BR more (1), .BR xz (1), diff --git a/src/scripts/xzmore.in b/src/scripts/xzmore.in index 5188fda..c571913 100644 --- a/src/scripts/xzmore.in +++ b/src/scripts/xzmore.in @@ -1,4 +1,5 @@ #!@POSIX_SHELL@ +# SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2001, 2002, 2007 Free Software Foundation # Copyright (C) 1992, 1993 Jean-loup Gailly @@ -23,7 +24,7 @@ # specified via XZ_OPT. xz='@xz@ --format=auto' -version='xzmore (@PACKAGE_NAME@) @VERSION@' +version='xzmore (@PACKAGE_NAME@) @PACKAGE_VERSION@' usage="Usage: ${0##*/} [OPTION]... [FILE]... Like 'more', but operate on the uncompressed contents of xz compressed FILEs. |