about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-04-05 21:39:50 +0000
committerJakub Jelinek <jakub@redhat.com>2005-04-05 21:39:50 +0000
commitff44b53b529ff11f45595a02058a3949eec9a211 (patch)
tree1cb8aecf1f532ee27c8b685a36cb0d9fbed0e5d7
parent8fedcc4046552f181b461995e5c5cedabfcd86e0 (diff)
downloadglibc-ff44b53b529ff11f45595a02058a3949eec9a211.tar.gz
glibc-ff44b53b529ff11f45595a02058a3949eec9a211.tar.xz
glibc-ff44b53b529ff11f45595a02058a3949eec9a211.zip
Updated to fedora-glibc-20050405T2114 cvs/fedora-glibc-2_3_4-21
-rw-r--r--ChangeLog56
-rw-r--r--intl/Makefile23
-rw-r--r--intl/bindtextdom.c4
-rw-r--r--intl/dcigettext.c485
-rw-r--r--intl/gettextP.h45
-rw-r--r--intl/loadmsgcat.c172
-rw-r--r--intl/tst-gettext3.c60
-rw-r--r--intl/tst-gettext3.sh45
-rw-r--r--sunrpc/pmap_rmt.c3
-rw-r--r--timezone/antarctica33
-rw-r--r--timezone/asia182
-rw-r--r--timezone/australasia31
-rw-r--r--timezone/etcetera7
-rw-r--r--timezone/europe31
-rw-r--r--timezone/iso3166.tab4
-rw-r--r--timezone/leapseconds44
-rw-r--r--timezone/northamerica4
-rw-r--r--timezone/scheck.c2
-rw-r--r--timezone/southamerica12
-rw-r--r--timezone/tzfile.h26
-rw-r--r--timezone/zdump.c17
-rw-r--r--timezone/zic.c124
22 files changed, 843 insertions, 567 deletions
diff --git a/ChangeLog b/ChangeLog
index 95417faa1f..850dd5bec2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,59 @@
+2005-03-27  Bruno Haible  <bruno@clisp.org>
+
+	* intl/tst-gettext3.c: New file.
+	* intl/tst-gettext3.sh: New file.
+	* intl/Makefile (distribute): Add tst-gettext3.sh.
+	(test-srcs): Add tst-gettext3.
+	(tests): Depend on tst-gettext3.out.
+	(tst-gettext3.out): New rule.
+	(CFLAGS-tst-gettext3.c): New variable.
+
+	Fix bug exposed by tst-gettext3.
+	* intl/gettextP.h (struct converted_domain): New type.
+	(struct loaded_domain): Remove the conv, conv_tab fields. Add
+	conversions, nconversions fields.
+	(_nl_init_domain_conv): Remove declaration.
+	(_nl_free_domain_conv): Remove declaration.
+	(_nl_find_msg): Add convert argument.
+	* intl/dcigettext.c (DCIGETTEXT): Call _nl_find_msg with convert=1.
+	(_nl_find_msg): Add convert argument. When a conversion to a different
+	charset is needed, create a new converted_domain element, instead of
+	throwing away the old converted translations.
+	(get_output_charset): New function.
+	* intl/loadmsgcat.c (_nl_init_domain_conv): Remove function.
+	(_nl_free_domain_conv): Remove function.
+	(_nl_load_domain): Initialize the conversions array to empty. Use
+	_nl_find_msg instead of _nl_init_domain_conv to retrieve the header
+	entry.
+	(_nl_unload_domain): Free the conversions array and its contents.
+
+	* intl/gettextP.h (struct loaded_domain): Remove codeset_cntr field.
+	(struct binding): Likewise.
+	* intl/bindtextdom.c (set_binding_values): Drop codeset_cntr
+	modifications.
+
+2005-04-04  Jakub Jelinek  <jakub@redhat.com>
+
+	* sunrpc/pmap_rmt.c (xdr_rmtcall_args): Use a dummy arglen instead
+	of trying to encode uninitialized arglen.
+
+2005-04-04  Ulrich Drepper  <drepper@redhat.com>
+
+	* timezone/scheck.c: Update from tzcode2005h.
+	* timezone/tzfile.h: Likewise.
+	* timezone/zdump.c: Likewise.
+	* timezone/zic.c: Likewise.
+
+	* timezone/antarctica: Update from tzdata2005h.
+	* timezone/asia: Likewise.
+	* timezone/australasia: Likewise.
+	* timezone/etcetera: Likewise.
+	* timezone/europe: Likewise.
+	* timezone/northamerica: Likewise.
+	* timezone/southamerica: Likewise.
+	* timezone/leapseconds: Likewise.
+	* timezone/iso3166.tab: Likewise.
+
 2005-03-31  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/ia64/fpu/libm_cpu_defs.h: Update copyright.
diff --git a/intl/Makefile b/intl/Makefile
index 32212c0e29..81557a3457 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1995-2003, 2005 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -25,11 +25,14 @@ routines = bindtextdom dcgettext dgettext gettext	\
 	   finddomain loadmsgcat localealias textdomain
 aux =	   l10nflist explodename plural plural-exp hash-string
 distribute = gmo.h gettextP.h hash-string.h loadinfo.h locale.alias \
-	     plural.y plural-exp.h po2test.sed tst-gettext.sh tst-translit.sh \
-	     translit.po tst-gettext2.sh tstlang1.po tstlang2.po tstcodeset.po\
-	     tst-codeset.sh plural-eval.c
-
-test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset
+	     plural.y plural-exp.h plural-eval.c po2test.sed \
+	     tst-gettext.sh \
+	     tst-translit.sh translit.po \
+	     tst-gettext2.sh tstlang1.po tstlang2.po \
+	     tst-codeset.sh tstcodeset.po \
+	     tst-gettext3.sh
+
+test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset tst-gettext3
 tests = tst-ngettext
 
 before-compile = $(objpfx)msgs.h
@@ -56,7 +59,7 @@ ifeq (no,$(cross-compiling))
 ifeq (yes,$(build-shared))
 ifneq ($(strip $(MSGFMT)),:)
 tests: $(objpfx)tst-translit.out $(objpfx)tst-gettext2.out \
-       $(objpfx)tst-codeset.out
+       $(objpfx)tst-codeset.out $(objpfx)tst-gettext3.out
 ifneq (no,$(PERL))
 tests: $(objpfx)mtrace-tst-gettext
 endif
@@ -72,6 +75,8 @@ $(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
 	$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
 $(objpfx)tst-codeset.out: tst-codeset.sh $(objpfx)tst-codeset
 	$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
+$(objpfx)tst-gettext3.out: tst-gettext3.sh $(objpfx)tst-gettext3
+	$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
 endif
 endif
 
@@ -80,13 +85,15 @@ $(objpfx)msgs.h: po2test.sed ../po/de.po
 	LC_ALL=C sed -f $^ > $@
 
 CFLAGS-tst-gettext.c = -DTESTSTRS_H=\"$(objpfx)msgs.h\"
-CFLAGS-tst-gettext2.c = -DOBJPFX=\"$(objpfx)\"
 CFLAGS-tst-translit.c = -DOBJPFX=\"$(objpfx)\"
+CFLAGS-tst-gettext2.c = -DOBJPFX=\"$(objpfx)\"
 CFLAGS-tst-codeset.c = -DOBJPFX=\"$(objpfx)\"
+CFLAGS-tst-gettext3.c = -DOBJPFX=\"$(objpfx)\"
 
 $(objpfx)tst-translit.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext2.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-codeset.out: $(objpfx)tst-gettext.out
+$(objpfx)tst-gettext3.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(msgcatdir)"' \
 	    -D'LOCALE_ALIAS_PATH="$(msgcatdir)"'
diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
index 546da8e29d..fd527a180a 100644
--- a/intl/bindtextdom.c
+++ b/intl/bindtextdom.c
@@ -207,7 +207,6 @@ set_binding_values (domainname, dirnamep, codesetp)
 			free (binding->codeset);
 
 		      binding->codeset = result;
-		      ++binding->codeset_cntr;
 		      modified = 1;
 		    }
 		}
@@ -271,8 +270,6 @@ set_binding_values (domainname, dirnamep, codesetp)
 	/* The default value.  */
 	new_binding->dirname = (char *) _nl_default_dirname;
 
-      new_binding->codeset_cntr = 0;
-
       if (codesetp)
 	{
 	  const char *codeset = *codesetp;
@@ -293,7 +290,6 @@ set_binding_values (domainname, dirnamep, codesetp)
 	      memcpy (result, codeset, len);
 #endif
 	      codeset = result;
-	      ++new_binding->codeset_cntr;
 	    }
 	  *codesetp = codeset;
 	  new_binding->codeset = (char *) codeset;
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index 8163064edc..c73c719d94 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -326,6 +326,10 @@ static struct transmem_list *transmem_list;
 #else
 typedef unsigned char transmem_block_t;
 #endif
