about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-12-11 07:25:44 +0000
committerUlrich Drepper <drepper@redhat.com>1999-12-11 07:25:44 +0000
commitd980842cab63c6ccc760aa89341a3ed9006cba12 (patch)
tree97df07e5cef67e870a0b715f0feaa94cb6ca90b8
parent6bfd66472166f6806971759294ddbdf70d2c1274 (diff)
downloadglibc-d980842cab63c6ccc760aa89341a3ed9006cba12.tar.gz
glibc-d980842cab63c6ccc760aa89341a3ed9006cba12.tar.xz
glibc-d980842cab63c6ccc760aa89341a3ed9006cba12.zip
Update.
	* locale/programs/ld-collate.c: Implement "copy" in LC_COLLATE.
-rw-r--r--ChangeLog2
-rw-r--r--locale/programs/ld-collate.c27
2 files changed, 23 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 258530bb79..63088b293b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 1999-12-10  Ulrich Drepper  <drepper@cygnus.com>
 
+	* locale/programs/ld-collate.c: Implement "copy" in LC_COLLATE.
+
 	* locale/programs/ld-collate.c (collate_read): Add handling of
 	reorder-after.
 
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 84472f30fb..982462f7b3 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -714,15 +714,19 @@ insert_value (struct linereader *ldfile, struct token *arg,
 
 static void
 collate_startup (struct linereader *ldfile, struct localedef_t *locale,
-		 int ignore_content)
+		 struct localedef_t *copy_locale, int ignore_content)
 {
   if (!ignore_content)
     {
       struct locale_collate_t *collate;
 
-      collate = locale->categories[LC_COLLATE].collate =
-	(struct locale_collate_t *) xcalloc (1,
-					     sizeof (struct locale_collate_t));
+      if (copy_locale == NULL)
+	collate = locale->categories[LC_COLLATE].collate =
+	  (struct locale_collate_t *) xcalloc (1,
+					       sizeof (struct locale_collate_t));
+      else
+	collate = locale->categories[LC_COLLATE].collate =
+	  copy_locale->categories[LC_COLLATE].collate;
 
       /* Init the various data structures.  */
       init_hash (&collate->elem_table, 100);
@@ -763,6 +767,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
   enum token_t nowtok;
   int state = 0;
   int was_ellipsis = 0;
+  struct localedef_t *copy_locale = NULL;
 
   /* Get the repertoire we have to use.  */
   if (repertoire_name != NULL)
@@ -786,6 +791,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
 	{
 	  SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
 
+	skip_category:
 	  do
 	    now = lr_token (ldfile, charmap, NULL);
 	  while (now->tok != tok_eof && now->tok != tok_end);
@@ -805,7 +811,16 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
 	  return;
 	}
 
-      /* XXX Use the name */
+      /* Get the locale definition.  */
+      copy_locale = find_locale (LC_COLLATE, now->val.str.startmb,
+				 repertoire_name, charmap);
+      if ((copy_locale->avail & COLLATE_LOCALE) == 0)
+	{
+	  /* Not yet loaded.  So do it now.  */
+	  if (locfile_read (copy_locale, charmap) != 0)
+	    goto skip_category;
+	}
+
       lr_ignore_rest (ldfile, 1);
 
       now = lr_token (ldfile, charmap, NULL);
@@ -813,7 +828,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
     }
 
   /* Prepare the data structures.  */
-  collate_startup (ldfile, result, ignore_content);
+  collate_startup (ldfile, result, copy_locale, ignore_content);
   collate = result->categories[LC_COLLATE].collate;
 
   while (1)