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/tty.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/tty.c') diff --git a/src/tty.c b/src/tty.c index 056cb935d..088a22565 100644 --- a/src/tty.c +++ b/src/tty.c @@ -30,6 +30,7 @@ #include "system.h" #include "closeout.h" #include "error.h" +#include "long-options.h" /* The name under which this program was run. */ char *program_name; @@ -37,18 +38,10 @@ char *program_name; /* If nonzero, return an exit status but produce no output. */ static int silent; -/* 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; - static struct option const longopts[] = { - {"help", no_argument, &show_help, 1}, {"silent", no_argument, NULL, 's'}, {"quiet", no_argument, NULL, 's'}, - {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -84,6 +77,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + parse_long_options (argc, argv, "tty", GNU_PACKAGE, VERSION, + "David MacKenzie", usage); + silent = 0; while ((optc = getopt_long (argc, argv, "s", longopts, NULL)) != -1) @@ -102,15 +98,6 @@ main (int argc, char **argv) } } - if (show_version) - { - printf ("tty (%s) %s\n", GNU_PACKAGE, VERSION); - exit (0); - } - - if (show_help) - usage (0); - if (optind != argc) usage (2); -- cgit v1.2.3-54-g00ecf