sbase

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

commit 0c8fe5d19b70792a8aede0a62fe09d3a1b6b3d2c
parent 3b4a366ffd63e32e54e06cd8470f4ad02e6e4eef
Author: sin <sin@2f30.org>
Date:   Fri,  6 Feb 2015 19:11:33 +0000

wc: Report exit status properly

Diffstat:
Mwc.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/wc.c b/wc.c @@ -67,6 +67,7 @@ main(int argc, char *argv[]) { FILE *fp; int i; + int ret = 0; ARGBEGIN { case 'c': @@ -91,6 +92,7 @@ main(int argc, char *argv[]) for (i = 0; i < argc; i++) { if (!(fp = fopen(argv[i], "r"))) { weprintf("fopen %s:", argv[i]); + ret = 1; continue; } wc(fp, argv[i]); @@ -99,5 +101,5 @@ main(int argc, char *argv[]) if (argc > 1) output("total", tc, tl, tw); } - return 0; + return ret; }