diff options
Diffstat (limited to 'src/uname.c')
-rw-r--r-- | src/uname.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/uname.c b/src/uname.c index 62b9e5f27..f2499b8e2 100644 --- a/src/uname.c +++ b/src/uname.c @@ -40,6 +40,7 @@ #include "system.h" #include "error.h" +#include "long-options.h" static void print_element PARAMS ((unsigned int mask, char *element)); @@ -68,21 +69,13 @@ static unsigned char toprint; /* 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; - static struct option const long_options[] = { - {"help", no_argument, &show_help, 1}, {"machine", no_argument, NULL, 'm'}, {"nodename", no_argument, NULL, 'n'}, {"release", no_argument, NULL, 'r'}, {"sysname", no_argument, NULL, 's'}, {"processor", no_argument, NULL, 'p'}, - {"version", no_argument, &show_version, 1}, {"all", no_argument, NULL, 'a'}, {NULL, 0, NULL, 0} }; @@ -125,6 +118,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + parse_long_options (argc, argv, "uname", GNU_PACKAGE, VERSION, + "David MacKenzie", usage); + toprint = 0; while ((c = getopt_long (argc, argv, "snrvpma", long_options, NULL)) != -1) @@ -168,15 +164,6 @@ main (int argc, char **argv) } } - if (show_version) - { - printf ("uname (%s) %s\n", GNU_PACKAGE, VERSION); - exit (0); - } - - if (show_help) - usage (0); - if (optind != argc) usage (1); |