1 # Check tz tables for consistency.
3 # Contributed by Paul Eggert.
8 if (!iso_table
) iso_table =
"iso3166.tab"
9 if (!zone_table
) zone_table =
"zone.tab"
10 if (!want_warnings
) want_warnings =
-1
12 # A special (and we hope temporary) case.
13 tztab
["America/Montreal"] =
1
15 while (getline <iso_table
) {
17 if ($
0 ~
/^
#/) continue
19 printf "%s:%d: wrong number of columns\n", \
20 iso_table
, iso_NR
>>"/dev/stderr"
25 if (cc !~
/^
[A
-Z
][A
-Z
]$
/) {
26 printf "%s:%d: invalid country code `%s'\n", \
27 iso_table
, iso_NR
, cc
>>"/dev/stderr"
37 printf "%s:%d: country code `%s' is %s\n", \
38 iso_table
, iso_NR
, cc
, s \
44 printf "%s:%d: `%s' and `%s' have the sname name\n", \
45 iso_table
, iso_NR
, name2cc
[name
], cc \
54 zone_table =
"zone.tab"
57 while (getline <zone_table
) {
59 if ($
0 ~
/^
#/) continue
60 if (NF != 3 && NF != 4) {
61 printf "%s:%d: wrong number of columns\n", \
62 zone_table
, zone_NR
>>"/dev/stderr"
70 printf "%s:%d: country code `%s' is out of order\n", \
71 zone_table
, zone_NR
, cc
>>"/dev/stderr"
78 tz2comments
[cctz
] = comments
83 printf "%s:%d: %s: unknown country code\n", \
84 zone_table
, zone_NR
, cc
>>"/dev/stderr"
87 if (coordinates !~
/^
[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$
/ \
88 && coordinates !~
/^
[-+][0-9][0-9][0-5][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9][0-5][0-9]$
/) {
89 printf "%s:%d: %s: invalid coordinates\n", \
90 zone_table
, zone_NR
, coordinates
>>"/dev/stderr"
95 for (cctz in cctztab
) {
96 cc =
substr (cctz
, 1, 2)
98 if (cc_used
[cc
] ==
1) {
99 if (tz2comments
[cctz
]) {
100 printf "%s:%d: unnecessary comment `%s'\n", \
101 zone_table
, tz2NR
[tz
], \
107 if (!tz2comments
[cctz
]) {
108 printf "%s:%d: missing comment\n", \
109 zone_table
, tz2NR
[tz
] >>"/dev/stderr"
120 if ($
1 ==
"Zone") tz = $
2
122 # Ignore Link commands if source and destination basenames
123 # are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
126 while ((i =
index(src
, "/"))) src =
substr(src
, i
+1)
127 while ((i =
index(dst
, "/"))) dst =
substr(dst
, i
+1)
128 if (src
!= dst
) tz = $
3
130 if (tz
&& tz ~
/\
//) {
132 printf "%s: no data for `%s'\n", zone_table
, tz \
143 printf "%s:%d: no Zone table for `%s'\n", \
144 zone_table
, tz2NR
[tz
], tz
>>"/dev/stderr"
149 if (0 < want_warnings
) {
150 for (cc in cc2name
) {
152 printf "%s:%d: warning: " \
153 "no Zone entries for %s (%s)\n", \
154 iso_table
, cc2NR
[cc
], cc
, cc2name
[cc
]