[tz] [PATCH 4/4] Revert the change that added meta-information to version-3 format.
Paul Eggert
eggert at cs.ucla.edu
Wed Sep 11 10:01:41 UTC 2013
Further testing found that it was incompatible with Ubuntu 12.04 glibc
so this feature requires redesign and more testing.
* Makefile (ZFLAGS): Remove comment about name and version info.
Make it an empty var instead.
* tzfile.5, tzfile.h: Remove description of meta-information.
* zic.8: Remove options -n and -o.
* zic.c: Don't include <stddef.h>.
(genoption, genoptions, genname, addgenoption, writevalue): Remove.
(usage, main, writezone): Remove support for -n and -o.
---
Makefile | 3 +--
tzfile.5 | 29 ++++-------------------------
tzfile.h | 6 ------
zic.8 | 14 --------------
zic.c | 59 ++---------------------------------------------------------
5 files changed, 7 insertions(+), 104 deletions(-)
diff --git a/Makefile b/Makefile
index 9052eeb..e493f2e 100644
--- a/Makefile
+++ b/Makefile
@@ -241,8 +241,7 @@ LDFLAGS= $(LFLAGS)
zic= ./zic
ZIC= $(zic) $(ZFLAGS)
-# Uncomment this to put name and version info into zic output files.
-#ZFLAGS= -n -o version='$(VERSION)'
+ZFLAGS=
# The name of a Posix-compliant `awk' on your system.
AWK= awk
diff --git a/tzfile.5 b/tzfile.5
index edfa475..4089910 100644
--- a/tzfile.5
+++ b/tzfile.5
@@ -134,43 +134,22 @@ For version-2-format time zone files,
the above header and data are followed by a second header and data,
identical in format except that
eight bytes are used for each transition time or leap second time.
-After the second header and data,
-and just before the end of the file, comes a newline-enclosed,
+After the second header and data comes a newline-enclosed,
POSIX-TZ-environment-variable-style string for use in handling instants
after the last transition time stored in the file
(with nothing between the newlines if there is no POSIX representation for
such instants).
.PP
-Version-3-format time zone files have the following additions:
-.IP
-The POSIX-TZ-style string may use two minor extensions to the
-POSIX TZ format, as described in
+For version-3-format time zone files, the POSIX-TZ-style string may
+use two minor extensions to the POSIX TZ format, as described in
.IR newtzset (3).
First, the hours part of its transition times may be signed and range from
\(mi167 through 167 instead of the POSIX-required unsigned values
from 0 through 24. Second, DST is in effect all year if it starts
January 1 at 00:00 and ends December 31 at 24:00 plus the difference
between daylight saving and standard time.
-.IP
-The newline-enclosed POSIX-TZ-style string is preceded by a section
-containing auxiliary meta-information that is not needed to process
-time stamps. This section consists of another copy of the
-newline-enclosed POSIX-TZ-style string (this is for the benefit of
-version-2-only clients), followed by a four-byte integer size value,
-followed by zero or more NUL-terminated byte strings, followed by an
-additional NUL. The size value is the total number of bytes in all
-the byte strings, including the trailing NULs at the end of the
-strings, but not including the additional NUL. Each byte string
-consists of a name-value pair separated by "=". Names consist of
-ASCII letters, digits and underscores, and start with a letter;
-duplicate names are not allowed. Two common names are "name", the
-Zone name for the data, and "version", the data's version number.
-Values can contain any bytes except NUL.
.PP
-Future additions to the format may insert more data just before the
-newline-enclosed POSIX-TZ-style string at the end of the file, so
-clients should not assume that this string immediately follows
-the auxiliary meta-information.
+Future changes to the format may append more data.
.SH SEE ALSO
newctime(3), newtzset(3)
.\" This file is in the public domain, so clarified as of
diff --git a/tzfile.h b/tzfile.h
index 233563c..a2955dd 100644
--- a/tzfile.h
+++ b/tzfile.h
@@ -89,12 +89,6 @@ struct tzhead {
** Second, its DST start time may be January 1 at 00:00 and its stop
** time December 31 at 24:00 plus the difference between DST and
** standard time, indicating DST all year.
-** Third, the newline-enclosed TZ string is preceded by a new section
-** consisting of another copy of the string, followed by a four-byte
-** integer size value, followed by zero or more NUL-terminated
-** name=value byte strings, followed by an additional NUL. The size
-** value gives the total size of the name=value byte strings,
-** including their terminating NUL bytes, but excluding the additional NUL.
*/
/*
diff --git a/zic.8 b/zic.8
index 61113b9..b61ebd3 100644
--- a/zic.8
+++ b/zic.8
@@ -15,11 +15,6 @@ zic \- time zone compiler
.B \-l
.I localtime
] [
-.B \-n
-] [
-.B \-o
-.IB name = value
-] [
.B \-p
.I posixrules
] [
@@ -67,15 +62,6 @@ will act as if the input contained a link line of the form
.ti +.5i
Link \fItimezone\fP localtime
.TP
-.B "\-n"
-Store each zone's name into its generated file, as meta-information
-with the name "name" and value the zone's name.
-.TP
-.BI "\-o " name = value
-Store the given name-value pair into the generated file, as
-meta-information. This option can be repeated, once for each distinct
-name.
-.TP
.BI "\-p " timezone
Use the given time zone's rules when handling POSIX-format
time zone environment variables.
diff --git a/zic.c b/zic.c
index 60bcdfa..9939195 100644
--- a/zic.c
+++ b/zic.c
@@ -9,7 +9,6 @@
#include "tzfile.h"
#include <stdarg.h>
-#include <stddef.h>
#define ZIC_VERSION '3'
@@ -141,9 +140,6 @@ static int yearistype(int year, const char * type);
static int charcnt;
static int errors;
static const char * filename;
-static const char ** genoption;
-static int genoptions;
-static int genname;
static int leapcnt;
static int leapseen;
static zic_t leapminyear;
@@ -436,8 +432,7 @@ static _Noreturn void
usage(FILE *stream, int status)
{
(void) fprintf(stream, _("%s: usage is %s \
-[ --version ] [ --help ] [ -v ] [ -l localtime ]\\\n\
-\t[ -n ] [ -o name=value ]... [ -p posixrules ] \\\n\
+[ --version ] [ --help ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n\
\n\
Report bugs to %s.\n"),
@@ -451,29 +446,6 @@ static const char * directory;
static const char * leapsec;
static const char * yitcommand;
-static int
-addgenoption(char const *option)
-{
- register char const *o = option;
- register ptrdiff_t namelen;
- register int i;
- if (! (isascii (*o) && isalpha(*o)))
- return 0;
- while (*++o != '=')
- if (! (isascii (*o) && (isalnum(*o) || *o == '_')))
- return 0;
- namelen = o - option;
- if (namelen == sizeof "name" - 1
- && memcmp(option, "name", namelen) == 0)
- return 0;
- for (i = 0; i < genoptions; i++)
- if (strncmp(genoption[i], option, namelen + 1) == 0)
- return 0;
- genoption = erealloc(genoption, (genoptions + 1) * sizeof *genoption);
- genoption[genoptions++] = option;
- return 1;
-}
-
int
main(int argc, char **argv)
{
@@ -504,7 +476,7 @@ main(int argc, char **argv)
} else if (strcmp(argv[i], "--help") == 0) {
usage(stdout, EXIT_SUCCESS);
}
- while ((c = getopt(argc, argv, "d:l:p:L:no:vsy:")) != EOF && c != -1)
+ while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1)
switch (c) {
default:
usage(stderr, EXIT_FAILURE);
@@ -528,17 +500,6 @@ _("%s: More than one -l option specified\n"),
exit(EXIT_FAILURE);
}
break;
- case 'n':
- genname = TRUE;
- break;
- case 'o':
- if (!addgenoption(optarg)) {
- fprintf(stderr,
- _("%s: %s: invalid -o option\n"),
- progname, optarg);
- exit(EXIT_FAILURE);
- }
- break;
case 'p':
if (psxrules == NULL)
psxrules = optarg;
@@ -1432,7 +1393,6 @@ writezone(const char *const name, const char *const string)
register int leapcnt32, leapi32;
register int timecnt32, timei32;
register int pass;
- register int_fast32_t genlen;
static char * fullname;
static const struct tzhead tzh0;
static struct tzhead tzh;
@@ -1748,21 +1708,6 @@ writezone(const char *const name, const char *const string)
(void) putc(ttisgmts[i], fp);
}
(void) fprintf(fp, "\n%s\n", string);
-
- genlen = 0;
- if (genname)
- genlen += sizeof "name=" + strlen (name);
- for (i = 0; i < genoptions; i++)
- genlen += strlen (genoption[i]) + 1;
- puttzcode(genlen, fp);
-
- if (genname)
- fprintf(fp, "name=%s%c", name, 0);
- for (i = 0; i < genoptions; i++) {
- register char const *v = genoption[i];
- fprintf(fp, "%s%c", v, 0);
- }
- fprintf(fp, "%c\n%s\n", 0, string);
if (ferror(fp) || fclose(fp)) {
(void) fprintf(stderr, _("%s: Error writing %s\n"),
progname, fullname);
--
1.8.1.2
More information about the tz
mailing list