1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
diff --git a/dfc.c b/dfc.c
index 91eb5df..9a0ed57 100644
--- a/dfc.c
+++ b/dfc.c
@@ -12,7 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define _XOPEN_SOURCE /* glibc2 needs this */
+#define __USE_XOPEN /* glibc2 needs this */
#include <time.h>
#include <limits.h>
#include <unistd.h>
@@ -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);
}
|