diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-09-15 14:08:31 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-18 11:01:19 +0200 |
commit | 932481a005cc7b2933791a349a312af0149b6c94 (patch) | |
tree | f2ad8701e842a301c97cffcfa0c40539aa42c0d9 /common | |
parent | fbf145dc86832846465a317619dd4d61af3897b3 (diff) | |
download | barebox-932481a005cc7b2933791a349a312af0149b6c94.tar.gz barebox-932481a005cc7b2933791a349a312af0149b6c94.tar.xz |
commands: setenv: allow use with hush shell
setenv was so far restricted to the simple shell, because with hush,
users could just do dev.var=VAL for setting variables in the
environment. The hush syntax doesn't allow for setting all kinds of
environment variables though, e.g.
5c00a000.tamp@5c00a000:reboot-mode.of.param
can't be set with hush, because of the special characters. It could
still be read by using the ${variable} syntax though.
Allow setting these variables by making the setenv command generally
available. The default is chosen to be 'y', because the command is
deemed small and useful enough to have it there by default.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 1 | ||||
-rw-r--r-- | common/complete.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/common/Kconfig b/common/Kconfig index 140b0f95c1..4ba58e55d4 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -411,6 +411,7 @@ choice select COMMAND_SUPPORT select PARAMETER select STDDEV + select CMD_SETENV help simple shell. No if/then, no return values from commands, no loops diff --git a/common/complete.c b/common/complete.c index 919e5abc6a..36e10405c8 100644 --- a/common/complete.c +++ b/common/complete.c @@ -336,6 +336,12 @@ static int env_param_complete(struct string_list *sl, char *instr, int eval) return 0; } +int env_param_noeval_complete(struct string_list *sl, char *instr) +{ + return env_param_complete(sl, instr, 0); +} +EXPORT_SYMBOL(env_param_noeval_complete); + static int tab_pressed = 0; void complete_reset(void) |