summaryrefslogtreecommitdiff
path: root/common/main.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-01-09 21:34:46 +0100
committerWolfgang Denk <wd@denx.de>2008-01-09 21:34:46 +0100
commit3b93020d74630f0574cbd26d200a82c00dd11eaa (patch)
treefdf53ce4da01d337ceb71cadf496a9fc8d2fb62c /common/main.c
parentc83d7ca4dadd44ae430235077f63b64a11f36f6e (diff)
parent6007f3251c0967adc13f2ed8be1b924ddc30124d (diff)
downloadu-boot-imx-3b93020d74630f0574cbd26d200a82c00dd11eaa.zip
u-boot-imx-3b93020d74630f0574cbd26d200a82c00dd11eaa.tar.gz
u-boot-imx-3b93020d74630f0574cbd26d200a82c00dd11eaa.tar.bz2
Merge branch 'master' of /home/wd/git/u-boot/master/
Diffstat (limited to 'common/main.c')
-rw-r--r--common/main.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/common/main.c b/common/main.c
index 379695c..4253eac 100644
--- a/common/main.c
+++ b/common/main.c
@@ -696,7 +696,7 @@ static void cread_add_str(char *str, int strsize, int insert, unsigned long *num
}
}
-static int cread_line(char *buf, unsigned int *len)
+static int cread_line(const char *const prompt, char *buf, unsigned int *len)
{
unsigned long num = 0;
unsigned long eol_num = 0;
@@ -818,6 +818,7 @@ static int cread_line(char *buf, unsigned int *len)
insert = !insert;
break;
case CTL_CH('x'):
+ case CTL_CH('u'):
BEGINNING_OF_LINE();
ERASE_TO_EOL();
break;
@@ -867,6 +868,27 @@ static int cread_line(char *buf, unsigned int *len)
REFRESH_TO_EOL();
continue;
}
+#ifdef CONFIG_AUTO_COMPLETE
+ case '\t': {
+ int num2, col;
+
+ /* do not autocomplete when in the middle */
+ if (num < eol_num) {
+ getcmd_cbeep();
+ break;
+ }
+
+ buf[num] = '\0';
+ col = strlen(prompt) + eol_num;
+ num2 = num;
+ if (cmd_auto_complete(prompt, buf, &num2, &col)) {
+ col = num2 - num;
+ num += col;
+ eol_num += col;
+ }
+ break;
+ }
+#endif
default:
cread_add_char(ichar, insert, &num, &eol_num, buf, *len);
break;
@@ -909,7 +931,7 @@ int readline (const char *const prompt)
puts (prompt);
- rc = cread_line(p, &len);
+ rc = cread_line(prompt, p, &len);
return rc < 0 ? rc : len;
#else
char *p = console_buffer;