about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog30
-rw-r--r--inet/getnetgrent_r.c6
-rw-r--r--locale/programs/charmap-dir.c10
-rw-r--r--locale/programs/charmap.c26
-rw-r--r--locale/programs/ld-address.c87
-rw-r--r--locale/programs/ld-collate.c56
-rw-r--r--locale/programs/ld-ctype.c230
-rw-r--r--locale/programs/ld-identification.c16
-rw-r--r--locale/programs/ld-measurement.c15
-rw-r--r--locale/programs/ld-messages.c30
-rw-r--r--locale/programs/ld-monetary.c44
-rw-r--r--locale/programs/ld-name.c21
-rw-r--r--locale/programs/ld-numeric.c19
-rw-r--r--locale/programs/ld-paper.c12
-rw-r--r--locale/programs/ld-telephone.c27
-rw-r--r--locale/programs/ld-time.c101
-rw-r--r--locale/programs/linereader.c10
-rw-r--r--locale/programs/linereader.h4
-rw-r--r--locale/programs/localedef.c35
-rw-r--r--locale/programs/localedef.h14
-rw-r--r--locale/programs/locfile.c16
-rw-r--r--locale/programs/repertoire.c12
22 files changed, 453 insertions, 368 deletions
diff --git a/ChangeLog b/ChangeLog
index 6492b83220..de582c5bc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,35 @@
 2002-02-05  Ulrich Drepper  <drepper@redhat.com>
 
+	* inet/getnetgrent_r.c (innetgr): Add int* parameter to getfct
+	definition and pass &errno in use of this variable.
+	Reported by Simon Wilkinson <simon@sxw.org.uk> [PR libc/2911].
+
+2002-02-04  Andreas Schwab  <schwab@suse.de>
+
+	* locale/programs/localedef.h (WITH_CUR_LOCALE): Define.
+	* locale/programs/charmap-dir.c: Wrap calls that output messages
+	with WITH_CUR_LOCALE.  Include "localedef.h" first.
+	* locale/programs/charmap.c: Likewise.
+	* locale/programs/ld-address.c: Likewise.
+	* locale/programs/ld-collate.c: Likewise.
+	* locale/programs/ld-ctype.c: Likewise.
+	* locale/programs/ld-identification.c: Likewise.
+	* locale/programs/ld-measurement.c: Likewise.
+	* locale/programs/ld-messages.c: Likewise.
+	* locale/programs/ld-monetary.c: Likewise.
+	* locale/programs/ld-name.c: Likewise.
+	* locale/programs/ld-numeric.c: Likewise.
+	* locale/programs/ld-paper.c: Likewise.
+	* locale/programs/ld-telephone.c: Likewise.
+	* locale/programs/ld-time.c: Likewise.
+	* locale/programs/linereader.c: Likewise.
+	* locale/programs/linereader.h: Likewise.
+	* locale/programs/localedef.c: Likewise.
+	* locale/programs/locfile.c: Likewise.
+	* locale/programs/repertoire.c: Likewise.
+
+2002-02-05  Ulrich Drepper  <drepper@redhat.com>
+
 	* elf/rtld.c (_dl_start_final): Determine load address to locate
 	ehdr with GL(dl_rtld_map).l_map_start.
 
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index 4c3a1cadfe..ba1019c1f8 100644
--- a/inet/getnetgrent_r.c
+++ b/inet/getnetgrent_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2002 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
@@ -298,7 +298,7 @@ innetgr (const char *netgroup, const char *host, const char *user,
 {
   int (*setfct) (const char *, struct __netgrent *);
   void (*endfct) (struct __netgrent *);
-  int (*getfct) (struct __netgrent *, char *, size_t);
+  int (*getfct) (struct __netgrent *, char *, size_t, int *);
   struct name_list *known = NULL;
   struct name_list *needed = NULL;
   int result = 0;
@@ -328,7 +328,7 @@ innetgr (const char *netgroup, const char *host, const char *user,
 	    {
 	      char buffer[1024];
 
-	      while ((*getfct) (&entry, buffer, sizeof buffer)
+	      while ((*getfct) (&entry, buffer, sizeof buffer, &errno)
 		     == NSS_STATUS_SUCCESS)
 		{
 		  if (entry.type == group_val)
diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
index 14cf765632..a7a453552b 100644
--- a/locale/programs/charmap-dir.c
+++ b/locale/programs/charmap-dir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002 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
@@ -28,11 +28,9 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
+#include "localedef.h"
 #include "charmap-dir.h"
 
-extern void *xmalloc (size_t n);
-extern void *xrealloc (void *p, size_t n);
-
 /* The data type of a charmap directory being traversed.  */
 struct charmap_dir
 {
@@ -58,8 +56,8 @@ charmap_opendir (const char *directory)
   dir = opendir (directory);
   if (dir == NULL)
     {
-      error (1, errno, gettext ("cannot read character map directory `%s'"),
-             directory);
+      WITH_CUR_LOCALE (error (1, errno, gettext ("\
+cannot read character map directory `%s'"), directory));
       return NULL;
     }
 
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
index 815a28d419..ee755ba50a 100644
--- a/locale/programs/charmap.c
+++ b/locale/programs/charmap.c
@@ -29,8 +29,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <error.h>
 
-#include "error.h"
+#include "localedef.h"
 #include "linereader.h"
 #include "charmap.h"
 #include "charmap-dir.h"
@@ -43,8 +44,6 @@
 #include "charmap-kw.h"
 
 
-extern void *xmalloc (size_t __n);
-
 /* Prototypes for local functions.  */
 static struct charmap_t *parse_charmap (struct linereader *cmfile,
 					int verbose, int be_quiet);
@@ -133,7 +132,8 @@ charmap_read (const char *filename, int verbose, int be_quiet, int use_default)
 	  result = parse_charmap (cmfile, verbose, be_quiet);
 
 	  if (result == NULL && !be_quiet)
-	    error (0, errno, _("character map file `%s' not found"), filename);
+	    WITH_CUR_LOCALE (error (0, errno, _("\
+character map file `%s' not found"), filename));
 	}
     }
 
@@ -190,8 +190,8 @@ charmap_read (const char *filename, int verbose, int be_quiet, int use_default)
 	result = parse_charmap (cmfile, verbose, be_quiet);
 
       if (result == NULL)
-	error (4, errno, _("default character map file `%s' not found"),
-	       DEFAULT_CHARMAP);
+	WITH_CUR_LOCALE (error (4, errno, _("\
+default character map file `%s' not found"), DEFAULT_CHARMAP));
     }
 
   /* Test of ASCII compatibility of locale encoding.
@@ -247,9 +247,9 @@ charmap_read (const char *filename, int verbose, int be_quiet, int use_default)
       while (*p++ != '\0');
 
       if (failed)
-	fprintf (stderr, _("\
+	WITH_CUR_LOCALE (fprintf (stderr, _("\
 character map `%s' is not ASCII compatible, locale not ISO C compliant\n"),
-		 result->code_set_name);
+				  result->code_set_name));
     }
 
   return result;
@@ -324,9 +324,9 @@ parse_charmap (struct linereader *cmfile, int verbose, int be_quiet)
 	      if (result->mb_cur_min > result->mb_cur_max)
 		{
 		  if (!be_quiet)
-		    error (0, 0, _("\
+		    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: <mb_cur_max> must be greater than <mb_cur_min>\n"),
-			   cmfile->fname);
+					    cmfile->fname));
 
 		  result->mb_cur_min = result->mb_cur_max;
 		}
@@ -829,14 +829,16 @@ only WIDTH definitions are allowed to follow the CHARMAP definition"));
 	  continue;
 
 	default:
-	  error (5, 0, _("%s: error in state machine"), __FILE__);
+	  WITH_CUR_LOCALE (error (5, 0, _("%s: error in state machine"),
+				  __FILE__));
 	  /* NOTREACHED */
 	}
       break;
     }
 
   if (state != 91 && !be_quiet)
-    error (0, 0, _("%s: premature end of file"), cmfile->fname);
+    WITH_CUR_LOCALE (error (0, 0, _("%s: premature end of file"),
+			    cmfile->fname));
 
   lr_close (cmfile);
 
diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c
index adf6bbeb28..52b91cfc28 100644
--- a/locale/programs/ld-address.c
+++ b/locale/programs/ld-address.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -29,6 +29,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -128,8 +129,8 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (address == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"),
-		   "LC_ADDRESS");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_ADDRESS"));
 	  address_startup (NULL, locale, 0);
 	  address = locale->categories[LC_ADDRESS].address;
 	  nothing = 1;
@@ -139,8 +140,8 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (address->postal_fmt == NULL)
     {
       if (! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_ADDRESS", "postal_fmt");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_ADDRESS", "postal_fmt"));
       /* Use as the default value the value of the i18n locale.  */
       address->postal_fmt = "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N";
     }
@@ -151,8 +152,8 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       const char *cp = address->postal_fmt;
 
       if (*cp == '\0')
-	error (0, 0, _("%s: field `%s' must not be empty"),
-	       "LC_ADDRESS", "postal_fmt");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
+				"LC_ADDRESS", "postal_fmt"));
       else
 	while (*cp != '\0')
 	  {
@@ -163,9 +164,9 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 		  ++cp;
 		if (strchr ("afdbshNtreCzTSc%", *cp) == NULL)
 		  {
-		    error (0, 0, _("\
+		    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: invalid escape `%%%c' sequence in field `%s'"),
-			   "LC_ADDRESS", *cp, "postal_fmt");
+					    "LC_ADDRESS", *cp, "postal_fmt"));
 		    break;
 		  }
 	      }
