(noinst_HEADERS): Add nanosleep.h.
[coreutils.git] / src / true.c
blob1ea0d0d7aef13074f6e0b3fb901c61e06b8d7d2b
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 [ignored command line arguments]\n\
18 or: %s OPTION\n\
19 Exit with a status code indicating success.\n\
20 \n\
21 These option names may not be abbreviated.\n\
22 \n\
23 --help display this help and exit\n\
24 --version output version information and exit\n\
26 , program_name, program_name);
27 puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
28 exit (status);
31 int
32 main (int argc, char **argv)
34 program_name = argv[0];
35 setlocale (LC_ALL, "");
36 bindtextdomain (PACKAGE, LOCALEDIR);
37 textdomain (PACKAGE);
39 /* Recognize --help or --version only if it's the only command-line
40 argument and if POSIXLY_CORRECT is not set. */
41 if (argc == 2 && getenv ("POSIXLY_CORRECT") == NULL)
43 if (STREQ (argv[1], "--help"))
44 usage (EXIT_SUCCESS);
46 if (STREQ (argv[1], "--version"))
47 version_etc (stdout, PROGRAM_NAME, GNU_PACKAGE, VERSION, AUTHORS);
50 exit (EXIT_SUCCESS);