1 # Check tz tables for consistency.
3 # Contributed by Paul Eggert. This file is in the public domain.
8 if (!iso_table) iso_table = "iso3166.tab"
9 if (!zone_table) zone_table = "zone1970.tab"
10 if (!want_warnings) want_warnings = -1
12 while (getline <iso_table) {
14 if ($0 ~ /^#/) continue
16 printf "%s:%d: wrong number of columns\n", \
17 iso_table, iso_NR >>"/dev/stderr"
22 if (cc !~ /^[A-Z][A-Z]$/) {
23 printf "%s:%d: invalid country code '%s'\n", \
24 iso_table, iso_NR, cc >>"/dev/stderr"
34 printf "%s:%d: country code '%s' is %s\n", \
35 iso_table, iso_NR, cc, s \
41 printf "%s:%d: '%s' and '%s' have the same name\n", \
42 iso_table, iso_NR, name2cc[name], cc \
53 while (getline <zone_table) {
55 if ($0 ~ /^#/) continue
56 if (NF != 3 && NF != 4) {
57 printf "%s:%d: wrong number of columns\n", \
58 zone_table, zone_NR >>"/dev/stderr"
61 ccs = input_ccs[zone_NR] = $1
64 comments = input_comments[zone_NR] = $4
68 # Don't complain about a special case for Crimea in zone.tab.
69 # FIXME: zone.tab should be removed, since it is obsolete.
70 # Or at least put just "XX" in its country-code column.
72 && !(zone_table == "zone.tab" \
73 && tz0 == "Europe/Simferopol")) {
74 printf "%s:%d: country code '%s' is out of order\n", \
75 zone_table, zone_NR, cc >>"/dev/stderr"
87 printf "%s:%d: %s: unknown country code\n", \
88 zone_table, zone_NR, cc >>"/dev/stderr"
92 if (coordinates !~ /^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$/ \
93 && 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]$/) {
94 printf "%s:%d: %s: invalid coordinates\n", \
95 zone_table, zone_NR, coordinates >>"/dev/stderr"
100 for (i = 1; i <= zone_NR; i++) {
103 comments = input_comments[i]
108 if (used_max < cc_used[cc]) {
109 used_max = cc_used[cc]
113 if (used_max <= 1 && comments) {
114 printf "%s:%d: unnecessary comment '%s'\n", \
115 zone_table, i, comments \
118 } else if (1 < used_max && !comments) {
119 printf "%s:%d: missing comment for %s\n", \
120 zone_table, i, used_max_cc \
135 if ($5 ~ /%/) rulePercentUsed[$4] = 1
136 } else if ($1 == "Link" && zone_table == "zone.tab") {
137 # Ignore Link commands if source and destination basenames
138 # are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
141 while ((i = index(src, "/"))) src = substr(src, i+1)
142 while ((i = index(dst, "/"))) dst = substr(dst, i+1)
143 if (src != dst) tz = $3
144 } else if ($1 == "Rule") {
146 if ($10 != "-") ruleLetters[$2] = 1
149 if ($3 ~ /%/) rulePercentUsed[$2] = 1
151 if (tz && tz ~ /\// && tz !~ /^Etc\//) {
152 if (!tztab[tz] && FILENAME != "backward") {
153 printf "%s: no data for '%s'\n", zone_table, tz \
162 for (tz in ruleDefined) {
164 printf "%s: Rule never used\n", tz
168 for (tz in ruleLetters) {
169 if (!rulePercentUsed[tz]) {
170 printf "%s: Rule contains letters never used\n", tz
175 if (!zoneSeen[tz] && tz !~ /^Etc\//) {
176 printf "%s:%d: no Zone table for '%s'\n", \
177 zone_table, tz2NR[tz], tz >>"/dev/stderr"
181 if (0 < want_warnings) {
182 for (cc in cc2name) {
184 printf "%s:%d: warning: " \
185 "no Zone entries for %s (%s)\n", \
186 iso_table, cc2NR[cc], cc, cc2name[cc]