sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit ce28f6ca9062e9e1ffc074e14fc3874a9be9a7aa
parent a7954e8cabafb78027381f1e256337d3a650225d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue Apr  1 15:14:21 +0200

cmp: dont output EOF difference is sflag is set

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>

Diffstat:
cmp.c | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/cmp.c b/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);