mirror of
https://github.com/mirror/make.git
synced 2025-01-21 01:30:30 +08:00
Formerly vpath.c.~3~
This commit is contained in:
parent
a8993377f7
commit
019a25fa84
17
vpath.c
17
vpath.c
@ -147,18 +147,18 @@ construct_vpath_list (pattern, dirpath)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip over any initial colons. */
|
/* Skip over any initial colons and blanks. */
|
||||||
p = dirpath;
|
p = dirpath;
|
||||||
while (*p == ':')
|
while (*p == ':' || isblank (*p))
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
/* Figure out the maximum number of VPATH entries and
|
/* Figure out the maximum number of VPATH entries and
|
||||||
put it in MAXELEM. We start with 2, one before the
|
put it in MAXELEM. We start with 2, one before the
|
||||||
first colon and one nil, the list terminator and
|
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;
|
maxelem = 2;
|
||||||
while (*p != '\0')
|
while (*p != '\0')
|
||||||
if (*p++ == ':')
|
if (*p++ == ':' || isblank (*p))
|
||||||
++maxelem;
|
++maxelem;
|
||||||
|
|
||||||
vpath = (char **) xmalloc (maxelem * sizeof (char *));
|
vpath = (char **) xmalloc (maxelem * sizeof (char *));
|
||||||
@ -172,14 +172,14 @@ construct_vpath_list (pattern, dirpath)
|
|||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
||||||
/* Find the next entry. */
|
/* Find the next entry. */
|
||||||
while (*p != '\0' && *p == ':')
|
while (*p != ':' && !isblank (*p))
|
||||||
++p;
|
++p;
|
||||||
if (*p == '\0')
|
if (*p == '\0')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Find the end of this entry. */
|
/* Find the end of this entry. */
|
||||||
v = p;
|
v = p;
|
||||||
while (*p != '\0' && *p != ':')
|
while (*p != '\0' && *p != ':' && !isblank (*p))
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
len = p - v;
|
len = p - v;
|
||||||
@ -192,14 +192,19 @@ construct_vpath_list (pattern, dirpath)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
v = savestring (v, len);
|
v = savestring (v, len);
|
||||||
|
|
||||||
|
/* Verify that the directory actually exists. */
|
||||||
|
|
||||||
if (dir_file_exists_p (v, ""))
|
if (dir_file_exists_p (v, ""))
|
||||||
{
|
{
|
||||||
|
/* It does. Put it in the list. */
|
||||||
vpath[elem++] = dir_name (v);
|
vpath[elem++] = dir_name (v);
|
||||||
free (v);
|
free (v);
|
||||||
if (len > maxvpath)
|
if (len > maxvpath)
|
||||||
maxvpath = len;
|
maxvpath = len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
/* The directory does not exist. Omit from the list. */
|
||||||
free (v);
|
free (v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user