Subject: Re: printing expanded variables?
To: Alan Barrett <apb@cequrux.com>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 09/04/2003 14:46:48
>On second thoughts, I agree with Greg.
> make -V '${FUBAR}'
As you said, this is trivial. I actually look for a $ anywhere
so that
make -V 'PATH=${LIST:ts:}'
works.
--sjg
@@ -912,9 +912,14 @@ main(int argc, char **argv)
for (ln = Lst_First(variables); ln != NILLNODE;
ln = Lst_Succ(ln)) {
- char *value = Var_Value((char *)Lst_Datum(ln),
- VAR_GLOBAL, &p1);
-
+ char *var = (char *)Lst_Datum(ln);
+ char *value;
+
+ if (strchr(var, '$')) {
+ value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, 0)
;
+ } else {
+ value = Var_Value(var, VAR_GLOBAL, &p1);
+ }
printf("%s\n", value ? value : "");
if (p1)
free(p1);