Advertisement
Guest User

Untitled

a guest
Jan 20th, 2012
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. ## true
  2. /* Exit with a status code indicating success.
  3. Copyright (C) 1999-2003, 2005, 2007 Free Software Foundation, Inc.
  4.  
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  17.  
  18. #include <config.h>
  19. #include <stdio.h>
  20. #include <sys/types.h>
  21. #include "system.h"
  22.  
  23. /* Act like "true" by default; false.c overrides this. */
  24. #ifndef EXIT_STATUS
  25. # define EXIT_STATUS EXIT_SUCCESS
  26. #endif
  27.  
  28. #if EXIT_STATUS == EXIT_SUCCESS
  29. # define PROGRAM_NAME "true"
  30. #else
  31. # define PROGRAM_NAME "false"
  32. #endif
  33.  
  34. #define AUTHORS "Jim Meyering"
  35.  
  36. /* The name this program was run with. */
  37. char *program_name;
  38.  
  39. void
  40. usage (int status)
  41. {
  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. emit_bug_reporting_address ();
  55. exit (status);
  56. }
  57.  
  58. int
  59. main (int argc, char **argv)
  60. {
  61. initialize_main (&argc, &argv);
  62. program_name = argv[0];
  63. setlocale (LC_ALL, "");
  64. bindtextdomain (PACKAGE, LOCALEDIR);
  65. textdomain (PACKAGE);
  66.  
  67. atexit (close_stdout);
  68.  
  69. /* Recognize --help or --version only if it's the only command-line
  70. argument. */
  71. if (argc == 2)
  72. {
  73. if (STREQ (argv[1], "--help"))
  74. usage (EXIT_STATUS);
  75.  
  76. if (STREQ (argv[1], "--version"))
  77. version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, VERSION, AUTHORS,
  78. (char *) NULL);
  79. }
  80.  
  81. exit (EXIT_STATUS);
  82. }
  83.  
  84. ##false
  85. #define EXIT_STATUS EXIT_FAILURE
  86. #include "true.c"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement