Updated to tzcode2005j.tar.gz
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13561 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -25,6 +25,8 @@ static char privatehid[] = "@(#)private.h 7.55";
|
|||||||
#endif /* !defined NOID */
|
#endif /* !defined NOID */
|
||||||
#endif /* !defined lint */
|
#endif /* !defined lint */
|
||||||
|
|
||||||
|
#define GRANDPARENTED "Local time zone must be set--see zic manual page"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Defaults for preprocessor symbols.
|
** Defaults for preprocessor symbols.
|
||||||
** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
|
** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
|
||||||
@@ -91,13 +93,13 @@ static char privatehid[] = "@(#)private.h 7.55";
|
|||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
|
|
||||||
#if HAVE_GETTEXT - 0
|
#if HAVE_GETTEXT
|
||||||
#include "libintl.h"
|
#include "libintl.h"
|
||||||
#endif /* HAVE_GETTEXT - 0 */
|
#endif /* HAVE_GETTEXT */
|
||||||
|
|
||||||
#if HAVE_SYS_WAIT_H - 0
|
#if HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
|
#include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
|
||||||
#endif /* HAVE_SYS_WAIT_H - 0 */
|
#endif /* HAVE_SYS_WAIT_H */
|
||||||
|
|
||||||
#ifndef WIFEXITED
|
#ifndef WIFEXITED
|
||||||
#define WIFEXITED(status) (((status) & 0xff) == 0)
|
#define WIFEXITED(status) (((status) & 0xff) == 0)
|
||||||
@@ -106,18 +108,18 @@ static char privatehid[] = "@(#)private.h 7.55";
|
|||||||
#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
|
#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
|
||||||
#endif /* !defined WEXITSTATUS */
|
#endif /* !defined WEXITSTATUS */
|
||||||
|
|
||||||
#if HAVE_UNISTD_H - 0
|
#if HAVE_UNISTD_H
|
||||||
#include "unistd.h" /* for F_OK and R_OK */
|
#include "unistd.h" /* for F_OK and R_OK */
|
||||||
#endif /* HAVE_UNISTD_H - 0 */
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
|
||||||
#if !(HAVE_UNISTD_H - 0)
|
#if !HAVE_UNISTD_H
|
||||||
#ifndef F_OK
|
#ifndef F_OK
|
||||||
#define F_OK 0
|
#define F_OK 0
|
||||||
#endif /* !defined F_OK */
|
#endif /* !defined F_OK */
|
||||||
#ifndef R_OK
|
#ifndef R_OK
|
||||||
#define R_OK 4
|
#define R_OK 4
|
||||||
#endif /* !defined R_OK */
|
#endif /* !defined R_OK */
|
||||||
#endif /* !(HAVE_UNISTD_H - 0) */
|
#endif /* !HAVE_UNISTD_H */
|
||||||
|
|
||||||
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
|
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
|
||||||
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
|
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
|
||||||
@@ -216,7 +218,7 @@ char * imalloc P((int n));
|
|||||||
void * irealloc P((void * pointer, int size));
|
void * irealloc P((void * pointer, int size));
|
||||||
void icfree P((char * pointer));
|
void icfree P((char * pointer));
|
||||||
void ifree P((char * pointer));
|
void ifree P((char * pointer));
|
||||||
char * scheck P((const char *string, const char *format));
|
char * scheck P((const char *string, char *format));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Finally, some convenience items.
|
** Finally, some convenience items.
|
||||||
@@ -255,7 +257,8 @@ char * scheck P((const char *string, const char *format));
|
|||||||
** add one more for a minus sign if the type is signed.
|
** add one more for a minus sign if the type is signed.
|
||||||
*/
|
*/
|
||||||
#define INT_STRLEN_MAXIMUM(type) \
|
#define INT_STRLEN_MAXIMUM(type) \
|
||||||
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
|
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
|
||||||
|
1 + TYPE_SIGNED(type))
|
||||||
#endif /* !defined INT_STRLEN_MAXIMUM */
|
#endif /* !defined INT_STRLEN_MAXIMUM */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -289,11 +292,11 @@ char * scheck P((const char *string, const char *format));
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _
|
#ifndef _
|
||||||
#if HAVE_GETTEXT - 0
|
#if HAVE_GETTEXT
|
||||||
#define _(msgid) gettext(msgid)
|
#define _(msgid) gettext(msgid)
|
||||||
#else /* !(HAVE_GETTEXT - 0) */
|
#else /* !HAVE_GETTEXT */
|
||||||
#define _(msgid) msgid
|
#define _(msgid) msgid
|
||||||
#endif /* !(HAVE_GETTEXT - 0) */
|
#endif /* !HAVE_GETTEXT */
|
||||||
#endif /* !defined _ */
|
#endif /* !defined _ */
|
||||||
|
|
||||||
#ifndef TZ_DOMAIN
|
#ifndef TZ_DOMAIN
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#ifndef NOID
|
#ifndef NOID
|
||||||
static char tzfilehid[] = "@(#)tzfile.h 7.16";
|
static char tzfilehid[] = "@(#)tzfile.h 7.17";
|
||||||
#endif /* !defined NOID */
|
#endif /* !defined NOID */
|
||||||
#endif /* !defined lint */
|
#endif /* !defined lint */
|
||||||
|
|
||||||
@@ -172,26 +172,4 @@ struct tzhead {
|
|||||||
|
|
||||||
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
|
#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 */
|
#endif /* !defined TZFILE_H */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
#ifndef NOID
|
#ifndef NOID
|
||||||
static char elsieid[] = "@(#)scheck.c 8.15";
|
static char elsieid[] = "@(#)scheck.c 8.16";
|
||||||
#endif /* !defined lint */
|
#endif /* !defined lint */
|
||||||
#endif /* !defined NOID */
|
#endif /* !defined NOID */
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ static char elsieid[] = "@(#)scheck.c 8.15";
|
|||||||
char *
|
char *
|
||||||
scheck(string, format)
|
scheck(string, format)
|
||||||
const char * const string;
|
const char * const string;
|
||||||
const char * const format;
|
char * const format;
|
||||||
{
|
{
|
||||||
register char * fbuf;
|
register char * fbuf;
|
||||||
register const char * fp;
|
register const char * fp;
|
||||||
|
|||||||
+52
-8
@@ -1,4 +1,4 @@
|
|||||||
static char elsieid[] = "@(#)zdump.c 7.61";
|
static char elsieid[] = "@(#)zdump.c 7.65";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** This code has been made independent of the rest of the time
|
** This code has been made independent of the rest of the time
|
||||||
@@ -144,8 +144,10 @@ static time_t absolute_min_time;
|
|||||||
static time_t absolute_max_time;
|
static time_t absolute_max_time;
|
||||||
static size_t longest;
|
static size_t longest;
|
||||||
static char * progname;
|
static char * progname;
|
||||||
|
static int warned;
|
||||||
|
|
||||||
static char * abbr P((struct tm * tmp));
|
static char * abbr P((struct tm * tmp));
|
||||||
|
static void abbrok P((const char * abbr, const char * zone));
|
||||||
static long delta P((struct tm * newp, struct tm * oldp));
|
static long delta P((struct tm * newp, struct tm * oldp));
|
||||||
static void dumptime P((const struct tm * tmp));
|
static void dumptime P((const struct tm * tmp));
|
||||||
static time_t hunt P((char * name, time_t lot, time_t hit));
|
static time_t hunt P((char * name, time_t lot, time_t hit));
|
||||||
@@ -175,12 +177,13 @@ time_t * tp;
|
|||||||
(void) fprintf(stderr, "\n%s: ", progname);
|
(void) fprintf(stderr, "\n%s: ", progname);
|
||||||
(void) fprintf(stderr, tformat(), *tp);
|
(void) fprintf(stderr, tformat(), *tp);
|
||||||
(void) fprintf(stderr, " ->");
|
(void) fprintf(stderr, " ->");
|
||||||
(void) fprintf(stderr, " sec %d", tmp->tm_sec);
|
(void) fprintf(stderr, " year=%d", tmp->tm_year);
|
||||||
(void) fprintf(stderr, " min %d", tmp->tm_min);
|
(void) fprintf(stderr, " mon=%d", tmp->tm_mon);
|
||||||
(void) fprintf(stderr, " hour %d", tmp->tm_hour);
|
(void) fprintf(stderr, " mday=%d", tmp->tm_mday);
|
||||||
(void) fprintf(stderr, " mday %d", tmp->tm_mday);
|
(void) fprintf(stderr, " hour=%d", tmp->tm_hour);
|
||||||
(void) fprintf(stderr, " mon %d", tmp->tm_mon);
|
(void) fprintf(stderr, " min=%d", tmp->tm_min);
|
||||||
(void) fprintf(stderr, " year %d", tmp->tm_year);
|
(void) fprintf(stderr, " sec=%d", tmp->tm_sec);
|
||||||
|
(void) fprintf(stderr, " isdst=%d", tmp->tm_isdst);
|
||||||
(void) fprintf(stderr, " -> ");
|
(void) fprintf(stderr, " -> ");
|
||||||
(void) fprintf(stderr, tformat(), t);
|
(void) fprintf(stderr, tformat(), t);
|
||||||
(void) fprintf(stderr, "\n");
|
(void) fprintf(stderr, "\n");
|
||||||
@@ -190,6 +193,44 @@ time_t * tp;
|
|||||||
}
|
}
|
||||||
#endif /* !defined TYPECHECK */
|
#endif /* !defined TYPECHECK */
|
||||||
|
|
||||||
|
static void
|
||||||
|
abbrok(abbr, zone)
|
||||||
|
const char * const abbr;
|
||||||
|
const char * const zone;
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register const char * cp;
|
||||||
|
register char * wp;
|
||||||
|
|
||||||
|
if (warned)
|
||||||
|
return;
|
||||||
|
cp = abbr;
|
||||||
|
wp = NULL;
|
||||||
|
while (isascii(*cp) && isalpha(*cp))
|
||||||
|
++cp;
|
||||||
|
if (cp - abbr == 0)
|
||||||
|
wp = _("lacks alphabetic at start");
|
||||||
|
if (cp - abbr < 3)
|
||||||
|
wp = _("has fewer than 3 alphabetics");
|
||||||
|
if (cp - abbr > 6)
|
||||||
|
wp = _("has more than 6 alphabetics");
|
||||||
|
if (wp == NULL && (*cp == '+' || *cp == '-')) {
|
||||||
|
++cp;
|
||||||
|
if (isascii(*cp) && isdigit(*cp))
|
||||||
|
if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
|
||||||
|
++cp;
|
||||||
|
}
|
||||||
|
if (*cp != '\0')
|
||||||
|
wp = _("differs from POSIX standard");
|
||||||
|
if (wp == NULL)
|
||||||
|
return;
|
||||||
|
(void) fflush(stdout);
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"%s: warning: zone \"%s\" abbreviation \"%s\" %s\n",
|
||||||
|
progname, zone, abbr, wp);
|
||||||
|
warned = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
@@ -215,7 +256,7 @@ char * argv[];
|
|||||||
INITIALIZE(cutlotime);
|
INITIALIZE(cutlotime);
|
||||||
INITIALIZE(cuthitime);
|
INITIALIZE(cuthitime);
|
||||||
#if HAVE_GETTEXT
|
#if HAVE_GETTEXT
|
||||||
(void) setlocale(LC_MESSAGES, "");
|
(void) setlocale(LC_ALL, "");
|
||||||
#ifdef TZ_DOMAINDIR
|
#ifdef TZ_DOMAINDIR
|
||||||
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
|
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
|
||||||
#endif /* defined TEXTDOMAINDIR */
|
#endif /* defined TEXTDOMAINDIR */
|
||||||
@@ -296,6 +337,7 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
|
|||||||
show(argv[i], now, FALSE);
|
show(argv[i], now, FALSE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
warned = FALSE;
|
||||||
t = absolute_min_time;
|
t = absolute_min_time;
|
||||||
show(argv[i], t, TRUE);
|
show(argv[i], t, TRUE);
|
||||||
t += SECSPERHOUR * HOURSPERDAY;
|
t += SECSPERHOUR * HOURSPERDAY;
|
||||||
@@ -526,6 +568,8 @@ int v;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) printf("\n");
|
(void) printf("\n");
|
||||||
|
if (tmp != NULL && *abbr(tmp) != '\0')
|
||||||
|
abbrok(abbr(tmp), zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
|||||||
+91
-32
@@ -1,4 +1,4 @@
|
|||||||
static char elsieid[] = "@(#)zic.c 7.118";
|
static char elsieid[] = "@(#)zic.c 7.124";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Regardless of the type of time_t, we do our work using this type.
|
** Regardless of the type of time_t, we do our work using this type.
|
||||||
@@ -10,6 +10,10 @@ typedef int zic_t;
|
|||||||
#include "locale.h"
|
#include "locale.h"
|
||||||
#include "tzfile.h"
|
#include "tzfile.h"
|
||||||
|
|
||||||
|
#ifndef ZIC_MAX_ABBR_LEN_WO_WARN
|
||||||
|
#define ZIC_MAX_ABBR_LEN_WO_WARN 6
|
||||||
|
#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */
|
||||||
|
|
||||||
#if HAVE_SYS_STAT_H
|
#if HAVE_SYS_STAT_H
|
||||||
#include "sys/stat.h"
|
#include "sys/stat.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -138,9 +142,9 @@ static void usage P((void));
|
|||||||
static void writezone P((const char * name));
|
static void writezone P((const char * name));
|
||||||
static int yearistype P((int year, const char * type));
|
static int yearistype P((int year, const char * type));
|
||||||
|
|
||||||
#if !(HAVE_STRERROR - 0)
|
#if !HAVE_STRERROR
|
||||||
static char * strerror P((int));
|
static char * strerror P((int));
|
||||||
#endif /* !(HAVE_STRERROR - 0) */
|
#endif /* !HAVE_STRERROR */
|
||||||
|
|
||||||
static int charcnt;
|
static int charcnt;
|
||||||
static int errors;
|
static int errors;
|
||||||
@@ -380,7 +384,7 @@ char * const ptr;
|
|||||||
** Error handling.
|
** Error handling.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !(HAVE_STRERROR - 0)
|
#if !HAVE_STRERROR
|
||||||
static char *
|
static char *
|
||||||
strerror(errnum)
|
strerror(errnum)
|
||||||
int errnum;
|
int errnum;
|
||||||
@@ -391,7 +395,7 @@ int errnum;
|
|||||||
return (errnum > 0 && errnum <= sys_nerr) ?
|
return (errnum > 0 && errnum <= sys_nerr) ?
|
||||||
sys_errlist[errnum] : _("Unknown system error");
|
sys_errlist[errnum] : _("Unknown system error");
|
||||||
}
|
}
|
||||||
#endif /* !(HAVE_STRERROR - 0) */
|
#endif /* !HAVE_STRERROR */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eats(name, num, rname, rnum)
|
eats(name, num, rname, rnum)
|
||||||
@@ -448,7 +452,9 @@ const char * const string;
|
|||||||
static void
|
static void
|
||||||
usage P((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);
|
progname, progname);
|
||||||
(void) exit(EXIT_FAILURE);
|
(void) exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -472,13 +478,13 @@ char * argv[];
|
|||||||
#ifdef unix
|
#ifdef unix
|
||||||
(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
|
(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
|
||||||
#endif /* defined unix */
|
#endif /* defined unix */
|
||||||
#if HAVE_GETTEXT - 0
|
#if HAVE_GETTEXT
|
||||||
(void) setlocale(LC_MESSAGES, "");
|
(void) setlocale(LC_ALL, "");
|
||||||
#ifdef TZ_DOMAINDIR
|
#ifdef TZ_DOMAINDIR
|
||||||
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
|
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
|
||||||
#endif /* defined TEXTDOMAINDIR */
|
#endif /* defined TEXTDOMAINDIR */
|
||||||
(void) textdomain(TZ_DOMAIN);
|
(void) textdomain(TZ_DOMAIN);
|
||||||
#endif /* HAVE_GETTEXT - 0 */
|
#endif /* HAVE_GETTEXT */
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
for (i = 1; i < argc; ++i)
|
for (i = 1; i < argc; ++i)
|
||||||
if (strcmp(argv[i], "--version") == 0) {
|
if (strcmp(argv[i], "--version") == 0) {
|
||||||
@@ -579,6 +585,11 @@ _("%s: More than one -L option specified\n"),
|
|||||||
for (i = 0; i < nlinks; ++i) {
|
for (i = 0; i < nlinks; ++i) {
|
||||||
eat(links[i].l_filename, links[i].l_linenum);
|
eat(links[i].l_filename, links[i].l_linenum);
|
||||||
dolink(links[i].l_from, links[i].l_to);
|
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) {
|
if (lcltime != NULL) {
|
||||||
eat("command line", 1);
|
eat("command line", 1);
|
||||||
@@ -626,22 +637,27 @@ const char * const tofile;
|
|||||||
(void) exit(EXIT_FAILURE);
|
(void) exit(EXIT_FAILURE);
|
||||||
|
|
||||||
result = link(fromname, toname);
|
result = link(fromname, toname);
|
||||||
#if (HAVE_SYMLINK - 0)
|
#if HAVE_SYMLINK
|
||||||
if (result != 0 &&
|
if (result != 0 &&
|
||||||
access(fromname, F_OK) == 0 &&
|
access(fromname, F_OK) == 0 &&
|
||||||
!itsdir(fromname)) {
|
!itsdir(fromname)) {
|
||||||
const char *s = tofile;
|
const char *s = tofile;
|
||||||
register char * symlinkcontents = NULL;
|
register char * symlinkcontents = NULL;
|
||||||
while ((s = strchr(s+1, '/')) != NULL)
|
|
||||||
symlinkcontents = ecatalloc(symlinkcontents, "../");
|
|
||||||
symlinkcontents = ecatalloc(symlinkcontents, fromfile);
|
|
||||||
|
|
||||||
result = symlink(symlinkcontents, toname);
|
while ((s = strchr(s+1, '/')) != NULL)
|
||||||
|
symlinkcontents =
|
||||||
|
ecatalloc(symlinkcontents,
|
||||||
|
"../");
|
||||||
|
symlinkcontents =
|
||||||
|
ecatalloc(symlinkcontents,
|
||||||
|
fromfile);
|
||||||
|
result = symlink(symlinkcontents,
|
||||||
|
toname);
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
//warning(_("hard link failed, symbolic link used"));
|
warning(_("hard link failed, symbolic link used"));
|
||||||
ifree(symlinkcontents);
|
ifree(symlinkcontents);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* HAVE_SYMLINK */
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
const char *e = strerror(errno);
|
const char *e = strerror(errno);
|
||||||
|
|
||||||
@@ -1102,7 +1118,9 @@ const int iscont;
|
|||||||
zones[nzones - 1].z_untiltime > min_time &&
|
zones[nzones - 1].z_untiltime > min_time &&
|
||||||
zones[nzones - 1].z_untiltime < max_time &&
|
zones[nzones - 1].z_untiltime < max_time &&
|
||||||
zones[nzones - 1].z_untiltime >= z.z_untiltime) {
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1136,7 +1154,7 @@ const int nfields;
|
|||||||
cp = fields[LP_YEAR];
|
cp = fields[LP_YEAR];
|
||||||
if (sscanf(cp, scheck(cp, "%d"), &year) != 1) {
|
if (sscanf(cp, scheck(cp, "%d"), &year) != 1) {
|
||||||
/*
|
/*
|
||||||
* Leapin' Lizards!
|
** Leapin' Lizards!
|
||||||
*/
|
*/
|
||||||
error(_("invalid leaping year"));
|
error(_("invalid leaping year"));
|
||||||
return;
|
return;
|
||||||
@@ -1206,7 +1224,9 @@ const int nfields;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((lp = byword(fields[LP_ROLL], leap_types)) == NULL) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
leapadd(tadd(t, tod), positive, lp->l_value, count);
|
leapadd(tadd(t, tod), positive, lp->l_value, count);
|
||||||
@@ -1468,13 +1488,12 @@ const char * const name;
|
|||||||
while (fromi < timecnt && attypes[fromi].type == 0)
|
while (fromi < timecnt && attypes[fromi].type == 0)
|
||||||
++fromi; /* handled by default rule */
|
++fromi; /* handled by default rule */
|
||||||
for ( ; fromi < timecnt; ++fromi) {
|
for ( ; fromi < timecnt; ++fromi) {
|
||||||
if (toi != 0
|
if (toi != 0 && ((attypes[fromi].at +
|
||||||
&& ((attypes[fromi].at
|
gmtoffs[attypes[toi - 1].type]) <=
|
||||||
+ gmtoffs[attypes[toi - 1].type])
|
(attypes[toi - 1].at + gmtoffs[toi == 1 ? 0
|
||||||
<= (attypes[toi - 1].at
|
|
||||||
+ gmtoffs[toi == 1 ? 0
|
|
||||||
: attypes[toi - 2].type]))) {
|
: attypes[toi - 2].type]))) {
|
||||||
attypes[toi - 1].type = attypes[fromi].type;
|
attypes[toi - 1].type =
|
||||||
|
attypes[fromi].type;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (toi == 0 ||
|
if (toi == 0 ||
|
||||||
@@ -1521,7 +1540,8 @@ const char * const name;
|
|||||||
convert(eitol(typecnt), tzh.tzh_typecnt);
|
convert(eitol(typecnt), tzh.tzh_typecnt);
|
||||||
convert(eitol(charcnt), tzh.tzh_charcnt);
|
convert(eitol(charcnt), tzh.tzh_charcnt);
|
||||||
(void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
|
(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_magic);
|
||||||
DO(tzh_reserved);
|
DO(tzh_reserved);
|
||||||
DO(tzh_ttisgmtcnt);
|
DO(tzh_ttisgmtcnt);
|
||||||
@@ -1741,11 +1761,12 @@ const int zonecount;
|
|||||||
}
|
}
|
||||||
if (*startbuf == '\0' &&
|
if (*startbuf == '\0' &&
|
||||||
startoff == oadd(zp->z_gmtoff,
|
startoff == oadd(zp->z_gmtoff,
|
||||||
stdoff)) {
|
stdoff))
|
||||||
doabbr(startbuf, zp->z_format,
|
doabbr(startbuf,
|
||||||
|
zp->z_format,
|
||||||
rp->r_abbrvar,
|
rp->r_abbrvar,
|
||||||
rp->r_stdoff != 0);
|
rp->r_stdoff !=
|
||||||
}
|
0);
|
||||||
}
|
}
|
||||||
eats(zp->z_filename, zp->z_linenum,
|
eats(zp->z_filename, zp->z_linenum,
|
||||||
rp->r_filename, rp->r_linenum);
|
rp->r_filename, rp->r_linenum);
|
||||||
@@ -2036,7 +2057,9 @@ register char * cp;
|
|||||||
else while ((*dp = *cp++) != '"')
|
else while ((*dp = *cp++) != '"')
|
||||||
if (*dp != '\0')
|
if (*dp != '\0')
|
||||||
++dp;
|
++dp;
|
||||||
else error(_("Odd number of quotation marks"));
|
else error(_(
|
||||||
|
"Odd number of quotation marks"
|
||||||
|
));
|
||||||
} while (*cp != '\0' && *cp != '#' &&
|
} while (*cp != '\0' && *cp != '#' &&
|
||||||
(!isascii(*cp) || !isspace((unsigned char) *cp)));
|
(!isascii(*cp) || !isspace((unsigned char) *cp)));
|
||||||
if (isascii(*cp) && isspace((unsigned char) *cp))
|
if (isascii(*cp) && isspace((unsigned char) *cp))
|
||||||
@@ -2157,7 +2180,8 @@ register const int wantedy;
|
|||||||
}
|
}
|
||||||
if (i < 0 || i >= len_months[isleap(y)][m]) {
|
if (i < 0 || i >= len_months[isleap(y)][m]) {
|
||||||
if (noise)
|
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))
|
if (dayoff < 0 && !TYPE_SIGNED(zic_t))
|
||||||
@@ -2176,6 +2200,41 @@ const char * const string;
|
|||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
|
if (strcmp(string, GRANDPARENTED) != 0) {
|
||||||
|
register const char * cp;
|
||||||
|
register char * wp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics
|
||||||
|
** optionally followed by a + or - and a number from 1 to 14.
|
||||||
|
*/
|
||||||
|
cp = string;
|
||||||
|
wp = NULL;
|
||||||
|
while (isascii(*cp) && isalpha(*cp))
|
||||||
|
++cp;
|
||||||
|
if (cp - string == 0)
|
||||||
|
wp = _("time zone abbreviation lacks alphabetic at start");
|
||||||
|
if (noise && cp - string > 3)
|
||||||
|
wp = _("time zone abbreviation has more than 3 alphabetics");
|
||||||
|
if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN)
|
||||||
|
wp = _("time zone abbreviation has too many alphabetics");
|
||||||
|
if (wp == NULL && (*cp == '+' || *cp == '-')) {
|
||||||
|
++cp;
|
||||||
|
if (isascii(*cp) && isdigit(*cp))
|
||||||
|
if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
|
||||||
|
++cp;
|
||||||
|
}
|
||||||
|
if (*cp != '\0')
|
||||||
|
wp = _("time zone abbreviation differs from POSIX standard");
|
||||||
|
if (wp != NULL) {
|
||||||
|
wp = ecpyalloc(wp);
|
||||||
|
wp = ecatalloc(wp, " (");
|
||||||
|
wp = ecatalloc(wp, string);
|
||||||
|
wp = ecatalloc(wp, ")");
|
||||||
|
warning(wp);
|
||||||
|
ifree(wp);
|
||||||
|
}
|
||||||
|
}
|
||||||
i = strlen(string) + 1;
|
i = strlen(string) + 1;
|
||||||
if (charcnt + i > TZ_MAX_CHARS) {
|
if (charcnt + i > TZ_MAX_CHARS) {
|
||||||
error(_("too many, or too long, time zone abbreviations"));
|
error(_("too many, or too long, time zone abbreviations"));
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#ifndef NOID
|
#ifndef NOID
|
||||||
static char elsieid[] = "@(#)localtime.c 7.89";
|
static char elsieid[] = "@(#)localtime.c 7.95";
|
||||||
#endif /* !defined NOID */
|
#endif /* !defined NOID */
|
||||||
#endif /* !defined lint */
|
#endif /* !defined lint */
|
||||||
|
|
||||||
@@ -20,6 +20,20 @@ static char elsieid[] = "@(#)localtime.c 7.89";
|
|||||||
#include "private.h"
|
#include "private.h"
|
||||||
#include "tzfile.h"
|
#include "tzfile.h"
|
||||||
#include "fcntl.h"
|
#include "fcntl.h"
|
||||||
|
#include "float.h" /* for FLT_MAX and DBL_MAX */
|
||||||
|
|
||||||
|
#ifndef TZ_ABBR_MAX_LEN
|
||||||
|
#define TZ_ABBR_MAX_LEN 16
|
||||||
|
#endif /* !defined TZ_ABBR_MAX_LEN */
|
||||||
|
|
||||||
|
#ifndef TZ_ABBR_CHAR_SET
|
||||||
|
#define TZ_ABBR_CHAR_SET \
|
||||||
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._"
|
||||||
|
#endif /* !defined TZ_ABBR_CHAR_SET */
|
||||||
|
|
||||||
|
#ifndef TZ_ABBR_ERR_CHAR
|
||||||
|
#define TZ_ABBR_ERR_CHAR '_'
|
||||||
|
#endif /* !defined TZ_ABBR_ERR_CHAR */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** SunOS 4.1.1 headers lack O_BINARY.
|
** SunOS 4.1.1 headers lack O_BINARY.
|
||||||
@@ -123,6 +137,7 @@ struct rule {
|
|||||||
|
|
||||||
static long detzcode P((const char * codep));
|
static long detzcode P((const char * codep));
|
||||||
static const char * getzname P((const char * strp));
|
static const char * getzname P((const char * strp));
|
||||||
|
static const char * getqzname P((const char * strp, const char delim));
|
||||||
static const char * getnum P((const char * strp, int * nump, int min,
|
static const char * getnum P((const char * strp, int * nump, int min,
|
||||||
int max));
|
int max));
|
||||||
static const char * getsecs P((const char * strp, long * secsp));
|
static const char * getsecs P((const char * strp, long * secsp));
|
||||||
@@ -268,6 +283,24 @@ settzname P((void))
|
|||||||
tzname[ttisp->tt_isdst] =
|
tzname[ttisp->tt_isdst] =
|
||||||
&sp->chars[ttisp->tt_abbrind];
|
&sp->chars[ttisp->tt_abbrind];
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
** Finally, scrub the abbreviations.
|
||||||
|
** First, replace bogus characters.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < sp->charcnt; ++i)
|
||||||
|
if (strchr(TZ_ABBR_CHAR_SET, sp->chars[i]) == NULL)
|
||||||
|
sp->chars[i] = TZ_ABBR_ERR_CHAR;
|
||||||
|
/*
|
||||||
|
** Second, truncate long abbreviations.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < sp->typecnt; ++i) {
|
||||||
|
register const struct ttinfo * const ttisp = &sp->ttis[i];
|
||||||
|
register char * cp = &sp->chars[ttisp->tt_abbrind];
|
||||||
|
|
||||||
|
if (strlen(cp) > TZ_ABBR_MAX_LEN &&
|
||||||
|
strcmp(cp, GRANDPARENTED) != 0)
|
||||||
|
*(cp + TZ_ABBR_MAX_LEN) = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -468,6 +501,27 @@ register const char * strp;
|
|||||||
return strp;
|
return strp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Given a pointer into an extended time zone string, scan until the ending
|
||||||
|
** delimiter of the zone name is located. Return a pointer to the delimiter.
|
||||||
|
**
|
||||||
|
** As with getzname above, the legal character set is actually quite
|
||||||
|
** restricted, with other characters producing undefined results.
|
||||||
|
** We choose not to care - allowing almost anything to be in the zone abbrev.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
getqzname(strp, delim)
|
||||||
|
register const char * strp;
|
||||||
|
const char delim;
|
||||||
|
{
|
||||||
|
register char c;
|
||||||
|
|
||||||
|
while ((c = *strp) != '\0' && c != delim)
|
||||||
|
++strp;
|
||||||
|
return strp;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Given a pointer into a time zone string, extract a number from that string.
|
** Given a pointer into a time zone string, extract a number from that string.
|
||||||
** Check that the number is within a specified range; if it is not, return
|
** Check that the number is within a specified range; if it is not, return
|
||||||
@@ -751,11 +805,19 @@ const int lastditch;
|
|||||||
if (stdlen >= sizeof sp->chars)
|
if (stdlen >= sizeof sp->chars)
|
||||||
stdlen = (sizeof sp->chars) - 1;
|
stdlen = (sizeof sp->chars) - 1;
|
||||||
stdoffset = 0;
|
stdoffset = 0;
|
||||||
|
} else {
|
||||||
|
if (*name == '<') {
|
||||||
|
name++;
|
||||||
|
stdname = name;
|
||||||
|
name = getqzname(name, '>');
|
||||||
|
if (*name != '>')
|
||||||
|
return (-1);
|
||||||
|
stdlen = name - stdname;
|
||||||
|
name++;
|
||||||
} else {
|
} else {
|
||||||
name = getzname(name);
|
name = getzname(name);
|
||||||
stdlen = name - stdname;
|
stdlen = name - stdname;
|
||||||
if (stdlen < 3)
|
}
|
||||||
return -1;
|
|
||||||
if (*name == '\0')
|
if (*name == '\0')
|
||||||
return -1;
|
return -1;
|
||||||
name = getoffset(name, &stdoffset);
|
name = getoffset(name, &stdoffset);
|
||||||
@@ -766,11 +828,18 @@ const int lastditch;
|
|||||||
if (load_result != 0)
|
if (load_result != 0)
|
||||||
sp->leapcnt = 0; /* so, we're off a little */
|
sp->leapcnt = 0; /* so, we're off a little */
|
||||||
if (*name != '\0') {
|
if (*name != '\0') {
|
||||||
|
if (*name == '<') {
|
||||||
|
dstname = ++name;
|
||||||
|
name = getqzname(name, '>');
|
||||||
|
if (*name != '>')
|
||||||
|
return -1;
|
||||||
|
dstlen = name - dstname;
|
||||||
|
name++;
|
||||||
|
} else {
|
||||||
dstname = name;
|
dstname = name;
|
||||||
name = getzname(name);
|
name = getzname(name);
|
||||||
dstlen = name - dstname; /* length of DST zone name */
|
dstlen = name - dstname; /* length of DST zone name */
|
||||||
if (dstlen < 3)
|
}
|
||||||
return -1;
|
|
||||||
if (*name != '\0' && *name != ',' && *name != ';') {
|
if (*name != '\0' && *name != ',' && *name != ';') {
|
||||||
name = getoffset(name, &dstoffset);
|
name = getoffset(name, &dstoffset);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
@@ -1325,7 +1394,6 @@ register struct tm * const tmp;
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Adapted from code provided by Robert Elz, who writes:
|
** Adapted from code provided by Robert Elz, who writes:
|
||||||
** The "best" way to do mktime I think is based on an idea of Bob
|
** The "best" way to do mktime I think is based on an idea of Bob
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
#ifndef NOID
|
#ifndef NOID
|
||||||
static char elsieid[] = "@(#)strftime.c 7.74";
|
static char elsieid[] = "@(#)strftime.c 7.75";
|
||||||
/*
|
/*
|
||||||
** Based on the UCB version with the ID appearing below.
|
** Based on the UCB version with the ID appearing below.
|
||||||
** This is ANSIish only when "multibyte character == plain character".
|
** This is ANSIish only when "multibyte character == plain character".
|
||||||
@@ -108,7 +108,8 @@ static const struct lc_time_T C_time_locale = {
|
|||||||
|
|
||||||
static char * _add P((const char *, char *, const char *));
|
static char * _add P((const char *, char *, const char *));
|
||||||
static char * _conv P((int, const char *, char *, const char *));
|
static char * _conv P((int, const char *, char *, const char *));
|
||||||
static char * _fmt P((const char *, const struct tm *, char *, const char *, int *));
|
static char * _fmt P((const char *, const struct tm *, char *, const char *,
|
||||||
|
int *));
|
||||||
static char * _yconv P((int, int, int, int, char *, const char *));
|
static char * _yconv P((int, int, int, int, char *, const char *));
|
||||||
|
|
||||||
extern char * tzname[];
|
extern char * tzname[];
|
||||||
|
|||||||
Reference in New Issue
Block a user