1 .\" $Id: mdoc.7,v 1.142 2010/07/26 13:45:49 kristaps Exp $
3 .\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
6 .\" Permission to use, copy, modify, and distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
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.
18 .Dd $Mdocdate: July 26 2010 $
23 .Nd mdoc language reference
27 language is used to format
31 In this reference document, we describe its syntax, structure, and
33 Our reference implementation is mandoc; the
35 section describes compatibility with other troff \-mdoc implementations.
39 document follows simple rules: lines beginning with the control
42 are parsed for macros.
43 Other lines are interpreted within the scope of
45 .Bd -literal -offset indent
46 \&.Sh Macro lines change control state.
47 Other lines are interpreted within the current state.
51 documents may contain only graphable 7-bit ASCII characters, the space
52 character, and, in certain circumstances, the tab character.
59 whether in a macro or free-form text line, is ignored to the end of
61 A macro line with only a control character and comment escape,
64 Macro lines with only a control character and optionally whitespace are
66 .Ss Reserved Characters
67 Within a macro line, the following characters are reserved:
69 .Bl -tag -width Ds -offset indent -compact
94 Use of reserved characters is described in
96 For general use in macro lines, these characters can either be escaped
97 with a non-breaking space
99 or, if applicable, an appropriate escape sequence can be used.
100 .Ss Special Characters
101 Special characters may occur in both macro and free-form lines.
102 Sequences begin with the escape character
104 followed by either an open-parenthesis
106 for two-character sequences; an open-bracket
108 for n-character sequences (terminated at a close-bracket
110 or a single one-character sequence.
121 Terms may be text-decorated using the
123 escape followed by an indicator: B (bold), I, (italic), R (Roman), or P
124 (revert to previous mode):
126 .D1 \efBbold\efR \efIitalic\efP
128 A numerical representation 3, 2, or 1 (bold, italic, and Roman,
129 respectively) may be used instead.
130 A text decoration is valid within
131 the current font scope only: if a macro opens a font scope alongside
132 its own scope, such as
135 in-scope invocations of
137 are only valid within the font scope of the macro.
140 is specified outside of any font scope, such as in unenclosed, free-form
141 text, it will affect the remainder of the document.
147 which encourages semantic annotation.
148 .Ss Predefined Strings
151 also defined a set of package-specific
152 .Dq predefined strings ,
154 .Sx Special Characters ,
155 mark special output characters and strings by way of input codes.
156 Predefined strings are escaped with the slash-asterisk,
174 Whitespace consists of the space character.
175 In free-form lines, whitespace is preserved within a line; un-escaped
176 trailing spaces are stripped from input (unless in a literal context).
177 Blank free-form lines, which may include whitespace, are only permitted
178 within literal contexts.
180 In macro lines, whitespace delimits arguments and is discarded.
181 If arguments are quoted, whitespace within the quotes is retained.
183 Macro arguments may be quoted with double-quotes to group
184 space-delimited terms or to retain blocks of whitespace.
185 A quoted argument begins with a double-quote preceded by whitespace.
186 The next double-quote not pair-wise adjacent to another double-quote
187 terminates the literal, regardless of surrounding whitespace.
189 Note that any quoted text, even if it would cause a macro invocation
190 when unquoted, is considered literal text.
191 Thus, the following produces
193 .Bd -literal -offset indent
197 In free-form mode, quotes are regarded as opaque text.
199 There are several macros in
201 that require a date argument.
202 The canonical form for dates is the American format:
204 .D1 Cm Month Day , Year
208 value is an optionally zero-padded numeral.
211 value is the full month name.
214 value is the full four-digit year.
216 Reduced form dates are broken-down canonical form dates:
221 Some examples of valid dates follow:
223 .D1 "May, 2009" Pq reduced form
224 .D1 "2009" Pq reduced form
225 .D1 "May 20, 2009" Pq canonical form
227 Many macros support scaled widths for their arguments, such as
228 stipulating a two-inch list indentation with the following:
229 .Bd -literal -offset indent
233 The syntax for scaled widths is
234 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
235 where a decimal must be preceded or proceeded by at least one digit.
236 Negative numbers, while accepted, are truncated to zero.
237 The following scaling units are accepted:
239 .Bl -tag -width Ds -offset indent -compact
252 default vertical span
264 default horizontal span
269 Using anything other than
275 is necessarily non-portable across output media.
279 When composing a manual, make sure that your sentences end at the end of
281 By doing so, front-ends will be able to apply the proper amount of
282 spacing after the end of sentence (unescaped) period, exclamation mark,
283 or question mark followed by zero or more non-sentence closing
290 The proper spacing is also intelligently preserved if a sentence ends at
291 the boundary of a macro line, e.g.,
294 .D1 \&Fl T \&Ns \&Cm ascii \.
298 document consists of a document prologue followed by one or more
301 The prologue, which consists of the
306 macros in that order, is required for every document.
308 The first section (sections are denoted by
310 must be the NAME section, consisting of at least one
315 Following that, convention dictates specifying at least the
319 sections, although this varies between manual sections.
321 The following is a well-formed skeleton
324 .Bd -literal -offset indent
330 \&.Nd a description goes here
331 \&.\e\*q The next is for sections 2, 3, & 9 only.
340 utility processes files ...
341 \&.\e\*q .Sh IMPLEMENTATION NOTES
342 \&.\e\*q The next is for sections 2, 3, & 9 only.
343 \&.\e\*q .Sh RETURN VALUES
344 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
345 \&.\e\*q .Sh ENVIRONMENT
347 \&.\e\*q The next is for sections 1 & 8 only.
348 \&.\e\*q .Sh EXIT STATUS
349 \&.\e\*q .Sh EXAMPLES
350 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
351 \&.\e\*q .Sh DIAGNOSTICS
352 \&.\e\*q The next is for sections 2, 3, & 9 only.
354 \&.\e\*q .Sh SEE ALSO
355 \&.\e\*q .Xr foobar 1
356 \&.\e\*q .Sh STANDARDS
361 \&.\e\*q .Sh SECURITY CONSIDERATIONS
366 document are conventionally ordered as they appear above.
367 Sections should be composed as follows:
368 .Bl -ohang -offset Ds
370 The name(s) and a one-line description of the documented material.
371 The syntax for this as follows:
372 .Bd -literal -offset indent
376 \&.Nd a one-line description
381 macro(s) must precede the
390 The name of the library containing the documented material, which is
391 assumed to be a function in a section 2, 3, or 9 manual.
392 The syntax for this is as follows:
393 .Bd -literal -offset indent
400 Documents the utility invocation syntax, function call syntax, or device
403 For the first, utilities (sections 1, 6, and 8), this is
404 generally structured as follows:
405 .Bd -literal -offset indent
416 For the second, function calls (sections 2, 3, 9):
417 .Bd -literal -offset indent
418 \&.Vt extern const char *global;
421 \&.Fn foo "const char *src"
423 \&.Fn bar "const char *src"
426 And for the third, configurations (section 4):
427 .Bd -literal -offset indent
428 \&.Cd \*qit* at isa? port 0x2e\*q
429 \&.Cd \*qit* at isa? port 0x4e\*q
432 Manuals not in these sections generally don't need a
435 Some macros are displayed differently in the
437 section, particularly
447 All of these macros are output on their own line.
448 If two such dissimilar macros are pair-wise invoked (except for
454 they are separated by a vertical space, unless in the case of
459 which are always separated by vertical space.
461 When text and macros following an
463 macro starting an input line span multiple output lines,
464 all output lines but the first will be indented to align
465 with the text immediately following the
467 macro, up to the next
472 macro or the end of an enclosing block, whichever comes first.
474 This expands upon the brief, one-line description in
476 It usually contains a break-down of the options (if documenting a
478 .Bd -literal -offset indent
479 The arguments are as follows:
480 \&.Bl \-tag \-width Ds
482 Print verbose information.
486 Manuals not documenting a command won't include the above fragment.
487 .It Em IMPLEMENTATION NOTES
488 Implementation-specific notes should be kept here.
489 This is useful when implementing standard functions that may have side
490 effects or notable algorithmic implications.
492 This section is the dual of
494 which is used for commands.
495 It documents the return values of functions in sections 2, 3, and 9.
500 Lists the environment variables used by the utility,
501 and explains the syntax and semantics of their values.
504 manual provides examples of typical content and formatting.
509 Documents files used.
510 It's helpful to document both the file name and a short description of how
511 the file is used (created, modified, etc.).
516 Command exit status for section 1, 6, and 8 manuals.
517 This section is the dual of
519 which is used for functions.
520 Historically, this information was described in
522 a practise that is now discouraged.
528 This often contains snippets of well-formed, well-tested invocations.
529 Make doubly sure that your examples work properly!
531 Documents error conditions.
532 This is most useful in section 4 manuals.
533 Historically, this section was used in place of
535 for manuals in sections 1, 6, and 8; however, this practise is
542 Documents error handling in sections 2, 3, and 9.
547 References other manuals with related topics.
548 This section should exist for most manuals.
549 Cross-references should conventionally be ordered first by section, then
555 References any standards implemented or used.
556 If not adhering to any standards, the
558 section should be used instead.
563 The history of any manual without a
565 section should be described in this section.
567 Credits to authors, if applicable, should appear in this section.
568 Authors should generally be noted by both name and email address.
573 Common misuses and misunderstandings should be explained
576 Known bugs, limitations and work-arounds should be described
578 .It Em SECURITY CONSIDERATIONS
579 Documents any security precautions that operators should consider.
582 Macros are one to three three characters in length and begin with a
585 at the beginning of the line.
586 An arbitrary amount of whitespace may sit between the control character
588 Thus, the following are equivalent:
589 .Bd -literal -offset indent
594 The syntax of a macro depends on its classification.
597 refers to macro arguments, which may be followed by zero or more
601 opens the scope of a macro; and if specified,
607 column indicates that the macro may be called subsequent to the initial
609 If a macro is not callable, then its invocation after the initial line
610 macro is interpreted as opaque text, such that
617 column indicates whether the macro may be followed by further
618 (ostensibly callable) macros.
619 If a macro is not parsed, subsequent macro invocations on the line
620 will be interpreted as opaque text.
624 column, if applicable, describes closure rules.
625 .Ss Block full-explicit
626 Multi-line scope closed by an explicit closing macro.
627 All macros contains bodies; only
630 .Bd -literal -offset indent
631 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
636 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsedX" "closed by XXX"
637 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
638 .It Sx \&Bd Ta \&No Ta \&No Ta closed by Sx \&Ed
639 .It Sx \&Bf Ta \&No Ta \&No Ta closed by Sx \&Ef
640 .It Sx \&Bk Ta \&No Ta \&No Ta closed by Sx \&Ek
641 .It Sx \&Bl Ta \&No Ta \&No Ta closed by Sx \&El
642 .It Sx \&Ed Ta \&No Ta \&No Ta opened by Sx \&Bd
643 .It Sx \&Ef Ta \&No Ta \&No Ta opened by Sx \&Bf
644 .It Sx \&Ek Ta \&No Ta \&No Ta opened by Sx \&Bk
645 .It Sx \&El Ta \&No Ta \&No Ta opened by Sx \&Bl
647 .Ss Block full-implicit
648 Multi-line scope closed by end-of-file or implicitly by another macro.
649 All macros have bodies; some
657 don't have heads; only one
664 .Bd -literal -offset indent
665 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
669 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsedX" "closed by XXXXXXXXXXX"
670 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
671 .It Sx \&It Ta \&No Ta Yes Ta closed by Sx \&It , Sx \&El
672 .It Sx \&Nd Ta \&No Ta \&No Ta closed by Sx \&Sh
673 .It Sx \&Nm Ta \&No Ta Yes Ta closed by Sx \&Nm , Sx \&Sh , Sx \&Ss
674 .It Sx \&Sh Ta \&No Ta \&No Ta closed by Sx \&Sh
675 .It Sx \&Ss Ta \&No Ta \&No Ta closed by Sx \&Sh , Sx \&Ss
681 .Sx Block full-implicit
682 macro only when invoked as the first macro
685 section line, else it is
687 .Ss Block partial-explicit
688 Like block full-explicit, but also with single-line scope.
689 Each has at least a body and, in limited circumstances, a head
696 .Bd -literal -offset indent
697 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
699 \&.Yc \(lBtail...\(rB
701 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \
702 \(lBbody...\(rB \&Yc \(lBtail...\(rB
705 .Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXX" -compact -offset indent
706 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
707 .It Sx \&Ac Ta Yes Ta Yes Ta opened by Sx \&Ao
708 .It Sx \&Ao Ta Yes Ta Yes Ta closed by Sx \&Ac
709 .It Sx \&Bc Ta Yes Ta Yes Ta closed by Sx \&Bo
710 .It Sx \&Bo Ta Yes Ta Yes Ta opened by Sx \&Bc
711 .It Sx \&Brc Ta Yes Ta Yes Ta opened by Sx \&Bro
712 .It Sx \&Bro Ta Yes Ta Yes Ta closed by Sx \&Brc
713 .It Sx \&Dc Ta Yes Ta Yes Ta opened by Sx \&Do
714 .It Sx \&Do Ta Yes Ta Yes Ta closed by Sx \&Dc
715 .It Sx \&Ec Ta Yes Ta Yes Ta opened by Sx \&Eo
716 .It Sx \&Eo Ta Yes Ta Yes Ta closed by Sx \&Ec
717 .It Sx \&Fc Ta Yes Ta Yes Ta opened by Sx \&Fo
718 .It Sx \&Fo Ta \&No Ta \&No Ta closed by Sx \&Fc
719 .It Sx \&Oc Ta Yes Ta Yes Ta closed by Sx \&Oo
720 .It Sx \&Oo Ta Yes Ta Yes Ta opened by Sx \&Oc
721 .It Sx \&Pc Ta Yes Ta Yes Ta closed by Sx \&Po
722 .It Sx \&Po Ta Yes Ta Yes Ta opened by Sx \&Pc
723 .It Sx \&Qc Ta Yes Ta Yes Ta opened by Sx \&Oo
724 .It Sx \&Qo Ta Yes Ta Yes Ta closed by Sx \&Oc
725 .It Sx \&Re Ta \&No Ta \&No Ta opened by Sx \&Rs
726 .It Sx \&Rs Ta \&No Ta \&No Ta closed by Sx \&Re
727 .It Sx \&Sc Ta Yes Ta Yes Ta opened by Sx \&So
728 .It Sx \&So Ta Yes Ta Yes Ta closed by Sx \&Sc
729 .It Sx \&Xc Ta Yes Ta Yes Ta opened by Sx \&Xo
730 .It Sx \&Xo Ta Yes Ta Yes Ta closed by Sx \&Xc
732 .Ss Block partial-implicit
733 Like block full-implicit, but with single-line scope closed by
734 .Sx Reserved Characters
736 .Bd -literal -offset indent
737 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB
740 .Bl -column "MacroX" "CallableX" "ParsedX" -compact -offset indent
741 .It Em Macro Ta Em Callable Ta Em Parsed
742 .It Sx \&Aq Ta Yes Ta Yes
743 .It Sx \&Bq Ta Yes Ta Yes
744 .It Sx \&Brq Ta Yes Ta Yes
745 .It Sx \&D1 Ta \&No Ta \&Yes
746 .It Sx \&Dl Ta \&No Ta Yes
747 .It Sx \&Dq Ta Yes Ta Yes
748 .It Sx \&Op Ta Yes Ta Yes
749 .It Sx \&Pq Ta Yes Ta Yes
750 .It Sx \&Ql Ta Yes Ta Yes
751 .It Sx \&Qq Ta Yes Ta Yes
752 .It Sx \&Sq Ta Yes Ta Yes
753 .It Sx \&Vt Ta Yes Ta Yes
759 .Sx Block partial-implicit
760 only when invoked as the first macro
763 section line, else it is
767 .Sx Reserved Characters ,
768 end of line, fixed argument lengths, and/or subsequent macros.
769 In-line macros have only text children.
770 If a number (or inequality) of arguments is
772 then the macro accepts an arbitrary number of arguments.
773 .Bd -literal -offset indent
774 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lbres...\(rb
776 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc...
778 \&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
781 .Bl -column "MacroX" "CallableX" "ParsedX" "Arguments" -compact -offset indent
782 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Arguments
783 .It Sx \&%A Ta \&No Ta \&No Ta >0
784 .It Sx \&%B Ta \&No Ta \&No Ta >0
785 .It Sx \&%C Ta \&No Ta \&No Ta >0
786 .It Sx \&%D Ta \&No Ta \&No Ta >0
787 .It Sx \&%I Ta \&No Ta \&No Ta >0
788 .It Sx \&%J Ta \&No Ta \&No Ta >0
789 .It Sx \&%N Ta \&No Ta \&No Ta >0
790 .It Sx \&%O Ta \&No Ta \&No Ta >0
791 .It Sx \&%P Ta \&No Ta \&No Ta >0
792 .It Sx \&%Q Ta \&No Ta \&No Ta >0
793 .It Sx \&%R Ta \&No Ta \&No Ta >0
794 .It Sx \&%T Ta \&No Ta \&No Ta >0
795 .It Sx \&%U Ta \&No Ta \&No Ta >0
796 .It Sx \&%V Ta \&No Ta \&No Ta >0
797 .It Sx \&Ad Ta Yes Ta Yes Ta n
798 .It Sx \&An Ta Yes Ta Yes Ta n
799 .It Sx \&Ap Ta Yes Ta Yes Ta 0
800 .It Sx \&Ar Ta Yes Ta Yes Ta n
801 .It Sx \&At Ta Yes Ta Yes Ta 1
802 .It Sx \&Bsx Ta Yes Ta Yes Ta n
803 .It Sx \&Bt Ta \&No Ta \&No Ta 0
804 .It Sx \&Bx Ta Yes Ta Yes Ta n
805 .It Sx \&Cd Ta Yes Ta Yes Ta >0
806 .It Sx \&Cm Ta Yes Ta Yes Ta n
807 .It Sx \&Db Ta \&No Ta \&No Ta 1
808 .It Sx \&Dd Ta \&No Ta \&No Ta n
809 .It Sx \&Dt Ta \&No Ta \&No Ta n
810 .It Sx \&Dv Ta Yes Ta Yes Ta n
811 .It Sx \&Dx Ta Yes Ta Yes Ta n
812 .It Sx \&Em Ta Yes Ta Yes Ta >0
813 .It Sx \&En Ta \&No Ta \&No Ta 0
814 .It Sx \&Er Ta Yes Ta Yes Ta >0
815 .It Sx \&Es Ta \&No Ta \&No Ta 0
816 .It Sx \&Ev Ta Yes Ta Yes Ta n
817 .It Sx \&Ex Ta \&No Ta \&No Ta n
818 .It Sx \&Fa Ta Yes Ta Yes Ta n
819 .It Sx \&Fd Ta \&No Ta \&No Ta >0
820 .It Sx \&Fl Ta Yes Ta Yes Ta n
821 .It Sx \&Fn Ta Yes Ta Yes Ta >0
822 .It Sx \&Fr Ta \&No Ta \&No Ta n
823 .It Sx \&Ft Ta Yes Ta Yes Ta n
824 .It Sx \&Fx Ta Yes Ta Yes Ta n
825 .It Sx \&Hf Ta \&No Ta \&No Ta n
826 .It Sx \&Ic Ta Yes Ta Yes Ta >0
827 .It Sx \&In Ta \&No Ta \&No Ta n
828 .It Sx \&Lb Ta \&No Ta \&No Ta 1
829 .It Sx \&Li Ta Yes Ta Yes Ta n
830 .It Sx \&Lk Ta Yes Ta Yes Ta n
831 .It Sx \&Lp Ta \&No Ta \&No Ta 0
832 .It Sx \&Ms Ta Yes Ta Yes Ta >0
833 .It Sx \&Mt Ta Yes Ta Yes Ta >0
834 .It Sx \&Nm Ta Yes Ta Yes Ta n
835 .It Sx \&No Ta Yes Ta Yes Ta 0
836 .It Sx \&Ns Ta Yes Ta Yes Ta 0
837 .It Sx \&Nx Ta Yes Ta Yes Ta n
838 .It Sx \&Os Ta \&No Ta \&No Ta n
839 .It Sx \&Ot Ta \&No Ta \&No Ta n
840 .It Sx \&Ox Ta Yes Ta Yes Ta n
841 .It Sx \&Pa Ta Yes Ta Yes Ta n
842 .It Sx \&Pf Ta Yes Ta Yes Ta 1
843 .It Sx \&Pp Ta \&No Ta \&No Ta 0
844 .It Sx \&Rv Ta \&No Ta \&No Ta n
845 .It Sx \&Sm Ta \&No Ta \&No Ta 1
846 .It Sx \&St Ta \&No Ta Yes Ta 1
847 .It Sx \&Sx Ta Yes Ta Yes Ta >0
848 .It Sx \&Sy Ta Yes Ta Yes Ta >0
849 .It Sx \&Tn Ta Yes Ta Yes Ta >0
850 .It Sx \&Ud Ta \&No Ta \&No Ta 0
851 .It Sx \&Ux Ta Yes Ta Yes Ta n
852 .It Sx \&Va Ta Yes Ta Yes Ta n
853 .It Sx \&Vt Ta Yes Ta Yes Ta >0
854 .It Sx \&Xr Ta Yes Ta Yes Ta >0
855 .It Sx \&br Ta \&No Ta \&No Ta 0
856 .It Sx \&sp Ta \&No Ta \&No Ta 1
859 This section is a canonical reference of all macros, arranged
861 For the scoping of individual macros, see
867 Multiple authors should each be accorded their own
870 Author names should be ordered with full or abbreviated forename(s)
871 first, then full surname.
876 This macro may also be used in a non-bibliographic context when
877 referring to book titles.
879 Publication city or location of an
884 this macro is not implemented in
887 Publication date of an
890 This should follow the reduced or canonical form syntax described in
893 Publisher or issuer name of an
901 Issue number (usually for journals) of an
905 Optional information of an
909 Book or journal page number of an
913 Institutional author (school, government, etc.) of an
916 Multiple institutional authors should each be accorded their own
920 Technical report name of an
927 This macro may also be used in a non-bibliographical context when
928 referring to article titles.
930 URI of reference document.
939 Does not have any tail arguments.
942 Do not use this for postal addresses.
949 Requires either the name of an author or one of the following arguments:
951 .Bl -tag -width "-nosplitX" -offset indent -compact
953 Start a new output line before each subsequent invocation of
962 The effect of selecting either of the
964 modes ends at the beginning of the
969 section, the default is
971 for the first author listing and
973 for all other author listings.
977 .D1 \&.An Kristaps Dzonsons \&Aq kristaps@bsd.lv
979 Begin a block enclosed by angle brackets.
980 Does not have any head arguments.
983 .D1 \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac
988 Inserts an apostrophe without any surrounding whitespace.
989 This is generally used as a grammatical device when referring to the verb
993 .D1 \&.Fn execve \&Ap d
995 Encloses its arguments in angle brackets.
998 .D1 \&.Fl -key= \&Ns \&Aq \&Ar val
1001 this macro is often abused for rendering URIs, which should instead use
1005 or to note pre-processor
1007 statements, which should use
1014 If an argument is not provided, the string
1016 is used as a default.
1019 .D1 \&.Fl o \&Ns \&Ar file1
1021 .D1 \&.Ar arg1 , arg2 .
1023 Formats an AT&T version.
1024 Accepts one optional argument:
1026 .Bl -tag -width "v[1-7] | 32vX" -offset indent -compact
1035 Note that these arguments do not begin with a hyphen.
1054 Does not have any tail arguments.
1056 Begin a display block.
1057 Its syntax is as follows:
1058 .Bd -ragged -offset indent
1061 .Op Fl offset Ar width
1065 Display blocks are used to select a different indentation and
1066 justification than the one used by the surrounding text.
1067 They may contain both macro lines and free-form text lines.
1068 By default, a display block is preceded by a vertical space.
1072 must be one of the following:
1073 .Bl -tag -width 13n -offset indent
1075 Centre-justify each line.
1076 Using this display type is not recommended; many
1078 implementations render it poorly.
1080 Left- and right-justify the block.
1082 Do not justify the block at all.
1083 Preserve white space as it appears in the input.
1085 Only left-justify the block.
1093 must be provided first.
1094 Additional arguments may follow:
1095 .Bl -tag -width 13n -offset indent
1096 .It Fl offset Ar width
1097 Indent the display by the
1099 which may be one of the following:
1102 One of the pre-defined strings
1104 the width of standard indentation;
1109 which has no effect;
1111 which justifies to the right margin; or
1113 which aligns around an imagined centre axis.
1115 A macro invocation, which selects a predefined width
1116 associated with that macro.
1117 The most popular is the imaginary macro
1122 A width using the syntax described in
1123 .Sx Scaling Widths .
1125 An arbitrary string, which indents by the length of this string.
1128 When the argument is missing,
1132 Do not assert vertical space before the display.
1136 .Bd -literal -offset indent
1137 \&.Bd \-literal \-offset indent \-compact
1147 Change the font mode for a scoped block of text.
1148 Its syntax is as follows:
1149 .Bd -ragged -offset indent
1152 .Fl emphasis | literal | symbolic |
1153 .Cm \&Em | \&Li | \&Sy
1161 argument are equivalent, as are
1169 Without an argument, this macro does nothing.
1170 The font mode continues until broken by a new font mode in a nested
1182 Keep the output generated from each macro input line together
1183 on one single output line.
1184 Line breaks in free-form text lines are unaffected.
1185 The syntax is as follows:
1187 .D1 Pf \. Sx \&Bk Fl words
1191 argument is required; additional arguments are ignored.
1193 The following example will not break within each
1196 .Bd -literal -offset indent
1199 \&.Op Fl o Ar output
1203 Be careful in using over-long lines within a keep block!
1204 Doing so will clobber the right margin.
1207 Lists consist of items started by the
1209 macro, containing a head or a body or both.
1210 The list syntax is as follows:
1211 .Bd -ragged -offset indent
1215 .Op Fl offset Ar val
1222 is mandatory and must be specified first.
1229 or use the length of the given string.
1232 is a global indentation for the whole list, affecting both item heads
1234 For those list types supporting it, the
1236 argument requests an additional indentation of item bodies,
1241 argument is specified, list entries are separated by vertical space.
1243 A list must specify one of the following list types:
1244 .Bl -tag -width 12n -offset indent
1246 No item heads can be specified, but a bullet will be printed at the head
1248 Item bodies start on the same output line as the bullet
1249 and are indented according to the
1256 argument has no effect; instead, each argument specifies the width
1257 of one column, using either the
1259 syntax or the string length of the argument.
1260 If the first line of the body of a
1266 contexts spanning one input line each are implied until an
1268 macro line is encountered, at which point items start being interpreted as
1275 except that dashes are used in place of bullets.
1279 except that item heads are not parsed for macro invocations.
1280 .\" but with additional formatting to the head.
1285 except that cardinal numbers are used in place of bullets,
1290 except that the first lines of item bodies are not indented, but follow
1291 the item heads like in
1298 Item bodies follow items heads on the same line, using normal inter-word
1300 Bodies are not indented, and the
1302 argument is ignored.
1304 No item heads can be specified, and none are printed.
1305 Bodies are not indented, and the
1307 argument is ignored.
1309 Item bodies start on the line following item heads and are not indented.
1312 argument is ignored.
1314 Item bodies are indented according to the
1317 When an item head fits inside the indentation, the item body follows
1318 this head on the same output line.
1319 Otherwise, the body starts on the output line following the head.
1327 Begin a block enclosed by square brackets.
1328 Does not have any head arguments.
1331 .Bd -literal -offset indent -compact
1339 Encloses its arguments in square brackets.
1342 .D1 \&.Bq 1 , \&Dv BUFSIZ
1345 this macro is sometimes abused to emulate optional arguments for
1346 commands; the correct macros to use for this purpose are
1358 Does not have any tail arguments.
1360 Begin a block enclosed by curly braces.
1361 Does not have any head arguments.
1364 .Bd -literal -offset indent -compact
1372 Encloses its arguments in curly braces.
1375 .D1 \&.Brq 1 , ... , \&Va n
1380 Format the BSD/OS version provided as an argument, or a default value if
1381 no argument is provided.
1398 .Dq is currently in beta test.
1400 Format the BSD version provided as an argument, or a default value if no
1401 argument is provided.
1417 Kernel configuration declaration.
1418 This denotes strings accepted by
1422 .D1 \&.Cd device le0 at scode?
1425 this macro is commonly abused by using quoted literals to retain
1426 whitespace and align consecutive
1429 This practise is discouraged.
1432 Useful when specifying configuration options or keys.
1435 .D1 \&.Cm ControlPath
1436 .D1 \&.Cm ControlMaster
1441 One-line indented display.
1442 This is formatted by the default rules and is useful for simple indented
1444 It is followed by a newline.
1447 .D1 \&.D1 \&Fl abcdefgh
1454 Switch debugging mode.
1455 Its syntax is as follows:
1457 .D1 Pf \. Sx \&Db Cm on | off
1459 This macro is ignored by
1465 Does not have any tail arguments.
1468 This is the mandatory first macro of any
1471 Its syntax is as follows:
1473 .D1 Pf \. Sx \&Dd Op Ar date
1479 which signifies the current manual revision date dictated by
1481 or instead a valid canonical date as specified by
1483 If a date does not conform or is empty, the current date is used.
1486 .D1 \&.Dd $\&Mdocdate$
1487 .D1 \&.Dd $\&Mdocdate: July 21 2007$
1488 .D1 \&.Dd July 21, 2007
1495 One-line intended display.
1496 This is formatted as literal text and is useful for commands and
1498 It is followed by a newline.
1501 .D1 \&.Dl % mandoc mdoc.7 \e(ba less
1508 Begin a block enclosed by double quotes.
1509 Does not have any head arguments.
1512 .Bd -literal -offset indent -compact
1514 April is the cruellest month
1522 Encloses its arguments in
1527 .Bd -literal -offset indent -compact
1528 \&.Dq April is the cruellest month
1539 This is the mandatory second macro of any
1542 Its syntax is as follows:
1543 .Bd -ragged -offset indent
1549 .Op Ar volume | arch
1554 Its arguments are as follows:
1555 .Bl -tag -width Ds -offset Ds
1557 The document's title (name), defaulting to
1560 It should be capitalised.
1571 .Pq Perl libraries ,
1581 .Pq system utilities ,
1583 .Pq kernel functions ,
1585 .Pq X Window System ,
1587 .Pq X Window System ,
1597 It should correspond to the manual's filename suffix and defaults to
1601 This overrides the volume inferred from
1603 This field is optional, and if specified, must be one of
1605 .Pq users' supplementary documents ,
1607 .Pq programmers' supplementary documents ,
1609 .Pq administrators' supplementary documents ,
1611 .Pq system managers' manuals ,
1613 .Pq users' reference manuals ,
1615 .Pq programmers' reference manuals ,
1617 .Pq kernel manuals ,
1628 .Pq contributed manuals .
1630 This specifies a specific relevant architecture.
1633 is not provided, it may be used in its place, else it may be used
1635 It, too, is optional.
1670 .D1 \&.Dt FOO 9 i386
1677 Defined variables such as preprocessor constants.
1681 .D1 \&.Dv STDOUT_FILENO
1686 Format the DragonFly BSD version provided as an argument, or a default
1687 value if no argument is provided.
1703 Close a scope started by
1705 Its syntax is as follows:
1707 .D1 Pf \. Sx \&Ec Op Ar TERM
1711 argument is used as the enclosure tail, for example, specifying \e(rq
1715 End a display context started by
1718 End a font mode context started by
1721 End a keep context started by
1724 End a list context started by
1732 Denotes text that should be emphasised.
1733 Note that this is a presentation term and should not be used for
1734 stylistically decorating technical terms.
1746 This macro is obsolete and not implemented in
1749 An arbitrary enclosure.
1750 Its syntax is as follows:
1752 .D1 Pf \. Sx \&Eo Op Ar TERM
1756 argument is used as the enclosure head, for example, specifying \e(lq
1760 Display error constants.
1769 This macro is obsolete and not implemented.
1771 Environmental variables such as those specified in
1778 Insert a standard sentence regarding exit values.
1779 Its syntax is as follows:
1781 .D1 Pf \. Sx \&Ex Fl std Op Ar utility
1785 is not specified, the document's name set by
1793 Its syntax is as follows:
1794 .Bd -ragged -offset indent
1800 This may be invoked for names with or without the corresponding type.
1801 It is also used to specify the field name of a structure.
1804 macro is used in the
1808 section when documenting multi-line function prototypes.
1809 If invoked with multiple arguments, the arguments are separated by a
1811 Furthermore, if the following macro is another
1813 the last argument will also have a trailing comma.
1816 .D1 \&.Fa \(dqconst char *p\(dq
1817 .D1 \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq
1823 End a function context started by
1826 Historically used to document include files.
1827 This usage has been deprecated in favour of
1829 Do not use this macro.
1832 .Sx MANUAL STRUCTURE
1837 Used when listing arguments to command-line utilities.
1838 Prints a fixed-width hyphen
1840 directly followed by each argument.
1841 If no arguments are provided, a hyphen is printed followed by a space.
1842 If the argument is a macro, a hyphen is prefixed to the subsequent macro
1849 .D1 \&.Op \&Fl o \&Ns \&Ar file
1855 Its syntax is as follows:
1856 .Bd -ragged -offset indent
1860 .Op Oo Cm argtype Oc Cm argname
1863 Function arguments are surrounded in parenthesis and
1864 are delimited by commas.
1865 If no arguments are specified, blank parenthesis are output.
1868 .D1 \&.Fn "int funcname" "int arg0" "int arg1"
1869 .D1 \&.Fn funcname "int arg0"
1870 .D1 \&.Fn funcname arg0
1871 .Bd -literal -offset indent -compact
1877 .Sx MANUAL STRUCTURE
1881 Begin a function block.
1882 This is a multi-line version of
1884 Its syntax is as follows:
1886 .D1 Pf \. Sx \&Fo Cm funcname
1888 Invocations usually occur in the following context:
1889 .Bd -ragged -offset indent
1890 .Pf \. Sx \&Ft Cm functype
1892 .Pf \. Sx \&Fo Cm funcname
1894 .Pf \. Sx \&Fa Oo Cm argtype Oc Cm argname
1906 .Sx MANUAL STRUCTURE ,
1913 Its syntax is as follows:
1915 .D1 Pf \. Sx \&Ft Cm functype
1919 .Bd -literal -offset indent -compact
1925 .Sx MANUAL STRUCTURE ,
1930 Format the FreeBSD version provided as an argument, or a default value
1931 if no argument is provided.
1947 This macro is obsolete and not implemented.
1949 Designate an internal or interactive command.
1952 but used for instructions rather than values.
1959 .Sx \&Bd No Fl literal
1962 is preferred for displaying code; the
1964 macro is used when referring to specific instructions.
1971 section (only if invoked as the line macro), the first argument is
1974 the arguments is enclosed in angle brackets.
1980 .Sx MANUAL STRUCTURE .
1983 The syntax of this macro depends on the list type.
1992 have the following syntax:
1994 .D1 Pf \. Sx \&It Cm args
2003 have the following syntax:
2007 with subsequent lines interpreted within the scope of the
2009 until either a closing
2016 list has the following syntax:
2018 .D1 Pf \. Sx \&It Op Cm args
2020 Subsequent lines are interpreted as with
2023 The line arguments correspond to the list's left-hand side; body
2024 arguments correspond to the list's contents.
2028 list is the most complicated.
2029 Its syntax is as follows:
2031 .D1 Pf \. Sx \&It Op Cm args
2035 are phrases, a mix of macros and text corresponding to a line column,
2036 delimited by tabs or the special
2039 Lines subsequent the
2041 are interpreted within the scope of the last phrase.
2042 Calling the pseudo-macro
2044 will open a new phrase scope (this must occur on a macro line to be
2045 interpreted as a macro).
2046 Note that the tab phrase delimiter may only be used within the
2049 Subsequent this, only the
2051 pseudo-macro may be used to delimit phrases.
2052 Furthermore, note that quoted sections propagate over tab-delimited
2057 .D1 .It \(dqcol1 ; <TAB> col2 ;\(dq \&;
2059 will preserve the semicolon whitespace except for the last.
2065 The syntax is as follows:
2067 .D1 Pf \. Sx \&Lb Cm library
2071 parameter may be a system library, such as
2075 in which case a small library description is printed next to the linker
2076 invocation; or a custom library, in which case the library name is
2078 This is most commonly used in the
2080 section as described in
2081 .Sx MANUAL STRUCTURE .
2087 Denotes text that should be in a literal font mode.
2088 Note that this is a presentation term and should not be used for
2089 stylistically decorating technical terms.
2098 Its syntax is as follows:
2100 .D1 Pf \. Sx \&Lk Cm uri Op Cm name
2103 .D1 \&.Lk http://bsd.lv "The BSD.lv Project"
2104 .D1 \&.Lk http://bsd.lv
2112 Display a mathematical symbol.
2113 Its syntax is as follows:
2115 .D1 Pf \. Sx \&Ms Cm symbol
2124 Its syntax is as follows:
2126 .D1 Pf \. Sx \&Mt Cm address
2129 .D1 \&.Mt discuss@manpages.bsd.lv
2131 A one-line description of the manual's content.
2132 This may only be invoked in the
2134 section subsequent the
2139 .D1 \&.Sx \&Nd mdoc language reference
2140 .D1 \&.Sx \&Nd format and display UNIX manuals
2144 macro technically accepts child macros and terminates with a subsequent
2147 Do not assume this behaviour: some
2149 database generators are not smart enough to parse more than the line
2150 arguments and will display macros verbatim.
2155 The name of the manual page, or \(em in particular in section 1, 6,
2156 and 8 pages \(em of an additional command or feature documented in
2158 When first invoked, the
2160 macro expects a single argument, the name of the manual page.
2161 Usually, the first invocation happens in the
2163 section of the page.
2164 The specified name will be remembered and used whenever the macro is
2165 called again without arguments later in the page.
2169 .Sx Block full-implicit
2170 semantics when invoked as the first macro on an input line in the
2172 section; otherwise, it uses ordinary
2177 .Bd -literal -offset indent
2186 of section 2, 3 and 9 manual pages, use the
2190 to mark up the name of the manual page.
2194 macro used to terminate prior macro contexts.
2197 .D1 \&.Sx \&Fl ab \&No cd \&Fl ef
2200 Following invocation, text is interpreted as free-form text until a
2201 macro is encountered.
2204 .D1 \&.Fl o \&Ns \&Ar output
2211 Format the NetBSD version provided as an argument, or a default value if
2212 no argument is provided.
2232 Multi-line version of
2236 .Bd -literal -offset indent -compact
2238 \&.Op Fl flag Ns Ar value
2242 Command-line option.
2243 Used when listing options to command-line utilities.
2244 Prints the argument(s) in brackets.
2247 .D1 \&.Op \&Fl a \&Ar b
2248 .D1 \&.Op \&Ar a | b
2253 Document operating system version.
2254 This is the mandatory third macro of
2258 Its syntax is as follows:
2260 .D1 Pf \. Sx \&Os Op Cm system
2264 parameter specifies the relevant operating system or environment.
2265 Left unspecified, it defaults to the local operating system version.
2266 This is the suggested form.
2270 .D1 \&.Os KTH/CSC/TCS
2281 this macro has been deprecated.
2283 Format the OpenBSD version provided as an argument, or a default value
2284 if no argument is provided.
2303 .D1 \&.Pa /usr/bin/mandoc
2304 .D1 \&.Pa /usr/share/man/man7/mdoc.7
2309 Close parenthesised context opened by
2314 between its arguments.
2315 Its syntax is as follows:
2317 .D1 Pf \. \&Pf Cm prefix suffix
2321 argument may be a macro.
2324 .D1 \&.Pf \e. \&Sx \&Pf \&Cm prefix suffix
2326 Multi-line version of
2330 This will assert vertical space between prior and subsequent macros
2333 Parenthesised enclosure.
2338 Close quoted context opened by
2341 Format a single-quoted literal.
2347 Multi-line version of
2350 Encloses its arguments in
2365 Does not have any tail arguments.
2367 Begin a bibliographic
2370 Does not have any head arguments.
2371 The block macro may only contain
2387 child macros (at least one must be specified).
2390 .Bd -literal -offset indent -compact
2392 \&.%A J. E. Hopcroft
2394 \&.%B Introduction to Automata Theory, Languages, and Computation
2395 \&.%I Addison-Wesley
2396 \&.%C Reading, Massachusettes
2403 block is used within a SEE ALSO section, a vertical space is asserted
2404 before the rendered output, else the block continues on the current
2407 Inserts text regarding a function call's return value.
2408 This macro must consist of the
2410 argument followed by an optional
2414 is not provided, the document's name as stipulated by the first
2421 Close single-quoted context opened by
2424 Begin a new section.
2425 For a list of conventional manual sections, see
2426 .Sx MANUAL STRUCTURE .
2427 These sections should be used unless it's absolutely necessary that
2428 custom sections be used.
2430 Section names should be unique so that they may be keyed by
2439 Switches the spacing mode for output generated from macros.
2440 Its syntax is as follows:
2442 .D1 Pf \. Sx \&Sm Cm on | off
2444 By default, spacing is
2448 no white space is inserted between macro arguments and between the
2449 output generated from adjacent macros, but free-form text lines
2450 still get normal spacing between words and sentences.
2452 Multi-line version of
2455 Encloses its arguments in
2465 Begin a new sub-section.
2468 there's no convention for sub-sections.
2469 Conventional sections, as described in
2470 .Sx MANUAL STRUCTURE ,
2471 rarely have sub-sections.
2473 Sub-section names should be unique so that they may be keyed by
2482 Replace an abbreviation for a standard with the full form.
2483 The following standards are recognised:
2485 .Bl -tag -width "-p1003.1g-2000X" -compact
2579 Reference a section or sub-section.
2580 The referenced section or sub-section name must be identical to the
2581 enclosed argument, including whitespace.
2584 .D1 \&.Sx MANUAL STRUCTURE
2586 Format enclosed arguments in symbolic
2588 Note that this is a presentation term and should not be used for
2589 stylistically decorating technical terms.
2603 .Dq currently under development.
2605 Format the UNIX name.
2606 Accepts no argument.
2625 .D1 \&.Va const char *bar ;
2628 This is also used for indicating global variables in the
2630 section, in which case a variable name is also specified.
2631 Note that it accepts
2632 .Sx Block partial-implicit
2633 syntax when invoked as the first macro in the
2635 section, else it accepts ordinary
2639 Note that this should not be confused with
2641 which is used for function return types.
2644 .D1 \&.Vt unsigned char
2645 .D1 \&.Vt extern const char * const sys_signame[] \&;
2648 .Sx MANUAL STRUCTURE
2652 Close a scope opened by
2655 Open an extension scope.
2656 This macro originally existed to extend the 9-argument limit of troff;
2657 since this limit has been lifted, the macro has been deprecated.
2659 Link to another manual
2660 .Pq Qq cross-reference .
2661 Its syntax is as follows:
2663 .D1 Pf \. Sx \&Xr Cm name section
2669 are the name and section of the linked manual.
2672 is followed by non-punctuation, an
2674 is inserted into the token stream.
2675 This behaviour is for compatibility with
2680 .D1 \&.Xr mandoc 1 \&;
2681 .D1 \&.Xr mandoc 1 \&Ns s behaviour
2684 This macro should not be used; it is implemented for compatibility with
2689 in the event of natural paragraph breaks.
2691 Emits vertical space.
2692 This macro should not be used; it is implemented for compatibility with
2694 Its syntax is as follows:
2696 .D1 Pf \. Sx \&sp Op Cm height
2700 argument must be formatted as described in
2701 .Sx Scaling Widths .
2704 asserts a single vertical space.
2706 This section documents compatibility between mandoc and other other
2707 troff implementations, at this time limited to GNU troff
2711 refers to groff versions before the
2714 .Pq somewhere between 1.15 and 1.19 .
2716 Heirloom troff, the other significant troff implementation accepting
2717 \-mdoc, is similar to historic groff.
2723 macro in groff prints
2725 In mandoc, it resolves to the current date.
2727 The \es (font size), \em (font colour), and \eM (font filling colour)
2728 font decoration escapes are all discarded in mandoc.
2730 Old groff fails to assert a newline before
2731 .Sx \&Bd Fl ragged compact .
2733 groff behaves inconsistently when encountering
2737 regarding spacing between arguments.
2738 In mandoc, this is not the case: each argument is consistently followed
2739 by a single space and the trailing
2741 suppresses prior spacing.
2743 groff behaves inconsistently when encountering
2749 at times newline(s) are suppressed depending on whether a prior
2752 In mandoc, this is not the case.
2757 for the normalised behaviour.
2759 Historic groff does not break before an
2761 when not invoked as the line macro in the
2765 Historic groff formats the
2767 badly: trailing arguments are trashed and
2769 is not specially treated.
2771 groff does not accept the
2773 pseudo-macro as a line macro.
2778 is no longer accepted.
2782 macro does not format its arguments when used in the FILES section under
2786 Historic groff does not print a dash for empty
2789 mandoc and newer groff implementations do.
2791 groff behaves irregularly when specifying
2794 within line-macro scopes.
2795 mandoc follows a consistent system.
2797 In mandoc, negative scaling units are truncated to zero; groff would
2798 move to prior lines.
2801 scaling unit, while accepted, is rendered as the default unit.
2803 In quoted literals, groff allowed pair-wise double-quotes to produce a
2804 standalone double-quote in formatted output.
2805 This idiosyncratic behaviour is not applicable in mandoc.
2809 .Fl offset Ar center
2812 are disregarded in mandoc.
2813 Furthermore, troff specifies a
2815 argument that is not supported in mandoc.
2816 Lastly, since text is not right-justified in mandoc (or even groff),
2825 Historic groff has many un-callable macros.
2826 Most of these (excluding some block-level macros) are now callable.
2832 but has been a proper delimiter since then.
2835 is assumed for all lists (it wasn't in historic groff): any list may be
2838 lists will restart the sequence only for the sub-list.
2842 incorrectly by following it with a reserved character and expecting the
2843 delimiter to render.
2844 This is not supported in mandoc.
2852 macros were stipulated only to occur in certain manual sections.
2853 mandoc does not have these restrictions.
2855 Newer groff and mandoc print
2857 prior to unknown arguments of
2859 older groff did nothing.
2867 reference was written by
2868 .An Kristaps Dzonsons Aq kristaps@bsd.lv .