|
@@ -83,8 +83,7 @@ extern void mdm_init(void); /* defined in board.c */
|
|
|
|
|
|
/***************************************************************************
|
|
/***************************************************************************
|
|
* Watch for 'delay' seconds for autoboot stop or autoboot delay string.
|
|
* Watch for 'delay' seconds for autoboot stop or autoboot delay string.
|
|
- * returns: 0 - no key string, allow autoboot
|
|
|
|
- * 1 - got key string, abort
|
|
|
|
|
|
+ * returns: 0 - no key string, allow autoboot 1 - got key string, abort
|
|
*/
|
|
*/
|
|
#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
|
|
#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
|
|
# if defined(CONFIG_AUTOBOOT_KEYED)
|
|
# if defined(CONFIG_AUTOBOOT_KEYED)
|
|
@@ -266,6 +265,26 @@ int abortboot(int bootdelay)
|
|
# endif /* CONFIG_AUTOBOOT_KEYED */
|
|
# endif /* CONFIG_AUTOBOOT_KEYED */
|
|
#endif /* CONFIG_BOOTDELAY >= 0 */
|
|
#endif /* CONFIG_BOOTDELAY >= 0 */
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Return 0 on success, or != 0 on error.
|
|
|
|
+ */
|
|
|
|
+static inline
|
|
|
|
+int run_command2(const char *cmd, int flag)
|
|
|
|
+{
|
|
|
|
+#ifndef CONFIG_SYS_HUSH_PARSER
|
|
|
|
+ /*
|
|
|
|
+ * run_command can return 0 or 1 for success, so clean up its result.
|
|
|
|
+ */
|
|
|
|
+ if (run_command(cmd, flag) == -1)
|
|
|
|
+ return 1;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+#else
|
|
|
|
+ return parse_string_outer(cmd,
|
|
|
|
+ FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP);
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
+
|
|
/****************************************************************************/
|
|
/****************************************************************************/
|
|
|
|
|
|
void main_loop (void)
|
|
void main_loop (void)
|
|
@@ -332,12 +351,7 @@ void main_loop (void)
|
|
int prev = disable_ctrlc(1); /* disable Control C checking */
|
|
int prev = disable_ctrlc(1); /* disable Control C checking */
|
|
# endif
|
|
# endif
|
|
|
|
|
|
-# ifndef CONFIG_SYS_HUSH_PARSER
|
|
|
|
- run_command (p, 0);
|
|
|
|
-# else
|
|
|
|
- parse_string_outer(p, FLAG_PARSE_SEMICOLON |
|
|
|
|
- FLAG_EXIT_FROM_LOOP);
|
|
|
|
-# endif
|
|
|
|
|
|
+ run_command2(p, 0);
|
|
|
|
|
|
# ifdef CONFIG_AUTOBOOT_KEYED
|
|
# ifdef CONFIG_AUTOBOOT_KEYED
|
|
disable_ctrlc(prev); /* restore Control C checking */
|
|
disable_ctrlc(prev); /* restore Control C checking */
|
|
@@ -382,12 +396,7 @@ void main_loop (void)
|
|
int prev = disable_ctrlc(1); /* disable Control C checking */
|
|
int prev = disable_ctrlc(1); /* disable Control C checking */
|
|
# endif
|
|
# endif
|
|
|
|
|
|
-# ifndef CONFIG_SYS_HUSH_PARSER
|
|
|
|
- run_command (s, 0);
|
|
|
|
-# else
|
|
|
|
- parse_string_outer(s, FLAG_PARSE_SEMICOLON |
|
|
|
|
- FLAG_EXIT_FROM_LOOP);
|
|
|
|
-# endif
|
|
|
|
|
|
+ run_command2(s, 0);
|
|
|
|
|
|
# ifdef CONFIG_AUTOBOOT_KEYED
|
|
# ifdef CONFIG_AUTOBOOT_KEYED
|
|
disable_ctrlc(prev); /* restore Control C checking */
|
|
disable_ctrlc(prev); /* restore Control C checking */
|
|
@@ -397,14 +406,8 @@ void main_loop (void)
|
|
# ifdef CONFIG_MENUKEY
|
|
# ifdef CONFIG_MENUKEY
|
|
if (menukey == CONFIG_MENUKEY) {
|
|
if (menukey == CONFIG_MENUKEY) {
|
|
s = getenv("menucmd");
|
|
s = getenv("menucmd");
|
|
- if (s) {
|
|
|
|
-# ifndef CONFIG_SYS_HUSH_PARSER
|
|
|
|
- run_command(s, 0);
|
|
|
|
-# else
|
|
|
|
- parse_string_outer(s, FLAG_PARSE_SEMICOLON |
|
|
|
|
- FLAG_EXIT_FROM_LOOP);
|
|
|
|
-# endif
|
|
|
|
- }
|
|
|
|
|
|
+ if (s)
|
|
|
|
+ run_command2(s, 0);
|
|
}
|
|
}
|
|
#endif /* CONFIG_MENUKEY */
|
|
#endif /* CONFIG_MENUKEY */
|
|
#endif /* CONFIG_BOOTDELAY */
|
|
#endif /* CONFIG_BOOTDELAY */
|
|
@@ -1403,14 +1406,9 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
|
|
printf ("## Error: \"%s\" not defined\n", argv[i]);
|
|
printf ("## Error: \"%s\" not defined\n", argv[i]);
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
-#ifndef CONFIG_SYS_HUSH_PARSER
|
|
|
|
- if (run_command (arg, flag) == -1)
|
|
|
|
- return 1;
|
|
|
|
-#else
|
|
|
|
- if (parse_string_outer(arg,
|
|
|
|
- FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
|
|
|
|
|
|
+
|
|
|
|
+ if (run_command2(arg, flag) != 0)
|
|
return 1;
|
|
return 1;
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|