lexgrog is an implementation of the traditional ``groff guess utility in lex. It reads the list of files on its command line as either man page source files or preformatted ``cat pages, and displays their name and description as used by apropos and whatis, the list of preprocessing filters required by the man page before it is passed to nroff or troff, or both.
Parse input as man page source files. This is the default if neither --man nor --cat is given.
Parse input as preformatted man pages (``cat pages''). --man and --cat may not be given simultaneously.
Display the name and description from the man page's header, as used by apropos and whatis. This is the default if neither --whatis nor --filters is given.
Display the list of filters needed to preprocess the man page before formatting with nroff or troff.
Print a help message and exit.
Successful program execution.
mandb (which uses the same code as lexgrog) parses the NAME section at the top of each manual page looking for names and descriptions of the features documented in each. While the parser is quite tolerant, as it has to cope with a number of different forms that have historically been used, it may sometimes fail to extract the required information.
A correct NAME section looks something like this:
.SH NAME foo - program to do something
Some manual pagers require the `-' to be exactly as shown; mandb is more tolerant, but for compatibility with other systems it is nevertheless a good idea to retain the backslash.
On the left-hand side, there may be several names, separated by commas. The text on the right-hand side is free-form, and may be spread over multiple lines. If several features with different descriptions are being documented in the same manual page, the following form is therefore used:
.SH NAME foo, bar - programs to do something .br baz - program to do nothing
(A macro which starts a new paragraph, like .PP, may be used instead of the break macro .br.)
The code used by lexgrog to scan man pages was written by: