about summary refs log tree commit diff
path: root/timezone/checktab.awk
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-02-15 19:31:34 +0000
committerUlrich Drepper <drepper@redhat.com>1998-02-15 19:31:34 +0000
commit14ea22e96c0b6fce54e2451c69c96c429177b62c (patch)
tree4fa8964f6ae07342ee56de737e944c60f6a4cf63 /timezone/checktab.awk
parentdc30f461575342ffeb6c0f2d5931493c1c3a91c0 (diff)
downloadglibc-14ea22e96c0b6fce54e2451c69c96c429177b62c.tar.gz
glibc-14ea22e96c0b6fce54e2451c69c96c429177b62c.tar.xz
glibc-14ea22e96c0b6fce54e2451c69c96c429177b62c.zip
Update.
1998-02-15  Ulrich Drepper  <drepper@cygnus.com>

	* nss/nsswitch.c (__nss_lookup): Return 1 if this was the last
	module.

	* nss/getXXent_r.c: If no more module is found don't try to call
	setXXent functions but leave unsuccessfully.

	* malloc/obstack.h: Cleanups.

	* sysdeps/wordsize-32/stdint.h: New file.
	* sysdeps/wordsize-64/stdint.h: New file.
	* sysdeps/generic/stdint.h: New file.
	* sysdeps/wordsize-32/inttypes.h: Adopt to use stdint.h.
	* sysdeps/wordsize-64/inttypes.h: Likewise.
	* stdlib/Makefile (headers): Add stdint.h.

1998-02-03  Paul Eggert  <eggert@twinsun.com>

	* malloc/obstack.h (PTR_INT_TYPE): Use __PTRDIFF_TYPE__ if available.

1998-02-13 17:59  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* timezone: New directory.
	* time/README, time/africa, time/antarctica, time/asia,
	time/australasia, time/backward, time/checktab.awk,
	time/etcetera, time/europe, time/factory, time/ialloc.c,
	time/iso3166.tab, time/leapseconds, time/northamerica,
	time/pacificnew, time/private.h, time/scheck.c,
	time/solar87, time/solar88, time/solar89, time/southamerica,
	time/systemv, time/test-tz.c, time/tzfile.h,
	time/tzselect.ksh, time/yearistype, time/zdump.c,
	time/zic.c, time/zone.tab: Moved to timezone.
	* time/tzfile.c: Include tzfile.h from timezone subdir.
	* time/tzset.c: Likewise.
	* time/Makefile: Cut out all code relating to timezones...
	* timezone/Makefile: ...and paste it in here.
	* Makefile (subdirs): Add timezone.

1998-02-13 18:45  H.J. Lu  <hjl@gnu.org>

	* libc.map (_sys_nerr): Added.

	* sysdeps/unix/sysv/linux/errlist.c (_sys_nerr): Make it
	versioned symbol.

1998-02-15 17:16  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/bits/socket.h: Define PF_KEY and
	pseudo_AF_KEY instead of pseudo_PF_KEY and AF_KEY.
	Reported by Craig Metz <cmetz@inner.net>.

1998-01-22  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* nss/nss_files/files-parse.c (LOOKUP_NAME_CASE): Use __strcasecmp
	instead of strcasecmp.
	* nss/nss_files/files-alias.c (get_next_alias): Likewise.

	* wctype/wctype.h (_ISwbit): Avoid warning with gcc before 2.8.

1998-02-15 16:55  Ulrich Drepper  <drepper@cygnus.com>

	* socket/sys/socket.h (setsockopt): Make OPTVAL parameter const.
	Patch by Dean Gaudet <dgaudet@arctic.org>.

1998-02-15 16:53  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/Dist: Add getresgid.c and getresuid.c.

1998-02-15 10:49  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* sysdeps/unix/sysv/linux/poll.c: If compiled against a kernel
	with no poll syscall, just include the BSD version.
	* sysdeps/unix/sysv/linux/getresuid.c: If compiled against a
	kernel without the syscall, include the stub version.
	* sysdeps/unix/sysv/linux/getresgid.c: Likewise.
	* sysdeps/generic/getresuid.c: New file.
	* sysdeps/generic/getresgid.c: New file.

1998-02-15  Ulrich Drepper  <drepper@cygnus.com>

	* stdio-common/vfscanf.c: Correct last change a bit.
