From 3591293509e0c0bcf244b0f974775bff2e25697e Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Wed, 10 Sep 2008 09:43:49 +0300 Subject: autoscr: Fix one-character lines and non-newline terminated scripts When not using hush, the autoscr command now executes lines that are only one character long. It also runs the last line of scripts even if it does not end in a newline. Signed-off-by: Petri Lehtinen --- common/cmd_autoscript.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common/cmd_autoscript.c') diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c index c2e7e665aad..0439da2cd3b 100644 --- a/common/cmd_autoscript.c +++ b/common/cmd_autoscript.c @@ -180,7 +180,7 @@ autoscript (ulong addr, const char *fit_uname) if (*next == '\n') { *next = '\0'; /* run only non-empty commands */ - if ((next - line) > 1) { + if (*line) { debug ("** exec: \"%s\"\n", line); if (run_command (line, 0) < 0) { @@ -192,6 +192,8 @@ autoscript (ulong addr, const char *fit_uname) } ++next; } + if (rcode == 0 && *line) + rcode = (run_command(line, 0) >= 0); } #endif free (cmd); -- cgit v1.2.3 From 6d0f6bcf337c5261c08fabe12982178c2c489d76 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Thu, 16 Oct 2008 15:01:15 +0200 Subject: rename CFG_ macros to CONFIG_SYS Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- common/cmd_autoscript.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common/cmd_autoscript.c') diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c index 0439da2cd3b..4517ac83c76 100644 --- a/common/cmd_autoscript.c +++ b/common/cmd_autoscript.c @@ -43,7 +43,7 @@ #if defined(CONFIG_8xx) #include #endif -#ifdef CFG_HUSH_PARSER +#ifdef CONFIG_SYS_HUSH_PARSER #include #endif @@ -164,7 +164,7 @@ autoscript (ulong addr, const char *fit_uname) memmove (cmd, (char *)data, len); *(cmd + len) = 0; -#ifdef CFG_HUSH_PARSER /*?? */ +#ifdef CONFIG_SYS_HUSH_PARSER /*?? */ rcode = parse_string_outer (cmd, FLAG_PARSE_SEMICOLON); #else { @@ -211,7 +211,7 @@ do_autoscript (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* Find script image */ if (argc < 2) { - addr = CFG_LOAD_ADDR; + addr = CONFIG_SYS_LOAD_ADDR; debug ("* autoscr: default load address = 0x%08lx\n", addr); #if defined(CONFIG_FIT) } else if (fit_parse_subimage (argv[1], load_addr, &addr, &fit_uname)) { -- cgit v1.2.3