summaryrefslogtreecommitdiff
path: root/footobar.c
diff options
context:
space:
mode:
authortjg <tjg>2001-10-01 12:54:26 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:19 +0100
commit8ce5bc05bcf9b263a65eb6e8d6bae0e610a88b16 (patch)
treed1e35e9054b5ab6d82c0c277b80da892782b6033 /footobar.c
parent593a3857b992c85038276eb0e4c8aa20d796f3de (diff)
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.
Diffstat (limited to 'footobar.c')
-rw-r--r--footobar.c7
1 files changed, 4 insertions, 3 deletions
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) {