xref: /openbsd-src/usr.bin/mandoc/mandoc.1 (revision 7350f337b9e3eb4461d99580e625c7ef148d107c)
1.\"	$OpenBSD: mandoc.1,v 1.163 2019/05/26 01:16:09 naddy Exp $
2.\"
3.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4.\" Copyright (c) 2012, 2014-2018 Ingo Schwarze <schwarze@openbsd.org>
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: May 26 2019 $
19.Dt MANDOC 1
20.Os
21.Sh NAME
22.Nm mandoc
23.Nd format manual pages
24.Sh SYNOPSIS
25.Nm mandoc
26.Op Fl ac
27.Op Fl I Cm os Ns = Ns Ar name
28.Op Fl K Ar encoding
29.Op Fl mdoc | man
30.Op Fl O Ar options
31.Op Fl T Ar output
32.Op Fl W Ar level
33.Op Ar
34.Sh DESCRIPTION
35The
36.Nm
37utility formats manual pages for display.
38.Pp
39By default,
40.Nm
41reads
42.Xr mdoc 7
43or
44.Xr man 7
45text from stdin and produces
46.Fl T Cm locale
47output.
48.Pp
49The options are as follows:
50.Bl -tag -width Ds
51.It Fl a
52If the standard output is a terminal device and
53.Fl c
54is not specified, use
55.Xr more 1
56to paginate the output, just like
57.Xr man 1
58would.
59.It Fl c
60Copy the formatted manual pages to the standard output without using
61.Xr more 1
62to paginate them.
63This is the default.
64It can be specified to override
65.Fl a .
66.It Fl I Cm os Ns = Ns Ar name
67Override the default operating system
68.Ar name
69for the
70.Xr mdoc 7
71.Ic \&Os
72and for the
73.Xr man 7
74.Ic \&TH
75macro.
76.It Fl K Ar encoding
77Specify the input encoding.
78The supported
79.Ar encoding
80arguments are
81.Cm us-ascii ,
82.Cm iso-8859-1 ,
83and
84.Cm utf-8 .
85If not specified, autodetection uses the first match in the following
86list:
87.Bl -enum
88.It
89If the first three bytes of the input file are the UTF-8 byte order
90mark (BOM, 0xefbbbf), input is interpreted as
91.Cm utf-8 .
92.It
93If the first or second line of the input file matches the
94.Sy emacs
95mode line format
96.Pp
97.D1 .\e" -*- Oo ...; Oc coding: Ar encoding ; No -*-
98.Pp
99then input is interpreted according to
100.Ar encoding .
101.It
102If the first non-ASCII byte in the file introduces a valid UTF-8
103sequence, input is interpreted as
104.Cm utf-8 .
105.It
106Otherwise, input is interpreted as
107.Cm iso-8859-1 .
108.El
109.It Fl mdoc | man
110With
111.Fl mdoc ,
112all input files are interpreted as
113.Xr mdoc 7 .
114With
115.Fl man ,
116all input files are interpreted as
117.Xr man 7 .
118By default, the input language is automatically detected for each file:
119if the first macro is
120.Ic \&Dd
121or
122.Ic \&Dt ,
123the
124.Xr mdoc 7
125parser is used; otherwise, the
126.Xr man 7
127parser is used.
128With other arguments,
129.Fl m
130is silently ignored.
131.It Fl O Ar options
132Comma-separated output options.
133See the descriptions of the individual output formats for supported
134.Ar options .
135.It Fl T Ar output
136Select the output format.
137Supported values for the
138.Ar output
139argument are
140.Cm ascii ,
141.Cm html ,
142the default of
143.Cm locale ,
144.Cm man ,
145.Cm markdown ,
146.Cm pdf ,
147.Cm ps ,
148.Cm tree ,
149and
150.Cm utf8 .
151.Pp
152The special
153.Fl T Cm lint
154mode only parses the input and produces no output.
155It implies
156.Fl W Cm all
157and redirects parser messages, which usually appear on standard
158error output, to standard output.
159.It Fl W Ar level
160Specify the minimum message
161.Ar level
162to be reported on the standard error output and to affect the exit status.
163The
164.Ar level
165can be
166.Cm base ,
167.Cm style ,
168.Cm warning ,
169.Cm error ,
170or
171.Cm unsupp .
172The
173.Cm base
174level automatically derives the operating system from the contents of the
175.Ic \&Os
176macro, from the
177.Fl Ios
178command line option, or from the
179.Xr uname 3
180return value.
181The levels
182.Cm openbsd
183and
184.Cm netbsd
185are variants of
186.Cm base
187that bypass autodetection and request validation of base system
188conventions for a particular operating system.
189The level
190.Cm all
191is an alias for
192.Cm base .
193By default,
194.Nm
195is silent.
196See
197.Sx EXIT STATUS
198and
199.Sx DIAGNOSTICS
200for details.
201.Pp
202The special option
203.Fl W Cm stop
204tells
205.Nm
206to exit after parsing a file that causes warnings or errors of at least
207the requested level.
208No formatted output will be produced from that file.
209If both a
210.Ar level
211and
212.Cm stop
213are requested, they can be joined with a comma, for example
214.Fl W Cm error , Ns Cm stop .
215.It Ar file
216Read from the given input file.
217If multiple files are specified, they are processed in the given order.
218If unspecified,
219.Nm
220reads from standard input.
221.El
222.Pp
223The options
224.Fl fhklw
225are also supported and are documented in
226.Xr man 1 .
227In
228.Fl f
229and
230.Fl k
231mode,
232.Nm
233also supports the options
234.Fl CMmOSs
235described in the
236.Xr apropos 1
237manual.
238The options
239.Fl fkl
240are mutually exclusive and override each other.
241.Ss ASCII Output
242Use
243.Fl T Cm ascii
244to force text output in 7-bit ASCII character encoding documented in the
245.Xr ascii 7
246manual page, ignoring the
247.Xr locale 1
248set in the environment.
249.Pp
250Font styles are applied by using back-spaced encoding such that an
251underlined character
252.Sq c
253is rendered as
254.Sq _ Ns \e[bs] Ns c ,
255where
256.Sq \e[bs]
257is the back-space character number 8.
258Emboldened characters are rendered as
259.Sq c Ns \e[bs] Ns c .
260This markup is typically converted to appropriate terminal sequences by
261the pager or
262.Xr ul 1 .
263To remove the markup, pipe the output to
264.Xr col 1
265.Fl b
266instead.
267.Pp
268The special characters documented in
269.Xr mandoc_char 7
270are rendered best-effort in an ASCII equivalent.
271In particular, opening and closing
272.Sq single quotes
273are represented as characters number 0x60 and 0x27, respectively,
274which agrees with all ASCII standards from 1965 to the latest
275revision (2012) and which matches the traditional way in which
276.Xr roff 7
277formatters represent single quotes in ASCII output.
278This correct ASCII rendering may look strange with modern
279Unicode-compatible fonts because contrary to ASCII, Unicode uses
280the code point U+0060 for the grave accent only, never for an opening
281quote.
282.Pp
283The following
284.Fl O
285arguments are accepted:
286.Bl -tag -width Ds
287.It Cm indent Ns = Ns Ar indent
288The left margin for normal text is set to
289.Ar indent
290blank characters instead of the default of five for
291.Xr mdoc 7
292and seven for
293.Xr man 7 .
294Increasing this is not recommended; it may result in degraded formatting,
295for example overfull lines or ugly line breaks.
296When output is to a pager on a terminal that is less than 66 columns
297wide, the default is reduced to three columns.
298.It Cm mdoc
299Format
300.Xr man 7
301input files in
302.Xr mdoc 7
303output style.
304Specifically, this suppresses the two additional blank lines near the
305top and the bottom of each page, and it implies
306.Fl O Cm indent Ns =5 .
307One useful application is for checking that
308.Fl T Cm man
309output formats in the same way as the
310.Xr mdoc 7
311source it was generated from.
312.It Cm tag Ns Op = Ns Ar term
313If the formatted manual page is opened in a pager,
314go to the definition of the
315.Ar term
316rather than showing the manual page from the beginning.
317If no
318.Ar term
319is specified, reuse the first command line argument that is not a
320.Ar section
321number.
322If that argument is in
323.Xr apropos 1
324.Ar key Ns = Ns Ar val
325format, only the
326.Ar val
327is used rather than the argument as a whole.
328This is useful for commands like
329.Ql man -akO tag Ic=ulimit
330to search for a keyword and jump right to its definition
331in the matching manual pages.
332.It Cm width Ns = Ns Ar width
333The output width is set to
334.Ar width
335instead of the default of 78.
336When output is to a pager on a terminal that is less than 79 columns
337wide, the default is reduced to one less than the terminal width.
338In any case, lines that are output in literal mode are never wrapped
339and may exceed the output width.
340.El
341.Ss HTML Output
342Output produced by
343.Fl T Cm html
344conforms to HTML5 using optional self-closing tags.
345Default styles use only CSS1.
346Equations rendered from
347.Xr eqn 7
348blocks use MathML.
349.Pp
350The file
351.Pa /usr/share/misc/mandoc.css
352documents style-sheet classes available for customising output.
353If a style-sheet is not specified with
354.Fl O Cm style ,
355.Fl T Cm html
356defaults to simple output (via an embedded style-sheet)
357readable in any graphical or text-based web
358browser.
359.Pp
360Non-ASCII characters are rendered
361as hexadecimal Unicode character references.
362.Pp
363The following
364.Fl O
365arguments are accepted:
366.Bl -tag -width Ds
367.It Cm fragment
368Omit the <!DOCTYPE> declaration and the <html>, <head>, and <body>
369elements and only emit the subtree below the <body> element.
370The
371.Cm style
372argument will be ignored.
373This is useful when embedding manual content within existing documents.
374.It Cm includes Ns = Ns Ar fmt
375The string
376.Ar fmt ,
377for example,
378.Ar ../src/%I.html ,
379is used as a template for linked header files (usually via the
380.Ic \&In
381macro).
382Instances of
383.Sq \&%I
384are replaced with the include filename.
385The default is not to present a
386hyperlink.
387.It Cm man Ns = Ns Ar fmt Ns Op ; Ns Ar fmt
388The string
389.Ar fmt ,
390for example,
391.Ar ../html%S/%N.%S.html ,
392is used as a template for linked manuals (usually via the
393.Ic \&Xr
394macro).
395Instances of
396.Sq \&%N
397and
398.Sq %S
399are replaced with the linked manual's name and section, respectively.
400If no section is included, section 1 is assumed.
401The default is not to
402present a hyperlink.
403If two formats are given and a file
404.Ar %N.%S
405exists in the current directory, the first format is used;
406otherwise, the second format is used.
407.It Cm style Ns = Ns Ar style.css
408The file
409.Ar style.css
410is used for an external style-sheet.
411This must be a valid absolute or
412relative URI.
413.It Cm toc
414If an input file contains at least two non-standard sections,
415print a table of contents near the beginning of the output.
416.El
417.Ss Locale Output
418By default,
419.Nm
420automatically selects UTF-8 or ASCII output according to the current
421.Xr locale 1 .
422If any of the environment variables
423.Ev LC_ALL ,
424.Ev LC_CTYPE ,
425or
426.Ev LANG
427are set and the first one that is set
428selects the UTF-8 character encoding, it produces
429.Sx UTF-8 Output ;
430otherwise, it falls back to
431.Sx ASCII Output .
432This output mode can also be selected explicitly with
433.Fl T Cm locale .
434.Ss Man Output
435Use
436.Fl T Cm man
437to translate
438.Xr mdoc 7
439input into
440.Xr man 7
441output format.
442This is useful for distributing manual sources to legacy systems
443lacking
444.Xr mdoc 7
445formatters.
446.Pp
447If the input format of a file is
448.Xr man 7 ,
449the input is copied to the output, expanding any
450.Xr roff 7
451.Ic so
452requests.
453The parser is also run, and as usual, the
454.Fl W
455level controls which
456.Sx DIAGNOSTICS
457are displayed before copying the input to the output.
458.Ss Markdown Output
459Use
460.Fl T Cm markdown
461to translate
462.Xr mdoc 7
463input to the markdown format conforming to
464.Lk http://daringfireball.net/projects/markdown/syntax.text\
465 "John Gruber's 2004 specification" .
466The output also almost conforms to the
467.Lk http://commonmark.org/ CommonMark
468specification.
469.Pp
470The character set used for the markdown output is ASCII.
471Non-ASCII characters are encoded as HTML entities.
472Since that is not possible in literal font contexts, because these
473are rendered as code spans and code blocks in the markdown output,
474non-ASCII characters are transliterated to ASCII approximations in
475these contexts.
476.Pp
477Markdown is a very weak markup language, so all semantic markup is
478lost, and even part of the presentational markup may be lost.
479Do not use this as an intermediate step in converting to HTML;
480instead, use
481.Fl T Cm html
482directly.
483.Pp
484The
485.Xr man 7 ,
486.Xr tbl 7 ,
487and
488.Xr eqn 7
489input languages are not supported by
490.Fl T Cm markdown
491output mode.
492.Ss PDF Output
493PDF-1.1 output may be generated by
494.Fl T Cm pdf .
495See
496.Sx PostScript Output
497for
498.Fl O
499arguments and defaults.
500.Ss PostScript Output
501PostScript
502.Qq Adobe-3.0
503Level-2 pages may be generated by
504.Fl T Cm ps .
505Output pages default to letter sized and are rendered in the Times font
506family, 11-point.
507Margins are calculated as 1/9 the page length and width.
508Line-height is 1.4m.
509.Pp
510Special characters are rendered as in
511.Sx ASCII Output .
512.Pp
513The following
514.Fl O
515arguments are accepted:
516.Bl -tag -width Ds
517.It Cm paper Ns = Ns Ar name
518The paper size
519.Ar name
520may be one of
521.Ar a3 ,
522.Ar a4 ,
523.Ar a5 ,
524.Ar legal ,
525or
526.Ar letter .
527You may also manually specify dimensions as
528.Ar NNxNN ,
529width by height in millimetres.
530If an unknown value is encountered,
531.Ar letter
532is used.
533.El
534.Ss UTF-8 Output
535Use
536.Fl T Cm utf8
537to force text output in UTF-8 multi-byte character encoding,
538ignoring the
539.Xr locale 1
540settings in the environment.
541See
542.Sx ASCII Output
543regarding font styles and
544.Fl O
545arguments.
546.Pp
547On operating systems lacking locale or wide character support, and
548on those where the internal character representation is not UCS-4,
549.Nm
550always falls back to
551.Sx ASCII Output .
552.Ss Syntax tree output
553Use
554.Fl T Cm tree
555to show a human readable representation of the syntax tree.
556It is useful for debugging the source code of manual pages.
557The exact format is subject to change, so don't write parsers for it.
558.Pp
559The first paragraph shows meta data found in the
560.Xr mdoc 7
561prologue, on the
562.Xr man 7
563.Ic \&TH
564line, or the fallbacks used.
565.Pp
566In the tree dump, each output line shows one syntax tree node.
567Child nodes are indented with respect to their parent node.
568The columns are:
569.Pp
570.Bl -enum -compact
571.It
572For macro nodes, the macro name; for text and
573.Xr tbl 7
574nodes, the content.
575There is a special format for
576.Xr eqn 7
577nodes.
578.It
579Node type (text, elem, block, head, body, body-end, tail, tbl, eqn).
580.It
581Flags:
582.Bl -dash -compact
583.It
584An opening parenthesis if the node is an opening delimiter.
585.It
586An asterisk if the node starts a new input line.
587.It
588The input line number (starting at one).
589.It
590A colon.
591.It
592The input column number (starting at one).
593.It
594A closing parenthesis if the node is a closing delimiter.
595.It
596A full stop if the node ends a sentence.
597.It
598BROKEN if the node is a block broken by another block.
599.It
600NOSRC if the node is not in the input file,
601but automatically generated from macros.
602.It
603NOPRT if the node is not supposed to generate output
604for any output format.
605.El
606.El
607.Pp
608The following
609.Fl O
610argument is accepted:
611.Bl -tag -width Ds
612.It Cm noval
613Skip validation and show the unvalidated syntax tree.
614This can help to find out whether a given behaviour is caused by
615the parser or by the validator.
616Meta data is not available in this case.
617.El
618.Sh ENVIRONMENT
619.Bl -tag -width MANPAGER
620.It Ev LC_CTYPE
621The character encoding
622.Xr locale 1 .
623When
624.Sx Locale Output
625is selected, it decides whether to use ASCII or UTF-8 output format.
626It never affects the interpretation of input files.
627.It Ev MANPAGER
628Any non-empty value of the environment variable
629.Ev MANPAGER
630is used instead of the standard pagination program,
631.Xr more 1 ;
632see
633.Xr man 1
634for details.
635Only used if
636.Fl a
637or
638.Fl l
639is specified.
640.It Ev PAGER
641Specifies the pagination program to use when
642.Ev MANPAGER
643is not defined.
644If neither PAGER nor MANPAGER is defined,
645.Xr more 1
646.Fl s
647is used.
648Only used if
649.Fl a
650or
651.Fl l
652is specified.
653.El
654.Sh EXIT STATUS
655The
656.Nm
657utility exits with one of the following values, controlled by the message
658.Ar level
659associated with the
660.Fl W
661option:
662.Pp
663.Bl -tag -width Ds -compact
664.It 0
665No base system convention violations, style suggestions, warnings,
666or errors occurred, or those that did were ignored because they
667were lower than the requested
668.Ar level .
669.It 1
670At least one base system convention violation or style suggestion
671occurred, but no warning or error, and
672.Fl W Cm base
673or
674.Fl W Cm style
675was specified.
676.It 2
677At least one warning occurred, but no error, and
678.Fl W Cm warning
679or a lower
680.Ar level
681was requested.
682.It 3
683At least one parsing error occurred,
684but no unsupported feature was encountered, and
685.Fl W Cm error
686or a lower
687.Ar level
688was requested.
689.It 4
690At least one unsupported feature was encountered, and
691.Fl W Cm unsupp
692or a lower
693.Ar level
694was requested.
695.It 5
696Invalid command line arguments were specified.
697No input files have been read.
698.It 6
699An operating system error occurred, for example exhaustion
700of memory, file descriptors, or process table entries.
701Such errors cause
702.Nm
703to exit at once, possibly in the middle of parsing or formatting a file.
704.El
705.Pp
706Note that selecting
707.Fl T Cm lint
708output mode implies
709.Fl W Cm all .
710.Sh EXAMPLES
711To page manuals to the terminal:
712.Pp
713.Dl $ mandoc -l mandoc.1 man.1 apropos.1 makewhatis.8
714.Pp
715To produce HTML manuals with
716.Pa /usr/share/misc/mandoc.css
717as the style-sheet:
718.Pp
719.Dl $ mandoc \-T html -O style=/usr/share/misc/mandoc.css mdoc.7 > mdoc.7.html
720.Pp
721To check over a large set of manuals:
722.Pp
723.Dl $ mandoc \-T lint \(gafind /usr/src -name \e*\e.[1-9]\(ga
724.Pp
725To produce a series of PostScript manuals for A4 paper:
726.Pp
727.Dl $ mandoc \-T ps \-O paper=a4 mdoc.7 man.7 > manuals.ps
728.Pp
729Convert a modern
730.Xr mdoc 7
731manual to the older
732.Xr man 7
733format, for use on systems lacking an
734.Xr mdoc 7
735parser:
736.Pp
737.Dl $ mandoc \-T man foo.mdoc > foo.man
738.Sh DIAGNOSTICS
739Messages displayed by
740.Nm
741follow this format:
742.Bd -ragged -offset indent
743.Nm :
744.Ar file : Ns Ar line : Ns Ar column : level : message : macro arguments
745.Pq Ar os
746.Ed
747.Pp
748The first three fields identify the
749.Ar file
750name,
751.Ar line
752number, and
753.Ar column
754number of the input file where the message was triggered.
755The line and column numbers start at 1.
756Both are omitted for messages referring to an input file as a whole.
757All
758.Ar level
759and
760.Ar message
761strings are explained below.
762The name of the
763.Ar macro
764triggering the message and its
765.Ar arguments
766are omitted where meaningless.
767The
768.Ar os
769operating system specifier is omitted for messages that are relevant
770for all operating systems.
771Fatal messages about invalid command line arguments
772or operating system errors, for example when memory is exhausted,
773may also omit the
774.Ar file
775and
776.Ar level
777fields.
778.Pp
779Message levels have the following meanings:
780.Bl -tag -width "warning"
781.It Cm unsupp
782An input file uses unsupported low-level
783.Xr roff 7
784features.
785The output may be incomplete and/or misformatted,
786so using GNU troff instead of
787.Nm
788to process the file may be preferable.
789.It Cm error
790Indicates a risk of information loss or severe misformatting,
791in most cases caused by serious syntax errors.
792.It Cm warning
793Indicates a risk that the information shown or its formatting
794may mismatch the author's intent in minor ways.
795Additionally, syntax errors are classified at least as warnings,
796even if they do not usually cause misformatting.
797.It Cm style
798An input file uses dubious or discouraged style.
799This is not a complaint about the syntax, and probably neither
800formatting nor portability are in danger.
801While great care is taken to avoid false positives on the higher
802message levels, the
803.Cm style
804level tries to reduce the probability that issues go unnoticed,
805so it may occasionally issue bogus suggestions.
806Please use your good judgement to decide whether any particular
807.Cm style
808suggestion really justifies a change to the input file.
809.It Cm base
810A convention used in the base system of a specific operating system
811is not adhered to.
812These are not markup mistakes, and neither the quality of formatting
813nor portability are in danger.
814Messages of the
815.Cm base
816level are printed with the more intuitive
817.Cm style
818.Ar level
819tag.
820.El
821.Pp
822Messages of the
823.Cm base ,
824.Cm style ,
825.Cm warning ,
826.Cm error ,
827and
828.Cm unsupp
829levels except those about non-existent or unreadable input files
830are hidden unless their level, or a lower level, is requested using a
831.Fl W
832option or
833.Fl T Cm lint
834output mode.
835.Pp
836As indicated below, all
837.Cm base
838and some
839.Cm style
840checks are only performed if a specific operating system name occurs
841in the arguments of the
842.Fl W
843command line option, of the
844.Ic \&Os
845macro, of the
846.Fl Ios
847command line option, or, if neither are present, in the return value
848of the
849.Xr uname 3
850function.
851.Ss Conventions for base system manuals
852.Bl -ohang
853.It Sy "Mdocdate found"
854.Pq mdoc , Nx
855The
856.Ic \&Dd
857macro uses CVS
858.Ic Mdocdate
859keyword substitution, which is not supported by the
860.Nx
861base system.
862Consider using the conventional
863.Dq "Month dd, yyyy"
864format instead.
865.It Sy "Mdocdate missing"
866.Pq mdoc , Ox
867The
868.Ic \&Dd
869macro does not use CVS
870.Ic Mdocdate
871keyword substitution, but using it is conventionally expected in the
872.Ox
873base system.
874.It Sy "unknown architecture"
875.Pq mdoc , Ox , Nx
876The third argument of the
877.Ic \&Dt
878macro does not match any of the architectures this operating system
879is running on.
880.It Sy "operating system explicitly specified"
881.Pq mdoc , Ox , Nx
882The
883.Ic \&Os
884macro has an argument.
885In the base system, it is conventionally left blank.
886.It Sy "RCS id missing"
887.Pq Ox , Nx
888The manual page lacks the comment line with the RCS identifier
889generated by CVS
890.Ic OpenBSD
891or
892.Ic NetBSD
893keyword substitution as conventionally used in these operating systems.
894.It Sy "referenced manual not found"
895.Pq mdoc
896An
897.Ic \&Xr
898macro references a manual page that is not found in the base system.
899The path to look for base system manuals is configurable at compile
900time and defaults to
901.Pa /usr/share/man : /usr/X11R6/man .
902.El
903.Ss Style suggestions
904.Bl -ohang
905.It Sy "legacy man(7) date format"
906.Pq mdoc
907The
908.Ic \&Dd
909macro uses the legacy
910.Xr man 7
911date format
912.Dq yyyy-dd-mm .
913Consider using the conventional
914.Xr mdoc 7
915date format
916.Dq "Month dd, yyyy"
917instead.
918.It Sy "normalizing date format to" : No ...
919.Pq mdoc , man
920The
921.Ic \&Dd
922or
923.Ic \&TH
924macro provides an abbreviated month name or a day number with a
925leading zero.
926In the formatted output, the month name is written out in full
927and the leading zero is omitted.
928.It Sy "lower case character in document title"
929.Pq mdoc , man
930The title is still used as given in the
931.Ic \&Dt
932or
933.Ic \&TH
934macro.
935.It Sy "duplicate RCS id"
936A single manual page contains two copies of the RCS identifier for
937the same operating system.
938Consider deleting the later instance and moving the first one up
939to the top of the page.
940.It Sy "possible typo in section name"
941.Pq mdoc
942Fuzzy string matching revealed that the argument of an
943.Ic \&Sh
944macro is similar, but not identical to a standard section name.
945.It Sy "unterminated quoted argument"
946.Pq roff
947Macro arguments can be enclosed in double quote characters
948such that space characters and macro names contained in the quoted
949argument need not be escaped.
950The closing quote of the last argument of a macro can be omitted.
951However, omitting it is not recommended because it makes the code
952harder to read.
953.It Sy "useless macro"
954.Pq mdoc
955A
956.Ic \&Bt ,
957.Ic \&Tn ,
958or
959.Ic \&Ud
960macro was found.
961Simply delete it: it serves no useful purpose.
962.It Sy "consider using OS macro"
963.Pq mdoc
964A string was found in plain text or in a
965.Ic \&Bx
966macro that could be represented using
967.Ic \&Ox ,
968.Ic \&Nx ,
969.Ic \&Fx ,
970or
971.Ic \&Dx .
972.It Sy "errnos out of order"
973.Pq mdoc, Nx
974The
975.Ic \&Er
976items in a
977.Ic \&Bl
978list are not in alphabetical order.
979.It Sy "duplicate errno"
980.Pq mdoc, Nx
981A
982.Ic \&Bl
983list contains two consecutive
984.Ic \&It
985entries describing the same
986.Ic \&Er
987number.
988.It Sy "trailing delimiter"
989.Pq mdoc
990The last argument of an
991.Ic \&Ex , \&Fo , \&Nd , \&Nm , \&Os , \&Sh , \&Ss , \&St ,
992or
993.Ic \&Sx
994macro ends with a trailing delimiter.
995This is usually bad style and often indicates typos.
996Most likely, the delimiter can be removed.
997.It Sy "no blank before trailing delimiter"
998.Pq mdoc
999The last argument of a macro that supports trailing delimiter
1000arguments is longer than one byte and ends with a trailing delimiter.
1001Consider inserting a blank such that the delimiter becomes a separate
1002argument, thus moving it out of the scope of the macro.
1003.It Sy "fill mode already enabled, skipping"
1004.Pq man
1005A
1006.Ic \&fi
1007request occurs even though the document is still in fill mode,
1008or already switched back to fill mode.
1009It has no effect.
1010.It Sy "fill mode already disabled, skipping"
1011.Pq man
1012An
1013.Ic \&nf
1014request occurs even though the document already switched to no-fill mode
1015and did not switch back to fill mode yet.
1016It has no effect.
1017.It Sy "verbatim \(dq--\(dq, maybe consider using \e(em"
1018.Pq mdoc
1019Even though the ASCII output device renders an em-dash as
1020.Qq \-\- ,
1021that is not a good way to write it in an input file
1022because it renders poorly on all other output devices.
1023.It Sy "function name without markup"
1024.Pq mdoc
1025A word followed by an empty pair of parentheses occurs on a text line.
1026Consider using an
1027.Ic \&Fn
1028or
1029.Ic \&Xr
1030macro.
1031.It Sy "whitespace at end of input line"
1032.Pq mdoc , man , roff
1033Whitespace at the end of input lines is almost never semantically
1034significant \(em but in the odd case where it might be, it is
1035extremely confusing when reviewing and maintaining documents.
1036.It Sy "bad comment style"
1037.Pq roff
1038Comment lines start with a dot, a backslash, and a double-quote character.
1039The
1040.Nm
1041utility treats the line as a comment line even without the backslash,
1042but leaving out the backslash might not be portable.
1043.El
1044.Ss Warnings related to the document prologue
1045.Bl -ohang
1046.It Sy "missing manual title, using UNTITLED"
1047.Pq mdoc
1048A
1049.Ic \&Dt
1050macro has no arguments, or there is no
1051.Ic \&Dt
1052macro before the first non-prologue macro.
1053.It Sy "missing manual title, using \(dq\(dq"
1054.Pq man
1055There is no
1056.Ic \&TH
1057macro, or it has no arguments.
1058.It Sy "missing manual section, using \(dq\(dq"
1059.Pq mdoc , man
1060A
1061.Ic \&Dt
1062or
1063.Ic \&TH
1064macro lacks the mandatory section argument.
1065.It Sy "unknown manual section"
1066.Pq mdoc
1067The section number in a
1068.Ic \&Dt
1069line is invalid, but still used.
1070.It Sy "missing date, using today's date"
1071.Pq mdoc, man
1072The document was parsed as
1073.Xr mdoc 7
1074and it has no
1075.Ic \&Dd
1076macro, or the
1077.Ic \&Dd
1078macro has no arguments or only empty arguments;
1079or the document was parsed as
1080.Xr man 7
1081and it has no
1082.Ic \&TH
1083macro, or the
1084.Ic \&TH
1085macro has less than three arguments or its third argument is empty.
1086.It Sy "cannot parse date, using it verbatim"
1087.Pq mdoc , man
1088The date given in a
1089.Ic \&Dd
1090or
1091.Ic \&TH
1092macro does not follow the conventional format.
1093.It Sy "date in the future, using it anyway"
1094.Pq mdoc , man
1095The date given in a
1096.Ic \&Dd
1097or
1098.Ic \&TH
1099macro is more than a day ahead of the current system
1100.Xr time 3 .
1101.It Sy "missing Os macro, using \(dq\(dq"
1102.Pq mdoc
1103The default or current system is not shown in this case.
1104.It Sy "late prologue macro"
1105.Pq mdoc
1106A
1107.Ic \&Dd
1108or
1109.Ic \&Os
1110macro occurs after some non-prologue macro, but still takes effect.
1111.It Sy "prologue macros out of order"
1112.Pq mdoc
1113The prologue macros are not given in the conventional order
1114.Ic \&Dd ,
1115.Ic \&Dt ,
1116.Ic \&Os .
1117All three macros are used even when given in another order.
1118.El
1119.Ss Warnings regarding document structure
1120.Bl -ohang
1121.It Sy ".so is fragile, better use ln(1)"
1122.Pq roff
1123Including files only works when the parser program runs with the correct
1124current working directory.
1125.It Sy "no document body"
1126.Pq mdoc , man
1127The document body contains neither text nor macros.
1128An empty document is shown, consisting only of a header and a footer line.
1129.It Sy "content before first section header"
1130.Pq mdoc , man
1131Some macros or text precede the first
1132.Ic \&Sh
1133or
1134.Ic \&SH
1135section header.
1136The offending macros and text are parsed and added to the top level
1137of the syntax tree, outside any section block.
1138.It Sy "first section is not NAME"
1139.Pq mdoc
1140The argument of the first
1141.Ic \&Sh
1142macro is not
1143.Sq NAME .
1144This may confuse
1145.Xr makewhatis 8
1146and
1147.Xr apropos 1 .
1148.It Sy "NAME section without Nm before Nd"
1149.Pq mdoc
1150The NAME section does not contain any
1151.Ic \&Nm
1152child macro before the first
1153.Ic \&Nd
1154macro.
1155.It Sy "NAME section without description"
1156.Pq mdoc
1157The NAME section lacks the mandatory
1158.Ic \&Nd
1159child macro.
1160.It Sy "description not at the end of NAME"
1161.Pq mdoc
1162The NAME section does contain an
1163.Ic \&Nd
1164child macro, but other content follows it.
1165.It Sy "bad NAME section content"
1166.Pq mdoc
1167The NAME section contains plain text or macros other than
1168.Ic \&Nm
1169and
1170.Ic \&Nd .
1171.It Sy "missing comma before name"
1172.Pq mdoc
1173The NAME section contains an
1174.Ic \&Nm
1175macro that is neither the first one nor preceded by a comma.
1176.It Sy "missing description line, using \(dq\(dq"
1177.Pq mdoc
1178The
1179.Ic \&Nd
1180macro lacks the required argument.
1181The title line of the manual will end after the dash.
1182.It Sy "description line outside NAME section"
1183.Pq mdoc
1184An
1185.Ic \&Nd
1186macro appears outside the NAME section.
1187The arguments are printed anyway and the following text is used for
1188.Xr apropos 1 ,
1189but none of that behaviour is portable.
1190.It Sy "sections out of conventional order"
1191.Pq mdoc
1192A standard section occurs after another section it usually precedes.
1193All section titles are used as given,
1194and the order of sections is not changed.
1195.It Sy "duplicate section title"
1196.Pq mdoc
1197The same standard section title occurs more than once.
1198.It Sy "unexpected section"
1199.Pq mdoc
1200A standard section header occurs in a section of the manual
1201where it normally isn't useful.
1202.It Sy "cross reference to self"
1203.Pq mdoc
1204An
1205.Ic \&Xr
1206macro refers to a name and section matching the section of the present
1207manual page and a name mentioned in an
1208.Ic \&Nm
1209macro in the NAME or SYNOPSIS section, or in an
1210.Ic \&Fn
1211or
1212.Ic \&Fo
1213macro in the SYNOPSIS.
1214Consider using
1215.Ic \&Nm
1216or
1217.Ic \&Fn
1218instead of
1219.Ic \&Xr .
1220.It Sy "unusual Xr order"
1221.Pq mdoc
1222In the SEE ALSO section, an
1223.Ic \&Xr
1224macro with a lower section number follows one with a higher number,
1225or two
1226.Ic \&Xr
1227macros referring to the same section are out of alphabetical order.
1228.It Sy "unusual Xr punctuation"
1229.Pq mdoc
1230In the SEE ALSO section, punctuation between two
1231.Ic \&Xr
1232macros differs from a single comma, or there is trailing punctuation
1233after the last
1234.Ic \&Xr
1235macro.
1236.It Sy "AUTHORS section without An macro"
1237.Pq mdoc
1238An AUTHORS sections contains no
1239.Ic \&An
1240macros, or only empty ones.
1241Probably, there are author names lacking markup.
1242.El
1243.Ss "Warnings related to macros and nesting"
1244.Bl -ohang
1245.It Sy "obsolete macro"
1246.Pq mdoc
1247See the
1248.Xr mdoc 7
1249manual for replacements.
1250.It Sy "macro neither callable nor escaped"
1251.Pq mdoc
1252The name of a macro that is not callable appears on a macro line.
1253It is printed verbatim.
1254If the intention is to call it, move it to its own input line;
1255otherwise, escape it by prepending
1256.Sq \e& .
1257.It Sy "skipping paragraph macro"
1258In
1259.Xr mdoc 7
1260documents, this happens
1261.Bl -dash -compact
1262.It
1263at the beginning and end of sections and subsections
1264.It
1265right before non-compact lists and displays
1266.It
1267at the end of items in non-column, non-compact lists
1268.It
1269and for multiple consecutive paragraph macros.
1270.El
1271In
1272.Xr man 7
1273documents, it happens
1274.Bl -dash -compact
1275.It
1276for empty
1277.Ic \&P ,
1278.Ic \&PP ,
1279and
1280.Ic \&LP
1281macros
1282.It
1283for
1284.Ic \&IP
1285macros having neither head nor body arguments
1286.It
1287for
1288.Ic \&br
1289or
1290.Ic \&sp
1291right after
1292.Ic \&SH
1293or
1294.Ic \&SS
1295.El
1296.It Sy "moving paragraph macro out of list"
1297.Pq mdoc
1298A list item in a
1299.Ic \&Bl
1300list contains a trailing paragraph macro.
1301The paragraph macro is moved after the end of the list.
1302.It Sy "skipping no-space macro"
1303.Pq mdoc
1304An input line begins with an
1305.Ic \&Ns
1306macro, or the next argument after an
1307.Ic \&Ns
1308macro is an isolated closing delimiter.
1309The macro is ignored.
1310.It Sy "blocks badly nested"
1311.Pq mdoc
1312If two blocks intersect, one should completely contain the other.
1313Otherwise, rendered output is likely to look strange in any output
1314format, and rendering in SGML-based output formats is likely to be
1315outright wrong because such languages do not support badly nested
1316blocks at all.
1317Typical examples of badly nested blocks are
1318.Qq Ic \&Ao \&Bo \&Ac \&Bc
1319and
1320.Qq Ic \&Ao \&Bq \&Ac .
1321In these examples,
1322.Ic \&Ac
1323breaks
1324.Ic \&Bo
1325and
1326.Ic \&Bq ,
1327respectively.
1328.It Sy "nested displays are not portable"
1329.Pq mdoc
1330A
1331.Ic \&Bd ,
1332.Ic \&D1 ,
1333or
1334.Ic \&Dl
1335display occurs nested inside another
1336.Ic \&Bd
1337display.
1338This works with
1339.Nm ,
1340but fails with most other implementations.
1341.It Sy "moving content out of list"
1342.Pq mdoc
1343A
1344.Ic \&Bl
1345list block contains text or macros before the first
1346.Ic \&It
1347macro.
1348The offending children are moved before the beginning of the list.
1349.It Sy "first macro on line"
1350Inside a
1351.Ic \&Bl Fl column
1352list, a
1353.Ic \&Ta
1354macro occurs as the first macro on a line, which is not portable.
1355.It Sy "line scope broken"
1356.Pq man
1357While parsing the next-line scope of the previous macro,
1358another macro is found that prematurely terminates the previous one.
1359The previous, interrupted macro is deleted from the parse tree.
1360.El
1361.Ss "Warnings related to missing arguments"
1362.Bl -ohang
1363.It Sy "skipping empty request"
1364.Pq roff , eqn
1365The macro name is missing from a macro definition request,
1366or an
1367.Xr eqn 7
1368control statement or operation keyword lacks its required argument.
1369.It Sy "conditional request controls empty scope"
1370.Pq roff
1371A conditional request is only useful if any of the following
1372follows it on the same logical input line:
1373.Bl -dash -compact
1374.It
1375The
1376.Sq \e{
1377keyword to open a multi-line scope.
1378.It
1379A request or macro or some text, resulting in a single-line scope.
1380.It
1381The immediate end of the logical line without any intervening whitespace,
1382resulting in next-line scope.
1383.El
1384Here, a conditional request is followed by trailing whitespace only,
1385and there is no other content on its logical input line.
1386Note that it doesn't matter whether the logical input line is split
1387across multiple physical input lines using
1388.Sq \e
1389line continuation characters.
1390This is one of the rare cases
1391where trailing whitespace is syntactically significant.
1392The conditional request controls a scope containing whitespace only,
1393so it is unlikely to have a significant effect,
1394except that it may control a following
1395.Ic \&el
1396clause.
1397.It Sy "skipping empty macro"
1398.Pq mdoc
1399The indicated macro has no arguments and hence no effect.
1400.It Sy "empty block"
1401.Pq mdoc , man
1402A
1403.Ic \&Bd ,
1404.Ic \&Bk ,
1405.Ic \&Bl ,
1406.Ic \&D1 ,
1407.Ic \&Dl ,
1408.Ic \&MT ,
1409.Ic \&RS ,
1410or
1411.Ic \&UR
1412block contains nothing in its body and will produce no output.
1413.It Sy "empty argument, using 0n"
1414.Pq mdoc
1415The required width is missing after
1416.Ic \&Bd
1417or
1418.Ic \&Bl
1419.Fl offset
1420or
1421.Fl width .
1422.It Sy "missing display type, using -ragged"
1423.Pq mdoc
1424The
1425.Ic \&Bd
1426macro is invoked without the required display type.
1427.It Sy "list type is not the first argument"
1428.Pq mdoc
1429In a
1430.Ic \&Bl
1431macro, at least one other argument precedes the type argument.
1432The
1433.Nm
1434utility copes with any argument order, but some other
1435.Xr mdoc 7
1436implementations do not.
1437.It Sy "missing -width in -tag list, using 8n"
1438.Pq mdoc
1439Every
1440.Ic \&Bl
1441macro having the
1442.Fl tag
1443argument requires
1444.Fl width ,
1445too.
1446.It Sy "missing utility name, using \(dq\(dq"
1447.Pq mdoc
1448The
1449.Ic \&Ex Fl std
1450macro is called without an argument before
1451.Ic \&Nm
1452has first been called with an argument.
1453.It Sy "missing function name, using \(dq\(dq"
1454.Pq mdoc
1455The
1456.Ic \&Fo
1457macro is called without an argument.
1458No function name is printed.
1459.It Sy "empty head in list item"
1460.Pq mdoc
1461In a
1462.Ic \&Bl
1463.Fl diag ,
1464.Fl hang ,
1465.Fl inset ,
1466.Fl ohang ,
1467or
1468.Fl tag
1469list, an
1470.Ic \&It
1471macro lacks the required argument.
1472The item head is left empty.
1473.It Sy "empty list item"
1474.Pq mdoc
1475In a
1476.Ic \&Bl
1477.Fl bullet ,
1478.Fl dash ,
1479.Fl enum ,
1480or
1481.Fl hyphen
1482list, an
1483.Ic \&It
1484block is empty.
1485An empty list item is shown.
1486.It Sy "missing argument, using next line"
1487.Pq mdoc
1488An
1489.Ic \&It
1490macro in a
1491.Ic \&Bd Fl column
1492list has no arguments.
1493While
1494.Nm
1495uses the text or macros of the following line, if any, for the cell,
1496other formatters may misformat the list.
1497.It Sy "missing font type, using \efR"
1498.Pq mdoc
1499A
1500.Ic \&Bf
1501macro has no argument.
1502It switches to the default font.
1503.It Sy "unknown font type, using \efR"
1504.Pq mdoc
1505The
1506.Ic \&Bf
1507argument is invalid.
1508The default font is used instead.
1509.It Sy "nothing follows prefix"
1510.Pq mdoc
1511A
1512.Ic \&Pf
1513macro has no argument, or only one argument and no macro follows
1514on the same input line.
1515This defeats its purpose; in particular, spacing is not suppressed
1516before the text or macros following on the next input line.
1517.It Sy "empty reference block"
1518.Pq mdoc
1519An
1520.Ic \&Rs
1521macro is immediately followed by an
1522.Ic \&Re
1523macro on the next input line.
1524Such an empty block does not produce any output.
1525.It Sy "missing section argument"
1526.Pq mdoc
1527An
1528.Ic \&Xr
1529macro lacks its second, section number argument.
1530The first argument, i.e. the name, is printed, but without subsequent
1531parentheses.
1532.It Sy "missing -std argument, adding it"
1533.Pq mdoc
1534An
1535.Ic \&Ex
1536or
1537.Ic \&Rv
1538macro lacks the required
1539.Fl std
1540argument.
1541The
1542.Nm
1543utility assumes
1544.Fl std
1545even when it is not specified, but other implementations may not.
1546.It Sy "missing option string, using \(dq\(dq"
1547.Pq man
1548The
1549.Ic \&OP
1550macro is invoked without any argument.
1551An empty pair of square brackets is shown.
1552.It Sy "missing resource identifier, using \(dq\(dq"
1553.Pq man
1554The
1555.Ic \&MT
1556or
1557.Ic \&UR
1558macro is invoked without any argument.
1559An empty pair of angle brackets is shown.
1560.It Sy "missing eqn box, using \(dq\(dq"
1561.Pq eqn
1562A diacritic mark or a binary operator is found,
1563but there is nothing to the left of it.
1564An empty box is inserted.
1565.El
1566.Ss "Warnings related to bad macro arguments"
1567.Bl -ohang
1568.It Sy "duplicate argument"
1569.Pq mdoc
1570A
1571.Ic \&Bd
1572or
1573.Ic \&Bl
1574macro has more than one
1575.Fl compact ,
1576more than one
1577.Fl offset ,
1578or more than one
1579.Fl width
1580argument.
1581All but the last instances of these arguments are ignored.
1582.It Sy "skipping duplicate argument"
1583.Pq mdoc
1584An
1585.Ic \&An
1586macro has more than one
1587.Fl split
1588or
1589.Fl nosplit
1590argument.
1591All but the first of these arguments are ignored.
1592.It Sy "skipping duplicate display type"
1593.Pq mdoc
1594A
1595.Ic \&Bd
1596macro has more than one type argument; the first one is used.
1597.It Sy "skipping duplicate list type"
1598.Pq mdoc
1599A
1600.Ic \&Bl
1601macro has more than one type argument; the first one is used.
1602.It Sy "skipping -width argument"
1603.Pq mdoc
1604A
1605.Ic \&Bl
1606.Fl column ,
1607.Fl diag ,
1608.Fl ohang ,
1609.Fl inset ,
1610or
1611.Fl item
1612list has a
1613.Fl width
1614argument.
1615That has no effect.
1616.It Sy "wrong number of cells"
1617In a line of a
1618.Ic \&Bl Fl column
1619list, the number of tabs or
1620.Ic \&Ta
1621macros is less than the number expected from the list header line
1622or exceeds the expected number by more than one.
1623Missing cells remain empty, and all cells exceeding the number of
1624columns are joined into one single cell.
1625.It Sy "unknown AT&T UNIX version"
1626.Pq mdoc
1627An
1628.Ic \&At
1629macro has an invalid argument.
1630It is used verbatim, with
1631.Qq "AT&T UNIX "
1632prefixed to it.
1633.It Sy "comma in function argument"
1634.Pq mdoc
1635An argument of an
1636.Ic \&Fa
1637or
1638.Ic \&Fn
1639macro contains a comma; it should probably be split into two arguments.
1640.It Sy "parenthesis in function name"
1641.Pq mdoc
1642The first argument of an
1643.Ic \&Fc
1644or
1645.Ic \&Fn
1646macro contains an opening or closing parenthesis; that's probably wrong,
1647parentheses are added automatically.
1648.It Sy "unknown library name"
1649.Pq mdoc, not on Ox
1650An
1651.Ic \&Lb
1652macro has an unknown name argument and will be rendered as
1653.Qq library Dq Ar name .
1654.It Sy "invalid content in Rs block"
1655.Pq mdoc
1656An
1657.Ic \&Rs
1658block contains plain text or non-% macros.
1659The bogus content is left in the syntax tree.
1660Formatting may be poor.
1661.It Sy "invalid Boolean argument"
1662.Pq mdoc
1663An
1664.Ic \&Sm
1665macro has an argument other than
1666.Cm on
1667or
1668.Cm off .
1669The invalid argument is moved out of the macro, which leaves the macro
1670empty, causing it to toggle the spacing mode.
1671.It Sy "argument contains two font escapes"
1672.Pq roff
1673The second argument of a
1674.Ic char
1675request contains more than one font escape sequence.
1676A wrong font may remain active after using the character.
1677.It Sy "unknown font, skipping request"
1678.Pq man , tbl
1679A
1680.Xr roff 7
1681.Ic \&ft
1682request or a
1683.Xr tbl 7
1684.Ic \&f
1685layout modifier has an unknown
1686.Ar font
1687argument.
1688.It Sy "odd number of characters in request"
1689.Pq roff
1690A
1691.Ic \&tr
1692request contains an odd number of characters.
1693The last character is mapped to the blank character.
1694.El
1695.Ss "Warnings related to plain text"
1696.Bl -ohang
1697.It Sy "blank line in fill mode, using .sp"
1698.Pq mdoc
1699The meaning of blank input lines is only well-defined in non-fill mode:
1700In fill mode, line breaks of text input lines are not supposed to be
1701significant.
1702However, for compatibility with groff, blank lines in fill mode
1703are formatted like
1704.Ic \&sp
1705requests.
1706To request a paragraph break, use
1707.Ic \&Pp
1708instead of a blank line.
1709.It Sy "tab in filled text"
1710.Pq mdoc , man
1711The meaning of tab characters is only well-defined in non-fill mode:
1712In fill mode, whitespace is not supposed to be significant
1713on text input lines.
1714As an implementation dependent choice, tab characters on text lines
1715are passed through to the formatters in any case.
1716Given that the text before the tab character will be filled,
1717it is hard to predict which tab stop position the tab will advance to.
1718.It Sy "new sentence, new line"
1719.Pq mdoc
1720A new sentence starts in the middle of a text line.
1721Start it on a new input line to help formatters produce correct spacing.
1722.It Sy "invalid escape sequence"
1723.Pq roff
1724An escape sequence has an invalid opening argument delimiter, lacks the
1725closing argument delimiter, the argument is of an invalid form, or it is
1726a character escape sequence with an invalid name.
1727If the argument is incomplete,
1728.Ic \e*
1729and
1730.Ic \en
1731expand to an empty string,
1732.Ic \eB
1733to the digit
1734.Sq 0 ,
1735and
1736.Ic \ew
1737to the length of the incomplete argument.
1738All other invalid escape sequences are ignored.
1739.It Sy "undefined escape, printing literally"
1740.Pq roff
1741In an escape sequence, the first character
1742right after the leading backslash is invalid.
1743That character is printed literally,
1744which is equivalent to ignoring the backslash.
1745.It Sy "undefined string, using \(dq\(dq"
1746.Pq roff
1747If a string is used without being defined before,
1748its value is implicitly set to the empty string.
1749However, defining strings explicitly before use
1750keeps the code more readable.
1751.El
1752.Ss "Warnings related to tables"
1753.Bl -ohang
1754.It Sy "tbl line starts with span"
1755.Pq tbl
1756The first cell in a table layout line is a horizontal span
1757.Pq Sq Cm s .
1758Data provided for this cell is ignored, and nothing is printed in the cell.
1759.It Sy "tbl column starts with span"
1760.Pq tbl
1761The first line of a table layout specification
1762requests a vertical span
1763.Pq Sq Cm ^ .
1764Data provided for this cell is ignored, and nothing is printed in the cell.
1765.It Sy "skipping vertical bar in tbl layout"
1766.Pq tbl
1767A table layout specification contains more than two consecutive vertical bars.
1768A double bar is printed, all additional bars are discarded.
1769.El
1770.Ss "Errors related to tables"
1771.Bl -ohang
1772.It Sy "non-alphabetic character in tbl options"
1773.Pq tbl
1774The table options line contains a character other than a letter,
1775blank, or comma where the beginning of an option name is expected.
1776The character is ignored.
1777.It Sy "skipping unknown tbl option"
1778.Pq tbl
1779The table options line contains a string of letters that does not
1780match any known option name.
1781The word is ignored.
1782.It Sy "missing tbl option argument"
1783.Pq tbl
1784A table option that requires an argument is not followed by an
1785opening parenthesis, or the opening parenthesis is immediately
1786followed by a closing parenthesis.
1787The option is ignored.
1788.It Sy "wrong tbl option argument size"
1789.Pq tbl
1790A table option argument contains an invalid number of characters.
1791Both the option and the argument are ignored.
1792.It Sy "empty tbl layout"
1793.Pq tbl
1794A table layout specification is completely empty,
1795specifying zero lines and zero columns.
1796As a fallback, a single left-justified column is used.
1797.It Sy "invalid character in tbl layout"
1798.Pq tbl
1799A table layout specification contains a character that can neither
1800be interpreted as a layout key character nor as a layout modifier,
1801or a modifier precedes the first key.
1802The invalid character is discarded.
1803.It Sy "unmatched parenthesis in tbl layout"
1804.Pq tbl
1805A table layout specification contains an opening parenthesis,
1806but no matching closing parenthesis.
1807The rest of the input line, starting from the parenthesis, has no effect.
1808.It Sy "tbl without any data cells"
1809.Pq tbl
1810A table does not contain any data cells.
1811It will probably produce no output.
1812.It Sy "ignoring data in spanned tbl cell"
1813.Pq tbl
1814A table cell is marked as a horizontal span
1815.Pq Sq Cm s
1816or vertical span
1817.Pq Sq Cm ^
1818in the table layout, but it contains data.
1819The data is ignored.
1820.It Sy "ignoring extra tbl data cells"
1821.Pq tbl
1822A data line contains more cells than the corresponding layout line.
1823The data in the extra cells is ignored.
1824.It Sy "data block open at end of tbl"
1825.Pq tbl
1826A data block is opened with
1827.Cm T{ ,
1828but never closed with a matching
1829.Cm T} .
1830The remaining data lines of the table are all put into one cell,
1831and any remaining cells stay empty.
1832.El
1833.Ss "Errors related to roff, mdoc, and man code"
1834.Bl -ohang
1835.It Sy "duplicate prologue macro"
1836.Pq mdoc
1837One of the prologue macros occurs more than once.
1838The last instance overrides all previous ones.
1839.It Sy "skipping late title macro"
1840.Pq mdoc
1841The
1842.Ic \&Dt
1843macro appears after the first non-prologue macro.
1844Traditional formatters cannot handle this because
1845they write the page header before parsing the document body.
1846Even though this technical restriction does not apply to
1847.Nm ,
1848traditional semantics is preserved.
1849The late macro is discarded including its arguments.
1850.It Sy "input stack limit exceeded, infinite loop?"
1851.Pq roff
1852Explicit recursion limits are implemented for the following features,
1853in order to prevent infinite loops:
1854.Bl -dash -compact
1855.It
1856expansion of nested escape sequences
1857including expansion of strings and number registers,
1858.It
1859expansion of nested user-defined macros,
1860.It
1861and
1862.Ic \&so
1863file inclusion.
1864.El
1865When a limit is hit, the output is incorrect, typically losing
1866some content, but the parser can continue.
1867.It Sy "skipping bad character"
1868.Pq mdoc , man , roff
1869The input file contains a byte that is not a printable
1870.Xr ascii 7
1871character.
1872The message mentions the character number.
1873The offending byte is replaced with a question mark
1874.Pq Sq \&? .
1875Consider editing the input file to replace the byte with an ASCII
1876transliteration of the intended character.
1877.It Sy "skipping unknown macro"
1878.Pq mdoc , man , roff
1879The first identifier on a request or macro line is neither recognized as a
1880.Xr roff 7
1881request, nor as a user-defined macro, nor, respectively, as an
1882.Xr mdoc 7
1883or
1884.Xr man 7
1885macro.
1886It may be mistyped or unsupported.
1887The request or macro is discarded including its arguments.
1888.It Sy "skipping request outside macro"
1889.Pq roff
1890A
1891.Ic shift
1892or
1893.Ic return
1894request occurs outside any macro definition and has no effect.
1895.It Sy "skipping insecure request"
1896.Pq roff
1897An input file attempted to run a shell command
1898or to read or write an external file.
1899Such attempts are denied for security reasons.
1900.It Sy "skipping item outside list"
1901.Pq mdoc , eqn
1902An
1903.Ic \&It
1904macro occurs outside any
1905.Ic \&Bl
1906list, or an
1907.Xr eqn 7
1908.Ic above
1909delimiter occurs outside any pile.
1910It is discarded including its arguments.
1911.It Sy "skipping column outside column list"
1912.Pq mdoc
1913A
1914.Ic \&Ta
1915macro occurs outside any
1916.Ic \&Bl Fl column
1917block.
1918It is discarded including its arguments.
1919.It Sy "skipping end of block that is not open"
1920.Pq mdoc , man , eqn , tbl , roff
1921Various syntax elements can only be used to explicitly close blocks
1922that have previously been opened.
1923An
1924.Xr mdoc 7
1925block closing macro, a
1926.Xr man 7
1927.Ic \&ME , \&RE
1928or
1929.Ic \&UE
1930macro, an
1931.Xr eqn 7
1932right delimiter or closing brace, or the end of an equation, table, or
1933.Xr roff 7
1934conditional request is encountered but no matching block is open.
1935The offending request or macro is discarded.
1936.It Sy "fewer RS blocks open, skipping"
1937.Pq man
1938The
1939.Ic \&RE
1940macro is invoked with an argument, but less than the specified number of
1941.Ic \&RS
1942blocks is open.
1943The
1944.Ic \&RE
1945macro is discarded.
1946.It Sy "inserting missing end of block"
1947.Pq mdoc , tbl
1948Various
1949.Xr mdoc 7
1950macros as well as tables require explicit closing by dedicated macros.
1951A block that doesn't support bad nesting
1952ends before all of its children are properly closed.
1953The open child nodes are closed implicitly.
1954.It Sy "appending missing end of block"
1955.Pq mdoc , man , eqn , tbl , roff
1956At the end of the document, an explicit
1957.Xr mdoc 7
1958block, a
1959.Xr man 7
1960next-line scope or
1961.Ic \&MT , \&RS
1962or
1963.Ic \&UR
1964block, an equation, table, or
1965.Xr roff 7
1966conditional or ignore block is still open.
1967The open block is closed implicitly.
1968.It Sy "escaped character not allowed in a name"
1969.Pq roff
1970Macro, string and register identifiers consist of printable,
1971non-whitespace ASCII characters.
1972Escape sequences and characters and strings expressed in terms of them
1973cannot form part of a name.
1974The first argument of an
1975.Ic \&am ,
1976.Ic \&as ,
1977.Ic \&de ,
1978.Ic \&ds ,
1979.Ic \&nr ,
1980or
1981.Ic \&rr
1982request, or any argument of an
1983.Ic \&rm
1984request, or the name of a request or user defined macro being called,
1985is terminated by an escape sequence.
1986In the cases of
1987.Ic \&as ,
1988.Ic \&ds ,
1989and
1990.Ic \&nr ,
1991the request has no effect at all.
1992In the cases of
1993.Ic \&am ,
1994.Ic \&de ,
1995.Ic \&rr ,
1996and
1997.Ic \&rm ,
1998what was parsed up to this point is used as the arguments to the request,
1999and the rest of the input line is discarded including the escape sequence.
2000When parsing for a request or a user-defined macro name to be called,
2001only the escape sequence is discarded.
2002The characters preceding it are used as the request or macro name,
2003the characters following it are used as the arguments to the request or macro.
2004.It Sy "using macro argument outside macro"
2005.Pq roff
2006The escape sequence \e$ occurs outside any macro definition
2007and expands to the empty string.
2008.It Sy "argument number is not numeric"
2009.Pq roff
2010The argument of the escape sequence \e$ is not a digit;
2011the escape sequence expands to the empty string.
2012.It Sy "NOT IMPLEMENTED: Bd -file"
2013.Pq mdoc
2014For security reasons, the
2015.Ic \&Bd
2016macro does not support the
2017.Fl file
2018argument.
2019By requesting the inclusion of a sensitive file, a malicious document
2020might otherwise trick a privileged user into inadvertently displaying
2021the file on the screen, revealing the file content to bystanders.
2022The argument is ignored including the file name following it.
2023.It Sy "skipping display without arguments"
2024.Pq mdoc
2025A
2026.Ic \&Bd
2027block macro does not have any arguments.
2028The block is discarded, and the block content is displayed in
2029whatever mode was active before the block.
2030.It Sy "missing list type, using -item"
2031.Pq mdoc
2032A
2033.Ic \&Bl
2034macro fails to specify the list type.
2035.It Sy "argument is not numeric, using 1"
2036.Pq roff
2037The argument of a
2038.Ic \&ce
2039request is not a number.
2040.It Sy "argument is not a character"
2041.Pq roff
2042The first argument of a
2043.Ic char
2044request is neither a single ASCII character
2045nor a single character escape sequence.
2046The request is ignored including all its arguments.
2047.It Sy "missing manual name, using \(dq\(dq"
2048.Pq mdoc
2049The first call to
2050.Ic \&Nm ,
2051or any call in the NAME section, lacks the required argument.
2052.It Sy "uname(3) system call failed, using UNKNOWN"
2053.Pq mdoc
2054The
2055.Ic \&Os
2056macro is called without arguments, and the
2057.Xr uname 3
2058system call failed.
2059As a workaround,
2060.Nm
2061can be compiled with
2062.Sm off
2063.Fl D Cm OSNAME=\(dq\e\(dq Ar string Cm \e\(dq\(dq .
2064.Sm on
2065.It Sy "unknown standard specifier"
2066.Pq mdoc
2067An
2068.Ic \&St
2069macro has an unknown argument and is discarded.
2070.It Sy "skipping request without numeric argument"
2071.Pq roff , eqn
2072An
2073.Ic \&it
2074request or an
2075.Xr eqn 7
2076.Ic \&size
2077or
2078.Ic \&gsize
2079statement has a non-numeric or negative argument or no argument at all.
2080The invalid request or statement is ignored.
2081.It Sy "excessive shift"
2082.Pq roff
2083The argument of a
2084.Ic shift
2085request is larger than the number of arguments of the macro that is
2086currently being executed.
2087All macro arguments are deleted and \en(.$ is set to zero.
2088.It Sy "NOT IMPLEMENTED: .so with absolute path or \(dq..\(dq"
2089.Pq roff
2090For security reasons,
2091.Nm
2092allows
2093.Ic \&so
2094file inclusion requests only with relative paths
2095and only without ascending to any parent directory.
2096By requesting the inclusion of a sensitive file, a malicious document
2097might otherwise trick a privileged user into inadvertently displaying
2098the file on the screen, revealing the file content to bystanders.
2099.Nm
2100only shows the path as it appears behind
2101.Ic \&so .
2102.It Sy ".so request failed"
2103.Pq roff
2104Servicing a
2105.Ic \&so
2106request requires reading an external file, but the file could not be
2107opened.
2108.Nm
2109only shows the path as it appears behind
2110.Ic \&so .
2111.It Sy "skipping all arguments"
2112.Pq mdoc , man , eqn , roff
2113An
2114.Xr mdoc 7
2115.Ic \&Bt ,
2116.Ic \&Ed ,
2117.Ic \&Ef ,
2118.Ic \&Ek ,
2119.Ic \&El ,
2120.Ic \&Lp ,
2121.Ic \&Pp ,
2122.Ic \&Re ,
2123.Ic \&Rs ,
2124or
2125.Ic \&Ud
2126macro, an
2127.Ic \&It
2128macro in a list that don't support item heads, a
2129.Xr man 7
2130.Ic \&LP ,
2131.Ic \&P ,
2132or
2133.Ic \&PP
2134macro, an
2135.Xr eqn 7
2136.Ic \&EQ
2137or
2138.Ic \&EN
2139macro, or a
2140.Xr roff 7
2141.Ic \&br ,
2142.Ic \&fi ,
2143or
2144.Ic \&nf
2145request or
2146.Sq \&..
2147block closing request is invoked with at least one argument.
2148All arguments are ignored.
2149.It Sy "skipping excess arguments"
2150.Pq mdoc , man , roff
2151A macro or request is invoked with too many arguments:
2152.Bl -dash -offset 2n -width 2n -compact
2153.It
2154.Ic \&Fo ,
2155.Ic \&MT ,
2156.Ic \&PD ,
2157.Ic \&RS ,
2158.Ic \&UR ,
2159.Ic \&ft ,
2160or
2161.Ic \&sp
2162with more than one argument
2163.It
2164.Ic \&An
2165with another argument after
2166.Fl split
2167or
2168.Fl nosplit
2169.It
2170.Ic \&RE
2171with more than one argument or with a non-integer argument
2172.It
2173.Ic \&OP
2174or a request of the
2175.Ic \&de
2176family with more than two arguments
2177.It
2178.Ic \&Dt
2179with more than three arguments
2180.It
2181.Ic \&TH
2182with more than five arguments
2183.It
2184.Ic \&Bd ,
2185.Ic \&Bk ,
2186or
2187.Ic \&Bl
2188with invalid arguments
2189.El
2190The excess arguments are ignored.
2191.El
2192.Ss Unsupported features
2193.Bl -ohang
2194.It Sy "input too large"
2195.Pq mdoc , man
2196Currently,
2197.Nm
2198cannot handle input files larger than its arbitrary size limit
2199of 2^31 bytes (2 Gigabytes).
2200Since useful manuals are always small, this is not a problem in practice.
2201Parsing is aborted as soon as the condition is detected.
2202.It Sy "unsupported control character"
2203.Pq roff
2204An ASCII control character supported by other
2205.Xr roff 7
2206implementations but not by
2207.Nm
2208was found in an input file.
2209It is replaced by a question mark.
2210.It Sy "unsupported escape sequence"
2211.Pq roff
2212An input file contains an escape sequence supported by GNU troff
2213or Heirloom troff but not by
2214.Nm ,
2215and it is likely that this will cause information loss
2216or considerable misformatting.
2217.It Sy "unsupported roff request"
2218.Pq roff
2219An input file contains a
2220.Xr roff 7
2221request supported by GNU troff or Heirloom troff but not by
2222.Nm ,
2223and it is likely that this will cause information loss
2224or considerable misformatting.
2225.It Sy "eqn delim option in tbl"
2226.Pq eqn , tbl
2227The options line of a table defines equation delimiters.
2228Any equation source code contained in the table will be printed unformatted.
2229.It Sy "unsupported table layout modifier"
2230.Pq tbl
2231A table layout specification contains an
2232.Sq Cm m
2233modifier.
2234The modifier is discarded.
2235.It Sy "ignoring macro in table"
2236.Pq tbl , mdoc , man
2237A table contains an invocation of an
2238.Xr mdoc 7
2239or
2240.Xr man 7
2241macro or of an undefined macro.
2242The macro is ignored, and its arguments are handled
2243as if they were a text line.
2244.El
2245.Sh SEE ALSO
2246.Xr apropos 1 ,
2247.Xr man 1 ,
2248.Xr eqn 7 ,
2249.Xr man 7 ,
2250.Xr mandoc_char 7 ,
2251.Xr mdoc 7 ,
2252.Xr roff 7 ,
2253.Xr tbl 7
2254.Sh HISTORY
2255The
2256.Nm
2257utility first appeared in
2258.Ox 4.8 .
2259The option
2260.Fl I
2261appeared in
2262.Ox 5.2 ,
2263and
2264.Fl aCcfhKklMSsw
2265in
2266.Ox 5.7 .
2267.Sh AUTHORS
2268.An -nosplit
2269The
2270.Nm
2271utility was written by
2272.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
2273and is maintained by
2274.An Ingo Schwarze Aq Mt schwarze@openbsd.org .
2275