summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1992-11-05 23:33:08 +0000
committerRoland McGrath <roland@redhat.com>1992-11-05 23:33:08 +0000
commit019a25fa8415ecccdf944c5ca225beafb70433c1 (patch)
tree8f1ab61b830dae64bc6df129fab4bbbcdf13445a
parenta8993377f75e6a0593bcaf9ce5ee3d7dac1e6eec (diff)
downloadgunmake-019a25fa8415ecccdf944c5ca225beafb70433c1.tar.gz
Formerly vpath.c.~3~
-rw-r--r--vpath.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/vpath.c b/vpath.c
index 40d92e3..1b9109b 100644
--- a/vpath.c
+++ b/vpath.c
@@ -147,18 +147,18 @@ construct_vpath_list (pattern, dirpath)
return;
}
- /* Skip over any initial colons. */
+ /* Skip over any initial colons and blanks. */
p = dirpath;
- while (*p == ':')
+ while (*p == ':' || isblank (*p))
++p;
/* Figure out the maximum number of VPATH entries and
put it in MAXELEM. We start with 2, one before the
first colon and one nil, the list terminator and
- increment our estimated number for each colon we find. */
+ increment our estimated number for each colon or blank we find. */
maxelem = 2;
while (*p != '\0')
- if (*p++ == ':')
+ if (*p++ == ':' || isblank (*p))
++maxelem;
vpath = (char **) xmalloc (maxelem * sizeof (char *));
@@ -172,14 +172,14 @@ construct_vpath_list (pattern, dirpath)
unsigned int len;
/* Find the next entry. */
- while (*p != '\0' && *p == ':')
+ while (*p != ':' && !isblank (*p))
++p;
if (*p == '\0')
break;
/* Find the end of this entry. */
v = p;
- while (*p != '\0' && *p != ':')
+ while (*p != '\0' && *p != ':' && !isblank (*p))
++p;
len = p - v;
@@ -192,14 +192,19 @@ construct_vpath_list (pattern, dirpath)
continue;
v = savestring (v, len);
+
+ /* Verify that the directory actually exists. */
+
if (dir_file_exists_p (v, ""))
{
+ /* It does. Put it in the list. */
vpath[elem++] = dir_name (v);
free (v);
if (len > maxvpath)
maxvpath = len;
}
else
+ /* The directory does not exist. Omit from the list. */
free (v);
}