*** empty log message ***
[coreutils.git] / src / true.c
blob004b77ef6389533bebefc19abe71aed81a9e5471
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 "),
25 program_name, program_name);
26 fputs (HELP_OPTION_DESCRIPTION, stdout);
27 fputs (VERSION_OPTION_DESCRIPTION, stdout);
28 printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
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);