]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Formerly file.c.~19~
authorRoland McGrath <roland@redhat.com>
Mon, 12 Oct 1992 18:04:07 +0000 (18:04 +0000)
committerRoland McGrath <roland@redhat.com>
Mon, 12 Oct 1992 18:04:07 +0000 (18:04 +0000)
file.c

diff --git a/file.c b/file.c
index 2e5f73f8e0c2efff76eb445a3c45bd4d76795c19..d516629145d1d59127b203596ee70bc1df3d20cf 100644 (file)
--- 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)