[hackers] [sbase] wc: Report exit status properly || sin

From: <git_AT_suckless.org>
Date: Tue, 24 Mar 2015 23:53:34 +0100 (CET)

commit 0c8fe5d19b70792a8aede0a62fe09d3a1b6b3d2c
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 Tue Mar 24 2015 - 23:53:34 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 25 2015 - 00:07:48 CET