OSDN Git Service

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