Module Name:    src
Committed By:   christos
Date:           Fri Aug 15 11:04:07 UTC 2014

Modified Files:
        src/lib/libc/time: Makefile NEWS Theory asctime.c checktab.awk ctime.3
            localtime.c private.h strftime.c time2posix.3 tz-art.htm
            tz-link.htm tzfile.5 tzfile.h tzselect.8 tzselect.ksh tzset.3
            zdump.8 zdump.c zic.8 zic.c

Log Message:
merge tzcode2014f via patch


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/Makefile
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/time/NEWS
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/Theory \
    src/lib/libc/time/tzfile.h
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/time/asctime.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/time/checktab.awk
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/time/ctime.3
cvs rdiff -u -r1.82 -r1.83 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/time/private.h \
    src/lib/libc/time/zdump.c
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/time/time2posix.3
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/time/tz-art.htm \
    src/lib/libc/time/tzselect.8
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/tzselect.ksh
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/time/tzset.3
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/zic.8
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/zic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/Makefile
diff -u src/lib/libc/time/Makefile:1.21 src/lib/libc/time/Makefile:1.22
--- src/lib/libc/time/Makefile:1.21	Tue Aug  5 11:45:49 2014
+++ src/lib/libc/time/Makefile	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,3 @@
-# <pre>
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -6,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2014e
+VERSION=	2014f
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -96,14 +95,14 @@ REDO=		posix_right
 YEARISTYPE=	./yearistype
 
 # Non-default libraries needed to link.
-# Add -lintl if you want to use `gettext' on Solaris.
+# Add -lintl if you want to use 'gettext' on Solaris.
 LDLIBS=
 
 # Add the following to the end of the "CFLAGS=" line as needed.
 #  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
-#  -DHAVE_ADJTIME=0 if `adjtime' does not exist (SVR0?)
+#  -DHAVE_ADJTIME=0 if 'adjtime' does not exist (SVR0?)
 #  -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
-#  -DHAVE_GETTEXT=1 if `gettext' works (GNU, Linux, Solaris); also see LDLIBS
+#  -DHAVE_GETTEXT=1 if 'gettext' works (GNU, Linux, Solaris); also see LDLIBS
 #  -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
 #	ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8).
 #  -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
@@ -124,7 +123,7 @@ LDLIBS=
 #	year 2000 grief
 #  -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
 #  -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
-#  -TTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
+#  -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
 #	the default is system-supplied, typically "/usr/lib/locale"
 #  -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
 #  -DNO_ERROR_IN_DST_GAP=1
@@ -136,14 +135,16 @@ LDLIBS=
 GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
 	-Wall -Wextra \
 	-Wbad-function-cast -Wcast-align -Wcast-qual \
-	-Wformat=2 -Winit-self \
+	-Wdeclaration-after-statement \
+	-Wformat=2 -Winit-self -Wjump-misses-init \
 	-Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
 	-Wnested-externs -Wno-address -Wno-cast-qual \
 	-Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \
 	-Wno-type-limits \
 	-Wno-unused-parameter -Woverlength-strings -Wpointer-arith \
 	-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
-	-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines \
+	-Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
+	-Wsuggest-attribute=pure -Wtrampolines \
 	-Wwrite-strings
 #
 # If you want to use System V compatibility code, add
@@ -237,7 +238,7 @@ ZIC=		$(zic) $(ZFLAGS)
 
 ZFLAGS=
 
-# The name of a Posix-compliant `awk' on your system.
+# The name of a Posix-compliant 'awk' on your system.
 AWK=		awk
 
 # The full path name of a Posix-compliant shell, preferably one that supports
@@ -267,16 +268,34 @@ VALIDATE_ENV = \
   SP_CHARSET_FIXED=YES \
   SP_ENCODING=UTF-8
 
-# INVALID_CHAR is a regular expression that matches invalid characters in
-# distributed files.  For now, stick to a safe subset of ASCII.
+# SAFE_CHAR is a regular expression that matches a safe character.
+# Some parts of this distribution are limited to safe characters;
+# others can use any UTF-8 character.
+# For now, the safe characters are a safe subset of ASCII.
 # The caller must set the shell variable 'sharp' to the character '#',
 # since Makefile macros cannot contain '#'.
 # TAB_CHAR is a single tab character, in single quotes.
 TAB_CHAR=	'	'
-INVALID_CHAR1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
-INVALID_CHAR2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
-INVALID_CHAR3=	'abcdefghijklmnopqrstuvwxyz{|}~'
-INVALID_CHAR=	'[^]'$(INVALID_CHAR1)$(INVALID_CHAR2)$(INVALID_CHAR3)'-]'
+SAFE_CHARSET1=	$(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@'
+SAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
+SAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
+SAFE_CHARSET=	]$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)-
+SAFE_CHAR=	'['$(SAFE_CHARSET)']'
+# NONSYM_CHAR is a regular expression that matches any character
+# except for a small number of symbols, where we prefer to stick with
+# ASCII renderings for the convenience of maintainers whose text editors
+# mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
+NONSYM_CHAR=	'[^–—°′″≈≠≤≥±−×÷∞←→↔·•§¶«»‘’‚‛“”„‟‹›「」『』〝〞〟]'
+
+# SAFE_LINE matches a line of safe characters.
+# SAFE_SHARP_LINE is similar, except any character can follow '#';
+# this is so that comments can contain non-ASCII characters.
+# NONSYM_LINE matches a line of non-symbols.
+# VALID_LINE matches a line of any validly-encoded characters.
+SAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
+SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(NONSYM_CHAR)'*)?$$'
+NONSYM_LINE=	'^'$(NONSYM_CHAR)'*$$'
+VALID_LINE=	'^.*$$'
 
 # Flags to give 'tar' when making a distribution.
 # Try to use flags appropriate for GNU tar.
@@ -299,7 +318,7 @@ AR=		ar
 # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
 RANLIB=		:
 
-TZCOBJS=	zic.o localtime.o asctime.o scheck.o ialloc.o
+TZCOBJS=	zic.o scheck.o ialloc.o
 TZDOBJS=	zdump.o localtime.o ialloc.o asctime.o
 DATEOBJS=	date.o localtime.o strftime.o asctime.o
 LIBSRCS=	localtime.c asctime.c difftime.c
@@ -315,21 +334,20 @@ MANTXTS=	newctime.3.txt newstrftime.3.tx
 			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
 			date.1.txt
 COMMON=		Makefile README
-DOCS=		NEWS Theory $(MANS) date.1 $(MANTXTS)
+WEB_PAGES=	tz-art.htm tz-link.htm
+DOCS=		NEWS Theory $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
 PRIMARY_YDATA=	africa antarctica asia australasia \
 		europe northamerica southamerica
 YDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
 NDATA=		systemv factory
 TDATA=		$(YDATA) $(NDATA)
-TABDATA=	iso3166.tab zone.tab leapseconds
+ZONETABLES=	zone1970.tab zone.tab
+TABDATA=	iso3166.tab leapseconds $(ZONETABLES)
 LEAP_DEPS=	leapseconds.awk leap-seconds.list
 DATA=		$(YDATA) $(NDATA) $(TABDATA) \
 			$(LEAP_DEPS) yearistype.sh
-WEB_PAGES=	tz-art.htm tz-link.htm
 AWK_SCRIPTS=	checktab.awk leapseconds.awk
-MISC=		usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
-			$(WEB_PAGES) $(AWK_SCRIPTS) workman.sh \
-			zoneinfo2tdf.pl
+MISC=		$(AWK_SCRIPTS) workman.sh zoneinfo2tdf.pl
 ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
 
 # And for the benefit of csh users on systems that assume the user
@@ -348,7 +366,7 @@ install:	all $(DATA) $(REDO) $(MANS)
 			$(DESTDIR)$(MANDIR)/man8
 		$(ZIC) -y $(YEARISTYPE) \
 			-d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
-		cp -f iso3166.tab zone.tab $(DESTDIR)$(TZDIR)/.
+		cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
 		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
 		cp libtz.a $(DESTDIR)$(LIBDIR)/.
 		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
@@ -435,10 +453,22 @@ tzselect:	tzselect.ksh
 check:		check_character_set check_tables check_web
 
 check_character_set: $(ENCHILADA)
-		sharp='#'; ! grep -n $(INVALID_CHAR) $(ENCHILADA)
-
-check_tables:	checktab.awk $(PRIMARY_YDATA)
-		$(AWK) -f checktab.awk $(PRIMARY_YDATA)
+		LC_ALL=en_US.utf8 && export LC_ALL && \
+		sharp='#' && \
+		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
+			$(MISC) $(SOURCES) $(WEB_PAGES) && \
+		! grep -Env $(SAFE_SHARP_LINE) $(YDATA) $(NDATA) iso3166.tab \
+			zone.tab leapseconds $(LEAP_DEPS) yearistype.sh && \
+		test $$(grep -Ecv $(SAFE_SHARP_LINE) Makefile) -eq 1 && \
+		! grep -Env $(NONSYM_LINE) README NEWS Theory $(MANS) date.1 \
+			zone1970.tab && \
+		! grep -Env $(VALID_LINE) $(ENCHILADA)
+
+check_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
+		for tab in $(ZONETABLES); do \
+		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
+		    || exit; \
+		done
 
 check_web:	$(WEB_PAGES)
 		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
@@ -517,7 +547,7 @@ check_public:	$(ENCHILADA)
 # Check that the code works under various alternative
 # implementations of time_t.
 check_time_t_alternatives:
