From 5b2aa1846bc8dc6d8ffce7d523cebc1ab45a17d7 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 6 Mar 1999 15:28:54 +0000 Subject: Include long-options.h. [long_options]: Remove the "help" and "version" entries. Remove declarations of show_help and show_version. (main): Use parse_long_options, including author name(s). Remove the show_version and show_help blocks. --- src/date.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'src/date.c') diff --git a/src/date.c b/src/date.c index e6429fa46..b38c5f036 100644 --- a/src/date.c +++ b/src/date.c @@ -24,9 +24,10 @@ #include "system.h" #include "closeout.h" -#include "getline.h" #include "error.h" #include "getdate.h" +#include "getline.h" +#include "long-options.h" #include "posixtm.h" #ifndef STDC_HEADERS @@ -44,12 +45,6 @@ static void show_date PARAMS ((const char *format, time_t when)); /* The name this program was run with, for error messages. */ char *program_name; -/* If nonzero, display usage information and exit. */ -static int show_help; - -/* If nonzero, print the version on standard output and exit. */ -static int show_version; - /* If non-zero, display time in RFC-822 format for mail or news. */ static int rfc_format = 0; @@ -60,14 +55,12 @@ static struct option const long_options[] = { {"date", required_argument, NULL, 'd'}, {"file", required_argument, NULL, 'f'}, - {"help", no_argument, &show_help, 1}, {"reference", required_argument, NULL, 'r'}, {"rfc-822", no_argument, NULL, 'R'}, {"set", required_argument, NULL, 's'}, {"uct", no_argument, NULL, 'u'}, {"utc", no_argument, NULL, 'u'}, {"universal", no_argument, NULL, 'u'}, - {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -287,6 +280,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + parse_long_options (argc, argv, "date", GNU_PACKAGE, VERSION, + "David MacKenzie", usage); + while ((optc = getopt_long (argc, argv, "d:f:r:Rs:u", long_options, NULL)) != -1) switch (optc) @@ -316,15 +312,6 @@ main (int argc, char **argv) usage (1); } - if (show_version) - { - printf ("date (%s) %s\n", GNU_PACKAGE, VERSION); - exit (0); - } - - if (show_help) - usage (0); - n_args = argc - optind; option_specified_date = ((datestr ? 1 : 0) -- cgit v1.2.3-54-g00ecf