prefix.c (update_path): Don't zap single `.' path components unless followed by anoth...
authorAlan Modra <amodra@bigpond.net.au>
Fri, 19 Jul 2002 13:24:55 +0000 (13:24 +0000)
committerAlan Modra <amodra@gcc.gnu.org>
Fri, 19 Jul 2002 13:24:55 +0000 (22:54 +0930)
* prefix.c (update_path): Don't zap single `.' path components
unless followed by another `.' and fix typo last patch.

From-SVN: r55586

gcc/ChangeLog
gcc/prefix.c

index bf1171f90b4d30abb3bfe512e69eb9ffe41e505c..7e943e4affe95bc92ae08e51e0be3e42bb88c946 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * prefix.c (update_path): Don't zap single `.' path components
+       unless followed by another `.' and fix typo last patch.
+
 2002-07-18  Neil Booth  <neil@daikokuya.co.uk>
 
        * cppexp.c (cpp_num_mul): Remove unused parameter.
index c8f0b98feb40193e481a4f2e845c55c0b13664e9..18f79987a34e8284b1e87f4ee5a1d03cbe4b1449 100644 (file)
@@ -284,7 +284,8 @@ update_path (path, key)
       p = strchr (p, '.');
       if (p == NULL)
        break;
-      /* Get rid of a leading `./' and replace `/./' with `/'.  */
+      /* Get rid of a leading `./' and replace `/./' with `/', when
+        such components are followed with another `.'.  */
       if (IS_DIR_SEPARATOR (p[1])
          && (p == result || IS_DIR_SEPARATOR (p[-1])))
        {
@@ -292,9 +293,14 @@ update_path (path, key)
          /* Be careful about .//foo  */
          while (IS_DIR_SEPARATOR (*src))
            ++src;
-         dest = p;
-         while ((*dest++ = *src++) != 0)
-           ;
+         if (*src == '.')
+           {
+             dest = p;
+             while ((*dest++ = *src++) != 0)
+               ;
+           }
+         else
+           ++p;
        }
       /* Look for `/../'  */
       else if (p[1] == '.'
@@ -316,7 +322,7 @@ update_path (path, key)
              dest = p - 1;
              while (dest != result && IS_DIR_SEPARATOR (*dest))
                --dest;
-             while (dest != result && IS_DIR_SEPARATOR (dest[-1]))
+             while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
                --dest;
              /* Don't strip leading `/'.  */
              while (IS_DIR_SEPARATOR (*dest))