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