summaryrefslogtreecommitdiff
path: root/include/common.h
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 /include/common.h
parent213adf6dffe44d909db0efc5ecbdc047bb029438 (diff)
downloadu-boot-imx-d51004a832a9784f4c6af5482d4dace6bfd938c4.zip
u-boot-imx-d51004a832a9784f4c6af5482d4dace6bfd938c4.tar.gz
u-boot-imx-d51004a832a9784f4c6af5482d4dace6bfd938c4.tar.bz2
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 'include/common.h')
-rw-r--r--include/common.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index 39859d3..55025c0 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);