aboutsummaryrefslogtreecommitdiff
path: root/coreutils/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/env.c')
-rw-r--r--coreutils/env.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/coreutils/env.c b/coreutils/env.c
index 3242446f5..20453e871 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -30,11 +30,6 @@
30//config: env is used to set an environment variable and run 30//config: env is used to set an environment variable and run
31//config: a command; without options it displays the current 31//config: a command; without options it displays the current
32//config: environment. 32//config: environment.
33//config:
34//config:config FEATURE_ENV_LONG_OPTIONS
35//config: bool "Enable long options"
36//config: default y
37//config: depends on ENV && LONG_OPTS
38 33
39//applet:IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env)) 34//applet:IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env))
40 35
@@ -53,23 +48,17 @@
53 48
54#include "libbb.h" 49#include "libbb.h"
55 50
56#if ENABLE_FEATURE_ENV_LONG_OPTIONS
57static const char env_longopts[] ALIGN1 =
58 "ignore-environment\0" No_argument "i"
59 "unset\0" Required_argument "u"
60 ;
61#endif
62
63int env_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 51int env_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
64int env_main(int argc UNUSED_PARAM, char **argv) 52int env_main(int argc UNUSED_PARAM, char **argv)
65{ 53{
66 unsigned opts; 54 unsigned opts;
67 llist_t *unset_env = NULL; 55 llist_t *unset_env = NULL;
68 56
69#if ENABLE_FEATURE_ENV_LONG_OPTIONS 57 opts = getopt32long(argv, "+iu:+",
70 applet_long_options = env_longopts; 58 "ignore-environment\0" No_argument "i"
71#endif 59 "unset\0" Required_argument "u"
72 opts = getopt32(argv, "+iu:+", &unset_env); 60 , &unset_env
61 );
73 argv += optind; 62 argv += optind;
74 if (argv[0] && LONE_DASH(argv[0])) { 63 if (argv[0] && LONE_DASH(argv[0])) {
75 opts |= 1; 64 opts |= 1;