@@ -177,7 +178,8 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (address->cat == NULL)						      \
     {									      \
       if (verbose && ! nothing)						      \
-	error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", #cat);    \
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
+				"LC_ADDRESS", #cat));  	    		      \
       address->cat = "";						      \
     }
 
@@ -194,16 +196,16 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (address->lang_term == NULL)
     {
       if (verbose && ! nothing)
-	error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS",
-	       "lang_term");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_ADDRESS", "lang_term"));
       address->lang_term = "";
       cnt = sizeof (iso639) / sizeof (iso639[0]);
     }
   else if (address->lang_term[0] == '\0')
     {
       if (verbose)
-	error (0, 0, _("%s: field `%s' must not be empty"),
-	       "LC_ADDRESS", "lang_term");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
+				"LC_ADDRESS", "lang_term"));
       cnt = sizeof (iso639) / sizeof (iso639[0]);
     }
   else
@@ -213,22 +215,23 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	if (strcmp (address->lang_term, iso639[cnt].term) == 0)
 	  break;
       if (cnt == sizeof (iso639) / sizeof (iso639[0]))
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: terminology language code `%s' not defined"),
-	       "LC_ADDRESS", address->lang_term);
+				"LC_ADDRESS", address->lang_term));
     }
 
   if (address->lang_ab == NULL)
     {
       if (verbose && ! nothing)
-	error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "lang_ab");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_ADDRESS", "lang_ab"));
       address->lang_ab = "";
     }
   else if (address->lang_ab[0] == '\0')
     {
       if (verbose)
-	error (0, 0, _("%s: field `%s' must not be empty"),
-	       "LC_ADDRESS", "lang_ab");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
+				"LC_ADDRESS", "lang_ab"));
     }
   else
     {
@@ -239,15 +242,15 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	    if (strcmp (address->lang_ab, iso639[cnt].ab) == 0)
 	      break;
 	  if (cnt == sizeof (iso639) / sizeof (iso639[0]))
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: language abbreviation `%s' not defined"),
-		   "LC_ADDRESS", address->lang_ab);
+				    "LC_ADDRESS", address->lang_ab));
 	}
       else
 	if (strcmp (iso639[cnt].ab, address->lang_ab) != 0)
-	  error (0, 0, _("\
+	  WITH_CUR_LOCALE (error (0, 0, _("\
 %s: `%s' value does not match `%s' value"),
-		 "LC_ADDRESS", "lang_ab", "lang_term");
+				  "LC_ADDRESS", "lang_ab", "lang_term"));
     }
 
   if (address->lang_lib == NULL)
@@ -256,8 +259,8 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   else if (address->lang_lib[0] == '\0')
     {
       if (verbose)
-	error (0, 0, _("%s: field `%s' must not be empty"),
-	       "LC_ADDRESS", "lang_lib");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
+				"LC_ADDRESS", "lang_lib"));
     }
   else
     {
@@ -267,22 +270,22 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	    if (strcmp (address->lang_lib, iso639[cnt].lib) == 0)
 	      break;
 	  if (cnt == sizeof (iso639) / sizeof (iso639[0]))
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: language abbreviation `%s' not defined"),
-		   "LC_ADDRESS", address->lang_lib);
+				    "LC_ADDRESS", address->lang_lib));
 	}
       else
 	if (strcmp (iso639[cnt].ab, address->lang_ab) != 0)
-	  error (0, 0, _("\
+	  WITH_CUR_LOCALE (error (0, 0, _("\
 %s: `%s' value does not match `%s' value"), "LC_ADDRESS", "lang_lib",
-		 helper == 1 ? "lang_term" : "lang_ab");
+				  helper == 1 ? "lang_term" : "lang_ab"));
     }
 
   if (address->country_num == 0)
     {
       if (verbose && ! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_ADDRESS", "country_num");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_ADDRESS", "country_num"));
       cnt = sizeof (iso3166) / sizeof (iso3166[0]);
     }
   else
@@ -292,34 +295,36 @@ address_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	  break;
 
       if (cnt == sizeof (iso3166) / sizeof (iso3166[0]))
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: numeric country code `%d' not valid"),
-	       "LC_ADDRESS", address->country_num);
+				"LC_ADDRESS", address->country_num));
     }
 
   if (address->country_ab2 == NULL)
     {
       if (verbose && ! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_ADDRESS", "country_ab2");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_ADDRESS", "country_ab2"));
       address->country_ab2 = "  ";
     }
   else if (cnt != sizeof (iso3166) / sizeof (iso3166[0])
 	   && strcmp (address->country_ab2, iso3166[cnt].ab2) != 0)
-    error (0, 0, _("%s: `%s' value does not match `%s' value"),
-	   "LC_ADDRESS", "country_ab2", "country_num");
+    WITH_CUR_LOCALE (error (0, 0,
+			    _("%s: `%s' value does not match `%s' value"),
+			    "LC_ADDRESS", "country_ab2", "country_num"));
 
   if (address->country_ab3 == NULL)
     {
       if (verbose && ! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_ADDRESS", "country_ab3");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_ADDRESS", "country_ab3"));
       address->country_ab3 = "   ";
     }
   else if (cnt != sizeof (iso3166) / sizeof (iso3166[0])
 	   && strcmp (address->country_ab3, iso3166[cnt].ab3) != 0)
-    error (0, 0, _("%s: `%s' value does not match `%s' value"),
-	   "LC_ADDRESS", "country_ab3", "country_num");
+    WITH_CUR_LOCALE (error (0, 0, _("\
+%s: `%s' value does not match `%s' value"),
+			    "LC_ADDRESS", "country_ab3", "country_num"));
 }
 
 
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 0da1261bd8..b9ea186d31 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -27,11 +27,11 @@
 #include <wchar.h>
 #include <sys/param.h>
 
+#include "localedef.h"
 #include "charmap.h"
 #include "localeinfo.h"
 #include "linereader.h"
 #include "locfile.h"
-#include "localedef.h"
 #include "elem-hash.h"
 
 /* Uncomment the following line in the production version.  */
@@ -1516,7 +1516,8 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
     {
       /* No data, no check.  */
       if (! be_quiet)
-	error (0, 0, _("No definition for %s category found"), "LC_COLLATE");
+	WITH_CUR_LOCALE (error (0, 0, _("No definition for %s category found"),
+				"LC_COLLATE"));
       return;
     }
 
@@ -1531,9 +1532,9 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	  && ((sect->rules[i] & sort_position)
 	      != (collate->sections->rules[i] & sort_position)))
 	{
-	  error (0, 0, _("\
+	  WITH_CUR_LOCALE (error (0, 0, _("\
 %s: `position' must be used for a specific level in all sections or none"),
-		 "LC_COLLATE");
+				  "LC_COLLATE"));
 	  break;
 	}
 
@@ -1554,9 +1555,10 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 		  {
 		    if (runp->weights[i].w[j]->weights == NULL)
 		      {
-			error_at_line (0, 0, runp->file, runp->line,
-				       _("symbol `%s' not defined"),
-				       runp->weights[i].w[j]->name);
+			WITH_CUR_LOCALE (error_at_line (0, 0, runp->file,
+							runp->line,
+							_("symbol `%s' not defined"),
+							runp->weights[i].w[j]->name));
 
 			need_undefined = 1;
 			runp->weights[i].w[j] = &collate->undefined;
@@ -1629,11 +1631,14 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 		      /* This should not happen.  It means that we have
 			 to symbols with the same byte sequence.  It is
 			 of course an error.  */
-		      error_at_line (0, 0, (*eptr)->file, (*eptr)->line,
-				     _("symbol `%s' has the same encoding as"),
-				     (*eptr)->name);
-		      error_at_line (0, 0, runp->file, runp->line,
-				     _("symbol `%s'"), runp->name);
+		      WITH_CUR_LOCALE (error_at_line (0, 0, (*eptr)->file,
+						      (*eptr)->line,
+						      _("\
+symbol `%s' has the same encoding as"), (*eptr)->name);
+				       error_at_line (0, 0, runp->file,
+						      runp->line,
+						      _("symbol `%s'"),
+						      runp->name));
 		      goto dont_insert;
 		    }
 		  else if (c < 0)
@@ -1732,11 +1737,14 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 		      /* This should not happen.  It means that we have
 			 two symbols with the same byte sequence.  It is
 			 of course an error.  */
-		      error_at_line (0, 0, (*eptr)->file, (*eptr)->line,
-				     _("symbol `%s' has the same encoding as"),
-				     (*eptr)->name);
-		      error_at_line (0, 0, runp->file, runp->line,
-				     _("symbol `%s'"), runp->name);
+		      WITH_CUR_LOCALE (error_at_line (0, 0, (*eptr)->file,
+						      (*eptr)->line,
+						      _("\
+symbol `%s' has the same encoding as"), (*eptr)->name);
+				       error_at_line (0, 0, runp->file,
+						      runp->line,
+						      _("symbol `%s'"),
+						      runp->name));
 		      goto dont_insertwc;
 		    }
 		  else if (c < 0)
