xref: /csrg-svn/share/man/man7/mdoc.samples.7 (revision 48888)
143435Scael.\" Copyright (c) 1990 The Regents of the University of California.
243435Scael.\" All rights reserved.
343435Scael.\"
4*48888Scael.\" %sccs.include.redist.mdoc%
543435Scael.\"
6*48888Scael.\"     @(#)mdoc.samples.7	5.4 (Berkeley) 05/01/91
743435Scael.\"
843435Scael.\"	This sampler invokes every macro in the package several
943435Scael.\" 	times and is garanteed to give a worst case performance
10*48888Scael.\"	for an already extremely slow package.
1143435Scael.Dd
1243435Scael.Os BSD 4.4
1343435Scael.Dt MDOC.SAMPLES 7
1443435Scael.Sh NAME
1543435Scael.Nm mdoc.sample
16*48888Scael.Nd writing manual pages with
1743435Scael.Nm -mdoc
1843435Scaelmacro package
1943435Scael.Sh SYNOPSIS
2043435Scael.Nm man mdoc.sample
2143435Scael.Sh DESCRIPTION
22*48888ScaelA tutorial sampler for writing
23*48888Scael.Bx
24*48888Scaelmanual pages with the
2543435Scael.Nm \-mdoc
26*48888Scaelmacro package; a
27*48888Scael.Em content Ns \-
28*48888Scaelbased formatting
29*48888Scaelpackage for
30*48888Scael.Xr troff 1 .
31*48888ScaelIts predecessor, the
32*48888Scael.Xr \-man 7
33*48888Scaelpackage,
34*48888Scaeladdressed page structure leaving the
35*48888Scaelmanipulation of fonts and other
36*48888Scaeltypesetting details to the individual author.
37*48888ScaelThe
38*48888Scael.Nm \-mdoc
39*48888Scaelpackage
40*48888Scaelallows the author to ignore font considerations by
41*48888Scaelusing macros to label
42*48888Scaelpieces of text according to content.
43*48888ScaelIn the context of manual pages, examples of content
44*48888Scaelare a command name, a file pathname or a cross
45*48888Scaelreference to another manual page; these
46*48888Scaelitems have value
47*48888Scaelfor both the author and the future user of the manual page.
48*48888ScaelIt is hoped the consistency gained
49*48888Scaelacross the manual set will provide easier
50*48888Scaeltranslation to future documentation tools.
51*48888Scael.Pp
52*48888ScaelThrough out the
53*48888Scael.Ux
54*48888Scaelmanual pages, a manual entry
55*48888Scaelis simply referred
56*48888Scaelto as a man page, regardless of actual length and without
57*48888Scaelsexist intention.
5843435Scael.Sh TROFF IDIOSYNCRASIES
59*48888ScaelThe
60*48888Scael.Nm \-mdoc
61*48888Scaelpackage attempts to simplify the process of writing a man page.
62*48888ScaelTheoretically, one should not have to learn the dirty details of
6343435Scael.Xr troff 1
64*48888Scaelto use
65*48888Scael.Nm \-mdoc ;
66*48888Scaelhowever, there are a few
6743435Scaellimitations which are unavoidable and best gotten out
68*48888Scaelof the way. And, too, be forewarned, this package is
69*48888Scael.Em not
70*48888Scaelfast.
7143435Scael.Ss Macro Usage
7243435ScaelAs in
7343435Scael.Xr troff 1 ,
74*48888Scaela macro is called by placing a
75*48888Scael.Ql \&\.
7643435Scael(dot character)
7743435Scaelat the beginning of
7843435Scaela line followed by the two character name for the macro.
79*48888ScaelArguments may follow the macro separated by spaces.
8043435ScaelIt is the dot character at the beginning of the line which causes
8143435Scael.Xr troff 1
82*48888Scaelto interpret the next two characters as a macro name.
8343435ScaelTo place a
84*48888Scael.Ql \&\.
8543435Scael(dot character)
8643435Scaelat the beginning of a line in some context other than
87*48888Scaela macro macro, precede the
88*48888Scael.Ql \&\.
8943435Scael(dot) with a
90*48888Scael.Ql \e& .
91*48888Scael.Pp
92*48888ScaelIn general,
93*48888Scael.Xr troff 1
94*48888Scaelmacros accept up to nine arguments, any
95*48888Scaelextra arguments are ignored.
96*48888ScaelMost macros in
97*48888Scael.Nm \-mdoc
98*48888Scaelaccept nine arguments and,
99*48888Scaelin limited cases, arguments may be continued or extended
100*48888Scaelon the
101*48888Scaelnext line (See
102*48888Scael.Sx Extensions
103*48888Scael\-
104*48888Scaelmacro
105*48888Scael.Ql \&.Xo
106*48888Scaeland
107*48888Scael.Ql \&.Xc ) .
108*48888ScaelA few macros handle quoted aguments (see
109*48888Scael.Sx Passing Space Characters in an Argument
110*48888Scaelbelow).
111*48888ScaelMany
112*48888Scael.Nm \-mdoc
113*48888Scaelmacros may be given the
11443435Scaelname of another macro as an argument. In this case
11543435Scaelthe argument, although the name of a macro,
11643435Scaelis not preceded by a
117*48888Scael.Ql \&\.
11843435Scael(dot),
119*48888Scaeland is
120*48888Scael.Em called
121*48888Scaelwhen the argument is processed.
122*48888ScaelIt is in this manner that some macros are nested; for
123*48888Scaelexample
124*48888Scaelthe option macro,
125*48888Scael.Ql \&.Op ,
126*48888Scaelmay
12743435Scael.Em call
128*48888Scaelthe flag and argument macros,
129*48888Scael.Ql \&.Fl
130*48888Scaeland
131*48888Scael.Ql \&.Ar ,
132*48888Scaelto specify an optional flag with an argument:
133*48888Scael.nr D 1
134*48888Scael.Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
135*48888Scael.It Op Fl s Ar bytes
13643435Scaelis produced by
137*48888Scael.Li \&.Op \&Fl s \&Ar bytes
138*48888Scael.El
13943435Scael.Pp
140*48888ScaelTo prevent a two character
141*48888Scaelstring from being interpreted as a macro name, precede
142*48888Scaelthe string with the
143*48888Scaelescape sequence
144*48888Scael.Ql \e& :
145*48888Scael.Bl -tag -width "[\&Fl s \&Ar bytes]" -offset indent
146*48888Scael.It Op \&Fl s \&Ar bytes
147*48888Scaelis produced by
148*48888Scael.Li \&.Op \e&Fl s \e&Ar bytes
149*48888Scael.El
15043435Scael.Pp
151*48888Scael.nr D 0
152*48888ScaelHere the strings
153*48888Scael.Ql \&Fl
154*48888Scaeland
155*48888Scael.Ql \&Ar
156*48888Scaelwere not interpreted as macros.
157*48888ScaelDetails on callable macros are presented in the
158*48888Scaelsections
159*48888Scael.Sx CONTENT MACROS
160*48888Scaeland
161*48888Scael.Sx PAGE LAYOUT MACROS.
162*48888Scael.Ss Passing Space Characters in an Argument
163*48888ScaelSometimes it is desirable to give as one argument a string
164*48888Scaelcontaining one or more blank space characters. This may be necessary
165*48888Scaelto defeat the nine argument limit or to specify arguments to macros
166*48888Scaelwhich expect particular arrangement of items in the argument list.
167*48888ScaelFor example,
168*48888Scaelthe function macro
169*48888Scael.Ql \&.Fn
170*48888Scaelexpects the first argument to be the name of a function and any
171*48888Scaelremaining arguments to be function parameters. As
172*48888Scael.Tn "ANSI C"
173*48888Scaelstipulates the declaration of function parameters in the
174*48888Scaelparenthesized parameter list, each parameter is guaranteed
175*48888Scaelto be at minimum a two word string. For example,
176*48888Scael.Fa int foo .
177*48888ScaelThere are two possible ways to pass an argument which contains
178*48888Scaelan imbedded space. Unfortunately, the most convient way
179*48888Scaelof passing such a space between quotes was too expensive to implement for
180*48888Scaelall the macros. It is however, implemented for the following macros which need
181*48888Scaelit the most:
18243435Scael.Pp
183*48888Scael.Bl -tag -width 4n -offset indent -compact
184*48888Scael.It Li \&Cd
185*48888ScaelConfiguration declaration (section 4 SYNOPSIS)
186*48888Scael.It Li \&Bl
187*48888ScaelBegin list (for the width specifier).
188*48888Scael.It Li \&Em
189*48888ScaelEmphasized text.
190*48888Scael.It Li \&Fn
191*48888ScaelFunctions (sections two and four).
192*48888Scael.It Li \&It
193*48888ScaelList items.
194*48888Scael.It Li \&Li
195*48888ScaelLiteral text.
196*48888Scael.It Li \&Sy
197*48888ScaelSymbolic text.
198*48888Scael.It Li \&%B
199*48888ScaelBook titles.
200*48888Scael.It Li \&%J
201*48888ScaelJournal names.
202*48888Scael.It Li \&%O
203*48888ScaelOptional notes for a reference.
204*48888Scael.It Li \&%R
205*48888ScaelReport title (in a reference).
206*48888Scael.It Li \&%T
207*48888ScaelTitle of article in a book or journal.
208*48888Scael.El
209*48888Scael.Pp
210*48888ScaelOne way of passing a string
211*48888Scaelcontaining blank spaces is to use the hard or unpaddable space character
212*48888Scael.Ql \e\  ,
213*48888Scaelthat is, a blank space preceeded by the escape character
214*48888Scael.Ql \e .
215*48888ScaelThis method may be used with any macro but has the side effect
216*48888Scaelof interfering with the adjustment of text
217*48888Scaelover the length of a line.
218*48888Scael.Xr Troff
219*48888Scaelsees the hard space as if it were any other printable character and
220*48888Scaelcannot split the string into blank or newline separated pieces as one
221*48888Scaelwould expect. The method is useful for strings which are not expected
222*48888Scaelto overlap a line boundary. For example:
223*48888Scael.Bl -tag -width "fetch(char *str)" -offset indent
224*48888Scael.It Fn fetch char\ *str
22543435Scaelis created by
226*48888Scael.Ql \&.Fn fetch char\e *str
227*48888Scael.It Fn fetch "char *str"
228*48888Scaelcan also be created by
229*48888Scael.Ql \&.Fn fetch "\\*q*char *str\\*q"
230*48888Scael.El
231*48888Scael.Pp
232*48888ScaelIf the
233*48888Scael.Ql \e
234*48888Scaelor quotes
235*48888Scaelwere omitted,
236*48888Scael.Ql \&.Fn
237*48888Scaelwould see three arguments and
238*48888Scaelthe result would be:
239*48888Scael.Pp
240*48888Scael.Dl Fn fetch char *str
241*48888Scael.Pp
242*48888ScaelNote what happens if the parameter list overlaps a newline
243*48888Scaelboundary. For example, the next two examples are repeated several times
244*48888Scaelto make sure a line boundary is crossed:
245*48888Scael.Bd -literal
246*48888Scael\&.Fn struct\e\ dtable\e\ *dlookup struct\e\ dtable\e\ *tab[]
247*48888Scael.Ed
248*48888Scael.Pp
249*48888Scaelproduces, nudge nudge,
250*48888Scael.Fn struct\ dtable\ *dlookup char\ *h struct\ dtable\ *tab[] ,
251*48888Scael.Fn struct\ dtable\ *dlookup char\ *h struct\ dtable\ *tab[] ,
252*48888Scaelnudge
253*48888Scael.Fn struct\ dtable\ *dlookup char\ *h struct\ dtable\ *tab[] .
254*48888Scael.Pp
255*48888ScaelIf double quotes are used, for example:
256*48888Scael.Bd -literal
257*48888Scael\&.Fn \*qstruct dtable *dlookup\*q \*qchar *h\*q \*qstruct dtable *tab[]\*q
258*48888Scael.Ed
259*48888Scael.Pp
260*48888Scaelproduces, nudge nudge,
261*48888Scael.Fn "struct dtable *dlookup" "char *h" "struct dtable *tab[]" ,
262*48888Scaelnudge
263*48888Scael.Fn "struct dtable *dlookup" "char *h" "struct dtable *tab[]" ,
264*48888Scaelnudge
265*48888Scael.Fn "struct dtable *dlookup" "char *h" "struct dtable *tab[]" .
266*48888Scael.Pp
267*48888ScaelNot a pretty sight...
268*48888ScaelIn a paragraph, a long parameter containing unpaddable spaces as
269*48888Scaelin the former example will cause
270*48888Scael.Xr troff
271*48888Scaelto break the line and spread
272*48888Scaelthe remaining words out.  The latter example will adjust nicely to
273*48888Scaeljustified margins, but may break in between an argument and its
274*48888Scaeldeclaration. In
275*48888Scael.Xr nroff
276*48888Scaelthe right margin adjustment is normally ragged and the problem is
277*48888Scaelnot as severe.
278*48888Scael.Ss Trailing Blank Space Characters
279*48888Scael.Xr Troff
280*48888Scaelcan be confused by blank space characters at the end of a line. It
281*48888Scaelis wise preventative measure to globally remove all blank spaces
282*48888Scaelfrom <blank-space><end-of-line> character sequences. Should the need
283*48888Scaelarise to force a blank character at the end of a line,
284*48888Scaelit may be forced with an unpaddable space and the
285*48888Scael.Ql \e&
286*48888Scaelescape character.
287*48888ScaelFor example,
288*48888Scael.Ql string\e\ \e& .
28943435Scael.Ss Escaping Special Characters
29043435ScaelSpecial characters
29143435Scaellike the newline character
292*48888Scael.Ql \en ,
29343435Scaelare handled by replacing the
294*48888Scael.Ql \e
29543435Scaelwith
296*48888Scael.Ql \ee
29743435Scael(e.g.
298*48888Scael.Ql \een )
29943435Scaelto preserve
30043435Scaelthe backslash.
301*48888Scael.Sh THE ANATOMY OF A MAN PAGE (Getting Started)
302*48888ScaelThere are three basic groups of macros: specific header macros
303*48888Scaelcalled only once at the very beginning of
304*48888Scaeleach manual page, page layout or structure macros
305*48888Scaelwhich may be called many times, and content macros which also
306*48888Scaelmay be called many times.
307*48888ScaelThe body of a man page is easily constructed from a basic
308*48888Scaeltemplate found in the file:
309*48888Scael.Bd -literal -offset indent
310*48888Scael\&.\e" /usr/share/misc/man.tempate :
311*48888Scael\&.\e" The following six lines are required.
312*48888Scael\&.Dt DOCUMENT_TITLE [section number] [volume]
313*48888Scael\&.Os OPERATING_SYSTEM [version/release]
314*48888Scael\&.Dd Month day, year
315*48888Scael\&.Sh NAME
316*48888Scael\&.Sh SYNOPSIS
317*48888Scael\&.Sh DESCRIPTION
318*48888Scael\&.\e" The following requests should be uncommented and
319*48888Scael\&.\e" used where appropriate.  This next request is
320*48888Scael\&.\e" for sections 2 and 3 function return values only.
321*48888Scael\&.\e" .Sh RETURN VALUES
322*48888Scael\&.\e" This next request is for sections 1, 6, 7 & 8 only
323*48888Scael\&.\e" .Sh ENVIRONMENT
324*48888Scael\&.\e" .Sh FILES
325*48888Scael\&.\e" .Sh EXAMPLES
326*48888Scael\&.\e" This next request is for sections 1, 6, 7 & 8 only
327*48888Scael\&.\e"     (command return values (to shell) and
328*48888Scael\&.\e"	  fprintf/stderr type diagnostics)
329*48888Scael\&.\e" .Sh DIAGNOSTICS
330*48888Scael\&.\e" The next request is for sections 2 and 3 error
331*48888Scael\&.\e" and signal handling only.
332*48888Scael\&.\e" .Sh ERRORS
333*48888Scael\&.\e" .Sh SEE ALSO
334*48888Scael\&.\e" .Sh STANDARDS
335*48888Scael\&.\e" .Sh HISTORY
336*48888Scael\&.\e" .Sh AUTHORS
337*48888Scael\&.\e" .Sh BUGS
338*48888Scael.Ed
339*48888Scael.Pp
340*48888ScaelThe first items in the template are the macros
341*48888Scael.Pq Li \&.Dt , \&.Dd , \&.Os ;
342*48888Scaelthe document or man page title
343*48888Scael.Pq Em in upper case ,
344*48888Scaelthe section of the manual the page
345*48888Scaelbelongs to, the (document) date,
346*48888Scaeland the operating system the man page is derived
347*48888Scaelfrom. These macros identify the page,
348*48888Scaeland are discussed below in
349*48888Scael.Sx TITLE MACROS .
350*48888Scael.Pp
351*48888ScaelThe remaining items in the template are section headers
352*48888Scael.Pq Li \&.Sh ;
353*48888Scaelof which NAME, SYNOPSIS and DESCRIPTION
354*48888Scaelare mandatory. The
355*48888Scaelheaders are
356*48888Scaeldiscussed in
357*48888Scael.Sx PAGE LAYOUT MACROS,
358*48888Scaelafter
359*48888Scaelpresentation of
360*48888Scael.Sx CONTENT MACROS .
361*48888ScaelSeveral content macros are used to demonstrate page layout macros;
362*48888Scaelreading about content macros before page layout macros is
363*48888Scaelrecommended.
364*48888Scael.Sh TITLE MACROS
36543435ScaelThree header macros designate the document title or manual page title,
36643435Scaelthe operating system,
367*48888Scaeland the date of authorship.
36843435ScaelThese macros are one called once at the very beginning of the document
36943435Scaeland are used to construct the headers and footers only.
370*48888Scael.Bl -tag -width 6n
371*48888Scael.It Li \&.Dt DOCUMENT_TITLE section# [volume]
37243435ScaelThe document title is the
37343435Scaelsubject of the man page and must be in CAPITALS due to troff
37443435Scaellimitations.
375*48888ScaelThe section number may be 1,\ ...,\ 8,
37643435Scaeland if it is specified,
37743435Scaelthe volume title may be omitted.
37843435ScaelA volume title may be arbitrary or one of the following:
37943435Scael.\" .Cl
38043435Scael.\" USD	UNIX User's Supplementary Documents
38143435Scael.\" .Cl
38243435Scael.\" PS1	UNIX Programmers's Supplementary Documents
383*48888Scael.Pp
384*48888Scael.Bl -column SMM -offset indent -compact
385*48888Scael.It AMD	UNIX Ancestral Manual Documents
386*48888Scael.It SMM	UNIX System Manager's Manual
387*48888Scael.It URM	UNIX Reference Manual
388*48888Scael.It PRM	UNIX Programmers's Manual
389*48888Scael.El
390*48888Scael.Pp
39143435Scael.\" .Cl
39243435Scael.\" MMI	UNIX Manual Master Index
39343435Scael.\" .Cl
39443435Scael.\" CON	UNIX Contributed Software Manual
39543435Scael.\" .Cl
39643435Scael.\" LOC	UNIX Local Manual
397*48888Scael.It Li \&.Os operating_system release#
39843435ScaelThe name of the operating system
39943435Scaelshould be the common acronym, e.g. BSD
40043435Scaelor ATT.  The release should be the standard release
401*48888Scaelnomenclature for the system specified, e.g. 4.3, 4.3+Tahoe, V.3,
40243435ScaelV.4. Unrecognized arguments are displayed as given in the page footer.
40343435ScaelFor instance, for the footer on this page, the 4.4 Berkeley Distribution
40443435Scaelwas produced by:
40543435Scael.Pp
406*48888Scael.Dl \&.Os BSD 4.4
407*48888Scael.It Li \&.Dd month day, year
40843435ScaelThe date should be written formally:
40943435Scael.Pp
41043435Scael.Dl January 25, 1989
411*48888Scael.El
412*48888Scael.Sh CONTENT MACROS
413*48888Scael.Ss What's in a name...
414*48888ScaelContent macro names are derived from the day to day
415*48888Scaelinformal language used to describe commands, subroutines and related
416*48888Scaelfiles. Slightly
417*48888Scaeldifferent variations of this language are used to describe
418*48888Scaelthe three different aspects of writing a man page.
419*48888ScaelFirst, there is the description of
420*48888Scael.Nm \-mdoc
421*48888Scaelmacro request usage.
422*48888ScaelSecond is the description of a
423*48888Scael.Ux
424*48888Scaelcommand
425*48888Scael.Em with
426*48888Scael.Nm \-mdoc
427*48888Scaelmacros and third,
428*48888Scaelthe
429*48888Scaeldescription a command to a user in the verbal sense;
430*48888Scaelthat is, discussion of a command in the text of a man page.
431*48888Scael.Pp
432*48888ScaelIn the first case,
433*48888Scael.Xr troff 1
434*48888Scaelmacros are themselves a type of command;
435*48888Scaelthe general syntax for a troff command is:
436*48888Scael.Bd -filled -offset indent
437*48888Scael\&.Va argument1 argument2 ... argument9
438*48888Scael.Ed
439*48888Scael.Pp
440*48888ScaelThe
441*48888Scael.Ql \&.Va
442*48888Scaelis a macro command or request, and anything following it is an argument to
443*48888Scaelbe processed.
444*48888ScaelIn the second case,
445*48888Scaelthe description of a
446*48888Scael.Ux
447*48888Scaelcommand using the content macros is a
448*48888Scaelbit more involved;
449*48888Scaela typical SYNOPSIS command line might be displayed as:
450*48888Scael.Pp
451*48888Scael.Bd -filled -offset indent
452*48888Scael.Nm filter
453*48888Scael.Op Fl flag
454*48888Scael.Ar infile outfile
455*48888Scael.Ed
456*48888Scael.Pp
457*48888ScaelHere,
458*48888Scael.Nm filter
459*48888Scaelis the command name and the
460*48888Scaelbracketed string
461*48888Scael.Fl flag
462*48888Scaelis a
463*48888Scael.Em flag
464*48888Scaelargument designated as optional by the option brackets.
465*48888ScaelIn
466*48888Scael.Nm \-mdoc
467*48888Scaelterms,
468*48888Scael.Ar infile
46943435Scaeland
470*48888Scael.Ar outfile
471*48888Scaelare
472*48888Scaelcalled
473*48888Scael.Em arguments .
474*48888ScaelThe macros which formatted the above example:
47543435Scael.Pp
476*48888Scael.Bd -ragged -offset indent
477*48888Scael.Li \&.Nm filter
478*48888Scael.Li \&.Op \&Fl flag
479*48888Scael.Li \&.Ar infile outfile
480*48888Scael.Ed
481*48888Scael.Pp
482*48888ScaelIn the third case, discussion of commands and command syntax
483*48888Scaelincludes both examples above, but may add more detail. The
484*48888Scaelarguments
485*48888Scael.Ar infile
486*48888Scaeland
487*48888Scael.Ar outfile
488*48888Scaelfrom the example above might be refered to as
489*48888Scael.Em operands
490*48888Scaelor
491*48888Scael.Em file arguments .
492*48888ScaelSome command line argument lists are quite long:
493*48888Scael.\" .Bl -tag -width make -offset indent
494*48888Scael.Bl -tag -width make -offset indent
495*48888Scael.It Nm make
496*48888Scael.Op Fl eiknqrstv
497*48888Scael.Op Fl D Ar variable
498*48888Scael.Op Fl d Ar flags
499*48888Scael.Op Fl f Ar makefile
500*48888Scael.Op Fl I Ar directory
501*48888Scael.Op Fl j Ar max_jobs
502*48888Scael.Op Ar variable=value
503*48888Scael.br
504*48888Scael.Op Ar "target\ ..."
505*48888Scael.El
506*48888Scael.Pp
507*48888ScaelHere one might talk about the command
508*48888Scael.Nm make
509*48888Scaeland qualify the argument
510*48888Scael.Ar makefile ,
511*48888Scaelas an argument to the flag,
512*48888Scael.Fl f ,
513*48888Scaelor discuss the optional
514*48888Scaelfile
515*48888Scaeloperand
516*48888Scael.Ar target .
517*48888ScaelIn the verbal context, such detail can prevent confusion,
518*48888Scaelhowever the
519*48888Scael.Nm \-mdoc
520*48888Scaelpackage
521*48888Scaeldoes not have a macro for an argument
522*48888Scael.Em to
523*48888Scaela flag.
524*48888ScaelInstead the
525*48888Scael.Ql \&Ar
526*48888Scaelargument macro is used for an operand or file argument like
527*48888Scael.Ar target
528*48888Scaelas well as an argument to a flag like
529*48888Scael.Ar variable :
530*48888Scael.Bd -literal -offset indent
531*48888Scael\&.Nm make
532*48888Scael\&.Op Fl eiknqrstv
533*48888Scael\&.Op Fl D Ar variable
534*48888Scael\&.Op Fl d Ar flags
535*48888Scael\&.Op Fl f Ar makefile
536*48888Scael\&.Op Fl I Ar directory
537*48888Scael\&.Op Fl j Ar max_jobs
538*48888Scael\&.Op Ar variable=value
539*48888Scael\&.Op Ar target ...
540*48888Scael.Ed
541*48888Scael.Ss General Syntax
542*48888ScaelAll content macros share a similar
543*48888Scaelsyntax with a few minor deviations:
544*48888Scael.Ql \&.Ar ,
545*48888Scael.Ql \&.Fl ,
546*48888Scael.Ql \&.Nm ,
547*48888Scaeland
548*48888Scael.Ql \&.Pa
549*48888Scaeldiffer only when called without arguments;
550*48888Scael.Ql \&.Fn
551*48888Scaeland
552*48888Scael.Ql \&.Xr
553*48888Scaelimpose an order on their argument lists
554*48888Scaeland the
555*48888Scael.Em enclosure
556*48888Scaeland
557*48888Scael.Em quoting
558*48888Scaelmacros
559*48888Scaelhave nesting limitations. All content macros
560*48888Scaelare capable of handling punctuation.
56143435ScaelAny argument which may be tested for punctuation
56243435Scaeland contains a member of the mathematical, logical or
563*48888Scaelquotation set:
564*48888Scael.Bd -literal -offset indent -compact
56543435Scael{+,\-,/,*,%,<,>,<=,>=,=,==,&,`,',"}
566*48888Scael.Ed
56743435Scaelshould have
568*48888Scaelthe character escaped with
569*48888Scael.Ql \e& .
570*48888ScaelTypical syntax is shown in the first content macro displayed
571*48888Scaelbelow,
572*48888Scael.Ql \&.Ad ,
573*48888Scaeland the syntax for enclosure/quoting macros is shown in
574*48888Scael.Sx Enclosure and Quoting Macros .
575*48888Scael.Ss Address Macro
576*48888ScaelThe address macro constructs an address
57743435Scaelof the form addr1[,addr2[,addr3]].
57843435Scael.Pp
579*48888Scael.Dl Usage: .Ad address ... \*(Pu
580*48888Scael.Bl -tag -width ".Ad f1 , f2 , f3 :" -compact -offset 14n
581*48888Scael.It Li \&.Ad addr1
58243435Scael.Ad addr1
583*48888Scael.It Li \&.Ad addr1\ .
58443435Scael.Ad addr1 .
585*48888Scael.It Li \&.Ad addr1\ , file2
58643435Scael.Ad addr1 , file2
587*48888Scael.It Li \&.Ad f1\ , f2\ , f3\ :
58843435Scael.Ad f1 , f2 , f3 :
589*48888Scael.It Li \&.Ad addr\ )\ )\ ,
59043435Scael.Ad addr ) ) ,
591*48888Scael.El
592*48888Scael.Pp
59343435ScaelIt is an error to call
59443435Scael.Li \&.Ad
59543435Scaelwithout arguments.
596*48888Scael.Li \&.Ad
597*48888Scaelis callable by other macros and may call other macros.
598*48888Scael.Ss Argument Macro
59943435ScaelThe
60043435Scael.Li \&.Ar
601*48888Scaelargument macro may be used whenever
60243435Scaela command line argument is referenced.
60343435Scael.Pp
60443435Scael.Dl Usage: .Ar argument ... \*(Pu
605*48888Scael.Bl -tag -width ".Ar file1 file2" -compact -offset 15n
606*48888Scael.It Li \&.Ar
60743435Scael.Ar
608*48888Scael.It Li \&.Ar file1
60943435Scael.Ar file1
610*48888Scael.It Li \&.Ar file1\ .
61143435Scael.Ar file1 .
612*48888Scael.It Li \&.Ar file1 file2
61343435Scael.Ar file1 file2
614*48888Scael.It Li \&.Ar f1 f2 f3\ :
61543435Scael.Ar f1 f2 f3 :
616*48888Scael.It Li \&.Ar file\ )\ )\ ,
61743435Scael.Ar file ) ) ,
618*48888Scael.El
61943435Scael.Pp
62043435ScaelIf
62143435Scael.Li \&.Ar
622*48888Scaelis called without arguments
623*48888Scael.Ql Ar
62443435Scaelis assumed. The
62543435Scael.Li \&.Ar
626*48888Scaelmacro may call other macros, and may be
627*48888Scaelcalled by other macros.
628*48888Scael.Ss Angle Bracket Quote/Enclosure
629*48888ScaelEncloses a string or strings in between angle brackets. The macro
630*48888Scael.Ql \&.Aq
631*48888Scaelencloses the remaining arguments on the macro command line, and the
632*48888Scael.Ql \&.Ao
633*48888Scael(angle open) and
634*48888Scael.Ql \&.Ac
635*48888Scael(angle close) macros may be used across one or more lines.
636*48888Scael.Pp
637*48888Scael.Dl Usage: .Aq string ... \*(Pu
638*48888Scael.Bl -tag -width ".Aq Pa ctype.h ) ," -compact -offset 14n
639*48888Scael.It Li \&.Aq
640*48888Scael.Aq
641*48888Scael.It Li \&.Aq string.
642*48888Scael.Aq string.
643*48888Scael.It Li \&.Aq string\ .
644*48888Scael.Aq string .
645*48888Scael.It Li \&.Aq stdio.h
646*48888Scael.Aq stdio.h
647*48888Scael.It Li \&.Aq \&Ar ctype.h\ )\ ,
648*48888Scael.Aq Ar ctype.h ) ,
649*48888Scael.El
650*48888Scael.Pp
651*48888ScaelSee
652*48888Scael.Sx Enclosure Macros
653*48888Scaelfor discussion and
654*48888Scael.Sx Options
655*48888Scaelfor examples of the open and close
656*48888Scaelmacros
657*48888Scael.Ql \&.Ac
658*48888Scaeland
659*48888Scael.Ql \&.Ao .
660*48888Scael.Ql \&.Aq
661*48888Scaelis callable by other macros and may call other macros.
662*48888Scael.Ss Apostrophes
663*48888ScaelThe simple act of appending an apostrophe to the end of a word
664*48888Scaelis quite painful with out the apostrophe macro. All arguments
665*48888Scaelin
666*48888Scael.Nm \-mdoc
667*48888Scaelare measured for width and the apostrophe character is misinterpreted
668*48888Scaelas a width delimiter.  To get around this, the aprostrophe macro
669*48888Scaelappends the apostrophe character to the word after is has been measured.
670*48888Scael.Pp
671*48888Scael.Dl Usage: .(macro_name) string Ap appended string \*(Pu
672*48888Scael.Bl -tag -width ".Aq Pa ctype.h ) ," -compact -offset 14n
673*48888Scael.It Li \&.Em execve \&Ap ing
674*48888Scael.Em execve Ap ing
675*48888Scael.El
676*48888Scael.Pp
67743435ScaelThe
678*48888Scael.Ql \&Ap
679*48888Scaelmacro may be called by other macros and may call other macros, it cannot
680*48888Scaelhowever, be the first macro on a request line.
681*48888Scael.Ss Bracket Quotes/Enclosure
682*48888ScaelBracket quotes should be used when the string being bracketed is
683*48888Scael.Em not
684*48888Scaelan option string.  The brackets for an option may be different
685*48888Scaelthan the default brackets. The macro
686*48888Scael.Ql \&.Bq
687*48888Scaelencloses the remaining arguments on a macro command line and the
688*48888Scaelmacros
689*48888Scael.Ql \&.Bo
690*48888Scaeland
691*48888Scael.Ql \&.Bc
692*48888Scaelmay be used across one or more lines.
69343435Scael.Pp
694*48888Scael.Dl Usage: .Bq string ... \*(Pu
695*48888Scael.Pp
696*48888ScaelThe
697*48888Scael.Li \&.Bq
698*48888Scaelmacro exists for statements which use other macros:
699*48888Scael.Bq Em Greek , French .
700*48888ScaelThis was done with:
701*48888Scael.Pp
702*48888Scael.Dl Li \&.Bq \&Em Greek \&, French \&.
703*48888Scael.Pp
704*48888ScaelIt also could have been done using the prefix macro:
705*48888Scael.Pp
706*48888Scael.Dl Li ".Pf [ Em Greek , French ] ."
707*48888Scael.Pp
708*48888ScaelSee
709*48888Scael.Sx Enclosure Macros
710*48888Scaelfor discussion and
711*48888Scael.Sx Options
712*48888Scaelfor examples of the open and close
713*48888Scaelmacros
714*48888Scael.Ql \&.Bc
715*48888Scaeland
716*48888Scael.Ql \&.Bo .
717*48888ScaelThe
718*48888Scael.Ql \&.Bq
719*48888Scaelmacro
720*48888Scaelis callable and may call other macros.
721*48888Scael.Ss Configuration Declaration (section four only)
722*48888ScaelThe
723*48888Scael.Ql \&.Cd
724*48888Scaelmacro is used to demonstrate a
725*48888Scael.Xr config 8
726*48888Scaeldeclaration for a device interface in a section four manual.
727*48888ScaelThis macro accepts quoted arguments (double quotes only).
728*48888Scael.Pp
729*48888Scael.Bl -tag -width "device le0 at scode?" -offset indent
730*48888Scael.It Cd "device le0 at scode?"
731*48888Scaelproduced by:
732*48888Scael.Ql ".Cd device le0 at scode?" .
733*48888Scael.El
734*48888Scael.Ss Command Modifier
735*48888ScaelThe command modifier is identical to the
736*48888Scael.Ql \&.Fl
737*48888Scael(flag) command with the exception
738*48888Scaelthe
739*48888Scael.Ql \&.Cm
740*48888Scaelmacro does not assert a dash
741*48888Scaelin front of every argument. Traditionally flags are marked by the
742*48888Scaelpreceding dash, some commands or subsets of commands do not use them.
743*48888ScaelCommand modifiers may also be specified in conjunction with interactive
744*48888Scaelcommands such as editor commands.
745*48888ScaelSee
746*48888Scael.Sx Flags .
747*48888Scael.Ss Double Quote macro/Enclosure
748*48888ScaelThe
749*48888Scael.Ql \&.Dq
750*48888Scaeldouble quote encloses
751*48888Scaelany remaining strings on the command line with double quotes.
752*48888ScaelPunctuation is
753*48888Scaelplaced after the end quote.
754*48888ScaelThe macros
755*48888Scael.Ql \&.Do
756*48888Scaeland
757*48888Scael.Ql \&.Dc
758*48888Scaelmay be used across one or more lines.
759*48888Scael.Pp
76043435Scael.Dl Usage: .Dq string ... \*(Pu
761*48888Scael.Bl -tag -width ".Dq Ar patternx ) ) ," -compact -offset 14n
762*48888Scael.It Li \&.Dq
76343435Scael.Dq
764*48888Scael.It Li ".Dq string."
765*48888Scael.Dq string.
766*48888Scael.It Li ".Dq string abc ."
767*48888Scael.Dq string abc .
768*48888Scael.It Li ".Dq \'^[A-Z]\'"
769*48888Scael.Dq \'^[A-Z]\'
770*48888Scael.It Li \&.Dq \&Ar pattern\ )\ )\ ,
77143435Scael.Dq Ar pattern ) ) ,
772*48888Scael.El
77343435Scael.Pp
77443435ScaelIf
775*48888Scael.Ql \&.Dq
77643435Scaelis called with no arguments
77743435Scael.Dq
77843435Scaelis assumed. The
779*48888Scael.Ql \&.Dq
780*48888Scaelmacro may call or be called by
781*48888Scaelother macros.
782*48888ScaelSee
783*48888Scael.Sx Enclosure Macros
784*48888Scaelfor discussion of
785*48888Scael.Ql \&.Dc
78643435Scaeland
787*48888Scael.Ql \&.Do
788*48888Scaelmacro types.
789*48888Scael.Ss Defined Variables
790*48888ScaelA variable which is defined in an include file is specified
791*48888Scaelby the macro
792*48888Scael.Ql \&.Dv .
79343435Scael.Pp
794*48888Scael.Dl Usage: .Dv defined_variable ... \*(Pu
795*48888Scael.Bl -tag -width ".Dv MAXHOSTNAMELEN" -compact -offset 14n
796*48888Scael.It Li ".Dv MAXHOSTNAMELEN"
797*48888Scael.Dv MAXHOSTNAMELEN
798*48888Scael.It Li ".Dv TIOCGPGRP )"
799*48888Scael.Dv TIOCGPGRP )
800*48888Scael.El
801*48888Scael.Pp
802*48888ScaelIt is an error to call
803*48888Scael.Ql \&.Dv
804*48888Scaelwithout arguments.
805*48888Scael.Ql \&.Dv
806*48888Scaelmay call other macros and
807*48888Scaelmay be called by other macros.
808*48888Scael.Ss Emphasis Macro
809*48888ScaelText may be stressed or emphasized with the
810*48888Scael.Ql \&.Em
811*48888Scaelmacro.  The usual font for emphasis is italic.
812*48888Scael.Pp
81343435Scael.Dl Usage: .Em argument ... \*(Pu
814*48888Scael.Bl -tag -width ".Em vide infra ) ) ," -compact -offset 14n
815*48888Scael.It Li ".Em does not"
81643435Scael.Em does not
817*48888Scael.It Li ".Em exceed 1024 ."
81843435Scael.Em exceed 1024 .
819*48888Scael.It Li ".Em vide infra ) ) ,"
82043435Scael.Em vide infra ) ) ,
821*48888Scael.El
82243435Scael.Pp
823*48888ScaelThe emphasis can be forced across several lines of text by using
824*48888Scaelthe
825*48888Scael.Ql \&.Bf
826*48888Scaelmacro discussed in
827*48888Scael.Sx Modes
828*48888Scaelunder
829*48888Scael.Sx PAGE LAYOUT .
830*48888Scael.\" .Pp
831*48888Scael.\" .Em
832*48888Scael.\" I'm certain the reason so many people desire an MBA from Harvard
833*48888Scael.\" is because they want to be successful philanthropists.
834*48888Scael.\" .Em
835*48888Scael.Pp
836*48888ScaelThe
837*48888Scael.Ql \&.Em
838*48888Scaelmacro
839*48888Scaelis callable and may call other macros.
84043435ScaelIt is an error to call
841*48888Scael.Ql \&.Em
84243435Scaelwithout arguments.
843*48888Scael.Ss Enclosure and Quoting Macros
844*48888ScaelThe concept of enclosure is similar to quoting.
845*48888ScaelThe object is to enclose a string or more between
846*48888Scaela pair of characters like quotes or parentheses.
847*48888ScaelThe terms quoting and enclosure are used
848*48888Scaelinterchangeably throughout this document.  Many of the
849*48888Scaelone line enclosure macros end
850*48888Scaelend in small letter
851*48888Scael.Ql q
852*48888Scaelto give a hint of quoting, but there are a few exceptions
853*48888Scael(the macros
854*48888Scael.Ql \&.En ,
855*48888Scael.Ql \&.Fn
856*48888Scaeland
857*48888Scael.Ql \&.Op
858*48888Scaelare also enclosure macros).
859*48888ScaelFor each enclosure macro
860*48888Scaelthere is also a pair of open and close macros which end
861*48888Scaelin small letters
862*48888Scael.Ql o
863*48888Scaeland
864*48888Scael.Ql c
865*48888Scaelrespectively. These can be used across one or more lines of text
866*48888Scaeland while they cannot be nested, the one line quote macros
867*48888Scaelcan be used inside
868*48888Scaelof them.
869*48888ScaelFor a good example of one these macros, see
870*48888Scael.Sx Options .
871*48888Scael.Pp
872*48888Scael.Bd -filled -offset indent
873*48888Scael.Bl -column "quote" "close" "open" "Enclose Stringx(in XX)" XXstringXX
874*48888Scael.Em " quote	 close	 open	function	result"
875*48888Scael\&.Aq,	.Ac,	.Ao	Angle Bracket Enclosure	<string>
876*48888Scael\&.Bq,	.Bc,	.Bo	Bracket Enclosure	[string]
877*48888Scael\&.Dq,	.Dc,	.Do	Double Quote	``string''
878*48888Scael	.Ec,	.Eo	Enclose String (in XX)	XXstringXX
879*48888Scael\&.Fn,	.Fc,	.Fo	Function Enclosure	function(string)
880*48888Scael\&.Op,	.Oc,	.Oo	Option Enclosure	[string]
881*48888Scael\&.Pq,	.Pc,	.Po	Parenthesis Enclosure	(string)
882*48888Scael\&.Qq,	.Qc,	.Qo	Straight Double Quote	"string"
883*48888Scael\&.Sq,	.Sc,	.So	Single Quote	`string'
884*48888Scael\&	.Xc,	.Xo	Extend Argument	\ \-\-
885*48888Scael.El
886*48888Scael.Ed
887*48888Scael.Pp
888*48888ScaelThe macros
889*48888Scael.Ql \&.Eo
890*48888Scaeland
891*48888Scael.Ql \&.Ec
892*48888Scaelallow a user to specify an open and close with the first argument as the
893*48888Scaelopening or closing string respectively.
894*48888Scael.Ss Errno's (Section two only)
89543435ScaelThe
896*48888Scael.Ql \&.Er
897*48888Scaelerrno macro specifies the error return value
898*48888Scaelfor section two library routines. The second example
89943435Scaelbelow shows
900*48888Scael.Ql \&.Er
90143435Scaelused with the
902*48888Scael.Ql \&.Bq
903*48888Scaelmacro, as it would be used in
904*48888Scaela section two manual page.
90543435Scael.Pp
90643435Scael.Dl Usage: .Er ERRNOTYPE ... \*(Pu
907*48888Scael.Bl -tag -width ".Bq Er ENOTDIR" -compact -offset 14n
908*48888Scael.It Li \&.Er ENOENT
90943435Scael.Er ENOENT
910*48888Scael.It Li \&.Er ENOENT\ )\ ;
911*48888Scael.Er ENOENT ) ;
912*48888Scael.It Li \&.Bq \&Er ENOTDIR
913*48888Scael.Bq Er ENOTDIR
914*48888Scael.El
91543435Scael.Pp
91643435ScaelIt is an error to call
917*48888Scael.Ql \&.Er
91843435Scaelwithout arguments.
919*48888ScaelThe
920*48888Scael.Ql \&.Er
921*48888Scaelmacro
922*48888Scaelis callable and may call other macros.
92343435Scael.Ss Environment Variables
92443435ScaelThe
925*48888Scael.Ql \&.Ev
926*48888Scaelmacro specifies a environment variable.
92743435Scael.Pp
92843435Scael.Dl Usage: .Ev argument ... \*(Pu
929*48888Scael.Bl -tag -width ".Ev PRINTER ) ) ," -compact -offset 14n
930*48888Scael.It Li \&.Ev DISPLAY
93143435Scael.Ev  DISPLAY
932*48888Scael.It Li \&.Ev PATH\ .
93343435Scael.Ev PATH .
934*48888Scael.It Li \&.Ev PRINTER\ )\ )\ ,
93543435Scael.Ev PRINTER ) ) ,
936*48888Scael.El
93743435Scael.Pp
93843435ScaelIt is an error to call
939*48888Scael.Ql \&.Ev
94043435Scaelwithout arguments.
941*48888ScaelThe
942*48888Scael.Ql \&.Ev
943*48888Scaelmacro
944*48888Scaelis callable by other macros and may call other macros.
945*48888Scael.Ss Function Argument
946*48888ScaelThe
947*48888Scael.Ql \&.Fa
948*48888Scaelmacro is used to refer to function arguments (parameters)
949*48888Scaeloutside of the SYNOPSIS section of the manual or inside
950*48888Scaelthe SYNOPSIS section should a parameter list be too
951*48888Scaellong for the
952*48888Scael.Ql \&.Fn
953*48888Scaelmacro and the enclosure macros
954*48888Scael.Ql \&.Fo
955*48888Scaeland
956*48888Scael.Ql \&.Fc
957*48888Scaelmust be used.
958*48888Scael.Ql \&.Fa
959*48888Scaelmay also be used to refer to structure members.
960*48888Scael.Pp
961*48888Scael.Dl Usage: .Fa function_argument ... \*(Pu
962*48888Scael.Bl -tag -width ".Fa d_namlen\ )\ )\ ," -compact -offset 14n
963*48888Scael.It Li \&.Fa d_namlen\ )\ )\ ,
964*48888Scael.Fa d_namlen ) ) ,
965*48888Scael.It Li \&.Fa iov_len
966*48888Scael.Fa iov_len
967*48888Scael.El
968*48888Scael.Pp
969*48888ScaelIt is an error to call
970*48888Scael.Ql \&.Fa
971*48888Scaelwithout arguments.
972*48888Scael.Ql \&.Fa
973*48888Scaelis callable by other macros and may call other macros.
974*48888Scael.Ss Function Declaration
975*48888ScaelThe
976*48888Scael.Ql \&.Fd
977*48888Scaelmacro is used in the SYNOPSIS section with section two or three
978*48888Scaelfunctions. The
979*48888Scael.Ql \&.Fd
980*48888Scaelmacro does not call other macros and is not callable by other
981*48888Scaelmacros.
982*48888Scael.Pp
983*48888Scael.Dl Usage: .Fd include_file (or defined variable)
984*48888Scael.Pp
985*48888ScaelIn the SYNOPSIS section a
986*48888Scael.Ql \&.Fd
987*48888Scaelrequest causes a line break if a function has already been presented
988*48888Scaeland a break has not occurred. This leaves a nice vertical space
989*48888Scaelin between the previous function call and the declaration for the
990*48888Scaelnext function.
99143435Scael.Ss Flags
99243435ScaelThe
993*48888Scael.Ql \&.Fl
994*48888Scaelmacro handles command line flags. It prepends
99543435Scaela dash,
996*48888Scael.Ql \- ,
99743435Scaelto the flag. For interactive command flags, which
99843435Scaelare not prepended with a dash, the
999*48888Scael.Ql \&.Cm
1000*48888Scael(command modifier)
1001*48888Scaelmacro is identical, but with out the dash.
100243435Scael.Pp
100343435Scael.Dl Usage: .Fl argument ... \*(Pu
1004*48888Scael.Bl -tag -width ".Fl \-s \-t \-v" -compact -offset 14n
1005*48888Scael.It Li \&.Fl
100643435Scael.Fl
1007*48888Scael.It Li \&.Fl cfv
100843435Scael.Fl cfv
1009*48888Scael.It Li \&.Fl cfv\ .
101043435Scael.Fl cfv .
1011*48888Scael.It Li \&.Fl s v t
101243435Scael.Fl s v t
1013*48888Scael.It Li \&.Fl -\ ,
101443435Scael.Fl - ,
1015*48888Scael.It Li \&.Fl xyz\ )\ ,
101643435Scael.Fl xyz ) ,
1017*48888Scael.El
101843435Scael.Pp
101943435ScaelThe
1020*48888Scael.Ql \&.Fl
1021*48888Scaelmacro without any arguments results
1022*48888Scaelin a dash representing stdin/stdout.
102343435ScaelNote that giving
1024*48888Scael.Ql \&.Fl
102543435Scaela single dash, will result in two dashes.
1026*48888ScaelThe
1027*48888Scael.Ql \&.Fl
1028*48888Scaelmacro
1029*48888Scaelis callable and may call other macros.
103043435Scael.Ss Functions (library routines)
1031*48888ScaelThe .Fn macro is modeled on ANSI C conventions.
1032*48888Scael.Bd -literal
1033*48888ScaelUsage: .Fn [type] function [[type] params ... \*(Pu]
1034*48888Scael.Ed
1035*48888Scael.Bl -tag -width ".Fn .int align. .const * char *sptrs" -compact
1036*48888Scael.It Li "\&.Fn getchar"
103743435Scael.Fn getchar
1038*48888Scael.It Li "\&.Fn strlen ) ,"
103943435Scael.Fn strlen ) ,
1040*48888Scael.It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
1041*48888Scael.Fn "int align" "const * char *sptrs" ,
1042*48888Scael.El
104343435Scael.Pp
104443435ScaelIt is an error to call
1045*48888Scael.Ql \&.Fn
104643435Scaelwithout any arguments.
1047*48888ScaelThe
1048*48888Scael.Ql \&.Fn
1049*48888Scaelmacro
1050*48888Scaelis callable by other macros and may call other macros, but
1051*48888Scaelnote that any call to another macro signals the end of
1052*48888Scaelthe
1053*48888Scael.Ql \&.Fn
1054*48888Scaelcall (it will close-paren at that point).
1055*48888Scael.Pp
1056*48888ScaelIn the SYNOPSIS section, the function will always begin at
1057*48888Scaelthe beginning of line. If there is more than one function
1058*48888Scaelpresented in the SYNOPSIS section and a function type has not been
1059*48888Scaelgiven, a line break will occur, leaving a nice vertical space
1060*48888Scaelbetween the current function name and the one prior.
106143435ScaelAt the moment,
1062*48888Scael.Ql \&.Fn
106343435Scaeldoes not check its word boundaries
1064*48888Scaelagainst troff line lengths and may split across a newline
1065*48888Scaelungracefully. This will be fixed in the near future.
1066*48888Scael.Ss Function Type
1067*48888ScaelThis macro is intended for the SYNOPSIS section. It may be used
1068*48888Scaelanywhere else in the manpage without problems, but its main purpose
1069*48888Scaelis to present the function type in kernel normal form for the SYNOPSIS
1070*48888Scaelof sections two and three
1071*48888Scael(it causes a page break allowing the function name to appear
1072*48888Scaelon the next line).
1073*48888Scael.Pp
1074*48888Scael.Dl Usage: .Ft type ... \*(Pu
1075*48888Scael.Pp
1076*48888Scael.Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
1077*48888Scael.It Li \&.Ft struct stat
1078*48888Scael.Ft struct stat
1079*48888Scael.El
1080*48888Scael.Pp
108143435ScaelThe
1082*48888Scael.Ql \&.Ft
1083*48888Scaelrequest is not callable by other macros.
1084*48888Scael.Ss Interactive Commands
1085*48888ScaelThe
1086*48888Scael.Ql \&.Ic
1087*48888Scaelmacro designates an interactive or internal command.
1088*48888Scael.Pp
1089*48888Scael.Dl Usage: .Li argument ... \*(Pu
1090*48888Scael.Bl -tag -width ".Ic setenv , unsetenv" -compact -offset 14n
1091*48888Scael.It Li \&.Ic :wq
1092*48888Scael.Ic :wq
1093*48888Scael.It Li \&.Ic do while {...}
1094*48888Scael.Ic do while {...}
1095*48888Scael.It Li \&.Ic setenv\ , unsetenv
1096*48888Scael.Ic setenv , unsetenv
1097*48888Scael.El
1098*48888Scael.Pp
1099*48888ScaelIt is an error to call
1100*48888Scael.Ql \&.Ic
1101*48888Scaelwithout arguments.
1102*48888ScaelThe
1103*48888Scael.Ql \&.Ic
1104*48888Scaelmacro may call other macros and is callable.
110543435Scael.Ss Literals
110643435ScaelThe
1107*48888Scael.Ql \&.Li
1108*48888Scaelliteral macro may be used for special characters,
110943435Scaelvariable constants, anything which should be displayed as it
111043435Scaelwould be typed.
111143435Scael.Pp
111243435Scael.Dl Usage: .Li argument ... \*(Pu
1113*48888Scael.Bl -tag -width ".Li cntrl-D ) ,"  -compact -offset 14n
1114*48888Scael.It Li \&.Li \een
111543435Scael.Li \en
1116*48888Scael.It Li \&.Li M1 M2 M3\ ;
111743435Scael.Li M1 M2 M3 ;
1118*48888Scael.It Li \&.Li cntrl-D\ )\ ,
111943435Scael.Li cntrl-D ) ,
1120*48888Scael.It Li \&.Li 1024\ ...
112143435Scael.Li 1024 ...
1122*48888Scael.El
112343435Scael.Pp
112443435ScaelThe
1125*48888Scael.Ql \&.Li
1126*48888Scaelmacro
1127*48888Scaelis callable by other macros and may call other macros.
1128*48888Scael.Ss Name Macro
1129*48888ScaelThe
1130*48888Scael.Ql \&.Nm
1131*48888Scaelmacro is used for the document title or subject name.
1132*48888ScaelIt has the peculiarity of remembering the first
113343435Scaelargument it was called with, which should
113443435Scaelalways be the subject name of the page.  When called without
113543435Scaelarguments,
1136*48888Scael.Ql \&.Nm
113743435Scaelregurgitates this initial name for the sole purpose
113843435Scaelof making less work for the author.
1139*48888ScaelNote:
1140*48888Scaela section two
114143435Scaelor three document function name is addressed with the
1142*48888Scael.Ql \&.Nm
1143*48888Scaelin the NAME section, and with
1144*48888Scael.Ql \&.Fn
1145*48888Scaelin the SYNOPSIS
1146*48888Scaeland remaining sections.
114743435ScaelFor interactive commands, such as the
1148*48888Scael.Ql while
114943435Scaelcommand keyword in
115043435Scael.Xr csh 1 ,
115143435Scaelthe
1152*48888Scael.Ql \&.Ic
1153*48888Scaelmacro should be used.
115443435ScaelWhile the
1155*48888Scael.Ql \&.Ic
115643435Scaelis nearly identical
115743435Scaelto
1158*48888Scael.Ql \&.Nm ,
115943435Scaelit can not recall the first argument it was invoked with.
116043435Scael.Pp
116143435Scael.Dl Usage: .Nm argument ... \*(Pu
1162*48888Scael.Bl -tag -width ".Nm mdoc.sample" -compact -offset 14n
1163*48888Scael.It Li \&.Nm mdoc.sample
116443435Scael.Nm  mdoc.sample
1165*48888Scael.It Li \&.Nm \-mdoc
116643435Scael.Nm \-mdoc .
1167*48888Scael.It Li \&.Nm foo\ )\ )\ ,
116843435Scael.Nm foo ) ) ,
1169*48888Scael.It Li \&.Nm
117043435Scael.Nm
1171*48888Scael.El
117243435Scael.Pp
117343435ScaelThe
1174*48888Scael.Ql \&.Nm
1175*48888Scaelmacro
1176*48888Scaelis callable by other macros and may call other macros.
1177*48888Scael.Ss No\-Op or Normal Text Macro
1178*48888ScaelThe macro
1179*48888Scael.Li \&.No
1180*48888Scaelis
1181*48888Scaela hack for words in a macro command line which should
1182*48888Scael.Em not
1183*48888Scaelbe formatted and follows the conventional syntax
1184*48888Scaelfor content macros.
1185*48888Scael.Ss No Space Macro
1186*48888ScaelThe
1187*48888Scael.Ql \&.Ns
1188*48888Scaelmacro eliminates unwanted spaces in between macro requests.
1189*48888ScaelIt is useful for old style argument lists where there is no space
1190*48888Scaelbetween the flag and argument:
1191*48888Scael.Bl -tag -width ".Op Fl I Ns Ar directory" -offset indent
1192*48888Scael.It Li ".Op Fl I Ns Ar directory"
1193*48888Scaelproduces
1194*48888Scael.Op Fl I Ns Ar directory
1195*48888Scael.El
1196*48888Scael.Pp
1197*48888ScaelNote: the
1198*48888Scael.Ql \&.Ns
1199*48888Scaelmacro always invokes the
1200*48888Scael.Ql \&.No
1201*48888Scaelmacro after eliminating the space unless another macro name
1202*48888Scaelfollows it.
1203*48888ScaelThe macro
1204*48888Scael.Ql \&.Ns
1205*48888Scaelis callable and may call other macros.
1206*48888ScaelFor the special case of appending an apostrophe to a string, see
1207*48888Scael.Ql \&Ap .
1208*48888Scael.Sx Apostrophes .
1209*48888ScaelFor prefixes see
1210*48888Scael.Sx Prefixes.
1211*48888Scael.Ss Options
1212*48888ScaelThe
1213*48888Scael.Ql \&.Op
1214*48888Scaelmacro
1215*48888Scaelplaces option brackets around the any remaining arguments on the command
1216*48888Scaelline, and places any
1217*48888Scaeltrailing punctuation outside the brackets. The macros
1218*48888Scael.Ql \&.Oc
1219*48888Scaeland
1220*48888Scael.Ql \&.Oo
1221*48888Scaelmay be used across one or more lines.
1222*48888Scael.Pp
1223*48888Scael.Dl Usage: .Op options ... \*(Pu
1224*48888Scael.Bl -tag -width ".Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
1225*48888Scael.It Li \&.Op
1226*48888Scael.Op
1227*48888Scael.It Li ".Op Fl k"
1228*48888Scael.Op Fl k
1229*48888Scael.It Li ".Op Fl k ) ."
1230*48888Scael.Op Fl k ) .
1231*48888Scael.It Li ".Op Fl k Ar kookfile"
1232*48888Scael.Op Fl k Ar kookfile
1233*48888Scael.It Li ".Op Fl k Ar kookfile ,"
1234*48888Scael.Op Fl k Ar kookfile ,
1235*48888Scael.It Li ".Op Ar objfil Op Ar corfil"
1236*48888Scael.Op Ar objfil Op Ar corfil
1237*48888Scael.It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1238*48888Scael.Op Fl c Ar objfil Op Ar corfil ,
1239*48888Scael.It Li \&.Op word1 word2
1240*48888Scael.Op word1 word2
1241*48888Scael.El
1242*48888Scael.Pp
1243*48888ScaelThe
1244*48888Scael.Ql \&.Oc
1245*48888Scaeland
1246*48888Scael.Ql \&.Oo
1247*48888Scaelmacros:
1248*48888Scael.Bd -literal -offset indent
1249*48888Scael\&.Oo
1250*48888Scael\&.Op \&Fl k \&Ar kilobytes
1251*48888Scael\&.Op \&Fl i \&Ar interval
1252*48888Scael\&.Op \&Fl c \&Ar count
1253*48888Scael\&.Oc
1254*48888Scael.Ed
1255*48888Scael.Pp
1256*48888ScaelProduce:
1257*48888Scael.Oo
1258*48888Scael.Op Fl k Ar kilobytes
1259*48888Scael.Op Fl i Ar interval
1260*48888Scael.Op Fl c Ar count
1261*48888Scael.Oc
1262*48888Scael.Pp
1263*48888ScaelThe macros
1264*48888Scael.Ql \&.Op ,
1265*48888Scael.Ql \&.Oc
1266*48888Scaeland
1267*48888Scael.Ql \&.Oo
1268*48888Scaelare callable and may call other macros.
1269*48888Scael.Ss Parenthesis Quote/Enclosure
1270*48888ScaelMacros
1271*48888Scael.Li \&.Pq , \&.Pc
1272*48888Scaeland
1273*48888Scael.Li \&.Po
1274*48888Scaelfollow the conventions for a typical quoting macros,
1275*48888Scaelsee
1276*48888Scael.Sx Enclosure Macros
1277*48888Scaeland
1278*48888Scael.Sx Options
1279*48888Scaelabove.
128043435Scael.Ss Pathnames
128143435ScaelThe
1282*48888Scael.Ql \&.Pa
1283*48888Scaelmacro formats path or file names.
128443435Scael.Pp
128543435Scael.Dl Usage: .Pa pathname \*(Pu
1286*48888Scael.Bl -tag -width ".Pa /tmp/fooXXXXX ) ." -compact -offset 14n
1287*48888Scael.It Li \&.Pa /usr/share
128843435Scael.Pa /usr/share
1289*48888Scael.It Li \&.Pa /tmp/fooXXXXX\ )\ .
129043435Scael.Pa /tmp/fooXXXXX ) .
1291*48888Scael.El
129243435Scael.Pp
1293*48888ScaelThe
1294*48888Scael.Ql \&.Pa
1295*48888Scaelmacro
1296*48888Scaelis callable by other macros and may call other macros.
1297*48888Scael.Ss Single Quotes/Enclosure
1298*48888ScaelSee
1299*48888Scael.Sx Enclosure Macros .
1300*48888ScaelSee
1301*48888Scael.Sx Double Quote/Enclosure
1302*48888Scaelabove.
1303*48888ScaelThe single quoting macro
1304*48888Scael.Ql \&.Sq
1305*48888Scaelworks in the identical manner as
1306*48888Scael.Ql \&.Dq.
1307*48888Scael.Ss Prefix Macro
1308*48888ScaelThe
1309*48888Scael.Ql \&.Pf is a short cut for combining
1310*48888Scaeltwo strings together, the first of which is
1311*48888Scaelin the default font, and the second is a content
1312*48888Scaelspecified string.
1313*48888Scael.Pp
1314*48888Scael.Bl -tag -width ".Pf ( Fa name2 " -offset 14n -compact
1315*48888Scael.It Li ".Pf ( Fa name2"
1316*48888Scaelbecomes
1317*48888Scael.Pf ( Fa name2
1318*48888Scael.El
1319*48888Scael.Pp
1320*48888ScaelThe
1321*48888Scael.Ql \&.Pf
1322*48888Scaelmacro is not callable, but may call other macros.  The
1323*48888Scael.Ql \&.Ns
1324*48888Scaelmacro performs the analogus suffix function.
1325*48888Scael.Ss Section Cross References
1326*48888ScaelThe
1327*48888Scael.Ql \&.Sx
1328*48888Scaelmacro designates a reference to a section header
1329*48888Scaelwithin the same document. It is callable by other macros and may
1330*48888Scaelcall other macros.
1331*48888Scael.Pp
1332*48888Scael.Bl -tag -width "Li \&.Sx FILES" -offset 14n
1333*48888Scael.It Li \&.Sx FILES
1334*48888Scael.Sx FILES
1335*48888Scael.El
1336*48888Scael.Ss References and Citations
1337*48888ScaelThe following macros make a modest attempt to handle references.
1338*48888ScaelAt best, the macros make it convientent to manually drop in a subset of
1339*48888Scaelrefer style references.
1340*48888Scael.Pp
1341*48888Scael.Bl -tag -width 6n -offset indent -compact
1342*48888Scael.It Li ".Rs"
1343*48888ScaelReference Start. Causes a line break and begins collection
1344*48888Scaelof reference information until the
1345*48888Scaelreference end macro is read.
1346*48888Scael.It Li ".Re"
1347*48888ScaelReference End. The reference is printed.
1348*48888Scael.It Li ".%A"
1349*48888ScaelReference author name, one name per invocation.
1350*48888Scael.It Li ".%B"
1351*48888ScaelBook title.
1352*48888Scael.It Li ".%J"
1353*48888ScaelJournal title.
1354*48888Scael.It Li ".%N"
1355*48888ScaelIssue number.
1356*48888Scael.It Li ".%O"
1357*48888ScaelOptional information.
1358*48888Scael.It Li ".%R"
1359*48888ScaelReport name.
1360*48888Scael.It Li ".%T"
1361*48888ScaelTitle of article.
1362*48888Scael.It Li ".%V"
1363*48888ScaelVolume(s).
1364*48888Scael.El
1365*48888Scael.Pp
1366*48888ScaelThe macros begining with
1367*48888Scael.Ql %
1368*48888Scaelare not callable, but may call only the trade name macro which
1369*48888Scaelreturns to its caller. The purpose is to allow trade names
1370*48888Scaelto be pretty printed in troff/ditroff output. WARNING: this
1371*48888Scaelhas very few trade names defined at the moment and will print unknown
1372*48888Scaeltrade names in the default font.
137343435Scael.Ss Symbolic
1374*48888ScaelThe symbolic emphasis macro is generally a boldface macro in
1375*48888Scaeleither the symbolic sense or the traditional English usage.
137643435Scael.Pp
137743435Scael.Dl Usage: .Sy symbol ... \*(Pu
1378*48888Scael.Bl -tag -width ".Sy Important Notice" -compact -offset 14n
1379*48888Scael.It Li \&.Sy Important Notice
1380*48888Scael.Sy Important Notice
1381*48888Scael.El
138243435Scael.Pp
138343435ScaelThe
1384*48888Scael.Ql \&.Sy
1385*48888Scaelmacro
1386*48888Scaelis callable by other macros and may call other macros, except
1387*48888Scaelin the second form.  Arguments to
1388*48888Scael.Ql \&.Sy
1389*48888Scaelmay be quoted.
139043435Scael.Ss Variables
139143435ScaelGeneric variable reference:
139243435Scael.Pp
139343435Scael.Dl Usage: .Va variable ... \*(Pu
1394*48888Scael.Bl -tag -width ".Va char s ] ) ) ," -compact -offset 14n
1395*48888Scael.It Li \&.Va count
139643435Scael.Va count
1397*48888Scael.It Li \&.Va settimer ,
139843435Scael.Va settimer ,
1399*48888Scael.It Li \&.Va int\ *prt\ )\ :
140043435Scael.Va int\ *prt ) :
1401*48888Scael.It Li \&.Va char\ s\ ]\ )\ )\ ,
140243435Scael.Va char\ s ] ) ) ,
1403*48888Scael.El
140443435Scael.Pp
1405*48888ScaelIt is an error to call
1406*48888Scael.Ql \&.Va
1407*48888Scaelwithout any arguments.
1408*48888ScaelThe
1409*48888Scael.Ql \&.Va
1410*48888Scaelmacro
1411*48888Scaelis callable by other macros and may call other macros.
141243435Scael.Ss Cross References
141343435ScaelThe
1414*48888Scael.Ql \&.Xr
1415*48888Scaelmacro expects the first argument to be
141643435Scaela manual page name, and the second argument, if it exists,
141743435Scaelto be either a section page number or punctuation.  Any
141843435Scaelremaining arguments are assumed to be punctuation.
141943435Scael.Pp
142043435Scael.Dl Usage: .Xr manpage [1,...,8] \*(Pu
1421*48888Scael.Bl -tag -width ".Xr mdoc 7 ) ) ," -compact -offset 14n
1422*48888Scael.It Li \&.Xr mdoc
142343435Scael.Xr mdoc
1424*48888Scael.It Li \&.Xr mdoc\ ,
142543435Scael.Xr mdoc ,
1426*48888Scael.It Li \&.Xr mdoc 7
142743435Scael.Xr mdoc 7
1428*48888Scael.It Li \&.Xr mdoc 7\ )\ )\ ,
142943435Scael.Xr mdoc 7 ) ) ,
1430*48888Scael.El
143143435Scael.Pp
143243435ScaelThe
1433*48888Scael.Ql \&.Xr
1434*48888Scaelmacro
1435*48888Scaelis callable by other macros and may call other macros.
143643435ScaelIt is an error to call
1437*48888Scael.Ql \&.Xr
143843435Scaelwithout
143943435Scaelany arguments.
1440*48888Scael.Ss Extended  Arguments
1441*48888ScaelThe
1442*48888Scael.Li \&.Xo
1443*48888Scaeland
1444*48888Scael.Li \&.Xc
1445*48888Scaelmaxros allow one to extend an argument list
1446*48888Scaelon a macro boundary.  Argument lists cannot
1447*48888Scaelbe extended within a macro
1448*48888Scaelwhich expects all of its arguments on one line such
1449*48888Scaelas
1450*48888Scael.Ql \&.Op .
145143435Scael.\" ---
145243435Scael.Sh PAGE LAYOUT MACROS
145343435Scael.Ss Section Headers
1454*48888ScaelThe first three
1455*48888Scael.Ql \&.Sh
1456*48888Scaelsection header macros
1457*48888Scaellist below are required in every
1458*48888Scaelman page. The remaining section headers
1459*48888Scaelare recommended at the disgression of the author
1460*48888Scaelwriting the manual page. The
1461*48888Scael.Ql \&.Sh
1462*48888Scaelmacro can take up to nine arguments. It may call
1463*48888Scaelother macros, but it may not be called by other macros.
1464*48888Scael.Bl -tag -width ".Sh SYNOPSIS"
1465*48888Scael.It \&.Sh NAME
146643435ScaelThe
1467*48888Scael.Ql \&.Sh NAME
1468*48888Scaelmacro is mandatory. If not specified,
146943435Scaelthe headers, footers and page layout defaults
147043435Scaelwill not be set and things will be rather unpleasant.
147143435ScaelThe NAME section consists of at least three items.
147243435ScaelThe first is the
1473*48888Scael.Ql \&.Nm
1474*48888Scaelname macro naming the subject of the man page.
1475*48888ScaelThe second is the Name Description macro,
1476*48888Scael.Ql \&.Nd ,
147743435Scaelwhich separates the subject
147843435Scaelname from the third item, which is the description. The
147943435Scaeldescription should be the most terse and lucid possible,
148043435Scaelas the space available is small.
1481*48888Scael.It \&.Sh SYNOPSIS
148243435ScaelThe SYNOPSIS section describes the typical usage of the
1483*48888Scaelsubject of a man page. The  macros required
148443435Scaelare either
1485*48888Scael.Ql ".Nm" ,
1486*48888Scael.Ql ".Cd" ,
148743435Scaelor
1488*48888Scael.Ql ".Fn"
1489*48888Scael(and possibly
1490*48888Scael.Ql ".Fd" ,
1491*48888Scael.Ql ".Ft"
1492*48888Scaelmacros).
149343435ScaelThe function name
1494*48888Scaelmacro
1495*48888Scael.Ql ".Fn"
149643435Scaelis required
149743435Scaelfor manual page sections 2 and 3, the command and general
1498*48888Scaelname macro
1499*48888Scael.Ql \&.Nm
1500*48888Scaelis required for sections 1, 5, 6, 7, 8.
1501*48888ScaelSection 4 manuals require a
1502*48888Scael.Ql ".Nm" , ".Fd"
1503*48888Scaelor a
1504*48888Scael.Ql ".Cd"
1505*48888Scaelconfiguration device usage macro.
1506*48888ScaelSeveral other macros may be necessary to produce
150743435Scaelthe synopsis line as shown below:
150843435Scael.Pp
1509*48888Scael.Bd -filled -offset indent
151043435Scael.Nm cat
151143435Scael.Op Fl benstuv
151243435Scael.Op Fl
151343435Scael.Ar
1514*48888Scael.Ed
151543435Scael.Pp
1516*48888ScaelThe following macros were used:
151743435Scael.Pp
151843435Scael.Dl \&.Nm cat
1519*48888Scael.Dl \&.Op \&Fl benstuv
1520*48888Scael.Dl \&.Op \&Fl
152143435Scael.Dl \&.Ar
1522*48888Scael.It \&.Sh DESCRIPTION
152343435ScaelIn most cases the first text in the DESCRIPTION section
152443435Scaelis a brief paragraph on the command, function or file,
152543435Scaelfollowed by a lexical list of options and respective
152643435Scaelexplanations. To create such a list, the
1527*48888Scael.Ql \&.Bl
1528*48888Scaelbegin-list,
1529*48888Scael.Ql \&.It
1530*48888Scaellist-item and
1531*48888Scael.Ql \&.El
1532*48888Scaelend-list
1533*48888Scaelmacros are used (see
1534*48888Scael.Sx Lists and Columns
1535*48888Scaelbelow).
1536*48888Scael.El
153743435Scael.Pp
153843435ScaelThe following
1539*48888Scael.Ql \&.Sh
154043435Scaelsection headers are part of the
154143435Scaelpreferred manual page layout and must be used appropriately
154243435Scaelto maintain consistency. They are listed in the order
154343435Scaelin which they would be used.
1544*48888Scael.Bl -tag -width SYNOPSIS
1545*48888Scael.It \&.Sh ENVIRONMENT
154643435ScaelThe ENVIRONMENT section should reveal any related
154743435Scaelenvironment
154843435Scaelvariables and clues to their behaviour and/or usage.
1549*48888Scael.It \&.Sh EXAMPLES
155043435ScaelThere are several ways to create examples. See
155143435Scaelthe EXAMPLES section below
155243435Scaelfor details.
1553*48888Scael.It \&.Sh FILES
155443435ScaelFiles which are used or created by the man page subject
155543435Scaelshould be listed via the
1556*48888Scael.Ql \&.Pa
1557*48888Scaelmacro in the FILES section.
1558*48888Scael.It \&.Sh SEE ALSO
155943435ScaelReferences to other material on the man page topic and
156043435Scaelcross references to other relevant man pages should
156143435Scaelbe placed in the SEE ALSO section.  Cross references
156243435Scaelare specified using the
1563*48888Scael.Ql \&.Xr
1564*48888Scaelmacro.  At this time
156543435Scael.Xr refer 1
156643435Scaelstyle references are not accommodated.
1567*48888Scael.It \&.Sh STANDARDS
156843435ScaelIf the command, library function or file adheres to a
156943435Scaelspecific implementation such as POSIX 1003.1 or
157043435ScaelANSI C X3.159-1989 this should be noted here.  If the
157143435Scaelcommand does not adhere to any standard, its history
157243435Scaelshould be noted in the HISTORY section.
1573*48888Scael.It \&.Sh HISTORY
157443435ScaelAny command which does not adhere to any specific standards
157543435Scaelshould be outlined historically in this section.
1576*48888Scael.It \&.Sh AUTHORS
157743435ScaelCredits, if need be, should be placed here.
1578*48888Scael.It \&.Sh DIAGNOSTICS
157943435ScaelDiagnostics from a command should be placed in this section.
1580*48888Scael.It \&.Sh ERRORS
158143435ScaelSpecific error handling, especially from library functions
158243435Scael(man page sections 2 and 3) should go here.  The
1583*48888Scael.Ql \&.Er
1584*48888Scaelmacro is used to specify an errno.
1585*48888Scael.It \&.Sh BUGS
158643435ScaelBlatant problems with the topic go here...
1587*48888Scael.El
158843435Scael.Pp
1589*48888ScaelUser specified
1590*48888Scael.Ql \&.Sh
1591*48888Scaelsections may be added,
1592*48888Scaelfor example, this section was set with:
1593*48888Scael.Bd -literal -offset 14n
1594*48888Scael\&.Sh PAGE LAYOUT MACROS
1595*48888Scael.Ed
159643435Scael.Ss Paragraphs and Line Spacing.
1597*48888Scael.Bl -tag -width 6n
1598*48888Scael.It \&.Pp
159943435ScaelThe \&.Pp paragraph command may
160043435Scaelbe used to specify a line space where necessary.
1601*48888ScaelThe macro is not necessary after a
1602*48888Scael.Ql \&.Sh
160343435Scaelor
1604*48888Scael.Ql \&.Ss
1605*48888Scaelmacro or before
160643435Scaela
1607*48888Scael.Ql \&.Bl
1608*48888Scaelmacro.
1609*48888Scael(The
1610*48888Scael.Ql \&.Bl
1611*48888Scaelmacro asserts a vertical distance unless the -compact flag is given).
1612*48888Scael.El
1613*48888Scael.\" .Pp
1614*48888Scael.\" .Ds I
1615*48888Scael.\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
1616*48888Scael.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
1617*48888Scael.\" .Cl Cx \t\t
1618*48888Scael.\" .Li \&.Cx\ (
1619*48888Scael.\" .Cx
1620*48888Scael.\" .Cl Cx \t\t
1621*48888Scael.\" .Li \&.Va ax
1622*48888Scael.\" .Cx
1623*48888Scael.\" .Cl Cx \t\t
1624*48888Scael.\" .Li \&.Sy \+
1625*48888Scael.\" .Cx
1626*48888Scael.\" .Cl Cx \&(\&
1627*48888Scael.\" .Va ax
1628*48888Scael.\" .Cx +
1629*48888Scael.\" .Va by
1630*48888Scael.\" .Cx +
1631*48888Scael.\" .Va c )
1632*48888Scael.\" .Cx \t
1633*48888Scael.\" .Em is produced by
1634*48888Scael.\" .Cx \t
1635*48888Scael.\" .Li \&.Va by
1636*48888Scael.\" .Cx
1637*48888Scael.\" .Cl Cx \t\t
1638*48888Scael.\" .Li \&.Sy \+
1639*48888Scael.\" .Cx
1640*48888Scael.\" .Cl Cx \t\t
1641*48888Scael.\" .Li \&.Va c )
1642*48888Scael.\" .Cx
1643*48888Scael.\" .Cl Cx \t\t
1644*48888Scael.\" .Li \&.Cx
1645*48888Scael.\" .Cx
1646*48888Scael.\" .Cw
1647*48888Scael.\" .De
1648*48888Scael.\" .Pp
1649*48888Scael.\" This example shows the same equation in a different format. The spaces
1650*48888Scael.\" around the
1651*48888Scael.\" .Li \&+
1652*48888Scael.\" signs were forced with
1653*48888Scael.\" .Li \e :
1654*48888Scael.\" .Pp
1655*48888Scael.\" .Ds I
1656*48888Scael.\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
1657*48888Scael.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
1658*48888Scael.\" .Cl Cx \t\t
1659*48888Scael.\" .Li \&.Cx\ (
1660*48888Scael.\" .Cx
1661*48888Scael.\" .Cl Cx \t\t
1662*48888Scael.\" .Li \&.Va a
1663*48888Scael.\" .Cx
1664*48888Scael.\" .Cl Cx \t\t
1665*48888Scael.\" .Li \&.Sy x
1666*48888Scael.\" .Cx
1667*48888Scael.\" .Cl Cx \t\t
1668*48888Scael.\" .Li \&.Cx \e\ +\e\ \e&
1669*48888Scael.\" .Cx
1670*48888Scael.\" .Cl Cx \&(\&
1671*48888Scael.\" .Va a
1672*48888Scael.\" .Sy x
1673*48888Scael.\" .Cx \ +\ \&
1674*48888Scael.\" .Va b
1675*48888Scael.\" .Sy y
1676*48888Scael.\" .Cx \ +\ \&
1677*48888Scael.\" .Va c )
1678*48888Scael.\" .Cx \t
1679*48888Scael.\" .Em is produced by
1680*48888Scael.\" .Cl Cx \t\t
1681*48888Scael.\" .Li \&.Va b
1682*48888Scael.\" .Cx
1683*48888Scael.\" .Cl Cx \t\t
1684*48888Scael.\" .Li \&.Sy y
1685*48888Scael.\" .Cx
1686*48888Scael.\" .Cl Cx \t\t
1687*48888Scael.\" .Li \&.Cx \e\ +\e\ \e&
1688*48888Scael.\" .Cx
1689*48888Scael.\" .Cl Cx \t\t
1690*48888Scael.\" .Li \&.Va c )
1691*48888Scael.\" .Cx
1692*48888Scael.\" .Cl Cx \t\t
1693*48888Scael.\" .Li \&.Cx
1694*48888Scael.\" .Cx
1695*48888Scael.\" .Cw
1696*48888Scael.\" .De
1697*48888Scael.\" .Pp
1698*48888Scael.\" The incantation below was
1699*48888Scael.\" lifted from the
1700*48888Scael.\" .Xr adb 1
1701*48888Scael.\" manual page:
1702*48888Scael.\" .Pp
1703*48888Scael.\" .Ds I
1704*48888Scael.\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
1705*48888Scael.\" .Cl Cx \t\t
1706*48888Scael.\" .Li \&.Cx Op Sy ?/
1707*48888Scael.\" .Cx
1708*48888Scael.\" .Cl Cx \t\t
1709*48888Scael.\" .Li \&.Nm m
1710*48888Scael.\" .Cx
1711*48888Scael.\" .Cl Cx Op Sy ?/
1712*48888Scael.\" .Nm m
1713*48888Scael.\" .Ad \ b1 e1 f1
1714*48888Scael.\" .Op Sy ?/
1715*48888Scael.\" .Cx \t
1716*48888Scael.\" .Em is produced by
1717*48888Scael.\" .Cx \t
1718*48888Scael.\" .Li \&.Ar \e\ b1 e1 f1
1719*48888Scael.\" .Cx
1720*48888Scael.\" .Cl Cx \t\t
1721*48888Scael.\" .Li \&.Op Sy ?/
1722*48888Scael.\" .Cx
1723*48888Scael.\" .Cl Cx \t\t
1724*48888Scael.\" .Li \&.Cx
1725*48888Scael.\" .Cx
1726*48888Scael.\" .Cw
1727*48888Scael.\" .De
1728*48888Scael.\" .Pp
1729*48888Scael.Ss Examples and Displays
1730*48888ScaelThere are five types of displays, a quickie one line indented display
1731*48888Scael.Ql \&.D1 ,
1732*48888Scaela quickie one line literal display
1733*48888Scael.Ql \&.Dl ,
1734*48888Scaela block literal, block filled and block ragged which use
1735*48888Scaelthe
1736*48888Scael.Ql \&.Bd
1737*48888Scaelbegin-display
1738*48888Scaeland
1739*48888Scael.Ql \&.Ed
1740*48888Scaelend-display macros.
174143435Scael.Pp
1742*48888Scael.Bl -tag -width \&.D1
1743*48888Scael.It Li \&.D1
1744*48888Scael(D-one) Display one line of indented text.
1745*48888ScaelArguments are checked to see if they are callable.
1746*48888Scael.Bd -ragged -offset indent
1747*48888Scael.Li \&.D1 \&Fl ldghfstru
1748*48888Scael.Ed
174943435Scael.Pp
1750*48888Scaelproduces:
175143435Scael.Pp
1752*48888Scael.Dl Fl ldghfstru
1753*48888Scael.It Li \&.Dl
1754*48888Scael(D-ell)
1755*48888ScaelDisplay one line of indented
1756*48888Scael.Em literal
1757*48888Scaeltext.  The
1758*48888Scael.Ql \&.Dl
1759*48888Scaelexample macro has been used throughout this
1760*48888Scaelfile.  It allows
1761*48888Scaelthe indent (display) of one line of text.
1762*48888ScaelIts default font is set to
1763*48888Scaelconstant width (literal) however
1764*48888Scael.Ql \&.Dl
1765*48888Scaeldoes check arguments to see it they are callable.
1766*48888ScaelMacros called from
176743435Scael.Li \&.Dl
1768*48888Scaelshould be content macros; calling macros from
1769*48888Scaelthe page layout section
1770*48888Scaelis redundant and may cause unpredictable errors.
1771*48888Scael.Bd -ragged -offset indent
177243435Scael.Li \&.Dl % ls -ldg /usr/local/bin
1773*48888Scael.Ed
177443435Scael.Pp
177543435Scaelproduces:
1776*48888Scael.Pp
177743435Scael.Dl % ls -ldg /usr/local/bin
1778*48888Scael.It Li \&.Bd
1779*48888ScaelBegin-display. The
1780*48888Scael.Ql \&.Bd
1781*48888Scaeldisplay must be ended with the
1782*48888Scael.Ql \&.Ed
1783*48888Scaelmacro. Displays may be nested within displays and
1784*48888Scaellists.
1785*48888Scael.Ql \&.Bd
1786*48888Scaelhas the following syntax:
178743435Scael.Pp
1788*48888Scael.Dl ".Bd display-type [offset offset_value]"
178943435Scael.Pp
1790*48888ScaelThe display-type must be one of the following four types and
1791*48888Scaelmay have an offset specifier for indentation:
1792*48888Scael.Ql \&.Bd .
179343435Scael.Pp
1794*48888Scael.Bl -tag -width "literalxx" -compact
1795*48888Scael.It Fl ragged
179643435ScaelDisplay a block of text as typed,
1797*48888Scaelright (and left) margin edges are left ragged.
1798*48888Scael.It Fl filled
1799*48888ScaelDisplay a filled (formatted) block.
1800*48888ScaelThe block of text is formatted (the edges are filled \-
1801*48888Scaelnot left ragged).
1802*48888Scael.It Fl literal
1803*48888ScaelDisplay a literal block, useful for source code or
1804*48888Scaelsimple tabbed or spaced text.
1805*48888Scael.It Fl file Ar file_name
1806*48888ScaelThe file name following the
1807*48888Scael.Fl file
1808*48888Scaelflag is read and displayed. Literal mode is
1809*48888Scaelasserted and tabs are set at 8 constant width character
1810*48888Scaelintervals, however any
1811*48888Scael.Xr troff/ Ns Nm \-mdoc
1812*48888Scaelcommands in file will be processed.
1813*48888Scael.It Fl offset Ar string
1814*48888ScaelIf
1815*48888Scael.Fl offset
1816*48888Scaelis specified with one of the following strings, the string
1817*48888Scaelis interpreted to indicate the level of indentation for the
1818*48888Scaelforthcoming block of text:
1819*48888Scael.Pp
1820*48888Scael.Bl -tag -width "indent" -compact
1821*48888Scael.It Ar left
182243435ScaelAlign block on the current left margin,
182343435Scaelthis is the default mode of
1824*48888Scael.Ql \&.Bd .
1825*48888Scael.It Ar center
182643435ScaelSupposedly center the block. At this time
182743435Scaelunfortunately, the block merely gets
182843435Scaelleft aligned about an imaginary center margin.
1829*48888Scael.It Ar indent
1830*48888ScaelIndents by one default indent value or tab. The default
1831*48888Scaelindent value is also used for the
1832*48888Scael.Ql \&.D1
1833*48888Scaeldisplay so one can be garanteed of the two types of displays
1834*48888Scaellining up. This indent is nornally set to 6n or about two
1835*48888Scaelthirds of an inch (six constant width characters).
1836*48888Scael.It Ar indent-two
1837*48888ScaelIndents two times the default indent value.
1838*48888Scael.It Ar right
1839*48888ScaelThis
1840*48888Scael.Em left
1841*48888Scaelaligns the block about two inches from
1842*48888Scaelthe right side of the page. This macro also needs
1843*48888Scaelwork and perhaps may never be right in
1844*48888Scael.Xr troff .
1845*48888Scael.El
1846*48888Scael.El
1847*48888Scael.It ".Ed"
1848*48888ScaelEnd-display.
1849*48888Scael.El
1850*48888Scael.Ss Tagged Lists and Columns
1851*48888ScaelThere are several types of lists which may be initiated with the
1852*48888Scael.Ql ".Bl"
1853*48888Scaelbegin-list macro.  Items within the list
1854*48888Scaelare specified with the
1855*48888Scael.Ql ".It"
1856*48888Scaelitem macro and
1857*48888Scaeleach list must end with the
1858*48888Scael.Ql ".El"
1859*48888Scaelmacro. Lists may be nested within themselves and within displays.
1860*48888ScaelColumns may be used inside of lists, but lists are unproven
1861*48888Scaelinside of columns.
186243435Scael.Pp
1863*48888ScaelIn addition, several list attributes may be specified such as
1864*48888Scaelthe width of a tag, the list offset, and compactness specified
1865*48888Scael(blank lines between items allowed or disallowed).
1866*48888ScaelThe following list types are accepted by
1867*48888Scael.Ql ".Bl":
186843435Scael.Pp
1869*48888Scael.Bl -ohang -compact
1870*48888Scael.It Fl bullet
1871*48888Scael.It Fl item
1872*48888Scael.It Fl enum
1873*48888ScaelThese three are the simplest types of lists. Once the
1874*48888Scael.Ql ".Bl"
1875*48888Scaelmacro has been given, items in the list are merely
1876*48888Scaelindicated by a line consisting solely of the
1877*48888Scael.Ql ".It"
1878*48888Scaelmacro. For example, the source text for a simple enumerated list
1879*48888Scaelwould look like:
1880*48888Scael.Bd -literal -offset indent-two
1881*48888Scael\&.Bl -enum -compact
1882*48888Scael\&.It
1883*48888Scael\&Item one goes here.
1884*48888Scael\&.It
1885*48888Scael\&And item two here.
1886*48888Scael\&.It
1887*48888Scael\&Lastly item three goes here.
1888*48888Scael\&.El
1889*48888Scael.Ed
189043435Scael.Pp
1891*48888ScaelThe results:
189243435Scael.Pp
1893*48888Scael.Bl -enum -offset indent-two -compact
1894*48888Scael.It
1895*48888ScaelItem one goes here.
1896*48888Scael.It
1897*48888ScaelAnd item two here.
1898*48888Scael.It
1899*48888ScaelLastly item three goes here.
1900*48888Scael.El
190143435Scael.Pp
1902*48888ScaelA simple bullet list construction:
1903*48888Scael.Bd -literal -offset indent-two
1904*48888Scael\&.Bl -bullet -compact
1905*48888Scael\&.It
1906*48888Scael\&Bullet one goes here.
1907*48888Scael\&.It
1908*48888Scael\&Bullet two here.
1909*48888Scael\&.El
1910*48888Scael.Ed
191143435Scael.Pp
1912*48888ScaelProduces:
1913*48888Scael.Bl -bullet -offset indent-two -compact
1914*48888Scael.It
1915*48888ScaelBullet one goes here.
1916*48888Scael.It
1917*48888ScaelBullet two here.
1918*48888Scael.El
191943435Scael.Pp
1920*48888Scael.It Fl tag
1921*48888Scael.It Fl diag
1922*48888Scael.It Fl hang
1923*48888Scael.It Fl ohang
1924*48888Scael.It Fl inset
1925*48888ScaelThese list-types collect arguments specified with the
1926*48888Scael.Ql \&.It
1927*48888Scaelmacro and create a label which may be
1928*48888Scael.Em inset
1929*48888Scaelinto the forth coming text,
1930*48888Scael.Em hanged
1931*48888Scael(exdented) from the forth coming text,
1932*48888Scael.Em overhanged
1933*48888Scaelset above the forth coming paragraph or
1934*48888Scael.Em tagged
1935*48888Scael(exdented and offset). This
1936*48888Scaellist was constructed with the
1937*48888Scael.Ql Fl ohang
1938*48888Scaellist-type.  The
1939*48888Scael.Ql \&.It
1940*48888Scaelmacro may call any callable macros for the inset, hang
1941*48888Scaeland tag list-types, but will not call macros for the
1942*48888Scaeldiag type.
1943*48888ScaelHere is an example of inset labels:
1944*48888Scael.Bl -inset -offset indent
1945*48888Scael.It Em Tag
1946*48888ScaelThe tagged list (also called a tagged paragraph) is the
1947*48888Scaelmost common type of list used in the Berkeley manuals.
1948*48888Scael.It Em Diag
1949*48888ScaelDiag lists create section four diagnostic lists
1950*48888Scaeland are similar to inset lists except callable
1951*48888Scaelmacros are ignored.
1952*48888Scael.It Em Hang
1953*48888ScaelHanged labels are a matter of taste.
1954*48888Scael.It Em Ohang
1955*48888ScaelOver hanging labels are nice when space is constrained.
1956*48888Scael.It Em Inset
1957*48888ScaelInset labels are useful for controlling blocks of
1958*48888Scaelparagraphs and are valuable for converting
1959*48888Scael.Nm \-mdoc
1960*48888Scaelmanuals to other formats.
1961*48888Scael.El
196243435Scael.Pp
1963*48888ScaelHere is the source text which produced the above example:
1964*48888Scael.Bd -literal -offset indent
1965*48888Scael\&.Bl -inset -offset indent
1966*48888Scael\&.It Em Tag
1967*48888Scael\&The tagged list (also called a tagged paragraph) is the
1968*48888Scael\&most common type of list used in the Berkeley manuals.
1969*48888Scael\&.It Em Diag
1970*48888Scael\&Diag lists create section four diagnostic lists
1971*48888Scael\&and are similar to inset lists except callable
1972*48888Scael\&macros are ignored.
1973*48888Scael\&.It Em Hang
1974*48888Scael\&Hanged labels are a matter of taste.
1975*48888Scael\&.It Em Ohang
1976*48888Scael\&Over hanging labels are nice when space is constrained.
1977*48888Scael\&.It Em Inset
1978*48888Scael\&Inset labels are useful for controlling blocks of
1979*48888Scael\&paragraphs and are valuable for converting
1980*48888Scael\&.Nm \-mdoc
1981*48888Scael\&manuals to other formats.
1982*48888Scael\&.El
1983*48888Scael.Ed
198443435Scael.Pp
1985*48888ScaelHere is a hanged list with just one item:
1986*48888Scael.Bl -hang -offset indent
1987*48888Scael.It Em Hanged
1988*48888Scaellabels appear similar to tagged lists when the
1989*48888Scaellabel is smaller than the label width.
1990*48888Scael.It Em Longer hanged list labels
1991*48888Scaelblend in to the paragraph unlike
1992*48888Scaeltagged paragraph labels.
1993*48888Scael.El
199443435Scael.Pp
1995*48888ScaelAnd the unfomatted text which created it:
1996*48888Scael.Bd -literal -offset indent
1997*48888Scael\&.Bl -hang -offset indent
1998*48888Scael\&.It Em Hanged
1999*48888Scael\&labels appear similar to tagged lists when the
2000*48888Scael\&label is smaller than the label width.
2001*48888Scael\&.It Em Longer hanged list labels
2002*48888Scael\&blend in to the paragraph unlike
2003*48888Scael\&tagged paragraph labels.
2004*48888Scael\&.El
2005*48888Scael.Ed
2006*48888Scael.Pp
2007*48888ScaelThe tagged list which follows uses an optional width specifier to controll
2008*48888Scaelthe width of the tag.
2009*48888Scael.Pp
2010*48888Scael.Bl -tag -width "PAGEIN 10" -compact -offset indent
2011*48888Scael.It SL 10
201243435Scaelsleep time of the process (seconds blocked)
2013*48888Scael.It PAGEIN 10
2014*48888Scaelnumber of disk i/o's resulting from references
2015*48888Scaelby the process to pages not loaded in core.
2016*48888Scael.It UID 10
201743435Scaelnumerical user-id of process owner
2018*48888Scael.It PPID 10
2019*48888Scaelnumerical id of parent of process process priority
2020*48888Scael(non-positive when in non-interruptible wait)
2021*48888Scael.El
202243435Scael.Pp
202343435ScaelThe raw text:
2024*48888Scael.Bd -literal -offset indent
2025*48888Scael\&.Bl -tag -width "PAGEIN 10" -compact -offset indent
2026*48888Scael\&.It SL 10
2027*48888Scael\&sleep time of the process (seconds blocked)
2028*48888Scael\&.It PAGEIN 10
2029*48888Scael\&number of disk i/o's resulting from references
2030*48888Scael\&by the process to pages not loaded in core.
2031*48888Scael\&.It UID 10
2032*48888Scael\&numerical user-id of process owner
2033*48888Scael\&.It PPID 10
2034*48888Scael\&numerical id of parent of process process priority
2035*48888Scael\&(non-positive when in non-interruptible wait)
2036*48888Scael\&.El
2037*48888Scael.Ed
203843435Scael.Pp
2039*48888ScaelAcceptable width specifiers:
2040*48888Scael.Bl -tag -width Ar -offset indent
2041*48888Scael.It Fl width Ar "\&Fl"
2042*48888Scaelsets the width to the default width for a flag. All callable
2043*48888Scaelmacros have a default width value. The
2044*48888Scael.Ql \&.Fl ,
2045*48888Scaelvalue is presently
2046*48888Scaelset to ten constant width characters or about five sixth of
2047*48888Scaelan inch.
2048*48888Scael.It Fl width Ar "24n"
2049*48888Scaelsets the width to 24 constant width characters or about two
2050*48888Scaelinches.  The
2051*48888Scael.Ql n
2052*48888Scaelis absolutely necessary for the scaling to work correctly.
2053*48888Scael.It Fl width Ar "ENAMETOOLONG"
2054*48888Scaelsets width to the constant width length of the
2055*48888Scaelstring given.
2056*48888Scael.It Fl width  Ar "\\*qint mkfifo\\*q"
2057*48888Scaelagain, the width is set to the constant width of the string
2058*48888Scaelgiven.
2059*48888Scael.El
206043435Scael.Pp
2061*48888ScaelIf a width is not specified for the tag list type, the first
2062*48888Scaeltime
2063*48888Scael.Ql \&.It
2064*48888Scaelis invoked, an attempt is made to determine an appropriate
2065*48888Scaelwidth.  If the first argument to
2066*48888Scael.Ql ".It"
2067*48888Scaelis a callable macro, the default width for that macro will be used
2068*48888Scaelas if the macro name had been supplied as the width.  However,
2069*48888Scaelif another item in the list is given with a different callable
2070*48888Scaelmacro name, a new and nested list is assumed. Here is an involved
2071*48888Scaelexample of a self nesting list:
2072*48888Scael.Sh DIAGNOSTICS
2073*48888ScaelThe debugging facilities for
2074*48888Scael.Nm \-mdoc
2075*48888Scaelare limited, but can help detect subtle errors such
2076*48888Scaelas the collision of an argument name with an internal
2077*48888Scaelregister or macro name. (A what?)
2078*48888ScaelA register is an arithmetic storage class for
2079*48888Scael.Xr troff
2080*48888Scaelwith a one or two character name.
2081*48888ScaelAll registers internal to
2082*48888Scael.Nm \-mdoc
2083*48888Scaelfor
2084*48888Scael.Xr troff
2085*48888Scaeland
2086*48888Scael.Xr ditroff
2087*48888Scaelare two characters and
2088*48888Scaelof the form <uppercase><lowercase> such as
2089*48888Scael.Ql \&Ar ,
2090*48888Scael<lowercase><uppercase> as
2091*48888Scael.Ql \&aR
209243435Scaelor
2093*48888Scael<upper or lower letter><digit> as
2094*48888Scael.Ql \&C\&1 .
2095*48888ScaelAnd adding to the muddle,
2096*48888Scael.Xr troff
2097*48888Scaelhas its own internal registers all of which are either
2098*48888Scaeltwo lowercase characters or a dot plus a letter or meta-character
2099*48888Scaelcharacter.
2100*48888ScaelIn one of the introduction examples, it was shown how to
2101*48888Scaelprevent the interpretation of a macro name with the escape sequence
2102*48888Scael.Ql \e& .
2103*48888ScaelThis is sufficient for the internal register names also.
210443435Scael.Pp
2105*48888Scael.\" Every callable macro name has a corresponding register
2106*48888Scael.\" of the same name (<Uppercase><lowercase>).
2107*48888Scael.\" There are also specific registers which have
2108*48888Scael.\" been used for stacks and arrays and are listed in the
2109*48888Scael.\" .Sx Appendix .
2110*48888Scael.\" .Bd -ragged -offset 4n
2111*48888Scael.\" [A-Z][a-z]	registers corresponding to macro names (example ``Ar'')
2112*48888Scael.\" [a-z][A-Z]	registers corresponding to macro names (example ``aR'')
2113*48888Scael.\" C[0-9]		argument types (example C1)
2114*48888Scael.\" O[0-9]		offset stack (displays)
2115*48888Scael.\" h[0-9]		horizontal spacing stack (lists)
2116*48888Scael.\" o[0-9]		offset (stack) (lists)
2117*48888Scael.\" t[0-9]		tag stack (lists)
2118*48888Scael.\" v[0-9]		vertical spacing stack (lists)
2119*48888Scael.\" w[0-9]		width tag/label stack
2120*48888Scael.\" .Ed
2121*48888Scael.\" .Pp
2122*48888ScaelIf a non-escaped register name is given in the argument list of a request
2123*48888Scaelunpredictable behaviour will occur. In general, anytime huge portions
2124*48888Scaelof text do not appear where expected in the output, or small strings
2125*48888Scaelsuch as list tags disappear, chances are there is a misunderstanding
2126*48888Scaelabout an argument type in the argument list.
2127*48888ScaelYour mother never intended for you to remember this evil stuff - so here
2128*48888Scaelis a way to find out whether or not your arguments are valid: The
2129*48888Scael.Ql \&.Db
2130*48888Scael(debug)
2131*48888Scaelmacro displays the interpretation of the argument list for most
2132*48888Scaelmacros.  Macros such as the
2133*48888Scael.Ql \&.Pp
2134*48888Scael(paragraph)
2135*48888Scaelmacro do not contain debugging information. All of the callable macros do,
2136*48888Scaeland it is strongly advised whenever in doubt,
2137*48888Scaelturn on the
2138*48888Scael.Ql \&.Db
2139*48888Scaelmacro.
214043435Scael.Pp
2141*48888Scael.Dl Usage: \&.Db [on | off]
214243435Scael.Pp
2143*48888ScaelAn example of a portion of text with
2144*48888Scaelthe debug macro placed above and below an
2145*48888Scaelartificially created problem (a flag argument
2146*48888Scael.Ql \&aC
2147*48888Scaelwhich should be
2148*48888Scael.Ql \e&aC
2149*48888Scaelin order to work):
2150*48888Scael.Bd -literal -offset indent
2151*48888Scael\&.Db on
2152*48888Scael\&.Op Fl aC Ar file )
2153*48888Scael\&.Db off
2154*48888Scael.Ed
215543435Scael.Pp
2156*48888ScaelThe resulting output:
2157*48888Scael.Bd -literal -offset indent
2158*48888ScaelDEBUGGING ON
2159*48888ScaelDEBUG(argv) MACRO: `.Op'  Line #: 2
2160*48888Scael	Argc: 1  Argv: `Fl'  Length: 2
2161*48888Scael	Space: `'  Class: Executable
2162*48888Scael	Argc: 2  Argv: `aC'  Length: 2
2163*48888Scael	Space: `'  Class: Executable
2164*48888Scael	Argc: 3  Argv: `Ar'  Length: 2
2165*48888Scael	Space: `'  Class: Executable
2166*48888Scael	Argc: 4  Argv: `file'  Length: 4
2167*48888Scael	Space: ` '  Class: String
2168*48888Scael	Argc: 5  Argv: `)'  Length: 1
2169*48888Scael	Space: ` '  Class: Closing Punctuation or suffix
2170*48888Scael	MACRO REQUEST: .Op Fl aC Ar file )
2171*48888ScaelDEBUGGING OFF
2172*48888Scael.Ed
217343435Scael.Pp
2174*48888ScaelThe first line of information tells the name of the calling
2175*48888Scaelmacro, here
2176*48888Scael.Ql \&.Op ,
2177*48888Scaeland the line number it appears on. If one or more files are involved
2178*48888Scael(especially if text from another file is included) the line number
2179*48888Scaelmay be bogus.  If there is only one file, it should be accurate.
2180*48888ScaelThe second line gives the argument count, the argument
2181*48888Scael.Pq Ql \&Fl
2182*48888Scaeland its length. If the length of an argument is two characters, the
2183*48888Scaelargument is tested to see if it is executable (unfortunately, any
2184*48888Scaelregister which contains a non-zero value appears executable).
2185*48888ScaelThe third line gives the space allotted for a class, and the
2186*48888Scaelclass type. The problem here is the argument aC should not be
2187*48888Scaelexecutable. The four types of classes are string, executable, closing
2188*48888Scaelpunctuation and opening punctuation.  The last line shows the entire
2189*48888Scaelargument list as it was read. In this next example, the offending
2190*48888Scael.Ql \&aC
2191*48888Scaelis escaped:
2192*48888Scael.Bd -literal -offset indent
2193*48888Scael\&.Db on
2194*48888Scael\&.Em An escaped \e&aC
2195*48888Scael\&.Db off
2196*48888Scael.Ed
2197*48888Scael.Bd -literal -offset indent
2198*48888ScaelDEBUGGING ON
2199*48888ScaelDEBUG(fargv) MACRO: `.Em'  Line #: 2
2200*48888Scael	Argc: 1  Argv: `An'  Length: 2
2201*48888Scael	Space: ` '  Class: String
2202*48888Scael	Argc: 2  Argv: `escaped'  Length: 7
2203*48888Scael	Space: ` '  Class: String
2204*48888Scael	Argc: 3  Argv: `aC'  Length: 2
2205*48888Scael	Space: ` '  Class: String
2206*48888Scael	MACRO REQUEST: .Em An escaped &aC
2207*48888ScaelDEBUGGING OFF
2208*48888Scael.Ed
220943435Scael.Pp
2210*48888ScaelThe argument
2211*48888Scael.Ql \e&aC
2212*48888Scaelshows up with the same length of 2 as the
2213*48888Scael.Ql \e&
2214*48888Scaelsequence produces a zero width, but a register
2215*48888Scaelnamed
2216*48888Scael.Ql \e&aC
2217*48888Scaelwas not found and the type classified as string.
2218*48888Scael.Pp
2219*48888ScaelOther diagnostics consist of usage statements and are self explanatory.
222043435Scael.Sh FILES
2221*48888Scael.Bl -tag -width /usr/share/man0/template.doc -compact
2222*48888Scael.It Pa /usr/share/tmac/tmac.doc
222343435Scaelmanual macro package
2224*48888Scael.It Pa /usr/share/man0/template.doc
222543435Scaeltemplate for writing a man page
2226*48888Scael.El
222743435Scael.Sh HISTORY
222843435Scael4.4 BSD
222943435Scael.Sh SEE ALSO
2230*48888Scael.Xr mdoc 7 ,
223143435Scael.Xr man 1 ,
223243435Scael.Xr troff 1
223343435Scael.Sh BUGS
223443435ScaelUndesirable hyphenation on the dash of a flag
223543435Scaelargument is not yet resolved, and causes
223643435Scaeloccasional mishaps in the DESCRIPTION section.
2237*48888Scael(line break on the hyphen).
223843435Scael.Pp
223943435ScaelPredefined strings are not declared in documentation.
224043435Scael.Pp
224143435ScaelSection 3f has not been added to the header routines.
224243435Scael.Pp
2243*48888Scael.Ql \&.Nm
224443435Scaelfont should be changed in NAME section.
224543435Scael.Pp
2246*48888Scael.Ql \&.Fn
224743435Scaelneeds to have a check to prevent splitting up
224843435Scaelif the line length is too short. Right now it
224943435Scaelseparates the last parenthesis, and sometimes
225043435Scaellooks ridiculous if a line is in fill mode.
225143435Scael.Pp
225243435ScaelThe method used to prevent header and footer page
225343435Scaelbreaks (other than the initial header and footer) when using
225443435Scaelnroff seems to be putting out a partially filled line
225543435Scaelat the bottom of the page leaving an unsightly blank space.
225643435Scael.Pp
2257*48888ScaelThe list and display macros to not do any keeps
225843435Scaeland certainly should be able to.
2259