commit 821a980ab4be90a58e40824f70ee7556b7f7feb6
parent 93c8aaf925bfc6f5275baab35092c35ea19af5fb
Author: sin <sin@2f30.org>
Date: Thu, 20 Nov 2014 22:51:34 +0000
Respect exit status in tail(1)
There are more instances of this problem.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tail.c b/tail.c
@@ -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':
@@ -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