]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(catopen): Always add NLSPATH to search path for catalogs, not only if
authorUlrich Drepper <drepper@redhat.com>
Mon, 17 Mar 1997 03:41:49 +0000 (03:41 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 17 Mar 1997 03:41:49 +0000 (03:41 +0000)
the envvar NLSPATH is not available.

catgets/catgets.c

index b8e5bf0750c80ded32971973743dfc3626a720d2..9228f970d62520b4b0fba78d62ee6f57ae241eb5 100644 (file)
@@ -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);