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