diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-07-18 07:53:05 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-07-18 07:53:05 +0000 |
commit | d58ce6b09cee90630488e334b8774f7a93a2703b (patch) | |
tree | 98a61e1985f6074c7f96629d998b2e779850bd97 | |
parent | 983ce81d944af6e3e785811ebc7085d1e4cc1367 (diff) | |
download | coreutils-d58ce6b09cee90630488e334b8774f7a93a2703b.tar.xz |
(EXIT_STATUS): New macro.
(PROGRAM_NAME, usage): Behave like "false" if EXIT_STATUS indicates.
(usage): Remove "These option names may not be abbreviated."
-rw-r--r-- | src/true.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/true.c b/src/true.c index 5c79891e5..55490f90e 100644 --- a/src/true.c +++ b/src/true.c @@ -20,7 +20,17 @@ #include <sys/types.h> #include "system.h" -#define PROGRAM_NAME "true" +/* Act like "true" by default; false.c overrides this. */ +#ifndef EXIT_STATUS +# define EXIT_STATUS EXIT_SUCCESS +#endif + +#if EXIT_STATUS == EXIT_SUCCESS +# define PROGRAM_NAME "true" +#else +# define PROGRAM_NAME "false" +#endif + #define AUTHORS "Jim Meyering" /* The name this program was run with. */ @@ -34,13 +44,10 @@ Usage: %s [ignored command line arguments]\n\ or: %s OPTION\n\ "), program_name, program_name); - fputs (_("\ -Exit with a status code indicating success.\n\ -\n\ -These option names may not be abbreviated.\n\ -\n\ -"), - stdout); + printf ("%s\n\n", + _(EXIT_STATUS == EXIT_SUCCESS + ? "Exit with a status code indicating success." + : "Exit with a status code indicating failure.")); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME); @@ -64,12 +71,12 @@ main (int argc, char **argv) if (argc == 2) { if (STREQ (argv[1], "--help")) - usage (EXIT_SUCCESS); + usage (EXIT_STATUS); if (STREQ (argv[1], "--version")) version_etc (stdout, PROGRAM_NAME, GNU_PACKAGE, VERSION, AUTHORS, (char *) NULL); } - exit (EXIT_SUCCESS); + exit (EXIT_STATUS); } |