commit a7954e8cabafb78027381f1e256337d3a650225d
parent 1059cf5f175fa6d6edb313ad3151a55bae9dcf20
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 1 Apr 2014 15:13:30 +0200
cmp: fix line numbers
test case:
printf 'a\n\na' > t1
printf 'a\na' > t2
cmp t1 t2
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/cmp.c b/cmp.c
@@ -52,6 +52,7 @@ main(int argc, char *argv[])
b[1] = getc(fp[1]);
if(b[0] == EOF && b[1] == EOF)
break;
+ if(b[0] == '\n' && b[1] == '\n')
line++;
if(b[0] == b[1])
continue;