mirror of
https://git.tukaani.org/xz.git
synced 2025-02-17 14:08:12 +00:00
xzless: Use ||- in LESSOPEN with with "less" 451 and newer.
(cherry picked from commit 9860d418d296eb3c721e5384fb367c0499b579c8) (cherry picked from commit e5ba545f16e989ac51c38556e727c8c81988c04e)
This commit is contained in:
parent
3af41a23c4
commit
2c89f377cd
@ -48,7 +48,14 @@ if test "${LESSMETACHARS+set}" != set; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
VER=$(less -V | { read _ ver _ && echo ${ver%%.*}; })
|
VER=$(less -V | { read _ ver _ && echo ${ver%%.*}; })
|
||||||
if test "$VER" -ge 429; then
|
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
|
# 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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user