summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/make/compat.c8
-rw-r--r--usr.bin/make/cond.c16
-rw-r--r--usr.bin/make/parse.c18
-rw-r--r--usr.bin/make/suff.c18
-rw-r--r--usr.bin/make/targ.c20
-rw-r--r--usr.bin/make/var.c24
6 files changed, 50 insertions, 54 deletions
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index c90ca26cca7..ddbd32816dd 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat.c,v 1.30 2000/06/23 16:20:01 espie Exp $ */
+/* $OpenBSD: compat.c,v 1.31 2000/06/23 16:21:43 espie Exp $ */
/* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: compat.c,v 1.30 2000/06/23 16:20:01 espie Exp $";
+static char rcsid[] = "$OpenBSD: compat.c,v 1.31 2000/06/23 16:21:43 espie Exp $";
#endif
#endif /* not lint */
@@ -601,11 +601,11 @@ CompatMake(gnp, pgnp)
} else {
if (gn->lineno)
printf("\n\nStop in %s (line %lu of %s).\n",
- Var_Value(".CURDIR", &gn->context),
+ Var_Value(".CURDIR", VAR_GLOBAL),
(unsigned long)gn->lineno,
gn->fname);
else
- printf("\n\nStop in %s.\n", Var_Value(".CURDIR", &gn->context));
+ printf("\n\nStop in %s.\n", Var_Value(".CURDIR", VAR_GLOBAL));
exit (1);
}
} else if (gn->made == ERROR) {
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index 94c789ebb91..4f4d2164ce7 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cond.c,v 1.18 2000/06/17 14:38:14 espie Exp $ */
+/* $OpenBSD: cond.c,v 1.19 2000/06/23 16:21:43 espie Exp $ */
/* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
#else
-static char rcsid[] = "$OpenBSD: cond.c,v 1.18 2000/06/17 14:38:14 espie Exp $";
+static char rcsid[] = "$OpenBSD: cond.c,v 1.19 2000/06/23 16:21:43 espie Exp $";
#endif
#endif /* not lint */
@@ -235,7 +235,7 @@ CondGetArg(linePtr, argPtr, argLen, func, parens)
size_t len;
Boolean doFree;
- cp2 = Var_Parse(cp, VAR_CMD, TRUE, &len, &doFree);
+ cp2 = Var_Parse(cp, NULL, TRUE, &len, &doFree);
Buf_AddString(&buf, cp2);
if (doFree) {
@@ -291,7 +291,7 @@ CondDoDefined(argLen, arg)
Boolean result;
arg[argLen] = '\0';
- if (Var_Value(arg, VAR_CMD) != NULL)
+ if (Var_Value(arg, NULL) != NULL)
result = TRUE;
else
result = FALSE;
@@ -528,7 +528,7 @@ CondToken(doEval)
* value in lhs.
*/
t = Err;
- lhs = Var_Parse(condExpr, VAR_CMD, doEval,&varSpecLen,&doFree);
+ lhs = Var_Parse(condExpr, NULL, doEval,&varSpecLen,&doFree);
if (lhs == var_Error) {
/*
* Even if !doEval, we still report syntax errors, which
@@ -632,7 +632,7 @@ do_string_compare:
size_t len;
Boolean freeIt;
- cp2 = Var_Parse(cp, VAR_CMD, doEval,&len, &freeIt);
+ cp2 = Var_Parse(cp, NULL, doEval,&len, &freeIt);
if (cp2 != var_Error) {
Buf_AddString(&buf, cp2);
if (freeIt) {
@@ -685,7 +685,7 @@ do_string_compare:
size_t len;
Boolean freeIt;
- string = Var_Parse(rhs, VAR_CMD, doEval,&len,&freeIt);
+ string = Var_Parse(rhs, NULL, doEval,&len,&freeIt);
if (string == var_Error) {
right = 0.0;
} else {
@@ -817,7 +817,7 @@ error:
continue;
if (condExpr[arglen] != '\0') {
- val = Var_Parse(&condExpr[arglen - 1], VAR_CMD,
+ val = Var_Parse(&condExpr[arglen - 1], NULL,
doEval, &length, &doFree);
if (val == var_Error) {
t = Err;
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index eed3277a5d4..cab93c52d17 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.47 2000/06/23 16:20:01 espie Exp $ */
+/* $OpenBSD: parse.c,v 1.48 2000/06/23 16:21:43 espie Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: parse.c,v 1.47 2000/06/23 16:20:01 espie Exp $";
+static char rcsid[] = "$OpenBSD: parse.c,v 1.48 2000/06/23 16:21:43 espie Exp $";
#endif
#endif /* not lint */
@@ -838,7 +838,7 @@ ParseDoDependency (line)
Boolean freeIt;
char *result;
- result=Var_Parse(cp, VAR_CMD, TRUE, &length, &freeIt);
+ result=Var_Parse(cp, NULL, TRUE, &length, &freeIt);
if (freeIt) {
free(result);
@@ -858,7 +858,7 @@ ParseDoDependency (line)
* went well and FAILURE if there was an error in the
* specification. On error, line should remain untouched.
*/
- if (Arch_ParseArchive(&line, &targets, VAR_CMD) != SUCCESS) {
+ if (Arch_ParseArchive(&line, &targets, NULL) != SUCCESS) {
Parse_Error (PARSE_FATAL,
"Error in archive specification: \"%s\"", line);
return;
@@ -1246,7 +1246,7 @@ ParseDoDependency (line)
* expansion */
Lst_Init(&sources);
- if (Arch_ParseArchive(&line, &sources, VAR_CMD) != SUCCESS) {
+ if (Arch_ParseArchive(&line, &sources, NULL) != SUCCESS) {
Parse_Error (PARSE_FATAL,
"Error in source archive spec \"%s\"", line);
return;
@@ -1526,7 +1526,7 @@ Parse_DoVar (line, ctxt)
* expansion on the whole thing. The resulting string will need
* freeing when we're done, so set freeCmd to TRUE.
*/
- cp = Var_Subst(cp, VAR_CMD, TRUE);
+ cp = Var_Subst(cp, NULL, TRUE);
freeCmd = TRUE;
}
@@ -1691,7 +1691,7 @@ ParseDoInclude (file)
* Substitute for any variables in the file name before trying to
* find the thing.
*/
- file = Var_Subst(file, VAR_CMD, FALSE);
+ file = Var_Subst(file, NULL, FALSE);
/*
* Now we know the file's name and its search path, we attempt to
@@ -1893,7 +1893,7 @@ ParseTraditionalInclude (file)
* Substitute for any variables in the file name before trying to
* find the thing.
*/
- file = Var_Subst(file, VAR_CMD, FALSE);
+ file = Var_Subst(file, NULL, FALSE);
/*
* Now we know the file's name, we attempt to find the durn thing.
@@ -2561,7 +2561,7 @@ Parse_File(name, stream)
#endif
ParseFinishLine();
- cp = Var_Subst(line, VAR_CMD, TRUE);
+ cp = Var_Subst(line, NULL, TRUE);
free (line);
line = cp;
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index b642ac3c367..0050a68be41 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: suff.c,v 1.33 2000/06/23 16:20:01 espie Exp $ */
+/* $OpenBSD: suff.c,v 1.34 2000/06/23 16:21:43 espie Exp $ */
/* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#else
-static char rcsid[] = "$OpenBSD: suff.c,v 1.33 2000/06/23 16:20:01 espie Exp $";
+static char rcsid[] = "$OpenBSD: suff.c,v 1.34 2000/06/23 16:21:43 espie Exp $";
#endif
#endif /* not lint */
@@ -1595,10 +1595,6 @@ SuffFindArchiveDeps(gn, slst)
char *eoarch; /* End of archive portion */
char *eoname; /* End of member portion */
GNode *mem; /* Node for member */
- static char *copy[] = { /* Variables to be copied from the member node */
- TARGET, /* Must be first */
- PREFIX, /* Must be second */
- };
int i; /* Index into copy and vals */
Suff *ms; /* Suffix descriptor for member */
char *name; /* Start of member's name */
@@ -1636,13 +1632,9 @@ SuffFindArchiveDeps(gn, slst)
gn->unmade += 1;
}
- /*
- * Copy in the variables from the member node to this one.
- */
- for (i = (sizeof(copy)/sizeof(copy[0]))-1; i >= 0; i--) {
- Var_Set(copy[i], Var_Value(copy[i], &mem->context), &gn->context);
-
- }
+ /* Copy variables from member node to this one. */
+ Varq_Set(TARGET_INDEX, Varq_Value(TARGET_INDEX, mem), gn);
+ Varq_Set(PREFIX_INDEX, Varq_Value(PREFIX_INDEX, mem), gn);
ms = mem->suffix;
if (ms == NULL) {
diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c
index 21dd8fc0c77..e8b6ab6be3d 100644
--- a/usr.bin/make/targ.c
+++ b/usr.bin/make/targ.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: targ.c,v 1.23 2000/06/23 16:20:01 espie Exp $ */
+/* $OpenBSD: targ.c,v 1.24 2000/06/23 16:21:43 espie Exp $ */
/* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
#else
-static char *rcsid = "$OpenBSD: targ.c,v 1.23 2000/06/23 16:20:01 espie Exp $";
+static char *rcsid = "$OpenBSD: targ.c,v 1.24 2000/06/23 16:21:43 espie Exp $";
#endif
#endif /* not lint */
@@ -224,14 +224,14 @@ TargFreeGN(gnp)
free(gn->name);
efree(gn->path);
- Lst_Destroy(&gn->iParents, NOFRE);
- Lst_Destroy(&gn->cohorts, NOFRE);
- Lst_Destroy(&gn->parents, NOFRE);
- Lst_Destroy(&gn->children, NOFRE);
- Lst_Destroy(&gn->successors, NOFRE);
- Lst_Destroy(&gn->preds, NOFRE);
- Lst_Destroy(&gn->context, NOFRE);
- Lst_Destroy(&gn->commands, NOFRE);
+ Lst_Destroy(&gn->iParents, NOFREE);
+ Lst_Destroy(&gn->cohorts, NOFREE);
+ Lst_Destroy(&gn->parents, NOFREE);
+ Lst_Destroy(&gn->children, NOFREE);
+ Lst_Destroy(&gn->successors, NOFREE);
+ Lst_Destroy(&gn->preds, NOFREE);
+ Lst_Destroy(&gn->context, NOFREE);
+ Lst_Destroy(&gn->commands, NOFREE);
free(gn);
}
#endif
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index a81660b71eb..19f3d589c91 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.35 2000/06/23 16:20:01 espie Exp $ */
+/* $OpenBSD: var.c,v 1.36 2000/06/23 16:21:44 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@@ -70,7 +70,7 @@
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: var.c,v 1.35 2000/06/23 16:20:01 espie Exp $";
+static char rcsid[] = "$OpenBSD: var.c,v 1.36 2000/06/23 16:21:44 espie Exp $";
#endif
#endif /* not lint */
@@ -385,7 +385,10 @@ VarFind(name, ctxt, flags)
* look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order,
* depending on the FIND_* flags in 'flags'
*/
- var = Lst_Find(ctxt, VarCmp, name);
+ if (ctxt != NULL)
+ var = Lst_Find(ctxt, VarCmp, name);
+ else
+ var = NULL;
if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD))
var = Lst_Find(VAR_CMD, VarCmp, name);
@@ -1541,7 +1544,7 @@ Var_Parse(str, ctxt, err, lengthPtr, freePtr)
if (v == NULL) {
*lengthPtr = 2;
- if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) {
+ if (ctxt == VAR_CMD || ctxt == VAR_GLOBAL || ctxt == NULL) {
/*
* If substituting a local variable in a non-local context,
* assume it's for dynamic source stuff. We have to handle
@@ -1600,8 +1603,9 @@ Var_Parse(str, ctxt, err, lengthPtr, freePtr)
*tstr = '\0';
v = VarFind (str + 2, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
- if ((v == NULL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) &&
- ((tstr-str) == 4) && (str[3] == 'F' || str[3] == 'D'))
+ if (v == NULL && ctxt != VAR_CMD && ctxt != VAR_GLOBAL &&
+ ctxt != NULL &&
+ (tstr-str) == 4 && (str[3] == 'F' || str[3] == 'D'))
{
/*
* Check for bogus D and F forms of local variables since we're
@@ -1653,10 +1657,10 @@ Var_Parse(str, ctxt, err, lengthPtr, freePtr)
}
if (v == NULL) {
- if ((((tstr-str) == 3) ||
- ((((tstr-str) == 4) && (str[3] == 'F' ||
+ if ((tstr-str == 3 ||
+ ((tstr-str == 4 && (str[3] == 'F' ||
str[3] == 'D')))) &&
- ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)))
+ (ctxt == VAR_CMD || ctxt == VAR_GLOBAL || ctxt == NULL))
{
/*
* If substituting a local variable in a non-local context,
@@ -1677,7 +1681,7 @@ Var_Parse(str, ctxt, err, lengthPtr, freePtr)
}
} else if (((tstr-str) > 4) && (str[2] == '.') &&
isupper((unsigned char) str[3]) &&
- ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)))
+ (ctxt == VAR_CMD || ctxt == VAR_GLOBAL || ctxt == NULL))
{
int len;