Commit e1890e3e authored by Eli Zaretskii's avatar Eli Zaretskii

Fix slash collapsing in etags on MS-Windows

* lib-src/etags.c (canonicalize_filename) [DOS_NT]: Separate the
MS-Windows code from the Posix code, and support collapsing both
forward- and back-slashes on MS-Windows.  Fixes a regression found
by the test suite.
parent 1a17b775
......@@ -6484,7 +6484,6 @@ static void
canonicalize_filename (register char *fn)
{
register char* cp;
char sep = '/';
#ifdef DOS_NT
/* Canonicalize drive letter case. */
......@@ -6492,19 +6491,33 @@ canonicalize_filename (register char *fn)
if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0]))
fn[0] = lowcase (fn[0]);
sep = '\\';
#endif
/* Collapse multiple forward- and back-slashes into a single forward
slash. */
for (cp = fn; *cp != '\0'; cp++, fn++)
if (*cp == '/' || *cp == '\\')
{
*fn = '/';
while (cp[1] == '/' || cp[1] == '\\')
cp++;
}
else
*fn = *cp;
#else /* !DOS_NT */
/* Collapse multiple separators into a single slash. */
/* Collapse multiple slashes into a single slash. */
for (cp = fn; *cp != '\0'; cp++, fn++)
if (*cp == sep)
if (*cp == '/')
{
*fn = '/';
while (cp[1] == sep)
while (cp[1] == '/')
cp++;
}
else
*fn = *cp;
#endif /* !DOS_NT */
*fn = '\0';
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment