1MAN-PAGES(7)               Linux Programmer's Manual              MAN-PAGES(7)
2
3
4

NAME

6       man-pages - conventions for writing Linux man pages
7

SYNOPSIS

9       man [section] title
10

DESCRIPTION

12       This  page describes the conventions that should be employed when writ‐
13       ing man pages for the Linux  man-pages  project,  which  documents  the
14       user-space API provided by the Linux kernel and the GNU C library.  The
15       project thus provides most of the pages in Section 2, many of the pages
16       that appear in Sections 3, 4, and 7, and a few of the pages that appear
17       in Sections 1, 5, and 8 of the man pages on a Linux system.   The  con‐
18       ventions  described on this page may also be useful for authors writing
19       man pages for other projects.
20
21   Sections of the manual pages
22       The manual Sections are traditionally defined as follows:
23
24       1 User commands (Programs)
25              Commands that can be executed by the user from within a shell.
26
27       2 System calls
28              Functions which wrap operations performed by the kernel.
29
30       3 Library calls
31              All library functions excluding the system call  wrappers  (Most
32              of the libc functions).
33
34       4 Special files (devices)
35              Files found in /dev which allow to access to devices through the
36              kernel.
37
38       5 File formats and configuration files
39              Describes various human-readable file formats and  configuration
40              files.
41
42       6 Games
43              Games and funny little programs available on the system.
44
45       7 Overview, conventions, and miscellaneous
46              Overviews  or  descriptions  of  various topics, conventions and
47              protocols, character set standards, the standard filesystem lay‐
48              out, and miscellaneous other things.
49
50       8 System management commands
51              Commands like mount(8), many of which only root can execute.
52
53   Macro package
54       New  manual  pages  should be marked up using the groff an.tmac package
55       described in man(7).  This choice is mainly for consistency:  the  vast
56       majority  of  existing  Linux  manual  pages  are marked up using these
57       macros.
58
59   Conventions for source file layout
60       Please limit source code line length to no more than about  75  charac‐
61       ters  wherever  possible.   This helps avoid line-wrapping in some mail
62       clients when patches are submitted inline.
63
64   Title line
65       The first command in a man page should be a TH command:
66
67              .TH title section date source manual
68
69       where:
70
71              title     The title of the man page, written in all caps  (e.g.,
72                        MAN-PAGES).
73
74              section   The  section  number  in  which the man page should be
75                        placed (e.g., 7).
76
77              date      The date of the last nontrivial change that  was  made
78                        to  the  man page.  (Within the man-pages project, the
79                        necessary updates  to  these  timestamps  are  handled
80                        automatically by scripts, so there is no need to manu‐
81                        ally update them as part of a patch.)  Dates should be
82                        written in the form YYYY-MM-DD.
83
84              source    The source of the command, function, or system call.
85
86                        For  those  few  man-pages  pages in Sections 1 and 8,
87                        probably you just want to write GNU.
88
89                        For system calls, just write Linux.  (An earlier prac‐
90                        tice  was  to  write  the version number of the kernel
91                        from which the manual page was being  written/checked.
92                        However,  this was never done consistently, and so was
93                        probably  worse  than  including  no  version  number.
94                        Henceforth, avoid including a version number.)
95
96                        For library calls that are part of glibc or one of the
97                        other common GNU libraries, just use  GNU  C  Library,
98                        GNU, or an empty string.
99
100                        For Section 4 pages, use Linux.
101
102                        In cases of doubt, just write Linux, or GNU.
103
104              manual    The  title  of  the  manual (e.g., for Section 2 and 3
105                        pages in the man-pages package, use Linux Programmer's
106                        Manual).
107
108   Sections within a manual page
109       The  list  below shows conventional or suggested sections.  Most manual
110       pages should include at least the highlighted sections.  Arrange a  new
111       manual page so that sections are placed in the order shown in the list.
112
113           NAME
114           SYNOPSIS
115           CONFIGURATION      [Normally only in Section 4]
116           DESCRIPTION
117           OPTIONS            [Normally only in Sections 1, 8]
118           EXIT STATUS        [Normally only in Sections 1, 8]
119           RETURN VALUE       [Normally only in Sections 2, 3]
120           ERRORS             [Typically only in Sections 2, 3]
121           ENVIRONMENT
122           FILES
123           VERSIONS           [Normally only in Sections 2, 3]
124           ATTRIBUTES         [Normally only in Sections 2, 3]
125           CONFORMING TO
126           NOTES
127           BUGS
128           EXAMPLES
129           AUTHORS            [Discouraged]
130           REPORTING BUGS     [Not used in man-pages]
131           COPYRIGHT          [Not used in man-pages]
132           SEE ALSO
133
134       Where  a  traditional  heading would apply, please use it; this kind of
135       consistency can make the information  easier  to  understand.   If  you
136       must,  you  can  create your own headings if they make things easier to
137       understand (this can be especially useful for pages in Sections  4  and
138       5).   However,  before  doing  this, consider whether you could use the
139       traditional headings, with some subsections  (.SS)  within  those  sec‐
140       tions.
141
142       The following list elaborates on the contents of each of the above sec‐
143       tions.
144
145       NAME   The name of this manual page.
146
147              See man(7) for important details of the line(s) that should fol‐
148              low the .SH NAME command.  All words in this line (including the
149              word immediately following the "\-")  should  be  in  lowercase,
150              except where English or technical terminological convention dic‐
151              tates otherwise.
152
153       SYNOPSIS
154              A brief summary of the command or function's interface.
155
156              For commands, this shows the syntax of the command and its argu‐
157              ments  (including  options); boldface is used for as-is text and
158              italics are used to indicate  replaceable  arguments.   Brackets
159              ([])  surround  optional  arguments,  vertical bars (|) separate
160              choices, and ellipses (...) can be repeated.  For functions,  it
161              shows  any  required  data  declarations or #include directives,
162              followed by the function declaration.
163
164              Where a feature test macro must be defined in  order  to  obtain
165              the  declaration  of  a  function  (or a variable) from a header
166              file, then the SYNOPSIS should indicate this,  as  described  in
167              feature_test_macros(7).
168
169       CONFIGURATION
170              Configuration details for a device.
171
172              This section normally appears only in Section 4 pages.
173
174       DESCRIPTION
175              An explanation of what the program, function, or format does.
176
177              Discuss how it interacts with files and standard input, and what
178              it produces on standard output or standard error.   Omit  inter‐
179              nals  and  implementation  details  unless  they're critical for
180              understanding the  interface.   Describe  the  usual  case;  for
181              information on command-line options of a program use the OPTIONS
182              section.
183
184              When describing new behavior or new flags for a system  call  or
185              library  function,  be  careful  to note the kernel or C library
186              version that introduced the change.   The  preferred  method  of
187              noting  this  information for flags is as part of a .TP list, in
188              the following form (here, for a new system call flag):
189
190                             XYZ_FLAG (since Linux 3.7)
191                                    Description of flag...
192
193              Including version information is especially useful to users  who
194              are  constrained  to  using  older  kernel or C library versions
195              (which is typical in embedded systems, for example).
196
197       OPTIONS
198              A description of the command-line options accepted by a  program
199              and how they change its behavior.
200
201              This  section  should  appear  only  for  Section 1 and 8 manual
202              pages.
203
204       EXIT STATUS
205              A list of the possible exit status values of a program  and  the
206              conditions that cause these values to be returned.
207
208              This  section  should  appear  only  for  Section 1 and 8 manual
209              pages.
210
211       RETURN VALUE
212              For Section 2 and 3 pages, this section gives a list of the val‐
213              ues the library routine will return to the caller and the condi‐
214              tions that cause these values to be returned.
215
216       ERRORS For Section 2 and 3 manual pages, this is a list of  the  values
217              that may be placed in errno in the event of an error, along with
218              information about the cause of the errors.
219
220              Where several different conditions produce the same  error,  the
221              preferred  approach  is  to  create  separate list entries (with
222              duplicate error names) for each of the conditions.   This  makes
223              the separate conditions clear, may make the list easier to read,
224              and allows metainformation (e.g., kernel  version  number  where
225              the  condition first became applicable) to be more easily marked
226              for each condition.
227
228              The error list should be in alphabetical order.
229
230       ENVIRONMENT
231              A list of all environment variables that affect the  program  or
232              function and how they affect it.
233
234       FILES  A  list  of the files the program or function uses, such as con‐
235              figuration files, startup files, and files the program  directly
236              operates on.
237
238              Give  the full pathname of these files, and use the installation
239              process to modify the directory part to match user  preferences.
240              For  many  programs,  the  default  installation  location is in
241              /usr/local, so your base manual page should  use  /usr/local  as
242              the base.
243
244       ATTRIBUTES
245              A summary of various attributes of the function(s) documented on
246              this page.  See attributes(7) for further details.
247
248       VERSIONS
249              A brief summary of the Linux kernel or glibc  versions  where  a
250              system  call  or  library function appeared, or changed signifi‐
251              cantly in its operation.
252
253              As a general rule, every new interface should include a VERSIONS
254              section in its manual page.  Unfortunately, many existing manual
255              pages don't include this information (since there was no  policy
256              to  do  so  when they were written).  Patches to remedy this are
257              welcome, but, from the perspective of  programmers  writing  new
258              code, this information probably matters only in the case of ker‐
259              nel interfaces that have been added in Linux 2.4 or later (i.e.,
260              changes  since kernel 2.2), and library functions that have been
261              added to glibc since version  2.1  (i.e.,  changes  since  glibc
262              2.0).
263
264              The syscalls(2) manual page also provides information about ker‐
265              nel versions in which various system calls first appeared.
266
267       CONFORMING TO
268              A description of any standards or conventions that relate to the
269              function or command described by the manual page.
270
271              The  preferred terms to use for the various standards are listed
272              as headings in standards(7).
273
274              For a page in Section 2 or  3,  this  section  should  note  the
275              POSIX.1  version(s)  that the call conforms to, and also whether
276              the call is specified in C99.  (Don't worry too much about other
277              standards  like  SUS,  SUSv2,  and  XPG,  or the SVr4 and 4.xBSD
278              implementation standards, unless the call was specified in those
279              standards, but isn't in the current version of POSIX.1.)
280
281              If the call is not governed by any standards but commonly exists
282              on other systems, note them.  If  the  call  is  Linux-specific,
283              note this.
284
285              If  this  section consists of just a list of standards (which it
286              commonly does), terminate the list with a period ('.').
287
288       NOTES  Miscellaneous notes.
289
290              For Section 2 and 3 man pages you may find it useful to  include
291              subsections (SS) named Linux Notes and Glibc Notes.
292
293              In  Section  2,  use the heading C library/kernel differences to
294              mark off notes that describe the differences  (if  any)  between
295              the  C  library  wrapper  function for a system call and the raw
296              system call interface provided by the kernel.
297
298       BUGS   A list of limitations,  known  defects  or  inconveniences,  and
299              other questionable activities.
300
301       EXAMPLES
302              One  or  more  examples demonstrating how this function, file or
303              command is used.
304
305              For details on writing example programs,  see  Example  programs
306              below.
307
308       AUTHORS
309              A list of authors of the documentation or program.
310
311              Use  of  an AUTHORS section is strongly discouraged.  Generally,
312              it is better not to clutter every page with a list of (over time
313              potentially  numerous)  authors;  if  you write or significantly
314              amend a page, add a copyright notice as a comment in the  source
315              file.   If  you  are  the  author of a device driver and want to
316              include an address for reporting bugs, place this under the BUGS
317              section.
318
319       REPORTING BUGS
320              The  man-pages  project  doesn't use a REPORTING BUGS section in
321              manual pages.  Information on reporting bugs is instead supplied
322              in  the  script-generated  COLOPHON  section.   However, various
323              projects do use a REPORTING BUGS section.  it is recommended  to
324              place it near the foot of the page.
325
326       COPYRIGHT
327              The  man-pages project doesn't use a COPYRIGHT section in manual
328              pages.  Copyright information is instead maintained in the  page
329              source.   In  pages  where this section is present, it is recom‐
330              mended to place it near the foot of the  page,  just  above  SEE
331              ALSO.
332
333       SEE ALSO
334              A  comma-separated  list of related man pages, possibly followed
335              by other related pages or documents.
336
337              The list should be ordered by section number and then alphabeti‐
338              cally by name.  Do not terminate this list with a period.
339
340              Where the SEE ALSO list contains many long manual page names, to
341              improve the visual result of the output, it  may  be  useful  to
342              employ the .ad l (don't right justify) and .nh (don't hyphenate)
343              directives.  Hyphenation of individual page names  can  be  pre‐
344              vented by preceding words with the string "\%".
345
346              Given  the  distributed,  autonomous nature of FOSS projects and
347              their documentation, it is sometimes necessary—and in many cases
348              desirable—that  the SEE ALSO section includes references to man‐
349              ual pages provided by other projects.
350

STYLE GUIDE

352       The following subsections describe the preferred  style  for  the  man-
353       pages  project.   For  details not covered below, the Chicago Manual of
354       Style is usually a good source; try also grepping for preexisting usage
355       in the project source tree.
356
357   Use of gender-neutral language
358       As  far  as  possible,  use  gender-neutral language in the text of man
359       pages.  Use of "they" ("them", "themself", "their") as a gender-neutral
360       singular pronoun is acceptable.
361
362   Formatting conventions for manual pages describing commands
363       For  manual  pages that describe a command (typically in Sections 1 and
364       8), the arguments are always specified using italics, even in the  SYN‐
365       OPSIS section.
366
367       The name of the command, and its options, should always be formatted in
368       bold.
369
370   Formatting conventions for manual pages describing functions
371       For manual pages that describe functions (typically in Sections  2  and
372       3),  the arguments are always specified using italics, even in the SYN‐
373       OPSIS section, where the rest of the function is specified in bold:
374
375           int myfunction(int argc, char **argv);
376
377       Variable names should, like argument names, be specified in italics.
378
379       Any reference to the subject of the current manual page should be writ‐
380       ten  with  the  name in bold followed by a pair of parentheses in Roman
381       (normal) font.  For example, in the fcntl(2) man  page,  references  to
382       the  subject  of  the page would be written as: fcntl().  The preferred
383       way to write this in the source file is:
384
385           .BR fcntl ()
386
387       (Using this format, rather than the use of "\fB...\fP()" makes it  eas‐
388       ier to write tools that parse man page source files.)
389
390   Use semantic newlines
391       In  the source of a manual page, new sentences should be started on new
392       lines, and long sentences should split  into  lines  at  clause  breaks
393       (commas,  semicolons,  colons,  and so on).  This convention, sometimes
394       known as "semantic newlines", makes it easier  to  see  the  effect  of
395       patches,  which  often  operate at the level of individual sentences or
396       sentence clauses.
397
398   Formatting conventions (general)
399       Paragraphs should be separated by suitable markers (usually either  .PP
400       or .IP).  Do not separate paragraphs using blank lines, as this results
401       in poor rendering in some output formats (such as PostScript and PDF).
402
403       Filenames (whether pathnames, or references to header files) are always
404       in  italics  (e.g.,  <stdio.h>),  except in the SYNOPSIS section, where
405       included files are in bold (e.g., #include <stdio.h>).  When  referring
406       to  a  standard header file include, specify the header file surrounded
407       by angle brackets, in the usual C way (e.g., <stdio.h>).
408
409       Special macros, which are usually in uppercase, are in bold (e.g., MAX‐
410       INT).  Exception: don't boldface NULL.
411
412       When  enumerating  a  list  of error codes, the codes are in bold (this
413       list usually uses the .TP macro).
414
415       Complete commands should, if long, be written as an  indented  line  on
416       their own, with a blank line before and after the command, for example
417
418           man 7 man-pages
419
420       If the command is short, then it can be included inline in the text, in
421       italic format, for example, man 7 man-pages.  In this case, it  may  be
422       worth  using  nonbreaking  spaces ("\ ") at suitable places in the com‐
423       mand.  Command options should be written in italics (e.g., -l).
424
425       Expressions, if not written on a  separate  indented  line,  should  be
426       specified  in  italics.   Again,  the  use of nonbreaking spaces may be
427       appropriate if the expression is inlined with normal text.
428
429       When showing example shell sessions, user input should be formatted  in
430       bold, for example
431
432           $ date
433           Thu Jul  7 13:01:27 CEST 2016
434
435       Any  reference  to  another man page should be written with the name in
436       bold, always followed by the section number, formatted in  Roman  (nor‐
437       mal)  font,  without  any separating spaces (e.g., intro(2)).  The pre‐
438       ferred way to write this in the source file is:
439
440           .BR intro (2)
441
442       (Including the section number  in  cross  references  lets  tools  like
443       man2html(1) create properly hyperlinked pages.)
444
445       Control  characters should be written in bold face, with no quotes; for
446       example, ^X.
447
448   Spelling
449       Starting with release 2.59, man-pages follows American spelling conven‐
450       tions  (previously,  there  was  a  random  mix of British and American
451       spellings); please write all new pages and patches according  to  these
452       conventions.
453
454       Aside  from  the well-known spelling differences, there are a few other
455       subtleties to watch for:
456
457       *  American English  tends  to  use  the  forms  "backward",  "upward",
458          "toward",  and  so  on  rather  than  the British forms "backwards",
459          "upwards", "towards", and so on.
460
461   BSD version numbers
462       The classical scheme for writing BSD version numbers is  x.yBSD,  where
463       x.y is the version number (e.g., 4.2BSD).  Avoid forms such as BSD 4.3.
464
465   Capitalization
466       In  subsection  ("SS") headings, capitalize the first word in the head‐
467       ing, but otherwise use lowercase, except  where  English  usage  (e.g.,
468       proper  nouns)  or  programming language requirements (e.g., identifier
469       names) dictate otherwise.  For example:
470
471           .SS Unicode under Linux
472
473   Indentation of structure definitions, shell session logs, and so on
474       When structure definitions, shell session logs, and so on are  included
475       in  running  text,  indent  them by 4 spaces (i.e., a block enclosed by
476       .in +4n and .in), format them using the .EX and EE macros, and surround
477       them with suitable paragraph markers (either .PP or .IP).  For example:
478
479               .PP
480               .in +4n
481               .EX
482               int
483               main(int argc, char *argv[])
484               {
485                   return 0;
486               }
487               .EE
488               .in
489               .PP
490
491   Preferred terms
492       The  following  table  lists  some preferred terms to use in man pages,
493       mainly to ensure consistency across pages.
494
495       Term                 Avoid using              Notes
496       ──────────────────────────────────────────────────────────────────
497
498       bit mask             bitmask
499       built-in             builtin
500       Epoch                epoch                    For the UNIX  Epoch
501                                                     (00:00:00,   1  Jan
502                                                     1970 UTC)
503       filename             file name
504       filesystem           file system
505       hostname             host name
506       inode                i-node
507       lowercase            lower case, lower-case
508       nonzero              non-zero
509       pathname             path name
510       pseudoterminal       pseudo-terminal
511       privileged port      reserved port,  system
512                            port
513       real-time            realtime, real time
514       run time             runtime
515       saved set-group-ID   saved  group ID, saved
516                            set-GID
517       saved set-user-ID    saved user  ID,  saved
518                            set-UID
519       set-group-ID         set-GID, setgid
520       set-user-ID          set-UID, setuid
521       superuser            super user, super-user
522       superblock           super   block,  super-
523                            block
524       timestamp            time stamp
525       timezone             time zone
526       uppercase            upper case, upper-case
527       usable               useable
528       user space           userspace
529       username             user name
530       x86-64               x86_64                   Except if referring
531                                                     to     result    of
532                                                     "uname -m" or simi‐
533                                                     lar
534       zeros                zeroes
535
536       See also the discussion Hyphenation of attributive compounds below.
537
538   Terms to avoid
539       The following table lists some terms to avoid using in man pages, along
540       with some suggested alternatives, mainly to ensure  consistency  across
541       pages.
542
543       Avoid             Use instead           Notes
544       ────────────────────────────────────────────────────────────
545
546
547       32bit             32-bit                same   for   8-bit,
548                                               16-bit, etc.
549       current process   calling process       A  common   mistake
550                                               made by kernel pro‐
551                                               grammers when writ‐
552                                               ing man pages
553       manpage           man   page,  manual
554                         page
555       minus infinity    negative infinity
556       non-root          unprivileged user
557       non-superuser     unprivileged user
558       nonprivileged     unprivileged
559       OS                operating system
560       plus infinity     positive infinity
561       pty               pseudoterminal
562       tty               terminal
563       Unices            UNIX systems
564       Unixes            UNIX systems
565
566   Trademarks
567       Use the correct spelling and case for trademarks.  The following  is  a
568       list  of  the correct spellings of various relevant trademarks that are
569       sometimes misspelled:
570
571            DG/UX
572            HP-UX
573            UNIX
574            UnixWare
575
576   NULL, NUL, null pointer, and null character
577       A null pointer is a pointer that points to  nothing,  and  is  normally
578       indicated  by  the  constant  NULL.  On the other hand, NUL is the null
579       byte, a byte with the value 0, represented in C via the character  con‐
580       stant '\0'.
581
582       The  preferred term for the pointer is "null pointer" or simply "NULL";
583       avoid writing "NULL pointer".
584
585       The preferred term for the byte is "null byte".  Avoid  writing  "NUL",
586       since  it  is  too  easily  confused with "NULL".  Avoid also the terms
587       "zero byte" and "null character".  The byte that terminates a C  string
588       should  be  described  as  "the  terminating null byte"; strings may be
589       described as "null-terminated", but avoid the use of "NUL-terminated".
590
591   Hyperlinks
592       For hyperlinks, use the .UR/.UE macro pair  (see  groff_man(7)).   This
593       produces proper hyperlinks that can be used in a web browser, when ren‐
594       dering a page with, say:
595
596            BROWSER=firefox man -H pagename
597
598   Use of e.g., i.e., etc., a.k.a., and similar
599       In general, the use of abbreviations such as  "e.g.",  "i.e.",  "etc.",
600       "cf.",  and "a.k.a." should be avoided, in favor of suitable full word‐
601       ings ("for example", "that is", "compare to", "and so on", "also  known
602       as").
603
604       The  only  place where such abbreviations may be acceptable is in short
605       parenthetical asides (e.g., like this one).
606
607       Always include periods in such abbreviations, as shown here.  In  addi‐
608       tion, "e.g." and "i.e." should always be followed by a comma.
609
610   Em-dashes
611       The  way  to  write  an em-dash—the glyph that appears at either end of
612       this subphrase—in *roff is with the macro "\(em".  (On an ASCII  termi‐
613       nal,  an  em-dash  typically renders as two hyphens, but in other typo‐
614       graphical contexts it renders as a long  dash.)   Em-dashes  should  be
615       written without surrounding spaces.
616
617   Hyphenation of attributive compounds
618       Compound  terms  should be hyphenated when used attributively (i.e., to
619       qualify a following noun). Some examples:
620
621           32-bit value
622           command-line argument
623           floating-point number
624           run-time check
625           user-space function
626           wide-character string
627
628   Hyphenation with multi, non, pre, re, sub, and so on
629       The general tendency in modern English is not to hyphenate  after  pre‐
630       fixes  such  as  "multi", "non", "pre", "re", "sub", and so on.  Manual
631       pages should generally follow this rule when these prefixes are used in
632       natural English constructions with simple suffixes.  The following list
633       gives some examples of the preferred forms:
634
635           interprocess
636           multithreaded
637           multiprocess
638           nonblocking
639           nondefault
640           nonempty
641           noninteractive
642           nonnegative
643           nonportable
644           nonzero
645           preallocated
646           precreate
647           prerecorded
648           reestablished
649           reinitialize
650           rearm
651           reread
652           subcomponent
653           subdirectory
654           subsystem
655
656       Hyphens should be retained when the prefixes are  used  in  nonstandard
657       English  words,  with  trademarks,  proper nouns, acronyms, or compound
658       terms.  Some examples:
659
660           non-ASCII
661           non-English
662           non-NULL
663           non-real-time
664
665       Finally, note that "re-create" and "recreate" are two different  verbs,
666       and the former is probably what you want.
667
668   Real minus character
669       Where a real minus character is required (e.g., for numbers such as -1,
670       for man page cross references such as utf-8(7), or when writing options
671       that  have a leading dash, such as in ls -l), use the following form in
672       the man page source:
673
674           \-
675
676       This guideline applies also to code examples.
677
678   Character constants
679       To produce single quotes that render well in both ASCII and UTF-8,  use
680       the following form for character constants in the man page source:
681
682           \(aqC\(aq
683
684       where  C is the quoted character.  This guideline applies also to char‐
685       acter constants used in code examples.
686
687   Example programs and shell sessions
688       Manual pages may include example programs demonstrating how  to  use  a
689       system call or library function.  However, note the following:
690
691       *  Example programs should be written in C.
692
693       *  An  example  program is necessary and useful only if it demonstrates
694          something beyond what can easily be provided in a  textual  descrip‐
695          tion  of  the interface.  An example program that does nothing other
696          than call an interface usually serves little purpose.
697
698       *  Example programs should be fairly short (preferably  less  than  100
699          lines; ideally less than 50 lines).
700
701       *  Example  programs  should  do  error checking after system calls and
702          library function calls.
703
704       *  Example programs should be complete, and  compile  without  warnings
705          when compiled with cc -Wall.
706
707       *  Where possible and appropriate, example programs should allow exper‐
708          imentation, by varying their behavior based on inputs (ideally  from
709          command-line arguments, or alternatively, via input read by the pro‐
710          gram).
711
712       *  Example programs should be  laid  out  according  to  Kernighan  and
713          Ritchie  style, with 4-space indents.  (Avoid the use of TAB charac‐
714          ters in source code!)  The following command can be used  to  format
715          your source code to something close to the preferred style:
716
717              indent -npro -kr -i4 -ts4 -sob -l72 -ss -nut -psl prog.c
718
719       *  For  consistency, all example programs should terminate using either
720          of:
721
722               exit(EXIT_SUCCESS);
723               exit(EXIT_FAILURE);
724
725          Avoid using the following forms to terminate a program:
726
727              exit(0);
728              exit(1);
729              return n;
730
731       *  If there is extensive explanatory text  before  the  program  source
732          code,  mark  off  the  source code with a subsection heading Program
733          source, as in:
734
735              .SS Program source
736
737          Always do this if the explanatory text includes a shell session log.
738
739       If you include a shell session log demonstrating the use of  a  program
740       or other system feature:
741
742       *  Place the session log above the source code listing
743
744       *  Indent the session log by four spaces.
745
746       *  Boldface the user input text, to distinguish it from output produced
747          by the system.
748
749       For some examples of  what  example  programs  should  look  like,  see
750       wait(2) and pipe(2).
751

EXAMPLES

753       For canonical examples of how man pages in the man-pages package should
754       look, see pipe(2) and fcntl(2).
755

SEE ALSO

757       man(1), man2html(1),  attributes(7),  groff(7),  groff_man(7),  man(7),
758       mdoc(7)
759

COLOPHON

761       This  page  is  part of release 5.07 of the Linux man-pages project.  A
762       description of the project, information about reporting bugs,  and  the
763       latest     version     of     this    page,    can    be    found    at
764       https://www.kernel.org/doc/man-pages/.
765
766
767
768Linux                             2020-04-11                      MAN-PAGES(7)
Impressum