diff --git a/dfc.c b/dfc.c index 91eb5df..9a0ed57 100644 --- a/dfc.c +++ b/dfc.c @@ -12,7 +12,7 @@ #include #include #include -#define _XOPEN_SOURCE /* glibc2 needs this */ +#define __USE_XOPEN /* glibc2 needs this */ #include #include #include @@ -307,7 +307,7 @@ time_t strptime_mktime(const char *s, const char *format, struct tm *tm) { } tm->tm_isdst = 0; - p = (char*)strptime(s, format, tm); + p = strptime((char *)s, format, tm); if (!p || *p) return ((time_t)-1); @@ -394,7 +394,7 @@ int main(int argc, char **argv) { char *p; if ((p = strchr(global_first_line_full_date, '='))) { - if (strptime(global_first_line_full_date, p+1, &ref_tm) == -1) { + if (strptime(global_first_line_full_date, p+1, &ref_tm) == (char *)-1) { ERROR("bad reference time or format"); exit(2); } @@ -479,7 +479,7 @@ int main(int argc, char **argv) { if (date_field >= 0) { // check date on group number 'date_field', // global_date_filter_field need to set to enable this condition - if (!(ptmp = (void*)strptime(tmp + REG_PTR(m, date_field), + if (!(ptmp = strptime(tmp + REG_PTR(m, date_field), global_input_date_format, &tm))) { fprintf(stderr, "UNPARSABLE: %s", tmp + REG_PTR(m, date_field)); continue; @@ -487,7 +487,7 @@ int main(int argc, char **argv) { } else { // single call to localtime at begin of line - if (!(ptmp = (void*)strptime(tmp, global_input_date_format, &tm))) { + if (!(ptmp = strptime(tmp, global_input_date_format, &tm))) { fprintf(stderr, "UNPARSABLE: %s", tmp); continue; } @@ -607,9 +607,9 @@ int main(int argc, char **argv) { } if (global_track_past_return) { - fprintf(stderr, "NEGATIVE-PAST-RETURN (%d)\nL1: %sL2: %s", + fprintf(stderr, "NEGATIVE-PAST-RETURN (%ld)\nL1: %sL2: %s", negative_tm_diff, negative_old_line, negative_cur_line); - fprintf(stderr, "POSITIVE-PAST-RETURN (%d)\nL1: %sL2: %s", + fprintf(stderr, "POSITIVE-PAST-RETURN (%ld)\nL1: %sL2: %s", positive_tm_diff, positive_old_line, positive_cur_line); }