diff options
Diffstat (limited to 'tz/checktab.awk')
-rw-r--r-- | tz/checktab.awk | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/tz/checktab.awk b/tz/checktab.awk index ec145b5..23e0a3a 100644 --- a/tz/checktab.awk +++ b/tz/checktab.awk @@ -58,11 +58,12 @@ BEGIN { zone_table, zone_NR >>"/dev/stderr" status = 1 } - split($1, cca, /,/) - cc = cca[1] + ccs = input_ccs[zone_NR] = $1 coordinates = $2 tz = $3 - comments = $4 + comments = input_comments[zone_NR] = $4 + split(ccs, cca, /,/) + cc = cca[1] # Don't complain about a special case for Crimea in zone.tab. # FIXME: zone.tab should be removed, since it is obsolete. @@ -77,12 +78,9 @@ BEGIN { cc0 = cc tz0 = tz tztab[tz] = 1 - tz2comments[tz] = comments tz2NR[tz] = zone_NR for (i in cca) { cc = cca[i] - cctz = cc tz - cctztab[cctz] = 1 if (cc2name[cc]) { cc_used[cc]++ } else { @@ -99,27 +97,27 @@ BEGIN { } } - for (cctz in cctztab) { - cc = substr (cctz, 1, 2) - tz = substr (cctz, 3) - if (1 < cc_used[cc]) { - comments_needed[tz] = cc - } - } - for (cctz in cctztab) { - cc = substr (cctz, 1, 2) - tz = substr (cctz, 3) - if (!comments_needed[tz] && tz2comments[tz]) { + for (i = 1; i <= zone_NR; i++) { + ccs = input_ccs[i] + if (!ccs) continue + comments = input_comments[i] + split(ccs, cca, /,/) + used_max = 0 + for (j in cca) { + cc = cca[j] + if (used_max < cc_used[cc]) { + used_max = cc_used[cc] + } + } + if (used_max <= 1 && comments) { printf "%s:%d: unnecessary comment '%s'\n", \ - zone_table, tz2NR[tz], tz2comments[tz] \ - >>"/dev/stderr" - tz2comments[tz] = 0 + zone_table, i, comments \ + >>"/dev/stderr" status = 1 - } else if (comments_needed[tz] && !tz2comments[tz]) { + } else if (1 < cc_used[cc] && !comments) { printf "%s:%d: missing comment for %s\n", \ - zone_table, tz2NR[tz], comments_needed[tz] \ + zone_table, i, cc \ >>"/dev/stderr" - tz2comments[tz] = 1 status = 1 } } @@ -149,8 +147,8 @@ $1 ~ /^#/ { next } ruleUsed[$2] = 1 if ($3 ~ /%/) rulePercentUsed[$2] = 1 } - if (tz && tz ~ /\//) { - if (!tztab[tz]) { + if (tz && tz ~ /\// && tz !~ /^Etc\//) { + if (!tztab[tz] && FILENAME != "backward") { printf "%s: no data for '%s'\n", zone_table, tz \ >>"/dev/stderr" status = 1 @@ -173,7 +171,7 @@ END { } } for (tz in tztab) { - if (!zoneSeen[tz]) { + if (!zoneSeen[tz] && tz !~ /^Etc\//) { printf "%s:%d: no Zone table for '%s'\n", \ zone_table, tz2NR[tz], tz >>"/dev/stderr" status = 1 |