diff options
author | Rob Landley <rob@landley.net> | 2012-03-02 08:33:01 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-03-02 08:33:01 -0600 |
commit | 03a8f7430ebe694602646873371fdf067b735eb9 (patch) | |
tree | c658a675a3fada718b2a3862e125c6bee850be27 /toys/cmp.c | |
parent | 7339560d3f8581e988cfb7095918bf47b6e8f067 (diff) | |
download | toybox-03a8f7430ebe694602646873371fdf067b735eb9.tar.gz |
Only show one normal difference (sans -l) and EOF message should go to stdout, not stderr.
Diffstat (limited to 'toys/cmp.c')
-rw-r--r-- | toys/cmp.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -63,17 +63,17 @@ void do_cmp(int fd, char *name) if (!(toys.optflags & FLAG_s)) { printf("%s %s differ: char %ld, line %ld\n", TT.name, name, byte_no, line_no); + toys.exitval++; } - return; + goto out; } - } byte_no++; if (toybuf[i] == '\n') line_no++; } if (len1 != len2) { if (!(toys.optflags & FLAG_s)) { - fdprintf(2, "cmp: EOF on %s\n", + printf("cmp: EOF on %s\n", len1 < len2 ? TT.name : name); } toys.exitval = 1; @@ -81,6 +81,7 @@ void do_cmp(int fd, char *name) } if (len1 < 1) break; } +out: if (CFG_TOYBOX_FREE) close(TT.fd); } |