+#if defined _LIBC || HAVE_ICONV
+static const char *get_output_charset PARAMS ((struct binding *domainbinding))
+     internal_function;
+#endif
 
 
 /* Names for the libintl functions are a problem.  They must not clash
@@ -597,7 +601,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
 
       if (domain != NULL)
 	{
-	  retval = _nl_find_msg (domain, binding, msgid1, &retlen);
+	  retval = _nl_find_msg (domain, binding, msgid1, 1, &retlen);
 
 	  if (retval == NULL)
 	    {
@@ -606,7 +610,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
 	      for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
 		{
 		  retval = _nl_find_msg (domain->successor[cnt], binding,
-					 msgid1, &retlen);
+					 msgid1, 1, &retlen);
 
 		  if (retval != NULL)
 		    {
@@ -683,10 +687,11 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
 
 char *
 internal_function
-_nl_find_msg (domain_file, domainbinding, msgid, lengthp)
+_nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
      struct loaded_l10nfile *domain_file;
      struct binding *domainbinding;
      const char *msgid;
+     int convert;
      size_t *lengthp;
 {
   struct loaded_domain *domain;
@@ -793,192 +798,317 @@ _nl_find_msg (domain_file, domainbinding, msgid, lengthp)
     }
 
 #if defined _LIBC || HAVE_ICONV
-  if (domain->codeset_cntr
-      != (domainbinding != NULL ? domainbinding->codeset_cntr : 0))
+  if (convert)
     {
-      /* The domain's codeset has changed through bind_textdomain_codeset()
-	 since the message catalog was initialized or last accessed.  We
-	 have to reinitialize the converter.  */
-      _nl_free_domain_conv (domain);
-      _nl_init_domain_conv (domain_file, domain, domainbinding);
-    }
+      /* We are supposed to do a conversion.  */
+      const char *encoding = get_output_charset (domainbinding);
+
+      /* Search whether a table with converted translations for this
+	 encoding has already been allocated.  */
+      size_t nconversions = domain->nconversions;
+      struct converted_domain *convd = NULL;
+      size_t i;
+
+      for (i = nconversions; i > 0; )
+	{
+	  i--;
+	  if (strcmp (domain->conversions[i].encoding, encoding) == 0)
+	    {
+	      convd = &domain->conversions[i];
+	      break;
+	    }
+	}
 
-  if (
+      if (convd == NULL)
+	{
+	  /* Allocate a table for the converted translations for this
+	     encoding.  */
+	  struct converted_domain *new_conversions =
+	    (struct converted_domain *)
+	    (domain->conversions != NULL
+	     ? realloc (domain->conversions,
+			(nconversions + 1) * sizeof (struct converted_domain))
+	     : malloc ((nconversions + 1) * sizeof (struct converted_domain)));
+
+	  if (__builtin_expect (new_conversions == NULL, 0))
+	    /* Nothing we can do, no more memory.  */
+	    goto converted;
+	  domain->conversions = new_conversions;
+
+	  /* Copy the 'encoding' string to permanent storage.  */
+	  encoding = strdup (encoding);
+	  if (__builtin_expect (encoding == NULL, 0))
+	    /* Nothing we can do, no more memory.  */
+	    goto converted;
+
+	  convd = &new_conversions[nconversions];
+	  convd->encoding = encoding;
+
+	  /* Find out about the character set the file is encoded with.
+	     This can be found (in textual form) in the entry "".  If this
+	     entry does not exist or if this does not contain the 'charset='
+	     information, we will assume the charset matches the one the
+	     current locale and we don't have to perform any conversion.  */
 # ifdef _LIBC
-      domain->conv != (__gconv_t) -1
+	  convd->conv = (__gconv_t) -1;
 # else
 #  if HAVE_ICONV
-      domain->conv != (iconv_t) -1
+	  convd->conv = (iconv_t) -1;
 #  endif
 # endif
-      )
-    {
-      /* We are supposed to do a conversion.  First allocate an
-	 appropriate table with the same structure as the table
-	 of translations in the file, where we can put the pointers
-	 to the converted strings in.
-	 There is a slight complication with plural entries.  They
-	 are represented by consecutive NUL terminated strings.  We
-	 handle this case by converting RESULTLEN bytes, including
-	 NULs.  */
-
-      if (domain->conv_tab == NULL
-	  && ((domain->conv_tab =
-		 (char **) calloc (nstrings + domain->n_sysdep_strings,
-				   sizeof (char *)))
-	      == NULL))
-	/* Mark that we didn't succeed allocating a table.  */
-	domain->conv_tab = (char **) -1;
-
-      if (__builtin_expect (domain->conv_tab == (char **) -1, 0))
-	/* Nothing we can do, no more memory.  */
-	goto converted;
-
-      if (domain->conv_tab[act] == NULL)
+	  {
+	    char *nullentry;
+	    size_t nullentrylen;
+
+	    /* Get the header entry.  This is a recursion, but it doesn't
+	       reallocate domain->conversions because we pass convert = 0.  */
+	    nullentry =
+	      _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
+
+	    if (nullentry != NULL)
+	      {
+		const char *charsetstr;
+
+		charsetstr = strstr (nullentry, "charset=");
+		if (charsetstr != NULL)
+		  {
+		    size_t len;
+		    char *charset;
+		    const char *outcharset;
+
+		    charsetstr += strlen ("charset=");
+		    len = strcspn (charsetstr, " \t\n");
+
+		    charset = (char *) alloca (len + 1);
+# if defined _LIBC || HAVE_MEMPCPY
+		    *((char *) mempcpy (charset, charsetstr, len)) = '\0';
+# else
+		    memcpy (charset, charsetstr, len);
+		    charset[len] = '\0';
+# endif
+
+		    outcharset = encoding;
+
+# ifdef _LIBC
+		    /* We always want to use transliteration.  */
+		    outcharset = norm_add_slashes (outcharset, "TRANSLIT");
+		    charset = norm_add_slashes (charset, "");
+		    if (__gconv_open (outcharset, charset, &convd->conv,
+				      GCONV_AVOID_NOCONV)
+			!= __GCONV_OK)
+		      convd->conv = (__gconv_t) -1;
+# else
+#  if HAVE_ICONV
+		    /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
+		       we want to use transliteration.  */
+#   if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \
+       || _LIBICONV_VERSION >= 0x0105
+		    if (strchr (outcharset, '/') == NULL)
+		      {
+			char *tmp;
+
+			len = strlen (outcharset);
+			tmp = (char *) alloca (len + 10 + 1);
+			memcpy (tmp, outcharset, len);
+			memcpy (tmp + len, "//TRANSLIT", 10 + 1);
+			outcharset = tmp;
+
+			convd->conv = iconv_open (outcharset, charset);
+
+			freea (outcharset);
+		      }
+		    else
+#   endif
+		      convd->conv = iconv_open (outcharset, charset);
+#  endif
+# endif
+
+		    freea (charset);
+		  }
+	      }
+	  }
+	  convd->conv_tab = NULL;
+	  /* Here domain->conversions is still == new_conversions.  */
+	  domain->nconversions++;
+	}
+
+      if (
+# ifdef _LIBC
+	  convd->conv != (__gconv_t) -1
+# else
+#  if HAVE_ICONV
+	  convd->conv != (iconv_t) -1
+#  endif
+# endif
+	  )
 	{
-	  /* We haven't used this string so far, so it is not
-	     translated yet.  Do this now.  */
-	  /* We use a bit more efficient memory handling.
-	     We allocate always larger blocks which get used over
-	     time.  This is faster than many small allocations.   */
-	  __libc_lock_define_initialized (static, lock)
+	  /* We are supposed to do a conversion.  First allocate an
+	     appropriate table with the same structure as the table
+	     of translations in the file, where we can put the pointers
+	     to the converted strings in.
+	     There is a slight complication with plural entries.  They
+	     are represented by consecutive NUL terminated strings.  We
+	     handle this case by converting RESULTLEN bytes, including
+	     NULs.  */
+
+	  if (convd->conv_tab == NULL
+	      && ((convd->conv_tab =
+		    (char **) calloc (nstrings + domain->n_sysdep_strings,
+				      sizeof (char *)))
+		  == NULL))
+	    /* Mark that we didn't succeed allocating a table.  */
+	    convd->conv_tab = (char **) -1;
+
+	  if (__builtin_expect (convd->conv_tab == (char **) -1, 0))
+	    /* Nothing we can do, no more memory.  */
+	    goto converted;
+
+	  if (convd->conv_tab[act] == NULL)
+	    {
+	      /* We haven't used this string so far, so it is not
+		 translated yet.  Do this now.  */
+	      /* We use a bit more efficient memory handling.
+		 We allocate always larger blocks which get used over
+		 time.  This is faster than many small allocations.   */
+	      __libc_lock_define_initialized (static, lock)
 # define INITIAL_BLOCK_SIZE	4080
-	  static unsigned char *freemem;
-	  static size_t freemem_size;
+	      static unsigned char *freemem;
+	      static size_t freemem_size;
 
-	  const unsigned char *inbuf;
-	  unsigned char *outbuf;
-	  int malloc_count;
+	      const unsigned char *inbuf;
+	      unsigned char *outbuf;
+	      int malloc_count;
 # ifndef _LIBC
-	  transmem_block_t *transmem_list = NULL;
+	      transmem_block_t *transmem_list = NULL;
 # endif
 
-	  __libc_lock_lock (lock);
+	      __libc_lock_lock (lock);
 
-	  inbuf = (const unsigned char *) result;
-	  outbuf = freemem + sizeof (size_t);
+	      inbuf = (const unsigned char *) result;
+	      outbuf = freemem + sizeof (size_t);
 
-	  malloc_count = 0;
-	  while (1)
-	    {
-	      transmem_block_t *newmem;
+	      malloc_count = 0;
+	      while (1)
+		{
+		  transmem_block_t *newmem;
 # ifdef _LIBC
-	      size_t non_reversible;
-	      int res;
+		  size_t non_reversible;
+		  int res;
 
-	      if (freemem_size < sizeof (size_t))
-		goto resize_freemem;
+		  if (freemem_size < sizeof (size_t))
+		    goto resize_freemem;
 
-	      res = __gconv (domain->conv,
-			     &inbuf, inbuf + resultlen,
-			     &outbuf,
-			     outbuf + freemem_size - sizeof (size_t),
-			     &non_reversible);
+		  res = __gconv (convd->conv,
+				 &inbuf, inbuf + resultlen,
+				 &outbuf,
+				 outbuf + freemem_size - sizeof (size_t),
+				 &non_reversible);
 
-	      if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT)
-		break;
+		  if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT)
+		    break;
 
-	      if (res != __GCONV_FULL_OUTPUT)
-		{
-		  __libc_lock_unlock (lock);
-		  goto converted;
-		}
+		  if (res != __GCONV_FULL_OUTPUT)
+		    {
+		      __libc_lock_unlock (lock);
+		      goto converted;
+		    }
 
-	      inbuf = (const unsigned char *) result;
+		  inbuf = (const unsigned char *) result;
 # else
 #  if HAVE_ICONV
-	      const char *inptr = (const char *) inbuf;
-	      size_t inleft = resultlen;
-	      char *outptr = (char *) outbuf;
-	      size_t outleft;
-
-	      if (freemem_size < sizeof (size_t))
-		goto resize_freemem;
-
-	      outleft = freemem_size - sizeof (size_t);
-	      if (iconv (domain->conv,
-			 (ICONV_CONST char **) &inptr, &inleft,
-			 &outptr, &outleft)
-		  != (size_t) (-1))
-		{
-		  outbuf = (unsigned char *) outptr;
-		  break;
-		}
-	      if (errno != E2BIG)
-		{
-		  __libc_lock_unlock (lock);
-		  goto converted;
-		}
+		  const char *inptr = (const char *) inbuf;
+		  size_t inleft = resultlen;
+		  char *outptr = (char *) outbuf;
+		  size_t outleft;
+
+		  if (freemem_size < sizeof (size_t))
+		    goto resize_freemem;
+
+		  outleft = freemem_size - sizeof (size_t);
+		  if (iconv (convd->conv,
+			     (ICONV_CONST char **) &inptr, &inleft,
+			     &outptr, &outleft)
+		      != (size_t) (-1))
+		    {
+		      outbuf = (unsigned char *) outptr;
+		      break;
+		    }
+		  if (errno != E2BIG)
+		    {
+		      __libc_lock_unlock (lock);
+		      goto converted;
+		    }
 #  endif
 # endif
 
-	    resize_freemem:
-	      /* We must allocate a new buffer or resize the old one.  */
-	      if (malloc_count > 0)
-		{
-		  ++malloc_count;
-		  freemem_size = malloc_count * INITIAL_BLOCK_SIZE;
-		  newmem = (transmem_block_t *) realloc (transmem_list,
-							 freemem_size);
+		resize_freemem:
+		  /* We must allocate a new buffer or resize the old one.  */
+		  if (malloc_count > 0)
+		    {
+		      ++malloc_count;
+		      freemem_size = malloc_count * INITIAL_BLOCK_SIZE;
+		      newmem = (transmem_block_t *) realloc (transmem_list,
+							     freemem_size);
 # ifdef _LIBC
-		  if (newmem != NULL)
-		    transmem_list = transmem_list->next;
+		      if (newmem != NULL)
+			transmem_list = transmem_list->next;
+		      else
+			{
+			  struct transmem_list *old = transmem_list;
+
+			  transmem_list = transmem_list->next;
+			  free (old);
+			}
+# endif
+		    }
 		  else
 		    {
-		      struct transmem_list *old = transmem_list;
-
-		      transmem_list = transmem_list->next;
-		      free (old);
+		      malloc_count = 1;
+		      freemem_size = INITIAL_BLOCK_SIZE;
+		      newmem = (transmem_block_t *) malloc (freemem_size);
+		    }
+		  if (__builtin_expect (newmem == NULL, 0))
+		    {
+		      freemem = NULL;
+		      freemem_size = 0;
+		      __libc_lock_unlock (lock);
+		      goto converted;
 		    }
-# endif
-		}
-	      else
-		{
-		  malloc_count = 1;
-		  freemem_size = INITIAL_BLOCK_SIZE;
-		  newmem = (transmem_block_t *) malloc (freemem_size);
-		}
-	      if (__builtin_expect (newmem == NULL, 0))
-		{
-		  freemem = NULL;
-		  freemem_size = 0;
-		  __libc_lock_unlock (lock);
-		  goto converted;
-		}
 
 # ifdef _LIBC
-	      /* Add the block to the list of blocks we have to free
-                 at some point.  */
-	      newmem->next = transmem_list;
-	      transmem_list = newmem;
+		  /* Add the block to the list of blocks we have to free
+		     at some point.  */
+		  newmem->next = transmem_list;
+		  transmem_list = newmem;
 
-	      freemem = (unsigned char *) newmem->data;
-	      freemem_size -= offsetof (struct transmem_list, data);
+		  freemem = (unsigned char *) newmem->data;
+		  freemem_size -= offsetof (struct transmem_list, data);
 # else
-	      transmem_list = newmem;
-	      freemem = newmem;
+		  transmem_list = newmem;
+		  freemem = newmem;
 # endif
 
-	      outbuf = freemem + sizeof (size_t);
+		  outbuf = freemem + sizeof (size_t);
+		}
+
+	      /* We have now in our buffer a converted string.  Put this
+		 into the table of conversions.  */
+	      *(size_t *) freemem = outbuf - freemem - sizeof (size_t);
+	      convd->conv_tab[act] = (char *) freemem;
+	      /* Shrink freemem, but keep it aligned.  */
+	      freemem_size -= outbuf - freemem;
+	      freemem = outbuf;
+	      freemem += freemem_size & (alignof (size_t) - 1);
+	      freemem_size = freemem_size & ~ (alignof (size_t) - 1);
+
+	      __libc_lock_unlock (lock);
 	    }
 
-	  /* We have now in our buffer a converted string.  Put this
-	     into the table of conversions.  */
-	  *(size_t *) freemem = outbuf - freemem - sizeof (size_t);
-	  domain->conv_tab[act] = (char *) freemem;
-	  /* Shrink freemem, but keep it aligned.  */
-	  freemem_size -= outbuf - freemem;
-	  freemem = outbuf;
-	  freemem += freemem_size & (alignof (size_t) - 1);
-	  freemem_size = freemem_size & ~ (alignof (size_t) - 1);
-
-	  __libc_lock_unlock (lock);
+	  /* Now convd->conv_tab[act] contains the translation of all
+	     the plural variants.  */
+	  result = convd->conv_tab[act] + sizeof (size_t);
+	  resultlen = *(size_t *) convd->conv_tab[act];
 	}