@@ -1777,7 +1785,7 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	  /* This seems not to be enforced by recent standards.  Don't
 	     emit an error, simply append UNDEFINED at the end.  */
 	  if (0)
-	    error (0, 0, _("no definition of `UNDEFINED'"));
+	    WITH_CUR_LOCALE (error (0, 0, _("no definition of `UNDEFINED'")));
 
 	  /* Add UNDEFINED at the end.  */
 	  collate->undefined.mborder =
@@ -3389,8 +3397,8 @@ error while adding equivalent collating symbol"));
 	    }
 	  else if (state == 3)
 	    {
-	      error (0, 0, _("%s: missing `reorder-end' keyword"),
-		     "LC_COLLATE");
+	      WITH_CUR_LOCALE (error (0, 0, _("\
+%s: missing `reorder-end' keyword"), "LC_COLLATE"));
 	      state = 4;
 	    }
 	  else if (state != 2 && state != 4)
@@ -3739,11 +3747,11 @@ error while adding equivalent collating symbol"));
 		    }
 		}
 	      else if (state == 3)
-		error (0, 0, _("%s: missing `reorder-end' keyword"),
-		       "LC_COLLATE");
+		WITH_CUR_LOCALE (error (0, 0, _("\
+%s: missing `reorder-end' keyword"), "LC_COLLATE"));
 	      else if (state == 5)
-		error (0, 0, _("%s: missing `reorder-sections-end' keyword"),
-		       "LC_COLLATE");
+		WITH_CUR_LOCALE (error (0, 0, _("\
+%s: missing `reorder-sections-end' keyword"), "LC_COLLATE"));
 	    }
 	  arg = lr_token (ldfile, charmap, result, NULL, verbose);
 	  if (arg->tok == tok_eof)
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index c1a92d861d..1026133dc2 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -33,13 +33,13 @@
 #include <wctype.h>
 #include <sys/uio.h>
 
+#include "localedef.h"
 #include "charmap.h"
 #include "localeinfo.h"
 #include "langinfo.h"
 #include "linereader.h"
 #include "locfile-token.h"
 #include "locfile.h"
-#include "localedef.h"
 
 #include <assert.h>
 
@@ -413,7 +413,8 @@ ctype_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (ctype == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"), "LC_CTYPE");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_CTYPE"));
 	  ctype_startup (NULL, locale, charmap, NULL, 0);
 	  ctype = locale->categories[LC_CTYPE].ctype;
 	}
@@ -431,7 +432,8 @@ ctype_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (ctype->codeset_name == NULL)
     {
       if (! be_quiet)
-	error (0, 0, _("No character set name specified in charmap"));
+	WITH_CUR_LOCALE (error (0, 0, _("\
+No character set name specified in charmap")));
       ctype->codeset_name = "//UNKNOWN//";
     }
 
@@ -459,11 +461,12 @@ ctype_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 			    uint32_t value = ctype->charnames[cnt];
 
 			    if (!be_quiet)
-			      error (0, 0, _("\
+			      WITH_CUR_LOCALE (error (0, 0, _("\
 character L'\\u%0*x' in class `%s' must be in class `%s'"),
-				     value > 0xffff ? 8 : 4, value,
-				     valid_table[cls1].name,
-				     valid_table[cls2].name);
+						      value > 0xffff ? 8 : 4,
+						      value,
+						      valid_table[cls1].name,
+						      valid_table[cls2].name));
 			  }
 			break;
 
@@ -473,11 +476,12 @@ character L'\\u%0*x' in class `%s' must be in class `%s'"),
 			    uint32_t value = ctype->charnames[cnt];
 
 			    if (!be_quiet)
-			      error (0, 0, _("\
+			      WITH_CUR_LOCALE (error (0, 0, _("\
 character L'\\u%0*x' in class `%s' must not be in class `%s'"),
-				     value > 0xffff ? 8 : 4, value,
-				     valid_table[cls1].name,
-				     valid_table[cls2].name);
+						      value > 0xffff ? 8 : 4,
+						      value,
+						      valid_table[cls1].name,
+						      valid_table[cls2].name));
 			  }
 			break;
 
@@ -486,8 +490,8 @@ character L'\\u%0*x' in class `%s' must not be in class `%s'"),
 			break;
 
 		      default:
-			error (5, 0, _("internal error in %s, line %u"),
-			       __FUNCTION__, __LINE__);
+			WITH_CUR_LOCALE (error (5, 0, _("\
+internal error in %s, line %u"), __FUNCTION__, __LINE__));
 		      }
 		  }
 	}
@@ -515,10 +519,11 @@ character L'\\u%0*x' in class `%s' must not be in class `%s'"),
 			    snprintf (buf, sizeof buf, "\\%Zo", cnt);
 
 			    if (!be_quiet)
-			      error (0, 0, _("\
+			      WITH_CUR_LOCALE (error (0, 0, _("\
 character '%s' in class `%s' must be in class `%s'"),
-				     buf, valid_table[cls1].name,
-				     valid_table[cls2].name);
+						      buf,
+						      valid_table[cls1].name,
+						      valid_table[cls2].name));
 			  }
 			break;
 
@@ -530,10 +535,11 @@ character '%s' in class `%s' must be in class `%s'"),
 			    snprintf (buf, sizeof buf, "\\%Zo", cnt);
 
 			    if (!be_quiet)
-			      error (0, 0, _("\
+			      WITH_CUR_LOCALE (error (0, 0, _("\
 character '%s' in class `%s' must not be in class `%s'"),
-				     buf, valid_table[cls1].name,
-				     valid_table[cls2].name);
+						      buf,
+						      valid_table[cls1].name,
+						      valid_table[cls2].name));
 			  }
 			break;
 
@@ -542,8 +548,8 @@ character '%s' in class `%s' must not be in class `%s'"),
 			break;
 
 		      default:
-			error (5, 0, _("internal error in %s, line %u"),
-			       __FUNCTION__, __LINE__);
+			WITH_CUR_LOCALE (error (5, 0, _("\
+internal error in %s, line %u"), __FUNCTION__, __LINE__));
 		      }
 		  }
 	}
@@ -559,8 +565,8 @@ character '%s' in class `%s' must not be in class `%s'"),
 	    & BITw (tok_blank)) == 0)))
     {
       if (!be_quiet)
-	error (0, 0, _("<SP> character not in class `%s'"),
-	       valid_table[cnt].name);
+	WITH_CUR_LOCALE (error (0, 0, _("<SP> character not in class `%s'"),
+				valid_table[cnt].name));
     }
   else if (((cnt = BITPOS (tok_punct),
 	     (ELEM (ctype, class_collection, , space_value)
@@ -571,8 +577,9 @@ character '%s' in class `%s' must not be in class `%s'"),
 		!= 0)))
     {
       if (!be_quiet)
-	error (0, 0, _("<SP> character must not be in class `%s'"),
-	       valid_table[cnt].name);
+	WITH_CUR_LOCALE (error (0, 0, _("\
+<SP> character must not be in class `%s'"),
+				valid_table[cnt].name));
     }
   else
     ELEM (ctype, class_collection, , space_value) |= BITw (tok_print);
@@ -585,7 +592,8 @@ character '%s' in class `%s' must not be in class `%s'"),
   if (space_seq == NULL || space_seq->nbytes != 1)
     {
       if (!be_quiet)
-	error (0, 0, _("character <SP> not defined in character map"));
+	WITH_CUR_LOCALE (error (0, 0, _("\
+character <SP> not defined in character map")));
     }
   else if (((cnt = BITPOS (tok_space),
 	     (ctype->class256_collection[space_seq->bytes[0]]
@@ -595,8 +603,8 @@ character '%s' in class `%s' must not be in class `%s'"),
 		 & BIT (tok_blank)) == 0)))
     {
       if (!be_quiet)
-	error (0, 0, _("<SP> character not in class `%s'"),
-	       valid_table[cnt].name);
+	WITH_CUR_LOCALE (error (0, 0, _("<SP> character not in class `%s'"),
+				valid_table[cnt].name));
     }
   else if (((cnt = BITPOS (tok_punct),
 	     (ctype->class256_collection[space_seq->bytes[0]]
@@ -606,8 +614,9 @@ character '%s' in class `%s' must not be in class `%s'"),
 		 & BIT (tok_graph)) != 0)))
     {
       if (!be_quiet)
-	error (0, 0, _("<SP> character must not be in class `%s'"),
-	       valid_table[cnt].name);
+	WITH_CUR_LOCALE (error (0, 0, _("\
+<SP> character must not be in class `%s'"),
+				valid_table[cnt].name));
     }
   else
     ctype->class256_collection[space_seq->bytes[0]] |= BIT (tok_print);
@@ -697,7 +706,8 @@ character '%s' in class `%s' must not be in class `%s'"),
       assert (ctype->mbdigits_act == ctype->wcdigits_act);
       ctype->wcdigits_act -= ctype->mbdigits_act % 10;
       ctype->mbdigits_act -= ctype->mbdigits_act % 10;
-      error (0, 0, _("`digit' category has not entries in groups of ten"));
+      WITH_CUR_LOCALE (error (0, 0, _("\
+`digit' category has not entries in groups of ten")));
     }
 
   /* Check the input digits.  There must be a multiple of ten available.
@@ -745,8 +755,8 @@ character '%s' in class `%s' must not be in class `%s'"),
 	      if (ctype->mbdigits[cnt] == NULL)
 		{
 		  /* Hum, this ain't good.  */
