Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/time/checktab.awk,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libc/time/checktab.awk,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.7 retrieving revision 1.8 diff -u -p -r1.7 -r1.8 --- src/lib/libc/time/checktab.awk 2014/05/13 16:33:56 1.7 +++ src/lib/libc/time/checktab.awk 2014/08/15 11:04:07 1.8 @@ -1,4 +1,4 @@ -# $NetBSD: checktab.awk,v 1.7 2014/05/13 16:33:56 christos Exp $ +# $NetBSD: checktab.awk,v 1.8 2014/08/15 11:04:07 christos Exp $ # Check tz tables for consistency. @@ -8,12 +8,55 @@ BEGIN { FS = "\t" if (!iso_table) iso_table = "iso3166.tab" - if (!zone_table) zone_table = "zone.tab" + if (!zone_table) zone_table = "zone1970.tab" if (!want_warnings) want_warnings = -1 # A special (and we hope temporary) case. tztab["America/Montreal"] = 1 + # Some more special cases; these are zones that should probably + # be turned into links. + if (zone_table == "zone1970.tab") { + tztab["Africa/Addis_Ababa"] = 1 + tztab["Africa/Asmara"] = 1 + tztab["Africa/Bangui"] = 1 + tztab["Africa/Blantyre"] = 1 + tztab["Africa/Brazzaville"] = 1 + tztab["Africa/Bujumbura"] = 1 + tztab["Africa/Dar_es_Salaam"] = 1 + tztab["Africa/Djibouti"] = 1 + tztab["Africa/Douala"] = 1 + tztab["Africa/Gaborone"] = 1 + tztab["Africa/Harare"] = 1 + tztab["Africa/Kampala"] = 1 + tztab["Africa/Kigali"] = 1 + tztab["Africa/Kinshasa"] = 1 + tztab["Africa/Libreville"] = 1 + tztab["Africa/Luanda"] = 1 + tztab["Africa/Lubumbashi"] = 1 + tztab["Africa/Lusaka"] = 1 + tztab["Africa/Malabo"] = 1 + tztab["Africa/Maseru"] = 1 + tztab["Africa/Mbabane"] = 1 + tztab["Africa/Mogadishu"] = 1 + tztab["Africa/Niamey"] = 1 + tztab["Africa/Porto-Novo"] = 1 + tztab["America/Antigua"] = 1 + tztab["America/Cayman"] = 1 + tztab["Asia/Aden"] = 1 + tztab["Asia/Bahrain"] = 1 + tztab["Asia/Ho_Chi_Minh"] = 1 + tztab["Asia/Kuwait"] = 1 + tztab["Asia/Muscat"] = 1 + tztab["Asia/Phnom_Penh"] = 1 + tztab["Asia/Vientiane"] = 1 + tztab["Indian/Antananarivo"] = 1 + tztab["Indian/Comoro"] = 1 + tztab["Indian/Mayotte"] = 1 + tztab["Pacific/Midway"] = 1 + tztab["Pacific/Saipan"] = 1 + } + while (getline >"/dev/stderr" status = 1 } @@ -36,14 +79,14 @@ BEGIN { s = "out of order"; } - printf "%s:%d: country code `%s' is %s\n", \ + printf "%s:%d: country code '%s' is %s\n", \ iso_table, iso_NR, cc, s \ >>"/dev/stderr" status = 1 } cc0 = cc if (name2cc[name]) { - printf "%s:%d: `%s' and `%s' have the sname name\n", \ + printf "%s:%d: '%s' and '%s' have the sname name\n", \ iso_table, iso_NR, name2cc[name], cc \ >>"/dev/stderr" status = 1 @@ -53,7 +96,6 @@ BEGIN { cc2NR[cc] = iso_NR } - zone_table = "zone.tab" cc0 = "" while (getline >"/dev/stderr" status = 1 } - cc = $1 + split($1, cca, /,/) + cc = cca[1] coordinates = $2 tz = $3 comments = $4 if (cc < cc0) { - printf "%s:%d: country code `%s' is out of order\n", \ + printf "%s:%d: country code '%s' is out of order\n", \ zone_table, zone_NR, cc >>"/dev/stderr" status = 1 } cc0 = cc - cctz = cc tz - cctztab[cctz] = 1 tztab[tz] = 1 - tz2comments[cctz] = comments + tz2comments[tz] = comments tz2NR[tz] = zone_NR - if (cc2name[cc]) { + for (i in cca) { + cc = cca[i] + cctz = cc tz + cctztab[cctz] = 1 + if (cc2name[cc]) { cc_used[cc]++ - } else { + } else { printf "%s:%d: %s: unknown country code\n", \ zone_table, zone_NR, cc >>"/dev/stderr" status = 1 + } } if (coordinates !~ /^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$/ \ && 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]$/) { @@ -97,23 +143,26 @@ BEGIN { for (cctz in cctztab) { cc = substr (cctz, 1, 2) tz = substr (cctz, 3) - if (cc_used[cc] == 1) { - if (tz2comments[cctz]) { - printf "%s:%d: unnecessary comment `%s'\n", \ - zone_table, tz2NR[tz], \ - tz2comments[cctz] \ - >>"/dev/stderr" - status = 1 - } - } else { - if (!tz2comments[cctz]) { - printf "%s:%d: missing comment\n", \ - zone_table, tz2NR[tz] >>"/dev/stderr" - status = 1 - } + 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]) { + printf "%s:%d: unnecessary comment '%s'\n", \ + zone_table, tz2NR[tz], tz2comments[tz] \ + >>"/dev/stderr" + tz2comments[tz] = 0 + status = 1 + } else if (comments_needed[tz] && !tz2comments[tz]) { + printf "%s:%d: missing comment for %s\n", \ + zone_table, tz2NR[tz], comments_needed[tz] \ + >>"/dev/stderr" + status = 1 + } + } FS = " " } @@ -124,7 +173,7 @@ $1 ~ /^#/ { next } if ($1 == "Zone") { tz = $2 ruleUsed[$4] = 1 - } else if ($1 == "Link") { + } else if ($1 == "Link" && zone_table == "zone.tab") { # Ignore Link commands if source and destination basenames # are identical, e.g. Europe/Istanbul versus Asia/Istanbul. src = $2 @@ -139,7 +188,7 @@ $1 ~ /^#/ { next } } if (tz && tz ~ /\//) { if (!tztab[tz]) { - printf "%s: no data for `%s'\n", zone_table, tz \ + printf "%s: no data for '%s'\n", zone_table, tz \ >>"/dev/stderr" status = 1 } @@ -154,14 +203,13 @@ END { status = 1 } } - for (tz in tz2cc) { + for (tz in tztab) { if (!zoneSeen[tz]) { - printf "%s:%d: no Zone table for `%s'\n", \ + printf "%s:%d: no Zone table for '%s'\n", \ zone_table, tz2NR[tz], tz >>"/dev/stderr" status = 1 } } - if (0 < want_warnings) { for (cc in cc2name) { if (!cc_used[cc]) {