summaryrefslogtreecommitdiff
path: root/gcc/prefix.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2002-07-19 13:24:55 +0000
committerAlan Modra <amodra@gcc.gnu.org>2002-07-19 22:54:55 +0930
commitc35383cbdf71d91609e075e87f01a18b7f96bb5c (patch)
tree3b24143bd484d1b79ed5da6d0ca2736654271b0d /gcc/prefix.c
parentc42c75bfc4eb02ebecc0d837cf108be92090e23a (diff)
downloadgcc-c35383cbdf71d91609e075e87f01a18b7f96bb5c.tar.gz
prefix.c (update_path): Don't zap single `.' path components unless followed by another `.' and fix...
* prefix.c (update_path): Don't zap single `.' path components unless followed by another `.' and fix typo last patch. From-SVN: r55586
Diffstat (limited to 'gcc/prefix.c')
-rw-r--r--gcc/prefix.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/prefix.c b/gcc/prefix.c
index c8f0b98feb4..18f79987a34 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -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))