about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/programs/ld-address.c4
-rw-r--r--locale/programs/ld-collate.c34
-rw-r--r--locale/programs/ld-ctype.c5
-rw-r--r--locale/programs/ld-identification.c5
-rw-r--r--locale/programs/ld-measurement.c5
-rw-r--r--locale/programs/ld-messages.c5
-rw-r--r--locale/programs/ld-monetary.c29
-rw-r--r--locale/programs/ld-name.c3
-rw-r--r--locale/programs/ld-numeric.c4
-rw-r--r--locale/programs/ld-paper.c3
-rw-r--r--locale/programs/ld-telephone.c5
-rw-r--r--locale/programs/locfile.c2
12 files changed, 76 insertions, 28 deletions
diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c
index 13ff792e13..187b5460ae 100644
--- a/locale/programs/ld-address.c
+++ b/locale/programs/ld-address.c
@@ -127,7 +127,9 @@ address_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (address == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"), "LC_ADDRESS");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"),
+		   "LC_ADDRESS");
 	  address_startup (NULL, locale, 0);
 	  address = locale->categories[LC_ADDRESS].address;
 	  nothing = 1;
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index c4ffd2b831..cd373d5238 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1376,6 +1376,14 @@ collate_finish (struct localedef_t *locale, struct charmap_t *charmap)
   struct section_list *sect;
   int ruleidx;
 
+  if (collate == NULL)
+    {
+      /* No data, no check.  */
+      if (! be_quiet)
+	error (0, 0, _("No definition for %s category found"), "LC_COLLATE");
+      return;
+    }
+
   /* If this assertion is hit change the type in `element_t'.  */
   assert (nrules <= sizeof (runp->used_in_level) * 8);
 
@@ -1624,10 +1632,6 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
   struct section_list *sect;
   int i;
 
-  obstack_init (&weightpool);
-  obstack_init (&extrapool);
-  obstack_init (&indirectpool);
-
   data.magic = LIMAGIC (LC_COLLATE);
   data.n = nelems;
   iov[0].iov_base = (void *) &data;
@@ -1645,6 +1649,28 @@ collate_output (struct localedef_t *locale, struct charmap_t *charmap,
   idx[1 + cnt] = idx[cnt] + iov[2 + cnt].iov_len;
   ++cnt;
 
+  /* If we have no LC_COLLATE data emit only the number of rules as zero.  */
+  if (collate == NULL)
+    {
+      while (cnt < _NL_ITEM_INDEX (_NL_NUM_LC_COLLATE))
+	{
+	  iov[2 + cnt].iov_base = (char *) "";
+	  iov[2 + cnt].iov_len = 0;
+	  idx[1 + cnt] = idx[cnt] + iov[2 + cnt].iov_len;
+	  ++cnt;
+	}
+
+      assert (cnt == _NL_ITEM_INDEX (_NL_NUM_LC_COLLATE));
+
+      write_locale_data (output_path, "LC_COLLATE", 2 + cnt, iov);
+
+      return;
+    }
+
+  obstack_init (&weightpool);
+  obstack_init (&extrapool);
+  obstack_init (&indirectpool);
+
   /* Prepare the ruleset table.  */
   for (sect = collate->sections, i = 0; sect != NULL; sect = sect->next)
     if (sect->ruleidx == i)
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index d98b7bdfd2..97ff7fc8bb 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -346,7 +346,8 @@ ctype_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (ctype == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"), "LC_CTYPE");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"), "LC_CTYPE");
 	  ctype_startup (NULL, locale, charmap, 0);
 	  ctype = locale->categories[LC_CTYPE].ctype;
 	}
@@ -1217,7 +1218,7 @@ charclass_symbolic_ellipsis (struct linereader *ldfile,
     invalid_range:
       lr_error (ldfile,
 		_("`%s' and `%.*s' are no valid names for symbolic range"),
-		last_str, now->val.str.lenmb, nowstr);
+		last_str, (int) now->val.str.lenmb, nowstr);
       return;
     }
 
diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c
index 957f12caaa..b14db505ed 100644
--- a/locale/programs/ld-identification.c
+++ b/locale/programs/ld-identification.c
@@ -128,8 +128,9 @@ identification_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (identification == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"),
-		 "LC_IDENTIFICATION");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"),
+		   "LC_IDENTIFICATION");
 	  identification_startup (NULL, locale, 0);
 	  identification
 	    = locale->categories[LC_IDENTIFICATION].identification;
diff --git a/locale/programs/ld-measurement.c b/locale/programs/ld-measurement.c
index 610eb5e09c..c3dbf5f705 100644
--- a/locale/programs/ld-measurement.c
+++ b/locale/programs/ld-measurement.c
@@ -89,8 +89,9 @@ measurement_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (measurement == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"),
-		 "LC_MEASUREMENT");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"),
+		   "LC_MEASUREMENT");
 	  measurement_startup (NULL, locale, 0);
 	  measurement = locale->categories[LC_MEASUREMENT].measurement;
 	  nothing = 1;
diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c
index a29cfeaaec..2ee4bda69e 100644
--- a/locale/programs/ld-messages.c
+++ b/locale/programs/ld-messages.c
@@ -94,8 +94,9 @@ messages_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (messages == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"),
-		 "LC_MESSAGES");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"),
+		   "LC_MESSAGES");
 	  messages_startup (NULL, locale, 0);
 	  messages = locale->categories[LC_MESSAGES].messages;
 	  nothing = 1;
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index a56d7a7b8b..c761ae24c0 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -187,8 +187,9 @@ monetary_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (monetary == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"),
-		 "LC_MONETARY");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"),
+		   "LC_MONETARY");
 	  monetary_startup (NULL, locale, 0);
 	  monetary = locale->categories[LC_MONETARY].monetary;
 	  nothing = 1;
@@ -196,9 +197,9 @@ monetary_finish (struct localedef_t *locale, struct charmap_t *charmap)
     }
 
 #define TEST_ELEM(cat) \
-  if (monetary->cat == NULL && !be_quiet)				      \
+  if (monetary->cat == NULL)						      \
     {									      \
-      if (! nothing)							      \
+      if (! be_quiet && ! nothing)					      \
 	error (0, 0, _("%s: field `%s' not defined"),			      \
 	       "LC_MONETARY", #cat);					      \
       monetary->cat = "";						      \
@@ -234,7 +235,14 @@ not correspond to a valid name in ISO 4217"),
   /* The decimal point must not be empty.  This is not said explicitly
      in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be
      != "".  */
-  if (monetary->mon_decimal_point[0] == '\0' && ! be_quiet && ! nothing)
+  if (monetary->mon_decimal_point == NULL)
+    {
+      if (! be_quiet && ! nothing)
+	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, _("\
 %s: value for field `%s' must not be the empty string"),
@@ -253,12 +261,15 @@ not correspond to a valid name in ISO 4217"),
 
 #undef TEST_ELEM
 #define TEST_ELEM(cat, min, max) \
-  if (monetary->cat == -2 && ! be_quiet && ! nothing)			      \
-    error (0, 0, _("%s: field `%s' not defined"),			      \
-	   "LC_MONETARY", #cat);					      \
+  if (monetary->cat == -2)						      \
+    {									      \
+       if (! be_quiet && ! nothing)					      \
+	 error (0, 0, _("%s: field `%s' not defined"),			      \
+	        "LC_MONETARY", #cat);					      \
+    }									      \
   else if ((monetary->cat < min || monetary->cat > max) && !be_quiet	      \
 	   && !nothing)							      \
-    error (0, 0, _("\
+    error (0, 0, _("							      \
 %s: value for field `%s' must be in range %d...%d"),			      \
 	   "LC_MONETARY", #cat, min, max)
 
diff --git a/locale/programs/ld-name.c b/locale/programs/ld-name.c
index 9419fdd4e3..39ab22c2f7 100644
--- a/locale/programs/ld-name.c
+++ b/locale/programs/ld-name.c
@@ -90,7 +90,8 @@ name_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (name == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"), "LC_NAME");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"), "LC_NAME");
 	  name_startup (NULL, locale, 0);
 	  name = locale->categories[LC_NAME].name;
 	  nothing = 1;
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index 22943f30ee..b35e6d60f5 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -97,7 +97,9 @@ numeric_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (numeric == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"), "LC_NUMERIC");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"),
+		   "LC_NUMERIC");
 	  numeric_startup (NULL, locale, 0);
 	  numeric = locale->categories[LC_NUMERIC].numeric;
 	  nothing = 1;
diff --git a/locale/programs/ld-paper.c b/locale/programs/ld-paper.c
index e20d789a98..2c1e4c64fb 100644
--- a/locale/programs/ld-paper.c
+++ b/locale/programs/ld-paper.c
@@ -87,7 +87,8 @@ paper_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (paper == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"), "LC_PAPER");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"), "LC_PAPER");
 	  paper_startup (NULL, locale, 0);
 	  paper = locale->categories[LC_PAPER].paper;
 	  nothing = 1;
diff --git a/locale/programs/ld-telephone.c b/locale/programs/ld-telephone.c
index 5d2ea490ad..1fd79fb516 100644
--- a/locale/programs/ld-telephone.c
+++ b/locale/programs/ld-telephone.c
@@ -90,8 +90,9 @@ telephone_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	 empty one.  */
       if (telephone == NULL)
 	{
-	  error (0, 0, _("No definition for %s category found"),
-		 "LC_TELEPHONE");
+	  if (! be_quiet)
+	    error (0, 0, _("No definition for %s category found"),
+		   "LC_TELEPHONE");
 	  telephone_startup (NULL, locale, 0);
 	  telephone = locale->categories[LC_TELEPHONE].telephone;
 	  nothing = 1;
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index 024590b7e4..941bffd34a 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -329,7 +329,7 @@ write_locale_data (const char *output_path, const char *category,
   int fd;
   char *fname;
 
-  fname = malloc (strlen (output_path) + 2 * strlen (category) + 6);
+  fname = malloc (strlen (output_path) + 2 * strlen (category) + 7);
   if (fname == NULL)
     error (5, errno, _("memory exhausted"));