summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-05-13 10:47:55 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-05-13 10:47:55 +0000
commite593cce383313f22164de5d39d8b35cb5b548e02 (patch)
tree81c225c043963f65f1daf1335adb98eb632c6555
parenta99b03f3e2a8fbddb3f70c106f0f1ed17c0613e8 (diff)
fix loopvar debug prints. Issue reported by naddy@
-rw-r--r--usr.bin/make/for.c7
-rw-r--r--usr.bin/make/var.c8
-rw-r--r--usr.bin/make/var.h1
3 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c
index 7652dee3ad1..49126f66c32 100644
--- a/usr.bin/make/for.c
+++ b/usr.bin/make/for.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: for.c,v 1.39 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: for.c,v 1.40 2009/05/13 10:47:54 espie Exp $ */
/* $NetBSD: for.c,v 1.4 1996/11/06 17:59:05 christos Exp $ */
/*
@@ -176,7 +176,8 @@ For_Eval(const char *line)
LstNode ln;
(void)fprintf(stderr, "For: Iterator ");
for (ln = Lst_First(&arg->vars); ln != NULL; ln = Lst_Adv(ln))
- (void)fprintf(stderr, "%s ", (char *)Lst_Datum(ln));
+ (void)fprintf(stderr, "%s ",
+ Var_LoopVarName(Lst_Datum(ln)));
(void)fprintf(stderr, "List %s\n", sub);
}
@@ -248,7 +249,7 @@ ForExec(void *valuep, void *argp)
if (DEBUG(FOR))
(void)fprintf(stderr, "--- %s = %s\n",
- (char *)Lst_Datum(arg->var), value);
+ Var_LoopVarName(Lst_Datum(arg->var)), value);
Buf_Init(&buf, arg->guess);
Var_SubstVar(&buf, arg->text, Lst_Datum(arg->var), value);
if (arg->freeold)
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 4e29d9ecfdb..15b297dc47d 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: var.c,v 1.84 2008/11/09 12:34:47 tobias Exp $ */
+/* $OpenBSD: var.c,v 1.85 2009/05/13 10:47:54 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@@ -1093,6 +1093,12 @@ Var_NewLoopVar(const char *name, const char *ename)
return l;
}
+char *
+Var_LoopVarName(struct LoopVar *v)
+{
+ return v->me->name;
+}
+
void
Var_DeleteLoopVar(struct LoopVar *l)
{
diff --git a/usr.bin/make/var.h b/usr.bin/make/var.h
index f2cf06c59fa..0ef90145e55 100644
--- a/usr.bin/make/var.h
+++ b/usr.bin/make/var.h
@@ -134,6 +134,7 @@ struct LoopVar; /* opaque handle */
struct LoopVar *Var_NewLoopVar(const char *, const char *);
void Var_DeleteLoopVar(struct LoopVar *);
extern void Var_SubstVar(Buffer, const char *, struct LoopVar *, const char *);
+char *Var_LoopVarName(struct LoopVar *);
/* Var_Dump();