summary refs log tree commit diff
path: root/locale/programs/localedef.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-19 13:33:29 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-19 13:33:29 +0000
commit816e6eb5a786594223586976c08e337bc08b6f4e (patch)
treef40c1af0b36c777b5987dc6c888e9492518d14da /locale/programs/localedef.c
parent685c167680a6d1040abc5ff33bd25e5f423f9405 (diff)
downloadglibc-816e6eb5a786594223586976c08e337bc08b6f4e.tar.gz
glibc-816e6eb5a786594223586976c08e337bc08b6f4e.tar.xz
glibc-816e6eb5a786594223586976c08e337bc08b6f4e.zip
Update.
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.
Diffstat (limited to 'locale/programs/localedef.c')
-rw-r--r--locale/programs/localedef.c37
1 files changed, 20 insertions, 17 deletions
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)
 	    {