Re: [dev] Man page links

From: Paul Onyschuk <>
Date: Sat, 11 Feb 2012 17:34:03 +0100

On Sat, 11 Feb 2012 10:41:38 -0500
Andrew Hills wrote:

> Before I was familiar with the software, having the man pages on the
> website was very convenient, as the retarded version of man shipped
> with RHEL (at work, of course) wouldn't let me point to an arbitrary
> directory of man page files or an arbitrary man page file. This is an
> edge case, but I am suggesting that it could be helpful to those of us
> desperately trying to survive in a world of broken Unix machines
> maintained by an MCITP-certified IT department.

Actually man(1) is brain dead, it is calling something like this:

$ zcat -f /path/to/manpage.1.gz | eqn | grap | pic | tbl | vgrind \
  | refer | groff -S -P-h -Wall -mtty-char -man-Tascii | less

Missing filters are skipped in pipeline, still it is long pipeline.
Much better replacement for groff as man page parser is mdocml[1]. It
can be used this way:

$ zcat -f /path/to/manpage.1.gz | mandoc | less

I would say that simplest man(1) for mandoc can be written in ~10 lines
of shell script (check if man page is compressed or not depending on
file suffix and pipe it to mandoc and pager).

On Sat, 11 Feb 2012 11:00:32 -0500
Andrew Hills wrote:

> Unfortunately, no. But, when man pages were not immediately available
> online, I hacked together some godawful sh script that called the
> right sequence of nroff and whatever else man uses. In any case, my
> need has passed; the suckless tools are not so complicated that I
> can't remember their syntax. The number of users stuck in completely
> backwards environments is probably so low that it is not worth the
> effort of suckless developers to update yet another section of the
> website whenever something changes.

Producing HTML output with mandoc is also simple:

$ zcat -f /path/to/manpage.1.gz | mandoc -Thtml \
  -Ostyle=/path/to/style.css > manpage.html

Other alternative is plain text file:

$ zcat -f /usr/to/manpage.1.gz | mandoc | col -b > manpage.txt

I don't think that col(1) is shipped with any Linux distribution, but
this is small tool and source from *BSD repositories can be used.

Received on Sat Feb 11 2012 - 17:34:03 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 11 2012 - 17:36:03 CET