From 52b9a0689603622fe9f2b7610e428c125e4acbb7 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 3 Dec 2012 16:52:14 +0100 Subject: [PATCH] 9boot: truncate long lines instead of producing partial lines from console/plan9.ini --- sys/src/boot/pc/sub.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/src/boot/pc/sub.c b/sys/src/boot/pc/sub.c index 91b407e02..70138377a 100644 --- a/sys/src/boot/pc/sub.c +++ b/sys/src/boot/pc/sub.c @@ -105,7 +105,7 @@ readline(void *f, char buf[64]) do{ if(!f) putc('>'); - while(p < buf + 64-1){ + for(;;){ if(!f){ putc(*p = getc()); if(*p == '\r') @@ -116,10 +116,18 @@ readline(void *f, char buf[64]) } }else if(read(f, p, 1) <= 0) return 0; - if(p == buf && strchr(white, *p)) - continue; if(strchr(crnl, *p)) break; + if(p == buf && strchr(white, *p)) + continue; /* whitespace on start of line */ + if(p >= buf + 64-1){ + if(!f){ + putc('\b'); + putc(' '); + putc('\b'); + } + continue; /* line full do not advance */ + } p++; } while(p > buf && strchr(white, p[-1]))