aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorEli Zaretskii2015-05-20 18:18:33 +0300
committerEli Zaretskii2015-05-20 18:18:33 +0300
commite1890e3e829665a54f04284f4e23bd0fd37de06b (patch)
tree1e752c8c1b671a728c03d18418e32a56a6d66c85 /lib-src
parent1a17b775b6bd476c051ae5ef00b752aacb6cf103 (diff)
downloademacs-e1890e3e829665a54f04284f4e23bd0fd37de06b.tar.gz
emacs-e1890e3e829665a54f04284f4e23bd0fd37de06b.zip
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.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 7bacbd3e619..0a308c1984f 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -6484,7 +6484,6 @@ static void
6484canonicalize_filename (register char *fn) 6484canonicalize_filename (register char *fn)
6485{ 6485{
6486 register char* cp; 6486 register char* cp;
6487 char sep = '/';
6488 6487
6489#ifdef DOS_NT 6488#ifdef DOS_NT
6490 /* Canonicalize drive letter case. */ 6489 /* Canonicalize drive letter case. */
@@ -6492,19 +6491,33 @@ canonicalize_filename (register char *fn)
6492 if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0])) 6491 if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0]))
6493 fn[0] = lowcase (fn[0]); 6492 fn[0] = lowcase (fn[0]);
6494 6493
6495 sep = '\\'; 6494 /* Collapse multiple forward- and back-slashes into a single forward
6496#endif 6495 slash. */
6496 for (cp = fn; *cp != '\0'; cp++, fn++)
6497 if (*cp == '/' || *cp == '\\')
6498 {
6499 *fn = '/';
6500 while (cp[1] == '/' || cp[1] == '\\')
6501 cp++;
6502 }
6503 else
6504 *fn = *cp;
6505
6506#else /* !DOS_NT */
6497 6507
6498 /* Collapse multiple separators into a single slash. */ 6508 /* Collapse multiple slashes into a single slash. */
6499 for (cp = fn; *cp != '\0'; cp++, fn++) 6509 for (cp = fn; *cp != '\0'; cp++, fn++)
6500 if (*cp == sep) 6510 if (*cp == '/')
6501 { 6511 {
6502 *fn = '/'; 6512 *fn = '/';
6503 while (cp[1] == sep) 6513 while (cp[1] == '/')
6504 cp++; 6514 cp++;
6505 } 6515 }
6506 else 6516 else
6507 *fn = *cp; 6517 *fn = *cp;
6518
6519#endif /* !DOS_NT */
6520
6508 *fn = '\0'; 6521 *fn = '\0';
6509} 6522}
6510 6523