-
-      /* Now domain->conv_tab[act] contains the translation of all
-	 the plural variants.  */
-      result = domain->conv_tab[act] + sizeof (size_t);
-      resultlen = *(size_t *) domain->conv_tab[act];
     }
 
  converted:
@@ -1122,6 +1252,61 @@ guess_category_value (category, categoryname)
   return language != NULL && strcmp (retval, "C") != 0 ? language : retval;
 }
 
+#if defined _LIBC || HAVE_ICONV
+/* Returns the output charset.  */
+static const char *
+internal_function
+get_output_charset (domainbinding)
+     struct binding *domainbinding;
+{
+  /* The output charset should normally be determined by the locale.  But
+     sometimes the locale is not used or not correctly set up, so we provide
+     a possibility for the user to override this: the OUTPUT_CHARSET
+     environment variable.  Moreover, the value specified through
+     bind_textdomain_codeset overrides both.  */
+  if (domainbinding != NULL && domainbinding->codeset != NULL)
+    return domainbinding->codeset;
+  else
+    {
+      /* For speed reasons, we look at the value of OUTPUT_CHARSET only
+	 once.  This is a user variable that is not supposed to change
+	 during a program run.  */
+      static char *output_charset_cache;
+      static int output_charset_cached;
+
+      if (!output_charset_cached)
+	{
+	  const char *value = getenv ("OUTPUT_CHARSET");
+
+	  if (value != NULL && value[0] != '\0')
+	    {
+	      size_t len = strlen (value) + 1;
+	      char *value_copy = (char *) malloc (len);
+
+	      if (value_copy != NULL)
+		memcpy (value_copy, value, len);
+	      output_charset_cache = value_copy;
+	    }
+	  output_charset_cached = 1;
+	}
+
+      if (output_charset_cache != NULL)
+	return output_charset_cache;
+      else
+	{
+# ifdef _LIBC
+	  return _NL_CURRENT (LC_CTYPE, CODESET);
+# else
+#  if HAVE_ICONV
+	  extern const char *locale_charset PARAMS ((void);
+	  return locale_charset ();
+#  endif
+# endif
+	}
+    }
+}
+#endif
+
 /* @@ begin of epilog @@ */
 
 /* We don't want libintl.a to depend on any other library.  So we
diff --git a/intl/gettextP.h b/intl/gettextP.h
index 46b51e1008..f18535a5b3 100644
--- a/intl/gettextP.h
+++ b/intl/gettextP.h
@@ -1,5 +1,5 @@
 /* Header describing internals of libintl library.
-   Copyright (C) 1995-1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000, 2001, 2004-2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
@@ -88,6 +88,26 @@ struct sysdep_string_desc
   const char *pointer;
 };
 
+/* Cache of translated strings after charset conversion.
+   Note: The strings are converted to the target encoding only on an as-needed
+   basis.  */
+struct converted_domain
+{
+  /* The target encoding name.  */
+  const char *encoding;
+  /* The descriptor for conversion from the message catalog's encoding to
+     this target encoding.  */
+#ifdef _LIBC
+  __gconv_t conv;
+#else
+# if HAVE_ICONV
+  iconv_t conv;
+# endif
+#endif
+  /* The table of translated strings after charset conversion.  */
+  char **conv_tab;
+};
+
 /* The representation of an opened message catalog.  */
 struct loaded_domain
 {
@@ -123,15 +143,9 @@ struct loaded_domain
   /* 1 if the hash table uses a different endianness than this machine.  */
   int must_swap_hash_tab;
 
-  int codeset_cntr;
-#ifdef _LIBC
-  __gconv_t conv;
-#else
-# if HAVE_ICONV
-  iconv_t conv;
-# endif
-#endif
-  char **conv_tab;
+  /* Cache of charset conversions of the translated strings.  */
+  struct converted_domain *conversions;
+  size_t nconversions;
 
   struct expression *plural;
   unsigned long int nplurals;
@@ -151,7 +165,6 @@ struct binding
 {
   struct binding *next;
   char *dirname;
-  int codeset_cntr;	/* Incremented each time codeset changes.  */
   char *codeset;
   char domainname[ZERO];
 };
@@ -173,16 +186,10 @@ struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
 void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
 			      struct binding *__domainbinding))
      internal_function;
