diff -u -r ../tzcode.orig/Makefile ./Makefile
---- ../tzcode.orig/Makefile 2003-12-15 06:33:34.000000000 -0800
-+++ ./Makefile 2004-05-24 14:30:31.659356800 -0700
+--- Makefile.orig 2006-11-27 05:54:05.000000000 -0800
++++ Makefile 2006-12-06 14:54:28.000000000 -0800
@@ -40,7 +40,7 @@
# (and subdirectories).
# Use an absolute path name for TZDIR unless you're just testing the software.
# The "tzselect", "zic", and "zdump" commands get installed in. . .
-@@ -239,9 +239,11 @@
+@@ -241,9 +241,11 @@
###############################################################################
+
TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
- TZDSRCS= zdump.c localtime.c asctime.c ialloc.c
-@@ -275,7 +277,10 @@
+ TZDSRCS= zdump.c localtime.c ialloc.c
+@@ -278,7 +280,10 @@
SHELL= /bin/sh
-all: tzselect zic zdump $(LIBOBJS)
-+LS= /usr/bin/ls
++LS= /bin/ls
+SED= /usr/bin/sed
+
+all: tzselect zic zdump $(LIBOBJS) tz2icu
ALL: all date
-@@ -308,9 +313,12 @@
+@@ -311,9 +316,12 @@
zdump: $(TZDOBJS)
$(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
yearistype: yearistype.sh
cp yearistype.sh yearistype
chmod +x yearistype
-@@ -321,6 +329,9 @@
+@@ -324,6 +332,9 @@
right_only: zic leapseconds $(TDATA)
$(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA)
# subdirectories of $(TZDIR). However, this led to configuration errors.
# For example, with posix_right under the earlier scheme,
diff -u -r ../tzcode.orig/zic.c ./zic.c
---- ../tzcode.orig/zic.c 2003-12-15 06:36:35.000000000 -0800
-+++ ./zic.c 2004-05-24 14:03:43.937566400 -0700
-@@ -13,6 +13,20 @@
+--- zic.c.orig 2006-12-06 14:29:17.000000000 -0800
++++ zic.c 2006-12-06 14:51:36.000000000 -0800
+@@ -26,6 +26,20 @@
#define MKDIR_UMASK 0755
#endif
+
/*
** On some ancient hosts, predicates like `isspace(C)' are defined
- ** only if isascii(C) || C == EOF. Modern hosts obey the C Standard,
-@@ -86,8 +100,14 @@
+ ** only if isascii(C) || C == EOF. Modern hosts obey the C Standard,
+@@ -106,8 +120,14 @@
extern int optind;
- static void addtt P((time_t starttime, int type));
+ static void addtt P((zic_t starttime, int type));
+#ifdef ICU
+static int addtype P((long gmtoff, long rawoff, long dstoff,
+ const char * abbr, int isdst,
static int addtype P((long gmtoff, const char * abbr, int isdst,
int ttisstd, int ttisgmt));
+#endif
- static void leapadd P((time_t t, int positive, int rolling, int count));
+ static void leapadd P((zic_t t, int positive, int rolling, int count));
static void adjleap P((void));
static void associate P((void));
-@@ -256,6 +276,18 @@
+@@ -287,6 +307,18 @@
const int l_value;
};
static struct lookup const * byword P((const char * string,
const struct lookup * lp));
-@@ -338,6 +370,11 @@
+@@ -369,6 +401,11 @@
unsigned char type;
} attypes[TZ_MAX_TIMES];
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];
-@@ -447,6 +484,62 @@
- (void) exit(EXIT_FAILURE);
+@@ -480,6 +517,62 @@
+ exit(EXIT_FAILURE);
}
+#ifdef ICU
static const char * psxrules;
static const char * lcltime;
static const char * directory;
-@@ -554,6 +647,14 @@
+@@ -591,6 +684,14 @@
adjleap();
}
for (i = optind; i < argc; ++i)
infile(argv[i]);
if (errors)
-@@ -573,6 +674,9 @@
+@@ -610,6 +711,9 @@
for (i = 0; i < nlinks; ++i) {
eat(links[i].l_filename, links[i].l_linenum);
dolink(links[i].l_from, links[i].l_to);
+#ifdef ICU
-+ emit_icu_link(icuFile, links[i].l_from, links[i].l_to);
++ emit_icu_link(icuFile, links[i].l_from, links[i].l_to);
+#endif
- }
- if (lcltime != NULL) {
- eat("command line", 1);
-@@ -582,6 +686,11 @@
+ if (noise)
+ for (j = 0; j < nlinks; ++j)
+ if (strcmp(links[i].l_to,
+@@ -624,6 +728,11 @@
eat("command line", 1);
dolink(psxrules, TZDEFRULES);
}
return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
-@@ -642,7 +751,9 @@
+@@ -689,7 +798,9 @@
(void) fprintf(stderr,
_("%s: Can't link from %s to %s: %s\n"),
progname, fromname, toname, e);
+#ifndef ICU_LINKS
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
+#endif
}
}
ifree(fromname);
-@@ -1503,7 +1614,12 @@
- convert(eitol(timecnt), tzh.tzh_timecnt);
- convert(eitol(typecnt), tzh.tzh_typecnt);
- convert(eitol(charcnt), tzh.tzh_charcnt);
+@@ -1655,7 +1766,12 @@
+ #define DO(field) (void) fwrite((void *) tzh.field, \
+ (size_t) sizeof tzh.field, (size_t) 1, fp)
+ tzh = tzh0;
+#ifdef ICU
+ * (ICUZoneinfoVersion*) &tzh.tzh_reserved = TZ_ICU_VERSION;
+ (void) strncpy(tzh.tzh_magic, TZ_ICU_MAGIC, sizeof tzh.tzh_magic);
+#else
- (void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
+ (void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
+#endif
- #define DO(field) (void) fwrite((void *) tzh.field, (size_t) sizeof tzh.field, (size_t) 1, fp)
- DO(tzh_magic);
- DO(tzh_reserved);
-@@ -1527,7 +1643,12 @@
- (void) fwrite((void *) types, (size_t) sizeof types[0],
- (size_t) timecnt, fp);
- for (i = 0; i < typecnt; ++i) {
+ tzh.tzh_version[0] = ZIC_VERSION;
+ convert(eitol(thistypecnt), tzh.tzh_ttisgmtcnt);
+ convert(eitol(thistypecnt), tzh.tzh_ttisstdcnt);
+@@ -1688,7 +1804,12 @@
+ }
+ for (i = 0; i < typecnt; ++i)
+ if (writetype[i]) {
+#ifdef ICU
+ puttzcode((long) rawoffs[i], fp);
+ puttzcode((long) dstoffs[i], fp);
+#else
- puttzcode((long) gmtoffs[i], fp);
+ puttzcode(gmtoffs[i], fp);
+#endif
- (void) putc(isdsts[i], fp);
- (void) putc(abbrinds[i], fp);
- }
-@@ -1583,6 +1704,24 @@
+ (void) putc(isdsts[i], fp);
+ (void) putc((unsigned char) indmap[abbrinds[i]], fp);
+ }
+@@ -1957,6 +2078,24 @@
}
}
static void
outzone(zpfirst, zonecount)
const struct zone * const zpfirst;
-@@ -1601,6 +1740,11 @@
- register int startttisgmt;
- register int type;
- char startbuf[BUFSIZ];
+@@ -1979,6 +2118,11 @@
+ register char * envvar;
+ register int max_abbr_len;
+ register int max_envvar_len;
+#ifdef ICU
+ int finalRuleYear, finalRuleIndex;
+ const struct rule* finalRule1;
+ const struct rule* finalRule2;
+#endif
- INITIALIZE(untiltime);
- INITIALIZE(starttime);
-@@ -1630,11 +1774,55 @@
+ max_abbr_len = 2 + max_format_len + max_abbrvar_len;
+ max_envvar_len = 2 * max_abbr_len + 5 * 9;
+@@ -2055,11 +2199,55 @@
eat(zp->z_filename, zp->z_linenum);
*startbuf = '\0';
startoff = zp->z_gmtoff;
if (zp->z_nrules == 0) {
stdoff = zp->z_stdoff;
doabbr(startbuf, zp->z_format,
- (char *) NULL, stdoff != 0);
+ (char *) NULL, stdoff != 0, FALSE);
type = addtype(oadd(zp->z_gmtoff, stdoff),
+#ifdef ICU
+ zp->z_gmtoff, stdoff,
startbuf, stdoff != 0, startttisstd,
startttisgmt);
if (usestart) {
-@@ -1708,6 +1896,15 @@
+@@ -2132,6 +2320,15 @@
break; /* go on to next year */
rp = &zp->z_rules[k];
rp->r_todo = FALSE;
if (useuntil && ktime >= untiltime)
break;
stdoff = rp->r_stdoff;
-@@ -1735,8 +1932,14 @@
- doabbr(buf, zp->z_format, rp->r_abbrvar,
- rp->r_stdoff != 0);
+@@ -2163,8 +2360,14 @@
+ doabbr(ab, zp->z_format, rp->r_abbrvar,
+ rp->r_stdoff != 0, FALSE);
offset = oadd(zp->z_gmtoff, rp->r_stdoff);
+#ifdef ICU
+ type = addtype(offset, zp->z_gmtoff, rp->r_stdoff,
-+ buf, rp->r_stdoff != 0,
++ ab, rp->r_stdoff != 0,
+ rp->r_todisstd, rp->r_todisgmt);
+#else
- type = addtype(offset, buf, rp->r_stdoff != 0,
+ type = addtype(offset, ab, rp->r_stdoff != 0,
rp->r_todisstd, rp->r_todisgmt);
+#endif
addtt(ktime, type);
}
}
-@@ -1750,10 +1953,19 @@
+@@ -2178,10 +2381,19 @@
if (*startbuf == '\0')
error(_("can't determine time zone abbreviation to use just after until time"));
else addtt(starttime,
}
/*
** Now we may get to set starttime for the next zone line.
-@@ -1779,6 +1991,10 @@
+@@ -2210,6 +2422,10 @@
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];
-@@ -1800,8 +2016,15 @@
+@@ -2231,8 +2447,15 @@
}
static int
const char * const abbr;
const int isdst;
const int ttisstd;
-@@ -1821,12 +2044,25 @@
+@@ -2252,12 +2475,25 @@
error(_("internal error - addtype called with bad ttisgmt"));
- (void) exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
+#ifdef ICU
+ if (isdst != (dstoff != 0)) {
strcmp(abbr, &chars[abbrinds[i]]) == 0 &&
ttisstd == ttisstds[i] &&
ttisgmt == ttisgmts[i])
-@@ -1841,6 +2077,10 @@
- (void) exit(EXIT_FAILURE);
+@@ -2272,6 +2508,10 @@
+ exit(EXIT_FAILURE);
}
gmtoffs[i] = gmtoff;
+#ifdef ICU