Imported upstream version 1.5
[manpages-zh.git] / raw / man7 / mdoc.samples.7
blob04ce36920635be01de782fe300f69733341e73be
1 .\" Copyright (c) 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"
33 .\" This tutorial sampler invokes every macro in the package several
34 .\" times and is guaranteed to give a worst case performance
35 .\" for an already extremely slow package.
36 .\"
37 .Dd December 30, 1993
38 .Os
39 .Dt MDOC.SAMPLES 7
40 .Sh NAME
41 .Nm mdoc.samples
42 .Nd tutorial sampler for writing
43 .Bx
44 manuals with
45 .Nm \-mdoc
46 .Sh SYNOPSIS
47 .Nm man mdoc.samples
48 .Sh DESCRIPTION
49 A tutorial sampler for writing
50 .Bx
51 manual pages with the
52 .Nm \-mdoc
53 macro package, a
54 .Em content Ns \-based
55 and
56 .Em domain Ns \-based
57 formatting
58 package for
59 .Xr troff 1 .
60 Its predecessor, the
61 .Xr \-man 7
62 package,
63 addressed page layout leaving the
64 manipulation of fonts and other
65 typesetting details to the individual author.
67 .Nm \-mdoc ,
68 page layout macros
69 make up the
70 .Em "page structure domain"
71 which consists of macros for titles, section headers, displays
72 and lists. Essentially items which affect the physical position
73 of text on a formatted page.
74 In addition to the page structure domain, there are two more domains,
75 the manual domain and the general text domain.
76 The general text domain is defined as macros which
77 perform tasks such as quoting or emphasizing pieces of text.
78 The manual domain is defined as macros that are a subset of the
79 day to day informal language used to describe commands, routines
80 and related
81 .Bx
82 files.
83 Macros in the manual domain handle
84 command names, command line arguments and options, function names,
85 function parameters, pathnames, variables, cross
86 references to other manual pages, and so on.
87 These domain
88 items have value
89 for both the author and the future user of the manual page.
90 It is hoped the consistency gained
91 across the manual set will provide easier
92 translation to future documentation tools.
93 .Pp
94 Throughout the
95 .Ux
96 manual pages, a manual entry
97 is simply referred
98 to as a man page, regardless of actual length and without
99 sexist intention.
100 .Sh GETTING STARTED
101 Since a tutorial document is normally read when a person
102 desires to use the material immediately, the assumption has
103 been made that the user of this document may be impatient.
104 The material presented in the remained of this document is
105 outlined as follows:
106 .Bl -enum -offset indent
108 .Tn "TROFF IDIOSYNCRASIES"
109 .Bl -tag -width flag -compact -offset indent
110 .It "Macro Usage" .
111 .It "Passing Space Characters in an Argument" .
112 .It "Trailing Blank Space Characters (a warning)" .
113 .It "Escaping Special Characters" .
116 .Tn "THE ANATOMY OF A MAN PAGE"
117 .Bl -tag -width flag -compact -offset indent
118 .It "A manual page template" .
121 .Tn "TITLE MACROS" .
123 .Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS" .
124 .Bl -tag -width flag -compact -offset indent
125 .It "What's in a name..." .
126 .It "General Syntax" .
129 .Tn "MANUAL DOMAIN"
130 .Bl -tag -width flag -compact -offset indent
131 .It "Addresses" .
132 .It "Author name" .
133 .It "Arguments" .
134 .It "Configuration Declarations (section four only)" .
135 .It "Command Modifier" .
136 .It "Defined Variables" .
137 .It "Errno's (Section two only)" .
138 .It "Environment Variables" .
139 .It "Function Argument" .
140 .It "Function Declaration" .
141 .It "Flags" .
142 .It "Functions (library routines)" .
143 .It "Function Types" .
144 .\" .It "Header File (including source code)" .
145 .It "Interactive Commands" .
146 .It "Names" .
147 .It "Options" .
148 .It "Pathnames" .
149 .It "Variables" .
150 .It "Cross References" .
153 .Tn "GENERAL TEXT DOMAIN"
154 .Bl -tag -width flag -compact -offset indent
155 .It "AT&T Macro" .
156 .It "BSD Macro" .
157 .It "FreeBSD Macro" .
158 .It "UNIX Macro" .
159 .It "Enclosure/Quoting Macros"
160 .Bl -tag -width flag -compact -offset indent
161 .It "Angle Bracket Quote/Enclosure" .
162 .It "Bracket Quotes/Enclosure" .
163 .It "Double Quote macro/Enclosure" .
164 .It "Parenthesis Quote/Enclosure" .
165 .It "Single Quotes/Enclosure" .
166 .It "Prefix Macro" .
168 .It "No\-Op or Normal Text Macro" .
169 .It "No Space Macro" .
170 .It "Section Cross References" .
171 .It "References and Citations" .
172 .It "Return Values (sections two and three only)"
173 .It "Trade Names (Acronyms and Type Names)" .
174 .It "Extended  Arguments" .
177 .Tn "PAGE STRUCTURE DOMAIN"
178 .Bl -tag -width flag -compact -offset indent
179 .It "Section Headers" .
180 .It "Paragraphs and Line Spacing" .
181 .It "Keeps" .
182 .It "Displays" .
183 .It "Font Modes (Emphasis, Literal, and Symbolic)" .
184 .It "Lists and Columns" .
187 .Tn "PREDEFINED STRINGS"
189 .Tn "DIAGNOSTICS"
191 .Tn "FORMATTING WITH GROFF, TROFF AND NROFF"
193 .Tn "BUGS"
195 .ne 7
196 .Sh TROFF IDIOSYNCRASIES
198 .Nm \-mdoc
199 package attempts to simplify the process of writing a man page.
200 Theoretically, one should not have to learn the dirty details of
201 .Xr troff 1
202 to use
203 .Nm \-mdoc ;
204 however, there are a few
205 limitations which are unavoidable and best gotten out
206 of the way.
207 And, too, be forewarned, this package is
208 .Em not
209 fast.
210 .Ss Macro Usage
211 As in
212 .Xr troff 1 ,
213 a macro is called by placing a
214 .Ql \&\.
215 (dot character)
216 at the beginning of
217 a line followed by the two character name for the macro.
218 Arguments may follow the macro separated by spaces.
219 It is the dot character at the beginning of the line which causes
220 .Xr troff 1
221 to interpret the next two characters as a macro name.
222 To place a
223 .Ql \&\.
224 (dot character)
225 at the beginning of a line in some context other than
226 a macro invocation, precede the
227 .Ql \&\.
228 (dot) with the
229 .Ql \e&
230 escape sequence.
232 .Ql \e&
233 translates literally to a zero width space, and is never displayed in the
234 output.
236 In general,
237 .Xr troff 1
238 macros accept up to nine arguments, any
239 extra arguments are ignored.
240 Most macros in
241 .Nm \-mdoc
242 accept nine arguments and,
243 in limited cases, arguments may be continued or extended
244 on the
245 next line (See
246 .Sx Extensions ) .
247 A few macros handle quoted arguments (see
248 .Sx Passing Space Characters in an Argument
249 below).
251 Most of the
252 .Nm \-mdoc
253 general text domain and manual domain macros are special
254 in that their argument lists are
255 .Em parsed
256 for callable macro names.
257 This means an argument on the argument list which matches
258 a general text or manual domain macro name and is determined
259 to be callable will be executed
260 or called when it is processed.
261 In this case
262 the argument, although the name of a macro,
263 is not preceded by a
264 .Ql \&\.
265 (dot).
266 It is in this manner that many macros are nested; for
267 example
268 the option macro,
269 .Ql \&.Op ,
271 .Em call
272 the flag and argument macros,
273 .Ql \&Fl
275 .Ql \&Ar ,
276 to specify an optional flag with an argument:
277 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
278 .It Op Fl s Ar bytes
279 is produced by
280 .Li \&.Op \&Fl s \&Ar bytes
283 To prevent a two character
284 string from being interpreted as a macro name, precede
285 the string with the
286 escape sequence
287 .Ql \e& :
288 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
289 .It Op \&Fl s \&Ar bytes
290 is produced by
291 .Li \&.Op \e&Fl s \e&Ar bytes
294 Here the strings
295 .Ql \&Fl
297 .Ql \&Ar
298 are not interpreted as macros.
299 Macros whose argument lists are parsed for callable arguments
300 are referred to
301 as parsed and macros which may be called from an argument
302 list are referred to as callable
303 throughout this document and in the companion quick reference
304 manual
305 .Xr mdoc 7 .
306 This is a technical
307 .Em faux pas
308 as almost all of the macros in 
309 .Nm \-mdoc
310 are parsed, but as it was cumbersome to constantly refer to macros
311 as being callable and being able to call other macros,
312 the term parsed has been used.
313 .Ss Passing Space Characters in an Argument
314 Sometimes it is desirable to give as one argument a string
315 containing one or more blank space characters.
316 This may be necessary
317 to defeat the nine argument limit or to specify arguments to macros
318 which expect particular arrangement of items in the argument list.
319 For example,
320 the function macro
321 .Ql \&.Fn
322 expects the first argument to be the name of a function and any
323 remaining arguments to be function parameters.
325 .Tn "ANSI C"
326 stipulates the declaration of function parameters in the
327 parenthesized parameter list, each parameter is guaranteed
328 to be at minimum a two word string.
329 For example,
330 .Fa int foo .
332 There are two possible ways to pass an argument which contains
333 an embedded space.
334 .Em Implementation note :
335 Unfortunately, the most convenient way
336 of passing spaces in between quotes by reassigning individual
337 arguments before parsing was fairly expensive speed wise
338 and space wise to implement in all the macros for
339 .Tn AT&T
340 .Xr troff .
341 It is not expensive for
342 .Xr groff
343 but for the sake of portability, has been limited
344 to the following macros which need
345 it the most:
347 .Bl -tag -width 4n -offset indent -compact
348 .It Li \&Cd
349 Configuration declaration (section 4
350 .Sx SYNOPSIS )
351 .It Li \&Bl
352 Begin list (for the width specifier).
353 .It Li \&Em
354 Emphasized text.
355 .It Li \&Fn
356 Functions (sections two and four).
357 .It Li \&It
358 List items.
359 .It Li \&Li
360 Literal text.
361 .It Li \&Sy
362 Symbolic text.
363 .It Li \&%B
364 Book titles.
365 .It Li \&%J
366 Journal names.
367 .It Li \&%O
368 Optional notes for a reference.
369 .It Li \&%R
370 Report title (in a reference).
371 .It Li \&%T
372 Title of article in a book or journal.
375 One way of passing a string
376 containing blank spaces is to use the hard or unpaddable space character
377 .Ql \e\  ,
378 that is, a blank space preceded by the escape character
379 .Ql \e .
380 This method may be used with any macro but has the side effect
381 of interfering with the adjustment of text
382 over the length of a line.
383 .Xr Troff
384 sees the hard space as if it were any other printable character and
385 cannot split the string into blank or newline separated pieces as one
386 would expect.
387 The method is useful for strings which are not expected
388 to overlap a line boundary.
389 For example:
390 .Bl -tag -width "fetch(char *str)" -offset indent
391 .It Fn fetch char\ *str
392 is created by
393 .Ql \&.Fn fetch char\e *str
394 .It Fn fetch "char *str"
395 can also be created by
396 .Ql \&.Fn fetch "\\*qchar *str\\*q"
399 If the
400 .Ql \e
401 or quotes
402 were omitted,
403 .Ql \&.Fn
404 would see three arguments and
405 the result would be:
407 .Dl Fn fetch char *str
409 For an example of what happens when the parameter list overlaps
410 a newline boundary, see the
411 .Sx BUGS
412 section.
413 .Ss Trailing Blank Space Characters
414 .Xr Troff
415 can be confused by blank space characters at the end of a line.
417 is a wise preventive measure to globally remove all blank spaces
418 from <blank-space><end-of-line> character sequences.
419 Should the need
420 arise to force a blank character at the end of a line,
421 it may be forced with an unpaddable space and the
422 .Ql \e&
423 escape character.
424 For example,
425 .Ql string\e\ \e& .
426 .Ss Escaping Special Characters
427 Special characters
428 like the newline character
429 .Ql \en ,
430 are handled by replacing the
431 .Ql \e
432 with
433 .Ql \ee
434 (e.g.
435 .Ql \een )
436 to preserve
437 the backslash.
438 .Sh THE ANATOMY OF A MAN PAGE
439 The body of a man page is easily constructed from a basic
440 template found in the file
441 .Pa /usr/share/misc/mdoc.template .
442 Several example man pages can also be found
443 in 
444 .Pa /usr/share/examples/mdoc .
446 .Ss A manual page template
447 .Bd -literal -offset indent
448 \&.\e" The following requests are required for all man pages.
449 \&.Dd Month day, year
450 \&.Os OPERATING_SYSTEM [version/release]
451 \&.Dt DOCUMENT_TITLE [section number] [volume]
452 \&.Sh NAME
453 \&.Nm name
454 \&.Nd one line description of name
455 \&.Sh SYNOPSIS
456 \&.Sh DESCRIPTION
457 \&.\e" The following requests should be uncommented and
458 \&.\e" used where appropriate.  This next request is
459 \&.\e" for sections 2 and 3 function return values only.
460 \&.\e" .Sh RETURN VALUES
461 \&.\e" This next request is for sections 1, 6, 7 & 8 only
462 \&.\e" .Sh ENVIRONMENT
463 \&.\e" .Sh FILES
464 \&.\e" .Sh EXAMPLES
465 \&.\e" This next request is for sections 1, 6, 7 & 8 only
466 \&.\e"     (command return values (to shell) and
467 \&.\e"    fprintf/stderr type diagnostics)
468 \&.\e" .Sh DIAGNOSTICS
469 \&.\e" The next request is for sections 2 and 3 error
470 \&.\e" and signal handling only.
471 \&.\e" .Sh ERRORS
472 \&.\e" .Sh SEE ALSO
473 \&.\e" .Sh CONFORMING TO
474 \&.\e" .Sh HISTORY
475 \&.\e" .Sh AUTHORS
476 \&.\e" .Sh BUGS
479 The first items in the template are the macros
480 .Pq Li \&.Dd , \&.Os , \&.Dt ;
481 the document date,
482 the operating system the man page or subject source is developed
483 or modified for,
484 and the man page title
485 .Pq Em in upper case
486 along with the section of the manual the page
487 belongs in.
488 These macros identify the page,
489 and are discussed below in
490 .Sx TITLE MACROS .
492 The remaining items in the template are section headers
493 .Pq Li \&.Sh ;
494 of which
495 .Sx NAME ,
496 .Sx SYNOPSIS
498 .Sx DESCRIPTION
499 are mandatory.
501 headers are
502 discussed in
503 .Sx PAGE STRUCTURE DOMAIN ,
504 after
505 presentation of
506 .Sx MANUAL DOMAIN .
507 Several content macros are used to demonstrate page layout macros;
508 reading about content macros before page layout macros is
509 recommended.
510 .Sh TITLE MACROS
511 The title macros are the first portion of the page structure
512 domain, but are presented first and separate for someone who
513 wishes to start writing a man page yesterday.
514 Three header macros designate the document title or manual page title,
515 the operating system,
516 and the date of authorship.
517 These macros are one called once at the very beginning of the document
518 and are used to construct the headers and footers only.
519 .Bl -tag -width 6n
520 .It Li \&.Dt DOCUMENT_TITLE section# [volume]
521 The document title is the
522 subject of the man page and must be in
523 .Tn CAPITALS
524 due to troff
525 limitations.
526 The section number may be 1,\ ...,\ 8,
527 and if it is specified,
528 the volume title may be omitted.
529 A volume title may be arbitrary or one of the following:
530 .\" .Cl
531 .\" USD UNIX User's Supplementary Documents
532 .\" .Cl
533 .\" PS1 UNIX Programmer's Supplementary Documents
535 .Bl -column SMM -offset indent -compact
536 .It Li AMD      UNIX Ancestral Manual Documents
537 .It Li SMM      UNIX System Manager's Manual
538 .It Li URM      UNIX Reference Manual
539 .It Li PRM      UNIX Programmer's Manual
542 The default volume labeling is
543 .Li URM
544 for sections 1, 6, and 7;
545 .Li SMM
546 for section 8;
547 .Li PRM
548 for sections 2, 3, 4, and 5.
549 .\" .Cl
550 .\" MMI UNIX Manual Master Index
551 .\" .Cl
552 .\" CON UNIX Contributed Software Manual
553 .\" .Cl
554 .\" LOC UNIX Local Manual
555 .It Li \&.Os operating_system release#
556 The name of the operating system
557 should be the common acronym, e.g.
558 .Tn BSD
560 .Tn FreeBSD
562 .Tn ATT .
563 The release should be the standard release
564 nomenclature for the system specified, e.g. 4.3, 4.3+Tahoe, V.3,
565 V.4.
566 Unrecognized arguments are displayed as given in the page footer.
567 For instance, a typical footer might be:
569 .Dl \&.Os BSD 4.3
572 .Dl \&.Os FreeBSD 2.2
574 or for a locally produced set
576 .Dl \&.Os CS Department
578 The Berkeley default,
579 .Ql \&.Os
580 without an argument, has been defined as
581 .Tn BSD
582 in the
583 site specific file
584 .Pa /usr/share/tmac/mdoc/doc-common .
585 It really should default to
586 .Tn LOCAL .
587 Note, if the
588 .Ql \&.Os
589 macro is not present, the bottom left corner of the page
590 will be ugly.
591 .It Li \&.Dd month day, year
592 The date should be written formally:
594 .ne 5
595 .Dl January 25, 1989
597 .Sh INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
598 .Ss What's in a name...
599 The manual domain macro names are derived from the day to day
600 informal language used to describe commands, subroutines and related
601 files.
602 Slightly different variations of this language are used to describe
603 the three different aspects of writing a man page.
604 First, there is the description of
605 .Nm \-mdoc
606 macro request usage.
607 Second is the description of a
609 command
610 .Em with
611 .Nm \-mdoc
612 macros and third,
613 the description of a command to a user in the verbal sense;
614 that is, discussion of a command in the text of a man page.
616 In the first case,
617 .Xr troff 1
618 macros are themselves a type of command;
619 the general syntax for a troff command is:
620 .Bd -filled -offset indent
621 \&.Va argument1 argument2 ... argument9
625 .Ql \&.Va
626 is a macro command or request, and anything following it is an argument to
627 be processed.
628 In the second case,
629 the description of a
631 command using the content macros is a
632 bit more involved;
633 a typical
634 .Sx SYNOPSIS
635 command line might be displayed as:
636 .Bd -filled -offset indent
637 .Nm filter
638 .Op Fl flag
639 .Ar infile outfile
642 Here,
643 .Nm filter
644 is the command name and the
645 bracketed string
646 .Fl flag
647 is a
648 .Em flag
649 argument designated as optional by the option brackets.
651 .Nm \-mdoc
652 terms,
653 .Ar infile
655 .Ar outfile
657 called
658 .Em arguments .
659 The macros which formatted the above example:
660 .Bd -literal -offset indent
661 \&.Nm filter
662 \&.Op \&Fl flag
663 \&.Ar infile outfile
666 In the third case, discussion of commands and command syntax
667 includes both examples above, but may add more detail.
669 arguments
670 .Ar infile
672 .Ar outfile
673 from the example above might be referred to as
674 .Em operands
676 .Em file arguments .
677 Some command line argument lists are quite long:
678 .Bl -tag -width make -offset indent
679 .It Nm make
680 .Op Fl eiknqrstv
681 .Op Fl D Ar variable
682 .Op Fl d Ar flags
683 .Op Fl f Ar makefile
684 .Bk -words
685 .Op Fl I Ar directory
687 .Op Fl j Ar max_jobs
688 .Op Ar variable=value
689 .Bk -words
690 .Op Ar target ...
694 Here one might talk about the command
695 .Nm make
696 and qualify the argument
697 .Ar makefile ,
698 as an argument to the flag,
699 .Fl f ,
700 or discuss the optional
701 file
702 operand
703 .Ar target .
704 In the verbal context, such detail can prevent confusion,
705 however the
706 .Nm \-mdoc
707 package
708 does not have a macro for an argument
709 .Em to
710 a flag.
711 Instead the
712 .Ql \&Ar
713 argument macro is used for an operand or file argument like
714 .Ar target
715 as well as an argument to a flag like
716 .Ar variable .
717 The make command line was produced from:
718 .Bd -literal -offset indent
719 \&.Nm make
720 \&.Op Fl eiknqrstv
721 \&.Op Fl D Ar variable
722 \&.Op Fl d Ar flags
723 \&.Op Fl f Ar makefile
724 \&.Op Fl I Ar directory
725 \&.Op Fl j Ar max_jobs
726 \&.Op Ar variable=value
727 \&.Bk -words
728 \&.Op Ar target ...
729 \&.Ek
733 .Ql \&.Bk
735 .Ql \&.Ek
736 macros are explained in
737 .Sx Keeps .
738 .Ss General Syntax
739 The manual domain and general text domain macros share a similar
740 syntax with a few minor deviations:
741 .Ql \&.Ar ,
742 .Ql \&.Fl ,
743 .Ql \&.Nm ,
745 .Ql \&.Pa
746 differ only when called without arguments;
747 .Ql \&.Fn
749 .Ql \&.Xr
750 impose an order on their argument lists
751 and the
752 .Ql \&.Op
754 .Ql \&.Fn
755 macros
756 have nesting limitations.
757 All content macros
758 are capable of recognizing and properly handling punctuation,
759 provided each punctuation character is separated by a leading space.
760 If an request is given:
762 .Dl \&.Li sptr, ptr),
764 The result is:
766 .Dl Li sptr, ptr),
768 The punctuation is not recognized and all is output in the
769 literal font. If the punctuation is separated by a leading
770 white space:
772 .Dl \&.Li "sptr , ptr ) ,"
774 The result is:
776 .Dl Li sptr , ptr ) ,
778 The punctuation is now recognized and is output in the
779 default font distinguishing it from the strings in literal font.
781 To remove the special meaning from a punctuation character
782 escape it with
783 .Ql \e& .
784 .Xr Troff
785 is limited as a macro language, and has difficulty
786 when presented with a string containing
787 a member of the mathematical, logical or
788 quotation set:
789 .Bd -literal -offset indent-two
790 \&{+,\-,/,*,\&%,<,>,<=,>=,=,==,&,`,',"}
793 The problem is that
794 .Xr troff
795 may assume it is supposed to actually perform the operation
796 or evaluation suggested by the characters.  To prevent
797 the accidental evaluation of these characters,
798 escape them with
799 .Ql \e& .
800 Typical syntax is shown in the first content macro displayed
801 below,
802 .Ql \&.Ad .
803 .Sh MANUAL DOMAIN
804 .Ss Address Macro
805 The address macro identifies an address construct
806 of the form addr1[,addr2[,addr3]].
808 .Dl Usage: .Ad address ... \*(Pu
809 .Bl -tag -width ".Ad f1 , f2 , f3 :" -compact -offset 14n
810 .It Li \&.Ad addr1
811 .Ad addr1
812 .It Li \&.Ad addr1\ .
813 .Ad addr1 .
814 .It Li \&.Ad addr1\ , file2
815 .Ad addr1 , file2
816 .It Li \&.Ad f1\ , f2\ , f3\ :
817 .Ad f1 , f2 , f3 :
818 .It Li \&.Ad addr\ )\ )\ ,
819 .Ad addr ) ) ,
822 It is an error to call
823 .Ql \&.Ad
824 without arguments.
825 .Ql \&.Ad
826 is callable by other macros and is parsed.
827 .Ss Author Name
829 .Ql \&.An
830 macro is used to specify the name of the author of the item being
831 documented, or the name of the author of the actual manual page.
832 Any remaining arguments after the name information are assumed 
833 to be punctuation.
835 .Dl Usage: .An author_name \*(Pu
836 .Bl -tag -width ".An Joe Author ) ) ," -compact -offset 14n
837 .It Li \&.An Joe\ Author
838 .An Joe Author
839 .It Li \&.An Joe\ Author\ ,
840 .An Joe\ Author ,
841 .It Li \&.An Joe\ Author\ \&Aq\ nobody@FreeBSD.ORG
842 .An Joe Author Aq nobody@FreeBSD.ORG
843 .It Li \&.An Joe\ Author\ )\ )\ ,
844 .An Joe Author ) ) ,
848 .Ql \&.An
849 macro is parsed and is callable.
850 It is an error to call
851 .Ql \&.An
852 without
853 any arguments.
854 .Ss Argument Macro
856 .Ql \&.Ar
857 argument macro may be used whenever
858 a command line argument is referenced.
860 .Dl Usage: .Ar argument ... \*(Pu
861 .Bl -tag -width ".Ar file1 file2" -compact -offset 15n
862 .It Li \&.Ar
864 .It Li \&.Ar file1
865 .Ar file1
866 .It Li \&.Ar file1\ .
867 .Ar file1 .
868 .It Li \&.Ar file1 file2
869 .Ar file1 file2
870 .It Li \&.Ar f1 f2 f3\ :
871 .Ar f1 f2 f3 :
872 .It Li \&.Ar file\ )\ )\ ,
873 .Ar file ) ) ,
877 .Ql \&.Ar
878 is called without arguments
879 .Ql Ar
880 is assumed.
882 .Ql \&.Ar
883 macro is parsed and is callable.
884 .Ss Configuration Declaration (section four only)
886 .Ql \&.Cd
887 macro is used to demonstrate a
888 .Xr config 8
889 declaration for a device interface in a section four manual.
890 This macro accepts quoted arguments (double quotes only).
892 .Bl -tag -width "device le0 at scode?" -offset indent
893 .It Cd "device le0 at scode?"
894 produced by:
895 .Ql ".Cd device le0 at scode?" .
897 .Ss Command Modifier
898 The command modifier is identical to the
899 .Ql \&.Fl
900 (flag) command with the exception
902 .Ql \&.Cm
903 macro does not assert a dash
904 in front of every argument.
905 Traditionally flags are marked by the
906 preceding dash, some commands or subsets of commands do not use them.
907 Command modifiers may also be specified in conjunction with interactive
908 commands such as editor commands.
910 .Sx Flags .
911 .Ss Defined Variables
912 A variable which is defined in an include file is specified
913 by the macro
914 .Ql \&.Dv .
916 .Dl Usage: .Dv defined_variable ... \*(Pu
917 .Bl -tag -width ".Dv MAXHOSTNAMELEN" -compact -offset 14n
918 .It Li ".Dv MAXHOSTNAMELEN"
919 .Dv MAXHOSTNAMELEN
920 .It Li ".Dv TIOCGPGRP )"
921 .Dv TIOCGPGRP )
924 It is an error to call
925 .Ql \&.Dv
926 without arguments.
927 .Ql \&.Dv
928 is parsed and is callable.
929 .Ss Errno's (Section two only)
931 .Ql \&.Er
932 errno macro specifies the error return value
933 for section two library routines.
934 The second example
935 below shows
936 .Ql \&.Er
937 used with the
938 .Ql \&.Bq
939 general text domain macro, as it would be used in
940 a section two manual page.
942 .Dl Usage: .Er ERRNOTYPE ... \*(Pu
943 .Bl -tag -width ".Bq Er ENOTDIR" -compact -offset 14n
944 .It Li \&.Er ENOENT
945 .Er ENOENT
946 .It Li \&.Er ENOENT\ )\ ;
947 .Er ENOENT ) ;
948 .It Li \&.Bq \&Er ENOTDIR
949 .Bq Er ENOTDIR
952 It is an error to call
953 .Ql \&.Er
954 without arguments.
956 .Ql \&.Er
957 macro is parsed and is callable.
958 .Ss Environment Variables
960 .Ql \&.Ev
961 macro specifies an environment variable.
963 .Dl Usage: .Ev argument ... \*(Pu
964 .Bl -tag -width ".Ev PRINTER ) ) ," -compact -offset 14n
965 .It Li \&.Ev DISPLAY
966 .Ev  DISPLAY
967 .It Li \&.Ev PATH\ .
968 .Ev PATH .
969 .It Li \&.Ev PRINTER\ )\ )\ ,
970 .Ev PRINTER ) ) ,
973 It is an error to call
974 .Ql \&.Ev
975 without arguments.
977 .Ql \&.Ev
978 macro is parsed and is callable.
979 .Ss Function Argument
981 .Ql \&.Fa
982 macro is used to refer to function arguments (parameters)
983 outside of the
984 .Sx SYNOPSIS
985 section of the manual or inside
987 .Sx SYNOPSIS
988 section should a parameter list be too
989 long for the
990 .Ql \&.Fn
991 macro and the enclosure macros
992 .Ql \&.Fo
994 .Ql \&.Fc
995 must be used.
996 .Ql \&.Fa
997 may also be used to refer to structure members.
999 .Dl Usage: .Fa function_argument ... \*(Pu
1000 .Bl -tag -width ".Fa d_namlen\ )\ )\ ," -compact -offset 14n
1001 .It Li \&.Fa d_namlen\ )\ )\ ,
1002 .Fa d_namlen ) ) ,
1003 .It Li \&.Fa iov_len
1004 .Fa iov_len
1007 It is an error to call
1008 .Ql \&.Fa
1009 without arguments.
1010 .Ql \&.Fa
1011 is parsed and is callable.
1012 .Ss Function Declaration
1014 .Ql \&.Fd
1015 macro is used in the
1016 .Sx SYNOPSIS
1017 section with section two or three
1018 functions.
1020 .Ql \&.Fd
1021 macro does not call other macros and is not callable by other
1022 macros.
1024 .Dl Usage: .Fd include_file (or defined variable)
1026 In the
1027 .Sx SYNOPSIS
1028 section a
1029 .Ql \&.Fd
1030 request causes a line break if a function has already been presented
1031 and a break has not occurred.
1032 This leaves a nice vertical space
1033 in between the previous function call and the declaration for the
1034 next function.
1035 .Ss Flags
1037 .Ql \&.Fl
1038 macro handles command line flags.
1039 It prepends
1040 a dash,
1041 .Ql \- ,
1042 to the flag.
1043 For interactive command flags, which
1044 are not prepended with a dash, the
1045 .Ql \&.Cm
1046 (command modifier)
1047 macro is identical, but without the dash.
1049 .Dl Usage: .Fl argument ... \*(Pu
1050 .Bl -tag -width ".Fl \-s \-t \-v" -compact -offset 14n
1051 .It Li \&.Fl
1053 .It Li \&.Fl cfv
1054 .Fl cfv
1055 .It Li \&.Fl cfv\ .
1056 .Fl cfv .
1057 .It Li \&.Fl s v t
1058 .Fl s v t
1059 .It Li \&.Fl -\ ,
1060 .Fl - ,
1061 .It Li \&.Fl xyz\ )\ ,
1062 .Fl xyz ) ,
1066 .Ql \&.Fl
1067 macro without any arguments results
1068 in a dash representing stdin/stdout.
1069 Note that giving
1070 .Ql \&.Fl
1071 a single dash, will result in two dashes.
1073 .Ql \&.Fl
1074 macro is parsed and is callable.
1075 .Ss Functions (library routines)
1076 The .Fn macro is modeled on ANSI C conventions.
1077 .Bd -literal
1078 Usage: .Fn [type] function [[type] parameters ... \*(Pu]
1080 .Bl -tag -width ".Fn .int align. .const * char *sptrsxx" -compact
1081 .It Li "\&.Fn getchar"
1082 .Fn getchar
1083 .It Li "\&.Fn strlen ) ,"
1084 .Fn strlen ) ,
1085 .It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
1086 .Fn "int align" "const * char *sptrs" ,
1089 It is an error to call
1090 .Ql \&.Fn
1091 without any arguments.
1093 .Ql \&.Fn
1094 macro
1095 is parsed and is callable,
1096 note that any call to another macro signals the end of
1098 .Ql \&.Fn
1099 call (it will close-parenthesis at that point).
1101 For functions that have more than eight parameters (and this
1102 is rare), the
1103 macros
1104 .Ql \&.Fo
1105 (function open)
1107 .Ql \&.Fc
1108 (function close)
1109 may be used with
1110 .Ql \&.Fa
1111 (function argument)
1112 to get around the limitation. For example:
1113 .Bd -literal -offset indent
1114 \&.Fo "int res_mkquery"
1115 \&.Fa "int op"
1116 \&.Fa "char *dname"
1117 \&.Fa "int class"
1118 \&.Fa "int type"
1119 \&.Fa "char *data"
1120 \&.Fa "int datalen"
1121 \&.Fa "struct rrec *newrr"
1122 \&.Fa "char *buf"
1123 \&.Fa "int buflen"
1124 \&.Fc
1127 Produces:
1128 .Bd -filled -offset indent
1129 .Fo "int res_mkquery"
1130 .Fa "int op"
1131 .Fa "char *dname"
1132 .Fa "int class"
1133 .Fa "int type"
1134 .Fa "char *data"
1135 .Fa "int datalen"
1136 .Fa "struct rrec *newrr"
1137 .Fa "char *buf"
1138 .Fa "int buflen"
1143 .Ql \&.Fo
1145 .Ql \&.Fc
1146 macros are parsed and are callable.
1147 In the
1148 .Sx SYNOPSIS
1149 section, the function will always begin at
1150 the beginning of line.
1151 If there is more than one function
1152 presented in the
1153 .Sx SYNOPSIS
1154 section and a function type has not been
1155 given, a line break will occur, leaving a nice vertical space
1156 between the current function name and the one prior.
1157 At the moment,
1158 .Ql \&.Fn
1159 does not check its word boundaries
1160 against troff line lengths and may split across a newline
1161 ungracefully.
1162 This will be fixed in the near future.
1163 .Ss Function Type
1164 This macro is intended for the
1165 .Sx SYNOPSIS
1166 section.
1167 It may be used
1168 anywhere else in the man page without problems, but its main purpose
1169 is to present the function type in kernel normal form for the
1170 .Sx SYNOPSIS
1171 of sections two and three
1172 (it causes a line break allowing the function name to appear
1173 on the next line).
1175 .Dl Usage: .Ft type ... \*(Pu
1176 .Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
1177 .It Li \&.Ft struct stat
1178 .Ft struct stat
1182 .Ql \&.Ft
1183 request is not callable by other macros.
1184 .Ss Interactive Commands
1186 .Ql \&.Ic
1187 macro designates an interactive or internal command.
1189 .Dl Usage: .Ic argument ... \*(Pu
1190 .Bl -tag -width ".Ic setenv , unsetenvxx" -compact -offset 14n
1191 .It Li \&.Ic :wq
1192 .Ic :wq
1193 .It Li \&.Ic do while {...}
1194 .Ic do while {...}
1195 .It Li \&.Ic setenv\ , unsetenv
1196 .Ic setenv , unsetenv
1199 It is an error to call
1200 .Ql \&.Ic
1201 without arguments.
1203 .Ql \&.Ic
1204 macro is parsed and is callable.
1205 .Ss Name Macro
1207 .Ql \&.Nm
1208 macro is used for the document title or subject name.
1209 It has the peculiarity of remembering the first
1210 argument it was called with, which should
1211 always be the subject name of the page.
1212 When called without
1213 arguments,
1214 .Ql \&.Nm
1215 regurgitates this initial name for the sole purpose
1216 of making less work for the author.
1217 Note:
1218 a section two
1219 or three document function name is addressed with the
1220 .Ql \&.Nm
1221 in the
1222 .Sx NAME
1223 section, and with
1224 .Ql \&.Fn
1225 in the
1226 .Sx SYNOPSIS
1227 and remaining sections.
1228 For interactive commands, such as the
1229 .Ql while
1230 command keyword in
1231 .Xr csh 1 ,
1233 .Ql \&.Ic
1234 macro should be used.
1235 While the
1236 .Ql \&.Ic
1237 is nearly identical
1239 .Ql \&.Nm ,
1240 it can not recall the first argument it was invoked with.
1242 .Dl Usage: .Nm argument ... \*(Pu
1243 .Bl -tag -width ".Nm mdoc.sample" -compact -offset 14n
1244 .It Li \&.Nm mdoc.sample
1245 .Nm  mdoc.sample
1246 .It Li \&.Nm \e-mdoc
1247 .Nm \-mdoc .
1248 .It Li \&.Nm foo\ )\ )\ ,
1249 .Nm foo ) ) ,
1250 .It Li \&.Nm
1255 .Ql \&.Nm
1256 macro is parsed and is callable.
1257 .Ss Options
1259 .Ql \&.Op
1260 macro
1261 places option brackets around the any remaining arguments on the command
1262 line, and places any
1263 trailing punctuation outside the brackets.
1264 The macros
1265 .Ql \&.Oc
1267 .Ql \&.Oo
1268 may be used across one or more lines.
1270 .Dl Usage: .Op options ... \*(Pu
1271 .Bl -tag -width ".Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
1272 .It Li \&.Op
1274 .It Li ".Op Fl k"
1275 .Op Fl k
1276 .It Li ".Op Fl k ) ."
1277 .Op Fl k ) .
1278 .It Li ".Op Fl k Ar kookfile"
1279 .Op Fl k Ar kookfile
1280 .It Li ".Op Fl k Ar kookfile ,"
1281 .Op Fl k Ar kookfile ,
1282 .It Li ".Op Ar objfil Op Ar corfil"
1283 .Op Ar objfil Op Ar corfil
1284 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1285 .Op Fl c Ar objfil Op Ar corfil ,
1286 .It Li \&.Op word1 word2
1287 .Op word1 word2
1291 .Ql \&.Oc
1293 .Ql \&.Oo
1294 macros:
1295 .Bd -literal -offset indent
1296 \&.Oo
1297 \&.Op \&Fl k \&Ar kilobytes
1298 \&.Op \&Fl i \&Ar interval
1299 \&.Op \&Fl c \&Ar count
1300 \&.Oc
1303 Produce:
1305 .Op Fl k Ar kilobytes
1306 .Op Fl i Ar interval
1307 .Op Fl c Ar count
1310 The macros
1311 .Ql \&.Op ,
1312 .Ql \&.Oc
1314 .Ql \&.Oo
1315 are parsed and are callable.
1316 .Ss Pathnames
1318 .Ql \&.Pa
1319 macro formats path or file names.
1321 .Dl Usage: .Pa pathname \*(Pu
1322 .Bl -tag -width ".Pa /tmp/fooXXXXX ) ." -compact -offset 14n
1323 .It Li \&.Pa /usr/share
1324 .Pa /usr/share
1325 .It Li \&.Pa /tmp/fooXXXXX\ )\ .
1326 .Pa /tmp/fooXXXXX ) .
1330 .Ql \&.Pa
1331 macro is parsed and is callable.
1332 .Ss Variables
1333 Generic variable reference:
1335 .Dl Usage: .Va variable ... \*(Pu
1336 .Bl -tag -width ".Va char s ] ) ) ," -compact -offset 14n
1337 .It Li \&.Va count
1338 .Va count
1339 .It Li \&.Va settimer ,
1340 .Va settimer ,
1341 .It Li \&.Va int\ *prt\ )\ :
1342 .Va int\ *prt ) :
1343 .It Li \&.Va char\ s\ ]\ )\ )\ ,
1344 .Va char\ s ] ) ) ,
1347 It is an error to call
1348 .Ql \&.Va
1349 without any arguments.
1351 .Ql \&.Va
1352 macro is parsed and is callable.
1353 .Ss Manual Page Cross References
1355 .Ql \&.Xr
1356 macro expects the first argument to be
1357 a manual page name, and the second argument, if it exists,
1358 to be either a section page number or punctuation.
1360 remaining arguments are assumed to be punctuation.
1362 .Dl Usage: .Xr man_page [1,...,8] \*(Pu
1363 .Bl -tag -width ".Xr mdoc 7 ) ) ," -compact -offset 14n
1364 .It Li \&.Xr mdoc
1365 .Xr mdoc
1366 .It Li \&.Xr mdoc\ ,
1367 .Xr mdoc ,
1368 .It Li \&.Xr mdoc 7
1369 .Xr mdoc 7
1370 .It Li \&.Xr mdoc 7\ )\ )\ ,
1371 .Xr mdoc 7 ) ) ,
1375 .Ql \&.Xr
1376 macro is parsed and is callable.
1377 It is an error to call
1378 .Ql \&.Xr
1379 without
1380 any arguments.
1381 .Sh GENERAL TEXT DOMAIN
1382 .Ss AT&T Macro
1383 .Bd -literal -offset indent -compact
1384 Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu
1386 .Bl -tag -width ".At v6 ) ," -compact -offset 14n
1387 .It Li ".At"
1389 .It Li ".At v6 ."
1390 .At v6 .
1394 .Ql \&.At
1395 macro is
1396 .Em not
1397 parsed and
1398 .Em not
1399 callable. It accepts at most two arguments.
1400 .Ss BSD Macro
1401 .Dl Usage: .Bx [Version/release] ... \*(Pu
1402 .Bl -tag -width ".Bx 4.3 ) ," -compact -offset 14n
1403 .It Li ".Bx"
1405 .It Li ".Bx 4.3 ."
1406 .Bx 4.3 .
1410 .Ql \&.Bx
1411 macro is parsed and is callable.
1412 .Ss FreeBSD Macro
1413 .Bd -literal -offset indent -compact
1414 Usage: .Fx Version.release ... \*(Pu
1416 .Bl -tag -width ".Fx 2.2 ) ," -compact -offset 14n
1417 .It Li ".Fx 2.2 ."
1418 .Fx 2.2 .
1422 .Ql \&.Fx
1423 macro is
1424 .Em not
1425 parsed and
1426 .Em not
1427 callable. It accepts at most two arguments.
1428 .Ss UNIX Macro
1429 .Dl Usage: .Ux ... \*(Pu
1430 .Bl -tag -width ".Ux 4.3 ) ," -compact -offset 14n
1431 .It Li ".Ux"
1436 .Ql \&.Ux
1437 macro is parsed and is callable.
1438 .Ss Enclosure and Quoting Macros
1439 The concept of enclosure is similar to quoting.
1440 The object being to enclose one or more strings between
1441 a pair of characters like quotes or parentheses.
1442 The terms quoting and enclosure are used
1443 interchangeably throughout this document.
1444 Most of the
1445 one line enclosure macros end
1446 in small letter
1447 .Ql q
1448 to give a hint of quoting, but there are a few irregularities.
1449 For each enclosure macro
1450 there is also a pair of open and close macros which end
1451 in small letters
1452 .Ql o
1454 .Ql c
1455 respectively.
1456 These can be used across one or more lines of text
1457 and while they have nesting limitations, the one line quote macros
1458 can be used inside
1459 of them.
1461 .ne 5
1462 .Bd -filled -offset indent
1463 .Bl -column "quote " "close " "open " "Enclose Stringx(in XX) " XXstringXX
1464 .Em " Quote      Close   Open   Function        Result"
1465 \&.Aq   .Ac     .Ao     Angle Bracket Enclosure <string>
1466 \&.Bq   .Bc     .Bo     Bracket Enclosure       [string]
1467 \&.Dq   .Dc     .Do     Double Quote    ``string''
1468         .Ec     .Eo     Enclose String (in XX)  XXstringXX
1469 \&.Pq   .Pc     .Po     Parenthesis Enclosure   (string)
1470 \&.Ql                   Quoted Literal  `st' or string
1471 \&.Qq   .Qc     .Qo     Straight Double Quote   "string"
1472 \&.Sq   .Sc     .So     Single Quote    `string'
1476 Except for the irregular macros noted below, all
1477 of the quoting macros are parsed and callable.
1478 All handle punctuation properly, as long as it
1479 is presented one character at a time and separated by spaces.
1480 The quoting macros examine opening and closing punctuation
1481 to determine whether it comes before or after the
1482 enclosing string. This makes some nesting possible.
1483 .Bl -tag -width xxx,xxxx
1484 .It Li \&.Ec , \&.Eo
1485 These macros expect the first argument to be the
1486 opening and closing strings respectively.
1487 .It Li \&.Ql
1488 The quoted literal macro behaves differently for
1489 .Xr troff
1490 than
1491 .Xr nroff .
1492 If formatted with
1493 .Xr nroff ,
1494 a quoted literal is always quoted. If formatted with
1495 troff, an item is only quoted if the width
1496 of the item is less than three constant width characters.
1497 This is to make short strings more visible where the font change
1498 to literal (constant width) is less noticeable.
1499 .It Li \&.Pf
1500 The prefix macro is not callable, but it is parsed:
1501 .Bl -tag -width "(namexx" -offset indent
1502 .It Li ".Pf ( Fa name2"
1503 becomes
1504 .Pf ( Fa name2 .
1508 .Ql \&.Ns
1509 (no space) macro performs the analogous suffix function.
1512 .ne 4
1513 Examples of quoting:
1514 .Bl -tag -width ".Aq Pa ctype.h ) ,xxxxxxxx" -compact -offset indent
1515 .It Li \&.Aq
1517 .It Li \&.Aq \&Ar ctype.h\ )\ ,
1518 .Aq Ar ctype.h ) ,
1519 .It Li \&.Bq
1521 .It Li \&.Bq \&Em Greek \&, French \&.
1522 .Bq Em Greek , French .
1523 .It Li \&.Dq
1525 .It Li ".Dq string abc ."
1526 .Dq string abc .
1527 .It Li ".Dq \'^[A-Z]\'"
1528 .Dq \'^[A-Z]\'
1529 .It Li "\&.Ql man mdoc"
1530 .Ql man mdoc
1531 .It Li \&.Qq
1533 .It Li "\&.Qq string ) ,"
1534 .Qq string ) ,
1535 .It Li "\&.Qq string Ns ),"
1536 .Qq string Ns ),
1537 .It Li \&.Sq
1539 .It Li "\&.Sq string
1540 .Sq string
1543 For a good example of nested enclosure macros, see the
1544 .Ql \&.Op
1545 option macro.
1546 It was created from the same
1547 underlying enclosure macros as those presented in the list
1548 above.
1550 .Ql \&.Xo
1552 .Ql \&.Xc
1553 extended argument list macros
1554 were also built from the same underlying routines and are a good
1555 example of
1556 .Nm \-mdoc
1557 macro usage at its worst.
1558 .Ss No\-Op or Normal Text Macro
1559 The macro
1560 .Ql \&.No
1562 a hack for words in a macro command line which should
1563 .Em not
1564 be formatted and follows the conventional syntax
1565 for content macros.
1566 .Ss No Space Macro
1568 .Ql \&.Ns
1569 macro eliminates unwanted spaces in between macro requests.
1570 It is useful for old style argument lists where there is no space
1571 between the flag and argument:
1572 .Bl -tag -width ".Op Fl I Ns Ar directoryxx" -offset indent
1573 .It Li ".Op Fl I Ns Ar directory"
1574 produces
1575 .Op Fl I Ns Ar directory
1578 Note: the
1579 .Ql \&.Ns
1580 macro always invokes the
1581 .Ql \&.No
1582 macro after eliminating the space unless another macro name
1583 follows it.
1584 The macro
1585 .Ql \&.Ns
1586 is parsed and is callable.
1587 .Ss Section Cross References
1589 .Ql \&.Sx
1590 macro designates a reference to a section header
1591 within the same document.
1592 It is parsed and is callable.
1594 .Bl -tag -width "Li \&.Sx FILES" -offset 14n
1595 .It Li \&.Sx FILES
1596 .Sx FILES
1598 .Ss References and Citations
1599 The following macros make a modest attempt to handle references.
1600 At best, the macros make it convenient to manually drop in a subset of
1601 refer style references.
1603 .Bl -tag -width 6n -offset indent -compact
1604 .It Li ".Rs"
1605 Reference Start.
1606 Causes a line break and begins collection
1607 of reference information until the
1608 reference end macro is read.
1609 .It Li ".Re"
1610 Reference End.
1611 The reference is printed.
1612 .It Li ".%A"
1613 Reference author name, one name per invocation.
1614 .It Li ".%B"
1615 Book title.
1616 .It Li ".\&%C"
1617 City/place.
1618 .It Li ".\&%D"
1619 Date.
1620 .It Li ".%J"
1621 Journal name.
1622 .It Li ".%N"
1623 Issue number.
1624 .It Li ".%O"
1625 Optional information.
1626 .It Li ".%P"
1627 Page number.
1628 .It Li ".%R"
1629 Report name.
1630 .It Li ".%T"
1631 Title of article.
1632 .It Li ".%V"
1633 Volume(s).
1636 The macros beginning with
1637 .Ql %
1638 are not callable, and are parsed only for the trade name macro which
1639 returns to its caller.
1640 (And not very predictably at the moment either.)
1641 The purpose is to allow trade names
1642 to be pretty printed in
1643 .Xr troff Ns / Ns Xr ditroff
1644 output.
1645 .Ss Return Values
1647 .Ql \&.Rv
1648 macro generates text for use in the
1649 .Sx RETURN VALUES
1650 section.
1652 .Dl Usage: .Rv [-std function]
1654 .Ql \&.Rv -std atexit
1655 will generate the following text:
1657 .\" fake chapter 3 to avoid error message from Rv
1658 .ds cH 3
1659 .Rv -std atexit
1660 .\" and back to 7 again
1661 .ds cH 7
1664 .Fl std
1665 option is valid only for manual page sections 2 and 3.
1666 .Ss Trade Names (or Acronyms and Type Names)
1667 The trade name macro is generally a small caps macro for
1668 all upper case words longer than two characters.
1670 .Dl Usage: .Tn symbol ... \*(Pu
1671 .Bl -tag -width ".Tn ASCII" -compact -offset 14n
1672 .It Li \&.Tn DEC
1673 .Tn DEC
1674 .It Li \&.Tn ASCII
1675 .Tn ASCII
1679 .Ql \&.Tn
1680 macro
1681 is parsed and is callable by other macros.
1682 .Ss Extended  Arguments
1684 .Ql \&.Xo
1686 .Ql \&.Xc
1687 macros allow one to extend an argument list
1688 on a macro boundary.
1689 Argument lists cannot
1690 be extended within a macro
1691 which expects all of its arguments on one line such
1693 .Ql \&.Op .
1695 Here is an example of
1696 .Ql \&.Xo
1697 using the space mode macro to turn spacing off:
1698 .Bd -literal -offset indent
1699 \&.Sm off
1700 \&.It Xo Sy I Ar operation
1701 \&.No \een Ar count No \een
1702 \&.Xc
1703 \&.Sm on
1706 Produces
1707 .Bd -filled -offset indent
1708 .Bl -tag -width flag -compact
1709 .Sm off
1710 .It Xo Sy I Ar operation
1711 .No \en Ar count No \en
1713 .Sm on
1717 Another one:
1718 .Bd -literal -offset indent
1719 \&.Sm off
1720 \&.It Cm S No \&/ Ar old_pattern Xo
1721 \&.No \&/ Ar new_pattern
1722 \&.No \&/ Op Cm g
1723 \&.Xc
1724 \&.Sm on
1727 Produces
1728 .Bd -filled -offset indent
1729 .Bl -tag -width flag -compact
1730 .Sm off
1731 .It Cm S No \&/ Ar old_pattern Xo
1732 .No \&/ Ar new_pattern
1733 .No \&/ Op Cm g
1735 .Sm on
1739 Another example of
1740 .Ql \&.Xo
1741 and using enclosure macros:
1742 Test the value of an variable.
1743 .Bd -literal -offset indent
1744 \&.It Xo
1745 \&.Ic .ifndef
1746 \&.Oo \e&! Oc Ns Ar variable
1747 \&.Op Ar operator variable ...
1748 \&.Xc
1751 Produces
1752 .Bd -filled -offset indent
1753 .Bl -tag -width flag -compact
1754 .It Xo
1755 .Ic .ifndef
1756 .Oo \&! Oc Ns Ar variable
1757 .Op Ar operator variable ...
1762 All of the above examples have used the
1763 .Ql \&.Xo
1764 macro on the argument list of the
1765 .Ql \&.It
1766 (list-item)
1767 macro.
1768 The extend macros are not used very often, and when they are
1769 it is usually to extend the list-item argument list.
1770 Unfortunately, this is also where the extend macros are the
1771 most finicky.
1772 In the first two examples, spacing was turned off;
1773 in the third, spacing was desired in part of the output but
1774 not all of it.
1775 To make these macros work in this situation make sure
1777 .Ql \&.Xo
1779 .Ql \&.Xc
1780 macros are placed as shown in the third example.
1781 If the
1782 .Ql \&.Xo
1783 macro is not alone on the
1784 .Ql \&.It
1785 argument list, spacing will be unpredictable.
1787 .Ql \&.Ns
1788 (no space macro)
1789 must not occur as the first or last macro on a line
1790 in this situation.
1791 Out of 900 manual pages (about 1500 actual pages)
1792 currently released with
1794 only fifteen use the
1795 .Ql \&.Xo
1796 macro.
1797 .Sh PAGE STRUCTURE DOMAIN
1798 .Ss Section Headers
1799 The first three
1800 .Ql \&.Sh
1801 section header macros
1802 list below are required in every
1803 man page.
1804 The remaining section headers
1805 are recommended at the discretion of the author
1806 writing the manual page.
1808 .Ql \&.Sh
1809 macro can take up to nine arguments.
1810 It is parsed and but is not callable.
1811 .Bl -tag -width ".Sh SYNOPSIS"
1812 .It \&.Sh NAME
1814 .Ql \&.Sh NAME
1815 macro is mandatory.
1816 If not specified,
1817 the headers, footers and page layout defaults
1818 will not be set and things will be rather unpleasant.
1820 .Sx NAME
1821 section consists of at least three items.
1822 The first is the
1823 .Ql \&.Nm
1824 name macro naming the subject of the man page.
1825 The second is the Name Description macro,
1826 .Ql \&.Nd ,
1827 which separates the subject
1828 name from the third item, which is the description.
1830 description should be the most terse and lucid possible,
1831 as the space available is small.
1832 .It \&.Sh SYNOPSIS
1834 .Sx SYNOPSIS
1835 section describes the typical usage of the
1836 subject of a man page.
1837 The  macros required
1838 are either
1839 .Ql ".Nm" ,
1840 .Ql ".Cd" ,
1841 .Ql ".Fn" ,
1842 (and possibly
1843 .Ql ".Fo" ,
1844 .Ql ".Fc" ,
1845 .Ql ".Fd" ,
1846 .Ql ".Ft"
1847 macros).
1848 The function name
1849 macro
1850 .Ql ".Fn"
1851 is required
1852 for manual page sections 2 and 3, the command and general
1853 name macro
1854 .Ql \&.Nm
1855 is required for sections 1, 5, 6, 7, 8.
1856 Section 4 manuals require a
1857 .Ql ".Nm" , 
1858 .Ql ".Fd"
1859 or a
1860 .Ql ".Cd"
1861 configuration device usage macro.
1862 Several other macros may be necessary to produce
1863 the synopsis line as shown below:
1865 .Bd -filled -offset indent
1866 .Nm cat
1867 .Op Fl benstuv
1868 .Op Fl
1872 The following macros were used:
1874 .Dl \&.Nm cat
1875 .Dl \&.Op \&Fl benstuv
1876 .Dl \&.Op \&Fl
1877 .Dl \&.Ar
1879 .Sy Note :
1880 The macros
1881 .Ql \&.Op ,
1882 .Ql \&.Fl ,
1884 .Ql \&.Ar
1885 recognize the pipe bar character
1886 .Ql \*(Ba ,
1887 so a command line such as:
1889 .Dl ".Op Fl a | Fl b"
1891 will not go orbital.
1892 .Xr Troff
1893 normally interprets a \*(Ba as a special operator.
1895 .Sx PREDEFINED STRINGS
1896 for a usable \*(Ba
1897 character in other situations.
1898 .It \&.Sh DESCRIPTION
1899 In most cases the first text in the
1900 .Sx DESCRIPTION
1901 section
1902 is a brief paragraph on the command, function or file,
1903 followed by a lexical list of options and respective
1904 explanations.
1905 To create such a list, the
1906 .Ql \&.Bl
1907 begin-list,
1908 .Ql \&.It
1909 list-item and
1910 .Ql \&.El
1911 end-list
1912 macros are used (see
1913 .Sx Lists and Columns
1914 below).
1917 The following
1918 .Ql \&.Sh
1919 section headers are part of the
1920 preferred manual page layout and must be used appropriately
1921 to maintain consistency.
1922 They are listed in the order
1923 in which they would be used.
1924 .Bl -tag -width SYNOPSIS
1925 .It \&.Sh ENVIRONMENT
1927 .Sx ENVIRONMENT
1928 section should reveal any related
1929 environment
1930 variables and clues to their behavior and/or usage.
1931 .It \&.Sh EXAMPLES
1932 There are several ways to create examples.
1935 .Sx EXAMPLES
1936 section below
1937 for details.
1938 .It \&.Sh FILES
1939 Files which are used or created by the man page subject
1940 should be listed via the
1941 .Ql \&.Pa
1942 macro in the
1943 .Sx FILES
1944 section.
1945 .It \&.Sh SEE ALSO
1946 References to other material on the man page topic and
1947 cross references to other relevant man pages should
1948 be placed in the
1949 .Sx SEE ALSO
1950 section.
1951 Cross references
1952 are specified using the
1953 .Ql \&.Xr
1954 macro.
1955 Cross references in the
1956 .Sx SEE ALSO
1957 section should be sorted by section number, and then
1958 placed in alphabetical order and comma separated.  For example:
1960 .Xr ls 1 ,
1961 .Xr ps 1 ,
1962 .Xr group 5 ,
1963 .Xr passwd 5 .
1965 At this time
1966 .Xr refer 1
1967 style references are not accommodated.
1968 .It \&.Sh CONFORMING TO
1969 If the command, library function or file adheres to a
1970 specific implementation such as
1971 .St -p1003.2
1973 .St -ansiC
1974 this should be noted here.
1975 If the
1976 command does not adhere to any standard, its history
1977 should be noted in the
1978 .Sx HISTORY
1979 section.
1980 .It \&.Sh HISTORY
1981 Any command which does not adhere to any specific standards
1982 should be outlined historically in this section.
1983 .It \&.Sh AUTHORS
1984 Credits, if need be, should be placed here.
1985 .It \&.Sh DIAGNOSTICS
1986 Diagnostics from a command should be placed in this section.
1987 .It \&.Sh ERRORS
1988 Specific error handling, especially from library functions
1989 (man page sections 2 and 3) should go here.
1991 .Ql \&.Er
1992 macro is used to specify an errno.
1993 .It \&.Sh BUGS
1994 Blatant problems with the topic go here...
1997 User specified
1998 .Ql \&.Sh
1999 sections may be added,
2000 for example, this section was set with:
2001 .Bd -literal -offset 14n
2002 \&.Sh PAGE STRUCTURE DOMAIN
2004 .Ss Paragraphs and Line Spacing.
2005 .Bl -tag -width 6n
2006 .It \&.Pp
2008 .Ql \&.Pp
2009 paragraph command may
2010 be used to specify a line space where necessary.
2011 The macro is not necessary after a
2012 .Ql \&.Sh
2014 .Ql \&.Ss
2015 macro or before
2017 .Ql \&.Bl
2018 macro.
2019 (The
2020 .Ql \&.Bl
2021 macro asserts a vertical distance unless the -compact flag is given).
2023 .\" This worked with version one, need to redo for version three
2024 .\" .Pp
2025 .\" .Ds I
2026 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2027 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2028 .\" .Cl Cx \t\t
2029 .\" .Li \&.Cx\ (
2030 .\" .Cx
2031 .\" .Cl Cx \t\t
2032 .\" .Li \&.Va ax
2033 .\" .Cx
2034 .\" .Cl Cx \t\t
2035 .\" .Li \&.Sy \+
2036 .\" .Cx
2037 .\" .Cl Cx \&(\&
2038 .\" .Va ax
2039 .\" .Cx +
2040 .\" .Va by
2041 .\" .Cx +
2042 .\" .Va c )
2043 .\" .Cx \t
2044 .\" .Em is produced by
2045 .\" .Cx \t
2046 .\" .Li \&.Va by
2047 .\" .Cx
2048 .\" .Cl Cx \t\t
2049 .\" .Li \&.Sy \+
2050 .\" .Cx
2051 .\" .Cl Cx \t\t
2052 .\" .Li \&.Va c )
2053 .\" .Cx
2054 .\" .Cl Cx \t\t
2055 .\" .Li \&.Cx
2056 .\" .Cx
2057 .\" .Cw
2058 .\" .De
2059 .\" .Pp
2060 .\" This example shows the same equation in a different format.
2061 .\" The spaces
2062 .\" around the
2063 .\" .Li \&+
2064 .\" signs were forced with
2065 .\" .Li \e :
2066 .\" .Pp
2067 .\" .Ds I
2068 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
2069 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2070 .\" .Cl Cx \t\t
2071 .\" .Li \&.Cx\ (
2072 .\" .Cx
2073 .\" .Cl Cx \t\t
2074 .\" .Li \&.Va a
2075 .\" .Cx
2076 .\" .Cl Cx \t\t
2077 .\" .Li \&.Sy x
2078 .\" .Cx
2079 .\" .Cl Cx \t\t
2080 .\" .Li \&.Cx \e\ +\e\ \e&
2081 .\" .Cx
2082 .\" .Cl Cx \&(\&
2083 .\" .Va a
2084 .\" .Sy x
2085 .\" .Cx \ +\ \&
2086 .\" .Va b
2087 .\" .Sy y
2088 .\" .Cx \ +\ \&
2089 .\" .Va c )
2090 .\" .Cx \t
2091 .\" .Em is produced by
2092 .\" .Cl Cx \t\t
2093 .\" .Li \&.Va b
2094 .\" .Cx
2095 .\" .Cl Cx \t\t
2096 .\" .Li \&.Sy y
2097 .\" .Cx
2098 .\" .Cl Cx \t\t
2099 .\" .Li \&.Cx \e\ +\e\ \e&
2100 .\" .Cx
2101 .\" .Cl Cx \t\t
2102 .\" .Li \&.Va c )
2103 .\" .Cx
2104 .\" .Cl Cx \t\t
2105 .\" .Li \&.Cx
2106 .\" .Cx
2107 .\" .Cw
2108 .\" .De
2109 .\" .Pp
2110 .\" The incantation below was
2111 .\" lifted from the
2112 .\" .Xr adb 1
2113 .\" manual page:
2114 .\" .Pp
2115 .\" .Ds I
2116 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
2117 .\" .Cl Cx \t\t
2118 .\" .Li \&.Cx Op Sy ?/
2119 .\" .Cx
2120 .\" .Cl Cx \t\t
2121 .\" .Li \&.Nm m
2122 .\" .Cx
2123 .\" .Cl Cx Op Sy ?/
2124 .\" .Nm m
2125 .\" .Ad \ b1 e1 f1
2126 .\" .Op Sy ?/
2127 .\" .Cx \t
2128 .\" .Em is produced by
2129 .\" .Cx \t
2130 .\" .Li \&.Ar \e\ b1 e1 f1
2131 .\" .Cx
2132 .\" .Cl Cx \t\t
2133 .\" .Li \&.Op Sy ?/
2134 .\" .Cx
2135 .\" .Cl Cx \t\t
2136 .\" .Li \&.Cx
2137 .\" .Cx
2138 .\" .Cw
2139 .\" .De
2140 .\" .Pp
2141 .Ss Keeps
2142 The only keep that is implemented at this time is for words.
2143 The macros are
2144 .Ql \&.Bk
2145 (begin-keep)
2147 .Ql \&.Ek
2148 (end-keep).
2149 The only option that
2150 .Ql \&.Bk
2151 accepts is
2152 .Fl words
2153 and is useful for preventing line breaks in the middle of options.
2154 In the example for the make command line arguments (see
2155 .Sx What's in a name ) ,
2156 the keep prevented
2157 .Xr nroff
2158 from placing up the
2159 flag and the argument
2160 on separate lines.
2161 (Actually, the option macro used to prevent this from occurring,
2162 but was dropped when the decision (religious) was made to force
2163 right justified margins in
2164 .Xr troff
2165 as options in general look atrocious when spread across a sparse
2166 line.
2167 More work needs to be done with the keep macros, a
2168 .Fl line
2169 option needs to be added.)
2170 .Ss Examples and Displays
2171 There are five types of displays, a quickie one line indented display
2172 .Ql \&.D1 ,
2173 a quickie one line literal display
2174 .Ql \&.Dl ,
2175 and a block literal, block filled and block ragged which use
2177 .Ql \&.Bd
2178 begin-display
2180 .Ql \&.Ed
2181 end-display macros.
2183 .Bl -tag -width \&.Dlxx
2184 .It Li \&.D1
2185 (D-one) Display one line of indented text.
2186 This macro is parsed, but it is not callable.
2188 .Dl Fl ldghfstru
2190 The above was produced by:
2191 .Li \&.Dl Fl ldghfstru .
2192 .It Li \&.Dl
2193 (D-ell)
2194 Display one line of indented
2195 .Em literal
2196 text.
2198 .Ql \&.Dl
2199 example macro has been used throughout this
2200 file.
2201 It allows
2202 the indent (display) of one line of text.
2203 Its default font is set to
2204 constant width (literal) however
2205 it is parsed and will recognized other macros.
2206 It is not callable however.
2208 .Dl % ls -ldg /usr/local/bin
2210 The above was produced by
2211 .Li \&.Dl % ls -ldg /usr/local/bin .
2212 .It Li \&.Bd
2213 Begin-display.
2215 .Ql \&.Bd
2216 display must be ended with the
2217 .Ql \&.Ed
2218 macro.
2219 Displays may be nested within displays and
2220 lists.
2221 .Ql \&.Bd
2222 has the following syntax:
2224 .Dl ".Bd display-type [-offset offset_value] [-compact]"
2226 The display-type must be one of the following four types and
2227 may have an offset specifier for indentation:
2228 .Ql \&.Bd .
2230 .Bl -tag -width "file file_name  " -compact
2231 .It Fl ragged
2232 Display a block of text as typed,
2233 right (and left) margin edges are left ragged.
2234 .It Fl filled
2235 Display a filled (formatted) block.
2236 The block of text is formatted (the edges are filled \-
2237 not left unjustified).
2238 .It Fl literal
2239 Display a literal block, useful for source code or
2240 simple tabbed or spaced text.
2241 .It Fl file Ar file_name
2242 The file name following the
2243 .Fl file
2244 flag is read and displayed.
2245 Literal mode is
2246 asserted and tabs are set at 8 constant width character
2247 intervals, however any
2248 .Xr troff/ Ns Nm \-mdoc
2249 commands in file will be processed.
2250 .It Fl offset Ar string
2252 .Fl offset
2253 is specified with one of the following strings, the string
2254 is interpreted to indicate the level of indentation for the
2255 forthcoming block of text:
2257 .Bl -tag -width "indent-two" -compact
2258 .It Ar left
2259 Align block on the current left margin,
2260 this is the default mode of
2261 .Ql \&.Bd .
2262 .It Ar center
2263 Supposedly center the block.
2264 At this time
2265 unfortunately, the block merely gets
2266 left aligned about an imaginary center margin.
2267 .It Ar indent
2268 Indents by one default indent value or tab.
2269 The default
2270 indent value is also used for the
2271 .Ql \&.D1
2272 display so one is guaranteed the two types of displays
2273 will line up.
2274 This indent is normally set to 6n or about two
2275 thirds of an inch (six constant width characters).
2276 .It Ar indent-two
2277 Indents two times the default indent value.
2278 .It Ar right
2279 This
2280 .Em left
2281 aligns the block about two inches from
2282 the right side of the page.
2283 This macro needs
2284 work and perhaps may never do the right thing by
2285 .Xr troff .
2288 .It ".Ed"
2289 End-display.
2291 .Ss Font Modes
2292 There are five macros for changing the appearance of the manual page text:
2293 .Bl -tag -width \&.Emxx
2294 .It \&.Em
2295 Text may be stressed or emphasized with the
2296 .Ql \&.Em
2297 macro.
2298 The usual font for emphasis is italic.
2300 .Dl Usage: .Em argument ... \*(Pu
2301 .Bl -tag -width ".Em vide infra ) ) ," -compact -offset 14n
2302 .It Li ".Em does not"
2303 .Em does not
2304 .It Li ".Em exceed 1024 ."
2305 .Em exceed 1024 .
2306 .It Li ".Em vide infra ) ) ,"
2307 .Em vide infra ) ) ,
2311 .Ql \&.Em
2312 macro is parsed and is callable.
2313 It is an error to call
2314 .Ql \&.Em
2315 without arguments.
2316 .It \&.Li
2318 .Ql \&.Li
2319 literal macro may be used for special characters,
2320 variable constants, anything which should be displayed as it
2321 would be typed.
2323 .Dl Usage: .Li argument ... \*(Pu
2324 .Bl -tag -width ".Li cntrl-D ) ,"  -compact -offset 14n
2325 .It Li \&.Li \een
2326 .Li \en
2327 .It Li \&.Li M1 M2 M3\ ;
2328 .Li M1 M2 M3 ;
2329 .It Li \&.Li cntrl-D\ )\ ,
2330 .Li cntrl-D ) ,
2331 .It Li \&.Li 1024\ ...
2332 .Li 1024 ...
2336 .Ql \&.Li
2337 macro is parsed and is callable.
2338 .It \&.Sy
2339 The symbolic emphasis macro is generally a boldface macro in
2340 either the symbolic sense or the traditional English usage.
2342 .Dl Usage: .Sy symbol ... \*(Pu
2343 .Bl -tag -width ".Sy Important Noticex" -compact -offset 14n
2344 .It Li \&.Sy Important Notice
2345 .Sy Important Notice
2349 .Ql \&.Sy
2350 macro is parsed and is callable.
2351 Arguments to
2352 .Ql \&.Sy
2353 may be quoted.
2354 .It Li \&.Bf
2355 Begin font mode.
2357 .Ql \&.Bf
2358 font mode must be ended with the
2359 .Ql \&.Ef
2360 macro.
2361 Font modes may be nested within other font modes.
2362 .Ql \&.Bf
2363 has the following syntax:
2365 .Dl ".Bf font-mode"
2367 The font-mode must be one of the following three types:
2368 .Ql \&.Bf .
2370 .Bl -tag -width "file file_name  " -compact
2371 .It Sy \&Em | Fl emphasis
2372 Same as if the 
2373 .Ql \&.Em
2374 macro was used for the entire block of text.
2375 .It Sy \&Li | Fl literal
2376 Same as if the
2377 .Ql \&.Li
2378 macro was used for the entire block of text.
2379 .It Sy \&Sy | Fl symbolic
2380 Same as if the
2381 .Ql \&.Sy
2382 macro was used for the entire block of text.
2384 .It ".Ef"
2385 End font mode.
2387 .Ss Tagged Lists and Columns
2388 There are several types of lists which may be initiated with the
2389 .Ql ".Bl"
2390 begin-list macro.
2391 Items within the list
2392 are specified with the
2393 .Ql ".It"
2394 item macro and
2395 each list must end with the
2396 .Ql ".El"
2397 macro.
2398 Lists may be nested within themselves and within displays.
2399 Columns may be used inside of lists, but lists are unproven
2400 inside of columns.
2402 In addition, several list attributes may be specified such as
2403 the width of a tag, the list offset, and compactness
2404 (blank lines between items allowed or disallowed).
2405 Most of this document has been formatted with a tag style list
2406 .Pq Fl tag .
2407 For a change of pace, the list-type used to present the list-types
2408 is an over-hanging list
2409 .Pq Fl ohang .
2410 This type of list is quite popular with
2411 .Tn TeX
2412 users, but might look a bit funny after having read many pages of
2413 tagged lists.
2414 The following list types are accepted by
2415 .Ql ".Bl" :
2417 .Bl -ohang -compact
2418 .It Fl bullet
2419 .It Fl item
2420 .It Fl enum
2421 These three are the simplest types of lists.
2422 Once the
2423 .Ql ".Bl"
2424 macro has been given, items in the list are merely
2425 indicated by a line consisting solely of the
2426 .Ql ".It"
2427 macro.
2428 For example, the source text for a simple enumerated list
2429 would look like:
2430 .Bd -literal -offset indent-two
2431 \&.Bl -enum -compact
2432 \&.It
2433 \&Item one goes here.
2434 \&.It
2435 \&And item two here.
2436 \&.It
2437 \&Lastly item three goes here.
2438 \&.El
2441 The results:
2443 .Bl -enum -offset indent-two -compact
2445 Item one goes here.
2447 And item two here.
2449 Lastly item three goes here.
2452 A simple bullet list construction:
2453 .Bd -literal -offset indent-two
2454 \&.Bl -bullet -compact
2455 \&.It
2456 \&Bullet one goes here.
2457 \&.It
2458 \&Bullet two here.
2459 \&.El
2462 Produces:
2463 .Bl -bullet -offset indent-two -compact
2465 Bullet one goes here.
2467 Bullet two here.
2470 .It Fl tag
2471 .It Fl diag
2472 .It Fl hang
2473 .It Fl ohang
2474 .It Fl inset
2475 These list-types collect arguments specified with the
2476 .Ql \&.It
2477 macro and create a label which may be
2478 .Em inset
2479 into the forthcoming text,
2480 .Em hanged
2481 from the forthcoming text,
2482 .Em overhanged
2483 from above and not indented or
2484 .Em tagged .
2485 This
2486 list was constructed with the
2487 .Ql Fl ohang
2488 list-type.
2490 .Ql \&.It
2491 macro is parsed only for the inset, hang
2492 and tag list-types and is not callable.
2493 Here is an example of inset labels:
2494 .Bl -inset -offset indent
2495 .It Em Tag
2496 The tagged list (also called a tagged paragraph) is the
2497 most common type of list used in the Berkeley manuals.
2498 .It Em Diag
2499 Diag lists create section four diagnostic lists
2500 and are similar to inset lists except callable
2501 macros are ignored.
2502 .It Em Hang
2503 Hanged labels are a matter of taste.
2504 .It Em Ohang
2505 Overhanging labels are nice when space is constrained.
2506 .It Em Inset
2507 Inset labels are useful for controlling blocks of
2508 paragraphs and are valuable for converting
2509 .Nm \-mdoc
2510 manuals to other formats.
2513 Here is the source text which produced the above example:
2514 .Bd -literal -offset indent
2515 \&.Bl -inset -offset indent
2516 \&.It Em Tag
2517 \&The tagged list (also called a tagged paragraph) is the
2518 \&most common type of list used in the Berkeley manuals.
2519 \&.It Em Diag
2520 \&Diag lists create section four diagnostic lists
2521 \&and are similar to inset lists except callable
2522 \&macros are ignored.
2523 \&.It Em Hang
2524 \&Hanged labels are a matter of taste.
2525 \&.It Em Ohang
2526 \&Overhanging labels are nice when space is constrained.
2527 \&.It Em Inset
2528 \&Inset labels are useful for controlling blocks of
2529 \&paragraphs and are valuable for converting
2530 \&.Nm \-mdoc
2531 \&manuals to other formats.
2532 \&.El
2535 Here is a hanged list with two items:
2536 .Bl -hang -offset indent
2537 .It Em Hanged
2538 labels appear similar to tagged lists when the
2539 label is smaller than the label width.
2540 .It Em Longer hanged list labels
2541 blend in to the paragraph unlike
2542 tagged paragraph labels.
2545 And the unformatted text which created it:
2546 .Bd -literal -offset indent
2547 \&.Bl -hang -offset indent
2548 \&.It Em Hanged
2549 \&labels appear similar to tagged lists when the
2550 \&label is smaller than the label width.
2551 \&.It Em Longer hanged list labels
2552 \&blend in to the paragraph unlike
2553 \&tagged paragraph labels.
2554 \&.El
2557 The tagged list which follows uses an optional width specifier to control
2558 the width of the tag.
2560 .Bl -tag -width "PAGEIN" -compact -offset indent
2561 .It SL
2562 sleep time of the process (seconds blocked)
2563 .It PAGEIN
2564 number of disk
2565 .Tn I/O Ns 's
2566 resulting from references
2567 by the process to pages not loaded in core.
2568 .It UID
2569 numerical user-id of process owner
2570 .It PPID
2571 numerical id of parent of process process priority
2572 (non-positive when in non-interruptible wait)
2575 The raw text:
2576 .Bd -literal -offset indent
2577 \&.Bl -tag -width "PAGEIN" -compact -offset indent
2578 \&.It SL
2579 \&sleep time of the process (seconds blocked)
2580 \&.It PAGEIN
2581 \&number of disk
2582 \&.Tn I/O Ns 's
2583 \&resulting from references
2584 \&by the process to pages not loaded in core.
2585 \&.It UID
2586 \&numerical user-id of process owner
2587 \&.It PPID
2588 \&numerical id of parent of process process priority
2589 \&(non-positive when in non-interruptible wait)
2590 \&.El
2593 Acceptable width specifiers:
2594 .Bl -tag -width Ar -offset indent
2595 .It Fl width Ar "\&Fl"
2596 sets the width to the default width for a flag.
2597 All callable
2598 macros have a default width value.
2600 .Ql \&.Fl ,
2601 value is presently
2602 set to ten constant width characters or about five sixth of
2603 an inch.
2604 .It Fl width Ar "24n"
2605 sets the width to 24 constant width characters or about two
2606 inches.
2608 .Ql n
2609 is absolutely necessary for the scaling to work correctly.
2610 .It Fl width Ar "ENAMETOOLONG"
2611 sets width to the constant width length of the
2612 string given.
2613 .It Fl width  Ar "\\*qint mkfifo\\*q"
2614 again, the width is set to the constant width of the string
2615 given.
2618 If a width is not specified for the tag list type, the first
2619 time
2620 .Ql \&.It
2621 is invoked, an attempt is made to determine an appropriate
2622 width.
2623 If the first argument to
2624 .Ql ".It"
2625 is a callable macro, the default width for that macro will be used
2626 as if the macro name had been supplied as the width.
2627 However,
2628 if another item in the list is given with a different callable
2629 macro name, a new and nested list is assumed.
2630 .Sh PREDEFINED STRINGS
2631 The following strings are predefined as may be used by
2632 preceding with the troff string interpreting sequence
2633 .Ql \&\e*(xx
2634 where
2635 .Em xx
2636 is the name of the defined string or as
2637 .Ql \&\e*x
2638 where
2639 .Em x
2640 is the name of the string.
2641 The interpreting sequence may be used any where in the text.
2643 .Bl -column "String " "Nroff " "Troff " -offset indent
2644 .It Sy "String  Nroff   Troff"
2645 .It Li "<=" Ta \&<\&= Ta \*(<=
2646 .It Li ">=" Ta \&>\&= Ta \*(>=
2647 .It Li "Rq" Ta "''" Ta \*(Rq
2648 .It Li "Lq" Ta "``" Ta \*(Lq
2649 .It Li "ua" Ta ^ Ta \*(ua
2650 .It Li "aa" Ta ' Ta \*(aa
2651 .It Li "ga" Ta \` Ta \*(ga
2652 .\" .It Li "sL" Ta ` Ta \*(sL
2653 .\" .It Li "sR" Ta ' Ta \*(sR
2654 .It Li "q" Ta \&" Ta \*q
2655 .It Li "Pi" Ta pi Ta \*(Pi
2656 .It Li "Ne" Ta != Ta \*(Ne
2657 .It Li "Le" Ta <= Ta \*(Le
2658 .It Li "Ge" Ta >= Ta \*(Ge
2659 .It Li "Lt" Ta < Ta \*(Gt
2660 .It Li "Gt" Ta > Ta \*(Lt
2661 .It Li "Pm" Ta +- Ta \*(Pm
2662 .It Li "If" Ta infinity Ta \*(If
2663 .It Li "Na" Ta \fINaN\fP Ta \*(Na
2664 .It Li "Ba" Ta \fR\&|\fP Ta \*(Ba
2667 .Sy Note :
2668 The string named
2669 .Ql q
2670 should be written as
2671 .Ql \e*q
2672 since it is only one char.
2673 .Sh DIAGNOSTICS
2674 The debugging facilities for
2675 .Nm \-mdoc
2676 are limited, but can help detect subtle errors such
2677 as the collision of an argument name with an internal
2678 register or macro name.
2679 (A what?)
2680 A register is an arithmetic storage class for
2681 .Xr troff
2682 with a one or two character name.
2683 All registers internal to
2684 .Nm \-mdoc
2686 .Xr troff
2688 .Xr ditroff
2689 are two characters and
2690 of the form <upper_case><lower_case> such as
2691 .Ql \&Ar ,
2692 <lower_case><upper_case> as
2693 .Ql \&aR
2695 <upper or lower letter><digit> as
2696 .Ql \&C\&1 .
2697 And adding to the muddle,
2698 .Xr troff
2699 has its own internal registers all of which are either
2700 two lower case characters or a dot plus a letter or meta-character
2701 character.
2702 In one of the introduction examples, it was shown how to
2703 prevent the interpretation of a macro name with the escape sequence
2704 .Ql \e& .
2705 This is sufficient for the internal register names also.
2707 .\" Every callable macro name has a corresponding register
2708 .\" of the same name (<upper_case><lower_case>).
2709 .\" There are also specific registers which have
2710 .\" been used for stacks and arrays and are listed in the
2711 .\" .Sx Appendix .
2712 .\" .Bd -ragged -offset 4n
2713 .\" [A-Z][a-z]  registers corresponding to macro names (example ``Ar'')
2714 .\" [a-z][A-Z]  registers corresponding to macro names (example ``aR'')
2715 .\" C[0-9]              argument types (example C1)
2716 .\" O[0-9]              offset stack (displays)
2717 .\" h[0-9]              horizontal spacing stack (lists)
2718 .\" o[0-9]              offset (stack) (lists)
2719 .\" t[0-9]              tag stack (lists)
2720 .\" v[0-9]              vertical spacing stack (lists)
2721 .\" w[0-9]              width tag/label stack
2722 .\" .Ed
2723 .\" .Pp
2724 If a non-escaped register name is given in the argument list of a request
2725 unpredictable behavior will occur.
2726 In general, any time huge portions
2727 of text do not appear where expected in the output, or small strings
2728 such as list tags disappear, chances are there is a misunderstanding
2729 about an argument type in the argument list.
2730 Your mother never intended for you to remember this evil stuff - so here
2731 is a way to find out whether or not your arguments are valid: The
2732 .Ql \&.Db
2733 (debug)
2734 macro displays the interpretation of the argument list for most
2735 macros.
2736 Macros such as the
2737 .Ql \&.Pp
2738 (paragraph)
2739 macro do not contain debugging information.
2740 All of the callable macros do,
2741 and it is strongly advised whenever in doubt,
2742 turn on the
2743 .Ql \&.Db
2744 macro.
2746 .Dl Usage: \&.Db [on | off]
2748 An example of a portion of text with
2749 the debug macro placed above and below an
2750 artificially created problem (a flag argument
2751 .Ql \&aC
2752 which should be
2753 .Ql \e&aC
2754 in order to work):
2755 .Bd -literal -offset indent
2756 \&.Db on
2757 \&.Op Fl aC Ar file )
2758 \&.Db off
2761 The resulting output:
2762 .Bd -literal -offset indent
2763 DEBUGGING ON
2764 DEBUG(argv) MACRO: `.Op'  Line #: 2
2765         Argc: 1  Argv: `Fl'  Length: 2
2766         Space: `'  Class: Executable
2767         Argc: 2  Argv: `aC'  Length: 2
2768         Space: `'  Class: Executable
2769         Argc: 3  Argv: `Ar'  Length: 2
2770         Space: `'  Class: Executable
2771         Argc: 4  Argv: `file'  Length: 4
2772         Space: ` '  Class: String
2773         Argc: 5  Argv: `)'  Length: 1
2774         Space: ` '  Class: Closing Punctuation or suffix
2775         MACRO REQUEST: .Op Fl aC Ar file )
2776 DEBUGGING OFF
2779 The first line of information tells the name of the calling
2780 macro, here
2781 .Ql \&.Op ,
2782 and the line number it appears on.
2783 If one or more files are involved
2784 (especially if text from another file is included) the line number
2785 may be bogus.
2786 If there is only one file, it should be accurate.
2787 The second line gives the argument count, the argument
2788 .Pq Ql \&Fl
2789 and its length.
2790 If the length of an argument is two characters, the
2791 argument is tested to see if it is executable (unfortunately, any
2792 register which contains a non-zero value appears executable).
2793 The third line gives the space allotted for a class, and the
2794 class type.
2795 The problem here is the argument aC should not be
2796 executable.
2797 The four types of classes are string, executable, closing
2798 punctuation and opening punctuation.
2799 The last line shows the entire
2800 argument list as it was read.
2801 In this next example, the offending
2802 .Ql \&aC
2803 is escaped:
2804 .Bd -literal -offset indent
2805 \&.Db on
2806 \&.Em An escaped \e&aC
2807 \&.Db off
2809 .Bd -literal -offset indent
2810 DEBUGGING ON
2811 DEBUG(fargv) MACRO: `.Em'  Line #: 2
2812         Argc: 1  Argv: `An'  Length: 2
2813         Space: ` '  Class: String
2814         Argc: 2  Argv: `escaped'  Length: 7
2815         Space: ` '  Class: String
2816         Argc: 3  Argv: `aC'  Length: 2
2817         Space: ` '  Class: String
2818         MACRO REQUEST: .Em An escaped &aC
2819 DEBUGGING OFF
2822 The argument
2823 .Ql \e&aC
2824 shows up with the same length of 2 as the
2825 .Ql \e&
2826 sequence produces a zero width, but a register
2827 named
2828 .Ql \e&aC
2829 was not found and the type classified as string.
2831 Other diagnostics consist of usage statements and are self explanatory.
2832 .Sh GROFF, TROFF AND NROFF
2834 .Nm \-mdoc
2835 package does not need compatibility mode with
2836 .Xr groff .
2838 The package inhibits page breaks, and the headers and footers
2839 which normally occur at those breaks with
2840 .Xr nroff ,
2841 to make the manual more efficient for viewing on-line.
2842 At the moment,
2843 .Xr groff
2844 with
2845 .Fl T Ns Ar ascii
2846 does eject the imaginary remainder of the page at end of file.
2847 The inhibiting of the page breaks makes
2848 .Xr nroff Ns 'd
2849 files unsuitable for hardcopy.
2850 There is a register named
2851 .Ql \&cR
2852 which can be set to zero in the site dependent style file
2853 .Pa /usr/src/share/tmac/doc-nroff
2854 to restore the old style behavior.
2855 .Sh FILES
2856 .Bl -tag -width /usr/share/man0/template.doc -compact
2857 .It Pa /usr/share/tmac/tmac.doc
2858 manual macro package
2859 .It Pa /usr/share/misc/mdoc.template
2860 template for writing a man page
2861 .It Pa /usr/share/examples/mdoc/*
2862 several example man pages
2864 .Sh SEE ALSO
2865 .Xr man 1 ,
2866 .Xr troff 1 ,
2867 .Xr mdoc 7
2868 .Sh BUGS
2869 Undesirable hyphenation on the dash of a flag
2870 argument is not yet resolved, and causes
2871 occasional mishaps in the
2872 .Sx DESCRIPTION
2873 section.
2874 (line break on the hyphen).
2876 Predefined strings are not declared in documentation.
2878 Section 3f has not been added to the header routines.
2880 .Ql \&.Nm
2881 font should be changed in
2882 .Sx NAME
2883 section.
2885 .Ql \&.Fn
2886 needs to have a check to prevent splitting up
2887 if the line length is too short.
2888 Occasionally it
2889 separates the last parenthesis, and sometimes
2890 looks ridiculous if a line is in fill mode.
2892 The method used to prevent header and footer page
2893 breaks (other than the initial header and footer) when using
2894 nroff occasionally places an unsightly partially filled line (blank)
2895 at the would be bottom of the page.
2897 The list and display macros to not do any keeps
2898 and certainly should be able to.
2899 .\" Note what happens if the parameter list overlaps a newline
2900 .\" boundary.
2901 .\" to make sure a line boundary is crossed:
2902 .\" .Bd -literal
2903 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
2904 .\" .Ed
2905 .\" .Pp
2906 .\" produces, nudge nudge,
2907 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2908 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2909 .\" nudge
2910 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
2911 .\" .Pp
2912 .\" If double quotes are used, for example:
2913 .\" .Bd -literal
2914 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
2915 .\" .Ed
2916 .\" .Pp
2917 .\" produces, nudge nudge,
2918 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2919 .\" nudge
2920 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2921 .\" nudge
2922 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
2923 .\" .Pp
2924 .\" Not a pretty sight...
2925 .\" In a paragraph, a long parameter containing unpaddable spaces as
2926 .\" in the former example will cause
2927 .\" .Xr troff
2928 .\" to break the line and spread
2929 .\" the remaining words out.
2930 .\" The latter example will adjust nicely to
2931 .\" justified margins, but may break in between an argument and its
2932 .\" declaration.
2933 .\" In
2934 .\" .Xr nroff
2935 .\" the right margin adjustment is normally ragged and the problem is
2936 .\" not as severe.