#endif
if (prefix == 0)
- prefix = getenv (temp = concat (key, "_ROOT", NULL_PTR));
+ prefix = getenv (temp = concat (key, "_ROOT", NULL));
if (prefix == 0)
prefix = std_prefix;
arg = va_arg (args, const char *);
}
- newstr = (char *) malloc (length + 1);
+ newstr = (char *) xmalloc (length + 1);
va_end (args);
/* Now copy the individual pieces to the result string. */
{
register char *result = xmalloc (len + 1);
- bcopy (s, result, len);
+ memcpy (result, s, len);
result[len] = 0;
return result;
}
}
size = 32;
- dst = (char *) malloc (size);
+ dst = (char *) xmalloc (size);
res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size);
if (res == ERROR_MORE_DATA && type == REG_SZ)
{
- dst = (char *) realloc (dst, size);
+ dst = (char *) xrealloc (dst, size);
res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size);
}
if (prefix == 0)
prefix = PREFIX;
- /* Remove any trailing directory separator from what we got. First check
- for an empty prefix. */
- if (prefix[0] && IS_DIR_SEPARATOR (prefix[strlen (prefix) - 1]))
- {
- char * temp = xstrdup (prefix);
- temp[strlen (temp) - 1] = 0;
- prefix = temp;
- }
+ /* We used to strip trailing DIR_SEPARATORs here, but that can
+ sometimes yield a result with no separator when one was coded
+ and intended by the user, causing two path components to run
+ together. */
- return concat (prefix, name, NULL_PTR);
+ return concat (prefix, name, NULL);
}
/* Update PATH using KEY if PATH starts with PREFIX. */
if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
{
if (key[0] != '$')
- key = concat ("@", key, NULL_PTR);
+ key = concat ("@", key, NULL);
- path = concat (key, &path[strlen (std_prefix)], NULL_PTR);
+ path = concat (key, &path[strlen (std_prefix)], NULL);
while (path[0] == '@' || path[0] == '$')
path = translate_name (path);
}
+#ifdef UPDATE_PATH_HOST_CANONICALIZE
+/* Perform host dependant canonicalization when needed. */
+UPDATE_PATH_HOST_CANONICALIZE (path, key);
+#endif
+
#ifdef DIR_SEPARATOR_2
/* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
if (DIR_SEPARATOR != DIR_SEPARATOR_2)