1 .\" $Id: mdoc.7,v 1.157 2010/08/29 11:28:09 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 29 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
335 \&.\e\*q For sections 2, 3, & 9 only.
336 \&.\e\*q Not used in OpenBSD.
344 utility processes files ...
345 \&.\e\*q .Sh IMPLEMENTATION NOTES
346 \&.\e\*q .Sh RETURN VALUES
347 \&.\e\*q For sections 2, 3, & 9 only.
348 \&.\e\*q .Sh ENVIRONMENT
349 \&.\e\*q For sections 1, 6, 7, & 8 only.
351 \&.\e\*q .Sh EXIT STATUS
352 \&.\e\*q For sections 1 & 8 only.
353 \&.\e\*q .Sh EXAMPLES
354 \&.\e\*q .Sh DIAGNOSTICS
355 \&.\e\*q For sections 1, 4, 6, 7, & 8 only.
357 \&.\e\*q For sections 2, 3, & 9 only.
358 \&.\e\*q .Sh SEE ALSO
359 \&.\e\*q .Xr foobar 1
360 \&.\e\*q .Sh STANDARDS
365 \&.\e\*q .Sh SECURITY CONSIDERATIONS
366 \&.\e\*q Not used in OpenBSD.
371 document are conventionally ordered as they appear above.
372 Sections should be composed as follows:
373 .Bl -ohang -offset Ds
375 The name(s) and a one line description of the documented material.
376 The syntax for this as follows:
377 .Bd -literal -offset indent
381 \&.Nd a one line description
386 macro(s) must precede the
395 The name of the library containing the documented material, which is
396 assumed to be a function in a section 2, 3, or 9 manual.
397 The syntax for this is as follows:
398 .Bd -literal -offset indent
405 Documents the utility invocation syntax, function call syntax, or device
408 For the first, utilities (sections 1, 6, and 8), this is
409 generally structured as follows:
410 .Bd -literal -offset indent
421 For the second, function calls (sections 2, 3, 9):
422 .Bd -literal -offset indent
424 \&.Vt extern const char *global;
426 \&.Fn foo "const char *src"
428 \&.Fn bar "const char *src"
431 And for the third, configurations (section 4):
432 .Bd -literal -offset indent
433 \&.Cd \*qit* at isa? port 0x2e\*q
434 \&.Cd \*qit* at isa? port 0x4e\*q
437 Manuals not in these sections generally don't need a
440 Some macros are displayed differently in the
442 section, particularly
452 All of these macros are output on their own line.
453 If two such dissimilar macros are pairwise invoked (except for
459 they are separated by a vertical space, unless in the case of
464 which are always separated by vertical space.
466 When text and macros following an
468 macro starting an input line span multiple output lines,
469 all output lines but the first will be indented to align
470 with the text immediately following the
472 macro, up to the next
477 macro or the end of an enclosing block, whichever comes first.
479 This expands upon the brief, one line description in
481 It usually contains a breakdown of the options (if documenting a
483 .Bd -literal -offset indent
484 The arguments are as follows:
485 \&.Bl \-tag \-width Ds
487 Print verbose information.
491 Manuals not documenting a command won't include the above fragment.
492 .It Em IMPLEMENTATION NOTES
493 Implementation-specific notes should be kept here.
494 This is useful when implementing standard functions that may have side
495 effects or notable algorithmic implications.
497 This section documents the
498 return values of functions in sections 2, 3, and 9.
503 Lists the environment variables used by the utility,
504 and explains the syntax and semantics of their values.
507 manual provides examples of typical content and formatting.
512 Documents files used.
513 It's helpful to document both the file name and a short description of how
514 the file is used (created, modified, etc.).
519 This section documents the
520 command exit status for section 1, 6, and 8 utilities.
521 Historically, this information was described in
523 a practise that is now discouraged.
529 This often contains snippets of well-formed, well-tested invocations.
530 Make sure that examples work properly!
532 Documents error conditions.
533 This is most useful in section 4 manuals.
534 Historically, this section was used in place of
536 for manuals in sections 1, 6, and 8; however, this practise is
543 Documents error handling in sections 2, 3, and 9.
548 References other manuals with related topics.
549 This section should exist for most manuals.
550 Cross-references should conventionally be ordered first by section, then
556 References any standards implemented or used.
557 If not adhering to any standards, the
559 section should be used instead.
564 A brief history of the subject, including where support first appeared.
566 Credits to the person or persons who wrote the code and/or documentation.
567 Authors should generally be noted by both name and email address.
572 Common misuses and misunderstandings should be explained
575 Known bugs, limitations, and work-arounds should be described
577 .It Em SECURITY CONSIDERATIONS
578 Documents any security precautions that operators should consider.
581 Macros are one to three three characters in length and begin with a
584 at the beginning of the line.
585 An arbitrary amount of whitespace may sit between the control character
587 Thus, the following are equivalent:
588 .Bd -literal -offset indent
593 The syntax of a macro depends on its classification.
596 refers to macro arguments, which may be followed by zero or more
600 opens the scope of a macro; and if specified,
606 column indicates that the macro may be called subsequent to the initial
608 If a macro is not callable, then its invocation after the initial line
609 macro is interpreted as opaque text, such that
616 column indicates whether the macro may be followed by further
617 (ostensibly callable) macros.
618 If a macro is not parsed, subsequent macro invocations on the line
619 will be interpreted as opaque text.
623 column, if applicable, describes closure rules.
624 .Ss Block full-explicit
625 Multi-line scope closed by an explicit closing macro.
626 All macros contains bodies; only
629 .Bd -literal -offset indent
630 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
635 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsedX" "closed by XXX"
636 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
637 .It Sx \&Bd Ta \&No Ta \&No Ta closed by Sx \&Ed
638 .It Sx \&Bf Ta \&No Ta \&No Ta closed by Sx \&Ef
639 .It Sx \&Bk Ta \&No Ta \&No Ta closed by Sx \&Ek
640 .It Sx \&Bl Ta \&No Ta \&No Ta closed by Sx \&El
641 .It Sx \&Ed Ta \&No Ta \&No Ta opened by Sx \&Bd
642 .It Sx \&Ef Ta \&No Ta \&No Ta opened by Sx \&Bf
643 .It Sx \&Ek Ta \&No Ta \&No Ta opened by Sx \&Bk
644 .It Sx \&El Ta \&No Ta \&No Ta opened by Sx \&Bl
646 .Ss Block full-implicit
647 Multi-line scope closed by end-of-file or implicitly by another macro.
648 All macros have bodies; some
656 don't have heads; only one
663 .Bd -literal -offset indent
664 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
668 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsedX" "closed by XXXXXXXXXXX"
669 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
670 .It Sx \&It Ta \&No Ta Yes Ta closed by Sx \&It , Sx \&El
671 .It Sx \&Nd Ta \&No Ta \&No Ta closed by Sx \&Sh
672 .It Sx \&Nm Ta \&No Ta Yes Ta closed by Sx \&Nm , Sx \&Sh , Sx \&Ss
673 .It Sx \&Sh Ta \&No Ta \&No Ta closed by Sx \&Sh
674 .It Sx \&Ss Ta \&No Ta \&No Ta closed by Sx \&Sh , Sx \&Ss
680 .Sx Block full-implicit
681 macro only when invoked as the first macro
684 section line, else it is
686 .Ss Block partial-explicit
687 Like block full-explicit, but also with single-line scope.
688 Each has at least a body and, in limited circumstances, a head
695 .Bd -literal -offset indent
696 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
698 \&.Yc \(lBtail...\(rB
700 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \
701 \(lBbody...\(rB \&Yc \(lBtail...\(rB
704 .Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXX" -compact -offset indent
705 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
706 .It Sx \&Ac Ta Yes Ta Yes Ta opened by Sx \&Ao
707 .It Sx \&Ao Ta Yes Ta Yes Ta closed by Sx \&Ac
708 .It Sx \&Bc Ta Yes Ta Yes Ta closed by Sx \&Bo
709 .It Sx \&Bo Ta Yes Ta Yes Ta opened by Sx \&Bc
710 .It Sx \&Brc Ta Yes Ta Yes Ta opened by Sx \&Bro
711 .It Sx \&Bro Ta Yes Ta Yes Ta closed by Sx \&Brc
712 .It Sx \&Dc Ta Yes Ta Yes Ta opened by Sx \&Do
713 .It Sx \&Do Ta Yes Ta Yes Ta closed by Sx \&Dc
714 .It Sx \&Ec Ta Yes Ta Yes Ta opened by Sx \&Eo
715 .It Sx \&Eo Ta Yes Ta Yes Ta closed by Sx \&Ec
716 .It Sx \&Fc Ta Yes Ta Yes Ta opened by Sx \&Fo
717 .It Sx \&Fo Ta \&No Ta \&No Ta closed by Sx \&Fc
718 .It Sx \&Oc Ta Yes Ta Yes Ta closed by Sx \&Oo
719 .It Sx \&Oo Ta Yes Ta Yes Ta opened by Sx \&Oc
720 .It Sx \&Pc Ta Yes Ta Yes Ta closed by Sx \&Po
721 .It Sx \&Po Ta Yes Ta Yes Ta opened by Sx \&Pc
722 .It Sx \&Qc Ta Yes Ta Yes Ta opened by Sx \&Oo
723 .It Sx \&Qo Ta Yes Ta Yes Ta closed by Sx \&Oc
724 .It Sx \&Re Ta \&No Ta \&No Ta opened by Sx \&Rs
725 .It Sx \&Rs Ta \&No Ta \&No Ta closed by Sx \&Re
726 .It Sx \&Sc Ta Yes Ta Yes Ta opened by Sx \&So
727 .It Sx \&So Ta Yes Ta Yes Ta closed by Sx \&Sc
728 .It Sx \&Xc Ta Yes Ta Yes Ta opened by Sx \&Xo
729 .It Sx \&Xo Ta Yes Ta Yes Ta closed by Sx \&Xc
731 .Ss Block partial-implicit
732 Like block full-implicit, but with single-line scope closed by
733 .Sx Reserved Characters
735 .Bd -literal -offset indent
736 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB
739 .Bl -column "MacroX" "CallableX" "ParsedX" -compact -offset indent
740 .It Em Macro Ta Em Callable Ta Em Parsed
741 .It Sx \&Aq Ta Yes Ta Yes
742 .It Sx \&Bq Ta Yes Ta Yes
743 .It Sx \&Brq Ta Yes Ta Yes
744 .It Sx \&D1 Ta \&No Ta \&Yes
745 .It Sx \&Dl Ta \&No Ta Yes
746 .It Sx \&Dq Ta Yes Ta Yes
747 .It Sx \&Op Ta Yes Ta Yes
748 .It Sx \&Pq Ta Yes Ta Yes
749 .It Sx \&Ql Ta Yes Ta Yes
750 .It Sx \&Qq Ta Yes Ta Yes
751 .It Sx \&Sq Ta Yes Ta Yes
752 .It Sx \&Vt Ta Yes Ta Yes
758 .Sx Block partial-implicit
759 only when invoked as the first macro
762 section line, else it is
766 .Sx Reserved Characters ,
767 end of line, fixed argument lengths, and/or subsequent macros.
768 In-line macros have only text children.
769 If a number (or inequality) of arguments is
771 then the macro accepts an arbitrary number of arguments.
772 .Bd -literal -offset indent
773 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lBres...\(rB
775 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc...
777 \&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
780 .Bl -column "MacroX" "CallableX" "ParsedX" "Arguments" -compact -offset indent
781 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Arguments
782 .It Sx \&%A Ta \&No Ta \&No Ta >0
783 .It Sx \&%B Ta \&No Ta \&No Ta >0
784 .It Sx \&%C Ta \&No Ta \&No Ta >0
785 .It Sx \&%D Ta \&No Ta \&No Ta >0
786 .It Sx \&%I Ta \&No Ta \&No Ta >0
787 .It Sx \&%J Ta \&No Ta \&No Ta >0
788 .It Sx \&%N Ta \&No Ta \&No Ta >0
789 .It Sx \&%O Ta \&No Ta \&No Ta >0
790 .It Sx \&%P Ta \&No Ta \&No Ta >0
791 .It Sx \&%Q Ta \&No Ta \&No Ta >0
792 .It Sx \&%R Ta \&No Ta \&No Ta >0
793 .It Sx \&%T Ta \&No Ta \&No Ta >0
794 .It Sx \&%U Ta \&No Ta \&No Ta >0
795 .It Sx \&%V Ta \&No Ta \&No Ta >0
796 .It Sx \&Ad Ta Yes Ta Yes Ta n
797 .It Sx \&An Ta Yes Ta Yes Ta n
798 .It Sx \&Ap Ta Yes Ta Yes Ta 0
799 .It Sx \&Ar Ta Yes Ta Yes Ta n
800 .It Sx \&At Ta Yes Ta Yes Ta 1
801 .It Sx \&Bsx Ta Yes Ta Yes Ta n
802 .It Sx \&Bt Ta \&No Ta \&No Ta 0
803 .It Sx \&Bx Ta Yes Ta Yes Ta n
804 .It Sx \&Cd Ta Yes Ta Yes Ta >0
805 .It Sx \&Cm Ta Yes Ta Yes Ta n
806 .It Sx \&Db Ta \&No Ta \&No Ta 1
807 .It Sx \&Dd Ta \&No Ta \&No Ta n
808 .It Sx \&Dt Ta \&No Ta \&No Ta n
809 .It Sx \&Dv Ta Yes Ta Yes Ta n
810 .It Sx \&Dx Ta Yes Ta Yes Ta n
811 .It Sx \&Em Ta Yes Ta Yes Ta >0
812 .It Sx \&En Ta \&No Ta \&No Ta 0
813 .It Sx \&Er Ta Yes Ta Yes Ta >0
814 .It Sx \&Es Ta \&No Ta \&No Ta 0
815 .It Sx \&Ev Ta Yes Ta Yes Ta n
816 .It Sx \&Ex Ta \&No Ta \&No Ta n
817 .It Sx \&Fa Ta Yes Ta Yes Ta n
818 .It Sx \&Fd Ta \&No Ta \&No Ta >0
819 .It Sx \&Fl Ta Yes Ta Yes Ta n
820 .It Sx \&Fn Ta Yes Ta Yes Ta >0
821 .It Sx \&Fr Ta \&No Ta \&No Ta n
822 .It Sx \&Ft Ta Yes Ta Yes Ta n
823 .It Sx \&Fx Ta Yes Ta Yes Ta n
824 .It Sx \&Hf Ta \&No Ta \&No Ta n
825 .It Sx \&Ic Ta Yes Ta Yes Ta >0
826 .It Sx \&In Ta \&No Ta \&No Ta n
827 .It Sx \&Lb Ta \&No Ta \&No Ta 1
828 .It Sx \&Li Ta Yes Ta Yes Ta n
829 .It Sx \&Lk Ta Yes Ta Yes Ta n
830 .It Sx \&Lp Ta \&No Ta \&No Ta 0
831 .It Sx \&Ms Ta Yes Ta Yes Ta >0
832 .It Sx \&Mt Ta Yes Ta Yes Ta >0
833 .It Sx \&Nm Ta Yes Ta Yes Ta n
834 .It Sx \&No Ta Yes Ta Yes Ta 0
835 .It Sx \&Ns Ta Yes Ta Yes Ta 0
836 .It Sx \&Nx Ta Yes Ta Yes Ta n
837 .It Sx \&Os Ta \&No Ta \&No Ta n
838 .It Sx \&Ot Ta \&No Ta \&No Ta n
839 .It Sx \&Ox Ta Yes Ta Yes Ta n
840 .It Sx \&Pa Ta Yes Ta Yes Ta n
841 .It Sx \&Pf Ta Yes Ta Yes Ta 1
842 .It Sx \&Pp Ta \&No Ta \&No Ta 0
843 .It Sx \&Rv Ta \&No Ta \&No Ta n
844 .It Sx \&Sm Ta \&No Ta \&No Ta 1
845 .It Sx \&St Ta \&No Ta Yes Ta 1
846 .It Sx \&Sx Ta Yes Ta Yes Ta >0
847 .It Sx \&Sy Ta Yes Ta Yes Ta >0
848 .It Sx \&Tn Ta Yes Ta Yes Ta >0
849 .It Sx \&Ud Ta \&No Ta \&No Ta 0
850 .It Sx \&Ux Ta Yes Ta Yes Ta n
851 .It Sx \&Va Ta Yes Ta Yes Ta n
852 .It Sx \&Vt Ta Yes Ta Yes Ta >0
853 .It Sx \&Xr Ta Yes Ta Yes Ta >0
854 .It Sx \&br Ta \&No Ta \&No Ta 0
855 .It Sx \&sp Ta \&No Ta \&No Ta 1
858 This section is a canonical reference of all macros, arranged
860 For the scoping of individual macros, see
866 Multiple authors should each be accorded their own
869 Author names should be ordered with full or abbreviated forename(s)
870 first, then full surname.
875 This macro may also be used in a non-bibliographic context when
876 referring to book titles.
878 Publication city or location of an
882 Publication date of an
885 This should follow the reduced or canonical form syntax described in
888 Publisher or issuer name of an
896 Issue number (usually for journals) of an
900 Optional information of an
904 Book or journal page number of an
908 Institutional author (school, government, etc.) of an
911 Multiple institutional authors should each be accorded their own
915 Technical report name of an
922 This macro may also be used in a non-bibliographical context when
923 referring to article titles.
925 URI of reference document.
934 Does not have any tail arguments.
937 Do not use this for postal addresses.
944 Requires either the name of an author or one of the following arguments:
946 .Bl -tag -width "-nosplitX" -offset indent -compact
948 Start a new output line before each subsequent invocation of
957 The effect of selecting either of the
959 modes ends at the beginning of the
964 section, the default is
966 for the first author listing and
968 for all other author listings.
972 .D1 \&.An Kristaps Dzonsons \&Aq kristaps@bsd.lv
974 Begin a block enclosed by angle brackets.
975 Does not have any head arguments.
978 .D1 \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac
983 Inserts an apostrophe without any surrounding whitespace.
984 This is generally used as a grammatical device when referring to the verb
988 .D1 \&.Fn execve \&Ap d
990 Encloses its arguments in angle brackets.
993 .D1 \&.Fl -key= \&Ns \&Aq \&Ar val
996 this macro is often abused for rendering URIs, which should instead use
1000 or to note pre-processor
1002 statements, which should use
1009 If an argument is not provided, the string
1011 is used as a default.
1014 .D1 \&.Fl o \&Ns \&Ar file1
1016 .D1 \&.Ar arg1 , arg2 .
1018 Formats an AT&T version.
1019 Accepts one optional argument:
1021 .Bl -tag -width "v[1-7] | 32vX" -offset indent -compact
1030 Note that these arguments do not begin with a hyphen.
1049 Does not have any tail arguments.
1051 Begin a display block.
1052 Its syntax is as follows:
1053 .Bd -ragged -offset indent
1056 .Op Fl offset Ar width
1060 Display blocks are used to select a different indentation and
1061 justification than the one used by the surrounding text.
1062 They may contain both macro lines and free-form text lines.
1063 By default, a display block is preceded by a vertical space.
1067 must be one of the following:
1068 .Bl -tag -width 13n -offset indent
1070 Centre-justify each line.
1071 Using this display type is not recommended; many
1073 implementations render it poorly.
1075 Left- and right-justify the block.
1077 Do not justify the block at all.
1078 Preserve white space as it appears in the input.
1080 Only left-justify the block.
1088 must be provided first.
1089 Additional arguments may follow:
1090 .Bl -tag -width 13n -offset indent
1091 .It Fl offset Ar width
1092 Indent the display by the
1094 which may be one of the following:
1097 One of the pre-defined strings
1099 the width of standard indentation;
1104 which has no effect;
1106 which justifies to the right margin; or
1108 which aligns around an imagined centre axis.
1110 A macro invocation, which selects a predefined width
1111 associated with that macro.
1112 The most popular is the imaginary macro
1117 A width using the syntax described in
1118 .Sx Scaling Widths .
1120 An arbitrary string, which indents by the length of this string.
1123 When the argument is missing,
1127 Do not assert vertical space before the display.
1131 .Bd -literal -offset indent
1132 \&.Bd \-literal \-offset indent \-compact
1142 Change the font mode for a scoped block of text.
1143 Its syntax is as follows:
1144 .Bd -ragged -offset indent
1147 .Fl emphasis | literal | symbolic |
1148 .Cm \&Em | \&Li | \&Sy
1156 argument are equivalent, as are
1164 Without an argument, this macro does nothing.
1165 The font mode continues until broken by a new font mode in a nested
1177 Keep the output generated from each macro input line together
1178 on one single output line.
1179 Line breaks in free-form text lines are unaffected.
1180 The syntax is as follows:
1182 .D1 Pf \. Sx \&Bk Fl words
1186 argument is required; additional arguments are ignored.
1188 The following example will not break within each
1191 .Bd -literal -offset indent
1194 \&.Op Fl o Ar output
1198 Be careful in using over-long lines within a keep block!
1199 Doing so will clobber the right margin.
1202 Lists consist of items started by the
1204 macro, containing a head or a body or both.
1205 The list syntax is as follows:
1206 .Bd -ragged -offset indent
1210 .Op Fl offset Ar val
1217 is mandatory and must be specified first.
1224 or use the length of the given string.
1227 is a global indentation for the whole list, affecting both item heads
1229 For those list types supporting it, the
1231 argument requests an additional indentation of item bodies,
1236 argument is specified, list entries are separated by vertical space.
1238 A list must specify one of the following list types:
1239 .Bl -tag -width 12n -offset indent
1241 No item heads can be specified, but a bullet will be printed at the head
1243 Item bodies start on the same output line as the bullet
1244 and are indented according to the
1251 argument has no effect; instead, each argument specifies the width
1252 of one column, using either the
1254 syntax or the string length of the argument.
1255 If the first line of the body of a
1261 contexts spanning one input line each are implied until an
1263 macro line is encountered, at which point items start being interpreted as
1270 except that dashes are used in place of bullets.
1274 except that item heads are not parsed for macro invocations.
1275 .\" but with additional formatting to the head.
1280 except that cardinal numbers are used in place of bullets,
1285 except that the first lines of item bodies are not indented, but follow
1286 the item heads like in
1293 Item bodies follow items heads on the same line, using normal inter-word
1295 Bodies are not indented, and the
1297 argument is ignored.
1299 No item heads can be specified, and none are printed.
1300 Bodies are not indented, and the
1302 argument is ignored.
1304 Item bodies start on the line following item heads and are not indented.
1307 argument is ignored.
1309 Item bodies are indented according to the
1312 When an item head fits inside the indentation, the item body follows
1313 this head on the same output line.
1314 Otherwise, the body starts on the output line following the head.
1322 Begin a block enclosed by square brackets.
1323 Does not have any head arguments.
1326 .Bd -literal -offset indent -compact
1334 Encloses its arguments in square brackets.
1337 .D1 \&.Bq 1 , \&Dv BUFSIZ
1340 this macro is sometimes abused to emulate optional arguments for
1341 commands; the correct macros to use for this purpose are
1353 Does not have any tail arguments.
1355 Begin a block enclosed by curly braces.
1356 Does not have any head arguments.
1359 .Bd -literal -offset indent -compact
1367 Encloses its arguments in curly braces.
1370 .D1 \&.Brq 1 , ... , \&Va n
1375 Format the BSD/OS version provided as an argument, or a default value if
1376 no argument is provided.
1393 .Dq is currently in beta test .
1395 Format the BSD version provided as an argument, or a default value if no
1396 argument is provided.
1412 Kernel configuration declaration.
1413 This denotes strings accepted by
1417 .D1 \&.Cd device le0 at scode?
1420 this macro is commonly abused by using quoted literals to retain
1421 whitespace and align consecutive
1424 This practise is discouraged.
1427 Useful when specifying configuration options or keys.
1430 .D1 \&.Cm ControlPath
1431 .D1 \&.Cm ControlMaster
1436 One-line indented display.
1437 This is formatted by the default rules and is useful for simple indented
1439 It is followed by a newline.
1442 .D1 \&.D1 \&Fl abcdefgh
1449 Switch debugging mode.
1450 Its syntax is as follows:
1452 .D1 Pf \. Sx \&Db Cm on | off
1454 This macro is ignored by
1460 Does not have any tail arguments.
1463 This is the mandatory first macro of any
1466 Its syntax is as follows:
1468 .D1 Pf \. Sx \&Dd Op Ar date
1474 which signifies the current manual revision date dictated by
1476 or instead a valid canonical date as specified by
1478 If a date does not conform or is empty, the current date is used.
1481 .D1 \&.Dd $\&Mdocdate$
1482 .D1 \&.Dd $\&Mdocdate: July 21 2007$
1483 .D1 \&.Dd July 21, 2007
1490 One-line intended display.
1491 This is formatted as literal text and is useful for commands and
1493 It is followed by a newline.
1496 .D1 \&.Dl % mandoc mdoc.7 \e(ba less
1503 Begin a block enclosed by double quotes.
1504 Does not have any head arguments.
1507 .Bd -literal -offset indent -compact
1509 April is the cruellest month
1517 Encloses its arguments in
1522 .Bd -literal -offset indent -compact
1523 \&.Dq April is the cruellest month
1534 This is the mandatory second macro of any
1537 Its syntax is as follows:
1538 .Bd -ragged -offset indent
1544 .Op Ar volume | arch
1549 Its arguments are as follows:
1550 .Bl -tag -width Ds -offset Ds
1552 The document's title (name), defaulting to
1555 It should be capitalised.
1566 .Pq Perl libraries ,
1576 .Pq system utilities ,
1578 .Pq kernel functions ,
1580 .Pq X Window System ,
1582 .Pq X Window System ,
1592 It should correspond to the manual's filename suffix and defaults to
1596 This overrides the volume inferred from
1598 This field is optional, and if specified, must be one of
1600 .Pq users' supplementary documents ,
1602 .Pq programmers' supplementary documents ,
1604 .Pq administrators' supplementary documents ,
1606 .Pq system managers' manuals ,
1608 .Pq users' reference manuals ,
1610 .Pq programmers' reference manuals ,
1612 .Pq kernel manuals ,
1623 .Pq contributed manuals .
1625 This specifies a specific relevant architecture.
1628 is not provided, it may be used in its place, else it may be used
1630 It, too, is optional.
1665 .D1 \&.Dt FOO 9 i386
1672 Defined variables such as preprocessor constants.
1676 .D1 \&.Dv STDOUT_FILENO
1681 Format the DragonFly BSD version provided as an argument, or a default
1682 value if no argument is provided.
1698 Close a scope started by
1700 Its syntax is as follows:
1702 .D1 Pf \. Sx \&Ec Op Ar TERM
1706 argument is used as the enclosure tail, for example, specifying \e(rq
1710 End a display context started by
1713 End a font mode context started by
1716 End a keep context started by
1719 End a list context started by
1727 Denotes text that should be emphasised.
1728 Note that this is a presentation term and should not be used for
1729 stylistically decorating technical terms.
1741 This macro is obsolete and not implemented in
1744 An arbitrary enclosure.
1745 Its syntax is as follows:
1747 .D1 Pf \. Sx \&Eo Op Ar TERM
1751 argument is used as the enclosure head, for example, specifying \e(lq
1755 Display error constants.
1764 This macro is obsolete and not implemented.
1766 Environmental variables such as those specified in
1773 Insert a standard sentence regarding exit values.
1774 Its syntax is as follows:
1776 .D1 Pf \. Sx \&Ex Fl std Op Ar utility
1780 is not specified, the document's name set by
1788 Its syntax is as follows:
1789 .Bd -ragged -offset indent
1795 This may be invoked for names with or without the corresponding type.
1796 It is also used to specify the field name of a structure.
1799 macro is used in the
1803 section when documenting multi-line function prototypes.
1804 If invoked with multiple arguments, the arguments are separated by a
1806 Furthermore, if the following macro is another
1808 the last argument will also have a trailing comma.
1811 .D1 \&.Fa \(dqconst char *p\(dq
1812 .D1 \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq
1818 End a function context started by
1821 Historically used to document include files.
1822 This usage has been deprecated in favour of
1824 Do not use this macro.
1827 .Sx MANUAL STRUCTURE
1832 Used when listing arguments to command-line utilities.
1833 Prints a fixed-width hyphen
1835 directly followed by each argument.
1836 If no arguments are provided, a hyphen is printed followed by a space.
1837 If the argument is a macro, a hyphen is prefixed to the subsequent macro
1844 .D1 \&.Op \&Fl o \&Ns \&Ar file
1850 Its syntax is as follows:
1851 .Bd -ragged -offset indent
1855 .Op Oo Cm argtype Oc Cm argname
1858 Function arguments are surrounded in parenthesis and
1859 are delimited by commas.
1860 If no arguments are specified, blank parenthesis are output.
1863 .D1 \&.Fn "int funcname" "int arg0" "int arg1"
1864 .D1 \&.Fn funcname "int arg0"
1865 .D1 \&.Fn funcname arg0
1866 .Bd -literal -offset indent -compact
1872 .Sx MANUAL STRUCTURE
1876 Begin a function block.
1877 This is a multi-line version of
1879 Its syntax is as follows:
1881 .D1 Pf \. Sx \&Fo Cm funcname
1883 Invocations usually occur in the following context:
1884 .Bd -ragged -offset indent
1885 .Pf \. Sx \&Ft Cm functype
1887 .Pf \. Sx \&Fo Cm funcname
1889 .Pf \. Sx \&Fa Oo Cm argtype Oc Cm argname
1901 .Sx MANUAL STRUCTURE ,
1908 Its syntax is as follows:
1910 .D1 Pf \. Sx \&Ft Cm functype
1914 .Bd -literal -offset indent -compact
1920 .Sx MANUAL STRUCTURE ,
1927 version provided as an argument, or a default value
1928 if no argument is provided.
1944 This macro is obsolete and not implemented.
1946 Designate an internal or interactive command.
1949 but used for instructions rather than values.
1959 is preferred for displaying code; the
1961 macro is used when referring to specific instructions.
1968 section (only if invoked as the line macro), the first argument is
1971 the arguments is enclosed in angle brackets.
1977 .Sx MANUAL STRUCTURE .
1980 The syntax of this macro depends on the list type.
1989 have the following syntax:
1991 .D1 Pf \. Sx \&It Cm args
2000 have the following syntax:
2004 with subsequent lines interpreted within the scope of the
2006 until either a closing
2013 list has the following syntax:
2015 .D1 Pf \. Sx \&It Op Cm args
2017 Subsequent lines are interpreted as with
2020 The line arguments correspond to the list's left-hand side; body
2021 arguments correspond to the list's contents.
2025 list is the most complicated.
2026 Its syntax is as follows:
2028 .D1 Pf \. Sx \&It Op Cm args
2032 are phrases, a mix of macros and text corresponding to a line column,
2033 delimited by tabs or the special
2036 Lines subsequent the
2038 are interpreted within the scope of the last phrase.
2039 Calling the pseudo-macro
2041 will open a new phrase scope (this must occur on a macro line to be
2042 interpreted as a macro).
2043 Note that the tab phrase delimiter may only be used within the
2046 Subsequent this, only the
2048 pseudo-macro may be used to delimit phrases.
2049 Furthermore, note that quoted sections propagate over tab-delimited
2054 .D1 .It \(dqcol1 ; <TAB> col2 ;\(dq \&;
2056 will preserve the semicolon whitespace except for the last.
2062 The syntax is as follows:
2064 .D1 Pf \. Sx \&Lb Cm library
2068 parameter may be a system library, such as
2072 in which case a small library description is printed next to the linker
2073 invocation; or a custom library, in which case the library name is
2075 This is most commonly used in the
2077 section as described in
2078 .Sx MANUAL STRUCTURE .
2084 Denotes text that should be in a literal font mode.
2085 Note that this is a presentation term and should not be used for
2086 stylistically decorating technical terms.
2095 Its syntax is as follows:
2097 .D1 Pf \. Sx \&Lk Cm uri Op Cm name
2100 .D1 \&.Lk http://bsd.lv \*qThe BSD.lv Project\*q
2101 .D1 \&.Lk http://bsd.lv
2109 Display a mathematical symbol.
2110 Its syntax is as follows:
2112 .D1 Pf \. Sx \&Ms Cm symbol
2121 Its syntax is as follows:
2123 .D1 Pf \. Sx \&Mt Cm address
2126 .D1 \&.Mt discuss@manpages.bsd.lv
2128 A one line description of the manual's content.
2129 This may only be invoked in the
2131 section subsequent the
2136 .D1 \&.Sx \&Nd mdoc language reference
2137 .D1 \&.Sx \&Nd format and display UNIX manuals
2141 macro technically accepts child macros and terminates with a subsequent
2144 Do not assume this behaviour: some
2146 database generators are not smart enough to parse more than the line
2147 arguments and will display macros verbatim.
2152 The name of the manual page, or \(em in particular in section 1, 6,
2153 and 8 pages \(em of an additional command or feature documented in
2155 When first invoked, the
2157 macro expects a single argument, the name of the manual page.
2158 Usually, the first invocation happens in the
2160 section of the page.
2161 The specified name will be remembered and used whenever the macro is
2162 called again without arguments later in the page.
2166 .Sx Block full-implicit
2167 semantics when invoked as the first macro on an input line in the
2169 section; otherwise, it uses ordinary
2174 .Bd -literal -offset indent
2183 of section 2, 3 and 9 manual pages, use the
2187 to mark up the name of the manual page.
2191 macro used to terminate prior macro contexts.
2194 .D1 \&.Sx \&Fl ab \&No cd \&Fl ef
2197 Following invocation, text is interpreted as free-form text until a
2198 macro is encountered.
2201 .D1 \&.Fl o \&Ns \&Ar output
2210 version provided as an argument, or a default value if
2211 no argument is provided.
2231 Multi-line version of
2235 .Bd -literal -offset indent -compact
2237 \&.Op Fl flag Ns Ar value
2241 Command-line option.
2242 Used when listing options to command-line utilities.
2243 Prints the argument(s) in brackets.
2246 .D1 \&.Op \&Fl a \&Ar b
2247 .D1 \&.Op \&Ar a | b
2252 Document operating system version.
2253 This is the mandatory third macro of
2257 Its syntax is as follows:
2259 .D1 Pf \. Sx \&Os Op Cm system Op Cm version
2263 parameter specifies the relevant operating system or environment.
2264 Left unspecified, it defaults to the local operating system version.
2265 This is the suggested form.
2269 .D1 \&.Os KTH/CSC/TCS
2280 this macro has been deprecated.
2284 version provided as an argument, or a default value
2285 if no argument is provided.
2304 .D1 \&.Pa /usr/bin/mandoc
2305 .D1 \&.Pa /usr/share/man/man7/mdoc.7
2310 Close parenthesised context opened by
2315 between its arguments.
2316 Its syntax is as follows:
2318 .D1 Pf \. \&Pf Cm prefix suffix
2322 argument may be a macro.
2325 .D1 \&.Pf \e. \&Sx \&Pf \&Cm prefix suffix
2327 Multi-line version of
2331 This will assert vertical space between prior and subsequent macros
2334 Parenthesised enclosure.
2339 Close quoted context opened by
2342 Format a single-quoted literal.
2348 Multi-line version of
2351 Encloses its arguments in
2366 Does not have any tail arguments.
2368 Begin a bibliographic
2371 Does not have any head arguments.
2372 The block macro may only contain
2388 child macros (at least one must be specified).
2391 .Bd -literal -offset indent -compact
2393 \&.%A J. E. Hopcroft
2395 \&.%B Introduction to Automata Theory, Languages, and Computation
2396 \&.%I Addison-Wesley
2397 \&.%C Reading, Massachusettes
2404 block is used within a SEE ALSO section, a vertical space is asserted
2405 before the rendered output, else the block continues on the current
2408 Inserts text regarding a function call's return value.
2409 This macro must consist of the
2411 argument followed by an optional
2415 is not provided, the document's name as stipulated by the first
2422 Close single-quoted context opened by
2425 Begin a new section.
2426 For a list of conventional manual sections, see
2427 .Sx MANUAL STRUCTURE .
2428 These sections should be used unless it's absolutely necessary that
2429 custom sections be used.
2431 Section names should be unique so that they may be keyed by
2440 Switches the spacing mode for output generated from macros.
2441 Its syntax is as follows:
2443 .D1 Pf \. Sx \&Sm Cm on | off
2445 By default, spacing is
2449 no white space is inserted between macro arguments and between the
2450 output generated from adjacent macros, but free-form text lines
2451 still get normal spacing between words and sentences.
2453 Multi-line version of
2456 Encloses its arguments in
2466 Begin a new sub-section.
2469 there's no convention for sub-sections.
2470 Conventional sections, as described in
2471 .Sx MANUAL STRUCTURE ,
2472 rarely have sub-sections.
2474 Sub-section names should be unique so that they may be keyed by
2483 Replace an abbreviation for a standard with the full form.
2484 The following standards are recognised:
2486 .Bl -tag -width "-p1003.1g-2000X" -compact
2580 Reference a section or sub-section.
2581 The referenced section or sub-section name must be identical to the
2582 enclosed argument, including whitespace.
2585 .D1 \&.Sx MANUAL STRUCTURE
2587 Format enclosed arguments in symbolic
2589 Note that this is a presentation term and should not be used for
2590 stylistically decorating technical terms.
2604 .Dq currently under development .
2606 Format the UNIX name.
2607 Accepts no argument.
2626 .D1 \&.Va const char *bar ;
2629 This is also used for indicating global variables in the
2631 section, in which case a variable name is also specified.
2632 Note that it accepts
2633 .Sx Block partial-implicit
2634 syntax when invoked as the first macro in the
2636 section, else it accepts ordinary
2640 Note that this should not be confused with
2642 which is used for function return types.
2645 .D1 \&.Vt unsigned char
2646 .D1 \&.Vt extern const char * const sys_signame[] \&;
2649 .Sx MANUAL STRUCTURE
2653 Close a scope opened by
2656 Open an extension scope.
2657 This macro originally existed to extend the 9-argument limit of troff;
2658 since this limit has been lifted, the macro has been deprecated.
2660 Link to another manual
2661 .Pq Qq cross-reference .
2662 Its syntax is as follows:
2664 .D1 Pf \. Sx \&Xr Cm name section
2670 are the name and section of the linked manual.
2673 is followed by non-punctuation, an
2675 is inserted into the token stream.
2676 This behaviour is for compatibility with
2681 .D1 \&.Xr mandoc 1 \&;
2682 .D1 \&.Xr mandoc 1 \&Ns s behaviour
2685 This macro should not be used; it is implemented for compatibility with
2690 in the event of natural paragraph breaks.
2692 Emits vertical space.
2693 This macro should not be used; it is implemented for compatibility with
2695 Its syntax is as follows:
2697 .D1 Pf \. Sx \&sp Op Cm height
2701 argument must be formatted as described in
2702 .Sx Scaling Widths .
2705 asserts a single vertical space.
2707 This section documents compatibility between mandoc and other other
2708 troff implementations, at this time limited to GNU troff
2712 refers to groff versions before the
2715 .Pq somewhere between 1.15 and 1.19 .
2717 Heirloom troff, the other significant troff implementation accepting
2718 \-mdoc, is similar to historic groff.
2720 The following problematic behaviour is found in groff:
2721 .ds hist (Historic groff only.)
2726 with unknown arguments produces no output at all.
2728 Newer groff and mandoc print
2733 does not recognize trailing punctuation characters when they immediately
2734 precede tabulator characters, but treats them as normal text and
2735 outputs a space before them.
2737 .Sx \&Bd Fl ragged compact
2738 does not start a new line.
2742 without an argument prints
2744 In mandoc, it resolves to the current date.
2747 does not print a dash for an empty argument.
2751 does not start a new line unless invoked as the line macro in the
2759 children causes inconsistent spacing between arguments.
2760 In mandoc, a single space is always inserted between arguments.
2765 causes inconsistent vertical spacing, depending on whether a prior
2772 for the normalised behaviour in mandoc.
2775 ignores additional arguments and is not treated specially in the
2780 sometimes requires a
2784 In new groff and mandoc, any list may be nested by default and
2786 lists will restart the sequence only for the sub-list.
2789 followed by a reserved character is incorrectly used in some manuals
2790 instead of properly quoting that character, which sometimes works with
2794 only accepts a single link-name argument; the remainder is misformatted.
2797 does not format its arguments when used in the FILES section under
2801 can only be called by other macros, but not at the beginning of a line.
2806 Historic groff has many un-callable macros.
2807 Most of these (excluding some block-level macros) are callable
2808 in new groff and mandoc.
2811 (vertical bar) is not fully supported as a delimiter.
2818 .Pq font family face
2820 escapes behave irregularly when specified within line-macro scopes.
2822 Negative scaling units return to prior lines.
2823 Instead, mandoc truncates them to zero.
2826 The following features are unimplemented in mandoc:
2834 .Fl offset Ar center
2836 .Fl offset Ar right .
2837 Groff does not implement centered and flush-right rendering either,
2838 but produces large indentations.
2842 .Pq horizontal position ,
2844 .Pq vertical position ,
2848 .Pq text filling colour ,
2850 .Pq zero-length character ,
2854 .Pq horizontal position marker ,
2856 .Pq text overstrike ,
2860 escape sequences are all discarded in mandoc.
2864 scaling unit is accepted by mandoc, but rendered as the default unit.
2866 In quoted literals, groff allows pairwise double-quotes to produce a
2867 standalone double-quote in formatted output.
2868 This is not supported by mandoc.
2876 language first appeared as a troff macro package in
2878 It was later significantly updated by Werner Lemberg and Ruslan Ermilov
2880 The standalone implementation that is part of the
2882 utility written by Kristaps Dzonsons appeared in
2887 reference was written by
2888 .An Kristaps Dzonsons Aq kristaps@bsd.lv .