summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-17 03:41:49 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-17 03:41:49 +0000
commitff407b13b9cd6277d6221d1c180866aedb6839cb (patch)
tree4bf3e8719b3c8ed8bcef15e12b7afcedbcca58a8
parent265ede2a16643facef3e6abc6d9169abc76ad8dd (diff)
(catopen): Always add NLSPATH to search path for catalogs, not only if
the envvar NLSPATH is not available.
-rw-r--r--catgets/catgets.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/catgets/catgets.c b/catgets/catgets.c
index b8e5bf0750..9228f970d6 100644
--- a/catgets/catgets.c
+++ b/catgets/catgets.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
@@ -34,6 +34,7 @@ catopen (const char *cat_name, int flag)
{
__nl_catd result;
const char *env_var;
+ const char *nlspath;
result = (__nl_catd) malloc (sizeof (*result));
if (result == NULL)
@@ -82,8 +83,16 @@ catopen (const char *cat_name, int flag)
return (nl_catd) -1;
}
- if (__secure_getenv ("NLSPATH") != NULL)
- result->nlspath = __strdup (getenv ("NLSPATH"));
+ nlspath = __secure_getenv ("NLSPATH");
+ if (nlspath != NULL && *nlspath != '\0')
+ {
+ /* Append the system dependent directory. */
+ size_t len = strlen (nlspath + 1 + sizeof NLSPATH);
+ char *tmp = alloca (len);
+
+ __stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH);
+ nlspath = tmp;
+ }
else
result->nlspath = __strdup (NLSPATH);