*** empty log message ***
authorJim Meyering <jim@meyering.net>
Wed, 4 Aug 1999 11:14:55 +0000 (11:14 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 4 Aug 1999 11:14:55 +0000 (11:14 +0000)
src/true.c

index c462496..d3e4251 100644 (file)
@@ -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);
 }