xref: /csrg-svn/share/man/man7/mdoc.samples.7 (revision 65229)
163022Sbostic.\" Copyright (c) 1990, 1993
263022Sbostic.\"	The Regents of the University of California.  All rights reserved.
343435Scael.\"
448889Scael.\" %sccs.include.redist.roff%
543435Scael.\"
6*65229Smckusick.\"     @(#)mdoc.samples.7	8.2 (Berkeley) 12/30/93
743435Scael.\"
850772Scael.\" This tutorial sampler invokes every macro in the package several
950772Scael.\" times and is guaranteed to give a worst case performance
1050363Sbostic.\" for an already extremely slow package.
1150772Scael.\"
1243435Scael.Dd
1350772Scael.Os
1443435Scael.Dt MDOC.SAMPLES 7
1543435Scael.Sh NAME
1650772Scael.Nm mdoc.samples
1750772Scael.Nd tutorial sampler for writing
1850772Scael.Bx
1950772Scaelmanuals with
2050772Scael.Nm \-mdoc
2143435Scael.Sh SYNOPSIS
2250772Scael.Nm man mdoc.samples
2343435Scael.Sh DESCRIPTION
2448888ScaelA tutorial sampler for writing
2548888Scael.Bx
2648888Scaelmanual pages with the
2743435Scael.Nm \-mdoc
2850362Scaelmacro package, a
2950362Scael.Em content Ns \-based
3050772Scaeland
3150772Scael.Em domain Ns \-based
3250362Scaelformatting
3348888Scaelpackage for
3448888Scael.Xr troff 1 .
3548888ScaelIts predecessor, the
3648888Scael.Xr \-man 7
3748888Scaelpackage,
3850785Scaeladdressed page layout leaving the
3948888Scaelmanipulation of fonts and other
4048888Scaeltypesetting details to the individual author.
4150772ScaelIn
4250772Scael.Nm \-mdoc ,
4350772Scaelpage layout macros
4450772Scaelmake up the
4550772Scael.Em "page structure domain"
4650772Scaelwhich consists of macros for titles, section headers, displays
4750772Scaeland lists. Essentially items which affect the physical position
4850772Scaelof text on a formatted page.
4950772ScaelIn addition to the page structure domain, there are two more domains,
5050772Scaelthe manual domain and the general text domain.
5150772ScaelThe general text domain is defined as macros which
5250772Scaelperform tasks such as quoting or emphasizing pieces of text.
5350772ScaelThe manual domain is defined as macros that are a subset of the
5450772Scaelday to day informal language used to describe commands, routines
5550772Scaeland related
5650772Scael.Bx
5750772Scaelfiles.
5850772ScaelMacros in the manual domain handle
5950772Scaelcommand names, command line arguments and options, function names,
6050772Scaelfunction parameters, pathnames, variables, cross
6150772Scaelreferences to other manual pages, and so on.
6250772ScaelThese domain
6348888Scaelitems have value
6448888Scaelfor both the author and the future user of the manual page.
6548888ScaelIt is hoped the consistency gained
6648888Scaelacross the manual set will provide easier
6748888Scaeltranslation to future documentation tools.
6848888Scael.Pp
69*65229SmckusickThroughout the
7048888Scael.Ux
7148888Scaelmanual pages, a manual entry
7248888Scaelis simply referred
7348888Scaelto as a man page, regardless of actual length and without
7448888Scaelsexist intention.
7550772Scael.Sh GETTING STARTED
7650772ScaelSince a tutorial document is normally read when a person
7750772Scaeldesires to use the material immediately, the assumption has
7850772Scaelbeen made that the user of this document may be impatient.
7950772ScaelThe material presented in the remained of this document is
8050772Scaeloutlined as follows:
8150772Scael.Bl -enum -offset indent
8250772Scael.It
8350772Scael.Tn "TROFF IDIOSYNCRASIES"
8450772Scael.Bl -tag -width flag -compact -offset indent
85*65229Smckusick.It "Macro Usage" .
86*65229Smckusick.It "Passing Space Characters in an Argument" .
87*65229Smckusick.It "Trailing Blank Space Characters (a warning)" .
88*65229Smckusick.It "Escaping Special Characters" .
8950772Scael.El
9050772Scael.It
9150772Scael.Tn "THE ANATOMY OF A MAN PAGE"
9250772Scael.Bl -tag -width flag -compact -offset indent
93*65229Smckusick.It "A manual page template" .
9450772Scael.El
9550772Scael.It
9650772Scael.Tn "INTRODUCTION OF TITLE MACROS" .
9750772Scael.It
9850772Scael.Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS" .
9950772Scael.Bl -tag -width flag -compact -offset indent
100*65229Smckusick.It "What's in a name..." .
101*65229Smckusick.It "General Syntax" .
10250772Scael.El
10350772Scael.It
10450772Scael.Tn "MANUAL DOMAIN"
10550772Scael.Bl -tag -width flag -compact -offset indent
106*65229Smckusick.It "Addresses" .
107*65229Smckusick.It "Arguments" .
108*65229Smckusick.It "Configuration Declarations (section four only)" .
109*65229Smckusick.It "Command Modifier .
110*65229Smckusick.It "Defined Variables" .
111*65229Smckusick.It "Errno's (Section two only)" .
112*65229Smckusick.It "Environment Variables" .
113*65229Smckusick.It "Function Argument" .
114*65229Smckusick.It "Function Declaration" .
115*65229Smckusick.It "Flags" .
116*65229Smckusick.It "Functions (library routines)" .
117*65229Smckusick.It "Function Types" .
118*65229Smckusick.\" .It "Header File (including source code)" .
119*65229Smckusick.It "Interactive Commands" .
120*65229Smckusick.It "Literals" .
121*65229Smckusick.It "Names" .
122*65229Smckusick.It "Options" .
123*65229Smckusick.It "Pathnames" .
124*65229Smckusick.It "Variables" .
125*65229Smckusick.It "Cross References" .
12650772Scael.El
12750772Scael.It
12850772Scael.Tn "GENERAL TEXT DOMAIN"
12950772Scael.Bl -tag -width flag -compact -offset indent
130*65229Smckusick.It "AT&T Macro" .
131*65229Smckusick.It "BSD Macro" .
132*65229Smckusick.It "UNIX Macro" .
133*65229Smckusick.It "Emphasis Macro" .
134*65229Smckusick.It "Enclosure/Quoting Macros"
13550772Scael.Bl -tag -width flag -compact -offset indent
136*65229Smckusick.It "Angle Bracket Quote/Enclosure" .
137*65229Smckusick.It "Bracket Quotes/Enclosure" .
138*65229Smckusick.It "Double Quote macro/Enclosure" .
139*65229Smckusick.It "Parenthesis Quote/Enclosure" .
140*65229Smckusick.It "Single Quotes/Enclosure" .
141*65229Smckusick.It "Prefix Macro" .
14250772Scael.El
143*65229Smckusick.It "Extended  Arguments" .
144*65229Smckusick.It "No\-Op or Normal Text Macro" .
145*65229Smckusick.It "No Space Macro" .
146*65229Smckusick.It "Section Cross References" .
147*65229Smckusick.It "Symbolic Macro" .
148*65229Smckusick.It "References and Citations" .
149*65229Smckusick.It "Trade Names (Acronyms and Type Names)" .
15050772Scael.El
15150772Scael.It
15250772Scael.Tn "PAGE STRUCTURE DOMAIN"
15350772Scael.Bl -tag -width flag -compact -offset indent
154*65229Smckusick.It "Section Headers" .
155*65229Smckusick.It "Paragraphs and Line Spacing" .
156*65229Smckusick.It "Keeps" .
157*65229Smckusick.It "Displays" .
158*65229Smckusick.It "Lists and Columns" .
15950772Scael.El
16050772Scael.It
16150772Scael.Tn "PREDEFINED STRINGS"
16250772Scael.It
16350772Scael.Tn "DIAGNOSTICS"
16450772Scael.It
16550772Scael.Tn "FORMATTING WITH GROFF, TROFF AND NROFF"
16650772Scael.It
16750772Scael.Tn "BUGS"
16850772Scael.El
16950772Scael.ne 7
17043435Scael.Sh TROFF IDIOSYNCRASIES
17148888ScaelThe
17248888Scael.Nm \-mdoc
17348888Scaelpackage attempts to simplify the process of writing a man page.
17448888ScaelTheoretically, one should not have to learn the dirty details of
17543435Scael.Xr troff 1
17648888Scaelto use
17748888Scael.Nm \-mdoc ;
17848888Scaelhowever, there are a few
17943435Scaellimitations which are unavoidable and best gotten out
18050772Scaelof the way.
18150772ScaelAnd, too, be forewarned, this package is
18248888Scael.Em not
18348888Scaelfast.
18443435Scael.Ss Macro Usage
18543435ScaelAs in
18643435Scael.Xr troff 1 ,
18748888Scaela macro is called by placing a
18848888Scael.Ql \&\.
18943435Scael(dot character)
19043435Scaelat the beginning of
19143435Scaela line followed by the two character name for the macro.
19248888ScaelArguments may follow the macro separated by spaces.
19343435ScaelIt is the dot character at the beginning of the line which causes
19443435Scael.Xr troff 1
19548888Scaelto interpret the next two characters as a macro name.
19643435ScaelTo place a
19748888Scael.Ql \&\.
19843435Scael(dot character)
19943435Scaelat the beginning of a line in some context other than
20050772Scaela macro invocation, precede the
20148888Scael.Ql \&\.
20250772Scael(dot) with the
20350772Scael.Ql \e&
20450772Scaelescape sequence.
20550772ScaelThe
20650772Scael.Ql \e&
20750772Scaeltranslates literally to a zero width space, and is never displayed in the
20850772Scaeloutput.
20948888Scael.Pp
21048888ScaelIn general,
21148888Scael.Xr troff 1
21248888Scaelmacros accept up to nine arguments, any
21348888Scaelextra arguments are ignored.
21448888ScaelMost macros in
21548888Scael.Nm \-mdoc
21648888Scaelaccept nine arguments and,
21748888Scaelin limited cases, arguments may be continued or extended
21848888Scaelon the
21948888Scaelnext line (See
22050772Scael.Sx Extensions ) .
22150772ScaelA few macros handle quoted arguments (see
22248888Scael.Sx Passing Space Characters in an Argument
22348888Scaelbelow).
22450772Scael.Pp
22550772ScaelMost of the
22648888Scael.Nm \-mdoc
22750772Scaelgeneral text domain and manual domain macros are special
22850772Scaelin that their argument lists are
22950772Scael.Em parsed
23050772Scaelfor callable macro names.
23150772ScaelThis means an argument on the argument list which matches
23250772Scaela general text or manual domain macro name and is determined
23350772Scaelto be callable will be executed
23450772Scaelor called when it is processed.
23550772ScaelIn this case
23643435Scaelthe argument, although the name of a macro,
23743435Scaelis not preceded by a
23848888Scael.Ql \&\.
23950772Scael(dot).
24050772ScaelIt is in this manner that many macros are nested; for
24148888Scaelexample
24248888Scaelthe option macro,
24348888Scael.Ql \&.Op ,
24448888Scaelmay
24543435Scael.Em call
24648888Scaelthe flag and argument macros,
24750772Scael.Ql \&Fl
24848888Scaeland
24950772Scael.Ql \&Ar ,
25048888Scaelto specify an optional flag with an argument:
25148888Scael.Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
25248888Scael.It Op Fl s Ar bytes
25343435Scaelis produced by
25448888Scael.Li \&.Op \&Fl s \&Ar bytes
25548888Scael.El
25643435Scael.Pp
25748888ScaelTo prevent a two character
25848888Scaelstring from being interpreted as a macro name, precede
25948888Scaelthe string with the
26048888Scaelescape sequence
26148888Scael.Ql \e& :
26250785Scael.Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
26348888Scael.It Op \&Fl s \&Ar bytes
26448888Scaelis produced by
26548888Scael.Li \&.Op \e&Fl s \e&Ar bytes
26648888Scael.El
26743435Scael.Pp
26848888ScaelHere the strings
26948888Scael.Ql \&Fl
27048888Scaeland
27148888Scael.Ql \&Ar
27250785Scaelare not interpreted as macros.
27350785ScaelMacros whose argument lists are parsed for callable arguments
27450785Scaelare referred to
27550785Scaelas parsed and macros which may be called from an argument
27650785Scaellist are referred to as callable
277*65229Smckusickthroughout this document and in the companion quick reference
27850785Scaelmanual
27950772Scael.Xr mdoc 7 .
28050785ScaelThis is a technical
28150785Scael.Em faux pas
28250785Scaelas almost all of the macros in
28350785Scael.Nm \-mdoc
28450785Scaelare parsed, but as it was cumbersome to constantly refer to macros
28550785Scaelas being callable and being able to call other macros,
28650785Scaelthe term parsed has been used.
28748888Scael.Ss Passing Space Characters in an Argument
28848888ScaelSometimes it is desirable to give as one argument a string
28950772Scaelcontaining one or more blank space characters.
29050772ScaelThis may be necessary
29148888Scaelto defeat the nine argument limit or to specify arguments to macros
29248888Scaelwhich expect particular arrangement of items in the argument list.
29348888ScaelFor example,
29448888Scaelthe function macro
29548888Scael.Ql \&.Fn
29648888Scaelexpects the first argument to be the name of a function and any
29750772Scaelremaining arguments to be function parameters.
29850772ScaelAs
29948888Scael.Tn "ANSI C"
30048888Scaelstipulates the declaration of function parameters in the
30148888Scaelparenthesized parameter list, each parameter is guaranteed
30250772Scaelto be at minimum a two word string.
30350772ScaelFor example,
30448888Scael.Fa int foo .
30550772Scael.Pp
30648888ScaelThere are two possible ways to pass an argument which contains
30750772Scaelan embedded space.
30850772Scael.Em Implementation note :
30950772ScaelUnfortunately, the most convenient way
31050772Scaelof passing spaces in between quotes by reassigning individual
31150772Scaelarguments before parsing was fairly expensive speed wise
31250772Scaeland space wise to implement in all the macros for
31350772Scael.Tn AT&T
31450772Scael.Xr troff .
31550772ScaelIt is not expensive for
31650772Scael.Xr groff
31750772Scaelbut for the sake of portability, has been limited
31850772Scaelto the following macros which need
31948888Scaelit the most:
32043435Scael.Pp
32148888Scael.Bl -tag -width 4n -offset indent -compact
32248888Scael.It Li \&Cd
32350772ScaelConfiguration declaration (section 4
32450772Scael.Sx SYNOPSIS )
32548888Scael.It Li \&Bl
32648888ScaelBegin list (for the width specifier).
32748888Scael.It Li \&Em
32848888ScaelEmphasized text.
32948888Scael.It Li \&Fn
33048888ScaelFunctions (sections two and four).
33148888Scael.It Li \&It
33248888ScaelList items.
33348888Scael.It Li \&Li
33448888ScaelLiteral text.
33548888Scael.It Li \&Sy
33648888ScaelSymbolic text.
33748888Scael.It Li \&%B
33848888ScaelBook titles.
33948888Scael.It Li \&%J
34048888ScaelJournal names.
34148888Scael.It Li \&%O
34248888ScaelOptional notes for a reference.
34348888Scael.It Li \&%R
34448888ScaelReport title (in a reference).
34548888Scael.It Li \&%T
34648888ScaelTitle of article in a book or journal.
34748888Scael.El
34848888Scael.Pp
34948888ScaelOne way of passing a string
35048888Scaelcontaining blank spaces is to use the hard or unpaddable space character
35148888Scael.Ql \e\  ,
35250772Scaelthat is, a blank space preceded by the escape character
35348888Scael.Ql \e .
35448888ScaelThis method may be used with any macro but has the side effect
35548888Scaelof interfering with the adjustment of text
35648888Scaelover the length of a line.
35748888Scael.Xr Troff
35848888Scaelsees the hard space as if it were any other printable character and
35948888Scaelcannot split the string into blank or newline separated pieces as one
36050772Scaelwould expect.
36150772ScaelThe method is useful for strings which are not expected
36250772Scaelto overlap a line boundary.
36350772ScaelFor example:
36448888Scael.Bl -tag -width "fetch(char *str)" -offset indent
36548888Scael.It Fn fetch char\ *str
36643435Scaelis created by
36748888Scael.Ql \&.Fn fetch char\e *str
36848888Scael.It Fn fetch "char *str"
36948888Scaelcan also be created by
37048888Scael.Ql \&.Fn fetch "\\*q*char *str\\*q"
37148888Scael.El
37248888Scael.Pp
37348888ScaelIf the
37448888Scael.Ql \e
37548888Scaelor quotes
37648888Scaelwere omitted,
37748888Scael.Ql \&.Fn
37848888Scaelwould see three arguments and
37948888Scaelthe result would be:
38048888Scael.Pp
38148888Scael.Dl Fn fetch char *str
38248888Scael.Pp
38350362ScaelFor an example of what happens when the parameter list overlaps
38450362Scaela newline boundary, see the
38550362Scael.Sx BUGS
38650362Scaelsection.
38748888Scael.Ss Trailing Blank Space Characters
38848888Scael.Xr Troff
38950772Scaelcan be confused by blank space characters at the end of a line.
39050772ScaelIt
39150772Scaelis a wise preventive measure to globally remove all blank spaces
39250772Scaelfrom <blank-space><end-of-line> character sequences.
39350772ScaelShould the need
39448888Scaelarise to force a blank character at the end of a line,
39548888Scaelit may be forced with an unpaddable space and the
39648888Scael.Ql \e&
39748888Scaelescape character.
39848888ScaelFor example,
39948888Scael.Ql string\e\ \e& .
40043435Scael.Ss Escaping Special Characters
40143435ScaelSpecial characters
40243435Scaellike the newline character
40348888Scael.Ql \en ,
40443435Scaelare handled by replacing the
40548888Scael.Ql \e
40643435Scaelwith
40748888Scael.Ql \ee
40843435Scael(e.g.
40948888Scael.Ql \een )
41043435Scaelto preserve
41143435Scaelthe backslash.
41250772Scael.Sh THE ANATOMY OF A MAN PAGE
41348888ScaelThe body of a man page is easily constructed from a basic
41448888Scaeltemplate found in the file:
41548888Scael.Bd -literal -offset indent
41650772Scael\&.\e" /usr/share/misc/man.template:
41748888Scael\&.\e" The following six lines are required.
41850772Scael\&.Dd Month day, year
41950772Scael\&.Os OPERATING_SYSTEM [version/release]
42048888Scael\&.Dt DOCUMENT_TITLE [section number] [volume]
42148888Scael\&.Sh NAME
42248888Scael\&.Sh SYNOPSIS
42348888Scael\&.Sh DESCRIPTION
42448888Scael\&.\e" The following requests should be uncommented and
42548888Scael\&.\e" used where appropriate.  This next request is
42648888Scael\&.\e" for sections 2 and 3 function return values only.
42748888Scael\&.\e" .Sh RETURN VALUES
42848888Scael\&.\e" This next request is for sections 1, 6, 7 & 8 only
42948888Scael\&.\e" .Sh ENVIRONMENT
43048888Scael\&.\e" .Sh FILES
43148888Scael\&.\e" .Sh EXAMPLES
43248888Scael\&.\e" This next request is for sections 1, 6, 7 & 8 only
43348888Scael\&.\e"     (command return values (to shell) and
43448888Scael\&.\e"	  fprintf/stderr type diagnostics)
43548888Scael\&.\e" .Sh DIAGNOSTICS
43648888Scael\&.\e" The next request is for sections 2 and 3 error
43748888Scael\&.\e" and signal handling only.
43848888Scael\&.\e" .Sh ERRORS
43948888Scael\&.\e" .Sh SEE ALSO
44048888Scael\&.\e" .Sh STANDARDS
44148888Scael\&.\e" .Sh HISTORY
44248888Scael\&.\e" .Sh AUTHORS
44348888Scael\&.\e" .Sh BUGS
44448888Scael.Ed
44548888Scael.Pp
44648888ScaelThe first items in the template are the macros
44750772Scael.Pq Li \&.Dd , \&.Os , \&.Dt ;
44850772Scaelthe document date,
44950772Scaelthe operating system the man page or subject source is developed
45050772Scaelor modified for,
45150772Scaeland the man page title
45250772Scael.Pq Em in upper case
45350772Scaelalong with the section of the manual the page
45450772Scaelbelongs in.
45550772ScaelThese macros identify the page,
45648888Scaeland are discussed below in
45748888Scael.Sx TITLE MACROS .
45848888Scael.Pp
45948888ScaelThe remaining items in the template are section headers
46048888Scael.Pq Li \&.Sh ;
46150772Scaelof which
46250772Scael.Sx NAME ,
46350772Scael.Sx SYNOPSIS
46450772Scaeland
46550772Scael.Sx DESCRIPTION
46650772Scaelare mandatory.
46750772ScaelThe
46848888Scaelheaders are
46948888Scaeldiscussed in
47050772Scael.Sx PAGE STRUCTURE DOMAIN ,
47148888Scaelafter
47248888Scaelpresentation of
47350772Scael.Sx MANUAL DOMAIN .
47448888ScaelSeveral content macros are used to demonstrate page layout macros;
47548888Scaelreading about content macros before page layout macros is
47648888Scaelrecommended.
47748888Scael.Sh TITLE MACROS
47850772ScaelThe title macros are the first portion of the page structure
47950772Scaeldomain, but are presented first and separate for someone who
48050772Scaelwishes to start writing a man page yesterday.
48143435ScaelThree header macros designate the document title or manual page title,
48243435Scaelthe operating system,
48348888Scaeland the date of authorship.
48443435ScaelThese macros are one called once at the very beginning of the document
48543435Scaeland are used to construct the headers and footers only.
48648888Scael.Bl -tag -width 6n
48748888Scael.It Li \&.Dt DOCUMENT_TITLE section# [volume]
48843435ScaelThe document title is the
48950772Scaelsubject of the man page and must be in
49050772Scael.Tn CAPITALS
49150772Scaeldue to troff
49243435Scaellimitations.
49348888ScaelThe section number may be 1,\ ...,\ 8,
49443435Scaeland if it is specified,
49543435Scaelthe volume title may be omitted.
49643435ScaelA volume title may be arbitrary or one of the following:
49743435Scael.\" .Cl
49843435Scael.\" USD	UNIX User's Supplementary Documents
49943435Scael.\" .Cl
50050772Scael.\" PS1	UNIX Programmer's Supplementary Documents
50148888Scael.Pp
50248888Scael.Bl -column SMM -offset indent -compact
50350772Scael.It Li AMD	UNIX Ancestral Manual Documents
50450772Scael.It Li SMM	UNIX System Manager's Manual
50550772Scael.It Li URM	UNIX Reference Manual
50650772Scael.It Li PRM	UNIX Programmer's Manual
50748888Scael.El
50848888Scael.Pp
50950772ScaelThe default volume labeling is
51050772Scael.Li URM
51150772Scaelfor sections 1, 6, and 7;
51250772Scael.Li SMM
51350772Scaelfor section 8;
51450772Scael.Li PRM
51550772Scaelfor sections 2, 3, 4, and 5.
51643435Scael.\" .Cl
51743435Scael.\" MMI	UNIX Manual Master Index
51843435Scael.\" .Cl
51943435Scael.\" CON	UNIX Contributed Software Manual
52043435Scael.\" .Cl
52143435Scael.\" LOC	UNIX Local Manual
52248888Scael.It Li \&.Os operating_system release#
52343435ScaelThe name of the operating system
52450772Scaelshould be the common acronym, e.g.
52550772Scael.Tn BSD
52650772Scaelor
52750772Scael.Tn ATT .
52850772ScaelThe release should be the standard release
52948888Scaelnomenclature for the system specified, e.g. 4.3, 4.3+Tahoe, V.3,
53050772ScaelV.4.
53150772ScaelUnrecognized arguments are displayed as given in the page footer.
53250772ScaelFor instance, a typical footer might be:
53343435Scael.Pp
53450772Scael.Dl \&.Os BSD 4.3
53550772Scael.Pp
53650772Scaelor for a locally produced set
53750772Scael.Pp
53850772Scael.Dl \&.Os CS Department
53950772Scael.Pp
54050772ScaelThe Berkeley default,
54150772Scael.Ql \&.Os
54250772Scaelwithout an argument, has been defined as
54350772Scael.Tn BSD
54450772ScaelExperimental in the
54550772Scaelsite specific file
54650772Scael.Pa /usr/src/share/tmac/doc-common .
54750772ScaelIt really should default to
54850772Scael.Tn LOCAL .
54950772ScaelNote, if the
55050772Scael.Ql \&.Os
55150772Scaelmacro is not present, the bottom left corner of the page
55250772Scaelwill be ugly.
55348888Scael.It Li \&.Dd month day, year
55443435ScaelThe date should be written formally:
55543435Scael.Pp
55650772Scael.ne 5
55743435Scael.Dl January 25, 1989
55848888Scael.El
55950772Scael.Sh MANUAL DOMAIN
56048888Scael.Ss What's in a name...
56150772ScaelThe manual domain macro names are derived from the day to day
56248888Scaelinformal language used to describe commands, subroutines and related
56350772Scaelfiles.
56450772ScaelSlightly
56548888Scaeldifferent variations of this language are used to describe
56648888Scaelthe three different aspects of writing a man page.
56748888ScaelFirst, there is the description of
56848888Scael.Nm \-mdoc
56948888Scaelmacro request usage.
57048888ScaelSecond is the description of a
57148888Scael.Ux
57248888Scaelcommand
57348888Scael.Em with
57448888Scael.Nm \-mdoc
57548888Scaelmacros and third,
57648888Scaelthe
577*65229Smckusickdescription of a command to a user in the verbal sense;
57848888Scaelthat is, discussion of a command in the text of a man page.
57948888Scael.Pp
58048888ScaelIn the first case,
58148888Scael.Xr troff 1
58248888Scaelmacros are themselves a type of command;
58348888Scaelthe general syntax for a troff command is:
58448888Scael.Bd -filled -offset indent
58548888Scael\&.Va argument1 argument2 ... argument9
58648888Scael.Ed
58748888Scael.Pp
58848888ScaelThe
58948888Scael.Ql \&.Va
59048888Scaelis a macro command or request, and anything following it is an argument to
59148888Scaelbe processed.
59248888ScaelIn the second case,
59348888Scaelthe description of a
59448888Scael.Ux
59548888Scaelcommand using the content macros is a
59648888Scaelbit more involved;
59750772Scaela typical
59850772Scael.Sx SYNOPSIS
59950772Scaelcommand line might be displayed as:
60048888Scael.Bd -filled -offset indent
60148888Scael.Nm filter
60248888Scael.Op Fl flag
60348888Scael.Ar infile outfile
60448888Scael.Ed
60548888Scael.Pp
60648888ScaelHere,
60748888Scael.Nm filter
60848888Scaelis the command name and the
60948888Scaelbracketed string
61048888Scael.Fl flag
61148888Scaelis a
61248888Scael.Em flag
61348888Scaelargument designated as optional by the option brackets.
61448888ScaelIn
61548888Scael.Nm \-mdoc
61648888Scaelterms,
61748888Scael.Ar infile
61843435Scaeland
61948888Scael.Ar outfile
62048888Scaelare
62148888Scaelcalled
62248888Scael.Em arguments .
62348888ScaelThe macros which formatted the above example:
62450362Scael.Bd -literal -offset indent
62550362Scael\&.Nm filter
62650362Scael\&.Op \&Fl flag
62750362Scael\&.Ar infile outfile
62848888Scael.Ed
62948888Scael.Pp
63048888ScaelIn the third case, discussion of commands and command syntax
63150772Scaelincludes both examples above, but may add more detail.
63250772ScaelThe
63348888Scaelarguments
63448888Scael.Ar infile
63548888Scaeland
63648888Scael.Ar outfile
63750772Scaelfrom the example above might be referred to as
63848888Scael.Em operands
63948888Scaelor
64048888Scael.Em file arguments .
64148888ScaelSome command line argument lists are quite long:
64248888Scael.Bl -tag -width make -offset indent
64348888Scael.It Nm make
64448888Scael.Op Fl eiknqrstv
64548888Scael.Op Fl D Ar variable
64648888Scael.Op Fl d Ar flags
64748888Scael.Op Fl f Ar makefile
64850772Scael.Bk -words
64948888Scael.Op Fl I Ar directory
65050772Scael.Ek
65148888Scael.Op Fl j Ar max_jobs
65248888Scael.Op Ar variable=value
65350772Scael.Bk -words
65450772Scael.Op Ar target ...
65550772Scael.Ek
65648888Scael.El
65748888Scael.Pp
65848888ScaelHere one might talk about the command
65948888Scael.Nm make
66048888Scaeland qualify the argument
66148888Scael.Ar makefile ,
66248888Scaelas an argument to the flag,
66348888Scael.Fl f ,
66448888Scaelor discuss the optional
66548888Scaelfile
66648888Scaeloperand
66748888Scael.Ar target .
66848888ScaelIn the verbal context, such detail can prevent confusion,
66948888Scaelhowever the
67048888Scael.Nm \-mdoc
67148888Scaelpackage
67248888Scaeldoes not have a macro for an argument
67348888Scael.Em to
67448888Scaela flag.
67548888ScaelInstead the
67648888Scael.Ql \&Ar
67748888Scaelargument macro is used for an operand or file argument like
67848888Scael.Ar target
67948888Scaelas well as an argument to a flag like
68050772Scael.Ar variable .
68150772ScaelThe make command line was produced from:
68248888Scael.Bd -literal -offset indent
68348888Scael\&.Nm make
68448888Scael\&.Op Fl eiknqrstv
68548888Scael\&.Op Fl D Ar variable
68648888Scael\&.Op Fl d Ar flags
68748888Scael\&.Op Fl f Ar makefile
68848888Scael\&.Op Fl I Ar directory
68948888Scael\&.Op Fl j Ar max_jobs
69048888Scael\&.Op Ar variable=value
69150772Scael\&.Bk -words
69248888Scael\&.Op Ar target ...
69350772Scael\&.Ek
69448888Scael.Ed
69550772Scael.Pp
69650772ScaelThe
69750772Scael.Ql \&.Bk
69850772Scaeland
69950772Scael.Ql \&.Ek
70050785Scaelmacros are explained in
70150772Scael.Sx Keeps .
70248888Scael.Ss General Syntax
70350772ScaelThe manual domain and general text domain macros share a similar
70448888Scaelsyntax with a few minor deviations:
70548888Scael.Ql \&.Ar ,
70648888Scael.Ql \&.Fl ,
70748888Scael.Ql \&.Nm ,
70848888Scaeland
70948888Scael.Ql \&.Pa
71048888Scaeldiffer only when called without arguments;
71148888Scael.Ql \&.Fn
71248888Scaeland
71348888Scael.Ql \&.Xr
71448888Scaelimpose an order on their argument lists
71548888Scaeland the
71650772Scael.Ql \&.Op
71748888Scaeland
71850772Scael.Ql \&.Fn
71948888Scaelmacros
72050772Scaelhave nesting limitations.
72150772ScaelAll content macros
72250772Scaelare capable of recognizing and properly handling punctuation,
72350772Scaelprovided each punctuation character is separated by a leading space.
72450772ScaelIf an request is given:
72550772Scael.Pp
72650772Scael.Dl \&.Li sptr, ptr),
72750772Scael.Pp
72850772ScaelThe result is:
72950772Scael.Pp
73050772Scael.Dl Li sptr, ptr),
73150772Scael.Pp
73250772ScaelThe punctuation is not recognized and all is output in the
73350772Scaelliteral font. If the punctuation is separated by a leading
73450772Scaelwhite space:
73550772Scael.Pp
73650772Scael.Dl \&.Li "sptr , ptr ) ,"
73750772Scael.Pp
73850772ScaelThe result is:
73950772Scael.Pp
74050772Scael.Dl Li sptr , ptr ) ,
74150772Scael.Pp
74250772ScaelThe punctuation is now recognized and is output in the
74350772Scaeldefault font distinguishing it from the strings in literal font.
74450772Scael.Pp
74550772ScaelTo remove the special meaning from a punctuation character
74650772Scaelescape it with
74750772Scael.Ql \e& .
74850772Scael.Xr Troff
74950772Scaelis limited as a macro language, and has difficulty
75050772Scaelwhen presented with a string containing
75150772Scaela member of the mathematical, logical or
75248888Scaelquotation set:
75350772Scael.Bd -literal -offset indent-two
75450772Scael\&{+,\-,/,*,\&%,<,>,<=,>=,=,==,&,`,',"}
75548888Scael.Ed
75650772Scael.Pp
75750772ScaelThe problem is that
75850772Scael.Xr troff
75950772Scaelmay assume it is supposed to actually perform the operation
76050772Scaelor evaluation suggested by the characters.  To prevent
76150772Scaelthe accidental evaluation of these characters,
76250772Scaelescape them with
76348888Scael.Ql \e& .
76448888ScaelTypical syntax is shown in the first content macro displayed
76548888Scaelbelow,
76650772Scael.Ql \&.Ad .
76748888Scael.Ss Address Macro
76850772ScaelThe address macro identifies an address construct
76943435Scaelof the form addr1[,addr2[,addr3]].
77043435Scael.Pp
77148888Scael.Dl Usage: .Ad address ... \*(Pu
77248888Scael.Bl -tag -width ".Ad f1 , f2 , f3 :" -compact -offset 14n
77348888Scael.It Li \&.Ad addr1
77443435Scael.Ad addr1
77548888Scael.It Li \&.Ad addr1\ .
77643435Scael.Ad addr1 .
77748888Scael.It Li \&.Ad addr1\ , file2
77843435Scael.Ad addr1 , file2
77948888Scael.It Li \&.Ad f1\ , f2\ , f3\ :
78043435Scael.Ad f1 , f2 , f3 :
78148888Scael.It Li \&.Ad addr\ )\ )\ ,
78243435Scael.Ad addr ) ) ,
78348888Scael.El
78448888Scael.Pp
78543435ScaelIt is an error to call
78643435Scael.Li \&.Ad
78743435Scaelwithout arguments.
78848888Scael.Li \&.Ad
78950785Scaelis callable by other macros and is parsed.
79048888Scael.Ss Argument Macro
79143435ScaelThe
79243435Scael.Li \&.Ar
79348888Scaelargument macro may be used whenever
79443435Scaela command line argument is referenced.
79543435Scael.Pp
79643435Scael.Dl Usage: .Ar argument ... \*(Pu
79748888Scael.Bl -tag -width ".Ar file1 file2" -compact -offset 15n
79848888Scael.It Li \&.Ar
79943435Scael.Ar
80048888Scael.It Li \&.Ar file1
80143435Scael.Ar file1
80248888Scael.It Li \&.Ar file1\ .
80343435Scael.Ar file1 .
80448888Scael.It Li \&.Ar file1 file2
80543435Scael.Ar file1 file2
80648888Scael.It Li \&.Ar f1 f2 f3\ :
80743435Scael.Ar f1 f2 f3 :
80848888Scael.It Li \&.Ar file\ )\ )\ ,
80943435Scael.Ar file ) ) ,
81048888Scael.El
81143435Scael.Pp
81243435ScaelIf
81343435Scael.Li \&.Ar
81448888Scaelis called without arguments
81548888Scael.Ql Ar
81650772Scaelis assumed.
81750772ScaelThe
81843435Scael.Li \&.Ar
81950785Scaelmacro is parsed and is callable.
82048888Scael.Ss Configuration Declaration (section four only)
82148888ScaelThe
82248888Scael.Ql \&.Cd
82348888Scaelmacro is used to demonstrate a
82448888Scael.Xr config 8
82548888Scaeldeclaration for a device interface in a section four manual.
82648888ScaelThis macro accepts quoted arguments (double quotes only).
82748888Scael.Pp
82848888Scael.Bl -tag -width "device le0 at scode?" -offset indent
82948888Scael.It Cd "device le0 at scode?"
83048888Scaelproduced by:
83148888Scael.Ql ".Cd device le0 at scode?" .
83248888Scael.El
83348888Scael.Ss Command Modifier
83448888ScaelThe command modifier is identical to the
83548888Scael.Ql \&.Fl
83648888Scael(flag) command with the exception
83748888Scaelthe
83848888Scael.Ql \&.Cm
83948888Scaelmacro does not assert a dash
84050772Scaelin front of every argument.
84150772ScaelTraditionally flags are marked by the
84248888Scaelpreceding dash, some commands or subsets of commands do not use them.
84348888ScaelCommand modifiers may also be specified in conjunction with interactive
84448888Scaelcommands such as editor commands.
84548888ScaelSee
84648888Scael.Sx Flags .
84748888Scael.Ss Defined Variables
84848888ScaelA variable which is defined in an include file is specified
84948888Scaelby the macro
85048888Scael.Ql \&.Dv .
85143435Scael.Pp
85248888Scael.Dl Usage: .Dv defined_variable ... \*(Pu
85348888Scael.Bl -tag -width ".Dv MAXHOSTNAMELEN" -compact -offset 14n
85448888Scael.It Li ".Dv MAXHOSTNAMELEN"
85548888Scael.Dv MAXHOSTNAMELEN
85648888Scael.It Li ".Dv TIOCGPGRP )"
85748888Scael.Dv TIOCGPGRP )
85848888Scael.El
85948888Scael.Pp
86048888ScaelIt is an error to call
86148888Scael.Ql \&.Dv
86248888Scaelwithout arguments.
86348888Scael.Ql \&.Dv
86450785Scaelis parsed and is callable.
86548888Scael.Ss Errno's (Section two only)
86643435ScaelThe
86748888Scael.Ql \&.Er
86848888Scaelerrno macro specifies the error return value
86950772Scaelfor section two library routines.
87050772ScaelThe second example
87143435Scaelbelow shows
87248888Scael.Ql \&.Er
87343435Scaelused with the
87448888Scael.Ql \&.Bq
87550772Scaelgeneral text domain macro, as it would be used in
87648888Scaela section two manual page.
87743435Scael.Pp
87843435Scael.Dl Usage: .Er ERRNOTYPE ... \*(Pu
87948888Scael.Bl -tag -width ".Bq Er ENOTDIR" -compact -offset 14n
88048888Scael.It Li \&.Er ENOENT
88143435Scael.Er ENOENT
88248888Scael.It Li \&.Er ENOENT\ )\ ;
88348888Scael.Er ENOENT ) ;
88448888Scael.It Li \&.Bq \&Er ENOTDIR
88548888Scael.Bq Er ENOTDIR
88648888Scael.El
88743435Scael.Pp
88843435ScaelIt is an error to call
88948888Scael.Ql \&.Er
89043435Scaelwithout arguments.
89148888ScaelThe
89248888Scael.Ql \&.Er
89350785Scaelmacro is parsed and is callable.
89443435Scael.Ss Environment Variables
89543435ScaelThe
89648888Scael.Ql \&.Ev
897*65229Smckusickmacro specifies an environment variable.
89843435Scael.Pp
89943435Scael.Dl Usage: .Ev argument ... \*(Pu
90048888Scael.Bl -tag -width ".Ev PRINTER ) ) ," -compact -offset 14n
90148888Scael.It Li \&.Ev DISPLAY
90243435Scael.Ev  DISPLAY
90348888Scael.It Li \&.Ev PATH\ .
90443435Scael.Ev PATH .
90548888Scael.It Li \&.Ev PRINTER\ )\ )\ ,
90643435Scael.Ev PRINTER ) ) ,
90748888Scael.El
90843435Scael.Pp
90943435ScaelIt is an error to call
91048888Scael.Ql \&.Ev
91143435Scaelwithout arguments.
91248888ScaelThe
91348888Scael.Ql \&.Ev
91450785Scaelmacro is parsed and is callable.
91548888Scael.Ss Function Argument
91648888ScaelThe
91748888Scael.Ql \&.Fa
91848888Scaelmacro is used to refer to function arguments (parameters)
91950772Scaeloutside of the
92050772Scael.Sx SYNOPSIS
92150772Scaelsection of the manual or inside
92250772Scaelthe
92350772Scael.Sx SYNOPSIS
92450772Scaelsection should a parameter list be too
92548888Scaellong for the
92648888Scael.Ql \&.Fn
92748888Scaelmacro and the enclosure macros
92848888Scael.Ql \&.Fo
92948888Scaeland
93048888Scael.Ql \&.Fc
93148888Scaelmust be used.
93248888Scael.Ql \&.Fa
93348888Scaelmay also be used to refer to structure members.
93448888Scael.Pp
93548888Scael.Dl Usage: .Fa function_argument ... \*(Pu
93648888Scael.Bl -tag -width ".Fa d_namlen\ )\ )\ ," -compact -offset 14n
93748888Scael.It Li \&.Fa d_namlen\ )\ )\ ,
93848888Scael.Fa d_namlen ) ) ,
93948888Scael.It Li \&.Fa iov_len
94048888Scael.Fa iov_len
94148888Scael.El
94248888Scael.Pp
94348888ScaelIt is an error to call
94448888Scael.Ql \&.Fa
94548888Scaelwithout arguments.
94648888Scael.Ql \&.Fa
94750785Scaelis parsed and is callable.
94848888Scael.Ss Function Declaration
94948888ScaelThe
95048888Scael.Ql \&.Fd
95150772Scaelmacro is used in the
95250772Scael.Sx SYNOPSIS
95350772Scaelsection with section two or three
95450772Scaelfunctions.
95550772ScaelThe
95648888Scael.Ql \&.Fd
95748888Scaelmacro does not call other macros and is not callable by other
95848888Scaelmacros.
95948888Scael.Pp
96048888Scael.Dl Usage: .Fd include_file (or defined variable)
96148888Scael.Pp
96250772ScaelIn the
96350772Scael.Sx SYNOPSIS
96450772Scaelsection a
96548888Scael.Ql \&.Fd
96648888Scaelrequest causes a line break if a function has already been presented
96750772Scaeland a break has not occurred.
96850772ScaelThis leaves a nice vertical space
96948888Scaelin between the previous function call and the declaration for the
97048888Scaelnext function.
97143435Scael.Ss Flags
97243435ScaelThe
97348888Scael.Ql \&.Fl
97450772Scaelmacro handles command line flags.
97550772ScaelIt prepends
97643435Scaela dash,
97748888Scael.Ql \- ,
97850772Scaelto the flag.
97950772ScaelFor interactive command flags, which
98043435Scaelare not prepended with a dash, the
98148888Scael.Ql \&.Cm
98248888Scael(command modifier)
983*65229Smckusickmacro is identical, but without the dash.
98443435Scael.Pp
98543435Scael.Dl Usage: .Fl argument ... \*(Pu
98648888Scael.Bl -tag -width ".Fl \-s \-t \-v" -compact -offset 14n
98748888Scael.It Li \&.Fl
98843435Scael.Fl
98948888Scael.It Li \&.Fl cfv
99043435Scael.Fl cfv
99148888Scael.It Li \&.Fl cfv\ .
99243435Scael.Fl cfv .
99348888Scael.It Li \&.Fl s v t
99443435Scael.Fl s v t
99548888Scael.It Li \&.Fl -\ ,
99643435Scael.Fl - ,
99748888Scael.It Li \&.Fl xyz\ )\ ,
99843435Scael.Fl xyz ) ,
99948888Scael.El
100043435Scael.Pp
100143435ScaelThe
100248888Scael.Ql \&.Fl
100348888Scaelmacro without any arguments results
100448888Scaelin a dash representing stdin/stdout.
100543435ScaelNote that giving
100648888Scael.Ql \&.Fl
100743435Scaela single dash, will result in two dashes.
100848888ScaelThe
100948888Scael.Ql \&.Fl
101050785Scaelmacro is parsed and is callable.
101143435Scael.Ss Functions (library routines)
101248888ScaelThe .Fn macro is modeled on ANSI C conventions.
101348888Scael.Bd -literal
101450772ScaelUsage: .Fn [type] function [[type] parameters ... \*(Pu]
101548888Scael.Ed
101650362Scael.Bl -tag -width ".Fn .int align. .const * char *sptrsxx" -compact
101748888Scael.It Li "\&.Fn getchar"
101843435Scael.Fn getchar
101948888Scael.It Li "\&.Fn strlen ) ,"
102043435Scael.Fn strlen ) ,
102148888Scael.It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
102248888Scael.Fn "int align" "const * char *sptrs" ,
102348888Scael.El
102443435Scael.Pp
102543435ScaelIt is an error to call
102648888Scael.Ql \&.Fn
102743435Scaelwithout any arguments.
102848888ScaelThe
102948888Scael.Ql \&.Fn
103048888Scaelmacro
103150772Scaelis parsed and is callable,
103248888Scaelnote that any call to another macro signals the end of
103348888Scaelthe
103448888Scael.Ql \&.Fn
103550772Scaelcall (it will close-parenthesis at that point).
103648888Scael.Pp
103750772ScaelFor functions that have more than eight parameters (and this
103850772Scaelis rare), the
103950772Scaelmacros
104050772Scael.Ql \&.Fo
104150772Scael(function open)
104250772Scaeland
104350772Scael.Ql \&.Fc
104450772Scael(function close)
104550772Scaelmay be used with
104650772Scael.Ql \&.Fa
104750772Scael(function argument)
104850772Scaelto get around the limitation. For example:
104950772Scael.Bd -literal -offset indent
105050772Scael\&.Fo "int res_mkquery"
105150772Scael\&.Fa "int op"
105250772Scael\&.Fa "char *dname"
105350772Scael\&.Fa "int class"
105450772Scael\&.Fa "int type"
105550772Scael\&.Fa "char *data"
105650772Scael\&.Fa "int datalen"
105750772Scael\&.Fa "struct rrec *newrr"
105850772Scael\&.Fa "char *buf"
105950772Scael\&.Fa "int buflen"
106050772Scael\&.Fc
106150772Scael.Ed
106250772Scael.Pp
106350772ScaelProduces:
106450772Scael.Bd -filled -offset indent
106550772Scael.Fo "int res_mkquery"
106650772Scael.Fa "int op"
106750772Scael.Fa "char *dname"
106850772Scael.Fa "int class"
106950772Scael.Fa "int type"
107050772Scael.Fa "char *data"
107150772Scael.Fa "int datalen"
107250772Scael.Fa "struct rrec *newrr"
107350772Scael.Fa "char *buf"
107450772Scael.Fa "int buflen"
107550772Scael.Fc
107650772Scael.Ed
107750772Scael.Pp
107850772ScaelThe
107950772Scael.Ql \&.Fo
108050772Scaeland
108150772Scael.Ql \&.Fc
108250772Scaelmacros are parsed and are callable.
108350772ScaelIn the
108450772Scael.Sx SYNOPSIS
108550772Scaelsection, the function will always begin at
108650772Scaelthe beginning of line.
108750772ScaelIf there is more than one function
108850772Scaelpresented in the
108950772Scael.Sx SYNOPSIS
109050772Scaelsection and a function type has not been
109148888Scaelgiven, a line break will occur, leaving a nice vertical space
109248888Scaelbetween the current function name and the one prior.
109343435ScaelAt the moment,
109448888Scael.Ql \&.Fn
109543435Scaeldoes not check its word boundaries
109648888Scaelagainst troff line lengths and may split across a newline
109750772Scaelungracefully.
109850772ScaelThis will be fixed in the near future.
109948888Scael.Ss Function Type
110050772ScaelThis macro is intended for the
110150772Scael.Sx SYNOPSIS
110250772Scaelsection.
110350772ScaelIt may be used
110450772Scaelanywhere else in the man page without problems, but its main purpose
110550772Scaelis to present the function type in kernel normal form for the
110650772Scael.Sx SYNOPSIS
110748888Scaelof sections two and three
110848888Scael(it causes a page break allowing the function name to appear
110948888Scaelon the next line).
111048888Scael.Pp
111148888Scael.Dl Usage: .Ft type ... \*(Pu
111248888Scael.Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
111348888Scael.It Li \&.Ft struct stat
111448888Scael.Ft struct stat
111548888Scael.El
111648888Scael.Pp
111743435ScaelThe
111848888Scael.Ql \&.Ft
111948888Scaelrequest is not callable by other macros.
112048888Scael.Ss Interactive Commands
112148888ScaelThe
112248888Scael.Ql \&.Ic
112348888Scaelmacro designates an interactive or internal command.
112448888Scael.Pp
112548888Scael.Dl Usage: .Li argument ... \*(Pu
112650785Scael.Bl -tag -width ".Ic setenv , unsetenvxx" -compact -offset 14n
112748888Scael.It Li \&.Ic :wq
112848888Scael.Ic :wq
112948888Scael.It Li \&.Ic do while {...}
113048888Scael.Ic do while {...}
113148888Scael.It Li \&.Ic setenv\ , unsetenv
113248888Scael.Ic setenv , unsetenv
113348888Scael.El
113448888Scael.Pp
113548888ScaelIt is an error to call
113648888Scael.Ql \&.Ic
113748888Scaelwithout arguments.
113848888ScaelThe
113948888Scael.Ql \&.Ic
114050785Scaelmacro is parsed and is callable.
114143435Scael.Ss Literals
114243435ScaelThe
114348888Scael.Ql \&.Li
114448888Scaelliteral macro may be used for special characters,
114543435Scaelvariable constants, anything which should be displayed as it
114643435Scaelwould be typed.
114743435Scael.Pp
114843435Scael.Dl Usage: .Li argument ... \*(Pu
114948888Scael.Bl -tag -width ".Li cntrl-D ) ,"  -compact -offset 14n
115048888Scael.It Li \&.Li \een
115143435Scael.Li \en
115248888Scael.It Li \&.Li M1 M2 M3\ ;
115343435Scael.Li M1 M2 M3 ;
115448888Scael.It Li \&.Li cntrl-D\ )\ ,
115543435Scael.Li cntrl-D ) ,
115648888Scael.It Li \&.Li 1024\ ...
115743435Scael.Li 1024 ...
115848888Scael.El
115943435Scael.Pp
116043435ScaelThe
116148888Scael.Ql \&.Li
116250785Scaelmacro is parsed and is callable.
116348888Scael.Ss Name Macro
116448888ScaelThe
116548888Scael.Ql \&.Nm
116648888Scaelmacro is used for the document title or subject name.
116748888ScaelIt has the peculiarity of remembering the first
116843435Scaelargument it was called with, which should
116950772Scaelalways be the subject name of the page.
117050772ScaelWhen called without
117143435Scaelarguments,
117248888Scael.Ql \&.Nm
117343435Scaelregurgitates this initial name for the sole purpose
117443435Scaelof making less work for the author.
117548888ScaelNote:
117648888Scaela section two
117743435Scaelor three document function name is addressed with the
117848888Scael.Ql \&.Nm
117950772Scaelin the
118050772Scael.Sx NAME
118150772Scaelsection, and with
118248888Scael.Ql \&.Fn
118350772Scaelin the
118450772Scael.Sx SYNOPSIS
118548888Scaeland remaining sections.
118643435ScaelFor interactive commands, such as the
118748888Scael.Ql while
118843435Scaelcommand keyword in
118943435Scael.Xr csh 1 ,
119043435Scaelthe
119148888Scael.Ql \&.Ic
119248888Scaelmacro should be used.
119343435ScaelWhile the
119448888Scael.Ql \&.Ic
119543435Scaelis nearly identical
119643435Scaelto
119748888Scael.Ql \&.Nm ,
119843435Scaelit can not recall the first argument it was invoked with.
119943435Scael.Pp
120043435Scael.Dl Usage: .Nm argument ... \*(Pu
120148888Scael.Bl -tag -width ".Nm mdoc.sample" -compact -offset 14n
120248888Scael.It Li \&.Nm mdoc.sample
120343435Scael.Nm  mdoc.sample
120450785Scael.It Li \&.Nm \e-mdoc
120543435Scael.Nm \-mdoc .
120648888Scael.It Li \&.Nm foo\ )\ )\ ,
120743435Scael.Nm foo ) ) ,
120848888Scael.It Li \&.Nm
120943435Scael.Nm
121048888Scael.El
121143435Scael.Pp
121243435ScaelThe
121348888Scael.Ql \&.Nm
121450785Scaelmacro is parsed and is callable.
121548888Scael.Ss Options
121648888ScaelThe
121748888Scael.Ql \&.Op
121848888Scaelmacro
121948888Scaelplaces option brackets around the any remaining arguments on the command
122048888Scaelline, and places any
122150772Scaeltrailing punctuation outside the brackets.
122250772ScaelThe macros
122348888Scael.Ql \&.Oc
122448888Scaeland
122548888Scael.Ql \&.Oo
122648888Scaelmay be used across one or more lines.
122748888Scael.Pp
122848888Scael.Dl Usage: .Op options ... \*(Pu
122948888Scael.Bl -tag -width ".Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
123048888Scael.It Li \&.Op
123148888Scael.Op
123248888Scael.It Li ".Op Fl k"
123348888Scael.Op Fl k
123448888Scael.It Li ".Op Fl k ) ."
123548888Scael.Op Fl k ) .
123648888Scael.It Li ".Op Fl k Ar kookfile"
123748888Scael.Op Fl k Ar kookfile
123848888Scael.It Li ".Op Fl k Ar kookfile ,"
123948888Scael.Op Fl k Ar kookfile ,
124048888Scael.It Li ".Op Ar objfil Op Ar corfil"
124148888Scael.Op Ar objfil Op Ar corfil
124248888Scael.It Li ".Op Fl c Ar objfil Op Ar corfil ,"
124348888Scael.Op Fl c Ar objfil Op Ar corfil ,
124448888Scael.It Li \&.Op word1 word2
124548888Scael.Op word1 word2
124648888Scael.El
124748888Scael.Pp
124848888ScaelThe
124948888Scael.Ql \&.Oc
125048888Scaeland
125148888Scael.Ql \&.Oo
125248888Scaelmacros:
125348888Scael.Bd -literal -offset indent
125448888Scael\&.Oo
125548888Scael\&.Op \&Fl k \&Ar kilobytes
125648888Scael\&.Op \&Fl i \&Ar interval
125748888Scael\&.Op \&Fl c \&Ar count
125848888Scael\&.Oc
125948888Scael.Ed
126048888Scael.Pp
126148888ScaelProduce:
126248888Scael.Oo
126348888Scael.Op Fl k Ar kilobytes
126448888Scael.Op Fl i Ar interval
126548888Scael.Op Fl c Ar count
126648888Scael.Oc
126748888Scael.Pp
126848888ScaelThe macros
126948888Scael.Ql \&.Op ,
127048888Scael.Ql \&.Oc
127148888Scaeland
127248888Scael.Ql \&.Oo
127350785Scaelare parsed and are callable.
127443435Scael.Ss Pathnames
127543435ScaelThe
127648888Scael.Ql \&.Pa
127748888Scaelmacro formats path or file names.
127843435Scael.Pp
127943435Scael.Dl Usage: .Pa pathname \*(Pu
128048888Scael.Bl -tag -width ".Pa /tmp/fooXXXXX ) ." -compact -offset 14n
128148888Scael.It Li \&.Pa /usr/share
128243435Scael.Pa /usr/share
128348888Scael.It Li \&.Pa /tmp/fooXXXXX\ )\ .
128443435Scael.Pa /tmp/fooXXXXX ) .
128548888Scael.El
128643435Scael.Pp
128748888ScaelThe
128848888Scael.Ql \&.Pa
128950785Scaelmacro is parsed and is callable.
129050772Scael.Ss Variables
129150772ScaelGeneric variable reference:
129250772Scael.Pp
129350772Scael.Dl Usage: .Va variable ... \*(Pu
129450772Scael.Bl -tag -width ".Va char s ] ) ) ," -compact -offset 14n
129550772Scael.It Li \&.Va count
129650772Scael.Va count
129750772Scael.It Li \&.Va settimer ,
129850772Scael.Va settimer ,
129950772Scael.It Li \&.Va int\ *prt\ )\ :
130050772Scael.Va int\ *prt ) :
130150772Scael.It Li \&.Va char\ s\ ]\ )\ )\ ,
130250772Scael.Va char\ s ] ) ) ,
130350772Scael.El
130450772Scael.Pp
130550772ScaelIt is an error to call
130650772Scael.Ql \&.Va
130750772Scaelwithout any arguments.
130848888ScaelThe
130950772Scael.Ql \&.Va
131050785Scaelmacro is parsed and is callable.
131150772Scael.Ss Manual Page Cross References
131250772ScaelThe
131350772Scael.Ql \&.Xr
131450772Scaelmacro expects the first argument to be
131550772Scaela manual page name, and the second argument, if it exists,
131650772Scaelto be either a section page number or punctuation.
131750772ScaelAny
131850772Scaelremaining arguments are assumed to be punctuation.
131948888Scael.Pp
132050772Scael.Dl Usage: .Xr man_page [1,...,8] \*(Pu
132150772Scael.Bl -tag -width ".Xr mdoc 7 ) ) ," -compact -offset 14n
132250772Scael.It Li \&.Xr mdoc
132350772Scael.Xr mdoc
132450772Scael.It Li \&.Xr mdoc\ ,
132550772Scael.Xr mdoc ,
132650772Scael.It Li \&.Xr mdoc 7
132750772Scael.Xr mdoc 7
132850772Scael.It Li \&.Xr mdoc 7\ )\ )\ ,
132950772Scael.Xr mdoc 7 ) ) ,
133050772Scael.El
133150772Scael.Pp
133250772ScaelThe
133350772Scael.Ql \&.Xr
133450785Scaelmacro is parsed and is callable.
133550772ScaelIt is an error to call
133650772Scael.Ql \&.Xr
133750772Scaelwithout
133850772Scaelany arguments.
133950772Scael.Sh GENERAL TEXT DOMAIN
134050772Scael.Ss AT&T Macro
134150772Scael.Bd -literal -offset indent -compact
134250772ScaelUsage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu
134350772Scael.Ed
134450772Scael.Bl -tag -width ".At v6 ) ," -compact -offset 14n
134550772Scael.It Li ".At"
134650772Scael.At
134750772Scael.It Li ".At v6 ."
134850772Scael.At v6 .
134950772Scael.El
135050772Scael.Pp
135150772ScaelThe
135250772Scael.Ql \&.At
135350772Scaelmacro is
135450772Scael.Em not
135550772Scaelparsed and
135650772Scael.Em not
135750772Scaelcallable. It accepts at most two arguments.
135850772Scael.Ss BSD Macro
135950772Scael.Dl Usage: .Bx [Version/release] ... \*(Pu
136050772Scael.Bl -tag -width ".Bx 4.3 ) ," -compact -offset 14n
136150772Scael.It Li ".Bx"
136250772Scael.Bx
136350772Scael.It Li ".Bx 4.3 ."
136450772Scael.Bx 4.3 .
136550772Scael.El
136650772Scael.Pp
136750772ScaelThe
136850772Scael.Ql \&.Bx
136950772Scaelmacro is parsed and is callable.
137050772Scael.Ss UNIX Macro
137150772Scael.Dl Usage: .Ux ... \*(Pu
137250772Scael.Bl -tag -width ".Ux 4.3 ) ," -compact -offset 14n
137350772Scael.It Li ".Ux"
137450772Scael.Ux
137550772Scael.El
137650772Scael.Pp
137750772ScaelThe
137850772Scael.Ql \&.Ux
137950772Scaelmacro is parsed and is callable.
138050772Scael.Ss Emphasis Macro
138150772ScaelText may be stressed or emphasized with the
138250772Scael.Ql \&.Em
138350772Scaelmacro.
138450772ScaelThe usual font for emphasis is italic.
138550772Scael.Pp
138650772Scael.Dl Usage: .Em argument ... \*(Pu
138750772Scael.Bl -tag -width ".Em vide infra ) ) ," -compact -offset 14n
138850772Scael.It Li ".Em does not"
138950772Scael.Em does not
139050772Scael.It Li ".Em exceed 1024 ."
139150772Scael.Em exceed 1024 .
139250772Scael.It Li ".Em vide infra ) ) ,"
139350772Scael.Em vide infra ) ) ,
139450772Scael.El
139550772Scael.\" .Pp
139650785Scael.\" The emphasis can be forced across several lines of text by using
139750785Scael.\" the
139850785Scael.\" .Ql \&.Bf
139950785Scael.\" macro discussed in
140050785Scael.\" .Sx Modes
140150785Scael.\" under
140250785Scael.\" .Sx PAGE STRUCTURE DOMAIN .
140350785Scael.\" .Pp
140450785Scael.\" .Bf -emphasis
140550772Scael.\" We are certain the reason most people desire a Harvard MBA
140650772Scael.\" so they can become to be successful philanthropists.  Only
140750772Scael.\" mathematicians and physicists go to graduate school strictly
140850772Scael.\" to acquire infinite wealthy and fame. Its that inifinity
140950772Scael.\" word that does it to them. Ruins them.
141050785Scael.\" .Ef
141150772Scael.Pp
141250772ScaelThe
141350772Scael.Ql \&.Em
141450785Scaelmacro is parsed and is callable.
141550772ScaelIt is an error to call
141650772Scael.Ql \&.Em
141750772Scaelwithout arguments.
141850772Scael.Ss Enclosure and Quoting Macros
141950772ScaelThe concept of enclosure is similar to quoting.
142050772ScaelThe object being to enclose one or more strings between
142150772Scaela pair of characters like quotes or parentheses.
142250772ScaelThe terms quoting and enclosure are used
142350772Scaelinterchangeably throughout this document.
142450772ScaelMost of the
142550772Scaelone line enclosure macros end
1426*65229Smckusickin small letter
142750772Scael.Ql q
142850772Scaelto give a hint of quoting, but there are a few irregularities.
142950772ScaelFor each enclosure macro
143050772Scaelthere is also a pair of open and close macros which end
143150772Scaelin small letters
143250772Scael.Ql o
143350772Scaeland
143450772Scael.Ql c
143550772Scaelrespectively.
143650772ScaelThese can be used across one or more lines of text
143750772Scaeland while they have nesting limitations, the one line quote macros
143850772Scaelcan be used inside
143950772Scaelof them.
144050772Scael.Pp
144150785Scael.ne 5
144250772Scael.Bd -filled -offset indent
144350772Scael.Bl -column "quote " "close " "open " "Enclose Stringx(in XX) " XXstringXX
144450772Scael.Em " Quote	 Close	 Open	Function	Result"
144550772Scael\&.Aq	.Ac	.Ao	Angle Bracket Enclosure	<string>
144650772Scael\&.Bq	.Bc	.Bo	Bracket Enclosure	[string]
144750772Scael\&.Dq	.Dc	.Do	Double Quote	``string''
144850772Scael	.Ec	.Eo	Enclose String (in XX)	XXstringXX
144950772Scael\&.Pq	.Pc	.Po	Parenthesis Enclosure	(string)
145050772Scael\&.Ql			Quoted Literal	`st' or string
145150772Scael\&.Qq	.Qc	.Qo	Straight Double Quote	"string"
145250772Scael\&.Sq	.Sc	.So	Single Quote	`string'
145350772Scael.El
145450772Scael.Ed
145550772Scael.Pp
145650785ScaelExcept for the irregular macros noted below, all
145750772Scaelof the quoting macros are parsed and callable.
145850772ScaelAll handle punctuation properly, as long as it
145950772Scaelis presented one character at a time and separated by spaces.
146050772ScaelThe quoting macros examine opening and closing punctuation
146150772Scaelto determine whether it comes before or after the
146250772Scaelenclosing string. This makes some nesting possible.
146350772Scael.Bl -tag -width xxx,xxxx
146450772Scael.It Li \&.Ec , \&.Eo
146550772ScaelThese macros expect the first argument to be the
146650772Scaelopening and closing strings respectively.
146750772Scael.It Li \&.Ql
146850772ScaelThe quoted literal macro behaves differently for
146950772Scael.Xr troff
147050772Scaelthan
147150772Scael.Xr nroff .
147250772ScaelIf formatted with
147350772Scael.Xr nroff ,
147450772Scaela quoted literal is always quoted. If formatted with
147550772Scaeltroff, an item is only quoted if the width
147650772Scaelof the item is less than three constant width characters.
147750772ScaelThis is to make short strings more visible where the font change
147850772Scaelto literal (constant width) is less noticeable.
147950772Scael.It Li \&.Pf
148050772ScaelThe prefix macro is not callable, but it is parsed:
148150785Scael.Bl -tag -width "(namexx" -offset indent
148250785Scael.It Li ".Pf ( Fa name2"
148348888Scaelbecomes
148450772Scael.Pf ( Fa name2 .
148550785Scael.El
148650785Scael.Pp
148750772ScaelThe
148850772Scael.Ql \&.Ns
148950772Scael(no space) macro performs the analogous suffix function.
149048888Scael.El
149148888Scael.Pp
149250772Scael.ne 4
149350772ScaelExamples of quoting:
149450772Scael.Bl -tag -width ".Aq Pa ctype.h ) ,xxxxxxxx" -compact -offset indent
149550772Scael.It Li \&.Aq
149650772Scael.Aq
149750772Scael.It Li \&.Aq \&Ar ctype.h\ )\ ,
149850772Scael.Aq Ar ctype.h ) ,
149950772Scael.It Li \&.Bq
150050772Scael.Bq
150150772Scael.It Li \&.Bq \&Em Greek \&, French \&.
150250772Scael.Bq Em Greek , French .
150350772Scael.It Li \&.Dq
150450772Scael.Dq
150550772Scael.It Li ".Dq string abc ."
150650772Scael.Dq string abc .
150750772Scael.It Li ".Dq \'^[A-Z]\'"
150850772Scael.Dq \'^[A-Z]\'
150950772Scael.It Li "\&.Ql man mdoc"
151050772Scael.Ql man mdoc
151150772Scael.It Li \&.Qq
151250772Scael.Qq
151350772Scael.It Li "\&.Qq string ) ,"
151450772Scael.Qq string ) ,
151550785Scael.It Li "\&.Qq string Ns ),"
151650785Scael.Qq string Ns ),
151750772Scael.It Li \&.Sq
151850772Scael.Sq
151950772Scael.It Li "\&.Sq string
152050772Scael.Sq string
152150772Scael.El
152250772Scael.Pp
152350772ScaelFor a good example of nested enclosure macros, see the
152450772Scael.Ql \&.Op
152550772Scaeloption macro.
152650772ScaelIt was created from the same
152750772Scaelunderlying enclosure macros as those presented in the list
152850772Scaelabove.
152948888ScaelThe
153050772Scael.Ql \&.Xo
153150772Scaeland
153250772Scael.Ql \&.Xc
153350772Scaelextended argument list macros
153450772Scaelwere also built from the same underlying routines and are a good
153550772Scaelexample of
153650772Scael.Nm \-mdoc
153750772Scaelmacro usage at its worst.
153850772Scael.Ss No\-Op or Normal Text Macro
153950772ScaelThe macro
154050772Scael.Li \&.No
154150772Scaelis
154250772Scaela hack for words in a macro command line which should
154350772Scael.Em not
154450772Scaelbe formatted and follows the conventional syntax
154550772Scaelfor content macros.
154650772Scael.Ss No Space Macro
154750772ScaelThe
154848888Scael.Ql \&.Ns
154950772Scaelmacro eliminates unwanted spaces in between macro requests.
155050772ScaelIt is useful for old style argument lists where there is no space
155150772Scaelbetween the flag and argument:
155250772Scael.Bl -tag -width ".Op Fl I Ns Ar directoryxx" -offset indent
155350772Scael.It Li ".Op Fl I Ns Ar directory"
155450772Scaelproduces
155550772Scael.Op Fl I Ns Ar directory
155650772Scael.El
155750772Scael.Pp
155850772ScaelNote: the
155950772Scael.Ql \&.Ns
156050772Scaelmacro always invokes the
156150772Scael.Ql \&.No
156250772Scaelmacro after eliminating the space unless another macro name
156350772Scaelfollows it.
156450772ScaelThe macro
156550772Scael.Ql \&.Ns
156650785Scaelis parsed and is callable.
156748888Scael.Ss Section Cross References
156848888ScaelThe
156948888Scael.Ql \&.Sx
157048888Scaelmacro designates a reference to a section header
157150772Scaelwithin the same document.
157250785ScaelIt is parsed and is callable.
157348888Scael.Pp
157448888Scael.Bl -tag -width "Li \&.Sx FILES" -offset 14n
157548888Scael.It Li \&.Sx FILES
157648888Scael.Sx FILES
157748888Scael.El
157850772Scael.Ss Symbolic
157950772ScaelThe symbolic emphasis macro is generally a boldface macro in
158050772Scaeleither the symbolic sense or the traditional English usage.
158150772Scael.Pp
158250772Scael.Dl Usage: .Sy symbol ... \*(Pu
158350772Scael.Bl -tag -width ".Sy Important Noticex" -compact -offset 14n
158450772Scael.It Li \&.Sy Important Notice
158550772Scael.Sy Important Notice
158650772Scael.El
158750772Scael.Pp
158850772ScaelThe
158950772Scael.Ql \&.Sy
159050785Scaelmacro is parsed and is callable.
159150772ScaelArguments to
159250772Scael.Ql \&.Sy
159350772Scaelmay be quoted.
159448888Scael.Ss References and Citations
159548888ScaelThe following macros make a modest attempt to handle references.
159650772ScaelAt best, the macros make it convenient to manually drop in a subset of
159748888Scaelrefer style references.
159848888Scael.Pp
159948888Scael.Bl -tag -width 6n -offset indent -compact
160048888Scael.It Li ".Rs"
160150772ScaelReference Start.
160250772ScaelCauses a line break and begins collection
160348888Scaelof reference information until the
160448888Scaelreference end macro is read.
160548888Scael.It Li ".Re"
160650772ScaelReference End.
160750772ScaelThe reference is printed.
160848888Scael.It Li ".%A"
160948888ScaelReference author name, one name per invocation.
161048888Scael.It Li ".%B"
161148888ScaelBook title.
161250772Scael.It Li ".\&%C"
161350772ScaelCity/place.
161450772Scael.It Li ".\&%D"
161550772ScaelDate.
161648888Scael.It Li ".%J"
161750772ScaelJournal name.
161848888Scael.It Li ".%N"
161948888ScaelIssue number.
162048888Scael.It Li ".%O"
162148888ScaelOptional information.
162250772Scael.It Li ".%P"
162350772ScaelPage number.
162448888Scael.It Li ".%R"
162548888ScaelReport name.
162648888Scael.It Li ".%T"
162748888ScaelTitle of article.
162848888Scael.It Li ".%V"
162948888ScaelVolume(s).
163048888Scael.El
163148888Scael.Pp
163250772ScaelThe macros beginning with
163348888Scael.Ql %
163450772Scaelare not callable, and are parsed only for the trade name macro which
163550772Scaelreturns to its caller.
163650772Scael(And not very predictably at the moment either.)
163750772ScaelThe purpose is to allow trade names
163850785Scaelto be pretty printed in
163950785Scael.Xr troff Ns / Ns Xr ditroff
164050785Scaeloutput.
164150772Scael.Ss Trade Names (or Acronyms and Type Names)
164250772ScaelThe trade name macro is generally a small caps macro for
164350772Scaelall upper case words longer than two characters.
164443435Scael.Pp
164550772Scael.Dl Usage: .Tn symbol ... \*(Pu
164650772Scael.Bl -tag -width ".Tn ASCII" -compact -offset 14n
164750772Scael.It Li \&.Tn DEC
164850772Scael.Tn DEC
164950772Scael.It Li \&.Tn ASCII
165050772Scael.Tn ASCII
165148888Scael.El
165243435Scael.Pp
165343435ScaelThe
165450772Scael.Ql \&.Tn
165548888Scaelmacro
165650772Scaelis parsed and is callable by other macros.
165748888Scael.Ss Extended  Arguments
165848888ScaelThe
165948888Scael.Li \&.Xo
166048888Scaeland
166148888Scael.Li \&.Xc
166250772Scaelmacros allow one to extend an argument list
166350772Scaelon a macro boundary.
166450772ScaelArgument lists cannot
166548888Scaelbe extended within a macro
166648888Scaelwhich expects all of its arguments on one line such
166748888Scaelas
166848888Scael.Ql \&.Op .
166950772Scael.Pp
167050772ScaelHere is an example of
167150772Scael.Ql \&.Xo
167250772Scaelusing the space mode macro to turn spacing off:
167350772Scael.Bd -literal -offset indent
167450772Scael\&.Sm off
167550772Scael\&.It Xo Sy I Ar operation
167650785Scael\&.No \een Ar count No \een
167750772Scael\&.Xc
167850772Scael\&.Sm on
167950772Scael.Ed
168050772Scael.Pp
168150772ScaelProduces
168250772Scael.Bd -filled -offset indent
168350772Scael.Bl -tag -width flag -compact
168450772Scael.Sm off
168550772Scael.It Xo Sy I Ar operation
168650772Scael.No \en Ar count No \en
168750772Scael.Xc
168850772Scael.Sm on
168950772Scael.El
169050772Scael.Ed
169150772Scael.Pp
169250772ScaelAnother one:
169350772Scael.Bd -literal -offset indent
169450772Scael\&.Sm off
169550772Scael\&.It Cm S No \&/ Ar old_pattern Xo
169650772Scael\&.No \&/ Ar new_pattern
169750772Scael\&.No \&/ Op Cm g
169850772Scael\&.Xc
169950772Scael\&.Sm on
170050772Scael.Ed
170150772Scael.Pp
170250772ScaelProduces
170350772Scael.Bd -filled -offset indent
170450772Scael.Bl -tag -width flag -compact
170550772Scael.Sm off
170650772Scael.It Cm S No \&/ Ar old_pattern Xo
170750772Scael.No \&/ Ar new_pattern
170850772Scael.No \&/ Op Cm g
170950772Scael.Xc
171050772Scael.Sm on
171150772Scael.El
171250772Scael.Ed
171350772Scael.Pp
171450772ScaelAnother example of
171550772Scael.Ql \&.Xo
171650772Scaeland using enclosure macros:
171750772ScaelTest the value of an variable.
171850772Scael.Bd -literal -offset indent
171950772Scael\&.It Xo
172050772Scael\&.Ic .ifndef
172150772Scael\&.Oo \e&! Oc Ns Ar variable
172250772Scael\&.Op Ar operator variable ...
172350772Scael\&.Xc
172450772Scael.Ed
172550772Scael.Pp
172650772ScaelProduces
172750772Scael.Bd -filled -offset indent
172850772Scael.Bl -tag -width flag -compact
172950772Scael.It Xo
173050772Scael.Ic .ifndef
173150772Scael.Oo \&! Oc Ns Ar variable
173250772Scael.Op Ar operator variable ...
173350772Scael.Xc
173450772Scael.El
173550772Scael.Ed
173650772Scael.Pp
173750772ScaelAll of the above examples have used the
173850772Scael.Ql \&.Xo
173950772Scaelmacro on the argument list of the
174050772Scael.Ql \&.It
174150772Scael(list-item)
174250772Scaelmacro.
174350772ScaelThe extend macros are not used very often, and when they are
174450772Scaelit is usually to extend the list-item argument list.
174550772ScaelUnfortunately, this is also where the extend macros are the
174650772Scaelmost finicky.
174750772ScaelIn the first two examples, spacing was turned off;
174850772Scaelin the third, spacing was desired in part of the output but
174950772Scaelnot all of it.
175050772ScaelTo make these macros work in this situation make sure
175150772Scaelthe
175250772Scael.Ql \&.Xo
175350772Scaeland
175450772Scael.Ql \&.Xc
175550772Scaelmacros are placed as shown in the third example.
175650772ScaelIf the
175750772Scael.Ql \&.Xo
175850772Scaelmacro is not alone on the
175950772Scael.Ql \&.It
176050772Scaelargument list, spacing will be unpredictable.
176150772ScaelThe
176250772Scael.Ql \&.Ns
176350772Scael(no space macro)
176450772Scaelmust not occur as the first or last macro on a line
176550772Scaelin this situation.
176650785ScaelOut of 900 manual pages (about 1500 actual pages)
176750772Scaelcurrently released with
176850772Scael.Bx
176950772Scaelonly fifteen use the
177050772Scael.Ql \&.Xo
177150772Scaelmacro.
177250772Scael.Sh PAGE STRUCTURE DOMAIN
177343435Scael.Ss Section Headers
177448888ScaelThe first three
177548888Scael.Ql \&.Sh
177648888Scaelsection header macros
177748888Scaellist below are required in every
177850772Scaelman page.
177950772ScaelThe remaining section headers
178050772Scaelare recommended at the discretion of the author
178150772Scaelwriting the manual page.
178250772ScaelThe
178348888Scael.Ql \&.Sh
178450772Scaelmacro can take up to nine arguments.
178550785ScaelIt is parsed and but is not callable.
178648888Scael.Bl -tag -width ".Sh SYNOPSIS"
178748888Scael.It \&.Sh NAME
178843435ScaelThe
178948888Scael.Ql \&.Sh NAME
179050772Scaelmacro is mandatory.
179150772ScaelIf not specified,
179243435Scaelthe headers, footers and page layout defaults
179343435Scaelwill not be set and things will be rather unpleasant.
179450772ScaelThe
179550772Scael.Sx NAME
179650772Scaelsection consists of at least three items.
179743435ScaelThe first is the
179848888Scael.Ql \&.Nm
179948888Scaelname macro naming the subject of the man page.
180048888ScaelThe second is the Name Description macro,
180148888Scael.Ql \&.Nd ,
180243435Scaelwhich separates the subject
180350772Scaelname from the third item, which is the description.
180450772ScaelThe
180543435Scaeldescription should be the most terse and lucid possible,
180643435Scaelas the space available is small.
180748888Scael.It \&.Sh SYNOPSIS
180850772ScaelThe
180950772Scael.Sx SYNOPSIS
181050772Scaelsection describes the typical usage of the
181150772Scaelsubject of a man page.
181250772ScaelThe  macros required
181343435Scaelare either
181448888Scael.Ql ".Nm" ,
181548888Scael.Ql ".Cd" ,
181650772Scael.Ql ".Fn" ,
181748888Scael(and possibly
181850772Scael.Ql ".Fo" ,
181950772Scael.Ql ".Fc" ,
182048888Scael.Ql ".Fd" ,
182148888Scael.Ql ".Ft"
182248888Scaelmacros).
182343435ScaelThe function name
182448888Scaelmacro
182548888Scael.Ql ".Fn"
182643435Scaelis required
182743435Scaelfor manual page sections 2 and 3, the command and general
182848888Scaelname macro
182948888Scael.Ql \&.Nm
183048888Scaelis required for sections 1, 5, 6, 7, 8.
183148888ScaelSection 4 manuals require a
183248888Scael.Ql ".Nm" , ".Fd"
183348888Scaelor a
183448888Scael.Ql ".Cd"
183548888Scaelconfiguration device usage macro.
183648888ScaelSeveral other macros may be necessary to produce
183743435Scaelthe synopsis line as shown below:
183843435Scael.Pp
183948888Scael.Bd -filled -offset indent
184043435Scael.Nm cat
184143435Scael.Op Fl benstuv
184243435Scael.Op Fl
184343435Scael.Ar
184448888Scael.Ed
184543435Scael.Pp
184648888ScaelThe following macros were used:
184743435Scael.Pp
184843435Scael.Dl \&.Nm cat
184948888Scael.Dl \&.Op \&Fl benstuv
185048888Scael.Dl \&.Op \&Fl
185143435Scael.Dl \&.Ar
185250785Scael.Pp
185350772Scael.Sy Note :
185450772ScaelThe macros
185550772Scael.Ql \&.Op ,
185650772Scael.Ql \&.Fl ,
185750772Scaeland
185850772Scael.Ql \&.Ar
185950772Scaelrecognize the pipe bar character
186050785Scael.Ql \*(Ba ,
186150785Scaelso a command line such as:
186250772Scael.Pp
186350772Scael.Dl ".Op Fl a | Fl b"
186450772Scael.Pp
186550785Scaelwill not go orbital.
186650772Scael.Xr Troff
186750772Scaelnormally interprets a \*(Ba as a special operator.
186850772ScaelSee
186950772Scael.Sx PREDEFINED STRINGS
187050772Scaelfor a usable \*(Ba
187150772Scaelcharacter in other situations.
187248888Scael.It \&.Sh DESCRIPTION
187350772ScaelIn most cases the first text in the
187450772Scael.Sx DESCRIPTION
187550772Scaelsection
187643435Scaelis a brief paragraph on the command, function or file,
187743435Scaelfollowed by a lexical list of options and respective
187850772Scaelexplanations.
187950772ScaelTo create such a list, the
188048888Scael.Ql \&.Bl
188148888Scaelbegin-list,
188248888Scael.Ql \&.It
188348888Scaellist-item and
188448888Scael.Ql \&.El
188548888Scaelend-list
188648888Scaelmacros are used (see
188748888Scael.Sx Lists and Columns
188848888Scaelbelow).
188948888Scael.El
189043435Scael.Pp
189143435ScaelThe following
189248888Scael.Ql \&.Sh
189343435Scaelsection headers are part of the
189443435Scaelpreferred manual page layout and must be used appropriately
189550772Scaelto maintain consistency.
189650772ScaelThey are listed in the order
189743435Scaelin which they would be used.
189848888Scael.Bl -tag -width SYNOPSIS
189948888Scael.It \&.Sh ENVIRONMENT
190050772ScaelThe
190150772Scael.Sx ENVIRONMENT
190250772Scaelsection should reveal any related
190343435Scaelenvironment
190450772Scaelvariables and clues to their behavior and/or usage.
190548888Scael.It \&.Sh EXAMPLES
190650772ScaelThere are several ways to create examples.
190750772ScaelSee
190850772Scaelthe
190950772Scael.Sx EXAMPLES
191050772Scaelsection below
191143435Scaelfor details.
191248888Scael.It \&.Sh FILES
191343435ScaelFiles which are used or created by the man page subject
191443435Scaelshould be listed via the
191548888Scael.Ql \&.Pa
191650772Scaelmacro in the
191750772Scael.Sx FILES
191850772Scaelsection.
191948888Scael.It \&.Sh SEE ALSO
192043435ScaelReferences to other material on the man page topic and
192143435Scaelcross references to other relevant man pages should
192250772Scaelbe placed in the
192350772Scael.Sx SEE ALSO
192450772Scaelsection.
192550772ScaelCross references
192643435Scaelare specified using the
192748888Scael.Ql \&.Xr
192850772Scaelmacro.
192950772ScaelAt this time
193043435Scael.Xr refer 1
193143435Scaelstyle references are not accommodated.
193248888Scael.It \&.Sh STANDARDS
193343435ScaelIf the command, library function or file adheres to a
193450772Scaelspecific implementation such as
193550772Scael.St -p1003.2
193650772Scaelor
193750772Scael.St -ansiC
193850772Scaelthis should be noted here.
193950772ScaelIf the
194043435Scaelcommand does not adhere to any standard, its history
194150772Scaelshould be noted in the
194250772Scael.Sx HISTORY
194350772Scaelsection.
194448888Scael.It \&.Sh HISTORY
194543435ScaelAny command which does not adhere to any specific standards
194643435Scaelshould be outlined historically in this section.
194748888Scael.It \&.Sh AUTHORS
194843435ScaelCredits, if need be, should be placed here.
194948888Scael.It \&.Sh DIAGNOSTICS
195043435ScaelDiagnostics from a command should be placed in this section.
195148888Scael.It \&.Sh ERRORS
195243435ScaelSpecific error handling, especially from library functions
195350772Scael(man page sections 2 and 3) should go here.
195450772ScaelThe
195548888Scael.Ql \&.Er
195648888Scaelmacro is used to specify an errno.
195748888Scael.It \&.Sh BUGS
195843435ScaelBlatant problems with the topic go here...
195948888Scael.El
196043435Scael.Pp
196148888ScaelUser specified
196248888Scael.Ql \&.Sh
196348888Scaelsections may be added,
196448888Scaelfor example, this section was set with:
196548888Scael.Bd -literal -offset 14n
196648888Scael\&.Sh PAGE LAYOUT MACROS
196748888Scael.Ed
196843435Scael.Ss Paragraphs and Line Spacing.
196948888Scael.Bl -tag -width 6n
197048888Scael.It \&.Pp
197143435ScaelThe \&.Pp paragraph command may
197243435Scaelbe used to specify a line space where necessary.
197348888ScaelThe macro is not necessary after a
197448888Scael.Ql \&.Sh
197543435Scaelor
197648888Scael.Ql \&.Ss
197748888Scaelmacro or before
197843435Scaela
197948888Scael.Ql \&.Bl
198048888Scaelmacro.
198148888Scael(The
198248888Scael.Ql \&.Bl
198348888Scaelmacro asserts a vertical distance unless the -compact flag is given).
198448888Scael.El
198550772Scael.\" This worked with version one, need to redo for version three
198648888Scael.\" .Pp
198748888Scael.\" .Ds I
198848888Scael.\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
198948888Scael.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
199048888Scael.\" .Cl Cx \t\t
199148888Scael.\" .Li \&.Cx\ (
199248888Scael.\" .Cx
199348888Scael.\" .Cl Cx \t\t
199448888Scael.\" .Li \&.Va ax
199548888Scael.\" .Cx
199648888Scael.\" .Cl Cx \t\t
199748888Scael.\" .Li \&.Sy \+
199848888Scael.\" .Cx
199948888Scael.\" .Cl Cx \&(\&
200048888Scael.\" .Va ax
200148888Scael.\" .Cx +
200248888Scael.\" .Va by
200348888Scael.\" .Cx +
200448888Scael.\" .Va c )
200548888Scael.\" .Cx \t
200648888Scael.\" .Em is produced by
200748888Scael.\" .Cx \t
200848888Scael.\" .Li \&.Va by
200948888Scael.\" .Cx
201048888Scael.\" .Cl Cx \t\t
201148888Scael.\" .Li \&.Sy \+
201248888Scael.\" .Cx
201348888Scael.\" .Cl Cx \t\t
201448888Scael.\" .Li \&.Va c )
201548888Scael.\" .Cx
201648888Scael.\" .Cl Cx \t\t
201748888Scael.\" .Li \&.Cx
201848888Scael.\" .Cx
201948888Scael.\" .Cw
202048888Scael.\" .De
202148888Scael.\" .Pp
202250772Scael.\" This example shows the same equation in a different format.
202350772Scael.\" The spaces
202448888Scael.\" around the
202548888Scael.\" .Li \&+
202648888Scael.\" signs were forced with
202748888Scael.\" .Li \e :
202848888Scael.\" .Pp
202948888Scael.\" .Ds I
203048888Scael.\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
203148888Scael.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
203248888Scael.\" .Cl Cx \t\t
203348888Scael.\" .Li \&.Cx\ (
203448888Scael.\" .Cx
203548888Scael.\" .Cl Cx \t\t
203648888Scael.\" .Li \&.Va a
203748888Scael.\" .Cx
203848888Scael.\" .Cl Cx \t\t
203948888Scael.\" .Li \&.Sy x
204048888Scael.\" .Cx
204148888Scael.\" .Cl Cx \t\t
204248888Scael.\" .Li \&.Cx \e\ +\e\ \e&
204348888Scael.\" .Cx
204448888Scael.\" .Cl Cx \&(\&
204548888Scael.\" .Va a
204648888Scael.\" .Sy x
204748888Scael.\" .Cx \ +\ \&
204848888Scael.\" .Va b
204948888Scael.\" .Sy y
205048888Scael.\" .Cx \ +\ \&
205148888Scael.\" .Va c )
205248888Scael.\" .Cx \t
205348888Scael.\" .Em is produced by
205448888Scael.\" .Cl Cx \t\t
205548888Scael.\" .Li \&.Va b
205648888Scael.\" .Cx
205748888Scael.\" .Cl Cx \t\t
205848888Scael.\" .Li \&.Sy y
205948888Scael.\" .Cx
206048888Scael.\" .Cl Cx \t\t
206148888Scael.\" .Li \&.Cx \e\ +\e\ \e&
206248888Scael.\" .Cx
206348888Scael.\" .Cl Cx \t\t
206448888Scael.\" .Li \&.Va c )
206548888Scael.\" .Cx
206648888Scael.\" .Cl Cx \t\t
206748888Scael.\" .Li \&.Cx
206848888Scael.\" .Cx
206948888Scael.\" .Cw
207048888Scael.\" .De
207148888Scael.\" .Pp
207248888Scael.\" The incantation below was
207348888Scael.\" lifted from the
207448888Scael.\" .Xr adb 1
207548888Scael.\" manual page:
207648888Scael.\" .Pp
207748888Scael.\" .Ds I
207848888Scael.\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
207948888Scael.\" .Cl Cx \t\t
208048888Scael.\" .Li \&.Cx Op Sy ?/
208148888Scael.\" .Cx
208248888Scael.\" .Cl Cx \t\t
208348888Scael.\" .Li \&.Nm m
208448888Scael.\" .Cx
208548888Scael.\" .Cl Cx Op Sy ?/
208648888Scael.\" .Nm m
208748888Scael.\" .Ad \ b1 e1 f1
208848888Scael.\" .Op Sy ?/
208948888Scael.\" .Cx \t
209048888Scael.\" .Em is produced by
209148888Scael.\" .Cx \t
209248888Scael.\" .Li \&.Ar \e\ b1 e1 f1
209348888Scael.\" .Cx
209448888Scael.\" .Cl Cx \t\t
209548888Scael.\" .Li \&.Op Sy ?/
209648888Scael.\" .Cx
209748888Scael.\" .Cl Cx \t\t
209848888Scael.\" .Li \&.Cx
209948888Scael.\" .Cx
210048888Scael.\" .Cw
210148888Scael.\" .De
210248888Scael.\" .Pp
210350772Scael.Ss Keeps
210450772ScaelThe only keep that is implemented at this time is for words.
210550772ScaelThe macros are
210650772Scael.Ql \&.Bk
210750772Scael(begin-keep)
210850772Scaeland
210950772Scael.Ql \&.Ek
211050772Scael(end-keep).
211150772ScaelThe only option that
211250772Scael.Ql \&.Bl
211350772Scaelaccepts is
211450772Scael.Fl words
211550772Scaeland is useful for preventing line breaks in the middle of options.
211650772ScaelIn the example for the make command line arguments (see
211750772Scael.Sx What's in a name ) ,
211850772Scaelthe keep prevented
211950772Scael.Xr nroff
212050772Scaelfrom placing up the
212150772Scaelflag and the argument
212250772Scaelon separate lines.
212350772Scael(Actually, the option macro used to prevent this from occurring,
212450772Scaelbut was dropped when the decision (religious) was made to force
212550772Scaelright justified margins in
212650772Scael.Xr troff
212750772Scaelas options in general look atrocious when spread across a sparse
212850772Scaelline.
212950772ScaelMore work needs to be done with the keep macros, a
213050772Scael.Fl line
213150772Scaeloption needs to be added.)
213248888Scael.Ss Examples and Displays
213348888ScaelThere are five types of displays, a quickie one line indented display
213448888Scael.Ql \&.D1 ,
213548888Scaela quickie one line literal display
213648888Scael.Ql \&.Dl ,
213750772Scaeland a block literal, block filled and block ragged which use
213848888Scaelthe
213948888Scael.Ql \&.Bd
214048888Scaelbegin-display
214148888Scaeland
214248888Scael.Ql \&.Ed
214348888Scaelend-display macros.
214443435Scael.Pp
214550772Scael.Bl -tag -width \&.Dlxx
214648888Scael.It Li \&.D1
214748888Scael(D-one) Display one line of indented text.
214850772ScaelThis macro is parsed, but it is not callable.
214943435Scael.Pp
215050772Scael.Dl Fl ldghfstru
215143435Scael.Pp
215250772ScaelThe above was produced by:
215350772Scael.Li \&.Dl Fl ldghfstru .
215448888Scael.It Li \&.Dl
215548888Scael(D-ell)
215648888ScaelDisplay one line of indented
215748888Scael.Em literal
215850772Scaeltext.
215950772ScaelThe
216048888Scael.Ql \&.Dl
216148888Scaelexample macro has been used throughout this
216250772Scaelfile.
216350772ScaelIt allows
216448888Scaelthe indent (display) of one line of text.
216548888ScaelIts default font is set to
216648888Scaelconstant width (literal) however
216750772Scaelit is parsed and will recognized other macros.
216850772ScaelIt is not callable however.
216943435Scael.Pp
217050772Scael.Dl % ls -ldg /usr/local/bin
217148888Scael.Pp
217250772ScaelThe above was produced by
217350772Scael.Li \&.Dl % ls -ldg /usr/local/bin .
217448888Scael.It Li \&.Bd
217550772ScaelBegin-display.
217650772ScaelThe
217748888Scael.Ql \&.Bd
217848888Scaeldisplay must be ended with the
217948888Scael.Ql \&.Ed
218050772Scaelmacro.
218150772ScaelDisplays may be nested within displays and
218248888Scaellists.
218348888Scael.Ql \&.Bd
218448888Scaelhas the following syntax:
218543435Scael.Pp
218650772Scael.Dl ".Bd display-type [-offset offset_value] [-compact]"
218743435Scael.Pp
218848888ScaelThe display-type must be one of the following four types and
218948888Scaelmay have an offset specifier for indentation:
219048888Scael.Ql \&.Bd .
219143435Scael.Pp
219250772Scael.Bl -tag -width "file file_name  " -compact
219348888Scael.It Fl ragged
219443435ScaelDisplay a block of text as typed,
219548888Scaelright (and left) margin edges are left ragged.
219648888Scael.It Fl filled
219748888ScaelDisplay a filled (formatted) block.
219848888ScaelThe block of text is formatted (the edges are filled \-
219950772Scaelnot left unjustified).
220048888Scael.It Fl literal
220148888ScaelDisplay a literal block, useful for source code or
220248888Scaelsimple tabbed or spaced text.
220348888Scael.It Fl file Ar file_name
220448888ScaelThe file name following the
220548888Scael.Fl file
220650772Scaelflag is read and displayed.
220750772ScaelLiteral mode is
220848888Scaelasserted and tabs are set at 8 constant width character
220948888Scaelintervals, however any
221048888Scael.Xr troff/ Ns Nm \-mdoc
221148888Scaelcommands in file will be processed.
221248888Scael.It Fl offset Ar string
221348888ScaelIf
221448888Scael.Fl offset
221548888Scaelis specified with one of the following strings, the string
221648888Scaelis interpreted to indicate the level of indentation for the
221748888Scaelforthcoming block of text:
221848888Scael.Pp
221950772Scael.Bl -tag -width "indent-two" -compact
222048888Scael.It Ar left
222143435ScaelAlign block on the current left margin,
222243435Scaelthis is the default mode of
222348888Scael.Ql \&.Bd .
222448888Scael.It Ar center
222550772ScaelSupposedly center the block.
222650772ScaelAt this time
222743435Scaelunfortunately, the block merely gets
222843435Scaelleft aligned about an imaginary center margin.
222948888Scael.It Ar indent
223050772ScaelIndents by one default indent value or tab.
223150772ScaelThe default
223248888Scaelindent value is also used for the
223348888Scael.Ql \&.D1
223450772Scaeldisplay so one is guaranteed the two types of displays
223550772Scaelwill line up.
223650772ScaelThis indent is normally set to 6n or about two
223748888Scaelthirds of an inch (six constant width characters).
223848888Scael.It Ar indent-two
223948888ScaelIndents two times the default indent value.
224048888Scael.It Ar right
224148888ScaelThis
224248888Scael.Em left
224348888Scaelaligns the block about two inches from
224450772Scaelthe right side of the page.
224550772ScaelThis macro needs
224650772Scaelwork and perhaps may never do the right thing by
224748888Scael.Xr troff .
224848888Scael.El
224948888Scael.El
225048888Scael.It ".Ed"
225148888ScaelEnd-display.
225248888Scael.El
225348888Scael.Ss Tagged Lists and Columns
225448888ScaelThere are several types of lists which may be initiated with the
225548888Scael.Ql ".Bl"
225650772Scaelbegin-list macro.
225750772ScaelItems within the list
225848888Scaelare specified with the
225948888Scael.Ql ".It"
226048888Scaelitem macro and
226148888Scaeleach list must end with the
226248888Scael.Ql ".El"
226350772Scaelmacro.
226450772ScaelLists may be nested within themselves and within displays.
226548888ScaelColumns may be used inside of lists, but lists are unproven
226648888Scaelinside of columns.
226743435Scael.Pp
226848888ScaelIn addition, several list attributes may be specified such as
226950785Scaelthe width of a tag, the list offset, and compactness
227048888Scael(blank lines between items allowed or disallowed).
227150772ScaelMost of this document has been formatted with a tag style list
227250772Scael.Pq Fl tag .
227350772ScaelFor a change of pace, the list-type used to present the list-types
227450772Scaelis an over-hanging list
227550772Scael.Pq Fl ohang .
227650772ScaelThis type of list is quite popular with
227750772Scael.Tn TeX
227850785Scaelusers, but might look a bit funny after having read many pages of
227950772Scaeltagged lists.
228048888ScaelThe following list types are accepted by
228150772Scael.Ql ".Bl" :
228243435Scael.Pp
228348888Scael.Bl -ohang -compact
228448888Scael.It Fl bullet
228548888Scael.It Fl item
228648888Scael.It Fl enum
228750772ScaelThese three are the simplest types of lists.
228850772ScaelOnce the
228948888Scael.Ql ".Bl"
229048888Scaelmacro has been given, items in the list are merely
229148888Scaelindicated by a line consisting solely of the
229248888Scael.Ql ".It"
229350772Scaelmacro.
229450772ScaelFor example, the source text for a simple enumerated list
229548888Scaelwould look like:
229648888Scael.Bd -literal -offset indent-two
229748888Scael\&.Bl -enum -compact
229848888Scael\&.It
229948888Scael\&Item one goes here.
230048888Scael\&.It
230148888Scael\&And item two here.
230248888Scael\&.It
230348888Scael\&Lastly item three goes here.
230448888Scael\&.El
230548888Scael.Ed
230643435Scael.Pp
230748888ScaelThe results:
230843435Scael.Pp
230948888Scael.Bl -enum -offset indent-two -compact
231048888Scael.It
231148888ScaelItem one goes here.
231248888Scael.It
231348888ScaelAnd item two here.
231448888Scael.It
231548888ScaelLastly item three goes here.
231648888Scael.El
231743435Scael.Pp
231848888ScaelA simple bullet list construction:
231948888Scael.Bd -literal -offset indent-two
232048888Scael\&.Bl -bullet -compact
232148888Scael\&.It
232248888Scael\&Bullet one goes here.
232348888Scael\&.It
232448888Scael\&Bullet two here.
232548888Scael\&.El
232648888Scael.Ed
232743435Scael.Pp
232848888ScaelProduces:
232948888Scael.Bl -bullet -offset indent-two -compact
233048888Scael.It
233148888ScaelBullet one goes here.
233248888Scael.It
233348888ScaelBullet two here.
233448888Scael.El
233543435Scael.Pp
233648888Scael.It Fl tag
233748888Scael.It Fl diag
233848888Scael.It Fl hang
233948888Scael.It Fl ohang
234048888Scael.It Fl inset
234148888ScaelThese list-types collect arguments specified with the
234248888Scael.Ql \&.It
234348888Scaelmacro and create a label which may be
234448888Scael.Em inset
2345*65229Smckusickinto the forthcoming text,
234648888Scael.Em hanged
2347*65229Smckusickfrom the forthcoming text,
234848888Scael.Em overhanged
234950785Scaelfrom above and not indented or
235050772Scael.Em tagged .
235150772ScaelThis
235248888Scaellist was constructed with the
235348888Scael.Ql Fl ohang
235450772Scaellist-type.
235550772ScaelThe
235648888Scael.Ql \&.It
235750785Scaelmacro is parsed only for the inset, hang
235850785Scaeland tag list-types and is not callable.
235948888ScaelHere is an example of inset labels:
236048888Scael.Bl -inset -offset indent
236148888Scael.It Em Tag
236248888ScaelThe tagged list (also called a tagged paragraph) is the
236348888Scaelmost common type of list used in the Berkeley manuals.
236448888Scael.It Em Diag
236548888ScaelDiag lists create section four diagnostic lists
236648888Scaeland are similar to inset lists except callable
236748888Scaelmacros are ignored.
236848888Scael.It Em Hang
236948888ScaelHanged labels are a matter of taste.
237048888Scael.It Em Ohang
2371*65229SmckusickOverhanging labels are nice when space is constrained.
237248888Scael.It Em Inset
237348888ScaelInset labels are useful for controlling blocks of
237448888Scaelparagraphs and are valuable for converting
237548888Scael.Nm \-mdoc
237648888Scaelmanuals to other formats.
237748888Scael.El
237843435Scael.Pp
237948888ScaelHere is the source text which produced the above example:
238048888Scael.Bd -literal -offset indent
238148888Scael\&.Bl -inset -offset indent
238248888Scael\&.It Em Tag
238348888Scael\&The tagged list (also called a tagged paragraph) is the
238448888Scael\&most common type of list used in the Berkeley manuals.
238548888Scael\&.It Em Diag
238648888Scael\&Diag lists create section four diagnostic lists
238748888Scael\&and are similar to inset lists except callable
238848888Scael\&macros are ignored.
238948888Scael\&.It Em Hang
239048888Scael\&Hanged labels are a matter of taste.
239148888Scael\&.It Em Ohang
2392*65229Smckusick\&Overhanging labels are nice when space is constrained.
239348888Scael\&.It Em Inset
239448888Scael\&Inset labels are useful for controlling blocks of
239548888Scael\&paragraphs and are valuable for converting
239648888Scael\&.Nm \-mdoc
239748888Scael\&manuals to other formats.
239848888Scael\&.El
239948888Scael.Ed
240043435Scael.Pp
240148888ScaelHere is a hanged list with just one item:
240248888Scael.Bl -hang -offset indent
240348888Scael.It Em Hanged
240448888Scaellabels appear similar to tagged lists when the
240548888Scaellabel is smaller than the label width.
240648888Scael.It Em Longer hanged list labels
240748888Scaelblend in to the paragraph unlike
240848888Scaeltagged paragraph labels.
240948888Scael.El
241043435Scael.Pp
241150772ScaelAnd the unformatted text which created it:
241248888Scael.Bd -literal -offset indent
241348888Scael\&.Bl -hang -offset indent
241448888Scael\&.It Em Hanged
241548888Scael\&labels appear similar to tagged lists when the
241648888Scael\&label is smaller than the label width.
241748888Scael\&.It Em Longer hanged list labels
241848888Scael\&blend in to the paragraph unlike
241948888Scael\&tagged paragraph labels.
242048888Scael\&.El
242148888Scael.Ed
242248888Scael.Pp
242350772ScaelThe tagged list which follows uses an optional width specifier to control
242448888Scaelthe width of the tag.
242548888Scael.Pp
242650785Scael.Bl -tag -width "PAGEIN" -compact -offset indent
242750785Scael.It SL
242843435Scaelsleep time of the process (seconds blocked)
242950785Scael.It PAGEIN
243050785Scaelnumber of disk
243150785Scael.Tn I/O Ns 's
243250785Scaelresulting from references
243348888Scaelby the process to pages not loaded in core.
243450785Scael.It UID
243543435Scaelnumerical user-id of process owner
243650785Scael.It PPID
243748888Scaelnumerical id of parent of process process priority
243848888Scael(non-positive when in non-interruptible wait)
243948888Scael.El
244043435Scael.Pp
244143435ScaelThe raw text:
244248888Scael.Bd -literal -offset indent
244350785Scael\&.Bl -tag -width "PAGEIN" -compact -offset indent
244450785Scael\&.It SL
244548888Scael\&sleep time of the process (seconds blocked)
244650785Scael\&.It PAGEIN
244750785Scael\&number of disk
244850785Scael\&.Tn I/O Ns 's
244950785Scael\&resulting from references
245048888Scael\&by the process to pages not loaded in core.
245150785Scael\&.It UID
245248888Scael\&numerical user-id of process owner
245350785Scael\&.It PPID
245448888Scael\&numerical id of parent of process process priority
245548888Scael\&(non-positive when in non-interruptible wait)
245648888Scael\&.El
245748888Scael.Ed
245843435Scael.Pp
245948888ScaelAcceptable width specifiers:
246048888Scael.Bl -tag -width Ar -offset indent
246148888Scael.It Fl width Ar "\&Fl"
246250772Scaelsets the width to the default width for a flag.
246350772ScaelAll callable
246450772Scaelmacros have a default width value.
246550772ScaelThe
246648888Scael.Ql \&.Fl ,
246748888Scaelvalue is presently
246848888Scaelset to ten constant width characters or about five sixth of
246948888Scaelan inch.
247048888Scael.It Fl width Ar "24n"
247148888Scaelsets the width to 24 constant width characters or about two
247250772Scaelinches.
247350772ScaelThe
247448888Scael.Ql n
247548888Scaelis absolutely necessary for the scaling to work correctly.
247648888Scael.It Fl width Ar "ENAMETOOLONG"
247748888Scaelsets width to the constant width length of the
247848888Scaelstring given.
247948888Scael.It Fl width  Ar "\\*qint mkfifo\\*q"
248048888Scaelagain, the width is set to the constant width of the string
248148888Scaelgiven.
248248888Scael.El
248343435Scael.Pp
248448888ScaelIf a width is not specified for the tag list type, the first
248548888Scaeltime
248648888Scael.Ql \&.It
248748888Scaelis invoked, an attempt is made to determine an appropriate
248850772Scaelwidth.
248950772ScaelIf the first argument to
249048888Scael.Ql ".It"
249148888Scaelis a callable macro, the default width for that macro will be used
249250772Scaelas if the macro name had been supplied as the width.
249350772ScaelHowever,
249448888Scaelif another item in the list is given with a different callable
249550772Scaelmacro name, a new and nested list is assumed.
249650772Scael.Sh PREDEFINED STRINGS
249750772ScaelThe following strings are predefined as may be used by
249850772Scaelpreceding with the troff string interpreting sequence
249950772Scael.Ql \&\e*(xx
250050772Scaelwhere
250150772Scael.Em xx
250250772Scaelis the name of the defined string or as
250350772Scael.Ql \&\e*x
250450772Scaelwhere
250550772Scael.Em x
250650772Scaelis the name of the string.
250750772ScaelThe interpreting sequence may be used any where in the text.
250850772Scael.Pp
250950772Scael.Bl -column "String " "Nroff " "Troff " -offset indent
251050772Scael.It Sy "String	Nroff	Troff"
251150772Scael.It Li "<=" Ta \&<\&= Ta \*(<=
251250772Scael.It Li ">=" Ta \&>\&= Ta \*(>=
251350772Scael.It Li "Rq" Ta "''" Ta \*(Rq
251450772Scael.It Li "Lq" Ta "``" Ta \*(Lq
251550772Scael.It Li "ua" Ta ^ Ta \*(ua
251650772Scael.It Li "aa" Ta ' Ta \*(aa
251750772Scael.It Li "ga" Ta \` Ta \*(ga
251850772Scael.\" .It Li "sL" Ta ` Ta \*(sL
251950772Scael.\" .It Li "sR" Ta ' Ta \*(sR
252050772Scael.It Li "q" Ta \&" Ta \*q
252150772Scael.It Li "Pi" Ta pi Ta \*(Pi
252250772Scael.It Li "Ne" Ta != Ta \*(Ne
252350772Scael.It Li "Le" Ta <= Ta \*(Le
252450772Scael.It Li "Ge" Ta >= Ta \*(Ge
252550772Scael.It Li "Lt" Ta < Ta \*(Gt
252650772Scael.It Li "Gt" Ta > Ta \*(Lt
252750772Scael.It Li "Pm" Ta +- Ta \*(Pm
252850772Scael.It Li "If" Ta infinity Ta \*(If
252950772Scael.It Li "Na" Ta \fINaN\fP Ta \*(Na
253050772Scael.It Li "Ba" Ta \fR\&|\fP Ta \*(Ba
253150772Scael.El
253250772Scael.Pp
253350772Scael.Sy Note :
253450772ScaelThe string named
253550772Scael.Ql q
253650772Scaelshould be written as
253750785Scael.Ql \e*q
253850785Scaelsince it is only one char.
253948888Scael.Sh DIAGNOSTICS
254048888ScaelThe debugging facilities for
254148888Scael.Nm \-mdoc
254248888Scaelare limited, but can help detect subtle errors such
254348888Scaelas the collision of an argument name with an internal
254450772Scaelregister or macro name.
254550772Scael(A what?)
254648888ScaelA register is an arithmetic storage class for
254748888Scael.Xr troff
254848888Scaelwith a one or two character name.
254948888ScaelAll registers internal to
255048888Scael.Nm \-mdoc
255148888Scaelfor
255248888Scael.Xr troff
255348888Scaeland
255448888Scael.Xr ditroff
255548888Scaelare two characters and
255650772Scaelof the form <upper_case><lower_case> such as
255748888Scael.Ql \&Ar ,
255850772Scael<lower_case><upper_case> as
255948888Scael.Ql \&aR
256043435Scaelor
256148888Scael<upper or lower letter><digit> as
256248888Scael.Ql \&C\&1 .
256348888ScaelAnd adding to the muddle,
256448888Scael.Xr troff
256548888Scaelhas its own internal registers all of which are either
256650772Scaeltwo lower case characters or a dot plus a letter or meta-character
256748888Scaelcharacter.
256848888ScaelIn one of the introduction examples, it was shown how to
256948888Scaelprevent the interpretation of a macro name with the escape sequence
257048888Scael.Ql \e& .
257148888ScaelThis is sufficient for the internal register names also.
257243435Scael.Pp
257348888Scael.\" Every callable macro name has a corresponding register
257450772Scael.\" of the same name (<upper_case><lower_case>).
257548888Scael.\" There are also specific registers which have
257648888Scael.\" been used for stacks and arrays and are listed in the
257748888Scael.\" .Sx Appendix .
257848888Scael.\" .Bd -ragged -offset 4n
257948888Scael.\" [A-Z][a-z]	registers corresponding to macro names (example ``Ar'')
258048888Scael.\" [a-z][A-Z]	registers corresponding to macro names (example ``aR'')
258148888Scael.\" C[0-9]		argument types (example C1)
258248888Scael.\" O[0-9]		offset stack (displays)
258348888Scael.\" h[0-9]		horizontal spacing stack (lists)
258448888Scael.\" o[0-9]		offset (stack) (lists)
258548888Scael.\" t[0-9]		tag stack (lists)
258648888Scael.\" v[0-9]		vertical spacing stack (lists)
258748888Scael.\" w[0-9]		width tag/label stack
258848888Scael.\" .Ed
258948888Scael.\" .Pp
259048888ScaelIf a non-escaped register name is given in the argument list of a request
259150772Scaelunpredictable behavior will occur.
259250772ScaelIn general, any time huge portions
259348888Scaelof text do not appear where expected in the output, or small strings
259448888Scaelsuch as list tags disappear, chances are there is a misunderstanding
259548888Scaelabout an argument type in the argument list.
259648888ScaelYour mother never intended for you to remember this evil stuff - so here
259748888Scaelis a way to find out whether or not your arguments are valid: The
259848888Scael.Ql \&.Db
259948888Scael(debug)
260048888Scaelmacro displays the interpretation of the argument list for most
260150772Scaelmacros.
260250772ScaelMacros such as the
260348888Scael.Ql \&.Pp
260448888Scael(paragraph)
260550772Scaelmacro do not contain debugging information.
260650772ScaelAll of the callable macros do,
260748888Scaeland it is strongly advised whenever in doubt,
260848888Scaelturn on the
260948888Scael.Ql \&.Db
261048888Scaelmacro.
261143435Scael.Pp
261248888Scael.Dl Usage: \&.Db [on | off]
261343435Scael.Pp
261448888ScaelAn example of a portion of text with
261548888Scaelthe debug macro placed above and below an
261648888Scaelartificially created problem (a flag argument
261748888Scael.Ql \&aC
261848888Scaelwhich should be
261948888Scael.Ql \e&aC
262048888Scaelin order to work):
262148888Scael.Bd -literal -offset indent
262248888Scael\&.Db on
262348888Scael\&.Op Fl aC Ar file )
262448888Scael\&.Db off
262548888Scael.Ed
262643435Scael.Pp
262748888ScaelThe resulting output:
262848888Scael.Bd -literal -offset indent
262948888ScaelDEBUGGING ON
263048888ScaelDEBUG(argv) MACRO: `.Op'  Line #: 2
263148888Scael	Argc: 1  Argv: `Fl'  Length: 2
263248888Scael	Space: `'  Class: Executable
263348888Scael	Argc: 2  Argv: `aC'  Length: 2
263448888Scael	Space: `'  Class: Executable
263548888Scael	Argc: 3  Argv: `Ar'  Length: 2
263648888Scael	Space: `'  Class: Executable
263748888Scael	Argc: 4  Argv: `file'  Length: 4
263848888Scael	Space: ` '  Class: String
263948888Scael	Argc: 5  Argv: `)'  Length: 1
264048888Scael	Space: ` '  Class: Closing Punctuation or suffix
264148888Scael	MACRO REQUEST: .Op Fl aC Ar file )
264248888ScaelDEBUGGING OFF
264348888Scael.Ed
264443435Scael.Pp
264548888ScaelThe first line of information tells the name of the calling
264648888Scaelmacro, here
264748888Scael.Ql \&.Op ,
264850772Scaeland the line number it appears on.
264950772ScaelIf one or more files are involved
265048888Scael(especially if text from another file is included) the line number
265150772Scaelmay be bogus.
265250772ScaelIf there is only one file, it should be accurate.
265348888ScaelThe second line gives the argument count, the argument
265448888Scael.Pq Ql \&Fl
265550772Scaeland its length.
265650772ScaelIf the length of an argument is two characters, the
265748888Scaelargument is tested to see if it is executable (unfortunately, any
265848888Scaelregister which contains a non-zero value appears executable).
265948888ScaelThe third line gives the space allotted for a class, and the
266050772Scaelclass type.
266150772ScaelThe problem here is the argument aC should not be
266250772Scaelexecutable.
266350772ScaelThe four types of classes are string, executable, closing
266450772Scaelpunctuation and opening punctuation.
266550772ScaelThe last line shows the entire
266650772Scaelargument list as it was read.
266750772ScaelIn this next example, the offending
266848888Scael.Ql \&aC
266948888Scaelis escaped:
267048888Scael.Bd -literal -offset indent
267148888Scael\&.Db on
267248888Scael\&.Em An escaped \e&aC
267348888Scael\&.Db off
267448888Scael.Ed
267548888Scael.Bd -literal -offset indent
267648888ScaelDEBUGGING ON
267748888ScaelDEBUG(fargv) MACRO: `.Em'  Line #: 2
267848888Scael	Argc: 1  Argv: `An'  Length: 2
267948888Scael	Space: ` '  Class: String
268048888Scael	Argc: 2  Argv: `escaped'  Length: 7
268148888Scael	Space: ` '  Class: String
268248888Scael	Argc: 3  Argv: `aC'  Length: 2
268348888Scael	Space: ` '  Class: String
268448888Scael	MACRO REQUEST: .Em An escaped &aC
268548888ScaelDEBUGGING OFF
268648888Scael.Ed
268743435Scael.Pp
268848888ScaelThe argument
268948888Scael.Ql \e&aC
269048888Scaelshows up with the same length of 2 as the
269148888Scael.Ql \e&
269248888Scaelsequence produces a zero width, but a register
269348888Scaelnamed
269448888Scael.Ql \e&aC
269548888Scaelwas not found and the type classified as string.
269648888Scael.Pp
269748888ScaelOther diagnostics consist of usage statements and are self explanatory.
269850785Scael.Sh GROFF, TROFF AND NROFF
269950785ScaelThe
270050785Scael.Nm \-mdoc
270150785Scaelpackage does not need compatibility mode with
270250785Scael.Xr groff .
270350785Scael.Pp
270450785ScaelThe package inhibits page breaks, and the headers and footers
270550785Scaelwhich normally occur at those breaks with
270650785Scael.Xr nroff ,
270750785Scaelto make the manual more efficient for viewing on-line.
270850785ScaelAt the moment,
270950785Scael.Xr groff
271050785Scaelwith
271150785Scael.Fl T Ns Ar ascii
271250785Scaeldoes eject the imaginary remainder of the page at end of file.
271350785ScaelThe inhibiting of the page breaks makes
271450785Scael.Xr nroff Ns 'd
271550785Scaelfiles unsuitable for hardcopy.
271650785ScaelThere is a register named
271750785Scael.Ql \&cR
271850785Scaelwhich can be set to zero in the site dependent style file
271950785Scael.Pa /usr/src/share/tmac/doc-nroff
272050785Scaelto restore the old style behavior.
272143435Scael.Sh FILES
272248888Scael.Bl -tag -width /usr/share/man0/template.doc -compact
272348888Scael.It Pa /usr/share/tmac/tmac.doc
272443435Scaelmanual macro package
272548888Scael.It Pa /usr/share/man0/template.doc
272643435Scaeltemplate for writing a man page
272748888Scael.El
272843435Scael.Sh SEE ALSO
272948888Scael.Xr mdoc 7 ,
273043435Scael.Xr man 1 ,
273143435Scael.Xr troff 1
273243435Scael.Sh BUGS
273343435ScaelUndesirable hyphenation on the dash of a flag
273443435Scaelargument is not yet resolved, and causes
273550772Scaeloccasional mishaps in the
273650772Scael.Sx DESCRIPTION
273750772Scaelsection.
273848888Scael(line break on the hyphen).
273943435Scael.Pp
274043435ScaelPredefined strings are not declared in documentation.
274143435Scael.Pp
274243435ScaelSection 3f has not been added to the header routines.
274343435Scael.Pp
274448888Scael.Ql \&.Nm
274550772Scaelfont should be changed in
274650772Scael.Sx NAME
274750772Scaelsection.
274843435Scael.Pp
274948888Scael.Ql \&.Fn
275043435Scaelneeds to have a check to prevent splitting up
275150772Scaelif the line length is too short.
275250785ScaelOccasionally it
275343435Scaelseparates the last parenthesis, and sometimes
275443435Scaellooks ridiculous if a line is in fill mode.
275543435Scael.Pp
275643435ScaelThe method used to prevent header and footer page
275743435Scaelbreaks (other than the initial header and footer) when using
275850785Scaelnroff occasionally places an unsightly partially filled line (blank)
275950785Scaelat the would be bottom of the page.
276043435Scael.Pp
276148888ScaelThe list and display macros to not do any keeps
276243435Scaeland certainly should be able to.
276350772Scael.\" Note what happens if the parameter list overlaps a newline
276450772Scael.\" boundary.
276550772Scael.\" to make sure a line boundary is crossed:
276650772Scael.\" .Bd -literal
276750772Scael.\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
276850772Scael.\" .Ed
276950772Scael.\" .Pp
277050772Scael.\" produces, nudge nudge,
277150772Scael.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
277250772Scael.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
277350772Scael.\" nudge
277450772Scael.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
277550772Scael.\" .Pp
277650772Scael.\" If double quotes are used, for example:
277750772Scael.\" .Bd -literal
277850772Scael.\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
277950772Scael.\" .Ed
278050772Scael.\" .Pp
278150772Scael.\" produces, nudge nudge,
278250772Scael.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
278350772Scael.\" nudge
278450772Scael.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
278550772Scael.\" nudge
278650772Scael.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
278750772Scael.\" .Pp
278850772Scael.\" Not a pretty sight...
278950772Scael.\" In a paragraph, a long parameter containing unpaddable spaces as
279050772Scael.\" in the former example will cause
279150772Scael.\" .Xr troff
279250772Scael.\" to break the line and spread
279350772Scael.\" the remaining words out.
279450772Scael.\" The latter example will adjust nicely to
279550772Scael.\" justified margins, but may break in between an argument and its
279650772Scael.\" declaration.
279750772Scael.\" In
279850772Scael.\" .Xr nroff
279950772Scael.\" the right margin adjustment is normally ragged and the problem is
280050772Scael.\" not as severe.
2801