diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-03 16:52:14 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-03 16:52:14 +0100 |
commit | 52b9a0689603622fe9f2b7610e428c125e4acbb7 (patch) | |
tree | 515a35e713c71dfdee2e684090191ab4827bcbe2 /sys/src/boot | |
parent | ee251568fb06b829c60ee02b38f24a12b1964c5c (diff) |
9boot: truncate long lines instead of producing partial lines from console/plan9.ini
Diffstat (limited to 'sys/src/boot')
-rw-r--r-- | sys/src/boot/pc/sub.c | 14 |
1 files 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])) |