From 71c5289b0fcdd4ea89309a18d5e924fa962aab66 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 17 Mar 1997 04:14:27 +0000 Subject: Update from tzcode1997c. --- time/ialloc.c | 9 +-------- time/private.h | 16 ++++++++++++++-- time/scheck.c | 7 ++----- time/tzfile.c | 2 +- time/tzselect.ksh | 13 +++++-------- time/zdump.c | 32 +++++++++++++++++++------------- time/zic.c | 32 ++++++++++++++++++++++---------- 7 files changed, 64 insertions(+), 47 deletions(-) diff --git a/time/ialloc.c b/time/ialloc.c index 5631947d07..8a0c701578 100644 --- a/time/ialloc.c +++ b/time/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/time/private.h b/time/private.h index f81bf4867b..5502aa8c98 100644 --- a/time/private.h +++ b/time/private.h @@ -4,7 +4,7 @@ /* ** This file is in the public domain, so clarified as of -** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov). +** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). */ /* @@ -21,7 +21,7 @@ #ifndef lint #ifndef NOID -static char privatehid[] = "@(#)private.h 7.43"; +static char privatehid[] = "@(#)private.h 7.45"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -172,6 +172,18 @@ extern int unlink P((const char * filename)); extern int errno; #endif /* !defined errno */ +/* +** Private function declarations. +*/ +char * icalloc P((int nelem, int elsize)); +char * icatalloc P((char * old, const char * const new)); +char * icpyalloc P((const char * const string)); +char * imalloc P((const int n)); +void * irealloc P((void * const pointer, const int size)); +void icfree P((char * const pointer)); +void ifree P((char * const pointer)); +char * scheck P((const char * const string, const char * const format)); + /* ** Finally, some convenience items. */ diff --git a/time/scheck.c b/time/scheck.c index 64f25076ed..52b4ff51fd 100644 --- a/time/scheck.c +++ b/time/scheck.c @@ -1,6 +1,6 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)scheck.c 8.13"; +static char elsieid[] = "@(#)scheck.c 8.14"; #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/time/tzfile.c b/time/tzfile.c index 94b8a3c8fe..44b33cb02c 100644 --- a/time/tzfile.c +++ b/time/tzfile.c @@ -120,7 +120,7 @@ __tzfile_read (const char *file) and which is not the system wide default TZDEFAULT. */ if (__libc_enable_secure && ((*file == '/' - && memcmp (file, TZDEFAULT, sizeof (TZDEFAULT) - 1) + && memcmp (file, TZDEFAULT, sizeof TZDEFAULT) && memcmp (file, default_tzdir, sizeof (default_tzdir) - 1)) || strstr (file, "../") != NULL)) /* This test is certainly a bit too restrictive but it should diff --git a/time/tzselect.ksh b/time/tzselect.ksh index 33bdbc7431..031cda1de6 100644 --- a/time/tzselect.ksh +++ b/time/tzselect.ksh @@ -11,23 +11,20 @@ # you can use either of the following free programs instead: # # Bourne-Again shell (bash) -# -# (or any later version) +# # # Public domain ksh -# +# # # This script also uses several features of modern awk programs. # If your host lacks awk, or has an old awk that does not conform to Posix.2, # you can use either of the following free programs instead: # # GNU awk (gawk) -# -# (or any later version) +# # # mawk -# -# (or any later version) +# # Specify default values for environment variables if they are unset. @@ -57,7 +54,7 @@ newline=' IFS=$newline -# Work around a bash bug, where $PS3 is sent to stdout. +# Work around a bug in bash 1.14.7 and earlier, where $PS3 is sent to stdout. case $(echo 1 | (select x in x; do break; done) 2>/dev/null) in ?*) PS3= esac diff --git a/time/zdump.c b/time/zdump.c index e5ed82f104..01c79ca7fb 100644 --- a/time/zdump.c +++ b/time/zdump.c @@ -1,6 +1,6 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)zdump.c 7.25"; +static char elsieid[] = "@(#)zdump.c 7.26"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -111,19 +111,28 @@ static char elsieid[] = "@(#)zdump.c 7.25"; #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) @@ -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); } @@ -326,8 +334,6 @@ struct tm * oldp; return result; } -extern struct tm * localtime(); - static void show(zone, t, v) char * zone; @@ -336,7 +342,7 @@ 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))); tmp = localtime(&t); diff --git a/time/zic.c b/time/zic.c index c4c9a3ae25..b9518c4649 100644 --- a/time/zic.c +++ b/time/zic.c @@ -1,6 +1,6 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)zic.c 7.82"; +static char elsieid[] = "@(#)zic.c 7.83"; #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, @@ -1289,6 +1283,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: @@ -1397,8 +1393,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 @@ -1723,8 +1721,22 @@ error(_("can't determine time zone abbreviation 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); @@ -2130,7 +2142,7 @@ char * const argname; ** 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); if (errno != EEXIST || !itsdir(name)) { -- cgit v1.2.1