From 6c2f050742cfb5b3ff6ee96b106409f541eb53bc Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 9 Mar 1995 10:00:12 +0000 Subject: Wed Mar 8 13:38:13 1995 Roland McGrath * posix/glob/configure.bat: Fixes from DJ. * time/backward, time/europe, time/northamerica, time/pacificnew, time/zdump.c, time/zic.c, time/tzfile.h, time/private.h, time/ialloc.c: Code and data updated from ADO's 95b. * time/emkdir.c: File removed. * time/Makefile (distribute, extra-objs, zic): Omit it. * time/localtime.c: Deansideclized. Never #define __tzname et al to non-__ names. * locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int * instead of short int *. * ctype/ctype-info.c: Likewise. * ctype/ctype.h: Likewise. * locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead of EB and EL versions. --- time/Makefile | 6 +- time/backward | 9 +-- time/emkdir.c | 85 ---------------------- time/europe | 196 ++++++++++++++++++++++++++------------------------- time/ialloc.c | 35 +++------- time/localtime.c | 16 ++--- time/northamerica | 4 +- time/pacificnew | 4 +- time/private.h | 206 +++++++++++++++++++++++++----------------------------- time/tzfile.h | 16 ++++- time/zdump.c | 34 +++++---- time/zic.c | 155 ++++++++++++++++++++++++---------------- 12 files changed, 351 insertions(+), 415 deletions(-) delete mode 100644 time/emkdir.c (limited to 'time') diff --git a/time/Makefile b/time/Makefile index 684fa51a53..435ef83998 100644 --- a/time/Makefile +++ b/time/Makefile @@ -22,8 +22,8 @@ subdir := time headers := time.h sys/time.h sys/timeb.h -distribute := tzfile.h private.h scheck.c ialloc.c emkdir.c yearistype -extra-objs = scheck.o ialloc.o emkdir.o zonenames $(tzfiles:%=z.%) +distribute := tzfile.h private.h scheck.c ialloc.c yearistype +extra-objs = scheck.o ialloc.o zonenames $(tzfiles:%=z.%) routines := offtime asctime clock ctime difftime gmtime \ localtime mktime strftime time tzset tzfile \ @@ -113,7 +113,7 @@ $(installed-posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic endif -$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o $(objpfx)emkdir.o +$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o $(objpfx)tzfile.o: tzfile.c; $(tz-cc) $(objpfx)zic.o: zic.c; $(tz-cc) diff --git a/time/backward b/time/backward index 9298788b30..d4d8ff082f 100644 --- a/time/backward +++ b/time/backward @@ -1,9 +1,9 @@ -# @(#)backward 7.6 +# @(#)backward 7.8 -# This file provides links between late-1993-vintage names for time zones -# and their previous names. +# This file provides links between current names for time zones +# and their old names. Many names changed in late 1993. -Link Australia/Sydney Australia/ACT +Link Australia/Canberra Australia/ACT Link Australia/Lord_Howe Australia/LHI Link Australia/Sydney Australia/NSW Link Australia/Darwin Australia/North @@ -48,6 +48,7 @@ Link Africa/Tripoli Libya Link America/Tijuana Mexico/BajaNorte Link America/Mazatlan Mexico/BajaSur Link America/Mexico_City Mexico/General +Link America/Shiprock Navajo Link Pacific/Auckland NZ Link Pacific/Chatham NZ-CHAT Link Asia/Shanghai PRC diff --git a/time/emkdir.c b/time/emkdir.c deleted file mode 100644 index 5cc62d29e2..0000000000 --- a/time/emkdir.c +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef lint -#ifndef NOID -static char elsieid[] = "@(#)emkdir.c 8.23"; -#endif /* !defined NOID */ -#endif /* !defined lint */ - -#ifndef emkdir - -/*LINTLIBRARY*/ - -#include "private.h" - -extern char * imalloc P((int n)); -extern void ifree P((char * p)); - -static char * -quoted(name) -register const char * name; -{ - register char * result; - register char * cp; - register int c; - - if (name == NULL) - name = ""; - result = imalloc((int) (4 * strlen(name) + 3)); - if (result == NULL) - return NULL; - cp = result; -#ifdef unix - *cp++ = '\''; - while ((c = *name++) != '\0') - if (c == '\'') { - *cp++ = c; - *cp++ = '\\'; - *cp++ = c; - *cp++ = c; - } else *cp++ = c; - *cp++ = '\''; -#endif /* defined unix */ -#ifndef unix - while ((c = *name++) != '\0') - if (c == '/') - *cp++ = '\\'; - else *cp++ = c; -#endif /* !defined unix */ - *cp = '\0'; - return result; -} - -int -emkdir(name, mode) -const char * name; -const int mode; -{ - register int result; - register const char * format; - register char * command; - register char * qname; - - if ((qname = quoted(name)) == NULL) - return -1; -#ifdef unix - format = "mkdir 2>&- %s && chmod 2>&- %o %s"; -#endif /* defined unix */ -#ifndef unix - format = "mkdir %s"; -#endif /* !defined unix */ - command = imalloc((int) (strlen(format) + 2 * strlen(qname) + 20 + 1)); - if (command == NULL) { - ifree(qname); - return -1; - } - (void) sprintf(command, format, qname, mode, qname); - ifree(qname); - result = system(command); - ifree(command); - return (result == 0) ? 0 : -1; -} - -/* -** UNIX was a registered trademark of UNIX System Laboratories in 1993. -*/ - -#endif /* !defined emkdir */ diff --git a/time/europe b/time/europe index a802cfec8c..c5d4a572aa 100644 --- a/time/europe +++ b/time/europe @@ -446,7 +446,7 @@ # place of my old transcription of the Green Paper table [the UK Government # paper "Summer Time: A Consultation Document" (HMSO Cm722 June 1989)]. # -# Peter Ilieve peter@memex.co.uk +# Peter Ilieve peter@memex.co.uk # # # ## control file for tabscript, a program to generate UK summer time dates @@ -714,27 +714,25 @@ Rule GB-Eire 1961 1967 - Oct Sun>=23 2:00s 0 GMT Rule GB-Eire 1971 only - Oct 31 3:00 0 GMT Rule GB-Eire 1972 1980 - Oct Sun>=23 2:00s 0 GMT # 1981 on -Rule GB-Eire 1981 max - Mar lastSun 1:00s 1:00 BST -Rule GB-Eire 1981 1989 - Oct Sun>=23 1:00s 0 GMT -Rule GB-Eire 1990 1995 - Oct Sun>=22 1:00s 0 GMT -Rule GB-Eire 1996 max - Oct lastSun 1:00s 0 GMT -#Rule GB-Eire 1981 max - Mar lastSun 1:00u 1:00 BST -#Rule GB-Eire 1981 1989 - Oct Sun>=23 1:00u 0 GMT -#Rule GB-Eire 1990 1995 - Oct Sun>=22 1:00u 0 GMT -#Rule GB-Eire 1996 max - Oct lastSun 1:00u 0 GMT -# Also see W-Eur, which (starting 1996) differs only in LETTER/S. +Rule GB-Eire 1981 max - Mar lastSun 1:00u 1:00 BST +Rule GB-Eire 1981 1989 - Oct Sun>=23 1:00u 0 GMT +Rule GB-Eire 1990 1995 - Oct Sun>=22 1:00u 0 GMT +Rule GB-Eire 1996 max - Oct lastSun 1:00u 0 GMT +# Also see EC, which (starting 1996) differs only in LETTER/S. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/London -0:01:15 - LMT 1847 Sep 22 0:00 GB-Eire %s 1968 Feb 18 2:00 1:00 - BST 1971 Oct 31 2:00 - 0:00 GB-Eire %s + 0:00 GB-Eire %s 1996 + 0:00 EC GMT/BST Zone Europe/Belfast -0:23:40 - LMT 1880 Aug 2 -0:25:21 - DMT 1916 May 21 2:00 # Dublin MT -0:25:21 1:00 DST 1916 Oct 1 3:00 0:00 GB-Eire %s 1968 Feb 18 2:00 1:00 - BST 1971 Oct 31 3:00 - 0:00 GB-Eire %s + 0:00 GB-Eire %s 1996 + 0:00 EC GMT/BST Zone Europe/Dublin -0:25:21 - LMT 1880 Aug 2 -0:25:21 - DMT 1916 May 21 2:00 # Dublin MT -0:25:21 1:00 DST 1916 Oct 1 3:00 @@ -745,17 +743,26 @@ Zone Europe/Dublin -0:25:21 - LMT 1880 Aug 2 0:00 - GMT 1948 Apr 18 2:00 0:00 GB-Eire %s 1968 Feb 18 2:00 1:00 - BST 1971 Oct 31 3:00 - 0:00 GB-Eire %s + 0:00 GB-Eire %s 1996 + 0:00 EC GMT/BST ############################################################################### # Continental Europe -# The *-Eur rules now correspond to the European Community (EC). -# Three rulesets are used because the EC changes at 01:00 UTC, not local time. -# Older *-Eur rules are for convenience in the tables. +# EC rules are for the European Community. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule EC 1800 only - Jan 1 0:00 0 - +Rule EC 1977 1980 - Apr Sun>=1 1:00u 1:00 " DST" +Rule EC 1977 only - Sep lastSun 1:00u 0 - +Rule EC 1978 only - Oct 1 1:00u 0 - +Rule EC 1979 1995 - Sep lastSun 1:00u 0 - +Rule EC 1981 max - Mar lastSun 1:00u 1:00 " DST" +Rule EC 1996 max - Oct lastSun 1:00u 0 - +# Also see GB-Eire, which (starting 1996) differs only in LETTER/S. + +# W-Eur differs from EC only in that W-Eur uses standard time. Rule W-Eur 1800 only - Jan 1 0:00 0 - Rule W-Eur 1977 1980 - Apr Sun>=1 1:00s 1:00 " DST" Rule W-Eur 1977 only - Sep lastSun 1:00s 0 - @@ -763,8 +770,9 @@ Rule W-Eur 1978 only - Oct 1 1:00s 0 - Rule W-Eur 1979 1995 - Sep lastSun 1:00s 0 - Rule W-Eur 1981 max - Mar lastSun 1:00s 1:00 " DST" Rule W-Eur 1996 max - Oct lastSun 1:00s 0 - -# Also see GB-Eire, which (starting 1996) differs only in LETTER/S. +# Older M-Eur rules are for convenience in the tables. +# From 1977 on, M-Eur differs from EC only in that M-Eur uses standard time. Rule M-Eur 1800 only - Jan 1 0:00 0 - Rule M-Eur 1916 only - Apr 30 23:00 1:00 " DST" Rule M-Eur 1916 only - Oct 1 1:00 0 - @@ -789,10 +797,6 @@ Rule M-Eur 1979 1995 - Sep lastSun 2:00s 0 - Rule M-Eur 1981 max - Mar lastSun 2:00s 1:00 " DST" Rule M-Eur 1996 max - Oct lastSun 2:00s 0 - -Rule E-Eur 1981 max - Mar lastSun 3:00s 1:00 " DST" -Rule E-Eur 1981 1995 - Sep lastSun 3:00s 0 - -Rule E-Eur 1996 max - Oct lastSun 3:00s 0 - - # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Russia 1880 only - Jan 1 0:00 0 - Rule Russia 1917 only - Jul 1 23:00 1:00 " DST" @@ -817,9 +821,9 @@ Rule Russia 1985 max - Mar lastSun 2:00s 1:00 D # These are for backward compatibility with older versions. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone WET 0:00 W-Eur WET%s +Zone WET 0:00 EC WET%s Zone MET 1:00 M-Eur MET%s -Zone EET 2:00 E-Eur EET%s +Zone EET 2:00 EC EET%s Zone W-SU 3:00 M-Eur ???? # Tom Hoffman says that MET is also known as Central European Time @@ -859,14 +863,14 @@ Zone Europe/Tirane 1:19:20 - LMT 1914 1:00 - MET 1940 Jun 16 1:00 Albania MET%s 1985 Mar 31 1:00 1:00 W-Eur MET%s -# This may change to `M-Eur' soon, for EC compatibility. +# This may change to `EC' soon. # Andorra # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Andorra 0:06:04 - LMT 1901 0:00 - WET 1946 Sep 30 1:00 - MET 1985 Mar 31 2:00 - 1:00 M-Eur MET%s + 1:00 EC MET%s # Austria # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -884,8 +888,8 @@ Zone Europe/Vienna 1:05:20 - LMT 1893 Apr 1:00 M-Eur MET%s 1918 Jun 16 3:00 1:00 Austria MET%s 1940 Apr 1 2:00 1:00 M-Eur MET%s 1945 Apr 2 2:00 - 1:00 Austria MET%s 1981 Mar 29 2:00 - 1:00 M-Eur MET%s + 1:00 Austria MET%s 1981 + 1:00 EC MET%s # Belarus # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -944,8 +948,8 @@ Zone Europe/Brussels 0:17:20 - LMT 1880 1:00 M-Eur MET%s 1919 Mar 1 23:00 0:00 Belgium WET%s 1940 Feb 24 23:00 1:00 M-Eur MET%s 1945 Apr 2 2:00 - 1:00 Belgium MET%s 1977 Apr 3 2:00 - 1:00 M-Eur MET%s + 1:00 Belgium MET%s 1977 + 1:00 EC MET%s # Bosnia and Herzegovina # They switched from the Julian to the Gregorian calendar on 1918 Mar 18. @@ -954,8 +958,8 @@ Zone Europe/Sarajevo 1:13:40 - LMT 1884 1:00 - MET 1941 Apr 18 23:00 1:00 M-Eur MET%s 1945 May 8 2:00s 1:00 1:00 "MET DST" 1945 Sep 16 2:00s - 1:00 - MET 1983 Mar 27 2:00s - 1:00 M-Eur MET%s + 1:00 - MET 1983 + 1:00 EC MET%s # Bulgaria # Part switched from the Julian to the Gregorian calendar on 1915 Nov 14; @@ -974,7 +978,7 @@ Zone Europe/Sofia 1:33:16 - LMT 1880 2:00 - EET 1979 Mar 31 23:00 2:00 Bulg EET%s 1982 Sep 26 2:00 2:00 M-Eur EET%s -# This may change to `E-Eur' soon, for EC compatibility. +# This may change to `EC' soon. # Croatia # They switched from the Julian to the Gregorian calendar on 1918 Mar 18. @@ -983,8 +987,8 @@ Zone Europe/Zagreb 1:03:52 - LMT 1884 1:00 - MET 1941 Apr 18 23:00 1:00 M-Eur MET%s 1945 May 8 2:00s 1:00 1:00 "MET DST" 1945 Sep 16 2:00s - 1:00 - MET 1983 Mar 27 2:00s - 1:00 M-Eur MET%s + 1:00 - MET 1983 + 1:00 EC MET%s # Czech Republic # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1000,8 +1004,8 @@ Rule Czech 1949 only - Apr 9 2:00s 1:00 " DST" Zone Europe/Prague 0:57:44 - LMT 1850 0:58 - PMT 1891 Oct # Prague Mean Time 1:00 M-Eur MET%s 1944 Sep 17 2:00s - 1:00 Czech MET%s 1979 Apr 1 2:00 - 1:00 M-Eur MET%s + 1:00 Czech MET%s 1979 + 1:00 EC MET%s # Denmark # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1025,11 +1029,11 @@ Zone Europe/Copenhagen 0:50:20 - LMT 1890 0:50 - CMT 1894 Apr # Copenhagen Mean Time 1:00 Denmark MET%s 1942 Nov 2 2:00s 1:00 M-Eur MET%s 1945 Apr 2 2:00 - 1:00 Denmark MET%s 1980 Apr 6 2:00 - 1:00 M-Eur MET%s + 1:00 Denmark MET%s 1980 + 1:00 EC MET%s Zone Atlantic/Faeroe -0:27:04 - LMT 1908 Jan 11 # Torshavn - 0:00 - WET 1981 Mar 29 1:00 - 0:00 W-Eur WET%s + 0:00 - WET 1981 + 0:00 EC WET%s Zone America/Scoresbysund -1:29:00 - LMT 1916 Jul 28 -2:00 - MGT 1980 Apr 6 2:00 -2:00 M-Eur MGT%s 1981 Mar 29 @@ -1058,7 +1062,7 @@ Zone Europe/Tallinn 1:39:00 - LMT 1880 3:00 Russia MS%s 1989 Mar 26 2:00s 2:00 1:00 "EET DST" 1989 Sep 24 2:00s 2:00 M-Eur EET%s -# This may change to `E-Eur' soon, for EC compatibility. +# This may change to `EC' soon. # Finland # @@ -1078,7 +1082,7 @@ Rule Finland 1942 only - Oct 3 0:00 0 - Zone Europe/Helsinki 1:39:52 - LMT 1878 May 31 1:40 - HMT 1921 May # Helsinki Mean Time 2:00 Finland EET%s 1981 Mar 29 2:00 - 2:00 E-Eur EET%s + 2:00 EC EET%s # France # Shanks seems to use `24:00' ambiguously; we resolve it with Whitman. @@ -1141,8 +1145,8 @@ Zone Europe/Paris 0:09:05 - LMT 1891 Mar 15 0:01 0:00 France WET%s 1940 Jun 14 1:00 M-Eur MET%s 1944 Aug 25 0:00 France WET%s 1945 Sep 16 3:00 - 1:00 France MET%s 1977 Apr Sun>=1 2:00 - 1:00 M-Eur MET%s + 1:00 France MET%s 1977 + 1:00 EC MET%s # Germany # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1161,15 +1165,15 @@ Rule Germany 1949 only - Apr 10 2:00s 1:00 " DST" # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Berlin 0:53:28 - LMT 1893 Apr 1:00 M-Eur MET%s 1945 Apr 2 2:00 - 1:00 Germany MET%s 1980 Apr 6 2:00 - 1:00 M-Eur MET%s + 1:00 Germany MET%s 1980 + 1:00 EC MET%s # Gibraltar # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Gibraltar -0:21:24 - LMT 1880 Aug 2 0:00 GB-Eire %s 1957 Apr 14 2:00 - 1:00 - MET 1982 Mar 28 2:00 - 1:00 M-Eur MET%s + 1:00 - MET 1982 + 1:00 EC MET%s # Greece # They adopted the Julian calendar in 1846. @@ -1205,10 +1209,10 @@ Zone Europe/Athens 1:34:52 - LMT 1895 Sep 14 1:35 - AMT 1916 Jul 28 0:01 # Athens MT 2:00 Greece EET%s 1941 Apr 30 1:00 Greece MET%s 1944 Apr 4 - 2:00 Greece EET%s 1981 Mar 29 2:00 -# Greece must change by 1996 for EC compatibility. - 2:00 M-Eur EET%s 1996 # Guess the last minute. - 2:00 E-Eur EET%s + 2:00 Greece EET%s 1981 + # Shanks says they switched to M-Eur in 1981; + # go with EC intead, since Greece joined it on Jan 1. + 2:00 EC EET%s # Hungary # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1237,7 +1241,7 @@ Zone Europe/Budapest 1:16:20 - LMT 1890 Oct 1:00 Hungary MET%s 1941 Apr 6 2:00 1:00 M-Eur MET%s 1945 May 1 23:00 1:00 Hungary MET%s 1980 Sep 28 2:00s - 1:00 M-Eur MET%s + 1:00 EC MET%s # Iceland # @@ -1347,9 +1351,11 @@ Zone Europe/Rome 0:49:56 - LMT 1866 Sep 22 0:50 - RMT 1893 Nov # Rome Mean Time 1:00 Italy MET%s 1942 Nov 2 2:00s 1:00 M-Eur MET%s 1945 Apr 2 2:00s - 1:00 Italy MET%s 1980 Apr 6 2:00 - 1:00 M-Eur MET%s -# Vatican is identical to Europe/Rome; San Marino is like Europe/Rome. + 1:00 Italy MET%s 1980 + 1:00 EC MET%s + +Link Europe/Rome Europe/Vatican +Link Europe/Rome Europe/San_Marino # Latvia # They switched from the Julian to the Gregorian calendar on 1918 Feb 15. @@ -1365,13 +1371,13 @@ Zone Europe/Riga 1:36:24 - LMT 1880 3:00 Russia MS%s 1991 Mar 31 2:00s 2:00 1:00 "EET DST" 1991 Sep 29 2:00s 2:00 M-Eur EET%s -# This may change to `E-Eur' soon, for EC compatibility. +# This may change to `EC' soon. # Liechtenstein # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Vaduz 0:38:04 - LMT 1894 Jun - 1:00 - MET 1981 Mar 29 2:00 - 1:00 M-Eur MET%s + 1:00 - MET 1981 + 1:00 EC MET%s # Lithuania # They switched from the Julian to the Gregorian calendar on 1918 Feb 15. @@ -1387,7 +1393,7 @@ Zone Europe/Vilnius 1:41:16 - LMT 1880 3:00 Russia MS%s 1991 Mar 31 2:00s 2:00 1:00 "EET DST" 1991 Sep 29 2:00s 2:00 M-Eur EET%s -# This may change to `E-Eur' soon, for EC compatibility. +# This may change to `EC' soon. # Luxembourg # Whitman disagrees with most of these dates in minor ways; go with Shanks. @@ -1422,8 +1428,8 @@ Zone Europe/Luxembourg 0:24:36 - LMT 1904 Jun 0:00 Lux WET%s 1929 Oct 6 2:00s 0:00 Belgium WET%s 1940 May 14 3:00 1:00 M-Eur WET%s 1944 Sep 18 3:00 - 1:00 Belgium MET%s 1979 Apr 1 2:00 - 1:00 M-Eur MET%s + 1:00 Belgium MET%s 1979 + 1:00 EC MET%s # Macedonia # They switched from the Julian to the Gregorian calendar on 1918 Mar 18. @@ -1432,8 +1438,8 @@ Zone Europe/Skopje 1:25:44 - LMT 1884 1:00 - MET 1941 Apr 18 23:00 1:00 M-Eur MET%s 1945 May 8 2:00s 1:00 1:00 "MET DST" 1945 Sep 16 2:00s - 1:00 - MET 1983 Mar 27 2:00s - 1:00 M-Eur MET%s + 1:00 - MET 1983 + 1:00 EC MET%s # Malta # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1449,8 +1455,8 @@ Zone Europe/Malta 0:58:04 - LMT 1893 Nov 2 # Valletta 1:00 Italy MET%s 1942 Nov 2 2:00s 1:00 M-Eur MET%s 1945 Apr 2 2:00s 1:00 Italy MET%s 1973 Mar 31 - 1:00 Malta MET%s 1981 Mar 29 2:00s - 1:00 M-Eur MET%s + 1:00 Malta MET%s 1981 + 1:00 EC MET%s # Moldova # They switched from the Julian to the Gregorian calendar on 1919 Mar 18. @@ -1460,7 +1466,7 @@ Zone Europe/Chisinau 1:55:20 - LMT 1924 May 2 3:00 Russia MS%s 1991 Mar 31 2:00s 2:00 1:00 "EET DST" 1991 Sep 29 2:00s 2:00 M-Eur EET%s -# This may change to `E-Eur' soon, for EC compatibility. +# This may change to `EC' soon. # Monaco # Shanks gives 0:09 for Paris Mean Time; go with Whitman's more precise 0:09:05. @@ -1468,8 +1474,8 @@ Zone Europe/Chisinau 1:55:20 - LMT 1924 May 2 Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15 0:09:05 - PMT 1911 Mar 11 # Paris Mean Time 0:00 France WET%s 1945 Sep 16 3:00 - 1:00 France MET%s 1977 Apr Sun>=1 2:00 - 1:00 M-Eur MET%s + 1:00 France MET%s 1977 + 1:00 EC MET%s # Netherlands # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1496,16 +1502,16 @@ Rule Neth 1933 1936 - May 15 2:00s 1:00 NST Rule Neth 1937 only - May 22 2:00s 1:00 NST # Whitman gives 1939 Apr 15 and 1940 Apr 19; go with Shanks. Rule Neth 1938 1939 - May 15 2:00s 1:00 NST -Rule Neth 1945 only - Apr 2 2:00s 1:00 - -Rule Neth 1945 only - May 20 2:00s 0 " DST" +Rule Neth 1945 only - Apr 2 2:00s 1:00 " DST" +Rule Neth 1945 only - May 20 2:00s 0 - # Before 1937, Shanks says just `0:20'; we use Whitman's more precise figure. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Amsterdam 0:19:28 - LMT 1892 May 0:19:28 Neth %s 1937 Jul 0:20 Neth %s 1940 May 16 0:40 1:00 M-Eur MET%s 1945 Apr 2 2:00 - 1:00 Neth MET%s 1977 Apr Sun>=1 2:00 - 1:00 M-Eur MET%s + 1:00 Neth MET%s 1977 + 1:00 EC MET%s # Norway # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1526,8 +1532,8 @@ Rule Norway 1965 only - Apr 25 2:00s 1:00 " DST" Zone Europe/Oslo 0:43:00 - LMT 1895 1:00 Norway MET%s 1940 Aug 10 23:00 1:00 M-Eur MET%s 1945 Apr 2 2:00 - 1:00 Norway MET%s 1980 Apr 6 2:00 - 1:00 M-Eur MET%s + 1:00 Norway MET%s 1980 + 1:00 EC MET%s # Svalbard is like Europe/Oslo. # # From Whitman: @@ -1568,7 +1574,7 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 1:00 M-Eur MET%s 1944 Oct 1:00 Poland MET%s 1977 Apr 3 1:00 1:00 W-Eur MET%s -# This may change to `M-Eur' soon, for EC compatibility. +# This may change to `EC' soon. # Portugal # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1639,11 +1645,11 @@ Zone Europe/Lisbon -0:36:32 - LMT 1884 0:00 Port WET%s 1966 Apr 3 2:00 1:00 - MET 1976 Sep 26 1:00 0:00 Port WET%s 1983 Sep 25 1:00s - 0:00 W-Eur WET%s 1992 Sep 27 1:00s + 0:00 EC WET%s 1992 Sep 27 1:00s # From Rui Pedro Salgueiro (November 12, 1992): # Portugal has recently (September, 27) changed timezone # (from WET to MET or CET) to harmonize with EEC. - 1:00 M-Eur MET%s + 1:00 EC MET%s # We don't know what happened to Madeira or the Azores, # so we'll just use Shanks for now. # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -1658,7 +1664,7 @@ Zone Atlantic/Madeira -1:07:36 - LMT 1884 # Funchal -1:00 Port ACT%s 1966 Apr 3 2:00 0:00 - WET 1977 Mar 27 0:00 Port WET%s 1983 Sep 25 1:00s - 0:00 W-Eur WET%s + 0:00 EC WET%s # Slovakia Link Europe/Prague Europe/Bratislava @@ -1680,7 +1686,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct 1:44 - BMT 1931 Jul 24 # Bucharest MT 2:00 Romania EET%s 1981 Mar 29 2:00s 2:00 M-Eur EET%s -# This may change to `E-Eur' soon, for EC compatibility. +# This may change to `EC' soon. # Russia # From Paul Eggert (May 28, 1994): @@ -1790,8 +1796,8 @@ Zone Europe/Belgrade 1:22:00 - LMT 1884 1:00 - MET 1941 Apr 18 23:00 1:00 M-Eur MET%s 1945 May 8 2:00s 1:00 1:00 "MET DST" 1945 Sep 16 2:00s - 1:00 - MET 1983 Mar 27 2:00s - 1:00 M-Eur MET%s + 1:00 - MET 1983 + 1:00 EC MET%s # Slovenia # They switched from the Julian to the Gregorian calendar on 1918 Mar 18. @@ -1800,8 +1806,8 @@ Zone Europe/Ljubljana 0:58:04 - LMT 1884 1:00 - MET 1941 Apr 18 23:00 1:00 M-Eur MET%s 1945 May 8 2:00s 1:00 1:00 "MET DST" 1945 Sep 16 2:00s - 1:00 - MET 1983 Mar 27 2:00s - 1:00 M-Eur MET%s + 1:00 - MET 1983 + 1:00 EC MET%s # Spain # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1845,13 +1851,13 @@ Rule Spain 1978 only - Oct 1 1:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Madrid -0:14:44 - LMT 1901 0:00 Spain WET%s 1946 Sep 30 - 1:00 Spain MET%s 1979 Apr 1 2:00 - 1:00 M-Eur MET%s + 1:00 Spain MET%s 1979 + 1:00 EC MET%s Zone Atlantic/Canary -1:01:36 - LMT 1922 Mar # Las Palmas de Gran C. -1:00 - ACT 1946 Sep 30 1:00 0:00 - WET 1980 Apr 6 0:00s 0:00 1:00 "WET DST" 1980 Sep 28 0:00s - 0:00 W-Eur WET%s + 0:00 EC WET%s # Sweden # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -1859,8 +1865,8 @@ Zone Europe/Stockholm 1:12:12 - LMT 1878 May 31 1:12 - SMT 1900 Jan 1 1:00 # Stockholm MT 1:00 - MET 1916 Apr 14 23:00s 1:00 1:00 "MET DST" 1916 Sep 30 23:00s - 1:00 - MET 1980 Apr 6 2:00 - 1:00 M-Eur MET%s + 1:00 - MET 1980 + 1:00 EC MET%s # Switzerland # From Howse (1988), p 82: @@ -1871,15 +1877,15 @@ Zone Europe/Stockholm 1:12:12 - LMT 1878 May 31 Rule Swiss 1894 only - Jun 1 0:00 0 - # From Whitman (who writes ``Midnight?''): Rule Swiss 1940 only - Nov 2 0:00 1:00 " DST" -Rule Swiss 1940 only - Dec 31 0:00 0 " DST" +Rule Swiss 1940 only - Dec 31 0:00 0 - # From Shanks (1991): Rule Swiss 1941 1942 - May Sun>=1 2:00 1:00 " DST" -Rule Swiss 1941 1942 - Oct Sun>=1 0:00 0 " DST" +Rule Swiss 1941 1942 - Oct Sun>=1 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12 0:30 - SST 1894 Jun # Swiss Standard Time - 1:00 Swiss MET%s 1981 Mar 29 2:00 - 1:00 M-Eur MET%s + 1:00 Swiss MET%s 1981 + 1:00 EC MET%s # Turkey # European Turkey switched to the Gregorian calendar in 1908. @@ -1945,7 +1951,7 @@ Zone Europe/Istanbul 1:55:52 - LMT 1880 3:00 Turkey TUR%s 1985 Apr 20 2:00 Turkey EET%s 1986 2:00 M-Eur EET%s -# This may change to `E-Eur' soon, for EC compatibility. +# This may change to `EC' soon. Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents. # Ukraine @@ -1963,7 +1969,7 @@ Zone Europe/Kiev 2:02:04 - LMT 1880 2:00 - EET 1930 Jun 21 3:00 Russia MS%s 1990 Jul 17 2:00 M-Eur EET%s -# This may change to `E-Eur' soon, for EC compatibility. +# This may change to `EC' soon. Zone Europe/Simferopol 2:16:24 - LMT 1880 2:08 Russia LST%s 1919 Jul 1 2:00 2:08 Ukraine LST%s 1924 May 2 diff --git a/time/ialloc.c b/time/ialloc.c index d6a1b22b0e..5631947d07 100644 --- a/time/ialloc.c +++ b/time/ialloc.c @@ -1,6 +1,6 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)ialloc.c 8.24"; +static char elsieid[] = "@(#)ialloc.c 8.28"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -8,13 +8,6 @@ static char elsieid[] = "@(#)ialloc.c 8.24"; #include "private.h" -#ifdef MAL -#define NULLMAL(x) ((x) == NULL || (x) == MAL) -#endif /* defined MAL */ -#ifndef MAL -#define NULLMAL(x) ((x) == NULL) -#endif /* !defined MAL */ - #define nonzero(n) (((n) == 0) ? 1 : (n)) char * icalloc P((int nelem, int elsize)); @@ -28,15 +21,7 @@ char * imalloc(n) const int n; { -#ifdef MAL - register char * result; - - result = malloc((alloc_size_T) nonzero(n)); - return NULLMAL(result) ? NULL : result; -#endif /* defined MAL */ -#ifndef MAL - return malloc((alloc_size_T) nonzero(n)); -#endif /* !defined MAL */ + return malloc((size_t) nonzero(n)); } char * @@ -46,7 +31,7 @@ int elsize; { if (nelem == 0 || elsize == 0) nelem = elsize = 1; - return calloc((alloc_size_T) nelem, (alloc_size_T) elsize); + return calloc((size_t) nelem, (size_t) elsize); } void * @@ -54,9 +39,9 @@ irealloc(pointer, size) void * const pointer; const int size; { - if (NULLMAL(pointer)) + if (pointer == NULL) return imalloc(size); - return realloc((genericptr_T) pointer, (alloc_size_T) nonzero(size)); + return realloc((void *) pointer, (size_t) nonzero(size)); } char * @@ -67,14 +52,14 @@ const char * const new; register char * result; register int oldsize, newsize; - newsize = NULLMAL(new) ? 0 : strlen(new); - if (NULLMAL(old)) + newsize = (new == NULL) ? 0 : strlen(new); + if (old == NULL) oldsize = 0; else if (newsize == 0) return old; else oldsize = strlen(old); if ((result = irealloc(old, oldsize + newsize + 1)) != NULL) - if (!NULLMAL(new)) + if (new != NULL) (void) strcpy(result + oldsize, new); return result; } @@ -90,7 +75,7 @@ void ifree(p) char * const p; { - if (!NULLMAL(p)) + if (p != NULL) (void) free(p); } @@ -98,6 +83,6 @@ void icfree(p) char * const p; { - if (!NULLMAL(p)) + if (p != NULL) (void) free(p); } diff --git a/time/localtime.c b/time/localtime.c index a729b974a6..5743347641 100644 --- a/time/localtime.c +++ b/time/localtime.c @@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include #include @@ -25,20 +24,15 @@ Cambridge, MA 02139, USA. */ #include -#ifndef HAVE_GNU_LD -#define __tzname tzname -#define __daylight daylight -#define __timezone timezone -#endif - /* Return the `struct tm' representation of *TIMER in the local timezone. */ struct tm * -DEFUN(localtime, (timer), CONST time_t *timer) +localtime (timer) + const time_t *timer; { extern int __use_tzfile; - extern int EXFUN(__tz_compute, (time_t timer, struct tm *tp)); - extern int EXFUN(__tzfile_compute, (time_t timer, - long int *leap_correct, int *leap_hit)); + extern int __tz_compute __P ((time_t timer, struct tm *tp)); + extern int __tzfile_compute __P ((time_t timer, + long int *leap_correct, int *leap_hit)); register struct tm *tp; long int leap_correction; int leap_extra_secs; diff --git a/time/northamerica b/time/northamerica index 40733fddce..479f3fcb80 100644 --- a/time/northamerica +++ b/time/northamerica @@ -1,4 +1,4 @@ -# @(#)northamerica 7.12 +# @(#)northamerica 7.15 # also includes Central America and the Caribbean # This data is by no means authoritative; if you think you know better, @@ -148,7 +148,7 @@ Zone America/Phoenix -7:00 US M%sT 1946 # large size and location in three states." (The "only" means that other # tribal nations don't use DST.) -Link America/Denver Navajo +Link America/Denver America/Shiprock # From Bob Devine (January 28, 1988): # Michigan didn't observe DST from 1968 to 1973. diff --git a/time/pacificnew b/time/pacificnew index cd1477cc71..0c3ac86c2f 100644 --- a/time/pacificnew +++ b/time/pacificnew @@ -1,4 +1,4 @@ -# @(#)pacificnew 7.6 +# @(#)pacificnew 7.7 # From Arthur David Olson (April 5, 1989): # On April 5, 1989, the U. S. House of Representatives passed (238-154) a bill @@ -20,7 +20,7 @@ # Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] ## Zone US/Pacific-PET -8:00 US P%sT XXXX -## -8:00 Twilite P%sT +## -8:00 Twilite P%sT # For now... Link America/Los_Angeles US/Pacific-New ## diff --git a/time/private.h b/time/private.h index 8852b8337b..651a6f1b56 100644 --- a/time/private.h +++ b/time/private.h @@ -16,58 +16,73 @@ #ifndef lint #ifndef NOID -static char privatehid[] = "@(#)private.h 7.10"; +static char privatehid[] = "@(#)private.h 7.33"; #endif /* !defined NOID */ #endif /* !defined lint */ /* -** const +** Defaults for preprocessor symbols. +** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'. */ -#ifndef const -#ifndef __STDC__ -#define const -#endif /* !defined __STDC__ */ -#endif /* !defined const */ +#ifndef HAVE_ADJTIME +#define HAVE_ADJTIME 1 +#endif /* !defined HAVE_ADJTIME */ + +#ifndef HAVE_SETTIMEOFDAY +#define HAVE_SETTIMEOFDAY 3 +#endif /* !defined HAVE_SETTIMEOFDAY */ + +#ifndef HAVE_UNISTD_H +#define HAVE_UNISTD_H 1 +#endif /* !defined HAVE_UNISTD_H */ + +#ifndef LOCALE_HOME +#define LOCALE_HOME "/usr/lib/locale" +#endif /* !defined LOCALE_HOME */ /* -** void +** Nested includes */ -#ifndef void -#ifndef __STDC__ -#ifndef vax -#ifndef sun -#define void char -#endif /* !defined sun */ -#endif /* !defined vax */ -#endif /* !defined __STDC__ */ -#endif /* !defined void */ +#include "sys/types.h" /* for time_t */ +#include "stdio.h" +#include "ctype.h" +#include "errno.h" +#include "string.h" +#include "limits.h" /* for CHAR_BIT */ +#include "time.h" +#include "stdlib.h" + +#if HAVE_UNISTD_H - 0 +#include "unistd.h" /* for F_OK and R_OK */ +#endif /* HAVE_UNISTD_H - 0 */ + +#if !(HAVE_UNISTD_H - 0) +#ifndef F_OK +#define F_OK 0 +#endif /* !defined F_OK */ +#ifndef R_OK +#define R_OK 4 +#endif /* !defined R_OK */ +#endif /* !(HAVE_UNISTD_H - 0) */ /* -** INITIALIZE +** Workarounds for compilers/systems. */ -#ifndef GNUC_or_lint -#ifdef lint -#define GNUC_or_lint -#endif /* defined lint */ -#ifdef __GNUC__ -#define GNUC_or_lint -#endif /* defined __GNUC__ */ -#endif /* !defined GNUC_or_lint */ +/* +** SunOS 4.1.1 cc lacks const. +*/ -#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 */ +#ifndef const +#ifndef __STDC__ +#define const +#endif /* !defined __STDC__ */ +#endif /* !defined const */ /* -** P((args)) +** SunOS 4.1.1 cc lacks prototypes. */ #ifndef P @@ -80,30 +95,24 @@ static char privatehid[] = "@(#)private.h 7.10"; #endif /* !defined P */ /* -** genericptr_T +** SunOS 4.1.1 headers lack EXIT_SUCCESS. */ -#ifdef __STDC__ -typedef void * genericptr_T; -#endif /* defined __STDC__ */ -#ifndef __STDC__ -typedef char * genericptr_T; -#endif /* !defined __STDC__ */ +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif /* !defined EXIT_SUCCESS */ -#include "sys/types.h" /* for time_t */ -#include "stdio.h" -#include "ctype.h" -#include "errno.h" -#include "string.h" -#include "limits.h" /* for CHAR_BIT */ -#ifndef _TIME_ -#include "time.h" -#endif /* !defined _TIME_ */ +/* +** SunOS 4.1.1 headers lack EXIT_FAILURE. +*/ -#ifndef remove -extern int unlink P((const char * filename)); -#define remove unlink -#endif /* !defined remove */ +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif /* !defined EXIT_FAILURE */ + +/* +** SunOS 4.1.1 headers lack FILENAME_MAX. +*/ #ifndef FILENAME_MAX @@ -122,62 +131,18 @@ extern int unlink P((const char * filename)); #endif /* !defined FILENAME_MAX */ -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif /* !defined EXIT_SUCCESS */ - -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 -#endif /* !defined EXIT_FAILURE */ - -#ifdef __STDC__ - -#define alloc_size_T size_t -#define qsort_size_T size_t -#define fwrite_size_T size_t - -#endif /* defined __STDC__ */ -#ifndef __STDC__ - -#ifndef alloc_size_T -#define alloc_size_T unsigned -#endif /* !defined alloc_size_T */ - -#ifndef qsort_size_T -#ifdef USG -#define qsort_size_T unsigned -#endif /* defined USG */ -#ifndef USG -#define qsort_size_T int -#endif /* !defined USG */ -#endif /* !defined qsort_size_T */ - -#ifndef fwrite_size_T -#define fwrite_size_T int -#endif /* !defined fwrite_size_T */ - -#ifndef USG -extern char * sprintf P((char * buf, const char * format, ...)); -#endif /* !defined USG */ - -#endif /* !defined __STDC__ */ - /* -** Ensure that these are declared--redundantly declaring them shouldn't hurt. +** SunOS 4.1.1 libraries lack remove. */ -extern char * getenv P((const char * name)); -extern genericptr_T malloc P((alloc_size_T size)); -extern genericptr_T calloc P((alloc_size_T nelem, alloc_size_T elsize)); -extern genericptr_T realloc P((genericptr_T oldptr, alloc_size_T newsize)); +#ifndef remove +extern int unlink P((const char * filename)); +#define remove unlink +#endif /* !defined remove */ -#ifdef USG -extern void exit P((int s)); -extern void qsort P((genericptr_T base, qsort_size_T nelem, - qsort_size_T elsize, int (*comp)())); -extern void perror P((const char * string)); -extern void free P((char * buf)); -#endif /* defined USG */ +/* +** Finally, some convenience items. +*/ #ifndef TRUE #define TRUE 1 @@ -198,13 +163,32 @@ extern void free P((char * buf)); ((sizeof(type) * CHAR_BIT - 1) * 302 / 1000 + 2) #endif /* !defined INT_STRLEN_MAXIMUM */ -#ifndef LOCALE_HOME -#define LOCALE_HOME "/usr/lib/locale" -#endif /* !defined LOCALE_HOME */ +/* +** 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 */ /* ** UNIX was a registered trademark of UNIX System Laboratories in 1993. -** VAX is a trademark of Digital Equipment Corporation. */ #endif /* !defined PRIVATE_H */ diff --git a/time/tzfile.h b/time/tzfile.h index 45b4d7d606..9c74041582 100644 --- a/time/tzfile.h +++ b/time/tzfile.h @@ -16,7 +16,7 @@ #ifndef lint #ifndef NOID -static char tzfilehid[] = "@(#)tzfile.h 7.4"; +static char tzfilehid[] = "@(#)tzfile.h 7.6"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -41,7 +41,8 @@ static char tzfilehid[] = "@(#)tzfile.h 7.4"; */ struct tzhead { - char tzh_reserved[24]; /* reserved for future use */ + char tzh_reserved[20]; /* reserved for future use */ + 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 */ char tzh_timecnt[4]; /* coded number of transition times */ @@ -67,6 +68,11 @@ struct tzhead { ** transition time is wall clock time ** if absent, transition times are ** assumed to be wall clock time +** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition +** time is GMT, if FALSE, +** transition time is local time +** if absent, transition times are +** assumed to be local time */ /* @@ -89,7 +95,11 @@ struct tzhead { #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ #endif /* !defined NOSOLAR */ #ifdef NOSOLAR -#define TZ_MAX_TYPES 10 /* Maximum number of local time types */ +/* +** Must be at least 14 for Europe/Riga as of Jan 12 1995, +** as noted by Earl Chew . +*/ +#define TZ_MAX_TYPES 20 /* Maximum number of local time types */ #endif /* !defined NOSOLAR */ #endif /* !defined TZ_MAX_TYPES */ diff --git a/time/zdump.c b/time/zdump.c index d35df33073..32882119f8 100644 --- a/time/zdump.c +++ b/time/zdump.c @@ -1,6 +1,6 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)zdump.c 7.12"; +static char elsieid[] = "@(#)zdump.c 7.20"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -10,10 +10,11 @@ static char elsieid[] = "@(#)zdump.c 7.12"; ** You can use this code to help in verifying other implementations. */ -#include "stdio.h" /* for stdout, stderr */ +#include "stdio.h" /* for stdout, stderr, perror */ #include "string.h" /* for strcpy */ #include "sys/types.h" /* for time_t */ #include "time.h" /* for struct tm */ +#include "stdlib.h" /* for exit, malloc, atoi */ #ifndef MAX_STRING_LENGTH #define MAX_STRING_LENGTH 1024 @@ -71,9 +72,11 @@ static char elsieid[] = "@(#)zdump.c 7.12"; #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 @@ -92,11 +95,6 @@ extern int optind; extern time_t time(); extern char * tzname[2]; -#ifdef USG -extern void exit(); -extern void perror(); -#endif /* defined USG */ - static char * abbr(); static long delta(); static time_t hunt(); @@ -109,16 +107,19 @@ main(argc, argv) int argc; char * argv[]; { - register int i, c; + register int i; + register int c; register int vflag; register char * cutoff; register int cutyear; register long cuttime; char ** fakeenv; time_t now; - time_t t, newt; + time_t t; + time_t newt; time_t hibit; - struct tm tm, newtm; + struct tm tm; + struct tm newtm; INITIALIZE(cuttime); progname = argv[0]; @@ -152,15 +153,18 @@ char * argv[]; for (hibit = 1; (hibit << 1) != 0; hibit <<= 1) continue; { - register int from, to; + register int from; + register int to; for (i = 0; environ[i] != NULL; ++i) continue; - fakeenv = (char **) malloc((i + 2) * sizeof *fakeenv); + fakeenv = (char **) malloc((size_t) ((i + 2) * + sizeof *fakeenv)); if (fakeenv == NULL || - (fakeenv[0] = (char *) malloc(longest + 4)) == NULL) { - (void) perror(progname); - (void) exit(EXIT_FAILURE); + (fakeenv[0] = (char *) malloc((size_t) (longest + + 4))) == NULL) { + (void) perror(progname); + (void) exit(EXIT_FAILURE); } to = 0; (void) strcpy(fakeenv[to++], "TZ="); diff --git a/time/zic.c b/time/zic.c index 73ea46821e..fc1a16bff9 100644 --- a/time/zic.c +++ b/time/zic.c @@ -1,11 +1,14 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)zic.c 7.28"; +static char elsieid[] = "@(#)zic.c 7.50"; #endif /* !defined NOID */ #endif /* !defined lint */ #include "private.h" #include "tzfile.h" +#ifdef unix +#include "sys/stat.h" /* for umask manifest constants */ +#endif /* defined unix */ struct rule { const char * r_filename; @@ -25,7 +28,7 @@ struct rule { long r_tod; /* time from midnight */ int r_todisstd; /* above is standard time if TRUE */ /* or wall clock time if FALSE */ - int r_todisuniv; /* above is universal time if TRUE */ + int r_todisgmt; /* above is GMT if TRUE */ /* or local time if FALSE */ long r_stdoff; /* offset from standard time */ const char * r_abbrvar; /* variable part of abbreviation */ @@ -60,8 +63,8 @@ struct zone { time_t z_untiltime; }; -extern int emkdir P((const char * name, int mode)); -extern int getopt P((int argc, char * argv[], const char * options)); +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)); @@ -74,13 +77,15 @@ 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, - int ttisstd)); + int ttisstd, int ttisgmt)); static void leapadd P((time_t t, int positive, int rolling, int count)); static void adjleap P((void)); static void associate P((void)); static int ciequal P((const char * ap, const char * bp)); static void convert P((long val, char * buf)); static void dolink P((const char * fromfile, const char * tofile)); +static void doabbr P((char * abbr, const char * format, + const char * letters, int isdst)); static void eat P((const char * name, int num)); static void eats P((const char * name, int num, const char * rname, int rnum)); @@ -105,7 +110,7 @@ static void newabbr P((const char * abbr)); static long oadd P((long t1, long t2)); static void outzone P((const struct zone * zp, int ntzones)); static void puttzcode P((long code, FILE * fp)); -static int rcomp P((const genericptr_T leftp, const genericptr_T rightp)); +static int rcomp P((const void * leftp, const void * rightp)); static time_t rpytime P((const struct rule * rp, int wantedy)); static void rulesub P((struct rule * rp, const char * loyearp, const char * hiyearp, @@ -321,6 +326,7 @@ static long gmtoffs[TZ_MAX_TYPES]; static char isdsts[TZ_MAX_TYPES]; static unsigned char abbrinds[TZ_MAX_TYPES]; static char ttisstds[TZ_MAX_TYPES]; +static char ttisgmts[TZ_MAX_TYPES]; static char chars[TZ_MAX_CHARS]; static time_t trans[TZ_MAX_LEAPS]; static long corr[TZ_MAX_LEAPS]; @@ -377,7 +383,7 @@ const char * const string; { /* ** Match the format of "cc" to allow sh users to - ** zic ... 2>&1 | error -t "*" -v + ** zic ... 2>&1 | error -t "*" -v ** on BSD systems. */ (void) fprintf(stderr, "\"%s\", line %d: %s", @@ -392,8 +398,8 @@ const char * const string; static void usage P((void)) { - (void) fprintf(stderr, -"%s: usage is %s [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] [ -d directory ] \n\ + (void) fprintf(stderr, "%s: usage is %s \ +[ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] [ -d directory ]\n\ \t[ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n", progname, progname); (void) exit(EXIT_FAILURE); @@ -411,11 +417,12 @@ main(argc, argv) int argc; char * argv[]; { - register int i, j; + register int i; + register int j; register int c; #ifdef unix - (void) umask(umask(022) | 022); + (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); #endif /* defined unix */ progname = argv[0]; while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF) @@ -601,7 +608,7 @@ const char * const name; myname = ecpyalloc(name); myname = ecatalloc(myname, "/."); - accres = access(myname, 0); + accres = access(myname, F_OK); ifree(myname); return accres == 0; } @@ -616,11 +623,11 @@ const char * const name; static int rcomp(cp1, cp2) -const genericptr_T cp1; -const genericptr_T cp2; +const void * cp1; +const void * cp2; { - return strcmp(((struct rule *) cp1)->r_name, - ((struct rule *) cp2)->r_name); + return strcmp(((const struct rule *) cp1)->r_name, + ((const struct rule *) cp2)->r_name); } static void @@ -632,9 +639,8 @@ associate P((void)) register int i; if (nrules != 0) - (void) qsort((genericptr_T) rules, - (qsort_size_T) nrules, - (qsort_size_T) sizeof *rules, rcomp); + (void) qsort((void *) rules, (size_t) nrules, + (size_t) sizeof *rules, rcomp); for (i = 0; i < nzones; ++i) { zp = &zones[i]; zp->z_rules = NULL; @@ -767,7 +773,7 @@ const char * name; /* ** Convert a string of one of the forms -** h -h hh:mm -hh:mm hh:mm:ss -hh:mm:ss +** h -h hh:mm -hh:mm hh:mm:ss -hh:mm:ss ** into a number of seconds. ** A null string maps to zero. ** Call error with errstring and return zero on errors. @@ -956,7 +962,8 @@ const int iscont; zones[nzones - 1].z_untiltime > min_time && zones[nzones - 1].z_untiltime < max_time && zones[nzones - 1].z_untiltime >= z.z_untiltime) { -error("Zone continuation line end time is not after end time of previous line"); + error("Zone continuation line end time is not \ +after end time of previous line"); return FALSE; } } @@ -1115,25 +1122,25 @@ const char * const timep; } rp->r_month = lp->l_value; rp->r_todisstd = FALSE; - rp->r_todisuniv = FALSE; + rp->r_todisgmt = FALSE; dp = ecpyalloc(timep); if (*dp != '\0') { ep = dp + strlen(dp) - 1; switch (lowerit(*ep)) { case 's': /* Standard */ rp->r_todisstd = TRUE; - rp->r_todisuniv = FALSE; + rp->r_todisgmt = FALSE; *ep = '\0'; break; case 'w': /* Wall */ rp->r_todisstd = FALSE; - rp->r_todisuniv = FALSE; + rp->r_todisgmt = FALSE; *ep = '\0'; case 'g': /* Greenwich */ case 'u': /* Universal */ case 'z': /* Zulu */ rp->r_todisstd = TRUE; - rp->r_todisuniv = TRUE; + rp->r_todisgmt = TRUE; *ep = '\0'; break; } @@ -1144,7 +1151,8 @@ const char * const timep; ** Year work. */ cp = loyearp; - if ((lp = byword(cp, begin_years)) != NULL) switch ((int) lp->l_value) { + lp = byword(cp, begin_years); + if (lp != NULL) switch ((int) lp->l_value) { case YR_MINIMUM: rp->r_loyear = min_int; break; @@ -1260,9 +1268,7 @@ FILE * const fp; char buf[4]; convert(val, buf); - (void) fwrite((genericptr_T) buf, - (fwrite_size_T) sizeof buf, - (fwrite_size_T) 1, fp); + (void) fwrite((void *) buf, (size_t) sizeof buf, (size_t) 1, fp); } static void @@ -1286,14 +1292,22 @@ const char * const name; (void) exit(EXIT_FAILURE); } } + convert(eitol(typecnt), tzh.tzh_ttisgmtcnt); convert(eitol(typecnt), tzh.tzh_ttisstdcnt); convert(eitol(leapcnt), tzh.tzh_leapcnt); convert(eitol(timecnt), tzh.tzh_timecnt); convert(eitol(typecnt), tzh.tzh_typecnt); convert(eitol(charcnt), tzh.tzh_charcnt); - (void) fwrite((genericptr_T) &tzh, - (fwrite_size_T) sizeof tzh, - (fwrite_size_T) 1, fp); +#define DO(field) (void) fwrite((void *) tzh.field, \ + (size_t) sizeof tzh.field, (size_t) 1, fp) + DO(tzh_reserved); + DO(tzh_ttisgmtcnt); + DO(tzh_ttisstdcnt); + DO(tzh_leapcnt); + DO(tzh_timecnt); + DO(tzh_typecnt); + DO(tzh_charcnt); +#undef DO for (i = 0; i < timecnt; ++i) { j = leapcnt; while (--j >= 0) @@ -1304,18 +1318,16 @@ const char * const name; puttzcode((long) ats[i], fp); } if (timecnt > 0) - (void) fwrite((genericptr_T) types, - (fwrite_size_T) sizeof types[0], - (fwrite_size_T) timecnt, fp); + (void) fwrite((void *) types, (size_t) sizeof types[0], + (size_t) timecnt, fp); for (i = 0; i < typecnt; ++i) { puttzcode((long) gmtoffs[i], fp); (void) putc(isdsts[i], fp); (void) putc(abbrinds[i], fp); } if (charcnt != 0) - (void) fwrite((genericptr_T) chars, - (fwrite_size_T) sizeof chars[0], - (fwrite_size_T) charcnt, fp); + (void) fwrite((void *) chars, (size_t) sizeof chars[0], + (size_t) charcnt, fp); for (i = 0; i < leapcnt; ++i) { if (roll[i]) { if (timecnt == 0 || trans[i] < ats[0]) { @@ -1337,6 +1349,8 @@ const char * const name; } for (i = 0; i < typecnt; ++i) (void) putc(ttisstds[i], fp); + for (i = 0; i < typecnt; ++i) + (void) putc(ttisgmts[i], fp); if (ferror(fp) || fclose(fp)) { (void) fprintf(stderr, "%s: Write error on ", progname); (void) perror(fullname); @@ -1344,6 +1358,25 @@ const char * const name; } } +static void +doabbr(abbr, format, letters, isdst) +char * const abbr; +const char * const format; +const char * const letters; +const int isdst; +{ + if (strchr(format, '/') == NULL) { + if (letters == NULL) + (void) strcpy(abbr, format); + else (void) sprintf(abbr, format, letters); + } else if (isdst) + (void) strcpy(abbr, strchr(format, '/') + 1); + else { + (void) strcpy(abbr, format); + *strchr(abbr, '/') = '\0'; + } +} + static void outzone(zpfirst, zonecount) const struct zone * const zpfirst; @@ -1360,6 +1393,7 @@ const int zonecount; register long startoff; register int startisdst; register int startttisstd; + register int startttisgmt; register int type; char startbuf[BUFSIZ]; @@ -1381,9 +1415,7 @@ const int zonecount; ** for noting the need to unconditionally initialize startttisstd. */ startttisstd = FALSE; -#ifdef lint - starttime = 0; -#endif /* defined lint */ + startttisgmt = FALSE; for (i = 0; i < zonecount; ++i) { zp = &zpfirst[i]; usestart = i > 0 && (zp - 1)->z_untiltime > min_time; @@ -1395,9 +1427,11 @@ const int zonecount; startisdst = -1; if (zp->z_nrules == 0) { stdoff = zp->z_stdoff; - (void) strcpy(startbuf, zp->z_format); + doabbr(startbuf, zp->z_format, + (char *) NULL, stdoff != 0); type = addtype(oadd(zp->z_gmtoff, stdoff), - startbuf, stdoff != 0, startttisstd); + startbuf, stdoff != 0, startttisstd, + startttisgmt); if (usestart) addtt(starttime, type); else if (stdoff != 0) @@ -1433,7 +1467,7 @@ const int zonecount; ** stdoff values. */ untiltime = zp->z_untiltime; - if (!zp->z_untilrule.r_todisuniv) + if (!zp->z_untilrule.r_todisgmt) untiltime = tadd(untiltime, -gmtoff); if (!zp->z_untilrule.r_todisstd) @@ -1445,16 +1479,13 @@ const int zonecount; ** that takes effect earliest in the year. */ k = -1; -#ifdef lint - ktime = 0; -#endif /* defined lint */ for (j = 0; j < zp->z_nrules; ++j) { rp = &zp->z_rules[j]; if (!rp->r_todo) continue; eats(zp->z_filename, zp->z_linenum, rp->r_filename, rp->r_linenum); - offset = rp->r_todisuniv ? 0 : gmtoff; + offset = rp->r_todisgmt ? 0 : gmtoff; if (!rp->r_todisstd) offset = oadd(offset, stdoff); jtime = rp->r_temp; @@ -1478,8 +1509,9 @@ const int zonecount; stdoff = rp->r_stdoff; startoff = oadd(zp->z_gmtoff, rp->r_stdoff); - (void) sprintf(startbuf, zp->z_format, - rp->r_abbrvar); + doabbr(startbuf, zp->z_format, + rp->r_abbrvar, + rp->r_stdoff != 0); startisdst = rp->r_stdoff != 0; continue; } @@ -1496,19 +1528,20 @@ const int zonecount; startoff = oadd(startoff, zp->z_gmtoff); (void) strcpy(startbuf, - &chars[abbrinds[type]]); + &chars[abbrinds[type]]); } if (startisdst >= 0) -addtt(starttime, addtype(startoff, startbuf, startisdst, startttisstd)); +addtt(starttime, addtype(startoff, startbuf, startisdst, startttisstd, + startttisgmt)); } } eats(zp->z_filename, zp->z_linenum, rp->r_filename, rp->r_linenum); - (void) sprintf(buf, zp->z_format, - rp->r_abbrvar); + doabbr(buf, zp->z_format, rp->r_abbrvar, + rp->r_stdoff != 0); offset = oadd(zp->z_gmtoff, rp->r_stdoff); type = addtype(offset, buf, rp->r_stdoff != 0, - rp->r_todisstd); + rp->r_todisstd, rp->r_todisgmt); addtt(ktime, type); stdoff = rp->r_stdoff; } @@ -1519,6 +1552,7 @@ addtt(starttime, addtype(startoff, startbuf, startisdst, startttisstd)); if (useuntil) { starttime = tadd(zp->z_untiltime, -gmtoff); startttisstd = zp->z_untilrule.r_todisstd; + startttisgmt = zp->z_untilrule.r_todisgmt; if (!startttisstd) starttime = tadd(starttime, -stdoff); } @@ -1545,11 +1579,12 @@ const int type; } static int -addtype(gmtoff, abbr, isdst, ttisstd) +addtype(gmtoff, abbr, isdst, ttisstd, ttisgmt) const long gmtoff; const char * const abbr; const int isdst; const int ttisstd; +const int ttisgmt; { register int i, j; @@ -1560,7 +1595,8 @@ const int ttisstd; for (i = 0; i < typecnt; ++i) { if (gmtoff == gmtoffs[i] && isdst == isdsts[i] && strcmp(abbr, &chars[abbrinds[i]]) == 0 && - ttisstd == ttisstds[i]) + ttisstd == ttisstds[i] && + ttisgmt == ttisgmts[i]) return i; } /* @@ -1574,6 +1610,7 @@ const int ttisstd; gmtoffs[i] = gmtoff; isdsts[i] = isdst; ttisstds[i] = ttisstd; + ttisgmts[i] = ttisgmt; for (j = 0; j < charcnt; ++j) if (strcmp(&chars[j], abbr) == 0) @@ -1908,7 +1945,7 @@ char * const argname; *cp = '\0'; #ifndef unix /* - ** MS-DOS drive specifier? + ** DOS drive specifier? */ if (strlen(name) == 2 && isascii(name[0]) && isalpha(name[0]) && name[1] == ':') { @@ -1920,7 +1957,7 @@ char * const argname; /* ** It doesn't seem to exist, so we try to create it. */ - if (emkdir(name, 0755) != 0) { + if (mkdir(name, 0755) != 0) { (void) fprintf(stderr, "%s: Can't create directory ", progname); -- cgit v1.2.3