-		  error (0, 0, _("\
-no input digits defined and none of the standard names in the charmap"));
+		  WITH_CUR_LOCALE (error (0, 0, _("\
+no input digits defined and none of the standard names in the charmap")));
 
 		  ctype->mbdigits[cnt] = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool,
 							sizeof (struct charseq) + 1);
@@ -810,8 +820,8 @@ no input digits defined and none of the standard names in the charmap"));
 
 	if (!warned)
 	  {
-	    error (0, 0, _("\
-not all characters used in `outdigit' are available in the charmap"));
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+not all characters used in `outdigit' are available in the charmap")));
 	    warned = 1;
 	  }
 
@@ -827,8 +837,8 @@ not all characters used in `outdigit' are available in the charmap"));
       {
 	if (!warned)
 	  {
-	    error (0, 0, _("\
-not all characters used in `outdigit' are available in the repertoire"));
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+not all characters used in `outdigit' are available in the repertoire")));
 	    warned = 1;
 	  }
 
@@ -1227,9 +1237,9 @@ ctype_class_new (struct linereader *lr, struct locale_ctype_t *ctype,
 
   if (ctype->nr_charclass == MAX_NR_CHARCLASS)
     /* Exit code 2 is prescribed in P1003.2b.  */
-    error (2, 0, _("\
+    WITH_CUR_LOCALE (error (2, 0, _("\
 implementation limit: no more than %Zd character classes allowed"),
-	   MAX_NR_CHARCLASS);
+			    MAX_NR_CHARCLASS));
 
   ctype->classnames[ctype->nr_charclass++] = name;
 }
@@ -1259,9 +1269,9 @@ ctype_map_new (struct linereader *lr, struct locale_ctype_t *ctype,
 
   if (ctype->map_collection_nr == MAX_NR_CHARMAP)
     /* Exit code 2 is prescribed in P1003.2b.  */
-    error (2, 0, _("\
+    WITH_CUR_LOCALE (error (2, 0, _("\
 implementation limit: no more than %d character maps allowed"),
-	   MAX_NR_CHARMAP);
+			    MAX_NR_CHARMAP));
 
   ctype->mapnames[cnt] = name;
 
@@ -2824,10 +2834,11 @@ with character code range values one must use the absolute ellipsis `...'"));
 			    {
 			      lr_error (ldfile, _("\
 %s: duplicate `default_missing' definition"), "LC_CTYPE");
-			      error_at_line (0, 0, ctype->default_missing_file,
-					     ctype->default_missing_lineno,
-					     _("\
-previous definition was here"));
+			      WITH_CUR_LOCALE (error_at_line (0, 0,
+							      ctype->default_missing_file,
+							      ctype->default_missing_lineno,
+							      _("\
+previous definition was here")));
 			    }
 			  else
 			    {
@@ -3001,14 +3012,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
 	  if (seq == NULL)
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("\
+		WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined in charmap while needed as default value"),
-		       "LC_CTYPE", tmp);
+					"LC_CTYPE", tmp));
 	    }
 	  else if (seq->nbytes != 1)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-		   "LC_CTYPE", tmp);
+				    "LC_CTYPE", tmp));
 	  else
 	    ctype->class256_collection[seq->bytes[0]] |= bit;
 
@@ -3085,14 +3096,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		   "LC_CTYPE", "<space>");
+				    "LC_CTYPE", "<space>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<space>");
+				"LC_CTYPE", "<space>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
 
@@ -3105,14 +3116,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		   "LC_CTYPE", "<form-feed>");
+				    "LC_CTYPE", "<form-feed>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<form-feed>");
+				"LC_CTYPE", "<form-feed>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
 
@@ -3126,14 +3137,14 @@ set_class_defaults (struct locale_ctype_t *ctype,
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-		   "<newline>");
+				    "<newline>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<newline>");
+				"LC_CTYPE", "<newline>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
 
@@ -3147,14 +3158,14 @@ character `%s' not defined while needed as default value"),
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		   "LC_CTYPE", "<carriage-return>");
+				    "LC_CTYPE", "<carriage-return>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<carriage-return>");
+				"LC_CTYPE", "<carriage-return>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
 
@@ -3168,14 +3179,14 @@ character `%s' not defined while needed as default value"),
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		   "LC_CTYPE", "<tab>");
+				    "LC_CTYPE", "<tab>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<tab>");
+				"LC_CTYPE", "<tab>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
 
@@ -3189,14 +3200,14 @@ character `%s' not defined while needed as default value"),
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		   "LC_CTYPE", "<vertical-tab>");
+				    "LC_CTYPE", "<vertical-tab>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<vertical-tab>");
+				"LC_CTYPE", "<vertical-tab>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_space);
 
@@ -3229,14 +3240,14 @@ character `%s' not defined while needed as default value"),
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		   "LC_CTYPE", "<space>");
+				    "LC_CTYPE", "<space>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<space>");
+				"LC_CTYPE", "<space>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_blank);
 
@@ -3250,14 +3261,14 @@ character `%s' not defined while needed as default value"),
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		   "LC_CTYPE", "<tab>");
+				    "LC_CTYPE", "<tab>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<tab>");
+				"LC_CTYPE", "<tab>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_blank);
 
@@ -3317,14 +3328,14 @@ character `%s' not defined while needed as default value"),
       if (seq == NULL)
 	{
 	  if (!be_quiet)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		   "LC_CTYPE", "<space>");
+				    "LC_CTYPE", "<space>"));
 	}
       else if (seq->nbytes != 1)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' in charmap not representable with one byte"),
-	       "LC_CTYPE", "<space>");
+				"LC_CTYPE", "<space>"));
       else
 	ctype->class256_collection[seq->bytes[0]] |= BIT (tok_print);
 
@@ -3359,16 +3370,16 @@ character `%s' not defined while needed as default value"),
 	  if (seq_from == NULL)
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("\
+		WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-		       "LC_CTYPE", tmp);
+					"LC_CTYPE", tmp));
 	    }
 	  else if (seq_from->nbytes != 1)
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("\
+		WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' needed as default value not representable with one byte"),
-		       "LC_CTYPE", tmp);
+					"LC_CTYPE", tmp));
 	    }
 	  else
 	    {
@@ -3384,16 +3395,16 @@ character `%s' not defined while needed as default value"),
 	      if (seq_to == NULL)
 		{
 		  if (!be_quiet)
-		    error (0, 0, _("\
+		    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' not defined while needed as default value"),
-			   "LC_CTYPE", tmp);
+					    "LC_CTYPE", tmp));
 		}
 	      else if (seq_to->nbytes != 1)
 		{
 		  if (!be_quiet)
-		    error (0, 0, _("\
+		    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: character `%s' needed as default value not representable with one byte"),
-			   "LC_CTYPE", tmp);
+					    "LC_CTYPE", tmp));
 		}
 	      else
 		/* The index [0] is determined by the order of the
@@ -3425,8 +3436,9 @@ character `%s' not defined while needed as default value"),
   if (ctype->outdigits_act != 10)
     {
       if (ctype->outdigits_act != 0)
-	error (0,0, _("%s: field `%s' does not contain exactly ten entries"),
-	       "LC_CTYPE", "outdigit");
+	WITH_CUR_LOCALE (error (0, 0, _("\
+%s: field `%s' does not contain exactly ten entries"),
+				"LC_CTYPE", "outdigit"));
 
       for (cnt = ctype->outdigits_act; cnt < 10; ++cnt)
 	{
@@ -3445,8 +3457,8 @@ character `%s' not defined while needed as default value"),
 	  if (ctype->mboutdigits[cnt] == NULL)
 	    {
 	      /* Provide a replacement.  */
