[hackers] [sbase] a question regarding date(1)

From: Ali H. Fardan <raiz_AT_firemail.cc>
Date: Thu, 01 Sep 2016 19:01:50 +0300

so I just came across this if (argc) statement and
I'm not sure why it is placed there in the first
pleace, I am assuming that argc is not tinkered with
(via arg.h), but the program works well without it,
so my question is, is this if() statement incorrect
or it's just there because of arg.h?

diff --git a/date.c b/date.c
index 1671e1f..b2836fd 100644
--- a/date.c
+++ b/date.c
_AT_@ -33,13 +33,13 @@ main(int argc, char *argv[])
                  usage();
          } ARGEND

- if (argc) {
- if (argc != 1 || argv[0][0] != '+')
- usage();
- else
- fmt = &argv[0][1];
- }
- if (!(now = tztime(&t)))
+ if (argc != 1 || argv[0][0] != '+')
+ usage();
+ else
+ fmt = &argv[0][1];
+
+ now = tztime(&t);
+ if (!now)
                  eprintf("%stime failed\n", tz);

          strftime(buf, sizeof(buf), fmt, now);
Received on Thu Sep 01 2016 - 18:01:50 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 01 2016 - 18:12:18 CEST