Annotation of mandoc/mandoc.1, Revision 1.183
1.183 ! schwarze 1: .\" $Id: mandoc.1,v 1.182 2017/03/27 14:40:39 schwarze Exp $
1.1 kristaps 2: .\"
1.92 schwarze 3: .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.168 schwarze 4: .\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
1.1 kristaps 5: .\"
6: .\" Permission to use, copy, modify, and distribute this software for any
1.16 kristaps 7: .\" purpose with or without fee is hereby granted, provided that the above
8: .\" copyright notice and this permission notice appear in all copies.
1.1 kristaps 9: .\"
1.16 kristaps 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.
1.1 kristaps 17: .\"
1.183 ! schwarze 18: .Dd $Mdocdate: March 27 2017 $
1.14 kristaps 19: .Dt MANDOC 1
1.1 kristaps 20: .Os
21: .Sh NAME
22: .Nm mandoc
1.181 schwarze 23: .Nd format manual pages
1.1 kristaps 24: .Sh SYNOPSIS
25: .Nm mandoc
1.153 schwarze 26: .Op Fl acfhkl
1.156 schwarze 27: .Op Fl I Cm os Ns = Ns Ar name
28: .Op Fl K Ar encoding
1.180 schwarze 29: .Op Fl mdoc | man
1.156 schwarze 30: .Op Fl O Ar option
31: .Op Fl T Ar output
32: .Op Fl W Ar level
1.89 kristaps 33: .Op Ar
1.1 kristaps 34: .Sh DESCRIPTION
35: The
36: .Nm
1.26 kristaps 37: utility formats
1.8 kristaps 38: .Ux
1.57 kristaps 39: manual pages for display.
1.100 kristaps 40: .Pp
41: By default,
42: .Nm
43: reads
44: .Xr mdoc 7
45: or
46: .Xr man 7
1.180 schwarze 47: text from stdin and produces
1.156 schwarze 48: .Fl T Cm locale
1.100 kristaps 49: output.
50: .Pp
1.109 schwarze 51: The options are as follows:
1.19 kristaps 52: .Bl -tag -width Ds
1.107 schwarze 53: .It Fl a
54: If the standard output is a terminal device and
55: .Fl c
56: is not specified, use
57: .Xr more 1
58: to paginate the output, just like
59: .Xr man 1
60: would.
61: .It Fl c
62: Copy the formatted manual pages to the standard output without using
63: .Xr more 1
64: to paginate them.
65: This is the default.
66: It can be specified to override
67: .Fl a .
1.156 schwarze 68: .It Fl I Cm os Ns = Ns Ar name
1.101 schwarze 69: Override the default operating system
70: .Ar name
71: for the
72: .Xr mdoc 7
1.180 schwarze 73: .Ic \&Os
1.130 schwarze 74: and for the
75: .Xr man 7
1.180 schwarze 76: .Ic \&TH
1.101 schwarze 77: macro.
1.156 schwarze 78: .It Fl K Ar encoding
1.119 schwarze 79: Specify the input encoding.
80: The supported
81: .Ar encoding
82: arguments are
83: .Cm us-ascii ,
84: .Cm iso-8859-1 ,
85: and
86: .Cm utf-8 .
1.176 schwarze 87: If not specified, autodetection uses the first match in the following
88: list:
89: .Bl -enum
90: .It
91: If the first three bytes of the input file are the UTF-8 byte order
92: mark (BOM, 0xefbbbf), input is interpreted as
93: .Cm utf-8 .
94: .It
95: If the first or second line of the input file matches the
1.119 schwarze 96: .Sy emacs
97: mode line format
98: .Pp
99: .D1 .\e" -*- Oo ...; Oc coding: Ar encoding ; No -*-
1.176 schwarze 100: .Pp
101: then input is interpreted according to
102: .Ar encoding .
103: .It
104: If the first non-ASCII byte in the file introduces a valid UTF-8
105: sequence, input is interpreted as
106: .Cm utf-8 .
107: .It
108: Otherwise, input is interpreted as
109: .Cm iso-8859-1 .
1.119 schwarze 110: .El
1.180 schwarze 111: .It Fl mdoc | man
112: With
113: .Fl mdoc ,
114: all input files are interpreted as
115: .Xr mdoc 7 .
116: With
117: .Fl man ,
118: all input files are interpreted as
119: .Xr man 7 .
120: By default, the input language is automatically detected for each file:
121: if the the first macro is
122: .Ic \&Dd
123: or
124: .Ic \&Dt ,
125: the
126: .Xr mdoc 7
127: parser is used; otherwise, the
128: .Xr man 7
129: parser is used.
130: With other arguments,
131: .Fl m
132: is silently ignored.
1.156 schwarze 133: .It Fl O Ar option
1.57 kristaps 134: Comma-separated output options.
1.156 schwarze 135: .It Fl T Ar output
1.57 kristaps 136: Output format.
137: See
1.1 kristaps 138: .Sx Output Formats
1.57 kristaps 139: for available formats.
140: Defaults to
1.156 schwarze 141: .Fl T Cm locale .
142: .It Fl W Ar level
1.77 schwarze 143: Specify the minimum message
144: .Ar level
145: to be reported on the standard error output and to affect the exit status.
146: The
147: .Ar level
148: can be
1.133 schwarze 149: .Cm warning ,
150: .Cm error ,
1.77 schwarze 151: or
1.133 schwarze 152: .Cm unsupp ;
1.132 schwarze 153: .Cm all
1.77 schwarze 154: is an alias for
1.132 schwarze 155: .Cm warning .
156: By default,
157: .Nm
158: is silent.
1.77 schwarze 159: See
160: .Sx EXIT STATUS
161: and
162: .Sx DIAGNOSTICS
163: for details.
164: .Pp
165: The special option
1.156 schwarze 166: .Fl W Cm stop
1.77 schwarze 167: tells
168: .Nm
169: to exit after parsing a file that causes warnings or errors of at least
170: the requested level.
171: No formatted output will be produced from that file.
172: If both a
173: .Ar level
174: and
175: .Cm stop
176: are requested, they can be joined with a comma, for example
1.156 schwarze 177: .Fl W Cm error , Ns Cm stop .
1.58 kristaps 178: .It Ar file
179: Read input from zero or more files.
1.57 kristaps 180: If unspecified, reads from stdin.
181: If multiple files are specified,
1.2 kristaps 182: .Nm
183: will halt with the first failed parse.
1.1 kristaps 184: .El
1.109 schwarze 185: .Pp
1.183 ! schwarze 186: The options
! 187: .Fl fhklw
! 188: are also supported and are documented in man(1).
1.109 schwarze 189: In
190: .Fl f
191: and
192: .Fl k
193: mode,
194: .Nm
195: also supports the options
1.183 ! schwarze 196: .Fl CMmOSs
1.109 schwarze 197: described in the
198: .Xr apropos 1
199: manual.
1.182 schwarze 200: The options
201: .Fl fkl
202: are mutually exclusive and override each other.
1.1 kristaps 203: .Ss Output Formats
204: The
205: .Nm
206: utility accepts the following
207: .Fl T
1.66 kristaps 208: arguments, which correspond to output modes:
1.175 schwarze 209: .Bl -tag -width "-T markdown"
1.156 schwarze 210: .It Fl T Cm ascii
1.81 kristaps 211: Produce 7-bit ASCII output.
1.57 kristaps 212: See
1.48 kristaps 213: .Sx ASCII Output .
1.156 schwarze 214: .It Fl T Cm html
1.116 kristaps 215: Produce HTML5, CSS1, and MathML output.
1.57 kristaps 216: See
1.48 kristaps 217: .Sx HTML Output .
1.156 schwarze 218: .It Fl T Cm lint
1.58 kristaps 219: Parse only: produce no output.
220: Implies
1.156 schwarze 221: .Fl W Cm warning .
222: .It Fl T Cm locale
1.93 schwarze 223: Encode output using the current locale.
1.128 schwarze 224: This is the default.
1.93 schwarze 225: See
226: .Sx Locale Output .
1.156 schwarze 227: .It Fl T Cm man
1.95 kristaps 228: Produce
1.91 schwarze 229: .Xr man 7
1.95 kristaps 230: format output.
231: See
232: .Sx Man Output .
1.175 schwarze 233: .It Fl T Cm markdown
234: Produce output in
235: .Sy markdown
236: format.
237: See
238: .Sx Markdown Output .
1.156 schwarze 239: .It Fl T Cm pdf
1.73 kristaps 240: Produce PDF output.
241: See
242: .Sx PDF Output .
1.156 schwarze 243: .It Fl T Cm ps
1.62 kristaps 244: Produce PostScript output.
245: See
246: .Sx PostScript Output .
1.156 schwarze 247: .It Fl T Cm tree
1.58 kristaps 248: Produce an indented parse tree.
1.161 schwarze 249: See
250: .Sx Syntax tree output .
1.156 schwarze 251: .It Fl T Cm utf8
1.93 schwarze 252: Encode output in the UTF\-8 multi-byte format.
253: See
254: .Sx UTF\-8 Output .
1.156 schwarze 255: .It Fl T Cm xhtml
1.114 kristaps 256: This is a synonym for
1.156 schwarze 257: .Fl T Cm html .
1.1 kristaps 258: .El
1.13 kristaps 259: .Pp
260: If multiple input files are specified, these will be processed by the
261: corresponding filter in-order.
1.66 kristaps 262: .Ss ASCII Output
263: Output produced by
1.156 schwarze 264: .Fl T Cm ascii
1.128 schwarze 265: is rendered in standard 7-bit ASCII documented in
1.66 kristaps 266: .Xr ascii 7 .
267: .Pp
268: Font styles are applied by using back-spaced encoding such that an
269: underlined character
270: .Sq c
271: is rendered as
272: .Sq _ Ns \e[bs] Ns c ,
273: where
274: .Sq \e[bs]
275: is the back-space character number 8.
276: Emboldened characters are rendered as
277: .Sq c Ns \e[bs] Ns c .
278: .Pp
279: The special characters documented in
280: .Xr mandoc_char 7
281: are rendered best-effort in an ASCII equivalent.
282: .Pp
283: Output width is limited to 78 visible columns unless literal input lines
284: exceed this limit.
285: .Pp
286: The following
287: .Fl O
288: arguments are accepted:
1.19 kristaps 289: .Bl -tag -width Ds
1.98 schwarze 290: .It Cm indent Ns = Ns Ar indent
291: The left margin for normal text is set to
292: .Ar indent
293: blank characters instead of the default of five for
294: .Xr mdoc 7
295: and seven for
296: .Xr man 7 .
297: Increasing this is not recommended; it may result in degraded formatting,
1.99 schwarze 298: for example overfull lines or ugly line breaks.
1.66 kristaps 299: .It Cm width Ns = Ns Ar width
300: The output width is set to
301: .Ar width ,
1.141 schwarze 302: which will normalise to \(>=58.
1.1 kristaps 303: .El
1.66 kristaps 304: .Ss HTML Output
305: Output produced by
1.156 schwarze 306: .Fl T Cm html
1.114 kristaps 307: conforms to HTML5 using optional self-closing tags.
1.116 kristaps 308: Default styles use only CSS1.
309: Equations rendered from
310: .Xr eqn 7
311: blocks use MathML.
1.66 kristaps 312: .Pp
1.61 kristaps 313: The
1.164 schwarze 314: .Pa mandoc.css
1.83 kristaps 315: file documents style-sheet classes available for customising output.
316: If a style-sheet is not specified with
1.156 schwarze 317: .Fl O Cm style ,
318: .Fl T Cm html
1.114 kristaps 319: defaults to simple output (via an embedded style-sheet)
320: readable in any graphical or text-based web
1.83 kristaps 321: browser.
1.66 kristaps 322: .Pp
1.89 kristaps 323: Special characters are rendered in decimal-encoded UTF\-8.
1.66 kristaps 324: .Pp
325: The following
1.64 kristaps 326: .Fl O
1.66 kristaps 327: arguments are accepted:
1.37 kristaps 328: .Bl -tag -width Ds
1.94 kristaps 329: .It Cm fragment
1.123 schwarze 330: Omit the <!DOCTYPE> declaration and the <html>, <head>, and <body>
331: elements and only emit the subtree below the <body> element.
1.94 kristaps 332: The
333: .Cm style
1.97 schwarze 334: argument will be ignored.
1.94 kristaps 335: This is useful when embedding manual content within existing documents.
1.64 kristaps 336: .It Cm includes Ns = Ns Ar fmt
1.40 kristaps 337: The string
338: .Ar fmt ,
1.49 kristaps 339: for example,
1.40 kristaps 340: .Ar ../src/%I.html ,
341: is used as a template for linked header files (usually via the
1.180 schwarze 342: .Ic \&In
1.57 kristaps 343: macro).
344: Instances of
1.43 kristaps 345: .Sq \&%I
1.57 kristaps 346: are replaced with the include filename.
347: The default is not to present a
1.40 kristaps 348: hyperlink.
1.64 kristaps 349: .It Cm man Ns = Ns Ar fmt
1.39 kristaps 350: The string
351: .Ar fmt ,
1.49 kristaps 352: for example,
1.39 kristaps 353: .Ar ../html%S/%N.%S.html ,
354: is used as a template for linked manuals (usually via the
1.180 schwarze 355: .Ic \&Xr
1.57 kristaps 356: macro).
357: Instances of
1.43 kristaps 358: .Sq \&%N
1.40 kristaps 359: and
360: .Sq %S
361: are replaced with the linked manual's name and section, respectively.
1.57 kristaps 362: If no section is included, section 1 is assumed.
363: The default is not to
1.40 kristaps 364: present a hyperlink.
1.64 kristaps 365: .It Cm style Ns = Ns Ar style.css
1.58 kristaps 366: The file
367: .Ar style.css
368: is used for an external style-sheet.
369: This must be a valid absolute or
370: relative URI.
1.61 kristaps 371: .El
1.93 schwarze 372: .Ss Locale Output
373: Locale-depending output encoding is triggered with
1.156 schwarze 374: .Fl T Cm locale .
1.128 schwarze 375: This is the default.
376: .Pp
1.93 schwarze 377: This option is not available on all systems: systems without locale
378: support, or those whose internal representation is not natively UCS-4,
379: will fall back to
1.156 schwarze 380: .Fl T Cm ascii .
1.93 schwarze 381: See
382: .Sx ASCII Output
383: for font style specification and available command-line arguments.
1.95 kristaps 384: .Ss Man Output
385: Translate input format into
386: .Xr man 7
387: output format.
1.102 schwarze 388: This is useful for distributing manual sources to legacy systems
1.96 kristaps 389: lacking
1.95 kristaps 390: .Xr mdoc 7
391: formatters.
392: .Pp
393: If
394: .Xr mdoc 7
395: is passed as input, it is translated into
1.97 schwarze 396: .Xr man 7 .
397: If the input format is
1.95 kristaps 398: .Xr man 7 ,
1.97 schwarze 399: the input is copied to the output, expanding any
1.95 kristaps 400: .Xr roff 7
1.180 schwarze 401: .Ic so
1.97 schwarze 402: requests.
403: The parser is also run, and as usual, the
404: .Fl W
405: level controls which
406: .Sx DIAGNOSTICS
407: are displayed before copying the input to the output.
1.175 schwarze 408: .Ss Markdown Output
409: Translate
410: .Xr mdoc 7
411: input to the
412: .Sy markdown
413: format conforming to
414: .Lk http://daringfireball.net/projects/markdown/syntax.text\
415: "John Gruber's 2004 specification" .
1.178 schwarze 416: The output also almost conforms to the
417: .Lk http://commonmark.org/ CommonMark
418: specification.
419: .Pp
420: The character set used for the markdown output is ASCII.
421: Non-ASCII characters are encoded as HTML entities.
422: Since that is not possible in literal font contexts, because these
423: are rendered as code spans and code blocks in the markdown output,
424: non-ASCII characters are transliterated to ASCII approximations in
425: these contexts.
1.175 schwarze 426: .Pp
427: Markdown is a very weak markup language, so all semantic markup is
428: lost, and even part of the presentational markup may be lost.
429: Do not use this as an intermediate step in converting to HTML;
430: instead, use
431: .Fl T Cm html
432: directly.
433: .Pp
434: The
435: .Xr man 7 ,
436: .Xr tbl 7 ,
437: and
438: .Xr eqn 7
439: input languages are not supported by
440: .Fl T Cm markdown
441: output mode.
1.93 schwarze 442: .Ss PDF Output
443: PDF-1.1 output may be generated by
1.156 schwarze 444: .Fl T Cm pdf .
1.93 schwarze 445: See
446: .Sx PostScript Output
447: for
448: .Fl O
449: arguments and defaults.
1.62 kristaps 450: .Ss PostScript Output
1.65 kristaps 451: PostScript
452: .Qq Adobe-3.0
453: Level-2 pages may be generated by
1.156 schwarze 454: .Fl T Cm ps .
1.67 kristaps 455: Output pages default to letter sized and are rendered in the Times font
1.70 kristaps 456: family, 11-point.
457: Margins are calculated as 1/9 the page length and width.
1.71 kristaps 458: Line-height is 1.4m.
1.66 kristaps 459: .Pp
460: Special characters are rendered as in
461: .Sx ASCII Output .
462: .Pp
463: The following
464: .Fl O
465: arguments are accepted:
466: .Bl -tag -width Ds
467: .It Cm paper Ns = Ns Ar name
468: The paper size
469: .Ar name
470: may be one of
1.68 kristaps 471: .Ar a3 ,
472: .Ar a4 ,
473: .Ar a5 ,
474: .Ar legal ,
1.66 kristaps 475: or
476: .Ar letter .
1.68 kristaps 477: You may also manually specify dimensions as
478: .Ar NNxNN ,
479: width by height in millimetres.
480: If an unknown value is encountered,
481: .Ar letter
482: is used.
1.66 kristaps 483: .El
1.93 schwarze 484: .Ss UTF\-8 Output
485: Use
1.156 schwarze 486: .Fl T Cm utf8
1.93 schwarze 487: to force a UTF\-8 locale.
1.73 kristaps 488: See
1.93 schwarze 489: .Sx Locale Output
490: for details and options.
1.161 schwarze 491: .Ss Syntax tree output
492: Use
493: .Fl T Cm tree
494: to show a human readable representation of the syntax tree.
495: It is useful for debugging the source code of manual pages.
1.162 schwarze 496: The exact format is subject to change, so don't write parsers for it.
1.170 schwarze 497: .Pp
498: The first paragraph shows meta data found in the
499: .Xr mdoc 7
500: prologue, on the
501: .Xr man 7
502: .Ic \&TH
503: line, or the fallbacks used.
504: .Pp
505: In the tree dump, each output line shows one syntax tree node.
1.161 schwarze 506: Child nodes are indented with respect to their parent node.
507: The columns are:
508: .Pp
509: .Bl -enum -compact
510: .It
511: For macro nodes, the macro name; for text and
512: .Xr tbl 7
1.162 schwarze 513: nodes, the content.
514: There is a special format for
1.161 schwarze 515: .Xr eqn 7
516: nodes.
517: .It
518: Node type (text, elem, block, head, body, body-end, tail, tbl, eqn).
519: .It
520: Flags:
521: .Bl -dash -compact
522: .It
523: An opening parenthesis if the node is an opening delimiter.
524: .It
525: An asterisk if the node starts a new input line.
526: .It
527: The input line number (starting at one).
528: .It
529: A colon.
530: .It
531: The input column number (starting at one).
532: .It
533: A closing parenthesis if the node is a closing delimiter.
534: .It
535: A full stop if the node ends a sentence.
1.169 schwarze 536: .It
1.174 schwarze 537: BROKEN if the node is a block broken by another block.
538: .It
1.169 schwarze 539: NOSRC if the node is not in the input file,
540: but automatically generated from macros.
541: .It
542: NOPRT if the node is not supposed to generate output
543: for any output format.
1.161 schwarze 544: .El
1.174 schwarze 545: .El
546: .Pp
547: The following
548: .Fl O
549: argument is accepted:
550: .Bl -tag -width Ds
551: .It Cm noval
552: Skip validation and show the unvalidated syntax tree.
553: This can help to find out whether a given behaviour is caused by
554: the parser or by the validator.
555: Meta data is not available in this case.
1.161 schwarze 556: .El
1.108 schwarze 557: .Sh ENVIRONMENT
558: .Bl -tag -width MANPAGER
559: .It Ev MANPAGER
560: Any non-empty value of the environment variable
561: .Ev MANPAGER
1.179 schwarze 562: is used instead of the standard pagination program,
563: .Xr more 1 ;
564: see
565: .Xr man 1
566: for details.
567: Only used if
568: .Fl a
569: or
570: .Fl l
571: is specified.
1.108 schwarze 572: .It Ev PAGER
573: Specifies the pagination program to use when
574: .Ev MANPAGER
575: is not defined.
576: If neither PAGER nor MANPAGER is defined,
1.159 schwarze 577: .Xr more 1
578: .Fl s
1.179 schwarze 579: is used.
580: Only used if
581: .Fl a
582: or
583: .Fl l
584: is specified.
1.108 schwarze 585: .El
1.77 schwarze 586: .Sh EXIT STATUS
587: The
588: .Nm
589: utility exits with one of the following values, controlled by the message
590: .Ar level
591: associated with the
592: .Fl W
593: option:
594: .Pp
595: .Bl -tag -width Ds -compact
596: .It 0
597: No warnings or errors occurred, or those that did were ignored because
598: they were lower than the requested
599: .Ar level .
600: .It 2
601: At least one warning occurred, but no error, and
1.156 schwarze 602: .Fl W Cm warning
1.77 schwarze 603: was specified.
604: .It 3
1.133 schwarze 605: At least one parsing error occurred,
606: but no unsupported feature was encountered, and
1.156 schwarze 607: .Fl W Cm error
1.133 schwarze 608: or
1.156 schwarze 609: .Fl W Cm warning
1.133 schwarze 610: was specified.
611: .It 4
1.134 schwarze 612: At least one unsupported feature was encountered, and
1.156 schwarze 613: .Fl W Cm unsupp ,
614: .Fl W Cm error
1.77 schwarze 615: or
1.156 schwarze 616: .Fl W Cm warning
1.77 schwarze 617: was specified.
618: .It 5
619: Invalid command line arguments were specified.
620: No input files have been read.
621: .It 6
1.131 schwarze 622: An operating system error occurred, for example exhaustion
623: of memory, file descriptors, or process table entries.
1.77 schwarze 624: Such errors cause
625: .Nm
626: to exit at once, possibly in the middle of parsing or formatting a file.
627: .El
628: .Pp
629: Note that selecting
1.156 schwarze 630: .Fl T Cm lint
1.77 schwarze 631: output mode implies
1.156 schwarze 632: .Fl W Cm warning .
1.1 kristaps 633: .Sh EXAMPLES
1.13 kristaps 634: To page manuals to the terminal:
1.1 kristaps 635: .Pp
1.156 schwarze 636: .Dl $ mandoc \-W all,stop mandoc.1 2\*(Gt&1 | less
1.82 kristaps 637: .Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
1.28 kristaps 638: .Pp
1.41 kristaps 639: To produce HTML manuals with
1.164 schwarze 640: .Pa mandoc.css
1.41 kristaps 641: as the style-sheet:
1.38 kristaps 642: .Pp
1.164 schwarze 643: .Dl $ mandoc \-T html -O style=mandoc.css mdoc.7 \*(Gt mdoc.7.html
1.38 kristaps 644: .Pp
1.28 kristaps 645: To check over a large set of manuals:
646: .Pp
1.158 schwarze 647: .Dl $ mandoc \-T lint \(gafind /usr/src -name \e*\e.[1-9]\(ga
1.66 kristaps 648: .Pp
649: To produce a series of PostScript manuals for A4 paper:
650: .Pp
1.156 schwarze 651: .Dl $ mandoc \-T ps \-O paper=a4 mdoc.7 man.7 \*(Gt manuals.ps
1.91 schwarze 652: .Pp
653: Convert a modern
654: .Xr mdoc 7
655: manual to the older
656: .Xr man 7
657: format, for use on systems lacking an
658: .Xr mdoc 7
659: parser:
660: .Pp
1.156 schwarze 661: .Dl $ mandoc \-T man foo.mdoc \*(Gt foo.man
1.77 schwarze 662: .Sh DIAGNOSTICS
1.106 schwarze 663: Messages displayed by
664: .Nm
665: follow this format:
1.77 schwarze 666: .Pp
1.106 schwarze 667: .D1 Nm Ns : Ar file : Ns Ar line : Ns Ar column : level : message : macro args
1.77 schwarze 668: .Pp
1.106 schwarze 669: Line and column numbers start at 1.
670: Both are omitted for messages referring to an input file as a whole.
671: Macro names and arguments are omitted where meaningless.
672: Fatal messages about invalid command line arguments
673: or operating system errors, for example when memory is exhausted,
674: may also omit the
675: .Ar file
1.104 schwarze 676: and
1.106 schwarze 677: .Ar level
678: fields.
1.104 schwarze 679: .Pp
1.77 schwarze 680: Message levels have the following meanings:
681: .Bl -tag -width "warning"
1.133 schwarze 682: .It Cm unsupp
683: An input file uses unsupported low-level
684: .Xr roff 7
685: features.
686: The output may be incomplete and/or misformatted,
687: so using GNU troff instead of
688: .Nm
689: to process the file may be preferable.
1.77 schwarze 690: .It Cm error
1.133 schwarze 691: An input file contains invalid syntax that cannot be safely interpreted.
1.77 schwarze 692: By discarding part of the input or inserting missing tokens,
693: the parser is able to continue, and the error does not prevent
694: generation of formatted output, but typically, preparing that
695: output involves information loss, broken document structure
1.133 schwarze 696: or unintended formatting, no matter whether
697: .Nm
698: or GNU troff is used.
699: In many cases, the output of
700: .Nm
701: and GNU troff is identical, but in some,
702: .Nm
703: is more resilient than GNU troff with respect to malformed input.
1.131 schwarze 704: .Pp
705: Non-existent or unreadable input files are also reported on the
706: .Cm error
707: level.
708: In that case, the parser cannot even be started and no output
709: is produced from those input files.
1.77 schwarze 710: .It Cm warning
711: An input file uses obsolete, discouraged or non-portable syntax.
712: All the same, the meaning of the input is unambiguous and a correct
713: rendering can be produced.
714: Documents causing warnings may render poorly when using other
715: formatting tools instead of
716: .Nm .
717: .El
718: .Pp
719: Messages of the
1.133 schwarze 720: .Cm warning ,
721: .Cm error ,
1.77 schwarze 722: and
1.133 schwarze 723: .Cm unsupp
1.131 schwarze 724: levels except those about non-existent or unreadable input files
725: are hidden unless their level, or a lower level, is requested using a
1.77 schwarze 726: .Fl W
727: option or
1.156 schwarze 728: .Fl T Cm lint
1.77 schwarze 729: output mode.
1.106 schwarze 730: .Ss Warnings related to the document prologue
731: .Bl -ohang
732: .It Sy "missing manual title, using UNTITLED"
733: .Pq mdoc
734: A
735: .Ic \&Dt
736: macro has no arguments, or there is no
737: .Ic \&Dt
738: macro before the first non-prologue macro.
739: .It Sy "missing manual title, using \(dq\(dq"
740: .Pq man
741: There is no
742: .Ic \&TH
743: macro, or it has no arguments.
744: .It Sy "lower case character in document title"
745: .Pq mdoc , man
746: The title is still used as given in the
747: .Ic \&Dt
748: or
749: .Ic \&TH
750: macro.
751: .It Sy "missing manual section, using \(dq\(dq"
752: .Pq mdoc , man
753: A
754: .Ic \&Dt
755: or
756: .Ic \&TH
757: macro lacks the mandatory section argument.
758: .It Sy "unknown manual section"
759: .Pq mdoc
760: The section number in a
761: .Ic \&Dt
762: line is invalid, but still used.
763: .It Sy "missing date, using today's date"
764: .Pq mdoc, man
765: The document was parsed as
766: .Xr mdoc 7
767: and it has no
768: .Ic \&Dd
769: macro, or the
770: .Ic \&Dd
771: macro has no arguments or only empty arguments;
772: or the document was parsed as
773: .Xr man 7
774: and it has no
775: .Ic \&TH
776: macro, or the
777: .Ic \&TH
778: macro has less than three arguments or its third argument is empty.
779: .It Sy "cannot parse date, using it verbatim"
780: .Pq mdoc , man
781: The date given in a
782: .Ic \&Dd
783: or
784: .Ic \&TH
785: macro does not follow the conventional format.
786: .It Sy "missing Os macro, using \(dq\(dq"
787: .Pq mdoc
788: The default or current system is not shown in this case.
789: .It Sy "duplicate prologue macro"
790: .Pq mdoc
791: One of the prologue macros occurs more than once.
792: The last instance overrides all previous ones.
793: .It Sy "late prologue macro"
794: .Pq mdoc
795: A
796: .Ic \&Dd
797: or
798: .Ic \&Os
799: macro occurs after some non-prologue macro, but still takes effect.
800: .It Sy "skipping late title macro"
801: .Pq mdoc
802: The
803: .Ic \&Dt
1.152 schwarze 804: macro appears after the first non-prologue macro.
805: Traditional formatters cannot handle this because
806: they write the page header before parsing the document body.
1.106 schwarze 807: Even though this technical restriction does not apply to
808: .Nm ,
809: traditional semantics is preserved.
810: The late macro is discarded including its arguments.
811: .It Sy "prologue macros out of order"
812: .Pq mdoc
813: The prologue macros are not given in the conventional order
814: .Ic \&Dd ,
815: .Ic \&Dt ,
816: .Ic \&Os .
817: All three macros are used even when given in another order.
818: .El
819: .Ss Warnings regarding document structure
820: .Bl -ohang
821: .It Sy ".so is fragile, better use ln(1)"
822: .Pq roff
823: Including files only works when the parser program runs with the correct
824: current working directory.
825: .It Sy "no document body"
826: .Pq mdoc , man
827: The document body contains neither text nor macros.
828: An empty document is shown, consisting only of a header and a footer line.
829: .It Sy "content before first section header"
830: .Pq mdoc , man
831: Some macros or text precede the first
832: .Ic \&Sh
833: or
834: .Ic \&SH
835: section header.
836: The offending macros and text are parsed and added to the top level
837: of the syntax tree, outside any section block.
838: .It Sy "first section is not NAME"
839: .Pq mdoc
840: The argument of the first
841: .Ic \&Sh
842: macro is not
843: .Sq NAME .
844: This may confuse
845: .Xr makewhatis 8
846: and
847: .Xr apropos 1 .
1.168 schwarze 848: .It Sy "NAME section without Nm before Nd"
1.106 schwarze 849: .Pq mdoc
1.155 schwarze 850: The NAME section does not contain any
851: .Ic \&Nm
1.168 schwarze 852: child macro before the first
853: .Ic \&Nd
854: macro.
1.155 schwarze 855: .It Sy "NAME section without description"
856: .Pq mdoc
857: The NAME section lacks the mandatory
858: .Ic \&Nd
859: child macro.
860: .It Sy "description not at the end of NAME"
861: .Pq mdoc
862: The NAME section does contain an
1.106 schwarze 863: .Ic \&Nd
1.155 schwarze 864: child macro, but other content follows it.
865: .It Sy "bad NAME section content"
866: .Pq mdoc
867: The NAME section contains plain text or macros other than
868: .Ic \&Nm
1.106 schwarze 869: and
1.155 schwarze 870: .Ic \&Nd .
1.168 schwarze 871: .It Sy "missing comma before name"
872: .Pq mdoc
873: The NAME section contains an
874: .Ic \&Nm
875: macro that is neither the first one nor preceded by a comma.
1.142 schwarze 876: .It Sy "missing description line, using \(dq\(dq"
877: .Pq mdoc
878: The
879: .Ic \&Nd
880: macro lacks the required argument.
881: The title line of the manual will end after the dash.
1.177 schwarze 882: .It Sy "description line outside NAME section"
883: .Pq mdoc
884: An
885: .Ic \&Nd
886: macro appears outside the NAME section.
887: The arguments are printed anyway and the following text is used for
888: .Xr apropos 1 ,
889: but none of that behaviour is portable.
1.106 schwarze 890: .It Sy "sections out of conventional order"
891: .Pq mdoc
892: A standard section occurs after another section it usually precedes.
893: All section titles are used as given,
894: and the order of sections is not changed.
895: .It Sy "duplicate section title"
896: .Pq mdoc
897: The same standard section title occurs more than once.
898: .It Sy "unexpected section"
899: .Pq mdoc
900: A standard section header occurs in a section of the manual
901: where it normally isn't useful.
1.112 schwarze 902: .It Sy "unusual Xr order"
903: .Pq mdoc
904: In the SEE ALSO section, an
905: .Ic \&Xr
906: macro with a lower section number follows one with a higher number,
907: or two
908: .Ic \&Xr
1.157 schwarze 909: macros referring to the same section are out of alphabetical order.
1.112 schwarze 910: .It Sy "unusual Xr punctuation"
911: .Pq mdoc
912: In the SEE ALSO section, punctuation between two
913: .Ic \&Xr
914: macros differs from a single comma, or there is trailing punctuation
915: after the last
916: .Ic \&Xr
917: macro.
1.111 schwarze 918: .It Sy "AUTHORS section without An macro"
919: .Pq mdoc
920: An AUTHORS sections contains no
921: .Ic \&An
922: macros, or only empty ones.
923: Probably, there are author names lacking markup.
1.106 schwarze 924: .El
925: .Ss "Warnings related to macros and nesting"
926: .Bl -ohang
927: .It Sy "obsolete macro"
928: .Pq mdoc
929: See the
930: .Xr mdoc 7
931: manual for replacements.
1.126 schwarze 932: .It Sy "macro neither callable nor escaped"
933: .Pq mdoc
934: The name of a macro that is not callable appears on a macro line.
935: It is printed verbatim.
1.152 schwarze 936: If the intention is to call it, move it to its own input line;
1.126 schwarze 937: otherwise, escape it by prepending
938: .Sq \e& .
1.106 schwarze 939: .It Sy "skipping paragraph macro"
940: In
941: .Xr mdoc 7
942: documents, this happens
943: .Bl -dash -compact
944: .It
945: at the beginning and end of sections and subsections
946: .It
947: right before non-compact lists and displays
948: .It
949: at the end of items in non-column, non-compact lists
950: .It
951: and for multiple consecutive paragraph macros.
952: .El
953: In
954: .Xr man 7
955: documents, it happens
956: .Bl -dash -compact
957: .It
958: for empty
959: .Ic \&P ,
960: .Ic \&PP ,
961: and
962: .Ic \&LP
963: macros
964: .It
965: for
966: .Ic \&IP
967: macros having neither head nor body arguments
968: .It
969: for
970: .Ic \&br
971: or
972: .Ic \&sp
973: right after
974: .Ic \&SH
975: or
976: .Ic \&SS
977: .El
978: .It Sy "moving paragraph macro out of list"
979: .Pq mdoc
980: A list item in a
981: .Ic \&Bl
982: list contains a trailing paragraph macro.
983: The paragraph macro is moved after the end of the list.
984: .It Sy "skipping no-space macro"
985: .Pq mdoc
986: An input line begins with an
987: .Ic \&Ns
988: macro.
989: The macro is ignored.
990: .It Sy "blocks badly nested"
991: .Pq mdoc
992: If two blocks intersect, one should completely contain the other.
993: Otherwise, rendered output is likely to look strange in any output
994: format, and rendering in SGML-based output formats is likely to be
995: outright wrong because such languages do not support badly nested
996: blocks at all.
997: Typical examples of badly nested blocks are
998: .Qq Ic \&Ao \&Bo \&Ac \&Bc
999: and
1000: .Qq Ic \&Ao \&Bq \&Ac .
1001: In these examples,
1002: .Ic \&Ac
1003: breaks
1004: .Ic \&Bo
1005: and
1006: .Ic \&Bq ,
1007: respectively.
1008: .It Sy "nested displays are not portable"
1009: .Pq mdoc
1010: A
1011: .Ic \&Bd ,
1012: .Ic \&D1 ,
1013: or
1014: .Ic \&Dl
1015: display occurs nested inside another
1016: .Ic \&Bd
1017: display.
1018: This works with
1019: .Nm ,
1020: but fails with most other implementations.
1021: .It Sy "moving content out of list"
1022: .Pq mdoc
1023: A
1024: .Ic \&Bl
1025: list block contains text or macros before the first
1026: .Ic \&It
1027: macro.
1028: The offending children are moved before the beginning of the list.
1029: .It Sy "fill mode already enabled, skipping"
1030: .Pq man
1031: A
1032: .Ic \&fi
1033: request occurs even though the document is still in fill mode,
1034: or already switched back to fill mode.
1035: It has no effect.
1036: .It Sy "fill mode already disabled, skipping"
1037: .Pq man
1038: An
1039: .Ic \&nf
1040: request occurs even though the document already switched to no-fill mode
1041: and did not switch back to fill mode yet.
1042: It has no effect.
1043: .It Sy "line scope broken"
1044: .Pq man
1045: While parsing the next-line scope of the previous macro,
1046: another macro is found that prematurely terminates the previous one.
1047: The previous, interrupted macro is deleted from the parse tree.
1048: .El
1049: .Ss "Warnings related to missing arguments"
1050: .Bl -ohang
1051: .It Sy "skipping empty request"
1.118 schwarze 1052: .Pq roff , eqn
1053: The macro name is missing from a macro definition request,
1054: or an
1055: .Xr eqn 7
1056: control statement or operation keyword lacks its required argument.
1.106 schwarze 1057: .It Sy "conditional request controls empty scope"
1058: .Pq roff
1059: A conditional request is only useful if any of the following
1060: follows it on the same logical input line:
1061: .Bl -dash -compact
1062: .It
1063: The
1064: .Sq \e{
1065: keyword to open a multi-line scope.
1066: .It
1067: A request or macro or some text, resulting in a single-line scope.
1068: .It
1069: The immediate end of the logical line without any intervening whitespace,
1070: resulting in next-line scope.
1071: .El
1072: Here, a conditional request is followed by trailing whitespace only,
1073: and there is no other content on its logical input line.
1074: Note that it doesn't matter whether the logical input line is split
1075: across multiple physical input lines using
1076: .Sq \e
1077: line continuation characters.
1078: This is one of the rare cases
1079: where trailing whitespace is syntactically significant.
1080: The conditional request controls a scope containing whitespace only,
1081: so it is unlikely to have a significant effect,
1082: except that it may control a following
1083: .Ic \&el
1084: clause.
1085: .It Sy "skipping empty macro"
1086: .Pq mdoc
1.147 schwarze 1087: The indicated macro has no arguments and hence no effect.
1088: .It Sy "empty block"
1089: .Pq mdoc , man
1090: A
1091: .Ic \&Bd ,
1092: .Ic \&Bk ,
1093: .Ic \&Bl ,
1094: .Ic \&D1 ,
1095: .Ic \&Dl ,
1096: .Ic \&RS ,
1097: or
1098: .Ic \&UR
1099: block contains nothing in its body and will produce no output.
1.106 schwarze 1100: .It Sy "empty argument, using 0n"
1101: .Pq mdoc
1102: The required width is missing after
1103: .Ic \&Bd
1104: or
1105: .Ic \&Bl
1106: .Fl offset
1107: or
1108: .Fl width.
1109: .It Sy "missing display type, using -ragged"
1110: .Pq mdoc
1111: The
1112: .Ic \&Bd
1113: macro is invoked without the required display type.
1114: .It Sy "list type is not the first argument"
1115: .Pq mdoc
1116: In a
1117: .Ic \&Bl
1118: macro, at least one other argument precedes the type argument.
1119: The
1120: .Nm
1121: utility copes with any argument order, but some other
1122: .Xr mdoc 7
1123: implementations do not.
1124: .It Sy "missing -width in -tag list, using 8n"
1125: .Pq mdoc
1126: Every
1127: .Ic \&Bl
1128: macro having the
1129: .Fl tag
1130: argument requires
1131: .Fl width ,
1132: too.
1133: .It Sy "missing utility name, using \(dq\(dq"
1134: .Pq mdoc
1135: The
1136: .Ic \&Ex Fl std
1137: macro is called without an argument before
1138: .Ic \&Nm
1139: has first been called with an argument.
1.146 schwarze 1140: .It Sy "missing function name, using \(dq\(dq"
1141: .Pq mdoc
1142: The
1143: .Ic \&Fo
1144: macro is called without an argument.
1145: No function name is printed.
1.106 schwarze 1146: .It Sy "empty head in list item"
1147: .Pq mdoc
1148: In a
1149: .Ic \&Bl
1150: .Fl diag ,
1151: .Fl hang ,
1152: .Fl inset ,
1153: .Fl ohang ,
1154: or
1155: .Fl tag
1156: list, an
1157: .Ic \&It
1158: macro lacks the required argument.
1159: The item head is left empty.
1160: .It Sy "empty list item"
1161: .Pq mdoc
1162: In a
1163: .Ic \&Bl
1164: .Fl bullet ,
1165: .Fl dash ,
1166: .Fl enum ,
1167: or
1168: .Fl hyphen
1169: list, an
1170: .Ic \&It
1171: block is empty.
1172: An empty list item is shown.
1.152 schwarze 1173: .It Sy "missing font type, using \efR"
1.106 schwarze 1174: .Pq mdoc
1175: A
1176: .Ic \&Bf
1177: macro has no argument.
1.152 schwarze 1178: It switches to the default font.
1179: .It Sy "unknown font type, using \efR"
1.106 schwarze 1180: .Pq mdoc
1181: The
1182: .Ic \&Bf
1183: argument is invalid.
1.152 schwarze 1184: The default font is used instead.
1.127 schwarze 1185: .It Sy "nothing follows prefix"
1186: .Pq mdoc
1187: A
1188: .Ic \&Pf
1189: macro has no argument, or only one argument and no macro follows
1190: on the same input line.
1191: This defeats its purpose; in particular, spacing is not suppressed
1192: before the text or macros following on the next input line.
1.143 schwarze 1193: .It Sy "empty reference block"
1194: .Pq mdoc
1195: An
1196: .Ic \&Rs
1197: macro is immediately followed by an
1198: .Ic \&Re
1199: macro on the next input line.
1200: Such an empty block does not produce any output.
1.165 schwarze 1201: .It Sy "missing section argument"
1202: .Pq mdoc
1203: An
1204: .Ic \&Xr
1205: macro lacks its second, section number argument.
1206: The first argument, i.e. the name, is printed, but without subsequent
1.166 schwarze 1207: parentheses.
1.106 schwarze 1208: .It Sy "missing -std argument, adding it"
1209: .Pq mdoc
1210: An
1211: .Ic \&Ex
1212: or
1213: .Ic \&Rv
1214: macro lacks the required
1215: .Fl std
1216: argument.
1217: The
1218: .Nm
1219: utility assumes
1220: .Fl std
1221: even when it is not specified, but other implementations may not.
1.150 schwarze 1222: .It Sy "missing option string, using \(dq\(dq"
1223: .Pq man
1224: The
1225: .Ic \&OP
1226: macro is invoked without any argument.
1227: An empty pair of square brackets is shown.
1228: .It Sy "missing resource identifier, using \(dq\(dq"
1229: .Pq man
1230: The
1231: .Ic \&UR
1232: macro is invoked without any argument.
1233: An empty pair of angle brackets is shown.
1.118 schwarze 1234: .It Sy "missing eqn box, using \(dq\(dq"
1235: .Pq eqn
1236: A diacritic mark or a binary operator is found,
1237: but there is nothing to the left of it.
1238: An empty box is inserted.
1.106 schwarze 1239: .El
1240: .Ss "Warnings related to bad macro arguments"
1241: .Bl -ohang
1242: .It Sy "unterminated quoted argument"
1243: .Pq roff
1244: Macro arguments can be enclosed in double quote characters
1245: such that space characters and macro names contained in the quoted
1246: argument need not be escaped.
1247: The closing quote of the last argument of a macro can be omitted.
1248: However, omitting it is not recommended because it makes the code
1249: harder to read.
1250: .It Sy "duplicate argument"
1251: .Pq mdoc
1252: A
1253: .Ic \&Bd
1254: or
1255: .Ic \&Bl
1256: macro has more than one
1257: .Fl compact ,
1258: more than one
1259: .Fl offset ,
1260: or more than one
1261: .Fl width
1262: argument.
1263: All but the last instances of these arguments are ignored.
1264: .It Sy "skipping duplicate argument"
1265: .Pq mdoc
1266: An
1267: .Ic \&An
1268: macro has more than one
1269: .Fl split
1270: or
1271: .Fl nosplit
1272: argument.
1273: All but the first of these arguments are ignored.
1274: .It Sy "skipping duplicate display type"
1275: .Pq mdoc
1276: A
1277: .Ic \&Bd
1278: macro has more than one type argument; the first one is used.
1279: .It Sy "skipping duplicate list type"
1280: .Pq mdoc
1281: A
1282: .Ic \&Bl
1283: macro has more than one type argument; the first one is used.
1284: .It Sy "skipping -width argument"
1285: .Pq mdoc
1286: A
1287: .Ic \&Bl
1288: .Fl column ,
1289: .Fl diag ,
1290: .Fl ohang ,
1291: .Fl inset ,
1292: or
1293: .Fl item
1294: list has a
1295: .Fl width
1296: argument.
1297: That has no effect.
1.151 schwarze 1298: .It Sy "wrong number of cells"
1299: In a line of a
1300: .Ic \&Bl Fl column
1301: list, the number of tabs or
1302: .Ic \&Ta
1303: macros is less than the number expected from the list header line
1304: or exceeds the expected number by more than one.
1305: Missing cells remain empty, and all cells exceeding the number of
1306: columns are joined into one single cell.
1.106 schwarze 1307: .It Sy "unknown AT&T UNIX version"
1308: .Pq mdoc
1309: An
1310: .Ic \&At
1311: macro has an invalid argument.
1312: It is used verbatim, with
1313: .Qq "AT&T UNIX "
1314: prefixed to it.
1.113 schwarze 1315: .It Sy "comma in function argument"
1316: .Pq mdoc
1317: An argument of an
1318: .Ic \&Fa
1319: or
1320: .Ic \&Fn
1321: macro contains a comma; it should probably be split into two arguments.
1.117 schwarze 1322: .It Sy "parenthesis in function name"
1323: .Pq mdoc
1324: The first argument of an
1325: .Ic \&Fc
1326: or
1327: .Ic \&Fn
1328: macro contains an opening or closing parenthesis; that's probably wrong,
1329: parentheses are added automatically.
1.106 schwarze 1330: .It Sy "invalid content in Rs block"
1331: .Pq mdoc
1332: An
1333: .Ic \&Rs
1334: block contains plain text or non-% macros.
1335: The bogus content is left in the syntax tree.
1336: Formatting may be poor.
1337: .It Sy "invalid Boolean argument"
1338: .Pq mdoc
1339: An
1340: .Ic \&Sm
1341: macro has an argument other than
1342: .Cm on
1343: or
1344: .Cm off .
1345: The invalid argument is moved out of the macro, which leaves the macro
1346: empty, causing it to toggle the spacing mode.
1347: .It Sy "unknown font, skipping request"
1.115 schwarze 1348: .Pq man , tbl
1.106 schwarze 1349: A
1350: .Xr roff 7
1351: .Ic \&ft
1.115 schwarze 1352: request or a
1353: .Xr tbl 7
1354: .Ic \&f
1355: layout modifier has an unknown
1356: .Ar font
1357: argument.
1.151 schwarze 1358: .It Sy "odd number of characters in request"
1359: .Pq roff
1360: A
1361: .Ic \&tr
1362: request contains an odd number of characters.
1363: The last character is mapped to the blank character.
1.106 schwarze 1364: .El
1365: .Ss "Warnings related to plain text"
1366: .Bl -ohang
1367: .It Sy "blank line in fill mode, using .sp"
1368: .Pq mdoc
1369: The meaning of blank input lines is only well-defined in non-fill mode:
1370: In fill mode, line breaks of text input lines are not supposed to be
1371: significant.
1372: However, for compatibility with groff, blank lines in fill mode
1373: are replaced with
1374: .Ic \&sp
1375: requests.
1376: .It Sy "tab in filled text"
1377: .Pq mdoc , man
1378: The meaning of tab characters is only well-defined in non-fill mode:
1379: In fill mode, whitespace is not supposed to be significant
1380: on text input lines.
1381: As an implementation dependent choice, tab characters on text lines
1382: are passed through to the formatters in any case.
1383: Given that the text before the tab character will be filled,
1384: it is hard to predict which tab stop position the tab will advance to.
1385: .It Sy "whitespace at end of input line"
1386: .Pq mdoc , man , roff
1387: Whitespace at the end of input lines is almost never semantically
1388: significant \(em but in the odd case where it might be, it is
1389: extremely confusing when reviewing and maintaining documents.
1.172 schwarze 1390: .It Sy "new sentence, new line"
1391: .Pq mdoc
1392: A new sentence starts in the middle of a text line.
1393: Start it on a new input line to help formatters produce correct spacing.
1.106 schwarze 1394: .It Sy "bad comment style"
1395: .Pq roff
1396: Comment lines start with a dot, a backslash, and a double-quote character.
1397: The
1398: .Nm
1399: utility treats the line as a comment line even without the backslash,
1400: but leaving out the backslash might not be portable.
1401: .It Sy "invalid escape sequence"
1402: .Pq roff
1403: An escape sequence has an invalid opening argument delimiter, lacks the
1404: closing argument delimiter, or the argument has too few characters.
1405: If the argument is incomplete,
1406: .Ic \e*
1407: and
1408: .Ic \en
1409: expand to an empty string,
1410: .Ic \eB
1411: to the digit
1412: .Sq 0 ,
1413: and
1414: .Ic \ew
1415: to the length of the incomplete argument.
1416: All other invalid escape sequences are ignored.
1417: .It Sy "undefined string, using \(dq\(dq"
1418: .Pq roff
1419: If a string is used without being defined before,
1420: its value is implicitly set to the empty string.
1421: However, defining strings explicitly before use
1422: keeps the code more readable.
1423: .El
1.138 schwarze 1424: .Ss "Warnings related to tables"
1425: .Bl -ohang
1426: .It Sy "tbl line starts with span"
1427: .Pq tbl
1428: The first cell in a table layout line is a horizontal span
1429: .Pq Sq Cm s .
1430: Data provided for this cell is ignored, and nothing is printed in the cell.
1431: .It Sy "tbl column starts with span"
1432: .Pq tbl
1433: The first line of a table layout specification
1434: requests a vertical span
1435: .Pq Sq Cm ^ .
1436: Data provided for this cell is ignored, and nothing is printed in the cell.
1437: .It Sy "skipping vertical bar in tbl layout"
1438: .Pq tbl
1439: A table layout specification contains more than two consecutive vertical bars.
1440: A double bar is printed, all additional bars are discarded.
1.106 schwarze 1441: .El
1442: .Ss "Errors related to tables"
1.136 schwarze 1443: .Bl -ohang
1444: .It Sy "non-alphabetic character in tbl options"
1445: .Pq tbl
1446: The table options line contains a character other than a letter,
1447: blank, or comma where the beginning of an option name is expected.
1448: The character is ignored.
1449: .It Sy "skipping unknown tbl option"
1450: .Pq tbl
1451: The table options line contains a string of letters that does not
1452: match any known option name.
1453: The word is ignored.
1454: .It Sy "missing tbl option argument"
1455: .Pq tbl
1456: A table option that requires an argument is not followed by an
1457: opening parenthesis, or the opening parenthesis is immediately
1458: followed by a closing parenthesis.
1459: The option is ignored.
1460: .It Sy "wrong tbl option argument size"
1461: .Pq tbl
1462: A table option argument contains an invalid number of characters.
1463: Both the option and the argument are ignored.
1.138 schwarze 1464: .It Sy "empty tbl layout"
1465: .Pq tbl
1466: A table layout specification is completely empty,
1467: specifying zero lines and zero columns.
1468: As a fallback, a single left-justified column is used.
1469: .It Sy "invalid character in tbl layout"
1470: .Pq tbl
1471: A table layout specification contains a character that can neither
1472: be interpreted as a layout key character nor as a layout modifier,
1473: or a modifier precedes the first key.
1474: The invalid character is discarded.
1475: .It Sy "unmatched parenthesis in tbl layout"
1476: .Pq tbl
1477: A table layout specification contains an opening parenthesis,
1478: but no matching closing parenthesis.
1479: The rest of the input line, starting from the parenthesis, has no effect.
1.139 schwarze 1480: .It Sy "tbl without any data cells"
1481: .Pq tbl
1482: A table does not contain any data cells.
1483: It will probably produce no output.
1484: .It Sy "ignoring data in spanned tbl cell"
1485: .Pq tbl
1486: A table cell is marked as a horizontal span
1487: .Pq Sq Cm s
1488: or vertical span
1489: .Pq Sq Cm ^
1490: in the table layout, but it contains data.
1491: The data is ignored.
1492: .It Sy "ignoring extra tbl data cells"
1493: .Pq tbl
1494: A data line contains more cells than the corresponding layout line.
1495: The data in the extra cells is ignored.
1496: .It Sy "data block open at end of tbl"
1497: .Pq tbl
1498: A data block is opened with
1499: .Cm T{ ,
1500: but never closed with a matching
1501: .Cm T} .
1502: The remaining data lines of the table are all put into one cell,
1503: and any remaining cells stay empty.
1.106 schwarze 1504: .El
1505: .Ss "Errors related to roff, mdoc, and man code"
1506: .Bl -ohang
1507: .It Sy "input stack limit exceeded, infinite loop?"
1508: .Pq roff
1509: Explicit recursion limits are implemented for the following features,
1510: in order to prevent infinite loops:
1511: .Bl -dash -compact
1512: .It
1513: expansion of nested escape sequences
1514: including expansion of strings and number registers,
1515: .It
1516: expansion of nested user-defined macros,
1517: .It
1518: and
1519: .Ic \&so
1520: file inclusion.
1521: .El
1522: When a limit is hit, the output is incorrect, typically losing
1523: some content, but the parser can continue.
1524: .It Sy "skipping bad character"
1525: .Pq mdoc , man , roff
1526: The input file contains a byte that is not a printable
1527: .Xr ascii 7
1528: character.
1529: The message mentions the character number.
1530: The offending byte is replaced with a question mark
1531: .Pq Sq \&? .
1532: Consider editing the input file to replace the byte with an ASCII
1533: transliteration of the intended character.
1534: .It Sy "skipping unknown macro"
1535: .Pq mdoc , man , roff
1536: The first identifier on a request or macro line is neither recognized as a
1537: .Xr roff 7
1538: request, nor as a user-defined macro, nor, respectively, as an
1539: .Xr mdoc 7
1540: or
1541: .Xr man 7
1542: macro.
1543: It may be mistyped or unsupported.
1544: The request or macro is discarded including its arguments.
1.133 schwarze 1545: .It Sy "skipping insecure request"
1546: .Pq roff
1547: An input file attempted to run a shell command
1548: or to read or write an external file.
1549: Such attempts are denied for security reasons.
1.106 schwarze 1550: .It Sy "skipping item outside list"
1.118 schwarze 1551: .Pq mdoc , eqn
1.106 schwarze 1552: An
1553: .Ic \&It
1554: macro occurs outside any
1555: .Ic \&Bl
1.118 schwarze 1556: list, or an
1557: .Xr eqn 7
1558: .Ic above
1559: delimiter occurs outside any pile.
1.106 schwarze 1560: It is discarded including its arguments.
1561: .It Sy "skipping column outside column list"
1562: .Pq mdoc
1563: A
1564: .Ic \&Ta
1565: macro occurs outside any
1566: .Ic \&Bl Fl column
1567: block.
1568: It is discarded including its arguments.
1569: .It Sy "skipping end of block that is not open"
1570: .Pq mdoc , man , eqn , tbl , roff
1571: Various syntax elements can only be used to explicitly close blocks
1572: that have previously been opened.
1573: An
1574: .Xr mdoc 7
1575: block closing macro, a
1576: .Xr man 7
1577: .Ic \&RE
1578: or
1579: .Ic \&UE
1.118 schwarze 1580: macro, an
1581: .Xr eqn 7
1582: right delimiter or closing brace, or the end of an equation, table, or
1.106 schwarze 1583: .Xr roff 7
1584: conditional request is encountered but no matching block is open.
1585: The offending request or macro is discarded.
1.135 schwarze 1586: .It Sy "fewer RS blocks open, skipping"
1587: .Pq man
1588: The
1589: .Ic \&RE
1590: macro is invoked with an argument, but less than the specified number of
1591: .Ic \&RS
1592: blocks is open.
1593: The
1594: .Ic \&RE
1595: macro is discarded.
1.106 schwarze 1596: .It Sy "inserting missing end of block"
1597: .Pq mdoc , tbl
1598: Various
1599: .Xr mdoc 7
1600: macros as well as tables require explicit closing by dedicated macros.
1601: A block that doesn't support bad nesting
1602: ends before all of its children are properly closed.
1603: The open child nodes are closed implicitly.
1.152 schwarze 1604: .It Sy "appending missing end of block"
1.106 schwarze 1605: .Pq mdoc , man , eqn , tbl , roff
1606: At the end of the document, an explicit
1607: .Xr mdoc 7
1608: block, a
1609: .Xr man 7
1610: next-line scope or
1611: .Ic \&RS
1612: or
1613: .Ic \&UR
1614: block, an equation, table, or
1615: .Xr roff 7
1616: conditional or ignore block is still open.
1617: The open block is closed implicitly.
1618: .It Sy "escaped character not allowed in a name"
1619: .Pq roff
1620: Macro, string and register identifiers consist of printable,
1621: non-whitespace ASCII characters.
1622: Escape sequences and characters and strings expressed in terms of them
1623: cannot form part of a name.
1624: The first argument of an
1625: .Ic \&am ,
1626: .Ic \&as ,
1627: .Ic \&de ,
1628: .Ic \&ds ,
1629: .Ic \&nr ,
1630: or
1631: .Ic \&rr
1632: request, or any argument of an
1633: .Ic \&rm
1634: request, or the name of a request or user defined macro being called,
1635: is terminated by an escape sequence.
1636: In the cases of
1637: .Ic \&as ,
1638: .Ic \&ds ,
1639: and
1640: .Ic \&nr ,
1641: the request has no effect at all.
1642: In the cases of
1643: .Ic \&am ,
1644: .Ic \&de ,
1645: .Ic \&rr ,
1646: and
1647: .Ic \&rm ,
1648: what was parsed up to this point is used as the arguments to the request,
1649: and the rest of the input line is discarded including the escape sequence.
1650: When parsing for a request or a user-defined macro name to be called,
1651: only the escape sequence is discarded.
1652: The characters preceding it are used as the request or macro name,
1653: the characters following it are used as the arguments to the request or macro.
1.124 schwarze 1654: .It Sy "NOT IMPLEMENTED: Bd -file"
1655: .Pq mdoc
1656: For security reasons, the
1657: .Ic \&Bd
1658: macro does not support the
1659: .Fl file
1660: argument.
1661: By requesting the inclusion of a sensitive file, a malicious document
1662: might otherwise trick a privileged user into inadvertently displaying
1663: the file on the screen, revealing the file content to bystanders.
1664: The argument is ignored including the file name following it.
1.163 schwarze 1665: .It Sy "skipping display without arguments"
1666: .Pq mdoc
1667: A
1668: .Ic \&Bd
1669: block macro does not have any arguments.
1670: The block is discarded, and the block content is displayed in
1671: whatever mode was active before the block.
1.106 schwarze 1672: .It Sy "missing list type, using -item"
1673: .Pq mdoc
1674: A
1675: .Ic \&Bl
1676: macro fails to specify the list type.
1677: .It Sy "missing manual name, using \(dq\(dq"
1678: .Pq mdoc
1679: The first call to
1.168 schwarze 1680: .Ic \&Nm ,
1681: or any call in the NAME section, lacks the required argument.
1.106 schwarze 1682: .It Sy "uname(3) system call failed, using UNKNOWN"
1683: .Pq mdoc
1684: The
1685: .Ic \&Os
1686: macro is called without arguments, and the
1687: .Xr uname 3
1688: system call failed.
1689: As a workaround,
1690: .Nm
1691: can be compiled with
1692: .Sm off
1693: .Fl D Cm OSNAME=\(dq\e\(dq Ar string Cm \e\(dq\(dq .
1694: .Sm on
1695: .It Sy "unknown standard specifier"
1696: .Pq mdoc
1697: An
1698: .Ic \&St
1699: macro has an unknown argument and is discarded.
1700: .It Sy "skipping request without numeric argument"
1.118 schwarze 1701: .Pq roff , eqn
1.106 schwarze 1702: An
1703: .Ic \&it
1.118 schwarze 1704: request or an
1705: .Xr eqn 7
1706: .Ic \&size
1707: or
1708: .Ic \&gsize
1709: statement has a non-numeric or negative argument or no argument at all.
1710: The invalid request or statement is ignored.
1.132 schwarze 1711: .It Sy "NOT IMPLEMENTED: .so with absolute path or \(dq..\(dq"
1712: .Pq roff
1713: For security reasons,
1714: .Nm
1715: allows
1716: .Ic \&so
1717: file inclusion requests only with relative paths
1718: and only without ascending to any parent directory.
1719: By requesting the inclusion of a sensitive file, a malicious document
1720: might otherwise trick a privileged user into inadvertently displaying
1721: the file on the screen, revealing the file content to bystanders.
1722: .Nm
1723: only shows the path as it appears behind
1724: .Ic \&so .
1725: .It Sy ".so request failed"
1726: .Pq roff
1727: Servicing a
1728: .Ic \&so
1729: request requires reading an external file, but the file could not be
1730: opened.
1731: .Nm
1732: only shows the path as it appears behind
1733: .Ic \&so .
1.106 schwarze 1734: .It Sy "skipping all arguments"
1735: .Pq mdoc , man , eqn , roff
1736: An
1737: .Xr mdoc 7
1738: .Ic \&Bt ,
1739: .Ic \&Ed ,
1740: .Ic \&Ef ,
1741: .Ic \&Ek ,
1742: .Ic \&El ,
1.144 schwarze 1743: .Ic \&Lp ,
1744: .Ic \&Pp ,
1.106 schwarze 1745: .Ic \&Re ,
1.143 schwarze 1746: .Ic \&Rs ,
1.106 schwarze 1747: or
1748: .Ic \&Ud
1749: macro, an
1750: .Ic \&It
1751: macro in a list that don't support item heads, a
1752: .Xr man 7
1753: .Ic \&LP ,
1754: .Ic \&P ,
1755: or
1756: .Ic \&PP
1757: macro, an
1758: .Xr eqn 7
1.120 schwarze 1759: .Ic \&EQ
1760: or
1.106 schwarze 1761: .Ic \&EN
1762: macro, or a
1763: .Xr roff 7
1.148 schwarze 1764: .Ic \&br ,
1765: .Ic \&fi ,
1766: or
1767: .Ic \&nf
1.144 schwarze 1768: request or
1.106 schwarze 1769: .Sq \&..
1770: block closing request is invoked with at least one argument.
1771: All arguments are ignored.
1772: .It Sy "skipping excess arguments"
1.135 schwarze 1773: .Pq mdoc , man , roff
1.150 schwarze 1774: A macro or request is invoked with too many arguments:
1775: .Bl -dash -offset 2n -width 2n -compact
1776: .It
1777: .Ic \&Fo ,
1778: .Ic \&PD ,
1779: .Ic \&RS ,
1780: .Ic \&UR ,
1781: .Ic \&ft ,
1782: or
1783: .Ic \&sp
1784: with more than one argument
1785: .It
1.144 schwarze 1786: .Ic \&An
1.150 schwarze 1787: with another argument after
1.144 schwarze 1788: .Fl split
1789: or
1.150 schwarze 1790: .Fl nosplit
1791: .It
1792: .Ic \&RE
1793: with more than one argument or with a non-integer argument
1794: .It
1795: .Ic \&OP
1796: or a request of the
1797: .Ic \&de
1798: family with more than two arguments
1.154 schwarze 1799: .It
1800: .Ic \&Dt
1801: with more than three arguments
1.150 schwarze 1802: .It
1803: .Ic \&TH
1804: with more than five arguments
1805: .It
1.145 schwarze 1806: .Ic \&Bd ,
1807: .Ic \&Bk ,
1808: or
1809: .Ic \&Bl
1.150 schwarze 1810: with invalid arguments
1811: .El
1.106 schwarze 1812: The excess arguments are ignored.
1.133 schwarze 1813: .El
1814: .Ss Unsupported features
1815: .Bl -ohang
1816: .It Sy "input too large"
1817: .Pq mdoc , man
1818: Currently,
1819: .Nm
1820: cannot handle input files larger than its arbitrary size limit
1821: of 2^31 bytes (2 Gigabytes).
1822: Since useful manuals are always small, this is not a problem in practice.
1823: Parsing is aborted as soon as the condition is detected.
1.136 schwarze 1824: .It Sy "unsupported control character"
1825: .Pq roff
1826: An ASCII control character supported by other
1827: .Xr roff 7
1828: implementations but not by
1829: .Nm
1830: was found in an input file.
1831: It is replaced by a question mark.
1.133 schwarze 1832: .It Sy "unsupported roff request"
1833: .Pq roff
1834: An input file contains a
1835: .Xr roff 7
1836: request supported by GNU troff or Heirloom troff but not by
1837: .Nm ,
1838: and it is likely that this will cause information loss
1839: or considerable misformatting.
1.139 schwarze 1840: .It Sy "eqn delim option in tbl"
1841: .Pq eqn , tbl
1842: The options line of a table defines equation delimiters.
1843: Any equation source code contained in the table will be printed unformatted.
1844: .It Sy "unsupported table layout modifier"
1.138 schwarze 1845: .Pq tbl
1846: A table layout specification contains an
1847: .Sq Cm m
1848: modifier.
1849: The modifier is discarded.
1.133 schwarze 1850: .It Sy "ignoring macro in table"
1.139 schwarze 1851: .Pq tbl , mdoc , man
1852: A table contains an invocation of an
1853: .Xr mdoc 7
1854: or
1855: .Xr man 7
1856: macro or of an undefined macro.
1857: The macro is ignored, and its arguments are handled
1858: as if they were a text line.
1.106 schwarze 1859: .El
1.1 kristaps 1860: .Sh SEE ALSO
1.141 schwarze 1861: .Xr apropos 1 ,
1862: .Xr man 1 ,
1.85 kristaps 1863: .Xr eqn 7 ,
1.57 kristaps 1864: .Xr man 7 ,
1.13 kristaps 1865: .Xr mandoc_char 7 ,
1.84 kristaps 1866: .Xr mdoc 7 ,
1867: .Xr roff 7 ,
1868: .Xr tbl 7
1.173 schwarze 1869: .Sh HISTORY
1870: The
1871: .Nm
1872: utility first appeared in
1873: .Ox 4.8 .
1874: The option
1875: .Fl I
1876: appeared in
1877: .Ox 5.2 ,
1878: and
1879: .Fl aCcfhKklMSsw
1880: in
1881: .Ox 5.7 .
1.1 kristaps 1882: .Sh AUTHORS
1.156 schwarze 1883: .An -nosplit
1.1 kristaps 1884: The
1885: .Nm
1.26 kristaps 1886: utility was written by
1.141 schwarze 1887: .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
1888: and is maintained by
1889: .An Ingo Schwarze Aq Mt schwarze@openbsd.org .
CVSweb