[hackers] [sbase] wc: Report exit status properly || sin
commit 9d04f4229f7a3311b8ec45e992bd093303cf7bdf
Author: sin <sin_AT_2f30.org>
Date: Fri Feb 6 19:11:33 2015 +0000
wc: Report exit status properly
diff --git a/wc.c b/wc.c
index 39500c5..f0bddcb 100644
--- a/wc.c
+++ b/wc.c
_AT_@ -67,6 +67,7 @@ main(int argc, char *argv[])
{
FILE *fp;
int i;
+ int ret = 0;
ARGBEGIN {
case 'c':
_AT_@ -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]);
_AT_@ -99,5 +101,5 @@ main(int argc, char *argv[])
if (argc > 1)
output("total", tc, tl, tw);
}
- return 0;
+ return ret;
}
Received on Fri Feb 06 2015 - 20:11:58 CET
This archive was generated by hypermail 2.3.0
: Fri Feb 06 2015 - 20:12:08 CET