summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/input_curses.c
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2019-07-04 00:04:17 +0200
committerXavier Simonart <xavier.simonart@intel.com>2019-07-04 14:08:27 +0200
commit19795c2fc3180e8a0dae4373d8be2f5c0656fc8c (patch)
tree81c672fab25dab26a59dd219264a828093d532e4 /VNFs/DPPD-PROX/input_curses.c
parent080733bfa5facd0eb457fc3db1c3ee7885f2a438 (diff)
Fix keyboard related issues on Ubuntu 18.04
On Ubuntu 18.04, the keyboard was not properly handled in PROX For instance, many keys pressed were silently discarded. The issue is related to a change in histedit/libedit version. Recent libedit have (silently) changed the prototype of the get_char function passed in el_set(el, EL_GETCFN, get_char), with some input parameters changing from char to wchar_t. As PROX used the old prototype (char based), this resulted in some uninitialized field (= garbage) in the wchar_t, causing libedit to discard the character. PROX now uses different get_char prototypes, depending of the libedit version being used. If PROX was already compiled and a the OS is updated (e.g. from Ubuntu 16.04 to Ubuntu 18.04), this will require a 'make clean'. Change-Id: Icb0e555a21e13cdaf98172bad17f2f838fb7bc3a Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/input_curses.c')
-rw-r--r--VNFs/DPPD-PROX/input_curses.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/input_curses.c b/VNFs/DPPD-PROX/input_curses.c
index 6f79869b..4ea2e4a8 100644
--- a/VNFs/DPPD-PROX/input_curses.c
+++ b/VNFs/DPPD-PROX/input_curses.c
@@ -27,6 +27,7 @@
#include "cmd_parser.h"
#include "input_curses.h"
#include "histedit.h"
+#include "libedit_autoconf.h"
static EditLine *el;
static History *hist;
@@ -124,7 +125,11 @@ static int peek_stdin(void)
return FD_ISSET(fileno(stdin), &in_fd);
}
+#ifdef HAVE_LIBEDIT_EL_RFUNC_T
+static int do_get_char(EditLine *e, wchar_t *c)
+#else
static int get_char(EditLine *e, char *c)
+#endif
{
*c = display_getch();
@@ -167,6 +172,10 @@ static int get_char(EditLine *e, char *c)
return 1;
}
+#ifdef HAVE_LIBEDIT_EL_RFUNC_T
+static el_rfunc_t get_char = &do_get_char;
+#endif
+
static void proc_keyboard(struct input *input)
{
const char *line;