cmdline: add internal wrapper for vdprintf

Add internal wrapper for vdprintf(3) that is only available on Unix.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Dmitry Kozlyuk 2020-09-29 00:50:49 +03:00 committed by Thomas Monjalon
parent 9251cd97a6
commit b5741b5704
3 changed files with 15 additions and 1 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -5,6 +5,10 @@
#ifndef _CMDLINE_PRIVATE_H_
#define _CMDLINE_PRIVATE_H_
#include <stdarg.h>
#include <rte_common.h>
#include <cmdline.h>
/* 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