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++;
|
||||
if(b[0] == b[1])
|
||||
continue;
|
||||
for(i = 0; i < 2; i++)
|
||||
if(b[i] == EOF)
|
||||
enprintf(Diff, "cmp: EOF on %s\n",
|
||||
!argv[i] ? "<stdin>" : argv[i]);
|
||||
if(!lflag) {
|
||||
for(i = 0; i < 2; i++) {
|
||||
if(b[i] == EOF) {
|
||||
if(!sflag)
|
||||
fprintf(stderr, "cmp: EOF on %s\n",
|
||||
!argv[i] ? "<stdin>" : argv[i]);
|
||||
exit(Diff);
|
||||
}
|
||||
}
|
||||
if(!sflag)
|
||||
printf("%s %s differ: char %ld, line %ld\n",
|
||||
argv[0], !argv[1] ? "<stdin>" : argv[1], n, line);
|
||||
|
Loading…
Reference in New Issue
Block a user