-		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone.tab` && \
+		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
 		for type in $(TIME_T_ALTERNATIVES); do \
 		  mkdir -p tzpublic/$$type && \
 		  make clean_misc && \
@@ -586,3 +616,10 @@ zdump.o:	version.h
 zic.o:		private.h tzfile.h version.h
 
 .KEEP_STATE:
+
+.PHONY: ALL INSTALL all
+.PHONY: check check_character_set check_public check_tables
+.PHONY: check_time_t_alternatives check_web clean clean_misc
+.PHONY: install maintainer-clean names posix_only posix_right
+.PHONY: public right_only right_posix signatures tarballs typecheck
+.PHONY: zonenames zones

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.4 src/lib/libc/time/NEWS:1.5
--- src/lib/libc/time/NEWS:1.4	Sat Jun 14 13:49:27 2014
+++ src/lib/libc/time/NEWS	Fri Aug 15 07:04:07 2014
@@ -1,5 +1,214 @@
 News for the tz database
 
+Release 2014f - 2014-08-05 17:42:36 -0700
+
+  Changes affecting future time stamps
+
+    Russia will subtract an hour from most of its time zones on 2014-10-26
+    at 02:00 local time.  (Thanks to Alexander Krivenyshev.)
+    There are a few exceptions: Magadan Oblast (Asia/Magadan) and Zabaykalsky
+    Krai are subtracting two hours; conversely, Chukotka Autonomous Okrug
+    (Asia/Anadyr), Kamchatka Krai (Asia/Kamchatka), Kemerovo Oblast
+    (Asia/Novokuznetsk), and the Samara Oblast and the Udmurt Republic
+    (Europe/Samara) are not changing their clocks.  The changed zones are
+    Europe/Kaliningrad, Europe/Moscow, Europe/Simferopol, Europe/Volgograd,
+    Asia/Yekaterinburg, Asia/Omsk, Asia/Novosibirsk, Asia/Krasnoyarsk,
+    Asia/Irkutsk, Asia/Yakutsk, Asia/Vladivostok, Asia/Khandyga,
+    Asia/Sakhalin, and Asia/Ust-Nera; Asia/Magadan will have two hours
+    subtracted; and Asia/Novokuznetsk's time zone abbreviation is affected,
+    but not its UTC offset.  Two zones are added: Asia/Chita (split
+    from Asia/Yakutsk, and also with two hours subtracted) and
+    Asia/Srednekolymsk (split from Asia/Magadan, but with only one hour
+    subtracted).  (Thanks to Tim Parenti for much of the above.)
+
+  Changes affecting time zone abbreviations
+
+    Australian eastern time zone abbreviations are now AEST/AEDT not EST,
+    and similarly for the other Australian zones.  That is, for eastern
+    standard and daylight saving time the abbreviations are AEST and AEDT
+    instead of the former EST for both; similarly, ACST/ACDT, ACWST/ACWDT,
+    and AWST/AWDT are now used instead of the former CST, CWST, and WST.
+    This change does not affect UTC offsets, only time zone abbreviations.
+    (Thanks to Rich Tibbett and many others.)
+
+    Asia/Novokuznetsk shifts from NOVT to KRAT (remaining on UTC+7)
+    effective 2014-10-26 at 02:00 local time.
+
+    The time zone abbreviation for Xinjiang Time (observed in Ürümqi)
+    has been changed from URUT to XJT.  (Thanks to Luther Ma.)
+
+    Prefer MSK/MSD for Moscow time in Russia, even in other cities.
+    Similarly, prefer EET/EEST for eastern European time in Russia.
+
+    Change time zone abbreviations in (western) Samoa to use "ST" and
+    "DT" suffixes, as this is more likely to match common practice.
+    Prefix "W" to (western) Samoa time when its standard-time offset
+    disagrees with that of American Samoa.
+
+    America/Metlakatla now uses PST, not MeST, to abbreviate its time zone.
+
+    Time zone abbreviations have been updated for Japan's two time
+    zones used 1896-1937.  JWST now stands for Western Standard
+    Time, and JCST for Central Standard Time (formerly this was CJT).
+    These abbreviations are now used for time in Korea, Taiwan,
+    and Sakhalin while controlled by Japan.
+
+  Changes affecting past time stamps
+
+    China's five zones have been simplified to two, since the post-1970
+    differences in the other three seem to have been imaginary.  The
+    zones Asia/Harbin, Asia/Chongqing, and Asia/Kashgar have been
+    removed; backwards-compatibility links still work, albeit with
+    different behaviors for time stamps before May 1980.  Asia/Urumqi's
+    1980 transition to UTC+8 has been removed, so that it is now at
+    UTC+6 and not UTC+8.  (Thanks to Luther Ma and to Alois Treindl;
+    Treindl sent helpful translations of two papers by Guo Qingsheng.)
+
+    Some zones have been turned into links, when they differed from existing
+    zones only for older UTC offsets where the data were likely invented.
+    These changes affect UTC offsets in pre-1970 time stamps only.  This is
+    similar to the change in release 2013e, except this time for western
+    Africa.  The affected zones are: Africa/Bamako, Africa/Banjul,
+    Africa/Conakry, Africa/Dakar, Africa/Freetown, Africa/Lome,
+    Africa/Nouakchott, Africa/Ouagadougou, Africa/Sao_Tome, and
+    Atlantic/St_Helena.  This also affects the backwards-compatibility
+    link Africa/Timbuktu.  (Thanks to Alan Barrett, Stephen Colebourne,
+    Tim Parenti, and David Patte for reporting problems in earlier
+    versions of this change.)
+
+    Asia/Shanghai's pre-standard-time UT offset has been changed from
+    8:05:57 to 8:05:43, the location of Xujiahui Observatory.  Its
+    transition to standard time has been changed from 1928 to 1901.
+
+    Asia/Taipei switched to JWST on 1896-01-01, then to JST on 1937-10-01,
+    then to CST on 1945-09-21 at 01:00, and did not observe DST in 1945.
+    In 1946 it observed DST from 05-15 through 09-30; in 1947
+    from 04-15 through 10-31; and in 1979 from 07-01 through 09-30.
+    (Thanks to Yu-Cheng Chuang.)
+
+    Asia/Riyadh's transition to standard time is now 1947-03-14, not 1950.
+
+    Europe/Helsinki's 1942 fall-back transition was 10-04 at 01:00, not
+    10-03 at 00:00.  (Thanks to Konstantin Hyppönen.)
+
+    Pacific/Pago_Pago has been changed from UTC-11:30 to UTC-11 for the period
+    from 1911 to 1950.
+
+    Pacific/Chatham has been changed to New Zealand standard time plus
+    45 minutes for the period before 1957, reflecting a 1956 remark in
+    the New Zealand parliament.
+
+    Europe/Budapest has several pre-1946 corrections: in 1918 the transition
+    out of DST was on 09-16, not 09-29; in 1919 it was on 11-24, not 09-15; in
+    1945 it was on 11-01, not 11-03; in 1941 the transition to DST was 04-08
+    not 04-06 at 02:00; and there was no DST in 1920.
+
+    Africa/Accra is now assumed to have observed DST from 1920 through 1935.
+
+    Time in Russia before 1927 or so has been corrected by a few seconds in
+    the following zones: Europe/Moscow, Asia/Irkutsk, Asia/Tbilisi,
+    Asia/Tashkent, Asia/Vladivostok, Asia/Yekaterinburg, Europe/Helsinki, and
+    Europe/Riga.  Also, Moscow's location has been changed to its Kilometer 0
+    point.  (Thanks to Vladimir Karpinsky for the Moscow changes.)
+
+  Changes affecting data format
+
+    A new file 'zone1970.tab' supersedes 'zone.tab' in the installed data.
+    The new file's extended format allows multiple country codes per zone.
+    The older file is still installed but is deprecated; its format is
+    not changing and it will still be distributed for a while, but new
+    applications should use the new file.
+
+    The new file format simplifies maintenance of obscure locations.
+    To test this, it adds coverage for the Crozet Islands and the
+    Scattered Islands.  (Thanks to Tobias Conradi and Antoine Leca.)
+
+    The file 'iso3166.tab' is planned to switch from ASCII to UTF-8.
+    It is still ASCII now, but commentary about the switch has been added.
+    The new file 'zone1970.tab' already uses UTF-8.
+
+  Changes affecting code
+
+    'localtime', 'mktime', etc. now use much less stack space if ALL_STATE
+    is defined.  (Thanks to Elliott Hughes for reporting the problem.)
+
+    'zic' no longer mishandles input when ignoring case in locales that
+    are not compatible with English, e.g., unibyte Turkish locales when
+    compiled with HAVE_GETTEXT.
+
+    Error diagnostics of 'zic' and 'yearistype' have been reworded so that
+    they no longer use ASCII '-' as if it were a dash.
+
+    'zic' now rejects output file names that contain '.' or '..' components.
+    (Thanks to Tim Parenti for reporting the problem.)
+
+    'zic -v' now warns about output file names that do not follow
+    POSIX rules, or that contain a digit or '.'.  (Thanks to Arthur
+    David Olson for starting the ball rolling on this.)
+
+    Some lint has been removed when using GCC_DEBUG_FLAGS with GCC 4.9.0.
+
+  Changes affecting build procedure
+
+    'zic' no longer links in localtime.o and asctime.o, as they're not needed.
+    (Thanks to John Cochran.)
+
+  Changes affecting documentation and commentary
+
+    The 'Theory' file documents legacy names, the longstanding
+    exceptions to the POSIX-inspired file name rules.
+
+    The 'zic' documentation clarifies the role of time types when
+    interpreting dates.  (Thanks to Arthur David Olson.)
+
+    Documentation and commentary now prefer UTF-8 to US-ASCII,
+    allowing the use of proper accents in foreign words and names.
+    Code and data have not changed because of this.  (Thanks to
+    Garrett Wollman, Ian Abbott, and Guy Harris for helping to debug
+    this.)
+
+    Non-HTML documentation and commentary now use plain-text URLs instead of
+    HTML insertions, and are more consistent about bracketing URLs when they
+    are not already surrounded by white space.  (Thanks to suggestions by
+    Steffen Nurpmeso.)
+
+    There is new commentary about Xujiahui Observatory, the five timezone
+    project in China from 1918 to 1949, timekeeping in Japanese-occupied
+    Shanghai, and Tibet Time in the 1950s.  The sharp-eyed can spot the
+    warlord Jin Shuren in the data.
+
+    Commentary about the coverage of each Russian zone has been standardized.
+    (Thanks to Tim Parenti).
+
+    There is new commentary about contemporary timekeeping in Ethiopia.
+
+    Obsolete comments about a 2007 proposal for DST in Kuwait has been removed.
+
+    There is new commentary about time in Poland in 1919.
+
+    Proper credit has been given to DST inventor George Vernon Hudson.
+
+    Commentary about time in Metlakatla, AK and Resolute, NU has been
+    improved, with a new source for the former.
+
+    In zone.tab, Pacific/Easter no longer mentions Salas y Gómez, as it
+    is uninhabited.
+
+    Commentary about permanent Antarctic bases has been updated.
+
+    Several typos have been corrected.  (Thanks to Tim Parenti for
+    contributing some of these fixes.)
+
+    tz-link.htm now mentions the JavaScript libraries Moment Timezone,
+    TimezoneJS.Date, Walltime-js, and Timezone.  (Thanks to a heads-up
+    from Matt Johnson.)  Also, it mentions the Go 'latlong' package.
+    (Thanks to a heads-up from Dirkjan Ochtman.)
+
+    The files usno1988, usno1989, usno1989a, usno1995, usno1997, and usno1998
+    have been removed.  These obsolescent US Naval Observatory entries were no
+    longer helpful for maintenance.  (Thanks to Tim Parenti for the suggestion.)
+
+
 Release 2014e - 2014-06-12 21:53:52 -0700
 
   Changes affecting near-future time stamps
@@ -140,9 +349,9 @@ Release 2014a - 2014-03-07 23:30:29 -080
     The boundary of the US Pacific time zone is given more accurately.
     (Thanks to Alan Mintz.)
 
-    Chile's 2014 DST will be as predicted.  (Thanks to Jose Miguel Garrido.)
+    Chile's 2014 DST will be as predicted.  (Thanks to José Miguel Garrido.)
 
-    Paraguay's 2014 DST will be as predicted.  (Thanks to Carlos Raul Perasso.)
+    Paraguay's 2014 DST will be as predicted.  (Thanks to Carlos Raúl Perasso.)
 
     Better descriptions of countries with same time zone history as
     Trinidad and Tobago since 1970.  (Thanks to Alan Barrett for suggestion.)
@@ -165,7 +374,7 @@ Release 2014a - 2014-03-07 23:30:29 -080
 
       Mention the timezone-olson Haskell package.
 
-      Mention zeitverschiebung.net.  (Thanks to Martin Jaeger.)
+      Mention zeitverschiebung.net.  (Thanks to Martin Jäger.)
 
       Remove moribund links to daylight-savings-time.info and to
       Simple Timer + Clocks.
@@ -198,7 +407,7 @@ Release 2013i - 2013-12-17 07:25:23 -080
   Changes affecting documentation and commentary
 
     The files solar87, solar88, and solar89 are no longer distributed.
-    They were a negative experiment -- that is, a demonstration that
+    They were a negative experiment - that is, a demonstration that
     tz data can represent solar time only with some difficulty and error.
     Their presence in the distribution caused confusion, as Riyadh
     civil time was generally not solar time in those years.
@@ -231,7 +440,7 @@ Release 2013h - 2013-10-25 15:32:32 -070
     The 'tzselect' command no longer requires the 'select' command,
     and should now work with /bin/sh on more platforms.  It also works
     around a bug in BusyBox awk before version 1.21.0.  (Thanks to
-    Patrick 'P. J.' McDermott.)
+    Patrick 'P. J.' McDermott and Alan Barrett.)
 
   Changes affecting code
 
@@ -365,7 +574,7 @@ Release 2013e - 2013-09-19 23:50:04 -070
     Use ART (UTC-3, standard time), rather than WARST (also UTC-3, but
     daylight saving time) for San Luis, Argentina since 2009.
 
-  Changes affecting Godthab time stamps after 2037 if version mismatch
+  Changes affecting Godthåb time stamps after 2037 if version mismatch
 
     Allow POSIX-like TZ strings where the transition time's hour can
     range from -167 through 167, instead of the POSIX-required 0
@@ -627,7 +836,7 @@ Release 2013c - 2013-04-19 16:17:40 -070
 
     Assume that the recent change to Paraguay's DST rules is permanent,
     by moving the end of DST to the 4th Sunday in March every year.
-    (Thanks to Carlos Raul Perasso.)
+    (Thanks to Carlos Raúl Perasso.)
 
   Changes affecting past time stamps:
 
@@ -688,7 +897,7 @@ Release 2013a - 2013-02-27 09:20:35 -080
   Change affecting binary data format:
 
     The zone offset at the end of version-2-format zone files is now
-    allowed to be 24:00, as per POSIX.1-2008.  (Thanks to Arthor David Olson.)
+    allowed to be 24:00, as per POSIX.1-2008.  (Thanks to Arthur David Olson.)
 
   Changes affecting current and future time stamps:
 
@@ -925,7 +1134,7 @@ Release data2011m - 2011-10-24 21:42:16 
   version numbers there...)
 
 
-Release data2011l -  2011-10-10 11:15:43 +0700
+Release data2011l - 2011-10-10 11:15:43 +0700
 
   There are just 2 changes that cause different generated tzdata files from
   zic, to Asia/Hebron and Pacific/Fiji - the possible change for Bahia, Brazil
@@ -955,7 +1164,7 @@ Release 2011i - 2011-08-29 05:56:32 -040
 
 Release data2011h - 2011-06-15 18:41:48 -0400
 
-  Russia and Curacao changes
+  Russia and Curaçao changes
 
 
 Release 2011g - 2011-04-25 09:07:22 -0400
@@ -1020,7 +1229,7 @@ Release 2010k - 2010-07-26 10:42:27 -040
 
 Release 2010j - 2010-05-10 09:07:48 -0400
 
-  changes for Bahia de Banderas and for version naming
+  changes for Bahía de Banderas and for version naming
 
 
 Release data2010i - 2010-04-16 18:50:45 -0400
@@ -1123,7 +1332,7 @@ Release data2009m - 2009-09-03 10:23:43 
 
 Release data2009l - 2009-08-14 09:13:07 -0400
 
-  Samao (comments only) and Egypt
+  Samoa (comments only) and Egypt
 
 
 Release 2009k - 2009-07-20 09:46:08 -0400
@@ -1206,7 +1415,7 @@ Release data2008f - 2008-09-09 22:33:26 
 
 Release 2008e - 2008-07-28 14:11:17 -0400
 
-  changes by Arthur David Olson and Jesper Norgaard Welen
+  changes by Arthur David Olson and Jesper Nørgaard Welen
 
 
 Release data2008d - 2008-07-07 09:51:38 -0400
@@ -1451,7 +1660,7 @@ Release 2005o - 2005-11-28 10:55:26 -050
 
 Release 2005n - 2005-10-03 09:44:09 -0400
 
-  changes by Paul Eggert (both the Uruguary changes and the Kyrgyzstan
+  changes by Paul Eggert (both the Uruguay changes and the Kyrgyzstan
   et al. changes)
 
 
@@ -1601,7 +1810,7 @@ Release 2004c - 2004-08-11 12:06:26 -040
 
 Release 2004b - 2004-07-19 14:33:35 -0400
 
-  data changes by Paul Eggert--most importantly, updates for Argentina
+  data changes by Paul Eggert - most importantly, updates for Argentina
 
 
 Release 2004a - 2004-05-27 12:00:47 -0400
@@ -1697,7 +1906,7 @@ Release 2001b - 2001-04-05 16:44:38 -040
 
   changes by Paul Eggert (modulo jnorgard's typo fix)
 
-  tz-art.htm has been htmlified.
+  tz-art.htm has been HTMLified.
 
 
 Release 2001a - 2001-03-13 12:57:44 -0500
@@ -1718,7 +1927,7 @@ Release 2000h - 2000-12-14 15:33:38 -050
 
   one typo fix in the "art" file
 
-  With providence, this is the last update of the millenium.
+  With providence, this is the last update of the millennium.
 
 
 Release 2000g - 2000-10-10 11:35:22 -0400
@@ -1966,7 +2175,7 @@ Release code1997f-data1997g - 1997-07-19
 
   a small change to a function prototype;
 
-  "Music" has been renamed "Arts.htm", htmlified, and augmented to
+  "Music" has been renamed "Arts.htm", HTMLified, and augmented to
   include information on Around the World in Eighty Days.
 
 
@@ -1976,7 +2185,7 @@ Release code1997e-data1997f - 1997-05-03
 
   changes inspired by the item circulated on Slovenia
 
-  The description of Web resources has been htmlified for browsing
+  The description of Web resources has been HTMLified for browsing
   convenience.
 
   A new piece of tz-related music has been added to the "Music" file.
@@ -2078,7 +2287,7 @@ Release code96g - 1996-05-16 14:00:26 -0
   fix for the simultaneous-DST-and-zone-change challenge
 
 
-Release data96h - 1996-05-09 17:40:51-0400
+Release data96h - 1996-05-09 17:40:51 -0400
 
   changes by Paul Eggert
 
@@ -2116,7 +2325,7 @@ Release data96d - 1996-03-18 20:49:39 -0
   [not summarized]
 
 
-Release code96e -  1996-02-29 15:43:27 -0000
+Release code96e - 1996-02-29 15:43:27 -0000
   [tzcode96e.tar.gz is missing!]
 
   internationalization changes and the fix to the documentation for strftime
@@ -2134,7 +2343,7 @@ Release data96b - 1996-01-27 15:44:42 -0
   Kiribati change
 
 
-Release code96c - 1996-01-16 16:58:15-0500
+Release code96c - 1996-01-16 16:58:15 -0500
 
   leap-year streamlining and binary-search changes
 
@@ -2200,8 +2409,8 @@ Release code95e - 1995-10-13 13:23:57 -0
 
 Release data95i - 1995-09-26 10:43:26 -0400
 
-  For Canada/Central, guess that the Sun customer's ``one week too
-  early'' was just a approximation, and the true error is one month
+  For Canada/Central, guess that the Sun customer's "one week too
+  early" was just a approximation, and the true error is one month
   too early.  This is consistent with the rest of Canada.
 
 
@@ -2268,10 +2477,10 @@ Release 94h - 1994-12-10 12:51:14 -0500
   *	incorporate the table changes by Paul Eggert;
 
   *	include (and document) support for universal time specifications in
-	data files--but do not (yet) include use of this feature in the
+	data files - but do not (yet) include use of this feature in the
 	data files.
 
-  Think of this as "TZ Classic"--the software has been set up not to break if
+  Think of this as "TZ Classic" - the software has been set up not to break if
   universal time shows up in its input, and the data has been left as is so as
   not to break existing implementations.
 
@@ -2324,7 +2533,7 @@ Release 94b - 1994-02-07 10:04:33 -0500
   as extensive as Shanks but has a few goodies of its own.  I used it
   to update the tables.  I also fixed some more as a result of
   correspondence with Adam David and Peter Ilieve, and move some stray
-  links from `europe' to `backward'.  I corrected some scanning errors
+  links from 'europe' to 'backward'.  I corrected some scanning errors
   in usno1989.
 
   As far as the code goes, I fixed zic to allow years in the range
