From 8227d89247e718202f7eba746817d3a861080aad Mon Sep 17 00:00:00 2001 From: Lifang Zhang Date: Fri, 23 Jul 2021 11:04:56 +0300 Subject: helper: cli: add new API function odph_cli_log_va() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This new function is similar to odph_cli_log() except that it takes its arguments as a va_list. Signed-off-by: Lifang Zhang Reviewed-by: Matias Elo Reviewed-by: Jere Leppänen --- helper/cli.c | 9 +++++++++ helper/include/odp/helper/cli.h | 15 +++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'helper') diff --git a/helper/cli.c b/helper/cli.c index ef208c64d..81d41a58a 100644 --- a/helper/cli.c +++ b/helper/cli.c @@ -528,6 +528,15 @@ int odph_cli_log(const char *fmt, ...) return r; } +ODP_PRINTF_FORMAT(1, 0) +int odph_cli_log_va(const char *fmt, va_list in_args) +{ + int r; + + r = cli_log_va(ODP_LOG_PRINT, fmt, in_args); + return r; +} + static int msg_recv(int fd) { uint32_t msg; diff --git a/helper/include/odp/helper/cli.h b/helper/include/odp/helper/cli.h index 1c7a27bfd..6b8992926 100644 --- a/helper/include/odp/helper/cli.h +++ b/helper/include/odp/helper/cli.h @@ -24,6 +24,7 @@ extern "C" { #include #include #include +#include /** * @addtogroup odph_cli ODPH CLI @@ -146,6 +147,20 @@ int odph_cli_stop(void); */ int odph_cli_log(const char *fmt, ...); +/** + * Print to CLI + * + * Similar to odph_cli_log(), except that this one takes its arguments as + * a va_list. + * + * @param fmt printf-style message format + * @param in_args variadic arguments + * @return On success, the number of characters printed or buffered, without + * accounting for any line feed conversions. If an error is encountered, + * a negative value is returned. + */ +int odph_cli_log_va(const char *fmt, va_list in_args); + /** * Terminate CLI helper * -- cgit v1.2.3