summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1999-01-21 17:31:43 +0000
committerwollman <wollman@FreeBSD.org>1999-01-21 17:31:43 +0000
commitbec37b00542c31a7564e048f54223ad11449501a (patch)
treeebdca369df3b05933e61efd3a4823258c3745fbd /usr.sbin
parent83e7374e233d831742ded7b0cf7327b8553fb81b (diff)
downloadFreeBSD-src-bec37b00542c31a7564e048f54223ad11449501a.zip
FreeBSD-src-bec37b00542c31a7564e048f54223ad11449501a.tar.gz
Updated timezone compiler from Arthur Olson.
Obtained from: ftp://elsie.nci.nih.gov/pub/tzcode1999a.tar.gz
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/zic/Arts.htm177
-rw-r--r--usr.sbin/zic/Makefile366
-rw-r--r--usr.sbin/zic/README6
-rw-r--r--usr.sbin/zic/Theory239
-rw-r--r--usr.sbin/zic/WWW.htm97
-rw-r--r--usr.sbin/zic/ialloc.c9
-rw-r--r--usr.sbin/zic/scheck.c7
-rw-r--r--usr.sbin/zic/zdump.c38
-rw-r--r--usr.sbin/zic/zic.817
-rw-r--r--usr.sbin/zic/zic.c129
10 files changed, 973 insertions, 112 deletions
diff --git a/usr.sbin/zic/Arts.htm b/usr.sbin/zic/Arts.htm
new file mode 100644
index 0000000..39dcab7
--- /dev/null
+++ b/usr.sbin/zic/Arts.htm
@@ -0,0 +1,177 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<HTML>
+<HEAD>
+<TITLE>Time and the Arts</TITLE>
+</HEAD>
+<BODY>
+<H1>Time and the Arts</H1>
+<P>
+<H6>
+@(#)Arts.htm 7.18
+</H6>
+</P>
+<PRE>
+Data on recordings of "Save That Time," Russ Long, Serrob Publishing, BMI:
+--------------------------------------------------------------------------
+Artist: Karrin Allyson
+CD: I Didn't Know About You
+Copyright Date: 1993
+Label: Concord Jazz, Inc.
+ID: CCD-4543
+Track Time: 3:44
+Personnel: Karrin Allyson, vocal
+ Russ Long, piano
+ Gerald Spaits, bass
+ Todd Strait, drums
+Notes: CD notes "additional lyric by Karrin Allyson;
+ arranged by Russ Long and Karrin Allyson"
+ADO Rating: 1 star
+<A HREF="http://205.186.189.2/cgi-win/amg.exe?sql=1A_IDR|||175928">AMG Rating: 3.5 stars</A>
+Penguin Rating: 3.5 stars
+--------------------------------------------------------------------------
+Artist: Kevin Mahogany
+CD: Double Rainbow
+Copyright Date: 1993
+Label: Enja Records
+ID: ENJ-7097 2
+Track Time: 6:27
+Personnel: Kevin Mahogany, vocal
+ Kenny Barron, piano
+ Ray Drummond, bss
+ Ralph Moore, tenor saxophone
+ Lewis Nash, drums
+ADO Rating: 1.5 stars
+<A HREF="http://205.186.189.2/cgi-win/amg.exe?sql=1A_IDR|||262654">AMG Rating: unrated</A>
+Penguin Rating: 3 stars
+--------------------------------------------------------------------------
+Artist: Joe Williams
+CD: Here's to Life
+Copyright Date: 1994
+Label: Telarc International Corporation
+ID: CD-83357
+Track Time: 3:58
+Personnel: Joe Williams, vocal
+ The Robert Farnon [39 piece] Orchestra
+Notes: On-line information and samples available at
+ <A HREF="http://www.telarc.com/telarc/releases/release.req?ID=83357">http://telarc.dmn.com/telarc/releases/release.req?ID=83357</A>
+ADO Rating: black dot
+<A HREF="http://205.186.189.2/cgi-win/amg.exe?sql=1A_IDR|||194434">AMG Rating: 2 stars</A>
+Penguin Rating: 3 stars
+--------------------------------------------------------------------------
+Artist: Charles Fambrough
+CD: Keeper of the Spirit
+Copyright Date: 1995
+Label: AudioQuest Music
+ID: AQ-CD1033
+Track Time: 7:07
+Personnel: Charles Fambrough, bass
+ Joel Levine, tenor recorder
+ Edward Simon, piano
+ Lenny White, drums
+ Marion Simon, percussion
+Notes: On-line information and samples available at
+ <A HREF="http://wwmusic.com/~music/audioq/rel/1033.html">http://wwmusic.com/~music/audioq/rel/1033.html</A>
+ADO Rating: 2 stars
+<A HREF="http://205.186.189.2/cgi-win/AMG.exe?sql=1A_IDR|||224430">AMG Rating: unrated</A>
+Penguin Rating: 3 stars
+==========================================================================
+Also of note:
+--------------------------------------------------------------------------
+Artist: Holly Cole Trio
+CD: Blame It On My Youth
+Copyright Date: 1992
+Label: Manhattan
+ID: CDP 7 97349 2
+Total Time: 37:45
+Personnel: Holly Cole, voice
+ Aaron Davis, piano
+ David Piltch, string bass
+Notes: Lyrical reference to "Eastern Standard Time" in
+ Tom Waits' "Purple Avenue"
+ADO Rating: 2.5 stars
+<A HREF="http://205.186.189.2/cgi-win/AMG.exe?sql=1A_IDR|||157959">AMG Rating: 2 stars</A>
+Penguin Rating: unrated
+--------------------------------------------------------------------------
+Artist: Milt Hinton
+CD: Old Man Time
+Copyright Date: 1990
+Label: Chiaroscuro
+ID: CR(D) 310
+Total Time: 149:38 (two CDs)
+Personnel: Milt Hinton, bass
+ Doc Cheatham, Dizzy Gillespie, Clark Terry, trumpet
+ Al Grey, trombone
+ Eddie Barefield, Joe Camel (Flip Phillips), Buddy Tate,
+ clarinet and saxophone
+ John Bunch, Red Richards, Norman Simmons, Derek Smith,
+ Ralph Sutton, piano
+ Danny Barker, Al Casey, guitar
+ Gus Johnson, Gerryck King, Bob Rosengarden, Jackie Williams,
+ drums
+ Lionel Hampton, vibraphone
+ Cab Calloway, Joe Williams, vocal
+ Buck Clayton, arrangements
+Notes: tunes include Old Man Time, Time After Time,
+ Sometimes I'm Happy,
+ A Hot Time in the Old Town Tonight,
+ Four or Five Times, Now's the Time,
+ Time on My Hands, This Time It's Us,
+ and Good Time Charlie
+ On-line samples available at
+ <A HREF="http://www.globalmusic.com/labels/chiaroscuro/chiaro_cd_gallery.html">http://www.globalmusic.com/labels/chiaroscuro/chiaro_cd_gallery.html</A>
+ADO Rating: 3 stars
+<A HREF="http://205.186.189.2/cgi-win/AMG.exe?sql=1A_IDR|||162344">AMG Rating: 4.5 stars</A>
+Penguin Rating: 3 stars
+--------------------------------------------------------------------------
+Artist: Paul Broadbent
+CD: Pacific Standard Time
+Copyright Date: 1995
+Label: Concord Jazz, Inc.
+ID: CCD-4664
+Total Time: 62:42
+Personnel: Paul Broadbent, piano
+ Putter Smith, Bass
+ Frank Gibson, Jr., drums
+Notes: The CD cover features an analemma for equation of time fans
+ADO Rating: 1 star
+<A HREF="http://205.186.189.2/cgi-win/AMG.exe?sql=1A_IDR|||223722">AMG Rating: 3 stars</A>
+Penguin Rating: 3.5 stars
+--------------------------------------------------------------------------
+Artist: Anthony Braxton/Richard Teitelbaum
+CD: Silence/Time Zones
+Copyright Date: 1996
+Label: Black Lion
+ID: BLCD 760221
+Total Time: 72:58
+Personnel: Anthony Braxton, sporanino and alto saxophones,
+ contrebasse clarinet, miscellaneous instruments
+ Leo Smith, trumpet and miscellaneous instruments
+ Leroy Jenkins, violin and miscellaneous instruments
+ Richard Teitelbaum, modular moog and micromoog synthesizer
+ADO Rating: black dot
+<A HREF="http://205.186.189.2/cg/AMG_.exe?sql=A310757">AMG Rating: unrated</A>
+--------------------------------------------------------------------------
+Artist: Jules Verne
+Book: Le Tour du Monde en Quatre-Vingts Jours
+ (Around the World in Eighty Days)
+Notes: Wall-clock time plays a central role in the plot.
+ European readers of the 1870s clearly held the U.S. press in
+ deep contempt; the protagonists cross the U.S. without once
+ reading a paper.
+ An on-line French-language version of the book
+ "with illustrations from the original 1873 French-language edition"
+ is available at
+ <A HREF="http://fourmilab.ch/etexts/www/tdm80j">http://fourmilab.ch/etexts/www/tdm80j</A>
+ An on-line English-language translation of the book is available at
+ <A HREF="http://www.literature.org/Works/Jules-Verne/eighty">http://www.literature.org/Works/Jules-Verne/eighty</A>
+--------------------------------------------------------------------------
+Film: Bell Science - About Time
+Notes: The Frank Baxter/Richard Deacon extravaganza
+ Information on ordering is available at
+ <A HREF="http://www.videoflicks.com/VF/38/038332.htm">http://www.videoflicks.com/VF/38/038332.htm</A>
+--------------------------------------------------------------------------
+The syndicated comic strip "Dilbert" featured an all-too-rare example of
+time zone humor on 1998-03-14.
+</PRE>
+</BODY>
+</HTML>
diff --git a/usr.sbin/zic/Makefile b/usr.sbin/zic/Makefile
index 963a0ee..0aefc95 100644
--- a/usr.sbin/zic/Makefile
+++ b/usr.sbin/zic/Makefile
@@ -1,5 +1,365 @@
-# $Id$
-SUBDIR= zic zdump
+# @(#)Makefile 7.67
-.include <bsd.subdir.mk>
+# Change the line below for your time zone (after finding the zone you want in
+# the time zone files, or adding it to a time zone file).
+# Alternately, if you discover you've got the wrong time zone, you can just
+# zic -l rightzone
+# to correct things.
+# Use the command
+# make zonenames
+# to get a list of the values you can use for LOCALTIME.
+LOCALTIME= Factory
+
+# If you want something other than Eastern United States time as a template
+# for handling POSIX-style time zone environment variables,
+# change the line below (after finding the zone you want in the
+# time zone files, or adding it to a time zone file).
+# (When a POSIX-style environment variable is handled, the rules in the
+# template file are used to determine "spring forward" and "fall back" days and
+# times; the environment variable itself specifies UTC offsets of standard and
+# summer time.)
+# Alternately, if you discover you've got the wrong time zone, you can just
+# zic -p rightzone
+# to correct things.
+# Use the command
+# make zonenames
+# to get a list of the values you can use for POSIXRULES.
+# If you want POSIX compatibility, use "America/New_York".
+
+POSIXRULES= America/New_York
+
+# Everything gets put in subdirectories of. . .
+
+TOPDIR= /usr/local
+
+# "Compiled" time zone information is placed in the "TZDIR" directory
+# (and subdirectories).
+# Use an absolute path name for TZDIR unless you're just testing the software.
+
+TZDIR= $(TOPDIR)/etc/zoneinfo
+
+# The "zic" and "zdump" commands get installed in. . .
+
+ETCDIR= $(TOPDIR)/etc
+
+# If you "make INSTALL", the "date" command gets installed in. . .
+
+BINDIR= $(TOPDIR)/bin
+
+# Manual pages go in subdirectories of. . .
+
+MANDIR= $(TOPDIR)/man
+
+# Library functions are put in an archive in LIBDIR.
+
+LIBDIR= $(TOPDIR)/lib
+TZLIB= $(LIBDIR)/libtz.a
+
+# If you always want time values interpreted as "seconds since the epoch
+# (not counting leap seconds)", use
+# REDO= posix_only
+# below. If you always want right time values interpreted as "seconds since
+# the epoch" (counting leap seconds)", use
+# REDO= right_only
+# below. If you want both sets of data available, with leap seconds not
+# counted normally, use
+# REDO= posix_right
+# below. If you want both sets of data available, with leap seconds counted
+# normally, use
+# REDO= right_posix
+# below.
+# POSIX mandates that leap seconds not be counted; for compatibility with it,
+# use either "posix_only" or "posix_right".
+
+REDO= posix_right
+
+# Since "." may not be in PATH...
+
+YEARISTYPE= ./yearistype
+
+# Non-default libraries needed to link.
+# Add -lintl if you want to use `gettext' on Solaris.
+LDLIBS=
+
+# Add the following to the end of the "CFLAGS=" line as needed.
+# -DHAVE_ADJTIME=0 if `adjtime' does not exist (SVR0?)
+# -DHAVE_GETTEXT=1 if `gettext' works (GNU, Linux, Solaris); also see LDLIBS
+# -DHAVE_LONG_DOUBLE=1 if your compiler supports the `long double' type
+# -DHAVE_SETTIMEOFDAY=0 if settimeofday does not exist (SVR0?)
+# -DHAVE_SETTIMEOFDAY=1 if settimeofday has just 1 arg (SVR4)
+# -DHAVE_SETTIMEOFDAY=2 if settimeofday uses 2nd arg (4.3BSD)
+# -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD)
+# -DHAVE_STRERROR=1 if `strerror' works
+# -DHAVE_SYMLINK=0 if your system lacks the symlink function
+# -DLOCALE_HOME=\"path\" if locales are in "path", not "/usr/lib/locale"
+# -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
+# -DHAVE_UTMPX_H=1 if your compiler has a "utmpx.h"
+# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
+# -TTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
+# the default is system-supplied, typically "/usr/lib/locale"
+# $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking
+# -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
+# if you do not want run time warnings about formats that may cause
+# year 2000 grief
+#
+GCC_DEBUG_FLAGS = -Dlint -g -O -fno-common \
+ -Wall -Wcast-qual -Wconversion -Wmissing-prototypes \
+ -Wnested-externs -Wpointer-arith -Wshadow \
+ -Wtraditional # -Wstrict-prototypes -Wwrite-strings
+#
+# If you want to use System V compatibility code, add
+# -DUSG_COMPAT
+# to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight"
+# variables to be kept up-to-date by the time conversion functions. Neither
+# "timezone" nor "daylight" is described in X3J11's work.
+#
+# If your system has a "GMT offset" field in its "struct tm"s
+# (or if you decide to add such a field in your system's "time.h" file),
+# add the name to a define such as
+# -DTM_GMTOFF=tm_gmtoff
+# or
+# -DTM_GMTOFF=_tm_gmtoff
+# to the end of the "CFLAGS=" line.
+# Neither tm_gmtoff nor _tm_gmtoff is described in X3J11's work;
+# in its work, use of "tm_gmtoff" is described as non-conforming.
+# Both Linux and BSD have done the equivalent of defining TM_GMTOFF in
+# their recent releases.
+#
+# If your system has a "zone abbreviation" field in its "struct tm"s
+# (or if you decide to add such a field in your system's "time.h" file),
+# add the name to a define such as
+# -DTM_ZONE=tm_zone
+# or
+# -DTM_ZONE=_tm_zone
+# to the end of the "CFLAGS=" line.
+# Neither tm_zone nor _tm_zone is described in X3J11's work;
+# in its work, use of "tm_zone" is described as non-conforming.
+# Both UCB and Sun have done the equivalent of defining TM_ZONE in
+# their recent releases.
+#
+# If you want functions that were inspired by early versions of X3J11's work,
+# add
+# -DSTD_INSPIRED
+# to the end of the "CFLAGS=" line. This arranges for the functions
+# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
+# "posix2time", and "time2posix" to be added to the time conversion library.
+# "tzsetwall" is like "tzset" except that it arranges for local wall clock
+# time (rather than the time specified in the TZ environment variable)
+# to be used.
+# "offtime" is like "gmtime" except that it accepts a second (long) argument
+# that gives an offset to add to the time_t when converting it.
+# "timelocal" is equivalent to "mktime".
+# "timegm" is like "timelocal" except that it turns a struct tm into
+# a time_t using UTC (rather than local time as "timelocal" does).
+# "timeoff" is like "timegm" except that it accepts a second (long) argument
+# that gives an offset to use when converting to a time_t.
+# "posix2time" and "time2posix" are described in an included manual page.
+# None of these functions are described in X3J11's current work.
+# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
+# These functions may well disappear in future releases of the time
+# conversion package.
+#
+# If you want Source Code Control System ID's left out of object modules, add
+# -DNOID
+# to the end of the "CFLAGS=" line.
+#
+# If you'll never want to handle solar-time-based time zones, add
+# -DNOSOLAR
+# to the end of the "CFLAGS=" line
+# (and comment out the "SDATA=" line below).
+# This reduces (slightly) the run-time data-space requirements of
+# the time conversion functions; it may reduce the acceptability of your system
+# to folks in oil- and cash-rich places.
+#
+# If you want to allocate state structures in localtime, add
+# -DALL_STATE
+# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc.
+#
+# If you want an "altzone" variable (a la System V Release 3.1), add
+# -DALTZONE
+# to the end of the "CFLAGS=" line.
+# This variable is not described in X3J11's work.
+#
+# If you want a "gtime" function (a la MACH), add
+# -DCMUCS
+# to the end of the "CFLAGS=" line
+# This function is not described in X3J11's work.
+#
+# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
+# out by the National Institute of Standards and Technology
+# which claims to test C and Posix conformance. If you want to pass PCTS, add
+# -DPCTS
+# to the end of the "CFLAGS=" line.
+#
+# If you want strict compliance with XPG4 as of 1994-04-09, add
+# -DXPG4_1994_04_09
+# to the end of the "CFLAGS=" line. This causes "strftime" to always return
+# 53 as a week number (rather than 52 or 53) for those days in January that
+# before the first Monday in January when a "%V" format is used and January 1
+# falls on a Friday, Saturday, or Sunday.
+
+CFLAGS=
+
+# If you want zic's -s option used when installing, uncomment the next line
+# ZFLAGS= -s
+
+zic= ./zic
+ZIC= $(zic) $(ZFLAGS)
+
+# The name of a Posix-compliant `awk' on your system.
+AWK= awk
+
+###############################################################################
+
+cc= cc
+CC= $(cc) -DTZDIR=\"$(TZDIR)\"
+
+TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
+TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
+TZDSRCS= zdump.c localtime.c asctime.c ialloc.c
+TZDOBJS= zdump.o localtime.o asctime.o ialloc.o
+DATESRCS= date.c localtime.c logwtmp.c strftime.c asctime.c
+DATEOBJS= date.o localtime.o logwtmp.o strftime.o asctime.o
+LIBSRCS= localtime.c asctime.c difftime.c
+LIBOBJS= localtime.o asctime.o difftime.o
+HEADERS= tzfile.h private.h
+NONLIBSRCS= zic.c zdump.c scheck.c ialloc.c
+NEWUCBSRCS= date.c logwtmp.c strftime.c
+SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) tzselect.ksh
+MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
+ tzfile.5 tzselect.8 zic.8 zdump.8
+DOCS= README Theory $(MANS) date.1 Makefile
+PRIMARY_YDATA= africa antarctica asia australasia \
+ europe northamerica southamerica
+YDATA= $(PRIMARY_YDATA) pacificnew etcetera factory backward
+NDATA= systemv
+SDATA= solar87 solar88 solar89
+TDATA= $(YDATA) $(NDATA) $(SDATA)
+TABDATA= iso3166.tab zone.tab
+DATA= $(YDATA) $(NDATA) $(SDATA) $(TABDATA) leapseconds yearistype.sh
+MISC= usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
+ Arts.htm WWW.htm gccdiffs checktab.awk
+ENCHILADA= $(DOCS) $(SOURCES) $(DATA) $(MISC)
+
+# And for the benefit of csh users on systems that assume the user
+# shell should be used to handle commands in Makefiles. . .
+
+SHELL= /bin/sh
+
+all: zic zdump $(LIBOBJS)
+
+ALL: all date tzselect
+
+install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
+ cp iso3166.tab zone.tab $(TZDIR)/.
+ -mkdir $(TOPDIR) $(ETCDIR)
+ cp zic zdump $(ETCDIR)/.
+ -mkdir $(TOPDIR) $(MANDIR) \
+ $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
+ -rm -f $(MANDIR)/man3/newctime.3 \
+ $(MANDIR)/man3/newtzset.3 \
+ $(MANDIR)/man5/tzfile.5 \
+ $(MANDIR)/man8/tzselect.8 \
+ $(MANDIR)/man8/zdump.8 \
+ $(MANDIR)/man8/zic.8
+ cp newctime.3 newtzset.3 $(MANDIR)/man3/.
+ cp tzfile.5 $(MANDIR)/man5/.
+ cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
+
+INSTALL: ALL install date.1
+ -mkdir $(TOPDIR) $(BINDIR)
+ cp date $(BINDIR)/.
+ -mkdir $(TOPDIR) $(MANDIR) $(MANDIR)/man1
+ -rm -f $(MANDIR)/man1/date.1
+ cp date.1 $(MANDIR)/man1/.
+
+zdump: $(TZDOBJS)
+ $(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
+
+zic: $(TZCOBJS) yearistype
+ $(CC) $(CFLAGS) $(LFLAGS) $(TZCOBJS) $(LDLIBS) -o $@
+
+yearistype: yearistype.sh
+ cp yearistype.sh yearistype
+ chmod +x yearistype
+
+posix_only: zic $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA)
+
+right_only: zic leapseconds $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA)
+
+# In earlier versions of this makefile, the other two directories were
+# subdirectories of $(TZDIR). However, this led to configuration errors.
+# For example, with posix_right under the earlier scheme,
+# TZ='right/Australia/Adelaide' got you localtime with leap seconds,
+# but gmtime without leap seconds, which led to problems with applications
+# like sendmail that subtract gmtime from localtime.
+# Therefore, the other two directories are now siblings of $(TZDIR).
+# You must replace all of $(TZDIR) to switch from not using leap seconds
+# to using them, or vice versa.
+other_two: zic leapseconds $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(TZDIR)-leaps -L leapseconds $(TDATA)
+
+posix_right: posix_only other_two
+
+right_posix: right_only other_two
+
+zones: $(REDO)
+
+$(TZLIB): $(LIBOBJS)
+ -mkdir $(TOPDIR) $(LIBDIR)
+ ar ru $@ $(LIBOBJS)
+ if [ -x /usr/ucb/ranlib -o -x /usr/bin/ranlib ] ; \
+ then ranlib $@ ; fi
+
+# We use the system's logwtmp in preference to ours if available.
+
+date: $(DATEOBJS)
+ ar r ,lib.a logwtmp.o
+ if [ -x /usr/ucb/ranlib -o -x /usr/bin/ranlib ] ; \
+ then ranlib ,lib.a ; fi
+ $(CC) $(CFLAGS) date.o localtime.o asctime.o strftime.o \
+ $(LDLIBS) -lc ,lib.a -o $@
+ rm -f ,lib.a
+
+tzselect: tzselect.ksh
+ sed \
+ -e 's|AWK=[^}]*|AWK=$(AWK)|g' \
+ -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
+ <$? >$@
+ chmod +x $@
+
+check_tables: checktab.awk $(PRIMARY_YDATA)
+ $(AWK) -f checktab.awk $(PRIMARY_YDATA)
+
+clean:
+ rm -f core *.o *.out tzselect zdump zic yearistype date \
+ ,* *.tar.gz
+
+names:
+ @echo $(ENCHILADA)
+
+public: $(ENCHILADA)
+ tar cf - $(DOCS) $(SOURCES) $(MISC) | gzip -9 > tzcode.tar.gz
+ tar cf - $(DATA) | gzip -9 > tzdata.tar.gz
+
+zonenames: $(TDATA)
+ @awk '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA)
+
+asctime.o: private.h tzfile.h
+date.o: private.h
+difftime.o: private.h
+ialloc.o: private.h
+localtime.o: private.h tzfile.h
+scheck.o: private.h
+strftime.o: tzfile.h
+zic.o: private.h tzfile.h
+
+.KEEP_STATE:
diff --git a/usr.sbin/zic/README b/usr.sbin/zic/README
index 3ca53ca..5de3d74 100644
--- a/usr.sbin/zic/README
+++ b/usr.sbin/zic/README
@@ -1,8 +1,8 @@
-@(#)README 7.8
+@(#)README 7.10
"What time is it?" -- Richard Deacon as The King
"Any time you want it to be." -- Frank Baxter as The Scientist
- (from the Bell System film on time)
+ (from the Bell System film "About Time")
The 1989 update of the time zone package featured
@@ -36,7 +36,7 @@ leap second information from its output files.
Be sure to read the comments in "Makefile" and make any changes
needed to make things right for your system.
-To use the new functions, use a "-lz" option when compiling or linking.
+To use the new functions, use a "-ltz" option when compiling or linking.
Historical local time information has been included here not because it
is particularly useful, but rather to:
diff --git a/usr.sbin/zic/Theory b/usr.sbin/zic/Theory
index 2e34663..1c43133 100644
--- a/usr.sbin/zic/Theory
+++ b/usr.sbin/zic/Theory
@@ -1,40 +1,84 @@
-@(#)Theory 7.4
-
-These time and date functions are much like the System V Release 2.0 (SVR2)
-time and date functions; there are a few additions and changes to extend
-the usefulness of the SVR2 functions:
-
-* In SVR2, time display in a process is controlled by the environment
- variable TZ, which "must be a three-letter time zone name, followed
- by a number representing the difference between local time and
- Greenwich Mean Time in hours, followed by an optional three-letter
- name for a daylight time zone;" when the optional daylight time zone is
- present, "standard U.S.A. Daylight Savings Time conversion is applied."
- This means that SVR2 can't deal with other (for example, Australian)
- daylight savings time rules, or situations where more than two
+@(#)Theory 7.6
+
+
+----- Outline -----
+
+ Time and date functions
+ Names of time zone regions
+ Time zone abbreviations
+
+
+----- Time and date functions -----
+
+These time and date functions are upwards compatible with POSIX.1,
+an international standard for Unix-like systems.
+As of this writing, the current edition of POSIX.1 is:
+
+ Information technology --Portable Operating System Interface (POSIX (R))
+ -- Part 1: System Application Program Interface (API) [C Language]
+ ISO/IEC 9945-1:1996
+ ANSI/IEEE Std 1003.1, 1996 Edition
+ 1996-07-12
+
+POSIX.1 has the following properties and limitations.
+
+* In POSIX.1, time display in a process is controlled by the
+ environment variable TZ. Unfortunately, the POSIX.1 TZ string takes
+ a form that is hard to describe and is error-prone in practice.
+ Also, POSIX.1 TZ strings can't deal with other (for example, Israeli)
+ daylight saving time rules, or situations where more than two
time zone abbreviations are used in an area.
-* In SVR2, time conversion information is compiled into each program
- that does time conversion. This means that when time conversion
+ The POSIX.1 TZ string takes the following form:
+
+ stdoffset[dst[offset],date[/time],date[/time]]
+
+ where:
+
+ std and dst
+ are 3 or more characters specifying the standard
+ and daylight saving time (DST) zone names.
+ offset
+ is of the form `[-]hh:[mm[:ss]]' and specifies the
+ offset west of UTC. The default DST offset is one hour
+ ahead of standard time.
+ date[/time],date[/time]
+ specifies the beginning and end of DST. If this is absent,
+ the system supplies its own rules for DST, and these can
+ differ from year to year; typically US DST rules are used.
+ time
+ takes the form `hh:[mm[:ss]]' and defaults to 02:00.
+ date
+ takes one of the following forms:
+ Jn (1<=n<=365)
+ origin-1 day number not counting February 29
+ n (0<=n<=365)
+ origin-0 day number counting February 29 if present
+ Mm.n.d (0[Sunday]<=d<=6[Saturday], 1<=n<=5, 1<=m<=12)
+ for the dth day of week n of month m of the year,
+ where week 1 is the first week in which day d appears,
+ and `5' stands for the last week in which day d appears
+ (which may be either the 4th or 5th week).
+
+* In POSIX.1, when a TZ value like "EST5EDT" is parsed,
+ typically the current US DST rules are used,
+ but this means that the US DST rules are compiled into each program
+ that does time conversion. This means that when US time conversion
rules change (as in the United States in 1987), all programs that
do time conversion must be recompiled to ensure proper results.
-* In SVR2, time conversion fails for near-minimum or near-maximum
- time_t values when doing conversions for places that don't use GMT.
-
-* In SVR2, there's no tamper-proof way for a process to learn the
+* In POSIX.1, 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--
without regard to whether the user has fiddled the "TZ" environment
- variable. While an administrator can "do everything in GMT" to get
+ variable. While an administrator can "do everything in UTC" to get
around the problem, doing so is inconvenient and precludes handling
- daylight savings 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.)
-* These functions can account for leap seconds, thanks to Bradley White
- (bww@k.cs.cmu.edu).
+* POSIX.1 requires that systems ignore leap seconds.
-These are the changes that have been made to the SVR2 functions:
+These are the extensions that have been made to the POSIX.1 functions:
* The "TZ" environment variable is used in generating the name of a file
from which time zone information is read (or is interpreted a la
@@ -62,13 +106,12 @@ These are the changes that have been made to the SVR2 functions:
* To handle places where more than two time zone abbreviations are used,
the functions "localtime" and "gmtime" set tzname[tmp->tm_isdst]
(where "tmp" is the value the function returns) to the time zone
- abbreviation to be used. This differs from SVR2, where the elements
+ abbreviation to be used. This differs from POSIX.1, where the elements
of tzname are only changed as a result of calls to tzset.
* Since the "TZ" environment variable can now be used to control time
conversion, the "daylight" and "timezone" variables are no longer
- needed or supported. (You can use a compile-time option to cause
- these variables to be defined and to be set by "tzset"; however, their
+ needed. (These variables are defined and set by "tzset"; however, their
values will not be used by "localtime.")
* The "localtime" function has been set up to deliver correct results
@@ -86,9 +129,21 @@ These are the changes that have been made to the SVR2 functions:
environment variable; portable applications should not, however, rely
on this behavior since it's not the way SVR2 systems behave.)
-Points of interest to folks with Version 7 or BSD systems:
+* These functions can account for leap seconds, thanks to Bradley White
+ (bww@k.cs.cmu.edu).
+
+Points of interest to folks with other systems:
+
+* This package is already part of many POSIX-compliant hosts,
+ including BSD, HP, Linux, Network Appliance, SCO, SGI, and Sun.
+ On such hosts, the primary use of this package
+ is to update obsolete time zone rule tables.
+ To do this, you may need to compile the time zone compiler
+ `zic' supplied with this package instead of using the system `zic',
+ since the format of zic's input changed slightly in late 1994,
+ and many vendors still do not support the new input format.
-* The BSD "timezone" function is not present in this package;
+* The Unix Version 7 "timezone" function is not present in this package;
it's impossible to reliably map timezone's arguments (a "minutes west
of GMT" value and a "daylight saving time in effect" flag) to a
time zone abbreviation, and we refuse to guess.
@@ -97,12 +152,13 @@ Points of interest to folks with Version 7 or BSD systems:
zone abbreviation to use. Alternatively, use
localtime(&clock)->tm_zone if this has been enabled.
-* The BSD gettimeofday function is not used in this package;
- this lets users control the time zone used in doing time conversions.
- Users who don't try to control things (that is, users who do not set
- the environment variable TZ) get the time conversion specified in the
- file "/etc/zoneinfo/localtime"; see the time zone compiler writeup for
- information on how to initialize this file.
+* The 4.2BSD gettimeofday function is not used in this package.
+ This formerly let users obtain the current UTC offset and DST flag,
+ but this functionality was removed in later versions of BSD.
+
+* In SVR2, time conversion fails for near-minimum or near-maximum
+ time_t values when doing conversions for places that don't use UTC.
+ This package takes care to do these conversions correctly.
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
@@ -115,6 +171,115 @@ Hewlett Packard, offer a wider selection of functions that provide capabilities
beyond those provided here. The absence of such functions from this package
is not meant to discourage the development, standardization, or use of such
functions. Rather, their absence reflects the decision to make this package
-close to SVR2 (with the exceptions outlined above) to ensure its broad
+contain valid extensions to POSIX.1, to ensure its broad
acceptability. If more powerful time conversion functions can be standardized,
so much the better.
+
+
+----- Names of time zone rule files -----
+
+The names of this package's installed time zone rule files are chosen to
+help minimize possible future incompatibilities due to political events.
+Ordinarily, names of countries are not used, to avoid incompatibilities
+when countries change their name (e.g. Zaire->Congo) or
+when locations change countries (e.g. Hong Kong from UK colony to China).
+
+Names normally have the form AREA/LOCATION, where AREA is the name
+of a continent or ocean, and LOCATION is the name of a specific
+location within that region. North and South America share the same
+area, `America'. Typical names are `Africa/Cairo', `America/New_York',
+and `Pacific/Honolulu'.
+
+Here are the general rules used for choosing location names,
+in decreasing order of importance:
+
+ Use only valid Posix file names. Use only Ascii letters, digits, `.',
+ `-' and `_'. Do not exceed 14 characters or start with `-'.
+ E.g. prefer `Brunei' to `Bandar_Seri_Begawan'.
+ Include at least one location per time zone rule set per country.
+ One such location is enough.
+ If all the clocks in a country's region have agreed since 1970,
+ don't bother to include more than one location
+ 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
+ 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 traditional English spelling, e.g. prefer `Rome' to `Roma', and
+ prefer `Athens' to the true name (which uses Greek letters).
+ The Posix file name restrictions encourage this rule.
+ Use the most populous among locations in a country's time zone,
+ e.g. prefer `Shanghai' to `Beijing'. Among locations with
+ similar populations, pick the best-known location,
+ e.g. prefer `Rome' to `Milan'.
+ Use the singular form, e.g. prefer `Canary' to `Canaries'.
+ Omit common suffixes like `_Islands' and `_City', unless that
+ would lead to ambiguity. E.g. prefer `Cayman' to
+ `Cayman_Islands' and `Guatemala' to `Guatemala_City',
+ but prefer `Mexico_City' to `Mexico' because the country
+ of Mexico has several time zones.
+ Use `_' to represent a space.
+ Omit `.' from abbreviations in names, e.g. prefer `St_Helena'
+ to `St._Helena'.
+
+The file `zone.tab' lists the geographical locations used to name
+time zone rule files.
+
+Older versions of this package used a different naming scheme,
+and these older names are still supported.
+See the file `backwards' for most of these older names
+(e.g. `US/Eastern' instead of `America/New_York').
+The other old-fashioned names still supported are
+`WET', `CET', `MET', `EET' (see the file `europe'),
+and `Factory' (see the file `factory').
+
+
+----- Time zone abbreviations -----
+
+When this package is installed, it generates time zone abbreviations
+like `EST' to be compatible with human tradition and POSIX.1.
+Here are the general rules used for choosing time zone abbreviations,
+in decreasing order of importance:
+
+ Use abbreviations that consist of 3 or more upper-case Ascii letters,
+ except use "___" for locations while uninhabited.
+ Posix.1 requires at least 3 characters, and the restriction to
+ upper-case Ascii letters follows most traditions.
+ Previous editions of this database also used characters like
+ ' ' and '?', but these characters have a special meaning to
+ the shell and cause commands like
+ set `date`
+ to have unexpected effects. In theory, the character set could
+ be !%./@A-Z^_a-z{}, but these tables use only upper-case
+ Ascii letters (and "___").
+ Use abbreviations that are in common use among English-speakers,
+ e.g. `EST' for Eastern Standard Time in North America.
+ We assume that applications translate them to other languages
+ as part of the normal localization process; for example,
+ a French application might translate `EST' to `HNE'.
+ For zones whose times are taken from a city's longitude, use the
+ traditional xMT notation, e.g. `PMT' for Paris Mean Time.
+ The only name like this in current use is `GMT'.
+ If there is no common English abbreviation, abbreviate the English
+ translation of the usual phrase used by native speakers.
+ If this is not available or is a phrase mentioning the country
+ (e.g. ``Cape Verde Time''), then:
+
+ When a country has a single or principal time zone region,
+ append `T' to the country's ISO code, e.g. `CVT' for
+ Cape Verde Time. For summer time append `ST';
+ for double summer time append `DST'; etc.
+ When a country has multiple time zones, take the first three
+ letters of an English place name identifying each zone
+ and then append `T', `ST', etc. as before;
+ e.g. `VLAST' for VLAdivostok Summer Time.
+
+Application writers should note that these abbreviations are ambiguous
+in practice: e.g. `EST' has a different meaning in Australia than
+it does in the United States. In new applications, it's often better
+to use numeric UTC offsets like `-0500' instead of time zone
+abbreviations like `EST'; this avoids the ambiguity.
diff --git a/usr.sbin/zic/WWW.htm b/usr.sbin/zic/WWW.htm
new file mode 100644
index 0000000..2151c89
--- /dev/null
+++ b/usr.sbin/zic/WWW.htm
@@ -0,0 +1,97 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<HTML>
+<HEAD>
+<TITLE>Sources for Time Zone and Daylight Saving Time Data</TITLE>
+</HEAD>
+<BODY>
+<H1>Sources for Time Zone and Daylight Saving Time Data</H1>
+<P>
+<H6>
+@(#)WWW.htm 7.16
+</H6>
+<H2>Paul Eggert writes:</H2><P>
+The public-domain tz database contains code and data
+that represent the history of local time
+for many representative locations around the globe.
+It is updated periodically to reflect changes made by political bodies
+to UTC offsets and daylight-saving rules.
+This database (often called <samp>zoneinfo</samp>)
+is used by several implementations,
+including BSD, DJGPP, GNU/Linux, HP-UX, IRIX, Solaris, and UnixWare.
+In the tz database's
+<A HREF="ftp://elsie.nci.nih.gov/pub/">FTP distribution</A>,
+the code is in the file <samp>tzcode<var>C</var>.tar.gz</samp>,
+where <samp><var>C</var></samp> is the code's version;
+similarly, the data are in <samp>tzdata<var>D</var>.tar.gz</samp>,
+where <samp><var>D</var></samp> is the data's version.
+<P>
+The <A HREF="ftp://ftp.gnu.org/pub/gnu/GETTING.GNU.SOFTWARE">GNU C Library</A>
+has an independent, thread-safe implementation of
+a time zone file reader.
+This library is freely available under the GNU Library General Public License,
+and is widely used in GNU/Linux systems.
+<P>
+The Web has several other sources for time zone and daylight saving time data.
+Here are some recent links that may be of interest.
+<UL>
+<LI><A HREF="http://www.bsdi.com/date">Date and Time Gateway</A>
+is a text-based source for tables of current time throughout the world.
+Its point-and-click interface accesses a recent version of the tz data.
+<LI><A HREF="http://www.worldtime.com/">WORLDTIME: interactive atlas,
+time info, public holidays</A>
+contains information on local time, sunrise and sunset,
+and public holidays in several hundred cities around the world.
+<LI><A HREF="http://www.hilink.com.au/times/">Local Times Around the World</A>
+is a text-based system containing links to local time servers
+throughout the world; though the coverage is limited,
+the live data provide a nice way to check one's tables.
+<LI><A HREF="http://tycho.usno.navy.mil/tzones.html">World Time Zones</A>
+contains US Naval Observatory data, used as the source
+for the <samp>usno*</samp> files.
+<LI>The United States Central Intelligence agency publishes time zone maps;
+the
+<A HREF="http://www.lib.utexas.edu/Libs/PCL/Map_collection/world_maps.html">
+Perry-Casta&ntilde;eda Library Map Collection</A>
+of the University of Texas at Austin has on-line copies of
+the 1995 and 1997 editions.
+The pictorial quality is good,
+but the maps do not indicate summer time,
+and parts of the data are a few years out of date.
+<LI><A HREF="http://pisolo.cstv.to.cnr.it/toi/uk/toi.html">The
+Time of Internet</A>
+contains good descriptions of Time Zones and daylight saving time,
+with diagrams.
+The time zone map is out of date, however.
+<LI><A HREF="http://ecco.bsee.swin.edu.au/chronos/GMT-explained.html">A
+Few Facts Concerning GMT, UT, and the RGO</A>
+answers questions like ``What is the difference between GMT and UTC?''
+<LI><A HREF="http://www.energy.ca.gov/daylightsaving.html">Daylight
+Saving Time -- Saving Time, Saving Energy</A>
+is a history of DST in the US.
+<LI><A HREF="http://dir.yahoo.com/Science/Measurements_and_Units/Time/Time_Zones/">Yahoo! - Science:Measurements and Units:Time:Time Zones</A>
+is where the famous Internet indexing service Yahoo! collects its time zone
+info.
+<LI>The <A HREF="http://www.iata.org/">International Air Transport Association</A>
+publishes the IATA Standard Schedules Information Manual (SSIM),
+which gives current time zone rules for
+all the airports served by commercial aviation.
+<LI><A HREF="http://hpiers.obspm.fr/webiers/results/bul/README.html">Bulletins
+of IERS</A> contains official publications of the
+International Earth Rotation Service, the committee that decides
+when leap seconds occur.
+</UL>
+<P>
+-- <A HREF="mailto:eggert@twinsun.com">eggert@twinsun.com</A>
+(1998-09-22)
+</P>
+<H2>Arthur David Olson writes:</H2><P>
+A good source of information about ISO 8601 seems to be
+<A HREF="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">International
+Standard Date and Time Notation</A>
+maintained by Markus Kuhn.
+<P>
+-- <A HREF="mailto:arthur_david_olson@nih.gov">arthur_david_olson@nih.gov</A>
+(1996-01-04)
+</P>
+</BODY>
+</HTML>
diff --git a/usr.sbin/zic/ialloc.c b/usr.sbin/zic/ialloc.c
index 5631947..8a0c701 100644
--- a/usr.sbin/zic/ialloc.c
+++ b/usr.sbin/zic/ialloc.c
@@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)ialloc.c 8.28";
+static char elsieid[] = "@(#)ialloc.c 8.29";
#endif /* !defined NOID */
#endif /* !defined lint */
@@ -10,13 +10,6 @@ static char elsieid[] = "@(#)ialloc.c 8.28";
#define nonzero(n) (((n) == 0) ? 1 : (n))
-char * icalloc P((int nelem, int elsize));
-char * icatalloc P((char * old, const char * new));
-char * icpyalloc P((const char * string));
-char * imalloc P((int n));
-void * irealloc P((void * pointer, int size));
-void ifree P((char * pointer));
-
char *
imalloc(n)
const int n;
diff --git a/usr.sbin/zic/scheck.c b/usr.sbin/zic/scheck.c
index 64f2507..39feeba 100644
--- a/usr.sbin/zic/scheck.c
+++ b/usr.sbin/zic/scheck.c
@@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)scheck.c 8.13";
+static char elsieid[] = "@(#)scheck.c 8.15";
#endif /* !defined lint */
#endif /* !defined NOID */
@@ -8,13 +8,10 @@ static char elsieid[] = "@(#)scheck.c 8.13";
#include "private.h"
-extern char * imalloc P((int n));
-extern void ifree P((char * p));
-
char *
scheck(string, format)
const char * const string;
-char * const format;
+const char * const format;
{
register char * fbuf;
register const char * fp;
diff --git a/usr.sbin/zic/zdump.c b/usr.sbin/zic/zdump.c
index 1058a84..094e172 100644
--- a/usr.sbin/zic/zdump.c
+++ b/usr.sbin/zic/zdump.c
@@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)zdump.c 7.24";
+static char elsieid[] = "@(#)zdump.c 7.28";
#endif /* !defined NOID */
#endif /* !defined lint */
@@ -111,19 +111,28 @@ static char elsieid[] = "@(#)zdump.c 7.24";
#define TZ_DOMAIN "tz"
#endif /* !defined TZ_DOMAIN */
+#ifndef P
+#ifdef __STDC__
+#define P(x) x
+#endif /* defined __STDC__ */
+#ifndef __STDC__
+#define P(x) ()
+#endif /* !defined __STDC__ */
+#endif /* !defined P */
+
extern char ** environ;
-extern int getopt();
+extern int getopt P((int argc, char * const argv[],
+ const char * options));
extern char * optarg;
extern int optind;
-extern time_t time();
extern char * tzname[2];
-static char * abbr();
-static long delta();
-static time_t hunt();
-static int longest;
+static char * abbr P((struct tm * tmp));
+static long delta P((struct tm * newp, struct tm * oldp));
+static time_t hunt P((char * name, time_t lot, time_t hit));
+static size_t longest;
static char * progname;
-static void show();
+static void show P((char * zone, time_t t, int v));
int
main(argc, argv)
@@ -159,7 +168,7 @@ char * argv[];
if (c == 'v')
vflag = 1;
else cutoff = optarg;
- if (c != EOF ||
+ if ((c != EOF && c != -1) ||
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
(void) fprintf(stderr,
_("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
@@ -191,8 +200,7 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
fakeenv = (char **) malloc((size_t) ((i + 2) *
sizeof *fakeenv));
if (fakeenv == NULL ||
- (fakeenv[0] = (char *) malloc((size_t) (longest +
- 4))) == NULL) {
+ (fakeenv[0] = (char *) malloc(longest + 4)) == NULL) {
(void) perror(progname);
(void) exit(EXIT_FAILURE);
}
@@ -255,7 +263,7 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
show(argv[i], t, TRUE);
}
if (fflush(stdout) || ferror(stdout)) {
- (void) fprintf(stderr, _("%s: Error writing standard output "),
+ (void) fprintf(stderr, _("%s: Error writing "),
argv[0]);
(void) perror(_("standard output"));
(void) exit(EXIT_FAILURE);
@@ -326,8 +334,6 @@ struct tm * oldp;
return result;
}
-extern struct tm * localtime();
-
static void
show(zone, t, v)
char * zone;
@@ -336,9 +342,9 @@ int v;
{
struct tm * tmp;
- (void) printf("%-*s ", longest, zone);
+ (void) printf("%-*s ", (int) longest, zone);
if (v)
- (void) printf("%.24s GMT = ", asctime(gmtime(&t)));
+ (void) printf("%.24s UTC = ", asctime(gmtime(&t)));
tmp = localtime(&t);
(void) printf("%.24s", asctime(tmp));
if (*abbr(tmp) != '\0')
diff --git a/usr.sbin/zic/zic.8 b/usr.sbin/zic/zic.8
index 979f4fa..b99afca 100644
--- a/usr.sbin/zic/zic.8
+++ b/usr.sbin/zic/zic.8
@@ -205,6 +205,8 @@ Recognized forms include:
.fi
.in -.5i
.sp
+where hour 0 is midnight at the start of the day,
+and hour 24 is midnight at the end of the day.
Any of these forms may be followed by the letter
.B w
if the given time is local
@@ -272,13 +274,13 @@ This is the name used in creating the time conversion information file for the
zone.
.TP
.B GMTOFF
-The amount of time to add to GMT to get standard time in this zone.
+The amount of time to add to UTC to get standard time in this zone.
This field has the same format as the
.B AT
and
.B SAVE
fields of rule lines;
-begin the field with a minus sign if time must be subtracted from GMT.
+begin the field with a minus sign if time must be subtracted from UTC.
.TP
.B RULES/SAVE
The name of the rule(s) that apply in the time zone or,
@@ -299,11 +301,14 @@ a slash (/)
separates standard and daylight abbreviations.
.TP
.B UNTIL
-The time at which the GMT offset or the rule(s) change for a location.
+The time at which the UTC offset or the rule(s) change for a location.
It is specified as a year, a month, a day, and a time of day.
If this is specified,
-the time zone information is generated from the given GMT offset
+the time zone information is generated from the given UTC offset
and rule change until the time specified.
+The month, day, and time of day have the same format as the IN, ON, and AT
+columns of a rule; trailing columns can be omitted, and default to the
+earliest possible value for the missing columns.
.IP
The next line must be a
.q continuation
@@ -389,7 +394,7 @@ The
field
should be (an abbreviation of)
.q Stationary
-if the leap second time given by the other fields should be interpreted as GMT
+if the leap second time given by the other fields should be interpreted as UTC
or
(an abbreviation of)
.q Rolling
@@ -405,4 +410,4 @@ the earliest transition time recorded in the compiled file is correct.
/usr/local/etc/zoneinfo standard directory used for created files
.SH "SEE ALSO"
newctime(3), tzfile(5), zdump(8)
-.\" @(#)zic.8 7.12
+.\" @(#)zic.8 7.18
diff --git a/usr.sbin/zic/zic.c b/usr.sbin/zic/zic.c
index 0cec893..040a605 100644
--- a/usr.sbin/zic/zic.c
+++ b/usr.sbin/zic/zic.c
@@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)zic.c 7.77";
+static char elsieid[] = "@(#)zic.c 7.96";
#endif /* !defined NOID */
#endif /* !defined lint */
@@ -79,15 +79,9 @@ struct zone {
extern int getopt P((int argc, char * const argv[],
const char * options));
-extern char * icatalloc P((char * old, const char * new));
-extern char * icpyalloc P((const char * string));
-extern void ifree P((char * p));
-extern char * imalloc P((int n));
-extern void * irealloc P((void * old, int n));
extern int link P((const char * fromname, const char * toname));
extern char * optarg;
extern int optind;
-extern char * scheck P((const char * string, const char * format));
static void addtt P((time_t starttime, int type));
static int addtype P((long gmtoff, const char * abbr, int isdst,
@@ -136,9 +130,9 @@ static void usage P((void));
static void writezone P((const char * name));
static int yearistype P((int year, const char * type));
-#if !HAVE_STRERROR
+#if !(HAVE_STRERROR - 0)
static char * strerror P((int));
-#endif /* !HAVE_STRERROR */
+#endif /* !(HAVE_STRERROR - 0) */
static int charcnt;
static int errors;
@@ -147,8 +141,10 @@ static int leapcnt;
static int linenum;
static time_t max_time;
static int max_year;
+static int max_year_representable;
static time_t min_time;
static int min_year;
+static int min_year_representable;
static int noise;
static const char * rfilename;
static int rlinenum;
@@ -359,6 +355,7 @@ char * const ptr;
{
if (ptr == NULL) {
const char *e = strerror(errno);
+
(void) fprintf(stderr, _("%s: Memory exhausted: %s\n"),
progname, e);
(void) exit(EXIT_FAILURE);
@@ -375,19 +372,18 @@ char * const ptr;
** Error handling.
*/
-#if ! HAVE_STRERROR
+#if !(HAVE_STRERROR - 0)
static char *
strerror(errnum)
int errnum;
{
- extern char *sys_errlist[];
- extern int sys_nerr;
+ extern char * sys_errlist[];
+ extern int sys_nerr;
- if (errnum > 0 && errnum <= sys_nerr)
- return sys_errlist[errnum];
- return "Unknown system error";
+ return (errnum > 0 && errnum <= sys_nerr) ?
+ sys_errlist[errnum] : _("Unknown system error");
}
-#endif /* ! HAVE_STRERROR */
+#endif /* !(HAVE_STRERROR - 0) */
static void
eats(name, num, rname, rnum)
@@ -434,9 +430,9 @@ const char * const string;
{
char * cp;
- cp = ecpyalloc("warning: ");
+ cp = ecpyalloc(_("warning: "));
cp = ecatalloc(cp, string);
- error(string);
+ error(cp);
ifree(cp);
--errors;
}
@@ -476,7 +472,7 @@ char * argv[];
(void) textdomain(TZ_DOMAIN);
#endif /* HAVE_GETTEXT - 0 */
progname = argv[0];
- while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF)
+ while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1)
switch (c) {
default:
usage();
@@ -605,10 +601,21 @@ const char * const tofile;
if (!itsdir(toname))
(void) remove(toname);
if (link(fromname, toname) != 0) {
+ int result;
+
if (mkdirs(toname) != 0)
(void) exit(EXIT_FAILURE);
- if (link(fromname, toname) != 0) {
+ result = link(fromname, toname);
+#if (HAVE_SYMLINK - 0)
+ if (result != 0) {
+ result = symlink(fromname, toname);
+ if (result == 0)
+warning(_("hard link failed, symbolic link used"));
+ }
+#endif
+ if (result != 0) {
const char *e = strerror(errno);
+
(void) fprintf(stderr,
_("%s: Can't link from %s to %s: %s\n"),
progname, fromname, toname, e);
@@ -654,6 +661,8 @@ setboundaries P((void))
}
min_year = TM_YEAR_BASE + gmtime(&min_time)->tm_year;
max_year = TM_YEAR_BASE + gmtime(&max_time)->tm_year;
+ min_year_representable = min_year;
+ max_year_representable = max_year;
}
static int
@@ -781,6 +790,7 @@ const char * name;
fp = stdin;
} else if ((fp = fopen(name, "r")) == NULL) {
const char *e = strerror(errno);
+
(void) fprintf(stderr, _("%s: Can't open %s: %s\n"),
progname, name, e);
(void) exit(EXIT_FAILURE);
@@ -849,6 +859,7 @@ _("%s: panic: Invalid l_value %d\n"),
}
if (fp != stdin && fclose(fp)) {
const char *e = strerror(errno);
+
(void) fprintf(stderr, _("%s: Error closing %s: %s\n"),
progname, filename, e);
(void) exit(EXIT_FAILURE);
@@ -890,9 +901,10 @@ const int signable;
error(errstring);
return 0;
}
- if (hh < 0 || hh >= HOURSPERDAY ||
+ if ((hh < 0 || hh >= HOURSPERDAY ||
mm < 0 || mm >= MINSPERHOUR ||
- ss < 0 || ss > SECSPERMIN) {
+ ss < 0 || ss > SECSPERMIN) &&
+ !(hh == HOURSPERDAY && mm == 0 && ss == 0)) {
error(errstring);
return 0;
}
@@ -1019,7 +1031,7 @@ const int iscont;
}
z.z_filename = filename;
z.z_linenum = linenum;
- z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid GMT offset"), TRUE);
+ z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid UTC offset"), TRUE);
if ((cp = strchr(fields[i_format], '%')) != 0) {
if (*++cp != 's' || strchr(cp, '%') != 0) {
error(_("invalid abbreviation format"));
@@ -1221,6 +1233,7 @@ const char * const timep;
rp->r_todisstd = FALSE;
rp->r_todisgmt = FALSE;
*ep = '\0';
+ break;
case 'g': /* Greenwich */
case 'u': /* Universal */
case 'z': /* Zulu */
@@ -1252,6 +1265,11 @@ const char * const timep;
} else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1) {
error(_("invalid starting year"));
return;
+ } else if (noise) {
+ if (rp->r_loyear < min_year_representable)
+ warning(_("starting year too low to be represented"));
+ else if (rp->r_loyear > max_year_representable)
+ warning(_("starting year too high to be represented"));
}
cp = hiyearp;
if ((lp = byword(cp, end_years)) != NULL) switch ((int) lp->l_value) {
@@ -1272,6 +1290,11 @@ const char * const timep;
} else if (sscanf(cp, scheck(cp, "%d"), &rp->r_hiyear) != 1) {
error(_("invalid ending year"));
return;
+ } else if (noise) {
+ if (rp->r_loyear < min_year_representable)
+ warning(_("starting year too low to be represented"));
+ else if (rp->r_loyear > max_year_representable)
+ warning(_("starting year too high to be represented"));
}
if (rp->r_loyear > rp->r_hiyear) {
error(_("starting year greater than ending year"));
@@ -1286,6 +1309,8 @@ const char * const timep;
}
rp->r_yrtype = ecpyalloc(typep);
}
+ if (rp->r_loyear < min_year && rp->r_loyear > 0)
+ min_year = rp->r_loyear;
/*
** Day work.
** Accept things such as:
@@ -1394,8 +1419,10 @@ const char * const name;
toi = 0;
fromi = 0;
+ while (fromi < timecnt && attypes[fromi].at < min_time)
+ ++fromi;
if (isdsts[0] == 0)
- while (attypes[fromi].type == 0)
+ while (fromi < timecnt && attypes[fromi].type == 0)
++fromi; /* handled by default rule */
for ( ; fromi < timecnt; ++fromi) {
if (toi != 0
@@ -1423,11 +1450,22 @@ const char * const name;
fullname = erealloc(fullname,
(int) (strlen(directory) + 1 + strlen(name) + 1));
(void) sprintf(fullname, "%s/%s", directory, name);
+ /*
+ ** Remove old file, if any, to snap links.
+ */
+ if (!itsdir(fullname) && remove(fullname) != 0 && errno != ENOENT) {
+ const char *e = strerror(errno);
+
+ (void) fprintf(stderr, _("%s: Can't remove %s: %s\n"),
+ progname, fullname, e);
+ (void) exit(EXIT_FAILURE);
+ }
if ((fp = fopen(fullname, "wb")) == NULL) {
if (mkdirs(fullname) != 0)
(void) exit(EXIT_FAILURE);
if ((fp = fopen(fullname, "wb")) == NULL) {
const char *e = strerror(errno);
+
(void) fprintf(stderr, _("%s: Can't create %s: %s\n"),
progname, fullname, e);
(void) exit(EXIT_FAILURE);
@@ -1439,7 +1477,9 @@ const char * const name;
convert(eitol(timecnt), tzh.tzh_timecnt);
convert(eitol(typecnt), tzh.tzh_typecnt);
convert(eitol(charcnt), tzh.tzh_charcnt);
+ (void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
#define DO(field) (void) fwrite((void *) tzh.field, (size_t) sizeof tzh.field, (size_t) 1, fp)
+ DO(tzh_magic);
DO(tzh_reserved);
DO(tzh_ttisgmtcnt);
DO(tzh_ttisstdcnt);
@@ -1603,7 +1643,7 @@ const int zonecount;
INITIALIZE(ktime);
if (useuntil) {
/*
- ** Turn untiltime into GMT
+ ** Turn untiltime into UTC
** assuming the current gmtoff and
** stdoff values.
*/
@@ -1683,7 +1723,7 @@ const int zonecount;
(void) strcpy(startbuf, zp->z_format);
eat(zp->z_filename, zp->z_linenum);
if (*startbuf == '\0')
-error(_("can't determine time zone abbrevation to use just after until time"));
+error(_("can't determine time zone abbreviation to use just after until time"));
else addtt(starttime,
addtype(startoff, startbuf,
startoff != zp->z_gmtoff,
@@ -1709,8 +1749,22 @@ error(_("can't determine time zone abbrevation to use just after until time"));
static void
addtt(starttime, type)
const time_t starttime;
-const int type;
+int type;
{
+ if (starttime <= min_time ||
+ (timecnt == 1 && attypes[0].at < min_time)) {
+ gmtoffs[0] = gmtoffs[type];
+ isdsts[0] = isdsts[type];
+ ttisstds[0] = ttisstds[type];
+ ttisgmts[0] = ttisgmts[type];
+ if (abbrinds[type] != 0)
+ (void) strcpy(chars, &chars[abbrinds[type]]);
+ abbrinds[0] = 0;
+ charcnt = strlen(chars) + 1;
+ typecnt = 1;
+ timecnt = 0;
+ type = 0;
+ }
if (timecnt >= TZ_MAX_TIMES) {
error(_("too many transitions?!"));
(void) exit(EXIT_FAILURE);
@@ -1905,10 +1959,11 @@ register const struct lookup * const table;
*/
foundlp = NULL;
for (lp = table; lp->l_word != NULL; ++lp)
- if (itsabbr(word, lp->l_word))
+ if (itsabbr(word, lp->l_word)) {
if (foundlp == NULL)
foundlp = lp;
else return NULL; /* multiple inexact matches */
+ }
return foundlp;
}
@@ -2112,14 +2167,20 @@ char * const argname;
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, 0755) != 0) {
+ if (mkdir(name, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) != 0) {
const char *e = strerror(errno);
- (void) fprintf(stderr,
- _("%s: Can't create directory %s: %s\n"),
- progname, name, e);
- ifree(name);
- return -1;
+
+ if (errno != EEXIST || !itsdir(name)) {
+ (void) fprintf(stderr,
+_("%s: Can't create directory %s: %s\n"),
+ progname, name, e);
+ ifree(name);
+ return -1;
+ }
}
}
*cp = '/';
OpenPOWER on IntegriCloud