From 4aa4e5d9b13190e94fe97664598f2dc70187a889 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 19 Sep 2022 20:58:21 -0400 Subject: Add when - to print all named dates --- bin/when.y | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bin/when.y') diff --git a/bin/when.y b/bin/when.y index 69ccc343..c94c5514 100644 --- a/bin/when.y +++ b/bin/when.y @@ -319,8 +319,16 @@ int main(int argc, char *argv[]) { } if (argc > 1) { - input = argv[1]; - return yyparse(); + if (strcmp(argv[1], "-")) { + input = argv[1]; + return yyparse(); + } else { + for (size_t i = 0; i < dates.len; ++i) { + printf("%s: ", dates.ptr[i].tm_zone); + printScalar(dateDiff(today(), dates.ptr[i])); + } + return EX_OK; + } } struct tm date = today(); -- cgit 1.4.1