-	      error (0, 0, _("\
-no output digits defined and none of the standard names in the charmap"));
+	      WITH_CUR_LOCALE (error (0, 0, _("\
+no output digits defined and none of the standard names in the charmap")));
 
 	      ctype->mboutdigits[cnt] = obstack_alloc (&((struct charmap_t *) charmap)->mem_pool,
 						       sizeof (struct charseq)
@@ -3736,9 +3748,9 @@ translit_flatten (struct locale_ctype_t *ctype,
 
       if (other == NULL)
 	{
-	  error (0, 0, _("\
+	  WITH_CUR_LOCALE (error (0, 0, _("\
 %s: transliteration data from locale `%s' not available"),
-		 "LC_CTYPE", copy_locale);
+				  "LC_CTYPE", copy_locale));
 	}
       else
 	{
@@ -3832,9 +3844,10 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
       wctype_table_finalize (&t);
 
       if (verbose)
-	fprintf (stderr, _("%s: table for class \"%s\": %lu bytes\n"),
-		 "LC_CTYPE", ctype->classnames[nr],
-		 (unsigned long int) t.result_size);
+	WITH_CUR_LOCALE (fprintf (stderr, _("\
+%s: table for class \"%s\": %lu bytes\n"),
+				 "LC_CTYPE", ctype->classnames[nr],
+				 (unsigned long int) t.result_size));
 
       ctype->class_3level[nr].iov_base = t.result;
       ctype->class_3level[nr].iov_len = t.result_size;
@@ -3900,9 +3913,10 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
       wctrans_table_finalize (&t);
 
       if (verbose)
-	fprintf (stderr, _("%s: table for map \"%s\": %lu bytes\n"),
-		 "LC_CTYPE", ctype->mapnames[nr],
-		 (unsigned long int) t.result_size);
+	WITH_CUR_LOCALE (fprintf (stderr, _("\
+%s: table for map \"%s\": %lu bytes\n"),
+				 "LC_CTYPE", ctype->mapnames[nr],
+				 (unsigned long int) t.result_size));
 
       ctype->map_3level[nr].iov_base = t.result;
       ctype->map_3level[nr].iov_len = t.result_size;
@@ -4032,8 +4046,8 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
     wcwidth_table_finalize (&t);
 
     if (verbose)
-      fprintf (stderr, _("%s: table for width: %lu bytes\n"),
-	       "LC_CTYPE", (unsigned long int) t.result_size);
+      WITH_CUR_LOCALE (fprintf (stderr, _("%s: table for width: %lu bytes\n"),
+			       "LC_CTYPE", (unsigned long int) t.result_size));
 
     ctype->width.iov_base = t.result;
     ctype->width.iov_len = t.result_size;
diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c
index 74420fcde2..481e4e79c4 100644
--- a/locale/programs/ld-identification.c
+++ b/locale/programs/ld-identification.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -29,6 +29,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -130,8 +131,8 @@ identification_finish (struct localedef_t *locale,
       if (identification == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"),
-		   "LC_IDENTIFICATION");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_IDENTIFICATION"));
 	  identification_startup (NULL, locale, 0);
 	  identification
 	    = locale->categories[LC_IDENTIFICATION].identification;
@@ -143,8 +144,8 @@ identification_finish (struct localedef_t *locale,
   if (identification->cat == NULL)					      \
     {									      \
       if (verbose && ! nothing)						      \
-	error (0, 0, _("%s: field `%s' not defined"),			      \
-	       "LC_IDENTIFICATION", #cat);				      \
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
+			       	"LC_IDENTIFICATION", #cat));		      \
       identification->cat = "";						      \
     }
 
@@ -167,8 +168,9 @@ identification_finish (struct localedef_t *locale,
     if (num != LC_ALL && identification->category[num] == NULL)
       {
 	if (verbose && ! nothing)
-	  error (0, 0, _("%s: no identification for category `%s'"),
-		 "LC_IDENTIFICATION", category_name[num]);
+	  WITH_CUR_LOCALE (error (0, 0, _("\
+%s: no identification for category `%s'"),
+				  "LC_IDENTIFICATION", category_name[num]));
 	identification->category[num] = "";
       }
 }
diff --git a/locale/programs/ld-measurement.c b/locale/programs/ld-measurement.c
index f0b960d63d..75219bdf9f 100644
--- a/locale/programs/ld-measurement.c
+++ b/locale/programs/ld-measurement.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -28,6 +28,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -91,8 +92,8 @@ measurement_finish (struct localedef_t *locale,
       if (measurement == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"),
-		   "LC_MEASUREMENT");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_MEASUREMENT"));
 	  measurement_startup (NULL, locale, 0);
 	  measurement = locale->categories[LC_MEASUREMENT].measurement;
 	  nothing = 1;
@@ -102,16 +103,16 @@ measurement_finish (struct localedef_t *locale,
   if (measurement->measurement == 0)
     {
       if (! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_MEASUREMENT", "measurement");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_MEASUREMENT", "measurement"));
       /* Use as the default value the value of the i18n locale.  */
       measurement->measurement = 1;
     }
   else
     {
       if (measurement->measurement > 3)
-	error (0, 0, _("%s: invalid value for field `%s'"),
-	       "LC_MEASUREMENT", "measurement");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: invalid value for field `%s'"),
+				"LC_MEASUREMENT", "measurement"));
     }
 }
 
diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c
index b005cb5da2..fadf82757f 100644
--- a/locale/programs/ld-messages.c
+++ b/locale/programs/ld-messages.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -29,8 +29,8 @@
 
 #include <assert.h>
 
-#include "linereader.h"
 #include "localedef.h"
+#include "linereader.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -95,8 +95,8 @@ messages_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (messages == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"),
-		   "LC_MESSAGES");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_MESSAGES"));
 	  messages_startup (NULL, locale, 0);
 	  messages = locale->categories[LC_MESSAGES].messages;
 	  nothing = 1;
@@ -112,15 +112,16 @@ messages_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (messages->yesexpr == NULL)
     {
       if (! be_quiet && ! nothing)
-	error (0, 0, _("%s: field `%s' undefined"), "LC_MESSAGES", "yesexpr");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' undefined"),
+				"LC_MESSAGES", "yesexpr"));
       messages->yesexpr = "^[yY]";
     }
   else if (messages->yesexpr[0] == '\0')
     {
       if (!be_quiet)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value for field `%s' must not be an empty string"),
-	       "LC_MESSAGES", "yesexpr");
+				"LC_MESSAGES", "yesexpr"));
     }
   else
     {
@@ -134,9 +135,9 @@ messages_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	  char errbuf[BUFSIZ];
 
 	  (void) regerror (result, &re, errbuf, BUFSIZ);
-	  error (0, 0, _("\
+	  WITH_CUR_LOCALE (error (0, 0, _("\
 %s: no correct regular expression for field `%s': %s"),
-		 "LC_MESSAGES", "yesexpr", errbuf);
+				  "LC_MESSAGES", "yesexpr", errbuf));
 	}
       else if (result != 0)
 	regfree (&re);
@@ -145,15 +146,16 @@ messages_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (messages->noexpr == NULL)
     {
       if (! be_quiet && ! nothing)
-	error (0, 0, _("%s: field `%s' undefined"), "LC_MESSAGES", "noexpr");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' undefined"),
+				"LC_MESSAGES", "noexpr"));
       messages->noexpr = "^[nN]";
     }
   else if (messages->noexpr[0] == '\0')
     {
       if (!be_quiet)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value for field `%s' must not be an empty string"),
-	       "LC_MESSAGES", "noexpr");
+				"LC_MESSAGES", "noexpr"));
     }
   else
     {
@@ -167,9 +169,9 @@ messages_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	  char errbuf[BUFSIZ];
 
 	  (void) regerror (result, &re, errbuf, BUFSIZ);
-	  error (0, 0, _("\
+	  WITH_CUR_LOCALE (error (0, 0, _("\
 %s: no correct regular expression for field `%s': %s"),
-		 "LC_MESSAGES", "noexpr", errbuf);
+				  "LC_MESSAGES", "noexpr", errbuf));
 	}
       else if (result != 0)
 	regfree (&re);
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index 0cd9579f50..4bb7c0bba4 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -30,8 +30,8 @@
 
 #include <assert.h>
 
-#include "linereader.h"
 #include "localedef.h"
+#include "linereader.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -191,8 +191,8 @@ monetary_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (monetary == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"),
-		   "LC_MONETARY");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_MONETARY"));
 	  monetary_startup (NULL, locale, 0);
 	  monetary = locale->categories[LC_MONETARY].monetary;
 	  nothing = 1;
@@ -203,8 +203,8 @@ monetary_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (monetary->cat == NULL)						      \
     {									      \
       if (! be_quiet && ! nothing)					      \
-	error (0, 0, _("%s: field `%s' not defined"),			      \
-	       "LC_MONETARY", #cat);					      \
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
+				"LC_MONETARY", #cat));			      \
       monetary->cat = initval;						      \
     }
 
@@ -221,18 +221,18 @@ monetary_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (strlen (monetary->int_curr_symbol) != 4)
 	{
 	  if (! be_quiet && ! nothing)
-	    error (0, 0, _("\
+	    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value of field `int_curr_symbol' has wrong length"),
-		   "LC_MONETARY");
+				    "LC_MONETARY"));
 	}
       else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
 			NR_VALID_INT_CURR, sizeof (const char *),
 			(comparison_fn_t) curr_strcmp) == NULL
 	       && !be_quiet)
