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