summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1992-10-12 18:04:07 +0000
committerRoland McGrath <roland@redhat.com>1992-10-12 18:04:07 +0000
commitdba6ec5d0c26919fe1bb5892e1fa6feb1f9da337 (patch)
tree407aa3f75eb7b12fabe26dcb8e783e149de2c033
parent953f1c7df06881408e4f3c132c8af332f00245ad (diff)
downloadgunmake-dba6ec5d0c26919fe1bb5892e1fa6feb1f9da337.tar.gz
Formerly file.c.~19~
-rw-r--r--file.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/file.c b/file.c
index 2e5f73f..d516629 100644
--- a/file.c
+++ b/file.c
@@ -50,8 +50,20 @@ lookup_file (name)
if (*name == '\0')
abort ();
+ /* This is also done in parse_file_seq, so this is redundant
+ for names read from makefiles. It is here for names passed
+ on the command line. */
while (name[0] == '.' && name[1] == '/' && name[2] != '\0')
- name += 2;
+ {
+ name += 2;
+ while (*name == '/')
+ /* Skip following slashes: ".//foo" is "foo", not "/foo". */
+ ++name;
+ }
+
+ if (*name == '\0')
+ /* It was all slashes after a dot. */
+ name = "./";
hashval = 0;
for (n = name; *n != '\0'; ++n)
@@ -79,7 +91,22 @@ enter_file (name)
for names read from makefiles. It is here for names passed
on the command line. */
while (name[0] == '.' && name[1] == '/' && name[2] != '\0')
- name += 2;
+ {
+ name += 2;
+ while (*name == '/')
+ /* Skip following slashes: ".//foo" is "foo", not "/foo". */
+ ++name;
+ }
+
+ if (*name == '\0')
+ {
+ /* It was all slashes! Move back to the dot and truncate
+ it after the first slash, so it becomes just "./". */
+ do
+ --name;
+ while (name[0] != '.');
+ name[2] = '\0';
+ }
hashval = 0;
for (n = name; *n != '\0'; ++n)