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 --- include/common.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/common.h') diff --git a/include/common.h b/include/common.h index 39859d323f2..55025c0afd0 100644 --- a/include/common.h +++ b/include/common.h @@ -286,6 +286,19 @@ int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen); /* common/main.c */ void main_loop (void); int run_command(const char *cmd, int flag); + +/** + * Run a list of commands separated by ; or even \0 + * + * Note that if 'len' is not -1, then the command does not need to be nul + * terminated, Memory will be allocated for the command in that case. + * + * @param cmd List of commands to run, each separated bu semicolon + * @param len Length of commands excluding terminator if known (-1 if not) + * @param flag Execution flags (CMD_FLAG_...) + * @return 0 on success, or != 0 on error. + */ +int run_command_list(const char *cmd, int len, int flag); int readline (const char *const prompt); int readline_into_buffer(const char *const prompt, char *buffer, int timeout); -- cgit v1.2.3