X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fmain.c;h=9f649dbcd31222b8850317270bd74e300828a3e4;hb=b2532eff87c73b11212dd63403ee9ae18c56b53a;hp=156e4bc3d8a3505cb8602a075f9295944f5c6d8f;hpb=27aa818670ad6776546ee3c1ad339b68866368ef;p=u-boot diff --git a/common/main.c b/common/main.c index 156e4bc3d8..9f649dbcd3 100644 --- a/common/main.c +++ b/common/main.c @@ -365,6 +365,10 @@ void main_loop (void) u_boot_hush_start (); #endif +#ifdef CONFIG_AUTO_COMPLETE + install_auto_complete(); +#endif + #ifdef CONFIG_PREBOOT if ((p = getenv ("preboot")) != NULL) { # ifdef CONFIG_AUTOBOOT_KEYED @@ -428,7 +432,7 @@ void main_loop (void) s = getenv("menucmd"); if (s) { # ifndef CFG_HUSH_PARSER - run_command (s, bd, 0); + run_command (s, 0); # else parse_string_outer(s, FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP); @@ -608,6 +612,14 @@ int readline (const char *const prompt) */ if (n < CFG_CBSIZE-2) { if (c == '\t') { /* expand TABs */ +#ifdef CONFIG_AUTO_COMPLETE + /* if auto completion triggered just continue */ + *p = '\0'; + if (cmd_auto_complete(prompt, console_buffer, &n, &col)) { + p = console_buffer + n; /* reset */ + continue; + } +#endif puts (tab_seq+(col&07)); col += 8 - (col&07); } else { @@ -714,8 +726,8 @@ static void process_macros (const char *input, char *output) int inputcnt = strlen (input); int outputcnt = CFG_CBSIZE; int state = 0; /* 0 = waiting for '$' */ - /* 1 = waiting for '(' */ - /* 2 = waiting for ')' */ + /* 1 = waiting for '(' or '{' */ + /* 2 = waiting for ')' or '}' */ /* 3 = waiting for ''' */ #ifdef DEBUG_PARSER char *output_start = output; @@ -753,7 +765,7 @@ static void process_macros (const char *input, char *output) } break; case 1: /* Waiting for ( */ - if (c == '(') { + if (c == '(' || c == '{') { state++; varname_start = input; } else { @@ -768,7 +780,7 @@ static void process_macros (const char *input, char *output) } break; case 2: /* Waiting for ) */ - if (c == ')') { + if (c == ')' || c == '}') { int i; char envname[CFG_CBSIZE], *envval; int envcnt = input-varname_start-1; /* Varname # of chars */