diff options
author | Roland McGrath <roland@redhat.com> | 1992-11-10 20:29:48 +0000 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 1992-11-10 20:29:48 +0000 |
commit | 2fbb3407dded7bbc4bbaa0fd6fdbe39a38cbd845 (patch) | |
tree | 8343f4f18f839f865c4bf598c9bd7e18e0a561be /vpath.c | |
parent | 9d58debbcc78354081ccb7c3c19027b28448eae1 (diff) | |
download | gunmake-2fbb3407dded7bbc4bbaa0fd6fdbe39a38cbd845.tar.gz |
Formerly vpath.c.~4~
Diffstat (limited to 'vpath.c')
-rw-r--r-- | vpath.c | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -147,11 +147,6 @@ construct_vpath_list (pattern, dirpath) return; } - /* Skip over any initial colons and blanks. */ - p = dirpath; - 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 @@ -164,19 +159,17 @@ construct_vpath_list (pattern, dirpath) vpath = (char **) xmalloc (maxelem * sizeof (char *)); maxvpath = 0; - elem = 0; + /* Skip over any initial colons and blanks. */ p = dirpath; + while (*p == ':' || isblank (*p)) + ++p; + + elem = 0; while (*p != '\0') { char *v; unsigned int len; - /* Find the next entry. */ - while (*p != ':' && !isblank (*p)) - ++p; - if (*p == '\0') - break; - /* Find the end of this entry. */ v = p; while (*p != '\0' && *p != ':' && !isblank (*p)) @@ -206,6 +199,10 @@ construct_vpath_list (pattern, dirpath) else /* The directory does not exist. Omit from the list. */ free (v); + + /* Skip over colons and blanks between entries. */ + while (*p == ':' || isblank (*p)) + ++p; } if (elem > 0) |