net/ice: clean input set macro definition
[dpdk.git] / lib / librte_cmdline / cmdline_os_unix.c
index d50eb1c..64a945a 100644 (file)
@@ -2,7 +2,9 @@
  * Copyright (c) 2020 Dmitry Kozlyuk
  */
 
+#include <poll.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "cmdline_private.h"
 
@@ -25,3 +27,27 @@ terminal_restore(const struct cmdline *cl)
 {
        tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm);
 }
+
+int
+cmdline_poll_char(struct cmdline *cl)
+{
+       struct pollfd pfd;
+
+       pfd.fd = cl->s_in;
+       pfd.events = POLLIN;
+       pfd.revents = 0;
+
+       return poll(&pfd, 1, 0);
+}
+
+ssize_t
+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);
+}