From: Ulrich Drepper Date: Mon, 17 Mar 1997 03:49:00 +0000 (+0000) Subject: When named file not found and not absolute use path in I18NPATH. X-Git-Tag: cvs/glibc-2_0_4~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31f43cffe0aedadfc11c556445b917ecd8d4e3c6;p=thirdparty%2Fglibc.git When named file not found and not absolute use path in I18NPATH. --- diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c index 09d987a14e7..aecc8913e25 100644 --- a/locale/programs/locfile.c +++ b/locale/programs/locfile.c @@ -1,6 +1,6 @@ /* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Ulrich Drepper, . + Contributed by Ulrich Drepper , 1996. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -76,10 +77,31 @@ locfile_read (const char *filename, struct charset_t *charset) { if (filename[0] != '/') { - char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)]; + char *i18npath = __secure_getenv ("I18NPATH"); + if (i18npath != NULL && *i18npath != '\0') + { + char path[strlen (filename) + 1 + strlen (i18npath) + 1]; + char *next; + i18npath = strdupa (i18npath); + + + while (ldfile == NULL + && (next = strsep (&i18npath, ":")) != NULL) + { + stpcpy (stpcpy (stpcpy (path, next), "/"), filename); + + ldfile = lr_open (path, locfile_hash); + } + } - stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename); - ldfile = lr_open (path, locfile_hash); + /* Test in the default directory. */ + if (ldfile == NULL) + { + char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)]; + + stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename); + ldfile = lr_open (path, locfile_hash); + } } if (ldfile == NULL)