diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-15 09:41:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-15 09:41:34 +0000 |
commit | 25e43e389c26d56f90f2f20e3cee19c808b2a18c (patch) | |
tree | fdadca249ffd70901103b3f06a98aeab695c6193 /src/scripts/xzless.in | |
parent | Adding debian version 5.6.1+really5.4.5-1. (diff) | |
download | xz-utils-25e43e389c26d56f90f2f20e3cee19c808b2a18c.tar.xz xz-utils-25e43e389c26d56f90f2f20e3cee19c808b2a18c.zip |
Merging upstream version 5.6.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/scripts/xzless.in')
-rw-r--r-- | src/scripts/xzless.in | 21 |
1 files changed, 18 insertions, 3 deletions
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 "$@" |