From d51004a832a9784f4c6af5482d4dace6bfd938c4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 30 Mar 2012 21:30:55 +0000 Subject: 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 Signed-off-by: Simon Glass --- common/cmd_pxe.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'common/cmd_pxe.c') 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); } /* -- cgit v1.2.1