diff --git a/lib/libc/file.c b/lib/libc/file.c index e728cf4..2347a22 100644 --- a/lib/libc/file.c +++ b/lib/libc/file.c @@ -171,6 +171,11 @@ fgets(char *str, int size, FILE *fh) int ch = fgetc(fh); if (ch == EOF) return NULL; + if (ch == '\b') { + if (i > 0) + i -= 2; + continue; + } str[i] = (char)ch; if (ch == '\n') { str[i + 1] = '\0'; diff --git a/sys/dev/x86/sercons.c b/sys/dev/x86/sercons.c index 6536e6d..6616b98 100644 --- a/sys/dev/x86/sercons.c +++ b/sys/dev/x86/sercons.c @@ -91,6 +91,12 @@ void Serial_Putc(char ch) // Timeout! } outb(base + UART_OFFSET_DATA, ch); + + if (ch == '\b') { + Serial_Putc(0x1B); + Serial_Putc('['); + Serial_Putc('P'); + } } void Serial_Puts(const char *str)