From: Dmitry Kozlyuk Date: Mon, 28 Sep 2020 21:50:49 +0000 (+0300) Subject: cmdline: add internal wrapper for vdprintf X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b5741b570482c59ef53a1ea1ac0ee266295ce6bc;p=dpdk.git cmdline: add internal wrapper for vdprintf Add internal wrapper for vdprintf(3) that is only available on Unix. Signed-off-by: Dmitry Kozlyuk Acked-by: Olivier Matz --- diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c index 0b2e1e30b7..49770869bb 100644 --- a/lib/librte_cmdline/cmdline.c +++ b/lib/librte_cmdline/cmdline.c @@ -131,7 +131,7 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...) if (cl->s_out < 0) return; va_start(ap, fmt); - vdprintf(cl->s_out, fmt, ap); + cmdline_vdprintf(cl->s_out, fmt, ap); va_end(ap); } diff --git a/lib/librte_cmdline/cmdline_os_unix.c b/lib/librte_cmdline/cmdline_os_unix.c index a4916c197e..64a945a34f 100644 --- a/lib/librte_cmdline/cmdline_os_unix.c +++ b/lib/librte_cmdline/cmdline_os_unix.c @@ -45,3 +45,9 @@ cmdline_read_char(struct cmdline *cl, char *c) { return read(cl->s_in, c, 1); } + +int +cmdline_vdprintf(int fd, const char *format, va_list op) +{ + return vdprintf(fd, format, op); +} diff --git a/lib/librte_cmdline/cmdline_private.h b/lib/librte_cmdline/cmdline_private.h index ac10de4f85..4d9ea33f06 100644 --- a/lib/librte_cmdline/cmdline_private.h +++ b/lib/librte_cmdline/cmdline_private.h @@ -5,6 +5,10 @@ #ifndef _CMDLINE_PRIVATE_H_ #define _CMDLINE_PRIVATE_H_ +#include + +#include + #include /* Disable buffering and echoing, save previous settings to oldterm. */ @@ -19,4 +23,8 @@ int cmdline_poll_char(struct cmdline *cl); /* Read one character from input. */ ssize_t cmdline_read_char(struct cmdline *cl, char *c); +/* vdprintf(3) */ +__rte_format_printf(2, 0) +int cmdline_vdprintf(int fd, const char *format, va_list op); + #endif