-	error (0, 0, _("\
+	WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value of field `int_curr_symbol' does \
 not correspond to a valid name in ISO 4217"),
-	       "LC_MONETARY");
+				"LC_MONETARY"));
     }
 
   /* The decimal point must not be empty.  This is not said explicitly
@@ -241,15 +241,15 @@ not correspond to a valid name in ISO 4217"),
   if (monetary->mon_decimal_point == NULL)
     {
       if (! be_quiet && ! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_MONETARY", "mon_decimal_point");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_MONETARY", "mon_decimal_point"));
       monetary->mon_decimal_point = ".";
     }
   else if (monetary->mon_decimal_point[0] == '\0' && ! be_quiet && ! nothing)
     {
-      error (0, 0, _("\
+      WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value for field `%s' must not be the empty string"),
-	     "LC_MONETARY", "mon_decimal_point");
+			      "LC_MONETARY", "mon_decimal_point"));
     }
   if (monetary->mon_decimal_point_wc == L'\0')
     monetary->mon_decimal_point_wc = L'.';
@@ -257,8 +257,8 @@ not correspond to a valid name in ISO 4217"),
   if (monetary->mon_grouping_len == 0)
     {
       if (! be_quiet && ! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_MONETARY", "mon_grouping");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_MONETARY", "mon_grouping"));
 
       monetary->mon_grouping = (char *) "\177";
       monetary->mon_grouping_len = 1;
@@ -269,15 +269,15 @@ not correspond to a valid name in ISO 4217"),
   if (monetary->cat == -2)						      \
     {									      \
        if (! be_quiet && ! nothing)					      \
-	 error (0, 0, _("%s: field `%s' not defined"),			      \
-	        "LC_MONETARY", #cat);					      \
+	 WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
+				 "LC_MONETARY", #cat));			      \
        monetary->cat = initval;						      \
     }									      \
   else if ((monetary->cat < min || monetary->cat > max)			      \
 	   && !be_quiet && !nothing)					      \
-    error (0, 0, _("							      \
+    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value for field `%s' must be in range %d...%d"),			      \
-	   "LC_MONETARY", #cat, min, max)
+			    "LC_MONETARY", #cat, min, max))
 
   TEST_ELEM (int_frac_digits, -128, 127, -1);
   TEST_ELEM (frac_digits, -128, 127, -1);
@@ -305,9 +305,9 @@ not correspond to a valid name in ISO 4217"),
     monetary->cat = monetary->alt;					      \
   else if ((monetary->cat < min || monetary->cat > max) && !be_quiet	      \
 	   && ! nothing)						      \
-    error (0, 0, _("\
+    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value for field `%s' must be in range %d...%d"),			      \
-	   "LC_MONETARY", #cat, min, max)
+			    "LC_MONETARY", #cat, min, max))
 
   TEST_ELEM (int_p_cs_precedes, p_cs_precedes, -1, 1);
   TEST_ELEM (int_p_sep_by_space, p_sep_by_space, -1, 2);
diff --git a/locale/programs/ld-name.c b/locale/programs/ld-name.c
index a838b6e114..11e0ace7d6 100644
--- a/locale/programs/ld-name.c
+++ b/locale/programs/ld-name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -27,6 +27,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -91,7 +92,8 @@ name_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (name == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"), "LC_NAME");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_NAME"));
 	  name_startup (NULL, locale, 0);
 	  name = locale->categories[LC_NAME].name;
 	  nothing = 1;
@@ -101,7 +103,8 @@ name_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (name->name_fmt == NULL)
     {
       if (! nothing)
-	error (0, 0, _("%s: field `%s' not defined"), "LC_NAME", "name_fmt");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_NAME", "name_fmt"));
       /* Use as the default value the value of the i18n locale.  */
       name->name_fmt = "%p%t%g%t%m%t%f";
     }
@@ -112,8 +115,8 @@ name_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       const char *cp = name->name_fmt;
 
       if (*cp == '\0')
-	error (0, 0, _("%s: field `%s' must not be empty"),
-	       "LC_NAME", "name_fmt");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
+				"LC_NAME", "name_fmt"));
       else
 	while (*cp != '\0')
 	  {
@@ -124,9 +127,8 @@ name_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 		  ++cp;
 		if (strchr ("dfFgGlomMpsSt", *cp) == NULL)
 		  {
-		    error (0, 0, _("\
-%s: invalid escape sequence in field `%s'"),
-			   "LC_NAME", "name_fmt");
+		    WITH_CUR_LOCALE (error (0, 0, _("\
+%s: invalid escape sequence in field `%s'"), "LC_NAME", "name_fmt"));
 		    break;
 		  }
 	      }
@@ -138,7 +140,8 @@ name_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (name->cat == NULL)						      \
     {									      \
       if (verbose && ! nothing)						      \
-	error (0, 0, _("%s: field `%s' not defined"), "LC_NAME", #cat);	      \
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
+				"LC_NAME", #cat));          		      \
       name->cat = "";							      \
     }
 
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index c0be827133..6e385f2be6 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -27,8 +27,8 @@
 
 #include <assert.h>
 
-#include "linereader.h"
 #include "localedef.h"
+#include "linereader.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -96,8 +96,8 @@ numeric_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (numeric == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"),
-		   "LC_NUMERIC");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_NUMERIC"));
 	  numeric_startup (NULL, locale, 0);
 	  numeric = locale->categories[LC_NUMERIC].numeric;
 	  nothing = 1;
@@ -110,21 +110,22 @@ numeric_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (numeric->decimal_point == NULL)
     {
       if (! be_quiet && ! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_NUMERIC", "decimal_point");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_NUMERIC", "decimal_point"));
       numeric->decimal_point = ".";
     }
   else if (numeric->decimal_point[0] == '\0' && ! be_quiet && ! nothing)
     {
-      error (0, 0, _("\
+      WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value for field `%s' must not be the empty string"),
-	     "LC_NUMERIC", "decimal_point");
+			      "LC_NUMERIC", "decimal_point"));
     }
   if (numeric->decimal_point_wc == L'\0')
     numeric->decimal_point_wc = L'.';
 
   if (numeric->grouping_len == 0 && ! be_quiet && ! nothing)
-    error (0, 0, _("%s: field `%s' not defined"), "LC_NUMERIC", "grouping");
+    WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+			    "LC_NUMERIC", "grouping"));
 }
 
 
diff --git a/locale/programs/ld-paper.c b/locale/programs/ld-paper.c
index 334d405ca8..2dce9ca8da 100644
--- a/locale/programs/ld-paper.c
+++ b/locale/programs/ld-paper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -28,6 +28,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -88,7 +89,8 @@ paper_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (paper == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"), "LC_PAPER");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_PAPER"));
 	  paper_startup (NULL, locale, 0);
 	  paper = locale->categories[LC_PAPER].paper;
 	  nothing = 1;
@@ -98,7 +100,8 @@ paper_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (paper->height == 0)
     {
       if (! nothing)
-	error (0, 0, _("%s: field `%s' not defined"), "LC_PAPER", "height");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_PAPER", "height"));
       /* Use as default values the values from the i18n locale.  */
       paper->height = 297;
     }
@@ -106,7 +109,8 @@ paper_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (paper->width == 0)
     {
       if (! nothing)
-	error (0, 0, _("%s: field `%s' not defined"), "LC_PAPER", "width");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_PAPER", "width"));
       /* Use as default values the values from the i18n locale.  */
       paper->width = 210;
     }
diff --git a/locale/programs/ld-telephone.c b/locale/programs/ld-telephone.c
index a66b48d436..01dcf36008 100644
--- a/locale/programs/ld-telephone.c
+++ b/locale/programs/ld-telephone.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -28,6 +28,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -91,8 +92,8 @@ telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (telephone == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"),
-		   "LC_TELEPHONE");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_TELEPHONE"));
 	  telephone_startup (NULL, locale, 0);
 	  telephone = locale->categories[LC_TELEPHONE].telephone;
 	  nothing = 1;
@@ -102,8 +103,8 @@ telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (telephone->tel_int_fmt == NULL)
     {
       if (! nothing)
-	error (0, 0, _("%s: field `%s' not defined"),
-	       "LC_TELEPHONE", "tel_int_fmt");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
+				"LC_TELEPHONE", "tel_int_fmt"));
       /* Use as the default value the value of the i18n locale.  */
       telephone->tel_int_fmt = "+%c %a %l";
     }
@@ -114,8 +115,8 @@ telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       const char *cp = telephone->tel_int_fmt;
 
       if (*cp == '\0')
