GROFMDOC(7) BSD Miscellaneous Information Manual GROFMDOC(7)
NAME
groffmdoc -- reference for groff's mdoc implementation
SYNOPSIS
groff -mdoc file ...
DESCRIPTION
A complete reference for writing UNIX manual pages with the -mdoc macro
package; a content-based and domain-based formatting package for GNU
troff(1). Its predecessor, the -man(7) package, addressed page layout
leaving the manipulation of fonts and other typesetting details to the
individual author. In -mdoc, page layout macros make up the page
structure domain which consists of macros for titles, section headers,
displays and lists - essentially items which affect the physical position
of text on a formatted page. In addition to the page structure domain,
there are two more domains, the manual domain and the general text
domain. The general text domain is defined as macros which perform tasks
such as quoting or emphasizing pieces of text. The manual domain is
defined as macros that are a subset of the day to day informal language
used to describe commands, routines and related UNIX files. Macros in
the manual domain handle command names, command line arguments and
options, function names, function parameters, pathnames, variables, cross
references to other manual pages, and so on. These domain items have
value for both the author and the future user of the manual page. Hope-
fully, the consistency gained across the manual set will provide easier
translation to future documentation tools.
Throughout the UNIX manual pages, a manual entry is simply referred to as
a man page, regardless of actual length and without sexist intention.
GETING STARTED
The material presented in the remainder of this document is outlined as
follows:
1. TROF IDIOSYNCRASIES
Macro Usage
Passing Space Characters in an Argument
Trailing Blank Space Characters
Escaping Special Characters
Other Possible Pitfalls
2. A MANUAL PAGE TEMPLATE
3. CONVENTIONS
4. TITLE MACROS
5. INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
What's in a Name...
General Syntax
6. MANUAL DOMAIN
Addresses
Author Name
Arguments
Configuration Declarations (Section Four Only)
Command Modifiers
Defined Variables
Errno's
Environment Variables
Flags
Function Declarations
Function Types
Functions (Library Routines)
Function Arguments
Return Values
Exit Status
Interactive Commands
Library Names
Literals
Names
Options
Pathnames
Standards
Variable Types
Variables
Manual Page Cross References
7. GENERAL TEXT DOMAIN
AT&T Macro
BSD Macro
NetBSD Macro
FreeBSD Macro
OpenBSD Macro
BSD/OS Macro
UNIX Macro
Emphasis Macro
Font Mode
Enclosure and Quoting Macros
No-Op or Normal Text Macro
No-Space Macro
Section Cross References
Symbolics
Mathematical Symbols
References and Citations
Trade Names (or Acronyms and Type Names)
Extended Arguments
8. PAGE STRUCTURE DOMAIN
Section Headers
Subsection Headers
Paragraphs and Line Spacing
Keeps
Examples and Displays
Lists and Columns
9. MISCELANEOUS MACROS
10. PREDEFINED STRINGS
11. DIAGNOSTICS
12. FORMATING WITH GROF, TROF, AND NROF
13. FILES
14. SEE ALSO
15. BUGS
TROF IDIOSYNCRASIES
The -mdoc package attempts to simplify the process of writing a man page.
Theoretically, one should not have to learn the tricky details of GNU
troff(1) to use -mdoc; however, there are a few limitations which are
unavoidable and best gotten out of the way. And, too, be forewarned,
this package is not fast.
acro Usage
As in GNU troff(1), a macro is called by placing a `.' (dot character) at
the beginning of a line followed by the two-character (or three-charac-
ter) name for the macro. There can be space or tab characters between
the dot and the macro name. Arguments may follow the macro separated by
spaces (but no tabs). It is the dot character at the beginning of the
line which causes GNU troff(1) to interpret the next two (or more) char-
acters as a macro name. A single starting dot followed by nothing is
ignored. To place a `.' (dot character) at the beginning of an input
line in some context other than a macro invocation, precede the `.' (dot)
with the `\&' escape sequence which translates literally to a zero-width
space, and is never displayed in the output.
In general, GNU troff(1) macros accept an unlimited number of arguments
(contrary to other versions of troff which can't handle more than nine
arguments). In limited cases, arguments may be continued or extended on
the next line (See Extended Arguments below). Almost all macros handle
quoted arguments (see Passing Space Characters in an Argument below).
Most of the -mdoc general text domain and manual domain macros are spe-
cial in that their argument lists are parsed for callable macro names.
This means an argument on the argument list which matches a general text
or manual domain macro name (and which is defined to be callable) will be
executed or called when it is processed. In this case the argument,
although the name of a macro, is not preceded by a `.' (dot). This makes
it possible to nest macros; for example the option macro, `.Op', may call
the flag and argument macros, `Fl' and `Ar', to specify an optional flag
with an argument:
[-s bytes] is produced by `.Op Fl s Ar bytes'
To prevent a string from being interpreted as a macro name, precede the
string with the escape sequence `\&':
[Fl s Ar bytes] is produced by `.Op \&Fl s \&Ar bytes'
Here the strings `Fl' and `Ar' are not interpreted as macros. Macros
whose argument lists are parsed for callable arguments are referred to as
parsed and macros which may be called from an argument list are referred
to as callable throughout this document. This is a technical faux pas as
almost all of the macros in -mdoc are parsed, but as it was cumbersome to
constantly refer to macros as being callable and being able to call other
macros, the term parsed has been used.
In the following, we call an -mdoc macro which starts a line (with a
leading dot) a command if this distinction is necessary.
Passing Space Characters in an Argument
Sometimes it is desirable to give as an argument a string containing one
or more blank space characters, say, to specify arguments to commands
which expect particular arrangement of items in the argument list. Addi-
tionally, it makes -mdoc working faster. For example, the function com-
mand `.Fn' expects the first argument to be the name of a function and
any remaining arguments to be function parameters. As ANSI C stipulates
the declaration of function parameters in the parenthesized parameter
list, each parameter is guaranteed to be at minimum a two word string.
For example, int foo.
There are two possible ways to pass an argument which contains an embed-
ded space. One way of passing a string containing blank spaces is to use
the hard or unpaddable space character `\ ', that is, a blank space pre-
ceded by the escape character `\'. This method may be used with any
macro but has the side effect of interfering with the adjustment of text
over the length of a line. Troff sees the hard space as if it were any
other printable character and cannot split the string into blank or new-
line separated pieces as one would expect. This method is useful for
strings which are not expected to overlap a line boundary. An alterna-
tive is to use `\~', a paddable (i.e. stretchable), unbreakable space
(this is a GNU troff(1) extension). The second method is to enclose the
string with double quotes.
For example:
fetch(char *str) is created by `.Fn fetch char\ *str'
fetch(char *str) can also be created by `.Fn fetch "char *str"'
If the `\' before the space in the first example or double quotes in the
second example were omitted, `.Fn' would see three arguments, and the
result would be:
fetch(char, *str)
Trailing Blank Space Characters
Troff can be confused by blank space characters at the end of a line. It
is a wise preventive measure to globally remove all blank spaces from
character sequences. Should the need arise to
use a blank character at the end of a line, it may be forced with an
unpaddable space and the `\&' escape character. For example,
`string\ \&'.
Escaping Special Characters
Special characters like the newline character `\n' are handled by replac-
ing the `\' with `\e' (e.g. `\en') to preserve the backslash.
Other Possible Pitfalls
A warning is emitted when an empty input line is found outside of dis-
plays (see below). Use `.sp' instead. (Well, it is even better to use
-mdoc macros to avoid the usage of low-level commands.)
Leading spaces will cause a break and are output directly. Avoid this
behaviour if possible. Similarly, do not use more than one space charac-
ter between words in an ordinary text line; contrary to other text for-
matters, they are not replaced with a single space.
You can't pass `"' directly as an argument. Use `\*[q]' (or `\*q')
instead.
By default, troff(1) inserts two space characters after a punctuation
mark closing a sentence; characters like `)' or `'' are treated transpar-
ently, not influencing the sentence-ending behaviour. To change this,
insert `\&' before or after the dot:
The
.Ql .
character.
.Pp
The
.Ql \&.
character.
.Pp
.No test .
test
.Pp
.No test.
test
gives
The `'. character
The `.' character.
test. test
test. test
As can be seen in the first and third line, -mdoc handles punctuation
characters specially in macro arguments. This will be explained in sec-
tion General Syntax below. In the same way, you have to protect trailing
full stops of abbreviations with a trailing zero-width space: `e.g.\&'.
A comment in the source file of a man page can be either started with
`.\"' on a single line, `\"' after some input, or `\#' anywhere (the lat-
ter is a GNU troff(1) extension); the rest of such a line is ignored.
A MANUAL PAGE TEMPLATE
The body of a man page is easily constructed from a basic template:
.\" The following commands are required for all man pages.
.Dd Month day, year
.Os [OPERATINGSYSTEM] [version/release]
.Dt DOCUMENTITLE [section number] [architecture/volume]
.Sh NAME
.Nm name
.Nd one line description of name
.\" This next command is for sections 2 and 3 only.
.\" .Sh LIBRARY
.Sh SYNOPSIS
.Sh DESCRIPTION
.\" The following commands should be uncommented and
.\" used where appropriate.
.\" .Sh IMPLEMENTATION NOTES
.\" This next command is for sections 2, 3 and 9 function
.\" return values only.
.\" .Sh RETURN VALUES
.\" This next command is for sections 1, 6, 7 and 8 only.
.\" .Sh ENVIRONMENT
.\" .Sh FILES
.\" .Sh EXAMPLES
.\" This next command is for sections 1, 6, 7, 8 and 9 only
.\" (command return values (to shell) and
.\" fprintf/stderr type diagnostics).
.\" .Sh DIAGNOSTICS
.\" .Sh COMPATIBILITY
.\" This next command is for sections 2, 3 and 9 error
.\" and signal handling only.
.\" .Sh ERORS
.\" .Sh SEE ALSO
.\" .Sh STANDARDS
.\" .Sh HISTORY
.\" .Sh AUTHORS
.\" .Sh BUGS
The first items in the template are the commands `.Dd', `.Os', and `.Dt';
the document date, the operating system the man page or subject source is
developed or modified for, and the man page title (in upper case) along
with the section of the manual the page belongs in. These commands iden-
tify the page and are discussed below in TITLE MACROS.
The remaining items in the template are section headers (.Sh); of which
NAME, SYNOPSIS, and DESCRIPTION are mandatory. The headers are discussed
in PAGE STRUCTURE DOMAIN, after presentation of MANUAL DOMAIN. Several
content macros are used to demonstrate page layout macros; reading about
content macros before page layout macros is recommended.
CONVENTIONS
In the description of all macros below, optional arguments are put into
brackets. An ellipsis (`...') represents zero or more additional argu-
ments. Alternative values for a parameter are separated with `'. If
there are alternative values for a mandatory parameter, braces are used
(together with `') to enclose the value set. Meta-variables are speci-
fied within angles.
Example:
.Xx {bar1 bar2} [-test1 [-test2 -test3] ...
Except stated explicitly, all macros are parsed and callable.
Note that a macro takes effect up to the next nested macro. For example,
`.Ic foo Aq bar' doesn't produce `foo <>' but `foo '. Conse-
quently, a warning message is emitted for most commands if the first
argument is a macro itself since it cancels the effect of the calling
command completely. Another consequence is that quoting macros never
insert literal quotes; `foo <>' has been produced by `.Ic "foo
"'.
Most macros have a default width value which can be used to specify a
label width (-width) or offset (-offset) for the `.Bl' and `.Bd' macros.
It is recommended not to use this rather obscure feature to avoid depen-
dencies on local modifications of the -mdoc package.
TITLE MACROS
The title macros are part of the page structure domain but are presented
first and separately for someone who wishes to start writing a man page
yesterday. Three header macros designate the document title or manual
page title, the operating system, and the date of authorship. These
macros are called once at the very beginning of the document and are used
to construct headers and footers only.
.Dt [] [] []
The document title is the subject of the man page and must be in
CAPITALS due to troff limitations. If omitted, `UNTITLED' is
used. The section number may be a number in the range 1, ..., 9
or `unass', `draft', or `paper'. If it is specified, and no vol-
ume name is given, a default volume name is used.
Under BSD, the following sections are defined:
1 BSD General Commands Manual
2 BSD System Calls Manual
3 BSD Library Functions Manual
4 BSD Kernel Interfaces Manual
5 BSD File Formats Manual
6 BSD Games Manual
7 BSD Miscellaneous Information Manual
8 BSD System Manager's Manual
9 BSD Kernel Developer's Manual
A volume name may be arbitrary or one of the following:
USD User's Supplementary Documents
PS1 Programmer's Supplementary Documents
AMD Ancestral Manual Documents
SM System Manager's Manual
URM User's Reference Manual
PRM Programmer's Manual
KM Kernel Manual
IND Manual Master Index
LOCAL Local Manual
CON Contributed Software Manual
For compatibility, `MI' can be used for `IND', and `LOC' for
`LOCAL'. Values from the previous table will specify a new vol-
ume name. If the third parameter is a keyword designating a com-
puter architecture, its value is prepended to the default volume
name as specified by the second parameter. By default, the fol-
lowing architecture keywords are defined:
alpha, acorn26, acorn32, algor, amd64, amiga, arc, arm26,
arm32, atari, bebox, cats, cesfic, cobalt, dreamcast,
evbarm, evbmips, evbppc, evbsh3, hp300, hp700, hpcmips,
i386, luna68k, m68k, mac68k, macppc, mips, mmeye, mvme68k,
mvmeppc, netwinder, news68k, newsmips, next68k, ofppc,
pc532, pmax, pmppc, powerpc, prep, sandpoint, sgimips, sh3,
shark, sparc, sparc64, sun3, tahoe, vax, x68k, x8664
If the section number is neither a numeric expression in the
range 1 to 9 nor one of the above described keywords, the third
parameter is used verbatim as the volume name.
In the following examples, the left (which is identical to the
right) and the middle part of the manual page header strings are
shown. Note how `\&' prevents the digit 7 from being a valid
numeric expression.
.Dt FO 7 `FO(7)' `BSD Miscellaneous Information
Manual'
.Dt FO 7 bar `FO(7)' `BSD Miscellaneous Information
Manual'
.Dt FO \&7 bar
`FO(7)' `bar'
.Dt FO 2 i386 `FO(2)' `BSD/i386 System Calls Manual'
.Dt FO "" bar `FO' `bar'
Local, OS-specific additions might be found in the file
mdoc.local; look for strings named `volume-ds-X' (for the for-
mer type) and `volume-as-X' (for the latter type); `X' then
denotes the keyword to be used with the `.Dt' macro.
This macro is neither callable nor parsed.
.Os [] []
If the first parameter is empty, the default `BSD' is used. This
may be overridden in the local configuration file, mdoc.local.
In general, the name of the operating system should be the common
acronym, e.g. BSD or AT. The release should be the standard
release nomenclature for the system specified. In the following
table, the possible second arguments for some predefined operat-
ing systems are listed. Similar to `.Dt', local additions might
be defined in mdoc.local; look for strings named
`operating-system-X-Y', where `X' is the acronym for the
operating system and `Y' the release ID.
AT 7th, 7, I, 3, V, V.2, V.3, V.4
BSD 3, 4, 4.1, 4.2, 4.3, 4.3t, 4.3T, 4.3r, 4.3R, 4.4
NetBSD 0.8, 0.8a, 0.9, 0.9a, 1.0, 1.0a, 1.1, 1.2, 1.2a,
1.2b, 1.2c, 1.2d, 1.2e, 1.3, 1.3a, 1.4, 1.4.1,
1.4.2, 1.4.3, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6,
1.6.1, 1.6.2, 2.0, 2.1
FreeBSD 1.0, 1.1, 1.1.5, 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5,
2.1.6, 2.1.7, 2.2, 2.2.1, 2.2.2, 2.2.5, 2.2.6,
2.2.7, 2.2.8, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 4.0,
4.1, 4.1.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.6.2, 4.7,
4.8, 4.9, 4.10, 5.0, 5.1, 5.2, 5.2.1, 5.3
For AT, an unknown second parameter will be replaced with the
string UNIX; for the other predefined acronyms it will be ignored
and a warning message emitted. Unrecognized arguments are dis-
played as given in the page footer. For instance, a typical
footer might be:
.Os BSD 4.3
giving `4.3 Berkeley Distribution', or for a locally produced set
.Os CS Department
which will produce `CS Department'.
If the `.Os' macro is not present, the bottom left corner of the
manual page will be ugly.
This macro is neither callable nor parsed.
.Dd [, ]
If `Dd' has no arguments, `Epoch' is used for the date string.
If it has exactly three arguments, they are concatenated, sepa-
rated with unbreakable space:
.Dd January 25, 2001
Otherwise, the current date is used, ignoring the parameters.
This macro is neither callable nor parsed.
INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
What''s in a Name...
The manual domain macro names are derived from the day to day informal
language used to describe commands, subroutines and related files.
Slightly different variations of this language are used to describe the
three different aspects of writing a man page. First, there is the
description of -mdoc macro command usage. Second is the description of a
UNIX command with -mdoc macros, and third, the description of a command
to a user in the verbal sense; that is, discussion of a command in the
text of a man page.
In the first case, troff(1) macros are themselves a type of command; the
general syntax for a troff command is:
.Xx argument1 argument2 ...
`.Xx' is a macro command, and anything following it are arguments to be
processed. In the second case, the description of a UNIX command using
the content macros is a bit more involved; a typical SYNOPSIS command
line might be displayed as:
filter [-flag]
Here, filter is the command name and the bracketed string -flag is a flag
argument designated as optional by the option brackets. In -mdoc terms,
and are called meta arguments; in this example, the
user has to replace the meta expressions given in angle brackets with
real file names. Note that in this document meta arguments are used to
describe -mdoc commands; in most man pages, meta variables are not
specifically written with angle brackets. The macros which formatted the
above example:
.Nm filter
.Op Fl flag
.Ao Ar infile Ac Ao Ar outfile Ac
In the third case, discussion of commands and command syntax includes
both examples above, but may add more detail. The arguments and
from the example above might be referred to as operands or file
arguments. Some command line argument lists are quite long:
make [-eiknqrstv] [-D variable] [-d flags] [-f makefile] [-I
directory] [-j maxjobs] [variable=value] [target ...]
Here one might talk about the command make and qualify the argument,
makefile, as an argument to the flag, -f, or discuss the optional file
operand target. In the verbal context, such detail can prevent confu-
sion, however the -mdoc package does not have a macro for an argument to
a flag. Instead the `Ar' argument macro is used for an operand or file
argument like target as well as an argument to a flag like variable. The
make command line was produced from:
.Nm make
.Op Fl eiknqrstv
.Op Fl D Ar variable
.Op Fl d Ar flags
.Op Fl f Ar makefile
.Op Fl I Ar directory
.Op Fl j Ar maxjobs
.Op Ar variable Ns = Ns Ar value
.Bk
.Op Ar target ...
.Ek
The `.Bk' and `.Ek' macros are explained in Keeps.
General Syntax
The manual domain and general text domain macros share a similar syntax
with a few minor deviations; most notably, `.Ar', `.Fl', `.Nm', and `.Pa'
differ only when called without arguments; and `.Fn' and `.Xr' impose an
order on their argument lists. All content macros are capable of recog-
nizing and properly handling punctuation, provided each punctuation char-
acter is separated by a leading space. If a command is given:
.Ar sptr, ptr),
The result is:
sptr, ptr),
The punctuation is not recognized and all is output in the font used by
`.Ar'. If the punctuation is separated by a leading white space:
.Ar sptr , ptr ) ,
The result is:
sptr, ptr),
The punctuation is now recognized and output in the default font distin-
guishing it from the argument strings. To remove the special meaning
from a punctuation character escape it with `\&'.
The following punctuation characters are recognized by -mdoc:
. , : ; (
) [ ] ? !
Troff is limited as a macro language, and has difficulty when presented
with a string containing a member of the mathematical, logical or quota-
tion set:
{],-,/,*,%,<,>,<=,>=,=,==,&,`,',"}
The problem is that troff may assume it is supposed to actually perform
the operation or evaluation suggested by the characters. To prevent the
accidental evaluation of these characters, escape them with `\&'. Typi-
cal syntax is shown in the first content macro displayed below, `.Ad'.
MANUAL DOMAIN
Addresses
The address macro identifies an address construct.
Usage: .Ad ...
.Ad addr1 addr1
.Ad addr1 . addr1.
.Ad addr1 , file2 addr1, file2
.Ad f1 , f2 , f3 : f1, f2, f3:
.Ad addr ) ) , addr)),
The default width is 12n.
Author Name
The `.An' macro is used to specify the name of the author of the item
being documented, or the name of the author of the actual manual page.
Usage: .An ...
.An "Joe Author" Joe Author
.An "Joe Author" , Joe Author,
.An "Joe Author" Aq nobody@FreeBSD.org
Joe Author
.An "Joe Author" ) ) , Joe Author)),
The default width is 12n.
In the AUTHORS section, the `.An' command causes a line break allowing
each new name to appear on its own line. If this is not desirable,
.An -nosplit
call will turn this off. To turn splitting back on, write
.An -split
Arguments
The .Ar argument macro may be used whenever an argument is referenced.
If called without arguments, the `file ...' string is output.
Usage: .Ar [] ...
.Ar file ...
.Ar file1 file1
.Ar file1 . file1.
.Ar file1 file2 file1 file2
.Ar f1 f2 f3 : f1 f2 f3:
.Ar file ) ) , file)),
The default width is 12n.
Configuration Declaration (Section Four Only)
The `.Cd' macro is used to demonstrate a config(8) declaration for a
device interface in a section four manual.
Usage: .Cd ...
.Cd "device le0 at scode?" device le00 at scode??
In the SYNOPSIS section a `.Cd' command causes a line break before and
after its arguments are printed.
The default width is 12n.
Command odifiers
The command modifier is identical to the `.Fl' (flag) command with the
exception that the `.Cm' macro does not assert a dash in front of every
argument. Traditionally flags are marked by the preceding dash, however,
some commands or subsets of commands do not use them. Command modifiers
may also be specified in conjunction with interactive commands such as
editor commands. See Flags.
The default width is 10n.
Defined Variables
A variable (or constant) which is defined in an include file is specified
by the macro `.Dv'.
Usage: .Dv ...
.Dv MAXHOSTNAMELEN MAXHOSTNAMELEN
.Dv TIOCGPGRP ) TIOCGPGRP)
The default width is 12n.
Errno''s
The `.Er' errno macro specifies the error return value for section 2, 3,
and 9 library routines. The second example below shows `.Er' used with
the `.Bq' general text domain macro, as it would be used in a section two
manual page.
Usage: .Er ...
.Er ENOENT ENOENT
.Er ENOENT ) ; ENOENT);
.Bq Er ENOTDIR [ENOTDIR]
The default width is 17n.
Environment Variables
The `.Ev' macro specifies an environment variable.
Usage: .Ev ...
.Ev DISPLAY DISPLAY
.Ev PATH . PATH.
.Ev PRINTER ) ) , PRINTER)),
The default width is 15n.
Flags
The `.Fl' macro handles command line flags. It prepends a dash, `-', to
the flag. For interactive command flags, which are not prepended with a
dash, the `.Cm' (command modifier) macro is identical, but without the
dash.
Usage: .Fl ...
.Fl -
.Fl cfv -cfv
.Fl cfv . -cfv.
.Cm cfv . cfv.
.Fl s v t -s -v -t
.Fl - , --,
.Fl xyz ) , -xyz),
.Fl -
The `.Fl' macro without any arguments results in a dash representing
stdin/stdout. Note that giving `.Fl' a single dash will result in two
dashes.
The default width is 12n.
Function Declarations
The `.Fd' macro is used in the SYNOPSIS section with section two or three
functions. It is neither callable nor parsed.
Usage: .Fd ...
.Fd "#include " ##include <>
In the SYNOPSIS section a `.Fd' command causes a line break if a function
has already been presented and a break has not occurred. This leaves a
nice vertical space in between the previous function call and the decla-
ration for the next function.
The `.In' macro, while in the SYNOPSIS section, represents the #include
statement, and is the short form of the above example. It specifies the
C header file as being included in a C program. It also causes a line
break.
While not in the SYNOPSIS section, it represents the header file enclosed
in angle brackets.
Usage: .In
.In stdio.h ##include <>
.In stdio.h
Function Types
This macro is intended for the SYNOPSIS section. It may be used anywhere
else in the man page without problems, but its main purpose is to present
the function type in kernel normal form for the SYNOPSIS of sections two
and three (it causes a line break, allowing the function name to appear
on the next line).
Usage: .Ft ...
.Ft struct stat struct stat
Functions (Library Routines)
The `.Fn' macro is modeled on ANSI C conventions.
Usage: .Fn [] ...
.Fn getchar getchar()
.Fn strlen ) , strlen()),
.Fn align "char *ptr" , align(char *ptr),
Note that any call to another macro signals the end of the `.Fn' call (it
will insert a closing parenthesis at that point).
For functions with many parameters (which is rare), the macros `.Fo'
(function open) and `.Fc' (function close) may be used with `.Fa' (func-
tion argument).
Example:
.Ft int
.Fo resmkquery
.Fa "int op"
.Fa "char *dname"
.Fa "int class"
.Fa "int type"
.Fa "char *data"
.Fa "int datalen"
.Fa "struct rrec *newrr"
.Fa "char *buf"
.Fa "int buflen"
.Fc
Produces:
int resmkquery(int op, char *dname, int class, int type,
char *data, int datalen, struct rrec *newrr, char *buf, int buflen)
In the SYNOPSIS section, the function will always begin at the beginning
of line. If there is more than one function presented in the SYNOPSIS
section and a function type has not been given, a line break will occur,
leaving a nice vertical space between the current function name and the
one prior.
The default width values of `.Fn' and `.Fo' are 12n and 16n, respec-
tively.
Function Arguments
The `.Fa' macro is used to refer to function arguments (parameters) out-
side of the SYNOPSIS section of the manual or inside the SYNOPSIS section
if the enclosure macros `.Fo' and `.Fc' instead of `.Fn' are used. `.Fa'
may also be used to refer to structure members.
Usage: .Fa ...
.Fa dnamlen ) ) , dnamlen)),
.Fa iovlen iovlen
The default width is 12n.
Return Values
The `.Rv' macro generates text for use in the RETURN VALUES section.
Usage: .Rv [-std] [ ...]
For example, `.Rv -std atexit' produces:
The atexit() function returns the value 0 if successful; otherwise
the value -1 is returned and the global variable errno is set to
indicate the error.
The -std option is valid only for manual page sections 2 and 3. Cur-
rently, this macro does nothing if used without the -std flag.
Exit Status
The `.Ex' macro generates text for use in the DIAGNOSTICS section.
Usage: .Ex [-std] [ ...]
For example, `.Ex -std cat' produces:
The cat utility exits 0 on success, and >0 if an error occurs.
The -std option is valid only for manual page sections 1, 6 and 8. Cur-
rently, this macro does nothing if used without the -std flag.
Interactive Commands
The `.Ic' macro designates an interactive or internal command.
Usage: .Ic ...
.Ic :wq ::wq
.Ic "do while {...}" do while {{...}}
.Ic setenv , unsetenv setenv, unsetenv
The default width is 12n.
Library Names
The `.Lb' macro is used to specify the library where a particular func-
tion is compiled in.
Usage: .Lb ...
Available arguments to `.Lb' and their results are:
libarm ARM Architecture Library (libarm, -larm)
libarm32 ARM32 Architecture Library (libarm32, -larm32)
libc Standard C Library (libc, -lc)
libcdk Curses Development Kit Library (libcdk, -lcdk)
libcompat Compatibility Library (libcompat, -lcompat)
libcrypt Crypt Library (libcrypt, -lcrypt)
libcurses Curses Library (libcurses, -lcurses)
libedit Command Line Editor Library (libedit, -ledit)
libedit Command Line Editor Library (libedit, -ledit)
libevent Event Notification Library (libevent, -levent)
libform Curses Form Library (libform, -lform)
libi386 i386 Architecture Library (libi386, -li386)
libintl Internationalized Message Handling Library (libintl,
-lintl)
libipsec IPsec Policy Control Library (libipsec, -lipsec)
libkvm Kernel Data Access Library (libkvm, -lkvm)
libm Math Library (libm, -lm)
libm68k m68k Architecture Library (libm68k, -lm68k)
libmagic Magic Number Recognition Library (libmagic, -lmagic)
libmenu Curses Menu Library (libmenu, -lmenu)
libossaudio OS Audio Emulation Library (libossaudio, -lossaudio)
libpcap Packet Capture Library (libpcap, -lpcap)
libpci PCI Bus Access Library (libpci, -lpci)
libpmc Performance Counters Library (libpmc, -lpmc)
libposix POSIX Compatibility Library (libposix, -lposix)
libpthread POSIX Threads Library (libpthread, -lpthread)
libresolv DNS Resolver Library (libresolv, -lresolv)
librt POSIX Real-time Library (librt, -lrt)
libtermcap Termcap Access Library (libtermcap, -ltermcap)
libusbhid USB Human Interface Devices Library (libusbhid,
-lusbhid)
libutil System Utilities Library (libutil, -lutil)
libx8664 x8664 Architecture Library (libx8664, -lx8664)
libz Compression Library (libz, -lz)
Local, OS-specific additions might be found in the file mdoc.local; look
for strings named `str-Lb-X'. `X' then denotes the keyword to be
used with the `.Lb' macro.
In the LIBRARY section an `.Lb' command causes a line break before and
after its arguments are printed.
Literals
The `.Li' literal macro may be used for special characters, variable con-
stants, etc. -- anything which should be displayed as it would be typed.
Usage: .Li ...
.Li \en \n
.Li M1 M2 M3 ; M1 M2 M3;
.Li cntrl-D ) , cntrl-D),
.Li 1024 ... 1024 ...
The default width is 16n.
Names
The `.Nm' macro is used for the document title or subject name. It has
the peculiarity of remembering the first argument it was called with,
which should always be the subject name of the page. When called without
arguments, `.Nm' regurgitates this initial name for the sole purpose of
making less work for the author. Note: A section two or three document
function name is addressed with the `.Nm' in the NAME section, and with
`.Fn' in the SYNOPSIS and remaining sections. For interactive commands,
such as the `while' command keyword in csh(1), the `.Ic' macro should be
used. While `.Ic' is nearly identical to `.Nm', it can not recall the
first argument it was invoked with.
Usage: .Nm [] ...
.Nm groffmdoc groffmdoc
.Nm \-mdoc -mdoc
.Nm foo ) ) , foo)),
.Nm : groffmdoc:
The default width is 10n.
Options
The `.Op' macro places option brackets around any remaining arguments on
the command line, and places any trailing punctuation outside the brack-
ets. The macros `.Oo' and `.Oc' (which produce an opening and a closing
option bracket respectively) may be used across one or more lines or to
specify the exact position of the closing parenthesis.
Usage: .Op [