1 # Check tz tables for consistency.
3 # Contributed by Paul Eggert <eggert@twinsun.com>.
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"
28 printf "%s:%d: country code `%s' is %s\n", \
29 iso_table
, iso_NR
, cc
, \
30 cc==cc0 ?
"duplicate" : "out of order" \
36 printf "%s:%d: `%s' and `%s' have the sname name\n", \
37 iso_table
, iso_NR
, name2cc
[name
], cc \
46 zone_table =
"zone.tab"
49 while (getline <zone_table
) {
51 if ($
0 ~
/^
#/) continue
52 if (NF != 3 && NF != 4) {
53 printf "%s:%d: wrong number of columns\n",
54 zone_table
, zone_NR
>>"/dev/stderr"
62 printf "%s:%d: country code `%s' is out of order\n", \
63 zone_table
, zone_NR
, cc
>>"/dev/stderr"
68 printf "%s:%d: %s: duplicate TZ column\n", \
69 zone_table
, zone_NR
, tz
>>"/dev/stderr"
73 tz2comments
[tz
] = comments
78 printf "%s:%d: %s: unknown country code\n", \
79 zone_table
, zone_NR
, cc
>>"/dev/stderr"
82 if (coordinates !~
/^
[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$
/ \
83 && 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]$
/) {
84 printf "%s:%d: %s: invalid coordinates\n", \
85 zone_table
, zone_NR
, coordinates
>>"/dev/stderr"
91 if (cc_used
[tz2cc
[tz
]] ==
1) {
92 if (tz2comments
[tz
]) {
93 printf "%s:%d: unnecessary comment `%s'\n", \
94 zone_table
, tz2NR
[tz
], tz2comments
[tz
] \
99 if (!tz2comments
[tz
]) {
100 printf "%s:%d: missing comment\n", \
101 zone_table
, tz2NR
[tz
] >>"/dev/stderr"
112 if ($
1 ==
"Zone") tz = $
2
114 # Ignore Link commands if source and destination basenames
115 # are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
118 while ((i =
index(src
, "/"))) src =
substr(src
, i
+1)
119 while ((i =
index(dst
, "/"))) dst =
substr(dst
, i
+1)
120 if (src
!= dst
) tz = $
3
122 if (tz
&& tz ~
/\
//) {
124 printf "%s: no data for `%s'\n", zone_table
, tz \
135 printf "%s:%d: no Zone table for `%s'\n", \
136 zone_table
, tz2NR
[tz
], tz
>>"/dev/stderr"
141 if (0 < want_warnings
) {
142 for (cc in cc2name
) {
144 printf "%s:%d: warning:" \
145 "no Zone entries for %s (%s)\n",
146 iso_table
, cc2NR
[cc
], cc
, cc2name
[cc
]