summaryrefslogtreecommitdiff
path: root/src/nl.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/nl.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/nl.c')
-rw-r--r--src/nl.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/nl.c b/src/nl.c
index e092e5109..4365686c8 100644
--- a/src/nl.c
+++ b/src/nl.c
@@ -24,12 +24,13 @@
#include <sys/types.h>
#include <getopt.h>
-#include "linebuffer.h"
#include "system.h"
#include <regex.h>
#include "error.h"
+#include "linebuffer.h"
+#include "long-options.h"
#include "xstrtol.h"
#ifndef TRUE
@@ -139,12 +140,6 @@ static int line_no;
/* Nonzero if we have ever read standard input. */
static int have_read_stdin;
-/* 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 longopts[] =
{
{"header-numbering", required_argument, NULL, 'h'},
@@ -158,8 +153,6 @@ static struct option const longopts[] =
{"number-width", required_argument, NULL, 'w'},
{"number-format", required_argument, NULL, 'n'},
{"section-delimiter", required_argument, NULL, 'd'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
@@ -452,6 +445,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "nl", GNU_PACKAGE, VERSION,
+ "Scott Bartram and David MacKenzie", usage);
+
have_read_stdin = 0;
while ((c = getopt_long (argc, argv, "h:b:f:v:i:pl:s:w:n:d:", longopts,
@@ -559,15 +555,6 @@ main (int argc, char **argv)
}
}
- if (show_version)
- {
- printf ("nl (%s) %s\n", GNU_PACKAGE, VERSION);
- exit (EXIT_SUCCESS);
- }
-
- if (show_help)
- usage (0);
-
/* Initialize the section delimiters. */
c = strlen (section_del);