Bug 17456 - Suggested lesspipe.sh replacement
Summary: Suggested lesspipe.sh replacement
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: less
Version: 6.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-09-12 21:39 UTC by Philip Rowlands
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-01-24 19:53:31 UTC
Embargoed:


Attachments (Terms of Use)
Suggested replacement for lesspipe.sh (772 bytes, text/plain)
2000-09-12 21:44 UTC, Philip Rowlands
no flags Details
Version of lesspipe.sh which copes with non-troff .<n>.gz files (855 bytes, text/plain)
2001-01-15 17:41 UTC, chris
no flags Details
Fixed lesspipe.sh (890 bytes, text/plain)
2001-01-24 19:53 UTC, Philip Rowlands
no flags Details

Description Philip Rowlands 2000-09-12 21:39:49 UTC
The lesspipe.sh supplied has several errors: firstly, filenames with
whitespace don't work (although the current rawhide release, less-358-6,
predates the #16777 fix); the wildcard matching is unnecessarily verbose;
the error redirection is unnecessarily given on every line; common file
cases are not grouped together...

So I've rewritten it, and attached it below. My (claimed) improvements are:

- No issues with any filenames; all variable substitutions are protected by
quotes and '--' end of option processing.
- Manpages are read with man, rather than calling groff directly, which
ignored everything in /etc/man.conf
- Manpages are blank-line-squeezed (they still have annoying page breaks,
but that's a different bugzilla)
- All 3 manpage cases are condensed into one
- Compressed tarfiles are grouped into one line, except .tar.bz2, which now
uses tar's 'I' option
- Zipfiles use zipinfo instead of unzip -l. This is a change in output
format, but preferable because zipinfo shows file permissions, compression
method, and uses an "ls -l" style format.

Comment 1 Philip Rowlands 2000-09-12 21:44:34 UTC
Created attachment 3400 [details]
Suggested replacement for lesspipe.sh

Comment 2 Ngo Than 2000-09-14 13:24:49 UTC
added your new lesspipe.sh in less-358-8. Thanks

Comment 3 chris 2001-01-15 17:39:03 UTC
Unfortunately, using this version of lesspipe.sh on a file whose name ends in
.1.gz which is not a manpage doesn't work (this happens to me quite often when I
try to view old logs which have been rotated and compressed by logrotate).

The attached version drops back to the default .gz or .bz2 behaviour if the
input file does not contain troff data.

Comment 4 chris 2001-01-15 17:41:18 UTC
Created attachment 7628 [details]
Version of lesspipe.sh which copes with non-troff .<n>.gz files

Comment 5 Philip Rowlands 2001-01-24 19:51:16 UTC
OK, I've reopened this bug to submit a fixed version. Some additional comments:

- RedHat added another case for *.?x.gz manpages. I don't think this is the
right way to go, as everyone seems to invent a new section for their project.
For example, on my RH6.2 install, there are *thr.gz, *t.gz, *x.gz, *m.gz,
*qt.gz. man(1) is better suited to reading these sorts of manpages, as it
invokes less.

- RedHat added a cpio handler, which I've slightly rewritten to make it safe
against files which look like options. I've never seen a cpio file with a .cpi
extension.

- Experimental support for directory listing (try "less /etc"). The display
format is personal preference, although I appreciate that not everyone will like
the -F option.

- And, of course, the submitted bug. I've added an 'else' case to the manpage
detection to handle compressed rotated logs.

Comment 6 Philip Rowlands 2001-01-24 19:53:28 UTC
Created attachment 8169 [details]
Fixed lesspipe.sh

Comment 7 Karsten Hopp 2001-02-01 12:40:48 UTC
fixed in the current rawhide version. I didn't add the support for directories.


Comment 8 chris 2001-02-01 12:49:05 UTC
Fair enough.  I actually think Philip's directory listing support is
exceptionally useful, but I guess tastes vary...


Note You need to log in before you can comment on or make changes to this bug.