From: Paul Eggert Date: Fri, 7 Mar 2014 01:31:25 +0000 (-0800) Subject: zless: improve gzip failure checking, and port to new -V format X-Git-Tag: v1.7~49 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=49dc6efd76d105acccbb14e8c213f3ac95ce08e9;p=debian%2Fgzip zless: improve gzip failure checking, and port to new -V format Problem reported by Jaroslaw Weglinski, and LESSOPEN change suggested by Mark Nudelman, in: http://bugs.gnu.org/16951 This doesn't fix bug 16951 entirely, as 'less' needs to be changed too, but it's a start. * zless.in (check_exit_status): New var. (LESSOPEN): Use it. (use_input_pipe_on_stdin): Adjust to output format on Fedora 20, where 'less -V' outputs "less 458 (POSIX regular expressions)" on the first line. --- diff --git a/zless.in b/zless.in index 92209f2..67760b3 100644 --- a/zless.in +++ b/zless.in @@ -55,13 +55,23 @@ fi less_version=`less -V` || exit case $less_version in -'less 429 -'* | 'less '4[3-9][0-9]* | 'less '[5-9][0-9][0-9]* | 'less '[1-9][0-9][0-9][0-9]*) +less' '45[1-9]* | \ +less' '4[6-9][0-9]* | \ +less' '[5-9][0-9][0-9]* | \ +less' '[1-9][0-9][0-9][0-9]*) + check_exit_status='|';; +*) check_exit_status='';; +esac +case $less_version in +less' '429* | \ +less' '4[3-9][0-9]* | \ +less' '[5-9][0-9][0-9]* | \ +less' '[1-9][0-9][0-9][0-9]*) use_input_pipe_on_stdin='-';; *) use_input_pipe_on_stdin='';; esac -LESSOPEN="|${use_input_pipe_on_stdin}gzip -cdfq -- %s" +LESSOPEN="|$check_exit_status${use_input_pipe_on_stdin}gzip -cdfq -- %s" export LESSOPEN exec less "$@"