diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-01-08 04:46:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-01-08 04:46:10 +0000 |
commit | f14854aab2b23d37c27c21975c5cb9f493f4ae82 (patch) | |
tree | e5c6d91baba29d96a949ac40de9af78b4532a0da | |
parent | 7c93d95dcf67ca7c53bd9bab9adeef60ea7b2503 (diff) | |
download | glibc-f14854aab2b23d37c27c21975c5cb9f493f4ae82.tar.gz glibc-f14854aab2b23d37c27c21975c5cb9f493f4ae82.tar.xz glibc-f14854aab2b23d37c27c21975c5cb9f493f4ae82.zip |
Update.
2000-01-06 Ulrich Drepper <drepper@cygnus.com> * localedata/Makefile (install-locales): Create locale directory if it does not exist. * locale/programs/charmap.c (charmap_read): Call lr_open here and not in parse_charmap. Try also the directories on the I18NPATH. (parse_charmap): Change accordingly.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | locale/programs/charmap.c | 85 | ||||
-rw-r--r-- | localedata/Makefile | 3 |
3 files changed, 59 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog index 14fe8665bc..bfe113ab5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2000-01-06 Ulrich Drepper <drepper@cygnus.com> + + * localedata/Makefile (install-locales): Create locale directory + if it does not exist. + + * locale/programs/charmap.c (charmap_read): Call lr_open here and + not in parse_charmap. Try also the directories on the I18NPATH. + (parse_charmap): Change accordingly. + 2000-01-05 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/i386/Dist: Distribute oldgetrlimit64.c diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c index 66adcb89db..9f2d8d4bf4 100644 --- a/locale/programs/charmap.c +++ b/locale/programs/charmap.c @@ -47,7 +47,7 @@ extern void *xmalloc (size_t __n); /* Prototypes for local functions. */ -static struct charmap_t *parse_charmap (const char *filename); +static struct charmap_t *parse_charmap (struct linereader *cmfile); static void new_width (struct linereader *cmfile, struct charmap_t *result, const char *from, const char *to, unsigned long int width); @@ -59,26 +59,52 @@ static void charmap_new_char (struct linereader *lr, struct charmap_t *cm, struct charmap_t * charmap_read (const char *filename) { - const char *pathnfile; struct charmap_t *result = NULL; if (filename != NULL) { - if (euidaccess (filename, R_OK) >= 0) - pathnfile = filename; - else if (filename[0] != '/') + struct linereader *cmfile; + + /* First try the name as found in the parameter. */ + cmfile = lr_open (filename, charmap_hash); + if (cmfile == NULL) { - char *cp = xmalloc (strlen (filename) + sizeof CHARMAP_PATH + 1); - stpcpy (stpcpy (stpcpy (cp, CHARMAP_PATH), "/"), filename); + /* No successful. So start looking through the directories + in the I18NPATH if this is a simple name. */ + if (strchr (filename, '/') == NULL) + { + char *i18npath = getenv ("I18NPATH"); + if (i18npath != NULL && *i18npath != '\0') + { + char path[strlen (filename) + 1 + strlen (i18npath) + + sizeof ("/charmaps/") - 1]; + char *next; + i18npath = strdupa (i18npath); + + + while (cmfile == NULL + && (next = strsep (&i18npath, ":")) != NULL) + { + stpcpy (stpcpy (stpcpy (path, next), "/charmaps/"), + filename); - pathnfile = (const char *) cp; + cmfile = lr_open (path, charmap_hash); + + if (cmfile == NULL) + { + /* Try without the "/charmaps" part. */ + stpcpy (stpcpy (path, next), filename); + + cmfile = lr_open (path, charmap_hash); + } + } + } + } } - else - pathnfile = NULL; - if (pathnfile != NULL) + if (cmfile != NULL) { - result = parse_charmap (pathnfile); + result = parse_charmap (cmfile); if (result == NULL && !be_quiet) error (0, errno, _("character map file `%s' not found"), filename); @@ -145,7 +171,11 @@ charmap_read (const char *filename) if (name != NULL) { - result = parse_charmap (buf); + struct linereader *cmfile; + + cmfile = lr_open (buf, charmap_hash); + result = (cmfile == NULL + ? NULL : parse_charmap (cmfile)); free (buf); @@ -163,9 +193,11 @@ charmap_read (const char *filename) if (result == NULL) { - pathnfile = CHARMAP_PATH "/" DEFAULT_CHARMAP; + struct linereader *cmfile; - result = parse_charmap (pathnfile); + cmfile = lr_open (CHARMAP_PATH "/" DEFAULT_CHARMAP, charmap_hash); + + result = cmfile == NULL ? NULL : parse_charmap (cmfile); if (result == NULL) error (4, errno, _("default character map file `%s' not found"), @@ -177,9 +209,8 @@ charmap_read (const char *filename) static struct charmap_t * -parse_charmap (const char *filename) +parse_charmap (struct linereader *cmfile) { - struct linereader *cmfile; struct charmap_t *result; int state; enum token_t expected_tok = tok_error; @@ -188,26 +219,6 @@ parse_charmap (const char *filename) char *to_name = NULL; enum token_t ellipsis = 0; - /* Determine path. */ - cmfile = lr_open (filename, charmap_hash); - if (cmfile == NULL) - { - if (strchr (filename, '/') == NULL) - { - /* Look in the systems charmap directory. */ - char *buf = xmalloc (strlen (filename) + 1 + sizeof (CHARMAP_PATH)); - - stpcpy (stpcpy (stpcpy (buf, CHARMAP_PATH), "/"), filename); - cmfile = lr_open (buf, charmap_hash); - - if (cmfile == NULL) - free (buf); - } - - if (cmfile == NULL) - return NULL; - } - /* We don't want symbolic names in string to be translated. */ cmfile->translate_strings = 0; diff --git a/localedata/Makefile b/localedata/Makefile index 6433e374ea..f919a7ea4e 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -90,6 +90,7 @@ endif # Sometimes the whole collection of locale files should be installed. LOCALEDEF=I18NPATH=. $(common-objpfx)elf/ld.so --library-path $(rpath-link) $(common-objpfx)locale/localedef install-locales: + $(..)./scripts/mkinstalldirs $(inst_localedir) while read locale charset; do \ case $$locale in \#*) continue;; esac; \ $(LOCALEDEF) -i locales/`echo $$locale | sed 's/\([^.]*\).*/\1/'` \ |