summaryrefslogtreecommitdiffstats
path: root/contrib/bmake
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2013-05-18 13:07:01 +0000
committersjg <sjg@FreeBSD.org>2013-05-18 13:07:01 +0000
commit1fdedca7e37cd7b05b1c1ffa79a292a2580898e8 (patch)
treec1b6f310e31ec2de7aacdd522dae32a4e5f2c372 /contrib/bmake
parent8ed3691e0b34930e7be0f4396b0922077a7e612a (diff)
downloadFreeBSD-src-1fdedca7e37cd7b05b1c1ffa79a292a2580898e8.zip
FreeBSD-src-1fdedca7e37cd7b05b1c1ffa79a292a2580898e8.tar.gz
Var_Delete: expand name to delete if needed.
Diffstat (limited to 'contrib/bmake')
-rw-r--r--contrib/bmake/var.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/contrib/bmake/var.c b/contrib/bmake/var.c
index 13be7d6..bbf7269 100644
--- a/contrib/bmake/var.c
+++ b/contrib/bmake/var.c
@@ -540,11 +540,20 @@ void
Var_Delete(const char *name, GNode *ctxt)
{
Hash_Entry *ln;
-
- ln = Hash_FindEntry(&ctxt->context, name);
+ char *cp;
+
+ if (strchr(name, '$')) {
+ cp = Var_Subst(NULL, name, VAR_GLOBAL, 0);
+ } else {
+ cp = name;
+ }
+ ln = Hash_FindEntry(&ctxt->context, cp);
if (DEBUG(VAR)) {
fprintf(debug_file, "%s:delete %s%s\n",
- ctxt->name, name, ln ? "" : " (not found)");
+ ctxt->name, cp, ln ? "" : " (not found)");
+ }
+ if (cp != name) {
+ free(cp);
}
if (ln != NULL) {
Var *v;
OpenPOWER on IntegriCloud