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>
This commit is contained in:
Hiltjo Posthuma 2014-04-01 15:13:30 +02:00 committed by sin
parent 1059cf5f17
commit a7954e8cab

1
cmp.c
View File

@ -52,6 +52,7 @@ main(int argc, char *argv[])
b[1] = getc(fp[1]); b[1] = getc(fp[1]);
if(b[0] == EOF && b[1] == EOF) if(b[0] == EOF && b[1] == EOF)
break; break;
if(b[0] == '\n' && b[1] == '\n')
line++; line++;
if(b[0] == b[1]) if(b[0] == b[1])
continue; continue;