diff options
Diffstat (limited to 'sfeed_plain.c')
-rw-r--r-- | sfeed_plain.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sfeed_plain.c b/sfeed_plain.c index 8b1f00f..c790ec4 100644 --- a/sfeed_plain.c +++ b/sfeed_plain.c @@ -2,6 +2,7 @@ #include <locale.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <time.h> @@ -52,8 +53,9 @@ int main(int argc, char *argv[]) { FILE *fp; - char *name; + char *name, *tmp, *endptr; int i; + long l; if (pledge("stdio rpath", NULL) == -1) err(1, "pledge"); @@ -65,8 +67,16 @@ main(int argc, char *argv[]) if ((comparetime = time(NULL)) == (time_t)-1) errx(1, "time"); - /* 1 day is old news */ - comparetime -= 86400; + + if ((tmp = getenv("SFEED_NEW_MAX_SECS"))) { + l = strtol(tmp, &endptr, 10); + if (*tmp == '\0' || *endptr != '\0' || l <= 0) + err(1, "cannot parse $SFEED_NEW_MAX_SECS"); + comparetime -= l; + } else { + /* 1 day is old news */ + comparetime -= 86400; + } if (argc == 1) { printfeed(stdin, ""); |