result->nlspath = __strdup (NLSPATH);
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)    /* We cannot get enough memory.  */    return (nl_catd) -1;  result->status = closed;  result->cat_name = __strdup (cat_name);  if (result->cat_name == NULL)    {      free (result);      __set_errno (ENOMEM);      return (nl_catd) -1;    }  if (strchr (cat_name, '/') == NULL)    {      if (flag == NL_CAT_LOCALE)	{	  env_var = getenv ("LC_ALL");	  if (env_var == NULL)	    {	      env_var = getenv ("LC_MESSAGES");	      if (env_var == NULL)		{		  env_var = getenv ("LANG");		  if (env_var == NULL)		    env_var = "C";		}	    }	}      else	{	  env_var = getenv ("LANG");	  if (env_var == NULL)	    env_var = "C";	}      result->env_var = __strdup (env_var);      if (result->env_var == NULL)	{	  free ((void *) result->cat_name);	  free ((void *) result);	  __set_errno (ENOMEM);	  return (nl_catd) -1;	}      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);      if (result->nlspath == NULL)	{	  free ((void *) result->cat_name);	  free ((void *) result->env_var);	  free ((void *) result);	  __set_errno (ENOMEM);	  return (nl_catd) -1;	}    }  else    {      result->env_var = NULL;      result->nlspath = NULL;    }  __libc_lock_init (result->lock);  return (nl_catd) result;}