From bc4469e5d23509cd7f9070278b146c467d5f120a Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 28 Apr 2018 04:40:09 +0200 Subject: [PATCH] ndb/csquery: insert \n between read chunks --- sys/src/cmd/ndb/csquery.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/src/cmd/ndb/csquery.c b/sys/src/cmd/ndb/csquery.c index 7d3e98ce8..1f77c1f38 100644 --- a/sys/src/cmd/ndb/csquery.c +++ b/sys/src/cmd/ndb/csquery.c @@ -16,7 +16,7 @@ usage(void) void query(char *addr) { - char buf[8192]; + char buf[8192+1]; int fd, n; fd = open(server, ORDWR); @@ -31,8 +31,10 @@ query(char *addr) } 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);