2003-01-03 21:38:27 +00:00
|
|
|
/* Exit with a status code indicating success.
|
2005-04-04 21:55:06 +00:00
|
|
|
Copyright (C) 1999-2003, 2005 Free Software Foundation, Inc.
|
2003-01-03 21:38:27 +00:00
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software Foundation,
|
2005-05-14 07:58:31 +00:00
|
|
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
2003-01-03 21:38:27 +00:00
|
|
|
|
1999-08-04 11:14:55 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include "system.h"
|
|
|
|
|
|
2005-07-18 07:53:05 +00:00
|
|
|
/* Act like "true" by default; false.c overrides this. */
|
|
|
|
|
#ifndef EXIT_STATUS
|
|
|
|
|
# define EXIT_STATUS EXIT_SUCCESS
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if EXIT_STATUS == EXIT_SUCCESS
|
|
|
|
|
# define PROGRAM_NAME "true"
|
|
|
|
|
#else
|
|
|
|
|
# define PROGRAM_NAME "false"
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-10-18 10:05:47 +00:00
|
|
|
#define AUTHORS "Jim Meyering"
|
1999-08-04 11:14:55 +00:00
|
|
|
|
|
|
|
|
/* The name this program was run with. */
|
|
|
|
|
char *program_name;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
usage (int status)
|
|
|
|
|
{
|
|
|
|
|
printf (_("\
|
1999-08-06 10:14:52 +00:00
|
|
|
Usage: %s [ignored command line arguments]\n\
|
1999-08-04 11:14:55 +00:00
|
|
|
or: %s OPTION\n\
|
2005-04-04 21:55:06 +00:00
|
|
|
"),
|
|
|
|
|
program_name, program_name);
|
2005-07-18 07:53:05 +00:00
|
|
|
printf ("%s\n\n",
|
|
|
|
|
_(EXIT_STATUS == EXIT_SUCCESS
|
|
|
|
|
? "Exit with a status code indicating success."
|
|
|
|
|
: "Exit with a status code indicating failure."));
|
2005-04-04 21:55:06 +00:00
|
|
|
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
|
|
|
|
fputs (VERSION_OPTION_DESCRIPTION, stdout);
|
2005-04-04 22:30:57 +00:00
|
|
|
printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME);
|
2002-07-02 09:09:10 +00:00
|
|
|
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
|
1999-08-04 11:14:55 +00:00
|
|
|
exit (status);
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-31 17:44:02 +00:00
|
|
|
int
|
1999-08-04 11:14:55 +00:00
|
|
|
main (int argc, char **argv)
|
1999-07-31 17:44:02 +00:00
|
|
|
{
|
2003-06-17 18:13:23 +00:00
|
|
|
initialize_main (&argc, &argv);
|
1999-08-04 11:14:55 +00:00
|
|
|
program_name = argv[0];
|
|
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
|
|
|
textdomain (PACKAGE);
|
|
|
|
|
|
2000-05-11 07:21:33 +00:00
|
|
|
atexit (close_stdout);
|
|
|
|
|
|
1999-08-04 11:14:55 +00:00
|
|
|
/* Recognize --help or --version only if it's the only command-line
|
2004-06-17 14:34:07 +00:00
|
|
|
argument. */
|
|
|
|
|
if (argc == 2)
|
1999-08-04 11:14:55 +00:00
|
|
|
{
|
|
|
|
|
if (STREQ (argv[1], "--help"))
|
2005-07-18 07:53:05 +00:00
|
|
|
usage (EXIT_STATUS);
|
1999-08-04 11:14:55 +00:00
|
|
|
|
|
|
|
|
if (STREQ (argv[1], "--version"))
|
2003-11-05 03:43:30 +00:00
|
|
|
version_etc (stdout, PROGRAM_NAME, GNU_PACKAGE, VERSION, AUTHORS,
|
|
|
|
|
(char *) NULL);
|
1999-08-04 11:14:55 +00:00
|
|
|
}
|
|
|
|
|
|
2005-07-18 07:53:05 +00:00
|
|
|
exit (EXIT_STATUS);
|
1999-07-31 17:44:02 +00:00
|
|
|
}
|