diff options
Diffstat (limited to 'src/printenv.c')
-rw-r--r-- | src/printenv.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/printenv.c b/src/printenv.c index 3ac1f25ad..6496392ee 100644 --- a/src/printenv.c +++ b/src/printenv.c @@ -35,20 +35,13 @@ #include "system.h" #include "closeout.h" #include "error.h" +#include "long-options.h" /* The name this program was run with. */ 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}, - {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -88,6 +81,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + parse_long_options (argc, argv, "printenv", GNU_PACKAGE, VERSION, + "David MacKenzie and Richard Mlynarik", usage); + while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1) { switch (c) @@ -100,15 +96,6 @@ main (int argc, char **argv) } } - if (show_version) - { - printf ("printenv (%s) %s\n", GNU_PACKAGE, VERSION); - exit (0); - } - - if (show_help) - usage (0); - if (optind == argc) { for (env = environ; *env != NULL; ++env) |