X-Git-Url: https://git.xandkar.net/?p=khatus.git;a=blobdiff_plain;f=x5%2Fkhatus.c;h=26e491af34ca5d8ccc8d044d5936e182eb2fb39f;hp=2a026dc1626a906ff7dcdb97564846892e9bcc6d;hb=7fb02106fc146cdfad92fe5bafad2336c9b166c1;hpb=69b75a40d02e69f77e7a4bf3c9c4b0ad6d35ba70 diff --git a/x5/khatus.c b/x5/khatus.c index 2a026dc..26e491a 100644 --- a/x5/khatus.c +++ b/x5/khatus.c @@ -276,14 +276,14 @@ fifo_read_one(Fifo *f, char *buf) total = 0; c = '\0'; b = buf + f->pos; - /* TODO: Could optimize here and only blank-out the remaining slots. */ - memset(b, ' ', f->width); while ((current = read(f->fd, &c, 1)) && c != '\n' && c != '\0' && total++ < f->width) *b++ = c; if (current == -1) { error("Failed to read: \"%s\". Error: %s\n", f->name, strerror(errno)); fifo_read_error(f, buf); - } + } else + while (total++ < f->width) + *b++ = ' '; /* TODO Record timestamp read */ close(f->fd); f->fd = -1;