(relative_filename): Treat "///" like "/" in filenames.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 29 May 2008 20:18:07 +0000 (20:18 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 29 May 2008 20:18:07 +0000 (20:18 +0000)
lib-src/ChangeLog
lib-src/etags.c

index 2dd6fb6..dc0d597 100644 (file)
@@ -1,3 +1,7 @@
+2008-05-29  Tom Tromey  <tromey@redhat.com>
+
+       * etags.c (relative_filename): Treat "///" like "/" in filenames.
+
 2008-05-09  Eli Zaretskii  <eliz@gnu.org>
 
        * ntlib.c: Include sys/types.h, sys/stat.h, and errno.h.
index d18ee6c..675e926 100644 (file)
@@ -6790,8 +6790,14 @@ relative_filename (file, dir)
 
   /* Build a sequence of "../" strings for the resulting relative file name. */
   i = 0;
+  while (*dp == '/')
+    ++dp;
   while ((dp = etags_strchr (dp + 1, '/')) != NULL)
-    i += 1;
+    {
+      i += 1;
+      while (*dp == '/')
+       ++dp;
+    }
   res = xnew (3*i + strlen (fp + 1) + 1, char);
   res[0] = '\0';
   while (i-- > 0)