-	error (0, 0, _("%s: field `%s' must not be empty"),
-	       "LC_TELEPHONE", "tel_int_fmt");
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
+				"LC_TELEPHONE", "tel_int_fmt"));
       else
 	while (*cp != '\0')
 	  {
@@ -123,9 +124,8 @@ telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	      {
 		if (strchr ("aAlc", *++cp) == NULL)
 		  {
-		    error (0, 0, _("\
-%s: invalid escape sequence in field `%s'"),
-			   "LC_TELEPHONE", "tel_int_fmt");
+		    WITH_CUR_LOCALE (error (0, 0, _("\
+%s: invalid escape sequence in field `%s'"), "LC_TELEPHONE", "tel_int_fmt"));
 		    break;
 		  }
 	      }
@@ -147,8 +147,8 @@ telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	    {
 	      if (strchr ("aAlc", *++cp) == NULL)
 		{
-		  error (0, 0, _("%s: invalid escape sequence in field `%s'"),
-			 "LC_TELEPHONE", "tel_dom_fmt");
+		  WITH_CUR_LOCALE (error (0, 0, _("\
+%s: invalid escape sequence in field `%s'"), "LC_TELEPHONE", "tel_dom_fmt"));
 		  break;
 		}
 	    }
@@ -160,7 +160,8 @@ telephone_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (telephone->cat == NULL)						      \
     {									      \
       if (verbose && ! nothing)						      \
-	error (0, 0, _("%s: field `%s' not defined"), "LC_TELEPHONE", #cat);  \
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
+				"LC_TELEPHONE", #cat));     		      \
       telephone->cat = "";						      \
     }
 
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index 5883d4c31c..32d9dad971 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -30,8 +30,8 @@
 
 #include <assert.h>
 
-#include "linereader.h"
 #include "localedef.h"
+#include "linereader.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -157,7 +157,8 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       if (time == NULL)
 	{
 	  if (! be_quiet)
-	    error (0, 0, _("No definition for %s category found"), "LC_TIME");
+	    WITH_CUR_LOCALE (error (0, 0, _("\
+No definition for %s category found"), "LC_TIME"));
 	  time_startup (NULL, locale, 0);
 	  time = locale->categories[LC_TIME].time;
 	  nothing = 1;
@@ -172,7 +173,8 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
       int i;								      \
 									      \
       if (! be_quiet && ! nothing)					      \
-	error (0, 0, _("%s: field `%s' not defined"), "LC_TIME", #cat);	      \
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
+				"LC_TIME", #cat));          		      \
 									      \
       for (i = 0; i < sizeof (initval) / sizeof (initval[0]); ++i)	      \
 	time->cat[i] = initval[i];					      \
@@ -192,7 +194,8 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
   if (time->cat == NULL)						      \
     {									      \
       if (! be_quiet && ! nothing)					      \
-	error (0, 0, _("%s: field `%s' not defined"), "LC_TIME", #cat);	      \
+	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
+				"LC_TIME", #cat));          		      \
 									      \
       time->cat = initval;						      \
     }
@@ -242,10 +245,9 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	  if (*str != '+' && *str != '-')
 	    {
 	      if (!be_quiet)
-		error (0, 0,
-		       _("%s: direction flag in string %Zd in `era' field"
-			 " is not '+' nor '-'"),
-		       "LC_TIME", idx + 1);
+		WITH_CUR_LOCALE (error (0, 0, _("\
+%s: direction flag in string %Zd in `era' field is not '+' nor '-'"),
+					"LC_TIME", idx + 1));
 	      /* Default arbitrarily to '+'.  */
 	      time->era_entries[idx].direction = '+';
 	    }
@@ -254,10 +256,9 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	  if (*++str != ':')
 	    {
 	      if (!be_quiet)
-		error (0, 0,
-		       _("%s: direction flag in string %Zd in `era' field"
-			 " is not a single character"),
-		       "LC_TIME", idx + 1);
+		WITH_CUR_LOCALE (error (0, 0, _("\
+%s: direction flag in string %Zd in `era' field is not a single character"),
+					"LC_TIME", idx + 1));
 	      (void) strsep (&str, ":");
 	    }
 	  else
@@ -268,17 +269,17 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	  if (endp == str)
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("%s: invalid number for offset in string %Zd in"
-			       " `era' field"),
-		       "LC_TIME", idx + 1);
+		WITH_CUR_LOCALE (error (0, 0, _("\
+%s: invalid number for offset in string %Zd in `era' field"),
+					"LC_TIME", idx + 1));
 	      (void) strsep (&str, ":");
 	    }
 	  else if (*endp != ':')
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("%s: garbage at end of offset value in"
-			       " string %Zd in `era' field"),
-		       "LC_TIME", idx + 1);
+		WITH_CUR_LOCALE (error (0, 0, _("\
+%s: garbage at end of offset value in string %Zd in `era' field"),
+					"LC_TIME", idx + 1));
 	      (void) strsep (&str, ":");
 	    }
 	  else
@@ -327,18 +328,18 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 		{
 		invalid_start_date:
 		  if (!be_quiet)
-		    error (0, 0, _("%s: invalid starting date in string %Zd in"
-				   " `era' field"),
-			   "LC_TIME", idx + 1);
+		    WITH_CUR_LOCALE (error (0, 0, _("\
+%s: invalid starting date in string %Zd in `era' field"),
+					    "LC_TIME", idx + 1));
 		  (void) strsep (&str, ":");
 		}
 	      else if (*endp != ':')
 		{
 		garbage_start_date:
 		  if (!be_quiet)
-		    error (0, 0, _("%s: garbage at end of starting date "
-				   "in string %Zd in `era' field "),
-			   "LC_TIME", idx + 1);
+		    WITH_CUR_LOCALE (error (0, 0, _("\
+%s: garbage at end of starting date in string %Zd in `era' field "),
+					    "LC_TIME", idx + 1));
 		  (void) strsep (&str, ":");
 		}
 	      else
@@ -355,9 +356,9 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 			   && time->era_entries[idx].start_date[2] == 29
 			   && !__isleap (time->era_entries[idx].start_date[0])))
 		      && !be_quiet)
-			  error (0, 0, _("%s: starting date is invalid in"
-					 " string %Zd in `era' field"),
-				 "LC_TIME", idx + 1);
+			  WITH_CUR_LOCALE (error (0, 0, _("\
+%s: starting date is invalid in string %Zd in `era' field"),
+						  "LC_TIME", idx + 1));
 		}
 	    }
 
@@ -404,18 +405,18 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 		{
 		invalid_stop_date:
 		  if (!be_quiet)
-		    error (0, 0, _("%s: invalid stopping date in string %Zd in"
-				   " `era' field"),
-			   "LC_TIME", idx + 1);
+		    WITH_CUR_LOCALE (error (0, 0, _("\
+%s: invalid stopping date in string %Zd in `era' field"),
+					    "LC_TIME", idx + 1));
 		  (void) strsep (&str, ":");
 		}
 	      else if (*endp != ':')
 		{
 		garbage_stop_date:
 		  if (!be_quiet)
-		    error (0, 0, _("%s: garbage at end of stopping date "
-				   "in string %Zd in `era' field"),
-			   "LC_TIME", idx + 1);
+		    WITH_CUR_LOCALE (error (0, 0, _("\
+%s: garbage at end of stopping date in string %Zd in `era' field"),
+					    "LC_TIME", idx + 1));
 		  (void) strsep (&str, ":");
 		}
 	      else
@@ -432,17 +433,17 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 			   && time->era_entries[idx].stop_date[2] == 29
 			   && !__isleap (time->era_entries[idx].stop_date[0])))
 		      && !be_quiet)
-			  error (0, 0, _("%s: stopping date is invalid in"
-					 " string %Zd in `era' field"),
-				 "LC_TIME", idx + 1);
+			  WITH_CUR_LOCALE (error (0, 0, _("\
+%s: stopping date is invalid in string %Zd in `era' field"),
+						  "LC_TIME", idx + 1));
 		}
 	    }
 
 	  if (str == NULL || *str == '\0')
 	    {
 	      if (!be_quiet)
-		error (0, 0, _("%s: missing era name in string %Zd in `era'"
-			       " field"), "LC_TIME", idx + 1);
+		WITH_CUR_LOCALE (error (0, 0, _("\
+%s: missing era name in string %Zd in `era' field"), "LC_TIME", idx + 1));
 	      time->era_entries[idx].name =
 		time->era_entries[idx].format = "";
 	    }
@@ -453,9 +454,9 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
 	      if (str == NULL || *str == '\0')
 		{
 		  if (!be_quiet)
-		    error (0, 0, _("%s: missing era format in string %Zd"
-				   " in `era' field"),
-			   "LC_TIME", idx + 1);
+		    WITH_CUR_LOCALE (error (0, 0, _("\
+%s: missing era format in string %Zd in `era' field"),
+					    "LC_TIME", idx + 1));
 		  time->era_entries[idx].name =
 		    time->era_entries[idx].format = "";
 		}
@@ -482,33 +483,33 @@ time_finish (struct localedef_t *locale, const struct charmap_t *charmap)
     time->week_1stday = 19971130;
 
   if (time->week_1stweek > time->week_ndays)
-    error (0, 0, _("\
+    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: third operand for value of field `%s' must not be larger than %d"),
-	   "LC_TIME", "week", 7);
+			    "LC_TIME", "week", 7));
 
   if (time->first_weekday == '\0')
     /* The definition does not specify this so the default is used.  */
     time->first_weekday = 1;
   else if (time->first_weekday > time->week_ndays)
-    error (0, 0, _("\
+    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: values of field `%s' must not be larger than %d"),
-	   "LC_TIME", "first_weekday", 7);
+			    "LC_TIME", "first_weekday", 7));
 
   if (time->first_workday == '\0')
     /* The definition does not specify this so the default is used.  */
     time->first_workday = 1;
   else if (time->first_workday > time->week_ndays)
-    error (0, 0, _("\
+    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: values of field `%s' must not be larger than %d"),
-	   "LC_TIME", "first_workday", 7);
+			    "LC_TIME", "first_workday", 7));
 
   if (time->cal_direction == '\0')
     /* The definition does not specify this so the default is used.  */
     time->cal_direction = 1;
   else if (time->cal_direction > 3)
