ref: ed41dd5b288d95dc11ff87e97bade9859bde6c07
parent: 4080322dc9196fc29164ba6c9da8b7cb3dc7a60b
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Sep 16 09:47:33 EDT 2018
9boot: don't let user erase the prompt (thanks mischief)
--- a/sys/src/boot/efi/sub.c
+++ b/sys/src/boot/efi/sub.c
@@ -110,13 +110,15 @@
if(f == nil){
while((*p = getc()) == 0)
;
+ if(p == buf && (*p == '\b' || strchr(white, *p) != nil))
+ continue;
putc(*p);
if(*p == '\r')
putc('\n');
- else if(*p == '\b' && p > buf){
+ else if(*p == '\b'){
+ p--;
putc(' ');
putc('\b');
- p--;
continue;
}
}else if(read(f, p, 1) <= 0)
--- a/sys/src/boot/pc/sub.c
+++ b/sys/src/boot/pc/sub.c
@@ -133,13 +133,15 @@
if(f == nil){
while((*p = getc()) == 0)
;
+ if(p == buf && (*p == '\b' || strchr(white, *p) != nil))
+ continue;
putc(*p);
if(*p == '\r')
putc('\n');
- else if(*p == '\b' && p > buf){
+ else if(*p == '\b'){
+ p--;
putc(' ');
putc('\b');
- p--;
continue;
}
}else if(read(f, p, 1) <= 0)