-const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
-					  struct loaded_domain *__domain,
-					  struct binding *__domainbinding))
-     internal_function;
-void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
-     internal_function;
 
 char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
-			    struct binding *domainbinding,
-			    const char *msgid, size_t *lengthp))
+			    struct binding *domainbinding, const char *msgid,
+			    int convert, size_t *lengthp))
      internal_function;
 
 #ifdef _LIBC
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index efefc69a43..1f55531097 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -1,5 +1,5 @@
 /* Load needed message catalogs.
-   Copyright (C) 1995-2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -752,146 +752,6 @@ get_sysdep_segment_value (name)
   return NULL;
 }
 
-/* Initialize the codeset dependent parts of an opened message catalog.
-   Return the header entry.  */
-const char *
-internal_function
-_nl_init_domain_conv (domain_file, domain, domainbinding)
-     struct loaded_l10nfile *domain_file;
-     struct loaded_domain *domain;
-     struct binding *domainbinding;
-{
-  /* Find out about the character set the file is encoded with.
-     This can be found (in textual form) in the entry "".  If this
-     entry does not exist or if this does not contain the `charset='
-     information, we will assume the charset matches the one the
-     current locale and we don't have to perform any conversion.  */
-  char *nullentry;
-  size_t nullentrylen;
-
-  /* Preinitialize fields, to avoid recursion during _nl_find_msg.  */
-  domain->codeset_cntr =
-    (domainbinding != NULL ? domainbinding->codeset_cntr : 0);
-#ifdef _LIBC
-  domain->conv = (__gconv_t) -1;
-#else
-# if HAVE_ICONV
-  domain->conv = (iconv_t) -1;
-# endif
-#endif
-  domain->conv_tab = NULL;
-
-  /* Get the header entry.  */
-  nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen);
-
-  if (nullentry != NULL)
-    {
-#if defined _LIBC || HAVE_ICONV
-      const char *charsetstr;
-
-      charsetstr = strstr (nullentry, "charset=");
-      if (charsetstr != NULL)
-	{
-	  size_t len;
-	  char *charset;
-	  const char *outcharset;
-
-	  charsetstr += strlen ("charset=");
-	  len = strcspn (charsetstr, " \t\n");
-
-	  charset = (char *) alloca (len + 1);
-# if defined _LIBC || HAVE_MEMPCPY
-	  *((char *) mempcpy (charset, charsetstr, len)) = '\0';
-# else
-	  memcpy (charset, charsetstr, len);
-	  charset[len] = '\0';
-# endif
-
-	  /* The output charset should normally be determined by the
-	     locale.  But sometimes the locale is not used or not correctly
-	     set up, so we provide a possibility for the user to override
-	     this.  Moreover, the value specified through
-	     bind_textdomain_codeset overrides both.  */
-	  if (domainbinding != NULL && domainbinding->codeset != NULL)
-	    outcharset = domainbinding->codeset;
-	  else
-	    {
-	      outcharset = getenv ("OUTPUT_CHARSET");
-	      if (outcharset == NULL || outcharset[0] == '\0')
-		{
-# ifdef _LIBC
-		  outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
-# else
-#  if HAVE_ICONV
-		  extern const char *locale_charset PARAMS ((void));
-		  outcharset = locale_charset ();
-#  endif
-# endif
-		}
-	    }
-
-# ifdef _LIBC
-	  /* We always want to use transliteration.  */
-	  outcharset = norm_add_slashes (outcharset, "TRANSLIT");
-	  charset = norm_add_slashes (charset, "");
-	  if (__gconv_open (outcharset, charset, &domain->conv,
-			    GCONV_AVOID_NOCONV)
-	      != __GCONV_OK)
-	    domain->conv = (__gconv_t) -1;
-# else
-#  if HAVE_ICONV
-	  /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
-	     we want to use transliteration.  */
-#   if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \
-       || _LIBICONV_VERSION >= 0x0105
-	  if (strchr (outcharset, '/') == NULL)
-	    {
-	      char *tmp;
-
-	      len = strlen (outcharset);
-	      tmp = (char *) alloca (len + 10 + 1);
-	      memcpy (tmp, outcharset, len);
-	      memcpy (tmp + len, "//TRANSLIT", 10 + 1);
-	      outcharset = tmp;
-
-	      domain->conv = iconv_open (outcharset, charset);
-
-	      freea (outcharset);
-	    }
-	  else
-#   endif
-	    domain->conv = iconv_open (outcharset, charset);
-#  endif
-# endif
-
-	  freea (charset);
-	}
-#endif /* _LIBC || HAVE_ICONV */
-    }
-
-  return nullentry;
-}
-
-/* Frees the codeset dependent parts of an opened message catalog.  */
-void
-internal_function
-_nl_free_domain_conv (domain)
-     struct loaded_domain *domain;
-{
-  if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1)
-    free (domain->conv_tab);
-
-#ifdef _LIBC
-  if (domain->conv != (__gconv_t) -1)
-    __gconv_close (domain->conv);
-#else
-# if HAVE_ICONV
-  if (domain->conv != (iconv_t) -1)
-    iconv_close (domain->conv);
-# endif
-#endif
-}
-
 /* Load the message catalogs specified by FILENAME.  If it is no valid
    message catalog do nothing.  */
 void
@@ -913,6 +773,7 @@ _nl_load_domain (domain_file, domainbinding)
   struct loaded_domain *domain;
   int revision;
   const char *nullentry;
+  size_t nullentrylen;
 
   __libc_lock_lock_recursive (lock);
   if (domain_file->decided != 0)
@@ -920,8 +781,8 @@ _nl_load_domain (domain_file, domainbinding)
       /* There are two possibilities:
 
          + is is the same thread calling again during this
-	   initialization via _nl_init_domain_conv and _nl_find_msg.  We
-	   have initialized everything this call needs.
+	   initialization via _nl_find_msg.  We have initialized
+	   everything this call needs.
 
 	 + this is another thread which tried to initialize this object.
            Not necessary anymore since if the lock is available this
@@ -1388,12 +1249,12 @@ _nl_load_domain (domain_file, domainbinding)
       goto out;
     }
 
-  /* Now initialize the character set converter from the character set
-     the file is encoded with (found in the header entry) to the domain's
-     specified character set or the locale's character set.  */
-  nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding);
+  /* No caches of converted translations so far.  */
+  domain->conversions = NULL;
+  domain->nconversions = 0;
 
-  /* Also look for a plural specification.  */
+  /* Get the header entry and look for a plural specification.  */
+  nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
   EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
 
  out:
