[PATCH] wpa_cli: Add backspace key process for some terminal

SiWon Kang kkangshawn at gmail.com
Thu May 12 19:18:14 PDT 2016


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, I add a routine to process '\b' character input.

Signed-off-by: Siwon Kang <kkangshawn at gmail.com>
---
 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 13173cb..9ac3f99 100644
--- a/src/utils/edit_simple.c
+++ b/src/utils/edit_simple.c
@@ -46,6 +46,12 @@ static void edit_read_char(int sock, void
*eloop_ctx, void *sock_ctx)
                fflush(stdout);
                return;
        }
+
+       if (c == '\b') {
+               if (cmdbuf_pos > 0) {
+                       cmdbuf[cmdbuf_pos--] = c;
+               }
+       }

        if (c >= 32 && c <= 255) {
                if (cmdbuf_pos < (int) sizeof(cmdbuf) - 1) {
-- 
1.9.1



More information about the Hostap mailing list