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