cmp: dont output EOF difference is sflag is set
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
parent
a7954e8cab
commit
ce28f6ca90
13
cmp.c
13
cmp.c
|
@ -56,11 +56,14 @@ main(int argc, char *argv[])
|
||||||
line++;
|
line++;
|
||||||
if(b[0] == b[1])
|
if(b[0] == b[1])
|
||||||
continue;
|
continue;
|
||||||
for(i = 0; i < 2; i++)
|
for(i = 0; i < 2; i++) {
|
||||||
if(b[i] == EOF)
|
if(b[i] == EOF) {
|
||||||
enprintf(Diff, "cmp: EOF on %s\n",
|
if(!sflag)
|
||||||
!argv[i] ? "<stdin>" : argv[i]);
|
fprintf(stderr, "cmp: EOF on %s\n",
|
||||||
if(!lflag) {
|
!argv[i] ? "<stdin>" : argv[i]);
|
||||||
|
exit(Diff);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!sflag)
|
if(!sflag)
|
||||||
printf("%s %s differ: char %ld, line %ld\n",
|
printf("%s %s differ: char %ld, line %ld\n",
|
||||||
argv[0], !argv[1] ? "<stdin>" : argv[1], n, line);
|
argv[0], !argv[1] ? "<stdin>" : argv[1], n, line);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user