From 707f9870baebc446209711f25f77714a36514bdf Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 4 Aug 1999 11:14:55 +0000 Subject: [PATCH] *** empty log message *** --- src/true.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) rewrite src/true.c (71%) diff --git a/src/true.c b/src/true.c dissimilarity index 71% index c462496f4..d3e42513b 100644 --- a/src/true.c +++ b/src/true.c @@ -1,5 +1,50 @@ -int -main () -{ - exit (0); -} +#include +#include +#include +#include "system.h" +#include "version-etc.h" + +#define PROGRAM_NAME "true" +#define AUTHORS "no one" + +/* The name this program was run with. */ +char *program_name; + +void +usage (int status) +{ + printf (_("\ +Usage: %s\n\ + or: %s OPTION\n\ +Exit with a status code indicating success.\n\ +These option names may not be abbreviated. +\n\ + --help display this help and exit\n\ + --version output version information and exit\n\ +") + , program_name, program_name); + puts (_("\nReport bugs to .")); + exit (status); +} + +int +main (int argc, char **argv) +{ + program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + + /* Recognize --help or --version only if it's the only command-line + argument and if POSIXLY_CORRECT is not set. */ + if (argc == 2 && getenv ("POSIXLY_CORRECT") == NULL) + { + if (STREQ (argv[1], "--help")) + usage (EXIT_SUCCESS); + + if (STREQ (argv[1], "--version")) + version_etc (stdout, PROGRAM_NAME, GNU_PACKAGE, VERSION, AUTHORS); + } + + exit (EXIT_SUCCESS); +} -- 2.11.4.GIT