Imported upstream version 1.5
[manpages-zh.git] / raw / man7 / man.7
blob4cdb5855f87d33993134cab5885247d3dd8d4298
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 .\"  [todo: split this into man.7 describing the macros
29 .\"   and manpage.7 describing the Linux man page conventions]
30 .\"
31 .TH MAN 7 1999-06-16 "Linux" "Linux Programmer's Manual"
32 .SH NAME
33 man \- macros to format man pages
34 .SH SYNOPSIS
35 .B groff \-Tascii \-man
36 .I file
37 \&...
38 .LP
39 .B groff \-Tps \-man
40 .I file
41 \&...
42 .LP
43 .B man
44 .RI [ section ]
45 .I title
46 .SH DESCRIPTION
47 This manual page explains the
48 .B "groff tmac.an"
49 macro package (often called the
50 .B man
51 macro package) and related conventions for creating manual (man) pages.
52 This macro package should be used by developers when
53 writing or porting man pages for Linux.  It is fairly compatible with other
54 versions of this macro package, so porting man pages should not be a major
55 problem (exceptions include the NET-2 BSD release, which uses a totally
56 different macro package called mdoc; see
57 .BR mdoc (7)).
58 .PP
59 Note that NET-2 BSD mdoc man pages can be used with
60 .B groff
61 simply by specifying the
62 .B \-mdoc
63 option instead of the
64 .B \-man
65 option.  Using the
66 .B \-mandoc
67 option is, however, recommended, since this will automatically detect which
68 macro package is in use.
69 .SH PREAMBLE
70 The first command in a man page (after comment lines) should be
71 .RS
72 .sp
73 .B \&.TH
74 .IR "title section date source manual" ,
75 .sp
76 .RE
77 where:
78 .RS
79 .TP 10
80 .I title
81 The title of the man page (e.g.,
82 .IR MAN ).
83 .TP
84 .I section
85 The section number the man page should be placed in (e.g.,
86 .IR 7 ).
87 .TP
88 .I date
89 The date of the last revision\(emremember to change this every time a
90 change is made to the man page, since this is the most general way of doing
91 version control.
92 .TP
93 .I source
94 The source of the command.
95 .sp
96 For binaries, use something like:
97 .IR GNU ", " NET-2 ", " "SLS Distribution" ", " "MCC Distribution" .
98 .sp
99 For system calls, use the version of the kernel that you are currently
100 looking at:
101 .IR "Linux 0.99.11" .
103 For library calls, use the source of the function:
104 .IR GNU ", " "BSD 4.3" ", " "Linux DLL 4.4.1" .
106 .I manual
107 The title of the manual (e.g.,
108 .IR "Linux Programmer's Manual" ).
111 Note that BSD mdoc-formatted pages begin with the
112 .B Dd
113 command, not the
114 .B TH
115 command.
117 The manual sections are traditionally defined as follows:
119 .TP 10
120 .B 1 Commands
121 Those commands that can be executed by the user from within
122 a shell.
124 .B 2 System calls
125 Those functions which must be performed by the kernel.
127 .B 3 Library calls
128 Most of the
129 .I libc
130 functions, such as
131 .BR qsort (3))
133 .B 4 Special files
134 Files found in
135 .IR /dev )
137 .B 5 File formats and conventions
138 The format for
139 .I /etc/passwd
140 and other human-readable files.
142 .B 6 Games
144 .B 7 Macro packages and conventions
145 A description of the standard file system layout, network protocols,
146 ASCII and other character codes, this man page, and other things.
148 .B 8 System management commands
149 Commands like
150 .BR mount (8),
151 many of which only
152 .I root
153 can execute.
155 .B 9 Kernel routines
156 This is an obsolete manual section.
157 Once it was thought a good idea to document the Linux kernel here,
158 but in fact very little has been documented, and the documentation
159 that exists is outdated already. There are better sources of
160 information for kernel developers. 
162 .SH SECTIONS
163 Sections are started with
164 .B \&.SH
165 followed by the heading name.  If the name contains spaces and appears
166 on the same line as
167 .BR \&.SH ,
168 then place the heading in double quotes.  Traditional or suggested
169 headings include:
170 NAME, SYNOPSIS, DESCRIPTION, RETURN VALUE,
171 EXIT STATUS, ERROR HANDLING, ERRORS,
172 OPTIONS, USAGE, EXAMPLES, FILES, ENVIRONMENT, DIAGNOSTICS, SECURITY,
173 CONFORMING TO, NOTES,
174 BUGS, AUTHOR, and SEE ALSO.
175 Where a traditional heading would apply, please use it;
176 this kind of consistency can make the information easier to understand.
177 However, feel free to create your own headings if they make things easier
178 to understand.
179 The only required heading is
180 .IR NAME ,
181 which should be the first section and
182 be followed on the next line by a one line description of the program:
185 \&.SH NAME
187 chess \\- the game of chess
190 It is extremely important that this format is followed, and that there is a
191 backslash before the single dash which follows the command name.  This
192 syntax is used by the
193 .BR makewhatis (8)
194 program to create a database of short command descriptions for the
195 .BR whatis (1)
197 .BR apropos (1)
198 commands.
200 Some other traditional sections have the following contents:
201 .TP 14
202 .B SYNOPSIS
203 briefly describes the command or function's interface.
204 For commands, this shows the syntax of the command and its arguments
205 (including options);
206 boldface is used for as-is text and italics are used to indicate replaceable
207 arguments. Brackets ([]) surround optional arguments, vertical bars (|)
208 separate choices, and ellipses (\&...) can be repeated.
209 For functions, it shows any required data declarations or
210 .B #include
211 directives, followed by the function declaration.
213 .B DESCRIPTION
214 gives an explanation of what the command, function, or format does.
215 Discuss how it interacts with files and standard input, and what it
216 produces on standard output or standard error.
217 Omit internals and implementation details unless they're critical for
218 understanding the interface.
219 Describe the usual case; for information on options use the
220 .B OPTIONS
221 section.
222 If there is some kind of input grammar or complex set of subcommands,
223 consider describing them in a separate
224 .B USAGE
225 section (and just place an overview in the
226 .B DESCRIPTION
227 section).
229 .B RETURN VALUE
230 gives a
231 list of the values the library routine will return to the caller
232 and the conditions that cause these values to be returned.
234 .B EXIT STATUS
235 lists the possible exit status values or a program and
236 the conditions that cause these values to be returned.
238 .B OPTIONS
239 describes the options accepted by the program and how they change
240 its behavior.
242 .B USAGE
243 describes the grammar of any sublanguage this implements.
245 .B EXAMPLES
246 provides one or more examples describing how this function, file or
247 command is used.
249 .B FILES
250 lists the files the program or function uses, such as
251 configuration files, startup files,
252 and files the program directly operates on.
253 Give the full pathname of these files, and use the installation
254 process to modify the directory part to match user preferences.
255 For many programs, the default installation location is in /usr/local,
256 so your base manual page should use /usr/local as the base.
258 .B ENVIRONMENT
259 lists all environment variables that affect your program or function
260 and how they affect it.
262 .B DIAGNOSTICS
263 gives an overview of the most common error messages and how to
264 cope with them.  You don't need to explain system error messages
265 or fatal signals that can appear during execution of any program
266 unless they're special in some way to your program.
268 .B SECURITY
269 discusses security issues and implications.
270 Warn about configurations or environments that should be avoided,
271 commands that may have security implications, and so on, especially
272 if they aren't obvious.
273 Discussing security in a separate section isn't necessary;
274 if it's easier to understand, place security information in the
275 other sections (such as the
276 .B DESCRIPTION
278 .B USAGE
279 section).
280 However, please include security information somewhere!
282 .B CONFORMING TO
283 describes any standards or conventions this implements.
285 .B NOTES
286 provides miscellaneous notes.
288 .B BUGS
289 lists limitations, known defects or inconveniences,
290 and other questionable activities.
292 .B AUTHOR
293 lists authors of the documentation or program so you can mail in bug
294 reports.
296 .B SEE ALSO
297 lists related man pages in alphabetical order, possibly followed by
298 other related pages or documents.
299 Conventionally this is the last section.
300 .SH FONTS
301 Although there are many arbitrary conventions for man pages in the UNIX
302 world, the existence of several hundred Linux-specific man pages defines our
303 font standards:
305 For functions, the arguments are always specified using italics,
306 .IR "even in the SYNOPSIS section" ,
307 where the rest of the function is specified in bold:
309 .BI "int myfunction(int " argc ", char **" argv );
312 Filenames are always in italics (e.g.,
313 .IR "/usr/include/stdio.h" ),
314 except in the SYNOPSIS section, where included files are in bold (e.g.,
315 .BR "#include <stdio.h>" ).
317 Special macros, which are usually in upper case, are in bold (e.g.,
318 .BR MAXINT ).
320 When enumerating a list of error codes, the codes are in bold (this list
321 usually uses the
322 .B \&.TP
323 macro).
325 Any reference to another man page (or to the subject of the current man
326 page) is in bold.  If the manual section number is given, it is given in
327 Roman (normal) font, without any spaces (e.g.,
328 .BR man (7)).
330 The commands to select the type face are:
331 .TP 4
332 .B \&.B
333 Bold
335 .B \&.BI
336 Bold alternating with italics
337 (especially useful for function specifications)
339 .B \&.BR
340 Bold alternating with Roman
341 (especially useful for referring to other
342 manual pages)
344 .B \&.I
345 Italics
347 .B \&.IB
348 Italics alternating with bold
350 .B \&.IR
351 Italics alternating with Roman
353 .B \&.RB
354 Roman alternating with bold
356 .B \&.RI
357 Roman alternating with italics
359 .B \&.SB
360 Small alternating with bold
362 .B \&.SM
363 Small (useful for acronyms)
365 Traditionally, each command can have up to six arguments, but the GNU
366 implementation removes this limitation (you might still want to limit
367 yourself to 6 arguments for portability's sake).
368 Arguments are delimited by
369 spaces.  Double quotes can be used to specify an argument which contains
370 spaces.  All of the arguments will be printed next to each other without
371 intervening spaces, so that the
372 .B \&.BR
373 command can be used to specify a word in bold followed by a mark of
374 punctuation in Roman.
375 If no arguments are given, the command is applied to the following line
376 of text.
377 .SH "OTHER MACROS AND STRINGS"
379 Below are other relevant macros and predefined strings.
380 Unless noted otherwise, all macros
381 cause a break (end the current line of text).
382 Many of these macros set or use the "prevailing indent."
383 The "prevailing indent" value is set by any macro with the parameter
384 .I i
385 below;
386 macros may omit
387 .I i
388 in which case the current prevailing indent will be used.
389 As a result, successive indented paragraphs can use the same indent without
390 re-specifying the indent value.
391 A normal (non-indented) paragraph resets the prevailing indent value
392 to its default value (0.5 inches).
393 By default a given indent is measured in ens; try to ens or ems as units for
394 indents, since these will automatically adjust to font size changes.
395 The other key macro definitions are:
396 .SS "Normal Paragraphs"
397 .TP 9m
398 .B \&.LP
399 Same as
400 .B \&.PP
401 (begin a new paragraph).
403 .B \&.P
404 Same as
405 .B \&.PP
406 (begin a new paragraph).
408 .B \&.PP
409 Begin a new paragraph and reset prevailing indent.
410 .SS "Relative Margin Indent"
411 .TP 9m
412 .BI \&.RS " i"
413 Start relative margin indent - moves the left margin
414 .I i
415 to the right (if
416 .I i
417 is omitted, the prevailing indent value is used).
418 A new prevailing indent is set to 0.5 inches.
419 As a result, all following paragraph(s) will be
420 indented until the corresponding
421 .BR \&.RE .
423 .B \&.RE
424 End relative margin indent and
425 restores the previous value of the prevailing indent.
426 .SS "Indented Paragraph Macros"
427 .TP 9m
428 .BI \&.HP " i"
429 Begin paragraph with a hanging indent
430 (the first line of the paragraph is at the left margin of
431 normal paragraphs, and the rest of the paragraph's lines are indented).
433 .BI \&.IP " x i"
434 Indented paragraph with optional hanging tag.
435 If the tag
436 .I x
437 is omitted, the entire following paragraph is indented by
438 .IR i .
439 If the tag
440 .I x
441 is provided, it is hung at the left margin
442 before the following indented paragraph
443 (this is just like
444 .BR \&.TP
445 except the tag is included with the command instead of being on the
446 following line).
447 If the tag is too long, the text after the tag will be moved down to the
448 next line (text will not be lost or garbled).
449 For bulleted lists, use this macro with \e(bu (bullet) or \e(em (em dash)
450 as the tag, and for numbered lists, use the number or letter followed by
451 a period as the tag;
452 this simplifies translation to other formats.
454 .BI \&.TP " i"
455 Begin paragraph with hanging tag.  The tag is given on the next line, but
456 its results are like those of the
457 .B \&.IP
458 command.
459 .SS "Hypertext Link Macros"
460 .TP 9m
461 .BI \&.UR " u"
462 Begins a hypertext link to the URI (URL)
463 .IR u ;
464 it will end with the corresponding
465 .B UE
466 command.
467 When generating HTML this should translate into the HTML command
468 \fB<A HREF="\fP\fIu\fP\fB">\fP.
469 There is an exception: if
470 .I u
471 is the special value ":", then no hypertext link of any kind
472 will be generated until after the closing
473 .B UE
474 (this permits disabling hypertext links in phrases like
475 .UR ":"
476 LALR(1)
478 when linking is not appropriate).
479 These hypertext link "macros" are new, and
480 many tools won't do anything with them, but
481 since many tools (including troff) will simply ignore undefined macros
482 (or at worst insert their text) these are safe to insert.
484 .BI \&.UE
485 Ends the corresponding
486 .B UR
487 command;
488 when generating HTML this should translate into
489 \fB</A>\fP.
491 .BI \&.UN " u"
492 Creates a named hypertext location named
493 .IR u ;
494 do not include a corresponding
495 .B UE
496 command.
497 When generating HTML this should translate into the HTML command
498 \fB<A NAME="\fP\fIu\fP\fB" id="\fP\fIu\fP\fB">&nbsp;</A>\fP
499 (the &nbsp; is optional if support for Mosaic is unneeded).
500 .SS "Miscellaneous Macros"
501 .TP 9m
502 .B \&.DT
503 Reset tabs to default tab values (every 0.5 inches);
504 does not cause a break.
506 .BI \&.PD " d"
507 Set inter-paragraph vertical distance to d
508 (if omitted, d=0.4v);
509 does not cause a break.
511 .BI \&.SS " t"
512 Subheading
513 .I t
514 (like
515 .BR \&.SH ,
516 but used for a subsection inside a section).
517 .SS "Predefined Strings"
519 .B man
520 package has the following predefined strings:
521 .IP \e*R
522 Registration Symbol: \*R
523 .IP \e*S
524 Change to default font size
525 .IP \e*(Tm
526 Trademark Symbol: \*(Tm
527 .IP \e*(lq
528 Left angled doublequote: \*(lq
529 .IP \e*(rq
530 Right angled doublequote: \*(rq
531 .SH "SAFE SUBSET"
532 Although technically
533 .B man
534 is a troff macro package, in reality a large number of other tools
535 process man page files that don't implement all of troff's abilities.
536 Thus, it's best to avoid some of troff's more exotic abilities where possible
537 to permit these other tools to work correctly.
538 Avoid using the various troff preprocessors
539 (if you must, go ahead and use
540 .BR tbl (1),
541 but try to use the
542 .B IP
543 and 
544 .B TP
545 commands instead for two-column tables).
546 Avoid using computations; most other tools can't process them.
547 Use simple commands that are easy to translate to other formats.
548 The following troff macros are believed to be safe (though in many cases
549 they will be ignored by translators):
550 .BR \e" ,
551 .BR . ,
552 .BR ad ,
553 .BR bp ,
554 .BR br ,
555 .BR ce ,
556 .BR de ,
557 .BR ds ,
558 .BR el ,
559 .BR ie ,
560 .BR if ,
561 .BR fi ,
562 .BR ft ,
563 .BR hy ,
564 .BR ig ,
565 .BR in ,
566 .BR na ,
567 .BR ne ,
568 .BR nf ,
569 .BR nh ,
570 .BR ps ,
571 .BR so ,
572 .BR sp ,
573 .BR ti ,
574 .BR tr .
576 You may also use many troff escape sequences (those sequences beginning
577 with \e).
578 When you need to include the backslash character as normal text,
579 use \ee.
580 Other sequences you may use, where x or xx are any characters and N
581 is any digit, include:
582 .BR \e' ,
583 .BR \e` ,
584 .BR \e- ,
585 .BR \e. ,
586 .BR \e" ,
587 .BR \e% ,
588 .BR \e*x ,
589 .BR \e*(xx ,
590 .BR \e(xx ,
591 .BR \e$N ,
592 .BR \enx ,
593 .BR \en(xx ,
594 .BR \efx ,
596 .BR \ef(xx .
597 Avoid using the escape sequences for drawing graphics.
599 Do not use the optional parameter for
600 .B bp
601 (break page).
602 Use only positive values for
603 .B sp
604 (vertical space).
605 Don't define a macro
606 .RB ( de )
607 with the same name as a macro in this or the
608 mdoc macro package with a different meaning; it's likely that
609 such redefinitions will be ignored.
610 Every positive indent
611 .RB ( in )
612 should be paired with a matching negative indent
613 (although you should be using the
614 .B RS
616 .B RE
617 macros instead).
618 The condition test
619 .RB ( if,ie )
620 should only have 't' or 'n' as the condition.
621 Only translations 
622 .RB ( tr )
623 that can be ignored should be used.
624 Font changes
625 .RB ( ft
626 and the \fB\ef\fP escape sequence)
627 should only have the values 1, 2, 3, 4, R, I, B, P, or CW
628 (the ft command may also have no parameters).
630 If you use capabilities beyond these, check the
631 results carefully on several tools.
632 Once you've confirmed that the additional capability is safe,
633 let the maintainer of this
634 document know about the safe command or sequence
635 that should be added to this list.
636 .SH NOTES
638 By all means include full URLs (or URIs) in the text itself;
639 some tools such as
640 .BR man2html (1)
641 can automatically turn them into hypertext links.
642 You can also use the new
643 .B UR
644 macro to identify links to related information.
645 If you include URLs, use the full URL
646 (e.g., <http://www.kernelnotes.org>) to ensure that tools
647 can automatically find the URLs.
649 Tools processing these files should open the file and examine the first
650 non-whitespace character. A period (.) or single quote (')
651 at the beginning of a line indicates a troff-based file (such as man or mdoc).
652 A left angle bracket (<) indicates an SGML/XML-based
653 file (such as HTML or Docbook). Anything else suggests simple ASCII
654 text (e.g., a "catman" result).
656 Many man pages begin with '\e" followed by a space and a list of characters,
657 indicating how the page is to be preprocessed.
658 For portability's sake to non-troff translators we recommend that you avoid
659 using anything other than
660 .BR tbl (1),
661 and Linux can detect that automatically.
662 However, you might want to include this information so your man page
663 can be handled by other (less capable) systems.
664 Here are the definitions of the preprocessors invoked by these characters:
665 .TP 3
666 .B e
667 eqn(1)
669 .B g
670 grap(1)
672 .B p
673 pic(1)
675 .B r
676 refer(1)
678 .B t
679 tbl(1)
681 .B v
682 vgrind(1)
683 .SH FILES
684 .IR /usr/share/groff/ [*/] tmac/tmac.an
686 .I /usr/man/whatis
687 .SH BUGS
689 Most of the macros describe formatting (e.g., font type and spacing) instead
690 of marking semantic content (e.g., this text is a reference to another page),
691 compared to formats like mdoc and DocBook (even HTML has more semantic
692 markings).
693 This situation makes it harder to vary the
694 .B man
695 format for different media,
696 to make the formatting consistent for a given media, and to automatically
697 insert cross-references.
698 By sticking to the safe subset described above, it should be easier to
699 automate transitioning to a different reference page format in the future.
701 The Sun macro
702 .B TX
703 is not implemented.
704 .SH AUTHORS
705 .IP \(em 3m
706 James Clark (jjc@jclark.com) wrote the implementation of the macro package.
707 .IP \(em
708 Rickard E. Faith (faith@cs.unc.edu) wrote the initial version of
709 this manual page.
710 .IP \(em
711 Jens Schweikhardt (schweikh@noc.fdn.de) wrote the Linux Man-Page Mini-HOWTO
712 (which influenced this manual page).
713 .IP \(em
714 David A. Wheeler (dwheeler@ida.org) heavily modified this
715 manual page, such as adding detailed information on sections and macros.
716 .SH "SEE ALSO"
717 .BR apropos (1),
718 .BR groff (1),
719 .BR man (1),
720 .BR man2html (1),
721 .BR mdoc (7),
722 .BR mdoc.samples (7),
723 .BR whatis (1)