[hackers] [sbase] cmp: make EOF check more clear || Hiltjo Posthuma
commit 1059cf5f175fa6d6edb313ad3151a55bae9dcf20
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue Apr 1 15:06:42 2014 +0200
cmp: make EOF check more clear
Signed-off-by: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
diff --git a/cmp.c b/cmp.c
index 9934e11..d1cd0ff 100644
--- a/cmp.c
+++ b/cmp.c
_AT_@ -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] == '
')
+ 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;
Received on Tue Apr 01 2014 - 17:20:25 CEST
This archive was generated by hypermail 2.3.0
: Tue Apr 01 2014 - 17:24:17 CEST