[4/7] cmdline: add internal wrapper for vdprintf
Checks
Commit Message
Add internal wrapper for vdprintf(3) that is only available on Unix.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
lib/librte_cmdline/cmdline.c | 2 +-
lib/librte_cmdline/cmdline_os_unix.c | 6 ++++++
lib/librte_cmdline/cmdline_private.h | 8 ++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
@@ -132,7 +132,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);
}
@@ -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);
+}
@@ -7,6 +7,10 @@
#include <termios.h>
+#include <stdarg.h>
+
+#include <rte_common.h>
+
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
@@ -35,4 +39,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