Skip to contentSkip to conversation

autoscr: Fix one-character lines and non-newline terminated scripts

PATCH New Petri Lehtinen 2 participants 2 messages Sep 10, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 common/cmd_autoscript.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
common/cmd_autoscript.c +3 -1
index c2e7e66..0439da2 100644
@@ -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);
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 1/1 autoscr: Fix one-character lines and non-newline terminated scripts

Dear Petri Lehtinen,

Quoted 8 lines · In message <[email protected]> you wrote:

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.

---
 common/cmd_autoscript.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The rule on staying alive as a program manager is to give 'em a  num-
ber or give 'em a date, but never give 'em both at once.