From 8ce5bc05bcf9b263a65eb6e8d6bae0e610a88b16 Mon Sep 17 00:00:00 2001 From: tjg Date: Mon, 1 Oct 2001 12:54:26 +0000 Subject: Bug: it's no longer possible to use parentheses to sneak a word that needs quoting past the "quoting detector", so `fn x { echo $(x.y) }' now works both in the current rc and its descendants. --- footobar.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'footobar.c') diff --git a/footobar.c b/footobar.c index 70f8295..14e052e 100644 --- a/footobar.c +++ b/footobar.c @@ -52,8 +52,6 @@ static bool Tconv(Format *f, int ignore) { return FALSE; } switch (n->type) { - case nWord: fmtprint(f, "%S", n->u[0].s); break; - case nQword: fmtprint(f, "%#S", n->u[0].s); break; case nBang: fmtprint(f, "!%T", n->u[0].p); break; case nCase: fmtprint(f, "case %T", n->u[0].p); break; case nNowait: fmtprint(f, "%T&", n->u[0].p); break; @@ -73,11 +71,14 @@ static bool Tconv(Format *f, int ignore) { case nLappend: fmtprint(f, "(%T %T)", n->u[0].p, n->u[1].p); break; case nForin: fmtprint(f, "for(%T in %T)%T", n->u[0].p, n->u[1].p, n->u[2].p); break; case nVarsub: fmtprint(f, "$%T(%T)", n->u[0].p, n->u[1].p); break; + case nWord: + fmtprint(f, quotep(n->u[0].s) ? "%#S" : "%S", n->u[0].s); + break; case nCount: case nFlat: case nVar: { char *lp = "", *rp = ""; Node *n0 = n->u[0].p; - if (n0->type != nWord && n0->type != nQword) + if (n0->type != nWord) lp = "(", rp = ")"; switch (n->type) { -- cgit v1.2.3