summaryrefslogtreecommitdiffstats
path: root/common/cmd_pxe.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-03-30 21:30:55 +0000
committerWolfgang Denk <wd@denx.de>2012-08-09 22:06:03 +0200
commitd51004a832a9784f4c6af5482d4dace6bfd938c4 (patch)
tree0817bdb51d21cd55b64e8eecdc5de7fd06e1a058 /common/cmd_pxe.c
parent213adf6dffe44d909db0efc5ecbdc047bb029438 (diff)
downloadtalos-obmc-uboot-d51004a832a9784f4c6af5482d4dace6bfd938c4.tar.gz
talos-obmc-uboot-d51004a832a9784f4c6af5482d4dace6bfd938c4.zip
Add run_command_list() to run a list of commands
This new function runs a list of commands separated by semicolon or newline. We move this out of cmd_source so that it can be used by other code. The PXE code also uses the new function. Suggested-by: Michael Walle <michael@walle.cc> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/cmd_pxe.c')
-rw-r--r--common/cmd_pxe.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 77a7dd17ac..6b31deab5b 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -554,33 +554,19 @@ static void label_print(void *data)
*/
static int label_localboot(struct pxe_label *label)
{
- char *localcmd, *dupcmd;
- int ret;
+ char *localcmd;
localcmd = from_env("localcmd");
if (!localcmd)
return -ENOENT;
- /*
- * dup the command to avoid any issues with the version of it existing
- * in the environment changing during the execution of the command.
- */
- dupcmd = strdup(localcmd);
-
- if (!dupcmd)
- return -ENOMEM;
-
if (label->append)
setenv("bootargs", label->append);
- printf("running: %s\n", dupcmd);
-
- ret = run_command(dupcmd, 0);
+ debug("running: %s\n", localcmd);
- free(dupcmd);
-
- return ret;
+ return run_command_list(localcmd, strlen(localcmd), 0);
}
/*
OpenPOWER on IntegriCloud