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 = "zone1970.tab"
10
if (!want_warnings) want_warnings = -1
12
# A special (and we hope temporary) case.
13
tztab["America/Montreal"] = 1
15
# Some more special cases; these are zones that should probably
16
# be turned into links.
17
if (zone_table == "zone1970.tab") {
18
tztab["Africa/Addis_Ababa"] = 1
19
tztab["Africa/Asmara"] = 1
20
tztab["Africa/Blantyre"] = 1
21
tztab["Africa/Bujumbura"] = 1
22
tztab["Africa/Dar_es_Salaam"] = 1
23
tztab["Africa/Djibouti"] = 1
24
tztab["Africa/Gaborone"] = 1
25
tztab["Africa/Harare"] = 1
26
tztab["Africa/Kampala"] = 1
27
tztab["Africa/Kigali"] = 1
28
tztab["Africa/Lubumbashi"] = 1
29
tztab["Africa/Lusaka"] = 1
30
tztab["Africa/Maseru"] = 1
31
tztab["Africa/Mbabane"] = 1
32
tztab["Africa/Mogadishu"] = 1
33
tztab["America/Antigua"] = 1
34
tztab["America/Cayman"] = 1
35
tztab["Asia/Aden"] = 1
36
tztab["Asia/Bahrain"] = 1
37
tztab["Asia/Ho_Chi_Minh"] = 1
38
tztab["Asia/Kuwait"] = 1
39
tztab["Asia/Muscat"] = 1
40
tztab["Asia/Phnom_Penh"] = 1
41
tztab["Asia/Vientiane"] = 1
42
tztab["Indian/Antananarivo"] = 1
43
tztab["Indian/Comoro"] = 1
44
tztab["Indian/Mayotte"] = 1
45
tztab["Pacific/Midway"] = 1
46
tztab["Pacific/Saipan"] = 1
49
while (getline <iso_table) {
51
if ($0 ~ /^#/) continue
53
printf "%s:%d: wrong number of columns\n", \
54
iso_table, iso_NR >>"/dev/stderr"
59
if (cc !~ /^[A-Z][A-Z]$/) {
60
printf "%s:%d: invalid country code '%s'\n", \
61
iso_table, iso_NR, cc >>"/dev/stderr"
71
printf "%s:%d: country code '%s' is %s\n", \
72
iso_table, iso_NR, cc, s \
78
printf "%s:%d: '%s' and '%s' have the sname name\n", \
79
iso_table, iso_NR, name2cc[name], cc \
90
while (getline <zone_table) {
92
if ($0 ~ /^#/) continue
93
if (NF != 3 && NF != 4) {
94
printf "%s:%d: wrong number of columns\n", \
95
zone_table, zone_NR >>"/dev/stderr"
104
printf "%s:%d: country code '%s' is out of order\n", \
105
zone_table, zone_NR, cc >>"/dev/stderr"
110
tz2comments[tz] = comments
119
printf "%s:%d: %s: unknown country code\n", \
120
zone_table, zone_NR, cc >>"/dev/stderr"
124
if (coordinates !~ /^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$/ \
125
&& 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]$/) {
126
printf "%s:%d: %s: invalid coordinates\n", \
127
zone_table, zone_NR, coordinates >>"/dev/stderr"
132
for (cctz in cctztab) {
133
cc = substr (cctz, 1, 2)
134
tz = substr (cctz, 3)
135
if (1 < cc_used[cc]) {
136
comments_needed[tz] = cc
139
for (cctz in cctztab) {
140
cc = substr (cctz, 1, 2)
141
tz = substr (cctz, 3)
142
if (!comments_needed[tz] && tz2comments[tz]) {
143
printf "%s:%d: unnecessary comment '%s'\n", \
144
zone_table, tz2NR[tz], tz2comments[tz] \
148
} else if (comments_needed[tz] && !tz2comments[tz]) {
149
printf "%s:%d: missing comment for %s\n", \
150
zone_table, tz2NR[tz], comments_needed[tz] \
165
} else if ($1 == "Link" && zone_table == "zone.tab") {
166
# Ignore Link commands if source and destination basenames
167
# are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
170
while ((i = index(src, "/"))) src = substr(src, i+1)
171
while ((i = index(dst, "/"))) dst = substr(dst, i+1)
172
if (src != dst) tz = $3
173
} else if ($1 == "Rule") {
178
if (tz && tz ~ /\//) {
180
printf "%s: no data for '%s'\n", zone_table, tz \
189
for (tz in ruleDefined) {
191
printf "%s: Rule never used\n", tz
197
printf "%s:%d: no Zone table for '%s'\n", \
198
zone_table, tz2NR[tz], tz >>"/dev/stderr"
202
if (0 < want_warnings) {
203
for (cc in cc2name) {
205
printf "%s:%d: warning: " \
206
"no Zone entries for %s (%s)\n", \
207
iso_table, cc2NR[cc], cc, cc2name[cc]