[tz] [PATCH 3/4] Fix minor problems found by static checking.

Paul Eggert eggert at cs.ucla.edu
Wed Sep 11 10:00:07 UTC 2013


Mostly this moves links so that files can be zic'ed standalone.
* antarctica (Antarctica/McMurdo): Move to australasia,
* australasia (Pacific/Johnston): Move to northamerica.
* checktab.awk: Add special case for America/Montreal, pending
the tzwinnow approach.
* northamerica (America/Anguilla, America/Dominica, America/Grenada)
(America/Guadeloupe, America/St_Barthelemy, America/Marigot)
(America/Montserrat, America/St_Kitts, America/St_Lucia)
(America/St_Vincent, America/Tortola, America/St_Thomas):
Move to southamerica.
* southamerica: Receive above-described moves.
* zic.c (writezone): Remove unused local.
---
 antarctica   |  4 ++--
 australasia  |  3 ++-
 checktab.awk |  3 +++
 northamerica | 23 +++++++++--------------
 southamerica | 13 +++++++++++++
 zic.c        |  1 -
 6 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/antarctica b/antarctica
index 234e59c..5333b7b 100644
--- a/antarctica
+++ b/antarctica
@@ -360,5 +360,5 @@ Zone Antarctica/Palmer	0	-	zzz	1965
 # makes all of the clocks run fast.  So every couple of days,
 # we have to go around and set them back 5 minutes or so.
 # Maybe if we let them run fast all of the time, we'd get to leave here sooner!!
-
-Link Pacific/Auckland Antarctica/McMurdo
+#
+# See 'australasia' for Antarctica/McMurdo.
diff --git a/australasia b/australasia
index c822b08..8685d00 100644
--- a/australasia
+++ b/australasia
@@ -496,6 +496,7 @@ Zone Pacific/Auckland	11:39:04 -	LMT	1868 Nov  2
 Zone Pacific/Chatham	12:13:48 -	LMT	1957 Jan  1
 			12:45	Chatham	CHA%sT
 
+Link Pacific/Auckland Antarctica/McMurdo
 
 # Auckland Is
 # uninhabited; Maori and Moriori, colonial settlers, pastoralists, sealers,
@@ -768,7 +769,7 @@ Zone Pacific/Funafuti	11:56:52 -	LMT	1901
 # We have no better information, so for now, assume this has been true
 # indefinitely into the past.
 #
-Link Pacific/Honolulu Pacific/Johnston
+# See 'northamerica' for Pacific/Johnston.
 
 # Kingman
 # uninhabited
