summary refs log tree commit diff
path: root/timezone/checktab.awk
diff options
context:
space:
mode:
Diffstat (limited to 'timezone/checktab.awk')
-rw-r--r--timezone/checktab.awk20
1 files changed, 17 insertions, 3 deletions
diff --git a/timezone/checktab.awk b/timezone/checktab.awk
index fec4f628e5..d78ba73156 100644
--- a/timezone/checktab.awk
+++ b/timezone/checktab.awk
@@ -115,10 +115,14 @@ BEGIN {
 	FS = " "
 }
 
+$1 ~ /^#/ { next }
+
 {
-	tz = ""
-	if ($1 == "Zone") tz = $2
-	if ($1 == "Link") {
+	tz = rules = ""
+	if ($1 == "Zone") {
+		tz = $2
+		ruleUsed[$4] = 1
+	} else if ($1 == "Link") {
 		# Ignore Link commands if source and destination basenames
 		# are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
 		src = $2
@@ -126,6 +130,10 @@ BEGIN {
 		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
+	} else {
+		ruleUsed[$2] = 1
 	}
 	if (tz && tz ~ /\//) {
 		if (!tztab[tz]) {
@@ -138,6 +146,12 @@ BEGIN {
 }
 
 END {
+	for (tz in ruleDefined) {
+		if (!ruleUsed[tz]) {
+			printf "%s: Rule never used\n", tz
+			status = 1
+		}
+	}
 	for (tz in tz2cc) {
 		if (!zoneSeen[tz]) {
 			printf "%s:%d: no Zone table for `%s'\n", \