From 707f9870baebc446209711f25f77714a36514bdf Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 4 Aug 1999 11:14:55 +0000 Subject: *** empty log message *** --- src/true.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'src/true.c') diff --git a/src/true.c b/src/true.c index c462496f4..d3e42513b 100644 --- a/src/true.c +++ b/src/true.c @@ -1,5 +1,50 @@ +#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 () +main (int argc, char **argv) { - exit (0); + 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); } -- cgit v1.2.3-54-g00ecf