@@ -2374,14 +2583,14 @@ Release 93b - 1993-02-02 14:53:58 -0500
 
 Release 93 - 1993-01-08 07:01:06 -0500
 
-  At kre's suggestion, the package has been split in two--a code piece
+  At kre's suggestion, the package has been split in two - a code piece
   (which also includes documentation) that's only of use to folks who
   want to recompile things and a data piece useful to anyone who can
   run "zic".
 
   The new version has a few changes to the data files, a few
   portability changes, and an off-by-one fix (with thanks to
-  Tom-Karzes at deshaw.com for providing a description and a
+  Tom Karzes at deshaw.com for providing a description and a
   solution).
 
 
@@ -2454,3 +2663,7 @@ Earlier versions of the code and data we
 list and are not summarized here.
 
 This file is in the public domain.
+
+Local Variables:
+coding: utf-8
+End:

Index: src/lib/libc/time/Theory
diff -u src/lib/libc/time/Theory:1.14 src/lib/libc/time/Theory:1.15
--- src/lib/libc/time/Theory:1.14	Fri Sep 20 15:06:54 2013
+++ src/lib/libc/time/Theory	Fri Aug 15 07:04:07 2014
@@ -87,16 +87,16 @@ POSIX has the following properties and l
 
 *	In POSIX, there's no tamper-proof way for a process to learn the
 	system's best idea of local wall clock.  (This is important for
-	applications that an administrator wants used only at certain times--
+	applications that an administrator wants used only at certain times -
 	without regard to whether the user has fiddled the "TZ" environment
 	variable.  While an administrator can "do everything in UTC" to get
 	around the problem, doing so is inconvenient and precludes handling
-	daylight saving time shifts--as might be required to limit phone
+	daylight saving time shifts - as might be required to limit phone
 	calls to off-peak hours.)
 
 *	POSIX requires that systems ignore leap seconds.
 
-*	The tz code attempts attempts to support all the time_t implementations
+*	The tz code attempts to support all the time_t implementations
 	allowed by POSIX.  The time_t type represents a nonnegative count of
 	seconds since 1970-01-01 00:00:00 UTC, ignoring leap seconds.
 	In practice, time_t is usually a signed 64- or 32-bit integer; 32-bit
@@ -156,7 +156,7 @@ These are the extensions that have been 
 	"tzsetwall();" if such code is moved to "old" systems that don't
 	provide tzsetwall, you won't be able to generate an executable program.
 	(These time zone functions also arrange for local wall clock time to be
-	used if tzset is called--directly or indirectly--and there's no "TZ"
+	used if tzset is called - directly or indirectly - and there's no "TZ"
 	environment variable; portable applications should not, however, rely
 	on this behavior since it's not the way SVR2 systems behave.)
 
@@ -194,7 +194,7 @@ Points of interest to folks with other s
 
 The functions that are conditionally compiled if STD_INSPIRED is defined
 should, at this point, be looked on primarily as food for thought.  They are
-not in any sense "standard compatible"--some are not, in fact, specified in
+not in any sense "standard compatible" - some are not, in fact, specified in
 *any* standard.  They do, however, represent responses of various authors to
 standardization proposals.
 
@@ -405,7 +405,8 @@ in decreasing order of importance:
 		digits, as that might create an ambiguity with POSIX
 		TZ strings.  A file name component must not exceed 14
 		characters or start with '-'.  E.g., prefer 'Brunei'
-		to 'Bandar_Seri_Begawan'.
+		to 'Bandar_Seri_Begawan'.  Exceptions: see the discussion
+		of legacy names below.
 	A name must not be empty, or contain '//', or start or end with '/'.
 	Do not use names that differ only in case.  Although the reference
 		implementation is case-sensitive, some other implementations
@@ -424,14 +425,14 @@ in decreasing order of importance:
 		even if subregions' clocks disagreed before 1970.
 		Otherwise these tables would become annoyingly large.
 	If a name is ambiguous, use a less ambiguous alternative;
-		e.g. many cities are named San Jose and Georgetown, so
+		e.g. many cities are named San José and Georgetown, so
 		prefer 'Costa_Rica' to 'San_Jose' and 'Guyana' to 'Georgetown'.
 	Keep locations compact.  Use cities or small islands, not countries
 		or regions, so that any future time zone changes do not split
 		locations into different time zones.  E.g. prefer 'Paris'
 		to 'France', since France has had multiple time zones.
 	Use mainstream English spelling, e.g. prefer 'Rome' to 'Roma', and
-		prefer 'Athens' to the true name (which uses Greek letters).
+		prefer 'Athens' to the Greek 'Αθήνα' or the Romanized 'Athína'.
 		The POSIX file name restrictions encourage this rule.
 	Use the most populous among locations in a zone,
 		e.g. prefer 'Shanghai' to 'Beijing'.  Among locations with
@@ -454,21 +455,32 @@ in decreasing order of importance:
 	If a name is changed, put its old spelling in the 'backward' file.
 		This means old spellings will continue to work.
 
-The file 'zone.tab' lists geographical locations used to name time
+The file 'zone1970.tab' lists geographical locations used to name time
 zone rule files.  It is intended to be an exhaustive list of names
 for geographic regions as described above; this is a subset of the
-names in the data.  Although a 'zone.tab' location's longitude
+names in the data.  Although a 'zone1970.tab' location's longitude
 corresponds to its LMT offset with one hour for every 15 degrees east
 longitude, this relationship is not exact.
 
 Older versions of this package used a different naming scheme,
 and these older names are still supported.
 See the file 'backward' for most of these older names
-(e.g. 'US/Eastern' instead of 'America/New_York');
-excluding 'backward' should not affect the other data.
+(e.g., 'US/Eastern' instead of 'America/New_York').
 The other old-fashioned names still supported are
 'WET', 'CET', 'MET', and 'EET' (see the file 'europe').
 
+Older versions of this package defined legacy names that are
+incompatible with the first rule of location names, but which are
+still supported.  These legacy names are mostly defined in the file
+'etcetera'.  Also, the file 'backward' defines the legacy names
+'GMT0', 'GMT-0', 'GMT+0' and 'Canada/East-Saskatchewan', and the file
+'northamerica' defines the legacy names 'EST5EDT', 'CST6CDT',
+'MST7MDT', and 'PST8PDT'.
+
+Excluding 'backward' should not affect the other data.  If
+'backward' is excluded, excluding 'etcetera' should not affect the
+remaining data.
+
 
 ----- Time zone abbreviations -----
 
@@ -530,10 +542,10 @@ in decreasing order of importance:
 		in some sense, asleep.
 
 Application writers should note that these abbreviations are ambiguous
-in practice: e.g. 'EST' has a different meaning in Australia than
+in practice: e.g. 'CST' has a different meaning in China than
 it does in the United States.  In new applications, it's often better
-to use numeric UT offsets like '-0500' instead of time zone
-abbreviations like 'EST'; this avoids the ambiguity.
+to use numeric UT offsets like '-0600' instead of time zone
+abbreviations like 'CST'; this avoids the ambiguity.
 
 
 ----- Calendrical issues -----
@@ -542,10 +554,9 @@ Calendrical issues are a bit out of scop
 but they indicate the sort of problems that we would run into if we
 extended the time zone database further into the past.  An excellent
 resource in this area is Nachum Dershowitz and Edward M. Reingold,
-<a href="http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/";>
-Calendrical Calculations: Third Edition
-</a>, Cambridge University Press (2008).  Other information and
-sources are given below.  They sometimes disagree.
+Calendrical Calculations: Third Edition, Cambridge University Press (2008)
+<http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/>.
+Other information and sources are given below.  They sometimes disagree.
 
 
 France
@@ -574,7 +585,7 @@ From: Petteri Sulonen (via Usenet)
 Date: 14 Jan 1999 00:00:00 GMT
 ...
 
-If your source is correct, how come documents between 1929 -- 1940 were
+If your source is correct, how come documents between 1929 and 1940 were
 still dated using the conventional, Gregorian calendar?
 
 I can post a scan of a document dated December 1, 1934, signed by
@@ -586,15 +597,14 @@ Executive Committee of the Supreme Sovie
 Sweden (and Finland)
 
 From: Mark Brader
-<a href="news:1996jul6.012937.29...@sq.com";>
-Subject: Re: Gregorian reform -- a part of locale?
-</a>
+Subject: Re: Gregorian reform - a part of locale?
+<news:1996jul6.012937.29...@sq.com>
 Date: 1996-07-06
 
 In 1700, Denmark made the transition from Julian to Gregorian.  Sweden
 decided to *start* a transition in 1700 as well, but rather than have one of
 those unsightly calendar gaps :-), they simply decreed that the next leap
-year after 1696 would be in 1744 -- putting the whole country on a calendar
+year after 1696 would be in 1744 - putting the whole country on a calendar
 different from both Julian and Gregorian for a period of 40 years.
 
 However, in 1704 something went wrong and the plan was not carried through;
