OSDN Git Service

LDP: Update original to LDP v3.75
[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-08-19 "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 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 .SH STYLE GUIDE
484 The following subsections describe the preferred style for the
485 .IR man-pages
486 project.
487 For details not covered below, the Chicago Manual of Style
488 is usually a good source;
489 try also grepping for preexisting usage in the project source tree.
490 .SS Use of gender-neutral language
491 As far as possible, use gender-neutral language in the text of man
492 pages.
493 Use of "they" ("them", "themself", "their") as a gender-neutral singular
494 pronoun is acceptable.
495 .SS Font conventions
496 .PP
497 For functions, the arguments are always specified using italics,
498 .IR "even in the SYNOPSIS section" ,
499 where the rest of the function is specified in bold:
500 .PP
501 .BI "    int myfunction(int " argc ", char **" argv );
502 .PP
503 Variable names should, like argument names, be specified in italics.
504 .PP
505 Filenames (whether pathnames, or references to header files)
506 are always in italics (e.g.,
507 .IR <stdio.h> ),
508 except in the SYNOPSIS section, where included files are in bold (e.g.,
509 .BR "#include <stdio.h>" ).
510 When referring to a standard header file include,
511 specify the header file surrounded by angle brackets,
512 in the usual C way (e.g.,
513 .IR <stdio.h> ).
514 .PP
515 Special macros, which are usually in uppercase, are in bold (e.g.,
516 .BR MAXINT ).
517 Exception: don't boldface NULL.
518 .PP
519 When enumerating a list of error codes, the codes are in bold (this list
520 usually uses the
521 .B \&.TP
522 macro).
523 .PP
524 Complete commands should, if long,
525 be written as an indented line on their own,
526 with a blank line before and after the command, for example
527 .in +4n
528 .nf
529
530 man 7 man-pages
531
532 .fi
533 .in
534 If the command is short, then it can be included inline in the text,
535 in italic format, for example,
536 .IR "man 7 man-pages" .
537 In this case, it may be worth using nonbreaking spaces
538 ("\e\ ") at suitable places in the command.
539 Command options should be written in italics (e.g.,
540 .IR \-l ).
541 .PP
542 Expressions, if not written on a separate indented line, should
543 be specified in italics.
544 Again, the use of nonbreaking spaces may be appropriate
545 if the expression is inlined with normal text.
546 .PP
547 Any reference to the subject of the current manual page
548 should be written with the name in bold.
549 If the subject is a function (i.e., this is a Section 2 or 3 page),
550 then the name should be followed by a pair of parentheses
551 in Roman (normal) font.
552 For example, in the
553 .BR fcntl (2)
554 man page, references to the subject of the page would be written as:
555 .BR fcntl ().
556 The preferred way to write this in the source file is:
557 .nf
558
559     .BR fcntl ()
560
561 .fi
562 (Using this format, rather than the use of "\\fB...\\fP()"
563 makes it easier to write tools that parse man page source files.)
564 .PP
565 Any reference to another man page
566 should be written with the name in bold,
567 .I always
568 followed by the section number,
569 formatted in Roman (normal) font, without any
570 separating spaces (e.g.,
571 .BR intro (2)).
572 The preferred way to write this in the source file is:
573 .nf
574
575     .BR intro (2)
576
577 .fi
578 (Including the section number in cross references lets tools like
579 .BR man2html (1)
580 create properly hyperlinked pages.)
581
582 Control characters should be written in bold face,
583 with no quotes; for example,
584 .BR ^X .
585 .SS Spelling
586 Starting with release 2.59,
587 .I man-pages
588 follows American spelling conventions
589 (previously, there was a random mix of British and American spellings);
590 please write all new pages and patches according to these conventions.
591
592 Aside from the well-known spelling differences,
593 there are a few other subtleties to watch for:
594 .IP * 3
595 American English tends to use the forms "backward", "upward", "toward",
596 and so on
597 rather than the British forms "backwards", "upwards", "towards", and so on.
598 .SS BSD version numbers
599 The classical scheme for writing BSD version numbers is
600 .IR x.yBSD ,
601 where
602 .I x.y
603 is the version number (e.g., 4.2BSD).
604 Avoid forms such as
605 .IR "BSD 4.3" .
606 .SS Capitalization
607 In subsection ("SS") headings,
608 capitalize the first word in the heading, but otherwise use lowercase,
609 except where English usage (e.g., proper nouns) or programming
610 language requirements (e.g., identifier names) dictate otherwise.
611 For example:
612
613     .SS Unicode under Linux
614
615 .SS Indentation of structure definitions, shell session logs, and so on
616 When structure definitions, shell session logs, and so on are included
617 in running text, indent them by 4 spaces (i.e., a block enclosed by
618 .I ".in\ +4n"
619 and
620 .IR ".in" ).
621 .SS Preferred terms
622 The following table lists some preferred terms to use in man pages,
623 mainly to ensure consistency across pages.
624 .TS
625 l l l
626 ---
627 l l l.
628 Term    Avoid using     Notes
629
630 bit mask        bitmask
631 built-in        builtin
632 Epoch   epoch   T{
633 For the UNIX Epoch (00:00:00, 1 Jan 1970 UTC)
634 T}
635 filename        file name
636 filesystem      file system
637 hostname        host name
638 inode   i-node
639 lowercase       lower case, lower-case
640 pathname        path name
641 pseudoterminal  pseudo-terminal
642 privileged port T{
643 reserved port,
644 system port
645 T}
646 real-time       T{
647 realtime,
648 real time
649 T}
650 run time        runtime
651 saved set-group-ID      T{
652 saved group ID,
653 saved set-GID
654 T}
655 saved set-user-ID       T{
656 saved user ID,
657 saved set-UID
658 T}
659 set-group-ID    set-GID, setgid
660 set-user-ID     set-UID, setuid
661 superuser       T{
662 super user,
663 super-user
664 T}
665 superblock      T{
666 super block,
667 super-block
668 T}
669 timestamp       time stamp
670 timezone        time zone
671 uppercase       upper case, upper-case
672 usable  useable
673 user space      userspace
674 username        user name
675 zeros   zeroes
676 .TE
677 .PP
678 See also the discussion
679 .IR "Hyphenation of attributive compounds"
680 below.
681 .SS Terms to avoid
682 The following table lists some terms to avoid using in man pages,
683 along with some suggested alternatives,
684 mainly to ensure consistency across pages.
685 .TS
686 l l l
687 ---
688 l l l.
689 Avoid   Use instead     Notes
690
691 32bit   32-bit  T{
692 same for 8-bit, 16-bit, etc.
693 T}
694 current process calling process T{
695 A common mistake made by kernel programmers when writing man pages
696 T}
697 manpage T{
698 man page, manual page
699 T}
700 minus infinity  negative infinity
701 non-root        unprivileged user
702 non-superuser   unprivileged user
703 nonprivileged   unprivileged
704 OS      operating system
705 plus infinity   positive infinity
706 pty     pseudoterminal
707 tty     terminal
708 Unices  UNIX systems
709 Unixes  UNIX systems
710 .TE
711 .SS Trademarks
712 Use the correct spelling and case for trademarks.
713 The following is a list of the correct spellings of various
714 relevant trademarks that are sometimes misspelled:
715
716      DG/UX
717      HP-UX
718      UNIX
719      UnixWare
720 .SS NULL, NUL, null pointer, and null character
721 A
722 .IR "null pointer"
723 is a pointer that points to nothing,
724 and is normally indicated by the constant
725 .IR NULL .
726 On the other hand,
727 .I NUL
728 is the
729 .IR "null byte",
730 a byte with the value 0, represented in C via the character constant
731 .IR \(aq\e0\(aq .
732
733 The preferred term for the pointer is "null pointer" or simply "NULL";
734 avoid writing "NULL pointer".
735
736 The preferred term for the byte is "null byte".
737 Avoid writing "NUL", since it is too easily confused with "NULL".
738 Avoid also the terms "zero byte" and "null character".
739 The byte that terminates a C string should be described
740 as "the terminating null byte";
741 strings may be described as "null-terminated",
742 but avoid the use of "NUL-terminated".
743 .SS Hyperlinks
744 For hyperlinks, use the
745 .IR .UR / .UE
746 macro pair
747 (see
748 .BR groff_man (7)).
749 This produces proper hyperlinks that can be used in a web browser,
750 when rendering a page with, say:
751
752      BROWSER=firefox man -H pagename
753 .SS Use of e.g., i.e., etc., a.k.a., and similar
754 In general, the use of abbreviations such as "e.g.", "i.e.", "etc.", "a.k.a."
755 should be avoided, in favor of suitable full wordings
756 ("for example", "that is", "and so on", "also known as").
757
758 The only place where such abbreviations may be acceptable is in
759 .I short
760 parenthetical asides (e.g., like this one).
761
762 Always include periods in such abbreviations, as shown here.
763 In addition, "e.g." and "i.e." should always be followed by a comma.
764 .SS Em-dashes
765 The way to write an em-dash\(emthe glyph that appears
766 at either end of this subphrase\(emin *roff is with the macro "\\(em".
767 (On an ASCII terminal, an em-dash typically renders as two hyphens,
768 but in other typographical contexts it renders as a long dash.)
769 Em-dashes should be written
770 .I without
771 surrounding spaces.
772 .SS Hyphenation of attributive compounds
773 Compound terms should be hyphenated when used attributively
774 (i.e., to qualify a following noun). Some examples:
775
776     32-bit value
777     command-line argument
778     floating-point number
779     run-time check
780     user-space function
781     wide-character string
782 .SS Hyphenation with multi, non, pre, re, sub, and so on
783 The general tendency in modern English is not to hyphenate
784 after prefixes such as "multi", "non", "pre", "re", "sub", and so on.
785 Manual pages should generally follow this rule when these prefixes are
786 used in natural English constructions with simple suffixes.
787 The following list gives some examples of the preferred forms:
788
789     interprocess
790     multithreaded
791     multiprocess
792     nonblocking
793     nondefault
794     nonempty
795     noninteractive
796     nonnegative
797     nonportable
798     nonzero
799     preallocated
800     precreate
801     prerecorded
802     reestablished
803     reinitialize
804     rearm
805     reread
806     subcomponent
807     subdirectory
808     subsystem
809
810 Hyphens should be retained when the prefixes are used in nonstandard
811 English words, with trademarks, proper nouns, acronyms, or compound terms.
812 Some examples:
813
814     non-ASCII
815     non-English
816     non-NULL
817     non-real-time
818
819 Finally, note that "re-create" and "recreate" are two different verbs,
820 and the former is probably what you want.
821 .SS Real minus character
822 Where a real minus character is required (e.g., for numbers such as \-1,
823 or when writing options that have a leading dash, such as in
824 .IR "ls\ \-l"),
825 use the following form in the man page source:
826
827     \\-
828
829 This guideline applies also to code examples.
830 .SS Character constants
831 To produce single quotes that render well in both ASCII and UTF-8,
832 use the following form for character constants in the man page source:
833
834     \\(aqC\\(aq
835
836 where
837 .I C
838 is the quoted character.
839 This guideline applies also to character constants used in code examples.
840 .SS Example programs and shell sessions
841 Manual pages may include example programs demonstrating how to
842 use a system call or library function.
843 However, note the following:
844 .IP * 3
845 Example programs should be written in C.
846 .IP *
847 An example program is necessary and useful only if it demonstrates
848 something beyond what can easily be provided in a textual
849 description of the interface.
850 An example program that does nothing
851 other than call an interface usually serves little purpose.
852 .IP *
853 Example programs should be fairly short (preferably less than 100 lines;
854 ideally less than 50 lines).
855 .IP *
856 Example programs should do error checking after system calls and
857 library function calls.
858 .IP *
859 Example programs should be complete, and compile without
860 warnings when compiled with \fIcc\ \-Wall\fP.
861 .IP *
862 Where possible and appropriate, example programs should allow
863 experimentation, by varying their behavior based on inputs
864 (ideally from command-line arguments, or alternatively, via
865 input read by the program).
866 .IP *
867 Example programs should be laid out according to Kernighan and
868 Ritchie style, with 4-space indents.
869 (Avoid the use of TAB characters in source code!)
870 .IP *
871 For consistency, all example programs should terminate using either of:
872
873      exit(EXIT_SUCCESS);
874      exit(EXIT_FAILURE);
875
876 Avoid using the following forms to terminate a program:
877
878     exit(0);
879     exit(1);
880     return n;
881 .IP *
882 If there is extensive explanatory text before the
883 program source code, mark off the source code
884 with a subsection heading
885 .IR "Program source" ,
886 as in:
887
888     .SS Program source
889
890 Always do this if the explanatory text includes a shell session log.
891 .PP
892 If you include a shell session log demonstrating the use of a program
893 or other system feature:
894 .IP * 3
895 Place the session log above the source code listing
896 .IP *
897 Indent the session log by four spaces.
898 .IP *
899 Boldface the user input text,
900 to distinguish it from output produced by the system.
901 .PP
902 For some examples of what example programs should look like, see
903 .BR wait (2)
904 and
905 .BR pipe (2).
906 .SH EXAMPLE
907 For canonical examples of how man pages in the
908 .I man-pages
909 package should look, see
910 .BR pipe (2)
911 and
912 .BR fcntl (2).
913 .SH SEE ALSO
914 .BR man (1),
915 .BR man2html (1),
916 .BR groff (7),
917 .BR groff_man (7),
918 .BR man (7),
919 .BR mdoc (7)
920 .SH COLOPHON
921 This page is part of release 3.75 of the Linux
922 .I man-pages
923 project.
924 A description of the project,
925 information about reporting bugs,
926 and the latest version of this page,
927 can be found at
928 \%http://www.kernel.org/doc/man\-pages/.