diff options
Diffstat (limited to 'var.c')
-rw-r--r-- | var.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $ */ +/* $NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $"); +__RCSID("$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -529,11 +529,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 = (char *)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; |