1 .\" $Id: mdoc.7,v 1.153 2010/08/24 13:07:01 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: August 24 2010 $
23 .Nd mdoc language reference
27 language is used to format
31 This reference document describes its syntax, structure, and
33 The reference implementation is
37 section describes compatibility with other troff \-mdoc implementations.
41 document follows simple rules: lines beginning with the control
44 are parsed for macros.
45 Other lines are interpreted within the scope of
47 .Bd -literal -offset indent
48 \&.Sh Macro lines change control state.
49 Other lines are interpreted within the current state.
53 documents may contain only graphable 7-bit ASCII characters, the space
54 character, and, in certain circumstances, the tab character.
61 whether in a macro or free-form text line, is ignored to the end of
63 A macro line with only a control character and comment escape,
66 Macro lines with only a control character and optional whitespace are
68 .Ss Reserved Characters
69 Within a macro line, the following characters are reserved:
71 .Bl -tag -width Ds -offset indent -compact
96 Use of reserved characters is described in
98 For general use in macro lines, these characters can either be escaped
99 with a non-breaking space
101 or, if applicable, an appropriate escape sequence can be used.
102 .Ss Special Characters
103 Special characters may occur in both macro and free-form lines.
104 Sequences begin with the escape character
106 followed by either an open-parenthesis
108 for two-character sequences; an open-bracket
110 for n-character sequences (terminated at a close-bracket
112 or a single one character sequence.
123 Terms may be text-decorated using the
125 escape followed by an indicator: B (bold), I (italic), R (Roman), or P
126 (revert to previous mode):
128 .D1 \efBbold\efR \efIitalic\efP
130 A numerical representation 3, 2, or 1 (bold, italic, and Roman,
131 respectively) may be used instead.
132 A text decoration is valid within
133 the current font scope only: if a macro opens a font scope alongside
134 its own scope, such as
137 in-scope invocations of
139 are only valid within the font scope of the macro.
142 is specified outside of any font scope, such as in unenclosed, free-form
143 text, it will affect the remainder of the document.
149 which encourages semantic annotation.
150 .Ss Predefined Strings
153 also defined a set of package-specific
154 .Dq predefined strings ,
156 .Sx Special Characters ,
157 mark special output characters and strings by way of input codes.
158 Predefined strings are escaped with the slash-asterisk,
176 Whitespace consists of the space character.
177 In free-form lines, whitespace is preserved within a line; unescaped
178 trailing spaces are stripped from input (unless in a literal context).
179 Blank free-form lines, which may include whitespace, are only permitted
180 within literal contexts.
182 In macro lines, whitespace delimits arguments and is discarded.
183 If arguments are quoted, whitespace within the quotes is retained.
185 Macro arguments may be quoted with double-quotes to group
186 space-delimited terms or to retain blocks of whitespace.
187 A quoted argument begins with a double-quote preceded by whitespace.
188 The next double-quote not pairwise adjacent to another double-quote
189 terminates the literal, regardless of surrounding whitespace.
191 Note that any quoted text, even if it would cause a macro invocation
192 when unquoted, is considered literal text.
193 Thus, the following produces
195 .Bd -literal -offset indent
199 In free-form mode, quotes are regarded as opaque text.
201 There are several macros in
203 that require a date argument.
204 The canonical form for dates is the American format:
206 .D1 Cm Month Day , Year
210 value is an optionally zero-padded numeral.
213 value is the full month name.
216 value is the full four-digit year.
218 Reduced form dates are broken-down canonical form dates:
223 Some examples of valid dates follow:
225 .D1 "May, 2009" Pq reduced form
226 .D1 "2009" Pq reduced form
227 .D1 "May 20, 2009" Pq canonical form
229 Many macros support scaled widths for their arguments, such as
230 stipulating a two-inch list indentation with the following:
231 .Bd -literal -offset indent
235 The syntax for scaled widths is
236 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
237 where a decimal must be preceded or proceeded by at least one digit.
238 Negative numbers, while accepted, are truncated to zero.
239 The following scaling units are accepted:
241 .Bl -tag -width Ds -offset indent -compact
254 default vertical span
266 default horizontal span
271 Using anything other than
277 is necessarily non-portable across output media.
281 When composing a manual, make sure that sentences end at the end of
283 By doing so, front-ends will be able to apply the proper amount of
284 spacing after the end of sentence (unescaped) period, exclamation mark,
285 or question mark followed by zero or more non-sentence closing
292 The proper spacing is also intelligently preserved if a sentence ends at
293 the boundary of a macro line.
297 .D1 \&Fl T \&Ns \&Cm ascii \.
301 document consists of a document prologue followed by one or more
304 The prologue, which consists of the
309 macros in that order, is required for every document.
311 The first section (sections are denoted by
313 must be the NAME section, consisting of at least one
318 Following that, convention dictates specifying at least the
322 sections, although this varies between manual sections.
324 The following is a well-formed skeleton
327 .Bd -literal -offset indent
333 \&.Nd a description goes here
334 \&.\e\*q The next is for sections 2, 3, & 9 only.
343 utility processes files ...
344 \&.\e\*q .Sh IMPLEMENTATION NOTES
345 \&.\e\*q The next is for sections 2, 3, & 9 only.
346 \&.\e\*q .Sh RETURN VALUES
347 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
348 \&.\e\*q .Sh ENVIRONMENT
350 \&.\e\*q The next is for sections 1 & 8 only.
351 \&.\e\*q .Sh EXIT STATUS
352 \&.\e\*q .Sh EXAMPLES
353 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
354 \&.\e\*q .Sh DIAGNOSTICS
355 \&.\e\*q The next is for sections 2, 3, & 9 only.
357 \&.\e\*q .Sh SEE ALSO
358 \&.\e\*q .Xr foobar 1
359 \&.\e\*q .Sh STANDARDS
364 \&.\e\*q .Sh SECURITY CONSIDERATIONS
369 document are conventionally ordered as they appear above.
370 Sections should be composed as follows:
371 .Bl -ohang -offset Ds
373 The name(s) and a one line description of the documented material.
374 The syntax for this as follows:
375 .Bd -literal -offset indent
379 \&.Nd a one line description
384 macro(s) must precede the
393 The name of the library containing the documented material, which is
394 assumed to be a function in a section 2, 3, or 9 manual.
395 The syntax for this is as follows:
396 .Bd -literal -offset indent
403 Documents the utility invocation syntax, function call syntax, or device
406 For the first, utilities (sections 1, 6, and 8), this is
407 generally structured as follows:
408 .Bd -literal -offset indent
419 For the second, function calls (sections 2, 3, 9):
420 .Bd -literal -offset indent
422 \&.Vt extern const char *global;
424 \&.Fn foo "const char *src"
426 \&.Fn bar "const char *src"
429 And for the third, configurations (section 4):
430 .Bd -literal -offset indent
431 \&.Cd \*qit* at isa? port 0x2e\*q
432 \&.Cd \*qit* at isa? port 0x4e\*q
435 Manuals not in these sections generally don't need a
438 Some macros are displayed differently in the
440 section, particularly
450 All of these macros are output on their own line.
451 If two such dissimilar macros are pairwise invoked (except for
457 they are separated by a vertical space, unless in the case of
462 which are always separated by vertical space.
464 When text and macros following an
466 macro starting an input line span multiple output lines,
467 all output lines but the first will be indented to align
468 with the text immediately following the
470 macro, up to the next
475 macro or the end of an enclosing block, whichever comes first.
477 This expands upon the brief, one line description in
479 It usually contains a breakdown of the options (if documenting a
481 .Bd -literal -offset indent
482 The arguments are as follows:
483 \&.Bl \-tag \-width Ds
485 Print verbose information.
489 Manuals not documenting a command won't include the above fragment.
490 .It Em IMPLEMENTATION NOTES
491 Implementation-specific notes should be kept here.
492 This is useful when implementing standard functions that may have side
493 effects or notable algorithmic implications.
495 This section documents the
496 return values of functions in sections 2, 3, and 9.
501 Lists the environment variables used by the utility,
502 and explains the syntax and semantics of their values.
505 manual provides examples of typical content and formatting.
510 Documents files used.
511 It's helpful to document both the file name and a short description of how
512 the file is used (created, modified, etc.).
517 This section documents the
518 command exit status for section 1, 6, and 8 utilities.
519 Historically, this information was described in
521 a practise that is now discouraged.
527 This often contains snippets of well-formed, well-tested invocations.
528 Make sure that examples work properly!
530 Documents error conditions.
531 This is most useful in section 4 manuals.
532 Historically, this section was used in place of
534 for manuals in sections 1, 6, and 8; however, this practise is
541 Documents error handling in sections 2, 3, and 9.
546 References other manuals with related topics.
547 This section should exist for most manuals.
548 Cross-references should conventionally be ordered first by section, then
554 References any standards implemented or used.
555 If not adhering to any standards, the
557 section should be used instead.
562 A brief history of the subject, including where support first appeared.
564 Credits to the person or persons who wrote the code and/or documentation.
565 Authors should generally be noted by both name and email address.
570 Common misuses and misunderstandings should be explained
573 Known bugs, limitations, and work-arounds should be described
575 .It Em SECURITY CONSIDERATIONS
576 Documents any security precautions that operators should consider.
579 Macros are one to three three characters in length and begin with a
582 at the beginning of the line.
583 An arbitrary amount of whitespace may sit between the control character
585 Thus, the following are equivalent:
586 .Bd -literal -offset indent
591 The syntax of a macro depends on its classification.
594 refers to macro arguments, which may be followed by zero or more
598 opens the scope of a macro; and if specified,
604 column indicates that the macro may be called subsequent to the initial
606 If a macro is not callable, then its invocation after the initial line
607 macro is interpreted as opaque text, such that
614 column indicates whether the macro may be followed by further
615 (ostensibly callable) macros.
616 If a macro is not parsed, subsequent macro invocations on the line
617 will be interpreted as opaque text.
621 column, if applicable, describes closure rules.
622 .Ss Block full-explicit
623 Multi-line scope closed by an explicit closing macro.
624 All macros contains bodies; only
627 .Bd -literal -offset indent
628 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
633 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsedX" "closed by XXX"
634 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
635 .It Sx \&Bd Ta \&No Ta \&No Ta closed by Sx \&Ed
636 .It Sx \&Bf Ta \&No Ta \&No Ta closed by Sx \&Ef
637 .It Sx \&Bk Ta \&No Ta \&No Ta closed by Sx \&Ek
638 .It Sx \&Bl Ta \&No Ta \&No Ta closed by Sx \&El
639 .It Sx \&Ed Ta \&No Ta \&No Ta opened by Sx \&Bd
640 .It Sx \&Ef Ta \&No Ta \&No Ta opened by Sx \&Bf
641 .It Sx \&Ek Ta \&No Ta \&No Ta opened by Sx \&Bk
642 .It Sx \&El Ta \&No Ta \&No Ta opened by Sx \&Bl
644 .Ss Block full-implicit
645 Multi-line scope closed by end-of-file or implicitly by another macro.
646 All macros have bodies; some
654 don't have heads; only one
661 .Bd -literal -offset indent
662 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
666 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsedX" "closed by XXXXXXXXXXX"
667 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
668 .It Sx \&It Ta \&No Ta Yes Ta closed by Sx \&It , Sx \&El
669 .It Sx \&Nd Ta \&No Ta \&No Ta closed by Sx \&Sh
670 .It Sx \&Nm Ta \&No Ta Yes Ta closed by Sx \&Nm , Sx \&Sh , Sx \&Ss
671 .It Sx \&Sh Ta \&No Ta \&No Ta closed by Sx \&Sh
672 .It Sx \&Ss Ta \&No Ta \&No Ta closed by Sx \&Sh , Sx \&Ss
678 .Sx Block full-implicit
679 macro only when invoked as the first macro
682 section line, else it is
684 .Ss Block partial-explicit
685 Like block full-explicit, but also with single-line scope.
686 Each has at least a body and, in limited circumstances, a head
693 .Bd -literal -offset indent
694 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
696 \&.Yc \(lBtail...\(rB
698 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \
699 \(lBbody...\(rB \&Yc \(lBtail...\(rB
702 .Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXX" -compact -offset indent
703 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
704 .It Sx \&Ac Ta Yes Ta Yes Ta opened by Sx \&Ao
705 .It Sx \&Ao Ta Yes Ta Yes Ta closed by Sx \&Ac
706 .It Sx \&Bc Ta Yes Ta Yes Ta closed by Sx \&Bo
707 .It Sx \&Bo Ta Yes Ta Yes Ta opened by Sx \&Bc
708 .It Sx \&Brc Ta Yes Ta Yes Ta opened by Sx \&Bro
709 .It Sx \&Bro Ta Yes Ta Yes Ta closed by Sx \&Brc
710 .It Sx \&Dc Ta Yes Ta Yes Ta opened by Sx \&Do
711 .It Sx \&Do Ta Yes Ta Yes Ta closed by Sx \&Dc
712 .It Sx \&Ec Ta Yes Ta Yes Ta opened by Sx \&Eo
713 .It Sx \&Eo Ta Yes Ta Yes Ta closed by Sx \&Ec
714 .It Sx \&Fc Ta Yes Ta Yes Ta opened by Sx \&Fo
715 .It Sx \&Fo Ta \&No Ta \&No Ta closed by Sx \&Fc
716 .It Sx \&Oc Ta Yes Ta Yes Ta closed by Sx \&Oo
717 .It Sx \&Oo Ta Yes Ta Yes Ta opened by Sx \&Oc
718 .It Sx \&Pc Ta Yes Ta Yes Ta closed by Sx \&Po
719 .It Sx \&Po Ta Yes Ta Yes Ta opened by Sx \&Pc
720 .It Sx \&Qc Ta Yes Ta Yes Ta opened by Sx \&Oo
721 .It Sx \&Qo Ta Yes Ta Yes Ta closed by Sx \&Oc
722 .It Sx \&Re Ta \&No Ta \&No Ta opened by Sx \&Rs
723 .It Sx \&Rs Ta \&No Ta \&No Ta closed by Sx \&Re
724 .It Sx \&Sc Ta Yes Ta Yes Ta opened by Sx \&So
725 .It Sx \&So Ta Yes Ta Yes Ta closed by Sx \&Sc
726 .It Sx \&Xc Ta Yes Ta Yes Ta opened by Sx \&Xo
727 .It Sx \&Xo Ta Yes Ta Yes Ta closed by Sx \&Xc
729 .Ss Block partial-implicit
730 Like block full-implicit, but with single-line scope closed by
731 .Sx Reserved Characters
733 .Bd -literal -offset indent
734 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB
737 .Bl -column "MacroX" "CallableX" "ParsedX" -compact -offset indent
738 .It Em Macro Ta Em Callable Ta Em Parsed
739 .It Sx \&Aq Ta Yes Ta Yes
740 .It Sx \&Bq Ta Yes Ta Yes
741 .It Sx \&Brq Ta Yes Ta Yes
742 .It Sx \&D1 Ta \&No Ta \&Yes
743 .It Sx \&Dl Ta \&No Ta Yes
744 .It Sx \&Dq Ta Yes Ta Yes
745 .It Sx \&Op Ta Yes Ta Yes
746 .It Sx \&Pq Ta Yes Ta Yes
747 .It Sx \&Ql Ta Yes Ta Yes
748 .It Sx \&Qq Ta Yes Ta Yes
749 .It Sx \&Sq Ta Yes Ta Yes
750 .It Sx \&Vt Ta Yes Ta Yes
756 .Sx Block partial-implicit
757 only when invoked as the first macro
760 section line, else it is
764 .Sx Reserved Characters ,
765 end of line, fixed argument lengths, and/or subsequent macros.
766 In-line macros have only text children.
767 If a number (or inequality) of arguments is
769 then the macro accepts an arbitrary number of arguments.
770 .Bd -literal -offset indent
771 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lBres...\(rB
773 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc...
775 \&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
778 .Bl -column "MacroX" "CallableX" "ParsedX" "Arguments" -compact -offset indent
779 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Arguments
780 .It Sx \&%A Ta \&No Ta \&No Ta >0
781 .It Sx \&%B Ta \&No Ta \&No Ta >0
782 .It Sx \&%C Ta \&No Ta \&No Ta >0
783 .It Sx \&%D Ta \&No Ta \&No Ta >0
784 .It Sx \&%I Ta \&No Ta \&No Ta >0
785 .It Sx \&%J Ta \&No Ta \&No Ta >0
786 .It Sx \&%N Ta \&No Ta \&No Ta >0
787 .It Sx \&%O Ta \&No Ta \&No Ta >0
788 .It Sx \&%P Ta \&No Ta \&No Ta >0
789 .It Sx \&%Q Ta \&No Ta \&No Ta >0
790 .It Sx \&%R Ta \&No Ta \&No Ta >0
791 .It Sx \&%T Ta \&No Ta \&No Ta >0
792 .It Sx \&%U Ta \&No Ta \&No Ta >0
793 .It Sx \&%V Ta \&No Ta \&No Ta >0
794 .It Sx \&Ad Ta Yes Ta Yes Ta n
795 .It Sx \&An Ta Yes Ta Yes Ta n
796 .It Sx \&Ap Ta Yes Ta Yes Ta 0
797 .It Sx \&Ar Ta Yes Ta Yes Ta n
798 .It Sx \&At Ta Yes Ta Yes Ta 1
799 .It Sx \&Bsx Ta Yes Ta Yes Ta n
800 .It Sx \&Bt Ta \&No Ta \&No Ta 0
801 .It Sx \&Bx Ta Yes Ta Yes Ta n
802 .It Sx \&Cd Ta Yes Ta Yes Ta >0
803 .It Sx \&Cm Ta Yes Ta Yes Ta n
804 .It Sx \&Db Ta \&No Ta \&No Ta 1
805 .It Sx \&Dd Ta \&No Ta \&No Ta n
806 .It Sx \&Dt Ta \&No Ta \&No Ta n
807 .It Sx \&Dv Ta Yes Ta Yes Ta n
808 .It Sx \&Dx Ta Yes Ta Yes Ta n
809 .It Sx \&Em Ta Yes Ta Yes Ta >0
810 .It Sx \&En Ta \&No Ta \&No Ta 0
811 .It Sx \&Er Ta Yes Ta Yes Ta >0
812 .It Sx \&Es Ta \&No Ta \&No Ta 0
813 .It Sx \&Ev Ta Yes Ta Yes Ta n
814 .It Sx \&Ex Ta \&No Ta \&No Ta n
815 .It Sx \&Fa Ta Yes Ta Yes Ta n
816 .It Sx \&Fd Ta \&No Ta \&No Ta >0
817 .It Sx \&Fl Ta Yes Ta Yes Ta n
818 .It Sx \&Fn Ta Yes Ta Yes Ta >0
819 .It Sx \&Fr Ta \&No Ta \&No Ta n
820 .It Sx \&Ft Ta Yes Ta Yes Ta n
821 .It Sx \&Fx Ta Yes Ta Yes Ta n
822 .It Sx \&Hf Ta \&No Ta \&No Ta n
823 .It Sx \&Ic Ta Yes Ta Yes Ta >0
824 .It Sx \&In Ta \&No Ta \&No Ta n
825 .It Sx \&Lb Ta \&No Ta \&No Ta 1
826 .It Sx \&Li Ta Yes Ta Yes Ta n
827 .It Sx \&Lk Ta Yes Ta Yes Ta n
828 .It Sx \&Lp Ta \&No Ta \&No Ta 0
829 .It Sx \&Ms Ta Yes Ta Yes Ta >0
830 .It Sx \&Mt Ta Yes Ta Yes Ta >0
831 .It Sx \&Nm Ta Yes Ta Yes Ta n
832 .It Sx \&No Ta Yes Ta Yes Ta 0
833 .It Sx \&Ns Ta Yes Ta Yes Ta 0
834 .It Sx \&Nx Ta Yes Ta Yes Ta n
835 .It Sx \&Os Ta \&No Ta \&No Ta n
836 .It Sx \&Ot Ta \&No Ta \&No Ta n
837 .It Sx \&Ox Ta Yes Ta Yes Ta n
838 .It Sx \&Pa Ta Yes Ta Yes Ta n
839 .It Sx \&Pf Ta Yes Ta Yes Ta 1
840 .It Sx \&Pp Ta \&No Ta \&No Ta 0
841 .It Sx \&Rv Ta \&No Ta \&No Ta n
842 .It Sx \&Sm Ta \&No Ta \&No Ta 1
843 .It Sx \&St Ta \&No Ta Yes Ta 1
844 .It Sx \&Sx Ta Yes Ta Yes Ta >0
845 .It Sx \&Sy Ta Yes Ta Yes Ta >0
846 .It Sx \&Tn Ta Yes Ta Yes Ta >0
847 .It Sx \&Ud Ta \&No Ta \&No Ta 0
848 .It Sx \&Ux Ta Yes Ta Yes Ta n
849 .It Sx \&Va Ta Yes Ta Yes Ta n
850 .It Sx \&Vt Ta Yes Ta Yes Ta >0
851 .It Sx \&Xr Ta Yes Ta Yes Ta >0
852 .It Sx \&br Ta \&No Ta \&No Ta 0
853 .It Sx \&sp Ta \&No Ta \&No Ta 1
856 This section is a canonical reference of all macros, arranged
858 For the scoping of individual macros, see
864 Multiple authors should each be accorded their own
867 Author names should be ordered with full or abbreviated forename(s)
868 first, then full surname.
873 This macro may also be used in a non-bibliographic context when
874 referring to book titles.
876 Publication city or location of an
880 Publication date of an
883 This should follow the reduced or canonical form syntax described in
886 Publisher or issuer name of an
894 Issue number (usually for journals) of an
898 Optional information of an
902 Book or journal page number of an
906 Institutional author (school, government, etc.) of an
909 Multiple institutional authors should each be accorded their own
913 Technical report name of an
920 This macro may also be used in a non-bibliographical context when
921 referring to article titles.
923 URI of reference document.
932 Does not have any tail arguments.
935 Do not use this for postal addresses.
942 Requires either the name of an author or one of the following arguments:
944 .Bl -tag -width "-nosplitX" -offset indent -compact
946 Start a new output line before each subsequent invocation of
955 The effect of selecting either of the
957 modes ends at the beginning of the
962 section, the default is
964 for the first author listing and
966 for all other author listings.
970 .D1 \&.An Kristaps Dzonsons \&Aq kristaps@bsd.lv
972 Begin a block enclosed by angle brackets.
973 Does not have any head arguments.
976 .D1 \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac
981 Inserts an apostrophe without any surrounding whitespace.
982 This is generally used as a grammatical device when referring to the verb
986 .D1 \&.Fn execve \&Ap d
988 Encloses its arguments in angle brackets.
991 .D1 \&.Fl -key= \&Ns \&Aq \&Ar val
994 this macro is often abused for rendering URIs, which should instead use
998 or to note pre-processor
1000 statements, which should use
1007 If an argument is not provided, the string
1009 is used as a default.
1012 .D1 \&.Fl o \&Ns \&Ar file1
1014 .D1 \&.Ar arg1 , arg2 .
1016 Formats an AT&T version.
1017 Accepts one optional argument:
1019 .Bl -tag -width "v[1-7] | 32vX" -offset indent -compact
1028 Note that these arguments do not begin with a hyphen.
1047 Does not have any tail arguments.
1049 Begin a display block.
1050 Its syntax is as follows:
1051 .Bd -ragged -offset indent
1054 .Op Fl offset Ar width
1058 Display blocks are used to select a different indentation and
1059 justification than the one used by the surrounding text.
1060 They may contain both macro lines and free-form text lines.
1061 By default, a display block is preceded by a vertical space.
1065 must be one of the following:
1066 .Bl -tag -width 13n -offset indent
1068 Centre-justify each line.
1069 Using this display type is not recommended; many
1071 implementations render it poorly.
1073 Left- and right-justify the block.
1075 Do not justify the block at all.
1076 Preserve white space as it appears in the input.
1078 Only left-justify the block.
1086 must be provided first.
1087 Additional arguments may follow:
1088 .Bl -tag -width 13n -offset indent
1089 .It Fl offset Ar width
1090 Indent the display by the
1092 which may be one of the following:
1095 One of the pre-defined strings
1097 the width of standard indentation;
1102 which has no effect;
1104 which justifies to the right margin; or
1106 which aligns around an imagined centre axis.
1108 A macro invocation, which selects a predefined width
1109 associated with that macro.
1110 The most popular is the imaginary macro
1115 A width using the syntax described in
1116 .Sx Scaling Widths .
1118 An arbitrary string, which indents by the length of this string.
1121 When the argument is missing,
1125 Do not assert vertical space before the display.
1129 .Bd -literal -offset indent
1130 \&.Bd \-literal \-offset indent \-compact
1140 Change the font mode for a scoped block of text.
1141 Its syntax is as follows:
1142 .Bd -ragged -offset indent
1145 .Fl emphasis | literal | symbolic |
1146 .Cm \&Em | \&Li | \&Sy
1154 argument are equivalent, as are
1162 Without an argument, this macro does nothing.
1163 The font mode continues until broken by a new font mode in a nested
1175 Keep the output generated from each macro input line together
1176 on one single output line.
1177 Line breaks in free-form text lines are unaffected.
1178 The syntax is as follows:
1180 .D1 Pf \. Sx \&Bk Fl words
1184 argument is required; additional arguments are ignored.
1186 The following example will not break within each
1189 .Bd -literal -offset indent
1192 \&.Op Fl o Ar output
1196 Be careful in using over-long lines within a keep block!
1197 Doing so will clobber the right margin.
1200 Lists consist of items started by the
1202 macro, containing a head or a body or both.
1203 The list syntax is as follows:
1204 .Bd -ragged -offset indent
1208 .Op Fl offset Ar val
1215 is mandatory and must be specified first.
1222 or use the length of the given string.
1225 is a global indentation for the whole list, affecting both item heads
1227 For those list types supporting it, the
1229 argument requests an additional indentation of item bodies,
1234 argument is specified, list entries are separated by vertical space.
1236 A list must specify one of the following list types:
1237 .Bl -tag -width 12n -offset indent
1239 No item heads can be specified, but a bullet will be printed at the head
1241 Item bodies start on the same output line as the bullet
1242 and are indented according to the
1249 argument has no effect; instead, each argument specifies the width
1250 of one column, using either the
1252 syntax or the string length of the argument.
1253 If the first line of the body of a
1259 contexts spanning one input line each are implied until an
1261 macro line is encountered, at which point items start being interpreted as
1268 except that dashes are used in place of bullets.
1272 except that item heads are not parsed for macro invocations.
1273 .\" but with additional formatting to the head.
1278 except that cardinal numbers are used in place of bullets,
1283 except that the first lines of item bodies are not indented, but follow
1284 the item heads like in
1291 Item bodies follow items heads on the same line, using normal inter-word
1293 Bodies are not indented, and the
1295 argument is ignored.
1297 No item heads can be specified, and none are printed.
1298 Bodies are not indented, and the
1300 argument is ignored.
1302 Item bodies start on the line following item heads and are not indented.
1305 argument is ignored.
1307 Item bodies are indented according to the
1310 When an item head fits inside the indentation, the item body follows
1311 this head on the same output line.
1312 Otherwise, the body starts on the output line following the head.
1320 Begin a block enclosed by square brackets.
1321 Does not have any head arguments.
1324 .Bd -literal -offset indent -compact
1332 Encloses its arguments in square brackets.
1335 .D1 \&.Bq 1 , \&Dv BUFSIZ
1338 this macro is sometimes abused to emulate optional arguments for
1339 commands; the correct macros to use for this purpose are
1351 Does not have any tail arguments.
1353 Begin a block enclosed by curly braces.
1354 Does not have any head arguments.
1357 .Bd -literal -offset indent -compact
1365 Encloses its arguments in curly braces.
1368 .D1 \&.Brq 1 , ... , \&Va n
1373 Format the BSD/OS version provided as an argument, or a default value if
1374 no argument is provided.
1391 .Dq is currently in beta test .
1393 Format the BSD version provided as an argument, or a default value if no
1394 argument is provided.
1410 Kernel configuration declaration.
1411 This denotes strings accepted by
1415 .D1 \&.Cd device le0 at scode?
1418 this macro is commonly abused by using quoted literals to retain
1419 whitespace and align consecutive
1422 This practise is discouraged.
1425 Useful when specifying configuration options or keys.
1428 .D1 \&.Cm ControlPath
1429 .D1 \&.Cm ControlMaster
1434 One-line indented display.
1435 This is formatted by the default rules and is useful for simple indented
1437 It is followed by a newline.
1440 .D1 \&.D1 \&Fl abcdefgh
1447 Switch debugging mode.
1448 Its syntax is as follows:
1450 .D1 Pf \. Sx \&Db Cm on | off
1452 This macro is ignored by
1458 Does not have any tail arguments.
1461 This is the mandatory first macro of any
1464 Its syntax is as follows:
1466 .D1 Pf \. Sx \&Dd Op Ar date
1472 which signifies the current manual revision date dictated by
1474 or instead a valid canonical date as specified by
1476 If a date does not conform or is empty, the current date is used.
1479 .D1 \&.Dd $\&Mdocdate$
1480 .D1 \&.Dd $\&Mdocdate: July 21 2007$
1481 .D1 \&.Dd July 21, 2007
1488 One-line intended display.
1489 This is formatted as literal text and is useful for commands and
1491 It is followed by a newline.
1494 .D1 \&.Dl % mandoc mdoc.7 \e(ba less
1501 Begin a block enclosed by double quotes.
1502 Does not have any head arguments.
1505 .Bd -literal -offset indent -compact
1507 April is the cruellest month
1515 Encloses its arguments in
1520 .Bd -literal -offset indent -compact
1521 \&.Dq April is the cruellest month
1532 This is the mandatory second macro of any
1535 Its syntax is as follows:
1536 .Bd -ragged -offset indent
1542 .Op Ar volume | arch
1547 Its arguments are as follows:
1548 .Bl -tag -width Ds -offset Ds
1550 The document's title (name), defaulting to
1553 It should be capitalised.
1564 .Pq Perl libraries ,
1574 .Pq system utilities ,
1576 .Pq kernel functions ,
1578 .Pq X Window System ,
1580 .Pq X Window System ,
1590 It should correspond to the manual's filename suffix and defaults to
1594 This overrides the volume inferred from
1596 This field is optional, and if specified, must be one of
1598 .Pq users' supplementary documents ,
1600 .Pq programmers' supplementary documents ,
1602 .Pq administrators' supplementary documents ,
1604 .Pq system managers' manuals ,
1606 .Pq users' reference manuals ,
1608 .Pq programmers' reference manuals ,
1610 .Pq kernel manuals ,
1621 .Pq contributed manuals .
1623 This specifies a specific relevant architecture.
1626 is not provided, it may be used in its place, else it may be used
1628 It, too, is optional.
1663 .D1 \&.Dt FOO 9 i386
1670 Defined variables such as preprocessor constants.
1674 .D1 \&.Dv STDOUT_FILENO
1679 Format the DragonFly BSD version provided as an argument, or a default
1680 value if no argument is provided.
1696 Close a scope started by
1698 Its syntax is as follows:
1700 .D1 Pf \. Sx \&Ec Op Ar TERM
1704 argument is used as the enclosure tail, for example, specifying \e(rq
1708 End a display context started by
1711 End a font mode context started by
1714 End a keep context started by
1717 End a list context started by
1725 Denotes text that should be emphasised.
1726 Note that this is a presentation term and should not be used for
1727 stylistically decorating technical terms.
1739 This macro is obsolete and not implemented in
1742 An arbitrary enclosure.
1743 Its syntax is as follows:
1745 .D1 Pf \. Sx \&Eo Op Ar TERM
1749 argument is used as the enclosure head, for example, specifying \e(lq
1753 Display error constants.
1762 This macro is obsolete and not implemented.
1764 Environmental variables such as those specified in
1771 Insert a standard sentence regarding exit values.
1772 Its syntax is as follows:
1774 .D1 Pf \. Sx \&Ex Fl std Op Ar utility
1778 is not specified, the document's name set by
1786 Its syntax is as follows:
1787 .Bd -ragged -offset indent
1793 This may be invoked for names with or without the corresponding type.
1794 It is also used to specify the field name of a structure.
1797 macro is used in the
1801 section when documenting multi-line function prototypes.
1802 If invoked with multiple arguments, the arguments are separated by a
1804 Furthermore, if the following macro is another
1806 the last argument will also have a trailing comma.
1809 .D1 \&.Fa \(dqconst char *p\(dq
1810 .D1 \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq
1816 End a function context started by
1819 Historically used to document include files.
1820 This usage has been deprecated in favour of
1822 Do not use this macro.
1825 .Sx MANUAL STRUCTURE
1830 Used when listing arguments to command-line utilities.
1831 Prints a fixed-width hyphen
1833 directly followed by each argument.
1834 If no arguments are provided, a hyphen is printed followed by a space.
1835 If the argument is a macro, a hyphen is prefixed to the subsequent macro
1842 .D1 \&.Op \&Fl o \&Ns \&Ar file
1848 Its syntax is as follows:
1849 .Bd -ragged -offset indent
1853 .Op Oo Cm argtype Oc Cm argname
1856 Function arguments are surrounded in parenthesis and
1857 are delimited by commas.
1858 If no arguments are specified, blank parenthesis are output.
1861 .D1 \&.Fn "int funcname" "int arg0" "int arg1"
1862 .D1 \&.Fn funcname "int arg0"
1863 .D1 \&.Fn funcname arg0
1864 .Bd -literal -offset indent -compact
1870 .Sx MANUAL STRUCTURE
1874 Begin a function block.
1875 This is a multi-line version of
1877 Its syntax is as follows:
1879 .D1 Pf \. Sx \&Fo Cm funcname
1881 Invocations usually occur in the following context:
1882 .Bd -ragged -offset indent
1883 .Pf \. Sx \&Ft Cm functype
1885 .Pf \. Sx \&Fo Cm funcname
1887 .Pf \. Sx \&Fa Oo Cm argtype Oc Cm argname
1899 .Sx MANUAL STRUCTURE ,
1906 Its syntax is as follows:
1908 .D1 Pf \. Sx \&Ft Cm functype
1912 .Bd -literal -offset indent -compact
1918 .Sx MANUAL STRUCTURE ,
1925 version provided as an argument, or a default value
1926 if no argument is provided.
1942 This macro is obsolete and not implemented.
1944 Designate an internal or interactive command.
1947 but used for instructions rather than values.
1957 is preferred for displaying code; the
1959 macro is used when referring to specific instructions.
1966 section (only if invoked as the line macro), the first argument is
1969 the arguments is enclosed in angle brackets.
1975 .Sx MANUAL STRUCTURE .
1978 The syntax of this macro depends on the list type.
1987 have the following syntax:
1989 .D1 Pf \. Sx \&It Cm args
1998 have the following syntax:
2002 with subsequent lines interpreted within the scope of the
2004 until either a closing
2011 list has the following syntax:
2013 .D1 Pf \. Sx \&It Op Cm args
2015 Subsequent lines are interpreted as with
2018 The line arguments correspond to the list's left-hand side; body
2019 arguments correspond to the list's contents.
2023 list is the most complicated.
2024 Its syntax is as follows:
2026 .D1 Pf \. Sx \&It Op Cm args
2030 are phrases, a mix of macros and text corresponding to a line column,
2031 delimited by tabs or the special
2034 Lines subsequent the
2036 are interpreted within the scope of the last phrase.
2037 Calling the pseudo-macro
2039 will open a new phrase scope (this must occur on a macro line to be
2040 interpreted as a macro).
2041 Note that the tab phrase delimiter may only be used within the
2044 Subsequent this, only the
2046 pseudo-macro may be used to delimit phrases.
2047 Furthermore, note that quoted sections propagate over tab-delimited
2052 .D1 .It \(dqcol1 ; <TAB> col2 ;\(dq \&;
2054 will preserve the semicolon whitespace except for the last.
2060 The syntax is as follows:
2062 .D1 Pf \. Sx \&Lb Cm library
2066 parameter may be a system library, such as
2070 in which case a small library description is printed next to the linker
2071 invocation; or a custom library, in which case the library name is
2073 This is most commonly used in the
2075 section as described in
2076 .Sx MANUAL STRUCTURE .
2082 Denotes text that should be in a literal font mode.
2083 Note that this is a presentation term and should not be used for
2084 stylistically decorating technical terms.
2093 Its syntax is as follows:
2095 .D1 Pf \. Sx \&Lk Cm uri Op Cm name
2098 .D1 \&.Lk http://bsd.lv \*qThe BSD.lv Project\*q
2099 .D1 \&.Lk http://bsd.lv
2107 Display a mathematical symbol.
2108 Its syntax is as follows:
2110 .D1 Pf \. Sx \&Ms Cm symbol
2119 Its syntax is as follows:
2121 .D1 Pf \. Sx \&Mt Cm address
2124 .D1 \&.Mt discuss@manpages.bsd.lv
2126 A one line description of the manual's content.
2127 This may only be invoked in the
2129 section subsequent the
2134 .D1 \&.Sx \&Nd mdoc language reference
2135 .D1 \&.Sx \&Nd format and display UNIX manuals
2139 macro technically accepts child macros and terminates with a subsequent
2142 Do not assume this behaviour: some
2144 database generators are not smart enough to parse more than the line
2145 arguments and will display macros verbatim.
2150 The name of the manual page, or \(em in particular in section 1, 6,
2151 and 8 pages \(em of an additional command or feature documented in
2153 When first invoked, the
2155 macro expects a single argument, the name of the manual page.
2156 Usually, the first invocation happens in the
2158 section of the page.
2159 The specified name will be remembered and used whenever the macro is
2160 called again without arguments later in the page.
2164 .Sx Block full-implicit
2165 semantics when invoked as the first macro on an input line in the
2167 section; otherwise, it uses ordinary
2172 .Bd -literal -offset indent
2181 of section 2, 3 and 9 manual pages, use the
2185 to mark up the name of the manual page.
2189 macro used to terminate prior macro contexts.
2192 .D1 \&.Sx \&Fl ab \&No cd \&Fl ef
2195 Following invocation, text is interpreted as free-form text until a
2196 macro is encountered.
2199 .D1 \&.Fl o \&Ns \&Ar output
2208 version provided as an argument, or a default value if
2209 no argument is provided.
2229 Multi-line version of
2233 .Bd -literal -offset indent -compact
2235 \&.Op Fl flag Ns Ar value
2239 Command-line option.
2240 Used when listing options to command-line utilities.
2241 Prints the argument(s) in brackets.
2244 .D1 \&.Op \&Fl a \&Ar b
2245 .D1 \&.Op \&Ar a | b
2250 Document operating system version.
2251 This is the mandatory third macro of
2255 Its syntax is as follows:
2257 .D1 Pf \. Sx \&Os Op Cm system Op Cm version
2261 parameter specifies the relevant operating system or environment.
2262 Left unspecified, it defaults to the local operating system version.
2263 This is the suggested form.
2267 .D1 \&.Os KTH/CSC/TCS
2278 this macro has been deprecated.
2282 version provided as an argument, or a default value
2283 if no argument is provided.
2302 .D1 \&.Pa /usr/bin/mandoc
2303 .D1 \&.Pa /usr/share/man/man7/mdoc.7
2308 Close parenthesised context opened by
2313 between its arguments.
2314 Its syntax is as follows:
2316 .D1 Pf \. \&Pf Cm prefix suffix
2320 argument may be a macro.
2323 .D1 \&.Pf \e. \&Sx \&Pf \&Cm prefix suffix
2325 Multi-line version of
2329 This will assert vertical space between prior and subsequent macros
2332 Parenthesised enclosure.
2337 Close quoted context opened by
2340 Format a single-quoted literal.
2346 Multi-line version of
2349 Encloses its arguments in
2364 Does not have any tail arguments.
2366 Begin a bibliographic
2369 Does not have any head arguments.
2370 The block macro may only contain
2386 child macros (at least one must be specified).
2389 .Bd -literal -offset indent -compact
2391 \&.%A J. E. Hopcroft
2393 \&.%B Introduction to Automata Theory, Languages, and Computation
2394 \&.%I Addison-Wesley
2395 \&.%C Reading, Massachusettes
2402 block is used within a SEE ALSO section, a vertical space is asserted
2403 before the rendered output, else the block continues on the current
2406 Inserts text regarding a function call's return value.
2407 This macro must consist of the
2409 argument followed by an optional
2413 is not provided, the document's name as stipulated by the first
2420 Close single-quoted context opened by
2423 Begin a new section.
2424 For a list of conventional manual sections, see
2425 .Sx MANUAL STRUCTURE .
2426 These sections should be used unless it's absolutely necessary that
2427 custom sections be used.
2429 Section names should be unique so that they may be keyed by
2438 Switches the spacing mode for output generated from macros.
2439 Its syntax is as follows:
2441 .D1 Pf \. Sx \&Sm Cm on | off
2443 By default, spacing is
2447 no white space is inserted between macro arguments and between the
2448 output generated from adjacent macros, but free-form text lines
2449 still get normal spacing between words and sentences.
2451 Multi-line version of
2454 Encloses its arguments in
2464 Begin a new sub-section.
2467 there's no convention for sub-sections.
2468 Conventional sections, as described in
2469 .Sx MANUAL STRUCTURE ,
2470 rarely have sub-sections.
2472 Sub-section names should be unique so that they may be keyed by
2481 Replace an abbreviation for a standard with the full form.
2482 The following standards are recognised:
2484 .Bl -tag -width "-p1003.1g-2000X" -compact
2578 Reference a section or sub-section.
2579 The referenced section or sub-section name must be identical to the
2580 enclosed argument, including whitespace.
2583 .D1 \&.Sx MANUAL STRUCTURE
2585 Format enclosed arguments in symbolic
2587 Note that this is a presentation term and should not be used for
2588 stylistically decorating technical terms.
2602 .Dq currently under development .
2604 Format the UNIX name.
2605 Accepts no argument.
2624 .D1 \&.Va const char *bar ;
2627 This is also used for indicating global variables in the
2629 section, in which case a variable name is also specified.
2630 Note that it accepts
2631 .Sx Block partial-implicit
2632 syntax when invoked as the first macro in the
2634 section, else it accepts ordinary
2638 Note that this should not be confused with
2640 which is used for function return types.
2643 .D1 \&.Vt unsigned char
2644 .D1 \&.Vt extern const char * const sys_signame[] \&;
2647 .Sx MANUAL STRUCTURE
2651 Close a scope opened by
2654 Open an extension scope.
2655 This macro originally existed to extend the 9-argument limit of troff;
2656 since this limit has been lifted, the macro has been deprecated.
2658 Link to another manual
2659 .Pq Qq cross-reference .
2660 Its syntax is as follows:
2662 .D1 Pf \. Sx \&Xr Cm name section
2668 are the name and section of the linked manual.
2671 is followed by non-punctuation, an
2673 is inserted into the token stream.
2674 This behaviour is for compatibility with
2679 .D1 \&.Xr mandoc 1 \&;
2680 .D1 \&.Xr mandoc 1 \&Ns s behaviour
2683 This macro should not be used; it is implemented for compatibility with
2688 in the event of natural paragraph breaks.
2690 Emits vertical space.
2691 This macro should not be used; it is implemented for compatibility with
2693 Its syntax is as follows:
2695 .D1 Pf \. Sx \&sp Op Cm height
2699 argument must be formatted as described in
2700 .Sx Scaling Widths .
2703 asserts a single vertical space.
2705 This section documents compatibility between mandoc and other other
2706 troff implementations, at this time limited to GNU troff
2710 refers to groff versions before the
2713 .Pq somewhere between 1.15 and 1.19 .
2715 Heirloom troff, the other significant troff implementation accepting
2716 \-mdoc, is similar to historic groff.
2718 The following problematic behaviour is found in groff:
2719 .ds hist (Historic groff only.)
2724 with unknown arguments produces no output at all.
2726 Newer groff and mandoc print
2731 does not recognize trailing punctuation characters when they immediately
2732 precede tabulator characters, but treats them as normal text and
2733 outputs a space before them.
2735 .Sx \&Bd Fl ragged compact
2736 does not start a new line.
2740 without an argument prints
2742 In mandoc, it resolves to the current date.
2745 does not print a dash for an empty argument.
2749 does not start a new line unless invoked as the line macro in the
2757 children causes inconsistent spacing between arguments.
2758 In mandoc, a single space is always inserted between arguments.
2763 causes inconsistent vertical spacing, depending on whether a prior
2770 for the normalised behaviour in mandoc.
2773 ignores additional arguments and is not treated specially in the
2778 sometimes requires a
2782 In new groff and mandoc, any list may be nested by default and
2784 lists will restart the sequence only for the sub-list.
2787 followed by a reserved character is incorrectly used in some manuals
2788 instead of properly quoting that character, which sometimes works with
2792 only accepts a single link-name argument; the remainder is misformatted.
2795 does not format its arguments when used in the FILES section under
2799 can only be called by other macros, but not at the beginning of a line.
2804 Historic groff has many un-callable macros.
2805 Most of these (excluding some block-level macros) are callable
2806 in new groff and mandoc.
2809 (vertical bar) is not fully supported as a delimiter.
2816 .Pq font family face
2818 escapes behave irregularly when specified within line-macro scopes.
2820 Negative scaling units return to prior lines.
2821 Instead, mandoc truncates them to zero.
2824 The following features are unimplemented in mandoc:
2832 .Fl offset Ar center
2834 .Fl offset Ar right .
2835 Groff does not implement centered and flush-right rendering either,
2836 but produces large indentations.
2840 .Pq horizontal position ,
2842 .Pq vertical position ,
2846 .Pq text filling colour ,
2848 .Pq zero-length character ,
2854 escape sequences are all discarded in mandoc.
2858 scaling unit is accepted by mandoc, but rendered as the default unit.
2860 In quoted literals, groff allows pairwise double-quotes to produce a
2861 standalone double-quote in formatted output.
2862 This is not supported by mandoc.
2870 language first appeared as a troff macro package in
2872 It was later significantly updated by Werner Lemberg and Ruslan Ermilov
2874 The standalone implementation that is part of the
2876 utility written by Kristaps Dzonsons appeared in
2881 reference was written by
2882 .An Kristaps Dzonsons Aq kristaps@bsd.lv .