* src/dd.c (flags): noatime and nofollow now depend on
[coreutils/bo.git] / src / true.c
blob55490f90eaccb5b425100ccd196b443ce2da1bcb
1 /* Exit with a status code indicating success.
2 Copyright (C) 1999-2003, 2005 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 #include <config.h>
19 #include <stdio.h>
20 #include <sys/types.h>
21 #include "system.h"
23 /* Act like "true" by default; false.c overrides this. */
24 #ifndef EXIT_STATUS
25 # define EXIT_STATUS EXIT_SUCCESS
26 #endif
28 #if EXIT_STATUS == EXIT_SUCCESS
29 # define PROGRAM_NAME "true"
30 #else
31 # define PROGRAM_NAME "false"
32 #endif
34 #define AUTHORS "Jim Meyering"
36 /* The name this program was run with. */
37 char *program_name;
39 void
40 usage (int status)
42 printf (_("\
43 Usage: %s [ignored command line arguments]\n\
44 or: %s OPTION\n\
45 "),
46 program_name, program_name);
47 printf ("%s\n\n",
48 _(EXIT_STATUS == EXIT_SUCCESS
49 ? "Exit with a status code indicating success."
50 : "Exit with a status code indicating failure."));
51 fputs (HELP_OPTION_DESCRIPTION, stdout);
52 fputs (VERSION_OPTION_DESCRIPTION, stdout);
53 printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME);
54 printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
55 exit (status);
58 int
59 main (int argc, char **argv)
61 initialize_main (&argc, &argv);
62 program_name = argv[0];
63 setlocale (LC_ALL, "");
64 bindtextdomain (PACKAGE, LOCALEDIR);
65 textdomain (PACKAGE);
67 atexit (close_stdout);
69 /* Recognize --help or --version only if it's the only command-line
70 argument. */
71 if (argc == 2)
73 if (STREQ (argv[1], "--help"))
74 usage (EXIT_STATUS);
76 if (STREQ (argv[1], "--version"))
77 version_etc (stdout, PROGRAM_NAME, GNU_PACKAGE, VERSION, AUTHORS,
78 (char *) NULL);
81 exit (EXIT_STATUS);