Merge r21-2-24-utf-2000-0_13-0.
[chise/xemacs-chise.git-] / info / standards.info-1
1 This is ../info/standards.info, produced by makeinfo version 3.12s from
2 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, 1995, 1996,
9 1997, 1998, 1999 Free Software Foundation, Inc.
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 \1f
26 File: standards.info,  Node: Top,  Next: Preface,  Prev: (dir),  Up: (dir)
27
28 Version
29 *******
30
31    Last updated June 24, 1999.
32
33 * Menu:
34
35 * Preface::                 About the GNU Coding Standards
36 * Legal Issues::            Keeping Free Software Free
37 * Design Advice::           General Program Design
38 * Program Behavior::        Program Behavior for All Programs
39 * Writing C::               Making The Best Use of C
40 * Documentation::           Documenting Programs
41 * Managing Releases::       The Release Process
42 * References::              References to Non-Free Software or Documentation
43
44 \1f
45 File: standards.info,  Node: Preface,  Next: Legal Issues,  Prev: Top,  Up: Top
46
47 About the GNU Coding Standards
48 ******************************
49
50    The GNU Coding Standards were written by Richard Stallman and other
51 GNU Project volunteers.  Their purpose is to make the GNU system clean,
52 consistent, and easy to install.  This document can also be read as a
53 guide to writing portable, robust and reliable programs.  It focuses on
54 programs written in C, but many of the rules and principles are useful
55 even if you write in another programming language.  The rules often
56 state reasons for writing in a certain way.
57
58    Corrections or suggestions for this document should be sent to
59 <gnu@gnu.org>.  If you make a suggestion, please include a suggested
60 new wording for it; our time is limited.  We prefer a context diff to
61 the `standards.texi' or `make-stds.texi' files, but if you don't have
62 those files, please mail your suggestion anyway.
63
64    This release of the GNU Coding Standards was last updated June 24,
65 1999.
66
67 \1f
68 File: standards.info,  Node: Legal Issues,  Next: Design Advice,  Prev: Preface,  Up: Top
69
70 Keeping Free Software Free
71 **************************
72
73    This node discusses how you can make sure that GNU software remains
74 unencumbered.
75
76 * Menu:
77
78 * Reading Non-Free Code::       Referring to Proprietary Programs
79 * Contributions::               Accepting Contributions
80
81 \1f
82 File: standards.info,  Node: Reading Non-Free Code,  Next: Contributions,  Up: Legal Issues
83
84 Referring to Proprietary Programs
85 =================================
86
87    Don't in any circumstances refer to Unix source code for or during
88 your work on GNU!  (Or to any other proprietary programs.)
89
90    If you have a vague recollection of the internals of a Unix program,
91 this does not absolutely mean you can't write an imitation of it, but
92 do try to organize the imitation internally along different lines,
93 because this is likely to make the details of the Unix version
94 irrelevant and dissimilar to your results.
95
96    For example, Unix utilities were generally optimized to minimize
97 memory use; if you go for speed instead, your program will be very
98 different.  You could keep the entire input file in core and scan it
99 there instead of using stdio.  Use a smarter algorithm discovered more
100 recently than the Unix program.  Eliminate use of temporary files.  Do
101 it in one pass instead of two (we did this in the assembler).
102
103    Or, on the contrary, emphasize simplicity instead of speed.  For some
104 applications, the speed of today's computers makes simpler algorithms
105 adequate.
106
107    Or go for generality.  For example, Unix programs often have static
108 tables or fixed-size strings, which make for arbitrary limits; use
109 dynamic allocation instead.  Make sure your program handles NULs and
110 other funny characters in the input files.  Add a programming language
111 for extensibility and write part of the program in that language.
112
113    Or turn some parts of the program into independently usable
114 libraries.  Or use a simple garbage collector instead of tracking
115 precisely when to free memory, or use a new GNU facility such as
116 obstacks.
117
118 \1f
119 File: standards.info,  Node: Contributions,  Prev: Reading Non-Free Code,  Up: Legal Issues
120
121 Accepting Contributions
122 =======================
123
124    If the program you are working on is copyrighted by the Free Software
125 Foundation, then when someone else sends you a piece of code to add to
126 the program, we need legal papers to use it--just as we asked you to
127 sign papers initially.  _Each_ person who makes a nontrivial
128 contribution to a program must sign some sort of legal papers in order
129 for us to have clear title to the program; the main author alone is not
130 enough.
131
132    So, before adding in any contributions from other people, please tell
133 us, so we can arrange to get the papers.  Then wait until we tell you
134 that we have received the signed papers, before you actually use the
135 contribution.
136
137    This applies both before you release the program and afterward.  If
138 you receive diffs to fix a bug, and they make significant changes, we
139 need legal papers for that change.
140
141    This also applies to comments and documentation files.  For copyright
142 law, comments and code are just text.  Copyright applies to all kinds of
143 text, so we need legal papers for all kinds.
144
145    We know it is frustrating to ask for legal papers; it's frustrating
146 for us as well.  But if you don't wait, you are going out on a limb--for
147 example, what if the contributor's employer won't sign a disclaimer?
148 You might have to take that code out again!
149
150    You don't need papers for changes of a few lines here or there, since
151 they are not significant for copyright purposes.  Also, you don't need
152 papers if all you get from the suggestion is some ideas, not actual code
153 which you use.  For example, if someone send you one implementation, but
154 you write a different implementation of the same idea, you don't need to
155 get papers.
156
157    The very worst thing is if you forget to tell us about the other
158 contributor.  We could be very embarrassed in court some day as a
159 result.
160
161    We have more detailed advice for maintainers of programs; if you have
162 reached the stage of actually maintaining a program for GNU (whether
163 released or not), please ask us for a copy.
164
165 \1f
166 File: standards.info,  Node: Design Advice,  Next: Program Behavior,  Prev: Legal Issues,  Up: Top
167
168 General Program Design
169 **********************
170
171    This node discusses some of the issues you should take into account
172 when designing your program.
173
174 * Menu:
175
176 * Compatibility::               Compatibility with other implementations
177 * Using Extensions::            Using non-standard features
178 * ANSI C::                      Using ANSI C features
179 * Source Language::             Using languages other than C
180
181 \1f
182 File: standards.info,  Node: Compatibility,  Next: Using Extensions,  Up: Design Advice
183
184 Compatibility with Other Implementations
185 ========================================
186
187    With occasional exceptions, utility programs and libraries for GNU
188 should be upward compatible with those in Berkeley Unix, and upward
189 compatible with ANSI C if ANSI C specifies their behavior, and upward
190 compatible with POSIX if POSIX specifies their behavior.
191
192    When these standards conflict, it is useful to offer compatibility
193 modes for each of them.
194
195    ANSI C and POSIX prohibit many kinds of extensions.  Feel free to
196 make the extensions anyway, and include a `--ansi', `--posix', or
197 `--compatible' option to turn them off.  However, if the extension has
198 a significant chance of breaking any real programs or scripts, then it
199 is not really upward compatible.  Try to redesign its interface.
200
201    Many GNU programs suppress extensions that conflict with POSIX if the
202 environment variable `POSIXLY_CORRECT' is defined (even if it is
203 defined with a null value).  Please make your program recognize this
204 variable if appropriate.
205
206    When a feature is used only by users (not by programs or command
207 files), and it is done poorly in Unix, feel free to replace it
208 completely with something totally different and better.  (For example,
209 `vi' is replaced with Emacs.)  But it is nice to offer a compatible
210 feature as well.  (There is a free `vi' clone, so we offer it.)
211
212    Additional useful features not in Berkeley Unix are welcome.
213
214 \1f
215 File: standards.info,  Node: Using Extensions,  Next: ANSI C,  Prev: Compatibility,  Up: Design Advice
216
217 Using Non-standard Features
218 ===========================
219
220    Many GNU facilities that already exist support a number of convenient
221 extensions over the comparable Unix facilities.  Whether to use these
222 extensions in implementing your program is a difficult question.
223
224    On the one hand, using the extensions can make a cleaner program.
225 On the other hand, people will not be able to build the program unless
226 the other GNU tools are available.  This might cause the program to
227 work on fewer kinds of machines.
228
229    With some extensions, it might be easy to provide both alternatives.
230 For example, you can define functions with a "keyword" `INLINE' and
231 define that as a macro to expand into either `inline' or nothing,
232 depending on the compiler.
233
234    In general, perhaps it is best not to use the extensions if you can
235 straightforwardly do without them, but to use the extensions if they
236 are a big improvement.
237
238    An exception to this rule are the large, established programs (such
239 as Emacs) which run on a great variety of systems.  Such programs would
240 be broken by use of GNU extensions.
241
242    Another exception is for programs that are used as part of
243 compilation: anything that must be compiled with other compilers in
244 order to bootstrap the GNU compilation facilities.  If these require
245 the GNU compiler, then no one can compile them without having them
246 installed already.  That would be no good.
247
248 \1f
249 File: standards.info,  Node: ANSI C,  Next: Source Language,  Prev: Using Extensions,  Up: Design Advice
250
251 ANSI C and pre-ANSI C
252 =====================
253
254    Do not ever use the "trigraph" feature of ANSI C.
255
256    ANSI C is widespread enough now that it is ok to write new programs
257 that use ANSI C features (and therefore will not work in non-ANSI
258 compilers).  And if a program is already written in ANSI C, there's no
259 need to convert it to support non-ANSI compilers.
260
261    If you don't know non-ANSI C, there's no need to learn it; just
262 write in ANSI C.
263
264    However, it is easy to support non-ANSI compilers in most programs,
265 so you might still consider doing so when you write a program.  And if a
266 program you are maintaining has such support, you should try to keep it
267 working.
268
269    To support pre-ANSI C, instead of writing function definitions in
270 ANSI prototype form,
271
272      int
273      foo (int x, int y)
274      ...
275
276 write the definition in pre-ANSI style like this,
277
278      int
279      foo (x, y)
280           int x, y;
281      ...
282
283 and use a separate declaration to specify the argument prototype:
284
285      int foo (int, int);
286
287    You need such a declaration anyway, in a header file, to get the
288 benefit of ANSI C prototypes in all the files where the function is
289 called.  And once you have the declaration, you normally lose nothing
290 by writing the function definition in the pre-ANSI style.
291
292    This technique does not work for integer types narrower than `int'.
293 If you think of an argument as being of a type narrower than `int',
294 declare it as `int' instead.
295
296    There are a few special cases where this technique is hard to use.
297 For example, if a function argument needs to hold the system type
298 `dev_t', you run into trouble, because `dev_t' is shorter than `int' on
299 some machines; but you cannot use `int' instead, because `dev_t' is
300 wider than `int' on some machines.  There is no type you can safely use
301 on all machines in a non-ANSI definition.  The only way to support
302 non-ANSI C and pass such an argument is to check the width of `dev_t'
303 using Autoconf and choose the argument type accordingly.  This may not
304 be worth the trouble.
305
306 \1f
307 File: standards.info,  Node: Source Language,  Prev: ANSI C,  Up: Design Advice
308
309 Using Languages Other Than C
310 ============================
311
312    Using a language other than C is like using a non-standard feature:
313 it will cause trouble for users.  Even if GCC supports the other
314 language, users may find it inconvenient to have to install the
315 compiler for that other language in order to build your program.  For
316 example, if you write your program in C++, people will have to install
317 the C++ compiler in order to compile your program.  Thus, it is better
318 if you write in C.
319
320    But there are three situations when there is no disadvantage in using
321 some other language:
322
323    * It is okay to use another language if your program contains an
324      interpreter for that language.
325
326      For example, if your program links with GUILE, it is ok to write
327      part of the program in Scheme or another language supported by
328      GUILE.
329
330    * It is okay to use another language in a tool specifically intended
331      for use with that language.
332
333      This is okay because the only people who want to build the tool
334      will be those who have installed the other language anyway.
335
336    * If an application is of interest to a narrow community, then
337      perhaps it's not important if the application is inconvenient to
338      install.
339
340    C has one other advantage over C++ and other compiled languages: more
341 people know C, so more people will find it easy to read and modify the
342 program if it is written in C.
343
344 \1f
345 File: standards.info,  Node: Program Behavior,  Next: Writing C,  Prev: Design Advice,  Up: Top
346
347 Program Behavior for All Programs
348 *********************************
349
350    This node describes how to write robust software. It also describes
351 general standards for error messages, the command line interface, and
352 how libraries should behave.
353
354 * Menu:
355
356 * Semantics::                   Writing robust programs
357 * Libraries::                   Library behavior
358 * Errors::                      Formatting error messages
359 * User Interfaces::             Standards for command line interfaces
360 * Option Table::                Table of long options.
361 * Memory Usage::                When and how to care about memory needs
362
363 \1f
364 File: standards.info,  Node: Semantics,  Next: Libraries,  Up: Program Behavior
365
366 Writing Robust Programs
367 =======================
368
369    Avoid arbitrary limits on the length or number of _any_ data
370 structure, including file names, lines, files, and symbols, by
371 allocating all data structures dynamically.  In most Unix utilities,
372 "long lines are silently truncated".  This is not acceptable in a GNU
373 utility.
374
375    Utilities reading files should not drop NUL characters, or any other
376 nonprinting characters _including those with codes above 0177_.  The
377 only sensible exceptions would be utilities specifically intended for
378 interface to certain types of terminals or printers that can't handle
379 those characters.  Whenever possible, try to make programs work
380 properly with sequences of bytes that represent multibyte characters,
381 using encodings such as UTF-8 and others.
382
383    Check every system call for an error return, unless you know you
384 wish to ignore errors.  Include the system error text (from `perror' or
385 equivalent) in _every_ error message resulting from a failing system
386 call, as well as the name of the file if any and the name of the
387 utility.  Just "cannot open foo.c" or "stat failed" is not sufficient.
388
389    Check every call to `malloc' or `realloc' to see if it returned
390 zero.  Check `realloc' even if you are making the block smaller; in a
391 system that rounds block sizes to a power of 2, `realloc' may get a
392 different block if you ask for less space.
393
394    In Unix, `realloc' can destroy the storage block if it returns zero.
395 GNU `realloc' does not have this bug: if it fails, the original block
396 is unchanged.  Feel free to assume the bug is fixed.  If you wish to
397 run your program on Unix, and wish to avoid lossage in this case, you
398 can use the GNU `malloc'.
399
400    You must expect `free' to alter the contents of the block that was
401 freed.  Anything you want to fetch from the block, you must fetch before
402 calling `free'.
403
404    If `malloc' fails in a noninteractive program, make that a fatal
405 error.  In an interactive program (one that reads commands from the
406 user), it is better to abort the command and return to the command
407 reader loop.  This allows the user to kill other processes to free up
408 virtual memory, and then try the command again.
409
410    Use `getopt_long' to decode arguments, unless the argument syntax
411 makes this unreasonable.
412
413    When static storage is to be written in during program execution, use
414 explicit C code to initialize it.  Reserve C initialized declarations
415 for data that will not be changed.
416
417    Try to avoid low-level interfaces to obscure Unix data structures
418 (such as file directories, utmp, or the layout of kernel memory), since
419 these are less likely to work compatibly.  If you need to find all the
420 files in a directory, use `readdir' or some other high-level interface.
421 These are supported compatibly by GNU.
422
423    The preferred signal handling facilities are the BSD variant of
424 `signal', and the POSIX `sigaction' function; the alternative USG
425 `signal' interface is an inferior design.
426
427    Nowadays, using the POSIX signal functions may be the easiest way to
428 make a program portable.  If you use `signal', then on GNU/Linux
429 systems running GNU libc version 1, you should include `bsd/signal.h'
430 instead of `signal.h', so as to get BSD behavior.  It is up to you
431 whether to support systems where `signal' has only the USG behavior, or
432 give up on them.
433
434    In error checks that detect "impossible" conditions, just abort.
435 There is usually no point in printing any message.  These checks
436 indicate the existence of bugs.  Whoever wants to fix the bugs will have
437 to read the source code and run a debugger.  So explain the problem with
438 comments in the source.  The relevant data will be in variables, which
439 are easy to examine with the debugger, so there is no point moving them
440 elsewhere.
441
442    Do not use a count of errors as the exit status for a program.
443 _That does not work_, because exit status values are limited to 8 bits
444 (0 through 255).  A single run of the program might have 256 errors; if
445 you try to return 256 as the exit status, the parent process will see 0
446 as the status, and it will appear that the program succeeded.
447
448    If you make temporary files, check the `TMPDIR' environment
449 variable; if that variable is defined, use the specified directory
450 instead of `/tmp'.
451
452 \1f
453 File: standards.info,  Node: Libraries,  Next: Errors,  Prev: Semantics,  Up: Program Behavior
454
455 Library Behavior
456 ================
457
458    Try to make library functions reentrant.  If they need to do dynamic
459 storage allocation, at least try to avoid any nonreentrancy aside from
460 that of `malloc' itself.
461
462    Here are certain name conventions for libraries, to avoid name
463 conflicts.
464
465    Choose a name prefix for the library, more than two characters long.
466 All external function and variable names should start with this prefix.
467 In addition, there should only be one of these in any given library
468 member.  This usually means putting each one in a separate source file.
469
470    An exception can be made when two external symbols are always used
471 together, so that no reasonable program could use one without the
472 other; then they can both go in the same file.
473
474    External symbols that are not documented entry points for the user
475 should have names beginning with `_'.  They should also contain the
476 chosen name prefix for the library, to prevent collisions with other
477 libraries.  These can go in the same files with user entry points if
478 you like.
479
480    Static functions and variables can be used as you like and need not
481 fit any naming convention.
482
483 \1f
484 File: standards.info,  Node: Errors,  Next: User Interfaces,  Prev: Libraries,  Up: Program Behavior
485
486 Formatting Error Messages
487 =========================
488
489    Error messages from compilers should look like this:
490
491      SOURCE-FILE-NAME:LINENO: MESSAGE
492
493 If you want to mention the column number, use this format:
494
495      SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE
496
497 Line numbers should start from 1 at the beginning of the file, and
498 column numbers should start from 1 at the beginning of the line.  (Both
499 of these conventions are chosen for compatibility.)  Calculate column
500 numbers assuming that space and all ASCII printing characters have
501 equal width, and assuming tab stops every 8 columns.
502
503    Error messages from other noninteractive programs should look like
504 this:
505
506      PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE
507
508 when there is an appropriate source file, or like this:
509
510      PROGRAM: MESSAGE
511
512 when there is no relevant source file.
513
514    If you want to mention the column number, use this format:
515
516      PROGRAM:SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE
517
518    In an interactive program (one that is reading commands from a
519 terminal), it is better not to include the program name in an error
520 message.  The place to indicate which program is running is in the
521 prompt or with the screen layout.  (When the same program runs with
522 input from a source other than a terminal, it is not interactive and
523 would do best to print error messages using the noninteractive style.)
524
525    The string MESSAGE should not begin with a capital letter when it
526 follows a program name and/or file name.  Also, it should not end with
527 a period.
528
529    Error messages from interactive programs, and other messages such as
530 usage messages, should start with a capital letter.  But they should not
531 end with a period.
532
533 \1f
534 File: standards.info,  Node: User Interfaces,  Next: Option Table,  Prev: Errors,  Up: Program Behavior
535
536 Standards for Command Line Interfaces
537 =====================================
538
539    Please don't make the behavior of a utility depend on the name used
540 to invoke it.  It is useful sometimes to make a link to a utility with
541 a different name, and that should not change what it does.
542
543    Instead, use a run time option or a compilation switch or both to
544 select among the alternate behaviors.
545
546    Likewise, please don't make the behavior of the program depend on the
547 type of output device it is used with.  Device independence is an
548 important principle of the system's design; do not compromise it merely
549 to save someone from typing an option now and then.  (Variation in error
550 message syntax when using a terminal is ok, because that is a side issue
551 that people do not depend on.)
552
553    If you think one behavior is most useful when the output is to a
554 terminal, and another is most useful when the output is a file or a
555 pipe, then it is usually best to make the default behavior the one that
556 is useful with output to a terminal, and have an option for the other
557 behavior.
558
559    Compatibility requires certain programs to depend on the type of
560 output device.  It would be disastrous if `ls' or `sh' did not do so in
561 the way all users expect.  In some of these cases, we supplement the
562 program with a preferred alternate version that does not depend on the
563 output device type.  For example, we provide a `dir' program much like
564 `ls' except that its default output format is always multi-column
565 format.
566
567    It is a good idea to follow the POSIX guidelines for the
568 command-line options of a program.  The easiest way to do this is to use
569 `getopt' to parse them.  Note that the GNU version of `getopt' will
570 normally permit options anywhere among the arguments unless the special
571 argument `--' is used.  This is not what POSIX specifies; it is a GNU
572 extension.
573
574    Please define long-named options that are equivalent to the
575 single-letter Unix-style options.  We hope to make GNU more user
576 friendly this way.  This is easy to do with the GNU function
577 `getopt_long'.
578
579    One of the advantages of long-named options is that they can be
580 consistent from program to program.  For example, users should be able
581 to expect the "verbose" option of any GNU program which has one, to be
582 spelled precisely `--verbose'.  To achieve this uniformity, look at the
583 table of common long-option names when you choose the option names for
584 your program (*note Option Table::).
585
586    It is usually a good idea for file names given as ordinary arguments
587 to be input files only; any output files would be specified using
588 options (preferably `-o' or `--output').  Even if you allow an output
589 file name as an ordinary argument for compatibility, try to provide an
590 option as another way to specify it.  This will lead to more consistency
591 among GNU utilities, and fewer idiosyncracies for users to remember.
592
593    All programs should support two standard options: `--version' and
594 `--help'.
595
596 `--version'
597      This option should direct the program to print information about
598      its name, version, origin and legal status, all on standard
599      output, and then exit successfully.  Other options and arguments
600      should be ignored once this is seen, and the program should not
601      perform its normal function.
602
603      The first line is meant to be easy for a program to parse; the
604      version number proper starts after the last space.  In addition,
605      it contains the canonical name for this program, in this format:
606
607           GNU Emacs 19.30
608
609      The program's name should be a constant string; _don't_ compute it
610      from `argv[0]'.  The idea is to state the standard or canonical
611      name for the program, not its file name.  There are other ways to
612      find out the precise file name where a command is found in `PATH'.
613
614      If the program is a subsidiary part of a larger package, mention
615      the package name in parentheses, like this:
616
617           emacsserver (GNU Emacs) 19.30
618
619      If the package has a version number which is different from this
620      program's version number, you can mention the package version
621      number just before the close-parenthesis.
622
623      If you *need* to mention the version numbers of libraries which
624      are distributed separately from the package which contains this
625      program, you can do so by printing an additional line of version
626      info for each library you want to mention.  Use the same format
627      for these lines as for the first line.
628
629      Please do not mention all of the libraries that the program uses
630      "just for completeness"--that would produce a lot of unhelpful
631      clutter.  Please mention library version numbers only if you find
632      in practice that they are very important to you in debugging.
633
634      The following line, after the version number line or lines, should
635      be a copyright notice.  If more than one copyright notice is
636      called for, put each on a separate line.
637
638      Next should follow a brief statement that the program is free
639      software, and that users are free to copy and change it on certain
640      conditions.  If the program is covered by the GNU GPL, say so
641      here.  Also mention that there is no warranty, to the extent
642      permitted by law.
643
644      It is ok to finish the output with a list of the major authors of
645      the program, as a way of giving credit.
646
647      Here's an example of output that follows these rules:
648
649           GNU Emacs 19.34.5
650           Copyright (C) 1996 Free Software Foundation, Inc.
651           GNU Emacs comes with NO WARRANTY,
652           to the extent permitted by law.
653           You may redistribute copies of GNU Emacs
654           under the terms of the GNU General Public License.
655           For more information about these matters,
656           see the files named COPYING.
657
658      You should adapt this to your program, of course, filling in the
659      proper year, copyright holder, name of program, and the references
660      to distribution terms, and changing the rest of the wording as
661      necessary.
662
663      This copyright notice only needs to mention the most recent year in
664      which changes were made--there's no need to list the years for
665      previous versions' changes.  You don't have to mention the name of
666      the program in these notices, if that is inconvenient, since it
667      appeared in the first line.
668
669 `--help'
670      This option should output brief documentation for how to invoke the
671      program, on standard output, then exit successfully.  Other
672      options and arguments should be ignored once this is seen, and the
673      program should not perform its normal function.
674
675      Near the end of the `--help' option's output there should be a line
676      that says where to mail bug reports.  It should have this format:
677
678           Report bugs to MAILING-ADDRESS.
679
680 \1f
681 File: standards.info,  Node: Option Table,  Next: Memory Usage,  Prev: User Interfaces,  Up: Program Behavior
682
683 Table of Long Options
684 =====================
685
686    Here is a table of long options used by GNU programs.  It is surely
687 incomplete, but we aim to list all the options that a new program might
688 want to be compatible with.  If you use names not already in the table,
689 please send <gnu@gnu.org> a list of them, with their meanings, so we
690 can update the table.
691
692 `after-date'
693      `-N' in `tar'.
694
695 `all'
696      `-a' in `du', `ls', `nm', `stty', `uname', and `unexpand'.
697
698 `all-text'
699      `-a' in `diff'.
700
701 `almost-all'
702      `-A' in `ls'.
703
704 `append'
705      `-a' in `etags', `tee', `time'; `-r' in `tar'.
706
707 `archive'
708      `-a' in `cp'.
709
710 `archive-name'
711      `-n' in `shar'.
712
713 `arglength'
714      `-l' in `m4'.
715
716 `ascii'
717      `-a' in `diff'.
718
719 `assign'
720      `-v' in `gawk'.
721
722 `assume-new'
723      `-W' in Make.
724
725 `assume-old'
726      `-o' in Make.
727
728 `auto-check'
729      `-a' in `recode'.
730
731 `auto-pager'
732      `-a' in `wdiff'.
733
734 `auto-reference'
735      `-A' in `ptx'.
736
737 `avoid-wraps'
738      `-n' in `wdiff'.
739
740 `background'
741      For server programs, run in the background.
742
743 `backward-search'
744      `-B' in `ctags'.
745
746 `basename'
747      `-f' in `shar'.
748
749 `batch'
750      Used in GDB.
751
752 `baud'
753      Used in GDB.
754
755 `before'
756      `-b' in `tac'.
757
758 `binary'
759      `-b' in `cpio' and `diff'.
760
761 `bits-per-code'
762      `-b' in `shar'.
763
764 `block-size'
765      Used in `cpio' and `tar'.
766
767 `blocks'
768      `-b' in `head' and `tail'.
769
770 `break-file'
771      `-b' in `ptx'.
772
773 `brief'
774      Used in various programs to make output shorter.
775
776 `bytes'
777      `-c' in `head', `split', and `tail'.
778
779 `c++'
780      `-C' in `etags'.
781
782 `catenate'
783      `-A' in `tar'.
784
785 `cd'
786      Used in various programs to specify the directory to use.
787
788 `changes'
789      `-c' in `chgrp' and `chown'.
790
791 `classify'
792      `-F' in `ls'.
793
794 `colons'
795      `-c' in `recode'.
796
797 `command'
798      `-c' in `su'; `-x' in GDB.
799
800 `compare'
801      `-d' in `tar'.
802
803 `compat'
804      Used in `gawk'.
805
806 `compress'
807      `-Z' in `tar' and `shar'.
808
809 `concatenate'
810      `-A' in `tar'.
811
812 `confirmation'
813      `-w' in `tar'.
814
815 `context'
816      Used in `diff'.
817
818 `copyleft'
819      `-W copyleft' in `gawk'.
820
821 `copyright'
822      `-C' in `ptx', `recode', and `wdiff'; `-W copyright' in `gawk'.
823
824 `core'
825      Used in GDB.
826
827 `count'
828      `-q' in `who'.
829
830 `count-links'
831      `-l' in `du'.
832
833 `create'
834      Used in `tar' and `cpio'.
835
836 `cut-mark'
837      `-c' in `shar'.
838
839 `cxref'
840      `-x' in `ctags'.
841
842 `date'
843      `-d' in `touch'.
844
845 `debug'
846      `-d' in Make and `m4'; `-t' in Bison.
847
848 `define'
849      `-D' in `m4'.
850
851 `defines'
852      `-d' in Bison and `ctags'.
853
854 `delete'
855      `-D' in `tar'.
856
857 `dereference'
858      `-L' in `chgrp', `chown', `cpio', `du', `ls', and `tar'.
859
860 `dereference-args'
861      `-D' in `du'.
862
863 `device'
864      Specify an I/O device (special file name).
865
866 `diacritics'
867      `-d' in `recode'.
868
869 `dictionary-order'
870      `-d' in `look'.
871
872 `diff'
873      `-d' in `tar'.
874
875 `digits'
876      `-n' in `csplit'.
877
878 `directory'
879      Specify the directory to use, in various programs.  In `ls', it
880      means to show directories themselves rather than their contents.
881      In `rm' and `ln', it means to not treat links to directories
882      specially.
883
884 `discard-all'
885      `-x' in `strip'.
886
887 `discard-locals'
888      `-X' in `strip'.
889
890 `dry-run'
891      `-n' in Make.
892
893 `ed'
894      `-e' in `diff'.
895
896 `elide-empty-files'
897      `-z' in `csplit'.
898
899 `end-delete'
900      `-x' in `wdiff'.
901
902 `end-insert'
903      `-z' in `wdiff'.
904
905 `entire-new-file'
906      `-N' in `diff'.
907
908 `environment-overrides'
909      `-e' in Make.
910
911 `eof'
912      `-e' in `xargs'.
913
914 `epoch'
915      Used in GDB.
916
917 `error-limit'
918      Used in `makeinfo'.
919
920 `error-output'
921      `-o' in `m4'.
922
923 `escape'
924      `-b' in `ls'.
925
926 `exclude-from'
927      `-X' in `tar'.
928
929 `exec'
930      Used in GDB.
931
932 `exit'
933      `-x' in `xargs'.
934
935 `exit-0'
936      `-e' in `unshar'.
937
938 `expand-tabs'
939      `-t' in `diff'.
940
941 `expression'
942      `-e' in `sed'.
943
944 `extern-only'
945      `-g' in `nm'.
946
947 `extract'
948      `-i' in `cpio'; `-x' in `tar'.
949
950 `faces'
951      `-f' in `finger'.
952
953 `fast'
954      `-f' in `su'.
955
956 `fatal-warnings'
957      `-E' in `m4'.
958
959 `file'
960      `-f' in `info', `gawk', Make, `mt', and `tar'; `-n' in `sed'; `-r'
961      in `touch'.
962
963 `field-separator'
964      `-F' in `gawk'.
965
966 `file-prefix'
967      `-b' in Bison.
968
969 `file-type'
970      `-F' in `ls'.
971
972 `files-from'
973      `-T' in `tar'.
974
975 `fill-column'
976      Used in `makeinfo'.
977
978 `flag-truncation'
979      `-F' in `ptx'.
980
981 `fixed-output-files'
982      `-y' in Bison.
983
984 `follow'
985      `-f' in `tail'.
986
987 `footnote-style'
988      Used in `makeinfo'.
989
990 `force'
991      `-f' in `cp', `ln', `mv', and `rm'.
992
993 `force-prefix'
994      `-F' in `shar'.
995
996 `foreground'
997      For server programs, run in the foreground; in other words, don't
998      do anything special to run the server in the background.
999
1000 `format'
1001      Used in `ls', `time', and `ptx'.
1002
1003 `freeze-state'
1004      `-F' in `m4'.
1005
1006 `fullname'
1007      Used in GDB.
1008
1009 `gap-size'
1010      `-g' in `ptx'.
1011
1012 `get'
1013      `-x' in `tar'.
1014
1015 `graphic'
1016      `-i' in `ul'.
1017
1018 `graphics'
1019      `-g' in `recode'.
1020
1021 `group'
1022      `-g' in `install'.
1023
1024 `gzip'
1025      `-z' in `tar' and `shar'.
1026
1027 `hashsize'
1028      `-H' in `m4'.
1029
1030 `header'
1031      `-h' in `objdump' and `recode'
1032
1033 `heading'
1034      `-H' in `who'.
1035
1036 `help'
1037      Used to ask for brief usage information.
1038
1039 `here-delimiter'
1040      `-d' in `shar'.
1041
1042 `hide-control-chars'
1043      `-q' in `ls'.
1044
1045 `idle'
1046      `-u' in `who'.
1047
1048 `ifdef'
1049      `-D' in `diff'.
1050
1051 `ignore'
1052      `-I' in `ls'; `-x' in `recode'.
1053
1054 `ignore-all-space'
1055      `-w' in `diff'.
1056
1057 `ignore-backups'
1058      `-B' in `ls'.
1059
1060 `ignore-blank-lines'
1061      `-B' in `diff'.
1062
1063 `ignore-case'
1064      `-f' in `look' and `ptx'; `-i' in `diff' and `wdiff'.
1065
1066 `ignore-errors'
1067      `-i' in Make.
1068
1069 `ignore-file'
1070      `-i' in `ptx'.
1071
1072 `ignore-indentation'
1073      `-I' in `etags'.
1074
1075 `ignore-init-file'
1076      `-f' in Oleo.
1077
1078 `ignore-interrupts'
1079      `-i' in `tee'.
1080
1081 `ignore-matching-lines'
1082      `-I' in `diff'.
1083
1084 `ignore-space-change'
1085      `-b' in `diff'.
1086
1087 `ignore-zeros'
1088      `-i' in `tar'.
1089
1090 `include'
1091      `-i' in `etags'; `-I' in `m4'.
1092
1093 `include-dir'
1094      `-I' in Make.
1095
1096 `incremental'
1097      `-G' in `tar'.
1098
1099 `info'
1100      `-i', `-l', and `-m' in Finger.
1101
1102 `initial'
1103      `-i' in `expand'.
1104
1105 `initial-tab'
1106      `-T' in `diff'.
1107
1108 `inode'
1109      `-i' in `ls'.
1110
1111 `interactive'
1112      `-i' in `cp', `ln', `mv', `rm'; `-e' in `m4'; `-p' in `xargs';
1113      `-w' in `tar'.
1114
1115 `intermix-type'
1116      `-p' in `shar'.
1117
1118 `jobs'
1119      `-j' in Make.
1120
1121 `just-print'
1122      `-n' in Make.
1123
1124 `keep-going'
1125      `-k' in Make.
1126
1127 `keep-files'
1128      `-k' in `csplit'.
1129
1130 `kilobytes'
1131      `-k' in `du' and `ls'.
1132
1133 `language'
1134      `-l' in `etags'.
1135
1136 `less-mode'
1137      `-l' in `wdiff'.
1138
1139 `level-for-gzip'
1140      `-g' in `shar'.
1141
1142 `line-bytes'
1143      `-C' in `split'.
1144
1145 `lines'
1146      Used in `split', `head', and `tail'.
1147
1148 `link'
1149      `-l' in `cpio'.
1150
1151 `lint'
1152 `lint-old'
1153      Used in `gawk'.
1154
1155 `list'
1156      `-t' in `cpio'; `-l' in `recode'.
1157
1158 `list'
1159      `-t' in `tar'.
1160
1161 `literal'
1162      `-N' in `ls'.
1163
1164 `load-average'
1165      `-l' in Make.
1166
1167 `login'
1168      Used in `su'.
1169
1170 `machine'
1171      No listing of which programs already use this; someone should
1172      check to see if any actually do, and tell <gnu@gnu.org>.
1173
1174 `macro-name'
1175      `-M' in `ptx'.
1176
1177 `mail'
1178      `-m' in `hello' and `uname'.
1179
1180 `make-directories'
1181      `-d' in `cpio'.
1182
1183 `makefile'
1184      `-f' in Make.
1185
1186 `mapped'
1187      Used in GDB.
1188
1189 `max-args'
1190      `-n' in `xargs'.
1191
1192 `max-chars'
1193      `-n' in `xargs'.
1194
1195 `max-lines'
1196      `-l' in `xargs'.
1197
1198 `max-load'
1199      `-l' in Make.
1200
1201 `max-procs'
1202      `-P' in `xargs'.
1203
1204 `mesg'
1205      `-T' in `who'.
1206
1207 `message'
1208      `-T' in `who'.
1209
1210 `minimal'
1211      `-d' in `diff'.
1212
1213 `mixed-uuencode'
1214      `-M' in `shar'.
1215
1216 `mode'
1217      `-m' in `install', `mkdir', and `mkfifo'.
1218
1219 `modification-time'
1220      `-m' in `tar'.
1221
1222 `multi-volume'
1223      `-M' in `tar'.
1224
1225 `name-prefix'
1226      `-a' in Bison.
1227
1228 `nesting-limit'
1229      `-L' in `m4'.
1230
1231 `net-headers'
1232      `-a' in `shar'.
1233
1234 `new-file'
1235      `-W' in Make.
1236
1237 `no-builtin-rules'
1238      `-r' in Make.
1239
1240 `no-character-count'
1241      `-w' in `shar'.
1242
1243 `no-check-existing'
1244      `-x' in `shar'.
1245
1246 `no-common'
1247      `-3' in `wdiff'.
1248
1249 `no-create'
1250      `-c' in `touch'.
1251
1252 `no-defines'
1253      `-D' in `etags'.
1254
1255 `no-deleted'
1256      `-1' in `wdiff'.
1257
1258 `no-dereference'
1259      `-d' in `cp'.
1260
1261 `no-inserted'
1262      `-2' in `wdiff'.
1263
1264 `no-keep-going'
1265      `-S' in Make.
1266
1267 `no-lines'
1268      `-l' in Bison.
1269
1270 `no-piping'
1271      `-P' in `shar'.
1272
1273 `no-prof'
1274      `-e' in `gprof'.
1275
1276 `no-regex'
1277      `-R' in `etags'.
1278
1279 `no-sort'
1280      `-p' in `nm'.
1281
1282 `no-split'
1283      Used in `makeinfo'.
1284
1285 `no-static'
1286      `-a' in `gprof'.
1287
1288 `no-time'
1289      `-E' in `gprof'.
1290
1291 `no-timestamp'
1292      `-m' in `shar'.
1293
1294 `no-validate'
1295      Used in `makeinfo'.
1296
1297 `no-wait'
1298      Used in `emacsclient'.
1299
1300 `no-warn'
1301      Used in various programs to inhibit warnings.
1302
1303 `node'
1304      `-n' in `info'.
1305
1306 `nodename'
1307      `-n' in `uname'.
1308
1309 `nonmatching'
1310      `-f' in `cpio'.
1311
1312 `nstuff'
1313      `-n' in `objdump'.
1314
1315 `null'
1316      `-0' in `xargs'.
1317
1318 `number'
1319      `-n' in `cat'.
1320
1321 `number-nonblank'
1322      `-b' in `cat'.
1323
1324 `numeric-sort'
1325      `-n' in `nm'.
1326
1327 `numeric-uid-gid'
1328      `-n' in `cpio' and `ls'.
1329
1330 `nx'
1331      Used in GDB.
1332
1333 `old-archive'
1334      `-o' in `tar'.
1335
1336 `old-file'
1337      `-o' in Make.
1338
1339 `one-file-system'
1340      `-l' in `tar', `cp', and `du'.
1341
1342 `only-file'
1343      `-o' in `ptx'.
1344
1345 `only-prof'
1346      `-f' in `gprof'.
1347
1348 `only-time'
1349      `-F' in `gprof'.
1350
1351 `options'
1352      `-o' in `getopt', `fdlist', `fdmount', `fdmountd', and `fdumount'.
1353
1354 `output'
1355      In various programs, specify the output file name.
1356
1357 `output-prefix'
1358      `-o' in `shar'.
1359
1360 `override'
1361      `-o' in `rm'.
1362
1363 `overwrite'
1364      `-c' in `unshar'.
1365
1366 `owner'
1367      `-o' in `install'.
1368
1369 `paginate'
1370      `-l' in `diff'.
1371
1372 `paragraph-indent'
1373      Used in `makeinfo'.
1374
1375 `parents'
1376      `-p' in `mkdir' and `rmdir'.
1377
1378 `pass-all'
1379      `-p' in `ul'.
1380
1381 `pass-through'
1382      `-p' in `cpio'.
1383
1384 `port'
1385      `-P' in `finger'.
1386
1387 `portability'
1388      `-c' in `cpio' and `tar'.
1389
1390 `posix'
1391      Used in `gawk'.
1392
1393 `prefix-builtins'
1394      `-P' in `m4'.
1395
1396 `prefix'
1397      `-f' in `csplit'.
1398
1399 `preserve'
1400      Used in `tar' and `cp'.
1401
1402 `preserve-environment'
1403      `-p' in `su'.
1404
1405 `preserve-modification-time'
1406      `-m' in `cpio'.
1407
1408 `preserve-order'
1409      `-s' in `tar'.
1410
1411 `preserve-permissions'
1412      `-p' in `tar'.
1413
1414 `print'
1415      `-l' in `diff'.
1416
1417 `print-chars'
1418      `-L' in `cmp'.
1419
1420 `print-data-base'
1421      `-p' in Make.
1422
1423 `print-directory'
1424      `-w' in Make.
1425
1426 `print-file-name'
1427      `-o' in `nm'.
1428
1429 `print-symdefs'
1430      `-s' in `nm'.
1431
1432 `printer'
1433      `-p' in `wdiff'.
1434
1435 `prompt'
1436      `-p' in `ed'.
1437
1438 `proxy'
1439      Specify an HTTP proxy.
1440
1441 `query-user'
1442      `-X' in `shar'.
1443
1444 `question'
1445      `-q' in Make.
1446
1447 `quiet'
1448      Used in many programs to inhibit the usual output.  *Note:* every
1449      program accepting `--quiet' should accept `--silent' as a synonym.
1450
1451 `quiet-unshar'
1452      `-Q' in `shar'
1453
1454 `quote-name'
1455      `-Q' in `ls'.
1456
1457 `rcs'
1458      `-n' in `diff'.
1459
1460 `re-interval'
1461      Used in `gawk'.
1462
1463 `read-full-blocks'
1464      `-B' in `tar'.
1465
1466 `readnow'
1467      Used in GDB.
1468
1469 `recon'
1470      `-n' in Make.
1471
1472 `record-number'
1473      `-R' in `tar'.
1474
1475 `recursive'
1476      Used in `chgrp', `chown', `cp', `ls', `diff', and `rm'.
1477
1478 `reference-limit'
1479      Used in `makeinfo'.
1480
1481 `references'
1482      `-r' in `ptx'.
1483
1484 `regex'
1485      `-r' in `tac' and `etags'.
1486
1487 `release'
1488      `-r' in `uname'.
1489
1490 `reload-state'
1491      `-R' in `m4'.
1492
1493 `relocation'
1494      `-r' in `objdump'.
1495
1496 `rename'
1497      `-r' in `cpio'.
1498
1499 `replace'
1500      `-i' in `xargs'.
1501
1502 `report-identical-files'
1503      `-s' in `diff'.
1504
1505 `reset-access-time'
1506      `-a' in `cpio'.
1507
1508 `reverse'
1509      `-r' in `ls' and `nm'.
1510
1511 `reversed-ed'
1512      `-f' in `diff'.
1513
1514 `right-side-defs'
1515      `-R' in `ptx'.
1516
1517 `same-order'
1518      `-s' in `tar'.
1519
1520 `same-permissions'
1521      `-p' in `tar'.
1522
1523 `save'
1524      `-g' in `stty'.
1525
1526 `se'
1527      Used in GDB.
1528
1529 `sentence-regexp'
1530      `-S' in `ptx'.
1531
1532 `separate-dirs'
1533      `-S' in `du'.
1534
1535 `separator'
1536      `-s' in `tac'.
1537
1538 `sequence'
1539      Used by `recode' to chose files or pipes for sequencing passes.
1540
1541 `shell'
1542      `-s' in `su'.
1543
1544 `show-all'
1545      `-A' in `cat'.
1546
1547 `show-c-function'
1548      `-p' in `diff'.
1549
1550 `show-ends'
1551      `-E' in `cat'.
1552
1553 `show-function-line'
1554      `-F' in `diff'.
1555
1556 `show-tabs'
1557      `-T' in `cat'.
1558
1559 `silent'
1560      Used in many programs to inhibit the usual output.  *Note:* every
1561      program accepting `--silent' should accept `--quiet' as a synonym.
1562
1563 `size'
1564      `-s' in `ls'.
1565
1566 `socket'
1567      Specify a file descriptor for a network server to use for its
1568      socket, instead of opening and binding a new socket.  This
1569      provides a way to run, in a nonpriveledged process, a server that
1570      normally needs a reserved port number.
1571
1572 `sort'
1573      Used in `ls'.
1574
1575 `source'
1576      `-W source' in `gawk'.
1577
1578 `sparse'
1579      `-S' in `tar'.
1580
1581 `speed-large-files'
1582      `-H' in `diff'.
1583
1584 `split-at'
1585      `-E' in `unshar'.
1586
1587 `split-size-limit'
1588      `-L' in `shar'.
1589
1590 `squeeze-blank'
1591      `-s' in `cat'.
1592
1593 `start-delete'
1594      `-w' in `wdiff'.
1595
1596 `start-insert'
1597      `-y' in `wdiff'.
1598
1599 `starting-file'
1600      Used in `tar' and `diff' to specify which file within a directory
1601      to start processing with.
1602
1603 `statistics'
1604      `-s' in `wdiff'.
1605
1606 `stdin-file-list'
1607      `-S' in `shar'.
1608
1609 `stop'
1610      `-S' in Make.
1611
1612 `strict'
1613      `-s' in `recode'.
1614
1615 `strip'
1616      `-s' in `install'.
1617
1618 `strip-all'
1619      `-s' in `strip'.
1620
1621 `strip-debug'
1622      `-S' in `strip'.
1623
1624 `submitter'
1625      `-s' in `shar'.
1626
1627 `suffix'
1628      `-S' in `cp', `ln', `mv'.
1629
1630 `suffix-format'
1631      `-b' in `csplit'.
1632
1633 `sum'
1634      `-s' in `gprof'.
1635
1636 `summarize'
1637      `-s' in `du'.
1638
1639 `symbolic'
1640      `-s' in `ln'.
1641
1642 `symbols'
1643      Used in GDB and `objdump'.
1644
1645 `synclines'
1646      `-s' in `m4'.
1647
1648 `sysname'
1649      `-s' in `uname'.
1650
1651 `tabs'
1652      `-t' in `expand' and `unexpand'.
1653
1654 `tabsize'
1655      `-T' in `ls'.
1656
1657 `terminal'
1658      `-T' in `tput' and `ul'.  `-t' in `wdiff'.
1659
1660 `text'
1661      `-a' in `diff'.
1662
1663 `text-files'
1664      `-T' in `shar'.
1665
1666 `time'
1667      Used in `ls' and `touch'.
1668
1669 `timeout'
1670      Specify how long to wait before giving up on some operation.
1671
1672 `to-stdout'
1673      `-O' in `tar'.
1674
1675 `total'
1676      `-c' in `du'.
1677
1678 `touch'
1679      `-t' in Make, `ranlib', and `recode'.
1680
1681 `trace'
1682      `-t' in `m4'.
1683
1684 `traditional'
1685      `-t' in `hello'; `-W traditional' in `gawk'; `-G' in `ed', `m4',
1686      and `ptx'.
1687
1688 `tty'
1689      Used in GDB.
1690
1691 `typedefs'
1692      `-t' in `ctags'.
1693
1694 `typedefs-and-c++'
1695      `-T' in `ctags'.
1696
1697 `typeset-mode'
1698      `-t' in `ptx'.
1699
1700 `uncompress'
1701      `-z' in `tar'.
1702
1703 `unconditional'
1704      `-u' in `cpio'.
1705
1706 `undefine'
1707      `-U' in `m4'.
1708
1709 `undefined-only'
1710      `-u' in `nm'.
1711
1712 `update'
1713      `-u' in `cp', `ctags', `mv', `tar'.
1714
1715 `usage'
1716      Used in `gawk'; same as `--help'.
1717
1718 `uuencode'
1719      `-B' in `shar'.
1720
1721 `vanilla-operation'
1722      `-V' in `shar'.
1723
1724 `verbose'
1725      Print more information about progress.  Many programs support this.
1726
1727 `verify'
1728      `-W' in `tar'.
1729
1730 `version'
1731      Print the version number.
1732
1733 `version-control'
1734      `-V' in `cp', `ln', `mv'.
1735
1736 `vgrind'
1737      `-v' in `ctags'.
1738
1739 `volume'
1740      `-V' in `tar'.
1741
1742 `what-if'
1743      `-W' in Make.
1744
1745 `whole-size-limit'
1746      `-l' in `shar'.
1747
1748 `width'
1749      `-w' in `ls' and `ptx'.
1750
1751 `word-regexp'
1752      `-W' in `ptx'.
1753
1754 `writable'
1755      `-T' in `who'.
1756
1757 `zeros'
1758      `-z' in `gprof'.
1759
1760 \1f
1761 File: standards.info,  Node: Memory Usage,  Prev: Option Table,  Up: Program Behavior
1762
1763 Memory Usage
1764 ============
1765
1766    If it typically uses just a few meg of memory, don't bother making
1767 any effort to reduce memory usage.  For example, if it is impractical
1768 for other reasons to operate on files more than a few meg long, it is
1769 reasonable to read entire input files into core to operate on them.
1770
1771    However, for programs such as `cat' or `tail', that can usefully
1772 operate on very large files, it is important to avoid using a technique
1773 that would artificially limit the size of files it can handle.  If a
1774 program works by lines and could be applied to arbitrary user-supplied
1775 input files, it should keep only a line in memory, because this is not
1776 very hard and users will want to be able to operate on input files that
1777 are bigger than will fit in core all at once.
1778
1779    If your program creates complicated data structures, just make them
1780 in core and give a fatal error if `malloc' returns zero.
1781
1782 \1f
1783 File: standards.info,  Node: Writing C,  Next: Documentation,  Prev: Program Behavior,  Up: Top
1784
1785 Making The Best Use of C
1786 ************************
1787
1788    This node provides advice on how best to use the C language when
1789 writing GNU software.
1790
1791 * Menu:
1792
1793 * Formatting::                  Formatting Your Source Code
1794 * Comments::                    Commenting Your Work
1795 * Syntactic Conventions::       Clean Use of C Constructs
1796 * Names::                       Naming Variables and Functions
1797 * System Portability::          Portability between different operating systems
1798 * CPU Portability::             Supporting the range of CPU types
1799 * System Functions::            Portability and ``standard'' library functions
1800 * Internationalization::        Techniques for internationalization
1801 * Mmap::                        How you can safely use `mmap'.
1802
1803 \1f
1804 File: standards.info,  Node: Formatting,  Next: Comments,  Up: Writing C
1805
1806 Formatting Your Source Code
1807 ===========================
1808
1809    It is important to put the open-brace that starts the body of a C
1810 function in column zero, and avoid putting any other open-brace or
1811 open-parenthesis or open-bracket in column zero.  Several tools look
1812 for open-braces in column zero to find the beginnings of C functions.
1813 These tools will not work on code not formatted that way.
1814
1815    It is also important for function definitions to start the name of
1816 the function in column zero.  This helps people to search for function
1817 definitions, and may also help certain tools recognize them.  Thus, the
1818 proper format is this:
1819
1820      static char *
1821      concat (s1, s2)        /* Name starts in column zero here */
1822           char *s1, *s2;
1823      {                     /* Open brace in column zero here */
1824        ...
1825      }
1826
1827 or, if you want to use ANSI C, format the definition like this:
1828
1829      static char *
1830      concat (char *s1, char *s2)
1831      {
1832        ...
1833      }
1834
1835    In ANSI C, if the arguments don't fit nicely on one line, split it
1836 like this:
1837
1838      int
1839      lots_of_args (int an_integer, long a_long, short a_short,
1840                    double a_double, float a_float)
1841      ...
1842
1843    For the body of the function, we prefer code formatted like this:
1844
1845      if (x < foo (y, z))
1846        haha = bar[4] + 5;
1847      else
1848        {
1849          while (z)
1850            {
1851              haha += foo (z, z);
1852              z--;
1853            }
1854          return ++x + bar ();
1855        }
1856
1857    We find it easier to read a program when it has spaces before the
1858 open-parentheses and after the commas.  Especially after the commas.
1859
1860    When you split an expression into multiple lines, split it before an
1861 operator, not after one.  Here is the right way:
1862
1863      if (foo_this_is_long && bar > win (x, y, z)
1864          && remaining_condition)
1865
1866    Try to avoid having two operators of different precedence at the same
1867 level of indentation.  For example, don't write this:
1868
1869      mode = (inmode[j] == VOIDmode
1870              || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])
1871              ? outmode[j] : inmode[j]);
1872
1873    Instead, use extra parentheses so that the indentation shows the
1874 nesting:
1875
1876      mode = ((inmode[j] == VOIDmode
1877               || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])))
1878              ? outmode[j] : inmode[j]);
1879
1880    Insert extra parentheses so that Emacs will indent the code properly.
1881 For example, the following indentation looks nice if you do it by hand,
1882 but Emacs would mess it up:
1883
1884      v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
1885          + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;
1886
1887    But adding a set of parentheses solves the problem:
1888
1889      v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
1890           + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);
1891
1892    Format do-while statements like this:
1893
1894      do
1895        {
1896          a = foo (a);
1897        }
1898      while (a > 0);
1899
1900    Please use formfeed characters (control-L) to divide the program into
1901 pages at logical places (but not within a function).  It does not matter
1902 just how long the pages are, since they do not have to fit on a printed
1903 page.  The formfeeds should appear alone on lines by themselves.
1904