shithub: riscv

Download patch

ref: bc4469e5d23509cd7f9070278b146c467d5f120a
parent: af3fd92789b0a730774737ae4194382e39f61f4d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Apr 28 00:40:09 EDT 2018

ndb/csquery: insert \n between read chunks

--- a/sys/src/cmd/ndb/csquery.c
+++ b/sys/src/cmd/ndb/csquery.c
@@ -16,7 +16,7 @@
 void
 query(char *addr)
 {
-	char buf[8192];
+	char buf[8192+1];
 	int fd, n;
 
 	fd = open(server, ORDWR);
@@ -31,8 +31,10 @@
 	}
 	if(!statusonly){
 		seek(fd, 0, 0);
-		while((n = read(fd, buf, sizeof(buf))) > 0)
+		while((n = read(fd, buf, sizeof(buf)-1)) > 0){
+			buf[n++] = '\n';
 			write(1, buf, n);
+		}
 		write(1, "\n", 1);
 	}
 	close(fd);