home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / etc / standards.info-2 < prev    next >
Encoding:
GNU Info File  |  1995-03-04  |  37.3 KB  |  1,463 lines

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