git: 9front

Download patch

ref: 3e46a7f62a98666c171d103b58a95f94cc2779ed
parent: 137d1bedab910a788c2156acea14f4effa743be6
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Mon Dec 3 11:52:14 EST 2012

9boot: truncate long lines instead of producing partial lines from console/plan9.ini

--- a/sys/src/boot/pc/sub.c
+++ b/sys/src/boot/pc/sub.c
@@ -105,7 +105,7 @@
 	do{
 		if(!f)
 			putc('>');
-		while(p < buf + 64-1){
+		for(;;){
 			if(!f){
 				putc(*p = getc());
 				if(*p == '\r')
@@ -116,10 +116,18 @@
 				}
 			}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]))
--