* Theory: Suggest at least one name per inhabited country or territory.

From a suggestion by Stephen Colebourne in
<http://mm.icann.org/pipermail/tz/2013-September/019868.html>.
Correct some UTC-vs-UT solecisms.

In several places the code and documentation incorrectly used
"UTC" to describe time stamps that might precede the introduction
of UTC and for which UTC is therefore undefined.  Change these
uses to "UT", as that's the correct term when talking about these
time stamps.  Problem reported by Steve Allen in
<http://mm.icann.org/pipermail/tz/2013-September/019907.html>.
The major compatibility issue here is with 'zdump -v'; it'll now
output "UT" instead of the possibly-incorrect "UTC".
Many files change in minor ways in the commentary.
* zdump.c (show):
* zic.c (inzsub, addtype):
In output, say "UT" rather than "UTC", since the time stamp we're
talking about might precede the introduction of UTC.
* newctime.3, newstrftime.3, newtzset.3, zdump.8: Explain UT vs UTC better.

Suggested by Steve Allen in
<http://mm.icann.org/pipermail/tz/2013-September/019924.html>.
* newtzset.3: Fix misspelling of "newctime" in previous patch.
* Theory: Say that excluding 'backward' should not affect other data.

Suggested by Stephen Colebourne in
<http://mm.icann.org/pipermail/tz/2013-September/019939.html>.
* newctime.3: Fix typos reported by Paul Goyette.
* tz-link.htm (href): Update shapefile citations.

Reported by Guy Harris in
<http://mm.icann.org/pipermail/tz/2013-September/019974.html>.
Record that San Luis is at UTC-3, not UTC-4 with perpetual UTC.

* southamerica (SanLuis): Move October 2009 transition from here ...
(America/Argentina/San_Luis): ... to here.  This causes San Luis
to not appear to be on perpetual DST.
Support time stamps past 2038 in zones like America/Santiago.

This implements a suggestion by Arthur David Olson.
Without this change, zic -v diagnoses problems with several zones
where it cannot compute a POSIX-equivalent TZ setting for time
stamps past 2038, which means these time stamps may be mishandled.
This entails a minor change to the binary tz file format, to allow
a minor extension to the POSIX TZ setting in the binary file,
instead of requiring a pure POSIX TZ setting.  The zones fixed by
this change are America/Godthab, America/Santiago, Antarctica/Palmer,
Asia/Gaza, Asia/Hebron, Asia/Jerusalem, Pacific/Easter, and
Pacific/Fiji.  The only zone that remains unfixed is
Asia/Tehran, which schedules clock transitions via the
Iranian calendar, something that even the extended TZ
setting cannot represent.
* localtime.c (getrule): Allow transition times to be signed.
* newtzset.3: Describe the extensions to POSIX TZ strings.
Some of these extensions (e.g., hours == 26) were already
implemented but were not documented.  Give examples.
* tzfile.5: Document the relaxed restriction on the stored TZ
string; its hours component can be in the range -167..167 rather
than the POSIX-required 0..24.  Refer to newtzset(5).
* zic.c (stringoffset): Allow hours to go up to 167.
(stringrule): Be willing to generate hours in the range -167
through 167.
* zic.c (stringzone): Add support for perpetual DST.

This causes zic to generate, e.g., TZ='WART4WARST,J1/0,J365/24'
for perpetual DST in San Luis, Argentina.
See <http://mm.icann.org/pipermail/tz/2013-September/020056.html>.
Improve the support for perpetual DST.

Problem reported by Zefram in
<http://mm.icann.org/pipermail/tz/2013-September/020059.html>.
* localtime.c (tzparse): Elide simultaneous entries out of and
into DST if DST goes for an hour more than a year (actually, for
more than the DST offset more than a year).  Since this
optimization can elide all entries, avoid looping forever looking
for entries that will never arrive.  While we're at it, fix
another portability bug where the code assumed wraparound on
signed integer overflow.
* newtzset.3, tzfile.5: Mention that as an extension to POSIX,
if DST covers the entire year plus the DST offset, it's assumed to
be in effect all year.  Give an example.
* zic.c (stringrule): Omit the "J" in January and February,
as this can save a byte or two in the output.
(rule_cmp): New function.
(stringzone): Do a better job of constructing the standard-time
abbreviation when there is perpetual DST.  Defer to the new
stringrule to construct the times for perpetual DST.
Fix bug noted by Zefram, which caused a stray hour of standard
time to be inserted in an otherwise perpetual DST.
Previously, this code generated "WARST4WARST,J1/0,J365/24"
for the San Luis example; now it generates "WART4WARST,0/0,J365/25".
* zic.c: Prefer <stdarg.h> to allocating memory by hand.

Since we assume C89 now, it's safe to use vfprintf.
(verror): New function, with the old implementation of 'error'
but with a va_list API.
(error, warning): Use it.
(associate, gethms): Pass explicit %s to avoid GCC warning about
possibly unsafe formats.
(inzone, outzone, newabbr): Simplify by using the new error or
warning functions, avoiding the need to allocate and free memory.
* private.h (ATTRIBUTE_FORMAT): New macro.
Bump tzfile format to version 3.

Also, improve the documentation and diagnostics in this area.
Suggested by Arthur David Olson in
<http://mm.icann.org/pipermail/tz/2013-September/020064.html>.
* tzfile.5, tzfile.h: Bump tzfile format to version 3.
* zic.8: Document -v better.
* zic.c (ZIC_VERSION): Bump from '2' to '3'.
(stringrule, stringzone, outzone): Report compatibility issues
more carefully, mentioning client dates.
* zic.c: Tweak 400-years-hack to better handle some edge cases better.

Derived from Zefram's patch mentioned in
<http://mm.icann.org/pipermail/tz/2013-July/019470.html>.
With the current tz data, this affects only the Asia/Tehran file,
and it doesn't affect zdump output.
(YEAR_BY_YEAR_ZONE): New constant.
(stringzone): Return it when applicable.
(outzone): Search through a couple of extra years when extending.
Extend when we ran past 2037 in the data, too.
Fix off-by-one bug with Kingston Mean Time.

* northamerica (America/Cayman, America/Jamaica, America/Grand_Turk):
Change KMT from -5:07:12 to -5:07:11 (should be -5:07:10.41).
* zone.tab: Fine-tune geographical coordinates to match -5:07:10.41.
I chose the latitude to match the General Post Office, Kingston,
in the city center according to Google Maps.
Replace a zone with a link when that doesn't lose non-LMT info.

* africa (Africa/Juba): Now a link to Africa/Khartoum.
* europe (Europe/Vaduz): Now a link to Europe/Zurich.

This is more likely to be correct.
Reflect Fiji DST change planned for October.

Reported by David Wheeler in
<http://mm.icann.org/pipermail/tz/2013-September/020083.html>.
* australasia (Fiji): Tweak spring-forward transitions to match
timeanddate.com's predictions.
* newtzset.3: Adjust Fiji example to match updated predictions.
Reword examples so that the English descriptions are more
consistent and are roughly in the same order as the TZ string
contents.
Add optional meta-information to version-3 format.

* Makefile (ZFLAGS): Add a comment about how to enable meta-info.
* tzfile.5: Describe meta-information.
* zic.8: Document new options -n and -o, which cause zic to
generate meta-info.
* zic.c: Include <stddef.h>, for ptrdiff_t.
(genoption, genoptions, genname): New static vars.
(usage): Summarize new options.
(addgenoption, writevalue): New function.
(main, writezone): Add support for new options.
* europe (Europe/Zurich): Move 1848 transition to 1855.