@@ -606,9 +616,9 @@ Then in 1753, Sweden made the transition
 getting there only 13 years behind the original schedule.
 
 (A previous posting of this story was challenged, and Swedish readers
-produced the following references to support it: "Tiderakning och historia"
-by Natanael Beckman (1924) and "Tid, en bok om tiderakning och
-kalendervasen" by Lars-Olof Lode'n (no date was given).)
+produced the following references to support it: "Tideräkning och historia"
+by Natanael Beckman (1924) and "Tid, en bok om tideräkning och
+kalenderväsen" by Lars-Olof Lodén (1968).
 
 
 Grotefend's data
@@ -629,23 +639,23 @@ Gregorian calendar:
 
 21 Dec 1582/
    01 Jan 1583 - Holland, Brabant, Flanders, Hennegau
-10/21 Feb 1583 - bishopric of Liege (L"uttich)
+10/21 Feb 1583 - bishopric of Liege (Lüttich)
 13/24 Feb 1583 - bishopric of Augsburg
 04/15 Oct 1583 - electorate of Trier
 05/16 Oct 1583 - Bavaria, bishoprics of Freising, Eichstedt, Regensburg,
                  Salzburg, Brixen
-13/24 Oct 1583 - Austrian Oberelsass and Breisgau
+13/24 Oct 1583 - Austrian Oberelsaß and Breisgau
 20/31 Oct 1583 - bishopric of Basel
-02/13 Nov 1583 - duchy of J"ulich-Berg
-02/13 Nov 1583 - electorate and city of K"oln
-04/15 Nov 1583 - bishopric of W"urzburg
+02/13 Nov 1583 - duchy of Jülich-Berg
+02/13 Nov 1583 - electorate and city of Köln
+04/15 Nov 1583 - bishopric of Würzburg
 11/22 Nov 1583 - electorate of Mainz
 16/27 Nov 1583 - bishopric of Strassburg and the margraviate of Baden
-17/28 Nov 1583 - bishopric of M"unster and duchy of Cleve
+17/28 Nov 1583 - bishopric of Münster and duchy of Cleve
 14/25 Dec 1583 - Steiermark
 
 06/17 Jan 1584 - Austria and Bohemia
-11/22 Jan 1584 - Luzern, Uri, Schwyz, Zug, Freiburg, Solothurn
+11/22 Jan 1584 - Lucerne, Uri, Schwyz, Zug, Freiburg, Solothurn
 12/23 Jan 1584 - Silesia and the Lausitz
 22 Jan/
    02 Feb 1584 - Hungary (legally on 21 Oct 1587)
@@ -664,7 +674,7 @@ Gregorian calendar:
           1617 - duchy of Kurland (reverted to the Julian calendar in
                  1796)
 
-          1624 - bishopric of Osnabr"uck
+          1624 - bishopric of Osnabrück
 
           1630 - bishopric of Minden
 
@@ -683,7 +693,7 @@ Gregorian calendar:
    12 Dec 1700 - Utrecht, Overijssel
 
 31 Dec 1700/
-   12 Jan 1701 - Friesland, Groningen, Z"urich, Bern, Basel, Geneva,
+   12 Jan 1701 - Friesland, Groningen, Zürich, Bern, Basel, Geneva,
                  Turgau, and Schaffhausen
 
           1724 - Glarus, Appenzell, and the city of St. Gallen
@@ -695,7 +705,7 @@ Gregorian calendar:
 17 Feb/
    01 Mar 1753 - Sweden
 
-1760-1812      - Graub"unden
+1760-1812      - Graubünden
 
 The Russian empire (including Finland and the Baltic states) did not
 convert to the Gregorian calendar until the Soviet revolution of 1917.
@@ -749,3 +759,9 @@ Michael Allison and Robert Schmunk,
 Jia-Rui Chong, "Workdays Fit for a Martian", Los Angeles Times
 <http://articles.latimes.com/2004/jan/14/science/sci-marstime14>
 (2004-01-14), pp A1, A20-A21.
+
+
+-----
+Local Variables:
+coding: utf-8
+End:
Index: src/lib/libc/time/tzfile.h
diff -u src/lib/libc/time/tzfile.h:1.14 src/lib/libc/time/tzfile.h:1.15
--- src/lib/libc/time/tzfile.h:1.14	Tue May 13 12:33:56 2014
+++ src/lib/libc/time/tzfile.h	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tzfile.h,v 1.14 2014/05/13 16:33:56 christos Exp $	*/
+/*	$NetBSD: tzfile.h,v 1.15 2014/08/15 11:04:07 christos Exp $	*/
 
 #ifndef TZFILE_H
 #define TZFILE_H
@@ -41,7 +41,7 @@
 struct tzhead {
 	char	tzh_magic[4];		/* TZ_MAGIC */
 	char	tzh_version[1];		/* '\0' or '2' or '3' as of 2013 */
-	char	tzh_reserved[15];	/* reserved--must be zero */
+	char	tzh_reserved[15];	/* reserved; must be zero */
 	char	tzh_ttisgmtcnt[4];	/* coded number of trans. time flags */
 	char	tzh_ttisstdcnt[4];	/* coded number of trans. time flags */
 	char	tzh_leapcnt[4];		/* coded number of leap seconds */

Index: src/lib/libc/time/asctime.c
diff -u src/lib/libc/time/asctime.c:1.18 src/lib/libc/time/asctime.c:1.19
--- src/lib/libc/time/asctime.c:1.18	Sun Oct 28 13:11:33 2012
+++ src/lib/libc/time/asctime.c	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: asctime.c,v 1.18 2012/10/28 17:11:33 christos Exp $	*/
+/*	$NetBSD: asctime.c,v 1.19 2014/08/15 11:04:07 christos Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -16,7 +16,7 @@
 #if 0
 static char	elsieid[] = "@(#)asctime.c	8.5";
 #else
-__RCSID("$NetBSD: asctime.c,v 1.18 2012/10/28 17:11:33 christos Exp $");
+__RCSID("$NetBSD: asctime.c,v 1.19 2014/08/15 11:04:07 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -71,7 +71,7 @@ __weak_alias(asctime_r,_asctime_r)
 ** ??? ???-2147483648 -2147483648:-2147483648:-2147483648     -2147483648\n
 ** (two three-character abbreviations, five strings denoting integers,
 ** seven explicit spaces, two explicit colons, a newline,
-** and a trailing ASCII nul).
+** and a trailing NUL byte).
 ** The values above are for systems where an int is 32 bits and are provided
 ** as an example; the define below calculates the maximum for the system at
 ** hand.

Index: src/lib/libc/time/checktab.awk
diff -u src/lib/libc/time/checktab.awk:1.7 src/lib/libc/time/checktab.awk:1.8
--- src/lib/libc/time/checktab.awk:1.7	Tue May 13 12:33:56 2014
+++ src/lib/libc/time/checktab.awk	Fri Aug 15 07:04:07 2014
@@ -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 <iso_table) {
 		iso_NR++
 		if ($0 ~ /^#/) continue
@@ -25,7 +68,7 @@ BEGIN {
 		cc = $1
 		name = $2
 		if (cc !~ /^[A-Z][A-Z]$/) {
-			printf "%s:%d: invalid country code `%s'\n", \
+			printf "%s:%d: invalid country code '%s'\n", \
 				iso_table, iso_NR, cc >>"/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 <zone_table) {
@@ -64,27 +106,31 @@ BEGIN {
 				zone_table, zone_NR >>"/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]) {

Index: src/lib/libc/time/ctime.3
diff -u src/lib/libc/time/ctime.3:1.49 src/lib/libc/time/ctime.3:1.50
--- src/lib/libc/time/ctime.3:1.49	Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/ctime.3	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctime.3,v 1.49 2013/12/26 18:34:28 christos Exp $
+.\" $NetBSD: ctime.3,v 1.50 2014/08/15 11:04:07 christos Exp $
 .\"
 .\" XXX: License missing?
 .\"
@@ -22,7 +22,7 @@
 .Nm tzalloc ,
 .Nm tzgetname ,
 .Nm tzfree ,
-.Nd convert date and time to ASCII
+.Nd convert date and time
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.82 src/lib/libc/time/localtime.c:1.83
--- src/lib/libc/time/localtime.c:1.82	Tue May 13 12:33:56 2014
+++ src/lib/libc/time/localtime.c	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.82 2014/05/13 16:33:56 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.83 2014/08/15 11:04:07 christos Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.82 2014/05/13 16:33:56 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.83 2014/08/15 11:04:07 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -144,16 +144,16 @@ struct __state {
 };
 
 struct rule {
-	int		r_type;		/* type of rule--see below */
+	int		r_type;		/* type of rule; see below */
 	int		r_day;		/* day number of rule */
 	int		r_week;		/* week number of rule */
 	int		r_mon;		/* month number of rule */
 	int_fast32_t	r_time;		/* transition time of rule */
 };
 
-#define JULIAN_DAY		0	/* Jn - Julian day */
-#define DAY_OF_YEAR		1	/* n - day of year */
-#define MONTH_NTH_DAY_OF_WEEK	2	/* Mm.n.d - month, week, day of week */
+#define JULIAN_DAY		0	/* Jn = Julian day */
+#define DAY_OF_YEAR		1	/* n = day of year */
+#define MONTH_NTH_DAY_OF_WEEK	2	/* Mm.n.d = month, week, day of week */
 
 typedef struct tm *(*subfun_t)(const timezone_t sp, const time_t *timep,
 			       const int_fast32_t offset, struct tm *tmp);
@@ -386,17 +386,7 @@ tzload(timezone_t sp, const char *name, 
 					2 * sizeof *sp +
 					4 * TZ_MAX_TIMES];
 	} u_t;
-	u_t *			up;
-
-	up = malloc(sizeof *up);
-	if (up == NULL)
-		return -1;
-
-	sp->goback = sp->goahead = FALSE;
-	if (name == NULL && (name = TZDEFAULT) == NULL)
-		goto oops;
-	{
-		int	doaccess;
+	union local_storage {
 		/*
 		** Section 4.9.1 of the C standard says that
 		** "FILENAME_MAX expands to an integral constant expression
@@ -406,35 +396,51 @@ tzload(timezone_t sp, const char *name, 
 		*/
 		char		fullname[FILENAME_MAX + 1];
 
-		if (name[0] == ':')
-			++name;
-		doaccess = name[0] == '/';
-		if (!doaccess) {
-			if ((p = TZDIR) == NULL)
-				goto oops;
-			if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
-				goto oops;
-			(void) strcpy(fullname, p);	/* XXX strcpy is safe */
-			(void) strcat(fullname, "/");	/* XXX strcat is safe */
-			(void) strcat(fullname, name);	/* XXX strcat is safe */
-			/*
-			** Set doaccess if '.' (as in "../") shows up in name.
-			*/
-			if (strchr(name, '.') != NULL)
-				doaccess = TRUE;
-			name = fullname;
-		}
-		if (doaccess && access(name, R_OK) != 0)
+		/* The main part of the storage for this function.  */
+		struct {
+			u_t u;
+			struct __state st;
+		} u;
+	};
+	char *fullname;
+	u_t *up;
+	int doaccess;
+	union local_storage *lsp;
+	lsp = malloc(sizeof *lsp);
+	if (!lsp)
+		return -1;
+	fullname = lsp->fullname;
+	up = &lsp->u.u;
+
+	sp->goback = sp->goahead = FALSE;
+
+	if (! name) {
+		name = TZDEFAULT;
+		if (! name)
 			goto oops;
-		/*
-		 * XXX potential security problem here if user of a set-id
-		 * program has set TZ (which is passed in as name) here,
-		 * and uses a race condition trick to defeat the access(2)
-		 * above.
-		 */
-		if ((fid = open(name, OPEN_MODE)) == -1)
+	}
+
+	if (name[0] == ':')
+		++name;
+	doaccess = name[0] == '/';
+	if (!doaccess) {
+		p = TZDIR;
+		if (! p || sizeof lsp->fullname - 1 <= strlen(p) + strlen(name))
 			goto oops;
+		strcpy(fullname, p);
+		strcat(fullname, "/");
+		strcat(fullname, name);
+		/* Set doaccess if '.' (as in "../") shows up in name.  */
+		if (strchr(name, '.'))
+			doaccess = TRUE;
+		name = fullname;
 	}
+	if (doaccess && access(name, R_OK) != 0)
+		goto oops;
+
+	fid = open(name, OPEN_MODE);
+	if (fid < 0)
+		goto oops;
 	nread = read(fid, up->buf, sizeof up->buf);
 	if (close(fid) < 0 || nread <= 0)
 		goto oops;
@@ -567,36 +573,36 @@ tzload(timezone_t sp, const char *name, 
 	if (doextend && nread > 2 &&
 		up->buf[0] == '\n' && up->buf[nread - 1] == '\n' &&
 		sp->typecnt + 2 <= TZ_MAX_TYPES) {
-			struct __state ts;
+			struct __state *ts = &lsp->u.st;
 			int	result;
 
 			up->buf[nread - 1] = '\0';
-			result = tzparse(&ts, &up->buf[1], FALSE);
-			if (result == 0 && ts.typecnt == 2 &&
-				sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) {
+			result = tzparse(ts, &up->buf[1], FALSE);
+			if (result == 0 && ts->typecnt == 2 &&
+				sp->charcnt + ts->charcnt <= TZ_MAX_CHARS) {
 					for (i = 0; i < 2; ++i)
-						ts.ttis[i].tt_abbrind +=
+						ts->ttis[i].tt_abbrind +=
 							sp->charcnt;
-					for (i = 0; i < ts.charcnt; ++i)
+					for (i = 0; i < ts->charcnt; ++i)
 						sp->chars[sp->charcnt++] =
-							ts.chars[i];
+							ts->chars[i];
 					i = 0;
-					while (i < ts.timecnt &&
-						ts.ats[i] <=
+					while (i < ts->timecnt &&
+						ts->ats[i] <=
 						sp->ats[sp->timecnt - 1])
 							++i;
-					while (i < ts.timecnt &&
+					while (i < ts->timecnt &&
 					    sp->timecnt < TZ_MAX_TIMES) {
 						sp->ats[sp->timecnt] =
-							ts.ats[i];
+							ts->ats[i];
 						sp->types[sp->timecnt] =
 							sp->typecnt +
-							ts.types[i];
+							ts->types[i];
 						++sp->timecnt;
 						++i;
 					}
-					sp->ttis[sp->typecnt++] = ts.ttis[0];
-					sp->ttis[sp->typecnt++] = ts.ttis[1];
+					sp->ttis[sp->typecnt++] = ts->ttis[0];
+					sp->ttis[sp->typecnt++] = ts->ttis[1];
 			}
 	}
 	if (sp->timecnt > 1) {
@@ -771,10 +777,10 @@ getsecs(const char *strp, int_fast32_t *
 	int	num;
 
 	/*
-	** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
+	** 'HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
 	** "M10.4.6/26", which does not conform to Posix,
 	** but which specifies the equivalent of
-	** ``02:00 on the first Sunday on or after 23 Oct''.
+	** "02:00 on the first Sunday on or after 23 Oct".
 	*/
 	strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
 	if (strp == NULL)
@@ -788,7 +794,7 @@ getsecs(const char *strp, int_fast32_t *
 		*secsp += num * SECSPERMIN;
 		if (*strp == ':') {
 			++strp;
-			/* `SECSPERMIN' allows for leap seconds. */
+			/* 'SECSPERMIN' allows for leap seconds.  */
 			strp = getnum(strp, &num, 0, SECSPERMIN);
 			if (strp == NULL)
 				return NULL;
@@ -956,6 +962,13 @@ transtime(const int year, const struct r
 		for (i = 0; i < rulep->r_mon - 1; ++i)
 			value += mon_lengths[leapyear][i] * SECSPERDAY;
 		break;
+	default:
+		_DIAGASSERT(
+		    rulep->r_type == JULIAN_DAY ||
+		    rulep->r_type == DAY_OF_YEAR ||
+		    rulep->r_type == MONTH_NTH_DAY_OF_WEEK);
+		value = 0;
+		break;
 	}
 
 	/*
@@ -984,7 +997,6 @@ tzparse(timezone_t sp, const char *name,
 	char *			cp;
 	int			load_result;
 
-	INITIALIZE(dstname);
 	stdname = name;
 	if (lastditch) {
 		stdlen = strlen(name);	/* length of standard zone name */
@@ -1341,8 +1353,8 @@ tzset(void)
 
 /*
 ** The easy way to behave "as if no library function calls" localtime
-** is to not call it--so we drop its guts into "localsub", which can be
-** freely called. (And no, the PANS doesn't require the above behavior--
+** is to not call it, so we drop its guts into "localsub", which can be
+** freely called. (And no, the PANS doesn't require the above behavior,
 ** but it *is* desirable.)
 **
 ** The unused offset argument is for the benefit of mktime variants.
@@ -1473,8 +1485,9 @@ gmtsub(const timezone_t sp, const time_t
 		gmt_is_set = TRUE;
 		saveerrno = errno;
 		gmtptr = malloc(sizeof *gmtptr);
+		gmt_is_set = gmtptr != NULL;
 		errno = saveerrno;
-		if (gmtptr != NULL)
+		if (gmt_is_set)
 			gmtload(gmtptr);
 	}
 	mutex_unlock(&gmt_mutex);
@@ -2062,8 +2075,8 @@ time1(const timezone_t sp, struct tm *co
 	int			sameind, otherind;
 	int			i;
 	int			nseen;
-	int				seen[TZ_MAX_TYPES];
-	int				types[TZ_MAX_TYPES];
+	char				seen[TZ_MAX_TYPES];
+	unsigned char			types[TZ_MAX_TYPES];
 	int				okay;
 
 	if (tmp == NULL) {

Index: src/lib/libc/time/private.h
diff -u src/lib/libc/time/private.h:1.33 src/lib/libc/time/private.h:1.34
--- src/lib/libc/time/private.h:1.33	Tue May 13 12:33:56 2014
+++ src/lib/libc/time/private.h	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: private.h,v 1.33 2014/05/13 16:33:56 christos Exp $	*/
+/*	$NetBSD: private.h,v 1.34 2014/08/15 11:04:07 christos Exp $	*/
 
 #ifndef PRIVATE_H
 #define PRIVATE_H
@@ -31,7 +31,7 @@
 
 /*
 ** Defaults for preprocessor symbols.
-** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
+** You can override these in your C compiler options, e.g. '-DHAVE_ADJTIME=0'.
 */
 
 #ifndef HAVE_ADJTIME
@@ -354,29 +354,15 @@ const char *	scheck(const char * string,
 ** INITIALIZE(x)
 */
 
-#ifndef GNUC_or_lint
 #ifdef lint
-#define GNUC_or_lint
-#endif /* defined lint */
-#ifndef lint
-#ifdef __GNUC__
-#define GNUC_or_lint
-#endif /* defined __GNUC__ */
-#endif /* !defined lint */
-#endif /* !defined GNUC_or_lint */
-
-#ifndef INITIALIZE
-#ifdef GNUC_or_lint
-#define INITIALIZE(x)	((x) = 0)
-#endif /* defined GNUC_or_lint */
-#ifndef GNUC_or_lint
-#define INITIALIZE(x)
-#endif /* !defined GNUC_or_lint */
-#endif /* !defined INITIALIZE */
+# define INITIALIZE(x)	((x) = 0)
+#else
+# define INITIALIZE(x)
+#endif
 
 /*
 ** For the benefit of GNU folk...
-** `_(MSGID)' uses the current locale's message library string for MSGID.
+** '_(MSGID)' uses the current locale's message library string for MSGID.
 ** The default is to use gettext if available, and use MSGID otherwise.
 */
 
@@ -388,9 +374,9 @@ const char *	scheck(const char * string,
 #endif /* !HAVE_GETTEXT */
 #endif /* !defined _ */
 
-#ifndef TZ_DOMAIN
-#define TZ_DOMAIN "tz"
-#endif /* !defined TZ_DOMAIN */
+#if !defined TZ_DOMAIN && defined HAVE_GETTEXT
+# define TZ_DOMAIN "tz"
+#endif
 
 #if HAVE_INCOMPATIBLE_CTIME_R
 #undef asctime_r
@@ -419,8 +405,4 @@ char *ctime_r(time_t const *, char *);
 #define SECSPERREPEAT_BITS	34	/* ceil(log2(SECSPERREPEAT)) */
 #endif /* !defined SECSPERREPEAT_BITS */
 
-/*
-** UNIX was a registered trademark of The Open Group in 2003.
-*/
-
 #endif /* !defined PRIVATE_H */
Index: src/lib/libc/time/zdump.c
diff -u src/lib/libc/time/zdump.c:1.33 src/lib/libc/time/zdump.c:1.34
--- src/lib/libc/time/zdump.c:1.33	Tue May 13 12:33:56 2014
+++ src/lib/libc/time/zdump.c	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: zdump.c,v 1.33 2014/05/13 16:33:56 christos Exp $	*/
+/*	$NetBSD: zdump.c,v 1.34 2014/08/15 11:04:07 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2009-05-17 by Arthur David Olson.
@@ -6,7 +6,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: zdump.c,v 1.33 2014/05/13 16:33:56 christos Exp $");
+__RCSID("$NetBSD: zdump.c,v 1.34 2014/08/15 11:04:07 christos Exp $");
 #endif /* !defined lint */
 
 #include "version.h"
@@ -27,10 +27,6 @@ __RCSID("$NetBSD: zdump.c,v 1.33 2014/05
 #include "time.h"	/* for struct tm */
 #include "stdlib.h"	/* for exit, malloc, atoi */
 #include <err.h>
-#include "ctype.h"	/* for isalpha et al. */
-#ifndef isascii
-#define isascii(x) 1
-#endif /* !defined isascii */
 
 /*
 ** Substitutes for pre-C99 compilers.
@@ -170,16 +166,6 @@ enum { SECSPER400YEARS_FITS = SECSPERLYE
 #include "libintl.h"
 #endif /* HAVE_GETTEXT */
 
-#ifndef GNUC_or_lint
-#ifdef lint
-#define GNUC_or_lint
-#else /* !defined lint */
-#ifdef __GNUC__
-#define GNUC_or_lint
-#endif /* defined __GNUC__ */
-#endif /* !defined lint */
-#endif /* !defined GNUC_or_lint */
-
 #ifndef ATTRIBUTE_PURE
 #if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
 # define ATTRIBUTE_PURE __attribute__ ((ATTRIBUTE_PURE__))
@@ -198,7 +184,7 @@ enum { SECSPER400YEARS_FITS = SECSPERLYE
 
 /*
 ** For the benefit of GNU folk...
-** `_(MSGID)' uses the current locale's message library string for MSGID.
+** '_(MSGID)' uses the current locale's message library string for MSGID.
 ** The default is to use gettext if available, and use MSGID otherwise.
 */
 
@@ -210,9 +196,9 @@ enum { SECSPER400YEARS_FITS = SECSPERLYE
 #endif /* !HAVE_GETTEXT */
 #endif /* !defined _ */
 
-#ifndef TZ_DOMAIN
-#define TZ_DOMAIN "tz"
-#endif /* !defined TZ_DOMAIN */
+#if !defined TZ_DOMAIN && defined HAVE_GETTEXT
+# define TZ_DOMAIN "tz"
+#endif
 
 extern char **	environ;
 extern int	getopt(int argc, char * const argv[],
@@ -242,6 +228,25 @@ static void	show(char * zone, time_t t, 
 static const char *	tformat(void);
 static time_t	yeartot(long y) ATTRIBUTE_PURE;
 
+/* Is A an alphabetic character in the C locale?  */
+static int
+is_alpha(char a)
+{
+	switch (a) {
+	  default:
+		return 0;
+	  case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':
+	  case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N':
+	  case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U':
+	  case 'V': case 'W': case 'X': case 'Y': case 'Z':
+	  case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
+	  case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
+	  case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
+	  case 'v': case 'w': case 'x': case 'y': case 'z':
+	  	return 1;
+	}
+}
+
 #ifndef TYPECHECK
 #define my_localtime	localtime
 #else /* !defined TYPECHECK */
@@ -288,7 +293,7 @@ abbrok(const char *const abbrp, const ch
 		return;
 	cp = abbrp;
 	wp = NULL;
-	while (isascii((unsigned char) *cp) && isalpha((unsigned char) *cp))
+	while (is_alpha(*cp))
 		++cp;
 	if (cp - abbrp == 0)
 		wp = _("lacks alphabetic at start");
@@ -298,10 +303,9 @@ abbrok(const char *const abbrp, const ch
 		wp = _("has more than 6 alphabetics");
 	if (wp == NULL && (*cp == '+' || *cp == '-')) {
 		++cp;
-		if (isascii((unsigned char) *cp) &&
-			isdigit((unsigned char) *cp))
-				if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
-					++cp;
+		if ('0' <= *cp && *cp <= '9')
+			if (*cp++ == '1' && '0' <= *cp && *cp <= '4')
+				cp++;
 		if (*cp != '\0')
 			wp = _("differs from POSIX standard");
 	}

Index: src/lib/libc/time/strftime.c
diff -u src/lib/libc/time/strftime.c:1.30 src/lib/libc/time/strftime.c:1.31
--- src/lib/libc/time/strftime.c:1.30	Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/strftime.c	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: strftime.c,v 1.30 2013/12/26 18:34:28 christos Exp $	*/
+/*	$NetBSD: strftime.c,v 1.31 2014/08/15 11:04:07 christos Exp $	*/
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
@@ -6,7 +6,7 @@
 static char	elsieid[] = "@(#)strftime.c	7.64";
 static char	elsieid[] = "@(#)strftime.c	8.3";
 #else
-__RCSID("$NetBSD: strftime.c,v 1.30 2013/12/26 18:34:28 christos Exp $");
+__RCSID("$NetBSD: strftime.c,v 1.31 2014/08/15 11:04:07 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -57,7 +57,7 @@ __RCSID("$NetBSD: strftime.c,v 1.30 2013
 **    may be used to endorse or promote products derived from this software
 **    without specific prior written permission.
 **
-** THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+** THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ** ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
@@ -70,12 +70,6 @@ __RCSID("$NetBSD: strftime.c,v 1.30 2013
 ** SUCH DAMAGE.
 */
 
-#ifndef LIBC_SCCS
-#ifndef lint
-static const char	sccsid[] = "@(#)strftime.c	5.4 (Berkeley) 3/14/89";
-#endif /* !defined lint */
-#endif /* !defined LIBC_SCCS */
-
 #include "tzfile.h"
 #include "fcntl.h"
 #include "locale.h"
@@ -354,7 +348,7 @@ label:
 ** (01-53)."
 ** (ado, 1993-05-24)
 **
-** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html"; by Markus Kuhn:
+** From <http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html> by Markus Kuhn:
 ** "Week 01 of a year is per definition the first week which has the
 ** Thursday in this year, which is equivalent to the week which contains
 ** the fourth day of January. In other words, the first week of a new year
@@ -766,9 +760,9 @@ _loc(void)
 	if (oldsun) {
 		/*
 		** SunOS 4 used an obsolescent format; see localdtconv(3).
-		** c_fmt had the ``short format for dates and times together''
+		** c_fmt had the "short format for dates and times together"
 		** (SunOS 4 date, "%a %b %e %T %Z %Y" in the C locale);
-		** date_fmt had the ``long format for dates''
+		** date_fmt had the "long format for dates"
 		** (SunOS 4 strftime %C, "%A, %B %e, %Y" in the C locale).
 		** Discard the latter in favor of the former.
 		*/

Index: src/lib/libc/time/time2posix.3
diff -u src/lib/libc/time/time2posix.3:1.17 src/lib/libc/time/time2posix.3:1.18
--- src/lib/libc/time/time2posix.3:1.17	Thu Dec 16 20:30:14 2010
+++ src/lib/libc/time/time2posix.3	Fri Aug 15 07:04:07 2014
@@ -1,5 +1,5 @@
-.\"	$NetBSD: time2posix.3,v 1.17 2010/12/17 01:30:14 wiz Exp $
-.Dd December 4, 2010
+.\"	$NetBSD: time2posix.3,v 1.18 2014/08/15 11:04:07 christos Exp $
+.Dd August 15, 2014
 .Dt TIME2POSIX 3
 .Os
 .Sh NAME
@@ -35,14 +35,16 @@ If the time package is configured with l
 enabled, however, no such adjustment is needed and
 .Va time_t
 values continue to increase over leap events
-(as a true `seconds since...' value).
+(as a true 
+.Dq "seconds since..."
+value).
 This means that these values will differ from those required by POSIX
 by the net number of leap seconds inserted since the Epoch.
 .Pp
 Typically this is not a problem as the type
 .Va time_t
 is intended to be (mostly)
-opaque \(em
+opaque \*(en
 .Va time_t
 values should only be obtained-from and
 passed-to functions such as

Index: src/lib/libc/time/tz-art.htm
diff -u src/lib/libc/time/tz-art.htm:1.5 src/lib/libc/time/tz-art.htm:1.6
--- src/lib/libc/time/tz-art.htm:1.5	Wed Jul 17 16:13:04 2013
+++ src/lib/libc/time/tz-art.htm	Fri Aug 15 07:04:07 2014
@@ -3,7 +3,7 @@ PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd";>
 <html>
 <head>
-<meta http-equiv="Content-type" content='text/html; charset="US-ASCII"'>
+<meta http-equiv="Content-type" content='text/html; charset="UTF-8"'>
 <title>Time and the Arts</title>
 </head>
 <body>
@@ -317,7 +317,7 @@ O'Clock, Eastern Wartime</a></td></tr>
 Mystery, history, daylight saving time, and old-time radio.
 </td></tr>
 <tr><td>&nbsp;</td></tr>
-<tr><td>Film</td><td>Bell Science - About Time</td></tr>
+<tr><td>Film</td><td>Bell Science &ndash; About Time</td></tr>
 <tr><td>Notes</td><td>The Frank Baxter/Richard Deacon extravaganza.
 Information is available at
 <a href="http://www.videoflicks.com/titles/1035/1035893.htm";>http://www.videoflicks.com/titles/1035/1035893.htm</a></td></tr>
@@ -408,7 +408,7 @@ is extended by 10 seconds, it will creat
 a gigantic computerized theft. To achieve this, at one location the
 crooks interfere with the microwave system supplying time signals to
 the computer, advancing the time by 0.1 second each minute over the
-last hour of 1999. (So this movie teaches us that 0.1 x 60 = 10.)
+last hour of 1999. (So this movie teaches us that 0.1 &times; 60 = 10.)
 IMDB page:
 <a href="http://us.imdb.com/title/tt0137494/";>
 http://us.imdb.com/title/tt0137494/
@@ -438,7 +438,7 @@ as noted by Will Fitzgerald)
 </li>
 <li>
 Brady: "...[Bishop Usher] determined that the Lord began the Creation
-on the 23rd of October in the Year 4004 B.C. at -- uh, at 9 A.M.!"
+on the 23rd of October in the Year 4004 B.C. at &ndash; uh, at 9 A.M.!"
 <br>
 Drummond: "That Eastern Standard Time? (Laughter)  Or Rocky Mountain
 Time? (More laughter)  It wasn't daylight-saving time, was it?  Because
@@ -457,8 +457,8 @@ May, 1999 episode of the syndicated tele
 <li>
 "A fundamental belief held by Americans is that if you are on land, you
 cannot be killed by a fish...So most Americans remain on land, believing
-they're safe. Unfortunately, this belief&mdash;like so many myths, such as that
-there's a reason for 'Daylight Saving Time'&mdash;is false."
+they're safe. Unfortunately, this belief &ndash; like so many myths, such as that
+there's a reason for 'Daylight Saving Time' &ndash; is false."
 (Dave Barry column, 2000-07-02)
 </li>
 <li>
@@ -472,15 +472,16 @@ when you turn the clocks ahead."
 originally aired 2002-02-25)
 </li>
 <li>
-"I thought you said Tulsa was a three hour flight."
+"I thought you said Tulsa was a three-hour flight."
 "Well, you're forgetting about the time difference."
-("Chandler" and "Joey" in dialog from the episode of "Friends" first
-aired 2002-12-05)
+("Joey" and "Chandler" in dialog from the episode of "Friends"
+entitled "The One With Rachel's Phone Number," originally aired 2002-12-05)
 </li>
 <li>
 "Is that a pertinent fact,
-or are you trying to dazzle me with your command of time zones?"
-(Kelsey Grammer as "Frasier Crane")
+or are you just trying to dazzle me with your command of time zones?"
+(Kelsey Grammer as "Frasier Crane" to "Roz" from the episode of "Frasier"
+entitled "The Kid," originally aired 1997-11-04)
 </li>
 <li>
 "Don't worry about the world coming to an end today.
@@ -492,7 +493,7 @@ It is already tomorrow in Australia."
 I refused to go on at midnight, okay?  And so I work, you know, and
 then I get this job at eleven, supposed to be a big deal.  Then
 yesterday daylight [saving] time ended. Right now it's basically
-midnight." (Conan O'Brien on the 2010-11-08 premier of "Conan.")
+midnight." (Conan O'Brien on the 2010-11-08 premiere of "Conan.")
 </li>
 </ul>
 </body>
Index: src/lib/libc/time/tzselect.8
diff -u src/lib/libc/time/tzselect.8:1.5 src/lib/libc/time/tzselect.8:1.6
--- src/lib/libc/time/tzselect.8:1.5	Fri Sep 20 15:06:54 2013
+++ src/lib/libc/time/tzselect.8	Fri Aug 15 07:04:07 2014
@@ -1,20 +1,22 @@
-.\"	$NetBSD: tzselect.8,v 1.5 2013/09/20 19:06:54 christos Exp $
+.\"	$NetBSD: tzselect.8,v 1.6 2014/08/15 11:04:07 christos Exp $
 .\"
 .TH TZSELECT 8
 .SH NAME
 tzselect \- select a time zone
 .SH SYNOPSIS
+.ie \n(.g .ds - \f(CW-\fP
+.el ds - \-
 .B tzselect
 [
-.B \-c
+.B \*-c
 .I coord
 ] [
-.B \-n
+.B \*-n
 .I limit
 ] [
-.B \-\-help
+.B \*-\*-help
 ] [
-.B \-\-version
+.B \*-\*-version
 ]
 .SH DESCRIPTION
 The
@@ -26,7 +28,7 @@ The output is suitable as a value for th
 All interaction with the user is done via standard input and standard error.
 .SH OPTIONS
 .TP
-.BI "\-c " coord
+.BI "\*-c " coord
 Instead of asking for continent and then country and then city,
 ask for selection from time zones whose largest cities
 are closest to the location with geographical coordinates
@@ -56,32 +58,27 @@ seconds, with any trailing fractions rep
 .I SS
 is present) seconds.  The decimal point is that of the current locale.
 For example, in the (default) C locale,
-.B "\-c\ +40.689\-074.045"
+.B "\*-c\ +40.689\*-074.045"
 specifies 40.689\(de\|N, 74.045\(de\|W,
-.B "\-c\ +4041.4\-07402.7"
+.B "\*-c\ +4041.4\*-07402.7"
 specifies 40\(de\|41.4\(fm\|N, 74\(de\|2.7\(fm\|W, and
-.B "\-c\ +404121\-0740240"
+.B "\*-c\ +404121\*-0740240"
 specifies 40\(de\|41\(fm\|21\(sd\|N, 74\(de\|2\(fm\|40\(sd\|W.
 If
 .I coord
 is not one of the documented forms, the resulting behavior is unspecified.
 .TP
-.BI "\-n " limit
+.BI "\*-n " limit
 When
-.B \-c
+.B \*-c
 is used, display the closest
 .I limit
 locations (default 10).
-.PP
-Applications should not assume that
-.BR tzselect 's
-output matches the user's political preferences.
-.RE
 .TP
-.B "\-\-help"
+.B "\*-\*-help"
 Output help information and exit.
 .TP
-.B "\-\-version"
+.B "\*-\*-version"
 Output version information and exit.
 .SH "ENVIRONMENT VARIABLES"
 .TP
@@ -99,8 +96,8 @@ Name of the directory containing time zo
 \f2TZDIR\fP\f3/iso3166.tab\fP
 Table of ISO 3166 2-letter country codes and country names.
 .TP
-\f2TZDIR\fP\f3/zone.tab\fP
-Tables of country codes, latitude and longitude, zone names, and
+\f2TZDIR\fP\f3/zone1970.tab\fP
+Table of country codes, latitude and longitude, zone names, and
 descriptive comments.
 .TP
 \f2TZDIR\fP\f3/\fP\f2TZ\fP
@@ -110,6 +107,10 @@ The exit status is zero if a time zone w
 nonzero otherwise.
 .SH "SEE ALSO"
 newctime(3), tzfile(5), zdump(8), zic(8)
+.SH NOTES
+Applications should not assume that
+.BR tzselect 's
+output matches the user's political preferences.
 .\" @(#)tzselect.8	8.2
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.

Index: src/lib/libc/time/tz-link.htm
diff -u src/lib/libc/time/tz-link.htm:1.16 src/lib/libc/time/tz-link.htm:1.17
--- src/lib/libc/time/tz-link.htm:1.16	Sat Jun 14 13:49:27 2014
+++ src/lib/libc/time/tz-link.htm	Fri Aug 15 07:04:07 2014
@@ -5,10 +5,10 @@
 <head>
 <title>Sources for Time Zone and Daylight Saving Time Data</title>
 <link rel="schema.DC" href="http://purl.org/DC/elements/1.1/";>
-<meta http-equiv="Content-type" content='text/html; charset="US-ASCII"'>
+<meta http-equiv="Content-type" content='text/html; charset="UTF-8"'>
 <meta name="DC.Creator" content="Eggert, Paul">
 <meta name="DC.Contributor" content="Olson, Arthur David">
-<meta name="DC.Date" content="2014-06-04">
+<meta name="DC.Date" content="2014-08-05">
 <meta name="DC.Description"
  content="Sources of information about time zones and daylight saving time">
 <meta name="DC.Identifier"
@@ -247,7 +247,8 @@ General Public License (<abbr
 title="General Public License">GPL</abbr>)</a>.</li>
 <li><a href="http://sourceforge.net/projects/tzical";>tziCal &ndash; tz
 database conversion utility</a> is like Vzic, except for the <a
-href="http://msdn.microsoft.com/netframework";>.NET framework</a>.</li>
+href="http://msdn.microsoft.com/netframework";>.NET framework</a>
+and with a <abbr>BSD</abbr>-style license.</li>
 <li><a
 href="http://search.cpan.org/dist/DateTime-TimeZone/";>DateTime::TimeZone</a>
 contains a script <code>parse_olson</code> that compiles
@@ -268,7 +269,7 @@ and from <abbr title="Common Locale Data
 into an <abbr>ICU</abbr>-specific format.
 <abbr>ICU</abbr> is freely available under a
 <abbr>BSD</abbr>-style license.</li>
-<li><a href="http://www.joda.org/joda-time/";>Joda Time &ndash; Java date
+<li><a href="http://www.joda.org/joda-time/";>Joda-Time &ndash; Java date
 and time <abbr title="Application Program Interface">API</abbr></a>
 contains a class
 <code>org.joda.time.tz.ZoneInfoCompiler</code> that compiles
@@ -280,11 +281,21 @@ are similar to Joda Time, but for the .N
 Java. They are freely available under the
 <a href="http://www.apache.org/licenses/LICENSE-2.0";>Apache License</a>
 and a <abbr>BSD</abbr>-style license, respectively.</li>
-<li><a href="https://github.com/mde/timezone-js";>TimezoneJS.Date</a>
-is a <a href="http://en.wikipedia.org/wiki/JavaScript";>JavaScript</a>
-library that parses <code><abbr>tz</abbr></code> source files and interprets time
-stamps using an API that is upward compatible with standard JavaScript
+<li><a href="http://en.wikipedia.org/wiki/JavaScript";>JavaScript</a>-based
+compilers and libraries include:
+<ul>
+<li><a href="http://momentjs.com/timezone/";>Moment Timezone</a> is a
+plugin for the <a href="http://momentjs.com/";>Moment.js</a> date
+manipulation library. It is freely available under
+the <abbr title="Massachusetts Institute of Technology">MIT</abbr>
+license.</li>
+<li><a href="https://github.com/mde/timezone-js";>TimezoneJS.Date</a>'s
+<abbr>API</abbr> is upward compatible with standard JavaScript
 Dates. It is freely available under the Apache License.</li>
+<li><a href="https://github.com/sproutsocial/walltime-js";>Walltime-js</a>
+translates UTC to local time. It is freely available under the <abbr>MIT</abbr>
+license.</li>
+</ul>
 <li><a href="http://pytz.sourceforge.net";>pytz &ndash; World Timezone
 Definitions for Python</a> compiles <code><abbr>tz</abbr></code> source into
 <a href="http://python.org/";>Python</a>.
@@ -293,8 +304,7 @@ It is freely available under a <abbr>BSD
 Ruby Timezone Library</a>
 compiles <code><abbr>tz</abbr></code> source into
 <a href="http://www.ruby-lang.org/en/";>Ruby</a>.
-It is freely available under the <abbr
-title="Massachusetts Institute of Technology">MIT</abbr> license.</li>
+It is freely available under the <abbr>MIT</abbr> license.</li>
 <li>The <a href="http://www.squeaksource.com/Chronos/";>Chronos Date/Time
 Library</a> is
 a <a href="http://en.wikipedia.org/wiki/Smalltalk";>Smalltalk</a> class
@@ -302,7 +312,7 @@ library that compiles <code><abbr>tz</ab
 zone repository whose format
 is either proprietary or an <abbr>XML</abbr>-encoded
 representation.</li>
-<li>Starting with version 8.5, <a href="http://tcl.tk/";>Tcl</a>
+<li><a href="http://tcl.tk/";>Tcl</a>
 contains a developer-oriented parser that compiles <code><abbr>tz</abbr></code>
 source into text files, along with a runtime that can read those
 files. Tcl is freely available under a <abbr>BSD</abbr>-style
@@ -327,6 +337,9 @@ It is freely available under the <abbr>L
 <li><a href="http://bmsi.com/java/#TZ";>ZoneInfo.java</a>
 is a <code><abbr>tz</abbr></code> binary file reader written in Java.
 It is freely available under the <abbr>LGPL</abbr>.</li>
+<li><a href="https://github.com/bigeasy/timezone";>Timezone</a> is a
+JavaScript library that supports date arithmetic that is time zone
+aware. It is freely available under the <abbr>MIT</abbr> license.</li>
 <li>Tcl, mentioned above, also contains a
 <code><abbr>tz</abbr></code> binary file reader.</li>
 <li><a href="http://search.cpan.org/perldoc?DateTime::TimeZone::Tzfile";>
@@ -344,7 +357,8 @@ are not supported.</li>
 <li>The <a
 href="http://hackage.haskell.org/package/timezone-olson";>timezone-olson</a>
 package contains <a href="http://haskell.org";>Haskell</a> code that
-parses and uses <code><abbr>tz</abbr></code> binary data.</li>
+parses and uses <code><abbr>tz</abbr></code> binary data. It is freely
+available under a BSD-style license.</li>
 </ul>
 <h2>Other <code><abbr>tz</abbr></code>-based time zone software</h2>
 <ul>
@@ -358,6 +372,10 @@ href="http://mozilla.com/thunderbird";>Th
 It displays multiple clocks in the application window, and has a mapping
 interface to <a href="http://earth.google.com/";>Google Earth</a>.
 It is freely available under the <abbr>GPL</abbr>.</li>
+<li><a href="http://golang.org/";>Go programming language</a>
+implementations contain a copy of a 32-bit subset of a recent
+<code><abbr>tz</abbr></code> database in a
+Go-specific format.</li>
 <li><a
 href="http://users.skynet.be/Peter.Verthez/projects/intclock/";>International
 clock (intclock)</a> is a multi-timezone clock for
@@ -365,8 +383,8 @@ clock (intclock)</a> is a multi-timezone
 under the <abbr>GPL</abbr>.</li>
 <li><a
 href="http://www.oracle.com/us/technologies/java/overview/index.html";>Oracle
-Java</a> releases since 1.4
-contain a copy of a subset of a recent <code><abbr>tz</abbr></code> database in a
+Java</a> contains a copy of a subset of a recent
+<code><abbr>tz</abbr></code> database in a
 Java-specific format.</li>
 <li><a href="http://kimmo.suominen.com/sw/timezone/";>Time Zone</a> is
 a <a href="http://wordpress.org/";>WordPress</a> plugin. It is freely
@@ -377,7 +395,7 @@ download, compile and use the <code>tzda
 files as they are released. The Basic version is free.</li>
 <li><a
 href="http://veladg.com/velaterra.html";>VelaTerra</a> is
-a Mac <abbr>OS X</abbr> program. Its developers
+an <abbr>OS X</abbr> program. Its developers
 <a href="http://veladg.com/tzoffer.html";>offer free
 licenses</a> to <code><abbr>tz</abbr></code> contributors.</li>
 </ul>
@@ -397,9 +415,7 @@ href="http://astrocom.com/";>Astro Comput
 is another time zone database.</li>
 <li><a href="http://tycho.usno.navy.mil/tzones.html";>World Time Zones</a>
 contains data from the Time Service Department of the
-<abbr>US</abbr> Naval Observatory, used as the source
-for the <code><abbr>usno</abbr>*</code> files in
-the <code><abbr>tz</abbr></code> distribution.</li>
+<abbr>US</abbr> Naval Observatory.</li>
 <li>The <a href="http://www.iata.org/publications/Pages/ssim.aspx";>Standard
 Schedules Information Manual</a> of the
 <a href="http://iata.org/";>International Air Transport
@@ -422,7 +438,7 @@ title="Central Intelligence Agency">CIA<
 href="https://www.cia.gov/library/publications/the-world-factbook/graphics/ref_maps/physical/pdf/standard_time_zones_of_the_world.pdf";>time
 zone map</a>; the
 <a
-href="http://www.lib.utexas.edu/maps/world.html";>Perry-Casta&ntilde;eda
+href="http://www.lib.utexas.edu/maps/world.html";>Perry&ndash;Casta&ntilde;eda
 Library Map Collection</a>
 of the University of Texas at Austin has copies of
 recent editions.
@@ -446,6 +462,9 @@ where the two differ greatly.</li>
 maps</a> contains <a
 href="http://en.wikipedia.org/wiki/Shapefile";>shapefiles</a> of
 sets of <code><abbr>tz</abbr></code> regions.</li>
+<li>The <a href="https://github.com/bradfitz/latlong";>latlong package</a>
+maps geographical coordinates to a <code><abbr>tz</abbr></code> region.
+It is written in Go and is freely available under the Apache License.</li>
 <li><a href="http://derickrethans.nl/what-time-is-it.html";>What Time
 is It Here?</a> applies <a href="http://www.mongodb.org/";>MongoDB</a>
 geospatial query operators to shapefiles' data.</li>
@@ -612,7 +631,8 @@ Scales</a> goes into more detail, partic
 title="International Astronomical Union">IAU</abbr></a>'s <a
 href="http://www.iausofa.org/";><abbr
 title="Standards Of Fundamental Astronomy">SOFA</abbr></a>
-initiative publishes C and Fortran
+collection contains C and <a
+href="http://en.wikipedia.org/wiki/Fortran";>Fortran</a>
 code for converting among time scales like
 <abbr title="International Atomic Time">TAI</abbr>,
 <abbr>TDB</abbr>, <abbr>TDT</abbr> and
@@ -679,7 +699,7 @@ Schema: Datatypes &ndash; dateTime</a> s
 <a href="http://tools.ietf.org/html/rfc5322";>Internet
 Message Format</a> (Internet <abbr>RFC</abbr> 5322) &sect;3.3
 specifies the time notation used in email and <a
-href="http://tools.ietf.org/html/rfc2616";><abbr>HTTP</abbr></a>
+href="http://www.w3.org/Protocols/";><abbr>HTTP</abbr></a>
 headers.</li>
 <li>
 <a href="http://tools.ietf.org/html/rfc3339";>Date and Time
@@ -697,12 +717,12 @@ Best of Dates, the Worst of Dates</a> co
 by software developers when handling dates and time stamps.</li>
 <li>Alphabetic time zone abbreviations should not be used as unique
 identifiers for <abbr>UTC</abbr> offsets as they are ambiguous in
-practice. For example, "<abbr>EST</abbr>" denotes 5 hours behind
-<abbr>UTC</abbr> in English-speaking North America, but it denotes 10
-or 11 hours ahead of <abbr>UTC</abbr> in Australia; and
-French-speaking North Americans prefer
-"<abbr title="Heure Normale de l'Est">HNE</abbr>" to
-"<abbr>EST</abbr>". For <abbr>POSIX</abbr> the <code><abbr>tz</abbr></code>
+practice. For example, in English-speaking North America
+"<abbr>CST</abbr>" denotes 6 hours behind <abbr>UTC</abbr>,
+but in China it denotes 8 hours ahead of <abbr>UTC</abbr>,
+and French-speaking North Americans prefer
+"<abbr title="Heure Normale du Centre">HNC</abbr>" to
+"<abbr>CST</abbr>". For <abbr>POSIX</abbr> the <code><abbr>tz</abbr></code>
 database contains English abbreviations for all time stamps but in
 many cases these are merely inventions of the database
 maintainers.</li>

Index: src/lib/libc/time/tzfile.5
diff -u src/lib/libc/time/tzfile.5:1.20 src/lib/libc/time/tzfile.5:1.21
--- src/lib/libc/time/tzfile.5:1.20	Fri Sep 20 15:06:54 2013
+++ src/lib/libc/time/tzfile.5	Fri Aug 15 07:04:07 2014
@@ -1,8 +1,8 @@
-.\"	$NetBSD: tzfile.5,v 1.20 2013/09/20 19:06:54 christos Exp $
+.\"	$NetBSD: tzfile.5,v 1.21 2014/08/15 11:04:07 christos Exp $
 .\"
 .\" This file is in the public domain, so clarified as of
 .\" 1996-06-05 by Arthur David Olson (arthur_david_ol...@nih.gov).
-.Dd September 20, 2013
+.Dd August 15, 2014
 .Dt TZFILE 5
 .Os
 .Sh NAME
@@ -150,7 +150,7 @@ For version-3-format time zone files, th
 use two minor extensions to the POSIX TZ format, as described in
 .Xr tzset 3 .
 First, the hours part of its transition times may be signed and range from
-\(mi167 through 167 instead of the POSIX-required unsigned values
+\-167 through 167 instead of the POSIX-required unsigned values
 from 0 through 24.
 Second, DST is in effect all year if it starts
 January 1 at 00:00 and ends December 31 at 24:00 plus the difference

Index: src/lib/libc/time/tzselect.ksh
diff -u src/lib/libc/time/tzselect.ksh:1.10 src/lib/libc/time/tzselect.ksh:1.11
--- src/lib/libc/time/tzselect.ksh:1.10	Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/tzselect.ksh	Fri Aug 15 07:04:07 2014
@@ -1,6 +1,6 @@
 #! /bin/bash
 #
-#	$NetBSD: tzselect.ksh,v 1.10 2013/12/26 18:34:28 christos Exp $
+#	$NetBSD: tzselect.ksh,v 1.11 2014/08/15 11:04:07 christos Exp $
 #
 PKGVERSION='(tzcode) '
 TZVERSION=see_Makefile
@@ -42,12 +42,13 @@ REPORT_BUGS_TO=t...@iana.org
 # Check for awk Posix compliance.
 ($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
 [ $? = 123 ] || {
-	echo >&2 "$0: Sorry, your \`$AWK' program is not Posix compatible."
+	echo >&2 "$0: Sorry, your '$AWK' program is not Posix compatible."
 	exit 1
 }
 
 coord=
 location_limit=10
+zonetabtype=zone1970
 
 usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT]
 Select a time zone interactively.
@@ -82,7 +83,7 @@ if
   ?*) : ;;
   '')
     # '; exit' should be redundant, but Dash doesn't properly fail without it.
-    (eval 'set --; select x; do break; done; exit') 2>/dev/null
+    (eval 'set --; select x; do break; done; exit') </dev/null 2>/dev/null
   esac
 then
   # Do this inside 'eval', as otherwise the shell might exit when parsing it
@@ -148,6 +149,8 @@ do
 	coord=$OPTARG ;;
     n*)
 	location_limit=$OPTARG ;;
+    t*) # Undocumented option, used for developer testing.
+	zonetabtype=$OPTARG ;;
     -help)
 	exec echo "$usage" ;;
     -version)
@@ -167,10 +170,10 @@ esac
 
 # Make sure the tables are readable.
 TZ_COUNTRY_TABLE=$TZDIR/iso3166.tab
-TZ_ZONE_TABLE=$TZDIR/zone.tab
+TZ_ZONE_TABLE=$TZDIR/$zonetabtype.tab
 for f in $TZ_COUNTRY_TABLE $TZ_ZONE_TABLE
 do
-	<$f || {
+	<"$f" || {
 		echo >&2 "$0: time zone files are not set up correctly"
 		exit 1
 	}
@@ -234,7 +237,13 @@ output_distances='
   /^[^#]/ {
     here_lat = convert_latitude($2)
     here_long = convert_longitude($2)
-    line = $1 "\t" $2 "\t" $3 "\t" country[$1]
+    line = $1 "\t" $2 "\t" $3
+    sep = "\t"
+    ncc = split($1, cc, /,/)
+    for (i = 1; i <= ncc; i++) {
+      line = line sep country[cc[i]]
+      sep = ", "
+    }
     if (NF == 4)
       line = line " - " $4
     printf "%g\t%s\n", dist(coord_lat, coord_long, here_lat, here_long), line
@@ -271,7 +280,7 @@ while
 		entry = entry " Ocean"
               printf "'\''%s'\''\n", entry
             }
-          ' $TZ_ZONE_TABLE |
+          ' <"$TZ_ZONE_TABLE" |
 	  sort -u |
 	  tr '\n' ' '
 	  echo ''
@@ -310,7 +319,7 @@ while
 				exit 0
 			}'
 		do
-			echo >&2 "\`$TZ' is not a conforming" \
+			echo >&2 "'$TZ' is not a conforming" \
 				'Posix time zone string.'
 		done
 		TZ_for_date=$TZ;;
@@ -329,7 +338,7 @@ while
 		    distance_table=`$AWK \
 			    -v coord="$coord" \
 			    -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
-			    "$output_distances" <$TZ_ZONE_TABLE |
+			    "$output_distances" <"$TZ_ZONE_TABLE" |
 		      sort -n |
 		      sed "${location_limit}q"
 		    `
@@ -357,7 +366,9 @@ while
 			BEGIN { FS = "\t" }
 			/^#/ { next }
 			$3 ~ ("^" continent "/") {
-				if (!cc_seen[$1]++) cc_list[++ccs] = $1
+			    ncc = split($1, cc, /,/)
+			    for (i = 1; i <= ncc; i++)
+				if (!cc_seen[cc[i]]++) cc_list[++ccs] = cc[i]
 			}
 			END {
 				while (getline <TZ_COUNTRY_TABLE) {
@@ -371,7 +382,7 @@ while
 					print country
 				}
 			}
-		' <$TZ_ZONE_TABLE | sort -f`
+		' <"$TZ_ZONE_TABLE" | sort -f`
 
 
 		# If there's more than one country, ask the user which one.
@@ -401,8 +412,8 @@ while
 					}
 				}
 			}
-			$1 == cc { print $4 }
-		' <$TZ_ZONE_TABLE`
+			$1 ~ cc { print $4 }
+		' <"$TZ_ZONE_TABLE"`
 
 
 		# If there's more than one region, ask the user which one.
@@ -432,13 +443,13 @@ while
 					}
 				}
 			}
-			$1 == cc && $4 == region { print $3 }
-		' <$TZ_ZONE_TABLE`
+			$1 ~ cc && $4 == region { print $3 }
+		' <"$TZ_ZONE_TABLE"`
 		esac
 
 		# Make sure the corresponding zoneinfo file exists.
 		TZ_for_date=$TZDIR/$TZ
-		<$TZ_for_date || {
+		<"$TZ_for_date" || {
 			echo >&2 "$0: time zone files are not set up correctly"
 			exit 1
 		}

Index: src/lib/libc/time/tzset.3
diff -u src/lib/libc/time/tzset.3:1.28 src/lib/libc/time/tzset.3:1.29
--- src/lib/libc/time/tzset.3:1.28	Tue May 13 12:33:56 2014
+++ src/lib/libc/time/tzset.3	Fri Aug 15 07:04:07 2014
@@ -1,5 +1,5 @@
-.\"	$NetBSD: tzset.3,v 1.28 2014/05/13 16:33:56 christos Exp $
-.Dd May 13, 2014
+.\"	$NetBSD: tzset.3,v 1.29 2014/08/15 11:04:07 christos Exp $
+.Dd August 15, 2014
 .Dt TZSET 3
 .Os
 .Sh NAME
@@ -85,7 +85,7 @@ is required; if
 is missing, then summer time does not apply in this locale.
 Upper- and lowercase letters are explicitly allowed.
 Any characters except a leading colon (:), digits, comma (,), minus (-),
-plus (+), and ASCII NUL are allowed.
+plus (+), and NUL bytes are allowed.
 .It Cm offset
 Indicates the value one must add to the local time to arrive at
 Coordinated Universal Time.
@@ -121,7 +121,7 @@ summer time is assumed to be one hour ah
 One or more digits may be used; the value is always interpreted as a
 decimal number.
 The hour must be between zero and 24, and the minutes (and
-seconds) \(em if present \(em between zero and 59.
+seconds) \*(en if present \*(en between zero and 59.
 If preceded by a
 .Dq -
 the time zone shall be east of the Prime Meridian; otherwise it shall be
@@ -167,8 +167,8 @@ The Julian day
 (1 \*[Le]
 .Ar n
 \*[Le] 365).
-Leap days are not counted; that is, in all years \(em including leap
-years \(em February 28 is day 59 and March 1 is day 60.
+Leap days are not counted; that is, in all years \*(en including leap
+years \*(en February 28 is day 59 and March 1 is day 60.
 It is impossible to explicitly refer to the occasional February 29.
 .It Ar n
 The zero-based Julian day (0\ \*[Le]
@@ -212,7 +212,7 @@ or
 is allowed.
 As an extension to POSIX, the hours part of
 .Cm time
-can range from \(mi167 through 167; this allows for unusual rules such as
+can range from \-167 through 167; this allows for unusual rules such as
 .Dq the Saturday before the first Sunday of March .
 The default, if
 .Cm time
@@ -228,13 +228,13 @@ extensions to POSIX.
 .It EST5
 stands for US Eastern Standard
 Time (EST), 5 hours behind UTC, without daylight saving.
-.It FJT\(mi12FJST,M10.3.1/146,M1.3.4/75
+.It FJT\-12FJST,M10.3.1/146,M1.3.4/75
 stands for Fiji Time (FJT) and Fiji Summer Time (FJST), 12 hours ahead
 of UTC, springing forward on October's third Monday at
 146:00 (i.e., 02:00 on the first Sunday on or after October 21), and
 falling back on January's third Thursday at 75:00 (i.e., 03:00 on the
 first Sunday on or after January 18).
-.It IST\(mi2IDT,M3.4.4/26,M10.5.0
+.It IST\-2IDT,M3.4.4/26,M10.5.0
 stands for Israel Standard Time (IST) and Israel Daylight Time (IDT),
 2 hours ahead of UTC, springing forward on March's fourth
 Thursday at 26:00 (i.e., 02:00 on the first Friday on or after March
@@ -248,12 +248,12 @@ January 1 at 00:00 standard time, so day
 all year and the initial
 .Em WART
 is a placeholder.
-.It WGT3WGST,M3.5.0/\(mi2,M10.5.0/\(mi1
+.It WGT3WGST,M3.5.0/\-2,M10.5.0/\-1
 stands for Western Greenland Time (WGT) and Western Greenland Summer
 Time (WGST), 3 hours behind UTC, where clocks follow the EU rules of
-springing forward on March's last Sunday at 01:00 UTC (\(mi02:00 local
+springing forward on March's last Sunday at 01:00 UTC (\-02:00 local
 time) and falling back on October's last Sunday at 01:00 UTC
-(\(mi01:00 local time).
+(\-01:00 local time).
 .El
 .Pp
 If no

Index: src/lib/libc/time/zdump.8
diff -u src/lib/libc/time/zdump.8:1.11 src/lib/libc/time/zdump.8:1.12
--- src/lib/libc/time/zdump.8:1.11	Fri Sep 20 15:06:54 2013
+++ src/lib/libc/time/zdump.8	Fri Aug 15 07:04:07 2014
@@ -1,5 +1,5 @@
-.\"	$NetBSD: zdump.8,v 1.11 2013/09/20 19:06:54 christos Exp $
-.Dd September 20, 2013
+.\"	$NetBSD: zdump.8,v 1.12 2014/08/15 11:04:07 christos Exp $
+.Dd August 15, 2014
 .Dt ZDUMP 8
 .Os
 .Sh NAME
@@ -44,7 +44,8 @@ otherwise.
 .It Fl c Ar [loyear,]highyear
 Cut off the verbose output near the start of the given year(s).
 By default,
-the program cuts off verbose output near the starts of the years \-500 and 2500.
+the program cuts off verbose output near the starts of the years
+\-500 and 2500.
 .It Fl t Ar [loyear,]highyear
 Cut off verbose output at the start of the given time(s),
 given in decimal seconds since 1970-01-01 00:00:00 UTC.

Index: src/lib/libc/time/zic.8
diff -u src/lib/libc/time/zic.8:1.22 src/lib/libc/time/zic.8:1.23
--- src/lib/libc/time/zic.8:1.22	Wed May 28 15:13:27 2014
+++ src/lib/libc/time/zic.8	Fri Aug 15 07:04:07 2014
@@ -1,5 +1,5 @@
-.\"	$NetBSD: zic.8,v 1.22 2014/05/28 19:13:27 christos Exp $
-.Dd May 28, 2014
+.\"	$NetBSD: zic.8,v 1.23 2014/08/15 11:04:07 christos Exp $
+.Dd August 15, 2014
 .Dt ZIC 8
 .Os
 .Sh NAME
@@ -80,6 +80,15 @@ These compatibility issues affect only t
 before 1970 or after the start of 2038.
 .It A time zone abbreviation has fewer than 3 characters.
 POSIX requires at least 3.
+.It An output file name contains a byte that is not an ASCII letter,
+.Dq - ,
+.Dq / ,
+or
+.Dq _ ;
+or it 
+or it contains a file name component that contains more than 14 bytes
+or that starts with
+.Dq - .
 .El
 .It Fl y Ar command
 Use the given
@@ -88,8 +97,28 @@ rather than
 .Em yearistype
 when checking year types (see below).
 .Pp
+Input files should be text files, that is, they should be a series of
+zero or more lines, each ending in a newline byte and containing at
+most 511 bytes, and without any
+.Dv NUL
+bytes.
+The input text's encoding
+is typically UTF-8 or ASCII; it should have a unibyte representation
+for the POSIX Portable Character Set (PPCS)
+.%U http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html
+and the encoding's non-unibyte characters should consist entirely of
+non-PPCS bytes.
+Non-PPCS characters typically occur only in comments:
+although output file names and time zone abbreviations can contain
+nearly any character, other software will work better if these are
+limited to the restricted syntax described under the
+.Op v
+option.
+.Pp
 Input lines are made up of fields.
 Fields are separated from one another by one or more white space characters.
+The white space characters are space, form feed, carriage return, newline,
+tab, and vertical tab.
 Leading and trailing white space on input lines is ignored.
 An unquoted sharp character (#) in the input introduces a comment which extends
 to the end of the line the sharp character appears on.
@@ -216,6 +245,10 @@ or
 if the given time is universal time;
 in the absence of an indicator,
 wall clock time is assumed.
+The intent is that a rule line describes the instants when a
+clock/calendar set to the type of time specified in the
+.Em AT
+field would show the specified date and time of day.
 .It SAVE
 Gives the amount of time to be added to local standard time when the rule is in
 effect.
@@ -248,13 +281,19 @@ A zone line has the form
 .sp
 .Dl Zone	NAME			GMTOFF	RULES/SAVE	FORMAT	[UNTILYEAR [MONTH [DAY [TIME]]]]
 For example:
-.Dl Zone	Australia/Adelaide	9:30	Aus	CST	1971 Oct 31 2:00
+.Dl Zone	Australia/Adelaide	9:30	Aus	AC%sT	1971 Oct 31 2:00
 The fields that make up a zone line are:
 .Bl -tag -width "RULES/SAVE" -compact
 .It NAME
 The name of the time zone.
 This is the name used in creating the time conversion information file for the
 zone.
+It should not contain a file name component
+.Dq .
+or
+.Dq .. ;
+a file name component is a maximal substring that does not contain
+.Dq / .
 .It GMTOFF
 The amount of time to add to UT to get standard time in this zone.
 This field has the same format as the
@@ -312,10 +351,13 @@ The
 .Em LINK-FROM
 field should appear as the
 .Em NAME
-field in some zone line;
-the
+field in some zone line.
+The
 .Em LINK-TO
-field is used as an alternative name for that zone.
+field is used as an alternative name for that zone;
+it has the same syntax as a zone line's
+.Em NAME
+field.
 .Pp
 Except for continuation lines,
 lines may appear in any order in the input.

Index: src/lib/libc/time/zic.c
diff -u src/lib/libc/time/zic.c:1.46 src/lib/libc/time/zic.c:1.47
--- src/lib/libc/time/zic.c:1.46	Wed May 28 15:13:27 2014
+++ src/lib/libc/time/zic.c	Fri Aug 15 07:04:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.46 2014/05/28 19:13:27 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.47 2014/08/15 11:04:07 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.46 2014/05/28 19:13:27 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.47 2014/08/15 11:04:07 christos Exp $");
 #endif /* !defined lint */
 
 #include "version.h"
@@ -34,7 +34,7 @@ typedef int_fast64_t	zic_t;
 #endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */
 
 #if HAVE_SYS_STAT_H
-#include "sys/stat.h"
+#include <sys/stat.h>
 #endif
 #ifdef S_IRUSR
 #define MKDIR_UMASK (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
@@ -42,19 +42,6 @@ typedef int_fast64_t	zic_t;
 #define MKDIR_UMASK 0755
 #endif
 
-/*
-** On some ancient hosts, predicates like `isspace(C)' are defined
-** only if isascii(C) || C == EOF. Modern hosts obey the C Standard,
-** which says they are defined only if C == ((unsigned char) C) || C == EOF.
-** Neither the C Standard nor Posix require that `isascii' exist.
-** For portability, we check both ancient and modern requirements.
-** If isascii is not defined, the isascii check succeeds trivially.
-*/
-#include "ctype.h"
-#ifndef isascii
-#define isascii(x) 1
-#endif
-
 #define end(cp)	(strchr((cp), '\0'))
 
 struct rule {
@@ -133,7 +120,7 @@ static void	adjleap(void);
 static void	associate(void);
 static void	dolink(const char * fromfield, const char * tofield);
 static char **	getfields(char * buf);
-static zic_t	gethms(const char * string, const char * errstrng,
+static zic_t	gethms(const char * string, const char * errstring,
 			int signable);
 static void	infile(const char * filename);
 static void	inleap(char ** fields, int nfields);
@@ -143,7 +130,8 @@ static int	inzcont(char ** fields, int n
 static int	inzone(char ** fields, int nfields);
 static int	inzsub(char ** fields, int nfields, int iscont);
 static int	itsdir(const char * name);
-static int	lowerit(int c);
+static int	is_alpha(char a);
+static char	lowerit(char);
 static int	mkdirs(char * filename);
 static void	newabbr(const char * abbr);
 static zic_t	oadd(zic_t t1, zic_t t2);
@@ -636,11 +624,71 @@ _("%s: More than one -L option specified
 }
 
 static void
+componentcheck(char const *name, char const *component,
+	       char const *component_end)
+{
+	enum { component_len_max = 14 };
+	size_t component_len = component_end - component;
+	if (0 < component_len && component_len <= 2
+	    && component[0] == '.' && component_end[-1] == '.') {
+		fprintf(stderr, _("%s: file name '%s' contains"
+				  " '%.*s' component"),
+			progname, name, (int) component_len, component);
+		exit(EXIT_FAILURE);
+	}
+	if (!noise)
+		return;
+	if (0 < component_len && component[0] == '-')
+		warning(_("file name '%s' component contains leading '-'"),
+			name);
+	if (component_len_max < component_len)
+		warning(_("file name '%s' contains overlength component"
+			  " '%.*s...'"),
+			name, component_len_max, component);
+}
+
+static void
+namecheck(const char *name)
+{
+	char const *cp;
+
+	/* Benign characters in a portable file name.  */
+	static char const benign[] =
+	  "-/_"
+	  "abcdefghijklmnopqrstuvwxyz"
+	  "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+	/* Non-control chars in the POSIX portable character set,
+	   excluding the benign characters.  */
+	static char const printable_and_not_benign[] =
+	  " !\"#$%&'()*+,.0123456789:;<=>?@[\\]^`{|}~";
+
+	char const *component = name;
+	for (cp = name; *cp; cp++) {
+		unsigned char c = *cp;
+		if (noise && !strchr(benign, c)) {
+			warning((strchr(printable_and_not_benign, c)
+				 ? _("file name '%s' contains byte '%c'")
+				 : _("file name '%s' contains byte '\\%o'")),
+				name, c);
+			return;
+		}
+		if (c == '/') {
+			componentcheck(name, component, cp);
+			component = cp + 1;
+		}
+	}
+	componentcheck(name, component, cp);
+}
+
+static void
 dolink(const char *const fromfield, const char *const tofield)
 {
 	char *	fromname;
 	char *	toname;
+	int fromisdir;
 
+	namecheck(tofield);
 	if (fromfield[0] == '/')
 		fromname = ecpyalloc(fromfield);
 	else {
@@ -659,10 +707,16 @@ dolink(const char *const fromfield, cons
 	** We get to be careful here since
 	** there's a fair chance of root running us.
 	*/
-	if (!itsdir(toname))
+	fromisdir = itsdir(fromname);
+	if (fromisdir) {
+		int err = fromisdir < 0 ? errno : EPERM;
+		fprintf(stderr, _("%s: link from %s failed: %s"),
+			progname, fromname, strerror(err));
+		exit(EXIT_FAILURE);
+	}
+	if (itsdir(toname) <= 0)
 		(void) remove(toname);
-	if (link(fromname, toname) != 0
-	    && access(fromname, F_OK) == 0 && !itsdir(fromname)) {
+	if (link(fromname, toname) != 0) {
 		int	result;
 
 		if (mkdirs(toname) != 0)
@@ -767,17 +821,24 @@ static const zic_t max_time = -1 - ((zic
 
 static const zic_t big_bang_time = BIG_BANG;
 
+/* Return 1 if NAME is a directory, 0 if it's something else, -1 if trouble.  */
 static int
 itsdir(const char *const name)
 {
-	char *	myname;
-	int	accres;
-
-	myname = ecpyalloc(name);
-	myname = ecatalloc(myname, "/.");
-	accres = access(myname, F_OK);
-	free(myname);
-	return accres == 0;
+	struct stat st;
+	int res = stat(name, &st);
+	if (res != 0)
+		return res;
+#ifdef S_ISDIR
+	return S_ISDIR(st.st_mode) != 0;
+#else
+	{
+		char *nameslashdot = ecatalloc(ecpyalloc(name), "/.");
+		res = stat(nameslashdot, &st);
+		free(nameslashdot);
+		return res == 0;
+	}
+#endif
 }
 
 /*
@@ -1505,6 +1566,7 @@ writezone(const char *const name, const 
 	void *typesptr = ats + timecnt;
 	unsigned char *types = typesptr;
 
+	namecheck(name);
 	/*
 	** Sort.
 	*/
@@ -1572,7 +1634,7 @@ writezone(const char *const name, const 
 		++timei32;
 	}
 	/*
-	** Output an INT32_MIN "transition" if appropriate--see below.
+	** Output an INT32_MIN "transition" if appropriate; see below.
 	*/
 	if (timei32 > 0 && ats[timei32] > INT32_MIN) {
 		--timei32;
@@ -1590,7 +1652,7 @@ writezone(const char *const name, const 
 	/*
 	** Remove old file, if any, to snap links.
 	*/
-	if (!itsdir(fullname) && remove(fullname) != 0 && errno != ENOENT) {
+	if (itsdir(fullname) <= 0 && remove(fullname) != 0 && errno != ENOENT) {
 		const char *e = strerror(errno);
 
 		(void) fprintf(stderr, _("%s: Can't remove %s: %s\n"),
@@ -1750,7 +1812,7 @@ writezone(const char *const name, const 
 			if (pass == 1)
 				/*
 				** Output an INT32_MIN "transition"
-				** if appropriate--see above.
+				** if appropriate; see above.
 				*/
 				puttzcode(((ats[i] < INT32_MIN) ?
 					INT32_MIN : ats[i]), fp);
@@ -1833,10 +1895,8 @@ doabbr(char *const abbr, const int abbrl
 	}
 	if (!doquotes)
 		return;
-	for (cp = abbr; *cp != '\0'; ++cp)
-		if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ", *cp) == NULL &&
-			strchr("abcdefghijklmnopqrstuvwxyz", *cp) == NULL)
-				break;
+	for (cp = abbr; is_alpha(*cp); cp++)
+		continue;
 	len = strlen(abbr);
 	if (len > 0 && *cp == '\0')
 		return;
@@ -2116,6 +2176,7 @@ outzone(const struct zone *const zpfirst
 	envvar = emalloc(max_envvar_len + 1);
 	INITIALIZE(untiltime);
 	INITIALIZE(starttime);
+	starttime = 0; /* XXX: gcc */
 	/*
 	** Now. . .finally. . .generate some useful data!
 	*/
@@ -2390,7 +2451,7 @@ error(_("can't determine time zone abbre
 		if (lastat->at < rpytime(&xr, max_year - 1)) {
 			/*
 			** Create new type code for the redundant entry,
-			** to prevent it being optimised away.
+			** to prevent it being optimized away.
 			*/
 			if (typecnt >= TZ_MAX_TYPES) {
 				error(_("too many local time types"));
@@ -2441,15 +2502,15 @@ addtype(const zic_t gmtoff, const char *
 	int	i, j;
 
 	if (isdst != TRUE && isdst != FALSE) {
-		error(_("internal error - addtype called with bad isdst"));
+		error(_("internal error: addtype called with bad isdst"));
 		exit(EXIT_FAILURE);
 	}
 	if (ttisstd != TRUE && ttisstd != FALSE) {
-		error(_("internal error - addtype called with bad ttisstd"));
+		error(_("internal error: addtype called with bad ttisstd"));
 		exit(EXIT_FAILURE);
 	}
 	if (ttisgmt != TRUE && ttisgmt != FALSE) {
-		error(_("internal error - addtype called with bad ttisgmt"));
+		error(_("internal error: addtype called with bad ttisgmt"));
 		exit(EXIT_FAILURE);
 	}
 	/*
@@ -2559,11 +2620,54 @@ yearistype(const int year, const char *c
 		exit(EXIT_FAILURE);
 }
 
+/* Is A a space character in the C locale?  */
 static int
-lowerit(int a)
+is_space(char a)
 {
-	a = (unsigned char) a;
-	return (isascii(a) && isupper(a)) ? tolower(a) : a;
+	switch (a) {
+	  default:
+		return 0;
+	  case ' ': case '\f': case '\n': case '\r': case '\t': case '\v':
+	  	return 1;
+	}
+}
+
+/* Is A an alphabetic character in the C locale?  */
+static int
+is_alpha(char a)
+{
+	switch (a) {
+	  default:
+		return 0;
+	  case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':
+	  case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N':
+	  case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U':
+	  case 'V': case 'W': case 'X': case 'Y': case 'Z':
+	  case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
+	  case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
+	  case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
+	  case 'v': case 'w': case 'x': case 'y': case 'z':
+	  	return 1;
+	}
+}
+
+/* If A is an uppercase character in the C locale, return its lowercase
+   counterpart.  Otherwise, return A.  */
+static char
+lowerit(char a)
+{
+	switch (a) {
+	  default: return a;
+	  case 'A': return 'a'; case 'B': return 'b'; case 'C': return 'c';
+	  case 'D': return 'd'; case 'E': return 'e'; case 'F': return 'f';
+	  case 'G': return 'g'; case 'H': return 'h'; case 'I': return 'i';
+	  case 'J': return 'j'; case 'K': return 'k'; case 'L': return 'l';
+	  case 'M': return 'm'; case 'N': return 'n'; case 'O': return 'o';
+	  case 'P': return 'p'; case 'Q': return 'q'; case 'R': return 'r';
+	  case 'S': return 's'; case 'T': return 't'; case 'U': return 'u';
+	  case 'V': return 'v'; case 'W': return 'w'; case 'X': return 'x';
+	  case 'Y': return 'y'; case 'Z': return 'z';
+	}
 }
 
 /* case-insensitive equality */
@@ -2629,8 +2733,7 @@ getfields(char *cp)
 	array = emalloc(size_product(strlen(cp) + 1, sizeof *array));
 	nsubs = 0;
 	for ( ; ; ) {
-		while (isascii((unsigned char) *cp) &&
-			isspace((unsigned char) *cp))
+		while (is_space(*cp))
 				++cp;
 		if (*cp == '\0' || *cp == '#')
 			break;
@@ -2647,9 +2750,8 @@ getfields(char *cp)
 						));
 					exit(1);
 				}
-		} while (*cp != '\0' && *cp != '#' &&
-			(!isascii(*cp) || !isspace((unsigned char) *cp)));
-		if (isascii(*cp) && isspace((unsigned char) *cp))
+		} while (*cp && *cp != '#' && !is_space(*cp));
+		if (is_space(*cp))
 			++cp;
 		*dp = '\0';
 	}
@@ -2682,8 +2784,8 @@ tadd(const zic_t t1, const zic_t t2)
 }
 
 /*
-** Given a rule, and a year, compute the date - in seconds since January 1,
-** 1970, 00:00 LOCAL time - in that year that the rule refers to.
+** Given a rule, and a year, compute the date (in seconds since January 1,
+** 1970, 00:00 LOCAL time) in that year that the rule refers to.
 */
 
 static zic_t
@@ -2755,7 +2857,7 @@ rpytime(const struct rule *const rp, con
 			}
 		if (i < 0 || i >= len_months[isleap(y)][m]) {
 			if (noise)
-				warning(_("rule goes past start/end of month--\
+				warning(_("rule goes past start/end of month; \
 will not work with pre-2004 versions of zic"));
 		}
 	}
@@ -2782,8 +2884,7 @@ newabbr(const char *const string)
 		*/
 		cp = string;
 		mp = NULL;
-		while (isascii((unsigned char) *cp) &&
-			isalpha((unsigned char) *cp))
+		while (is_alpha(*cp))
 				++cp;
 		if (cp - string == 0)
 mp = _("time zone abbreviation lacks alphabetic at start");
@@ -2793,8 +2894,7 @@ mp = _("time zone abbreviation has fewer
 mp = _("time zone abbreviation has too many alphabetics");
 		if (mp == NULL && (*cp == '+' || *cp == '-')) {
 			++cp;
-			if (isascii((unsigned char) *cp) &&
-				isdigit((unsigned char) *cp))
+			if (is_digit(*cp))
 					if (*cp++ == '1' &&
 						*cp >= '0' && *cp <= '4')
 							++cp;
@@ -2828,29 +2928,25 @@ mkdirs(char *argname)
 		/*
 		** DOS drive specifier?
 		*/
-		if (isalpha((unsigned char) name[0]) &&
-			name[1] == ':' && name[2] == '\0') {
+		if (is_alpha(name[0]) && name[1] == ':' && name[2] == '\0') {
 				*cp = '/';
 				continue;
 		}
 #endif
-		if (!itsdir(name)) {
-			/*
-			** It doesn't seem to exist, so we try to create it.
-			** Creation may fail because of the directory being
-			** created by some other multiprocessor, so we get
-			** to do extra checking.
-			*/
-			if (mkdir(name, MKDIR_UMASK) != 0) {
-				const char *e = strerror(errno);
-
-				if (errno != EEXIST || !itsdir(name)) {
-					(void) fprintf(stderr,
-_("%s: Can't create directory %s: %s\n"),
-						progname, name, e);
-					free(name);
-					return -1;
-				}
+		/*
+		** Try to create it.  It's OK if creation fails because
+		** the directory already exists, perhaps because some
+		** other process just created it.
+		*/
+		if (mkdir(name, MKDIR_UMASK) != 0) {
+			int err = errno;
+			if (itsdir(name) <= 0) {
+				(void) fprintf(stderr,
+					       _("%s: Can't create directory"
+						 " %s: %s\n"),
+					       progname, name, strerror(err));
+				free(name);
+				return -1;
 			}
 		}
 		*cp = '/';
@@ -2858,7 +2954,3 @@ _("%s: Can't create directory %s: %s\n")
 	free(name);
 	return 0;
 }
-
-/*
-** UNIX was a registered trademark of The Open Group in 2003.
-*/

Reply via email to