summaryrefslogtreecommitdiff
path: root/src/date.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-03-06 15:28:54 +0000
committerJim Meyering <jim@meyering.net>1999-03-06 15:28:54 +0000
commit5b2aa1846bc8dc6d8ffce7d523cebc1ab45a17d7 (patch)
tree84329e3e3519feb76d3835f81928c4b657c495cf /src/date.c
parent782b27031417465b6d79e2d0d8c608b8ea842ce9 (diff)
downloadcoreutils-5b2aa1846bc8dc6d8ffce7d523cebc1ab45a17d7.tar.xz
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.
Diffstat (limited to 'src/date.c')
-rw-r--r--src/date.c23
1 files changed, 5 insertions, 18 deletions
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)