#include <common.h>
#include <watchdog.h>
#include <command.h>
-#include <malloc.h>
#ifdef CFG_HUSH_PARSER
#include <hush.h>
}
# if DEBUG_BOOTKEYS
if (!abort)
- printf("key timeout\n");
+ puts ("key timeout\n");
# endif
#ifdef CONFIG_SILENT_CONSOLE
if (bootdelay >= 0) {
if (tstc()) { /* we got a key press */
(void) getc(); /* consume input */
- printf ("\b\b\b 0");
+ puts ("\b\b\b 0");
abort = 1; /* don't auto boot */
}
}
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
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);
else if (len == -2) {
/* -2 means timed out, retry autoboot
*/
- printf("\nTimed out waiting for command\n");
+ puts ("\nTimed out waiting for command\n");
# ifdef CONFIG_RESET_TO_RETRY
/* Reinit board to run initialization code again */
do_reset (NULL, 0, 0, NULL);
#endif
if (len == -1)
- printf ("<INTERRUPT>\n");
+ puts ("<INTERRUPT>\n");
else
rc = run_command (lastcommand, flag);
puts ("\r\n");
return (p - console_buffer);
+ case '\0': /* nul */
+ continue;
+
case 0x03: /* ^C - break */
console_buffer[0] = '\0'; /* discard input */
return (-1);
*/
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 {
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;
}
break;
case 1: /* Waiting for ( */
- if (c == '(') {
+ if (c == '(' || c == '{') {
state++;
varname_start = input;
} else {
}
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 */
printf ("[%s]\n", finaltoken);
#endif
if (flag & CMD_FLAG_BOOTD) {
- printf ("'bootd' recursion detected\n");
+ puts ("'bootd' recursion detected\n");
rc = -1;
continue;
}