[hackers] [sbase] cmp: dont output EOF difference is sflag is set || Hiltjo Posthuma
commit ce28f6ca9062e9e1ffc074e14fc3874a9be9a7aa
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue Apr 1 15:14:21 2014 +0200
cmp: dont output EOF difference is sflag is set
Signed-off-by: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
diff --git a/cmp.c b/cmp.c
index fa88cc9..d61b1f5 100644
--- a/cmp.c
+++ b/cmp.c
_AT_@ -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
",
- !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
",
+ !argv[i] ? "<stdin>" : argv[i]);
+ exit(Diff);
+ }
+ }
if(!sflag)
printf("%s %s differ: char %ld, line %ld
",
argv[0], !argv[1] ? "<stdin>" : argv[1], n, line);
Received on Tue Apr 01 2014 - 17:20:40 CEST
This archive was generated by hypermail 2.3.0
: Tue Apr 01 2014 - 17:24:22 CEST