From bc2c0ce3e6e221bcd3cc2297e68353690d231a87 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 31 Aug 2021 12:48:19 +0000 Subject: cmd/sam: Remove 256 character Plan 9 command output limit --- sys/src/cmd/sam/shell.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/src/cmd/sam/shell.c b/sys/src/cmd/sam/shell.c index fe8f859cb..4b912de32 100644 --- a/sys/src/cmd/sam/shell.c +++ b/sys/src/cmd/sam/shell.c @@ -172,18 +172,23 @@ checkerrs(void) int f, n, nl; char *p; long l; + long r; + + r = 0; // total amount of characters read + nl = 3; // maximum number of newlines if(statfile(errfile, 0, 0, 0, &l, 0) > 0 && l != 0){ if((f=open((char *)errfile, 0)) != -1){ - if((n=read(f, buf, sizeof buf-1)) > 0){ - for(nl=0,p=buf; nl<3 && p<&buf[n]; p++) + while (r0 && (n=read(f, buf, sizeof buf-1)) > 0) { + for(p=buf; nl>0 && p<&buf[n]; p++) if(*p=='\n') - nl++; + nl--; + r += n; *p = 0; dprint("%s", buf); - if(p-buf < l-1) - dprint("(sam: more in %s)\n", errfile); } + if (r