tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

make: exists(some/dir/)



Another simple fix.

.if exists(${.CURDIR}/)

fails, where

.if exists(${.CURDIR}/.)

works fine.

The patch would be even simpler, but for that stuff bounded 
by #ifdef notdef

Index: dir.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/dir.c,v
retrieving revision 1.62
diff -u -p -r1.62 dir.c
--- dir.c       27 Nov 2010 05:02:35 -0000      1.62
+++ dir.c       4 Mar 2011 16:29:04 -0000
@@ -1061,6 +1061,7 @@ Dir_FindFile(const char *name, Lst path)
     Boolean      hasSlash;             /* true if 'name' contains a / */
     struct stat          stb;                  /* Buffer for stat, if 
necessary */
     Hash_Entry   *entry;               /* Entry for mtimes table */
+    const char   *trailing_dot = ".";
 
     /*
      * Find the final component of the name and note whether it has a
@@ -1165,6 +1166,11 @@ Dir_FindFile(const char *name, Lst path)
        return NULL;
     }
 
+    if (*cp == '\0') {
+       /* we were given a trailing "/" */
+       cp = trailing_dot;
+    }
+
     if (name[0] != '/') {
        Boolean checkedDot = FALSE;
 
@@ -1272,6 +1278,10 @@ Dir_FindFile(const char *name, Lst path)
      * b/c we added it here. This is not good...
      */
 #ifdef notdef
+    if (cp == traling_dot) {
+       cp = strrchr(name, '/');
+       cp += 1;
+    }
     cp[-1] = '\0';
     (void)Dir_AddDir(path, name);
     cp[-1] = '/';


Home | Main Index | Thread Index | Old Index