Diffstat (limited to 'timezone/checktab.awk')
-rw-r--r--timezone/checktab.awk152
1 files changed, 152 insertions, 0 deletions
diff --git a/timezone/checktab.awk b/timezone/checktab.awk
new file mode 100644
index 0000000000..9006e9f59a
--- /dev/null
+++ b/timezone/checktab.awk
@@ -0,0 +1,152 @@
+# Check tz tables for consistency.
+
+# Contributed by Paul Eggert <eggert@twinsun.com>.
+
+BEGIN {
+	FS = "\t"
+
+	if (!iso_table) iso_table = "iso3166.tab"
+	if (!zone_table) zone_table = "zone.tab"
+	if (!want_warnings) want_warnings = -1
+
+	while (getline <iso_table) {
+		iso_NR++
+		if ($0 ~ /^#/) continue
+		if (NF != 2) {
+			printf "%s:%d: wrong number of columns\n",
+				iso_table, iso_NR >>"/dev/stderr"
+			status = 1
+		}
+		cc = $1
+		name = $2
+		if (cc !~ /^[A-Z][A-Z]$/) {
+			printf "%s:%d: invalid country code `%s'\n", \
+				iso_table, iso_NR, cc >>"/dev/stderr"
+			status = 1
+		}
+		if (cc <= cc0) {
+			printf "%s:%d: country code `%s' is %s\n", \
+				iso_table, iso_NR, cc, \
+				cc==cc0 ? "duplicate"  : "out of order" \
+				>>"/dev/stderr"
+			status = 1
+		}
+		cc0 = cc
+		if (name2cc[name]) {
+			printf "%s:%d: `%s' and `%s' have the sname name\n", \
+				iso_table, iso_NR, name2cc[name], cc \
+				>>"/dev/stderr"
+			status = 1
+		}
+		name2cc[name] = cc
+		cc2name[cc] = name
+		cc2NR[cc] = iso_NR
+	}
+
+	zone_table = "zone.tab"
+	cc0 = ""
+
+	while (getline <zone_table) {
+		zone_NR++
+		if ($0 ~ /^#/) continue
+		if (NF != 3 && NF != 4) {
+			printf "%s:%d: wrong number of columns\n",
+				zone_table, zone_NR >>"/dev/stderr"
+			status = 1
+		}
+		cc = $1
+		coordinates = $2
+		tz = $3
+		comments = $4
+		if (cc < cc0) {
+			printf "%s:%d: country code `%s' is out of order\n", \
+				zone_table, zone_NR, cc >>"/dev/stderr"
+			status = 1
+		}
+		cc0 = cc
+		if (tz2cc[tz]) {
+			printf "%s:%d: %s: duplicate TZ column\n", \
+				zone_table, zone_NR, tz >>"/dev/stderr"
+			status = 1
+		}
+		tz2cc[tz] = cc
+		tz2comments[tz] = comments
+		tz2NR[tz] = zone_NR
+		if (cc2name[cc]) {
+			cc_used[cc]++
+		} else {
+			printf "%s:%d: %s: unknown country code\n", \
+				zone_table, zone_NR, cc >>"/dev/stderr"
+			status = 1
+		}
+		if (coordinates !~ /^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$/ \
+		    && coordinates !~ /^[-+][0-9][0-9][0-5][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9][0-5][0-9]$/) {
+			printf "%s:%d: %s: invalid coordinates\n", \
+				zone_table, zone_NR, coordinates >>"/dev/stderr"
+			status = 1
+		}
+	}
+
+	for (tz in tz2cc) {
+		if (cc_used[tz2cc[tz]] == 1) {
+			if (tz2comments[tz]) {
+				printf "%s:%d: unnecessary comment `%s'\n", \
+					zone_table, tz2NR[tz], tz2comments[tz] \
+					>>"/dev/stderr"
+				status = 1
+			}
+		} else {
+			if (!tz2comments[tz]) {
+				printf "%s:%d: missing comment\n", \
+					zone_table, tz2NR[tz] >>"/dev/stderr"
+				status = 1
+			}
+		}
+	}
+
+	FS = " "
+}
+
+{
+	tz = ""
+	if ($1 == "Zone") tz = $2
+	if ($1 == "Link") {
+		# Ignore Link commands if source and destination basenames
+		# are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
+		src = $2
+		dst = $3
+		while ((i = index(src, "/"))) src = substr(src, i+1)
+		while ((i = index(dst, "/"))) dst = substr(dst, i+1)
+		if (src != dst) tz = $3
+	}
+	if (tz && tz ~ /\//) {
+		if (!tz2cc[tz]) {
+			printf "%s: no data for `%s'\n", zone_table, tz \
+				>>"/dev/stderr"
+			status = 1
+		}
+		zoneSeen[tz] = 1
+	}
+}
+
+END {
+	for (tz in tz2cc) {
+		if (!zoneSeen[tz]) {
+			printf "%s:%d: no Zone table for `%s'\n", \
+				zone_table, tz2NR[tz], tz >>"/dev/stderr"
+			status = 1
+		}
+	}
+
+	if (0 < want_warnings) {
+		for (cc in cc2name) {
+			if (!cc_used[cc]) {
+				printf "%s:%d: warning:" \
+					"no Zone entries for %s (%s)\n",
+					iso_table, cc2NR[cc], cc, cc2name[cc]
+			}
+		}
+	}
+
+	exit status
+}