The attached patch enables zless to correctly view standard input
without changing its behavior in other cases.

There is still, however, one remaining problem - the patch depends on a
functionality introduced in less 429-1 and I am not sure how to sanely
express such a dependency, given that gzip merely suggests less. Any
suggestions?
diff -ur gzip-1.3.12/zless.1 gzip/zless.1
--- gzip-1.3.12/zless.1	2009-08-09 22:39:40.000000000 +0200
+++ gzip/zless.1	2009-08-10 02:02:46.641941863 +0200
@@ -8,7 +8,7 @@
 .I  Zless
 is a filter which allows examination of compressed or plain text files
 one screenful at a time on a soft-copy terminal.  It is the equivalent of
-setting the environment variable LESSOPEN to '|gzip -cdfq -- %s',
+setting the environment variable LESSOPEN to '|-gzip -cdfq -- %s',
 and the environment variable LESSMETACHARS to
 "'<space><tab><newline>;*?"()<>[|&^`#\\$%=~'",
 and then running
@@ -21,12 +21,6 @@
 filters.
 .SH "SEE ALSO"
 zmore(1), less(1), lessfile(1), lesspipe(1)
-.SH "BUGS"
-.I Zless
-does not work with compressed data that is piped to it via standard
-input; it requires that input files be specified as arguments.
-If you really want to use less in a pipe,
-then do the uncompress explicitly and pipe to less instead of using zless.
 .SH "COPYRIGHT NOTICE"
 Copyright \(co 2006 Free Software Foundation, Inc.
 .br
diff -ur gzip-1.3.12/zless.in gzip/zless.in
--- gzip-1.3.12/zless.in	2007-02-05 21:54:26.000000000 +0100
+++ gzip/zless.in	2009-08-10 02:00:04.188624923 +0200
@@ -49,5 +49,5 @@
   export LESSMETACHARS
 fi
 
-LESSOPEN="|gzip -cdfq -- %s"; export LESSOPEN
+LESSOPEN="|-gzip -cdfq -- %s"; export LESSOPEN
 exec less "$@"

Reply via email to