aboutsummaryrefslogtreecommitdiff
path: root/locale/programs/localedef.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/localedef.c
parent0f0e233c0e6a7c3df341566bbbd60917439f9cc9 (diff)
downloadglibc-b9eb05d6bfd4c42c8ea614b77cbc50d95fee51d1.tar
glibc-b9eb05d6bfd4c42c8ea614b77cbc50d95fee51d1.tar.gz
glibc-b9eb05d6bfd4c42c8ea614b77cbc50d95fee51d1.tar.bz2
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/localedef.c')
-rw-r--r--locale/programs/localedef.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 5eadbf3570..4fe3a28943 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -26,6 +26,7 @@
#include <fcntl.h>
#include <libintl.h>
#include <locale.h>
+#include <mcheck.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -134,6 +135,9 @@ main (int argc, char *argv[])
struct localedef_t global;
int remaining;
+ /* Enable `malloc' debugging. */
+ mcheck (NULL);
+
/* Set initial values for global variables. */
copy_list = NULL;
posix_conformance = getenv ("POSIXLY_CORRECT") != NULL;
@@ -196,7 +200,7 @@ main (int argc, char *argv[])
{
struct localedef_t *runp = locales;
- while (runp != NULL && runp->needed == runp->avail)
+ while (runp != NULL && (runp->needed & runp->avail) == runp->needed)
runp = runp->next;
if (runp == NULL)
@@ -429,7 +433,8 @@ normalize_codeset (codeset, name_len)
struct localedef_t *
-add_to_readlist (int locale, const char *name, const char *repertoire_name)
+add_to_readlist (int locale, const char *name, const char *repertoire_name,
+ int generate)
{
struct localedef_t *runp = locales;
@@ -439,7 +444,11 @@ add_to_readlist (int locale, const char *name, const char *repertoire_name)
if (runp == NULL)
{
/* Add a new entry at the end. */
- struct localedef_t *newp = xcalloc (1, sizeof (struct localedef_t));
+ struct localedef_t *newp;
+
+ assert (generate == 1);
+
+ newp = xcalloc (1, sizeof (struct localedef_t));
newp->name = name;
newp->repertoire_name = repertoire_name;
@@ -454,7 +463,7 @@ add_to_readlist (int locale, const char *name, const char *repertoire_name)
}
}
- if ((runp->needed & (1 << locale)) != 0)
+ if (generate && (runp->needed & (1 << locale)) != 0)
error (5, 0, _("circular dependencies between locale definitions"));
runp->needed |= 1 << locale;
@@ -467,9 +476,15 @@ struct localedef_t *
find_locale (int locale, const char *name, const char *repertoire_name,
struct charmap_t *charmap)
{
- struct localedef_t *result = add_to_readlist (locale, name, repertoire_name);
+ struct localedef_t *result;
+
+ /* Find the locale, but do not generate it since this would be a bug. */
+ result = add_to_readlist (locale, name, repertoire_name, 0);
+
+ assert (result != NULL);
- if (locfile_read (result, charmap) != 0)
+ if ((result->avail & (1 << locale)) == 0
+ && locfile_read (result, charmap) != 0)
error (4, errno, _("cannot open locale definition file `%s'"),
result->name);