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 <kkangshawn@gmail.com>
This commit is contained in:
SiWon Kang 2016-05-13 11:18:14 +09:00 committed by Jouni Malinen
parent 3dd0e9e4e4
commit 7a1887faec

View File

@ -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;