OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man7 / man-pages.7
1 .\" (C) Copyright 1992-1999 Rickard E. Faith and David A. Wheeler
2 .\" (faith@cs.unc.edu and dwheeler@ida.org)
3 .\" and (C) Copyright 2007 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" 2007-05-30 created by mtk, using text from old man.7 plus
28 .\" rewrites and additional text.
29 .\"
30 .TH MAN-PAGES 7 2014-12-31 "Linux" "Linux Programmer's Manual"
31 .SH NAME
32 man-pages \- conventions for writing Linux man pages
33 .SH SYNOPSIS
34 .B man
35 .RI [ section ]
36 .I title
37 .SH DESCRIPTION
38 This page describes the conventions that should be employed
39 when writing man pages for the Linux \fIman-pages\fP project,
40 which documents the user-space API provided by the Linux kernel
41 and the GNU C library.
42 The project thus provides most of the pages in Section 2,
43 as well as many of the pages that appear
44 in Sections 3, 4, 5, and 7 of the man pages on a Linux system.
45 The conventions described on this page may also be useful
46 for authors writing man pages for other projects.
47 .SS Sections of the manual pages
48 .PP
49 The manual Sections are traditionally defined as follows:
50 .TP 10
51 .B 1 Commands (Programs)
52 Those commands that can be executed by the user from within
53 a shell.
54 .TP
55 .B 2 System calls
56 Those functions which must be performed by the kernel.
57 .TP
58 .B 3 Library calls
59 Most of the
60 .I libc
61 functions.
62 .TP
63 .B 4 Special files (devices)
64 Files found in
65 .IR /dev .
66 .TP
67 .B 5 File formats and conventions
68 The format for
69 .I /etc/passwd
70 and other human-readable files.
71 .TP
72 .B 6 Games
73 .TP
74 .B 7 Overview, conventions, and miscellaneous
75 Overviews of various topics, conventions and protocols,
76 character set standards, and miscellaneous other things.
77 .TP
78 .B 8 System management commands
79 Commands like
80 .BR mount (8),
81 many of which only root can execute.
82 .\" .TP
83 .\" .B 9 Kernel routines
84 .\" This is an obsolete manual section.
85 .\" Once it was thought a good idea to document the Linux kernel here,
86 .\" but in fact very little has been documented, and the documentation
87 .\" that exists is outdated already.
88 .\" There are better sources of
89 .\" information for kernel developers.
90 .SS Macro package
91 New manual pages should be marked up using the
92 .B groff an.tmac
93 package described in
94 .BR man (7).
95 This choice is mainly for consistency: the vast majority of
96 existing Linux manual pages are marked up using these macros.
97 .SS Conventions for source file layout
98 Please limit source code line length to no more than about 75 characters
99 wherever possible.
100 This helps avoid line-wrapping in some mail clients when patches are
101 submitted inline.
102
103 New sentences should be started on new lines.
104 This makes it easier to see the effect of patches,
105 which often operate at the level of individual sentences.
106 .SS Title line
107 The first command in a man page should be a
108 .B TH
109 command:
110 .RS
111 .sp
112 .B \&.TH
113 .I "title section date source manual"
114 .sp
115 .RE
116 where:
117 .RS
118 .TP 10
119 .I title
120 The title of the man page, written in all caps (e.g.,
121 .IR MAN-PAGES ).
122 .TP
123 .I section
124 The section number in which the man page should be placed (e.g.,
125 .IR 7 ).
126 .TP
127 .I date
128 The date of the last nontrivial change that was made to the man page.
129 (Within the
130 .I man-pages
131 project, the necessary updates to these timetamps are handled
132 automatically by scripts, so there is no need to manually update
133 them as part of a patch.)
134 Dates should be written in the form YYYY-MM-DD.
135 .TP
136 .I source
137 The source of the command, function, or system call.
138
139 For those few \fIman-pages\fP pages in Sections 1 and 8,
140 probably you just want to write
141 .IR GNU .
142
143 For system calls, just write
144 .IR "Linux" .
145 (An earlier practice was to write the version number
146 of the kernel from which the manual page was being written/checked.
147 However, this was never done consistently, and so was
148 probably worse than including no version number.
149 Henceforth, avoid including a version number.)
150
151 For library calls that are part of glibc or one of the
152 other common GNU libraries, just use
153 .IR "GNU C Library" ", " GNU ,
154 or an empty string.
155
156 For Section 4 pages, use
157 .IR "Linux" .
158
159 In cases of doubt, just write
160 .IR Linux ", or " GNU .
161 .TP
162 .I manual
163 The title of the manual (e.g., for Section 2 and 3 pages in
164 the \fIman-pages\fP package, use
165 .IR "Linux Programmer's Manual" ).
166 .RE
167 .SS Sections within a manual page
168 The list below shows conventional or suggested sections.
169 Most manual pages should include at least the
170 .B highlighted
171 sections.
172 Arrange a new manual page so that sections
173 are placed in the order shown in the list.
174 .in +0.5i
175 .nf
176
177 \fBNAME\fP
178 \fBSYNOPSIS\fP
179 CONFIGURATION      [Normally only in Section 4]
180 \fBDESCRIPTION\fP
181 OPTIONS            [Normally only in Sections 1, 8]
182 EXIT STATUS        [Normally only in Sections 1, 8]
183 RETURN VALUE       [Normally only in Sections 2, 3]
184 .\" May 07: Few current man pages have an ERROR HANDLING section,,,
185 .\" ERROR HANDLING,
186 ERRORS             [Typically only in Sections 2, 3]
187 .\" May 07: Almost no current man pages have a USAGE section,,,
188 .\" USAGE,
189 .\" DIAGNOSTICS,
190 .\" May 07: Almost no current man pages have a SECURITY section,,,
191 .\" SECURITY,
192 ENVIRONMENT
193 FILES
194 VERSIONS           [Normally only in Sections 2, 3]
195 ATTRIBUTES         [Normally only in Sections 2, 3]
196 CONFORMING TO
197 NOTES
198 BUGS
199 EXAMPLE
200 .\" AUTHORS sections are discouraged
201 .\" AUTHORS             [Discouraged]
202 \fBSEE ALSO\fP
203
204 .fi
205 .in
206 .IR "Where a traditional heading would apply" ", " "please use it" ;
207 this kind of consistency can make the information easier to understand.
208 If you must, you can create your own
209 headings if they make things easier to understand (this can
210 be especially useful for pages in Sections 4 and 5).
211 However, before doing this, consider whether you could use the
212 traditional headings, with some subsections (\fI.SS\fP) within
213 those sections.
214
215 The following list elaborates on the contents of each of
216 the above sections.
217 .TP 14
218 .B NAME
219 The name of this manual page.
220
221 See
222 .BR man (7)
223 for important details of the line(s) that should follow the
224 \fB.SH NAME\fP command.
225 All words in this line (including the word immediately
226 following the "\\\-") should be in lowercase,
227 except where English or technical terminological convention
228 dictates otherwise.
229 .TP
230 .B SYNOPSIS
231 A brief summary of the command or function's interface.
232
233 For commands, this shows the syntax of the command and its arguments
234 (including options);
235 boldface is used for as-is text and italics are used to
236 indicate replaceable arguments.
237 Brackets ([]) surround optional arguments, vertical bars (|)
238 separate choices, and ellipses (\&...) can be repeated.
239 For functions, it shows any required data declarations or
240 .B #include
241 directives, followed by the function declaration.
242
243 Where a feature test macro must be defined in order to obtain
244 the declaration of a function (or a variable) from a header file,
245 then the SYNOPSIS should indicate this, as described in
246 .BR feature_test_macros (7).
247 .\" FIXME . Say something here about compiler options
248 .TP
249 .B CONFIGURATION
250 Configuration details for a device.
251
252 This section normally appears only in Section 4 pages.
253 .TP
254 .B DESCRIPTION
255 An explanation of what the program, function, or format does.
256
257 Discuss how it interacts with files and standard input, and what it
258 produces on standard output or standard error.
259 Omit internals and implementation details unless they're critical for
260 understanding the interface.
261 Describe the usual case;
262 for information on command-line options of a program use the
263 .B OPTIONS
264 section.
265 .\" If there is some kind of input grammar or complex set of subcommands,
266 .\" consider describing them in a separate
267 .\" .B USAGE
268 .\" section (and just place an overview in the
269 .\" .B DESCRIPTION
270 .\" section).
271
272 When describing new behavior or new flags for
273 a system call or library function,
274 be careful to note the kernel or C library version
275 that introduced the change.
276 The preferred method of noting this information for flags is as part of a
277 .B .TP
278 list, in the following form (here, for a new system call flag):
279 .RS 22
280 .TP
281 .BR XYZ_FLAG " (since Linux 3.7)"
282 Description of flag...
283 .RE
284 .IP
285 Including version information is especially useful to users
286 who are constrained to using older kernel or C library versions
287 (which is typical in embedded systems, for example).
288 .TP
289 .B OPTIONS
290 A description of the command-line options accepted by a
291 program and how they change its behavior.
292
293 This section should appear only for Section 1 and 8 manual pages.
294 .\" .TP
295 .\" .B USAGE
296 .\" describes the grammar of any sublanguage this implements.
297 .TP
298 .B EXIT STATUS
299 A list of the possible exit status values of a program and
300 the conditions that cause these values to be returned.
301
302 This section should appear only for Section 1 and 8 manual pages.
303 .TP
304 .B RETURN VALUE
305 For Section 2 and 3 pages, this section gives a
306 list of the values the library routine will return to the caller
307 and the conditions that cause these values to be returned.
308 .TP
309 .B ERRORS
310 For Section 2 and 3 manual pages, this is a list of the
311 values that may be placed in
312 .I errno
313 in the event of an error, along with information about the cause
314 of the errors.
315
316 .IR "The error list should be in alphabetical order" .
317 .TP
318 .B ENVIRONMENT
319 A list of all environment variables that affect the program or function
320 and how they affect it.
321 .TP
322 .B FILES
323 A list of the files the program or function uses, such as
324 configuration files, startup files,
325 and files the program directly operates on.
326
327 Give the full pathname of these files, and use the installation
328 process to modify the directory part to match user preferences.
329 For many programs, the default installation location is in
330 .IR /usr/local ,
331 so your base manual page should use
332 .I /usr/local
333 as the base.
334 .\" May 07: Almost no current man pages have a DIAGNOSTICS section;
335 .\"         "RETURN VALUE" or "EXIT STATUS" is preferred.
336 .\" .TP
337 .\" .B DIAGNOSTICS
338 .\" gives an overview of the most common error messages and how to
339 .\" cope with them.
340 .\" You don't need to explain system error messages
341 .\" or fatal signals that can appear during execution of any program
342 .\" unless they're special in some way to the program.
343 .\"
344 .\" May 07: Almost no current man pages have a SECURITY section.
345 .\".TP
346 .\".B SECURITY
347 .\"discusses security issues and implications.
348 .\"Warn about configurations or environments that should be avoided,
349 .\"commands that may have security implications, and so on, especially
350 .\"if they aren't obvious.
351 .\"Discussing security in a separate section isn't necessary;
352 .\"if it's easier to understand, place security information in the
353 .\"other sections (such as the
354 .\" .B DESCRIPTION
355 .\" or
356 .\" .B USAGE
357 .\" section).
358 .\" However, please include security information somewhere!
359 .TP
360 .B ATTRIBUTES
361 A summary of various attributes of the function(s) documented on this page,
362 broken into subsections.
363
364 The following subsections are defined:
365 .sp
366 .RS
367 .TP
368 .B "Multithreading (see pthreads(7))"
369 This subsection notes attributes relating to multithreaded applications:
370 .RS
371 .IP * 3
372 Whether the function is thread-safe.
373 .IP *
374 Whether the function is a cancellation point.
375 .IP *
376 Whether the function is async-cancel-safe.
377 .RE
378 .IP
379 Details of these attributes can be found in
380 .BR pthreads (7).
381 .RE
382 .TP
383 .B VERSIONS
384 A brief summary of the Linux kernel or glibc versions where a
385 system call or library function appeared,
386 or changed significantly in its operation.
387
388 As a general rule, every new interface should
389 include a VERSIONS section in its manual page.
390 Unfortunately,
391 many existing manual pages don't include this information
392 (since there was no policy to do so when they were written).
393 Patches to remedy this are welcome,
394 but, from the perspective of programmers writing new code,
395 this information probably matters only in the case of kernel
396 interfaces that have been added in Linux 2.4 or later
397 (i.e., changes since kernel 2.2),
398 and library functions that have been added to glibc since version 2.1
399 (i.e., changes since glibc 2.0).
400
401 The
402 .BR syscalls (2)
403 manual page also provides information about kernel versions
404 in which various system calls first appeared.
405 .TP
406 .B CONFORMING TO
407 A description of any standards or conventions that relate to the function
408 or command described by the manual page.
409
410 The preferred terms to use for the various standards are listed as
411 headings in
412 .BR standards (7).
413
414 For a page in Section 2 or 3,
415 this section should note the POSIX.1
416 version(s) that the call conforms to,
417 and also whether the call is specified in C99.
418 (Don't worry too much about other standards like SUS, SUSv2, and XPG,
419 or the SVr4 and 4.xBSD implementation standards,
420 unless the call was specified in those standards,
421 but isn't in the current version of POSIX.1.)
422
423 If the call is not governed by any standards but commonly
424 exists on other systems, note them.
425 If the call is Linux-specific, note this.
426
427 If this section consists of just a list of standards
428 (which it commonly does),
429 terminate the list with a period (\(aq.\(aq).
430 .TP
431 .B NOTES
432 Miscellaneous notes.
433
434 For Section 2 and 3 man pages you may find it useful to include
435 subsections (\fBSS\fP) named \fILinux Notes\fP and \fIGlibc Notes\fP.
436
437 In Section 2, use the heading
438 .I "C library/kernel ABI differences"
439 to mark off notes that describe the differences (if any) between
440 the C library wrapper function for a system call and
441 the raw system call interface provided by the kernel.
442 .TP
443 .B BUGS
444 A list of limitations, known defects or inconveniences,
445 and other questionable activities.
446 .TP
447 .B EXAMPLE
448 One or more examples demonstrating how this function, file or
449 command is used.
450
451 For details on writing example programs,
452 see \fIExample Programs\fP below.
453 .TP
454 .B AUTHORS
455 A list of authors of the documentation or program.
456
457 \fBUse of an AUTHORS section is strongly discouraged\fP.
458 Generally, it is better not to clutter every page with a list
459 of (over time potentially numerous) authors;
460 if you write or significantly amend a page,
461 add a copyright notice as a comment in the source file.
462 If you are the author of a device driver and want to include
463 an address for reporting bugs, place this under the BUGS section.
464 .TP
465 .B SEE ALSO
466 A comma-separated list of related man pages, possibly followed by
467 other related pages or documents.
468
469 The list should be ordered by section number and
470 then alphabetically by name
471 Do not terminate this list with a period.
472 .IP
473 Where the SEE ALSO list contains many long manual page names,
474 to improve the visual result of the output, it may be useful to employ the
475 .I .ad l
476 (don't right justify)
477 and
478 .I .nh
479 (don't hyphenate)
480 directives.
481 Hyphenation of individual page names can be prevented
482 by preceding words with the string "\\%".
483
484 Given the distributed, autonomous nature of FOSS projects
485 and their documentation, it is sometimes necessary\(emand in many cases
486 desirable\(emthat the SEE ALSO section includes references to
487 manual pages provided by other projects.
488 .SH STYLE GUIDE
489 The following subsections describe the preferred style for the
490 .IR man-pages
491 project.
492 For details not covered below, the Chicago Manual of Style
493 is usually a good source;
494 try also grepping for preexisting usage in the project source tree.
495 .SS Use of gender-neutral language
496 As far as possible, use gender-neutral language in the text of man
497 pages.
498 Use of "they" ("them", "themself", "their") as a gender-neutral singular
499 pronoun is acceptable.
500 .SS Font conventions
501 .PP
502 For functions, the arguments are always specified using italics,
503 .IR "even in the SYNOPSIS section" ,
504 where the rest of the function is specified in bold:
505 .PP
506 .BI "    int myfunction(int " argc ", char **" argv );
507 .PP
508 Variable names should, like argument names, be specified in italics.
509 .PP
510 Filenames (whether pathnames, or references to header files)
511 are always in italics (e.g.,
512 .IR <stdio.h> ),
513 except in the SYNOPSIS section, where included files are in bold (e.g.,
514 .BR "#include <stdio.h>" ).
515 When referring to a standard header file include,
516 specify the header file surrounded by angle brackets,
517 in the usual C way (e.g.,
518 .IR <stdio.h> ).
519 .PP
520 Special macros, which are usually in uppercase, are in bold (e.g.,
521 .BR MAXINT ).
522 Exception: don't boldface NULL.
523 .PP
524 When enumerating a list of error codes, the codes are in bold (this list
525 usually uses the
526 .B \&.TP
527 macro).
528 .PP
529 Complete commands should, if long,
530 be written as an indented line on their own,
531 with a blank line before and after the command, for example
532 .in +4n
533 .nf
534
535 man 7 man-pages
536
537 .fi
538 .in
539 If the command is short, then it can be included inline in the text,
540 in italic format, for example,
541 .IR "man 7 man-pages" .
542 In this case, it may be worth using nonbreaking spaces
543 ("\e\ ") at suitable places in the command.
544 Command options should be written in italics (e.g.,
545 .IR \-l ).
546 .PP
547 Expressions, if not written on a separate indented line, should
548 be specified in italics.
549 Again, the use of nonbreaking spaces may be appropriate
550 if the expression is inlined with normal text.
551 .PP
552 Any reference to the subject of the current manual page
553 should be written with the name in bold.
554 If the subject is a function (i.e., this is a Section 2 or 3 page),
555 then the name should be followed by a pair of parentheses
556 in Roman (normal) font.
557 For example, in the
558 .BR fcntl (2)
559 man page, references to the subject of the page would be written as:
560 .BR fcntl ().
561 The preferred way to write this in the source file is:
562 .nf
563
564     .BR fcntl ()
565
566 .fi
567 (Using this format, rather than the use of "\\fB...\\fP()"
568 makes it easier to write tools that parse man page source files.)
569 .PP
570 Any reference to another man page
571 should be written with the name in bold,
572 .I always
573 followed by the section number,
574 formatted in Roman (normal) font, without any
575 separating spaces (e.g.,
576 .BR intro (2)).
577 The preferred way to write this in the source file is:
578 .nf
579
580     .BR intro (2)
581
582 .fi
583 (Including the section number in cross references lets tools like
584 .BR man2html (1)
585 create properly hyperlinked pages.)
586
587 Control characters should be written in bold face,
588 with no quotes; for example,
589 .BR ^X .
590 .SS Spelling
591 Starting with release 2.59,
592 .I man-pages
593 follows American spelling conventions
594 (previously, there was a random mix of British and American spellings);
595 please write all new pages and patches according to these conventions.
596
597 Aside from the well-known spelling differences,
598 there are a few other subtleties to watch for:
599 .IP * 3
600 American English tends to use the forms "backward", "upward", "toward",
601 and so on
602 rather than the British forms "backwards", "upwards", "towards", and so on.
603 .SS BSD version numbers
604 The classical scheme for writing BSD version numbers is
605 .IR x.yBSD ,
606 where
607 .I x.y
608 is the version number (e.g., 4.2BSD).
609 Avoid forms such as
610 .IR "BSD 4.3" .
611 .SS Capitalization
612 In subsection ("SS") headings,
613 capitalize the first word in the heading, but otherwise use lowercase,
614 except where English usage (e.g., proper nouns) or programming
615 language requirements (e.g., identifier names) dictate otherwise.
616 For example:
617
618     .SS Unicode under Linux
619
620 .SS Indentation of structure definitions, shell session logs, and so on
621 When structure definitions, shell session logs, and so on are included
622 in running text, indent them by 4 spaces (i.e., a block enclosed by
623 .I ".in\ +4n"
624 and
625 .IR ".in" ).
626 .SS Preferred terms
627 The following table lists some preferred terms to use in man pages,
628 mainly to ensure consistency across pages.
629 .TS
630 l l l
631 ---
632 l l l.
633 Term    Avoid using     Notes
634
635 bit mask        bitmask
636 built-in        builtin
637 Epoch   epoch   T{
638 For the UNIX Epoch (00:00:00, 1 Jan 1970 UTC)
639 T}
640 filename        file name
641 filesystem      file system
642 hostname        host name
643 inode   i-node
644 lowercase       lower case, lower-case
645 pathname        path name
646 pseudoterminal  pseudo-terminal
647 privileged port T{
648 reserved port,
649 system port
650 T}
651 real-time       T{
652 realtime,
653 real time
654 T}
655 run time        runtime
656 saved set-group-ID      T{
657 saved group ID,
658 saved set-GID
659 T}
660 saved set-user-ID       T{
661 saved user ID,
662 saved set-UID
663 T}
664 set-group-ID    set-GID, setgid
665 set-user-ID     set-UID, setuid
666 superuser       T{
667 super user,
668 super-user
669 T}
670 superblock      T{
671 super block,
672 super-block
673 T}
674 timestamp       time stamp
675 timezone        time zone
676 uppercase       upper case, upper-case
677 usable  useable
678 user space      userspace
679 username        user name
680 zeros   zeroes
681 .TE
682 .PP
683 See also the discussion
684 .IR "Hyphenation of attributive compounds"
685 below.
686 .SS Terms to avoid
687 The following table lists some terms to avoid using in man pages,
688 along with some suggested alternatives,
689 mainly to ensure consistency across pages.
690 .TS
691 l l l
692 ---
693 l l l.
694 Avoid   Use instead     Notes
695
696 32bit   32-bit  T{
697 same for 8-bit, 16-bit, etc.
698 T}
699 current process calling process T{
700 A common mistake made by kernel programmers when writing man pages
701 T}
702 manpage T{
703 man page, manual page
704 T}
705 minus infinity  negative infinity
706 non-root        unprivileged user
707 non-superuser   unprivileged user
708 nonprivileged   unprivileged
709 OS      operating system
710 plus infinity   positive infinity
711 pty     pseudoterminal
712 tty     terminal
713 Unices  UNIX systems
714 Unixes  UNIX systems
715 .TE
716 .SS Trademarks
717 Use the correct spelling and case for trademarks.
718 The following is a list of the correct spellings of various
719 relevant trademarks that are sometimes misspelled:
720
721      DG/UX
722      HP-UX
723      UNIX
724      UnixWare
725 .SS NULL, NUL, null pointer, and null character
726 A
727 .IR "null pointer"
728 is a pointer that points to nothing,
729 and is normally indicated by the constant
730 .IR NULL .
731 On the other hand,
732 .I NUL
733 is the
734 .IR "null byte",
735 a byte with the value 0, represented in C via the character constant
736 .IR \(aq\e0\(aq .
737
738 The preferred term for the pointer is "null pointer" or simply "NULL";
739 avoid writing "NULL pointer".
740
741 The preferred term for the byte is "null byte".
742 Avoid writing "NUL", since it is too easily confused with "NULL".
743 Avoid also the terms "zero byte" and "null character".
744 The byte that terminates a C string should be described
745 as "the terminating null byte";
746 strings may be described as "null-terminated",
747 but avoid the use of "NUL-terminated".
748 .SS Hyperlinks
749 For hyperlinks, use the
750 .IR .UR / .UE
751 macro pair
752 (see
753 .BR groff_man (7)).
754 This produces proper hyperlinks that can be used in a web browser,
755 when rendering a page with, say:
756
757      BROWSER=firefox man -H pagename
758 .SS Use of e.g., i.e., etc., a.k.a., and similar
759 In general, the use of abbreviations such as "e.g.", "i.e.", "etc.", "a.k.a."
760 should be avoided, in favor of suitable full wordings
761 ("for example", "that is", "and so on", "also known as").
762
763 The only place where such abbreviations may be acceptable is in
764 .I short
765 parenthetical asides (e.g., like this one).
766
767 Always include periods in such abbreviations, as shown here.
768 In addition, "e.g." and "i.e." should always be followed by a comma.
769 .SS Em-dashes
770 The way to write an em-dash\(emthe glyph that appears
771 at either end of this subphrase\(emin *roff is with the macro "\\(em".
772 (On an ASCII terminal, an em-dash typically renders as two hyphens,
773 but in other typographical contexts it renders as a long dash.)
774 Em-dashes should be written
775 .I without
776 surrounding spaces.
777 .SS Hyphenation of attributive compounds
778 Compound terms should be hyphenated when used attributively
779 (i.e., to qualify a following noun). Some examples:
780
781     32-bit value
782     command-line argument
783     floating-point number
784     run-time check
785     user-space function
786     wide-character string
787 .SS Hyphenation with multi, non, pre, re, sub, and so on
788 The general tendency in modern English is not to hyphenate
789 after prefixes such as "multi", "non", "pre", "re", "sub", and so on.
790 Manual pages should generally follow this rule when these prefixes are
791 used in natural English constructions with simple suffixes.
792 The following list gives some examples of the preferred forms:
793
794     interprocess
795     multithreaded
796     multiprocess
797     nonblocking
798     nondefault
799     nonempty
800     noninteractive
801     nonnegative
802     nonportable
803     nonzero
804     preallocated
805     precreate
806     prerecorded
807     reestablished
808     reinitialize
809     rearm
810     reread
811     subcomponent
812     subdirectory
813     subsystem
814
815 Hyphens should be retained when the prefixes are used in nonstandard
816 English words, with trademarks, proper nouns, acronyms, or compound terms.
817 Some examples:
818
819     non-ASCII
820     non-English
821     non-NULL
822     non-real-time
823
824 Finally, note that "re-create" and "recreate" are two different verbs,
825 and the former is probably what you want.
826 .SS Real minus character
827 Where a real minus character is required (e.g., for numbers such as \-1,
828 or when writing options that have a leading dash, such as in
829 .IR "ls\ \-l"),
830 use the following form in the man page source:
831
832     \\-
833
834 This guideline applies also to code examples.
835 .SS Character constants
836 To produce single quotes that render well in both ASCII and UTF-8,
837 use the following form for character constants in the man page source:
838
839     \\(aqC\\(aq
840
841 where
842 .I C
843 is the quoted character.
844 This guideline applies also to character constants used in code examples.
845 .SS Example programs and shell sessions
846 Manual pages may include example programs demonstrating how to
847 use a system call or library function.
848 However, note the following:
849 .IP * 3
850 Example programs should be written in C.
851 .IP *
852 An example program is necessary and useful only if it demonstrates
853 something beyond what can easily be provided in a textual
854 description of the interface.
855 An example program that does nothing
856 other than call an interface usually serves little purpose.
857 .IP *
858 Example programs should be fairly short (preferably less than 100 lines;
859 ideally less than 50 lines).
860 .IP *
861 Example programs should do error checking after system calls and
862 library function calls.
863 .IP *
864 Example programs should be complete, and compile without
865 warnings when compiled with \fIcc\ \-Wall\fP.
866 .IP *
867 Where possible and appropriate, example programs should allow
868 experimentation, by varying their behavior based on inputs
869 (ideally from command-line arguments, or alternatively, via
870 input read by the program).
871 .IP *
872 Example programs should be laid out according to Kernighan and
873 Ritchie style, with 4-space indents.
874 (Avoid the use of TAB characters in source code!)
875 .IP *
876 For consistency, all example programs should terminate using either of:
877
878      exit(EXIT_SUCCESS);
879      exit(EXIT_FAILURE);
880
881 Avoid using the following forms to terminate a program:
882
883     exit(0);
884     exit(1);
885     return n;
886 .IP *
887 If there is extensive explanatory text before the
888 program source code, mark off the source code
889 with a subsection heading
890 .IR "Program source" ,
891 as in:
892
893     .SS Program source
894
895 Always do this if the explanatory text includes a shell session log.
896 .PP
897 If you include a shell session log demonstrating the use of a program
898 or other system feature:
899 .IP * 3
900 Place the session log above the source code listing
901 .IP *
902 Indent the session log by four spaces.
903 .IP *
904 Boldface the user input text,
905 to distinguish it from output produced by the system.
906 .PP
907 For some examples of what example programs should look like, see
908 .BR wait (2)
909 and
910 .BR pipe (2).
911 .SH EXAMPLE
912 For canonical examples of how man pages in the
913 .I man-pages
914 package should look, see
915 .BR pipe (2)
916 and
917 .BR fcntl (2).
918 .SH SEE ALSO
919 .BR man (1),
920 .BR man2html (1),
921 .BR groff (7),
922 .BR groff_man (7),
923 .BR man (7),
924 .BR mdoc (7)
925 .SH COLOPHON
926 This page is part of release 3.79 of the Linux
927 .I man-pages
928 project.
929 A description of the project,
930 information about reporting bugs,
931 and the latest version of this page,
932 can be found at
933 \%http://www.kernel.org/doc/man\-pages/.