OSDN Git Service

(split) LDP: Update original to LDP v3.50.
[linuxjm/LDP_man-pages.git] / original / man7 / man.7
1 .\" (C) Copyright 1992-1999 Rickard E. Faith and David A. Wheeler
2 .\" (faith@cs.unc.edu and dwheeler@ida.org)
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\" Modified Sun Jul 25 11:06:05 1993 by Rik Faith (faith@cs.unc.edu)
27 .\" Modified Sat Jun  8 00:39:52 1996 by aeb
28 .\" Modified Wed Jun 16 23:00:00 1999 by David A. Wheeler (dwheeler@ida.org)
29 .\" Modified Thu Jul 15 12:43:28 1999 by aeb
30 .\" Modified Sun Jan  6 18:26:25 2002 by Martin Schulze <joey@infodrom.org>
31 .\" Modified Tue Jul 27 20:12:02 2004 by Colin Watson <cjwatson@debian.org>
32 .\" 2007-05-30, mtk: various rewrites and moved much text to new man-pages.7.
33 .\"
34 .TH MAN 7 2012-08-05 "Linux" "Linux Programmer's Manual"
35 .SH NAME
36 man \- macros to format man pages
37 .SH SYNOPSIS
38 .B groff \-Tascii \-man
39 .I file
40 \&...
41 .LP
42 .B groff \-Tps \-man
43 .I file
44 \&...
45 .LP
46 .B man
47 .RI [ section ]
48 .I title
49 .SH DESCRIPTION
50 This manual page explains the
51 .B "groff an.tmac"
52 macro package (often called the
53 .B man
54 macro package).
55 This macro package should be used by developers when
56 writing or porting man pages for Linux.
57 It is fairly compatible with other
58 versions of this macro package, so porting man pages should not be a major
59 problem (exceptions include the NET-2 BSD release, which uses a totally
60 different macro package called mdoc; see
61 .BR mdoc (7)).
62 .PP
63 Note that NET-2 BSD mdoc man pages can be used with
64 .B groff
65 simply by specifying the
66 .B \-mdoc
67 option instead of the
68 .B \-man
69 option.
70 Using the
71 .B \-mandoc
72 option is, however, recommended, since this will automatically detect which
73 macro package is in use.
74 .PP
75 For conventions that should be employed when writing man pages
76 for the Linux \fIman-pages\fP package, see
77 .BR man-pages (7).
78 .SS Title line
79 The first command in a man page (after comment lines,
80 that is, lines that start with \fB.\\"\fP) should be
81 .RS
82 .sp
83 .B \&.TH
84 .I "title section date source manual"
85 .sp
86 .RE
87 For details of the arguments that should be supplied to the \fBTH\fP
88 command, see
89 .BR man-pages (7).
90 .PP
91 Note that BSD mdoc-formatted pages begin with the
92 .B Dd
93 command, not the
94 .B TH
95 command.
96 .SS Sections
97 Sections are started with
98 .B \&.SH
99 followed by the heading name.
100 .\" The following doesn't seem to be required (see Debian bug 411303),
101 .\" If the name contains spaces and appears
102 .\" on the same line as
103 .\" .BR \&.SH ,
104 .\" then place the heading in double quotes.
105
106 The only mandatory heading is NAME, which should be the first section and
107 be followed on the next line by a one-line description of the program:
108 .RS
109 .sp
110 \&.SH NAME
111 .br
112 item \\- description
113 .sp
114 .RE
115 It is extremely important that this format is followed, and that there is a
116 backslash before the single dash which follows the item name.
117 This syntax is used by the
118 .BR mandb (8)
119 program to create a database of short descriptions for the
120 .BR whatis (1)
121 and
122 .BR apropos (1)
123 commands.
124 (See
125 .BR lexgrog (1)
126 for further details on the syntax of the NAME section.)
127 .PP
128 For a list of other sections that might appear in a manual page, see
129 .BR man-pages (7).
130 .SS Fonts
131 The commands to select the type face are:
132 .TP 4
133 .B \&.B
134 Bold
135 .TP
136 .B \&.BI
137 Bold alternating with italics
138 (especially useful for function specifications)
139 .TP
140 .B \&.BR
141 Bold alternating with Roman
142 (especially useful for referring to other
143 manual pages)
144 .TP
145 .B \&.I
146 Italics
147 .TP
148 .B \&.IB
149 Italics alternating with bold
150 .TP
151 .B \&.IR
152 Italics alternating with Roman
153 .TP
154 .B \&.RB
155 Roman alternating with bold
156 .TP
157 .B \&.RI
158 Roman alternating with italics
159 .TP
160 .B \&.SB
161 Small alternating with bold
162 .TP
163 .B \&.SM
164 Small (useful for acronyms)
165 .LP
166 Traditionally, each command can have up to six arguments, but the GNU
167 implementation removes this limitation (you might still want to limit
168 yourself to 6 arguments for portability's sake).
169 Arguments are delimited by spaces.
170 Double quotes can be used to specify an argument which contains spaces.
171 All of the arguments will be printed next to each other without
172 intervening spaces, so that the
173 .B \&.BR
174 command can be used to specify a word in bold followed by a mark of
175 punctuation in Roman.
176 If no arguments are given, the command is applied to the following line
177 of text.
178 .SS Other macros and strings
179 .PP
180 Below are other relevant macros and predefined strings.
181 Unless noted otherwise, all macros
182 cause a break (end the current line of text).
183 Many of these macros set or use the "prevailing indent."
184 The "prevailing indent" value is set by any macro with the parameter
185 .I i
186 below;
187 macros may omit
188 .I i
189 in which case the current prevailing indent will be used.
190 As a result, successive indented paragraphs can use the same indent without
191 respecifying the indent value.
192 A normal (nonindented) paragraph resets the prevailing indent value
193 to its default value (0.5 inches).
194 By default a given indent is measured in ens;
195 try to use ens or ems as units for
196 indents, since these will automatically adjust to font size changes.
197 The other key macro definitions are:
198 .SS Normal paragraphs
199 .TP 9m
200 .B \&.LP
201 Same as
202 .B \&.PP
203 (begin a new paragraph).
204 .TP
205 .B \&.P
206 Same as
207 .B \&.PP
208 (begin a new paragraph).
209 .TP
210 .B \&.PP
211 Begin a new paragraph and reset prevailing indent.
212 .SS Relative margin indent
213 .TP 9m
214 .BI \&.RS " i"
215 Start relative margin indent: moves the left margin
216 .I i
217 to the right (if
218 .I i
219 is omitted, the prevailing indent value is used).
220 A new prevailing indent is set to 0.5 inches.
221 As a result, all following paragraph(s) will be
222 indented until the corresponding
223 .BR \&.RE .
224 .TP
225 .B \&.RE
226 End relative margin indent and
227 restores the previous value of the prevailing indent.
228 .SS Indented paragraph macros
229 .TP 9m
230 .BI \&.HP " i"
231 Begin paragraph with a hanging indent
232 (the first line of the paragraph is at the left margin of
233 normal paragraphs, and the rest of the paragraph's lines are indented).
234 .TP
235 .BI \&.IP " x i"
236 Indented paragraph with optional hanging tag.
237 If the tag
238 .I x
239 is omitted, the entire following paragraph is indented by
240 .IR i .
241 If the tag
242 .I x
243 is provided, it is hung at the left margin
244 before the following indented paragraph
245 (this is just like
246 .B \&.TP
247 except the tag is included with the command instead of being on the
248 following line).
249 If the tag is too long, the text after the tag will be moved down to the
250 next line (text will not be lost or garbled).
251 For bulleted lists, use this macro with \e(bu (bullet) or \e(em (em dash)
252 as the tag, and for numbered lists, use the number or letter followed by
253 a period as the tag;
254 this simplifies translation to other formats.
255 .TP
256 .BI \&.TP " i"
257 Begin paragraph with hanging tag.
258 The tag is given on the next line, but
259 its results are like those of the
260 .B \&.IP
261 command.
262 .SS Hypertext link macros
263 (Feature supported with
264 .B groff
265 only.)
266 In order to use hypertext link macros, it is necessary to load the
267 .B www.tmac
268 macro package.
269 Use the request
270 .B .mso www.tmac
271 to do this.
272 .TP 9m
273 .BI \&.URL " url link trailer"
274 Inserts a hypertext link to the URI (URL)
275 .IR url ,
276 with
277 .I link
278 as the text of the link.
279 The
280 .I trailer
281 will be printed immediately afterward.
282 When generating HTML this should translate into the HTML command
283 \fB<A HREF="\fP\fIurl\fP\fB">\fIlink\fP\fB</A>\fP\fItrailer\fP.
284 .\" The following is a kludge to get a paragraph into the listing.
285 .TP
286 .B " "
287 This and other related macros are new, and
288 many tools won't do anything with them, but
289 since many tools (including troff) will simply ignore undefined macros
290 (or at worst insert their text) these are safe to insert.
291 .\" The following is a kludge to get a paragraph into the listing.
292 .TP
293 .B " "
294 It can be useful to define your own
295 .B URL
296 macro in manual pages for the benefit of those viewing it with a roff
297 viewer other than
298 .BR groff .
299 That way, the URL, link text, and trailer text (if any) are still visible.
300 .\" The following is a kludge to get a paragraph into the listing.
301 .TP
302 .B " "
303 Here's an example:
304 .RS 1.5i
305 \&.de URL
306 .br
307 \\\\$2 \\(laURL: \\\\$1 \\(ra\\\\$3
308 .br
309 \&..
310 .br
311 \&.if \\n[.g] .mso www.tmac
312 .br
313 \&.TH
314 .I ...
315 .br
316 .I (later in the page)
317 .br
318 This software comes from the
319 .br
320 \&.URL "http://www.gnu.org/" "GNU Project" " of the"
321 .br
322 \&.URL "http://www.fsf.org/" "Free Software Foundation" .
323 .RE
324 .\" The following is a kludge to get a paragraph into the listing.
325 .TP
326 .B " "
327 In the above, if
328 .B groff
329 is being used, the
330 .B www.tmac
331 macro package's definition of the URL macro will supersede the locally
332 defined one.
333 .PP
334 A number of other link macros are available.
335 See
336 .BR groff_www (7)
337 for more details.
338 .SS Miscellaneous macros
339 .TP 9m
340 .B \&.DT
341 Reset tabs to default tab values (every 0.5 inches);
342 does not cause a break.
343 .TP
344 .BI \&.PD " d"
345 Set inter-paragraph vertical distance to d
346 (if omitted, d=0.4v);
347 does not cause a break.
348 .TP
349 .BI \&.SS " t"
350 Subheading
351 .I t
352 (like
353 .BR \&.SH ,
354 but used for a subsection inside a section).
355 .SS Predefined strings
356 The
357 .B man
358 package has the following predefined strings:
359 .IP \e*R
360 Registration Symbol: \*R
361 .IP \e*S
362 Change to default font size
363 .IP \e*(Tm
364 Trademark Symbol: \*(Tm
365 .IP \e*(lq
366 Left angled double quote: \*(lq
367 .IP \e*(rq
368 Right angled double quote: \*(rq
369 .SS Safe subset
370 Although technically
371 .B man
372 is a troff macro package, in reality a large number of other tools
373 process man page files that don't implement all of troff's abilities.
374 Thus, it's best to avoid some of troff's more exotic abilities
375 where possible to permit these other tools to work correctly.
376 Avoid using the various troff preprocessors
377 (if you must, go ahead and use
378 .BR tbl (1),
379 but try to use the
380 .B IP
381 and
382 .B TP
383 commands instead for two-column tables).
384 Avoid using computations; most other tools can't process them.
385 Use simple commands that are easy to translate to other formats.
386 The following troff macros are believed to be safe (though in many cases
387 they will be ignored by translators):
388 .BR \e" ,
389 .BR . ,
390 .BR ad ,
391 .BR bp ,
392 .BR br ,
393 .BR ce ,
394 .BR de ,
395 .BR ds ,
396 .BR el ,
397 .BR ie ,
398 .BR if ,
399 .BR fi ,
400 .BR ft ,
401 .BR hy ,
402 .BR ig ,
403 .BR in ,
404 .BR na ,
405 .BR ne ,
406 .BR nf ,
407 .BR nh ,
408 .BR ps ,
409 .BR so ,
410 .BR sp ,
411 .BR ti ,
412 .BR tr .
413 .PP
414 You may also use many troff escape sequences (those sequences beginning
415 with \e).
416 When you need to include the backslash character as normal text,
417 use \ee.
418 Other sequences you may use, where x or xx are any characters and N
419 is any digit, include:
420 .BR \e' ,
421 .BR \e` ,
422 .BR \e- ,
423 .BR \e. ,
424 .BR \e" ,
425 .BR \e% ,
426 .BR \e*x ,
427 .BR \e*(xx ,
428 .BR \e(xx ,
429 .BR \e$N ,
430 .BR \enx ,
431 .BR \en(xx ,
432 .BR \efx ,
433 and
434 .BR \ef(xx .
435 Avoid using the escape sequences for drawing graphics.
436 .PP
437 Do not use the optional parameter for
438 .B bp
439 (break page).
440 Use only positive values for
441 .B sp
442 (vertical space).
443 Don't define a macro
444 .RB ( de )
445 with the same name as a macro in this or the
446 mdoc macro package with a different meaning; it's likely that
447 such redefinitions will be ignored.
448 Every positive indent
449 .RB ( in )
450 should be paired with a matching negative indent
451 (although you should be using the
452 .B RS
453 and
454 .B RE
455 macros instead).
456 The condition test
457 .RB ( if,ie )
458 should only have \(aqt\(aq or \(aqn\(aq as the condition.
459 Only translations
460 .RB ( tr )
461 that can be ignored should be used.
462 Font changes
463 .RB ( ft
464 and the \fB\ef\fP escape sequence)
465 should only have the values 1, 2, 3, 4, R, I, B, P, or CW
466 (the ft command may also have no parameters).
467 .PP
468 If you use capabilities beyond these, check the
469 results carefully on several tools.
470 Once you've confirmed that the additional capability is safe,
471 let the maintainer of this
472 document know about the safe command or sequence
473 that should be added to this list.
474 .SH FILES
475 .IR /usr/share/groff/ [*/] tmac/an.tmac
476 .br
477 .I /usr/man/whatis
478 .SH NOTES
479 .PP
480 By all means include full URLs (or URIs) in the text itself;
481 some tools such as
482 .BR man2html (1)
483 can automatically turn them into hypertext links.
484 You can also use the new
485 .B URL
486 macro to identify links to related information.
487 If you include URLs, use the full URL
488 (e.g.,
489 .UR http://www.kernelnotes.org
490 .UE )
491 to ensure that tools can automatically find the URLs.
492 .PP
493 Tools processing these files should open the file and examine the first
494 nonwhitespace character.
495 A period (.) or single quote (') at the beginning
496 of a line indicates a troff-based file (such as man or mdoc).
497 A left angle bracket (<) indicates an SGML/XML-based
498 file (such as HTML or Docbook).
499 Anything else suggests simple ASCII
500 text (e.g., a "catman" result).
501 .PP
502 Many man pages begin with \fB\'\e"\fP followed by a
503 space and a list of characters,
504 indicating how the page is to be preprocessed.
505 For portability's sake to non-troff translators we recommend
506 that you avoid using anything other than
507 .BR tbl (1),
508 and Linux can detect that automatically.
509 However, you might want to include this information so your man page
510 can be handled by other (less capable) systems.
511 Here are the definitions of the preprocessors invoked by these characters:
512 .TP 3
513 .B e
514 eqn(1)
515 .TP
516 .B g
517 grap(1)
518 .TP
519 .B p
520 pic(1)
521 .TP
522 .B r
523 refer(1)
524 .TP
525 .B t
526 tbl(1)
527 .TP
528 .B v
529 vgrind(1)
530 .SH BUGS
531 .PP
532 Most of the macros describe formatting (e.g., font type and spacing) instead
533 of marking semantic content (e.g., this text is a reference to another page),
534 compared to formats like mdoc and DocBook (even HTML has more semantic
535 markings).
536 This situation makes it harder to vary the
537 .B man
538 format for different media,
539 to make the formatting consistent for a given media, and to automatically
540 insert cross-references.
541 By sticking to the safe subset described above, it should be easier to
542 automate transitioning to a different reference page format in the future.
543 .LP
544 The Sun macro
545 .B TX
546 is not implemented.
547 .\" .SH AUTHORS
548 .\" .IP \(em 3m
549 .\" James Clark (jjc@jclark.com) wrote the implementation of the macro package.
550 .\" .IP \(em
551 .\" Rickard E. Faith (faith@cs.unc.edu) wrote the initial version of
552 .\" this manual page.
553 .\" .IP \(em
554 .\" Jens Schweikhardt (schweikh@noc.fdn.de) wrote the Linux Man-Page Mini-HOWTO
555 .\" (which influenced this manual page).
556 .\" .IP \(em
557 .\" David A. Wheeler (dwheeler@ida.org) heavily modified this
558 .\" manual page, such as adding detailed information on sections and macros.
559 .SH SEE ALSO
560 .BR apropos (1),
561 .BR groff (1),
562 .BR lexgrog (1),
563 .BR man (1),
564 .BR man2html (1),
565 .BR whatis (1),
566 .BR groff_man (7),
567 .BR groff_www (7),
568 .BR man-pages (7),
569 .BR mdoc (7),
570 .BR mdoc.samples (7)