Manual-Page Syntax Checking
Checking correct formatting of manual pages is usually done visually, with printed output from either of these commands:
groff -man -Tps pathfind.man | lp troff -man -Tpost pathfind.man | /usr/lib/lp/postscript/dpost | lp
or on the screen as ASCII or typeset material, with commands like this:
nroff -man pathfind.man | col | more groff -man -Tascii pathfind.man | more groff -man -TX100 pathfind.man &
The col command handles certain special escape sequences that nroff generates for horizontal and vertical motion. col is not needed for groff output.
Some Unix systems have a simple-minded syntax checker, checknr; the command:
checknr pathfind.man
produces no complaints on our systems. checknr is good at catching font mismatches, but knows little about the manual-page format.
Most Unix systems have deroff, which is a simple filter that strips troff markup. You can do a spellcheck like this:
deroff pathfind.man | spell
to avoid lots of complaints from the spellchecker about troff markup. Other handy tools for catching hard-to-spot errors in documentation are a doubled-word finder[8] and a delimiter-balance checker.[9]
[8] Available at http://www.math.utah.edu/pub/dw/.
[9] Available at http://www.math.utah.edu/pub/chkdelim/.
Get Classic Shell Scripting now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.