-    error (0, 0, _("\
+    WITH_CUR_LOCALE (error (0, 0, _("\
 %s: values for field `%s' must not be larger than %d"),
-	   "LC_TIME", "cal_direction", 3);
+			    "LC_TIME", "cal_direction", 3));
 
   /* XXX We don't perform any tests on the timezone value since this is
      simply useless, stupid $&$!@...  */
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index 9f5191226b..f569d1b9b8 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
 
@@ -29,18 +29,12 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "localedef.h"
 #include "charmap.h"
 #include "error.h"
 #include "linereader.h"
-#include "localedef.h"
 #include "locfile.h"
 
-/* Prototypes for a few program-wide used functions.  */
-extern void *xmalloc (size_t __n);
-extern void *xrealloc (void *__p, size_t __n);
-extern char *xstrdup (const char *__str);
-
-
 /* Prototypes for local functions.  */
 static struct token *get_toplvl_escape (struct linereader *lr);
 static struct token *get_symname (struct linereader *lr);
diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h
index 868c50264e..a44360979b 100644
--- a/locale/programs/linereader.h
+++ b/locale/programs/linereader.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.org>.
 
@@ -98,7 +98,7 @@ extern struct token *lr_token (struct linereader *lr,
 
 
 #define lr_error(lr, fmt, args...) \
-  error_at_line (0, 0, lr->fname, lr->lineno, fmt, ## args)
+  WITH_CUR_LOCALE (error_at_line (0, 0, lr->fname, lr->lineno, fmt, ## args))
 
 
 
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 1d09e8b46f..3c159560e9 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -31,10 +31,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <error.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 
-#include "error.h"
+#include "localedef.h"
 #include "charmap.h"
 #include "locfile.h"
 
@@ -189,7 +190,8 @@ main (int argc, char *argv[])
      defines error code 3 for this situation so I think it must be
      a fatal error (see P1003.2 4.35.8).  */
   if (sysconf (_SC_2_LOCALEDEF) < 0)
-    error (3, 0, _("FATAL: system does not define `_POSIX2_LOCALEDEF'"));
+    WITH_CUR_LOCALE (error (3, 0, _("\
+FATAL: system does not define `_POSIX2_LOCALEDEF'")));
 
   /* Process charmap file.  */
   charmap = charmap_read (charmap_file, verbose, be_quiet, 1);
@@ -202,7 +204,8 @@ main (int argc, char *argv[])
 
   /* Now read the locale file.  */
   if (locfile_read (&global, charmap) != 0)
-    error (4, errno, _("cannot open locale definition file `%s'"), input_file);
+    WITH_CUR_LOCALE (error (4, errno, _("\
+cannot open locale definition file `%s'"), input_file));
 
   /* Perhaps we saw some `copy' instructions.  */
   while (1)
@@ -217,8 +220,8 @@ main (int argc, char *argv[])
 	break;
 
       if (locfile_read (runp, charmap) != 0)
-	error (4, errno, _("cannot open locale definition file `%s'"),
-	       runp->name);
+	WITH_CUR_LOCALE (error (4, errno, _("\
+cannot open locale definition file `%s'"), runp->name));
     }
 
   /* Check the categories we processed in source form.  */
@@ -229,13 +232,14 @@ main (int argc, char *argv[])
   if (error_message_count == 0 || force_output != 0)
     {
       if (cannot_write_why != 0)
-	error (4, cannot_write_why, _("cannot write output files to `%s'"),
-	       output_path);
+	WITH_CUR_LOCALE (error (4, cannot_write_why, _("\
+cannot write output files to `%s'"), output_path));
       else
 	write_all_categories (locales, charmap, output_path);
     }
   else
-    error (4, 0, _("no output file produced because warning were issued"));
+    WITH_CUR_LOCALE (error (4, 0, _("\
+no output file produced because warning were issued")));
 
   /* This exit status is prescribed by POSIX.2 4.35.7.  */
   exit (error_message_count != 0);
@@ -485,13 +489,14 @@ add_to_readlist (int locale, const char *name, const char *repertoire_name,
     }
 
   if (generate && (runp->needed & (1 << locale)) != 0)
-    error (5, 0, _("circular dependencies between locale definitions"));
+    WITH_CUR_LOCALE (error (5, 0, _("\
+circular dependencies between locale definitions")));
 
   if (copy_locale != NULL)
     {
       if (runp->categories[locale].generic != NULL)
-	error (5, 0, _("cannot add already read locale `%s' a second time"),
-	       name);
+	WITH_CUR_LOCALE (error (5, 0, _("\
+cannot add already read locale `%s' a second time"), name));
       else
 	runp->categories[locale].generic =
 	  copy_locale->categories[locale].generic;
@@ -516,8 +521,8 @@ find_locale (int locale, const char *name, const char *repertoire_name,
 
   if ((result->avail & (1 << locale)) == 0
       && locfile_read (result, charmap) != 0)
-    error (4, errno, _("cannot open locale definition file `%s'"),
-	   result->name);
+    WITH_CUR_LOCALE (error (4, errno, _("\
+cannot open locale definition file `%s'"), result->name));
 
   return result;
 }
@@ -536,8 +541,8 @@ load_locale (int locale, const char *name, const char *repertoire_name,
 
   if ((result->avail & (1 << locale)) == 0
       && locfile_read (result, charmap) != 0)
-    error (4, errno, _("cannot open locale definition file `%s'"),
-	   result->name);
+    WITH_CUR_LOCALE (error (4, errno, _("\
+cannot open locale definition file `%s'"), result->name));
 
   return result;
 }
diff --git a/locale/programs/localedef.h b/locale/programs/localedef.h
index cdb08d8293..717962e10b 100644
--- a/locale/programs/localedef.h
+++ b/locale/programs/localedef.h
@@ -24,6 +24,7 @@
 /* Get the basic locale definitions.  */
 #include <locale.h>
 #include <stddef.h>
+#include <errno.h>
 
 #include "repertoire.h"
 
@@ -122,6 +123,19 @@ extern void *xrealloc (void *__p, size_t __n);
 extern char *xstrdup (const char *__str);
 
 
+/* Wrapper to switch LC_CTYPE back to the locale specified in the
+   environment for output.  */
+#define WITH_CUR_LOCALE(stmt)					\
+  do {								\
+      int saved_errno = errno;					\
+      const char *cur_locale_ = setlocale (LC_CTYPE, NULL);	\
+      setlocale (LC_CTYPE, "");					\
+      errno = saved_errno; 					\
+      stmt;							\
+      setlocale (LC_CTYPE, cur_locale_);			\
+  } while (0)
+
+
 /* Mark given locale as to be read.  */
 extern struct localedef_t *add_to_readlist (int locale, const char *name,
 					    const char *repertoire_name,
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index d2e9ba1382..07a65bbb54 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
 
@@ -568,9 +568,8 @@ write_locale_data (const char *output_path, const char *category,
       if (fd == -1)
 	{
 	  if (!be_quiet)
-	    error (0, save_err, _("\
-cannot open output file `%s' for category `%s'"),
-		   fname, category);
+	    WITH_CUR_LOCALE (error (0, save_err, _("\
+cannot open output file `%s' for category `%s'"), fname, category));
 	  free (fname);
 	  return;
 	}
@@ -593,8 +592,8 @@ cannot open output file `%s' for category `%s'"),
       if (writev (fd, &vec[cnt], step) < 0)
 	{
 	  if (!be_quiet)
-	    error (0, errno, _("failure while writing data for category `%s'"),
-		   category);
+	    WITH_CUR_LOCALE (error (0, errno, _("\
+failure while writing data for category `%s'"), category));
 	  break;
 	}
     }
@@ -690,9 +689,8 @@ cannot open output file `%s' for category `%s'"),
 			      if (rename (tmp_fname, fname) < 0)
 				{
 				  if (!be_quiet)
-				    error (0, errno, _("\
-cannot create output file `%s' for category `%s'"),
-					   fname, category);
+				    WITH_CUR_LOCALE (error (0, errno, _("\
+cannot create output file `%s' for category `%s'"), fname, category));
 				}
 			      free (tmp_fname);
 			      free (other_fname);
diff --git a/locale/programs/repertoire.c b/locale/programs/repertoire.c
index 903b620216..8251db43d3 100644
--- a/locale/programs/repertoire.c
+++ b/locale/programs/repertoire.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -30,11 +30,11 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "localedef.h"
 #include "linereader.h"
 #include "charmap.h"
 #include "repertoire.h"
 #include "simple-hash.h"
-#include "localedef.h"
 
 
 /* Simple keyword hashing for the repertoiremap.  */
@@ -322,13 +322,14 @@ argument to <%s> must be a single character"),
     }
 
   if (state != 2 && state != 90 && !be_quiet)
-    error (0, 0, _("%s: premature end of file"), repfile->fname);
+    WITH_CUR_LOCALE (error (0, 0, _("%s: premature end of file"),
+			    repfile->fname));
 
   lr_close (repfile);
 
   if (tsearch (result, &known, &repertoire_compare) == NULL)
     /* Something went wrong.  */
-    error (0, errno, _("cannot safe new repertoire map"));
+    WITH_CUR_LOCALE (error (0, errno, _("cannot safe new repertoire map")));
 
   return result;
 }
@@ -339,7 +340,8 @@ repertoire_complain (const char *name)
 {
   if (tfind (name, &unavailable, (__compar_fn_t) strcmp) == NULL)
     {
-      error (0, errno, _("repertoire map file `%s' not found"), name);
+      WITH_CUR_LOCALE (error (0, errno, _("\
+repertoire map file `%s' not found"), name));
 
       /* Remember that we reported this map.  */
       tsearch (name, &unavailable, (__compar_fn_t) strcmp);