summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/Makefile3
-rw-r--r--locale/programs/ld-collate.c17
-rw-r--r--locale/programs/ld-ctype.c7
-rw-r--r--locale/programs/ld-time.c5
-rw-r--r--locale/programs/linereader.c4
-rw-r--r--locale/programs/localedef.c20
-rw-r--r--locale/programs/localedef.h5
-rw-r--r--locale/programs/repertoire.c3
8 files changed, 56 insertions, 8 deletions
diff --git a/locale/Makefile b/locale/Makefile
index 8bcc015219..d99f53511a 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -40,9 +40,8 @@ routines	= setlocale findlocale loadlocale localeconv nl_langinfo \
 categories	= ctype messages monetary numeric time paper name \
 		  address telephone measurement identification collate
 aux		= $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name
-# XXX For testing this is now others-static instead of others.
 others		= localedef locale
-others-static		= localedef locale
+#others-static	= localedef locale
 install-bin	= localedef locale
 extra-objs	= $(localedef-modules:=.o) $(locale-modules:=.o) \
 		  $(lib-modules:=.o)
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index a716494796..a7eb8083a4 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1677,6 +1677,21 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
   obstack_init (&extrapool);
   obstack_init (&indirectpool);
 
+  /* Since we are using the sign of an integer to mark indirection the
+     offsets in the arrays we are indirectly referring to must not be
+     zero since -0 == 0.  Therefore we add a bit of dummy content.  */
+  if (sizeof (int) == sizeof (int32_t))
+    {
+      obstack_int_grow (&extrapool, 0);
+      obstack_int_grow (&indirectpool, 0);
+    }
+  else
+    {
+      int32_t zero = 0;
+      obstack_grow (&extrapool, &zero, sizeof (zero));
+      obstack_grow (&indirectpool, &zero, sizeof (zero));
+    }
+
   /* Prepare the ruleset table.  */
   for (sect = collate->sections, i = 0; sect != NULL; sect = sect->next)
     if (sect->ruleidx == i)
@@ -1978,7 +1993,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
 	}
 
       /* Get the locale definition.  */
-      copy_locale = find_locale (LC_COLLATE, now->val.str.startmb,
+      copy_locale = load_locale (LC_COLLATE, now->val.str.startmb,
 				 repertoire_name, charmap);
       if ((copy_locale->avail & COLLATE_LOCALE) == 0)
 	{
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 97ff7fc8bb..0fd430662f 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -324,6 +324,8 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap)
   /* Now resolve copying and also handle completely missing definitions.  */
   if (ctype == NULL)
     {
+      const char *repertoire_name;
+
       /* First see whether we were supposed to copy.  If yes, find the
 	 actual definition.  */
       if (locale->copy_name[LC_CTYPE] != NULL)
@@ -351,6 +353,11 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	  ctype_startup (NULL, locale, charmap, 0);
 	  ctype = locale->categories[LC_CTYPE].ctype;
 	}
+
+      /* Get the repertoire we have to use.  */
+      repertoire_name = locale->repertoire_name ?: repertoire_global;
+      if (repertoire_name != NULL)
+	ctype->repertoire = repertoire_read (repertoire_name);
     }
 
   /* Set default value for classes not specified.  */
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index 5e12c9ba78..e317fc11a2 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -154,7 +154,8 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (time == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"), "LC_TIME");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"), "LC_TIME");
 	  time_startup (NULL, locale, 0);
 	  time = locale->categories[LC_TIME].time;
 	  nothing = 1;
@@ -481,7 +482,7 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap)
     time->cal_direction = 1;
   else if (time->cal_direction > 3)
     error (0, 0, _("\
-%s: values for field `%s' must not be larger than 3"),
+%s: values for field `%s' must not be larger than %d"),
 	   "LC_TIME", "cal_direction", 3);
 
   /* XXX We don't perform any tests on the timezone value since this is
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index 564173083e..c689153bda 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -711,7 +711,7 @@ non-symbolic character value should not be used"));
 		{
 		  /* This name is not in the repertoire map.  */
 		  lr_error (lr, _("symbol `%.*s' not in repertoire map"),
-			    bufact - startidx, &buf[startidx]);
+			    (int) (bufact - startidx), &buf[startidx]);
 		  illegal_string = 1;
 		}
 	      else
@@ -726,7 +726,7 @@ non-symbolic character value should not be used"));
 	    {
 	      /* This name is not in the charmap.  */
 	      lr_error (lr, _("symbol `%.*s' not in charmap"),
-			bufact - startidx, &buf[startidx]);
+			(int) (bufact - startidx), &buf[startidx]);
 	      illegal_string = 1;
 
 	      /* Now forget about the name we just added.  */
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 4fe3a28943..fa5d3de02b 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -490,3 +490,23 @@ find_locale (int locale, const char *name, const char *repertoire_name,
 
   return result;
 }
+
+
+struct localedef_t *
+load_locale (int locale, const char *name, const char *repertoire_name,
+	     struct charmap_t *charmap)
+{
+  struct localedef_t *result;
+
+  /* Generate the locale if it does not exist.  */
+  result = add_to_readlist (locale, name, repertoire_name, 1);
+
+  assert (result != NULL);
+
+  if ((result->avail & (1 << locale)) == 0
+      && locfile_read (result, charmap) != 0)
+    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 31721c5353..4f8a103fd9 100644
--- a/locale/programs/localedef.h
+++ b/locale/programs/localedef.h
@@ -131,4 +131,9 @@ extern struct localedef_t *find_locale (int locale, const char *name,
 					const char *repertoire_name,
 					struct charmap_t *charmap);
 
+/* Load (if necessary) the information for the locale NAME.  */
+extern struct localedef_t *load_locale (int locale, const char *name,
+					const char *repertoire_name,
+					struct charmap_t *charmap);
+
 #endif /* localedef.h */
diff --git a/locale/programs/repertoire.c b/locale/programs/repertoire.c
index 4a4ef756fa..9293c03b7e 100644
--- a/locale/programs/repertoire.c
+++ b/locale/programs/repertoire.c
@@ -431,7 +431,8 @@ hexadecimal range format should use only capital characters"));
           && errno == ERANGE)
       || *to_end != '\0')
     {
-      lr_error (lr, _("<%s> and <%s> are invalid names for range"));
+      lr_error (lr, _("<%s> and <%s> are invalid names for range"),
+		from, to);
       return;
     }