//config: env is used to set an environment variable and run
//config: a command; without options it displays the current
//config: environment.
-//config:
-//config:config FEATURE_ENV_LONG_OPTIONS
-//config: bool "Enable long options"
-//config: default y
-//config: depends on ENV && LONG_OPTS
//applet:IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env))
#include "libbb.h"
-#if ENABLE_FEATURE_ENV_LONG_OPTIONS
-static const char env_longopts[] ALIGN1 =
- "ignore-environment\0" No_argument "i"
- "unset\0" Required_argument "u"
- ;
-#endif
-
int env_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int env_main(int argc UNUSED_PARAM, char **argv)
{
unsigned opts;
llist_t *unset_env = NULL;
-#if ENABLE_FEATURE_ENV_LONG_OPTIONS
- applet_long_options = env_longopts;
-#endif
- opts = getopt32(argv, "+iu:+", &unset_env);
+ opts = getopt32long(argv, "+iu:*",
+ "ignore-environment\0" No_argument "i"
+ "unset\0" Required_argument "u"
+ , &unset_env
+ );
argv += optind;
if (argv[0] && LONE_DASH(argv[0])) {
opts |= 1;
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE