summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--iconv/gconv.c13
-rw-r--r--iconv/gconv_db.c17
-rw-r--r--locale/programs/ld-collate.c5
-rw-r--r--locale/programs/ld-ctype.c3
-rw-r--r--locale/programs/ld-messages.c3
-rw-r--r--locale/programs/ld-monetary.c15
-rw-r--r--locale/programs/ld-numeric.c5
-rw-r--r--locale/programs/ld-time.c3
-rw-r--r--locale/programs/localedef.c37
-rw-r--r--locale/programs/locales.h22
-rw-r--r--locale/programs/locfile.c1
-rw-r--r--localedata/ChangeLog4
-rw-r--r--localedata/locales/POSIX3
-rw-r--r--manual/locale.texi2
15 files changed, 123 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 9111b18e1b..726fee9ace 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+1998-10-19 13:24  Ulrich Drepper  <drepper@cygnus.com>
+
+	* locale/programs/ld-collate.c (collate_startup): Clear bit for this
+	category in copy_posix.
+	(collate_finish): Don't warn about UNDEFINED not being defined.
+	* locale/programs/ld-ctype.c (ctype_startup): Clear bit for this
+	category in copy_posix.
+	* locale/programs/ld-messages.c (messages_startup): Likewise.
+	* locale/programs/ld-monetary.c (monetary_startup): Likewise.
+	* locale/programs/ld-numeric.c (numeric_startup): Likewise.
+	* locale/programs/ld-time.c (time_startup): Likewise.
+	* locale/programs/localedef.c: Move copy_def_list_t definition into
+	locales.h.  Define copy_posix variable.
+	(main): Before processing copy list add &copy_posix to copy_list.
+	* locale/programs/locales.h: Add definition of copy_def_list_t.
+	* locale/programs/locfile.c: Clear bit for appropriate category in
+	case of an copy instruction.
+
 1998-10-19  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/unix/sysv/linux/i386/setresgid.c: Remove #include of
diff --git a/iconv/gconv.c b/iconv/gconv.c
index 9484fc8881..ceefffcc87 100644
--- a/iconv/gconv.c
+++ b/iconv/gconv.c
@@ -22,8 +22,10 @@
 #include <assert.h>
 #include <gconv.h>
 #include <sys/param.h>
-#include <elf/ldsodefs.h>
 
+#ifndef STATIC_GCONV
+# include <elf/ldsodefs.h>
+#endif
 
 int
 internal_function
@@ -41,8 +43,12 @@ __gconv (gconv_t cd, const char **inbuf, const char *inbufend, char **outbuf,
 
   if (inbuf == NULL || *inbuf == NULL)
     /* We just flush.  */
+#ifdef _CALL_DL_FCT
     result = _CALL_DL_FCT (cd->steps->fct,
 			   (cd->steps, cd->data, NULL, NULL, converted, 1));
+#else
+    result = cd->steps->fct (cd->steps, cd->data, NULL, NULL, converted, 1);
+#endif
   else
     {
       const char *last_start;
@@ -54,9 +60,14 @@ __gconv (gconv_t cd, const char **inbuf, const char *inbufend, char **outbuf,
       do
 	{
 	  last_start = *inbuf;
+#ifdef _CALL_DL_FCT
 	  result = _CALL_DL_FCT (cd->steps->fct,
 				 (cd->steps, cd->data, inbuf, inbufend,
 				  converted, 0));
+#else
+	  result = cd->steps->fct (cd->steps, cd->data, inbuf, inbufend,
+				   converted, 0);
+#endif
 	}
       while (result == GCONV_EMPTY_INPUT && last_start != *inbuf
 	     && *inbuf + cd->steps->min_needed_from <= inbufend);
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
index d5d075df88..cbaaf18339 100644
--- a/iconv/gconv_db.c
+++ b/iconv/gconv_db.c
@@ -22,7 +22,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <bits/libc-lock.h>
-#include <elf/ldsodefs.h>
+
+#ifndef STATIC_GCONV
+# include <elf/ldsodefs.h>
+#endif
 
 #include <gconv_int.h>
 
@@ -155,7 +158,11 @@ free_derivation (void *p)
 
   for (cnt = 0; cnt < deriv->nsteps; ++cnt)
     if (deriv->steps[cnt].end_fct)
+#ifdef _CALL_DL_FCT
       _CALL_DL_FCT (deriv->steps[cnt].end_fct, (&deriv->steps[cnt]));
+#else
+      deriv->steps[cnt].end_fct (&deriv->steps[cnt]);
+#endif
 
   free ((struct gconv_step *) deriv->steps);
   free (deriv);
@@ -221,7 +228,11 @@ gen_steps (struct derivation_step *best, const char *toset,
 
 	  /* Call the init function.  */
 	  if (result[step_cnt].init_fct != NULL)
+#ifdef _CALL_DL_FCT
 	    _CALL_DL_FCT (result[step_cnt].init_fct, (&result[step_cnt]));
+#else
+	    result[step_cnt].init_fct (&result[step_cnt]);
+#endif
 
 	  current = current->last;
 	}
@@ -232,7 +243,11 @@ gen_steps (struct derivation_step *best, const char *toset,
 	  while (++step_cnt < *nsteps)
 	    {
 	      if (result[step_cnt].end_fct != NULL)
+#ifdef _CALL_DL_FCT
 		_CALL_DL_FCT (result[step_cnt].end_fct, (&result[step_cnt]));
+#else
+		result[step_cnt].end_fct (&result[step_cnt]);
+#endif
 #ifndef STATIC_GCONV
 	      __gconv_release_shlib (result[step_cnt].shlib_handle);
 #endif
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index a92ff1154a..b9734c36dd 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -155,6 +155,9 @@ collate_startup (struct linereader *lr, struct localedef_t *locale,
 {
   struct locale_collate_t *collate;
 
+  /* We have a definition for LC_COLLATE.  */
+  copy_posix.mask &= ~(1 << LC_COLLATE);
+
   /* It is important that we always use UCS4 encoding for strings now.  */
   encoding_method = ENC_UCS4;
 
@@ -260,7 +263,7 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
       \**************************************************************/
       u_int32_t weight;
 
-      if (!be_quiet)
+      if (/* XXX Remove the 0 & */ 0 && !be_quiet)
 	error (0, 0, _("no definition of `UNDEFINED'"));
 
       collate->undefined.ordering_len = collate->nrules;
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 01d37e3fc4..a4dcd76807 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -135,6 +135,9 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
   unsigned int cnt;
   struct locale_ctype_t *ctype;
 
+  /* We have a definition for LC_CTYPE.  */
+  copy_posix.mask &= ~(1 << LC_CTYPE);
+
   /* It is important that we always use UCS1 encoding for strings now.  */
   encoding_method = ENC_UCS1;
 
diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c
index 9353e1e49e..e52f5413e2 100644
--- a/locale/programs/ld-messages.c
+++ b/locale/programs/ld-messages.c
@@ -60,6 +60,9 @@ messages_startup (struct linereader *lr, struct localedef_t *locale,
 {
   struct locale_messages_t *messages;
 
+  /* We have a definition for LC_MESSAGES.  */
+  copy_posix.mask &= ~(1 << LC_MESSAGES);
+
   /* It is important that we always use UCS1 encoding for strings now.  */
   encoding_method = ENC_UCS1;
 
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index d202d76399..4aede4691f 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -84,6 +84,9 @@ monetary_startup (struct linereader *lr, struct localedef_t *locale,
 {
   struct locale_monetary_t *monetary;
 
+  /* We have a definition for LC_MONETARY.  */
+  copy_posix.mask &= ~(1 << LC_MONETARY);
+
   /* It is important that we always use UCS1 encoding for strings now.  */
   encoding_method = ENC_UCS1;
 
@@ -129,15 +132,17 @@ monetary_finish (struct localedef_t *locale)
   /* The international currency symbol must come from ISO 4217.  */
   if (monetary->int_curr_symbol != NULL)
     {
-      if (strlen (monetary->int_curr_symbol) != 4)
+      if (strlen (monetary->int_curr_symbol) != 4
+	  && monetary->int_curr_symbol[0] != '\0')
 	{
 	  if (!be_quiet)
 	    error (0, 0, _("\
 value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"));
 	}
-      else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
-			NR_VALID_INT_CURR, sizeof (const char *),
-			(comparison_fn_t) curr_strcmp) == NULL
+      else if (monetary->int_curr_symbol[0] != '\0'
+	       && 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, _("\
 value of field `int_curr_symbol' in category `LC_MONETARY' does \
@@ -336,6 +341,8 @@ field `%s' in category `%s' declared more than once"),			      \
 	lr_error (lr, _("\
 field `%s' in category `%s' declared more than once"),			      \
 		  #cat, "LC_MONETARY");					      \
+      else if (code->tok == tok_minus1)					      \
+	monetary->cat = -1;						      \
       else								      \
 	monetary->cat = code->val.num;					      \
       break
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index 2454281a4d..bbc575852d 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -54,6 +54,9 @@ numeric_startup (struct linereader *lr, struct localedef_t *locale,
 {
   struct locale_numeric_t *numeric;
 
+  /* We have a definition for LC_NUMERIC.  */
+  copy_posix.mask &= ~(1 << LC_NUMERIC);
+
   /* It is important that we always use UCS1 encoding for strings now.  */
   encoding_method = ENC_UCS1;
 
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index e16a247430..aa401627f2 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -90,6 +90,9 @@ time_startup (struct linereader *lr, struct localedef_t *locale,
 {
   struct locale_time_t *time;
 
+  /* We have a definition for LC_TIME.  */
+  copy_posix.mask &= ~(1 << LC_TIME);
+
   /* It is important that we always use UCS1 encoding for strings now.  */
   encoding_method = ENC_UCS1;
 
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 94d6255378..f208d8b874 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -38,27 +38,21 @@
 #include "error.h"
 #include "charset.h"
 #include "locfile.h"
+#include "locales.h"
 
 /* Undefine the following line in the production version.  */
 /* #define NDEBUG 1 */
 #include <assert.h>
 
 
-/* List of locale definition files which are used in `copy' instructions.  */
-struct copy_def_list_t
+/* This is a special entry of the copylist.  For all categories we don't
+   have a definition we use the data for the POSIX locale.  */
+struct copy_def_list_t copy_posix =
 {
-  struct copy_def_list_t *next;
-
-  const char *name;
-  int mask;
-
-  struct localedef_t *locale;
-
-  struct
-  {
-    void *data;
-    size_t len;
-  } binary[6];
+  next: NULL,
+  name: "POSIX",
+  mask: (1 << LC_ALL) - 1,
+  locale: NULL
 };
 
 
@@ -153,7 +147,6 @@ main (int argc, char *argv[])
   int remaining;
 
   /* Set initial values for global variables.  */
-  copy_list = NULL;
   posix_conformance = getenv ("POSIXLY_CORRECT") != NULL;
   error_print_progname = error_print;
 
@@ -204,6 +197,10 @@ main (int argc, char *argv[])
   if (localedef->failed != 0)
     error (4, errno, _("cannot open locale definition file `%s'"), input_file);
 
+  /* Make sure all categories are defined.  */
+  copy_posix.next = copy_list;
+  copy_list = &copy_posix;
+
   /* Perhaps we saw some `copy' instructions.  Process the given list.
      We use a very simple algorithm: we look up the list from the
      beginning every time.  */
@@ -229,8 +226,14 @@ main (int argc, char *argv[])
 	  int avail = 0;
 
 	  if (act_add_locdef->locale == NULL)
-	    act_add_locdef->locale = locfile_read (act_add_locdef->name,
-						   charset);
+	    {
+	      /* Saving the mask is an ugly trick to prevent the reader
+		 from modifying `copy_posix' if we currently process it.  */
+	      int save_mask = act_add_locdef->mask;
+	      act_add_locdef->locale = locfile_read (act_add_locdef->name,
+						     charset);
+	      act_add_locdef->mask = save_mask;
+	    }
 
 	  if (! act_add_locdef->locale->failed)
 	    {
diff --git a/locale/programs/locales.h b/locale/programs/locales.h
index eab909e7c8..1cd3a3f92e 100644
--- a/locale/programs/locales.h
+++ b/locale/programs/locales.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
 
@@ -33,6 +33,26 @@
 #include "localeinfo.h"
 
 
+/* List of locale definition files which are used in `copy' instructions.  */
+struct copy_def_list_t
+{
+  struct copy_def_list_t *next;
+
+  const char *name;
+  int mask;
+
+  struct localedef_t *locale;
+
+  struct
+  {
+    void *data;
+    size_t len;
+  } binary[6];
+};
+
+extern struct copy_def_list_t copy_posix;
+
+
 /* Header of the locale data files.  */
 struct locale_file
 {
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index 5a3fc25e3d..0485b61645 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -116,6 +116,7 @@ locfile_read (const char *filename, struct charset_t *charset)
 #define HANDLE_COPY(category, token, string)				      \
   if (nowtok == tok_copy)						      \
     {									      \
+      copy_posix.mask &= ~(1 << category);				      \
       copy_category = category;						      \
       expected_tok = token;						      \
       expected_str = string;						      \
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 30e1724fcb..c221f85d0d 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,7 @@
+1998-10-19 13:31  Ulrich Drepper  <drepper@cygnus.com>
+
+	* locales/POSIX: Correct typo.  Add UNDEFINED symbol.
+
 1998-10-14  Ulrich Drepper  <drepper@cygnus.com>
 
 	* locales/gr_GR: Renamed to...
diff --git a/localedata/locales/POSIX b/localedata/locales/POSIX
index a60ccd8927..7d65b351ff 100644
--- a/localedata/locales/POSIX
+++ b/localedata/locales/POSIX
@@ -21,7 +21,7 @@
 # Distribution and use is free, also for
 # commercial purposes.
 
-repertoire_map mnemonic.ds
+repertoiremap mnemonic.ds
 
 LC_CTYPE
 # The following is the POSIX Locale LC_CTYPE.
@@ -206,6 +206,7 @@ order_start forward
 <right-curly-bracket>
 <tilde>
 <DEL>
+<UNDEFINED>
 order_end
 #
 END LC_COLLATE
diff --git a/manual/locale.texi b/manual/locale.texi
index 6128df7740..6208710121 100644
--- a/manual/locale.texi
+++ b/manual/locale.texi
@@ -289,7 +289,7 @@ with_other_locale (char *new_locale,
 
   /* @r{Copy the name so it won't be clobbered by @code{setlocale}.} */
   saved_locale = strdup (old_locale);
-  if (old_locale == NULL)
+  if (saved_locale == NULL)
     fatal ("Out of memory");
 
   /* @r{Now change the locale and do some stuff with it.} */