Help with man macros

Dick Dunn rcd at ico.ISC.COM
Thu Aug 10 10:17:43 AEST 1989


jiii at visdc.UUCP (John E Van Deusen III) writes about nroff in response to
a question about man macros:
> ...It is my understanding that certain newer versions of nroff
> use terminfo, but the older versions are driven by a terminal-specific
> table located in the /usr/lib/term directory.  Most systems do not
> provide the source code for users to compile their own driving tables...

No, nroff does not use terminfo.  However, there have been several
variations on the format of the table which nroff uses.  The older versions
used files in /usr/lib/term (unfortunately, the same directory name was
used through more than one file format); the current version uses
/usr/lib/nterm.

Circa V7, the file was just a data-initialization statement in a .c file;
you compiled it and moved it into place.  Nroff read the file, discarding
the header and figuring out offsets and such.  A more recent version (but
still older-style nroff) had you compile the data initialization and link
it with a special program which generated a more convenient output file--
which was pure data instead of a.out format.

The current (DWB 2.0) format is (radical idea!) a text file; thus the only
tool you need to build it is a text editor, starting from an existing file.
IMHO this is a great improvement.  It's simple, and the extra startup time
is negligible.

> Even when [building the table] is possible the table functions are
> fairly limited...

They have improved slightly, but there are still some awkward cases.
John's example of underlining vs italics is one.  Another is that there's
no form feed--nroff assumes it can use multiple line feeds to get from one
page to the next, which won't work when you're dealing with a printer
that's more helpful than smart.

> The solution that I have used is to create a filter, using yacc & lex,
> to recognize the various overstrike sequences that are output by nroff
> for the default terminal, usually a model 37 Teletype.  The filter then
> outputs the escape sequences for some desired printer instead...

This will work, but it's probably easier to develop the filter if you use a
different terminal type--create one of your own which is adapted to produce
easily-parsed data for the things the filter has to re-hack and which
minimizes the number of sequences the filter has to handle.
-- 
Dick Dunn     rcd at ico.isc.com    uucp: {ncar,nbires}!ico!rcd     (303)449-2870
   ...Simpler is better.



More information about the Comp.unix.wizards mailing list