* path.cc (normalize_win32_path): Handle UNC paths better.

(slash_unc_prefix_p): Allow backslash UNC paths.
This commit is contained in:
Christopher Faylor 2000-12-03 06:21:40 +00:00
parent 92311ab5e5
commit 191bacb0be
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,8 @@
Sun Dec 3 01:20:25 2000 Christopher Faylor <cgf@cygnus.com>
* path.cc (normalize_win32_path): Handle UNC paths better.
(slash_unc_prefix_p): Allow backslash UNC paths.
Sun Dec 3 00:20:25 2000 Christopher Faylor <cgf@cygnus.com>
* Makefile.in: Remove some extra cruft.

View File

@ -713,12 +713,20 @@ normalize_win32_path (const char *src, char *dst)
char *dst_start = dst;
char *dst_root_start = dst;
if (strchr (src, ':') == NULL)
if (strchr (src, ':') == NULL && !slash_unc_prefix_p (src))
{
if (!cygcwd.get (dst, 0))
return get_errno ();
if (SLASH_P (src[0]))
dst[2] = '\0';
if (dst[1] == ':')
dst[2] = '\0';
else if (slash_unc_prefix_p (dst))
{
char *p = strpbrk (dst + 2, "\\/");
if (p && (p = strpbrk (p + 1, "\\/")))
*p = '\0';
}
else if (strlen (dst) + 1 + strlen (src) >= MAX_PATH)
{
debug_printf ("ENAMETOOLONG = normalize_win32_path (%s)", src);
@ -881,7 +889,7 @@ slash_unc_prefix_p (const char *path)
&& isalpha (path[2])
&& path[3] != 0
&& !isdirsep (path[3])
&& ((p = strchr(&path[3], '/')) != NULL));
&& ((p = strpbrk(path + 3, "\\/")) != NULL));
if (!ret || p == NULL)
return ret;
return ret && isalnum (p[1]);