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 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 sname name\n", \
42 iso_table
, iso_NR
, name2cc
[name
], cc \
51 zone_table =
"zone.tab"
54 while (getline <zone_table
) {
56 if ($
0 ~
/^
#/) continue
57 if (NF != 3 && NF != 4) {
58 printf "%s:%d: wrong number of columns\n", \
59 zone_table
, zone_NR
>>"/dev/stderr"
67 printf "%s:%d: country code `%s' is out of order\n", \
68 zone_table
, zone_NR
, cc
>>"/dev/stderr"
73 printf "%s:%d: %s: duplicate TZ column\n", \
74 zone_table
, zone_NR
, tz
>>"/dev/stderr"
78 tz2comments
[tz
] = 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"
96 if (cc_used
[tz2cc
[tz
]] ==
1) {
97 if (tz2comments
[tz
]) {
98 printf "%s:%d: unnecessary comment `%s'\n", \
99 zone_table
, tz2NR
[tz
], tz2comments
[tz
] \
104 if (!tz2comments
[tz
]) {
105 printf "%s:%d: missing comment\n", \
106 zone_table
, tz2NR
[tz
] >>"/dev/stderr"
117 if ($
1 ==
"Zone") tz = $
2
119 # Ignore Link commands if source and destination basenames
120 # are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
123 while ((i =
index(src
, "/"))) src =
substr(src
, i
+1)
124 while ((i =
index(dst
, "/"))) dst =
substr(dst
, i
+1)
125 if (src
!= dst
) tz = $
3
127 if (tz
&& tz ~
/\
//) {
129 printf "%s: no data for `%s'\n", zone_table
, tz \
140 printf "%s:%d: no Zone table for `%s'\n", \
141 zone_table
, tz2NR
[tz
], tz
>>"/dev/stderr"
146 if (0 < want_warnings
) {
147 for (cc in cc2name
) {
149 printf "%s:%d: warning: " \
150 "no Zone entries for %s (%s)\n", \
151 iso_table
, cc2NR
[cc
], cc
, cc2name
[cc
]