1LEXGROG(1)                    Manual pager utils                    LEXGROG(1)
2
3
4

NAME

6       lexgrog - parse header information in man pages
7

SYNOPSIS

9       lexgrog [-m|-c] [-fhwV] [-E encoding] file ...
10

DESCRIPTION

12       lexgrog  is  an implementation of the traditional “groff guess” utility
13       in lex.  It reads the list of files on its command line as  either  man
14       page  source files or preformatted “cat” pages, and displays their name
15       and description as used by apropos and whatis, the list of  preprocess‐
16       ing  filters  required  by the man page before it is passed to nroff or
17       troff, or both.
18
19       If its input is badly formatted, lexgrog  will  print  “parse  failed”;
20       this  may  be useful for external programs that need to check man pages
21       for correctness.  If one of lexgrog's input files is “-”, it will  read
22       from  standard  input;  if any input file is compressed, a decompressed
23       version will be read automatically.
24

OPTIONS

26       -m, --man
27              Parse input as man page source files.  This is  the  default  if
28              neither --man nor --cat is given.
29
30       -c, --cat
31              Parse  input as preformatted man pages (“cat pages”).  --man and
32              --cat may not be given simultaneously.
33
34       -w, --whatis
35              Display the name and description from the man page's header,  as
36              used  by  apropos  and  whatis.   This is the default if neither
37              --whatis nor --filters is given.
38
39       -f, --filters
40              Display the list of filters needed to preprocess  the  man  page
41              before formatting with nroff or troff.
42
43       -E encoding, --encoding encoding
44              Override the guessed character set for the page to encoding.
45
46       -h, --help
47              Print a help message and exit.
48
49       -V, --version
50              Display version information.
51

EXIT STATUS

53       0      Successful program execution.
54
55       1      Usage error.
56
57       2      lexgrog failed to parse one or more of its input files.
58

EXAMPLES

60         $ lexgrog man.1
61         man.1: "man - an interface to the on-line reference manuals"
62         $ lexgrog -fw man.1
63         man.1 (t): "man - an interface to the on-line reference manuals"
64         $ lexgrog -c whatis.cat1
65         whatis.cat1: "whatis - display manual page descriptions"
66         $ lexgrog broken.1
67         broken.1: parse failed
68

WHATIS PARSING

70       mandb  (which uses the same code as lexgrog) parses the NAME section at
71       the top of each manual page looking for names and descriptions  of  the
72       features documented in each.  While the parser is quite tolerant, as it
73       has to cope with a number of different  forms  that  have  historically
74       been used, it may sometimes fail to extract the required information.
75
76       When  using the traditional man macro set, a correct NAME section looks
77       something like this:
78
79              .SH NAME
80              foo \- program to do something
81
82       Some manual pagers require the ‘\-’ to be exactly as  shown;  mandb  is
83       more tolerant, but for compatibility with other systems it is neverthe‐
84       less a good idea to retain the backslash.
85
86       On the left-hand side, there may be several names, separated by commas.
87       Names  containing  whitespace will be ignored to avoid pathological be‐
88       haviour on certain ill-formed NAME sections.  The text  on  the  right-
89       hand side is free-form, and may be spread over multiple lines.  If sev‐
90       eral features with different descriptions are being documented  in  the
91       same manual page, the following form is therefore used:
92
93              .SH NAME
94              foo, bar \- programs to do something
95              .br
96              baz \- program to do nothing
97
98       (A macro which starts a new paragraph, like .PP, may be used instead of
99       the break macro .br.)
100
101       When using the BSD-derived mdoc macro set, a correct NAME section looks
102       something like this:
103
104              .Sh NAME
105              .Nm foo
106              .Nd program to do something
107
108       There  are  several common reasons why whatis parsing fails.  Sometimes
109       authors of manual pages replace ‘.SH NAME’ with  ‘.SH  MYPROGRAM’,  and
110       then  mandb  cannot find the section from which to extract the informa‐
111       tion it needs.  Sometimes authors include a  NAME  section,  but  place
112       free-form  text  there rather than ‘name \- description’.  However, any
113       syntax resembling the above should be accepted.
114

SEE ALSO

116       man(1), mandb(8), apropos(1), whatis(1).
117

NOTES

119       lexgrog attempts to parse files containing .so requests, but will  only
120       be  able  to  do  so correctly if the files are properly installed in a
121       manual page hierarchy.
122

AUTHOR

124       The code used by lexgrog to scan man pages was written by:
125
126       Wilf. (G.Wilford@ee.surrey.ac.uk).
127       Fabrizio Polacco (fpolacco@debian.org).
128       Colin Watson (cjwatson@debian.org).
129
130       Colin Watson wrote the current incarnation of the  command-line  front-
131       end, as well as this man page.
132
133
134
1352.5.7                             2010-02-16                        LEXGROG(1)
Impressum