[hackers] [sbase] Respect exit status in tail(1) || sin

From: <git_AT_suckless.org>
Date: Thu, 20 Nov 2014 23:52:19 +0100

commit 821a980ab4be90a58e40824f70ee7556b7f7feb6
Author: sin <sin_AT_2f30.org>
Date: Thu Nov 20 22:51:34 2014 +0000

    Respect exit status in tail(1)
    
    There are more instances of this problem.

diff --git a/tail.c b/tail.c
index b399cf2..b3a8b30 100644
--- a/tail.c
+++ b/tail.c
_AT_@ -23,6 +23,7 @@ main(int argc, char *argv[])
         FILE *fp;
         void (*tail)(FILE *, const char *, long) = taketail;
         char *lines;
+ int ret = 0;
 
         ARGBEGIN {
         case 'n':
_AT_@ -43,14 +44,14 @@ main(int argc, char *argv[])
                 for (; argc > 0; argc--, argv++) {
                         if (!(fp = fopen(argv[0], "r"))) {
                                 weprintf("fopen %s:", argv[0]);
+ ret = 1;
                                 continue;
                         }
                         tail(fp, argv[0], n);
                         fclose(fp);
                 }
         }
-
- return 0;
+ return ret;
 }
 
 static void
Received on Thu Nov 20 2014 - 23:52:19 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 21 2014 - 00:00:33 CET