summaryrefslogtreecommitdiff
path: root/common/cli_hush.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2016-01-27 04:47:55 +0100
committerTom Rini <trini@konsulko.com>2016-02-08 10:10:37 -0500
commitf3b267b3a229e328bf765ffbb8cb2af382bbfa63 (patch)
tree9af8709d22441583a5757056f3eee2796404913e /common/cli_hush.c
parent13d3046fa392625f172d55cba8eb551f47e45f3f (diff)
hush: Add rudimentary support for PS1 and PS2
Add trivial support for changing the U-Boot command prompt string by setting PS1 and PS2 environment variables. Only static variables are supported. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/cli_hush.c')
-rw-r--r--common/cli_hush.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/cli_hush.c b/common/cli_hush.c
index cbaf22e9129..00861e2d9e4 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -978,12 +978,22 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str)
static int uboot_cli_readline(struct in_str *i)
{
char *prompt;
+ char __maybe_unused *ps_prompt = NULL;
if (i->promptmode == 1)
prompt = CONFIG_SYS_PROMPT;
else
prompt = CONFIG_SYS_PROMPT_HUSH_PS2;
+#ifdef CONFIG_CMDLINE_PS_SUPPORT
+ if (i->promptmode == 1)
+ ps_prompt = getenv("PS1");
+ else
+ ps_prompt = getenv("PS2");
+ if (ps_prompt)
+ prompt = ps_prompt;
+#endif
+
return cli_readline(prompt);
}
#endif