@@ -1412,10 +1273,23 @@ internal_function __libc_freeres_fn_section
 _nl_unload_domain (domain)
      struct loaded_domain *domain;
 {
+  size_t i;
+
   if (domain->plural != &__gettext_germanic_plural)
     __gettext_free_exp (domain->plural);
 
-  _nl_free_domain_conv (domain);
+  for (i = 0; i < domain->nconversions; i++)
+    {
+      struct converted_domain *convd = &domain->conversions[i];
+
+      free ((char *) convd->encoding);
+      if (convd->conv_tab != NULL && convd->conv_tab != (char **) -1)
+	free (convd->conv_tab);
+      if (convd->conv != (__gconv_t) -1)
+	__gconv_close (convd->conv);
+    }
+  if (domain->conversions != NULL)
+    free (domain->conversions);
 
   if (domain->malloced)
     free (domain->malloced);
diff --git a/intl/tst-gettext3.c b/intl/tst-gettext3.c
new file mode 100644
index 0000000000..917967b383
--- /dev/null
+++ b/intl/tst-gettext3.c
@@ -0,0 +1,60 @@
+/* Test that the gettext() results come out in the correct encoding for
+   locales that differ only in their encoding.
+   Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bruno Haible <bruno@clisp.org>, 2001, 2005.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <libintl.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main (void)
+{
+  char *s;
+  int result = 0;
+
+  unsetenv ("LANGUAGE");
+  unsetenv ("OUTPUT_CHARSET");
+  textdomain ("codeset");
+  bindtextdomain ("codeset", OBJPFX "domaindir");
+
+  setlocale (LC_ALL, "de_DE.ISO-8859-1");
+
+  /* Here we expect output in ISO-8859-1.  */
+  s = gettext ("cheese");
+  if (strcmp (s, "K\344se"))
+    {
+      printf ("call 1 returned: %s\n", s);
+      result = 1;
+    }
+
+  setlocale (LC_ALL, "de_DE.UTF-8");
+
+  /* Here we expect output in UTF-8.  */
+  s = gettext ("cheese");
+  if (strcmp (s, "K\303\244se"))
+    {
+      printf ("call 2 returned: %s\n", s);
+      result = 1;
+    }
+
+  return result;
+}
diff --git a/intl/tst-gettext3.sh b/intl/tst-gettext3.sh
new file mode 100644
index 0000000000..7bd977cf2d
--- /dev/null
+++ b/intl/tst-gettext3.sh
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Test that the gettext() results come out in the correct encoding for
+# locales that differ only in their encoding.
+# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+common_objpfx=$1
+objpfx=$2
+
+LC_ALL=C
+export LC_ALL
+
+# Generate the test data.
+test -d ${objpfx}domaindir || mkdir ${objpfx}domaindir
+# Create the domain directories.
+test -d ${objpfx}domaindir/de_DE || mkdir ${objpfx}domaindir/de_DE
+test -d ${objpfx}domaindir/de_DE/LC_MESSAGES || mkdir ${objpfx}domaindir/de_DE/LC_MESSAGES
+# Populate them.
+msgfmt -o ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo tstcodeset.po
+
+GCONV_PATH=${common_objpfx}iconvdata
+export GCONV_PATH
+LOCPATH=${common_objpfx}localedata
+export LOCPATH
+
+${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${objpfx}tst-gettext3 > ${objpfx}tst-gettext3.out
+
+exit $?
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index 644d503a1f..e068848919 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -125,8 +125,9 @@ xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap)
       INTUSE(xdr_u_long) (xdrs, &(cap->vers)) &&
       INTUSE(xdr_u_long) (xdrs, &(cap->proc)))
     {
+      u_long dummy_arglen = 0;
       lenposition = XDR_GETPOS (xdrs);
-      if (!INTUSE(xdr_u_long) (xdrs, &(cap->arglen)))
+      if (!INTUSE(xdr_u_long) (xdrs, &dummy_arglen))
 	return FALSE;
       argposition = XDR_GETPOS (xdrs);
       if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr))
diff --git a/timezone/antarctica b/timezone/antarctica
index b5c12cbaee..ad47860bd6 100644
--- a/timezone/antarctica
+++ b/timezone/antarctica
@@ -1,4 +1,4 @@
-# @(#)antarctica	7.23
+# @(#)antarctica	7.24
 
 # From Paul Eggert (1999-11-15):
 # To keep things manageable, we list only locations occupied year-round; see
@@ -90,19 +90,19 @@ Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
 # </a>
 
 # Brazil - year-round base
-# Ferraz, King George Island, since 1983/4
+# Comandante Ferraz, King George Island, -6205+05824, since 1983/4
 
 # Chile - year-round bases and towns
 # Escudero, South Shetland Is, -621157-0585735, since 1994
-# Frei, King George Island, -6214-05848, since 1969-03-07
-# O'Higgins, Antarctic Peninsula, -6319-05704, since 1948-02
-# Prat, -6230-05941
-# Villa Las Estrellas (a town), King George Island, since 1984-04-09
+# Presidente Eduadro Frei, King George Island, -6214-05848, since 1969-03-07
+# General Bernardo O'Higgins, Antarctic Peninsula, -6319-05704, since 1948-02
+# Capitan Arturo Prat, -6230-05941
+# Villa Las Estrellas (a town), around the Frei base, since 1984-04-09
 # These locations have always used Santiago time; use TZ='America/Santiago'.
 
 # China - year-round bases
-# Great Wall, King George Island, since 1985-02-20
-# Zhongshan, Larsemann Hills, Prydz Bay, since 1989-02-26
+# Great Wall, King George Island, -6213-05858, since 1985-02-20
+# Zhongshan, Larsemann Hills, Prydz Bay, -6922+07623, since 1989-02-26
 
 # France - year-round bases
 #
@@ -145,14 +145,14 @@ Zone Antarctica/DumontDUrville 0 -	zzz	1947
 
 
 # Germany - year-round base
-# Georg von Neumayer
+# Georg von Neumayer, -7039-00815
 
 # India - year-round base
-# Dakshin Gangotri
+# Dakshin Gangotri, -7005+01200
 
 # Japan - year-round bases
-# Dome Fuji
-# Syowa
+# Dome Fuji, -7719+03942
+# Syowa, -690022+0393524
 #
 # From Hideyuki Suzuki (1999-02-06):
 # In all Japanese stations, +0300 is used as the standard time.  [See]
@@ -171,7 +171,7 @@ Zone Antarctica/Syowa	0	-	zzz	1957 Jan 29
 # </a>
 
 # S Korea - year-round base
-# King Sejong, King George Island, since 1988
+# King Sejong, King George Island, -6213-05847, since 1988
 
 # New Zealand - claims
 # Balleny Islands (never inhabited)
@@ -202,7 +202,8 @@ Rule	NZAQ	1990	max	-	Mar	Sun>=15	2:00s	0	S
 # Russia - year-round bases
 # Bellingshausen, King George Island, -621159-0585337, since 1968-02-22
 # Mirny, Davis coast, -6633+09301, since 1956-02
-# Molodezhnaya, Alasheyev Bay, year-round from 1962-02 to 1999-07-01
+# Molodezhnaya, Alasheyev Bay, -6740+04551,
+#	year-round from 1962-02 to 1999-07-01
 # Novolazarevskaya, Queen Maud Land, -7046+01150,
 #	year-round from 1960/61 to 1992
 
@@ -234,8 +235,8 @@ Zone Antarctica/Vostok	0	-	zzz	1957 Dec 16
 			6:00	-	VOST	# Vostok time
 
 # S Africa - year-round bases
-# Marion Island
-# Sanae
+# Marion Island, -4653+03752
+# Sanae, -7141-00250
 
 # UK
 #
diff --git a/timezone/asia b/timezone/asia
index 32e6e3c45f..915014c7e8 100644
--- a/timezone/asia
+++ b/timezone/asia
@@ -1,4 +1,4 @@
-# @(#)asia	7.78
+# @(#)asia	7.81
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -107,7 +107,7 @@ Zone	Asia/Baku	3:19:24 -	LMT	1924 May  2
 			3:00	-	BAKT	1957 Mar    # Baku Time
 			4:00 RussiaAsia BAK%sT	1991 Mar 31 2:00s
 			3:00	1:00	BAKST	1991 Aug 30 # independence
-			3:00 RussiaAsia	AZ%sT	1992 Sep lastSun 2:00s
+			3:00 RussiaAsia	AZ%sT	1992 Sep lastSat 23:00
 			4:00	-	AZT	1996 # Azerbaijan time
 			4:00	EUAsia	AZ%sT	1997
 			4:00	Azer	AZ%sT
@@ -137,8 +137,12 @@ Zone	Asia/Thimphu	5:58:36 -	LMT	1947 Aug 15 # or Thimbu
 # British Indian Ocean Territory
 # Whitman and the 1995 CIA time zone map say 5:00, but the
 # 1997 and later maps say 6:00.  Assume the switch occurred in 1996.
+# We have no information as to when standard time was introduced;
+# assume it occurred in 1907, the same year as Mauritius (which
+# then contained the Chagos Archipelago).
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Chagos	5:00	-	IOT	1996 # BIOT Time
+Zone	Indian/Chagos	4:49:40	-	LMT	1907
+			5:00	-	IOT	1996 # BIOT Time
 			6:00	-	IOT
 
 # Brunei
@@ -337,7 +341,7 @@ Link	Asia/Nicosia	Europe/Nicosia
 # President Eduard Shevardnadze decreed Wednesday.
 #
 # From the BBC via Joseph S. Myers (2004-06-27):
-#  	
+#
 # Georgia moved closer to Western Europe on Sunday...  The former Soviet
 # republic has changed its time zone back to that of Moscow.  As a result it
 # is now just four hours ahead of Greenwich Mean Time, rather than five hours
@@ -639,7 +643,8 @@ Rule	Zion	1988	only	-	Apr	 9	0:00	1:00	D
 Rule	Zion	1988	only	-	Sep	 3	0:00	0	S
 
 # From Ephraim Silverberg <ephraim@cs.huji.ac.il>
