OSDN Git Service

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