mirror of https://git.tukaani.org/xz.git
xzless: Use --show-preproc-errors with "less" 632 and newer.
This makes "less" show a warning if a decompression error occurred.
(cherry picked from commit fd0692b052
)
This commit is contained in:
parent
c692bd42be
commit
5e7a8c0869
|
@ -47,13 +47,20 @@ if test "${LESSMETACHARS+set}" != set; then
|
||||||
LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
|
LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$(less -V | { read _ ver _ && echo ${ver%%.*}; })" -ge 429; then
|
VER=$(less -V | { read _ ver _ && echo ${ver%%.*}; })
|
||||||
|
if test "$VER" -ge 429; then
|
||||||
# less 429 or later: LESSOPEN pipe will be used on
|
# less 429 or later: LESSOPEN pipe will be used on
|
||||||
# standard input if $LESSOPEN begins with |-.
|
# standard input if $LESSOPEN begins with |-.
|
||||||
LESSOPEN="|-$xz -cdfqQ -- %s"
|
LESSOPEN="|-$xz -cdfqQ -- %s"
|
||||||
else
|
else
|
||||||
LESSOPEN="|$xz -cdfqQ -- %s"
|
LESSOPEN="|$xz -cdfqQ -- %s"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SHOW_PREPROC_ERRORS=
|
||||||
|
if test "$VER" -ge 632; then
|
||||||
|
SHOW_PREPROC_ERRORS=--show-preproc-errors
|
||||||
|
fi
|
||||||
|
|
||||||
export LESSMETACHARS LESSOPEN
|
export LESSMETACHARS LESSOPEN
|
||||||
|
|
||||||
exec less "$@"
|
exec less $SHOW_PREPROC_ERRORS "$@"
|
||||||
|
|
Loading…
Reference in New Issue