-# (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, and 2004-12-22):
+# (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,
+# and 2005-02-17):
 
 # According to the Office of the Secretary General of the Ministry of
 # Interior, there is NO set rule for Daylight-Savings/Standard time changes.
@@ -735,91 +740,74 @@ Rule	Zion	2003	only	-	Oct	 3	1:00	0	S
 Rule	Zion	2004	only	-	Apr	 7	1:00	1:00	D
 Rule	Zion	2004	only	-	Sep	22	1:00	0	S
 
-# Yesterday, the Knesset Interior Committee passed a proposed (originally
-# in March 2004) change to the Time Setting Law that would make the dates
-# for DST from 2005 and beyond so that DST starts on the night _after_ the
-# first night of the Passover holiday at midnight until midnight of the
-# Saturday night _before_ the fast of Yom Kippur.
+# The proposed law agreed upon by the Knesset Interior Committee on
+# 2005-02-14 is that, for 2005 and beyond, DST starts at 02:00 the
+# last Friday before April 2nd (i.e. the last Friday in March or April
+# 1st itself if it falls on a Friday) and ends at 02:00 on the Saturday
+# night _before_ the fast of Yom Kippur.
+#
+# Those who can read Hebrew can view the announcement at:
 #
-# Those who can read Hebrew can view the proposal at:
+#	ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2005+beyond.ps
+
+# From Paul Eggert (2005-02-22):
+# I used Ephraim Silverberg's dst-israel.el program
+# <ftp://ftp.cs.huji.ac.il/pub/tz/software/dst-israel.el> (2005-02-20)
+# along with Ed Reingold's cal-hebrew in GNU Emacs 21.4,
+# to generate the transitions in this list.
+# (I replaced "lastFri" with "Fri>=26" by hand.)
+# The spring transitions below all correspond to the following Rule:
 #
-#	ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2005+.ps
+# Rule	Zion	2005	max	-	Mar	Fri>=26	2:00	1:00	D
 #
-# The proposal still has to be passed by the Knesset (three readings) for
-# it to become law....
+# but older zic implementations (e.g., Solaris 8) do not support
+# "Fri>=26" to mean April 1 in years like 2005, so for now we list the
+# springtime transitions explicitly.
 
-# From Paul Eggert (2004-12-22):
-# For now, guess that the rules proposed on 2004-12-20 will be adopted.
-# This is quite possibly wrong, but it is more likely than no DST at all.
-# I used Ed Reingold's cal-hebrew in GNU Emacs 21.3, along with code
-# written by Ephraim Silverberg, to generate this list.
-# Rule	NAME    FROM    TO      TYPE    IN      ON      AT      SAVE    LETTER/S
-Rule	Zion	2005	only	-	Apr	25	0:00	1:00	D
-Rule	Zion	2005	only	-	Oct	 9	0:00	0	S
-Rule	Zion	2006	only	-	Apr	14	0:00	1:00	D
-Rule	Zion	2006	only	-	Oct	 1	0:00	0	S
-Rule	Zion	2007	only	-	Apr	 4	0:00	1:00	D
-Rule	Zion	2007	only	-	Sep	16	0:00	0	S
-Rule	Zion	2008	only	-	Apr	21	0:00	1:00	D
-Rule	Zion	2008	only	-	Oct	 5	0:00	0	S
-Rule	Zion	2009	only	-	Apr	10	0:00	1:00	D
-Rule	Zion	2009	only	-	Sep	27	0:00	0	S
-Rule	Zion	2010	only	-	Mar	31	0:00	1:00	D
-Rule	Zion	2010	only	-	Sep	12	0:00	0	S
-Rule	Zion	2011	only	-	Apr	20	0:00	1:00	D
-Rule	Zion	2011	only	-	Oct	 2	0:00	0	S
-Rule	Zion	2012	only	-	Apr	 8	0:00	1:00	D
-Rule	Zion	2012	only	-	Sep	23	0:00	0	S
-Rule	Zion	2013	only	-	Mar	27	0:00	1:00	D
-Rule	Zion	2013	only	-	Sep	 8	0:00	0	S
-Rule	Zion	2014	only	-	Apr	16	0:00	1:00	D
-Rule	Zion	2014	only	-	Sep	28	0:00	0	S
-Rule	Zion	2015	only	-	Apr	 5	0:00	1:00	D
-Rule	Zion	2015	only	-	Sep	20	0:00	0	S
-Rule	Zion	2016	only	-	Apr	24	0:00	1:00	D
-Rule	Zion	2016	only	-	Oct	 9	0:00	0	S
-Rule	Zion	2017	only	-	Apr	12	0:00	1:00	D
-Rule	Zion	2017	only	-	Sep	24	0:00	0	S
-Rule	Zion	2018	only	-	Apr	 1	0:00	1:00	D
-Rule	Zion	2018	only	-	Sep	16	0:00	0	S
-Rule	Zion	2019	only	-	Apr	21	0:00	1:00	D
-Rule	Zion	2019	only	-	Oct	 6	0:00	0	S
-Rule	Zion	2020	only	-	Apr	10	0:00	1:00	D
-Rule	Zion	2020	only	-	Sep	27	0:00	0	S
-Rule	Zion	2021	only	-	Mar	29	0:00	1:00	D
-Rule	Zion	2021	only	-	Sep	12	0:00	0	S
-Rule	Zion	2022	only	-	Apr	17	0:00	1:00	D
-Rule	Zion	2022	only	-	Oct	 2	0:00	0	S
-Rule	Zion	2023	only	-	Apr	 7	0:00	1:00	D
-Rule	Zion	2023	only	-	Sep	24	0:00	0	S
-Rule	Zion	2024	only	-	Apr	24	0:00	1:00	D
-Rule	Zion	2024	only	-	Oct	 6	0:00	0	S
-Rule	Zion	2025	only	-	Apr	14	0:00	1:00	D
-Rule	Zion	2025	only	-	Sep	28	0:00	0	S
-Rule	Zion	2026	only	-	Apr	 3	0:00	1:00	D
-Rule	Zion	2026	only	-	Sep	20	0:00	0	S
-Rule	Zion	2027	only	-	Apr	23	0:00	1:00	D
-Rule	Zion	2027	only	-	Oct	10	0:00	0	S
-Rule	Zion	2028	only	-	Apr	12	0:00	1:00	D
-Rule	Zion	2028	only	-	Sep	24	0:00	0	S
-Rule	Zion	2029	only	-	Apr	 1	0:00	1:00	D
-Rule	Zion	2029	only	-	Sep	16	0:00	0	S
-Rule	Zion	2030	only	-	Apr	19	0:00	1:00	D
-Rule	Zion	2030	only	-	Oct	 6	0:00	0	S
-Rule	Zion	2031	only	-	Apr	 9	0:00	1:00	D
-Rule	Zion	2031	only	-	Sep	21	0:00	0	S
-Rule	Zion	2032	only	-	Mar	28	0:00	1:00	D
-Rule	Zion	2032	only	-	Sep	12	0:00	0	S
-Rule	Zion	2033	only	-	Apr	15	0:00	1:00	D
-Rule	Zion	2033	only	-	Oct	 2	0:00	0	S
-Rule	Zion	2034	only	-	Apr	 5	0:00	1:00	D
-Rule	Zion	2034	only	-	Sep	17	0:00	0	S
-Rule	Zion	2035	only	-	Apr	25	0:00	1:00	D
-Rule	Zion	2035	only	-	Oct	 7	0:00	0	S
-Rule	Zion	2036	only	-	Apr	13	0:00	1:00	D
-Rule	Zion	2036	only	-	Sep	28	0:00	0	S
-Rule	Zion	2037	only	-	Apr	 1	0:00	1:00	D
-Rule	Zion	2037	only	-	Sep	13	0:00	0	S
+# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule	Zion	2005	only	-	Apr	 1	2:00	1:00	D
+Rule	Zion	2005	only	-	Oct	 9	2:00	0	S
+Rule	Zion	2006	2010	-	Mar	Fri>=26	2:00	1:00	D
+Rule	Zion	2006	only	-	Oct	 1	2:00	0	S
+Rule	Zion	2007	only	-	Sep	16	2:00	0	S
+Rule	Zion	2008	only	-	Oct	 5	2:00	0	S
+Rule	Zion	2009	only	-	Sep	27	2:00	0	S
+Rule	Zion	2010	only	-	Sep	12	2:00	0	S
+Rule	Zion	2011	only	-	Apr	 1	2:00	1:00	D
+Rule	Zion	2011	only	-	Oct	 2	2:00	0	S
+Rule	Zion	2012	2015	-	Mar	Fri>=26	2:00	1:00	D
+Rule	Zion	2012	only	-	Sep	23	2:00	0	S
+Rule	Zion	2013	only	-	Sep	 8	2:00	0	S
+Rule	Zion	2014	only	-	Sep	28	2:00	0	S
+Rule	Zion	2015	only	-	Sep	20	2:00	0	S
+Rule	Zion	2016	only	-	Apr	 1	2:00	1:00	D
+Rule	Zion	2016	only	-	Oct	 9	2:00	0	S
+Rule	Zion	2017	2021	-	Mar	Fri>=26	2:00	1:00	D
+Rule	Zion	2017	only	-	Sep	24	2:00	0	S
+Rule	Zion	2018	only	-	Sep	16	2:00	0	S
+Rule	Zion	2019	only	-	Oct	 6	2:00	0	S
+Rule	Zion	2020	only	-	Sep	27	2:00	0	S
+Rule	Zion	2021	only	-	Sep	12	2:00	0	S
+Rule	Zion	2022	only	-	Apr	 1	2:00	1:00	D
+Rule	Zion	2022	only	-	Oct	 2	2:00	0	S
+Rule	Zion	2023	2032	-	Mar	Fri>=26	2:00	1:00	D
+Rule	Zion	2023	only	-	Sep	24	2:00	0	S
+Rule	Zion	2024	only	-	Oct	 6	2:00	0	S
+Rule	Zion	2025	only	-	Sep	28	2:00	0	S
+Rule	Zion	2026	only	-	Sep	20	2:00	0	S
+Rule	Zion	2027	only	-	Oct	10	2:00	0	S
+Rule	Zion	2028	only	-	Sep	24	2:00	0	S
+Rule	Zion	2029	only	-	Sep	16	2:00	0	S
+Rule	Zion	2030	only	-	Oct	 6	2:00	0	S
+Rule	Zion	2031	only	-	Sep	21	2:00	0	S
+Rule	Zion	2032	only	-	Sep	12	2:00	0	S
+Rule	Zion	2033	only	-	Apr	 1	2:00	1:00	D
+Rule	Zion	2033	only	-	Oct	 2	2:00	0	S
+Rule	Zion	2034	2037	-	Mar	Fri>=26	2:00	1:00	D
+Rule	Zion	2034	only	-	Sep	17	2:00	0	S
+Rule	Zion	2035	only	-	Oct	 7	2:00	0	S
+Rule	Zion	2036	only	-	Sep	28	2:00	0	S
+Rule	Zion	2037	only	-	Sep	13	2:00	0	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Jerusalem	2:20:56 -	LMT	1880
@@ -939,6 +927,13 @@ Zone	Asia/Amman	2:23:44 -	LMT	1931
 # - Qyzylorda switched from +5:00 to +6:00 on 1992-01-19 02:00.
 # - Oral switched from +5:00 to +4:00 in spring 1989.
 #
