* misc-utils/cal.c: Unconditionally call time()
and highlight today where possible.
Signed-off-by: Rajeev V. Pillai <rajeevvp@gmail.com>
Signed-off-by: Pádraig Brady <P@draigBrady.com>
argc -= optind;
argv += optind;
+ time(&now);
+ local_time = localtime(&now);
+
day = month = year = 0;
switch(argc) {
case 3:
if (day > dm)
errx(1, _("illegal day value: use 1-%d"), dm);
day = day_in_year(day, month, year);
+ } else if ((local_time->tm_year + 1900) == year) {
+ day = local_time->tm_yday + 1;
}
if (!month)
yflag=1;
break;
case 0:
- time(&now);
- local_time = localtime(&now);
day = local_time->tm_yday + 1;
year = local_time->tm_year + 1900;
month = local_time->tm_mon + 1;