mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-06 14:10:30 +08:00
Update from tzcode1997c.
This commit is contained in:
parent
1893ec6a38
commit
71c5289b0f
@ -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;
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -11,23 +11,20 @@
|
||||
# you can use either of the following free programs instead:
|
||||
#
|
||||
# Bourne-Again shell (bash)
|
||||
# <URL:ftp://prep.ai.mit.edu:/pub/gnu/bash-2.0.tar.gz>
|
||||
# (or any later version)
|
||||
# <URL:ftp://ftp.gnu.ai.mit.edu/pub/gnu/>
|
||||
#
|
||||
# Public domain ksh
|
||||
# <URL:ftp://ftp.cs.mun.ca:/pub/pdksh/pdksh.tar.gz>
|
||||
# <URL:ftp://ftp.cs.mun.ca/pub/pdksh/pdksh.tar.gz>
|
||||
#
|
||||
# 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)
|
||||
# <URL:ftp://prep.ai.mit.edu:/pub/gnu/gawk-3.0.2.tar.gz>
|
||||
# (or any later version)
|
||||
# <URL:ftp://ftp.gnu.ai.mit.edu/pub/gnu/>
|
||||
#
|
||||
# mawk
|
||||
# <URL:ftp://oxy.edu/public/mawk1.2.2.tar.gz>
|
||||
# (or any later version)
|
||||
# <URL:ftp://ftp.whidbey.net/pub/brennan/>
|
||||
|
||||
|
||||
# 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
|
||||
|
32
time/zdump.c
32
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);
|
||||
|
32
time/zic.c
32
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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user