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