aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
authorLifang Zhang <lifang.zhang@nokia.com>2021-07-23 11:04:56 +0300
committerMatias Elo <matias.elo@nokia.com>2021-09-30 14:27:54 +0300
commit8227d89247e718202f7eba746817d3a861080aad (patch)
tree14541a6b1065e73a540a2b76e8674562a7ef5808 /helper
parentad67a7c251c8f6fc4630666dfd705f45ba56e6bc (diff)
helper: cli: add new API function odph_cli_log_va()
This new function is similar to odph_cli_log() except that it takes its arguments as a va_list. Signed-off-by: Lifang Zhang <lifang.zhang@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r--helper/cli.c9
-rw-r--r--helper/include/odp/helper/cli.h15
2 files changed, 24 insertions, 0 deletions
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 <odp_api.h>
#include <odp/helper/ip.h>
#include <stdint.h>
+#include <stdarg.h>
/**
* @addtogroup odph_cli ODPH CLI
@@ -147,6 +148,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
*
* Free any resources allocated by the CLI helper.