From 7a1887faece4377f13e39bec0346ae2ffd573b79 Mon Sep 17 00:00:00 2001 From: SiWon Kang Date: Fri, 13 May 2016 11:18:14 +0900 Subject: [PATCH] wpa_cli: Add backspace key process for some terminal In some terminal, verified with gtkterm and teraterm, backspace key is not properly processed. For instance, type 'abc', 3 times of backspace key press then '123' shows the result of 'abc123' instead of '123'. To fix this, add a routine to process '\b' character input when using edit_simple.c instead of edit.c (i.e., without CONFIG_WPA_CLI_EDIT=y). Signed-off-by: Siwon Kang --- src/utils/edit_simple.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/edit_simple.c b/src/utils/edit_simple.c index 13173cb19..2ffd1a2a2 100644 --- a/src/utils/edit_simple.c +++ b/src/utils/edit_simple.c @@ -47,6 +47,12 @@ static void edit_read_char(int sock, void *eloop_ctx, void *sock_ctx) return; } + if (c == '\b') { + if (cmdbuf_pos > 0) + cmdbuf_pos--; + return; + } + if (c >= 32 && c <= 255) { if (cmdbuf_pos < (int) sizeof(cmdbuf) - 1) { cmdbuf[cmdbuf_pos++] = c;