diff options
| author | Philip Paeps <philip@FreeBSD.org> | 2025-01-17 01:31:42 +0000 |
|---|---|---|
| committer | Philip Paeps <philip@FreeBSD.org> | 2025-01-17 01:31:42 +0000 |
| commit | b4a294ba7e6013c296c42213799a25be87b635d7 (patch) | |
| tree | f29e255f9f117354379452dc18e942cc78f12e0b /checktab.awk | |
| parent | 62ad5eff805323c79d60cd902863fa8c29b863a8 (diff) | |
Diffstat (limited to 'checktab.awk')
| -rw-r--r-- | checktab.awk | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/checktab.awk b/checktab.awk index 9a26e4655ddb..5fa60556be13 100644 --- a/checktab.awk +++ b/checktab.awk @@ -9,6 +9,19 @@ BEGIN { if (!zone_table) zone_table = "zone1970.tab" if (!want_warnings) want_warnings = -1 + monthabbr["Jan"] = 1 + monthabbr["Feb"] = 1 + monthabbr["Mar"] = 1 + monthabbr["Apr"] = 1 + monthabbr["May"] = 1 + monthabbr["Jun"] = 1 + monthabbr["Jul"] = 1 + monthabbr["Aug"] = 1 + monthabbr["Sep"] = 1 + monthabbr["Oct"] = 1 + monthabbr["Nov"] = 1 + monthabbr["Dec"] = 1 + while (getline <iso_table) { iso_NR++ if ($0 ~ /^#/) continue @@ -65,6 +78,12 @@ BEGIN { split(ccs, cca, /,/) cc = cca[1] + if (tztab[tz]) { + printf "%s:%d: %s: duplicate Zone from line %d\n", \ + zone_table, zone_NR, tz, tz2NR[tz] + status = 1 + } + # Don't complain about a special case for Crimea in zone.tab. # FIXME: zone.tab should be removed, since it is obsolete. # Or at least put just "XX" in its country-code column. @@ -128,12 +147,14 @@ BEGIN { $1 ~ /^#/ { next } { - tz = rules = "" + tz = rules = stdoff = "" if ($1 == "Zone") { tz = $2 + stdoff = $3 ruleUsed[$4] = 1 if ($5 ~ /%/) rulePercentUsed[$4] = 1 - } else if ($1 == "Link" && zone_table == "zone.tab") { + } else if ($1 == "Link") { + if (zone_table == "zone.tab") { # Ignore Link commands if source and destination basenames # are identical, e.g. Europe/Istanbul versus Asia/Istanbul. src = $2 @@ -141,13 +162,27 @@ $1 ~ /^#/ { next } while ((i = index(src, "/"))) src = substr(src, i+1) while ((i = index(dst, "/"))) dst = substr(dst, i+1) if (src != dst) tz = $3 + } } else if ($1 == "Rule") { ruleDefined[$2] = 1 if ($10 != "-") ruleLetters[$2] = 1 + if (!monthabbr[$6]) { + printf "%s:%d: tricky month: %s\n", FILENAME, FNR, $6 \ + >>"/dev/stderr" + status = 1 + } } else { + stdoff = $1 ruleUsed[$2] = 1 if ($3 ~ /%/) rulePercentUsed[$2] = 1 } + + if (stdoff && stdoff !~ /^\-?1?[0-9](:[0-5][0-9](:[0-5][0-9])?)?$/) { + printf "%s:%d: unlikely STDOFF: %s\n", FILENAME, FNR, stdoff \ + >>"/dev/stderr" + status = 1 + } + if (tz && tz ~ /\// && tz !~ /^Etc\//) { if (!tztab[tz] && FILENAME != "backward" \ && zone_table != "zonenow.tab") { |
