mirror of
git://git.suckless.org/sbase
synced 2024-12-25 00:12:42 +00:00
cmp: make EOF check more clear
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
parent
24a5006f57
commit
1059cf5f17
8
cmp.c
8
cmp.c
@ -47,9 +47,11 @@ main(int argc, char *argv[])
|
||||
if (!fp[1])
|
||||
enprintf(Error, "fopen %s:", argv[1]);
|
||||
|
||||
for(n = 1; ((b[0] = getc(fp[0])) != EOF) \
|
||||
| ((b[1] = getc(fp[1])) != EOF); n++) {
|
||||
if(b[0] == '\n')
|
||||
for(n = 1; ; n++) {
|
||||
b[0] = getc(fp[0]);
|
||||
b[1] = getc(fp[1]);
|
||||
if(b[0] == EOF && b[1] == EOF)
|
||||
break;
|
||||
line++;
|
||||
if(b[0] == b[1])
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user