summaryrefslogtreecommitdiff
path: root/src/true.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-08-04 11:14:55 +0000
committerJim Meyering <jim@meyering.net>1999-08-04 11:14:55 +0000
commit707f9870baebc446209711f25f77714a36514bdf (patch)
tree9bc39b9904372a06a180f7480f599a96b26e9cd0 /src/true.c
parent26fe14166ff0bcdbf5caa6d446fb7560cbe8cf10 (diff)
downloadcoreutils-707f9870baebc446209711f25f77714a36514bdf.tar.xz
*** empty log message ***
Diffstat (limited to 'src/true.c')
-rw-r--r--src/true.c49
1 files changed, 47 insertions, 2 deletions
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 <config.h>
+#include <stdio.h>
+#include <sys/types.h>
+#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 <bug-sh-utils@gnu.org>."));
+ 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);
}