home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / gnu / info / standards.info-2 (.txt) < prev    next >
GNU Info File  |  1994-11-17  |  44KB  |  1,198 lines

  1. This is Info file ../standards.info, produced by Makeinfo-1.55 from the
  2. input file ../standards.texi.
  3. START-INFO-DIR-ENTRY
  4. * Standards: (standards).        GNU coding standards.
  5. END-INFO-DIR-ENTRY
  6.    GNU Coding Standards Copyright (C) 1992, 1993, 1994 Free Software
  7. Foundation, Inc.
  8.    Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.    Permission is granted to copy and distribute modified versions of
  12. this manual under the conditions for verbatim copying, provided that
  13. the entire resulting derived work is distributed under the terms of a
  14. permission notice identical to this one.
  15.    Permission is granted to copy and distribute translations of this
  16. manual into another language, under the above conditions for modified
  17. versions, except that this permission notice may be stated in a
  18. translation approved by the Free Software Foundation.
  19. File: standards.info,  Node: Syntactic Conventions,  Next: Names,  Prev: Comments,  Up: Top
  20. Clean Use of C Constructs
  21. *************************
  22.    Please explicitly declare all arguments to functions.  Don't omit
  23. them just because they are `int's.
  24.    Declarations of external functions and functions to appear later in
  25. the source file should all go in one place near the beginning of the
  26. file (somewhere before the first function definition in the file), or
  27. else should go in a header file.  Don't put `extern' declarations inside
  28. functions.
  29.    It used to be common practice to use the same local variables (with
  30. names like `tem') over and over for different values within one
  31. function.  Instead of doing this, it is better declare a separate local
  32. variable for each distinct purpose, and give it a name which is
  33. meaningful.  This not only makes programs easier to understand, it also
  34. facilitates optimization by good compilers.  You can also move the
  35. declaration of each local variable into the smallest scope that includes
  36. all its uses.  This makes the program even cleaner.
  37.    Don't use local variables or parameters that shadow global
  38. identifiers.
  39.    Don't declare multiple variables in one declaration that spans lines.
  40. Start a new declaration on each line, instead.  For example, instead of
  41. this:
  42.      int    foo,
  43.             bar;
  44. write either this:
  45.      int foo, bar;
  46. or this:
  47.      int foo;
  48.      int bar;
  49. (If they are global variables, each should have a comment preceding it
  50. anyway.)
  51.    When you have an `if'-`else' statement nested in another `if'
  52. statement, always put braces around the `if'-`else'.  Thus, never write
  53. like this:
  54.      if (foo)
  55.        if (bar)
  56.          win ();
  57.        else
  58.          lose ();
  59. always like this:
  60.      if (foo)
  61.        {
  62.          if (bar)
  63.            win ();
  64.          else
  65.            lose ();
  66.        }
  67.    If you have an `if' statement nested inside of an `else' statement,
  68. either write `else if' on one line, like this,
  69.      if (foo)
  70.        ...
  71.      else if (bar)
  72.        ...
  73. with its `then'-part indented like the preceding `then'-part, or write
  74. the nested `if' within braces like this:
  75.      if (foo)
  76.        ...
  77.      else
  78.        {
  79.          if (bar)
  80.            ...
  81.        }
  82.    Don't declare both a structure tag and variables or typedefs in the
  83. same declaration.  Instead, declare the structure tag separately and
  84. then use it to declare the variables or typedefs.
  85.    Try to avoid assignments inside `if'-conditions.  For example, don't
  86. write this:
  87.      if ((foo = (char *) malloc (sizeof *foo)) == 0)
  88.        fatal ("virtual memory exhausted");
  89. instead, write this:
  90.      foo = (char *) malloc (sizeof *foo);
  91.      if (foo == 0)
  92.        fatal ("virtual memory exhausted");
  93.    Don't make the program ugly to placate `lint'.  Please don't insert
  94. any casts to `void'.  Zero without a cast is perfectly fine as a null
  95. pointer constant.
  96. File: standards.info,  Node: Names,  Next: Using Extensions,  Prev: Syntactic Conventions,  Up: Top
  97. Naming Variables and Functions
  98. ******************************
  99.    Please use underscores to separate words in a name, so that the Emacs
  100. word commands can be useful within them.  Stick to lower case; reserve
  101. upper case for macros and `enum' constants, and for name-prefixes that
  102. follow a uniform convention.
  103.    For example, you should use names like `ignore_space_change_flag';
  104. don't use names like `iCantReadThis'.
  105.    Variables that indicate whether command-line options have been
  106. specified should be named after the meaning of the option, not after
  107. the option-letter.  A comment should state both the exact meaning of
  108. the option and its letter.  For example,
  109.      /* Ignore changes in horizontal whitespace (-b).  */
  110.      int ignore_space_change_flag;
  111.    When you want to define names with constant integer values, use
  112. `enum' rather than `#define'.  GDB knows about enumeration constants.
  113.    Use file names of 14 characters or less, to avoid creating gratuitous
  114. problems on System V.  You can use the program `doschk' to test for
  115. this.  `doschk' also tests for potential name conflicts if the files
  116. were loaded onto an MS-DOS file system--something you may or may not
  117. care about.
  118. File: standards.info,  Node: Using Extensions,  Next: System Functions,  Prev: Names,  Up: Top
  119. Using Non-standard Features
  120. ***************************
  121.    Many GNU facilities that already exist support a number of convenient
  122. extensions over the comparable Unix facilities.  Whether to use these
  123. extensions in implementing your program is a difficult question.
  124.    On the one hand, using the extensions can make a cleaner program.
  125. On the other hand, people will not be able to build the program unless
  126. the other GNU tools are available.  This might cause the program to
  127. work on fewer kinds of machines.
  128.    With some extensions, it might be easy to provide both alternatives.
  129. For example, you can define functions with a "keyword" `INLINE' and
  130. define that as a macro to expand into either `inline' or nothing,
  131. depending on the compiler.
  132.    In general, perhaps it is best not to use the extensions if you can
  133. straightforwardly do without them, but to use the extensions if they
  134. are a big improvement.
  135.    An exception to this rule are the large, established programs (such
  136. as Emacs) which run on a great variety of systems.  Such programs would
  137. be broken by use of GNU extensions.
  138.    Another exception is for programs that are used as part of
  139. compilation: anything that must be compiled with other compilers in
  140. order to bootstrap the GNU compilation facilities.  If these require
  141. the GNU compiler, then no one can compile them without having them
  142. installed already.  That would be no good.
  143.    Since most computer systems do not yet implement ANSI C, using the
  144. ANSI C features is effectively using a GNU extension, so the same
  145. considerations apply.  (Except for ANSI features that we discourage,
  146. such as trigraphs--don't ever use them.)
  147. File: standards.info,  Node: System Functions,  Next: Semantics,  Prev: Using Extensions,  Up: Top
  148. Calling System Functions
  149. ************************
  150.    C implementations differ substantially.  ANSI C reduces but does not
  151. eliminate the incompatibilities; meanwhile, many users wish to compile
  152. GNU software with pre-ANSI compilers.  This chapter gives
  153. recommendations for how to use the more or less standard C library
  154. functions to avoid unnecessary loss of portability.
  155.    * Don't use the value of `sprintf'.  It returns the number of
  156.      characters written on some systems, but not on all systems.
  157.    * Don't declare system functions explicitly.
  158.      Almost any declaration for a system function is wrong on some
  159.      system.  To minimize conflicts, leave it to the system header
  160.      files to declare system functions.  If the headers don't declare a
  161.      function, let it remain undeclared.
  162.      While it may seem unclean to use a function without declaring it,
  163.      in practice this works fine for most system library functions on
  164.      the systems where this really happens.  The problem is only
  165.      theoretical.  By contrast, actual declarations have frequently
  166.      caused actual conflicts.
  167.    * If you must declare a system function, don't specify the argument
  168.      types.  Use an old-style declaration, not an ANSI prototype.  The
  169.      more you specify about the function, the more likely a conflict.
  170.    * In particular, don't unconditionally declare `malloc' or `realloc'.
  171.      Most GNU programs use those functions just once, in functions
  172.      conventionally named `xmalloc' and `xrealloc'.  These functions
  173.      call `malloc' and `realloc', respectively, and check the results.
  174.      Because `xmalloc' and `xrealloc' are defined in your program, you
  175.      can declare them in other files without any risk of type conflict.
  176.      On most systems, `int' is the same length as a pointer; thus, the
  177.      calls to `malloc' and `realloc' work fine.  For the few
  178.      exceptional systems (mostly 64-bit machines), you can use
  179.      *conditionalized* declarations of `malloc' and `realloc'--or put
  180.      these declarations in configuration files specific to those
  181.      systems.
  182.    * The string functions require special treatment.  Some Unix systems
  183.      have a header file `string.h'; other have `strings.h'.  Neither
  184.      file name is portable.  There are two things you can do: use
  185.      Autoconf to figure out which file to include, or don't include
  186.      either file.
  187.    * If you don't include either strings file, you can't get
  188.      declarations for the string functions from the header file in the
  189.      usual way.
  190.      That causes less of a problem than you might think.  The newer ANSI
  191.      string functions are off-limits anyway because many systems still
  192.      don't support them.  The string functions you can use are these:
  193.           strcpy   strncpy   strcat   strncat
  194.           strlen   strcmp   strncmp
  195.           strchr   strrchr
  196.      The copy and concatenate functions work fine without a declaration
  197.      as long as you don't use their values.  Using their values without
  198.      a declaration fails on systems where the width of a pointer
  199.      differs from the width of `int', and perhaps in other cases.  It
  200.      is trivial to avoid using their values, so do that.
  201.      The compare functions and `strlen' work fine without a declaration
  202.      on most systems, possibly all the ones that GNU software runs on.
  203.      You may find it necessary to declare them *conditionally* on a few
  204.      systems.
  205.      The search functions must be declared to return `char *'.  Luckily,
  206.      there is no variation in the data type they return.  But there is
  207.      variation in their names.  Some systems give these functions the
  208.      names `index' and `rindex'; other systems use the names `strchr'
  209.      and `strrchr'.  Some systems support both pairs of names, but
  210.      neither pair works on all systems.
  211.      You should pick a single pair of names and use it throughout your
  212.      program.  (Nowadays, it is better to choose `strchr' and
  213.      `strrchr'.)  Declare both of those names as functions returning
  214.      `char *'.  On systems which don't support those names, define them
  215.      as macros in terms of the other pair.  For example, here is what
  216.      to put at the beginning of your file (or in a header) if you want
  217.      to use the names `strchr' and `strrchr' throughout:
  218.           #ifndef HAVE_STRCHR
  219.           #define strchr index
  220.           #endif
  221.           #ifndef HAVE_STRRCHR
  222.           #define strrchr rindex
  223.           #endif
  224.           
  225.           char *strchr ();
  226.           char *strrchr ();
  227.    Here we assume that `HAVE_STRCHR' and `HAVE_STRRCHR' are macros
  228. defined in systems where the corresponding functions exist.  One way to
  229. get them properly defined is to use Autoconf.
  230. File: standards.info,  Node: Semantics,  Next: Errors,  Prev: System Functions,  Up: Top
  231. Program Behavior for All Programs
  232. *********************************
  233.    Avoid arbitrary limits on the length or number of *any* data
  234. structure, including filenames, lines, files, and symbols, by allocating
  235. all data structures dynamically.  In most Unix utilities, "long lines
  236. are silently truncated".  This is not acceptable in a GNU utility.
  237.    Utilities reading files should not drop NUL characters, or any other
  238. nonprinting characters *including those with codes above 0177*.  The
  239. only sensible exceptions would be utilities specifically intended for
  240. interface to certain types of printers that can't handle those
  241. characters.
  242.    Check every system call for an error return, unless you know you
  243. wish to ignore errors.  Include the system error text (from `perror' or
  244. equivalent) in *every* error message resulting from a failing system
  245. call, as well as the name of the file if any and the name of the
  246. utility.  Just "cannot open foo.c" or "stat failed" is not sufficient.
  247.    Check every call to `malloc' or `realloc' to see if it returned
  248. zero.  Check `realloc' even if you are making the block smaller; in a
  249. system that rounds block sizes to a power of 2, `realloc' may get a
  250. different block if you ask for less space.
  251.    In Unix, `realloc' can destroy the storage block if it returns zero.
  252. GNU `realloc' does not have this bug: if it fails, the original block
  253. is unchanged.  Feel free to assume the bug is fixed.  If you wish to
  254. run your program on Unix, and wish to avoid lossage in this case, you
  255. can use the GNU `malloc'.
  256.    You must expect `free' to alter the contents of the block that was
  257. freed.  Anything you want to fetch from the block, you must fetch before
  258. calling `free'.
  259.    If `malloc' fails in a noninteractive program, make that a fatal
  260. error.  In an interactive program (one that reads commands from the
  261. user), it is better to abort the command and return to the command
  262. reader loop.  This allows the user to kill other processes to free up
  263. virtual memory, and then try the command again.
  264.    Use `getopt_long' to decode arguments, unless the argument syntax
  265. makes this unreasonable.
  266.    When static storage is to be written in during program execution, use
  267. explicit C code to initialize it.  Reserve C initialized declarations
  268. for data that will not be changed.
  269.    Try to avoid low-level interfaces to obscure Unix data structures
  270. (such as file directories, utmp, or the layout of kernel memory), since
  271. these are less likely to work compatibly.  If you need to find all the
  272. files in a directory, use `readdir' or some other high-level interface.
  273. These will be supported compatibly by GNU.
  274.    By default, the GNU system will provide the signal handling
  275. functions of BSD and of POSIX.  So GNU software should be written to use
  276. these.
  277.    In error checks that detect "impossible" conditions, just abort.
  278. There is usually no point in printing any message.  These checks
  279. indicate the existence of bugs.  Whoever wants to fix the bugs will have
  280. to read the source code and run a debugger.  So explain the problem with
  281. comments in the source.  The relevant data will be in variables, which
  282. are easy to examine with the debugger, so there is no point moving them
  283. elsewhere.
  284. File: standards.info,  Node: Errors,  Next: Libraries,  Prev: Semantics,  Up: Top
  285. Formatting Error Messages
  286. *************************
  287.    Error messages from compilers should look like this:
  288.      SOURCE-FILE-NAME:LINENO: MESSAGE
  289.    Error messages from other noninteractive programs should look like
  290. this:
  291.      PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE
  292. when there is an appropriate source file, or like this:
  293.      PROGRAM: MESSAGE
  294. when there is no relevant source file.
  295.    In an interactive program (one that is reading commands from a
  296. terminal), it is better not to include the program name in an error
  297. message.  The place to indicate which program is running is in the
  298. prompt or with the screen layout.  (When the same program runs with
  299. input from a source other than a terminal, it is not interactive and
  300. would do best to print error messages using the noninteractive style.)
  301.    The string MESSAGE should not begin with a capital letter when it
  302. follows a program name and/or filename.  Also, it should not end with a
  303. period.
  304.    Error messages from interactive programs, and other messages such as
  305. usage messages, should start with a capital letter.  But they should not
  306. end with a period.
  307. File: standards.info,  Node: Libraries,  Next: Portability,  Prev: Errors,  Up: Top
  308. Library Behavior
  309. ****************
  310.    Try to make library functions reentrant.  If they need to do dynamic
  311. storage allocation, at least try to avoid any nonreentrancy aside from
  312. that of `malloc' itself.
  313.    Here are certain name conventions for libraries, to avoid name
  314. conflicts.
  315.    Choose a name prefix for the library, more than two characters long.
  316. All external function and variable names should start with this prefix.
  317. In addition, there should only be one of these in any given library
  318. member.  This usually means putting each one in a separate source file.
  319.    An exception can be made when two external symbols are always used
  320. together, so that no reasonable program could use one without the
  321. other; then they can both go in the same file.
  322.    External symbols that are not documented entry points for the user
  323. should have names beginning with `_'.  They should also contain the
  324. chosen name prefix for the library, to prevent collisions with other
  325. libraries.  These can go in the same files with user entry points if
  326. you like.
  327.    Static functions and variables can be used as you like and need not
  328. fit any naming convention.
  329. File: standards.info,  Node: Portability,  Next: User Interfaces,  Prev: Libraries,  Up: Top
  330. Portability As It Applies to GNU
  331. ********************************
  332.    Much of what is called "portability" in the Unix world refers to
  333. porting to different Unix versions.  This is a secondary consideration
  334. for GNU software, because its primary purpose is to run on top of one
  335. and only one kernel, the GNU kernel, compiled with one and only one C
  336. compiler, the GNU C compiler.  The amount and kinds of variation among
  337. GNU systems on different cpu's will be like the variation among Berkeley
  338. 4.3 systems on different cpu's.
  339.    All users today run GNU software on non-GNU systems.  So supporting a
  340. variety of non-GNU systems is desirable; simply not paramount.  The
  341. easiest way to achieve portability to a reasonable range of systems is
  342. to use Autoconf.  It's unlikely that your program needs to know more
  343. information about the host machine than Autoconf can provide, simply
  344. because most of the programs that need such knowledge have already been
  345. written.
  346.    It is difficult to be sure exactly what facilities the GNU kernel
  347. will provide, since it isn't finished yet.  Therefore, assume you can
  348. use anything in 4.3; just avoid using the format of semi-internal data
  349. bases (e.g., directories) when there is a higher-level alternative
  350. (`readdir').
  351.    You can freely assume any reasonably standard facilities in the C
  352. language, libraries or kernel, because we will find it necessary to
  353. support these facilities in the full GNU system, whether or not we have
  354. already done so.  The fact that there may exist kernels or C compilers
  355. that lack these facilities is irrelevant as long as the GNU kernel and
  356. C compiler support them.
  357.    It remains necessary to worry about differences among cpu types, such
  358. as the difference in byte ordering and alignment restrictions.  It's
  359. unlikely that 16-bit machines will ever be supported by GNU, so there
  360. is no point in spending any time to consider the possibility that an
  361. int will be less than 32 bits.
  362.    You can assume that all pointers have the same format, regardless of
  363. the type they point to, and that this is really an integer.  There are
  364. some weird machines where this isn't true, but they aren't important;
  365. don't waste time catering to them.  Besides, eventually we will put
  366. function prototypes into all GNU programs, and that will probably make
  367. your program work even on weird machines.
  368.    Since some important machines (including the 68000) are big-endian,
  369. it is important not to assume that the address of an `int' object is
  370. also the address of its least-significant byte.  Thus, don't make the
  371. following mistake:
  372.      int c;
  373.      ...
  374.      while ((c = getchar()) != EOF)
  375.              write(file_descriptor, &c, 1);
  376.    You can assume that it is reasonable to use a meg of memory.  Don't
  377. strain to reduce memory usage unless it can get to that level.  If your
  378. program creates complicated data structures, just make them in core and
  379. give a fatal error if malloc returns zero.
  380.    If a program works by lines and could be applied to arbitrary
  381. user-supplied input files, it should keep only a line in memory, because
  382. this is not very hard and users will want to be able to operate on input
  383. files that are bigger than will fit in core all at once.
  384. File: standards.info,  Node: User Interfaces,  Next: Documentation,  Prev: Portability,  Up: Top
  385. Standards for Command Line Interfaces
  386. *************************************
  387.    Please don't make the behavior of a utility depend on the name used
  388. to invoke it.  It is useful sometimes to make a link to a utility with
  389. a different name, and that should not change what it does.
  390.    Instead, use a run time option or a compilation switch or both to
  391. select among the alternate behaviors.
  392.    Likewise, please don't make the behavior of the program depend on the
  393. type of output device it is used with.  Device independence is an
  394. important principle of the system's design; do not compromise it merely
  395. to save someone from typing an option now and then.
  396.    If you think one behavior is most useful when the output is to a
  397. terminal, and another is most useful when the output is a file or a
  398. pipe, then it is usually best to make the default behavior the one that
  399. is useful with output to a terminal, and have an option for the other
  400. behavior.
  401.    Compatibility requires certain programs to depend on the type of
  402. output device.  It would be disastrous if `ls' or `sh' did not do so in
  403. the way all users expect.  In some of these cases, we supplement the
  404. program with a preferred alternate version that does not depend on the
  405. output device type.  For example, we provide a `dir' program much like
  406. `ls' except that its default output format is always multi-column
  407. format.
  408.    It is a good idea to follow the POSIX guidelines for the
  409. command-line options of a program.  The easiest way to do this is to use
  410. `getopt' to parse them.  Note that the GNU version of `getopt' will
  411. normally permit options anywhere among the arguments unless the special
  412. argument `--' is used.  This is not what POSIX specifies; it is a GNU
  413. extension.
  414.    Please define long-named options that are equivalent to the
  415. single-letter Unix-style options.  We hope to make GNU more user
  416. friendly this way.  This is easy to do with the GNU function
  417. `getopt_long'.
  418.    One of the advantages of long-named options is that they can be
  419. consistent from program to program.  For example, users should be able
  420. to expect the "verbose" option of any GNU program which has one, to be
  421. spelled precisely `--verbose'.  To achieve this uniformity, look at the
  422. table of common long-option names when you choose the option names for
  423. your program.  The table appears below.
  424.    If you use names not already in the table, please send
  425. `gnu@prep.ai.mit.edu' a list of them, with their meanings, so we can
  426. update the table.
  427.    It is usually a good idea for file names given as ordinary arguments
  428. to be input files only; any output files would be specified using
  429. options (preferably `-o').  Even if you allow an output file name as an
  430. ordinary argument for compatibility, try to provide a suitable option
  431. as well.  This will lead to more consistency among GNU utilities, so
  432. that there are fewer idiosyncracies for users to remember.
  433.    Programs should support an option `--version' which prints the
  434. program's version number on standard output and exits successfully, and
  435. an option `--help' which prints option usage information on standard
  436. output and exits successfully.  These options should inhibit the normal
  437. function of the command; they should do nothing except print the
  438. requested information.
  439. `auto-check'
  440.      `-a' in `recode'.
  441. `auto-reference'
  442.      `-A' in `ptx'.
  443. `after-date'
  444.      `-N' in `tar'.
  445. `all'
  446.      `-a' in `du', `ls', `nm', `stty', `uname', and `unexpand'.
  447. `all-text'
  448.      `-a' in `diff'.
  449. `almost-all'
  450.      `-A' in `ls'.
  451. `append'
  452.      `-a' in `etags', `tee', `time'; `-r' in `tar'.
  453. `archive'
  454.      `-a' in `cp'.
  455. `archive-name'
  456.      `-n' in `shar'.
  457. `arglength'
  458.      `-l' in `m4'.
  459. `ascii'
  460.      `-a' in `diff'.
  461. `assume-new'
  462.      `-W' in Make.
  463. `assume-old'
  464.      `-o' in Make.
  465. `backward-search'
  466.      `-B' in etags.
  467. `basename'
  468.      `-f' in `shar'.
  469. `batch'
  470.      Used in GDB.
  471. `baud'
  472.      Used in GDB.
  473. `before'
  474.      `-b' in `tac'.
  475. `binary'
  476.      `-b' in `cpio' and `diff'.
  477. `bits-per-code'
  478.      `-b' in `shar'.
  479. `block-size'
  480.      Used in `cpio' and `tar'.
  481. `blocks'
  482.      `-b' in `head' and `tail'.
  483. `break-file'
  484.      `-b' in `ptx'.
  485. `brief'
  486.      Used in various programs to make output shorter.
  487. `bytes'
  488.      `-c' in `head', `split', and `tail'.
  489. `c++'
  490.      `-C' in `etags'.
  491. `catenate'
  492.      `-A' in `tar'.
  493.      Used in various programs to specify the directory to use.
  494. `changes'
  495.      `-c' in `chgrp' and `chown'.
  496. `classify'
  497.      `-F' in `ls'.
  498. `colons'
  499.      `-c' in `recode'.
  500. `command'
  501.      `-c' in `su'; `-x' in GDB.
  502. `compare'
  503.      `-d' in `tar'.
  504. `compress'
  505.      `-Z' in `tar' and `shar'.
  506. `concatenate'
  507.      `-A' in `tar'.
  508. `confirmation'
  509.      `-w' in `tar'.
  510. `context'
  511.      Used in `diff'.
  512. `copyright'
  513.      `-C' in `ptx' and `recode'.
  514. `core'
  515.      Used in GDB.
  516. `count'
  517.      `-q' in `who'.
  518. `count-links'
  519.      `-l' in `du'.
  520. `create'
  521.      Used in `tar' and `cpio'.
  522. `cut-mark'
  523.      `-c' in `shar'.
  524. `cxref'
  525.      `-x' in `etags'.
  526. `date'
  527.      `-d' in `touch'.
  528. `debug'
  529.      `-d' in Make and `m4'; `-t' in Bison.
  530. `define'
  531.      `-D' in `m4'.
  532. `defines'
  533.      `-d' in Bison and `etags'.
  534. `delete'
  535.      `-D' in `tar'.
  536. `dereference'
  537.      `-L' in `chgrp', `chown', `cpio', `du', `ls', and `tar'.
  538. `dereference-args'
  539.      `-D' in `du'.
  540. `diacritics'
  541.      `-d' in `recode'.
  542. `dictionary-order'
  543.      `-d' in `look'.
  544. `diff'
  545.      `-d' in `tar'.
  546. `digits'
  547.      `-n' in `csplit'.
  548. `directory'
  549.      Specify the directory to use, in various programs.  In `ls', it
  550.      means to show directories themselves rather than their contents.
  551.      In `rm' and `ln', it means to not treat links to directories
  552.      specially.
  553. `discard-all'
  554.      `-x' in `strip'.
  555. `discard-locals'
  556.      `-X' in `strip'.
  557. `diversions'
  558.      `-N' in `m4'.
  559. `dry-run'
  560.      `-n' in Make.
  561.      `-e' in `diff'.
  562. `elide-empty-files'
  563.      `-z' in `csplit'.
  564. `entire-new-file'
  565.      `-N' in `diff'.
  566. `environment-overrides'
  567.      `-e' in Make.
  568. `eof'
  569.      `-e' in `xargs'.
  570. `epoch'
  571.      Used in GDB.
  572. `error-limit'
  573.      Used in Makeinfo.
  574. `error-output'
  575.      `-o' in `m4'.
  576. `escape'
  577.      `-b' in `ls'.
  578. `exclude-from'
  579.      `-X' in `tar'.
  580. `exec'
  581.      Used in GDB.
  582. `exit'
  583.      `-x' in `xargs'.
  584. `exit-0'
  585.      `-e' in `unshar'.
  586. `expand-tabs'
  587.      `-t' in `diff'.
  588. `expression'
  589.      `-e' in `sed'.
  590. `extern-only'
  591.      `-g' in `nm'.
  592. `extract'
  593.      `-i' in `cpio'; `-x' in `tar'.
  594. `faces'
  595.      `-f' in `finger'.
  596. `fast'
  597.      `-f' in `su'.
  598. `fatal-warnings'
  599.      `-E' in `m4'.
  600. `file'
  601.      `-f' in `info', Make, `mt', and `tar'; `-n' in `sed'; `-r' in
  602.      `touch'.
  603. `file-prefix'
  604.      `-b' in Bison.
  605. `file-type'
  606.      `-F' in `ls'.
  607. `files-from'
  608.      `-T' in `tar'.
  609. `fill-column'
  610.      Used in Makeinfo.
  611. `flag-truncation'
  612.      `-F' in `ptx'.
  613. `fixed-output-files'
  614.      `-y' in Bison.
  615. `follow'
  616.      `-f' in `tail'.
  617. `footnote-style'
  618.      Used in Makeinfo.
  619. `force'
  620.      `-f' in `cp', `ln', `mv', and `rm'.
  621. `force-prefix'
  622.      `-F' in `shar'.
  623. `format'
  624.      Used in `ls', `time', and `ptx'.
  625. `forward-search'
  626.      `-F' in `etags'.
  627. `fullname'
  628.      Used in GDB.
  629. `gap-size'
  630.      `-g' in `ptx'.
  631. `get'
  632.      `-x' in `tar'.
  633. `graphic'
  634.      `-i' in `ul'.
  635. `graphics'
  636.      `-g' in `recode'.
  637. `group'
  638.      `-g' in `install'.
  639. `gzip'
  640.      `-z' in `tar' and `shar'.
  641. `hashsize'
  642.      `-H' in `m4'.
  643. `header'
  644.      `-h' in `objdump' and `recode'
  645. `heading'
  646.      `-H' in `who'.
  647. `help'
  648.      Used to ask for brief usage information.
  649. `here-delimiter'
  650.      `-d' in `shar'.
  651. `hide-control-chars'
  652.      `-q' in `ls'.
  653. `idle'
  654.      `-u' in `who'.
  655. `ifdef'
  656.      `-D' in `diff'.
  657. `ignore'
  658.      `-I' in `ls'; `-x' in `recode'.
  659. `ignore-all-space'
  660.      `-w' in `diff'.
  661. `ignore-backups'
  662.      `-B' in `ls'.
  663. `ignore-blank-lines'
  664.      `-B' in `diff'.
  665. `ignore-case'
  666.      `-f' in `look' and `ptx'; `-i' in `diff'.
  667. `ignore-errors'
  668.      `-i' in Make.
  669. `ignore-file'
  670.      `-i' in `ptx'.
  671. `ignore-indentation'
  672.      `-S' in `etags'.
  673. `ignore-init-file'
  674.      `-f' in Oleo.
  675. `ignore-interrupts'
  676.      `-i' in `tee'.
  677. `ignore-matching-lines'
  678.      `-I' in `diff'.
  679. `ignore-space-change'
  680.      `-b' in `diff'.
  681. `ignore-zeros'
  682.      `-i' in `tar'.
  683. `include'
  684.      `-i' in `etags'; `-I' in `m4'.
  685. `include-dir'
  686.      `-I' in Make.
  687. `incremental'
  688.      `-G' in `tar'.
  689. `info'
  690.      `-i', `-l', and `-m' in Finger.
  691. `initial'
  692.      `-i' in `expand'.
  693. `initial-tab'
  694.      `-T' in `diff'.
  695. `inode'
  696.      `-i' in `ls'.
  697. `interactive'
  698.      `-i' in `cp', `ln', `mv', `rm'; `-e' in `m4'; `-p' in `xargs';
  699.      `-w' in `tar'.
  700. `intermix-type'
  701.      `-p' in `shar'.
  702. `jobs'
  703.      `-j' in Make.
  704. `just-print'
  705.      `-n' in Make.
  706. `keep-going'
  707.      `-k' in Make.
  708. `keep-files'
  709.      `-k' in `csplit'.
  710. `kilobytes'
  711.      `-k' in `du' and `ls'.
  712. `level-for-gzip'
  713.      `-g' in `shar'.
  714. `line-bytes'
  715.      `-C' in `split'.
  716. `lines'
  717.      Used in `split', `head', and `tail'.
  718. `link'
  719.      `-l' in `cpio'.
  720. `list'
  721.      `-t' in `cpio'; `-l' in `recode'.
  722. `list'
  723.      `-t' in `tar'.
  724. `literal'
  725.      `-N' in `ls'.
  726. `load-average'
  727.      `-l' in Make.
  728. `login'
  729.      Used in `su'.
  730. `machine'
  731.      No listing of which programs already use this; someone should
  732.      check to see if any actually do and tell `gnu@prep.ai.mit.edu'.
  733. `macro-name'
  734.      `-M' in `ptx'.
  735. `mail'
  736.      `-m' in `hello' and `uname'.
  737. `make-directories'
  738.      `-d' in `cpio'.
  739. `makefile'
  740.      `-f' in Make.
  741. `mapped'
  742.      Used in GDB.
  743. `max-args'
  744.      `-n' in `xargs'.
  745. `max-chars'
  746.      `-n' in `xargs'.
  747. `max-lines'
  748.      `-l' in `xargs'.
  749. `max-load'
  750.      `-l' in Make.
  751. `max-procs'
  752.      `-P' in `xargs'.
  753. `mesg'
  754.      `-T' in `who'.
  755. `message'
  756.      `-T' in `who'.
  757. `minimal'
  758.      `-d' in `diff'.
  759. `mixed-uuencode'
  760.      `-M' in `shar'.
  761. `mode'
  762.      `-m' in `install', `mkdir', and `mkfifo'.
  763. `modification-time'
  764.      `-m' in `tar'.
  765. `multi-volume'
  766.      `-M' in `tar'.
  767. `name-prefix'
  768.      `-a' in Bison.
  769. `nesting-limit'
  770.      `-L' in `m4'.
  771. `net-headers'
  772.      `-a' in `shar'.
  773. `new-file'
  774.      `-W' in Make.
  775. `no-builtin-rules'
  776.      `-r' in Make.
  777. `no-character-count'
  778.      `-w' in `shar'.
  779. `no-check-existing'
  780.      `-x' in `shar'.
  781. `no-create'
  782.      `-c' in `touch'.
  783. `no-defines'
  784.      `-D' in `etags'.
  785. `no-dereference'
  786.      `-d' in `cp'.
  787. `no-keep-going'
  788.      `-S' in Make.
  789. `no-lines'
  790.      `-l' in Bison.
  791. `no-piping'
  792.      `-P' in `shar'.
  793. `no-prof'
  794.      `-e' in `gprof'.
  795. `no-sort'
  796.      `-p' in `nm'.
  797. `no-split'
  798.      Used in Makeinfo.
  799. `no-static'
  800.      `-a' in `gprof'.
  801. `no-time'
  802.      `-E' in `gprof'.
  803. `no-timestamp'
  804.      `-m' in `shar'.
  805. `no-validate'
  806.      Used in Makeinfo.
  807. `no-verbose'
  808.      `-v' in `shar'.
  809. `no-warn'
  810.      Used in various programs to inhibit warnings.
  811. `node'
  812.      `-n' in `info'.
  813. `nodename'
  814.      `-n' in `uname'.
  815. `nonmatching'
  816.      `-f' in `cpio'.
  817. `nstuff'
  818.      `-n' in `objdump'.
  819. `null'
  820.      `-0' in `xargs'.
  821. `number'
  822.      `-n' in `cat'.
  823. `number-nonblank'
  824.      `-b' in `cat'.
  825. `numeric-sort'
  826.      `-n' in `nm'.
  827. `numeric-uid-gid'
  828.      `-n' in `cpio' and `ls'.
  829.      Used in GDB.
  830. `old-archive'
  831.      `-o' in `tar'.
  832. `old-file'
  833.      `-o' in Make.
  834. `one-file-system'
  835.      `-l' in `tar', `cp', and `du'.
  836. `only-file'
  837.      `-o' in `ptx'.
  838. `only-prof'
  839.      `-f' in `gprof'.
  840. `only-time'
  841.      `-F' in `gprof'.
  842. `output'
  843.      In various programs, specify the output file name.
  844. `output-prefix'
  845.      `-o' in `shar'.
  846. `override'
  847.      `-o' in `rm'.
  848. `overwrite'
  849.      `-c' in `unshar'.
  850. `owner'
  851.      `-o' in `install'.
  852. `paginate'
  853.      `-l' in `diff'.
  854. `paragraph-indent'
  855.      Used in Makeinfo.
  856. `parents'
  857.      `-p' in `mkdir' and `rmdir'.
  858. `pass-all'
  859.      `-p' in `ul'.
  860. `pass-through'
  861.      `-p' in `cpio'.
  862. `port'
  863.      `-P' in `finger'.
  864. `portability'
  865.      `-c' in `cpio' and `tar'.
  866. `prefix-builtins'
  867.      `-P' in `m4'.
  868. `prefix'
  869.      `-f' in `csplit'.
  870. `preserve'
  871.      Used in `tar' and `cp'.
  872. `preserve-environment'
  873.      `-p' in `su'.
  874. `preserve-modification-time'
  875.      `-m' in `cpio'.
  876. `preserve-order'
  877.      `-s' in `tar'.
  878. `preserve-permissions'
  879.      `-p' in `tar'.
  880. `print'
  881.      `-l' in `diff'.
  882. `print-chars'
  883.      `-L' in `cmp'.
  884. `print-data-base'
  885.      `-p' in Make.
  886. `print-directory'
  887.      `-w' in Make.
  888. `print-file-name'
  889.      `-o' in `nm'.
  890. `print-symdefs'
  891.      `-s' in `nm'.
  892. `query-user'
  893.      `-X' in `shar'.
  894. `question'
  895.      `-q' in Make.
  896. `quiet'
  897.      Used in many programs to inhibit the usual output.  *Note:* every
  898.      program accepting `--quiet' should accept `--silent' as a synonym.
  899. `quote-name'
  900.      `-Q' in `ls'.
  901. `rcs'
  902.      `-n' in `diff'.
  903. `read-full-blocks'
  904.      `-B' in `tar'.
  905. `readnow'
  906.      Used in GDB.
  907. `recon'
  908.      `-n' in Make.
  909. `record-number'
  910.      `-R' in `tar'.
  911. `recursive'
  912.      Used in `chgrp', `chown', `cp', `ls', `diff', and `rm'.
  913. `reference-limit'
  914.      Used in Makeinfo.
  915. `references'
  916.      `-r' in `ptx'.
  917. `regex'
  918.      `-r' in `tac'.
  919. `release'
  920.      `-r' in `uname'.
  921. `relocation'
  922.      `-r' in `objdump'.
  923. `rename'
  924.      `-r' in `cpio'.
  925. `replace'
  926.      `-i' in `xargs'.
  927. `report-identical-files'
  928.      `-s' in `diff'.
  929. `reset-access-time'
  930.      `-a' in `cpio'.
  931. `reverse'
  932.      `-r' in `ls' and `nm'.
  933. `reversed-ed'
  934.      `-f' in `diff'.
  935. `right-side-defs'
  936.      `-R' in `ptx'.
  937. `same-order'
  938.      `-s' in `tar'.
  939. `same-permissions'
  940.      `-p' in `tar'.
  941. `save'
  942.      `-g' in `stty'.
  943.      Used in GDB.
  944. `sentence-regexp'
  945.      `-S' in `ptx'.
  946. `separate-dirs'
  947.      `-S' in `du'.
  948. `separator'
  949.      `-s' in `tac'.
  950. `sequence'
  951.      Used by `recode' to chose files or pipes for sequencing passes.
  952. `shell'
  953.      `-s' in `su'.
  954. `show-all'
  955.      `-A' in `cat'.
  956. `show-c-function'
  957.      `-p' in `diff'.
  958. `show-ends'
  959.      `-E' in `cat'.
  960. `show-function-line'
  961.      `-F' in `diff'.
  962. `show-tabs'
  963.      `-T' in `cat'.
  964. `silent'
  965.      Used in many programs to inhibit the usual output.  *Note:* every
  966.      program accepting `--silent' should accept `--quiet' as a synonym.
  967. `size'
  968.      `-s' in `ls'.
  969. `sort'
  970.      Used in `ls'.
  971. `sparse'
  972.      `-S' in `tar'.
  973. `speed-large-files'
  974.      `-H' in `diff'.
  975. `split-at'
  976.      `-E' in `unshar'.
  977. `split-size-limit'
  978.      `-L' in `shar'.
  979. `squeeze-blank'
  980.      `-s' in `cat'.
  981. `starting-file'
  982.      Used in `tar' and `diff' to specify which file within a directory
  983.      to start processing with.
  984. `stdin-file-list'
  985.      `-S' in `shar'.
  986. `stop'
  987.      `-S' in Make.
  988. `strict'
  989.      `-s' in `recode'.
  990. `strip'
  991.      `-s' in `install'.
  992. `strip-all'
  993.      `-s' in `strip'.
  994. `strip-debug'
  995.      `-S' in `strip'.
  996. `submitter'
  997.      `-s' in `shar'.
  998. `suffix'
  999.      `-S' in `cp', `ln', `mv'.
  1000. `suffix-format'
  1001.      `-b' in `csplit'.
  1002. `sum'
  1003.      `-s' in `gprof'.
  1004. `summarize'
  1005.      `-s' in `du'.
  1006. `symbolic'
  1007.      `-s' in `ln'.
  1008. `symbols'
  1009.      Used in GDB and `objdump'.
  1010. `synclines'
  1011.      `-s' in `m4'.
  1012. `sysname'
  1013.      `-s' in `uname'.
  1014. `tabs'
  1015.      `-t' in `expand' and `unexpand'.
  1016. `tabsize'
  1017.      `-T' in `ls'.
  1018. `terminal'
  1019.      `-T' in `tput' and `ul'.
  1020. `text'
  1021.      `-a' in `diff'.
  1022. `text-files'
  1023.      `-T' in `shar'.
  1024. `time'
  1025.      Used in `ls' and `touch'.
  1026. `to-stdout'
  1027.      `-O' in `tar'.
  1028. `total'
  1029.      `-c' in `du'.
  1030. `touch'
  1031.      `-t' in Make, `ranlib', and `recode'.
  1032. `trace'
  1033.      `-t' in `m4'.
  1034. `traditional'
  1035.      `-t' in `hello'; `-G' in `m4' and `ptx'.
  1036. `tty'
  1037.      Used in GDB.
  1038. `typedefs'
  1039.      `-t' in `etags'.
  1040. `typedefs-and-c++'
  1041.      `-T' in `etags'.
  1042. `typeset-mode'
  1043.      `-t' in `ptx'.
  1044. `uncompress'
  1045.      `-z' in `tar'.
  1046. `unconditional'
  1047.      `-u' in `cpio'.
  1048. `undefine'
  1049.      `-U' in `m4'.
  1050. `undefined-only'
  1051.      `-u' in `nm'.
  1052. `update'
  1053.      `-u' in `cp', `etags', `mv', `tar'.
  1054. `uuencode'
  1055.      `-B' in `shar'.
  1056. `vanilla-operation'
  1057.      `-V' in `shar'.
  1058. `verbose'
  1059.      Print more information about progress.  Many programs support this.
  1060. `verify'
  1061.      `-W' in `tar'.
  1062. `version'
  1063.      Print the version number.
  1064. `version-control'
  1065.      `-V' in `cp', `ln', `mv'.
  1066. `vgrind'
  1067.      `-v' in `etags'.
  1068. `volume'
  1069.      `-V' in `tar'.
  1070. `what-if'
  1071.      `-W' in Make.
  1072. `whole-size-limit'
  1073.      `-l' in `shar'.
  1074. `width'
  1075.      `-w' in `ls' and `ptx'.
  1076. `word-regexp'
  1077.      `-W' in `ptx'.
  1078. `writable'
  1079.      `-T' in `who'.
  1080. `zeros'
  1081.      `-z' in `gprof'.
  1082. File: standards.info,  Node: Documentation,  Next: Releases,  Prev: User Interfaces,  Up: Top
  1083. Documenting Programs
  1084. ********************
  1085.    Please use Texinfo for documenting GNU programs.  See the Texinfo
  1086. manual, either the hardcopy or the version in the GNU Emacs Info
  1087. subsystem (`C-h i').  See existing GNU Texinfo files (e.g., those under
  1088. the `man/' directory in the GNU Emacs distribution) for examples.
  1089.    The title page of the manual should state the version of the program
  1090. which the manual applies to.  The Top node of the manual should also
  1091. contain this information.  If the manual is changing more frequently
  1092. than or independent of the program, also state a version number for the
  1093. manual in both of these places.
  1094.    The manual should document all command-line arguments and all
  1095. commands.  It should give examples of their use.  But don't organize
  1096. the manual as a list of features.  Instead, organize it by the concepts
  1097. a user will have before reaching that point in the manual.  Address the
  1098. goals that a user will have in mind, and explain how to accomplish
  1099. them.  Don't use Unix man pages as a model for how to write GNU
  1100. documentation; they are a bad example to follow.
  1101.    The manual should have a node named `PROGRAM Invocation' or
  1102. `Invoking PROGRAM', where PROGRAM stands for the name of the program
  1103. being described, as you would type it in the shell to run the program.
  1104. This node (together with its subnodes, if any) should describe the
  1105. program's command line arguments and how to run it (the sort of
  1106. information people would look in a man page for).  Start with an
  1107. `@example' containing a template for all the options and arguments that
  1108. the program uses.
  1109.    Alternatively, put a menu item in some menu whose item name fits one
  1110. of the above patterns.  This identifies the node which that item points
  1111. to as the node for this purpose, regardless of the node's actual name.
  1112.    There will be automatic features for specifying a program name and
  1113. quickly reading just this part of its manual.
  1114.    If one manual describes several programs, it should have such a node
  1115. for each program described.
  1116.    In addition to its manual, the package should have a file named
  1117. `NEWS' which contains a list of user-visible changes worth mentioning.
  1118. In each new release, add items to the front of the file and identify
  1119. the version they pertain to.  Don't discard old items; leave them in
  1120. the file after the newer items.  This way, a user upgrading from any
  1121. previous version can see what is new.
  1122.    If the `NEWS' file gets very long, move some of the older items into
  1123. a file named `ONEWS' and put a note at the end referring the user to
  1124. that file.
  1125.    Please do not use the term "pathname" that is used in Unix
  1126. documentation; use "file name" (two words) instead.  We use the term
  1127. "path" only for search paths, which are lists of file names.
  1128.    It is ok to supply a man page for the program as well as a Texinfo
  1129. manual if you wish to.  But keep in mind that supporting a man page
  1130. requires continual effort, each time the program is changed.  Any time
  1131. you spend on the man page is time taken away from more useful things you
  1132. could contribute.
  1133.    Thus, even if a user volunteers to donate a man page, you may find
  1134. this gift costly to accept.  Unless you have time on your hands, it may
  1135. be better to refuse the man page unless the same volunteer agrees to
  1136. take full responsibility for maintaining it--so that you can wash your
  1137. hands of it entirely.  If the volunteer ceases to do the job, then
  1138. don't feel obliged to pick it up yourself; it may be better to withdraw
  1139. the man page until another volunteer offers to carry on with it.
  1140.    Alternatively, if you expect the discrepancies to be small enough
  1141. that the man page remains useful, put a prominent note near the
  1142. beginning of the man page explaining that you don't maintain it and
  1143. that the Texinfo manual is more authoritative, and describing how to
  1144. access the Texinfo documentation.
  1145. File: standards.info,  Node: Releases,  Prev: Documentation,  Up: Top
  1146. Making Releases
  1147. ***************
  1148.    Package the distribution of Foo version 69.96 in a gzipped tar file
  1149. named `foo-69.96.tar.gz'.  It should unpack into a subdirectory named
  1150. `foo-69.96'.
  1151.    Building and installing the program should never modify any of the
  1152. files contained in the distribution.  This means that all the files
  1153. that form part of the program in any way must be classified into "source
  1154. files" and "non-source files".  Source files are written by humans and
  1155. never changed automatically; non-source files are produced from source
  1156. files by programs under the control of the Makefile.
  1157.    Naturally, all the source files must be in the distribution.  It is
  1158. okay to include non-source files in the distribution, provided they are
  1159. up-to-date and machine-independent, so that building the distribution
  1160. normally will never modify them.  We commonly include non-source files
  1161. produced by Bison, Lex, TeX, and Makeinfo; this helps avoid unnecessary
  1162. dependencies between our distributions, so that users can install
  1163. whichever packages they want to install.
  1164.    Non-source files that might actually be modified by building and
  1165. installing the program should *never* be included in the distribution.
  1166. So if you do distribute non-source files, always make sure they are up
  1167. to date when you make a new distribution.
  1168.    Make sure that the directory into which the distribution unpacks (as
  1169. well as any subdirectories) are all world-writable (octal mode 777).
  1170. This is so that old versions of `tar' which preserve the ownership and
  1171. permissions of the files from the tar archive will be able to extract
  1172. all the files even if the user is unprivileged.
  1173.    Make sure that all the files in the distribution are world-readable.
  1174.    Make sure that no file name in the distribution is more than 14
  1175. characters long.  Likewise, no file created by building the program
  1176. should have a name longer than 14 characters.  The reason for this is
  1177. that some systems adhere to a foolish interpretation of the POSIX
  1178. standard, and refuse to open a longer name, rather than truncating as
  1179. they did in the past.
  1180.    Don't include any symbolic links in the distribution itself.  If the
  1181. tar file contains symbolic links, then people cannot even unpack it on
  1182. systems that don't support symbolic links.  Also, don't use multiple
  1183. names for one file in different directories, because certain file
  1184. systems cannot handle this and that prevents unpacking the distribution.
  1185.    Try to make sure that all the file names will be unique on MS-DOG.  A
  1186. name on MS-DOG consists of up to 8 characters, optionally followed by a
  1187. period and up to three characters.  MS-DOG will truncate extra
  1188. characters both before and after the period.  Thus, `foobarhacker.c'
  1189. and `foobarhacker.o' are not ambiguous; they are truncated to
  1190. `foobarha.c' and `foobarha.o', which are distinct.
  1191.    Include in your distribution a copy of the `texinfo.tex' you used to
  1192. test print any `*.texinfo' files.
  1193.    Likewise, if your program uses small GNU software packages like
  1194. regex, getopt, obstack, or termcap, include them in the distribution
  1195. file.  Leaving them out would make the distribution file a little
  1196. smaller at the expense of possible inconvenience to a user who doesn't
  1197. know what other files to get.
  1198.