summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2019-06-27 00:17:27 +0200
committerTom Rini <trini@konsulko.com>2019-07-18 11:31:25 -0400
commit4225f830c56d6a8f6e459bce8cec310a58a9df28 (patch)
treea3c9312841756f7caea73b7abdfa129c99709b40 /common
parentaa2067a8692ece9b4ce470a2c6c6704987bfd56c (diff)
downloadu-boot-4225f830c56d6a8f6e459bce8cec310a58a9df28.tar.gz
u-boot-4225f830c56d6a8f6e459bce8cec310a58a9df28.tar.bz2
u-boot-4225f830c56d6a8f6e459bce8cec310a58a9df28.zip
common: Fix autocompletion with CONFIG_CMDLINE_PS_SUPPORT
The autocompletion did not work if CONFIG_CMDLINE_PS_SUPPORT was enabled because U-Boot was comparing the prompt string with CONFIG_SYS_PROMPT . While this works if CONFIG_CMDLINE_PS_SUPPORT is disabled, this no longer works if it's enabled because user can override the PS1 . Fix this by checking prompt string against the current PS1 value. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common')
-rw-r--r--common/command.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/command.c b/common/command.c
index e192bb2a61..db25bf54e0 100644
--- a/common/command.c
+++ b/common/command.c
@@ -356,8 +356,13 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
int i, j, k, len, seplen, argc;
int cnt;
char last_char;
+#ifdef CONFIG_CMDLINE_PS_SUPPORT
+ const char *ps_prompt = env_get("PS1");
+#else
+ const char *ps_prompt = CONFIG_SYS_PROMPT;
+#endif
- if (strcmp(prompt, CONFIG_SYS_PROMPT) != 0)
+ if (strcmp(prompt, ps_prompt) != 0)
return 0; /* not in normal console */
cnt = strlen(buf);