summary refs log tree commit diff
path: root/locale/programs/locfile.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-09-12 08:28:56 +0000
committerUlrich Drepper <drepper@redhat.com>1999-09-12 08:28:56 +0000
commitb9eb05d6bfd4c42c8ea614b77cbc50d95fee51d1 (patch)
tree7d42913f77a3db0fe5f54807a248578fe747e3d1 /locale/programs/locfile.c
parent0f0e233c0e6a7c3df341566bbbd60917439f9cc9 (diff)
downloadglibc-b9eb05d6bfd4c42c8ea614b77cbc50d95fee51d1.tar.gz
glibc-b9eb05d6bfd4c42c8ea614b77cbc50d95fee51d1.tar.xz
glibc-b9eb05d6bfd4c42c8ea614b77cbc50d95fee51d1.zip
Update.
1999-09-12  Ulrich Drepper  <drepper@cygnus.com>

	* locale/programs/ld-address.c: Fix handling of non-existing
	definitions for this category.  Correctly ignore content of this
	category is this is necessary.
	* locale/programs/ld-collate.c: Likewise.
	* locale/programs/ld-ctype.c: Likewise.
	* locale/programs/ld-identification.c: Likewise.
	* locale/programs/ld-measurement.c: Likewise.
	* locale/programs/ld-messages.c: Likewise.
	* locale/programs/ld-monetary.c: Likewise.
	* locale/programs/ld-name.c: Likewise.
	* locale/programs/ld-numeric.c: Likewise.
	* locale/programs/ld-paper.c: Likewise.
	* locale/programs/ld-telephone.c: Likewise.
	* locale/programs/ld-time.c: Likewise.
	* locale/programs/locfile.h (handle_copy): Take extra parameter
	with result pointer.  Fill in name of locale from which to copy.
	Correctly read token after `END'.

	* locale/programs/localedef.c (main): Correct handling copy.
	(add_to_readlist): Take extra parameter which says whether we
	are supposed to read the file or not.
	(find_locale): Call add_to_readlist with extra parameter set to 0.

	* locale/programs/localedef.h (struct localedef_t): Use __LC_LAST
	instead of wrong number in array definitions.
	(add_to_readlist): Update prototype.

	* locale/programs/locfile.c (locfile_read): Mark categories not
	available in source file as read.
	(write_all_categories): Fix typo.
Diffstat (limited to 'locale/programs/locfile.c')
-rw-r--r--locale/programs/locfile.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index fd858e2541..024590b7e4 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -41,6 +41,7 @@ locfile_read (struct localedef_t *result, struct charmap_t *charmap)
   const char *repertoire_name = result->repertoire_name;
   int locale_mask = result->needed ^ result->avail;
   struct linereader *ldfile;
+  int not_here = ALL_LOCALES;
 
   /* If no repertoire name was specified use the global one.  */
   if (repertoire_name == NULL)
@@ -158,72 +159,84 @@ argument to `%s' must be a single character"),
 	  ctype_read (ldfile, result, charmap, repertoire_name,
 		      (locale_mask & CTYPE_LOCALE) == 0);
 	  result->avail |= locale_mask & CTYPE_LOCALE;
+	  not_here ^= CTYPE_LOCALE;
 	  continue;
 
 	case tok_lc_collate:
 	  collate_read (ldfile, result, charmap, repertoire_name,
 			(locale_mask & COLLATE_LOCALE) == 0);
 	  result->avail |= locale_mask & COLLATE_LOCALE;
+	  not_here ^= COLLATE_LOCALE;
 	  continue;
 
 	case tok_lc_monetary:
 	  monetary_read (ldfile, result, charmap, repertoire_name,
 			 (locale_mask & MONETARY_LOCALE) == 0);
 	  result->avail |= locale_mask & MONETARY_LOCALE;
+	  not_here ^= MONETARY_LOCALE;
 	  continue;
 
 	case tok_lc_numeric:
 	  numeric_read (ldfile, result, charmap, repertoire_name,
 			(locale_mask & NUMERIC_LOCALE) == 0);
 	  result->avail |= locale_mask & NUMERIC_LOCALE;
+	  not_here ^= NUMERIC_LOCALE;
 	  continue;
 
 	case tok_lc_time:
 	  time_read (ldfile, result, charmap, repertoire_name,
 		     (locale_mask & TIME_LOCALE) == 0);
 	  result->avail |= locale_mask & TIME_LOCALE;
+	  not_here ^= TIME_LOCALE;
 	  continue;
 
 	case tok_lc_messages:
 	  messages_read (ldfile, result, charmap, repertoire_name,
 			 (locale_mask & MESSAGES_LOCALE) == 0);
 	  result->avail |= locale_mask & MESSAGES_LOCALE;
+	  not_here ^= MESSAGES_LOCALE;
 	  continue;
 
 	case tok_lc_paper:
 	  paper_read (ldfile, result, charmap, repertoire_name,
 		      (locale_mask & PAPER_LOCALE) == 0);
 	  result->avail |= locale_mask & PAPER_LOCALE;
+	  not_here ^= PAPER_LOCALE;
 	  continue;
 
 	case tok_lc_name:
 	  name_read (ldfile, result, charmap, repertoire_name,
 		     (locale_mask & NAME_LOCALE) == 0);
 	  result->avail |= locale_mask & NAME_LOCALE;
+	  not_here ^= NAME_LOCALE;
 	  continue;
 
 	case tok_lc_address:
 	  address_read (ldfile, result, charmap, repertoire_name,
 			(locale_mask & ADDRESS_LOCALE) == 0);
 	  result->avail |= locale_mask & ADDRESS_LOCALE;
+	  not_here ^= ADDRESS_LOCALE;
 	  continue;
 
 	case tok_lc_telephone:
 	  telephone_read (ldfile, result, charmap, repertoire_name,
 			  (locale_mask & TELEPHONE_LOCALE) == 0);
 	  result->avail |= locale_mask & TELEPHONE_LOCALE;
+	  not_here ^= TELEPHONE_LOCALE;
 	  continue;
 
 	case tok_lc_measurement:
 	  measurement_read (ldfile, result, charmap, repertoire_name,
 			    (locale_mask & MEASUREMENT_LOCALE) == 0);
 	  result->avail |= locale_mask & MEASUREMENT_LOCALE;
+	  not_here ^= MEASUREMENT_LOCALE;
 	  continue;
 
 	case tok_lc_identification:
 	  identification_read (ldfile, result, charmap, repertoire_name,
 			       (locale_mask & IDENTIFICATION_LOCALE) == 0);
 	  result->avail |= locale_mask & IDENTIFICATION_LOCALE;
+	  not_here ^= IDENTIFICATION_LOCALE;
 	  continue;
 
 	default:
@@ -239,6 +252,10 @@ syntax error: not inside a locale definition section"));
   /* We read all of the file.  */
   lr_close (ldfile);
 
+  /* Mark the categories which are not contained in the file.  We assume
+     them to be available and the default data will be used.  */
+  result->avail |= not_here;
+
   return 0;
 }
 
@@ -299,7 +316,7 @@ write_all_categories (struct localedef_t *definitions,
   int cnt;
 
   for (cnt = 0; cnt < sizeof (write_funcs) / sizeof (write_funcs[0]); ++cnt)
-    if (check_funcs[cnt] != NULL)
+    if (write_funcs[cnt] != NULL)
       write_funcs[cnt] (definitions, charmap, output_path);
 }