summaryrefslogtreecommitdiff
path: root/common/cmd_autoscript.c
diff options
context:
space:
mode:
authorPetri Lehtinen <petri.lehtinen@inoi.fi>2008-09-10 09:43:49 +0300
committerWolfgang Denk <wd@denx.de>2008-09-10 11:09:39 +0200
commit3591293509e0c0bcf244b0f974775bff2e25697e (patch)
tree69f5b437324599aca32d09e75edb5c4bee15d898 /common/cmd_autoscript.c
parent9ebbb54f7a25055010fa6668eba40c72a4c4f985 (diff)
downloadu-boot-imx-3591293509e0c0bcf244b0f974775bff2e25697e.zip
u-boot-imx-3591293509e0c0bcf244b0f974775bff2e25697e.tar.gz
u-boot-imx-3591293509e0c0bcf244b0f974775bff2e25697e.tar.bz2
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 <petri.lehtinen@inoi.fi>
Diffstat (limited to 'common/cmd_autoscript.c')
-rw-r--r--common/cmd_autoscript.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c
index c2e7e66..0439da2 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);