*** empty log message ***
[coreutils.git] / src / true.c
blob53c8f777fb7db6df147684c704820d9ededb83f4
1 #include <config.h>
2 #include <stdio.h>
3 #include <sys/types.h>
4 #include "system.h"
5 #include "version-etc.h"
6 #include "closeout.h"
8 #define PROGRAM_NAME "true"
9 #define AUTHORS "no one"
11 /* The name this program was run with. */
12 char *program_name;
14 void
15 usage (int status)
17 printf (_("\
18 Usage: %s [ignored command line arguments]\n\
19 or: %s OPTION\n\
20 Exit with a status code indicating success.\n\
21 \n\
22 These option names may not be abbreviated.\n\
23 \n\
24 --help display this help and exit\n\
25 --version output version information and exit\n\
27 , program_name, program_name);
28 puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
29 exit (status);
32 int
33 main (int argc, char **argv)
35 program_name = argv[0];
36 setlocale (LC_ALL, "");
37 bindtextdomain (PACKAGE, LOCALEDIR);
38 textdomain (PACKAGE);
40 atexit (close_stdout);
42 /* Recognize --help or --version only if it's the only command-line
43 argument and if POSIXLY_CORRECT is not set. */
44 if (argc == 2 && getenv ("POSIXLY_CORRECT") == NULL)
46 if (STREQ (argv[1], "--help"))
47 usage (EXIT_SUCCESS);
49 if (STREQ (argv[1], "--version"))
50 version_etc (stdout, PROGRAM_NAME, GNU_PACKAGE, VERSION, AUTHORS);
53 exit (EXIT_SUCCESS);