From d968e4e751b58ef4d60e9fb6e69b255cdc72ee0d Mon Sep 17 00:00:00 2001 From: "Mr.UNIX" Date: Sun, 26 Mar 2023 08:49:55 +0100 Subject: [PATCH] Add support for backspace key --- src/read.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/read.c b/src/read.c index 44da91d..44e4f43 100644 --- a/src/read.c +++ b/src/read.c @@ -10,6 +10,8 @@ read_command() { if (ferror(stdin)) { fprintf(stderr, "[-] Failed reading stdin: %s\n", strerror(errno)); return NULL; + } else if (c == '\b') { + if (i > 0) i--; } else if (c == '\\') { c = getchar(); if (c == '\n') continue;