summaryrefslogtreecommitdiff
path: root/common/cli_hush.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2016-01-27 04:47:54 +0100
committerTom Rini <trini@konsulko.com>2016-02-08 10:10:36 -0500
commit13d3046fa392625f172d55cba8eb551f47e45f3f (patch)
tree9aa038969d79cf48fcd38bc27cfa6478738f949e /common/cli_hush.c
parentdffceb4b15e4c5fd2487e625a08062a8120bd17f (diff)
hush: Pull out U-Boot prompt display and read functionality
Pull the code which displays U-Boot prompt and reads the command line into a separate function. No functional change. 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.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 2fbfdbe89a..cbaf22e912 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -974,6 +974,20 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str)
}
#endif
+#ifdef __U_BOOT__
+static int uboot_cli_readline(struct in_str *i)
+{
+ char *prompt;
+
+ if (i->promptmode == 1)
+ prompt = CONFIG_SYS_PROMPT;
+ else
+ prompt = CONFIG_SYS_PROMPT_HUSH_PS2;
+
+ return cli_readline(prompt);
+}
+#endif
+
static void get_user_input(struct in_str *i)
{
#ifndef __U_BOOT__
@@ -1003,11 +1017,8 @@ static void get_user_input(struct in_str *i)
bootretry_reset_cmd_timeout();
i->__promptme = 1;
- if (i->promptmode == 1) {
- n = cli_readline(CONFIG_SYS_PROMPT);
- } else {
- n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
- }
+ n = uboot_cli_readline(i);
+
#ifdef CONFIG_BOOT_RETRY_TIME
if (n == -2) {
puts("\nTimeout waiting for command\n");