]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man7/man.7
stpcpy.3, stpncpy.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wctob.3, wcwidth.3, wprintf...
[thirdparty/man-pages.git] / man7 / man.7
CommitLineData
fea681da
MK
1.\" (C) Copyright 1992-1999 Rickard E. Faith and David A. Wheeler
2.\" (faith@cs.unc.edu and dwheeler@ida.org)
3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
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.
c13182ef 13.\"
fea681da
MK
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.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
fea681da
MK
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
fea681da
MK
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>
a5e87f42 32.\" 2007-05-30, mtk: various rewrites and moved much text to new man-pages.7.
fea681da 33.\"
608bf950 34.TH MAN 7 2012-08-05 "Linux" "Linux Programmer's Manual"
fea681da
MK
35.SH NAME
36man \- 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
50This manual page explains the
add00eab 51.B "groff an.tmac"
fea681da
MK
52macro package (often called the
53.B man
e7cbacd4 54macro package).
fea681da 55This macro package should be used by developers when
c13182ef
MK
56writing or porting man pages for Linux.
57It is fairly compatible with other
fea681da
MK
58versions of this macro package, so porting man pages should not be a major
59problem (exceptions include the NET-2 BSD release, which uses a totally
60different macro package called mdoc; see
61.BR mdoc (7)).
62.PP
63Note that NET-2 BSD mdoc man pages can be used with
64.B groff
65simply by specifying the
66.B \-mdoc
67option instead of the
68.B \-man
c13182ef
MK
69option.
70Using the
fea681da
MK
71.B \-mandoc
72option is, however, recommended, since this will automatically detect which
73macro package is in use.
e7cbacd4
MK
74.PP
75For conventions that should be employed when writing man pages
76for the Linux \fIman-pages\fP package, see
77.BR man-pages (7).
78.SS Title line
988db661 79The first command in a man page (after comment lines,
e6b9359d 80that is, lines that start with \fB.\\"\fP) should be
fea681da
MK
81.RS
82.sp
83.B \&.TH
0daa9e92 84.I "title section date source manual"
fea681da
MK
85.sp
86.RE
47fc213b 87For details of the arguments that should be supplied to the \fBTH\fP
e7cbacd4
MK
88command, see
89.BR man-pages (7).
fea681da
MK
90.PP
91Note that BSD mdoc-formatted pages begin with the
92.B Dd
93command, not the
94.B TH
95command.
e6b9359d 96.SS Sections
fea681da
MK
97Sections are started with
98.B \&.SH
c13182ef 99followed by the heading name.
e6b9359d 100.\" The following doesn't seem to be required (see Debian bug 411303),
dc936104
MK
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.
e6b9359d 105
226ae424 106The only mandatory heading is NAME, which should be the first section and
a1712680 107be followed on the next line by a one-line description of the program:
fea681da
MK
108.RS
109.sp
110\&.SH NAME
111.br
a1712680 112item \\- description
fea681da
MK
113.sp
114.RE
115It is extremely important that this format is followed, and that there is a
a1712680 116backslash before the single dash which follows the item name.
c13182ef 117This syntax is used by the
a1712680
MK
118.BR mandb (8)
119program to create a database of short descriptions for the
fea681da
MK
120.BR whatis (1)
121and
122.BR apropos (1)
123commands.
a1712680
MK
124(See
125.BR lexgrog (1)
126for further details on the syntax of the NAME section.)
fea681da 127.PP
e7cbacd4
MK
128For a list of other sections that might appear in a manual page, see
129.BR man-pages (7).
e6b9359d 130.SS Fonts
fea681da
MK
131The commands to select the type face are:
132.TP 4
133.B \&.B
134Bold
135.TP
136.B \&.BI
137Bold alternating with italics
138(especially useful for function specifications)
139.TP
140.B \&.BR
141Bold alternating with Roman
142(especially useful for referring to other
143manual pages)
144.TP
145.B \&.I
146Italics
147.TP
148.B \&.IB
149Italics alternating with bold
150.TP
151.B \&.IR
152Italics alternating with Roman
153.TP
154.B \&.RB
155Roman alternating with bold
156.TP
157.B \&.RI
158Roman alternating with italics
159.TP
160.B \&.SB
161Small alternating with bold
162.TP
163.B \&.SM
164Small (useful for acronyms)
165.LP
166Traditionally, each command can have up to six arguments, but the GNU
167implementation removes this limitation (you might still want to limit
168yourself to 6 arguments for portability's sake).
c13182ef
MK
169Arguments are delimited by spaces.
170Double quotes can be used to specify an argument which contains spaces.
171All of the arguments will be printed next to each other without
fea681da
MK
172intervening spaces, so that the
173.B \&.BR
174command can be used to specify a word in bold followed by a mark of
175punctuation in Roman.
176If no arguments are given, the command is applied to the following line
177of text.
73d8cece 178.SS Other macros and strings
fea681da
MK
179.PP
180Below are other relevant macros and predefined strings.
181Unless noted otherwise, all macros
182cause a break (end the current line of text).
183Many of these macros set or use the "prevailing indent."
184The "prevailing indent" value is set by any macro with the parameter
185.I i
186below;
187macros may omit
188.I i
189in which case the current prevailing indent will be used.
190As a result, successive indented paragraphs can use the same indent without
3b777aff 191respecifying the indent value.
24b74457 192A normal (nonindented) paragraph resets the prevailing indent value
fea681da 193to its default value (0.5 inches).
c13182ef 194By default a given indent is measured in ens;
75fa8557 195try to use ens or ems as units for
fea681da
MK
196indents, since these will automatically adjust to font size changes.
197The other key macro definitions are:
73d8cece 198.SS Normal paragraphs
fea681da
MK
199.TP 9m
200.B \&.LP
201Same as
202.B \&.PP
203(begin a new paragraph).
204.TP
205.B \&.P
206Same as
207.B \&.PP
208(begin a new paragraph).
209.TP
210.B \&.PP
211Begin a new paragraph and reset prevailing indent.
73d8cece 212.SS Relative margin indent
fea681da
MK
213.TP 9m
214.BI \&.RS " i"
4d9b6984 215Start relative margin indent: moves the left margin
fea681da
MK
216.I i
217to the right (if
218.I i
219is omitted, the prevailing indent value is used).
220A new prevailing indent is set to 0.5 inches.
221As a result, all following paragraph(s) will be
222indented until the corresponding
223.BR \&.RE .
224.TP
225.B \&.RE
226End relative margin indent and
227restores the previous value of the prevailing indent.
73d8cece 228.SS Indented paragraph macros
fea681da
MK
229.TP 9m
230.BI \&.HP " i"
231Begin paragraph with a hanging indent
232(the first line of the paragraph is at the left margin of
233normal paragraphs, and the rest of the paragraph's lines are indented).
234.TP
235.BI \&.IP " x i"
236Indented paragraph with optional hanging tag.
237If the tag
238.I x
239is omitted, the entire following paragraph is indented by
240.IR i .
241If the tag
242.I x
243is provided, it is hung at the left margin
244before the following indented paragraph
245(this is just like
0daa9e92 246.B \&.TP
fea681da
MK
247except the tag is included with the command instead of being on the
248following line).
249If the tag is too long, the text after the tag will be moved down to the
250next line (text will not be lost or garbled).
31a6818e 251For bulleted lists, use this macro with \e(bu (bullet) or \e(em (em dash)
fea681da
MK
252as the tag, and for numbered lists, use the number or letter followed by
253a period as the tag;
254this simplifies translation to other formats.
255.TP
256.BI \&.TP " i"
c13182ef
MK
257Begin paragraph with hanging tag.
258The tag is given on the next line, but
fea681da
MK
259its results are like those of the
260.B \&.IP
261command.
73d8cece 262.SS Hypertext link macros
dd1b9170
MK
263(Feature supported with
264.B groff
265only.)
fea681da
MK
266In order to use hypertext link macros, it is necessary to load the
267.B www.tmac
268macro package.
269Use the request
270.B .mso www.tmac
271to do this.
272.TP 9m
273.BI \&.URL " url link trailer"
274Inserts a hypertext link to the URI (URL)
275.IR url ,
276with
277.I link
278as the text of the link.
279The
280.I trailer
5fab2e7c 281will be printed immediately afterward.
fea681da
MK
282When 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 " "
287This and other related macros are new, and
288many tools won't do anything with them, but
289since many tools (including troff) will simply ignore undefined macros
290(or at worst insert their text) these are safe to insert.
dd1b9170
MK
291.\" The following is a kludge to get a paragraph into the listing.
292.TP
293.B " "
294It can be useful to define your own
295.B URL
296macro in manual pages for the benefit of those viewing it with a roff
297viewer other than
298.BR groff .
299That 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 " "
303Here'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
318This 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 " "
327In the above, if
328.B groff
329is being used, the
330.B www.tmac
331macro package's definition of the URL macro will supersede the locally
332defined one.
fea681da 333.PP
c13182ef
MK
334A number of other link macros are available.
335See
fea681da
MK
336.BR groff_www (7)
337for more details.
73d8cece 338.SS Miscellaneous macros
fea681da
MK
339.TP 9m
340.B \&.DT
341Reset tabs to default tab values (every 0.5 inches);
342does not cause a break.
343.TP
344.BI \&.PD " d"
345Set inter-paragraph vertical distance to d
346(if omitted, d=0.4v);
347does not cause a break.
348.TP
349.BI \&.SS " t"
350Subheading
351.I t
352(like
353.BR \&.SH ,
354but used for a subsection inside a section).
73d8cece 355.SS Predefined strings
fea681da
MK
356The
357.B man
358package has the following predefined strings:
31a6818e 359.IP \e*R
fea681da 360Registration Symbol: \*R
31a6818e 361.IP \e*S
fea681da 362Change to default font size
31a6818e 363.IP \e*(Tm
fea681da 364Trademark Symbol: \*(Tm
31a6818e 365.IP \e*(lq
eb1af896 366Left angled double quote: \*(lq
31a6818e 367.IP \e*(rq
eb1af896 368Right angled double quote: \*(rq
73d8cece 369.SS Safe subset
fea681da
MK
370Although technically
371.B man
372is a troff macro package, in reality a large number of other tools
373process man page files that don't implement all of troff's abilities.
91749c0c
MK
374Thus, it's best to avoid some of troff's more exotic abilities
375where possible to permit these other tools to work correctly.
fea681da
MK
376Avoid using the various troff preprocessors
377(if you must, go ahead and use
378.BR tbl (1),
379but try to use the
380.B IP
c13182ef 381and
fea681da
MK
382.B TP
383commands instead for two-column tables).
384Avoid using computations; most other tools can't process them.
385Use simple commands that are easy to translate to other formats.
386The following troff macros are believed to be safe (though in many cases
387they will be ignored by translators):
31a6818e 388.BR \e" ,
fea681da
MK
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
414You may also use many troff escape sequences (those sequences beginning
31a6818e 415with \e).
fea681da 416When you need to include the backslash character as normal text,
31a6818e 417use \ee.
fea681da
MK
418Other sequences you may use, where x or xx are any characters and N
419is any digit, include:
31a6818e
MK
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 ,
fea681da 433and
31a6818e 434.BR \ef(xx .
fea681da
MK
435Avoid using the escape sequences for drawing graphics.
436.PP
437Do not use the optional parameter for
438.B bp
439(break page).
440Use only positive values for
441.B sp
442(vertical space).
443Don't define a macro
444.RB ( de )
445with the same name as a macro in this or the
446mdoc macro package with a different meaning; it's likely that
447such redefinitions will be ignored.
448Every positive indent
449.RB ( in )
450should be paired with a matching negative indent
451(although you should be using the
452.B RS
453and
454.B RE
455macros instead).
456The condition test
457.RB ( if,ie )
9708eb37 458should only have \(aqt\(aq or \(aqn\(aq as the condition.
c13182ef 459Only translations
fea681da
MK
460.RB ( tr )
461that can be ignored should be used.
462Font changes
463.RB ( ft
31a6818e 464and the \fB\ef\fP escape sequence)
fea681da
MK
465should 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
468If you use capabilities beyond these, check the
469results carefully on several tools.
470Once you've confirmed that the additional capability is safe,
471let the maintainer of this
472document know about the safe command or sequence
473that should be added to this list.
2b2581ee 474.SH FILES
add00eab 475.IR /usr/share/groff/ [*/] tmac/an.tmac
2b2581ee
MK
476.br
477.I /usr/man/whatis
fea681da
MK
478.SH NOTES
479.PP
480By all means include full URLs (or URIs) in the text itself;
481some tools such as
482.BR man2html (1)
483can automatically turn them into hypertext links.
484You can also use the new
485.B URL
486macro to identify links to related information.
487If you include URLs, use the full URL
608bf950
SK
488(e.g.,
489.UR http://www.kernelnotes.org
490.UE )
491to ensure that tools can automatically find the URLs.
fea681da
MK
492.PP
493Tools processing these files should open the file and examine the first
24b74457 494nonwhitespace character.
91749c0c
MK
495A period (.) or single quote (') at the beginning
496of a line indicates a troff-based file (such as man or mdoc).
fea681da 497A left angle bracket (<) indicates an SGML/XML-based
c13182ef
MK
498file (such as HTML or Docbook).
499Anything else suggests simple ASCII
fea681da
MK
500text (e.g., a "catman" result).
501.PP
31a6818e 502Many man pages begin with \fB\'\e"\fP followed by a
91749c0c 503space and a list of characters,
fea681da 504indicating how the page is to be preprocessed.
91749c0c
MK
505For portability's sake to non-troff translators we recommend
506that you avoid using anything other than
fea681da
MK
507.BR tbl (1),
508and Linux can detect that automatically.
509However, you might want to include this information so your man page
510can be handled by other (less capable) systems.
511Here are the definitions of the preprocessors invoked by these characters:
512.TP 3
513.B e
514eqn(1)
515.TP
516.B g
517grap(1)
518.TP
519.B p
520pic(1)
521.TP
522.B r
523refer(1)
524.TP
525.B t
526tbl(1)
527.TP
528.B v
529vgrind(1)
fea681da
MK
530.SH BUGS
531.PP
532Most of the macros describe formatting (e.g., font type and spacing) instead
533of marking semantic content (e.g., this text is a reference to another page),
534compared to formats like mdoc and DocBook (even HTML has more semantic
535markings).
536This situation makes it harder to vary the
537.B man
538format for different media,
539to make the formatting consistent for a given media, and to automatically
540insert cross-references.
541By sticking to the safe subset described above, it should be easier to
542automate transitioning to a different reference page format in the future.
543.LP
544The Sun macro
545.B TX
546is not implemented.
fd7f0a7f
MK
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.
47297adb 559.SH SEE ALSO
fea681da
MK
560.BR apropos (1),
561.BR groff (1),
a1712680 562.BR lexgrog (1),
fea681da
MK
563.BR man (1),
564.BR man2html (1),
e7cbacd4 565.BR whatis (1),
d81dc982 566.BR groff_man (7),
fea681da 567.BR groff_www (7),
e7cbacd4
MK
568.BR man-pages (7),
569.BR mdoc (7),
570.BR mdoc.samples (7)