//config: Enable pseudorandom generator and dynamic variable "$RANDOM".
//config: Each read of "$RANDOM" will generate a new pseudorandom value.
//config:
-//config:config HUSH_EXPORT_N
-//config: bool "Support 'export -n' option"
-//config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
-//config: help
-//config: export -n unexports variables. It is a bash extension.
-//config:
//config:config HUSH_MODE_X
//config: bool "Support 'hush -x' option and 'set -x' command"
//config: default y
//config: This instructs hush to print commands before execution.
//config: Adds ~300 bytes.
//config:
+//config:config HUSH_EXPORT
+//config: bool "export builtin"
+//config: default y
+//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
+//config: help
+//config: Enable export builtin in hush.
+//config:
+//config:config HUSH_EXPORT_N
+//config: bool "Support 'export -n' option"
+//config: default y
+//config: depends on HUSH_EXPORT
+//config: help
+//config: export -n unexports variables. It is a bash extension.
+//config:
//config:config HUSH_HELP
//config: bool "help builtin"
//config: default y
static int builtin_eval(char **argv) FAST_FUNC;
static int builtin_exec(char **argv) FAST_FUNC;
static int builtin_exit(char **argv) FAST_FUNC;
+#if ENABLE_HUSH_EXPORT
static int builtin_export(char **argv) FAST_FUNC;
+#endif
#if ENABLE_HUSH_JOB
static int builtin_fg_bg(char **argv) FAST_FUNC;
static int builtin_jobs(char **argv) FAST_FUNC;
BLTIN("eval" , builtin_eval , "Construct and run shell command"),
BLTIN("exec" , builtin_exec , "Execute command, don't return to shell"),
BLTIN("exit" , builtin_exit , "Exit"),
+#if ENABLE_HUSH_EXPORT
BLTIN("export" , builtin_export , "Set environment variables"),
+#endif
#if ENABLE_HUSH_JOB
BLTIN("fg" , builtin_fg_bg , "Bring job into the foreground"),
#endif
} while (*s);
}
-#if !ENABLE_HUSH_LOCAL
+#if ENABLE_HUSH_EXPORT || ENABLE_HUSH_LOCAL
+# if !ENABLE_HUSH_LOCAL
#define helper_export_local(argv, exp, lvl) \
helper_export_local(argv, exp)
-#endif
+# endif
static void helper_export_local(char **argv, int exp, int lvl)
{
do {
continue;
}
}
-#if ENABLE_HUSH_LOCAL
+# if ENABLE_HUSH_LOCAL
if (exp == 0 /* local? */
&& var && var->func_nest_level == lvl
) {
/* "local x=abc; ...; local x" - ignore second local decl */
continue;
}
-#endif
+# endif
/* Exporting non-existing variable.
* bash does not put it in environment,
* but remembers that it is exported,
set_local_var(name, /*exp:*/ exp, /*lvl:*/ lvl, /*ro:*/ 0);
} while (*++argv);
}
+#endif
+#if ENABLE_HUSH_EXPORT
static int FAST_FUNC builtin_export(char **argv)
{
unsigned opt_unexport;
return EXIT_SUCCESS;
}
+#endif
#if ENABLE_HUSH_LOCAL
static int FAST_FUNC builtin_local(char **argv)