]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(GETOPT_HELP_CHAR): Define.
authorJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 04:12:41 +0000 (04:12 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 04:12:41 +0000 (04:12 +0000)
(GETOPT_VERSION_CHAR): Define.
(GETOPT_HELP_OPTION_DECL): Define.
(GETOPT_VERSION_OPTION_DECL): Define.
(case_GETOPT_HELP_CHAR): Define.
(case_GETOPT_VERSION_CHAR): Define.

src/sys2.h

index 768ff9ea582714339022e6b80f687f919aa104e8..cea44a098e293ad1cb0fbe279c69020764fcdc7d 100644 (file)
@@ -249,3 +249,25 @@ off_t lseek ();
 #endif
 
 char *base_name PARAMS ((char const *));
+
+/* Factor out some of the common --help and --version processing code.  */
+
+#define GETOPT_HELP_CHAR 250
+#define GETOPT_VERSION_CHAR 251
+
+#define GETOPT_HELP_OPTION_DECL \
+  "help", no_argument, 0, GETOPT_HELP_CHAR
+#define GETOPT_VERSION_OPTION_DECL \
+  "version", no_argument, 0, GETOPT_VERSION_CHAR
+
+#define case_GETOPT_HELP_CHAR                  \
+  case GETOPT_HELP_CHAR:                       \
+    usage (EXIT_SUCCESS);                      \
+    break;
+
+#define case_GETOPT_VERSION_CHAR(Program_name, Authors)                        \
+  case GETOPT_VERSION_CHAR:                                            \
+    version_etc (stdout, Program_name, GNU_PACKAGE, VERSION, Authors); \
+    close_stdout ();                                                   \
+    exit (EXIT_SUCCESS);                                               \
+    break;