summaryrefslogtreecommitdiff
path: root/src/od.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-03-04 05:36:10 +0000
committerJim Meyering <jim@meyering.net>1999-03-04 05:36:10 +0000
commit88cbad981787d34f3dc8118bde16416c12a50421 (patch)
tree1a8993c9e22726767a534efd76dd619bfc80752d /src/od.c
parent0ae96f236175101ddc6c8f0eaf46d08f88173486 (diff)
downloadcoreutils-88cbad981787d34f3dc8118bde16416c12a50421.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/od.c')
-rw-r--r--src/od.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/od.c b/src/od.c
index bfa623183..03eba9366 100644
--- a/src/od.c
+++ b/src/od.c
@@ -24,8 +24,9 @@
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
-#include "xstrtoul.h"
#include "error.h"
+#include "long-options.h"
+#include "xstrtoul.h"
#if defined(__GNUC__) || defined(STDC_HEADERS)
# include <float.h>
@@ -239,12 +240,6 @@ static enum size_spec integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1];
#define MAX_FP_TYPE_SIZE sizeof(LONG_DOUBLE)
static enum size_spec fp_type_size[MAX_FP_TYPE_SIZE + 1];
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output then exit. */
-static int show_version;
-
static struct option const long_options[] =
{
/* POSIX options. */
@@ -258,8 +253,6 @@ static struct option const long_options[] =
{"strings", optional_argument, NULL, 's'},
{"traditional", no_argument, NULL, 'B'},
{"width", optional_argument, NULL, 'w'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
@@ -1600,6 +1593,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "od", GNU_PACKAGE, VERSION,
+ "Jim Meyering", usage);
+
err = 0;
for (i = 0; i <= MAX_INTEGRAL_TYPE_SIZE; i++)
@@ -1769,15 +1765,6 @@ the maximum\nrepresentable value of type `long'"), optarg);
if (n_failed_decodes > 0)
exit (EXIT_FAILURE);
- if (show_version)
- {
- printf ("od (%s) %s\n", GNU_PACKAGE, VERSION);
- exit (EXIT_SUCCESS);
- }
-
- if (show_help)
- usage (0);
-
if (flag_dump_strings && n_specs > 0)
error (EXIT_FAILURE, 0,
_("no type may be specified when dumping strings"));