+# <a href="http://www.kazsociety.org.uk/news/2005/03/30.htm">
+# From Kazakhstan Embassy's News Bulletin #11 (2005-03-21):
+# </a>
+# The Government of Kazakhstan passed a resolution March 15 abolishing
+# daylight saving time citing lack of economic benefits and health
+# complications coupled with a decrease in productivity.
+#
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
@@ -947,7 +942,8 @@ Zone	Asia/Almaty	5:07:48 -	LMT	1924 May  2 # or Alma-Ata
 			5:00	-	ALMT	1930 Jun 21 # Alma-Ata Time
 			6:00 RussiaAsia ALM%sT	1991
 			6:00	-	ALMT	1992
-			6:00 RussiaAsia	ALM%sT
+			6:00 RussiaAsia	ALM%sT	2005 Mar 15
+			6:00	-	ALMT
 # Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.)
 Zone	Asia/Qyzylorda	4:21:52 -	LMT	1924 May  2
 			4:00	-	KIZT	1930 Jun 21 # Kizilorda Time
@@ -957,7 +953,8 @@ Zone	Asia/Qyzylorda	4:21:52 -	LMT	1924 May  2
 			5:00 RussiaAsia	KIZ%sT	1991
 			5:00	-	KIZT	1991 Dec 16 # independence
 			5:00	-	QYZT	1992 Jan 19 2:00
-			6:00 RussiaAsia	QYZ%sT
+			6:00 RussiaAsia	QYZ%sT	2005 Mar 15
+			6:00	-	QYZT
 # Aqtobe (aka Aktobe, formerly Akt'ubinsk)
 Zone	Asia/Aqtobe	3:48:40	-	LMT	1924 May  2
 			4:00	-	AKTT	1930 Jun 21 # Aktyubinsk Time
@@ -966,7 +963,8 @@ Zone	Asia/Aqtobe	3:48:40	-	LMT	1924 May  2
 			6:00	-	AKTT	1982 Apr  1
 			5:00 RussiaAsia	AKT%sT	1991
 			5:00	-	AKTT	1991 Dec 16 # independence
-			5:00 RussiaAsia	AQT%sT	# Aqtobe Time
+			5:00 RussiaAsia	AQT%sT	2005 Mar 15 # Aqtobe Time
+			5:00	-	AQTT
 # Mangghystau
 # Aqtau was not founded until 1963, but it represents an inhabited region,
 # so include time stamps before 1963.
@@ -978,7 +976,8 @@ Zone	Asia/Aqtau	3:21:04	-	LMT	1924 May  2
 			5:00 RussiaAsia	SHE%sT	1991
 			5:00	-	SHET	1991 Dec 16 # independence
 			5:00 RussiaAsia	AQT%sT	1995 Mar lastSun 2:00 # Aqtau Time
-			4:00 RussiaAsia	AQT%sT
+			4:00 RussiaAsia	AQT%sT	2005 Mar 15
+			4:00	-	AQTT
 # West Kazakhstan
 Zone	Asia/Oral	3:25:24	-	LMT	1924 May  2 # or Ural'sk
 			4:00	-	URAT	1930 Jun 21 # Ural'sk time
@@ -988,7 +987,8 @@ Zone	Asia/Oral	3:25:24	-	LMT	1924 May  2 # or Ural'sk
 			5:00 RussiaAsia	URA%sT	1989 Mar 26 2:00
 			4:00 RussiaAsia	URA%sT	1991
 			4:00	-	URAT	1991 Dec 16 # independence
-			4:00 RussiaAsia	ORA%sT	# Oral Time
+			4:00 RussiaAsia	ORA%sT	2005 Mar 15 # Oral Time
+			4:00	-	ORAT
 
 # Kyrgyzstan (Kirgizstan)
 # Transitions through 1991 are from Shanks.
diff --git a/timezone/australasia b/timezone/australasia
index d8a8e36d53..41c7368852 100644
--- a/timezone/australasia
+++ b/timezone/australasia
@@ -1,4 +1,4 @@
-# @(#)australasia	7.69
+# @(#)australasia	7.71
 # This file also includes Pacific islands.
 
 # Notes are at the end of this file
@@ -199,9 +199,11 @@ Zone Pacific/Rarotonga	-10:39:04 -	LMT	1901		# Avarua
 			-10:00	Cook	CK%sT
 
 # Cocos
-# From USNO (1989):
+# These islands were ruled by the Ross family from about 1830 to 1978.
+# We don't know when standard time was introduced; for now, we guess 1900.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Cocos	6:30	-	CCT	# Cocos Islands Time
+Zone	Indian/Cocos	6:27:40	-	LMT	1900
+			6:30	-	CCT	# Cocos Islands Time
 
 # Fiji
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -381,11 +383,11 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1879 Jul  5
 			-11:00	-	BST	1983 Nov 30	# B=Bering
 			-11:00	-	SST			# S=Samoa
 
-# W Samoa
+# Samoa
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
-			-11:00	-	WST			# W Samoa Time
+			-11:00	-	WST			# Samoa Time
 
 # Solomon Is
 # excludes Bougainville, for which see Papua New Guinea
@@ -434,6 +436,17 @@ Zone Pacific/Johnston	-10:00	-	HST
 # uninhabited
 
 # Midway
+#
+# From Mark Brader (2005-01-23):
+# [Fallacies and Fantasies of Air Transport History, by R.E.G. Davies,
+# published 1994 by Paladwr Press, McLean, VA, USA; ISBN 0-9626483-5-3]
+# reproduced a Pan American Airways timeables from 1936, for their weekly
+# "Orient Express" flights between San Francisco and Manila, and connecting
+# flights to Chicago and the US East Coast.  As it uses some time zone
+# designations that I've never seen before:....
+# Fri. 6:30A Lv. HONOLOLU (Pearl Harbor), H.I.   H.L.T. Ar. 5:30P Sun.
+#  "   3:00P Ar. MIDWAY ISLAND . . . . . . . . . M.L.T. Lv. 6:00A  "
+#
 Zone Pacific/Midway	-11:49:28 -	LMT	1901
 			-11:00	-	NST	1956 Jun  3
 			-11:00	1:00	NDT	1956 Sep  2
@@ -1336,3 +1349,11 @@ Zone	Pacific/Wallis	12:15:20 -	LMT	1901
 # places as late as fourteen hours later than UTC.  And, since the IDL is not
 # an international standard, there are some places on the high seas where the
 # correct date is ambiguous.
+
+# From Paul Eggert, using references suggested by Oscar van Vlijmen
+# (2005-03-20):
+#
+# The American Practical Navigator (2002)
+# <http://pollux.nss.nima.mil/pubs/pubs_j_apn_sections.html?rid=187>
+# talks only about the 180-degree meridian with respect to ships in
+# international waters; it ignores the international date line.
diff --git a/timezone/etcetera b/timezone/etcetera
index f87a76ea48..431206ec3d 100644
--- a/timezone/etcetera
+++ b/timezone/etcetera
@@ -1,10 +1,11 @@
-# @(#)etcetera	7.11
+# @(#)etcetera	7.12
 
 # These entries are mostly present for historical reasons, so that
 # people in areas not otherwise covered by the tz files could "zic -l"
 # to a time zone that was right for their area.  These days, the
