* path.cc (normalize_win32_path): Honor network paths. Fold more

than two leading dir separators into one.  Check for dir separator
	instead of just slashes to handle incoming Win32 paths correctly.
This commit is contained in:
Corinna Vinschen 2005-08-25 20:35:25 +00:00
parent 4a8b3ef692
commit 9d13e04523
2 changed files with 25 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2005-08-25 Corinna Vinschen <corinna@vinschen.de>
* path.cc (normalize_win32_path): Honor network paths. Fold more
than two leading dir separators into one. Check for dir separator
instead of just slashes to handle incoming Win32 paths correctly.
2005-08-25 Christopher Faylor <cgf@timesys.com>
* errno.cc (errmap): Translate ERROR_NO_MORE_ITEMS to ENMFILE.

View File

@ -1089,18 +1089,29 @@ normalize_win32_path (const char *src, char *dst, char *&tail)
bool beg_src_slash = isdirsep (src[0]);
tail = dst;
if (beg_src_slash && isdirsep (src[1]) && src[2])
if (beg_src_slash && isdirsep (src[1]))
{
*tail++ = '\\';
src++;
if (src[1] == '.' && isdirsep (src[2]))
{
*tail++ = '\\';
*tail++ = '.';
if (isdirsep (src[2]))
{
/* More than two slashes are just folded into one. */
src += 2;
while (isdirsep (src[1]))
++src;
}
else
{
/* Two slashes start a network or device path. */
*tail++ = '\\';
src++;
if (src[1] == '.' && isdirsep (src[2]))
{
*tail++ = '\\';
*tail++ = '.';
src += 2;
}
}
}
else if (!isdrive(src) && *src != '/')
if (tail == dst && !isdrive(src) && isdirsep (*src))
{
if (beg_src_slash)
tail += cygheap->cwd.get_drive (dst);