2005-04-04 Ulrich Drepper <drepper@redhat.com>

[BZ #825]
	* timezone/scheck.c: Update from tzcode2005h.
	* timezone/tzfile.h: Likewise.
	* timezone/zdump.c: Likewise.
	* timezone/zic.c: Likewise.
This commit is contained in:
Roland McGrath 2005-04-06 01:20:45 +00:00
parent 57853edb23
commit 75a5dd2f48
4 changed files with 78 additions and 89 deletions

View File

@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
static char elsieid[] = "@(#)scheck.c 8.15";
static char elsieid[] = "@(#)scheck.c 8.16";
#endif /* !defined lint */
#endif /* !defined NOID */

View File

@ -21,7 +21,7 @@
#ifndef lint
#ifndef NOID
static char tzfilehid[] = "@(#)tzfile.h 7.16";
static char tzfilehid[] = "@(#)tzfile.h 7.17";
#endif /* !defined NOID */
#endif /* !defined lint */
@ -48,7 +48,7 @@ static char tzfilehid[] = "@(#)tzfile.h 7.16";
#define TZ_MAGIC "TZif"
struct tzhead {
char tzh_magic[4]; /* TZ_MAGIC */
char tzh_magic[4]; /* TZ_MAGIC */
char tzh_reserved[16]; /* reserved for future use */
char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
@ -172,26 +172,4 @@ struct tzhead {
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
#ifndef USG
/*
** Use of the underscored variants may cause problems if you move your code to
** certain System-V-based systems; for maximum portability, use the
** underscore-free variants. The underscored variants are provided for
** backward compatibility only; they may disappear from future versions of
** this file.
*/
#define SECS_PER_MIN SECSPERMIN
#define MINS_PER_HOUR MINSPERHOUR
#define HOURS_PER_DAY HOURSPERDAY
#define DAYS_PER_WEEK DAYSPERWEEK
#define DAYS_PER_NYEAR DAYSPERNYEAR
#define DAYS_PER_LYEAR DAYSPERLYEAR
#define SECS_PER_HOUR SECSPERHOUR
#define SECS_PER_DAY SECSPERDAY
#define MONS_PER_YEAR MONSPERYEAR
#endif /* !defined USG */
#endif /* !defined TZFILE_H */

View File

@ -1,4 +1,4 @@
static char elsieid[] = "@(#)zdump.c 7.61";
static char elsieid[] = "@(#)zdump.c 7.64";
/*
** This code has been made independent of the rest of the time
@ -175,12 +175,13 @@ time_t * tp;
(void) fprintf(stderr, "\n%s: ", progname);
(void) fprintf(stderr, tformat(), *tp);
(void) fprintf(stderr, " ->");
(void) fprintf(stderr, " sec %d", tmp->tm_sec);
(void) fprintf(stderr, " min %d", tmp->tm_min);
(void) fprintf(stderr, " hour %d", tmp->tm_hour);
(void) fprintf(stderr, " mday %d", tmp->tm_mday);
(void) fprintf(stderr, " mon %d", tmp->tm_mon);
(void) fprintf(stderr, " year %d", tmp->tm_year);
(void) fprintf(stderr, " year=%d", tmp->tm_year);
(void) fprintf(stderr, " mon=%d", tmp->tm_mon);
(void) fprintf(stderr, " mday=%d", tmp->tm_mday);
(void) fprintf(stderr, " hour=%d", tmp->tm_hour);
(void) fprintf(stderr, " min=%d", tmp->tm_min);
(void) fprintf(stderr, " sec=%d", tmp->tm_sec);
(void) fprintf(stderr, " isdst=%d", tmp->tm_isdst);
(void) fprintf(stderr, " -> ");
(void) fprintf(stderr, tformat(), t);
(void) fprintf(stderr, "\n");
@ -318,7 +319,7 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
newtmp = localtime(&newt);
if (newtmp != NULL)
newtm = *newtmp;
if ((tmp == NULL || newtmp == NULL) ? (tmp != newtmp) :
if ((tmp == NULL || newtmp == NULL) ? (tmp != newtmp) :
(delta(&newtm, &tm) != (newt - t) ||
newtm.tm_isdst != tm.tm_isdst ||
strcmp(abbr(&newtm), buf) != 0)) {

View File

@ -1,4 +1,4 @@
static char elsieid[] = "@(#)zic.c 7.118";
static char elsieid[] = "@(#)zic.c 7.122";
/*
** Regardless of the type of time_t, we do our work using this type.
@ -21,7 +21,7 @@ typedef int zic_t;
/*
** On some ancient hosts, predicates like `isspace(C)' are defined
** only if isascii(C) || C == EOF. Modern hosts obey the C Standard,
** only if isascii(C) || C == EOF. Modern hosts obey the C Standard,
** which says they are defined only if C == ((unsigned char) C) || C == EOF.
** Neither the C Standard nor Posix require that `isascii' exist.
** For portability, we check both ancient and modern requirements.
@ -138,9 +138,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 - 0)
#if !HAVE_STRERROR
static char * strerror P((int));
#endif /* !(HAVE_STRERROR - 0) */
#endif /* !HAVE_STRERROR */
static int charcnt;
static int errors;
@ -380,7 +380,7 @@ char * const ptr;
** Error handling.
*/
#if !(HAVE_STRERROR - 0)
#if !HAVE_STRERROR
static char *
strerror(errnum)
int errnum;
@ -391,7 +391,7 @@ int errnum;
return (errnum > 0 && errnum <= sys_nerr) ?
sys_errlist[errnum] : _("Unknown system error");
}
#endif /* !(HAVE_STRERROR - 0) */
#endif /* !HAVE_STRERROR */
static void
eats(name, num, rname, rnum)
@ -448,7 +448,9 @@ const char * const string;
static void
usage P((void))
{
(void) fprintf(stderr, _("%s: usage is %s [ --version ] [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"),
(void) fprintf(stderr, _("%s: usage is %s \
[ --version ] [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"),
progname, progname);
(void) exit(EXIT_FAILURE);
}
@ -472,14 +474,14 @@ char * argv[];
#ifdef unix
(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
#endif /* defined unix */
#if HAVE_GETTEXT - 0
#if HAVE_GETTEXT
(void) setlocale(LC_CTYPE, "");
(void) setlocale(LC_MESSAGES, "");
#ifdef TZ_DOMAINDIR
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
#endif /* defined TEXTDOMAINDIR */
(void) textdomain(TZ_DOMAIN);
#endif /* HAVE_GETTEXT - 0 */
#endif /* HAVE_GETTEXT */
progname = argv[0];
for (i = 1; i < argc; ++i)
if (strcmp(argv[i], "--version") == 0) {
@ -580,6 +582,11 @@ _("%s: More than one -L option specified\n"),
for (i = 0; i < nlinks; ++i) {
eat(links[i].l_filename, links[i].l_linenum);
dolink(links[i].l_from, links[i].l_to);
if (noise)
for (j = 0; j < nlinks; ++j)
if (strcmp(links[i].l_to,
links[j].l_from) == 0)
warning(_("link to link"));
}
if (lcltime != NULL) {
eat("command line", 1);
@ -627,32 +634,27 @@ const char * const tofile;
(void) exit(EXIT_FAILURE);
result = link(fromname, toname);
#if (HAVE_SYMLINK - 0)
#if HAVE_SYMLINK
if (result != 0 &&
access(fromname, F_OK) == 0 &&
!itsdir(fromname)) {
const char *s = tofile;
register char * symlinkcontents = NULL;
while ((s = strchr(s+1, '/')) != NULL)
symlinkcontents = ecatalloc(symlinkcontents, "../");
symlinkcontents = ecatalloc(symlinkcontents, fromfile);
access(fromname, F_OK) == 0 &&
!itsdir(fromname)) {
const char *s = tofile;
register char * symlinkcontents = NULL;
result = unlink(toname);
if (result != 0 && errno != ENOENT) {
const char *e = strerror(errno);
(void) fprintf(stderr,
_("%s: Can't unlink %s: %s\n"),
progname, toname, e);
(void) exit(EXIT_FAILURE);
}
result = symlink(symlinkcontents, toname);
if (result == 0)
while ((s = strchr(s+1, '/')) != NULL)
symlinkcontents =
ecatalloc(symlinkcontents,
"../");
symlinkcontents =
ecatalloc(symlinkcontents,
fromfile);
result = symlink(symlinkcontents,
toname);
if (result == 0)
warning(_("hard link failed, symbolic link used"));
ifree(symlinkcontents);
ifree(symlinkcontents);
}
#endif
#endif /* HAVE_SYMLINK */
if (result != 0) {
const char *e = strerror(errno);
@ -810,7 +812,7 @@ associate P((void))
*/
eat(zp->z_filename, zp->z_linenum);
zp->z_stdoff = gethms(zp->z_rule, _("unruly zone"),
TRUE);
TRUE);
/*
** Note, though, that if there's no rule,
** a '%s' in the format is a bad thing.
@ -1113,7 +1115,9 @@ 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;
}
}
@ -1146,11 +1150,11 @@ const int nfields;
dayoff = 0;
cp = fields[LP_YEAR];
if (sscanf(cp, scheck(cp, "%d"), &year) != 1) {
/*
* Leapin' Lizards!
*/
error(_("invalid leaping year"));
return;
/*
** Leapin' Lizards!
*/
error(_("invalid leaping year"));
return;
}
j = EPOCH_YEAR;
while (j != year) {
@ -1217,7 +1221,9 @@ const int nfields;
return;
}
if ((lp = byword(fields[LP_ROLL], leap_types)) == NULL) {
error(_("illegal Rolling/Stationary field on Leap line"));
error(_(
"illegal Rolling/Stationary field on Leap line"
));
return;
}
leapadd(tadd(t, tod), positive, lp->l_value, count);
@ -1479,14 +1485,13 @@ const char * const name;
while (fromi < timecnt && attypes[fromi].type == 0)
++fromi; /* handled by default rule */
for ( ; fromi < timecnt; ++fromi) {
if (toi != 0
&& ((attypes[fromi].at
+ gmtoffs[attypes[toi - 1].type])
<= (attypes[toi - 1].at
+ gmtoffs[toi == 1 ? 0
: attypes[toi - 2].type]))) {
attypes[toi - 1].type = attypes[fromi].type;
continue;
if (toi != 0 && ((attypes[fromi].at +
gmtoffs[attypes[toi - 1].type]) <=
(attypes[toi - 1].at + gmtoffs[toi == 1 ? 0
: attypes[toi - 2].type]))) {
attypes[toi - 1].type =
attypes[fromi].type;
continue;
}
if (toi == 0 ||
attypes[toi - 1].type != attypes[fromi].type)
@ -1532,7 +1537,8 @@ const char * const name;
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)
#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);
@ -1751,12 +1757,13 @@ const int zonecount;
continue;
}
if (*startbuf == '\0' &&
startoff == oadd(zp->z_gmtoff,
stdoff)) {
doabbr(startbuf, zp->z_format,
rp->r_abbrvar,
rp->r_stdoff != 0);
}
startoff == oadd(zp->z_gmtoff,
stdoff))
doabbr(startbuf,
zp->z_format,
rp->r_abbrvar,
rp->r_stdoff !=
0);
}
eats(zp->z_filename, zp->z_linenum,
rp->r_filename, rp->r_linenum);
@ -2047,7 +2054,9 @@ register char * cp;
else while ((*dp = *cp++) != '"')
if (*dp != '\0')
++dp;
else error(_("Odd number of quotation marks"));
else error(_(
"Odd number of quotation marks"
));
} while (*cp != '\0' && *cp != '#' &&
(!isascii(*cp) || !isspace((unsigned char) *cp)));
if (isascii(*cp) && isspace((unsigned char) *cp))
@ -2168,7 +2177,8 @@ register const int wantedy;
}
if (i < 0 || i >= len_months[isleap(y)][m]) {
if (noise)
warning(_("rule goes past start/end of month--will not work with pre-2004 versions of zic"));
warning(_("rule goes past start/end of month--\
will not work with pre-2004 versions of zic"));
}
}
if (dayoff < 0 && !TYPE_SIGNED(zic_t))