diff --git a/checktab.awk b/checktab.awk
index 5cdce56..fec4f62 100644
--- a/checktab.awk
+++ b/checktab.awk
@@ -9,6 +9,9 @@ BEGIN {
 	if (!zone_table) zone_table = "zone.tab"
 	if (!want_warnings) want_warnings = -1
 
+	# A special (and we hope temporary) case.
+	tztab["America/Montreal"] = 1
+
 	while (getline <iso_table) {
 		iso_NR++
 		if ($0 ~ /^#/) continue
diff --git a/northamerica b/northamerica
index 55755dd..c3921d3 100644
--- a/northamerica
+++ b/northamerica
@@ -600,6 +600,8 @@ Zone Pacific/Honolulu	-10:31:26 -	LMT	1896 Jan 13 12:00 #Schmitt&Cox
 			-10:30	-	HST	1947 Jun  8 2:00 #Schmitt&Cox+2
 			-10:00	-	HST
 
+Link Pacific/Honolulu Pacific/Johnston
+
 # Now we turn to US areas that have diverged from the consensus since 1970.
 
 # Arizona mostly uses MST.
@@ -2547,7 +2549,7 @@ Zone America/Santa_Isabel	-7:39:28 -	LMT	1922 Jan  1  0:20:32
 ###############################################################################
 
 # Anguilla
-Link America/Port_of_Spain America/Anguilla
+# See 'southamerica'.
 
 # Antigua and Barbuda
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -2869,7 +2871,7 @@ Zone	America/Havana	-5:29:28 -	LMT	1890
 			-5:00	Cuba	C%sT
 
 # Dominica
-Link America/Port_of_Spain America/Dominica
+# See 'southamerica'.
 
 # Dominican Republic
 
@@ -2918,13 +2920,10 @@ Zone America/El_Salvador -5:56:48 -	LMT	1921		# San Salvador
 			-6:00	Salv	C%sT
 
 # Grenada
-Link America/Port_of_Spain America/Grenada
 # Guadeloupe
-Link America/Port_of_Spain America/Guadeloupe
 # St Barthelemy
-Link America/Port_of_Spain America/St_Barthelemy
 # St Martin (French part)
-Link America/Port_of_Spain America/Marigot
+# See 'southamerica'.
 
 # Guatemala
 #
@@ -3086,7 +3085,7 @@ Zone America/Martinique	-4:04:20 -      LMT	1890		# Fort-de-France
 			-4:00	-	AST
 
 # Montserrat
-Link America/Port_of_Spain America/Montserrat
+# See 'southamerica'.
 
 # Nicaragua
 #
@@ -3168,10 +3167,8 @@ Zone America/Puerto_Rico -4:24:25 -	LMT	1899 Mar 28 12:00    # San Juan
 			-4:00	-	AST
 
 # St Kitts-Nevis
-Link America/Port_of_Spain America/St_Kitts
-
 # St Lucia
-Link America/Port_of_Spain America/St_Lucia
+# See 'southamerica'.
 
 # St Pierre and Miquelon
 # There are too many St Pierres elsewhere, so we'll use 'Miquelon'.
@@ -3182,7 +3179,7 @@ Zone America/Miquelon	-3:44:40 -	LMT	1911 May 15	# St Pierre
 			-3:00	Canada	PM%sT
 
 # St Vincent and the Grenadines
-Link America/Port_of_Spain America/St_Vincent
+# See 'southamerica'.
 
 # Turks and Caicos
 #
@@ -3216,7 +3213,5 @@ Zone America/Grand_Turk	-4:44:32 -	LMT	1890
 			-5:00	TC	E%sT
 
 # British Virgin Is
-Link America/Port_of_Spain America/Tortola
-
 # Virgin Is
-Link America/Port_of_Spain America/St_Thomas
+# See 'southamerica'.
diff --git a/southamerica b/southamerica
index aab2e1a..464c548 100644
--- a/southamerica
+++ b/southamerica
@@ -1642,6 +1642,19 @@ Zone America/Paramaribo	-3:40:40 -	LMT	1911
 Zone America/Port_of_Spain -4:06:04 -	LMT	1912 Mar 2
 			-4:00	-	AST
 
+Link America/Port_of_Spain America/Anguilla
+Link America/Port_of_Spain America/Dominica
+Link America/Port_of_Spain America/Grenada
+Link America/Port_of_Spain America/Guadeloupe
+Link America/Port_of_Spain America/Marigot
+Link America/Port_of_Spain America/Montserrat
+Link America/Port_of_Spain America/St_Barthelemy
+Link America/Port_of_Spain America/St_Kitts
+Link America/Port_of_Spain America/St_Lucia
+Link America/Port_of_Spain America/St_Thomas
+Link America/Port_of_Spain America/St_Vincent
+Link America/Port_of_Spain America/Tortola
+
 # Uruguay
 # From Paul Eggert (1993-11-18):
 # Uruguay wins the prize for the strangest peacetime manipulation of the rules.
diff --git a/zic.c b/zic.c
index e59a15f..60bcdfa 100644
--- a/zic.c
+++ b/zic.c
@@ -1760,7 +1760,6 @@ writezone(const char *const name, const char *const string)
 		fprintf(fp, "name=%s%c", name, 0);
 	for (i = 0; i < genoptions; i++) {
 		register char const *v = genoption[i];
-		register int namelen = strchr(v, '=') - v;
 		fprintf(fp, "%s%c", v, 0);
 	}
 	fprintf(fp, "%c\n%s\n", 0, string);
-- 
1.8.1.2





More information about the tz mailing list