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