This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Unreadable localedef messages


localedef does not correctly output error messages because LC_CTYPE has
been reset to POSIX.  We need to temporarily switch back to the inherited
locale for output.  Unfortunately we cannot just define wrapper functions
around error and error_at_line, because there are no va_list variants for
them, so the WITH_CUR_LOCALE macro needs to be rather mouthful.

Andreas.

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.

Index: locale/programs/charmap-dir.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/charmap-dir.c,v
retrieving revision 1.3
diff -u -a -r1.3 locale/programs/charmap-dir.c
--- locale/programs/charmap-dir.c	2001/07/06 04:55:33	1.3
+++ locale/programs/charmap-dir.c	2002/02/04 21:03:01
@@ -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 @@
   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;
     }
 
Index: locale/programs/charmap.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/charmap.c,v
retrieving revision 1.37
diff -u -a -r1.37 locale/programs/charmap.c
--- locale/programs/charmap.c	2002/01/11 06:46:13	1.37
+++ locale/programs/charmap.c	2002/02/04 21:03:01
@@ -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 @@
 	  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 @@
 	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 @@
       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 @@
 	      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 @@
 	  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);
 
Index: locale/programs/ld-address.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-address.c,v
retrieving revision 1.17
diff -u -a -r1.17 locale/programs/ld-address.c
--- locale/programs/ld-address.c	2001/12/10 01:15:01	1.17
+++ locale/programs/ld-address.c	2002/02/04 21:03:01
@@ -29,6 +29,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -128,8 +129,8 @@
       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 @@
   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 @@
       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 @@
 		  ++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 @@
   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 @@
   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 @@
 	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 @@
 	    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 @@
   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 @@
 	    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 @@
 	  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"));
 }
 
 
