From 747244840b647991844556284aacdb3857440861 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 13 Jul 2022 06:06:59 -0600 Subject: fdt: Start a test for the fdt command Add a basic test of the 'fdt addr' command, to kick things off. This includes a new convenience function to run a command from a printf() string. Signed-off-by: Simon Glass --- common/cli.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common/cli.c') diff --git a/common/cli.c b/common/cli.c index a7e3d84b68..a47d6a3f2b 100644 --- a/common/cli.c +++ b/common/cli.c @@ -126,6 +126,21 @@ int run_command_list(const char *cmd, int len, int flag) return rcode; } +int run_commandf(const char *fmt, ...) +{ + va_list args; + char cmd[128]; + int i, ret; + + va_start(args, fmt); + i = vsnprintf(cmd, sizeof(cmd), fmt, args); + va_end(args); + + ret = run_command(cmd, 0); + + return ret; +} + /****************************************************************************/ #if defined(CONFIG_CMD_RUN) -- cgit v1.2.3