summaryrefslogtreecommitdiff
path: root/src/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/env.c b/src/env.c
index 8f677359c..a0d81191d 100644
--- a/src/env.c
+++ b/src/env.c
@@ -85,6 +85,7 @@
#include "system.h"
#include "error.h"
+#include "long-options.h"
int putenv ();
@@ -93,18 +94,10 @@ extern char **environ;
/* The name by which this program was run. */
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 longopts[] =
{
- {"help", no_argument, &show_help, 1},
{"ignore-environment", no_argument, NULL, 'i'},
{"unset", required_argument, NULL, 'u'},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
@@ -146,6 +139,9 @@ main (register int argc, register char **argv, char **envp)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "env", GNU_PACKAGE, VERSION,
+ "Richard Mlynarik and David MacKenzie", usage);
+
while ((optc = getopt_long (argc, argv, "+iu:", longopts, NULL)) != -1)
{
switch (optc)
@@ -162,15 +158,6 @@ main (register int argc, register char **argv, char **envp)
}
}
- if (show_version)
- {
- printf ("env (%s) %s\n", GNU_PACKAGE, VERSION);
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (optind != argc && !strcmp (argv[optind], "-"))
ignore_environment = 1;