Index: locale/programs/ld-collate.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-collate.c,v
retrieving revision 1.100
diff -u -a -r1.100 locale/programs/ld-collate.c
--- locale/programs/ld-collate.c	2002/02/01 20:24:32	1.100
+++ locale/programs/ld-collate.c	2002/02/04 21:03:01
@@ -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 @@
     {
       /* 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 @@
 	  && ((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 @@
 		  {
 		    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 @@
 		      /* 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 @@
 		      /* 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 @@
 	  /* 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 @@
 	    }
 	  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 @@
 		    }
 		}
 	      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)
Index: locale/programs/ld-ctype.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-ctype.c,v
retrieving revision 1.100
diff -u -a -r1.100 locale/programs/ld-ctype.c
--- locale/programs/ld-ctype.c	2001/12/10 01:30:38	1.100
+++ locale/programs/ld-ctype.c	2002/02/04 21:03:02
@@ -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 @@
       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 @@
   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 @@
 			    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 @@
 			    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 @@
 			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 @@
 			    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 @@
 			    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 @@
 			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 @@
 	    & 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 @@
 		!= 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 @@
   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 @@
 		 & 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 @@
 		 & 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 @@
       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 @@
 	      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 @@
 
 	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 @@
       {
 	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 @@
 
   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 @@
 
   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 @@
 			    {
 			      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 @@
 	  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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
 	  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 @@
 	      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 @@
   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 @@
 	  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 @@
 
       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 @@
       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 @@
       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 @@
     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;
Index: locale/programs/ld-identification.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-identification.c,v
retrieving revision 1.9
diff -u -a -r1.9 locale/programs/ld-identification.c
--- locale/programs/ld-identification.c	2001/12/10 01:15:02	1.9
+++ locale/programs/ld-identification.c	2002/02/04 21:03:02
@@ -29,6 +29,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -130,8 +131,8 @@
       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 @@
   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 @@
     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] = "";
       }
 }
Index: locale/programs/ld-measurement.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-measurement.c,v
retrieving revision 1.10
diff -u -a -r1.10 locale/programs/ld-measurement.c
--- locale/programs/ld-measurement.c	2001/12/10 01:15:02	1.10
+++ locale/programs/ld-measurement.c	2002/02/04 21:03:02
@@ -28,6 +28,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -91,8 +92,8 @@
       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 @@
   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"));
     }
 }
 
Index: locale/programs/ld-messages.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-messages.c,v
retrieving revision 1.17
diff -u -a -r1.17 locale/programs/ld-messages.c
--- locale/programs/ld-messages.c	2001/12/10 01:15:02	1.17
+++ locale/programs/ld-messages.c	2002/02/04 21:03:02
@@ -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 @@
       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 @@
   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 @@
 	  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 @@
   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 @@
 	  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);
Index: locale/programs/ld-monetary.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-monetary.c,v
retrieving revision 1.32
diff -u -a -r1.32 locale/programs/ld-monetary.c
--- locale/programs/ld-monetary.c	2001/12/10 01:15:02	1.32
+++ locale/programs/ld-monetary.c	2002/02/04 21:03:02
@@ -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 @@
       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 @@
   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 @@
       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 @@
   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 @@
   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 @@
   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 @@
     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);
Index: locale/programs/ld-name.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-name.c,v
retrieving revision 1.10
diff -u -a -r1.10 locale/programs/ld-name.c
--- locale/programs/ld-name.c	2001/12/10 01:15:02	1.10
+++ locale/programs/ld-name.c	2002/02/04 21:03:02
@@ -27,6 +27,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -91,7 +92,8 @@
       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 @@
   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 @@
       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 @@
 		  ++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 @@
   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 = "";							      \
     }
 
Index: locale/programs/ld-numeric.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-numeric.c,v
retrieving revision 1.25
diff -u -a -r1.25 locale/programs/ld-numeric.c
--- locale/programs/ld-numeric.c	2001/12/10 01:15:02	1.25
+++ locale/programs/ld-numeric.c	2002/02/04 21:03:02
@@ -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 @@
       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 @@
   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"));
 }
 
 
Index: locale/programs/ld-paper.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-paper.c,v
retrieving revision 1.12
diff -u -a -r1.12 locale/programs/ld-paper.c
--- locale/programs/ld-paper.c	2001/12/10 01:15:02	1.12
+++ locale/programs/ld-paper.c	2002/02/04 21:03:02
@@ -28,6 +28,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -88,7 +89,8 @@
       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 @@
   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 @@
   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;
     }
Index: locale/programs/ld-telephone.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-telephone.c,v
retrieving revision 1.8
diff -u -a -r1.8 locale/programs/ld-telephone.c
--- locale/programs/ld-telephone.c	2001/12/10 01:15:02	1.8
+++ locale/programs/ld-telephone.c	2002/02/04 21:03:02
@@ -28,6 +28,7 @@
 
 #include <assert.h>
 
+#include "localedef.h"
 #include "localeinfo.h"
 #include "locfile.h"
 
@@ -91,8 +92,8 @@
       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 @@
   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 @@
       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 @@
 	      {
 		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 @@
 	    {
 	      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 @@
   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 = "";						      \
     }
 
Index: locale/programs/ld-time.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/ld-time.c,v
retrieving revision 1.36
diff -u -a -r1.36 locale/programs/ld-time.c
--- locale/programs/ld-time.c	2001/12/10 01:15:02	1.36
+++ locale/programs/ld-time.c	2002/02/04 21:03:02
@@ -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 @@
       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 @@
       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 @@
   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 @@
 	  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 @@
 	  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 @@
 	  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 @@
 		{
 		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->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 @@
 		{
 		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->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 @@
 	      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->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 $&$!@...  */
Index: locale/programs/linereader.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/linereader.c,v
retrieving revision 1.24
diff -u -a -r1.24 locale/programs/linereader.c
--- locale/programs/linereader.c	2001/12/10 01:26:21	1.24
+++ locale/programs/linereader.c	2002/02/04 21:03:02
@@ -29,17 +29,11 @@
 #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);
Index: locale/programs/linereader.h
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/linereader.h,v
retrieving revision 1.9
diff -u -a -r1.9 locale/programs/linereader.h
--- locale/programs/linereader.h	2001/12/10 01:27:38	1.9
+++ locale/programs/linereader.h	2002/02/04 21:03:02
@@ -98,7 +98,7 @@
 
 
 #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))
 
 
 
Index: locale/programs/localedef.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/localedef.c,v
retrieving revision 1.54
diff -u -a -r1.54 locale/programs/localedef.c
--- locale/programs/localedef.c	2002/01/17 07:15:53	1.54
+++ locale/programs/localedef.c	2002/02/04 21:03:02
@@ -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 @@
      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 @@
 
   /* 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 @@
 	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 @@
   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 @@
     }
 
   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 @@
 
   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 @@
 
   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;
 }
Index: locale/programs/localedef.h
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/localedef.h,v
retrieving revision 1.7
diff -u -a -r1.7 locale/programs/localedef.h
--- locale/programs/localedef.h	2001/12/10 01:22:36	1.7
+++ locale/programs/localedef.h	2002/02/04 21:03:02
@@ -24,6 +24,7 @@
 /* Get the basic locale definitions.  */
 #include <locale.h>
 #include <stddef.h>
+#include <errno.h>
 
 #include "repertoire.h"
 
@@ -120,6 +121,19 @@
 extern void *xcalloc (size_t __n, size_t __size);
 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.  */
Index: locale/programs/locfile.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/locfile.c,v
retrieving revision 1.30
diff -u -a -r1.30 locale/programs/locfile.c
--- locale/programs/locfile.c	2001/12/10 01:20:35	1.30
+++ locale/programs/locfile.c	2002/02/04 21:03:02
@@ -568,9 +568,8 @@
       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 @@
       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 @@
 			      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);
Index: locale/programs/locfile.h
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/locfile.h,v
retrieving revision 1.13
diff -u -a -r1.13 locale/programs/locfile.h
--- locale/programs/locfile.h	2001/12/10 01:24:11	1.13
+++ locale/programs/locfile.h	2002/02/04 21:03:02
@@ -22,8 +22,8 @@
 
 #include <sys/uio.h>
 
-#include "linereader.h"
 #include "localedef.h"
+#include "linereader.h"
 
 
 /* Header of the locale data files.  */
Index: locale/programs/repertoire.c
===================================================================
RCS file: /cvs/glibc/libc/locale/programs/repertoire.c,v
retrieving revision 1.13
diff -u -a -r1.13 locale/programs/repertoire.c
--- locale/programs/repertoire.c	2001/12/10 01:21:04	1.13
+++ locale/programs/repertoire.c	2002/02/04 21:03:02
@@ -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 @@
     }
 
   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 @@
 {
   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);

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]