summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-02-13 13:33:56 +0000
committerharti <harti@FreeBSD.org>2005-02-13 13:33:56 +0000
commitf744a83fcdca6dc51a79c0d3d1e3d89de6b5b764 (patch)
tree2cadaf3efab0bd813002d86e82b69e96966b048c /usr.bin
parentd897cc87c57b9a33e25430f3e14b8cc8b40ef6c8 (diff)
downloadFreeBSD-src-f744a83fcdca6dc51a79c0d3d1e3d89de6b5b764.zip
FreeBSD-src-f744a83fcdca6dc51a79c0d3d1e3d89de6b5b764.tar.gz
Back out the previous commit. There is an obvious bug in it.
Pointy hat to: harti
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/main.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 398cd43..f53e1f2 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -805,30 +805,28 @@ main(int argc, char **argv)
* <directory>:<directory>:<directory>...
*/
if (Var_Exists("VPATH", VAR_CMD)) {
+ char *vpath, savec;
/*
* GCC stores string constants in read-only memory, but
* Var_Subst will want to write this thing, so store it
* in an array
*/
static char VPATH[] = "${VPATH}";
- char *vpath;
- char savec;
- char *ptr;
vpath = Var_Subst(NULL, VPATH, VAR_CMD, FALSE);
+ path = vpath;
do {
/* skip to end of directory */
- for (ptr = vpath; *ptr != ':' && *ptr != '\0'; cp++)
- ;
-
+ for (cp = path; *cp != ':' && *cp != '\0'; cp++)
+ continue;
/* Save terminator character so know when to stop */
- savec = *ptr;
- *ptr = '\0';
-
+ savec = *cp;
+ *cp = '\0';
/* Add directory to search path */
- Dir_AddDir(&dirSearchPath, vpath);
- vpath = ptr + 1;
- } while (savec != '\0');
+ Dir_AddDir(&dirSearchPath, path);
+ *cp = savec;
+ path = cp + 1;
+ } while (savec == ':');
free(vpath);
}
OpenPOWER on IntegriCloud