-# tz files cover almost all the inhabited world, so there's little
-# need now for the entries that are not on UTC.
+# tz files cover almost all the inhabited world, and the only practical
+# need now for the entries that are not on UTC are for ships at sea
+# that cannot use POSIX TZ settings.
 
 Zone	Etc/GMT		0	-	GMT
 Zone	Etc/UTC		0	-	UTC
diff --git a/timezone/europe b/timezone/europe
index 2da2df16db..3bf1b1ab02 100644
--- a/timezone/europe
+++ b/timezone/europe
@@ -1,4 +1,4 @@
-# @(#)europe	7.91
+# @(#)europe	7.92
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -255,6 +255,35 @@
 #   "Timeball on the ballast office is down.  Dunsink time."
 #   -- James Joyce, Ulysses
 
+# From Joseph S. Myers (2005-01-26):
+# Irish laws are available online at www.irishstatutebook.ie.  These include 
+# various relating to legal time, for example:
+# 
+# ZZA13Y1923.html ZZA12Y1924.html ZZA8Y1925.html ZZSIV20PG1267.html
+# 
+# ZZSI71Y1947.html ZZSI128Y1948.html ZZSI23Y1949.html ZZSI41Y1950.html
+# ZZSI27Y1951.html ZZSI73Y1952.html
+# 
+# ZZSI11Y1961.html ZZSI232Y1961.html ZZSI182Y1962.html
+# ZZSI167Y1963.html ZZSI257Y1964.html ZZSI198Y1967.html
+# ZZA23Y1968.html ZZA17Y1971.html
+# 
+# ZZSI67Y1981.html ZZSI212Y1982.html ZZSI45Y1986.html
+# ZZSI264Y1988.html ZZSI52Y1990.html ZZSI371Y1992.html
+# ZZSI395Y1994.html ZZSI484Y1997.html ZZSI506Y2001.html
+#
+# [These are all relative to the root, e.g., the first is
+# <http://www.irishstatutebook.ie/ZZA13Y1923.html>.]
+# 
+# (These are those I found, but there could be more.  In any case these 
+# should allow various updates to the comments in the europe file to cover 
+# the laws applicable in Ireland.)
+# 
+# (Note that the time in the Republic of Ireland since 1968 has been defined 
+# in terms of standard time being GMT+1 with a period of winter time when it 
+# is GMT, rather than standard time being GMT with a period of summer time 
+# being GMT+1.)
+
 # From Paul Eggert (1999-03-28):
 # Clive Feather (<news:859845706.26043.0@office.demon.net>, 1997-03-31)
 # reports that Folkestone (Cheriton) Shuttle Terminal uses Concession Time
diff --git a/timezone/iso3166.tab b/timezone/iso3166.tab
index b17843ac8e..dad0d9d34a 100644
--- a/timezone/iso3166.tab
+++ b/timezone/iso3166.tab
@@ -1,6 +1,6 @@
 # ISO 3166 alpha-2 country codes
 #
-# @(#)iso3166.tab	1.15
+# @(#)iso3166.tab	1.16
 #
 # From Paul Eggert <eggert@twinsun.com> (2004-06-14):
 #
@@ -255,7 +255,7 @@ VI	Virgin Islands (US)
 VN	Vietnam
 VU	Vanuatu
 WF	Wallis & Futuna
-WS	Samoa (Western)
+WS	Samoa (western)
 YE	Yemen
 YT	Mayotte
 ZA	South Africa
diff --git a/timezone/leapseconds b/timezone/leapseconds
index 385ee66ebd..2966e760e3 100644
--- a/timezone/leapseconds
+++ b/timezone/leapseconds
@@ -1,4 +1,4 @@
-# @(#)leapseconds	7.18
+# @(#)leapseconds	7.19
 
 # Allowance for leapseconds added to each timezone file.
 
@@ -44,37 +44,37 @@ Leap	1995	Dec	31	23:59:60	+	S
 Leap	1997	Jun	30	23:59:60	+	S
 Leap	1998	Dec	31	23:59:60	+	S
 
-# 	INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
+#	INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
 # SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE
-# 
+#
 # SERVICE DE LA ROTATION TERRESTRE
 # OBSERVATOIRE DE PARIS
 # 61, Av. de l'Observatoire 75014 PARIS (France)
 # Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
 # Internet  : services.iers@obspm.fr
-# 
-# 						Paris, 21 July 2004
-# 
-# 
-# 						Bulletin C 28
-# 
-# 						To authorities responsible
-# 						for the measurement and
-# 						distribution of time
-# 
-# 			INFORMATION ON UTC - TAI
-# 
+#
+#						Paris, 21 July 2004
+#
+#
+#						Bulletin C 28
+#
+#						To authorities responsible
+#						for the measurement and
+#						distribution of time
+#
+#			INFORMATION ON UTC - TAI
+#
 # NO positive leap second will be introduced at the end of December 2004.
 # The difference between UTC and the International Atomic Time TAI is:
-# 
-# 	from 1999 January 1, 0h UTC, until further notice : UTC-TAI = -32 s
-# 
+#
+#	from 1999 January 1, 0h UTC, until further notice : UTC-TAI = -32 s
+#
 # Leap seconds can be introduced in UTC at the end of the months of December
 # or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
 # six months, either to announce a time step in UTC, or to confirm that there
 # will be no time step at the next possible date.
-# 
-# 					Daniel GAMBIS
-# 					Director
-# 					Earth Orientation Center of IERS
+#
+#					Daniel GAMBIS
+#					Director
+#					Earth Orientation Center of IERS
diff --git a/timezone/northamerica b/timezone/northamerica
index f9d2f6a447..2a58c95e66 100644
--- a/timezone/northamerica
+++ b/timezone/northamerica
@@ -1,4 +1,4 @@
-# @(#)northamerica	7.71
+# @(#)northamerica	7.72
 # also includes Central America and the Caribbean
 
 # This data is by no means authoritative; if you think you know better,
@@ -445,7 +445,7 @@ Link America/Denver America/Shiprock
 # Lemhi, Lincoln, Madison, Minidoka, Oneida, Owyhee, Payette, Power,
 # Teton, Twin Falls, Valley, Washington counties) and eastern Oregon
 # switched four weeks late in 1974.
-# 
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Boise	-7:44:49 -	LMT	1883 Nov 18 12:00
 			-8:00	US	P%sT	1923 May 13 2:00
diff --git a/timezone/scheck.c b/timezone/scheck.c
index 39feeba701..fd115f9c48 100644
--- a/timezone/scheck.c
+++ b/timezone/scheck.c
@@ -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 */
 
diff --git a/timezone/southamerica b/timezone/southamerica
index 2e9faf4934..6f3b081294 100644
--- a/timezone/southamerica
+++ b/timezone/southamerica
@@ -1,4 +1,4 @@
-# @(#)southamerica	7.57
+# @(#)southamerica	7.59
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -964,7 +964,7 @@ Zone America/Asuncion	-3:50:40 -	LMT	1890
 #
 # <a href="news:xrGmb.39935$gA1.13896113@news4.srv.hcvlny.cv.net">
 # From Evelyn C. Leeper via Mark Brader (2003-10-26):</a>
-# When we were in Peru in 1985-1986, they apparently switched over 
+# When we were in Peru in 1985-1986, they apparently switched over
 # sometime between December 29 and January 3 while we were on the Amazon.
 #
 # From Paul Eggert (2003-11-02):
@@ -1063,8 +1063,12 @@ Rule	Uruguay	1993	only	-	Feb	28	 0:00	0	-
 # From Eduardo Cota (2004-09-20):
 # The uruguayan government has decreed a change in the local time....
 # http://www.presidencia.gub.uy/decretos/2004091502.htm
-Rule	Uruguay	2004	only	-	Sep	Sun>=15	 0:00	1:00	S
-Rule	Uruguay	2005	only	-	Mar	Sun>=8	 0:00	0	-
+Rule	Uruguay	2004	only	-	Sep	19	 0:00	1:00	S
+# From Steffen Thorsen (2005-03-11):
+# Uruguay's DST was scheduled to end on Sunday, 2005-03-13, but in order to
+# save energy ... it was postponed two weeks....
+# http://www.presidencia.gub.uy/_Web/noticias/2005/03/2005031005.htm
+Rule	Uruguay	2005	only	-	Mar	27	 2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Montevideo	-3:44:44 -	LMT	1898 Jun 28
 			-3:44:44 -	MMT	1920 May  1	# Montevideo MT
diff --git a/timezone/tzfile.h b/timezone/tzfile.h
index 0e9966a950..2dad932ef4 100644
--- a/timezone/tzfile.h
+++ b/timezone/tzfile.h
@@ -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 */
diff --git a/timezone/zdump.c b/timezone/zdump.c
index bd7132698f..2fcce38c06 100644
--- a/timezone/zdump.c
+++ b/timezone/zdump.c
@@ -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)) {
diff --git a/timezone/zic.c b/timezone/zic.c
index d855475f9f..fb86fc69d2 100644
--- a/timezone/zic.c
+++ b/timezone/zic.c
@@ -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);
-
-			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)
+			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);
+					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))