summaryrefslogtreecommitdiff
path: root/read.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1992-10-12 17:35:43 +0000
committerRoland McGrath <roland@redhat.com>1992-10-12 17:35:43 +0000
commit81acf8675a81b4eec50c7e8177229429b37ce2ba (patch)
tree3bb1af2fd302e659987101bb38ff7a0503b9c671 /read.c
parentf31ff1c1c4a819864ed498285f9e84bec6e4501f (diff)
downloadgunmake-81acf8675a81b4eec50c7e8177229429b37ce2ba.tar.gz
Formerly read.c.~39~
Diffstat (limited to 'read.c')
-rw-r--r--read.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/read.c b/read.c
index d6cffbf..544d2c5 100644
--- a/read.c
+++ b/read.c
@@ -1385,11 +1385,24 @@ parse_file_seq (stringp, stopchar, size, strip)
p--;
if (strip)
- while (q[0] == '.' && q[1] == '/' && q[2] != '\0' && !isblank (q[2]))
- q += 2;
+ {
+ /* Skip leading `./'s. */
+ while (p - q > 2 && q[0] == '.' && q[1] == '/')
+ {
+ q += 2; /* Skip "./". */
+ while (q < p && *q == '/')
+ /* Skip following slashes: ".//foo" is "foo", not "/foo". */
+ ++q;
+ }
+ }
/* Extract the filename just found, and skip it. */
- name = savestring (q, p - q);
+
+ if (q == p)
+ /* ".///" was stripped to "". */
+ name = savestring ("./", 2);
+ else
+ name = savestring (q, p - q);
/* Add it to the front of the chain. */
new1 = (struct nameseq *) xmalloc (size);