sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 519a4f810563ac018a72b694c24f96db6f7c7152
parent d208659414798cd47652a5aac67b4df8abfc380d
Author: sin <sin@2f30.org>
Date:   Thu Nov 13 15:55:02 +0000

Don't overwrite the line buffer when we hit EOF on one of the files in comm(1)

Diffstat:
comm.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/comm.c b/comm.c @@ -49,14 +49,20 @@ main(int argc, char *argv[]) for(;;) { if(diff <= 0) { + lines[0][0] = '\0'; if(!nextline(lines[0], sizeof(lines[0]), fp[0], argv[0])) { + if (lines[1][0] != '\0') + printline(1, lines[1]); finish(1, fp[1], argv[1]); } } if(diff >= 0) { + lines[1][0] = '\0'; if(!nextline(lines[1], sizeof(lines[1]), fp[1], argv[1])) { + if (lines[0][0] != '\0') + printline(0, lines[0]); finish(0, fp[0], argv[0]); } }