1 # Check tz tables for consistency.
5 # Contributed by Paul Eggert <eggert@twinsun.com>.
10 if (!iso_table) iso_table = "iso3166.tab"
11 if (!zone_table) zone_table = "zone.tab"
12 if (!want_warnings) want_warnings = -1
14 while (getline <iso_table) {
16 if ($0 ~ /^#/) continue
18 printf "%s:%d: wrong number of columns\n", \
19 iso_table, iso_NR >>"/dev/stderr"
24 if (cc !~ /^[A-Z][A-Z]$/) {
25 printf "%s:%d: invalid country code `%s'\n", \
26 iso_table, iso_NR, cc >>"/dev/stderr"
36 printf "%s:%d: country code `%s' is %s\n", \
37 iso_table, iso_NR, cc, s \
43 printf "%s:%d: `%s' and `%s' have the sname name\n", \
44 iso_table, iso_NR, name2cc[name], cc \
53 zone_table = "zone.tab"
56 while (getline <zone_table) {
58 if ($0 ~ /^#/) continue
59 if (NF != 3 && NF != 4) {
60 printf "%s:%d: wrong number of columns\n", \
61 zone_table, zone_NR >>"/dev/stderr"
69 printf "%s:%d: country code `%s' is out of order\n", \
70 zone_table, zone_NR, cc >>"/dev/stderr"
75 printf "%s:%d: %s: duplicate TZ column\n", \
76 zone_table, zone_NR, tz >>"/dev/stderr"
80 tz2comments[tz] = comments
85 printf "%s:%d: %s: unknown country code\n", \
86 zone_table, zone_NR, cc >>"/dev/stderr"
89 if (coordinates !~ /^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$/ \
90 && 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]$/) {
91 printf "%s:%d: %s: invalid coordinates\n", \
92 zone_table, zone_NR, coordinates >>"/dev/stderr"
98 if (cc_used[tz2cc[tz]] == 1) {
99 if (tz2comments[tz]) {
100 printf "%s:%d: unnecessary comment `%s'\n", \
101 zone_table, tz2NR[tz], tz2comments[tz] \
106 if (!tz2comments[tz]) {
107 printf "%s:%d: missing comment\n", \
108 zone_table, tz2NR[tz] >>"/dev/stderr"
119 if ($1 == "Zone") tz = $2
121 # Ignore Link commands if source and destination basenames
122 # are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
125 while ((i = index(src, "/"))) src = substr(src, i+1)
126 while ((i = index(dst, "/"))) dst = substr(dst, i+1)
127 if (src != dst) tz = $3
129 if (tz && tz ~ /\//) {
131 printf "%s: no data for `%s'\n", zone_table, tz \
142 printf "%s:%d: no Zone table for `%s'\n", \
143 zone_table, tz2NR[tz], tz >>"/dev/stderr"
148 if (0 < want_warnings) {
149 for (cc in cc2name) {
151 printf "%s:%d: warning: " \
152 "no Zone entries for %s (%s)\n", \
153 iso_table, cc2NR[cc], cc, cc2name[cc]